Summary: Exceptions are not supporter, and likely will never be supported, on GPUs. The SIMT model makes context switching nearly impossible, and building an unwinder would require stashing a register file that is over 8 KiB these days. There's precedent to disable this for the target, so we should just do this. Offloading languages have their own weird handling, some chimera that just accepts exceptions but turns them into traps on the device side, so we leave that unaffected.
27 lines
1017 B
C++
27 lines
1017 B
C++
// RUN: %clang -### --target=amdgcn-amd-amdhsa -mcpu=gfx90a -nogpulib %s 2>&1 \
|
|
// RUN: | FileCheck %s --check-prefix=NOEXC
|
|
// RUN: %clang -### --target=nvptx64-nvidia-cuda -march=sm_80 -nogpulib %s 2>&1 \
|
|
// RUN: | FileCheck %s --check-prefix=NOEXC
|
|
// RUN: %clang -### --target=spirv64-- -nogpulib %s 2>&1 \
|
|
// RUN: | FileCheck %s --check-prefix=NOEXC
|
|
|
|
// Check that the default can still be overridden.
|
|
// RUN: %clang -### --target=amdgcn-amd-amdhsa -mcpu=gfx90a -nogpulib -fexceptions %s 2>&1 \
|
|
// RUN: | FileCheck %s --check-prefix=EXC
|
|
|
|
// Check that offloading languages still use their own handling.
|
|
// RUN: %clang -### --target=x86_64-unknown-linux-gnu -fopenmp \
|
|
// RUN: --offload-arch=gfx90a -nogpulib -nogpuinc %s 2>&1 \
|
|
// RUN: | FileCheck %s --check-prefix=OPENMP
|
|
|
|
// NOEXC-NOT: "-fcxx-exceptions"
|
|
// NOEXC-NOT: "-fexceptions"
|
|
|
|
// EXC: "-fcxx-exceptions"
|
|
// EXC: "-fexceptions"
|
|
|
|
// OPENMP: "-cc1"{{.*}}"-triple" "amdgcn-amd-amdhsa"
|
|
// OPENMP-SAME: "-fcxx-exceptions"
|
|
|
|
int main() { return 0; }
|