1//===- Transforms.h - Shard Transforms --------------------------*- 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_SHARD_TRANSFORMS_TRANSFORMS_H
10#define MLIR_DIALECT_SHARD_TRANSFORMS_TRANSFORMS_H
11
12#include "mlir/Dialect/Shard/IR/ShardOps.h"
13#include "mlir/IR/BuiltinTypes.h"
14#include "mlir/IR/Value.h"
15#include "mlir/Support/LLVM.h"
16#include "llvm/ADT/ArrayRef.h"
17
18namespace mlir {
19class RewritePatternSet;
20class SymbolTableCollection;
21class DialectRegistry;
22class ImplicitLocOpBuilder;
23namespace shard {
24
25void populateProcessMultiIndexOpLoweringPatterns(
26 RewritePatternSet &patterns, SymbolTableCollection &symbolTableCollection);
27void registerProcessMultiIndexOpLoweringDialects(DialectRegistry &registry);
28
29void populateAllSliceOpLoweringPatterns(
30 RewritePatternSet &patterns, SymbolTableCollection &symbolTableCollection);
31void registerAllSliceOpLoweringDialects(DialectRegistry &registry);
32
33void populateAllOpLoweringPatterns(
34 RewritePatternSet &patterns, SymbolTableCollection &symbolTableCollection);
35void registerAllOpLoweringDialects(DialectRegistry &registry);
36
37TypedValue<IndexType>
38createCollectiveProcessGroupSize(GridOp grid, ArrayRef<GridAxis> axes,
39 ImplicitLocOpBuilder &builder);
40
41// Get process linear index along the given grid axes.
42TypedValue<IndexType>
43createProcessLinearIndex(ImplicitLocOpBuilder &builder, StringRef grid,
44 ArrayRef<GridAxis> gridAxes = {});
45// Get process linear index from a multi-index along the given grid axes .
46TypedValue<IndexType>
47createProcessLinearIndex(ImplicitLocOpBuilder &builder, StringRef grid,
48 ValueRange processInGroupMultiIndex,
49 ArrayRef<GridAxis> gridAxes = {});
50
51} // namespace shard
52} // namespace mlir
53
54#endif // MLIR_DIALECT_SHARD_TRANSFORMS_TRANSFORMS_H
55