-
Notifications
You must be signed in to change notification settings - Fork 796
[Driver][SYCL] Update preprocessed file generation #19849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
61793b3
f5064bd
7fdacc4
23b7e9f
fc4489b
bbc7b1b
d57edf4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -10300,6 +10300,8 @@ void OffloadPackager::ConstructJob(Compilation &C, const JobAction &JA, | |||||
| for (const InputInfo &Input : Inputs) { | ||||||
| const Action *OffloadAction = Input.getAction(); | ||||||
| const ToolChain *TC = OffloadAction->getOffloadingToolChain(); | ||||||
| if (!TC) | ||||||
| TC = &C.getDefaultToolChain(); | ||||||
| const ArgList &TCArgs = | ||||||
| C.getArgsForToolChain(TC, OffloadAction->getOffloadingArch(), | ||||||
| OffloadAction->getOffloadingDeviceKind()); | ||||||
|
|
@@ -10389,6 +10391,50 @@ void OffloadPackager::ConstructJob(Compilation &C, const JobAction &JA, | |||||
| CmdArgs, Inputs, Output)); | ||||||
| } | ||||||
|
|
||||||
| // Use the clang-offload-packager to extract binaries from an packaged | ||||||
|
||||||
| // Use the clang-offload-packager to extract binaries from an packaged | |
| // Use the clang-offload-packager to extract device binaries from a packaged |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The binaries within a packaged file are not always device binaries in our usage, as they can be either host or device binaries. I'll update, but not add 'device'.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,10 @@ | ||
| /// Test preprocessing capabilities when using -fsycl | ||
| // Test the behaviors when enabling SYCL offloading with preprocessed files. | ||
|
|
||
| /// Creating a preprocessed file is expected to do an integration header | ||
| /// creation step. | ||
| // RUN: %clangxx -fsycl --offload-new-driver -E -o %t_output.ii %s -### 2>&1 \ | ||
| // RUN: | FileCheck -check-prefix PREPROC_ONLY %s | ||
| // RUN: %clang_cl -fsycl --offload-new-driver -P -Fi%t_output.ii %s -### 2>&1 \ | ||
| // RUN: %clang_cl -fsycl --offload-new-driver -P %s -### 2>&1 \ | ||
| // RUN: | FileCheck -check-prefix PREPROC_ONLY %s | ||
| // PREPROC_ONLY: clang{{.*}} "-fsycl-is-device"{{.*}} "-fsycl-int-header=[[INTHEADER:.+\.h]]" "-fsycl-int-footer=[[INTFOOTER:.+\.h]]"{{.*}} "-E" | ||
| // PREPROC_ONLY: clang{{.*}} "-fsycl-is-host"{{.*}} "-include-internal-header" "[[INTHEADER]]"{{.*}} "-include-internal-footer" "[[INTFOOTER]]"{{.*}} "-o" "[[HOST_OUT:.+\.ii]]" | ||
|
|
@@ -14,10 +15,31 @@ | |
| // PREPROC_IN-NOT: "-fsycl-int-header={{.*}}" | ||
| // PREPROC_IN: clang{{.*}} "-fsycl-is-host" | ||
|
|
||
| // RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl --offload-new-driver -E %s -ccc-print-phases 2>&1 \ | ||
| // RUN: | FileCheck -check-prefix PREPROC_PHASES %s | ||
| /// When generating preprocessed files, verify the compilation phases. | ||
| // RUN: %clangxx --target=x86_64-unknown-linux-gnu --offload-new-driver -fsycl -E %s -o %t.ii -ccc-print-phases 2>&1 \ | ||
| // RUN: | FileCheck %s -check-prefix PREPROC_PHASES | ||
| // RUN: %clang_cl --target=x86_64-unknown-linux-gnu --offload-new-driver -fsycl -P %s -Fi%t.ii -ccc-print-phases 2>&1 \ | ||
|
||
| // RUN: | FileCheck %s -check-prefix PREPROC_PHASES | ||
| // PREPROC_PHASES: 0: input, "[[INPUT:.+\.cpp]]", c++, (host-sycl) | ||
| // PREPROC_PHASES: 1: preprocessor, {0}, c++-cpp-output, (host-sycl) | ||
| // PREPROC_PHASES: 2: input, "[[INPUT]]", c++, (device-sycl) | ||
| // PREPROC_PHASES: 3: preprocessor, {2}, c++-cpp-output, (device-sycl) | ||
| // PREPROC_PHASES: 4: offload, "host-sycl (x86_64-unknown-linux-gnu)" {1}, "device-sycl (spir64-unknown-unknown)" {3}, c++-cpp-output | ||
| // PREPROC_PHASES: 4: compiler, {3}, none, (device-sycl) | ||
| // PREPROC_PHASES: 5: offload, "device-sycl (spir64-unknown-unknown)" {3}, c++-cpp-output | ||
| // PREPROC_PHASES: 6: clang-offload-packager, {5, 1}, c++-cpp-output | ||
| // PREPROC_PHASES: 7: offload, "host-sycl (x86_64-unknown-linux-gnu)" {1}, "device-sycl (spir64-unknown-unknown)" {3}, "device-sycl (spir64-unknown-unknown)" {4}, " (x86_64-unknown-linux-gnu)" {6}, c++-cpp-output | ||
|
|
||
| /// When generating preprocessed files, verify the tools called and the expected | ||
| /// output file name. | ||
| // RUN: %clangxx --offload-new-driver -fsycl -E %s -o sycl-preprocess.ii -### 2>&1 \ | ||
| // RUN: | FileCheck %s -check-prefix PREPROC_TOOLS | ||
| // RUN: %clang_cl --offload-new-driver -fsycl -P %s -Fisycl-preprocess.ii -### 2>&1 \ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we passing
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use of
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this some special file format -
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's an MSVC compatible way of designating the output file from the preprocessing step. (from the MSVC help output) |
||
| // RUN: | FileCheck %s -check-prefix PREPROC_TOOLS | ||
| // RUN: %clang_cl --offload-new-driver -fsycl -E %s -o sycl-preprocess.ii -### 2>&1 \ | ||
| // RUN: | FileCheck %s -check-prefix PREPROC_TOOLS | ||
| // PREPROC_TOOLS: clang{{.*}} "-fsycl-is-device" | ||
| // PREPROC_TOOLS-SAME: "-o" "[[DEVICE_PP_FILE:.+\.ii]] | ||
| // PREPROC_TOOLS: clang{{.*}} "-fsycl-is-host" | ||
| // PREPROC_TOOLS-SAME: "-o" "[[HOST_PP_FILE:.+\.ii]] | ||
| // PREPROC_TOOLS: clang-offload-packager{{.*}} "-o" "sycl-preprocess.ii" | ||
| // PREPROC_TOOLS-SAME: "--image=file=[[DEVICE_PP_FILE]],triple=spir64-unknown-unknown,arch=generic,kind=sycl{{.*}}" "--image=file=[[HOST_PP_FILE]],triple={{.*}},arch=generic,kind=host" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure I follow this comment. Can you add a more descriptive comment.