|
| 1 | +// clang-format off |
| 2 | +// RUN: %libomptarget-compile-generic |
| 3 | +// RUN: env LIBOMPTARGET_INFO=16 \ |
| 4 | +// RUN: %libomptarget-run-generic 2>&1 | %fcheck-generic --check-prefix=DEFAULT |
| 5 | + |
| 6 | +// UNSUPPORTED: nvptx64-nvidia-cuda |
| 7 | +// UNSUPPORTED: nvptx64-nvidia-cuda-LTO |
| 8 | +// UNSUPPORTED: aarch64-unknown-linux-gnu |
| 9 | +// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO |
| 10 | +// UNSUPPORTED: x86_64-pc-linux-gnu |
| 11 | +// UNSUPPORTED: x86_64-pc-linux-gnu-LTO |
| 12 | + |
| 13 | +__attribute__((optnone)) int optnone() { return 1; } |
| 14 | + |
| 15 | +int main() { |
| 16 | + int N = optnone() * 4098 * 32; |
| 17 | + |
| 18 | +// DEFAULT: [[NT:(128|256)]] (MaxFlatWorkGroupSize: [[NT]] |
| 19 | +#pragma omp target teams distribute parallel for simd |
| 20 | + for (int i = 0; i < N; ++i) { |
| 21 | + optnone(); |
| 22 | + } |
| 23 | +// DEFAULT: [[NT:(128|256)]] (MaxFlatWorkGroupSize: [[NT]] |
| 24 | +#pragma omp target teams distribute parallel for simd |
| 25 | + for (int i = 0; i < N; ++i) { |
| 26 | + optnone(); |
| 27 | + } |
| 28 | +// DEFAULT: [[NT:(128|256)]] (MaxFlatWorkGroupSize: [[NT]] |
| 29 | +#pragma omp target teams distribute parallel for simd |
| 30 | + for (int i = 0; i < N; ++i) { |
| 31 | + optnone(); |
| 32 | + } |
| 33 | +// DEFAULT: [[NT:(128|256)]] (MaxFlatWorkGroupSize: [[NT]] |
| 34 | +#pragma omp target |
| 35 | +#pragma omp teams distribute parallel for |
| 36 | + for (int i = 0; i < N; ++i) { |
| 37 | + optnone(); |
| 38 | + } |
| 39 | +// DEFAULT: 42 (MaxFlatWorkGroupSize: 1024 |
| 40 | +#pragma omp target thread_limit(optnone() * 42) |
| 41 | +#pragma omp teams distribute parallel for |
| 42 | + for (int i = 0; i < N; ++i) { |
| 43 | + optnone(); |
| 44 | + } |
| 45 | +// DEFAULT: 42 (MaxFlatWorkGroupSize: 42 |
| 46 | +#pragma omp target thread_limit(optnone() * 42) ompx_attribute(__attribute__((amdgpu_flat_work_group_size(42, 42)))) |
| 47 | +#pragma omp teams distribute parallel for |
| 48 | + for (int i = 0; i < N; ++i) { |
| 49 | + optnone(); |
| 50 | + } |
| 51 | +// FIXME: Use the attribute value to imply a thread_limit |
| 52 | +// DEFAULT: {{(128|256)}} (MaxFlatWorkGroupSize: 42 |
| 53 | +#pragma omp target ompx_attribute(__attribute__((amdgpu_flat_work_group_size(42, 42)))) |
| 54 | +#pragma omp teams distribute parallel for |
| 55 | + for (int i = 0; i < N; ++i) { |
| 56 | + optnone(); |
| 57 | + } |
| 58 | +// DEFAULT: MaxFlatWorkGroupSize: 1024 |
| 59 | +#pragma omp target |
| 60 | +#pragma omp teams distribute parallel for num_threads(optnone() * 42) |
| 61 | + for (int i = 0; i < N; ++i) { |
| 62 | + optnone(); |
| 63 | + } |
| 64 | +// DEFAULT: MaxFlatWorkGroupSize: 1024 |
| 65 | +#pragma omp target teams distribute parallel for thread_limit(optnone() * 42) |
| 66 | + for (int i = 0; i < N; ++i) { |
| 67 | + optnone(); |
| 68 | + } |
| 69 | +// DEFAULT: MaxFlatWorkGroupSize: 1024 |
| 70 | +#pragma omp target teams distribute parallel for num_threads(optnone() * 42) |
| 71 | + for (int i = 0; i < N; ++i) { |
| 72 | + optnone(); |
| 73 | + } |
| 74 | +// DEFAULT: 9 (MaxFlatWorkGroupSize: 9 |
| 75 | +#pragma omp target |
| 76 | +#pragma omp teams distribute parallel for num_threads(9) |
| 77 | + for (int i = 0; i < N; ++i) { |
| 78 | + optnone(); |
| 79 | + } |
| 80 | +// DEFAULT: 4 (MaxFlatWorkGroupSize: 4 |
| 81 | +#pragma omp target thread_limit(4) |
| 82 | +#pragma omp teams distribute parallel for |
| 83 | + for (int i = 0; i < N; ++i) { |
| 84 | + optnone(); |
| 85 | + } |
| 86 | +// DEFAULT: 4 (MaxFlatWorkGroupSize: 4 |
| 87 | +#pragma omp target |
| 88 | +#pragma omp teams distribute parallel for thread_limit(4) |
| 89 | + for (int i = 0; i < N; ++i) { |
| 90 | + optnone(); |
| 91 | + } |
| 92 | +// DEFAULT: 9 (MaxFlatWorkGroupSize: 9 |
| 93 | +#pragma omp target teams distribute parallel for num_threads(9) |
| 94 | + for (int i = 0; i < N; ++i) { |
| 95 | + optnone(); |
| 96 | + } |
| 97 | +// DEFAULT: 4 (MaxFlatWorkGroupSize: 4 |
| 98 | +#pragma omp target teams distribute parallel for simd thread_limit(4) |
| 99 | + for (int i = 0; i < N; ++i) { |
| 100 | + optnone(); |
| 101 | + } |
| 102 | +} |
| 103 | + |
0 commit comments