mirror of
https://github.com/zama-ai/concrete.git
synced 2026-04-17 03:00:54 -04:00
fix(compiler): Batching: Bail out if batchable operand is not produced by an op
An early test for a batchable operation checks whether the batchable operand is produced by a `tensor.extract` operation and bails out if this is not the case. However, the use of `llvm::dyn_cast<T>()` directly on the defining operation of the batchable operand causes an attempt to cast a null value for an operand which is not produced by an operation (e.g., block arguments). Using `llvm::dyn_cast_or_null<T>()` fixes this issue.
This commit is contained in:
@@ -578,7 +578,7 @@ public:
|
||||
// Find a batchable op which is embedded into a loop nest
|
||||
func.walk([&](BatchableOpInterface scalarOp) {
|
||||
// Is producer an extract op?
|
||||
auto extractOp = llvm::dyn_cast<mlir::tensor::ExtractOp>(
|
||||
auto extractOp = llvm::dyn_cast_or_null<mlir::tensor::ExtractOp>(
|
||||
scalarOp.getBatchableOperand().get().getDefiningOp());
|
||||
|
||||
if (!extractOp)
|
||||
|
||||
Reference in New Issue
Block a user