Preserve device debug info for gdb-oneapi (#1004)#1350
Open
pvelesko wants to merge 1 commit into
Open
Conversation
The HIPSPV toolchain force-disabled device debug info (adjustDebugInfoKind -> NoDebugInfo), so -g/-O0 produced SPIR-V with no debug metadata; gdb-oneapi could not resolve locals in kernels. The historical blocker (translator aborting on DW_OP_LLVM_convert) is gone. Honor -g and, when set, emit the NonSemantic.Shader.DebugInfo form that Intel IGC/gdb-oneapi consume. Applies on top of the existing HIPSPV spirv-ext patches for LLVM 17-22.
Collaborator
Author
|
/run-aurora-ci |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds llvm-patches/llvm/0007 for the configure_llvm.sh build path. The HIPSPV toolchain force-disabled device debug info (adjustDebugInfoKind -> NoDebugInfo), so -g/-O0 produced SPIR-V with no debug metadata and gdb-oneapi could not resolve locals in kernels. The historical blocker (translator aborting on DW_OP_LLVM_convert) is gone. The patch honors -g and, when set, emits the NonSemantic.Shader.DebugInfo form that Intel IGC/gdb-oneapi consume.
The same change is upstreamed in llvm/llvm-project#210504 and applied to the fork branch in CHIP-SPV/llvm-project#6.
Refs #1004
Hardware validation on Aurora (PVC, i915, oneAPI 2025.3, LLVM 22)
Full in-kernel debugging works, including reading arguments and locals per SIMD lane:
Getting there needs three changes. This PR is one of them; the other two are chipStar-side and are not yet written.
Measured combinations, all with -g -O0 on PVC:
So -cl-opt-disable alone is not enough, and preserving optnone alone is not enough; both are required. -g in the L0 build flags is not needed.
Also confirmed: nonsemantic-shader-200 is the right choice. Testing nonsemantic-shader-100 changed nothing, and icpx -fsycl -g passes -spirv-debug-info-version=nonsemantic-shader-200 itself.
The -g binary runs correctly on PVC and there is no change when -g is absent.
Using gdb-oneapi with chipStar
Two prerequisites live outside the compiler entirely.
Enable EU debug on the node. It is off by default but writable by a normal user inside a job; no root needed:
Without this, Level Zero enumerates zero devices under ZET_ENABLE_PROGRAM_DEBUGGING=1 and chipStar fails with hipErrorNotInitialized.
Redirect gdb-oneapi's auto-attach hook. Its intelgt_auto_attach.py plants the trigger breakpoint on zeContextCreate, but chipStar calls zeContextCreateEx (src/backend/Level0/CHIPBackendLevel0.cc:2368). Different address, so the hook never fires, gdbserver-ze never starts, and device breakpoints stay pending while the program runs to completion. The extension provides an official override:
Full session:
Add INTELGT_AUTO_ATTACH_VERBOSE_LOG=1 to trace auto-attach; a successful run logs "gdbserver-ze started for process N".
Item 2 deserves its own fix: chipStar could call zeContextCreate when it is not subsetting devices, and Intel should hook both entry points, since any Level Zero application using the Ex form is invisible to auto-attach today.