Skip to content

Raise block_size default to 8192 - #229

Merged
neuromechanist merged 1 commit into
mainfrom
216-block-size-default
Aug 15, 2026
Merged

neuromechanist merged 1 commit into
mainfrom
216-block-size-default

Conversation

@neuromechanist

Copy link
Copy Markdown
Member

Partially addresses #216: the default itself. Measured on the bundled 32-channel sample, this machine (Apple Silicon), 20 iterations, seed 42.

block_size torch-CPU f64 torch-CPU f32 torch-MPS f32
512 (old default) 217.4 ms 196.1 1758.0
8192 (new) 36.1 39.0 299.5
16384 30.3 28.5 235.5
single block 32.1 27.3 187.7

~6x on CPU float64. 8192 rather than the fastest value because peak block memory scales with it: at 256 channels 8192 costs ~240 MB per model against ~960 MB for a single block, and the default has to stay safe on large recordings. 16384 is 16% quicker for double the memory, which is not a good trade for a default.

Changed in all three array backends (PyTorch, MLX, NumPy — the last was still on 128) per .rules/backend_parity.md.

Parity

block_size shifts the multi-iteration trajectory ~1e-6 — well inside parity tolerance, and per-iteration sufficient statistics stay block-size-independent to 1e-8 (test_blocking_invariance). It is not free, though: a bit-for-bit comparison against the binary must set the same value on both sides. The parity harness already does (sample_params.json and input.param both pin 512), and the docstring and AGENTS.md now say so.

Not included

The rest of #216 — correcting the published MPS claims in paper.md, AGENTS.md and docs/guides/backends.md — is deliberately left out. My MPS numbers disagree with the ones in the issue by ~14x (187 ms vs 13.5 at single block; MPS never beats CPU here), so the correct figures are not established, and rewriting performance claims in a paper under review on unreconciled measurements would be worse than leaving them. The CPU result above reproduces on both machines and stands on its own.

Note

test_end_to_end_correlation_vs_fortran_from_sample_params_json fails in full-suite runs on this branch. It fails identically on unmodified main and passes in isolation both with and without this change: the reference binary is not reproducible run-to-run. Tracked as #228, not caused here.

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