Skip to content

Conversation

bashbaug
Copy link
Contributor

fixes #854

The OpenCL SPIR-V environment spec currently says that image write instructions must not include an optional Image Operand. While this was borderline true in the past - there was no usage with core OpenCL functionality, but it was used by cl_khr_mipmap_image_writes to pass the Lod - it is definitely no longer true now for things like Nontemporal. So, instead of banning an Image Operand for image write instructions, we can instead apply the same restrictions to image write instructions that we apply to image read instructions.

Additional notes:

@bashbaug
Copy link
Contributor Author

Answering my own question:

  • I don't see any tests that pass the optional Image Operand SignExtend or ZeroExtend to OpImageWrite, either in the CTS or in the SPIR-V LLVM Translator tests. Is this something we should add, or am I just not finding it?

I don't think this is necessary. For the integer image formats, the data we pass to OpImageWrite is always a 32-bit integer, at least currently: https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_Env.html#_data_format_for_reading_and_writing_images

Since we don't support image formats with channel data bigger than 32-bits, there is no need to sign extend or zero extend.

Tagging @svenh for confirmation, since SignExtend and ZeroExtend were explicitly mentioned as operands to OpImageWrite in #854.

@github-project-automation github-project-automation bot moved this from In progress to Reviewer approved in OpenCL specification maintenance Sep 2, 2025
@bashbaug
Copy link
Contributor Author

bashbaug commented Sep 2, 2025

Merging as discussed in the September 2nd teleconference.

@bashbaug bashbaug merged commit 81e4448 into KhronosGroup:main Sep 2, 2025
2 checks passed
@github-project-automation github-project-automation bot moved this from Reviewer approved to Done in OpenCL specification maintenance Sep 2, 2025
@bashbaug bashbaug deleted the spirv-image-operands branch September 2, 2025 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Relax "OpImageWrite does not allow any Image Operands"?
2 participants