| 1 | //===- InferStridedMetadataInterface.cpp - Strided md inference interface -===// |
|---|---|
| 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/Interfaces/InferStridedMetadataInterface.h" |
| 10 | #include "mlir/IR/BuiltinTypes.h" |
| 11 | #include "mlir/IR/TypeUtilities.h" |
| 12 | #include <optional> |
| 13 | |
| 14 | using namespace mlir; |
| 15 | |
| 16 | #include "mlir/Interfaces/InferStridedMetadataInterface.cpp.inc" |
| 17 | |
| 18 | void StridedMetadataRange::print(raw_ostream &os) const { |
| 19 | if (isUninitialized()) { |
| 20 | os << "strided_metadata<None>"; |
| 21 | return; |
| 22 | } |
| 23 | os << "strided_metadata<offset = ["; |
| 24 | llvm::interleaveComma(c: *offsets, os, each_fn: [&](const ConstantIntRanges &range) { |
| 25 | os << "{"<< range << "}"; |
| 26 | }); |
| 27 | os << "], sizes = ["; |
| 28 | llvm::interleaveComma(c: sizes, os, each_fn: [&](const ConstantIntRanges &range) { |
| 29 | os << "{"<< range << "}"; |
| 30 | }); |
| 31 | os << "], strides = ["; |
| 32 | llvm::interleaveComma(c: strides, os, each_fn: [&](const ConstantIntRanges &range) { |
| 33 | os << "{"<< range << "}"; |
| 34 | }); |
| 35 | os << "]>"; |
| 36 | } |
| 37 |