This op is the inverse of all-gather. It is useful to have an explicit concise representation instead of having a blob of slicing logic. Add lowering for the op that slices from the tensor based on the in-group process index. Make resharding generate an all-slice instead of inserting the slicing logic directly.
36 lines
1.2 KiB
C++
36 lines
1.2 KiB
C++
//===- TransformsDetail.h - -------------------------------------*- C++ -*-===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef MLIR_DIALECT_MESH_TRANSFORMS_TRANSFORMSDETAIL_H
|
|
#define MLIR_DIALECT_MESH_TRANSFORMS_TRANSFORMSDETAIL_H
|
|
|
|
#include "mlir/IR/PatternMatch.h"
|
|
#include "mlir/IR/SymbolTable.h"
|
|
|
|
namespace mlir {
|
|
namespace mesh {
|
|
|
|
template <typename Op>
|
|
struct OpRewritePatternWithSymbolTableCollection : OpRewritePattern<Op> {
|
|
template <typename... OpRewritePatternArgs>
|
|
OpRewritePatternWithSymbolTableCollection(
|
|
SymbolTableCollection &symbolTableCollection,
|
|
OpRewritePatternArgs &&...opRewritePatternArgs)
|
|
: OpRewritePattern<Op>(
|
|
std::forward<OpRewritePatternArgs...>(opRewritePatternArgs)...),
|
|
symbolTableCollection(symbolTableCollection) {}
|
|
|
|
protected:
|
|
SymbolTableCollection &symbolTableCollection;
|
|
};
|
|
|
|
} // namespace mesh
|
|
} // namespace mlir
|
|
|
|
#endif // MLIR_DIALECT_MESH_TRANSFORMS_TRANSFORMSDETAIL_H
|