Skip to content

Commit

Permalink
reviwer comments
Browse files Browse the repository at this point in the history
Signed-off-by: Nirvedh Meshram <nirvedh@gmail.com>
  • Loading branch information
nirvedhmeshram committed Jan 20, 2025
1 parent d07a2ec commit 2eee230
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ static LogicalResult commonRunOnOperation(

// Do nothing if any of inner tile sizes is dynamic.
if (llvm::any_of(packOp.getMixedTiles(), [](OpFoldResult tile) {
return isa<Value>(tile);
return llvm::IsaPred<Value>(tile);
})) {
return {};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ struct VectorizePadWithConditions final

/// Return true if the given `attrOrValue` is a constant zero.
auto isConstantZero = [](OpFoldResult attrOrValue) {
if (isa<Attribute>(attrOrValue)) {
auto attr = dyn_cast<IntegerAttr>(cast<Attribute>(attrOrValue));
return attr && attr.getValue().getZExtValue() == 0;
if (auto attr = dyn_cast<Attribute>(attrOrValue)) {
auto intAttr = dyn_cast<IntegerAttr>(attr);
return intAttr && intAttr.getValue().getZExtValue() == 0;
}
IntegerAttr attr;
return matchPattern(cast<Value>(attrOrValue), m_Constant(&attr)) &&
Expand Down
10 changes: 6 additions & 4 deletions compiler/src/iree/compiler/Codegen/LLVMCPU/KernelDispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1788,8 +1788,9 @@ static LogicalResult setRootConfig(mlir::FunctionOpInterface entryPointFn,
// backends prefer to not decompose the ops.
DictionaryAttr pipelineConfig;
auto target = IREE::HAL::ExecutableTargetAttr::lookup(entryPointFn);
bool hasDynamicInnerTile = llvm::any_of(
op.getMixedTiles(), [](OpFoldResult ofr) { return isa<Value>(ofr); });
bool hasDynamicInnerTile =
llvm::any_of(op.getMixedTiles(),
[](OpFoldResult ofr) { return llvm::IsaPred<Value>(ofr); });
if (!hasDynamicInnerTile && !isX86(target) && !isRISCV(target)) {
pipelineConfig = getPipelineConfWithDecompositionAttr(op.getContext());
}
Expand Down Expand Up @@ -1828,8 +1829,9 @@ static LogicalResult setRootConfig(mlir::FunctionOpInterface entryPointFn,
// backends prefer to not decompose the ops.
DictionaryAttr pipelineConfig;
auto target = IREE::HAL::ExecutableTargetAttr::lookup(entryPointFn);
bool hasDynamicInnerTile = llvm::any_of(
op.getMixedTiles(), [](OpFoldResult ofr) { return isa<Value>(ofr); });
bool hasDynamicInnerTile =
llvm::any_of(op.getMixedTiles(),
[](OpFoldResult ofr) { return llvm::IsaPred<Value>(ofr); });
if (!hasDynamicInnerTile && !isX86(target) && !isRISCV(target)) {
pipelineConfig = getPipelineConfWithDecompositionAttr(op.getContext());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1000,11 +1000,11 @@ struct ReifyExtractOfCreateMask final
for (auto [idx, size] :
llvm::zip_equal(extractOp.getMixedPosition(), maskOp.getOperands())) {
Value idxVal;
if (isa<Attribute>(idx)) {
if (auto attr = dyn_cast<Attribute>(idx)) {
idxVal = rewriter.create<arith::ConstantIndexOp>(
loc, cast<IntegerAttr>(cast<Attribute>(idx)).getInt());
loc, dyn_cast<IntegerAttr>(attr).getInt());
} else {
idxVal = cast<Value>(idx);
idxVal = dyn_cast<Value>(idx);
}
Value cmpIdx = rewriter.create<arith::CmpIOp>(
loc, arith::CmpIPredicate::slt, idxVal, size);
Expand Down

0 comments on commit 2eee230

Please sign in to comment.