You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey all, while I was working on investigating getting debug source correlations from a DXC compiled shader, I noticed a few issues in SPIRVToLLVMDbgTran.cpp when dealing with NonSemantic.Shader.DebugInfo.100.
Since I don't have the test suite, or the experience with this codebase to be confident in my fixes, I figured I would raise them here.
Let me know if this is the right forum, or if I should break up each of these into individual issues! Since they all seem relatively small, I figured I would batch them.
Repro
I've attached a SPIR-V file that should run into all these issues: example_shader.zip
We don't have access to a parent scope and the number of arguments differs from OpenCL debug info. I'm not sure how best to reference the parent composite type in order to derive the scope here.
3. SPIRVToLLVMDbgTran::transDebugIntrinsic fails on DebugNoLine
The text was updated successfully, but these errors were encountered:
AlexSabourinDev
changed the title
Bugs with NonSemanticShaderDebugInfo in SPIRVToLLVMDbgTran.cpp
Bugs with handling NonSemanticShaderDebugInfo in SPIRVToLLVMDbgTran.cpp
Aug 23, 2024
Summary
Hey all, while I was working on investigating getting debug source correlations from a DXC compiled shader, I noticed a few issues in
SPIRVToLLVMDbgTran.cpp
when dealing with NonSemantic.Shader.DebugInfo.100.Since I don't have the test suite, or the experience with this codebase to be confident in my fixes, I figured I would raise them here.
Let me know if this is the right forum, or if I should break up each of these into individual issues! Since they all seem relatively small, I figured I would batch them.
Repro
I've attached a SPIR-V file that should run into all these issues: example_shader.zip
Compiling it with this command line:
amdllpc.exe --auto-layout-desc -o="output.bin" -gfxip=10.3.0 -trim-debug-info=false "example_shader.spv"
1.
SPIRVToLLVMDbgTran::transTypeComposite
llpc/llpc/translator/lib/SPIRV/SPIRVToLLVMDbgTran.cpp
Lines 330 to 331 in 5278a3f
I think this should be
switch (getConstant(Ops[TagIdx]))
when reading NonSemantic debug info?From the spec:
2. DebugTypeMember doesn't have a parent scope with NonSemantic debug info.
DebugTypeMember had its parent scope removed as an argument in NonSemantic debug info.
From the spec:
As a result, these two lines in
SPIRVToLLVMDbgTran::transTypeMember
are incorrect.llpc/llpc/translator/lib/SPIRV/SPIRVToLLVMDbgTran.cpp
Line 365 in 5278a3f
llpc/llpc/translator/lib/SPIRV/SPIRVToLLVMDbgTran.cpp
Line 370 in 5278a3f
We don't have access to a parent scope and the number of arguments differs from OpenCL debug info. I'm not sure how best to reference the parent composite type in order to derive the scope here.
3.
SPIRVToLLVMDbgTran::transDebugIntrinsic
fails onDebugNoLine
This switch:
llpc/llpc/translator/lib/SPIRV/SPIRVToLLVMDbgTran.cpp
Line 886 in 5278a3f
Fails when we encounter a
DebugNoLine
op since we don't account for it. We end up falling into thellvm_unreachable
below.Perhaps its as simple as adding
SPIRVDebug::NoLine
below?llpc/llpc/translator/lib/SPIRV/SPIRVToLLVMDbgTran.cpp
Lines 903 to 904 in 5278a3f
4.
SPIRVToLLVMDbgTran::transDebugScope
references aDebugSource
but incorrectly considers it a string constant.In
SPIRVToLLVMDbgTran::transDebugScope
we reference a filename from aSPIRVLine
.llpc/llpc/translator/lib/SPIRV/SPIRVToLLVMDbgTran.cpp
Line 992 in 5278a3f
But with NonSemantic debug info, the filename isn't a string type. It's actually a
DebugSource
type.From the spec:
This causes a crash.
5. Index out of range in
SPIRVToLLVMDbgTran::transSource
I think this branch is incorrect:
llpc/llpc/translator/lib/SPIRV/SPIRVToLLVMDbgTran.cpp
Lines 1042 to 1043 in 5278a3f
I think it needs to be
if (ops.size() > TextIdx)
.This causes a crash.
Cheers!
The text was updated successfully, but these errors were encountered: