Skip to content

Redesign experimental Engine turn API - #2464

Open
bmehta001 wants to merge 33 commits into
mainfrom
bhamehta-engine-turn-api
Open

Redesign experimental Engine turn API#2464
bmehta001 wants to merge 33 commits into
mainfrom
bhamehta-engine-turn-api

Conversation

@bmehta001

@bmehta001 bmehta001 commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • redesign the experimental Engine API around Engine -> Request -> Turn, with Requests created and owned by an Engine
  • replace polling and unseen-token state with typed caller-buffered events from one canonical bulk OgaEngineRun
  • add request-local Turn IDs, named cancellation, per-Turn generation limits, usage and finish metadata, and automatic reclamation when the final Request handle is released
  • update the C ABI, C++ RAII wrapper, Python binding, examples, benchmarks, tests, and Engine architecture documentation

Addresses #2448.

API contract

OgaResult* OgaEngineRun(
    OgaEngine* engine,
    void* event_buffer,
    size_t event_capacity,
    size_t event_stride,
    size_t* out_event_count);
  • each positive-capacity call drains retained events or executes at most one model transaction, never both
  • capacity one preserves one-event-at-a-time pacing; larger buffers can receive one event per affected Request from the committed transaction
  • events identify a borrowed OgaRequest* and Request-local turn_id; flags are a bitmask, so the final token may also carry TurnFinished
  • OgaRequestOptions.max_session_tokens == 0 uses the Request's snapshotted OgaGeneratorParams.search.max_length
  • opaque reusable OgaTurnParams provide per-Turn overrides; max_generated_tokens is implemented and unsupported setters return explicit errors
  • stop sequences use token-ID sequences through OgaSequences; generation-time stop handling remains deferred
  • OgaRequestClose releases Engine state while OgaDestroyRequest releases the caller-owned handle
  • releasing the final public Request handle marks it abandoned; the Engine reclaims scheduler membership, retained events, and dynamic cache state at the next owner-thread boundary
  • Engine, Request, and Turn operations use one host owner thread; model execution may still batch Requests in parallel

Runtime behavior

  • dynamic batching supports resident continuation and prompt chunking
  • static batching preserves logical close immediately, but a closed resident row remains physically allocated until the shared batch is recycled
  • capacity, retryable, request-terminal, contract, and fatal failures are represented by typed events rather than diagnostic-string parsing
  • Engine-level events have no Request; examples and benchmarks classify them before request lookup and use bounded retry handling where appropriate
  • OgaCreateEngine retains the Model, so the caller may release its Model handle after successful Engine creation

Breaking changes

This intentionally replaces the previous experimental Engine API. The old create/add/continue/step/remove and unseen-token entry points, Request opaque-data accessors, and compatibility aliases are removed. Generator APIs are unchanged.

Validation

  • Linux/WSL Debug native, Python, and Engine benchmark builds
  • 77 focused Engine lifecycle/runtime tests
  • focused Engine C API tests
  • 29 Python Engine tests
  • Python examples and benchmark syntax checks
  • C++17 public-wrapper compile smoke
  • full material review of runtime, ABI, wrapper, example, benchmark, and documentation changes

Windows-native build validation was unavailable because this environment has no Visual Studio 2022 installation.

Follow-up

  • Consider adding Engine event-buffer generation tracking (for example, OgaEngineEventBufferGetGeneration) so C++ and managed wrappers can reject event/usage views retained across a later validated OgaEngineRun, instead of relying only on the documented borrowed-view lifetime.

@bmehta001
bmehta001 marked this pull request as ready for review August 25, 2026 21:32
@bmehta001
bmehta001 requested a review from a team as a code owner August 25, 2026 21:32
Copilot AI lite review requested due to automatic review settings August 25, 2026 21:32
@bmehta001 bmehta001 self-assigned this Aug 25, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR redesigns the experimental Engine low-level “turn” API across the native Engine implementation, C/C++ surface, Python binding, tests, examples, benchmarks, and documentation. It shifts the model to Engine-created, Engine-bound Requests with a BeginTurn / synchronous Run loop and an idempotent Close, while keeping generator APIs unchanged.

