Skip to content

Commit

Permalink
[Utils] Fix bug in sub-byte check for byte alignment (iree-org#14942)
Browse files Browse the repository at this point in the history
The current check refuses to allow things like: `tensor<2xi4>`, even
though it is byte aligned.
  • Loading branch information
Groverkss authored Oct 4, 2023
1 parent e50538c commit bb51f6f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/src/iree/compiler/Utils/ElementPackingUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Value calculateStorageElementCountInBytes(Location loc,
unsigned byteElements = 8 / elementBits;
// Perform some basic sanity check to make sure the total count is byte
// aligned for fully static shapes.
if (dynamicDims.empty() && staticCount * byteElements % 8 != 0) {
if (dynamicDims.empty() && (staticCount * elementBits) % 8 != 0) {
return nullptr;
}
auto divisor = builder.create<arith::ConstantIndexOp>(loc, byteElements);
Expand Down

0 comments on commit bb51f6f

Please sign in to comment.