| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| // REQUIRES: zlib | ||
| // REQUIRES: x86-registered-target | ||
| // UNSUPPORTED: target={{.*}}-darwin{{.*}}, target={{.*}}-aix{{.*}} | ||
|
|
||
| // | ||
| // Generate the host binary to be bundled. | ||
| // | ||
| // RUN: %clang -O0 -target %itanium_abi_triple %s -c -emit-llvm -o %t.bc | ||
|
|
||
| // | ||
| // Generate an empty file to help with the checks of empty files. | ||
| // | ||
| // RUN: touch %t.empty | ||
|
|
||
| // | ||
| // Generate device binaries to be bundled. | ||
| // | ||
| // RUN: echo 'Content of device file 1' > %t.tgt1 | ||
| // RUN: echo 'Content of device file 2' > %t.tgt2 | ||
|
|
||
| // | ||
| // Check compression/decompression of offload bundle. | ||
| // | ||
| // RUN: env OFFLOAD_BUNDLER_COMPRESS=1 OFFLOAD_BUNDLER_VERBOSE=1 \ | ||
| // RUN: clang-offload-bundler -type=bc -targets=hip-amdgcn-amd-amdhsa--gfx900,hip-amdgcn-amd-amdhsa--gfx906 \ | ||
| // RUN: -input=%t.tgt1 -input=%t.tgt2 -output=%t.hip.bundle.bc 2>&1 | \ | ||
| // RUN: FileCheck -check-prefix=COMPRESS %s | ||
| // RUN: clang-offload-bundler -type=bc -list -input=%t.hip.bundle.bc | FileCheck -check-prefix=NOHOST %s | ||
| // RUN: env OFFLOAD_BUNDLER_VERBOSE=1 \ | ||
| // RUN: clang-offload-bundler -type=bc -targets=hip-amdgcn-amd-amdhsa--gfx900,hip-amdgcn-amd-amdhsa--gfx906 \ | ||
| // RUN: -output=%t.res.tgt1 -output=%t.res.tgt2 -input=%t.hip.bundle.bc -unbundle 2>&1 | \ | ||
| // RUN: FileCheck -check-prefix=DECOMPRESS %s | ||
| // RUN: diff %t.tgt1 %t.res.tgt1 | ||
| // RUN: diff %t.tgt2 %t.res.tgt2 | ||
|
|
||
| // | ||
| // COMPRESS: Compression method used: | ||
| // DECOMPRESS: Decompression method: | ||
| // NOHOST-NOT: host- | ||
| // NOHOST-DAG: hip-amdgcn-amd-amdhsa--gfx900 | ||
| // NOHOST-DAG: hip-amdgcn-amd-amdhsa--gfx906 | ||
| // | ||
|
|
||
| // | ||
| // Check -bundle-align option. | ||
| // | ||
|
|
||
| // RUN: clang-offload-bundler -bundle-align=4096 -type=bc -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -input=%t.bc -input=%t.tgt1 -input=%t.tgt2 -output=%t.bundle3.bc -compress | ||
| // RUN: clang-offload-bundler -type=bc -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -output=%t.res.bc -output=%t.res.tgt1 -output=%t.res.tgt2 -input=%t.bundle3.bc -unbundle | ||
| // RUN: diff %t.bc %t.res.bc | ||
| // RUN: diff %t.tgt1 %t.res.tgt1 | ||
| // RUN: diff %t.tgt2 %t.res.tgt2 | ||
|
|
||
| // | ||
| // Check unbundling archive. | ||
| // | ||
| // RUN: clang-offload-bundler -type=bc -targets=hip-amdgcn-amd-amdhsa--gfx900,hip-amdgcn-amd-amdhsa--gfx906 \ | ||
| // RUN: -input=%t.tgt1 -input=%t.tgt2 -output=%T/hip_bundle1.bc -compress | ||
| // RUN: clang-offload-bundler -type=bc -targets=hip-amdgcn-amd-amdhsa--gfx900,hip-amdgcn-amd-amdhsa--gfx906 \ | ||
| // RUN: -input=%t.tgt1 -input=%t.tgt2 -output=%T/hip_bundle2.bc -compress | ||
| // RUN: llvm-ar cr %T/hip_archive.a %T/hip_bundle1.bc %T/hip_bundle2.bc | ||
| // RUN: clang-offload-bundler -unbundle -type=a -targets=hip-amdgcn-amd-amdhsa--gfx900,hip-amdgcn-amd-amdhsa--gfx906 \ | ||
| // RUN: -output=%T/hip_900.a -output=%T/hip_906.a -input=%T/hip_archive.a | ||
| // RUN: llvm-ar t %T/hip_900.a | FileCheck -check-prefix=HIP-AR-900 %s | ||
| // RUN: llvm-ar t %T/hip_906.a | FileCheck -check-prefix=HIP-AR-906 %s | ||
| // HIP-AR-900-DAG: hip_bundle1-hip-amdgcn-amd-amdhsa--gfx900 | ||
| // HIP-AR-900-DAG: hip_bundle2-hip-amdgcn-amd-amdhsa--gfx900 | ||
| // HIP-AR-906-DAG: hip_bundle1-hip-amdgcn-amd-amdhsa--gfx906 | ||
| // HIP-AR-906-DAG: hip_bundle2-hip-amdgcn-amd-amdhsa--gfx906 | ||
|
|
||
| // Some code so that we can create a binary out of this file. | ||
| int A = 0; | ||
| void test_func(void) { | ||
| ++A; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| // REQUIRES: zstd | ||
| // REQUIRES: x86-registered-target | ||
| // UNSUPPORTED: target={{.*}}-darwin{{.*}}, target={{.*}}-aix{{.*}} | ||
|
|
||
| // | ||
| // Generate the host binary to be bundled. | ||
| // | ||
| // RUN: %clang -O0 -target %itanium_abi_triple %s -c -emit-llvm -o %t.bc | ||
|
|
||
| // | ||
| // Generate an empty file to help with the checks of empty files. | ||
| // | ||
| // RUN: touch %t.empty | ||
|
|
||
| // | ||
| // Generate device binaries to be bundled. | ||
| // | ||
| // RUN: echo 'Content of device file 1' > %t.tgt1 | ||
| // RUN: echo 'Content of device file 2' > %t.tgt2 | ||
|
|
||
| // | ||
| // Check compression/decompression of offload bundle. | ||
| // | ||
| // RUN: clang-offload-bundler -type=bc -targets=hip-amdgcn-amd-amdhsa--gfx900,hip-amdgcn-amd-amdhsa--gfx906 \ | ||
| // RUN: -input=%t.tgt1 -input=%t.tgt2 -output=%t.hip.bundle.bc -compress -verbose 2>&1 | \ | ||
| // RUN: FileCheck -check-prefix=COMPRESS %s | ||
| // RUN: clang-offload-bundler -type=bc -list -input=%t.hip.bundle.bc | FileCheck -check-prefix=NOHOST %s | ||
| // RUN: clang-offload-bundler -type=bc -targets=hip-amdgcn-amd-amdhsa--gfx900,hip-amdgcn-amd-amdhsa--gfx906 \ | ||
| // RUN: -output=%t.res.tgt1 -output=%t.res.tgt2 -input=%t.hip.bundle.bc -unbundle -verbose 2>&1 | \ | ||
| // RUN: FileCheck -check-prefix=DECOMPRESS %s | ||
| // RUN: diff %t.tgt1 %t.res.tgt1 | ||
| // RUN: diff %t.tgt2 %t.res.tgt2 | ||
| // | ||
| // COMPRESS: Compression method used | ||
| // DECOMPRESS: Decompression method | ||
| // NOHOST-NOT: host- | ||
| // NOHOST-DAG: hip-amdgcn-amd-amdhsa--gfx900 | ||
| // NOHOST-DAG: hip-amdgcn-amd-amdhsa--gfx906 | ||
| // | ||
|
|
||
| // | ||
| // Check -bundle-align option. | ||
| // | ||
|
|
||
| // RUN: clang-offload-bundler -bundle-align=4096 -type=bc -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -input=%t.bc -input=%t.tgt1 -input=%t.tgt2 -output=%t.bundle3.bc -compress | ||
| // RUN: clang-offload-bundler -type=bc -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -output=%t.res.bc -output=%t.res.tgt1 -output=%t.res.tgt2 -input=%t.bundle3.bc -unbundle | ||
| // RUN: diff %t.bc %t.res.bc | ||
| // RUN: diff %t.tgt1 %t.res.tgt1 | ||
| // RUN: diff %t.tgt2 %t.res.tgt2 | ||
|
|
||
| // | ||
| // Check unbundling archive. | ||
| // | ||
| // RUN: clang-offload-bundler -type=bc -targets=hip-amdgcn-amd-amdhsa--gfx900,hip-amdgcn-amd-amdhsa--gfx906 \ | ||
| // RUN: -input=%t.tgt1 -input=%t.tgt2 -output=%T/hip_bundle1.bc -compress | ||
| // RUN: clang-offload-bundler -type=bc -targets=hip-amdgcn-amd-amdhsa--gfx900,hip-amdgcn-amd-amdhsa--gfx906 \ | ||
| // RUN: -input=%t.tgt1 -input=%t.tgt2 -output=%T/hip_bundle2.bc -compress | ||
| // RUN: llvm-ar cr %T/hip_archive.a %T/hip_bundle1.bc %T/hip_bundle2.bc | ||
| // RUN: clang-offload-bundler -unbundle -type=a -targets=hip-amdgcn-amd-amdhsa--gfx900,hip-amdgcn-amd-amdhsa--gfx906 \ | ||
| // RUN: -output=%T/hip_900.a -output=%T/hip_906.a -input=%T/hip_archive.a | ||
| // RUN: llvm-ar t %T/hip_900.a | FileCheck -check-prefix=HIP-AR-900 %s | ||
| // RUN: llvm-ar t %T/hip_906.a | FileCheck -check-prefix=HIP-AR-906 %s | ||
| // HIP-AR-900-DAG: hip_bundle1-hip-amdgcn-amd-amdhsa--gfx900 | ||
| // HIP-AR-900-DAG: hip_bundle2-hip-amdgcn-amd-amdhsa--gfx900 | ||
| // HIP-AR-906-DAG: hip_bundle1-hip-amdgcn-amd-amdhsa--gfx906 | ||
| // HIP-AR-906-DAG: hip_bundle2-hip-amdgcn-amd-amdhsa--gfx906 | ||
|
|
||
| // Some code so that we can create a binary out of this file. | ||
| int A = 0; | ||
| void test_func(void) { | ||
| ++A; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| // REQUIRES: zlib | ||
| // REQUIRES: x86-registered-target | ||
| // REQUIRES: amdgpu-registered-target | ||
|
|
||
| // Test compress bundled bitcode. | ||
|
|
||
| // RUN: rm -rf %T/a.bc | ||
| // RUN: %clang -c -v --target=x86_64-linux-gnu \ | ||
| // RUN: -x hip --offload-arch=gfx1100 --offload-arch=gfx1101 \ | ||
| // RUN: -fgpu-rdc -nogpuinc -nogpulib \ | ||
| // RUN: %S/Inputs/hip_multiple_inputs/a.cu \ | ||
| // RUN: --offload-compress --offload-device-only --gpu-bundle-output \ | ||
| // RUN: -o %T/a.bc \ | ||
| // RUN: 2>&1 | FileCheck %s | ||
|
|
||
| // CHECK: clang-offload-bundler{{.*}} -type=bc | ||
| // CHECK-SAME: -targets={{.*}}hip-amdgcn-amd-amdhsa-gfx1100,hip-amdgcn-amd-amdhsa-gfx1101 | ||
| // CHECK-SAME: -compress -verbose | ||
| // CHECK: Compressed bundle format | ||
|
|
||
| // Test uncompress of bundled bitcode. | ||
|
|
||
| // RUN: %clang --hip-link -v --target=x86_64-linux-gnu \ | ||
| // RUN: --offload-arch=gfx1100 --offload-arch=gfx1101 \ | ||
| // RUN: -fgpu-rdc -nogpulib \ | ||
| // RUN: %T/a.bc --offload-device-only \ | ||
| // RUN: 2>&1 | FileCheck -check-prefix=UNBUNDLE %s | ||
|
|
||
| // UNBUNDLE: clang-offload-bundler{{.*}} -type=bc | ||
| // UNBUNDLE-SAME: -targets={{.*}}hip-amdgcn-amd-amdhsa-gfx1100,hip-amdgcn-amd-amdhsa-gfx1101 | ||
| // UNBUNDLE-SAME: -unbundle | ||
| // UNBUNDLE-SAME: -verbose | ||
| // UNBUNDLE: Compressed bundle format | ||
|
|
||
| // Test compress bundled code objects. | ||
|
|
||
| // RUN: %clang -c -v --target=x86_64-linux-gnu \ | ||
| // RUN: -x hip --offload-arch=gfx1100 --offload-arch=gfx1101 \ | ||
| // RUN: -nogpuinc -nogpulib \ | ||
| // RUN: %S/Inputs/hip_multiple_inputs/a.cu \ | ||
| // RUN: --offload-compress \ | ||
| // RUN: 2>&1 | FileCheck -check-prefix=CO %s | ||
|
|
||
| // CO: clang-offload-bundler{{.*}} -type=o | ||
| // CO-SAME: -targets={{.*}}hipv4-amdgcn-amd-amdhsa--gfx1100,hipv4-amdgcn-amd-amdhsa--gfx1101 | ||
| // CO-SAME: -compress -verbose | ||
| // CO: Compressed bundle format |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| // REQUIRES: zstd | ||
| // REQUIRES: x86-registered-target | ||
| // REQUIRES: amdgpu-registered-target | ||
|
|
||
| // Test compress bundled bitcode. | ||
|
|
||
| // RUN: rm -rf %T/a.bc | ||
| // RUN: %clang -c -v --target=x86_64-linux-gnu \ | ||
| // RUN: -x hip --offload-arch=gfx1100 --offload-arch=gfx1101 \ | ||
| // RUN: -fgpu-rdc -nogpuinc -nogpulib \ | ||
| // RUN: %S/Inputs/hip_multiple_inputs/a.cu \ | ||
| // RUN: --offload-compress --offload-device-only --gpu-bundle-output \ | ||
| // RUN: -o %T/a.bc \ | ||
| // RUN: 2>&1 | FileCheck %s | ||
|
|
||
| // CHECK: clang-offload-bundler{{.*}} -type=bc | ||
| // CHECK-SAME: -targets={{.*}}hip-amdgcn-amd-amdhsa-gfx1100,hip-amdgcn-amd-amdhsa-gfx1101 | ||
| // CHECK-SAME: -compress -verbose | ||
| // CHECK: Compressed bundle format | ||
|
|
||
| // Test uncompress of bundled bitcode. | ||
|
|
||
| // RUN: %clang --hip-link -v --target=x86_64-linux-gnu \ | ||
| // RUN: --offload-arch=gfx1100 --offload-arch=gfx1101 \ | ||
| // RUN: -fgpu-rdc -nogpulib \ | ||
| // RUN: %T/a.bc --offload-device-only \ | ||
| // RUN: 2>&1 | FileCheck -check-prefix=UNBUNDLE %s | ||
|
|
||
| // UNBUNDLE: clang-offload-bundler{{.*}} -type=bc | ||
| // UNBUNDLE-SAME: -targets={{.*}}hip-amdgcn-amd-amdhsa-gfx1100,hip-amdgcn-amd-amdhsa-gfx1101 | ||
| // UNBUNDLE-SAME: -unbundle | ||
| // UNBUNDLE-SAME: -verbose | ||
| // UNBUNDLE: Compressed bundle format | ||
|
|
||
| // Test compress bundled code objects. | ||
|
|
||
| // RUN: %clang -c -v --target=x86_64-linux-gnu \ | ||
| // RUN: -x hip --offload-arch=gfx1100 --offload-arch=gfx1101 \ | ||
| // RUN: -nogpuinc -nogpulib \ | ||
| // RUN: %S/Inputs/hip_multiple_inputs/a.cu \ | ||
| // RUN: --offload-compress \ | ||
| // RUN: 2>&1 | FileCheck -check-prefix=CO %s | ||
|
|
||
| // CO: clang-offload-bundler{{.*}} -type=o | ||
| // CO-SAME: -targets={{.*}}hipv4-amdgcn-amd-amdhsa--gfx1100,hipv4-amdgcn-amd-amdhsa--gfx1101 | ||
| // CO-SAME: -compress -verbose | ||
| // CO: Compressed bundle format |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| set(LLVM_LINK_COMPONENTS | ||
| BinaryFormat | ||
| Object | ||
| Support | ||
| TargetParser | ||
|
|
||