CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
70 lines
4.1 KiB
C
70 lines
4.1 KiB
C
// REQUIRES: amdgpu-registered-target
|
|
// REQUIRES: lld
|
|
|
|
// Test HIP non-RDC linker wrapper behavior with new offload driver.
|
|
// The linker wrapper should output .hipfb files directly without using -r option.
|
|
|
|
// An externally visible variable so static libraries extract.
|
|
__attribute__((visibility("protected"), used)) int x;
|
|
|
|
// Create device binaries and package them
|
|
// RUN: %clang -cc1 %s -triple amdgcn-amd-amdhsa -emit-llvm-bc -o %t.amdgpu.bc
|
|
// RUN: llvm-offload-binary -o %t.out \
|
|
// RUN: --image=file=%t.amdgpu.bc,kind=hip,triple=amdgcn-amd-amdhsa,arch=gfx9-4-generic:xnack+ \
|
|
// RUN: --image=file=%t.amdgpu.bc,kind=hip,triple=amdgcn-amd-amdhsa,arch=gfx1200
|
|
|
|
// Test that linker wrapper outputs .hipfb file without -r option for HIP non-RDC
|
|
// The linker wrapper is called directly with the packaged device binary (not embedded in host object)
|
|
// Note: When called directly (not through the driver), the linker wrapper processes architectures
|
|
// from the packaged binary. The test verifies it can process at least one architecture correctly.
|
|
// RUN: %if system-windows %{ \
|
|
// RUN: clang-linker-wrapper --host-triple=x86_64-unknown-linux-gnu --wrapper-verbose --device-linker=amdgcn-amd-amdhsa=-v --device-compiler=-v --emit-fatbin-only --linker-path=/usr/bin/ld %t.out -o %t.hipfb 2>&1 | FileCheck %s --check-prefix=CMD-WIN \
|
|
// RUN: %} %else %{ \
|
|
// RUN: clang-linker-wrapper --host-triple=x86_64-unknown-linux-gnu --wrapper-verbose --device-linker=amdgcn-amd-amdhsa=-v --device-compiler=-v --emit-fatbin-only --linker-path=/usr/bin/ld %t.out -o %t.hipfb 2>&1 | FileCheck %s --check-prefix=CMD-LINUX \
|
|
// RUN: %}
|
|
|
|
// On Linux, ':' is preserved in file names
|
|
// CMD-LINUX-DAG: clang{{.*}} -o {{.*}}hipfb.amdgcn.gfx9-4-generic:xnack+{{.*}}.img
|
|
// CMD-LINUX-DAG: clang{{.*}} -o {{.*}}hipfb.amdgcn.gfx1200{{.*}}.img
|
|
// CMD-LINUX-DAG: ld.lld{{.*}} -o {{.*}}hipfb.amdgcn.gfx9-4-generic:xnack+{{.*}}.img
|
|
// CMD-LINUX-DAG: ld.lld{{.*}} -o {{.*}}hipfb.amdgcn.gfx1200{{.*}}.img
|
|
|
|
// On Windows, ':' is replaced with '@' in file names
|
|
// CMD-WIN-DAG: clang{{.*}} -o {{.*}}hipfb.amdgcn.gfx9-4-generic@xnack+{{.*}}.img
|
|
// CMD-WIN-DAG: clang{{.*}} -o {{.*}}hipfb.amdgcn.gfx1200{{.*}}.img
|
|
// CMD-WIN-DAG: ld.lld{{.*}} -o {{.*}}hipfb.amdgcn.gfx9-4-generic@xnack+{{.*}}.img
|
|
// CMD-WIN-DAG: ld.lld{{.*}} -o {{.*}}hipfb.amdgcn.gfx1200{{.*}}.img
|
|
|
|
// Verify the fat binary was created
|
|
// RUN: test -f %t.hipfb
|
|
|
|
// List code objects in the fat binary
|
|
// RUN: clang-offload-bundler -type=o -input=%t.hipfb -list | FileCheck %s --check-prefix=HIP-FATBIN-LIST
|
|
|
|
// HIP-FATBIN-LIST-DAG: hip-amdgcn-amd-amdhsa--gfx9-4-generic:xnack+
|
|
// HIP-FATBIN-LIST-DAG: hip-amdgcn-amd-amdhsa--gfx1200
|
|
// HIP-FATBIN-LIST-DAG: host-x86_64-unknown-linux-gnu
|
|
|
|
// Extract code objects for both architectures from the fat binary
|
|
// Use '-' instead of ':' in file names to avoid issues on Windows
|
|
// RUN: clang-offload-bundler -type=o -targets=hip-amdgcn-amd-amdhsa--gfx9-4-generic:xnack+,hip-amdgcn-amd-amdhsa--gfx1200 \
|
|
// RUN: -output=%t.gfx9-4-generic-xnack+.co -output=%t.gfx1200.co -input=%t.hipfb -unbundle
|
|
|
|
// Verify extracted code objects exist and are not empty
|
|
// RUN: test -f %t.gfx9-4-generic-xnack+.co
|
|
// RUN: test -s %t.gfx9-4-generic-xnack+.co
|
|
// RUN: test -f %t.gfx1200.co
|
|
// RUN: test -s %t.gfx1200.co
|
|
|
|
// Without --no-lto the AMDGPU device compilation uses the LTO pipeline
|
|
// (-flto).
|
|
// RUN: clang-linker-wrapper --host-triple=x86_64-unknown-linux-gnu --wrapper-verbose --dry-run --emit-fatbin-only --linker-path=/usr/bin/ld %t.out -o %t.lto.hipfb 2>&1 | FileCheck %s --check-prefix=LTO
|
|
// LTO: clang{{.*}} -mcpu=gfx1200{{.*}} -flto
|
|
|
|
// With --no-lto the AMDGPU device compilation uses the conventional non-LTO
|
|
// pipeline: -flto must not be passed, and '-x ir' must be passed so Clang
|
|
// compiles the bitcode (stored in an object-extension file) instead of
|
|
// handing it to the LTO link.
|
|
// RUN: clang-linker-wrapper --host-triple=x86_64-unknown-linux-gnu --wrapper-verbose --dry-run --no-lto --emit-fatbin-only --linker-path=/usr/bin/ld %t.out -o %t.nolto.hipfb 2>&1 | FileCheck %s --check-prefix=NO-LTO --implicit-check-not=-flto
|
|
// NO-LTO: clang{{.*}} -mcpu=gfx1200{{.*}} -x ir
|