MLIR  20.0.0git
ParallelLoopMapper.h
Go to the documentation of this file.
1 //===- ParallelLoopMapper.h - Utilities for mapping parallel loops to GPU ====//
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 declares the utilities to generate mappings for parallel
10 // loops to GPU devices.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef MLIR_DIALECT_GPU_TRANSFORMS_PARALLELLOOPMAPPER_H
15 #define MLIR_DIALECT_GPU_TRANSFORMS_PARALLELLOOPMAPPER_H
16 
18 #include "mlir/Support/LLVM.h"
19 #include "llvm/ADT/StringRef.h"
20 
21 namespace mlir {
22 
23 class AffineMap;
24 class Operation;
25 class Region;
26 
27 } // namespace mlir
28 
29 namespace mlir {
30 namespace scf {
31 class ParallelOp;
32 } // namespace scf
33 
34 namespace gpu {
35 
36 /// Name of the mapping attribute produced by loop mappers.
37 StringRef getMappingAttrName();
38 
39 /// Sets the mapping attribute of a scf.parallel operation. Verifies that the
40 /// mapping passed is valid.
41 /// - the number of DimMapperAttr provided is same as the number of loops of
42 /// the `ploopOp`.
43 /// - the mapping does not map multiple loops to the same processor.
44 LogicalResult setMappingAttr(scf::ParallelOp ploopOp,
46 } // namespace gpu
47 } // namespace mlir
48 #endif // MLIR_DIALECT_GPU_TRANSFORMS_PARALLELLOOPMAPPER_H
LogicalResult setMappingAttr(scf::ParallelOp ploopOp, ArrayRef< ParallelLoopDimMappingAttr > mapping)
Sets the mapping attribute of a scf.parallel operation.
StringRef getMappingAttrName()
Name of the mapping attribute produced by loop mappers.
Include the generated interface declarations.