Changes:

  • Replace the prior experimental create/add/continue/step/remove workflow with EngineCreateRequest, RequestBeginTurn, synchronous EngineRun, and RequestClose, including “borrowed alias” semantics for Run().
  • Add per-turn generated-token budgeting (optional max_generated_tokens) and snapshot request-level generation parameters at request creation.
  • Migrate/expand coverage across C API tests, C++ engine unit/contract tests, Python unit/integration tests, examples, benchmarks, and engine architecture docs to match the new contract.

Reviewed changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/python/test_onnxruntime_genai_engine.py Updates Python engine unit tests to the new create/begin_turn/run/close API and adds new contract tests (per-turn budget, snapshotting, close idempotence, opaque data).
test/python/integration/test_integration_engine.py Updates Python integration coverage for the new Engine/Request contract and close semantics.
test/engine/scheduler_contract_tests.cpp Adjusts scheduler contract tests to use Engine-owned request creation helpers and parameter snapshot flows.
test/engine/request_lifecycle_tests.cpp Reworks lifecycle/state-machine tests to cover BeginTurn/Run/Close behavior, snapshotting, and transactional guarantees.
test/engine/paged_key_value_cache_tests.cpp Updates cache tests to new request minting/begin-turn helpers.
test/engine/engine_test_helpers.h Introduces helpers for Engine-owned request creation and prompting (CreateEngineRequest, CreateRequestWithPrompt).
test/engine/engine_test_doubles.h Renames/updates doubles and trace comments from Step to Run semantics.
test/engine/engine_run_tests.cpp Replaces Engine::Step contract tests with Engine::Run tests and expands failure-mode coverage.
test/c_api_tests.cpp Adds/updates C API tests for TurnOptions, borrowed Run handle semantics, opaque data, and Close idempotence.
src/python/python.cpp Updates Python bindings to expose Request.begin_turn, Request.close, Engine.create_request, Engine.run, and Python-owned opaque data.
src/ort_genai.h Updates C++ RAII wrapper to match new C API (Engine creates requests; Run returns borrowed pointer; Request gains BeginTurn/Close).
src/ort_genai_c.h Updates the C header surface: introduces OgaTurnOptions, replaces Step with Run, replaces add/remove/continue with create/begin_turn/close, and updates docstrings.
src/ort_genai_c.cpp Implements new C ABI entry points (OgaEngineRun, OgaEngineCreateRequest, OgaRequestBeginTurn, OgaRequestClose) and borrowed-handle return plumbing.
src/engine/request.h Replaces AddTokens/Continue/Remove with BeginTurn/Close; adds per-turn budgeting fields and opaque-data storage.
src/engine/request.cpp Moves “turn admission” logic into Engine, adds per-turn budget enforcement, and updates close/opaque-data implementation.
src/engine/request_status.h Updates request state semantics to “Engine-bound Unassigned” and Close behavior notes.
src/engine/paged_key_value_cache.cpp Documentation tweak for Step → Run terminology.
src/engine/model_executor.h Documentation tweak for Step → Run terminology.
src/engine/engine.h Replaces AddRequest/RemoveRequest/Step with CreateRequest/Run and internal BeginTurn/CloseRequest hooks; adds Engine destructor.
src/engine/engine.cpp Implements parameter snapshot cloning, Engine-owned request creation, transactional BeginTurn admission, CloseRequest, RunDynamic/RunStatic, and teardown close behavior.
src/engine/cache_manager.cpp Updates static cache allocation logic to use request SearchOptions accessors.
examples/python/engine/tool-calling.py Migrates example to create_request/begin_turn/run/close with improved runtime checks.
examples/python/engine/model-qa.py Migrates interactive example to new API and ensures a single request is reused across turns via begin_turn.
examples/python/engine/continuous-batching.py Refactors example to single-owner loop using create_request/begin_turn/run/close and removes prior threaded admission model.
docs/paged_attention_engine.md Updates the Engine architecture doc to the new experimental API shape, ownership model, and single-owner-thread contract.
docs/paged_attention_batching.md Updates batching doc references to the new Engine-owned request lifecycle contract.
benchmark/python/benchmark_engine_guidance.py Migrates benchmark driver to create_request/begin_turn/run/close and updates error messages/flow.
benchmark/engine/scenarios/long_prefill.cpp Migrates native benchmark scenario to Engine-created requests and Run/Close flow.
benchmark/engine/scenarios/decode_baseline.cpp Migrates native benchmark scenario to Engine-created requests and Run/Close flow; updates token collection logic.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/ort_genai_c.h Outdated
Comment thread src/ort_genai.h
Comment thread benchmark/engine/scenarios/decode_baseline.cpp Outdated
bmehta001 and others added 11 commits August 28, 2026 01:43
Bind Requests to their Engine and unify initial and continuation admission so hosts can drive one externally serialized owner loop without duplicate lifecycle operations.

