diff --git a/mlir/include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yaml b/mlir/include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yaml --- a/mlir/include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yaml +++ b/mlir/include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yaml @@ -1140,11 +1140,14 @@ metadata: !LinalgOpMetadata name: batch_mmt4d cpp_class_name: BatchMmt4DOp - doc: "Performs a batched matrix-matrix-transpose multiplication of two\nbatched-4D\ - \ (5D) inputs.\n\nBesides the outermost batch dimension has the same semantic\ - \ as\nlinalg.batch_matmul, the differences from linalg.batch_matmul in the\nnon-batch\ - \ dimensions are the same as linalg.mmt4d vs. linalg.matmul. See the\ndescription\ - \ of lingalg.mmt4d." + doc: |- + Performs a batched matrix-matrix-transpose multiplication of two batched-4D + (5D) inputs. + + Besides the outermost batch dimension has the same semantic as + linalg.batch_matmul, the differences from linalg.batch_matmul in the + non-batch dimensions are the same as linalg.mmt4d vs. linalg.matmul. See the + description of lingalg.mmt4d. implements: - LinalgContractionOpInterface structured_op: !LinalgStructuredOpConfig diff --git a/mlir/test/mlir-linalg-ods-gen/test-linalg-ods-yaml-gen.yaml b/mlir/test/mlir-linalg-ods-gen/test-linalg-ods-yaml-gen.yaml --- a/mlir/test/mlir-linalg-ods-gen/test-linalg-ods-yaml-gen.yaml +++ b/mlir/test/mlir-linalg-ods-gen/test-linalg-ods-yaml-gen.yaml @@ -62,10 +62,8 @@ # ODS-LABEL: def Test1Op : LinalgStructuredBase_Op<"test1" -# ODS: let summary = [{ Title. }]; -# ODS-NEXT: let description = [{ -# ODS-NEXT: Detailed description. -# ODS-NEXT: }]; +# ODS: let summary = [{Title.}]; +# ODS-NEXT: let description = [{Detailed description.}]; # ODS: let arguments = # ODS-NEXT: Variadic:$inputs, diff --git a/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp b/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp --- a/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp +++ b/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp @@ -693,14 +693,13 @@ std::string doc; if (opConfig.metadata->doc) { static const char structuredOpDocFmt[] = R"FMT( - let summary = [{ {0} }]; - let description = [{ - {1} - }]; + let summary = [{{{0}}]; + let description = [{{{1}}]; )FMT"; StringRef summary, description; std::tie(summary, description) = - StringRef(*opConfig.metadata->doc).trim().split('\n'); + StringRef(*opConfig.metadata->doc).trim().split("\n\n"); + doc = llvm::formatv(structuredOpDocFmt, summary.trim(), description.trim()); }