Skip to content

Commit 1d4e066

Browse files
author
LU-JOHN
authored
Add option "-fsycl-allow-device-image-dependencies" (#15407)
Add option "-fsycl-allow-device-image-dependencies". This option replaces "-fsycl-allow-device-dependencies" which is deprecated. --------- Signed-off-by: Lu, John <john.lu@intel.com>
1 parent 7eb082c commit 1d4e066

File tree

17 files changed

+35
-19
lines changed

17 files changed

+35
-19
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7049,9 +7049,16 @@ def fsycl_remove_unused_external_funcs : Flag<["-"], "fsycl-remove-unused-extern
70497049
def fno_sycl_remove_unused_external_funcs : Flag<["-"], "fno-sycl-remove-unused-external-funcs">,
70507050
HelpText<"Prevent removal of unused `SYCL_EXTERNAL` functions">;
70517051
def fsycl_allow_device_dependencies : Flag<["-"], "fsycl-allow-device-dependencies">,
7052-
HelpText<"Allow dependencies between device code images">;
7052+
HelpText<"Deprecated: please use -fsycl-allow-device-image-dependencies instead.">,
7053+
Flags<[Deprecated]>;
70537054
def fno_sycl_allow_device_dependencies : Flag<["-"], "fno-sycl-allow-device-dependencies">,
7054-
HelpText<"Do not allow dependencies between device code images (default)">;
7055+
HelpText<"Deprecated: please use -fno-sycl-allow-device-image-dependencies instead.">,
7056+
Flags<[Deprecated]>;
7057+
7058+
defm sycl_allow_device_image_dependencies: BoolOptionWithoutMarshalling<"f", "sycl-allow-device-image-dependencies",
7059+
PosFlag<SetTrue, [], [ClangOption], "Allow dependencies between device code images">,
7060+
NegFlag<SetFalse, [], [ClangOption], "Do not allow dependencies between device code images (default)">>;
7061+
70557062
def fsycl_dump_device_code_EQ : Joined<["-"], "fsycl-dump-device-code=">,
70567063
Flags<[NoXarchOption]>,
70577064
HelpText<"Dump device code into the user provided directory.">;

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10801,10 +10801,17 @@ static void addArgs(ArgStringList &DstArgs, const llvm::opt::ArgList &Alloc,
1080110801
}
1080210802
}
1080310803

10804-
static bool allowDeviceDependencies(const llvm::opt::ArgList &TCArgs) {
10804+
static bool allowDeviceImageDependencies(const llvm::opt::ArgList &TCArgs) {
10805+
// deprecated
1080510806
if (TCArgs.hasFlag(options::OPT_fsycl_allow_device_dependencies,
1080610807
options::OPT_fno_sycl_allow_device_dependencies, false))
1080710808
return true;
10809+
10810+
// preferred
10811+
if (TCArgs.hasFlag(options::OPT_fsycl_allow_device_image_dependencies,
10812+
options::OPT_fno_sycl_allow_device_image_dependencies, false))
10813+
return true;
10814+
1080810815
return false;
1080910816
}
1081010817

@@ -10835,7 +10842,7 @@ static void getNonTripleBasedSYCLPostLinkOpts(const ToolChain &TC,
1083510842
options::OPT_fsycl_esimd_force_stateless_mem, false))
1083610843
addArgs(PostLinkArgs, TCArgs, {"-lower-esimd-force-stateless-mem=false"});
1083710844

10838-
if (allowDeviceDependencies(TCArgs))
10845+
if (allowDeviceImageDependencies(TCArgs))
1083910846
addArgs(PostLinkArgs, TCArgs, {"-allow-device-image-dependencies"});
1084010847
}
1084110848

