* Split out `MeshDialect.h` form `MeshOps.h` that defines the dialect class. Reduces include clutter if you care only about the dialect and not the ops. * Expose functions `getMesh` and `collectiveProcessGroupSize`. There functions are useful for outside users of the dialect. * Remove unused code. * Remove examples and tests of mesh.shard attribute in tensor encoding. Per the decision that Spmdization would be performed on sharding annotations and there will be no tensors with sharding specified in the type. For more info see this RFC comment: https://discourse.llvm.org/t/rfc-sharding-framework-design-for-device-mesh/73533/81
55 lines
1.9 KiB
C++
55 lines
1.9 KiB
C++
//===- TestProcessMultiIndexOpLowering.cpp --------------------------------===//
|
|
//
|
|
// 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "mlir/Dialect/Arith/IR/Arith.h"
|
|
#include "mlir/Dialect/Mesh/Transforms/Transforms.h"
|
|
#include "mlir/Dialect/Utils/IndexingUtils.h"
|
|
#include "mlir/IR/SymbolTable.h"
|
|
#include "mlir/Pass/Pass.h"
|
|
#include "mlir/Support/LogicalResult.h"
|
|
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
|
|
|
|
using namespace mlir;
|
|
|
|
namespace {
|
|
struct TestMultiIndexOpLoweringPass
|
|
: public PassWrapper<TestMultiIndexOpLoweringPass, OperationPass<>> {
|
|
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TestMultiIndexOpLoweringPass)
|
|
|
|
void runOnOperation() override;
|
|
void getDependentDialects(DialectRegistry ®istry) const override {
|
|
mesh::processMultiIndexOpLoweringRegisterDialects(registry);
|
|
}
|
|
StringRef getArgument() const final {
|
|
return "test-mesh-process-multi-index-op-lowering";
|
|
}
|
|
StringRef getDescription() const final {
|
|
return "Test lowering of mesh.process_multi_index op.";
|
|
}
|
|
};
|
|
} // namespace
|
|
|
|
void TestMultiIndexOpLoweringPass::runOnOperation() {
|
|
RewritePatternSet patterns(&getContext());
|
|
SymbolTableCollection symbolTableCollection;
|
|
mesh::processMultiIndexOpLoweringPopulatePatterns(patterns,
|
|
symbolTableCollection);
|
|
LogicalResult status =
|
|
applyPatternsAndFoldGreedily(getOperation(), std::move(patterns));
|
|
(void)status;
|
|
assert(succeeded(status) && "applyPatternsAndFoldGreedily failed.");
|
|
}
|
|
|
|
namespace mlir {
|
|
namespace test {
|
|
void registerTestMultiIndexOpLoweringPass() {
|
|
PassRegistration<TestMultiIndexOpLoweringPass>();
|
|
}
|
|
} // namespace test
|
|
} // namespace mlir
|