Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8941,6 +8941,7 @@ void SYCLPostLink::ConstructJob(Compilation &C, const JobAction &JA,
// Symbol file and specialization constant info generation is mandatory -
// add options unconditionally
addArgs(CmdArgs, TCArgs, {"-symbols"});
addArgs(CmdArgs, TCArgs, {"-emit-exported-symbols"});
addArgs(CmdArgs, TCArgs, {"-split-esimd"});
addArgs(CmdArgs, TCArgs, {"-lower-esimd"});
}
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Driver/sycl-device-lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
// RUN: | FileCheck %s -check-prefix=SYCL_LLVM_LINK_NO_DEVICE_LIB
// SYCL_LLVM_LINK_NO_DEVICE_LIB: clang{{.*}} "-cc1" {{.*}} "-fsycl-is-device"
// SYCL_LLVM_LINK_NO_DEVICE_LIB-NOT: llvm-link{{.*}} "-only-needed"
// SYCL_LLVM_LINK_NO_DEVICE_LIB: sycl-post-link{{.*}} "-symbols" "-split-esimd" "-lower-esimd" "-O2" "-spec-const=rt" "-o" "{{.*}}.table" "{{.*}}.bc"
// SYCL_LLVM_LINK_NO_DEVICE_LIB: sycl-post-link{{.*}} "-symbols" "-emit-exported-symbols" "-split-esimd" "-lower-esimd" "-O2" "-spec-const=rt" "-o" "{{.*}}.table" "{{.*}}.bc"

/// ###########################################################################
/// test llvm-link behavior for special user input whose filename resembles SYCL device library
Expand Down
1 change: 1 addition & 0 deletions llvm/include/llvm/Support/PropertySetIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ class PropertySetRegistry {
static constexpr char SYCL_PROGRAM_METADATA[] = "SYCL/program metadata";
static constexpr char SYCL_MISC_PROP[] = "SYCL/misc properties";
static constexpr char SYCL_ASSERT_USED[] = "SYCL/assert used";
static constexpr char SYCL_EXPORTED_SYMBOLS[] = "SYCL/exported symbols";

// Function for bulk addition of an entire property set under given category
// (property set name).
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/Support/PropertySetIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ constexpr char PropertySetRegistry::SYCL_KERNEL_PARAM_OPT_INFO[];
constexpr char PropertySetRegistry::SYCL_PROGRAM_METADATA[];
constexpr char PropertySetRegistry::SYCL_MISC_PROP[];
constexpr char PropertySetRegistry::SYCL_ASSERT_USED[];
constexpr char PropertySetRegistry::SYCL_EXPORTED_SYMBOLS[];

} // namespace util
} // namespace llvm
129 changes: 129 additions & 0 deletions llvm/test/tools/sycl-post-link/emit_exported_symbols.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
; This test checks that the post-link tool generates list of exported symbols.
;
; Global scope
; RUN: sycl-post-link -symbols -emit-exported-symbols -S %s -o %t.global.files.table
; RUN: FileCheck %s -input-file=%t.global.files.table --check-prefixes CHECK-GLOBAL-TABLE
; RUN: FileCheck %s -input-file=%t.global.files_0.prop --check-prefixes CHECK-GLOBAL-PROP
;
; Per-module split
; RUN: sycl-post-link -symbols -split=source -emit-exported-symbols -S %s -o %t.per_module.files.table
; RUN: FileCheck %s -input-file=%t.per_module.files.table --check-prefixes CHECK-PERMODULE-TABLE
; RUN: FileCheck %s -input-file=%t.per_module.files_0.prop --check-prefixes CHECK-PERMODULE-0-PROP
; RUN: FileCheck %s -input-file=%t.per_module.files_1.prop --check-prefixes CHECK-PERMODULE-1-PROP
; RUN: FileCheck %s -input-file=%t.per_module.files_2.prop --check-prefixes CHECK-KERNELONLY-PROP
;
; Per-kernel split
; RUN: sycl-post-link -symbols -split=kernel -emit-exported-symbols -S %s -o %t.per_kernel.files.table
; RUN: FileCheck %s -input-file=%t.per_kernel.files.table --check-prefixes CHECK-PERKERNEL-TABLE
; RUN: FileCheck %s -input-file=%t.per_kernel.files_0.prop --check-prefixes CHECK-PERKERNEL-0-PROP
; RUN: FileCheck %s -input-file=%t.per_kernel.files_1.prop --check-prefixes CHECK-PERKERNEL-1-PROP
; RUN: FileCheck %s -input-file=%t.per_kernel.files_2.prop --check-prefixes CHECK-PERKERNEL-2-PROP
; RUN: FileCheck %s -input-file=%t.per_kernel.files_3.prop --check-prefixes CHECK-KERNELONLY-PROP
; RUN: FileCheck %s -input-file=%t.per_kernel.files_4.prop --check-prefixes CHECK-KERNELONLY-PROP

target triple = "spir64-unknown-unknown"

define dso_local spir_kernel void @SpirKernel1(float %arg1) #0 {
entry:
ret void
}

define dso_local spir_kernel void @SpirKernel2(float %arg1) #2 {
entry:
ret void
}

define dso_local spir_func void @ExportedSpirFunc1(float %arg1) #0 {
entry:
ret void
}

define dso_local spir_func void @ExportedSpirFunc2(i32 %arg1, i32 %arg2) #1 {
entry:
ret void
}

define dso_local spir_func void @ExportedSpirFunc3(float %arg1) #0 {
entry:
ret void
}