Files changed:
- src/engine and native C/C++/Python bindings: add frozen request creation, BeginTurn, Run, borrowed readiness, and Close
- tests: cover lifecycle atomicity, ownership, readiness barriers, output retention, ABI sizing, and binding identity
- examples, benchmarks, and docs: migrate every first-party Engine caller and document the V1 contract

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Bound each Engine turn independently from the retained session length and restore application-owned request metadata without expanding the completion API.

Files changed:
- src/engine, src/ort_genai*: enforce transactional max_generated_tokens and restore opaque data
- src/python and examples: expose the per-turn budget
- test and docs: cover lifecycle, rollback, C/C++ contracts, and document behavior

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 17969924-dc33-467f-8c9c-2a9e47d2d186
Keep Python-owned opaque data alive on the canonical Request wrapper instead of storing a borrowed PyObject pointer, and clarify the final turn-admission contracts found during review.\n\nFiles changed:\n- src/python/python.cpp: restore lifetime-safe opaque metadata methods\n- test/python/test_onnxruntime_genai_engine.py: cover retention, replacement, clearing, turns, and close\n- src/engine/engine.cpp: clarify transactional turn-budget installation\n- src/ort_genai_c.h: state exact model-instance parameter ownership

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>\nCopilot-Session: 04c9cf07-a61b-4436-ab31-f3bd6385244b
Keep staggered request arrivals on the Engine owner thread so the example demonstrates continuous admission without queue, thread, or synchronization scaffolding.\n\nFiles changed:\n- examples/python/engine/continuous-batching.py: replace producer-thread commands with timed deque admission

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>\nCopilot-Session: 04c9cf07-a61b-4436-ab31-f3bd6385244b
Run the repository lint configuration across every file changed by the PR so Python import ordering and native formatting match enforced conventions.\n\nFiles changed:\n- benchmark/python/benchmark_engine_guidance.py\n- examples/python/engine/continuous-batching.py\n- examples/python/engine/tool-calling.py\n- src/engine/request.h\n- test/c_api_tests.cpp

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>\nCopilot-Session: 04c9cf07-a61b-4436-ab31-f3bd6385244b
Attach stable benchmark state to each Engine request so unseen-token draining avoids an O(concurrency) lookup in the measured hot loop. Value-initialize the C++ request output pointer to make its failure-path safety explicit to compilers and analyzers.\n\nFiles changed:\n- benchmark/engine/scenarios/decode_baseline.cpp\n- src/ort_genai.h

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>\nCopilot-Session: 04c9cf07-a61b-4436-ab31-f3bd6385244b
Replace request polling with typed caller-buffered events so turn lifecycle, cancellation, failure, and usage semantics have a stable ABI.

Update files: Engine core and invariants; public C/C++ and Python APIs; C++/Python tests; Engine examples, benchmark, and documentation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 035cd1a4-961b-4bc2-90a3-db5a4cd49cca
Drop the obsolete seen-sequence argument after the snapshot field was removed, keeping the test fixture aligned with the current request invariants.

Files changed: test/engine/engine_invariants_tests.cpp

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 035cd1a4-961b-4bc2-90a3-db5a4cd49cca
Make HasPendingRequests a cleanup boundary so released request handles cannot leave stale work or events visible. Document static-batch retention and Model ownership, and define stop inputs as token-ID sequences.

Add public and white-box lifecycle coverage for abandonment, peer isolation, static retention, and Engine-held Model lifetime.

Files changed: Engine lifecycle; C/C++ and Python API surfaces; Engine specification and architecture docs; C API, Engine, and Python tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 035cd1a4-961b-4bc2-90a3-db5a4cd49cca
Replace the single-event Run contract with one capacity-controlled bulk operation so capacity one preserves low-latency pacing while larger buffers receive a complete transaction without a second API or owned collection.

Keep execution bounded to one drain-or-model transaction, retain overflow in FIFO order, and validate every output record before Engine progress.

