[Validation] Drill through chained GEPs for TGSM#8575
Conversation
DXIL requires that TGSM pointers originate from a global variable in address space 3, and that any use of a pointer resolve to one and only one possible global variable. In SM 6.9 with the introduction of native vectors to DXIL it is now possible to end up with a chain of GEP and/or bitcast instructions in the access change for a TGSM pointer. To address this the validator needs to be able to walk up a TGSM chain to find the one unambiguous global. Assisted by Claude Opus 4.7
Co-authored-by: Ashley Coleman <ascoleman@microsoft.com>
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
Looks like that change doesn't work because |
Sorry, moving too fast on things. You can't cast these to Instructions because they are in the |
|
Did you mean 'access chain' in the description? Not change? |
| ; operators / instructions; any other construct (phi, select, etc.) in | ||
| ; the middle of a chain leaves the ultimate base ambiguous and must be |
There was a problem hiding this comment.
What if the phi or select is choosing between multiple GEPs or bitcasts that all point to the same global variable, just at different offsets? Would this still be valid DXIL?
There was a problem hiding this comment.
I think it should be... but to be honest I can't even contrive how it would be possible to generate it from HLSL. Generating PHIs and selects on offsets is easy enough because you can just mess with the index, but the base address of an array isn't something HLSL allows you to conditionalize on.
🤦 |
Co-authored-by: Alex Sepkowski <alexsepkowski@gmail.com>
DXIL requires that TGSM pointers originate from a global variable in address space 3, and that any use of a pointer resolve to one and only one possible global variable.
In SM 6.9 with the introduction of native vectors to DXIL it is now possible to end up with a chain of GEP and/or bitcast instructions in the access chain for a TGSM pointer. To address this the validator needs to be able to walk up a TGSM chain to find the one unambiguous global.
Fixes #8571
Assisted by Claude Opus 4.7