-
Notifications
You must be signed in to change notification settings - Fork 714
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
[SPIR-V] Shader failes to compile when activating debug infos #4911
Comments
Hi! Thanks for complete the report! Was able to reproduce at head with: class MyClass
{
static MyClass my_func()
{
MyClass tmp;
return tmp;
}
};
[numthreads(1, 1, 1)]
void main(uint3 GlobalInvocationID : SV_DispatchThreadID)
{
const uint index = GlobalInvocationID[0];
MyClass::my_func();
}
The issue seems to be linked to the optimizer, and the compact-ids pass, IDs gets rearranged, and the ID ends up being used before being defined: 10747 %26 = OpExtInst %void %1 DebugLexicalBlock %12 %uint_4 %uint_2 %22
10748 %28 = OpExtInst %void %1 DebugLocalVariable %27 %19 %12 %uint_5 %uint_11 %26 %uint_4 10853 %24 = OpExtInst %void %1 DebugTypeFunction %uint_3 %26
[...]
10855 %26 = OpExtInst %void %1 DebugTypeComposite %8 %uint_0 %19 %uint_1 %uint_7 %20 %8 %uint_0 %uint_3 %27 |
Not a compact-ids pass issue, the initial code also contains other debug instructions with IDs defined later on. Also, from other generated spv, the use-before-declaration seems to be OK. Looking into it. |
Hi.
|
Hello! Sorry haven't had much time for DXC. |
The blanket rule for NonSemantic.Shader.DebugInfo.100 is "no forward references". But there is a type-specific rule: DebugTypeComposite members can be forward references: ``` Members must be the <id>s of DebugTypeMember, DebugFunction, or DebugTypeInheritance. This could be a forward reference. ``` This is mandatory to correctly support HLSL class methods: - the composite has a function as member. - the function as the composite as scope. This cycle makes the forward reference mandatory, hence the exception in the spec. The removed code wrongly implemented the general rule, ignoring this exception. This change doesn't just solves the cycle issue, but might add forward references that were avoided (since we never visit members). But as far as the spec goes, this is a valid behavior. So I believe there is no need to add any additional logic to avoid forward references. This PR depends on the validator to correctly validate those forward references (KhronosGroup/SPIRV-Tools#5230). Fixes: microsoft#4911. Signed-off-by: Nathan Gauër <[email protected]>
I just tested this issue with latest DXC compiler. Theoretically this issue could now be closed. |
When activating debug infos now all of our shaders compile - with the exception of our raytracing shaders. |
Hello! So yes, thanks, for now, the issue is "resolved" as "it doesn't crash". For the second issue, seems unrelated to this (as in it's a different error/crash). |
The following reproducer does not compile, leading to the error message:
Reproducer:
Command Line used:
dxc.exe -spirv -T cs_6_7 -fvk-use-scalar-layout -enable-16bit-types -fspv-target-env=vulkan1.3 -fspv-debug=vulkan-with-source -E main
dxc version used:
dxcompiler.dll: 1.7 - 1.7.0.3774 (2168dcb4f)
Operating System used:
Windows 10
When removing the option
-fspv-debug=vulkan-with-source
the file compiles without a problem.
The issue also vanishes, when calling
CompressedIntersectionBits_Test::read_const(myIntersectionMaskBuffer_BitCompressed, aRayIndex);
instead of
CompressedIntersectionBits::read_const(myIntersectionMaskBuffer_BitCompressed, aRayIndex);
The text was updated successfully, but these errors were encountered: