llvm-project
f64bc988 - [mlir][acc] Add ACCIfClauseLowering pass (#173447)

Commit
16 days ago
[mlir][acc] Add ACCIfClauseLowering pass (#173447) This pass lowers OpenACC compute constructs with `if` clauses into `scf.if` with separate device and host paths. Before: ``` %d = acc.copyin varPtr(%a : memref<10xf32>) -> memref<10xf32> acc.parallel dataOperands(%d) if(%cond) { acc.loop control(%i : i32) = (%c0 : i32) to (%c10 : i32) step (%c1 : i32) { // loop body acc.yield } acc.yield } acc.copyout accPtr(%d) to varPtr(%a) ``` After: ``` scf.if %cond { %d = acc.copyin varPtr(%a : memref<10xf32>) -> memref<10xf32> acc.parallel dataOperands(%d) { acc.loop control(%i : i32) = (%c0 : i32) to (%c10 : i32) step (%c1 : i32) { // loop body acc.yield } acc.yield } acc.copyout accPtr(%d) to varPtr(%a) } else { scf.for %i = %c0 to %c10 step %c1 { // loop body } } ``` Co-authored-by: Susan Tan <zujunt@nvidia.com>
Parents
Loading