Skip to content

Commit 8825863

Browse files
author
LU-JOHN
authored
[SYCL][NFC] Rename support dynamic linking (#15258)
Rename sycl-post-link option "-support-dynamic-linking" to "-allow-device-image-dependencies". This is consistent with the clang option that is tied to this sycl-post-link option, and is also consistent with what is being done inside sycl-post-link. --------- Signed-off-by: Lu, John <[email protected]>
1 parent 9d88bee commit 8825863

File tree

8 files changed

+31
-31
lines changed

8 files changed

+31
-31
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10791,7 +10791,7 @@ static void addArgs(ArgStringList &DstArgs, const llvm::opt::ArgList &Alloc,
1079110791
}
1079210792
}
1079310793

10794-
static bool supportDynamicLinking(const llvm::opt::ArgList &TCArgs) {
10794+
static bool allowDeviceDependencies(const llvm::opt::ArgList &TCArgs) {
1079510795
if (TCArgs.hasFlag(options::OPT_fsycl_allow_device_dependencies,
1079610796
options::OPT_fno_sycl_allow_device_dependencies, false))
1079710797
return true;
@@ -10825,8 +10825,8 @@ static void getNonTripleBasedSYCLPostLinkOpts(const ToolChain &TC,
1082510825
options::OPT_fsycl_esimd_force_stateless_mem, false))
1082610826
addArgs(PostLinkArgs, TCArgs, {"-lower-esimd-force-stateless-mem=false"});
1082710827

10828-
if (supportDynamicLinking(TCArgs))
10829-
addArgs(PostLinkArgs, TCArgs, {"-support-dynamic-linking"});
10828+
if (allowDeviceDependencies(TCArgs))
10829+
addArgs(PostLinkArgs, TCArgs, {"-allow-device-image-dependencies"});
1083010830
}
1083110831