Files changed: Engine core; C/C++ and Python APIs; Engine specification and architecture docs; benchmarks and examples; C++, C API, and Python tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 035cd1a4-961b-4bc2-90a3-db5a4cd49cca
Forward newly required device methods and pass the request token limit explicitly so the rebased Engine tests compile against current main. Files changed: test/cpp/engine/engine_run_tests.cpp, test/cpp/engine/request_lifecycle_tests.cpp.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 035cd1a4-961b-4bc2-90a3-db5a4cd49cca
@bmehta001
bmehta001 force-pushed the bhamehta-engine-turn-api branch from 8d7565e to 9ce0ca6 Compare August 28, 2026 07:26
Comment thread test/python/integration/test_integration_engine.py Fixed
Comment thread test/python/integration/test_integration_engine.py Fixed
Comment thread test/python/integration/test_integration_engine.py Fixed
Comment thread test/python/integration/test_integration_engine.py Fixed
Comment thread test/python/integration/test_integration_engine.py Fixed
Comment thread test/python/test_onnxruntime_genai_engine.py Fixed
Comment thread test/python/test_onnxruntime_genai_engine.py Fixed
Comment thread test/python/test_onnxruntime_genai_engine.py Fixed
Comment thread test/python/test_onnxruntime_genai_engine.py Fixed
Comment thread test/python/test_onnxruntime_genai_engine.py Fixed
bmehta001 and others added 10 commits August 28, 2026 02:50
Remove overlapping lifecycle cases and make the Python tests verify the default turn limit and per-turn event identity directly. Files changed: test/cpp/engine/request_lifecycle_tests.cpp, test/python/test_onnxruntime_genai_engine.py.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 035cd1a4-961b-4bc2-90a3-db5a4cd49cca
Document the implemented ownership, validation, lifecycle, event, error, and wrapper contracts so the experimental specification accurately describes the shipped surface. Files changed: docs/engine_c_api_spec.md.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 035cd1a4-961b-4bc2-90a3-db5a4cd49cca
Avoid reading output-only state, validate Python token arrays safely, support C++17 benchmark consumers, handle request-less Engine events with bounded retries, and recreate unguided tool-call continuations. Align the specification, public comments, examples, benchmarks, and focused tests with those guarantees.

Files changed: src/ort_genai_c.cpp, src/ort_genai_c.h, src/ort_genai.h, src/python/python.cpp, docs/engine_c_api_spec.md, docs/paged_attention_engine.md, examples/python/engine/continuous-batching.py, examples/python/engine/model-qa.py, examples/python/engine/tool-calling.py, benchmark/python/benchmark_engine_guidance.py, benchmark/engine/scenarios/utils.h, benchmark/engine/scenarios/capacity_pressure.cpp, benchmark/engine/scenarios/continuation.cpp, benchmark/engine/scenarios/decode_baseline.cpp, benchmark/engine/scenarios/long_prefill.cpp, benchmark/engine/scenarios/mixed_workload.cpp, test/cpp/c_api_tests.cpp, test/python/test_onnxruntime_genai_engine.py.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 035cd1a4-961b-4bc2-90a3-db5a4cd49cca
Keep Requests alive through the existing sink maps without assigning local names that CodeQL correctly reports as unused. Files changed: test/python/integration/test_integration_engine.py, test/python/test_onnxruntime_genai_engine.py.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 035cd1a4-961b-4bc2-90a3-db5a4cd49cca
Keep the bulk-run count in independent storage so synthetic invalid strides cannot overlap an adjacent stack variable on macOS ARM64. Apply the repository-pinned Ruff and clang-format output to the changed Engine files.

Files changed: examples/python/engine/tool-calling.py; src/ort_genai_c.cpp; src/python/python.cpp; test/cpp/c_api_tests.cpp; test/cpp/engine/engine_run_tests.cpp; test/python/integration/test_integration_engine.py; test/python/test_onnxruntime_genai_engine.py

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 035cd1a4-961b-4bc2-90a3-db5a4cd49cca
Remove struct-size and reserved-field machinery from the experimental OgaRequestOptions contract so callers provide only the actual max-session-token option. Also replace premature version labels with concrete structure and ABI wording.

Files changed: docs/engine_c_api_spec.md; docs/paged_attention_engine.md; src/ort_genai.h; src/ort_genai_c.cpp; src/ort_genai_c.h; src/python/python.cpp; test/cpp/c_api_tests.cpp

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 035cd1a4-961b-4bc2-90a3-db5a4cd49cca
Keep C++ validation exceptions consistent with C API errors and document and test unsupported Turn setters across C, C++, and Python.

