DirectXShaderCompiler
DirectXShaderCompiler copied to clipboard
DXC Validation Error: TGSM pointers must originate from an unambiguous TGSM global variable
In commit cf044cc960419c5e08cc8a5d7366bc8df760013c (from 23 days ago) I get the following error when enabling optimization;
error: validation errors
D:\local\Temp\c325567c-e0cd-4acd-95cc-d9f5a824c9ee.hlsl:152:22: error: TGSM pointers must originate from an unambiguous TGSM global variable.
note: at '%137 = phi float addrspace(3)* [ %133, %126 ], [ %166, %135 ]' in block '#25' of function 'main'.
D:\local\Temp\c325567c-e0cd-4acd-95cc-d9f5a824c9ee.hlsl:152:22: error: TGSM pointers must originate from an unambiguous TGSM global variable.
note: at '%138 = phi float addrspace(3)* [ %130, %126 ], [ %163, %135 ]' in block '#25' of function 'main'.
D:\local\Temp\c325567c-e0cd-4acd-95cc-d9f5a824c9ee.hlsl:156:21: error: TGSM pointers must originate from an unambiguous TGSM global variable.
note: at '%141 = phi float addrspace(3)* [ %166, %155 ], [ %133, %134 ]' in block '#26' of function 'main'.
D:\local\Temp\c325567c-e0cd-4acd-95cc-d9f5a824c9ee.hlsl:156:21: error: TGSM pointers must originate from an unambiguous TGSM global variable.
note: at '%142 = phi float addrspace(3)* [ %163, %155 ], [ %130, %134 ]' in block '#26' of function 'main'.
Validation failed.
This happens because I have the WaveIsFirstLane write to a groupshared float2 array. I can't publish the code, but I will send a DM on Discord. When disabling optimization it works, so it seems like some optimization might change the generated DXIL.
Sorry for the delay. We can't do much without the code. Can you send the shader to [email protected] or to me directly?
Sent
It is possible that this has been fixed recently. Moving to Dormant for now. @Nielsbishere, can you let us know if this is still an issue for you?
@damyanp Oops, apparently Greg sent a reply to my mail about 3 years ago and I didn't reply :( He managed to simplify the repro to the following:
groupshared float thingies[6];
groupshared uint thingCounter;
[numthreads(8, 1, 1)]
void main() {
if(thingies[thingCounter] >= 0.0) {
for(int ix = thingCounter; ix >= 0; --ix) {
if(thingies[ix] <= 0.0) {
thingies[ix] = 3.0;
break;
}
thingies[ix] = 4.0;
}
++thingCounter;
}
}
After a quick check it is still reproducible on the version on shader-playground and when fetching the latest from nuget (1.8.2403.2).
D:\programming\repos\rt_core\builds\external\dxc>"D:\programming\repos\rt_core\builds\external\dxc\build\native\bin\x64\dxc.exe" "C:\Users\n\Downloads\newio.txt" -E main -T cs_6_0
error: validation errors
C:\Users\n\Downloads\newio.txt:9:22: error: TGSM pointers must originate from an unambiguous TGSM global variable.
note: at '%13 = phi float addrspace(3)* [ %8, %7 ], [ %22, %11 ]' in block '#5' of function 'main'.
C:\Users\n\Downloads\newio.txt:15:20: error: TGSM pointers must originate from an unambiguous TGSM global variable.
note: at '%15 = phi float addrspace(3)* [ %22, %19 ], [ %8, %10 ]' in block '#6' of function 'main'.
Validation failed.
https://godbolt.org/z/5fKxve7P5
@damyanp that verifies that it is an issue right? Or is it to hint that I should link the code like that. Can do that next time.
It was meant more as a convenience for us when we look at this next. But if you want to link like that in the future then that'd be great as well :)