diff --git a/compiler/src/iree/compiler/Dialect/Stream/Transforms/EncodeTensors.cpp b/compiler/src/iree/compiler/Dialect/Stream/Transforms/EncodeTensors.cpp index f690a7eeff255..f79cb8068f459 100644 --- a/compiler/src/iree/compiler/Dialect/Stream/Transforms/EncodeTensors.cpp +++ b/compiler/src/iree/compiler/Dialect/Stream/Transforms/EncodeTensors.cpp @@ -168,7 +168,8 @@ static Value canonicalizeFillPattern(Value pattern, OpBuilder &builder) { // %i8_val = (%i8_val << 2) | %i2_val // %i8_val = (%i8_val << 2) | %i2_val // %i8_val = (%i8_val << 2) | %i2_val - if (needToPackSubByteElementBitWidth(elementBitWidth)) { + bool patternIsPacked = IREE::Encoding::hasPackedStorageAttr(pattern.getType()); + if (!patternIsPacked && needToPackSubByteElementBitWidth(elementBitWidth)) { Type i8Type = builder.getI8Type(); Value bitwidth = builder.createOrFold( loc, i8Type, builder.getIntegerAttr(i8Type, elementBitWidth));