================
@@ -0,0 +1,169 @@
+// Check what a -fno-gpu-rdc object carries and when it is registered: build a
+// two translation unit program, check that each object holds its own finalized
+// device binary, then link and run the program to verify that both binaries
+// reach the SYCL runtime.
+// The second translation unit is this same source compiled with -DSECOND_TU.
+// The program provides its own __sycl_register_lib/__sycl_unregister_lib, so
+// -nolibsycl is used and no SYCL runtime or offload device is needed.
+
+// REQUIRES: spirv-registered-target, system-linux, native
+
+// RUN: rm -rf %t && mkdir -p %t
+// RUN: %clangxx -fsycl -fno-gpu-rdc -c %s -o %t/main.o
+// RUN: %clangxx -fsycl -fno-gpu-rdc -DSECOND_TU -c %s -o %t/second.o
+
+// The section holds an offload binary (magic 0x10FF10AD) whose image is a
+// finalized SPIR-V module (magic 0x07230203), both shown little endian by the
+// hex dump.
+// RUN: llvm-readelf --hex-dump=.sycl_fatbin %t/main.o | FileCheck %s \
+// RUN:   --check-prefix=BINARY
+// RUN: llvm-readelf --hex-dump=.sycl_fatbin %t/second.o | FileCheck %s \
+// RUN:   --check-prefix=BINARY
+// BINARY: 10ff10ad
+// BINARY: 03022307
+
+// Each binary offers the kernels of that translation unit.
+// RUN: llvm-objcopy --dump-section=.sycl_fatbin=%t/main.bin %t/main.o 
/dev/null
+// RUN: llvm-objcopy --dump-section=.sycl_fatbin=%t/second.bin %t/second.o 
/dev/null
+// RUN: FileCheck %s --check-prefix=MAIN-BINARY --input-file=%t/main.bin
+// RUN: FileCheck %s --check-prefix=SECOND-BINARY --input-file=%t/second.bin
+// MAIN-BINARY-DAG: main_tu_kernel_name
+// MAIN-BINARY-DAG: main_tu_other_kernel_name
+// SECOND-BINARY-DAG: second_tu_kernel_name
----------------
YuriPlyakhin wrote:

simplified the test, so not relevant anymore

fbe8f926f72fcab3b8de0d6f7d1aa8a090b2fbc3

https://github.com/llvm/llvm-project/pull/218089
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to