better compile times for throughput scheduling
Validate Operations / validate-operations (push) Has been cancelled

fix failing no-plan throughput ablation runs
update results
This commit is contained in:
NiccoloN
2026-10-28 16:34:48 +01:00
parent 3c7679594b
commit 5f2db946f0
28 changed files with 909 additions and 197 deletions
+54
View File
@@ -243,6 +243,17 @@ static void testSharedEngine(PimInstructionTiming target) {
actual = analyzePimExecution(abstract, target);
TEST_CHECK(actual.getInteger("global_read_requests") == 2);
TEST_CHECK(actual.getInteger("global_memory_service_ns") == 160);
// The construction limit applies to interpreted patterns, not just traffic.
// These zero-trip request bodies do not allocate a large event graph.
abstract[0] = {{E::Work, 4}, {E::Repeat, 1500000, 0, 0, 0,
{{E::Repeat, 0, 0, 0, 0, {{E::Load, 1}}}}}};
auto largerPattern = evaluatePimExecution(abstract, target);
TEST_CHECK(largerPattern.cost.available());
TEST_CHECK(largerPattern.report.getInteger("global_read_requests") == 0);
abstract[0] = {{E::Repeat, 2000001, 0, 0, 0, {{E::Load, 1}}}};
auto aboveBudget = evaluatePimExecution(abstract, target);
TEST_CHECK(!aboveBudget.cost.available());
TEST_CHECK(aboveBudget.cost.reason == "abstract repetition budget exceeded");
abstract[0] = {{E::Repeat, 1000000000000ull, 0, 0, 0, {{E::Load, 1}}}};
actual = analyzePimExecution(abstract, target);
TEST_CHECK(actual.getString("status") == "unavailable");
@@ -433,6 +444,48 @@ static void testDependencyTokens() {
TEST_CHECK(drained.empty() && drained.remaining().empty());
}
static void testSpatialExtractionBudget(PimInstructionTiming target) {
MLIRContext context;
context.loadDialect<arith::ArithDialect, func::FuncDialect, scf::SCFDialect,
tensor::TensorDialect, spatial::SpatialDialect>();
auto module = ModuleOp::create(UnknownLoc::get(&context));
OpBuilder builder(module.getBodyRegion());
auto loc = module.getLoc();
auto function = func::FuncOp::create(builder, loc, "test", builder.getFunctionType({}, {}));
builder.setInsertionPointToStart(function.addEntryBlock());
auto batch = spatial::SpatScheduledComputeBatch::create(builder, loc, TypeRange{},
builder.getI32IntegerAttr(2), ValueRange{}, ValueRange{});
batch->setAttr("coreIds", builder.getDenseI32ArrayAttr({0, 1}));
batch.getBody().push_back(new Block);
batch.getBody().front().addArgument(builder.getIndexType(), loc);
builder.setInsertionPointToStart(&batch.getBody().front());
Value zero = arith::ConstantIndexOp::create(builder, loc, 0);
Value upper = arith::ConstantIndexOp::create(builder, loc, 100000);
Value one = arith::ConstantIndexOp::create(builder, loc, 1);
auto type = RankedTensorType::get({16}, builder.getF32Type());
Value local = tensor::EmptyOp::create(builder, loc, type.getShape(), type.getElementType());
spatial::SpatReluOp::create(builder, loc, type, local);
auto loop = scf::ForOp::create(builder, loc, zero, upper, one);
builder.setInsertionPointToStart(loop.getBody());
for (int64_t i = 0; i < 5; ++i) arith::ConstantIndexOp::create(builder, loc, i);
// A zero-count wait is runtime-free, but requires indexed interpretation.
spatial::SpatWaitOp::create(builder, loc, zero, zero);
builder.setInsertionPointAfter(loop);
spatial::SpatYieldOp::create(builder, loc, ValueRange{});
builder.setInsertionPointAfter(batch);
func::ReturnOp::create(builder, loc);
TEST_CHECK(succeeded(verify(module)));
auto supported = evaluatePimSpatialSchedule(module, target);
TEST_CHECK(supported.report.getInteger("visited_operations") > 1000000);
TEST_CHECK(supported.cost.available());
builder.setInsertionPointToStart(loop.getBody());
for (int64_t i = 0; i < 5; ++i) arith::ConstantIndexOp::create(builder, loc, i);
auto unsupported = evaluatePimSpatialSchedule(module, target);
TEST_CHECK(!unsupported.cost.available());
TEST_CHECK(unsupported.cost.reason == "abstract extraction budget exceeded on physical core 0");
module.erase();
}
static void testReadOnlySpatial(PimInstructionTiming target, bool batched) {
MLIRContext context;
context.loadDialect<arith::ArithDialect, func::FuncDialect, scf::SCFDialect,
@@ -918,6 +971,7 @@ int main() {
testCapturedVectorWeights(hardware(period));
testPublicationAndOutput(hardware(period));
testUnrepresentableSpatial(hardware(period));
testSpatialExtractionBudget(hardware(period));
testReadOnlySpatial(hardware(period), false);
testReadOnlySpatial(hardware(period), true);
}