-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL] Support per-object file compilation #7595
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
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
5ff8b8b
Add merge option to file-table-form
sarnex 26d710c
Add serial action capability to ForEachWrappingAction
sarnex 041ccd0
Add -fsycl-rdc and -fno-sycl-rdc
sarnex 7f045b0
Honor -fsycl-max-parallel-link-jobs for ForEachWrapperAction
sarnex 50c19cc
Add function to detect if we should do per object linking
sarnex 0cef24c
Add error with -fsycl-no-rdc and missing offload arch
sarnex 9fc955c
Add error for unsupported device code split mode
sarnex 9cc4687
comment
sarnex f989edf
Driver changes to implement -fsycl-no-rdc
sarnex 4bba623
Make llvm-link command work with -fno-sycl-rdc
sarnex a5466a4
lit tests
sarnex 3a7ad8f
Make driver pass RDC flag for SYCL
sarnex a7e0464
Add error when calling unsupported function
sarnex efa7ff4
clang format
sarnex 0bd8080
address feedback
sarnex 30e7c5d
remove useless if
sarnex 53dc433
allow all device code split modes
sarnex bec3954
remove incorrect assert
sarnex cfceeef
error for SYCL_EXTERNAL declaration
sarnex 8468af2
simplify loop
sarnex a803d1e
formatting
sarnex e893bc6
improve error
sarnex 691adcd
address comments
sarnex File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/// Tests driver errors for -no-sycl-rdc | ||
|
||
// RUN: %clang -target %itanium_abi_triple -c %s -o %t.o | ||
// RUN: %clang -target spir64_gen -emit-llvm -c %s -o %t | ||
// RUN: clang-offload-bundler -type=o -targets=host-%itanium_abi_triple,sycl-spir64_gen-unknown-unknown -input=%t -input=%t.o -output=%t.fat.o | ||
// RUN: not %clang -### -fsycl -fno-sycl-rdc %t.fat.o 2>&1 | FileCheck -check-prefix=CHECK-ARCH %s | ||
|
||
// CHECK-ARCH: error: linked binaries do not contain expected 'spir64-unknown-unknown' target; found targets: 'spir64_gen-unknown-unknown', this is not supported with '-fno-sycl-rdc' | ||
|
||
// Some code so that we can create a binary out of this file. | ||
void test_func(void) { | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/// test behaviors of passing a fat static lib with -fno-sycl-rdc | ||
// Build a fat static lib that will be used for all tests | ||
// RUN: echo "void foo(void) {}" > %t1.cpp | ||
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl %t1.cpp -c -o %t1_bundle.o | ||
// RUN: llvm-ar cr %t_lib.a %t1_bundle.o | ||
// RUN: %clang -### -fsycl -fno-sycl-rdc -fsycl-device-code-split=none --sysroot=%S/Inputs/SYCL %t_lib.a 2>&1 -ccc-print-phases | FileCheck %s | ||
// RUN: %clang -### -fsycl -fno-sycl-rdc -fsycl-device-code-split=auto --sysroot=%S/Inputs/SYCL %t_lib.a 2>&1 -ccc-print-phases | FileCheck %s | ||
// RUN: %clang -### -fsycl -fno-sycl-rdc -fsycl-device-code-split=per_kernel --sysroot=%S/Inputs/SYCL %t_lib.a 2>&1 -ccc-print-phases | FileCheck %s | ||
// RUN: %clang -### -fsycl -fno-sycl-rdc -fsycl-device-code-split=per_source --sysroot=%S/Inputs/SYCL %t_lib.a 2>&1 -ccc-print-phases | FileCheck %s | ||
// CHECK: 2: input, "{{.*}}_lib.a", archive | ||
// CHECK: 3: clang-offload-unbundler, {2}, tempfilelist | ||
// CHECK: 4: spirv-to-ir-wrapper, {3}, tempfilelist, (device-sycl) | ||
// CHECK: 5: input, "{{.*}}libsycl-crt{{.*}}", object | ||
// CHECK: 6: clang-offload-unbundler, {5}, object | ||
// CHECK: 7: offload, " (spir64-unknown-unknown)" {6}, object | ||
// CHECK: 65: linker, {7, {{.*}}}, ir, (device-sycl) | ||
// CHECK: 66: linker, {4, 65}, ir, (device-sycl) | ||
// CHECK: 67: foreach, {4, 66}, ir, (device-sycl) | ||
// CHECK: 68: file-table-tform, {4, 67}, tempfilelist, (device-sycl) | ||
// CHECK: 69: sycl-post-link, {68}, tempfiletable, (device-sycl) | ||
// CHECK: 70: foreach, {68, 69}, tempfiletable, (device-sycl) | ||
// CHECK: 71: file-table-tform, {70}, tempfilelist, (device-sycl) | ||
// CHECK: 72: file-table-tform, {70}, tempfilelist, (device-sycl) | ||
// CHECK: 73: foreach, {68, 72}, tempfilelist, (device-sycl) | ||
// CHECK: 74: file-table-tform, {73}, tempfilelist, (device-sycl) | ||
// CHECK: 75: llvm-spirv, {74}, tempfilelist, (device-sycl) | ||
// CHECK: 76: file-table-tform, {71, 75}, tempfiletable, (device-sycl) | ||
// CHECK: 77: clang-offload-wrapper, {76}, object, (device-sycl) | ||
// CHECK: 78: offload, "host-sycl (x86_64-unknown-linux-gnu)" {1}, "device-sycl (spir64-unknown-unknown)" {77}, image |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/// Tests for -fno-sycl-rdc | ||
// RUN: touch %t1.cpp | ||
// RUN: touch %t2.cpp | ||
// RUN: %clang -### -fsycl -fno-sycl-rdc --sysroot=%S/Inputs/SYCL %t1.cpp %t2.cpp 2>&1 -ccc-print-phases | FileCheck %s | ||
|
||
// CHECK: 3: input, "{{.*}}1.cpp", c++, (device-sycl) | ||
// CHECK: 4: preprocessor, {3}, c++-cpp-output, (device-sycl) | ||
// CHECK: 5: compiler, {4}, ir, (device-sycl) | ||
// CHECK: 13: input, "{{.*}}2.cpp", c++, (device-sycl) | ||
// CHECK: 14: preprocessor, {13}, c++-cpp-output, (device-sycl) | ||
// CHECK: 15: compiler, {14}, ir, (device-sycl) | ||
|
||
// CHECK: 21: input, {{.*}}libsycl-crt{{.*}}, object | ||
// CHECK: 22: clang-offload-unbundler, {21}, object | ||
// CHECK: 23: offload, " (spir64-unknown-unknown)" {22}, object | ||
// CHECK: 81: linker, {23, {{.*}}}, ir, (device-sycl) | ||
// CHECK: 82: linker, {5, 81}, ir, (device-sycl) | ||
// CHECK: 83: sycl-post-link, {82}, tempfiletable, (device-sycl) | ||
// CHECK: 84: file-table-tform, {83}, tempfilelist, (device-sycl) | ||
// CHECK: 85: llvm-spirv, {84}, tempfilelist, (device-sycl) | ||
// CHECK: 86: file-table-tform, {83, 85}, tempfiletable, (device-sycl) | ||
// CHECK: 87: clang-offload-wrapper, {86}, object, (device-sycl) | ||
|
||
// CHECK: 88: linker, {15, 81}, ir, (device-sycl) | ||
// CHECK: 89: sycl-post-link, {88}, tempfiletable, (device-sycl) | ||
// CHECK: 90: file-table-tform, {89}, tempfilelist, (device-sycl) | ||
// CHECK: 91: llvm-spirv, {90}, tempfilelist, (device-sycl) | ||
// CHECK: 92: file-table-tform, {89, 91}, tempfiletable, (device-sycl) | ||
// CHECK: 93: clang-offload-wrapper, {92}, object, (device-sycl) | ||
|
||
// CHECK: 94: offload, "host-sycl (x86_64-unknown-linux-gnu)" {{{.*}}}, "device-sycl (spir64-unknown-unknown)" {87}, "device-sycl (spir64-unknown-unknown)" {93}, image |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// RUN: %clang_cc1 -fsycl-is-device -verify -fsyntax-only -fno-gpu-rdc -internal-isystem %S/Inputs %s | ||
|
||
// Check that declarations of SYCL_EXTERNAL functions throw an error if -fno-gpu-rdc is passed | ||
#include "sycl.hpp" | ||
|
||
// expected-error@+1{{invalid declaration of SYCL_EXTERNAL function in non-relocatable device code mode}} | ||
SYCL_EXTERNAL void syclExternalDecl(); | ||
|
||
// expected-error@+1{{invalid definition of SYCL_EXTERNAL function in non-relocatable device code mode}} | ||
SYCL_EXTERNAL void syclExternalDefn() {} | ||
|
||
using namespace sycl; | ||
queue q; | ||
|
||
void kernel_wrapper() { | ||
q.submit([&](handler &h) { | ||
h.single_task([=] { | ||
}); | ||
}); | ||
} | ||
|
||
int main() { | ||
kernel_wrapper(); | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[11|12] | ||
44|55 | ||
66|77 | ||
mdtoguchi marked this conversation as resolved.
Show resolved
Hide resolved
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[11|12] | ||
00|11 | ||
22|33 | ||
44|55 | ||
66|77 |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.