Skip to content

Add multi build support#2480

Draft
xiaoyu-work wants to merge 2 commits into
mainfrom
xiaoyu/builds-schema
Draft

Add multi build support#2480
xiaoyu-work wants to merge 2 commits into
mainfrom
xiaoyu/builds-schema

Conversation

@xiaoyu-work
Copy link
Copy Markdown
Collaborator

@xiaoyu-work xiaoyu-work commented May 29, 2026

This pull request introduces a new, flexible "builds" workflow to the Olive engine, enabling multiple independent build pipelines within a single run configuration. It adds support for per-build defaults, validation, and selective execution on model components, primarily targeting composite models. The changes also include robust schema validation and improved modularity for configuring builds.

Key changes include:

Builds Workflow and Configuration:

  • Added a new builds field to RunConfig, allowing users to define multiple named build pipelines, each with its own pipeline, component selection, and system/evaluator overrides. A special _default key enables partial defaults to be merged into sibling builds. (olive/engine/config.py, olive/workflows/run/config.py, olive/workflows/run/run.py) [1] [2] [3]

  • Introduced BuildConfigPartial and BuildConfig schemas for partial and full build configurations, and a merge_build_default function for merging defaults into builds. (olive/engine/config.py)

Validation and Reference Resolution:

  • Added pre- and post-validation to RunConfig to ensure build defaults are correctly merged and that all build references (passes, systems, evaluators) resolve to known entries. (olive/workflows/run/config.py) [1] [2]

Component Selection for Composite Models:

  • Implemented select_components methods in both ModelConfig and CompositeModelHandler to allow builds to operate on specific named components of a composite model, returning either a single component or a sub-composite as needed. (olive/model/config/model_config.py, olive/model/handler/composite.py) [1] [2]

Workflow Execution Logic:

  • Refactored the main run logic to dispatch to a new _run_builds function when builds are present, running each build as an independent workflow with its own engine, pipeline, and input model slice. Includes helper functions for validation, engine config construction, and reference resolution. (olive/workflows/run/run.py) [1] [2]

These improvements make the Olive engine significantly more flexible and modular, supporting advanced workflows for multi-component and multi-pipeline builds

xiaoyu-work and others added 2 commits May 28, 2026 15:27
Introduce a top-level �uilds section on RunConfig that lets users declare
multiple independent execution units (pipelines x devices x components) in one
workflow config.

* Add BuildConfigPartial / BuildConfig and a merge_build_default helper in
  olive/engine/config.py. _default lives inside �uilds as a sentinel key
  whose partial fields are merged into every sibling build with full-replace
  semantics (lists are not deep-merged).
* Add �uilds: dict[str, BuildConfig] to RunConfig with an
  �xpand_build_defaults before-validator that pops _default and merges it
  into siblings, plus a �alidate_builds_references after-validator that
  checks pipeline/host/target/evaluator string refs resolve to known entries.
* Schema-only change: the engine runner does not yet act on �uilds. Existing
  workflows without �uilds keep their current behavior.
* Add 8 unit tests in test/workflows/test_run_config_builds.py covering the
  merge, override, full-replace, missing-field, invalid-ref, absent-builds and
  empty-default cases.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Execute the �uilds schema added in Phase 1.

* Add CompositeModelHandler.select_components(names) that returns the
  unwrapped child handler when one name is given and a sliced
  CompositeModelHandler otherwise. Unknown names raise a clear error.
* Add ModelConfig.select_components(names) so the runner can slice a
  composite input config without materializing the full handler.
* Add a builds-aware execution branch in olive/workflows/run/run.py. When
  �uilds is non-empty, the runner: validates components against the
  composite input model, then loops over builds. For each build it builds a
  per-build engine config (host/target/evaluator/search_strategy overrides
  resolved against systems/evaluators), a per-build pipeline subset from
  passes in the order declared by pipeline, the per-build accelerator
  spec, and calls engine.run with build.output_dir. Returns
  dict[build_name -> WorkflowOutput]. The no-builds path is unchanged and
  still returns a single WorkflowOutput.
* Tests:
  - 7 new composite handler / ModelConfig select_components cases in
    test/model/test_composite_model.py.
  - 7 new runner smoke tests in test/workflows/test_run_builds.py with
    mocked Engine.run covering: no-builds backward compat, multi-build
    dispatch, pipeline-subset ordering, per-build output_dir, host/target
    override, non-composite + components error, unknown component error.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@xiaoyu-work xiaoyu-work changed the title Xiaoyu/builds schema Add multi build support May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant