[all-commits] [llvm/llvm-project] 233de4: [mlir] Add map_nested_foreach_thread_to_gpu_thread...

Guray Ozen via All-commits all-commits at lists.llvm.org
Mon Sep 19 07:27:49 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 233de4e808b35945266c9212671b71d320adb564
      https://github.com/llvm/llvm-project/commit/233de4e808b35945266c9212671b71d320adb564
  Author: Guray Ozen <guray.ozen at gmail.com>
  Date:   2022-09-19 (Mon, 19 Sep 2022)

  Changed paths:
    M mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.td
    M mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
    M mlir/include/mlir/Dialect/SCF/IR/SCFOps.td
    M mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
    M mlir/lib/Dialect/SCF/IR/SCF.cpp
    A mlir/test/Dialect/Linalg/transform-gpu.mlir

  Log Message:
  -----------
  [mlir] Add map_nested_foreach_thread_to_gpu_threads op to transform dialect

This revision adds a new op `map_nested_foreach_thread_to_gpu_threads` to transform dialect. The op searches `scf.foreach_threads` inside the `gpu_launch` and distributes them with `gpu.thread_id` attribute.

Loop mapping is explicit and given by the `map_nested_foreach_thread_to_gpu_threads` op. Mapping is done one-to-one, therefore the loops dissappear.

The dynamic trip count or trip count that are larger than thread size are not supported for the time being. However, we can indeed support them by generating a loop inside with cyclic scheduling.

For the time being, trip counts that are dynamic or bigger than thread sizes are not supported. However, in the future the compiler can indeed generate a loop with static cyclic scheduling to support these cases.

Current mechanism allows `scf.foreach_threads` to be siblings or nested. There cannot be interleaving code between the loops when they are nested.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D133950




More information about the All-commits mailing list