Skip to content

Commit aa45ad7

Browse files
committed
Update block size enum value to reflect the spec
Change-Id: I8bc0955f994b0602e719b4c060c389bf3950f133
1 parent 878b7e9 commit aa45ad7

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

mlir/include/mlir/Dialect/Tosa/IR/TosaOpBase.td

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -464,17 +464,14 @@ def Tosa_RoundingModeAttr
464464
: Tosa_I32EnumAttr<"RoundingMode", "Supported rounding modes", "rounding_mode",
465465
[Tosa_ROUNDING_SINGLE_ROUND, Tosa_ROUNDING_INEXACT_ROUND, Tosa_ROUNDING_DOUBLE_ROUND]>;
466466

467-
def Tosa_BLOCK_SIZE_32 : I32EnumAttrCase<"BLOCK_SIZE_32", 1>;
467+
def Tosa_BLOCK_SIZE_32 : I32EnumAttrCase<"BLOCK_SIZE_32", 32>;
468468

469469
def Tosa_BlockSizeAttr
470470
: Tosa_I32EnumAttr<"BlockSize", "Block size for the block_scaled formats", "block_size",
471471
[Tosa_BLOCK_SIZE_32]> {
472472
let extraClassDeclaration = [{
473-
static unsigned int getBlockSizeValue(BlockSize blockSize) {
474-
switch (blockSize) {
475-
case BlockSize::BLOCK_SIZE_32:
476-
return 32;
477-
}
473+
static uint32_t getBlockSizeValue(BlockSize blockSize) {
474+
return static_cast<uint32_t>(blockSize);
478475
}
479476
}];
480477
}

mlir/lib/Dialect/Tosa/IR/TosaOps.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1992,8 +1992,7 @@ LogicalResult MatmulTBlockScaledOp::verify() {
19921992
<< D << " vs N=" << N;
19931993

19941994
// Verify C is a multiple of block size
1995-
const unsigned int blockSize =
1996-
BlockSizeAttr::getBlockSizeValue(getBlockSize());
1995+
const uint32_t blockSize = BlockSizeAttr::getBlockSizeValue(getBlockSize());
19971996
if (ShapedType::isStatic(C) && C % blockSize != 0)
19981997
return emitOpError("expect C to be a multiple of block size, got C=")
19991998
<< C << ", block_size=" << blockSize;

0 commit comments

Comments
 (0)