OpenMP reductions need a neutral element, so we match some known reduction
kinds (integer add/mul/or/and/xor, float add/mul, integer and float min/max) to
define the neutral element and the atomic version when possible to express
using atomicrmw (everything except float mul). The SCF-to-OpenMP pass becomes a
module pass because it now needs to introduce new symbols for reduction
declarations in the module.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/lib/Conversion/SCFToOpenMP/SCFToOpenMP.cpp | ||
---|---|---|
63 | opreations -> operations | |
97 | is -> if | |
184 | please add assert message | |
232 | I would move this below the if | |
233 | Should not this be an assert instead? if I am not mistaken ReduceOp has a single block. | |
275 | I would explicitly set isMin to false. | |
354 | "cannot be an LLVM" -> "is not an LLVM" |
Address review.
mlir/lib/Conversion/SCFToOpenMP/SCFToOpenMP.cpp | ||
---|---|---|
275 | It is unset on purpose to indicate that the further call (matchSelectReduction) will set it. The compiler will likely complain if it is ever used without being initialized, but will not complain if it is initialized to the wrong value. |
opreations -> operations