define dso_local spir_func void @NotExportedSpirFunc1(float %arg1) {
entry:
ret void
}

attributes #0 = { "sycl-module-id"="a.cpp" }
attributes #1 = { "sycl-module-id"="b.cpp" }
attributes #2 = { "sycl-module-id"="c.cpp" }

; Global scope
; CHECK-GLOBAL-PROP: [SYCL/exported symbols]
; CHECK-GLOBAL-PROP-NEXT: ExportedSpirFunc1
; CHECK-GLOBAL-PROP-NEXT: ExportedSpirFunc2
; CHECK-GLOBAL-PROP-NEXT: ExportedSpirFunc3
; CHECK-GLOBAL-PROP-NOT: SpirKernel1
; CHECK-GLOBAL-PROP-NOT: NotExportedSpirFunc1

; CHECK-GLOBAL-TABLE: [Code|Properties|Symbols]
; CHECK-GLOBAL-TABLE-NEXT: {{.*}}global.files_0.prop
; CHECK-GLOBAL-TABLE-EMPTY:

; Per-module split
; CHECK-PERMODULE-0-PROP: [SYCL/exported symbols]
; CHECK-PERMODULE-0-PROP-NEXT: ExportedSpirFunc1
; CHECK-PERMODULE-0-PROP-NEXT: ExportedSpirFunc3
; CHECK-PERMODULE-0-PROP-NOT: ExportedSpirFunc2
; CHECK-PERMODULE-0-PROP-NOT: SpirKernel1
; CHECK-PERMODULE-0-PROP-NOT: NotExportedSpirFunc1

; CHECK-PERMODULE-1-PROP: [SYCL/exported symbols]
; CHECK-PERMODULE-1-PROP-NEXT: ExportedSpirFunc2
; CHECK-PERMODULE-1-PROP-NOT: ExportedSpirFunc1
; CHECK-PERMODULE-1-PROP-NOT: ExportedSpirFunc3
; CHECK-PERMODULE-1-PROP-NOT: SpirKernel1
; CHECK-PERMODULE-1-PROP-NOT: NotExportedSpirFunc1

; CHECK-PERMODULE-TABLE: [Code|Properties|Symbols]
; CHECK-PERMODULE-TABLE-NEXT: {{.*}}per_module.files_0.prop
; CHECK-PERMODULE-TABLE-NEXT: {{.*}}per_module.files_1.prop
; CHECK-PERMODULE-TABLE-NEXT: {{.*}}per_module.files_2.prop
; CHECK-PERMODULE-TABLE-EMPTY:

; Per-kernel split
; CHECK-PERKERNEL-0-PROP: [SYCL/exported symbols]
; CHECK-PERKERNEL-0-PROP-NEXT: ExportedSpirFunc1
; CHECK-PERKERNEL-0-PROP-NOT: ExportedSpirFunc2
; CHECK-PERKERNEL-0-PROP-NOT: ExportedSpirFunc3
; CHECK-PERKERNEL-0-PROP-NOT: SpirKernel1
; CHECK-PERKERNEL-0-PROP-NOT: NotExportedSpirFunc1

; CHECK-PERKERNEL-1-PROP: [SYCL/exported symbols]
; CHECK-PERKERNEL-1-PROP-NEXT: ExportedSpirFunc2
; CHECK-PERKERNEL-1-PROP-NOT: ExportedSpirFunc1
; CHECK-PERKERNEL-1-PROP-NOT: ExportedSpirFunc3
; CHECK-PERKERNEL-1-PROP-NOT: SpirKernel1
; CHECK-PERKERNEL-1-PROP-NOT: NotExportedSpirFunc1

; CHECK-PERKERNEL-2-PROP: [SYCL/exported symbols]
; CHECK-PERKERNEL-2-PROP-NEXT: ExportedSpirFunc3
; CHECK-PERKERNEL-2-PROP-NOT: ExportedSpirFunc1
; CHECK-PERKERNEL-2-PROP-NOT: ExportedSpirFunc2
; CHECK-PERKERNEL-2-PROP-NOT: SpirKernel1
; CHECK-PERKERNEL-2-PROP-NOT: NotExportedSpirFunc1

; CHECK-PERKERNEL-TABLE: [Code|Properties|Symbols]
; CHECK-PERKERNEL-TABLE-NEXT: {{.*}}per_kernel.files_0.prop
; CHECK-PERKERNEL-TABLE-NEXT: {{.*}}per_kernel.files_1.prop
; CHECK-PERKERNEL-TABLE-NEXT: {{.*}}per_kernel.files_2.prop
; CHECK-PERKERNEL-TABLE-NEXT: {{.*}}per_kernel.files_3.prop
; CHECK-PERKERNEL-TABLE-NEXT: {{.*}}per_kernel.files_4.prop
; CHECK-PERKERNEL-TABLE-EMPTY:

; Kernel-only generated modules should have no exported Symbols
; CHECK-KERNELONLY-PROP-NOT: [SYCL/exported symbols]
; CHECK-KERNELONLY-PROP-NOT: ExportedSpirFunc3
; CHECK-KERNELONLY-PROP-NOT: ExportedSpirFunc1
; CHECK-KERNELONLY-PROP-NOT: ExportedSpirFunc2
; CHECK-KERNELONLY-PROP-NOT: SpirKernel1
; CHECK-KERNELONLY-PROP-NOT: NotExportedSpirFunc1
Loading