forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
[clang-sycl-linker] Replace llvm-link with API calls #4
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
Draft
asudarsa
wants to merge
16
commits into
master
Choose a base branch
from
replace_llvm_link
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 4 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
ce34ccd
[clang-sycl-linker] Replace llvm-link with API calls
asudarsa ae0210f
More changes
asudarsa ee487ff
More changes
asudarsa a9255b4
Add tests
asudarsa e0d1859
Major refactoring to address review comments and also add back .bc su…
asudarsa c1611f0
Minor changes
asudarsa 596488c
Modify testcase and update CMakeLists.txt to make sure shared build w…
asudarsa 454c386
Adding more tests and remove support for non-bitcode inputs
asudarsa f4cc3cf
Pruned some tests
asudarsa d76a3a1
Minor fix
asudarsa 7249cb8
Minor fix
asudarsa 59c0bcd
Simplify tests and update comments
asudarsa a5acaa3
Added -dry-run option to testing
asudarsa 0649b61
Remove unnecessary file
asudarsa 987ab66
Valid LLVM IR bitcode input files are required
asudarsa 917987d
Minor changes to align with changes in SPIR-V backend PR
asudarsa 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,48 +1,35 @@ | ||
| // Tests the clang-sycl-linker tool. | ||
| // | ||
| // Test a simple case without arguments. | ||
| // RUN: %clangxx -emit-llvm -c %s -o %t_1.bc | ||
| // RUN: %clangxx -emit-llvm -c %s -o %t_2.bc | ||
| // RUN: clang-sycl-linker --dry-run -triple spirv64 %t_1.bc %t_2.bc -o a.spv 2>&1 \ | ||
| // RUN: %clangxx -c -target spirv64 %s -o %t_1.o | ||
| // RUN: %clangxx -c -target spirv64 %s -o %t_2.o | ||
| // RUN: clang-sycl-linker --dry-run %t_1.o %t_2.o -o a.spv 2>&1 \ | ||
| // RUN: | FileCheck %s --check-prefix=SIMPLE | ||
| // SIMPLE: "{{.*}}llvm-link{{.*}}" {{.*}}.bc {{.*}}.bc -o [[FIRSTLLVMLINKOUT:.*]].bc --suppress-warnings | ||
| // SIMPLE-NEXT: "{{.*}}llvm-spirv{{.*}}" {{.*}}-o a.spv [[FIRSTLLVMLINKOUT]].bc | ||
| // | ||
| // Test that llvm-link is not called when only one input is present. | ||
asudarsa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // RUN: clang-sycl-linker --dry-run -triple spirv64 %t_1.bc -o a.spv 2>&1 \ | ||
| // RUN: | FileCheck %s --check-prefix=SIMPLE-NO-LINK | ||
| // SIMPLE-NO-LINK: "{{.*}}llvm-spirv{{.*}}" {{.*}}-o a.spv {{.*}}.bc | ||
| // SIMPLE: sycl-device-link: input: {{.*}}.o; {{.*}}.o; libfiles: output: [[LLVMLINKOUT:.*]].bc | ||
| // SIMPLE-NEXT: "{{.*}}llvm-spirv{{.*}}" {{.*}}-o a.spv [[LLVMLINKOUT]].bc | ||
| // | ||
| // Test a simple case with device library files specified. | ||
| // RUN: touch %T/lib1.bc | ||
| // RUN: touch %T/lib2.bc | ||
| // RUN: clang-sycl-linker --dry-run -triple spirv64 %t_1.bc %t_2.bc --library-path=%T --device-libs=lib1.bc,lib2.bc -o a.spv 2>&1 \ | ||
| // RUN: touch %T/lib1.o | ||
| // RUN: touch %T/lib2.o | ||
| // RUN: clang-sycl-linker --dry-run %t_1.o %t_2.o --library-path=%T --device-libs=lib1.o,lib2.o -o a.spv 2>&1 \ | ||
| // RUN: | FileCheck %s --check-prefix=DEVLIBS | ||
| // DEVLIBS: "{{.*}}llvm-link{{.*}}" {{.*}}.bc {{.*}}.bc -o [[FIRSTLLVMLINKOUT:.*]].bc --suppress-warnings | ||
| // DEVLIBS-NEXT: "{{.*}}llvm-link{{.*}}" -only-needed [[FIRSTLLVMLINKOUT]].bc {{.*}}lib1.bc {{.*}}lib2.bc -o [[SECONDLLVMLINKOUT:.*]].bc --suppress-warnings | ||
| // DEVLIBS-NEXT: "{{.*}}llvm-spirv{{.*}}" {{.*}}-o a.spv [[SECONDLLVMLINKOUT]].bc | ||
| // | ||
| // Test a simple case with .o (fat object) as input. | ||
asudarsa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // TODO: Remove this test once fat object support is added. | ||
| // RUN: %clangxx -c %s -o %t.o | ||
| // RUN: not clang-sycl-linker --dry-run -triple spirv64 %t.o -o a.spv 2>&1 \ | ||
| // RUN: | FileCheck %s --check-prefix=FILETYPEERROR | ||
| // FILETYPEERROR: Unsupported file type | ||
| // DEVLIBS: sycl-device-link: input: {{.*}}.o; libfiles: {{.*}}lib1.o; {{.*}}lib2.o; output: [[LLVMLINKOUT:.*]].bc | ||
| // DEVLIBS-NEXT: "{{.*}}llvm-spirv{{.*}}" {{.*}}-o a.spv [[LLVMLINKOUT]].bc | ||
| // | ||
| // Test to see if device library related errors are emitted. | ||
| // RUN: not clang-sycl-linker --dry-run -triple spirv64 %t_1.bc %t_2.bc --library-path=%T --device-libs= -o a.spv 2>&1 \ | ||
| // RUN: not clang-sycl-linker --dry-run %t_1.o %t_2.o --library-path=%T --device-libs= -o a.spv 2>&1 \ | ||
| // RUN: | FileCheck %s --check-prefix=DEVLIBSERR1 | ||
| // DEVLIBSERR1: Number of device library files cannot be zero | ||
| // RUN: not clang-sycl-linker --dry-run -triple spirv64 %t_1.bc %t_2.bc --library-path=%T --device-libs=lib1.bc,lib2.bc,lib3.bc -o a.spv 2>&1 \ | ||
| // RUN: not clang-sycl-linker --dry-run %t_1.o %t_2.o --library-path=%T --device-libs=lib1.o,lib2.o,lib3.o -o a.spv 2>&1 \ | ||
| // RUN: | FileCheck %s --check-prefix=DEVLIBSERR2 | ||
| // DEVLIBSERR2: '{{.*}}lib3.bc' SYCL device library file is not found | ||
| // DEVLIBSERR2: '{{.*}}lib3.o' SYCL device library file is not found | ||
| // | ||
| // Test if correct set of llvm-spirv options are emitted for windows environment. | ||
| // RUN: clang-sycl-linker --dry-run -triple spirv64 --is-windows-msvc-env %t_1.bc %t_2.bc -o a.spv 2>&1 \ | ||
| // RUN: clang-sycl-linker --dry-run --is-windows-msvc-env %t_1.o %t_2.o -o a.spv 2>&1 \ | ||
| // RUN: | FileCheck %s --check-prefix=LLVMOPTSWIN | ||
| // LLVMOPTSWIN: -spirv-debug-info-version=ocl-100 -spirv-allow-extra-diexpressions -spirv-allow-unknown-intrinsics=llvm.genx. -spirv-ext= | ||
| // | ||
| // Test if correct set of llvm-spirv options are emitted for linux environment. | ||
| // RUN: clang-sycl-linker --dry-run -triple spirv64 %t_1.bc %t_2.bc -o a.spv 2>&1 \ | ||
| // RUN: clang-sycl-linker --dry-run %t_1.o %t_2.o -o a.spv 2>&1 \ | ||
| // RUN: | FileCheck %s --check-prefix=LLVMOPTSLIN | ||
| // LLVMOPTSLIN: -spirv-debug-info-version=nonsemantic-shader-200 -spirv-allow-unknown-intrinsics=llvm.genx. -spirv-ext= | ||
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
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.