-
Notifications
You must be signed in to change notification settings - Fork 790
[SYCL][Driver] Enhance -Xarch_device and -Xarch_host for sycl #12478
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
11 commits
Select commit
Hold shift + click to select a range
0924e7b
[SYCL][Driver] Add '--target/host-options=' for SYCL compiler
jinge90 bd8f024
remove redundant braces
jinge90 63e1196
push --target/host-options flags into SYCL device/host compile flags
jinge90 3691f60
Support -mllvm in --target-options
jinge90 dec85c4
enhance -Xarch_device and -Xarch_host
jinge90 4051b49
remove --target-options
jinge90 bc95a54
remove unnecessary newline
jinge90 06e88f8
Merge remote-tracking branch 'upstream/sycl' into target_host_option
jinge90 e9904dc
1. Handle combination use of -Xarch_device and -Xarch_host
jinge90 094fad5
fix lit test
jinge90 69d0e74
add more tests
jinge90 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
/// | ||
/// Perform several driver tests for SYCL -Xarch_device/host on Linux | ||
/// | ||
|
||
// UNSUPPORTED: system-windows | ||
|
||
/// ########################################################################### | ||
|
||
/// test behavior of -Xarch_device with 1 option for SYCL compiler, the flag | ||
/// should be passed to device compilation only. | ||
// RUN: %clangxx -fsycl %s -Xarch_device -fsanitize=address -### 2>&1 \ | ||
// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_DEVICE_OPTION | ||
// RUN: %clangxx -fsycl %s -Xarch_device -fsanitize=address -### 2>&1 \ | ||
// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_DEVICE_ONLY | ||
// SYCL_XARCH_DEVICE_OPTION: clang{{.*}} "-fsycl-is-device" | ||
// SYCL_XARCH_DEVICE_OPTION-SAME: -fsanitize=address | ||
// SYCL_XARCH_DEVICE_OPTION-SAME: -fsanitize-address-use-after-return=never | ||
// SYCL_XARCH_DEVICE_OPTION-SAME: -fno-sanitize-address-use-after-scope | ||
// SYCL_XARCH_DEVICE_OPTION-SAME: "-mllvm" "-asan-instrumentation-with-call-threshold=0" | ||
// SYCL_XARCH_DEVICE_OPTION-SAME: "-mllvm" "-asan-stack=0" | ||
// SYCL_XARCH_DEVICE_OPTION-SAME: "-mllvm" "-asan-globals=0" | ||
// SYCL_XARCH_DEVICE_ONLY: llc{{.*}} "-filetype=obj" | ||
// SYCL_XARCH_DEVICE_ONLY-NOT: fsanitize=address | ||
|
||
/// test behavior of -Xarch_device with multiple options for SYCL compiler, the | ||
/// flags should be passed to device compilation only. | ||
// RUN: %clangxx -fsycl %s -Xarch_device "-fsanitize=address -DXARCH_DEVICE_TEST -mllvm -enable-merge-functions" -### 2>&1 \ | ||
// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_DEVICE_OPTIONS1 | ||
// RUN: %clangxx -fsycl %s -Xarch_device "-fsanitize=address -DXARCH_DEVICE_TEST -mllvm -enable-merge-functions" -### 2>&1 \ | ||
// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_DEVICE_OPTIONS1 | ||
// RUN: %clangxx -fsycl %s -Xarch_device "-fsanitize=address -DXARCH_DEVICE_TEST -mllvm -enable-merge-functions" -### 2>&1 \ | ||
// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_DEVICE_OPTIONS2 | ||
// RUN: %clangxx -fsycl %s -Xarch_device "-fsanitize=address -DXARCH_DEVICE_TEST -mllvm -enable-merge-functions" -### 2>&1 \ | ||
// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_DEVICE_OPTIONS3 | ||
// SYCL_XARCH_DEVICE_OPTIONS1: clang{{.*}} "-fsycl-is-device" | ||
// SYCL_XARCH_DEVICE_OPTIONS1-SAME: -fsanitize=address | ||
// SYCL_XARCH_DEVICE_OPTIONS1-SAME: -fsanitize-address-use-after-return=never | ||
// SYCL_XARCH_DEVICE_OPTIONS1-SAME: -fno-sanitize-address-use-after-scope | ||
// SYCL_XARCH_DEVICE_OPTIONS1-SAME: "-mllvm" "-asan-instrumentation-with-call-threshold=0" | ||
// SYCL_XARCH_DEVICE_OPTIONS1-SAME: "-mllvm" "-asan-stack=0" | ||
// SYCL_XARCH_DEVICE_OPTIONS1-SAME: "-mllvm" "-asan-globals=0" | ||
// SYCL_XARCH_DEVICE_OPTIONS2: clang{{.*}} "-fsycl-is-device" | ||
// SYCL_XARCH_DEVICE_OPTIONS2-SAME: XARCH_DEVICE_TEST | ||
// SYCL_XARCH_DEVICE_OPTIONS3: clang{{.*}} "-fsycl-is-device" | ||
// SYCL_XARCH_DEVICE_OPTIONS3-SAME: "-mllvm" "-enable-merge-functions" | ||
|
||
|
||
/// test behavior of -Xarch_host with 1 option for SYCL compiler, the flag | ||
/// should be passed to host compilation only. | ||
// RUN: %clangxx -fsycl %s -Xarch_host -fsanitize=address -### 2>&1 \ | ||
// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_HOST_OPTION | ||
// RUN: %clangxx -fsycl %s -Xarch_host -fsanitize=address -### 2>&1 \ | ||
// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_HOST_ONLY | ||
// SYCL_XARCH_HOST_OPTION: clang{{.*}} "-fsycl-is-host" | ||
// SYCL_XARCH_HOST_OPTION-SAME: -fsanitize=address | ||
// SYCL_XARCH_HOST_OPTION-SAME: -fsanitize-address-use-after-scope | ||
// SYCL_XARCH_HOST_OPTION-NEXT: libclang_rt.asan | ||
// SYCL_XARCH_HOST_ONLY: clang{{.*}} "-fsycl-is-device" | ||
// SYCL_XARCH_HOST_ONLY-NOT: -fsanitize=address | ||
// SYCL_XARCH_HOST_ONLY: clang{{.*}} "-fsycl-is-host" | ||
|
||
/// test behavior of -Xarch_host with multiple options for SYCL compiler, the | ||
/// flags should be passed to host compilation only. | ||
// RUN: %clangxx -fsycl %s -Xarch_host "-fsanitize=address -DXARCH_HOST_TEST -mllvm -enable-merge-functions" -### 2>&1 \ | ||
// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_HOST_OPTIONS1 | ||
// RUN: %clangxx -fsycl %s -Xarch_host "-fsanitize=address -DXARCH_HOST_TEST -mllvm -enable-merge-functions" -### 2>&1 \ | ||
// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_HOST_OPTIONS2 | ||
// RUN: %clangxx -fsycl %s -Xarch_host "-fsanitize=address -DXARCH_HOST_TEST -mllvm -enable-merge-functions" -### 2>&1 \ | ||
// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_HOST_OPTIONS3 | ||
// SYCL_XARCH_HOST_OPTIONS1: clang{{.*}} "-fsycl-is-host" | ||
// SYCL_XARCH_HOST_OPTIONS1-SAME: -fsanitize=address | ||
// SYCL_XARCH_HOST_OPTIONS1-SAME: -fsanitize-address-use-after-scope | ||
// SYCL_XARCH_HOST_OPTIONS2: clang{{.*}} "-fsycl-is-host" | ||
// SYCL_XARCH_HOST_OPTIONS2-SAME: XARCH_HOST_TEST | ||
// SYCL_XARCH_HOST_OPTIONS3: clang{{.*}} "-fsycl-is-host" | ||
// SYCL_XARCH_HOST_OPTIONS3-SAME: "-mllvm" "-enable-merge-functions" | ||
|
||
// test behavior of combination of -Xarch_device and -Xarch_device. | ||
// RUN: %clangxx -fsycl %s -Xarch_device "-fsanitize=address -mllvm -enable-merge-functions" \ | ||
// RUN: -Xarch_host "-fsanitize=memory -DUSE_XARCH_HOST -fno-builtin" -### 2>&1 \ | ||
// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_COM_DEVICE_OPTIONS1 | ||
// RUN: %clangxx -fsycl %s -Xarch_device "-fsanitize=address -mllvm -enable-merge-functions" \ | ||
// RUN: -Xarch_host "-fsanitize=memory -DUSE_XARCH_HOST -fno-builtin" -### 2>&1 \ | ||
// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_COM_DEVICE_OPTIONS2 | ||
// RUN: %clangxx -fsycl %s -Xarch_device "-fsanitize=address -mllvm -enable-merge-functions" \ | ||
// RUN: -Xarch_host "-fsanitize=memory -DUSE_XARCH_HOST -fno-builtin" -### 2>&1 \ | ||
// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_COM_NO_DEVICE | ||
// RUN: %clangxx -fsycl %s -Xarch_device "-fsanitize=address -mllvm -enable-merge-functions" \ | ||
// RUN: -Xarch_host "-fsanitize=memory -DUSE_XARCH_HOST -fno-builtin" -### 2>&1 \ | ||
// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_COM_HOST_OPTIONS1 | ||
// RUN: %clangxx -fsycl %s -Xarch_device "-fsanitize=address -mllvm -enable-merge-functions" \ | ||
// RUN: -Xarch_host "-fsanitize=memory -DUSE_XARCH_HOST -fno-builtin" -### 2>&1 \ | ||
// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_COM_HOST_OPTIONS2 | ||
// RUN: %clangxx -fsycl %s -Xarch_device "-fsanitize=address -mllvm -enable-merge-functions" \ | ||
// RUN: -Xarch_host "-fsanitize=memory -DUSE_XARCH_HOST -fno-builtin" -### 2>&1 \ | ||
// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_COM_HOST_OPTIONS3 | ||
// RUN: %clangxx -fsycl %s -Xarch_device "-fsanitize=address -mllvm -enable-merge-functions" \ | ||
// RUN: -Xarch_host "-fsanitize=memory -DUSE_XARCH_HOST -fno-builtin" -### 2>&1 \ | ||
// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_COM_NO_HOST | ||
// SYCL_XARCH_COM_DEVICE_OPTIONS1: clang{{.*}} "-fsycl-is-device" | ||
// SYCL_XARCH_COM_DEVICE_OPTIONS1-SAME: -fsanitize=address | ||
// SYCL_XARCH_COM_DEVICE_OPTIONS1-SAME: -fsanitize-address-use-after-return=never | ||
// SYCL_XARCH_COM_DEVICE_OPTIONS1-SAME: -fno-sanitize-address-use-after-scope | ||
// SYCL_XARCH_COM_DEVICE_OPTIONS1-SAME: "-mllvm" "-asan-instrumentation-with-call-threshold=0" | ||
// SYCL_XARCH_COM_DEVICE_OPTIONS1-SAME: "-mllvm" "-asan-stack=0" | ||
// SYCL_XARCH_COM_DEVICE_OPTIONS1-SAME: "-mllvm" "-asan-globals=0" | ||
// SYCL_XARCH_COM_DEVICE_OPTIONS2: clang{{.*}} "-fsycl-is-device" | ||
// SYCL_XARCH_COM_DEVICE_OPTIONS2-SAME: "-mllvm" "-enable-merge-functions" | ||
// SYCL_XARCH_COM_NO_DEVICE: clang{{.*}} "-fsycl-is-device" | ||
// SYCL_XARCH_COM_NO_DEVICE-NOT: USE_XARCH_HOST | ||
// SYCL_XARCH_COM_NO_DEVICE: clang{{.*}} "-fsycl-is-host" | ||
// SYCL_XARCH_COM_HOST_OPTIONS1: clang{{.*}} "-fsycl-is-host" | ||
// SYCL_XARCH_COM_HOST_OPTIONS1-SAME: -fsanitize=memory | ||
// SYCL_XARCH_COM_HOST_OPTIONS1-NEXT: libclang_rt.msan | ||
// SYCL_XARCH_COM_HOST_OPTIONS2: clang{{.*}} "-fsycl-is-host" | ||
// SYCL_XARCH_COM_HOST_OPTIONS2-SAME: USE_XARCH_HOST | ||
// SYCL_XARCH_COM_HOST_OPTIONS3: clang{{.*}} "-fsycl-is-host" | ||
// SYCL_XARCH_COM_HOST_OPTIONS3-SAME: -fno-builtin | ||
// SYCL_XARCH_COM_NO_HOST: clang{{.*}} "-fsycl-is-host" | ||
// SYCL_XARCH_COM_NO_HOST-NOT: "-mllvm" "-enable-merge-functions" | ||
|
||
|
||
// test behavior of multiple usage of -Xarch_host in single command line | ||
// RUN: %clangxx -fsycl %s -Xarch_host "-fsanitize=address -mllvm -enable-merge-functions" \ | ||
// RUN: -Xarch_host -DFOO -Xarch_host -DFOO1 -### 2>&1 \ | ||
// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_HOST_MULTIPLE1 | ||
// RUN: %clangxx -fsycl %s -Xarch_host "-fsanitize=address -mllvm -enable-merge-functions" \ | ||
// RUN: -Xarch_host -DFOO -Xarch_host -DFOO1 -### 2>&1 \ | ||
// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_HOST_MULTIPLE2 | ||
// RUN: %clangxx -fsycl %s -Xarch_host "-fsanitize=address -mllvm -enable-merge-functions" \ | ||
// RUN: -Xarch_host -DFOO -Xarch_host -DFOO1 -### 2>&1 \ | ||
// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_HOST_MULTIPLE3 | ||
// RUN: %clangxx -fsycl %s -Xarch_host "-fsanitize=address -mllvm -enable-merge-functions" \ | ||
// RUN: -Xarch_host -DFOO -Xarch_host -DFOO1 -### 2>&1 \ | ||
// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_HOST_MULTIPLE4 | ||
// RUN: %clangxx -fsycl %s -Xarch_host "-fsanitize=address -mllvm -enable-merge-functions" \ | ||
// RUN: -Xarch_host -DFOO -Xarch_host -DFOO1 -### 2>&1 \ | ||
// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_NO_DEVICE_MULTIPLE1 | ||
// RUN: %clangxx -fsycl %s -Xarch_host "-fsanitize=address -mllvm -enable-merge-functions" \ | ||
// RUN: -Xarch_host -DFOO -Xarch_host -DFOO1 -### 2>&1 \ | ||
// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_NO_DEVICE_MULTIPLE2 | ||
// RUN: %clangxx -fsycl %s -Xarch_host "-fsanitize=address -mllvm -enable-merge-functions" \ | ||
// RUN: -Xarch_host -DFOO -Xarch_host -DFOO1 -### 2>&1 \ | ||
// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_NO_DEVICE_MULTIPLE3 | ||
// SYCL_XARCH_HOST_MULTIPLE1: clang{{.*}} "-fsycl-is-host" | ||
// SYCL_XARCH_HOST_MULTIPLE1-SAME: -fsanitize=address | ||
// SYCL_XARCH_HOST_MULTIPLE1-NEXT: libclang_rt.asan | ||
// SYCL_XARCH_HOST_MULTIPLE2: clang{{.*}} "-fsycl-is-host" | ||
// SYCL_XARCH_HOST_MULTIPLE2-SAME: "-mllvm" "-enable-merge-functions" | ||
// SYCL_XARCH_HOST_MULTIPLE3: clang{{.*}} "-fsycl-is-host" | ||
// SYCL_XARCH_HOST_MULTIPLE3-SAME: "FOO" | ||
// SYCL_XARCH_HOST_MULTIPLE4: clang{{.*}} "-fsycl-is-host" | ||
// SYCL_XARCH_HOST_MULTIPLE4-SAME: "FOO1" | ||
// SYCL_XARCH_NO_DEVICE_MULTIPLE1: clang{{.*}} "-fsycl-is-device" | ||
// SYCL_XARCH_NO_DEVICE_MULTIPLE1-NOT: -fsanitize=address | ||
// SYCL_XARCH_NO_DEVICE_MULTIPLE1: llc{{.*}} "-filetype=obj" | ||
// SYCL_XARCH_NO_DEVICE_MULTIPLE2: clang{{.*}} "-fsycl-is-device" | ||
// SYCL_XARCH_NO_DEVICE_MULTIPLE2-NOT: "-mllvm" "-enable-merge-functions" | ||
// SYCL_XARCH_NO_DEVICE_MULTIPLE2: llc{{.*}} "-filetype=obj" | ||
// SYCL_XARCH_NO_DEVICE_MULTIPLE3: clang{{.*}} "-fsycl-is-device" | ||
// SYCL_XARCH_NO_DEVICE_MULTIPLE3-NOT: "FOO" | ||
// SYCL_XARCH_NO_DEVICE_MULTIPLE3: llc{{.*}} "-filetype=obj" |
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.