This commit is contained in:
@@ -847,30 +847,33 @@ LogicalResult verifyComputeBatchLikeOp(ComputeBatchOpTy batch, StringRef opName)
|
||||
return batch.emitOpError("compute_batch coreIds values must be unique");
|
||||
}
|
||||
|
||||
Block& block = batch.getBody().front();
|
||||
if (block.getNumArguments() == 0)
|
||||
return batch.emitOpError("compute_batch body must have exactly one lane block argument");
|
||||
unsigned expectedArgCount = 1 + batch.getWeights().size() + batch.getInputs().size() + batch.getNumResults();
|
||||
if (block.getNumArguments() != expectedArgCount)
|
||||
return batch.emitOpError("compute_batch body block arguments must match lane, weight, input, and output operands/results");
|
||||
auto laneArg = batch.getLaneArgument();
|
||||
if (!laneArg || !laneArg->getType().isIndex())
|
||||
return batch.emitOpError("compute_batch first block argument must have index type");
|
||||
if (batch.getBody().empty())
|
||||
return batch.emitOpError("compute_batch body must have at least one block");
|
||||
|
||||
for (auto [weightIndex, weight] : llvm::enumerate(batch.getWeights())) {
|
||||
auto blockArg = batch.getWeightArgument(weightIndex);
|
||||
if (!blockArg || blockArg->getType() != weight.getType())
|
||||
return batch.emitOpError("compute_batch weight block argument types must match weight operand types exactly");
|
||||
}
|
||||
for (auto [inputIndex, input] : llvm::enumerate(batch.getInputs())) {
|
||||
auto blockArg = batch.getInputArgument(inputIndex);
|
||||
if (!blockArg || blockArg->getType() != input.getType())
|
||||
return batch.emitOpError("compute_batch input block argument types must match input operand types exactly");
|
||||
}
|
||||
for (auto [resultIndex, resultType] : llvm::enumerate(batch.getResultTypes())) {
|
||||
auto blockArg = batch.getOutputArgument(resultIndex);
|
||||
if (!blockArg || blockArg->getType() != resultType)
|
||||
return batch.emitOpError("compute_batch output block argument types must match result types exactly");
|
||||
unsigned expectedArgCount = 1 + batch.getWeights().size() + batch.getInputs().size() + batch.getNumResults();
|
||||
bool verifyLaneSliceOffsets = !isa<SpatScheduledComputeBatch>(batch.getOperation());
|
||||
for (Block& block : batch.getBody()) {
|
||||
if (block.getNumArguments() == 0)
|
||||
return batch.emitOpError("compute_batch body must have exactly one lane block argument");
|
||||
if (block.getNumArguments() != expectedArgCount)
|
||||
return batch.emitOpError(
|
||||
"compute_batch body block arguments must match lane, weight, input, and output operands/results");
|
||||
if (!block.getArgument(0).getType().isIndex())
|
||||
return batch.emitOpError("compute_batch first block argument must have index type");
|
||||
|
||||
for (auto [weightIndex, weight] : llvm::enumerate(batch.getWeights()))
|
||||
if (block.getArgument(1 + weightIndex).getType() != weight.getType())
|
||||
return batch.emitOpError("compute_batch weight block argument types must match weight operand types exactly");
|
||||
for (auto [inputIndex, input] : llvm::enumerate(batch.getInputs()))
|
||||
if (block.getArgument(1 + batch.getWeights().size() + inputIndex).getType() != input.getType())
|
||||
return batch.emitOpError("compute_batch input block argument types must match input operand types exactly");
|
||||
for (auto [resultIndex, resultType] : llvm::enumerate(batch.getResultTypes()))
|
||||
if (block.getArgument(1 + batch.getWeights().size() + batch.getInputs().size() + resultIndex).getType()
|
||||
!= resultType)
|
||||
return batch.emitOpError("compute_batch output block argument types must match result types exactly");
|
||||
|
||||
if (failed(verifyBatchBody(batch, block, verifyLaneSliceOffsets)))
|
||||
return failure();
|
||||
}
|
||||
|
||||
if (failed(verifyComputeResultsUses(batch.getOperation())))
|
||||
@@ -879,7 +882,7 @@ LogicalResult verifyComputeBatchLikeOp(ComputeBatchOpTy batch, StringRef opName)
|
||||
return failure();
|
||||
if (failed(verifyOnlyConstantExternalValues(batch.getOperation(), batch.getBody(), opName)))
|
||||
return failure();
|
||||
return verifyBatchBody(batch, block, !isa<SpatScheduledComputeBatch>(batch.getOperation()));
|
||||
return success();
|
||||
}
|
||||
|
||||
LogicalResult SpatGraphComputeBatch::verify() { return verifyComputeBatchLikeOp(*this, "spat.graph_compute_batch"); }
|
||||
|
||||
Reference in New Issue
Block a user