[all-commits] [llvm/llvm-project] 85e38d: [mlir][GPU] Add known_block_size and known_grid_si...

Krzysztof Drewniak via All-commits all-commits at lists.llvm.org
Thu Dec 22 13:41:58 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 85e38d7cd670371206f6067772dc822049d2cbd8
      https://github.com/llvm/llvm-project/commit/85e38d7cd670371206f6067772dc822049d2cbd8
  Author: Krzysztof Drewniak <Krzysztof.Drewniak at amd.com>
  Date:   2022-12-22 (Thu, 22 Dec 2022)

  Changed paths:
    M mlir/include/mlir/Dialect/GPU/IR/GPUOps.td
    M mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
    M mlir/lib/Dialect/GPU/IR/InferIntRangeInterfaceImpls.cpp
    M mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
    M mlir/test/Dialect/GPU/int-range-interface.mlir
    M mlir/test/Dialect/GPU/invalid.mlir
    M mlir/test/Dialect/GPU/outlining.mlir

  Log Message:
  -----------
  [mlir][GPU] Add known_block_size and known_grid_size to gpu.func

In many cases, the the number of workgroups (the grid size) and the
number of workitems within each group (the block size) that a GPU
kernel will be launched with are known. For example, if gpu.launch is
called with constant block and grid sizes, we know that those are the
only possible sizes that will be used to launch that kernel. In other
cases, a custom code-generation pipeline that eventually produces GPU
kernels may know the launch dimensions of those kernels, or at least
may be able to provide an upper bound on them.

Other GPU programming systems, such as OpenCL, allow capturing such
information to enable compiler optimizations - see
reqd_work_group_size, but MLIR currently has no mechanism for doing so.

This set of attributes is the first step in enabling optimizations
based on the known launch dimensions of kernels. It extends the kernel
outline pass to set these bounds on kernels with constant launch
dimensions and extends integer range inference for GPU index
operations to account for the bounds when they are known.

Subsequent revisions will use this data when lowering GPU operations
to the ROCDL dialect.

Reviewed By: antiagainst

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




More information about the All-commits mailing list