MLIR 24.0.0git
Passes.h
Go to the documentation of this file.
1//===- Passes.h - GPU ROCDL pass entrypoints --------------------*- 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// This header file defines prototypes of the ROCDL-specific GPU passes and
10// patterns.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef MLIR_DIALECT_GPU_TRANSFORMS_ROCDL_PASSES_H_
15#define MLIR_DIALECT_GPU_TRANSFORMS_ROCDL_PASSES_H_
20#include <optional>
22namespace mlir {
23#define GEN_PASS_DECL
24#include "mlir/Dialect/GPU/Transforms/ROCDL/Passes.h.inc"
26/// Collect a set of patterns to lower `gpu.subgroup_reduce` into `amdgpu.dpp`
27/// ops over scalar types. Assumes that the subgroup has
28/// `subgroupSize` lanes. Applicable only to AMD GPUs.
30 RewritePatternSet &patterns, unsigned subgroupSize,
31 const ROCDL::TargetInfo &target, PatternBenefit benefit = 1);
32
33/// Disjoint counterpart of `populateGpuLowerSubgroupReduceToDPPPatterns`
34/// that only matches `gpu.subgroup_reduce` ops with a `cluster_size`.
36 RewritePatternSet &patterns, unsigned subgroupSize,
37 const ROCDL::TargetInfo &target, PatternBenefit benefit = 1);
38
39/// Tries to promote `gpu.shuffle`s to specialized AMDGPU intrinsics.
41 RewritePatternSet &patterns, std::optional<ROCDL::TargetInfo> target);
42
43/// Generate the code for registering passes.
44#define GEN_PASS_REGISTRATION
45#include "mlir/Dialect/GPU/Transforms/ROCDL/Passes.h.inc"
46} // namespace mlir
47
48#endif // MLIR_DIALECT_GPU_TRANSFORMS_ROCDL_PASSES_H_
This class represents the benefit of a pattern match in a unitless scheme that ranges from 0 (very li...
Describes the AMDGPU target a lowering is producing code for: the triple's subarch (which identifies ...
Include the generated interface declarations.
void populateGpuPromoteShuffleToAMDGPUPatterns(RewritePatternSet &patterns, std::optional< ROCDL::TargetInfo > target)
Tries to promote gpu.shuffles to specialized AMDGPU intrinsics.
void populateGpuLowerClusteredSubgroupReduceToDPPPatterns(RewritePatternSet &patterns, unsigned subgroupSize, const ROCDL::TargetInfo &target, PatternBenefit benefit=1)
Disjoint counterpart of populateGpuLowerSubgroupReduceToDPPPatterns that only matches gpu....
void populateGpuLowerSubgroupReduceToDPPPatterns(RewritePatternSet &patterns, unsigned subgroupSize, const ROCDL::TargetInfo &target, PatternBenefit benefit=1)
Collect a set of patterns to lower gpu.subgroup_reduce into amdgpu.dpp ops over scalar types.