| 1 | //===- ShardingInterfaceImpl.cpp - Bufferization sharding models ----------===// |
|---|---|
| 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 | #include "mlir/Dialect/Bufferization/Extensions/ShardingInterfaceImpl.h" |
| 10 | #include "mlir/Dialect/Bufferization/IR/Bufferization.h" |
| 11 | #include "mlir/Dialect/Shard/Interfaces/ShardingInterfaceImpl.h" |
| 12 | #include "mlir/IR/DialectRegistry.h" |
| 13 | |
| 14 | using namespace mlir; |
| 15 | using namespace mlir::bufferization; |
| 16 | using namespace mlir::shard; |
| 17 | |
| 18 | void mlir::bufferization::shard_ext::registerShardingInterfaceExternalModels( |
| 19 | DialectRegistry ®istry) { |
| 20 | |
| 21 | registry.addExtension(extensionFn: +[](MLIRContext *ctx, BufferizationDialect *dialect) { |
| 22 | AllocTensorOp::attachInterface< |
| 23 | IndependentParallelIteratorDomainShardingInterface<AllocTensorOp>>( |
| 24 | context&: *ctx); |
| 25 | DeallocTensorOp::attachInterface< |
| 26 | IndependentParallelIteratorDomainShardingInterface<DeallocTensorOp>>( |
| 27 | context&: *ctx); |
| 28 | MaterializeInDestinationOp::attachInterface< |
| 29 | ElementwiseShardingInterface<MaterializeInDestinationOp>>(context&: *ctx); |
| 30 | }); |
| 31 | } |
| 32 |