brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.0 KiB · 8b4e386 Raw
64 lines · cpp
1// REQUIRES: amdgpu-registered-target2 3// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm-bc %s -o %t-ppc-host.bc4// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple amdgcn-amd-amdhsa -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix=AMD5// RUN: %clang_cc1 -target-cpu gfx900 -fopenmp -x c++ -std=c++11 -triple amdgcn-amd-amdhsa -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix=AMD6// RUN: %clang_cc1 -target-cpu gfx900 -fopenmp -x c++ -std=c++11 -triple amdgcn-amd-amdhsa -fopenmp-targets=amdgcn-amd-amdhsa -dwarf-version=5 -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix=AMD7// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple nvptx64 -fopenmp-targets=nvptx64 -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix=NVIDIA8// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple nvptx64 -fopenmp-targets=nvptx64 -emit-llvm %s -fopenmp-is-target-device -dwarf-version=5 -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix=NVIDIA9// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple spirv64 -fopenmp-targets=spirv64 -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix=SPIRV10// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple spirv64 -fopenmp-targets=spirv64 -emit-llvm %s -fopenmp-is-target-device -dwarf-version=5 -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix=SPIRV11// expected-no-diagnostics12 13 14// Check that the target attributes are set on the generated kernel15void func() {16  // AMD: amdgpu_kernel void @__omp_offloading[[HASH:.*]]_l28(ptr {{[^,]+}}) #017  // AMD: amdgpu_kernel void @__omp_offloading[[HASH:.*]]_l30(ptr {{[^,]+}})18  // AMD: amdgpu_kernel void @__omp_offloading[[HASH:.*]]_l32(ptr {{[^,]+}}) #419 20  // NVIDIA: ptx_kernel void @__omp_offloading[[HASH:.*]]_l28(ptr {{[^,]+}}) #[[ATTR0:[0-9]+]]21  // NVIDIA: ptx_kernel void @__omp_offloading[[HASH:.*]]_l30(ptr {{[^,]+}}) #[[ATTR1:[0-9]+]]22  // NVIDIA: ptx_kernel void @__omp_offloading[[HASH:.*]]_l32(ptr {{[^,]+}}) #[[ATTR2:[0-9]+]]23 24  // SPIRV: spir_kernel void @__omp_offloading[[HASH:.*]]_l28(ptr {{[^,]+}}) #025  // SPIRV: spir_kernel void @__omp_offloading[[HASH:.*]]_l30(ptr {{[^,]+}})26  // SPIRV: spir_kernel void @__omp_offloading[[HASH:.*]]_l32(ptr {{[^,]+}}) #427 28  #pragma omp target ompx_attribute([[clang::amdgpu_flat_work_group_size(10, 20)]])29  {}30  #pragma omp target teams ompx_attribute(__attribute__((launch_bounds(45, 90))))31  {}32  #pragma omp target teams distribute parallel for simd ompx_attribute([[clang::amdgpu_flat_work_group_size(3, 17)]]) device(3) ompx_attribute(__attribute__((amdgpu_waves_per_eu(3, 7))))33  for (int i = 0; i < 1000; ++i)34  {}35}36 37// SPIRV: attributes #038// SPIRV-SAME: "nvvm.maxntid"="20"39// SPIRV-SAME: "omp_target_thread_limit"="20" 40// SPIRV: attributes #441// SPIRV-SAME: "amdgpu-waves-per-eu"="3,7"42// SPIRV-SAME: "nvvm.maxntid"="17"43// SPIRV-SAME: "omp_target_thread_limit"="17"44 45// AMD: attributes #046// AMD-SAME: "amdgpu-flat-work-group-size"="10,20"47// AMD-SAME: "omp_target_thread_limit"="20"48// AMD: "omp_target_thread_limit"="45"49// AMD: attributes #450// AMD-SAME: "amdgpu-flat-work-group-size"="3,17"51// AMD-SAME: "amdgpu-waves-per-eu"="3,7"52// AMD-SAME: "omp_target_thread_limit"="17"53 54// It is unclear if we should use the AMD annotations for other targets, we do for now.55// NVIDIA: attributes #[[ATTR0]]56// NVIDIA-SAME: "nvvm.maxntid"="20"57// NVIDIA-SAME: "omp_target_thread_limit"="20"58// NVIDIA: attributes #[[ATTR1]]59// NVIDIA-SAME: "nvvm.maxntid"="45"60// NVIDIA-SAME: "omp_target_thread_limit"="45"61// NVIDIA: attributes #[[ATTR2]]62// NVIDIA-SAME: "nvvm.maxntid"="17"63// NVIDIA-SAME: "omp_target_thread_limit"="17"64