Correctly wrap/unwrap DebugLocalVariable ArgNumber in OpConstant#3769
Correctly wrap/unwrap DebugLocalVariable ArgNumber in OpConstant#3769AdamBrouwersHarries wants to merge 2 commits into
Conversation
The NonSemantic.Shader.DebugInfo spec requires that the (optional) ArgNumber operand for a DebugLocalVariable operation is the id of a 32-bit OpConstant. This patch ensures that both the LLVM to SPIR-V and SPIR-V to LLVM paths through the translator respect this requirement.
f13b82f to
4ebd698
Compare
|
Note, this addresses #3768 |
There do need to be some test changes - that's why CI has been failing. I haven't had capacity to work on it yet this week. Testing is a little tricky. The SPIR-V -> LLVM case is obvious enough, but requires a massive kernel with 65k+ IDs. LLVM to SPIR-V is less obvious, as LLVM inherently can't produce an ArgNumber that will overflow its own storage. I've encountered this issue "in the wild" in SPIR-V generated by Intel's SYCL compiler, so perhaps I should look into how that does it in more detail. |
|
I suspect, that the tests are failing not because of this patch:
Make sense. I won't push for extra tests then :) Still requires approval from the maintainers. I'm closing/re-opening the PR to force new HEAD for the tests. |
okay, this is something new |
The test |
|
Ah, I've realised that the test was actually written by @MrSidims, which is handy. For some reason, I can't actually disassemble the spir-v using spirv tools, and the spt file is not particularly editable. Do you happen to remember what the original source code which generated the spir-v looked like? |
Yes - sorry, I was slow to respond. That test doesn't correctly wrap the ArgNumber in an OpConstant, so will fail with the new patch. |
Nope. I could search at Intel's issue tracking system, but I've lost access to it some time ago :) May be @vmaksimo can help. You can use Alternatively, just convert it back to LLVM IR and it would give a ground to play with IR. |
Unfortunately the resulting .spv fails disassembly, with "error: 43: Invalid storage class operand: 4294967295". Converting from llvm IR -> SPIR-V -> Disassembly also fails, which is odd. EDIT: Actually, that might have been the error from the LLVM -> SPIR-V -> SPIR-V ASM. Going straight from SPIR-V to SPIR-V ASM with spirv-dis gives: I think it might be easier to try and re-create the SPIR-V from a fresh test with the same behaviour. |
|
Apologies, I really have no clue, what did I mean here :D |
No problem! I seem to have a knack for finding random tests and code that people have forgotten about 😅 I'll see how far I can get recreating the llvm IR with an OpenCL kernel, and then use that to generate a new SPIR-V test. |
The NonSemantic.Shader.DebugInfo spec requires that the (optional) ArgNumber operand for a DebugLocalVariable operation is the id of a 32-bit OpConstant.
This patch ensures that both the LLVM to SPIR-V and SPIR-V to LLVM paths through the translator respect this requirement.