Files changed:
- src/ort_genai.h
- src/ort_genai_c.h
- src/python/python.cpp
- test/cpp/c_api_tests.cpp
- test/python/test_onnxruntime_genai_engine.py

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 035cd1a4-961b-4bc2-90a3-db5a4cd49cca
Remove unused event-record extensibility so callers use one concrete contiguous layout. Delete stale scheduling hooks and make Engine validation failures report actionable values.

Files changed: Engine C/C++ API and specifications; Request and scheduler runtime; C API and lifecycle tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 035cd1a4-961b-4bc2-90a3-db5a4cd49cca
Avoid locking planned TurnParams APIs to transient not-implemented behavior while preserving durable null-input validation.

Files changed:
- test/cpp/c_api_tests.cpp
- test/python/test_onnxruntime_genai_engine.py

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep durable bulk-run and reusable-storage coverage without invoking platform-sensitive behavior through misaligned, overflowing, or union-aliased pointers.

Files changed:
- test/cpp/c_api_tests.cpp

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 7ae588a2-a388-4037-9be8-43444cf2b960
Comment thread src/ort_genai_c.h Outdated
Comment thread src/ort_genai_c.h Outdated
Comment thread src/ort_genai_c.h Outdated
Comment thread src/engine/engine.cpp Outdated
Comment thread src/engine/engine.cpp
Comment thread src/engine/engine.cpp Outdated
Comment thread src/engine/engine.cpp
Replace public Engine event, usage, request-option, and turn-option layouts with opaque handles so applications do not acquire unstable size, alignment, or enum-width ABI contracts. Add reusable Engine-owned event buffers and migrate C++, Python, tests, benchmarks, examples, and API documentation to borrowed event views.

Files changed: src/ort_genai_c.h and src/ort_genai_c.cpp define the C ABI; src/ort_genai.h and src/python/python.cpp expose language wrappers; src/engine/request.* and engine.h align internal names; tests, benchmarks, examples, and docs migrate callers.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 777c9478-d9a8-4f87-9be7-34f6c019c289
Catch static scheduling exceptions before model execution so partially mutated scheduler state cannot leave the Engine appearing healthy. Preserve the execution-failure classification for decode and token-generation failures.

Files changed: src/engine/engine.cpp adds phase-specific failure handling; test/cpp/engine/engine_run_tests.cpp verifies terminal request state, zero decode calls, contract-failure reporting, and retained unhealthy state.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 777c9478-d9a8-4f87-9be7-34f6c019c289
Comment thread src/ort_genai_c.h Outdated
Comment thread examples/python/engine/continuous-batching.py
Comment thread src/engine/request.h Outdated
Comment thread src/engine/engine.cpp Outdated
Comment thread src/python/python.cpp Outdated
Comment thread src/engine/engine.cpp Outdated
Comment thread src/engine/engine.cpp
Comment thread src/engine/scheduled_requests.cpp Outdated
Keep Request and device-affine state owner-thread-managed through abandonment and Engine teardown, and make fatal event delivery complete for every affected Turn.

Preserve the experimental C ABI with opaque option/event handles, fixed-width values, separate stop-token and stop-string surfaces, and a const borrowed Request view. Release the Python GIL during Engine execution and keep batched result placement linear.

Files changed: src/engine ownership, scheduling, cache, event, and sampling code; C/C++ and Python API surfaces; Engine examples and benchmarks; focused native/Python tests; Engine API documentation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 5f4b2966-d031-4b6c-a103-0fd023779887
Comment thread src/engine/request.cpp
Comment thread src/engine/request.cpp Outdated
bmehta001 and others added 9 commits August 30, 2026 09:12
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a2cf510e-be8f-4fb0-9c2b-5bdd5dd803ef

# Conflicts:
#	docs/paged_attention_engine.md
#	src/engine/engine.cpp
#	test/cpp/engine/engine_step_tests.cpp
Publish abandonment without retaining the Engine, and defer static-batch state release until executable peers no longer depend on shared runtime state.

