Skip to content

Commit

Permalink
[Encoding][NFC] Refactor dropEncoding method to "EncodingTypes.h". (#…
Browse files Browse the repository at this point in the history
…19988)

Also fix a comment style for a method in the EncodingType.h.

Signed-off-by: hanhanW <[email protected]>
  • Loading branch information
hanhanW authored Feb 14, 2025
1 parent b3ef1d5 commit 756e9e6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ MaterializeEncodingTypeConverter::MaterializeEncodingTypeConverter(
// itself.
MaterializeEncodingInfo encodingInfo = getEncodingInfo(type);
if (IREE::Codegen::isIdentityLayout(encodingInfo)) {
return dropEncoding(type);
return IREE::Encoding::dropEncoding(type);
}
auto packedType = cast<RankedTensorType>(tensor::PackOp::inferPackedType(
type, encodingInfo.innerTileSizes, encodingInfo.innerDimsPos,
Expand Down
3 changes: 0 additions & 3 deletions compiler/src/iree/compiler/Codegen/Common/EncodingUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ class OpMaterializeEncodingPattern : public OpConversionPattern<OpTy> {
// Utility methods about Encoding.
//===---------------------------------------------------------------------===//

/// Returns the RankedTensorType without encodings.
RankedTensorType dropEncoding(RankedTensorType type);

/// Returns the deserialized MaterializeEncodingInfo if the `layouts` field is
/// present in encodings and it only has a single layout. Otherwise, returns
/// std::nullopt.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ void SpecializedEncodingAttr::print(AsmPrinter &p) const {
os << ">";
}

static RankedTensorType dropEncoding(RankedTensorType type) {
RankedTensorType dropEncoding(RankedTensorType type) {
return RankedTensorType::get(type.getShape(), type.getElementType());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,13 @@ MatmulNarrowDim getMatmulNarrowDim(linalg::LinalgOp linalgOp,
/// value.
MatmulNarrowDim getMatmulNarrowDim(EncodingAttr encoding);

// Returns true if `encoding` represents a narrow-N matmul RESULT, e.g. the
// result of a matvec.
/// Returns true if `encoding` represents a narrow-N matmul RESULT, e.g. the
/// result of a matvec.
bool isNarrowNResult(EncodingAttr encoding);

/// Returns the same RankedTensoType without the encoding.
RankedTensorType dropEncoding(RankedTensorType type);

} // namespace mlir::iree_compiler::IREE::Encoding

#endif // IREE_COMPILER_DIALECT_ENCODING_IR_ENCODINGTYPES_H_

0 comments on commit 756e9e6

Please sign in to comment.