[AZ-621] Phase C: build_pre_constructed seeds c7_inference

Third subtask of AZ-618. Extends airborne_bootstrap.build_pre_constructed
additively with c7_inference (GPU InferenceRuntime). Wraps the existing
inference_factory.build_inference_runtime so a BUILD_TENSORRT_RUNTIME /
BUILD_PYTORCH_FP16_RUNTIME mismatch surfaces a clear operator-facing
AirborneBootstrapError naming BOTH airborne C7 flags plus the consuming
component slug, rather than bubbling up RuntimeNotAvailableError with no
context.

New public const C7_AIRBORNE_BUILD_FLAGS pairs each airborne runtime
with its gating env flag (onnx_trt_ep deliberately omitted — research
only). Tests stub at the factory boundary; real GPU/TensorRT load
remains Tier-2 only (consolidated at AZ-624). AZ-619 and AZ-620 test
files extended with a _stub_c7_inference_builder autouse fixture
mirroring the AZ-620 pattern for _build_c6_*.

18/18 runtime_root unit tests pass.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-05-19 06:47:05 +03:00
parent 1ab93fe0c7
commit 680ba29ae6
8 changed files with 398 additions and 11 deletions
@@ -0,0 +1,51 @@
# AZ-621 — Phase C: build_pre_constructed seeds c7_inference engine
**Task**: AZ-621_pre_constructed_phase_c_c7_inference
**Name**: AZ-618 Phase C: build_pre_constructed seeds c7_inference engine
**Description**: Third subtask of AZ-618. Extends `airborne_bootstrap.build_pre_constructed(config)` to populate the C7 inference runtime (PyTorch FP16 vs. TensorRT, gated by `BUILD_*` env flags).
**Complexity**: 3 points
**Dependencies**: AZ-619, AZ-620, AZ-320 (engine compiler), AZ-297 (InferenceRuntime Protocol). All in `done/` once AZ-619+AZ-620 land.
**Component**: runtime_root (cross-cutting)
**Tracker**: AZ-621
**Epic**: AZ-602 (parent: AZ-618 umbrella)
## Outcome
- `build_pre_constructed(config)` adds key `c7_inference` (InferenceRuntime instance) on top of AZ-619 + AZ-620.
- A misconfigured `BUILD_TENSORRT_RUNTIME=OFF` AND `BUILD_PYTORCH_FP16_RUNTIME=OFF` against a config that selects a strategy needing c7 raises `AirborneBootstrapError`.
- New unit tests under `tests/unit/runtime_root/test_az621_pre_constructed_phase_c.py` with the engine-load path stubbed (real GPU load is Tier-2-only, deferred to AZ-624's Jetson AC-5 run).
## Scope
### Included
- Internal builder `_build_c7_inference(config)`. Selects PyTorch FP16 vs. TensorRT per `config.inference.backend` (or equivalent field) and the matching `BUILD_*` env flag.
- BUILD-flag mismatch raises `AirborneBootstrapError` naming flag + component.
- Unit tests with stubbed engine load.
### Excluded
- C3 LightGlue / feature extractor (AZ-622), C5 / RANSAC (AZ-623), main() wiring (AZ-624).
- GPU model-load NFR thresholds — verified by AZ-624's full AC-4.
## Acceptance Criteria
**AC-621.1**: `build_pre_constructed(config)` adds `c7_inference` (InferenceRuntime instance) for a default config with the matching `BUILD_*` flag ON.
**AC-621.2**: with both `BUILD_TENSORRT_RUNTIME=OFF` and `BUILD_PYTORCH_FP16_RUNTIME=OFF` and a config selecting a C2 / C3 strategy that needs c7, `build_pre_constructed` raises `AirborneBootstrapError` naming both flag(s) and the consuming component slug.
**AC-621.3**: `pytest tests/unit/runtime_root/test_az621_pre_constructed_phase_c.py` covers AC-621.1 (stubbed engine) and AC-621.2.
## Tier-2 Note
Real TensorRT engine load is verified by the umbrella subtask AZ-624's Jetson AC-5 run per `_docs/02_document/tests/tier2-jetson-testing.md`. This subtask's unit tests stub via `BUILD_*` flag selection or factory monkeypatch.
## Constraints
- MUST NOT introduce new `BUILD_*` env flags.
- MUST be additive on top of AZ-619 + AZ-620.
## Evidence
- Umbrella spec: `_docs/02_tasks/todo/AZ-618_airborne_bootstrap_pre_constructed.md`
- AZ-297 / AZ-320 task specs in `_docs/02_tasks/done/` for C7 runtime classes