
The default version of OpenMP is updated from 5.0 to 5.1 which means if -fopenmp is specified but -fopenmp-version is not specified with clang, the default version of OpenMP is taken to be 5.1. After modifying the Frontend for that, various LIT tests were updated. This patch contains all such changes. At a high level, these are the patterns of changes observed in LIT tests - # RUN lines which mentioned `-fopenmp-version=50` need to kept only if the IR for version 5.0 and 5.1 are different. Otherwise only one RUN line with no version info(i.e. default version) needs to be there. # Test cases of this sort already had the RUN lines with respect to the older default version 5.0 and the version 5.1. Only swapping the version specification flag `-fopenmp-version` from newer version RUN line to older version RUN line is required. # Diagnostics: Remove the 5.0 version specific RUN lines if there was no difference in the Diagnostics messages with respect to the default 5.1. # Diagnostics: In case there was any difference in diagnostics messages between 5.0 and 5.1, mention version specific messages in tests. # If the test contained version specific ifdef's e.g. "#ifdef OMP5" but there were no RUN lines for any other version than 5.X, then bring the code guarded by ifdef's outside and remove the ifdef's. # Some tests had RUN lines for both 5.0 and 5.1 versions, but it is found that the IR for 5.0 is not different from the 5.1, therefore such RUN lines are redundant. So, such duplicated lines are removed. # To generate CHECK lines automatically, use the script llvm/utils/update_cc_test_checks.py Reviewed By: saiislam, ABataev Differential Revision: https://reviews.llvm.org/D129635 (cherry picked from commit 9dd2999907dc791136a75238a6000f69bf67cf4e)
124 lines
4.0 KiB
C++
124 lines
4.0 KiB
C++
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp \
|
|
// RUN: -fsyntax-only -verify %s
|
|
|
|
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp \
|
|
// RUN: -ast-print %s | FileCheck %s
|
|
|
|
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp \
|
|
// RUN: -emit-pch -o %t %s
|
|
|
|
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp \
|
|
// RUN: -include-pch %t -ast-print %s | FileCheck %s
|
|
|
|
// expected-no-diagnostics
|
|
|
|
#ifndef HEADER
|
|
#define HEADER
|
|
|
|
typedef void **omp_allocator_handle_t;
|
|
extern const omp_allocator_handle_t omp_null_allocator;
|
|
extern const omp_allocator_handle_t omp_default_mem_alloc;
|
|
extern const omp_allocator_handle_t omp_large_cap_mem_alloc;
|
|
extern const omp_allocator_handle_t omp_const_mem_alloc;
|
|
extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
|
|
extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
|
|
extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
|
|
extern const omp_allocator_handle_t omp_pteam_mem_alloc;
|
|
extern const omp_allocator_handle_t omp_thread_mem_alloc;
|
|
|
|
//CHECK: template <typename T, int C, int D> void templ_foo(T t) {
|
|
//CHECK: T j, z;
|
|
//CHECK: #pragma omp target parallel loop device(D) collapse(C) reduction(+: z) lastprivate(j) bind(thread) num_threads(C + 2)
|
|
//CHECK: for (T i = 0; i < t; ++i)
|
|
//CHECK: for (j = 0; j < t; ++j)
|
|
//CHECK: z += i + j;
|
|
//CHECK: }
|
|
|
|
//CHECK: template<> void templ_foo<int, 2, 0>(int t) {
|
|
//CHECK: int j, z;
|
|
//CHECK: #pragma omp target parallel loop device(0) collapse(2) reduction(+: z) lastprivate(j) bind(thread) num_threads(2 + 2)
|
|
//CHECK: for (int i = 0; i < t; ++i)
|
|
//CHECK: for (j = 0; j < t; ++j)
|
|
//CHECK: z += i + j;
|
|
//CHECK: }
|
|
template <typename T, int C, int D>
|
|
void templ_foo(T t) {
|
|
|
|
T j,z;
|
|
#pragma omp target parallel loop device(D) collapse(C) reduction(+:z) lastprivate(j) bind(thread) num_threads(C+2)
|
|
for (T i = 0; i<t; ++i)
|
|
for (j = 0; j<t; ++j)
|
|
z += i+j;
|
|
}
|
|
|
|
|
|
//CHECK: void test() {
|
|
void test() {
|
|
constexpr int N = 100;
|
|
float MTX[N][N];
|
|
int aaa[1000];
|
|
|
|
//CHECK: #pragma omp target parallel loop map(tofrom: MTX)
|
|
#pragma omp target parallel loop map(MTX)
|
|
for (auto j = 0; j < N; ++j) {
|
|
MTX[0][j] = 0;
|
|
}
|
|
|
|
int j, z, z1;
|
|
//CHECK: #pragma omp target parallel loop collapse(2) private(z) lastprivate(j) order(concurrent) reduction(+: z1) bind(parallel)
|
|
#pragma omp target parallel loop collapse(2) private(z) lastprivate(j) \
|
|
order(concurrent) reduction(+:z1) bind(parallel)
|
|
for (auto i = 0; i < N; ++i) {
|
|
for (j = 0; j < N; ++j) {
|
|
z = i+j;
|
|
MTX[i][j] = z;
|
|
z1 += z;
|
|
}
|
|
}
|
|
|
|
//CHECK: #pragma omp target parallel loop bind(thread) num_threads(16) default(none)
|
|
#pragma omp target parallel loop bind(thread) num_threads(16) default(none)
|
|
for (auto i = 0; i < N; ++i) { }
|
|
|
|
int pr;
|
|
int zzz;
|
|
//CHECK: #pragma omp target parallel loop private(zzz) uses_allocators(omp_default_mem_alloc) allocate(omp_default_mem_alloc: zzz) if(1) device(0) proc_bind(close) map(tofrom: pr)
|
|
#pragma omp target parallel loop private(zzz) uses_allocators(omp_default_mem_alloc) allocate(omp_default_mem_alloc:zzz) if(1) device(0) proc_bind(close) map(tofrom:pr)
|
|
for (int i=0; i<1000; ++i) {
|
|
zzz = i + 1;
|
|
pr = 33;
|
|
}
|
|
|
|
int fpr = 10;
|
|
int k;
|
|
int s = 20;
|
|
//CHECK: #pragma omp target parallel loop bind(thread) private(pr) firstprivate(fpr) shared(s) allocate(k) reduction(+: k)
|
|
#pragma omp target parallel loop bind(thread) private(pr) firstprivate(fpr) \
|
|
shared(s) allocate(k) reduction(+:k)
|
|
for (auto i = 0; i < N; ++i) {
|
|
pr = i + fpr + s;
|
|
}
|
|
|
|
short y = 3;
|
|
//CHECK: #pragma omp target parallel loop map(tofrom: y) depend(out : y)
|
|
#pragma omp target parallel loop map(tofrom:y) depend(out:y)
|
|
for (int i=0; i<10; ++i) {
|
|
y = 3+i;
|
|
}
|
|
}
|
|
|
|
//CHECK: void nobindingfunc() {
|
|
void nobindingfunc()
|
|
{
|
|
//CHECK: #pragma omp target parallel loop
|
|
#pragma omp target parallel loop
|
|
for (int i=0; i<10; ++i) { }
|
|
}
|
|
|
|
void bar()
|
|
{
|
|
templ_foo<int,2,0>(8);
|
|
}
|
|
|
|
#endif // HEADER
|