@@ -10853,7 +10860,7 @@ static bool shouldEmitOnlyKernelsAsEntryPoints(const ToolChain &TC,
1085310860
return true;
1085410861
// When supporting dynamic linking, non-kernels in a device image can be
1085510862
// called.
10856-
if (allowDeviceDependencies(TCArgs))
10863+
if (allowDeviceImageDependencies(TCArgs))
1085710864
return false;
1085810865
if (Triple.isNVPTX() || Triple.isAMDGPU())
1085910866
return false;

clang/test/Driver/sycl-deprecated.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@
33
// RUN: %clangxx -fno-sycl-explicit-simd %s -### 2>&1 | FileCheck %s -DOPTION=-fno-sycl-explicit-simd
44
// RUN: %clangxx -fsycl -fsycl-use-bitcode %s -### 2>&1 | FileCheck %s -DOPTION=-fsycl-use-bitcode
55
// RUN: %clangxx -fsycl -fno-sycl-use-bitcode %s -### 2>&1 | FileCheck %s -DOPTION=-fno-sycl-use-bitcode
6+
// RUN: %clangxx -fsycl -fsycl-allow-device-dependencies %s -### 2>&1 | FileCheck %s -DOPTION=-fsycl-allow-device-dependencies
7+
// RUN: %clangxx -fsycl -fno-sycl-allow-device-dependencies %s -### 2>&1 | FileCheck %s -DOPTION=-fno-sycl-allow-device-dependencies
68
// CHECK: option '[[OPTION]]' is deprecated and will be removed in a future release

clang/test/Driver/sycl-offload-old-model.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -174,16 +174,16 @@
174174
// RUN: %clang -### -target x86_64-unknown-linux-gnu -fsycl --no-offload-new-driver -fsycl-targets=spir64_gen %s 2>&1 | FileCheck -check-prefix=CHECK_SYCL_POST_LINK_OPT_PASS %s
175175
// CHECK_SYCL_POST_LINK_OPT_PASS: sycl-post-link{{.*}}emit-only-kernels-as-entry-points
176176
// RUN: %clang -### -target x86_64-unknown-linux-gnu -fsycl --no-offload-new-driver -fsycl-targets=spir64_gen -fno-sycl-remove-unused-external-funcs %s 2>&1 | FileCheck -check-prefix=CHECK_SYCL_POST_LINK_OPT_NO_PASS %s
177-
// RUN: %clang -### -target x86_64-unknown-linux-gnu -fsycl --no-offload-new-driver -fsycl-targets=spir64_gen -fsycl-allow-device-dependencies %s 2>&1 | FileCheck -check-prefix=CHECK_SYCL_POST_LINK_OPT_NO_PASS %s
177+
// RUN: %clang -### -target x86_64-unknown-linux-gnu -fsycl --no-offload-new-driver -fsycl-targets=spir64_gen -fsycl-allow-device-image-dependencies %s 2>&1 | FileCheck -check-prefix=CHECK_SYCL_POST_LINK_OPT_NO_PASS %s
178178
// CHECK_SYCL_POST_LINK_OPT_NO_PASS-NOT: sycl-post-link{{.*}}emit-only-kernels-as-entry-points
179179

180180
/// Check selective passing of -allow-device-image-dependencies to sycl-post-link tool
181-
// RUN: %clang -### -target x86_64-unknown-linux-gnu -fsycl --no-offload-new-driver -fsycl-targets=spir64_fpga -fsycl-allow-device-dependencies %s 2>&1 | FileCheck -check-prefix=CHECK_SYCL_POST_LINK_ADID_PASS %s
182-
// RUN: %clang -### -target x86_64-unknown-linux-gnu -fsycl --no-offload-new-driver -fsycl-targets=spir64_gen -fsycl-allow-device-dependencies %s 2>&1 | FileCheck -check-prefix=CHECK_SYCL_POST_LINK_ADID_PASS %s
183-
// RUN: %clang -### -target x86_64-unknown-linux-gnu -fsycl --no-offload-new-driver -fsycl-targets=spir64_gen -fno-sycl-allow-device-dependencies %s 2>&1 | FileCheck -check-prefix=CHECK_SYCL_POST_LINK_ADID_NO_PASS %s
184-
// RUN: %clang_cl -### -fsycl --no-offload-new-driver -fsycl-targets=spir64_fpga -fsycl-allow-device-dependencies %s 2>&1 | FileCheck -check-prefix=CHECK_SYCL_POST_LINK_ADID_PASS %s
185-
// RUN: %clang_cl -### -fsycl --no-offload-new-driver -fsycl-targets=spir64_gen -fsycl-allow-device-dependencies %s 2>&1 | FileCheck -check-prefix=CHECK_SYCL_POST_LINK_ADID_PASS %s
186-
// RUN: %clang_cl -### -fsycl --no-offload-new-driver -fsycl-targets=spir64_gen -fno-sycl-allow-device-dependencies %s 2>&1 | FileCheck -check-prefix=CHECK_SYCL_POST_LINK_ADID_NO_PASS %s
181+
// RUN: %clang -### -target x86_64-unknown-linux-gnu -fsycl --no-offload-new-driver -fsycl-targets=spir64_fpga -fsycl-allow-device-image-dependencies %s 2>&1 | FileCheck -check-prefix=CHECK_SYCL_POST_LINK_ADID_PASS %s
182+
// RUN: %clang -### -target x86_64-unknown-linux-gnu -fsycl --no-offload-new-driver -fsycl-targets=spir64_gen -fsycl-allow-device-image-dependencies %s 2>&1 | FileCheck -check-prefix=CHECK_SYCL_POST_LINK_ADID_PASS %s
183+
// RUN: %clang -### -target x86_64-unknown-linux-gnu -fsycl --no-offload-new-driver -fsycl-targets=spir64_gen -fno-sycl-allow-device-image-dependencies %s 2>&1 | FileCheck -check-prefix=CHECK_SYCL_POST_LINK_ADID_NO_PASS %s
184+
// RUN: %clang_cl -### -fsycl --no-offload-new-driver -fsycl-targets=spir64_fpga -fsycl-allow-device-image-dependencies %s 2>&1 | FileCheck -check-prefix=CHECK_SYCL_POST_LINK_ADID_PASS %s
185+
// RUN: %clang_cl -### -fsycl --no-offload-new-driver -fsycl-targets=spir64_gen -fsycl-allow-device-image-dependencies %s 2>&1 | FileCheck -check-prefix=CHECK_SYCL_POST_LINK_ADID_PASS %s
186+
// RUN: %clang_cl -### -fsycl --no-offload-new-driver -fsycl-targets=spir64_gen -fno-sycl-allow-device-image-dependencies %s 2>&1 | FileCheck -check-prefix=CHECK_SYCL_POST_LINK_ADID_NO_PASS %s
187187

188188
// CHECK_SYCL_POST_LINK_ADID_PASS: sycl-post-link{{.*}}allow-device-image-dependencies
189189
// CHECK_SYCL_POST_LINK_ADID_NO_PASS-NOT: sycl-post-link{{.*}}allow-device-image-dependencies

0 commit comments

Comments
 (0)