From 70273599e2bb8a8e2b0f7b5e7ad47fe2f00b2b40 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Fri, 18 Jul 2025 11:24:06 -0700 Subject: Fix debug info generation for let variables in SPIR-V output (#7743) * Initial plan * Fix debug info for let variables Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Fix parameter count for emitDebugVar function call Fixed regression where let variable debug info generation was missing the optional argIndex parameter in emitDebugVar call. Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Add location validity check for debug info generation Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Don't insert debug value for nondebuggable types. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> Co-authored-by: Yong He --- tests/language-feature/let-debug-info.slang | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/language-feature/let-debug-info.slang (limited to 'tests') diff --git a/tests/language-feature/let-debug-info.slang b/tests/language-feature/let-debug-info.slang new file mode 100644 index 000000000..206f234cc --- /dev/null +++ b/tests/language-feature/let-debug-info.slang @@ -0,0 +1,21 @@ +//TEST:COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +//TEST_INPUT: set outputBuffer = out ubuffer(data=[0 0 0 0], stride=4) +RWStructuredBuffer outputBuffer; + +[numthreads(1, 1, 1)] +void computeMain() +{ + let x = float(2); // Let variable should generate debug info + var y = float(3); // Var variable for comparison + float z = float(4); // Regular variable declaration + + // Use the variables so they don't get optimized away + float result = x + y + z; + + // CHECK: 9.0 + outputBuffer[0] = result; +} + +// This test verifies that 'let' variables now generate debug information +// Previously, 'let' variables did not generate debug info, causing issues with debuggers \ No newline at end of file -- cgit v1.2.3