[all-commits] [llvm/llvm-project] a25da1: [mlir][openacc] Add device_type support for comput...

Valentin Clement (バレンタイン クレメン) via All-commits all-commits at lists.llvm.org
Wed Dec 20 20:52:25 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a25da1a92120eb5cb74f1a3d28a4849178cfbdff
      https://github.com/llvm/llvm-project/commit/a25da1a92120eb5cb74f1a3d28a4849178cfbdff
  Author: Valentin Clement <clementval at gmail.com>
  Date:   2023-12-20 (Wed, 20 Dec 2023)

  Changed paths:
    M flang/lib/Lower/OpenACC.cpp
    A flang/test/Lower/OpenACC/acc-device-type.f90
    M flang/test/Lower/OpenACC/acc-kernels-loop.f90
    M flang/test/Lower/OpenACC/acc-kernels.f90
    M flang/test/Lower/OpenACC/acc-parallel-loop.f90
    M flang/test/Lower/OpenACC/acc-parallel.f90
    M flang/test/Lower/OpenACC/acc-serial-loop.f90
    M flang/test/Lower/OpenACC/acc-serial.f90
    M mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
    M mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp
    M mlir/test/Dialect/OpenACC/invalid.mlir
    M mlir/test/Dialect/OpenACC/ops.mlir

  Log Message:
  -----------
  [mlir][openacc] Add device_type support for compute operations (#75864)

Re-land PR after being reverted because of buildbot failures.

This patch adds representation for `device_type` clause information on
compute construct (parallel, kernels, serial).

The `device_type` clause on compute construct impacts clauses that
appear after it. The values impacted by `device_type` are now tied with
an attribute array that represent the device_type associated with them.
`DeviceType::None` is used to represent the value produced by a clause
before any `device_type`. The operands and the attribute information are
parser/printed together.

This is an example with `vector_length` clause. The first value (64) is
not impacted by `device_type` so it will be represented with
DeviceType::None. None is not printed. The second value (128) is tied
with the `device_type(multicore)` clause.
```
!$acc parallel vector_length(64) device_type(multicore) vector_length(256)
```
```
acc.parallel vector_length(%c64 : i32, %c128 : i32 [#acc.device_type<multicore>]) {
}
```

When multiple values can be produced for a single clause like
`num_gangs` and `wait`, an extra attribute describe the number of values
belonging to each `device_type`. Values and attributes are
parsed/printed together.

```
acc.parallel num_gangs({%c2 : i32, %c4 : i32}, {%c4 : i32} [#acc.device_type<nvidia>])
```

While preparing this patch I noticed that the wait devnum is not part of
the operations and is not lowered. It will be added in a follow up
patch.




More information about the All-commits mailing list