MLIR 24.0.0git
GPUTransformOps.h
Go to the documentation of this file.
1//===- GPUTransformOps.h - GPU transform ops --------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef MLIR_DIALECT_GPU_TRANSFORMOPS_GPUTRANSFORMOPS_H
10#define MLIR_DIALECT_GPU_TRANSFORMOPS_GPUTRANSFORMOPS_H
11
15
16//===----------------------------------------------------------------------===//
17// GPU Transform Operations
18//===----------------------------------------------------------------------===//
19
20#define GET_OP_CLASSES
21#include "mlir/Dialect/GPU/TransformOps/GPUTransformOps.h.inc"
22
23namespace mlir {
24class DialectRegistry;
25namespace transform {
26namespace gpu {
27struct GpuIdBuilder;
28
29/// Map the top level `scf.forall` op to GPU blocks.
30/// Mapping is one-to-one and the induction variables of `scf.forall` are
31/// rewritten to gpu.block_id according to the thread_dim_mapping attribute.
32///
33/// Dynamic, `scf.forall` trip counts are currently not supported.
34/// Dynamic `gridDims` are currently not supported.
36mapForallToBlocksImpl(RewriterBase &rewriter, TransformOpInterface transformOp,
37 scf::ForallOp forallOp,
39 const GpuIdBuilder &gpuIdBuilder);
40
41/// Search `scf.forall` ops nested under `target` and map each such op to an
42/// explicit GPU implementation along `blockDims`.
43/// The mapping is one-to-one and the induction variables of `scf.forall` are
44/// rewritten to gpuIdBuilder.idBuilder according to the
45/// gpuIdBuilder.mappingAttributes attribute.
46///
47/// Dynamic, `scf.forall` trip counts are currently not supported.
48/// Dynamic `blockDims` sizes are currently not supported.
49/// `blockDims` is expected to be of size 3.
52 std::optional<TransformOpInterface> transformOp,
53 scf::ForallOp forallOp, ArrayRef<int64_t> blockSizes,
54 int64_t warpSize, bool syncAfterDistribute);
55
56/// Search `scf.forall` ops nested under `target` and map each such op to an
57/// explicit GPU implementation along `blockDims`.
58/// The mapping is one-to-one and the induction variables of `scf.forall` are
59/// rewritten to appropriate ids according to the mapping attribute.
60///
61/// Dynamic, `scf.forall` trip counts are currently not supported.
62/// Dynamic `blockDims` or `newBasis` entries are currently not
63/// supported. `blockDims` is expected to be of size 3.
64///
65/// The insertion point of the `rewriter` is expected to be set at the
66/// beginning of the `target` body block and dominate all other blocks.
69 std::optional<TransformOpInterface> transformOp,
71 int64_t warpSize, bool syncAfterDistribute);
72
73} // namespace gpu
74} // namespace transform
75
76namespace gpu {
78} // namespace gpu
79} // namespace mlir
80
81#endif // MLIR_DIALECT_GPU_TRANSFORMOPS_GPUTRANSFORMOPS_H
The result of a transform IR operation application.
The DialectRegistry maps a dialect namespace to a constructor for the matching dialect.
Operation is the basic unit of execution within MLIR.
Definition Operation.h:87
This class coordinates the application of a rewrite on a set of IR, providing a way for clients to tr...
void registerTransformDialectExtension(DialectRegistry &registry)
DiagnosedSilenceableFailure mapForallToBlocksImpl(RewriterBase &rewriter, TransformOpInterface transformOp, scf::ForallOp forallOp, SmallVectorImpl< int64_t > &gridDims, const GpuIdBuilder &gpuIdBuilder)
Map the top level scf.forall op to GPU blocks.
DiagnosedSilenceableFailure mapNestedForallToThreadsImpl(RewriterBase &rewriter, std::optional< TransformOpInterface > transformOp, Operation *target, ArrayRef< int64_t > blockDims, int64_t warpSize, bool syncAfterDistribute)
Search scf.forall ops nested under target and map each such op to an explicit GPU implementation alon...
DiagnosedSilenceableFailure mapOneForallToThreadsImpl(RewriterBase &rewriter, std::optional< TransformOpInterface > transformOp, scf::ForallOp forallOp, ArrayRef< int64_t > blockSizes, int64_t warpSize, bool syncAfterDistribute)
Search scf.forall ops nested under target and map each such op to an explicit GPU implementation alon...
Include the generated interface declarations.
Helper struct for configuring the rewrite of mapped scf.forall ops to various gpu id configurations.
Definition Utils.h:59