|
12 | 12 | #include "mlir/Dialect/XeGPU/IR/XeGPU.h" |
13 | 13 | #include "mlir/IR/Builders.h" |
14 | 14 | #include "mlir/IR/TypeUtilities.h" |
| 15 | +#include "mlir/Interfaces/ViewLikeInterface.h" |
15 | 16 |
|
16 | 17 | #include "llvm/Support/Debug.h" |
17 | 18 |
|
@@ -328,29 +329,22 @@ ParseResult parseOptionalDynamicIndexList( |
328 | 329 | return success(); |
329 | 330 | } |
330 | 331 |
|
| 332 | + |
331 | 333 | void printOptionalDynamicIndexList(OpAsmPrinter &printer, Operation *op, |
332 | 334 | OperandRange values, |
333 | 335 | ArrayRef<int64_t> integers, |
334 | | - TypeRange valueTypes = TypeRange()) { |
| 336 | + TypeRange valueTypes = TypeRange(), |
| 337 | + AsmParser::Delimiter delimiter = AsmParser::Delimiter::Square){ |
335 | 338 |
|
336 | 339 | if (values.empty() && llvm::all_of(integers, [](int64_t i) { |
337 | | - // place-holder value MAX indicating user doesn't provide offsets |
| 340 | + // MAX indiates no user-provided offsets for CreateNdDescOp. |
338 | 341 | return i == std::numeric_limits<int64_t>::max(); |
339 | | - })) |
340 | | - return; |
341 | | - printer << '['; |
342 | | - unsigned dynamicValIdx = 0; |
343 | | - llvm::interleaveComma(integers, printer, [&](int64_t integer) { |
344 | | - if (ShapedType::isDynamic(integer)) { |
345 | | - printer << values[dynamicValIdx]; |
346 | | - if (!valueTypes.empty()) |
347 | | - printer << " : " << valueTypes[dynamicValIdx]; |
348 | | - ++dynamicValIdx; |
349 | | - } else { |
350 | | - printer << integer; |
351 | | - } |
352 | | - }); |
353 | | - printer << ']'; |
| 342 | + })) |
| 343 | + return; |
| 344 | + |
| 345 | + return printDynamicIndexList(printer, op, values, integers, |
| 346 | + /*scalableFlags=*/{}, valueTypes, delimiter); |
| 347 | + |
354 | 348 | } |
355 | 349 |
|
356 | 350 | //===----------------------------------------------------------------------===// |
|
0 commit comments