[PATCH] D82115: [OPENMP50]Codegen for scan directives in parallel for simd regions.
Alexey Bataev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 18 12:01:28 PDT 2020
ABataev created this revision.
ABataev added a reviewer: jdoerfert.
Herald added subscribers: sstefan1, guansong, yaxunl.
Herald added a project: clang.
Added codegen for scan directives in parallel for simd regions.
Emits the code for the directive with inscan reductions.
Original code:
#pragma omp parallel for simd reduction(inscan, op : ...)
for() {
<input phase>;
#pragma omp scan (in)exclusive(...)
<scan phase>
}
is transformed to something:
#pragma omp parallel
{
size num_iters = <num_iters>;
<type> buffer[num_iters];
#pragma omp for simd
for (i: 0..<num_iters>) {
<input phase>;
buffer[i] = red;
}
#pragma omp barrier
for (int k = 0; k != ceil(log2(num_iters)); ++k)
for (size cnt = last_iter; cnt >= pow(2, k); --k)
buffer[i] op= buffer[i-pow(2,k)];
#pragma omp for simd
for (0..<num_iters>) {
red = InclusiveScan ? buffer[i] : buffer[i-1];
<scan phase>;
}
}
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D82115
Files:
clang/lib/CodeGen/CGStmtOpenMP.cpp
clang/test/OpenMP/parallel_for_simd_scan_codegen.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82115.271799.patch
Type: text/x-patch
Size: 18125 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200618/8712865e/attachment-0001.bin>
More information about the cfe-commits
mailing list