1083210832
// On Intel targets we don't need non-kernel functions as entry points,
@@ -10843,7 +10843,7 @@ static bool shouldEmitOnlyKernelsAsEntryPoints(const ToolChain &TC,
1084310843
return true;
1084410844
// When supporting dynamic linking, non-kernels in a device image can be
1084510845
// called.
10846-
if (supportDynamicLinking(TCArgs))
10846+
if (allowDeviceDependencies(TCArgs))
1084710847
return false;
1084810848
if (Triple.isNVPTX() || Triple.isAMDGPU())
1084910849
return false;

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -177,16 +177,16 @@
177177
// 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
178178
// CHECK_SYCL_POST_LINK_OPT_NO_PASS-NOT: sycl-post-link{{.*}}emit-only-kernels-as-entry-points
179179

180-
/// Check selective passing of -support-dynamic-linking 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_SADD_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_SADD_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_SADD_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_SADD_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_SADD_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_SADD_NO_PASS %s
187-
188-
// CHECK_SYCL_POST_LINK_SADD_PASS: sycl-post-link{{.*}}support-dynamic-linking
189-
// CHECK_SYCL_POST_LINK_SADD_NO_PASS-NOT: sycl-post-link{{.*}}support-dynamic-linking
180+
/// 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
187+
188+
// CHECK_SYCL_POST_LINK_ADID_PASS: sycl-post-link{{.*}}allow-device-image-dependencies
189+
// CHECK_SYCL_POST_LINK_ADID_NO_PASS-NOT: sycl-post-link{{.*}}allow-device-image-dependencies
190190

191191
/// Check for correct handling of -fsycl-fp64-conv-emu option for different targets
192192
// RUN: %clang -### -target x86_64-unknown-linux-gnu -fsycl --no-offload-new-driver -fsycl-targets=spir64 -fsycl-fp64-conv-emu %s 2>&1 | FileCheck -check-prefix=CHECK_WARNING %s

llvm/lib/SYCLLowerIR/ModuleSplitter.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ constexpr char SYCL_SCOPE_NAME[] = "<SYCL>";
5252
constexpr char ESIMD_SCOPE_NAME[] = "<ESIMD>";
5353
constexpr char ESIMD_MARKER_MD[] = "sycl_explicit_simd";
5454

55-
cl::opt<bool> SupportDynamicLinking{
56-
"support-dynamic-linking",
57-
cl::desc("Generate device images that are suitable for dynamic linking"),
55+
cl::opt<bool> AllowDeviceImageDependencies{
56+
"allow-device-image-dependencies",
57+
cl::desc("Allow dependencies between device images"),
5858
cl::cat(getModuleSplitCategory()), cl::init(false)};
5959

6060
EntryPointsGroupScope selectDeviceCodeGroupScope(const Module &M,
@@ -670,7 +670,7 @@ static bool mustPreserveGV(const GlobalValue &GV) {
670670
// When dynamic linking is supported, we internalize everything that can
671671
// not be imported which also means that there is no point of having it
672672
// visible outside of the current module.
673-
if (SupportDynamicLinking)
673+
if (AllowDeviceImageDependencies)
674674
return canBeImportedFunction(*F);
675675

676676
// Otherwise, we are being even more aggressive: SYCL modules are expected
@@ -715,7 +715,7 @@ void ModuleDesc::cleanup() {
715715

716716
// Callback for internalize can't be a lambda with captures, so we propagate
717717
// necessary information through the module itself.
718-
if (!SupportDynamicLinking)
718+
if (!AllowDeviceImageDependencies)
719719
for (Function *F : EntryPoints.Functions)
720720
F->addFnAttr("sycl-entry-point");
721721

@@ -1391,7 +1391,7 @@ bool canBeImportedFunction(const Function &F) {
13911391
// of user device code (e.g. _Z38__spirv_JointMatrixWorkItemLength...) In
13921392
// order to be safe and not require perfect name analysis just start with this
13931393
// simple check.
1394-
if (!SupportDynamicLinking)
1394+
if (!AllowDeviceImageDependencies)
13951395
return false;
13961396

13971397
// SYCL_EXTERNAL property is not recorded for a declaration

llvm/test/tools/sycl-post-link/emit_imported_symbols.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
; This test checks that the -emit-imported-symbols option generates a list of imported symbols
22
; Function names were chosen so that no function with a 'inside' in their function name is imported
3-
; Note that -emit-imported-symbols will not emit any imported symbols without -support-dynamic-linking.
3+
; Note that -emit-imported-symbols will not emit any imported symbols without -allow-device-image-dependencies.
44

55
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
66
; Test with -split=kernel
77
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
88

9-
; RUN: sycl-post-link -properties -symbols -support-dynamic-linking -emit-imported-symbols -split=kernel -S < %s -o %t_kernel.table
9+
; RUN: sycl-post-link -properties -symbols -allow-device-image-dependencies -emit-imported-symbols -split=kernel -S < %s -o %t_kernel.table
1010

1111
; RUN: FileCheck %s -input-file=%t_kernel_0.sym --check-prefixes CHECK-KERNEL-SYM-0
1212
; RUN: FileCheck %s -input-file=%t_kernel_1.sym --check-prefixes CHECK-KERNEL-SYM-1
@@ -41,11 +41,11 @@
4141
; Test with -split=source
4242
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4343

44-
; RUN: sycl-post-link -properties -symbols -support-dynamic-linking -emit-imported-symbols -split=source -S < %s -o %t_source.table
44+
; RUN: sycl-post-link -properties -symbols -allow-device-image-dependencies -emit-imported-symbols -split=source -S < %s -o %t_source.table
4545
; RUN: FileCheck %s -input-file=%t_source_0.sym --check-prefixes CHECK-SOURCE-SYM-0
4646
; RUN: FileCheck %s -input-file=%t_source_0.prop --check-prefixes CHECK-SOURCE-IMPORTED-SYM-0
4747

48-
; RUN: sycl-post-link -properties -symbols -support-dynamic-linking -emit-imported-symbols -split=source -S < %s -o %t_source.table -O0
48+
; RUN: sycl-post-link -properties -symbols -allow-device-image-dependencies -emit-imported-symbols -split=source -S < %s -o %t_source.table -O0
4949
; RUN: FileCheck %s -input-file=%t_source_0.sym --check-prefixes CHECK-SOURCE-SYM-0
5050
; RUN: FileCheck %s -input-file=%t_source_0.prop --check-prefixes CHECK-SOURCE-IMPORTED-SYM-0
5151

llvm/test/tools/sycl-post-link/exclude_external_functions.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
; Test that when the -support-dynamic-linking option is used,
1+
; Test that when the -allow-device-image-dependencies option is used,
22
; dependencies to a function that can be imported do not cause the function
33
; to be added to a device image.
44

5-
; RUN: sycl-post-link -properties -symbols -support-dynamic-linking -split=kernel -S < %s -o %t.table
5+
; RUN: sycl-post-link -properties -symbols -allow-device-image-dependencies -split=kernel -S < %s -o %t.table
66

77

88
; RUN: FileCheck %s -input-file=%t_0.sym --check-prefixes CHECK-SYM-0

llvm/test/tools/sycl-post-link/exclude_external_functions_source.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
; Test that when the -support-dynamic-linking option is used with source splitting,
1+
; Test that when the -allow-device-image-dependencies option is used with source splitting,
22
; dependencies to a function that can be imported do not cause the function
33
; to be added to a device image.
44
; Also ensure that functions in the same source that can be imported do not get split into
55
; different images.
66

7-
; RUN: sycl-post-link -properties -symbols -support-dynamic-linking -split=source -S < %s -o %t.table
7+
; RUN: sycl-post-link -properties -symbols -allow-device-image-dependencies -split=source -S < %s -o %t.table
88

99
target triple = "spir64-unknown-unknown"
1010

llvm/test/tools/sycl-post-link/internalize_functions.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
; Test that when -support-dynamic-linking is used
1+
; Test that when -allow-device-image-dependencies is used
22
; non SYCL_EXTERNAL functions are internalized.
33
; Variables must not be internalized.
44

5-
; RUN: sycl-post-link -symbols -support-dynamic-linking -split=kernel -S < %s -o %t.table
5+
; RUN: sycl-post-link -symbols -allow-device-image-dependencies -split=kernel -S < %s -o %t.table
66
; RUN: FileCheck %s -input-file=%t_0.sym --check-prefixes CHECK-SYM-0
77
; RUN: FileCheck %s -input-file=%t_0.ll --check-prefixes CHECK-LL-0
88

llvm/test/tools/sycl-post-link/virtual-functions/module-cleanup.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
; RUN: sycl-post-link -split=auto -properties -emit-exported-symbols \
22
; RUN: -emit-imported-symbols -emit-only-kernels-as-entry-points \
3-
; RUN: -support-dynamic-linking \
3+
; RUN: -allow-device-image-dependencies \
44
; RUN: -S < %s -o %t.table
55
;
66
; Virtual functions require some special handling during module cleanup:

0 commit comments

Comments
 (0)