@@ -370,7 +370,7 @@ def MosaicGPU_AsyncStoreOp : Op<MosaicGPU_Dialect, "async_store",
370370}
371371
372372def MosaicGPU_VectorLoadOp : Op<MosaicGPU_Dialect, "vector_load",
373- [InferTypeOpInterface, MemoryEffects<[MemRead]>]> {
373+ [DeclareOpInterfaceMethods< InferTypeOpInterface> , MemoryEffects<[MemRead]>]> {
374374 let summary = "Reads an n-D slice of memory into an n-D vector.";
375375 let description = [{
376376 Similar to `vector.load` (vector dialect) but supports loading from
@@ -386,24 +386,6 @@ def MosaicGPU_VectorLoadOp : Op<MosaicGPU_Dialect, "vector_load",
386386 OptionalAttr<BoolAttr>:$optimized
387387 );
388388 let results = (outs AnyFixedVectorOfNonZeroRank);
389-
390- let extraClassDeclaration = [{
391- static llvm::LogicalResult inferReturnTypes(
392- mlir::MLIRContext *,
393- std::optional<mlir::Location> location,
394- mlir::ValueRange operands,
395- mlir::DictionaryAttr attributes,
396- mlir::OpaqueProperties properties,
397- mlir::RegionRange regions,
398- llvm::SmallVectorImpl<mlir::Type> &inferredReturnTypes) {
399- mlir::MemRefType memref_type =
400- mlir::cast<mlir::MemRefType>(operands[0].getType());
401- auto vector_type = mlir::VectorType::get(
402- memref_type.getShape(), memref_type.getElementType());
403- inferredReturnTypes.assign({vector_type});
404- return ::mlir::success();
405- }
406- }];
407389}
408390
409391def MosaicGPU_VectorStoreOp : Op<MosaicGPU_Dialect, "vector_store",
@@ -502,7 +484,8 @@ def MosaicGPU_WGMMASupportedAccumulatorType : AnyTypeOf<[F16, F32, I32],
502484 "A type supported by the accumulator `wgmma.mma_async` instruction">;
503485
504486
505- def MosaicGPU_WGMMAOp : Op<MosaicGPU_Dialect, "wgmma", [InferTypeOpInterface]> {
487+ def MosaicGPU_WGMMAOp : Op<MosaicGPU_Dialect, "wgmma",
488+ [DeclareOpInterfaceMethods<InferTypeOpInterface>]> {
506489 let summary = "Multiply two matrices asynchronously using warpgroup level matrix multiply operations.";
507490 let description = [{
508491 Schedules WGMMA operations that perform the following matrix multiply and
@@ -554,24 +537,6 @@ def MosaicGPU_WGMMAOp : Op<MosaicGPU_Dialect, "wgmma", [InferTypeOpInterface]> {
554537 `->` type(results)
555538 }];
556539
557- let extraClassDeclaration = [{
558- static llvm::LogicalResult inferReturnTypes(
559- mlir::MLIRContext *,
560- std::optional<mlir::Location> location,
561- mlir::ValueRange operands,
562- mlir::DictionaryAttr attributes,
563- mlir::OpaqueProperties properties,
564- mlir::RegionRange regions,
565- llvm::SmallVectorImpl<mlir::Type> &inferredReturnTypes) {
566- if (operands.empty()) {
567- return ::mlir::emitOptionalError(
568- location, "expected non-empty operands");
569- }
570- inferredReturnTypes.assign({operands[0].getType()});
571- return ::mlir::success();
572- }
573- }];
574-
575540 let hasVerifier = 1;
576541}
577542
@@ -630,32 +595,13 @@ def MosaicGPU_TcGen05MMAOp : Op<MosaicGPU_Dialect, "tcgen05_mma", [AttrSizedOper
630595}
631596
632597def MosaicGPU_OptimizationBarrierOp : Op<MosaicGPU_Dialect, "optimization_barrier",
633- [InferTypeOpInterface]> {
598+ [DeclareOpInterfaceMethods< InferTypeOpInterface> ]> {
634599 let summary = "Prevents MLIR from moving operations across the barrier.";
635600
636601 let arguments = (ins
637602 Variadic<AnyType>:$operands
638603 );
639604 let results = (outs Variadic<AnyType>);
640-
641- let extraClassDeclaration = [{
642- static llvm::LogicalResult inferReturnTypes(
643- mlir::MLIRContext *,
644- std::optional<mlir::Location> location,
645- mlir::ValueRange operands,
646- mlir::DictionaryAttr attributes,
647- mlir::OpaqueProperties properties,
648- mlir::RegionRange regions,
649- llvm::SmallVectorImpl<mlir::Type> &inferredReturnTypes) {
650- if (operands.empty()) {
651- return ::mlir::emitOptionalError(
652- location, "expected non-empty operands");
653- }
654- ::mlir::TypeRange operand_types = operands.getTypes();
655- inferredReturnTypes.assign(operand_types.begin(), operand_types.end());
656- return ::mlir::success();
657- }
658- }];
659605}
660606
661607def MosaicGPU_ReturnOp : Op<MosaicGPU_Dialect, "return",
@@ -794,31 +740,13 @@ def MosaicGPU_TmemDeallocOp : Op<MosaicGPU_Dialect, "tmem_dealloc", []> {
794740}
795741
796742def MosaicGPU_AsyncLoadTmemOp : Op<MosaicGPU_Dialect, "async_load_tmem",
797- [InferTypeOpInterface]> {
743+ [DeclareOpInterfaceMethods< InferTypeOpInterface> ]> {
798744 let summary = "Copies TMEM to registers asynchronously.";
799745
800746 let arguments = (ins MemRefRankOf<[AnyType], [2]>:$source);
801747 let results = (outs VectorOfRank<[2]>);
802748
803749 let hasVerifier = 1;
804-
805- let extraClassDeclaration = [{
806- static llvm::LogicalResult inferReturnTypes(
807- mlir::MLIRContext *,
808- std::optional<mlir::Location> location,
809- mlir::ValueRange operands,
810- mlir::DictionaryAttr attributes,
811- mlir::OpaqueProperties properties,
812- mlir::RegionRange regions,
813- llvm::SmallVectorImpl<mlir::Type> &inferredReturnTypes) {
814- mlir::MemRefType memref_type =
815- mlir::cast<mlir::MemRefType>(operands[0].getType());
816- auto vector_type = mlir::VectorType::get(
817- memref_type.getShape(), memref_type.getElementType());
818- inferredReturnTypes.assign({vector_type});
819- return ::mlir::success();
820- }
821- }];
822750}
823751
824752def MosaicGPU_AsyncStoreTmemOp : Op<MosaicGPU_Dialect, "async_store_tmem", []> {
0 commit comments