mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-15 12:39:19 +00:00
98c21289f1
This patch added a distinct CUID for each input file, which is represented by InputAction. clang initially creates an InputAction for each input file for the host compilation. In CUDA/HIP action builder, each InputAction is given a CUID and cloned for each GPU arch, and the CUID is also cloned. In this way, we guarantee the corresponding device and host compilation for the same file shared the same CUID. On the other hand, different compilation units have different CUID. -fuse-cuid=random|hash|none is added to control the method to generate CUID. The default is hash. -cuid=X is also added to specify CUID explicitly, which overrides -fuse-cuid. Reviewed by: Artem Belevich Differential Revision: https://reviews.llvm.org/D95007
94 lines
3.1 KiB
Plaintext
94 lines
3.1 KiB
Plaintext
// REQUIRES: clang-driver
|
|
// REQUIRES: x86-registered-target
|
|
// REQUIRES: amdgpu-registered-target
|
|
|
|
// Check invalid -fuse-cuid= option.
|
|
|
|
// RUN: not %clang -### -x hip \
|
|
// RUN: -target x86_64-unknown-linux-gnu \
|
|
// RUN: --offload-arch=gfx900 \
|
|
// RUN: --offload-arch=gfx906 \
|
|
// RUN: -c -nogpulib -fuse-cuid=invalid \
|
|
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \
|
|
// RUN: %S/Inputs/hip_multiple_inputs/b.hip \
|
|
// RUN: 2>&1 | FileCheck -check-prefixes=INVALID %s
|
|
|
|
// Check random CUID generator.
|
|
|
|
// RUN: %clang -### -x hip \
|
|
// RUN: -target x86_64-unknown-linux-gnu \
|
|
// RUN: --offload-arch=gfx900 \
|
|
// RUN: --offload-arch=gfx906 \
|
|
// RUN: -c -nogpulib -fuse-cuid=random \
|
|
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \
|
|
// RUN: %S/Inputs/hip_multiple_inputs/b.hip \
|
|
// RUN: 2>&1 | FileCheck -check-prefixes=COMMON,HEX %s
|
|
|
|
// Check fixed CUID.
|
|
|
|
// RUN: %clang -### -x hip \
|
|
// RUN: -target x86_64-unknown-linux-gnu \
|
|
// RUN: --offload-arch=gfx900 \
|
|
// RUN: --offload-arch=gfx906 \
|
|
// RUN: -c -nogpulib -cuid=xyz_123 \
|
|
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \
|
|
// RUN: %S/Inputs/hip_multiple_inputs/b.hip \
|
|
// RUN: 2>&1 | FileCheck -check-prefixes=COMMON,FIXED %s
|
|
|
|
// Check fixed CUID override -fuse-cuid.
|
|
|
|
// RUN: %clang -### -x hip \
|
|
// RUN: -target x86_64-unknown-linux-gnu \
|
|
// RUN: --offload-arch=gfx900 \
|
|
// RUN: --offload-arch=gfx906 \
|
|
// RUN: -c -nogpulib -fuse-cuid=random -cuid=xyz_123 \
|
|
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \
|
|
// RUN: %S/Inputs/hip_multiple_inputs/b.hip \
|
|
// RUN: 2>&1 | FileCheck -check-prefixes=COMMON,FIXED %s
|
|
|
|
// Check hash CUID generator.
|
|
|
|
// RUN: %clang -### -x hip \
|
|
// RUN: -target x86_64-unknown-linux-gnu \
|
|
// RUN: --offload-arch=gfx900 \
|
|
// RUN: --offload-arch=gfx906 \
|
|
// RUN: -c -nogpulib -fuse-cuid=hash \
|
|
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \
|
|
// RUN: %S/Inputs/hip_multiple_inputs/b.hip \
|
|
// RUN: 2>&1 | FileCheck -check-prefixes=COMMON,HEX %s
|
|
|
|
// INVALID: invalid value 'invalid' in '-fuse-cuid=invalid'
|
|
|
|
// COMMON: "{{.*}}clang{{.*}}" "-cc1"{{.*}} "-triple" "amdgcn-amd-amdhsa"
|
|
// COMMON-SAME: "-target-cpu" "gfx900"
|
|
// HEX-SAME: "-cuid=[[CUID:[0-9a-f]+]]"
|
|
// FIXED-SAME: "-cuid=[[CUID:xyz_123]]"
|
|
// COMMON-SAME: "{{.*}}a.cu"
|
|
|
|
// COMMON: "{{.*}}clang{{.*}}" "-cc1"{{.*}} "-triple" "amdgcn-amd-amdhsa"
|
|
// COMMON-SAME: "-target-cpu" "gfx906"
|
|
// COMMON-SAME: "-cuid=[[CUID]]"
|
|
// COMMON-SAME: "{{.*}}a.cu"
|
|
|
|
// COMMON: "{{.*}}clang{{.*}}" "-cc1"{{.*}} "-triple" "x86_64-unknown-linux-gnu"
|
|
// COMMON-SAME: "-cuid=[[CUID]]"
|
|
// COMMON-SAME: "{{.*}}a.cu"
|
|
|
|
// COMMON: "{{.*}}clang{{.*}}" "-cc1"{{.*}} "-triple" "amdgcn-amd-amdhsa"
|
|
// COMMON-SAME: "-target-cpu" "gfx900"
|
|
// HEX-NOT: "-cuid=[[CUID]]"
|
|
// HEX-SAME: "-cuid=[[CUID2:[0-9a-f]+]]"
|
|
// FIXED-SAME: "-cuid=[[CUID2:xyz_123]]"
|
|
// COMMON-SAME: "{{.*}}b.hip"
|
|
|
|
// COMMON: "{{.*}}clang{{.*}}" "-cc1"{{.*}} "-triple" "amdgcn-amd-amdhsa"
|
|
// COMMON-SAME: "-target-cpu" "gfx906"
|
|
// HEX-NOT: "-cuid=[[CUID]]"
|
|
// COMMON-SAME: "-cuid=[[CUID2]]"
|
|
// COMMON-SAME: "{{.*}}b.hip"
|
|
|
|
// COMMON: "{{.*}}clang{{.*}}" "-cc1"{{.*}} "-triple" "x86_64-unknown-linux-gnu"
|
|
// HEX-NOT: "-cuid=[[CUID]]"
|
|
// COMMON-SAME: "-cuid=[[CUID2]]"
|
|
// COMMON-SAME: "{{.*}}b.hip"
|