STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
test_accel_is_actually_used Namespace Reference

Functions

 cfg ()
 test_runner_evaluate_routes_through_the_accelerator (cfg, monkeypatch)
 test_layer1_inner_loop_routes_through_the_accelerator (cfg)
 test_stability_tail_routes_through_the_chug_kernel (cfg, monkeypatch)

Variables

 ROOT = Path(__file__).resolve().parents[1]
float PA = 101325.0

Detailed Description

Guard against a SILENT BYPASS: production quietly stopping using the accelerator.

Everything else in CI proves the accelerator *works* -- that numba imports, that
the kernels compile, that their numbers match Python. None of it proves the
production call sites still *call* them. Delete the `accel.evaluate(...)` line
from Layer-1's `_eval_candidate` and every other check stays green while the
optimizer silently runs ~120x slower on the Python path. That was verified by
doing exactly that: pre-flight, the strict impinging tests, the A/B parity suite
and the outcome tests all passed with the call disabled.

These tests close that hole by asserting the accelerator is actually reached
through the real code paths, not called directly by a test.

Function Documentation

◆ cfg()

test_accel_is_actually_used.cfg ( )

Definition at line 26 of file test_accel_is_actually_used.py.

◆ test_layer1_inner_loop_routes_through_the_accelerator()

test_accel_is_actually_used.test_layer1_inner_loop_routes_through_the_accelerator ( cfg)
The Layer-1 seam: EVERY candidate must go through accel.evaluate.

Asserts a RATIO, not merely a non-zero count. A count-only check would pass
if one candidate went through the accelerator and the next thousand did not.
Measured ratio is exactly 1.000 -- every candidate -- so the 0.9 floor has
real margin while still failing hard (ratio 0.0) on a bypass.

Runs a genuine one-iteration smoke optimization rather than calling the
accelerator directly, because the thing under test is the WIRING.

Definition at line 63 of file test_accel_is_actually_used.py.

◆ test_runner_evaluate_routes_through_the_accelerator()

test_accel_is_actually_used.test_runner_evaluate_routes_through_the_accelerator ( cfg,
monkeypatch )
chamber_solver / closure must reach the accelerator, not just be able to.

runner.evaluate -> chamber_solver._accel_chamber_pc -> accel.chamber_solve,
and the Brent residual -> closure.flows -> accel.solve.

Definition at line 34 of file test_accel_is_actually_used.py.

◆ test_stability_tail_routes_through_the_chug_kernel()

test_accel_is_actually_used.test_stability_tail_routes_through_the_chug_kernel ( cfg,
monkeypatch )
The chug seam: stability analysis must reach accel.chug_margin_fast.

Separate from the others because it is reached through
comprehensive_stability_analysis rather than the chamber solve, so a bypass
there is invisible to every check above. Chug is ~53x accelerated and is the
dominant per-evaluation stability cost, so silently dropping to Python here
is a large regression with no wrong answer to give it away.

Definition at line 117 of file test_accel_is_actually_used.py.

Variable Documentation

◆ PA

float test_accel_is_actually_used.PA = 101325.0

Definition at line 22 of file test_accel_is_actually_used.py.

◆ ROOT

test_accel_is_actually_used.ROOT = Path(__file__).resolve().parents[1]

Definition at line 21 of file test_accel_is_actually_used.py.