Repository navigation
Keep the Forge adapter working against the current engine; pass it lanes, new-file paths and the score aggregate - #158
Open
jiaqiang-dot-liu wants to merge 7 commits into
Conversation
Hyperloom's source-tree restructure (05e67da61) moved the modules the adapter imported. Against a current engine the probe reported no rewrite source languages, so every FlyDSL rewrite was refused, and initialization failed on import after the baseline had already been measured. - The probe reads the rewrite's source languages from the capability handshake `forge-rewrite-by-flydsl --capabilities-json` prints, instead of importing an engine module. - Initialization builds the implementer from `kernelforge.workflows.forge_loop.api`, the interface the engine publishes for callers outside its loop, and takes the usage ledger from `kernelforge.agent_backends.usage`. The branch for the earlier keyword implementer API is removed, with the option splitting it needed. - The probe imports the same library names, so an engine without them is refused before campaign work starts. Hyperloom revisions before 05e67da61 are such engines. The engine-gated tests register their scripted provider through the engine's provider registry instead of replacing an engine function, and no longer call `IterationLoop._measure_baseline` or `create_campaign_config`. The scratch repository's branch, clean tree and tracked files are checked without an engine.
…te tree A schema-v3 task lets a candidate add files to its declared solution tree. The adapter told the engine so only for the initialization implementer; the forge-loop command carried no --commit-new-path, and the engine commits a created file only where it was told one may appear. An optimization session that split the kernel into a new module therefore had its whole change rolled back: in four 6-hour runs this cost 8 sessions. build_command now passes one --commit-new-path per directory of each declared tree scope, the allowlist initialization already used, to every forge-loop command. The pattern builder moves beside the other candidate-bundle rules, and the engine probe requires the option.
The adapter passed no --lanes, so every run followed the engine default of three concurrent implementer lanes per round and a run had no way to ask for one. `lanes` joins the settings a run may override. Empty, the default, still leaves the count to the engine; a positive integer is passed to forge-loop as --lanes. The engine owns the upper bound and what a given count means. A rewrite's nested loop is not given the setting.
Arena's speedup is the geometric mean of per-case speedups. The engine judged its own KEEPs by the arithmetic mean, which counts a large gain on one case in full, so it kept candidates Arena scores lower and reported a search score above the grade it then received. The probe now reports whether the installed engine's forge-loop accepts --case-aggregate, and build_command passes `geometric` where it does. An engine without the option still runs and searches by its own aggregate.
…ectory The case added with the aggregate declaration built its second command under a subdirectory that did not exist and failed before asserting anything. Each engine capability is now its own parametrized case.
Initialization built the engine's gate settings with `interposed_driver_path`, set to the driver itself. Hyperloom removed that field together with its generated driver wrapper (AMD-AGI/Hyperloom#2878), so against a current engine the `initialize` workflow failed with a `TypeError` after the baseline had already been measured. An optimization campaign does not build these settings and was not affected. The argument is dropped. Passing the driver as its own interposer asked for no wrapper, which is what an engine that still has the field does when the field is left unset, so engines back to the one the probe admits keep working. The README no longer describes a planning stage the lane count might skip, or planning probes: the current engine has neither, and what a lane count means was already left to the engine.
jiaqiang-dot-liu
requested review from
irvineoy,
sharareh-y and
sinarafati-amd
as code owners
November 25, 2026 10:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Six commits on
agents/forgeand its tests, plus a merge ofmain, net +260 / −208 lines over nine files. Nothing outside the Forge adapter changes.Problems solved
The adapter imported engine modules that have moved. Hyperloom's source-tree restructure (
05e67da61) moved the modules the adapter imported. Against a current engine the probe reported no rewrite source languages, so every FlyDSL rewrite was refused, and initialization failed on import after the baseline had already been measured. The probe now reads the rewrite's source languages from the handshakeforge-rewrite-by-flydsl --capabilities-jsonprints, and initialization builds the implementer fromkernelforge.workflows.forge_loop.api, the interface the engine publishes for callers outside its loop. The probe imports the same names, so an engine without them (any Hyperloom revision before05e67da61) is refused before campaign work starts.Initialization named a gate field the engine removed. It passed
interposed_driver_path, set to the driver itself. AMD-AGI/Hyperloom#2878 removed that field with the generated driver wrapper, so theinitializeworkflow failed with aTypeError. The argument is dropped; an engine that still has the field behaves the same with it unset.An optimization session that created a file lost its whole change. A schema-v3 task lets a candidate add files to its declared solution tree, but only the initialization implementer was told so;
forge-loopgot no--commit-new-path, and the engine commits a created file only where it was told one may appear. In four 6-hour runs this rolled back 8 sessions. Everyforge-loopcommand now carries one--commit-new-pathper directory of each declared tree scope, and the probe requires the option.A run could not choose the engine's lane count. No
--laneswas passed, so every run followed the engine default.lanesjoins the settings a run may override: empty still leaves the count to the engine, a positive integer is passed as--lanes. A rewrite's nested loop is not given it.The engine searched by a different mean than Arena grades by. Arena's speedup is the geometric mean of per-case speedups; the engine judged its own KEEPs by the arithmetic mean, so it kept candidates Arena scores lower and reported a search score above its grade. Where the installed engine's
forge-loopaccepts--case-aggregate, the adapter passesgeometric. An engine without the option still runs.The README is updated for all of the above, and no longer describes a planning stage or planning probes: the current engine has neither.
Verification
Forge tests (
tests/test_forge_*.py), withAKA_FORGE_PROBE_PYTHONpointing at an interpreter that imports the engine:mainatda65963f9(contains #2878)b57a20751(the commit #2878 was based on)On this repository's
main(a8666be4) against the same current engine, 8 of those tests fail: the sixtest_installed_upstream_initializationcases and the twotest_scratch_branch_passes_real_upstream_campaign_preflightcases.Whole suite (
pytest tests), same environment: 2554 passed, 38 failed, 5 errors on this branch; 2535 passed, 46 failed, 5 errors onmain. The 43 failures and errors the two share are the same tests, none in Forge (test_magpie_workload_catalog.py,test_serving_evaluation.py,test_sikl_task_builder.py,test_benchmark_method_consistency.py, five collection errors); I have not investigated them.src/tools/sync_perf_helpers.pypasses.Real campaigns at this PR's head against Hyperloom
mainatda65963f9(contains #2878), one MI300X each, short budgets chosen to exercise each workflow rather than to optimize. Every result was accepted by the final evaluation.initializerewriteoptimize,lanes: 1optimize,lanes: 3optimize,lanes: 3Earlier, the first five commits drove eight 6-hour
optimizecampaigns (fused MoE, MLA decode, gated GEMM and mHC Triton tasks, each atlanes: 1andlanes: 3) against the #2878 branch before it merged; every result was accepted. The lane setting,--commit-new-pathand--case-aggregate geometricwere in use in all of these campaigns.Limits of that evidence
required_archextended locally to admit it; the tasks declare gfx950, and that edit is not part of this PR.rewritecampaign the optimization loop that follows the port delivered nothing: its three lanes finished as its budget ran out and the engine cut the round off before merging them, so the accepted result is the port's. That is the engine's round budgeting, not the adapter; a rewrite's nested loop is not givenlanesor a session budget by the adapter.