-
Notifications
You must be signed in to change notification settings - Fork 597
spirv-val: Validate zero product workgroup size #5407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
spirv-val: Validate zero product workgroup size #5407
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still thinking about the change to save execution mode instructions. I'm not so sure about that.
@alan-baker Any more thoughts? |
1350f1d
to
2e9855d
Compare
@alan-baker I found there was a I redid this PR (force pushed), its in 3 commits now for easier viewing as well |
@alan-baker @s-perron I see an issue with this patch - as far as I can judge. It introduces a check for However, OpenCL imposes different requirements, documented here: https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_Env.html#_built_in_variables This change in spirv-val leads to fails in four tests cases in SPIR-V Backend (see llvm/llvm-project#122162 (comment)), intended for the OpenCL/SYCL environment. At the same time, those test cases are valid in generating something of the kind
after invoking Please validate my reasoning. What do you think? |
@VyacheslavLevytskyy happy to help here (just lack OpenCL SPIR-V knowledge), can you show me what the OpenCL looks like that is triggering this (I can't get an error with https://godbolt.org/z/qYo61or9z) |
Thank you! Please have a look at test cases: https://github.com/llvm/llvm-project/tree/main/llvm/test/CodeGen/SPIRV/pointers/type-deduce-sycl-stub.ll I have no OpenCL equivalent for them. They would fail after executing
|
Probably there we see still the previous spirv-val version before this changes are applied? |
I think there are 2 things to fix:
|
The compiler-explorer uses ToT SPIRV-Tools
This should probably be an issue, and someone with the knowledge of the nuances how OpenCL does workgroup size check should either do it, or at least give me some sample SPIR-V to add as test cases |
@s-perron I created llvm/llvm-project#122755 |
@spencer-lunarg Here the sample SPIR-V
|
… WorkgroupSize variable (#122755) KhronosGroup/SPIRV-Tools#5407 introduces a check for WorkgroupSize variable to be a 3-component 32-bit int vector, and indeed, we see this requirement in https://registry.khronos.org/vulkan/specs/latest/man/html/WorkgroupSize.html#VUID-WorkgroupSize-WorkgroupSize-04427 However, OpenCL imposes different requirements, documented here: https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_Env.html#_built_in_variables OpenCL environment requires WorkgroupSize variable to have components of size_t size that will be 32 or 64 depending on a target. This is the way how the SPIR-V Backend implements this, by querying pointer size of the current platform/target. To allow spirv-val to account target environments difference, this PR adds `--target-env <env>` to test cases referring to the BuiltIn WorkgroupSize variable.
@spencer-lunarg Was my example helpful? Please let me know if I can help anyhow. Also if you can please estimate how soon we may get the resolution of this problem this would help me to decide if we need to wait for the fix a bit or to mark 4 failing test cases as XFAIL right now. |
@VyacheslavLevytskyy example was good, got a fix up an hour ago - #5940 |
thank you! |
…the BuiltIn WorkgroupSize variable (#122755) KhronosGroup/SPIRV-Tools#5407 introduces a check for WorkgroupSize variable to be a 3-component 32-bit int vector, and indeed, we see this requirement in https://registry.khronos.org/vulkan/specs/latest/man/html/WorkgroupSize.html#VUID-WorkgroupSize-WorkgroupSize-04427 However, OpenCL imposes different requirements, documented here: https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_Env.html#_built_in_variables OpenCL environment requires WorkgroupSize variable to have components of size_t size that will be 32 or 64 depending on a target. This is the way how the SPIR-V Backend implements this, by querying pointer size of the current platform/target. To allow spirv-val to account target environments difference, this PR adds `--target-env <env>` to test cases referring to the BuiltIn WorkgroupSize variable.
Improved version of #4828
closes #4801
Created a
EntryPointData
reduce number of hash maps with theentry_point_id
as the key