-
Notifications
You must be signed in to change notification settings - Fork 800
[NewOffloadModel] Remove compiler backend option and linker option to be passed as argument for ClangLinkerWrapper #20691
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
base: sycl
Are you sure you want to change the base?
Changes from 8 commits
2ee12b0
1488454
da1c270
0452eb7
71c475b
2993152
7d0ee38
e88a3fb
f4730f1
2f11978
fe390ac
7232ae9
eea2fd1
fd60624
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 | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -5232,7 +5232,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, | |||||||
| (JA.isHostOffloading(C.getActiveOffloadKinds()) && | ||||||||
| Args.hasFlag(options::OPT_offload_new_driver, | ||||||||
| options::OPT_no_offload_new_driver, | ||||||||
| C.isOffloadingHostKind(Action::OFK_Cuda))); | ||||||||
| C.isOffloadingHostKind(Action::OFK_Cuda))) || | ||||||||
| (JA.isHostOffloading(Action::OFK_SYCL) && | ||||||||
| C.getDriver().GetUseNewOffloadDriverForSYCLOffload(C, Args)); | ||||||||
|
|
||||||||
| bool IsRDCMode = | ||||||||
| Args.hasFlag(options::OPT_fgpu_rdc, options::OPT_fno_gpu_rdc, IsSYCL); | ||||||||
|
|
@@ -11245,14 +11247,16 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA, | |||||||
| if (Kind == Action::OFK_OpenMP && !Args.hasArg(OPT_no_offloadlib) && | ||||||||
| (TC->getTriple().isAMDGPU() || TC->getTriple().isNVPTX())) | ||||||||
| LinkerArgs.emplace_back("-lompdevice"); | ||||||||
|
|
||||||||
| // Forward all of these to the appropriate toolchain. | ||||||||
| for (StringRef Arg : CompilerArgs) | ||||||||
| CmdArgs.push_back(Args.MakeArgString( | ||||||||
| "--device-compiler=" + TC->getTripleString() + "=" + Arg)); | ||||||||
| for (StringRef Arg : LinkerArgs) | ||||||||
| CmdArgs.push_back(Args.MakeArgString( | ||||||||
| "--device-linker=" + TC->getTripleString() + "=" + Arg)); | ||||||||
| if (!C.hasOffloadToolChain<Action::OFK_SYCL>()) { | ||||||||
|
||||||||
| // RUN: %clang -### -target x86_64-pc-linux-gnu -fopenmp --offload-arch=gfx90a \ | |
| // RUN: -O3 -nogpulib %s 2>&1 | FileCheck %s --check-prefix=CHECK-OPT | |
| // CHECK-OPT: clang-linker-wrapper{{.*}}"--device-compiler=amdgcn-amd-amdhsa=-O3" |
If we add CompilerArgs to --device-compiler=, it will later be passed into clang-linker-wrapper and used for options for ocloc, which I don't think we will want that. For SYCL, we only want to pass the argument after -Xsycl-target-backend=spir64_gen and -Xsycl-target-backend=spir64_x86_64 -backend-cpu-opt.
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.
If we add CompilerArgs to --device-compiler=, it will later be passed into clang-linker-wrapper
Is not it the behavior that is expected?
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -141,27 +141,14 @@ | |
| // MULT_TARG_PHASES: 15: backend, {14}, assembler, (host-sycl) | ||
| // MULT_TARG_PHASES: 16: assembler, {15}, object, (host-sycl) | ||
|
|
||
| /// Test option passing behavior for clang-offload-wrapper options. | ||
| // RUN: %clangxx --target=x86_64-unknown-linux-gnu -fsycl --offload-new-driver \ | ||
| // RUN: -Xsycl-target-backend -backend-opt -### %s 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. Per my understanding, we still need to pass
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. Thanks for pointing this out! I think for backend option and linker option that are passed at compile time, they are stored in the Only the Therefore, for this test and the one got deleted below,
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. Yes, I understand how it works with your implementation. And I challenge that. Despite we extracted and put options to SYCLImage on compile stage, we still want to pass these options to link stage as well. |
||
| // RUN: | FileCheck -check-prefix WRAPPER_OPTIONS_BACKEND %s | ||
| // WRAPPER_OPTIONS_BACKEND: clang-linker-wrapper{{.*}} "--sycl-backend-compile-options={{.*}}-backend-opt{{.*}}" | ||
|
|
||
| // RUN: %clangxx --target=x86_64-unknown-linux-gnu -fsycl --offload-new-driver \ | ||
| // RUN: -Xsycl-target-linker -link-opt -### %s 2>&1 \ | ||
| // RUN: | FileCheck -check-prefix WRAPPER_OPTIONS_LINK %s | ||
| // WRAPPER_OPTIONS_LINK: clang-linker-wrapper{{.*}} "--sycl-target-link-options={{.*}}-link-opt{{.*}}" | ||
|
|
||
| /// Test option passing behavior for clang-offload-wrapper options for AOT. | ||
| /// Test option passing behavior for clang-offload-wrapper options for AOT | ||
| // RUN: %clangxx --target=x86_64-unknown-linux-gnu -fsycl --offload-new-driver \ | ||
| // RUN: -fsycl-targets=spir64_gen,spir64_x86_64 \ | ||
| // RUN: -Xsycl-target-backend=spir64_gen -backend-gen-opt \ | ||
| // RUN: -Xsycl-target-backend=spir64_x86_64 -backend-cpu-opt \ | ||
| // RUN: -### %s 2>&1 \ | ||
| // RUN: | FileCheck -check-prefix WRAPPER_OPTIONS_BACKEND_AOT %s | ||
| // WRAPPER_OPTIONS_BACKEND_AOT: clang-linker-wrapper{{.*}} "--host-triple=x86_64-unknown-linux-gnu" | ||
| // WRAPPER_OPTIONS_BACKEND_AOT-SAME: "--gpu-tool-arg=-backend-gen-opt" | ||
| // WRAPPER_OPTIONS_BACKEND_AOT-SAME: "--cpu-tool-arg=-backend-cpu-opt" | ||
| // WRAPPER_OPTIONS_BACKEND_AOT: clang-linker-wrapper{{.*}} "--host-triple=x86_64-unknown-linux-gnu" {{.*}} "--device-compiler=spir64_gen-unknown-unknown=-backend-gen-opt" "--device-compiler=spir64_x86_64-unknown-unknown=-backend-cpu-opt" | ||
|
|
||
| /// Verify arch settings for nvptx and amdgcn targets | ||
| // RUN: %clangxx -fsycl -### -fsycl-targets=amdgcn-amd-amdhsa -fno-sycl-libspirv \ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -325,11 +325,6 @@ | |
| // CHK-NO-FSYCL-TARGET-ERROR-NOT: clang{{.*}} error: cannot deduce implicit triple value for '-Xsycl-target-frontend', specify triple using '-Xsycl-target-frontend=<triple>' | ||
|
|
||
| /// ########################################################################### | ||
|
|
||
| // RUN: %clang -### -target x86_64-unknown-linux-gnu -fsycl --offload-new-driver -fsycl-targets=spir64-unknown-unknown -Xsycl-target-backend "-DFOO1 -DFOO2" %s 2>&1 \ | ||
| // RUN: | FileCheck -check-prefix=CHK-TOOLS-OPTS %s | ||
| // CHK-TOOLS-OPTS: clang-linker-wrapper{{.*}} "--sycl-backend-compile-options=-DFOO1 -DFOO2" | ||
|
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. similar here, per my understanding, need to pass options using |
||
|
|
||
| /// Check for implied options (-g -O0) | ||
| // RUN: %clang -### -target x86_64-unknown-linux-gnu -fsycl --offload-new-driver -fsycl-targets=spir64-unknown-unknown -g -O0 -Xsycl-target-backend "-DFOO1 -DFOO2" %s 2>&1 \ | ||
| // RUN: | FileCheck -check-prefix=CHK-TOOLS-IMPLIED-OPTS %s | ||
|
|
@@ -346,10 +341,6 @@ | |
| // RUN: | FileCheck -check-prefix=CHK-TOOLS-IMPLIED-OPTS-O0 %s | ||
| // CHK-TOOLS-IMPLIED-OPTS-O0-NOT: llvm-offload-binary{{.*}} {{.*}}compile-opts={{.*}}-cl-opt-disable" | ||
|
|
||
| // RUN: %clang -### -target x86_64-unknown-linux-gnu -fsycl --offload-new-driver -fsycl-targets=spir64-unknown-unknown -Xsycl-target-linker "-DFOO1 -DFOO2" %s 2>&1 \ | ||
| // RUN: | FileCheck -check-prefix=CHK-TOOLS-OPTS2 %s | ||
| // CHK-TOOLS-OPTS2: clang-linker-wrapper{{.*}} "--sycl-target-link-options=-DFOO1 -DFOO2" | ||
|
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. same here, but for device-linker |
||
|
|
||
| /// -fsycl-range-rounding settings | ||
| /// | ||
| /// // Check that driver flag is passed to cc1 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,21 +52,13 @@ | |
| // RUN: | FileCheck -check-prefix DEFAULT_LINK %s | ||
| // DEFAULT_LINK: clang-linker-wrapper{{.*}} | ||
|
|
||
| /// Passing in the default triple should allow for -Xsycl-target options, both the | ||
| /// "=<triple>" and the default spelling | ||
| // RUN: %clangxx -### -target x86_64-unknown-linux-gnu -fsycl --offload-new-driver -fsycl-targets=spir64 -Xsycl-target-backend=spir64 -DFOO -Xsycl-target-linker=spir64 -DFOO2 %S/Inputs/SYCL/objlin64.o 2>&1 \ | ||
| // RUN: | FileCheck -check-prefixes=SYCL_TARGET_OPT %s | ||
| // RUN: %clangxx -### -target x86_64-unknown-linux-gnu -fsycl --offload-new-driver -Xsycl-target-backend=spir64 -DFOO -Xsycl-target-linker=spir64 -DFOO2 %S/Inputs/SYCL/objlin64.o 2>&1 \ | ||
| // RUN: | FileCheck -check-prefixes=SYCL_TARGET_OPT %s | ||
| // SYCL_TARGET_OPT: clang-linker-wrapper{{.*}} "--sycl-backend-compile-options=-DFOO" "--sycl-target-link-options=-DFOO2" | ||
|
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. same here... |
||
|
|
||
| // RUN: %clangxx -### -target x86_64-unknown-linux-gnu -fsycl --offload-new-driver -fsycl-targets=spir64_x86_64 -Xsycl-target-backend -DFOO %S/Inputs/SYCL/objlin64.o 2>&1 \ | ||
| // RUN: | FileCheck -check-prefixes=SYCL_TARGET_OPT_AOT,SYCL_TARGET_OPT_CPU %s | ||
| // RUN: %clangxx -### -target x86_64-unknown-linux-gnu -fsycl --offload-new-driver -fsycl-targets=spir64_gen -Xsycl-target-backend -DFOO %S/Inputs/SYCL/objlin64.o 2>&1 \ | ||
| // RUN: | FileCheck -check-prefixes=SYCL_TARGET_OPT_AOT,SYCL_TARGET_OPT_GPU %s | ||
| // SYCL_TARGET_OPT_AOT-NOT: error: cannot deduce implicit triple value for '-Xsycl-target-backend' | ||
| // SYCL_TARGET_OPT_CPU: clang-linker-wrapper{{.*}} "--cpu-tool-arg=-DFOO" | ||
| // SYCL_TARGET_OPT_GPU: clang-linker-wrapper{{.*}} "--gpu-tool-arg=-DFOO" | ||
| // SYCL_TARGET_OPT_CPU: clang-linker-wrapper{{.*}} "--device-compiler=spir64_x86_64-unknown-unknown=-DFOO" | ||
| // SYCL_TARGET_OPT_GPU: clang-linker-wrapper{{.*}} "--device-compiler=spir64_gen-unknown-unknown=-DFOO" | ||
|
|
||
| /// Check -fsycl-targets=spir64 enables addition of -ffine-grained-bitfield-accesses option | ||
| // RUN: %clangxx -### -fsycl-device-only --offload-new-driver %s 2>&1 | FileCheck -check-prefixes=CHECK_BITFIELD_OPTION %s | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.