Skip to content

tests: make the MIR reservation probe immune to arm64's heap regions - #1428

Merged
wshlavacek merged 1 commit into
mainfrom
tests/mir-reservation-heap-regions
Oct 31, 2026
Merged

wshlavacek merged 1 commit into
mainfrom
tests/mir-reservation-heap-regions

Conversation

@wshlavacek

Copy link
Copy Markdown
Collaborator

test_a_live_mir_model_holds_far_less_than_upstreams_reservation failed on the macos-15 MIR leg of #1372 at 45.65 MB a model against a bound of 40, on a branch that does not touch MIR. A rerun of that job on the same commit passed.

Why

The probe divides the growth of the whole address space over 20 live MIR models by 20. That growth includes their heap, about 1.1 MB a live model. macOS on arm64 maps a heap in regions of up to 128 MB: on the macos-14 and macos-15 runners, 300 MB of mallocs moved the address space by 128-512 MB (#1402). Two regions taken in the window read as (45.65 − 32.1) × 20 = 271 MB. #1402 made the sibling abandon probe immune to the same thing; this one was left.

The fix

The probe keeps 100 live models instead of 20, which spreads a region over five times as many, and the bound is 64 MB a model, halfway between the default 32 and upstream's 128 by ratio. 512 MB of regions is 5.1 MB a model. Upstream's 128 still fails by a factor of two. The probe takes about a second.

Measured (macOS 26 arm64, a local MIR build)

build probe MB a model
default 32 MB 20 models, 15 runs 32.00 every run
default 32 MB 100 models, 15 runs 32.05-32.09
BNGSIM_MIR_CODE_RESERVE_MB=128 100 models 128.05: fails <= 64

macOS 26 does not grow the address space for heap here (100 MB of extra 100 KB allocations in the window still read 32.0), so these numbers are the reservation alone; the runners' regions are what the wider spread is for. changelog exempt: a test change only.

test_a_live_mir_model_holds_far_less_than_upstreams_reservation failed on
the macos-15 MIR leg of #1372 at 45.65 MB a model against 40, on a branch
that does not touch MIR. It divides the growth of the whole address space
over 20 live models by 20, and that growth includes their heap, about
1.1 MB a live model. macOS on arm64 maps a heap in regions of up to 128 MB,
128-512 MB for 300 MB of mallocs on the macos-14 and -15 runners (#1402),
and two taken in the window read as (45.65 - 32.1) * 20 = 271 MB. #1402 made
the sibling abandon probe immune to the same thing; this one was left.

The probe now keeps 100 live models, which spreads a region over five times
as many, and the bound is 64 MB a model, halfway between the default 32 and
upstream's 128 by ratio: 512 MB of regions is 5.1 MB a model, and upstream's
128 still fails it by a factor of two. The probe takes about a second.

Measured on macOS 26 arm64 (which does not grow the address space for heap,
so this is the reservation alone): 32.00 MB a model at 20 and 32.05-32.09
at 100 over 15 runs each.
@wshlavacek wshlavacek added the changelog exempt Exempt from the changelog-fragment gate: no user-visible change, or the release commit label Oct 31, 2026
@wshlavacek
wshlavacek merged commit 7d38d6f into main Oct 31, 2026
19 checks passed
@wshlavacek
wshlavacek deleted the tests/mir-reservation-heap-regions branch October 31, 2026 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog exempt Exempt from the changelog-fragment gate: no user-visible change, or the release commit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant