-
Notifications
You must be signed in to change notification settings - Fork 756
[SPIR-V] generated SPIR-V is invalid: [VUID-StandaloneSpirv-OpTypeImage-06924] Cannot store to OpTypeImage, OpTypeSampler, OpTypeSampledImage, or OpTypeAccelerationStructureKHR objects #7181
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
Comments
I get the same error on code |
Can you provide a shader that reproduces this issue? This type of error typically happens because the optimizer failed to copy propagate the temporaries that stored the opaque types like the images and samplers. Without a specific example, I cannot tell why it did not optimize. Considering that the debug info makes a difference, it could be that an extension is added that turns off optimization. If you can't provide a specific example, please compile with |
Yes I can. How can I send it to you (I am not allowed to make the shader public) ? |
If you can't make the shader public, then I probably can't accept it privately unless you have NDA in place with Google. I cannot accept your secrets. Can you make the extensions public? That is most likely the problem. EDIT changed to "can't accept it" |
Yes I simply don't want to publish it here, but can send it to you per email? |
I can also upload it on our server, and send you the link. Let me know when you are available to download... |
Could you try running:
I added |
please download the repro case here: http://www.imagine3d.fr/_temp/dxc_bugs.rar and let me know as soon as you've downloaded it ! |
I've removed the link, let me know once you are ready to download (or drop me an email [email protected]) |
I won't download from the link. The IP issues are too vague for me to be able to do that. You'll have to find something you can make truly public, or try to narrow down the problem yourself. The first thing to try is my suggestion above. |
I'm the founder and CEO of the company. By not allowed, I meant I don't want the code to be available to everyone. There is nothing fancy in the code, but it's not an open source software either. I'm happy for you to get your hands on it in order to fix the issue. Just drop me an email and I'll send it to you |
I'll have to see what our legal team says about it. |
Dear, why so much complexity... |
attached the output when compiling the shader with the additional -Vd parameter |
That's the output without the -Vd parameter: dxc.exe mipmap_gen_previousframecolor.hlsl -E maincomp -T cs_6_0 -spirv -fspv-target-env=vulkan1.1 -Wall -Wno-unused-const-variable -D imBINDLESS=0 -fspv-extension=SPV_KHR_non_semantic_info -fspv-debug=vulkan-with-source -fspv-extension=SPV_EXT_descriptor_indexing >> output_novd.txt note: please file a bug report on https://github.com/Microsoft/DirectXShaderCompiler/issues with source code if possible |
Hello, It is a compute shader with inline ray tracing.
|
I'll try to take a look next week. Possibly not the same issue as @gjaegy's. Hopefully it is. |
The SPV_GOOGLE_user_type extension was not added to one of the allow list. Adding it now. Part of microsoft/DirectXShaderCompiler#7181.
I have a fix for @TheMostDiligent's issue. The missing extension was inserted because of |
The part of the code that I fixed had not changed, so does not show me why it regressed. I'll try to track down the change that caused the regression. That might point to something else. |
The "regression" was caused by KhronosGroup/SPIRV-Tools#5368. The code DXC was generating was always invalid. The difference is that the validator now recognizes that it is invalid. As a workaround you can compile with To fix the issue more or different optimizations are needed to properly legalize the code. Without seeing the code, I cannot determine what is needed. @gjaegy Since this is an optimization problem, we could also try getting a reduced SPIR-V test case that will not give away any trade secrets. Here are the steps you can follow:
Hopefully you can post the disassembly of |
So is the fix on DXC or SPIRV-Tools side? If the code DXC produces is valid, then the issue should be fixed on SPIRV-Tools side? |
@TheMostDiligent For your test case, the fix is an improvement to the optimizer: KhronosGroup/SPIRV-Tools#6075. After that, the validator will no longer complain. |
The SPV_GOOGLE_user_type extension was not added to one of the allow list. Adding it now. Part of microsoft/DirectXShaderCompiler#7181.
Again, I'm happy to share the HLSL, there is nothing fancy about it. Simply drop me an email and I'll send it to you. Otherwise I'll try to follow the steps you've mentioned above. |
Actually I have no linux system available in the office. And running the "spirv-opt" command leads to an error (error: line 0: Invalid SPIR-V magic number '5053203b'). Attached the source shader files. Rename the file to 7181.rar and extract the files. The command line used is the following one:
|
Thanks for that. Here is a small reproducer: https://godbolt.org/z/shcsf4E8r. If the The issue seems in the spirv-opt pass copy-propagate-arrays. That pass will try to replace the image operand in the OpImageTexelPointer instruction another if on is a copy of the other. In this case is fails because the operand in the OpImageTexelPointer is also used in a debug instruction. The pass does not know what to do with that. I should be able to update the pass to not consider debug instructions as bad uses. |
Great news ! |
When checking if a variable is possibly stored to, debug instructions fall into the default case, which assumes it could be a store. We add a specific check for debug instruction, which are not stores. See microsoft/DirectXShaderCompiler#7181
When checking if a variable is possibly stored to, debug instructions fall into the default case, which assumes it could be a store. We add a specific check for debug instruction, which are not stores. See microsoft/DirectXShaderCompiler#7181
…6078) When checking if a variable is possibly stored to, debug instructions fall into the default case, which assumes it could be a store. We add a specific check for debug instruction, which are not stores. See microsoft/DirectXShaderCompiler#7181
Description
Invalid SPIR-V is generated with the latest release and with head, when compiling with debug
Steps to Reproduce
Compile with the following command:
dxc.exe mipmap_gen_envmap.hlsl -E maincomp -T cs_6_0 -spirv -fspv-target-env=vulkan1.1 -Wall -Wno-unused-const-variable -D imBINDLESS=0 -fspv-extension=SPV_KHR_non_semantic_info -fspv-debug=vulkan-with-source -fspv-extension=SPV_EXT_descriptor_indexing
Actual Behavior
fatal error: generated SPIR-V is invalid: [VUID-StandaloneSpirv-OpTypeImage-06924] Cannot store to OpTypeImage, OpTypeSampler, OpTypeSampledImage, or OpTypeAccelerationStructureKHR objects
OpStore %927 %3239
Problem doesn't occur without the "-fspv-debug=vulkan-with-source" option
Environment
Please contact me and I will send you a repro case per email.
The text was updated successfully, but these errors were encountered: