Skip to content

Commit c016a65

Browse files
authored
[mlir][vector] Switch to llvm::interleaved in debug prints. NFC. (#136248)
Clean up printing code by switching to `llvm::interleaved` from #135517.
1 parent 4be84a1 commit c016a65

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

mlir/lib/Dialect/Vector/Transforms/VectorUnroll.cpp

+4-8
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@
1313
#include "mlir/Dialect/Affine/IR/AffineOps.h"
1414
#include "mlir/Dialect/Utils/IndexingUtils.h"
1515
#include "mlir/Dialect/Vector/Transforms/VectorTransforms.h"
16-
#include "mlir/IR/ImplicitLocOpBuilder.h"
1716
#include "mlir/Interfaces/VectorInterfaces.h"
1817
#include "llvm/ADT/MapVector.h"
1918
#include "llvm/ADT/STLExtras.h"
2019
#include "llvm/Support/Debug.h"
21-
#include <numeric>
20+
#include "llvm/Support/InterleavedRange.h"
2221
#include <optional>
2322

2423
#define DEBUG_TYPE "vector-unroll"
@@ -28,7 +27,7 @@
2827
using namespace mlir;
2928
using namespace mlir::vector;
3029

31-
/// Compute the indices of the slice `index` for a tranfer op.
30+
/// Compute the indices of the slice `index` for a transfer op.
3231
static SmallVector<Value> sliceTransferIndices(ArrayRef<int64_t> elementOffsets,
3332
ArrayRef<Value> indices,
3433
AffineMap permutationMap,
@@ -88,17 +87,14 @@ getTargetShape(const vector::UnrollVectorOptions &options, Operation *op) {
8887
LDBG("--could not get shape of op " << *op << " -> BAIL");
8988
return std::nullopt;
9089
}
91-
LLVM_DEBUG(
92-
llvm::interleaveComma(*maybeUnrollShape, DBGS() << "--vector op shape: ");
93-
llvm::dbgs() << "\n";);
90+
LDBG("--vector op shape: " << llvm::interleaved(*maybeUnrollShape));
9491

9592
std::optional<SmallVector<int64_t>> targetShape = options.nativeShape(op);
9693
if (!targetShape) {
9794
LDBG("--no unrolling target shape defined " << *op << "-> SKIP");
9895
return std::nullopt;
9996
}
100-
LLVM_DEBUG(llvm::interleaveComma(*targetShape, DBGS() << "--target shape: ");
101-
llvm::dbgs() << "\n";);
97+
LDBG("--target shape: " << llvm::interleaved(*targetShape));
10298

10399
auto maybeShapeRatio = computeShapeRatio(*maybeUnrollShape, *targetShape);
104100
if (!maybeShapeRatio) {

mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include "mlir/Support/LLVM.h"
2828

2929
#include "llvm/ADT/DenseSet.h"
30-
#include "llvm/ADT/SetVector.h"
30+
#include "llvm/Support/InterleavedRange.h"
3131

3232
#define DEBUG_TYPE "vector-utils"
3333

@@ -372,9 +372,7 @@ Value vector::createReadOrMaskedRead(OpBuilder &builder, Location loc,
372372
LogicalResult
373373
vector::isValidMaskedInputVector(ArrayRef<int64_t> shape,
374374
ArrayRef<int64_t> inputVectorSizes) {
375-
LDBG("Iteration space static sizes:");
376-
LLVM_DEBUG(llvm::interleaveComma(shape, llvm::dbgs()));
377-
LLVM_DEBUG(llvm::dbgs() << "\n");
375+
LDBG("Iteration space static sizes:" << llvm::interleaved(shape));
378376

379377
if (inputVectorSizes.size() != shape.size()) {
380378
LDBG("Input vector sizes don't match the number of loops");

0 commit comments

Comments
 (0)