[mlir][Linalg] Fix formatting of generated docs markdown
This patch prevents `mlir-linalg-ods-yaml-gen` from adding extra whitespace around the summary and description fields. This broke the _italics_ of the summary as _ this _ is not recognised by markdown. It also meant the first line of the description was in a code block as it was indented two spaces. The separator between summary and description has also been updated to two newlines. This was already followed and prevents line wrapping the summary putting part of it in the description. These issues can be currently seen at: https://mlir.llvm.org/docs/Dialects/Linalg/ Reviewed By: awarzynski Differential Revision: https://reviews.llvm.org/D157853
This commit is contained in:
parent
67c092c8c8
commit
0d3abdc263
@ -1140,11 +1140,14 @@ structured_op: !LinalgStructuredOpConfig
|
||||
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
|
||||
|
@ -62,10 +62,8 @@ structured_op: !LinalgStructuredOpConfig
|
||||
|
||||
# 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<AnyType>:$inputs,
|
||||
|
@ -693,14 +693,13 @@ static LogicalResult generateNamedGenericOpOds(LinalgOpConfig &opConfig,
|
||||
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());
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user