101 lines · c
1// clang-format off2// RUN: %libomptarget-compile-generic3// RUN: env LIBOMPTARGET_INFO=16 \4// RUN: %libomptarget-run-generic 2>&1 | %fcheck-generic --check-prefix=DEFAULT5// RUN: %libomptarget-compile-generic -g6// RUN: env LIBOMPTARGET_INFO=16 \7// RUN: %libomptarget-run-generic 2>&1 | %fcheck-generic --check-prefix=DEFAULT8 9// REQUIRES: amdgpu10 11__attribute__((optnone)) int optnone() { return 1; }12 13int main() {14 int N = optnone() * 4098 * 32;15 16// DEFAULT: [[NT:(128|256)]] (MaxFlatWorkGroupSize: [[NT]]17#pragma omp target teams distribute parallel for simd18 for (int i = 0; i < N; ++i) {19 optnone();20 }21// DEFAULT: [[NT:(128|256)]] (MaxFlatWorkGroupSize: [[NT]]22#pragma omp target teams distribute parallel for simd23 for (int i = 0; i < N; ++i) {24 optnone();25 }26// DEFAULT: [[NT:(128|256)]] (MaxFlatWorkGroupSize: [[NT]]27#pragma omp target teams distribute parallel for simd28 for (int i = 0; i < N; ++i) {29 optnone();30 }31// DEFAULT: [[NT:(128|256)]] (MaxFlatWorkGroupSize: [[NT]]32#pragma omp target33#pragma omp teams distribute parallel for34 for (int i = 0; i < N; ++i) {35 optnone();36 }37// DEFAULT: 42 (MaxFlatWorkGroupSize: 102438#pragma omp target thread_limit(optnone() * 42)39#pragma omp teams distribute parallel for40 for (int i = 0; i < N; ++i) {41 optnone();42 }43// DEFAULT: 42 (MaxFlatWorkGroupSize: 4244#pragma omp target thread_limit(optnone() * 42) ompx_attribute(__attribute__((amdgpu_flat_work_group_size(42, 42))))45#pragma omp teams distribute parallel for46 for (int i = 0; i < N; ++i) {47 optnone();48 }49// DEFAULT: 42 (MaxFlatWorkGroupSize: 4250#pragma omp target ompx_attribute(__attribute__((amdgpu_flat_work_group_size(42, 42))))51#pragma omp teams distribute parallel for52 for (int i = 0; i < N; ++i) {53 optnone();54 }55// DEFAULT: MaxFlatWorkGroupSize: 102456#pragma omp target57#pragma omp teams distribute parallel for num_threads(optnone() * 42)58 for (int i = 0; i < N; ++i) {59 optnone();60 }61// DEFAULT: MaxFlatWorkGroupSize: 102462#pragma omp target teams distribute parallel for thread_limit(optnone() * 42)63 for (int i = 0; i < N; ++i) {64 optnone();65 }66// DEFAULT: MaxFlatWorkGroupSize: 102467#pragma omp target teams distribute parallel for num_threads(optnone() * 42)68 for (int i = 0; i < N; ++i) {69 optnone();70 }71// DEFAULT: 9 (MaxFlatWorkGroupSize: 972#pragma omp target73#pragma omp teams distribute parallel for num_threads(9)74 for (int i = 0; i < N; ++i) {75 optnone();76 }77// DEFAULT: 4 (MaxFlatWorkGroupSize: 478#pragma omp target thread_limit(4)79#pragma omp teams distribute parallel for80 for (int i = 0; i < N; ++i) {81 optnone();82 }83// DEFAULT: 4 (MaxFlatWorkGroupSize: 484#pragma omp target85#pragma omp teams distribute parallel for thread_limit(4)86 for (int i = 0; i < N; ++i) {87 optnone();88 }89// DEFAULT: 9 (MaxFlatWorkGroupSize: 990#pragma omp target teams distribute parallel for num_threads(9)91 for (int i = 0; i < N; ++i) {92 optnone();93 }94// DEFAULT: 4 (MaxFlatWorkGroupSize: 495#pragma omp target teams distribute parallel for simd thread_limit(4)96 for (int i = 0; i < N; ++i) {97 optnone();98 }99}100 101