| 1 |
// Test target codegen - host bc file has to be created first. |
| 2 |
// |
| 3 |
// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple i386-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm-bc %s -o %t-x86-host.bc |
| 4 |
// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-x86-host.bc -o - | FileCheck %s |
| 5 |
// expected-no-diagnostics |
| 6 |
#ifndef HEADER |
| 7 |
#define HEADER |
| 8 |
|
| 9 |
void foo(int N) { |
| 10 |
// CHECK: define {{.*}}l11{{.*}} #[[ATTR0:[0-9]+]] |
| 11 |
#pragma omp target teams distribute parallel for simd |
| 12 |
for (int i = 0; i < N; ++i) |
| 13 |
; |
| 14 |
// CHECK: define {{.*}}l15{{.*}} #[[ATTR1:[0-9]+]] |
| 15 |
#pragma omp target teams distribute parallel for simd thread_limit(4) |
| 16 |
for (int i = 0; i < N; ++i) |
| 17 |
; |
| 18 |
|
| 19 |
// CHECK: define {{.*}}l20{{.*}} #[[ATTR2:[0-9]+]] |
| 20 |
#pragma omp target teams distribute parallel for simd ompx_attribute(__attribute__((launch_bounds(42, 42)))) |
| 21 |
for (int i = 0; i < N; ++i) |
| 22 |
; |
| 23 |
|
| 24 |
// CHECK: define {{.*}}l25{{.*}} #[[ATTR3:[0-9]+]] |
| 25 |
#pragma omp target teams distribute parallel for simd ompx_attribute(__attribute__((launch_bounds(42, 42)))) num_threads(22) |
| 26 |
for (int i = 0; i < N; ++i) |
| 27 |
; |
| 28 |
} |
| 29 |
|
| 30 |
#endif |
| 31 |
|
| 32 |
// CHECK: attributes #[[ATTR0]] = {{{.*}} "nvvm.maxntid"="128" {{.*}}} |
| 33 |
// CHECK: attributes #[[ATTR1]] = {{{.*}} "nvvm.maxntid"="4" {{.*}}} |
| 34 |
// CHECK: attributes #[[ATTR2]] = {{{.*}} "nvvm.maxntid"="42" {{.*}}} |
| 35 |
// CHECK: attributes #[[ATTR3]] = {{{.*}} "nvvm.maxntid"="22" {{.*}}} |