Skip to content

Reject sub-MIL-floor cross-compile targets instead of raising - #2

Merged
sbryngelson merged 2 commits into
sbryngelson:mainfrom
comp-physics:fix/cross-compile-sub-mil-floor
Jun 14, 2026
Merged

sbryngelson merged 2 commits into
sbryngelson:mainfrom
comp-physics:fix/cross-compile-sub-mil-floor

Conversation

@sbryngelson

Copy link
Copy Markdown
Owner

Problem

cross_compile_check(graph, "h11") raised ValueError instead of returning False:

aneforge/_targets.py:278: ValueError: family 1 below the floor for limit 'max_tensor_dim'

preflight() calls limit("max_tensor_dim", family) (and other per-family caps) at the top, but limit() is only defined at or above the H13+ MIL floor (Family.A13=2). For a sub-floor target family — Family.OLDER=1, i.e. h11/h12/m9/t0 — limit() correctly raises, and preflight never reaches its rep.ok rejection path. So cross_compile_check (and compile(target=), which gates on the same preflight) crashed on any below-floor target.

This is the deterministic failure behind tests/test_cross_compile.py::test_relu_rejected_below_the_mil_floor in the on-device corpus.

Fix

Guard preflight() with the existing supports_mil(family) check. Below the floor, report every op as rejected (so rep.ok is False) without querying the floor-only limits, reusing the function's own graph-walk:

if not supports_mil(family):
    # Below the H13+ MIL floor: the e5rt/MIL path won't run at all -> all ops rejected.
    ... walk graph, append each op to rep.reject ...
    return rep

Fixed at the root layer (preflight), so both cross_compile_check and compile(target=) now reject sub-floor targets cleanly.

Note: host capability is unaffected

This only changes the verdict for sub-floor target families being cross-compiled for; it does not gate the host. Verified:

h11 target (family 1): preflight.ok = False   # correctly rejected
M5 host  (family 5):   preflight.ok = True    # fully capable, unchanged

Verification

  • The previously-failing test_relu_rejected_below_the_mil_floor now passes.
  • pytest tests/test_cross_compile.py tests/test_cross_compile_matrix.py tests/test_compile_targets.py tests/test_targets.py: 141 passed.
  • Blast radius is tiny: the new branch only triggers for family < 2, which never occurs for real hardware or normal compiles.

Branched off main, independent of the display/ASCII cleanup in #1.

preflight() queried per-family limits (limit(), defined only at/above the H13+
MIL floor) before checking supports_mil(), so cross_compile_check(graph, 'h11')
- a sub-floor target family (Family.OLDER) - raised ValueError instead of
returning False. Guard preflight() with supports_mil(): below the floor, report
every op rejected (not ok) and skip the floor-only limit lookups. Fixes both
cross_compile_check and compile(target=). Host capability is unaffected (an M5
is family 5; only sub-floor TARGETS reject).
@sbryngelson
sbryngelson merged commit 020dcad into sbryngelson:main Jun 14, 2026
9 checks passed
@sbryngelson
sbryngelson deleted the fix/cross-compile-sub-mil-floor branch June 14, 2026 01:38
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