mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-27 06:06:06 +00:00

When compiling HIP source for AMDGCN flavoured SPIR-V that is expected
to be consumed by the ROCm HIP RT, it's not desirable to set the OpenCL
Kernel CC on `__global__` functions. On one hand, this is not an OpenCL
RT, so it doesn't compose with e.g. OCL specific attributes. On the
other it is a "noisy" CC that carries semantics, and breaks overload
resolution when using [generic dispatchers such as those used by
RAJA](186d4194a5/src/common/HipDataUtils.hpp (L39)
).
26 lines
891 B
Plaintext
26 lines
891 B
Plaintext
// REQUIRES: amdgpu-registered-target
|
|
|
|
// RUN: %clang_cc1 -triple amdgcn -fcuda-is-device -std=c++11 \
|
|
// RUN: -fgpu-allow-device-init -x hip \
|
|
// RUN: -fno-threadsafe-statics -emit-llvm -o - %s \
|
|
// RUN: | FileCheck %s
|
|
// RUN: %clang_cc1 -triple spirv64-amd-amdhsa -fcuda-is-device -std=c++11 \
|
|
// RUN: -fgpu-allow-device-init -x hip \
|
|
// RUN: -fno-threadsafe-statics -emit-llvm -o - %s \
|
|
// RUN: | FileCheck %s --check-prefix=CHECK-SPIRV
|
|
|
|
#include "Inputs/cuda.h"
|
|
|
|
// CHECK: define internal amdgpu_kernel void @_GLOBAL__sub_I_device_init_fun.cu() #[[ATTR:[0-9]*]]
|
|
// CHECK: attributes #[[ATTR]] = {{.*}}"device-init"
|
|
// CHECK-SPIRV: define internal spir_kernel void @_GLOBAL__sub_I_device_init_fun.cu(){{.*}} #[[ATTR:[0-9]*]]
|
|
// CHECK-SPIRV: attributes #[[ATTR]] = {{.*}}"device-init"
|
|
|
|
__device__ void f();
|
|
|
|
struct A {
|
|
__device__ A() { f(); }
|
|
};
|
|
|
|
__device__ A a;
|