6 Commits

Author SHA1 Message Date
Scott Manley
668d474185
[OpenACC][MLIR] clone private operands during ACCIfClauseLowering (#177458)
Clone the private operands into the compute region side. This also fixes
an issue where references to acc.private remain on the host side.
2026-01-23 07:57:56 -06:00
Scott Manley
49903c4e64
[OpenACC][MLIR] clone reduction operands during ACCIfClauseLowering (#177196)
Clone the reduction operands into the compute region side. This also
fixes an issue where references to acc.reduction remain on the host
side.
2026-01-21 14:15:25 -06:00
Scott Manley
a20b6489b2
[OpenACC][MLIR] clone firstprivate operands during ACCIfClauseLowering (#176856)
Clone the firstprivate operands into the compute region side. This also
fixes an issue where references to acc.firstprivate remain on the host
side.
2026-01-20 18:09:30 -06:00
Razvan Lupusoru
30166796e8
[mlir][acc] Add ACCIfClauseLowering pass (#173573)
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>
2025-12-25 11:41:08 -08:00
Emilio Cota
0a415db5e2 Revert "[mlir][acc] Add ACCIfClauseLowering pass (#173447)"
This reverts commit f64bc988959f1ac028d2b64500791014537d3706.

The revert is needed because this commit depends on a previous commit
(PR #173407) that is about to be reverted due to a use-after-free -- see
https://github.com/llvm/llvm-project/pull/173407#issuecomment-3690793823
2025-12-24 22:29:42 -05:00
Razvan Lupusoru
f64bc98895
[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>
2025-12-24 08:53:48 -08:00