KhronosGroup / KhronosGroup/SPIRV-LLVM-Translator

Hiden regresion on OpImageWrite

Open
#1,645 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
LLVM
Stars
625
Forks
279
Avg merge
3d 5h
Merged PRs (30d)
34

Description

Commit https://github.com/KhronosGroup/SPIRV-LLVM-Translator/commit/b3e10f5844a432716a9214ef341499d2861e146b caused a regression on OpenCL instruction
`write_imagei(image_wo, (int4)(0,0,0,0), (int4)(0,0,0,0));`

Without the above commit SPV-IR is
call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_2_0_0_0_0_0_1Dv4_iS2_
with the above commit SPV-IR is
call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_2_0_0_0_0_0_1Dv4_iS2_i

This is out of specification https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#Image_Operands
When LoD is not specified in `write_imagei` instruction then Image Operands must not be specified at all.
The correct behavior was before commit https://github.com/KhronosGroup/SPIRV-LLVM-Translator/commit/b3e10f5844a432716a9214ef341499d2861e146b

This regression was undetected because the test https://github.com/KhronosGroup/SPIRV-LLVM-Translator/blob/llvm_release_140/test/transcoding/OpImageWrite.cl lacks opening brackets in `// CHECK-SPV-IR:`
Should be this:
`// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_2_0_0_0_0_0_1Dv4_iS2_(`
instead of this:
`// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_2_0_0_0_0_0_1Dv4_iS2_`

I see that commit https://github.com/KhronosGroup/SPIRV-LLVM-Translator/commit/b3e10f5844a432716a9214ef341499d2861e146b is backmerge of https://github.com/KhronosGroup/SPIRV-LLVM-Translator/commit/bb4ead0d84870afe1f6f4ce829ba985b1b7950c7 therefore I suspect that this error is also on the main branch.
I also suspect that the regression could be on other OpImage* instructions that do not use LoD.

Contributor guide

Open the contributing guide

Research direction

Start with test/transcoding/OpImageWrite.cl and compare its CHECK-SPV-IR pattern with the expected signature described here. Reproduce the write_imagei case around commits b3e10f5844a432716a9214ef341499d2861e146b and bb4ead0d84870afe1f6f4ce829ba985b1b7950c7. Check whether related OpImage* instructions without LoD show the same regression; done means the test detects the invalid operand and the affected cases produce the specified signature.

Written by the indexing model from the issue text.

Assessment

Domain
compilers, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.