-
Notifications
You must be signed in to change notification settings - Fork 738
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SYCL] Fix debug info generation when integration footer is present (#…
…6774) This patch is to fix two known issues with debugging caused by integration footer presence, without redesigning the integration footer approach. One issue is the missing checksum for the main file on Windows. This causes the breakpoints not being hit. The other issue being that the host compilation's DICompileUnit points to the temporary file created instead of the original source file. So file names and checksums are different for host and compilation. The changes made to fix the issues are: 1. Driver passes an absolute path to an original source file through -main-file-name if integration footer is enabled. 2. Driver passes a full path to the original source file through -full-main-file-name. 3. Clang CodeGen uses the file specified through -main-file-name and full-main-file-name to calculate checksums and file names for the main file. Joint work with @AlexeySachkov Signed-off-by: Zahira Ammarguellat <zahira.ammarguellat@intel.com>
- Loading branch information
Showing
10 changed files
with
149 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
int main() { | ||
int x = 0; | ||
return x + 1; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include "Inputs/sycl.hpp" | ||
|
||
int main() { | ||
sycl::sampler Sampler; | ||
sycl::kernel_single_task<class use_kernel_for_test>([=]() { | ||
Sampler.use(); | ||
}); | ||
return 0; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// This file attempts to emulate content of a file, which is passed to host | ||
// compiler when integration footer is used: this file is considered to be a | ||
// main file and Inputs/debug-info-checksum.cpp serves as integration footer. | ||
// | ||
// The file is specifically named debug-info-checksum-temp-name.cpp to emulate | ||
// the temporary file name, which is generated by the compiler driver for the | ||
// host .cpp file after appending footer to it. | ||
// | ||
// The command line executed is based on what is actually invoked by the | ||
// compiler driver and we explicitly pass 'Inputs/debug-info-checksum.cpp' as | ||
// a main file name to ensure that we can instruct the compiler to emit the | ||
// correct debug info (paths and checksums), even though the input file is not | ||
// exactly what user specified on the command line. | ||
// | ||
// RUN: %clang_cc1 -fsycl-is-host -I %S %S/Inputs/debug-info-checksum.cpp \ | ||
// RUN: -triple x86_64-unknown-linux-gpu \ | ||
// RUN: -main-file-name "%S/Inputs/debug-info-checksum.cpp" \ | ||
// RUN: -full-main-file-name "%S/Inputs/debug-info-checksum.cpp" \ | ||
// RUN: -fsycl-use-main-file-name -dwarf-version=5 -S -emit-llvm \ | ||
// RUN: -O0 -debug-info-kind=constructor -o - | FileCheck %s | ||
// | ||
// Verify that DICompileUnit points to a correct file and that checksum is also | ||
// correct. | ||
// | ||
// CHECK: !DICompileUnit({{.*}} file: ![[#FILE:]] | ||
// CHECK: ![[#FILE]] = !DIFile(filename: "{{.*}}clang{{.+}}test{{.+}}CodeGenSYCL{{.+}}Inputs{{.+}}debug-info-checksum.cpp" | ||
// CHECK-SAME: checksumkind: CSK_MD5, checksum: "f1fb5d68350b47d90a53968ac8c40529" | ||
|
||
#include "Inputs/debug-info-checksum.cpp" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// This test checks that a checksum is created correctly for the compiled file, | ||
// and that the same checksum is generated for host and target compilation. | ||
// It also checks that DICompileUnit in host and target compilation is referring | ||
// to the original source file name (not the temporary file created by the | ||
// compilation process) . | ||
|
||
// RUN: %clang_cc1 -triple spir64-unknown-unknown -fsycl-is-device \ | ||
// RUN: -fsycl-int-header=%t.header.h -fsycl-int-footer=%t.footer.h \ | ||
// RUN: -main-file-name %S/Inputs/checksum.cpp -fsycl-use-main-file-name \ | ||
// RUN: -full-main-file-name "%S/Inputs/checksum.cpp" \ | ||
// RUN: -gcodeview -debug-info-kind=limited -emit-llvm -O0 -o - "%S/Inputs/checksum.cpp" \ | ||
// RUN: | FileCheck %s -check-prefix=COMP1 | ||
|
||
// RUN: append-file "%S/Inputs/checksum.cpp" \ | ||
// RUN: --append=%t.footer.h \ | ||
// RUN: --orig-filename="%S/Inputs/checksum.cpp" \ | ||
// RUN: --output=%t.checksum.cpp --use-include | ||
|
||
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fsycl-is-host \ | ||
// RUN: -include %t.header.h -dependency-filter %t.header.h \ | ||
// RUN: -main-file-name %S/Inputs/checksum.cpp -fsycl-use-main-file-name \ | ||
// RUN: -full-main-file-name %S/Inputs/checksum.cpp \ | ||
// RUN: -gcodeview -debug-info-kind=limited -emit-llvm -O0 -o - \ | ||
// RUN: %t.checksum.cpp \ | ||
// RUN: | FileCheck %s -check-prefix=COMP2 | ||
|
||
// COMP1: !DICompileUnit({{.*}} file: ![[#FILE1:]] | ||
// COMP1: ![[#FILE1]] = !DIFile(filename: "{{.*}}clang{{.+}}test{{.+}}CodeGenSYCL{{.+}}checksum.cpp" | ||
// COMP1-SAME: checksumkind: CSK_MD5, checksum: "259269f735d83ec32c46a11352458493") | ||
|
||
// COMP2: !DICompileUnit({{.*}} file: ![[#FILE2:]] | ||
// COMP2: ![[#FILE2]] = !DIFile(filename: "{{.*}}clang{{.+}}test{{.+}}CodeGenSYCL{{.+}}checksum.cpp" | ||
// COMP2-SAME: checksumkind: CSK_MD5, checksum: "259269f735d83ec32c46a11352458493") |
This file contains 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