Files changed:
- src/engine/engine.{h,cpp} and request.{h,cpp}: coordinate safe request abandonment and static-batch teardown.
- test/cpp/engine: cover lifecycle races and reconcile merged helper APIs.
- examples/python/engine/continuous-batching.py: apply repository formatting.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a2cf510e-be8f-4fb0-9c2b-5bdd5dd803ef
Preserve nonfatal planning allocation failures and logical event ordering while retaining composite fixed-state execution order. Port main's composite transaction coverage to the Run API, simplify benchmark request ownership, and fix const-correct event lookup for MSVC.

Files changed:
- src/engine/engine.{h,cpp}: restore planning classification and event ordering.
- test/cpp/engine/engine_run_tests.cpp: port composite transaction tests from main.
- test/cpp/c_api_tests.cpp: use const request handles from events.
- benchmark/engine/scenarios/capacity_pressure.cpp: remove duplicate raw request handles.
- docs/paged_attention_engine.md: align transaction and event semantics.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a2cf510e-be8f-4fb0-9c2b-5bdd5dd803ef
Integrate the latest state-group schema and benchmark pipeline changes while retaining the Engine Request/Turn/event API across continuation workloads and hybrid tests.

Files changed:
- Engine cache teardown and composite lifetime coverage.
- Hybrid Python Engine test migration and state-group assertions.
- Main's state manifest, fixed-state, model-builder, benchmark pipeline, fixtures, and tests.
- Benchmark runner lint corrections.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 19be2c90-18d6-44a6-9f29-eaf08f39f226
Execute fitting plans before reporting omitted requests, make fatal delivery allocation-safe, and honor immediate static Request close while deferring shared-row cleanup.

Validate paged-cache graph geometry before allocation, establish active decodes in mixed-workload benchmarks, publish failed benchmark artifacts, and align Engine documentation with event-buffer APIs.

Files changed:
- src/engine, src/models, and src/ort_genai_c.h: scheduling, teardown, close, failure, and geometry contracts.
- test/cpp, test/python, and test/models: native, C API, Python, geometry, and generated-fixture coverage.
- benchmark/engine and pipeline configuration: correct mixed-workload setup and failure artifacts.
- docs: current Request, Turn, event-buffer, and cache semantics.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 19be2c90-18d6-44a6-9f29-eaf08f39f226
Restore the shared dummy decoder, benchmark behavior, teardown semantics, and strict paged-shape validation so the repair commit does not change unrelated contracts. Keep small paged-cache capacity tests representative by giving them a dedicated generated fixture instead of weakening the existing static fixture.

Files changed:
- benchmark/engine: restore the prior mixed-workload implementation and documentation.
- src/engine/cache_manager.*: remove unrelated post-teardown residency behavior.
- src/models/model_state_manifest.cpp: restore axis-zero paged geometry checks.
- test/cpp and test/python: remove fixture-dependent regressions and use a dedicated small paged model.
- test/models/engine and test/python/create: restore dummy-decoder and generate synthetic-paged-small reproducibly.
- .gitignore: track the dedicated paged fixture.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a2b55d16-29a0-41af-b8f3-801740ef6d4a
Remove all post-merge fixes, tests, fixtures, validation, benchmark behavior, and documentation changes so #2464 contains only the merge result and its conflict resolutions.

Files changed:
- src/engine, src/models, and src/ort_genai_c.h: remove post-merge runtime and validation fixes.
- test/cpp, test/python, and test/models: remove post-merge tests and fixtures.
- benchmark pipeline and Engine documentation: restore the merge result.
- .gitignore: remove fixture-specific tracking exceptions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a2b55d16-29a0-41af-b8f3-801740ef6d4a
Integrate origin/main's dynamic Engine speculative-draft verification while preserving the branch's Request, Turn, Run, and event-buffer API. Port only the overlapping incoming tests needed to use the current API.

Files changed:
- src/engine: merge speculative proposal verification, accepted-prefix cache commits, scheduling, and rollback into the current Engine API.
- test/cpp/engine and test/cpp/search_checkpoint_tests.cpp: retain incoming draft coverage using current Run and Request lifecycle helpers.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a2b55d16-29a0-41af-b8f3-801740ef6d4a
Keep token allocation and append-length validation accessible to both engine turns and speculative draft staging, fixing the missing identifiers without duplicating behavior.

Files changed:
- src/engine/engine.cpp
- src/engine/request.cpp
- src/engine/request.h

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e7445bf7-8668-4e73-ae96-a2a64ba1e1f4
@bmehta001
bmehta001 enabled auto-merge (squash) August 31, 2026 08:04
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.

4 participants