Commit d35634e
committed
track1(batch4): thread micro-batch axis end-to-end through path_c gridded step
Thread batch=N (bs1 default, bs4 selectable) through the path_c shape-config ->
delegation prim -> physical ABI bank sizing -> probe, keeping bs1 byte-identical.
- PathCModelShapeEnv: add batch:int=1 field + __post_init__ RAISE on batch<1
(no silent clamp); _path_c_model_shape_env_from_config reads config.micro_batch_size
(RAISE if present-but-non-positive); replace() preserves batch.
- ModelFactoryProfile: add micro_batch_size:int=1 (+_require_positive); hybrid_config()
carries it onto the frozen HybridTinyConfig via object.__setattr__ as the single
source of truth, reads it back + RAISES if it failed to stick (no bsN->bs1 revert).
- delegation prim call site: pass batch=int(resolved_shape_env.batch) (kills the
silent batch=1 default trap) + add a RULE #1 batch-consistency guard that RAISEs
with buffer-name + expected-vs-got batch if a compiled grid kernel's leading dim
disagrees with the region-declared batch.
- _mamba3_chunked_fwd_region_buffer_shape: batch=int(shape_env.batch) (resizes ALL
chunked region/handoff banks); serial-emit feasibility threads shape_env.batch.
- _buffer_shape: apply batch multiplier EXPLICITLY, per-buffer, ONLY to per-token
activation/state/checkpoint banks (hidden, mamba/m2rnn state+checkpoint+conv_state,
target_ids/mask, q_fp8/kv_fp8/scales/indices/lse, *_hidden/_delta/_out); weights
stay 1x (verified: act/state scale 4x, weight banks unchanged).
- path_c_relax_step_banks: add real_bank_numels_for_batch() + assert_batch_scaling()
bs4 self-check (param/paramg banks must stay 1x; act/actg/state must grow -> RAISE).
- probes: add --bs4 (requires --prod; RAISE otherwise) flipping the prod cfg batch
1->4; fwd probe adds an F0/F2 grid-total == 4x bs1 sanity assert. Builders/grids
already consume batch; no kernel edit.
RULE #1: every batch path RAISES on mismatch; no bs4->bs1 fallback anywhere.
Local check: ast.parse + py_compile (py3.13) PASS on all 6; isolated batch-logic +
per-buffer scaling discipline validated (gb10 compile/run is the Profile agent).1 parent 2b884ce commit d35634e
6 files changed
Lines changed: 309 additions & 25 deletions
File tree
- cppmega_mlx
- recipes
- runtime
- scratch
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
135 | 142 | | |
136 | 143 | | |
137 | 144 | | |
| |||
161 | 168 | | |
162 | 169 | | |
163 | 170 | | |
| 171 | + | |
164 | 172 | | |
165 | 173 | | |
166 | 174 | | |
| |||
217 | 225 | | |
218 | 226 | | |
219 | 227 | | |
220 | | - | |
221 | | - | |
222 | | - | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
223 | 265 | | |
224 | 266 | | |
225 | 267 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
433 | 433 | | |
434 | 434 | | |
435 | 435 | | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
436 | 449 | | |
437 | 450 | | |
438 | 451 | | |
| |||
1438 | 1451 | | |
1439 | 1452 | | |
1440 | 1453 | | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
1441 | 1470 | | |
1442 | 1471 | | |
1443 | 1472 | | |
| 1473 | + | |
1444 | 1474 | | |
1445 | 1475 | | |
1446 | 1476 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2377 | 2377 | | |
2378 | 2378 | | |
2379 | 2379 | | |
| 2380 | + | |
| 2381 | + | |
| 2382 | + | |
| 2383 | + | |
| 2384 | + | |
| 2385 | + | |
| 2386 | + | |
2380 | 2387 | | |
2381 | 2388 | | |
2382 | 2389 | | |
| |||
2430 | 2437 | | |
2431 | 2438 | | |
2432 | 2439 | | |
| 2440 | + | |
| 2441 | + | |
| 2442 | + | |
| 2443 | + | |
| 2444 | + | |
| 2445 | + | |
| 2446 | + | |
| 2447 | + | |
| 2448 | + | |
| 2449 | + | |
| 2450 | + | |
| 2451 | + | |
| 2452 | + | |
| 2453 | + | |
| 2454 | + | |
| 2455 | + | |
| 2456 | + | |
| 2457 | + | |
| 2458 | + | |
| 2459 | + | |
| 2460 | + | |
| 2461 | + | |
| 2462 | + | |
| 2463 | + | |
| 2464 | + | |
| 2465 | + | |
| 2466 | + | |
| 2467 | + | |
| 2468 | + | |
| 2469 | + | |
| 2470 | + | |
| 2471 | + | |
| 2472 | + | |
| 2473 | + | |
| 2474 | + | |
| 2475 | + | |
| 2476 | + | |
| 2477 | + | |
| 2478 | + | |
| 2479 | + | |
| 2480 | + | |
| 2481 | + | |
| 2482 | + | |
2433 | 2483 | | |
2434 | 2484 | | |
2435 | 2485 | | |
| |||
7499 | 7549 | | |
7500 | 7550 | | |
7501 | 7551 | | |
7502 | | - | |
| 7552 | + | |
| 7553 | + | |
| 7554 | + | |
7503 | 7555 | | |
7504 | 7556 | | |
7505 | 7557 | | |
| |||
14691 | 14743 | | |
14692 | 14744 | | |
14693 | 14745 | | |
14694 | | - | |
| 14746 | + | |
| 14747 | + | |
| 14748 | + | |
| 14749 | + | |
| 14750 | + | |
14695 | 14751 | | |
14696 | 14752 | | |
14697 | 14753 | | |
| |||
14755 | 14811 | | |
14756 | 14812 | | |
14757 | 14813 | | |
| 14814 | + | |
| 14815 | + | |
| 14816 | + | |
| 14817 | + | |
| 14818 | + | |
| 14819 | + | |
| 14820 | + | |
| 14821 | + | |
| 14822 | + | |
14758 | 14823 | | |
14759 | 14824 | | |
14760 | 14825 | | |
| |||
14765 | 14830 | | |
14766 | 14831 | | |
14767 | 14832 | | |
14768 | | - | |
| 14833 | + | |
14769 | 14834 | | |
14770 | 14835 | | |
14771 | | - | |
| 14836 | + | |
| 14837 | + | |
14772 | 14838 | | |
14773 | 14839 | | |
14774 | 14840 | | |
14775 | 14841 | | |
14776 | 14842 | | |
14777 | | - | |
| 14843 | + | |
| 14844 | + | |
| 14845 | + | |
| 14846 | + | |
14778 | 14847 | | |
14779 | 14848 | | |
14780 | 14849 | | |
14781 | | - | |
| 14850 | + | |
| 14851 | + | |
| 14852 | + | |
| 14853 | + | |
14782 | 14854 | | |
14783 | 14855 | | |
14784 | 14856 | | |
14785 | 14857 | | |
14786 | 14858 | | |
14787 | 14859 | | |
14788 | 14860 | | |
14789 | | - | |
| 14861 | + | |
| 14862 | + | |
14790 | 14863 | | |
14791 | 14864 | | |
14792 | 14865 | | |
| |||
14795 | 14868 | | |
14796 | 14869 | | |
14797 | 14870 | | |
14798 | | - | |
| 14871 | + | |
| 14872 | + | |
14799 | 14873 | | |
14800 | 14874 | | |
14801 | 14875 | | |
| |||
14804 | 14878 | | |
14805 | 14879 | | |
14806 | 14880 | | |
14807 | | - | |
| 14881 | + | |
| 14882 | + | |
| 14883 | + | |
14808 | 14884 | | |
14809 | 14885 | | |
14810 | 14886 | | |
| |||
14841 | 14917 | | |
14842 | 14918 | | |
14843 | 14919 | | |
14844 | | - | |
| 14920 | + | |
14845 | 14921 | | |
14846 | 14922 | | |
14847 | 14923 | | |
| |||
14865 | 14941 | | |
14866 | 14942 | | |
14867 | 14943 | | |
14868 | | - | |
| 14944 | + | |
| 14945 | + | |
14869 | 14946 | | |
14870 | 14947 | | |
14871 | 14948 | | |
| |||
14875 | 14952 | | |
14876 | 14953 | | |
14877 | 14954 | | |
14878 | | - | |
| 14955 | + | |
| 14956 | + | |
14879 | 14957 | | |
14880 | 14958 | | |
14881 | 14959 | | |
14882 | 14960 | | |
14883 | 14961 | | |
14884 | | - | |
| 14962 | + | |
| 14963 | + | |
| 14964 | + | |
14885 | 14965 | | |
14886 | 14966 | | |
14887 | 14967 | | |
| |||
14897 | 14977 | | |
14898 | 14978 | | |
14899 | 14979 | | |
14900 | | - | |
| 14980 | + | |
14901 | 14981 | | |
14902 | | - | |
| 14982 | + | |
14903 | 14983 | | |
14904 | | - | |
| 14984 | + | |
14905 | 14985 | | |
14906 | | - | |
| 14986 | + | |
14907 | 14987 | | |
14908 | | - | |
| 14988 | + | |
14909 | 14989 | | |
14910 | | - | |
| 14990 | + | |
14911 | 14991 | | |
14912 | 14992 | | |
14913 | 14993 | | |
| |||
14920 | 15000 | | |
14921 | 15001 | | |
14922 | 15002 | | |
14923 | | - | |
| 15003 | + | |
14924 | 15004 | | |
14925 | 15005 | | |
14926 | 15006 | | |
| |||
0 commit comments