Skip to content

Commit

Permalink
[mlir][vector][nfc] Fix typos in "VectorEmulateNarrowType.cpp" (llvm#…
Browse files Browse the repository at this point in the history
…125415)

Updates `emulatedVectorLoad` that was introduced in llvm#115922.
Specifically, ATM `emulatedVectorLoad` mixes "emulated type" and
"container type". This only became clear after llvm#123526 in which the
concepts of "emulated" and "container" types were introduced.

This is an NFC change and simply updates the variable naming.
  • Loading branch information
banach-space authored and Icohedron committed Feb 11, 2025
1 parent 4636200 commit 192ad02
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions mlir/lib/Dialect/Vector/Transforms/VectorEmulateNarrowType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,23 +278,25 @@ static Value dynamicallyInsertSubVector(RewriterBase &rewriter, Location loc,
return dest;
}

/// Returns the op sequence for an emulated sub-byte data type vector load.
/// specifically, use `emulatedElemType` for loading a vector of `origElemType`.
/// The load location is given by `base` and `linearizedIndices`, and the
/// load size is given by `numEmulatedElementsToLoad`.
/// Emulate a vector load for `emulatedElemTy` using `containerElemTy`
///
/// Specifically, use `containerElemTy` for loading a vector of
/// `emulatedElemTy`. The load location is given by `base` and
/// `linearizedIndices`, and the load size is given by
/// `numEmulatedElementsToLoad`.
static VectorValue emulatedVectorLoad(OpBuilder &rewriter, Location loc,
Value base,
OpFoldResult linearizedIndices,
int64_t numEmultedElementsToLoad,
Type origElemType,
Type emulatedElemType) {
auto scale = emulatedElemType.getIntOrFloatBitWidth() /
origElemType.getIntOrFloatBitWidth();
int64_t numContainerElemsToLoad,
Type emulatedElemTy,
Type containerElemTy) {
auto scale = containerElemTy.getIntOrFloatBitWidth() /
emulatedElemTy.getIntOrFloatBitWidth();
auto newLoad = rewriter.create<vector::LoadOp>(
loc, VectorType::get(numEmultedElementsToLoad, emulatedElemType), base,
loc, VectorType::get(numContainerElemsToLoad, containerElemTy), base,
getValueOrCreateConstantIndexOp(rewriter, loc, linearizedIndices));
return rewriter.create<vector::BitCastOp>(
loc, VectorType::get(numEmultedElementsToLoad * scale, origElemType),
loc, VectorType::get(numContainerElemsToLoad * scale, emulatedElemTy),
newLoad);
}

Expand Down

0 comments on commit 192ad02

Please sign in to comment.