[BACKEND] llvm::dyn_cast -> llvm::dyn_cast_or_null (#689)
This commit is contained in:
@@ -71,7 +71,7 @@ public:
|
||||
mlir::Value falseValue = selectOp.getFalseValue();
|
||||
|
||||
auto *loadOpCandidate = trueValue.getDefiningOp();
|
||||
auto loadOp = llvm::dyn_cast<triton::LoadOp>(loadOpCandidate);
|
||||
auto loadOp = llvm::dyn_cast_or_null<triton::LoadOp>(loadOpCandidate);
|
||||
if (!loadOp)
|
||||
return mlir::failure();
|
||||
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
|
||||
auto *broadcastOpCandidate = mask.getDefiningOp();
|
||||
auto broadcastOp =
|
||||
llvm::dyn_cast<triton::BroadcastOp>(broadcastOpCandidate);
|
||||
llvm::dyn_cast_or_null<triton::BroadcastOp>(broadcastOpCandidate);
|
||||
if (!broadcastOp)
|
||||
return mlir::failure();
|
||||
|
||||
@@ -106,7 +106,8 @@ struct CanonicalizeMaskedLoadPattern
|
||||
if (!mask)
|
||||
return mlir::failure();
|
||||
|
||||
auto constantMask = llvm::dyn_cast<arith::ConstantOp>(mask.getDefiningOp());
|
||||
auto constantMask =
|
||||
llvm::dyn_cast_or_null<arith::ConstantOp>(mask.getDefiningOp());
|
||||
if (!constantMask)
|
||||
return mlir::failure();
|
||||
|
||||
@@ -152,7 +153,8 @@ struct CanonicalizeMaskedStorePattern
|
||||
if (!mask)
|
||||
return mlir::failure();
|
||||
|
||||
auto constantMask = llvm::dyn_cast<arith::ConstantOp>(mask.getDefiningOp());
|
||||
auto constantMask =
|
||||
llvm::dyn_cast_or_null<arith::ConstantOp>(mask.getDefiningOp());
|
||||
if (!constantMask)
|
||||
return mlir::failure();
|
||||
|
||||
|
@@ -301,9 +301,17 @@ void LoopPipeliner::emitPrologue() {
|
||||
}
|
||||
|
||||
// If this is a load/async_copy, we need to update the mask
|
||||
if (llvm::isa<triton::LoadOp, triton::gpu::InsertSliceAsyncOp>(newOp)) {
|
||||
Value mask = llvm::isa<triton::LoadOp>(newOp) ? newOp->getOperand(1)
|
||||
: newOp->getOperand(3);
|
||||
if (Value mask = [&]() {
|
||||
if (auto loadOp = llvm::dyn_cast<triton::LoadOp>(newOp)) {
|
||||
return loadOp.mask();
|
||||
} else if (auto insertSliceAsyncOp =
|
||||
llvm::dyn_cast<triton::gpu::InsertSliceAsyncOp>(
|
||||
newOp)) {
|
||||
return insertSliceAsyncOp.mask();
|
||||
} else {
|
||||
return mlir::Value();
|
||||
}
|
||||
}()) {
|
||||
// assert(I1 or TensorOf<[I1]>);
|
||||
OpBuilder::InsertionGuard g(builder);
|
||||
// TODO: move this out of the loop
|
||||
|
Reference in New Issue
Block a user