Repository navigation
Conversation
|
make编译不过; |
|
Need to add sentencepiece library manually |
|
@wizd I using your fork, the intract mode is not work: it was in dead loop..... |
|
Resolved in #79 |
|
Oh wait, did I get confused? |
|
I think it does. Are you still able to reproduce the issues? |
|
I reran the There are 2 problems still:
|
|
Can you try running from shell script encoded as UTF-8 and outputting to a text file? Your terminal might not be handling Unicode correctly. You’ll also need to re-generate your models from scratch since this PR changes how the ggml files are created. |
|
@ggerganov just in case: did you re-run the quantization script as well? |
Oops .. all good now 🦙 |
|
suggestion: can we add a magic version number? i feel we’ll get further updates?
…On Mon, Mar 13, 2023 at 21:08, Georgi Gerganov ***@***.***> wrote:
> ***@***.***(https://github.com/ggerganov) just in case: did you re-run the quantization script as well?
Oops .. all good now 🦙
—
Reply to this email directly, [view it on GitHub](#87 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AADHVK435NNAH7DLEKXMTEDW35WCRANCNFSM6AAAAAAVYZNR34).
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
|
Does this merge into master? How to test it? The wizd's branch doesn't work well with intract mode. |
|
@ggerganov |
Fix TypeError in low_level chat
…l-fix vulkan: fix turbo3 build + coopmat FA after April upstream sync
* iq3_k: fix Metal dot product I was accessing the scales as 4-byte aligned, but iq3_k is not 4-byte aligned. Instead of throwing an error (as it happens on CUDA when one makes this mistake), Metal silently accepts and we get garbage. * iq3_k: slightly faster Metal dot product --------- Co-authored-by: Iwan Kawrakow <[email protected]>
…t set served from ONE registered, mlocked region, sized by -lme
On an integrated GPU "VRAM" and host RAM are one DRAM, so r236 refused the whole
host-expert tier there and upstream disables the expert cache outright: a MoE model
whose expert set exceeds RAM simply cannot run. This block adds the tier that can:
ONE anonymous region (mmap + MADV_HUGEPAGE, hipHostRegister(Mapped|ReadOnly) once,
mlock'ed, sliced per (tensor, expert)) that the GPU reads in place at 230-233 GB/s.
* -lme N|auto sizes it (the same flag, units and heat ranking as the discrete
host-expert budget -- the one command line that carries across). The store's
extent is clamped to RLIMIT_MEMLOCK, a model that fits in RAM declines it, and
a model that cannot fit is REFUSED at load with the fix rather than left to
swap.
* The SHAPE follows the budget: a budget that covers the whole expert set PLACES
it (static, no eviction); a budget below it takes the ARENA (the store is the
cache's slot storage, the expert tensors stay as holes in the read-only model
mapping, LFRU residency serves every read, a miss is one buffered pread into the
vacated slot). Measured: the arena holds 13.6 GiB less non-reclaimable memory
than placement at -lme 4 on a 35B, which is what "cap the NON-SWAPPABLE memory
spent on MoE experts" means on an APU.
* -lme is also the opt-in for STREAMING: with it a >RAM model runs on whatever the
lock can hold (measured: a 122B under RLIMIT_MEMLOCK=20 GiB clamps to a 20 GiB
arena and runs); without it a model whose weights do not fit RAM is refused in
0.2 s with the fix, never placed and left to swap.
* The MTP/nextn head is pinned at full residency OUTSIDE that budget (embedded and
separate-drafter shapes), and one store is shared safely by two models.
* The fills run on block 12's adaptive host-read transport; the buffered arm reads
STRAIGHT into the arena slot (no bounce, no H2D); on RDNA3_5 UMA the ladder
STARTS on that arm (+13.7% warm, +56-67% on a >RAM model).
* Prefill streams only what is not resident: a D2D for the used experts the store
holds, ONE coalesced span read + ONE H2D per maximal run of the rest, from 8
parallel readers (+63-67% prefill on a >RAM model), and the prefill logits are
unmoved (mean KLD -0.000000, same-top-p 99.990%).
Measured end to end: a 123.45 GiB model runs on this 123 GiB box; text identical in
every arm (627b2ebd7792 / f586785d7183 / 9ccf62ed39c3 / ee95c45231c3 / 347f9f6f715f /
9b259759672f); the tier is inert on a discrete RDNA4 box by measurement (zero GTT
census lines, gate-host-pool.sh 42/42 with this build, throughput within noise).
Kill switches: MOE_EXPERT_GTT=0 (no store at all, the delivery's previous behaviour
byte for byte), MOE_EXPERT_GTT_RO=0 (register writable), MOE_EXPERT_GTT_MLOCK=0 (do
not lock), MOE_EXPERT_GTT_ARENA=0|1 (force the shape), MOE_EXPERT_GTT_PREFILL=0 (the
per-expert prefill copy), MOE_EXPERT_GTT_FILL_DIRECT=0 (the bounce fill). Gate:
scripts/gate-uma-experts.sh (16 arms, 40 checks), plus scripts/gate-prefill-logits.sh
and scripts/gate-host-pool.sh on the discrete side. Scope: Linux, integrated GPUs;
every other backend keeps its behaviour (the code is gated on prop.integrated).
r277 amendment -- THE PLACEMENT READ QUEUE. Every placement fill (the host pool's
load-time prewarm, its one-shot band re-layout, a covering mirror, and this block's
GTT arena sizing seeds) is now a WORK QUEUE drained by the reader pool this block
already built for the prefill span stream (pf_read_pool/pf_read_submit/pf_read_wait),
so the reads run at depth instead of one at a time: a 576 KiB O_DIRECT read is
2 219 MiB/s at depth 1, 3 896 at 2, 5 307 at 3, 6 348 at 4 and 6 937 at 8, and the
drives plateau at ~6.8 GiB/s (SN7100) / ~14 GB/s (SN8100). Measured load-time
placement: host-pool prewarm 2 694 -> 6 103 MiB/s on the 91 GiB box (and 1 183 ->
6 103 on the default --load-mode mmap arm, because a placement read is O_DIRECT
whatever --load-mode says -- r273's rule for the mirror, now extended to every
placement fill; the DEMAND transport still follows --load-mode/MOE_HOST_POOL_DIO),
covering mirror 4 471 -> 6 640 MiB/s, and on the PCIe-5 box mirror 5 674 -> 13 555
and prewarm 3 296 -> 11 185 MiB/s (whole run -29 %/-40 %). Byte-identical text in
every arm; the pool census reports the queue, and MOE_EXPERT_FILL_QD=1 is the
depth-1 A/B. This block also carries the pool-base alignment shift the mirror
window needs (base_alloc/POOL_PLACE_ALIGN: `base` is congruent to the GGUF tensor
offset, so the mirror fill is ONE aligned window with no bounce and no memcpy;
measured 8 751 vs 5 674 MiB/s at depth 1), and a dead-code/warning cleanup of block
09/12/16 leftovers (6 unused functions, 6 write-only counters, one sign-compare --
no behaviour change; the slot-map occupancy invariant moved onto
pool_slot_assign_locked and the "nothing evicts, so no per-slot drain" rationale
onto the TODO ggml-org#87 note).
…t set served from ONE registered, mlocked region, sized by -lme
On an integrated GPU "VRAM" and host RAM are one DRAM, so r236 refused the whole
host-expert tier there and upstream disables the expert cache outright: a MoE model
whose expert set exceeds RAM simply cannot run. This block adds the tier that can:
ONE anonymous region (mmap + MADV_HUGEPAGE, hipHostRegister(Mapped|ReadOnly) once,
mlock'ed, sliced per (tensor, expert)) that the GPU reads in place at 230-233 GB/s.
* -lme N|auto sizes it (the same flag, units and heat ranking as the discrete
host-expert budget -- the one command line that carries across). The store's
extent is clamped to RLIMIT_MEMLOCK, a model that fits in RAM declines it, and
a model that cannot fit is REFUSED at load with the fix rather than left to
swap.
* The SHAPE follows the budget: a budget that covers the whole expert set PLACES
it (static, no eviction); a budget below it takes the ARENA (the store is the
cache's slot storage, the expert tensors stay as holes in the read-only model
mapping, LFRU residency serves every read, a miss is one buffered pread into the
vacated slot). Measured: the arena holds 13.6 GiB less non-reclaimable memory
than placement at -lme 4 on a 35B, which is what "cap the NON-SWAPPABLE memory
spent on MoE experts" means on an APU.
* -lme is also the opt-in for STREAMING: with it a >RAM model runs on whatever the
lock can hold (measured: a 122B under RLIMIT_MEMLOCK=20 GiB clamps to a 20 GiB
arena and runs); without it a model whose weights do not fit RAM is refused in
0.2 s with the fix, never placed and left to swap.
* The MTP/nextn head is pinned at full residency OUTSIDE that budget (embedded and
separate-drafter shapes), and one store is shared safely by two models.
* The fills run on block 12's adaptive host-read transport; the buffered arm reads
STRAIGHT into the arena slot (no bounce, no H2D); on RDNA3_5 UMA the ladder
STARTS on that arm (+13.7% warm, +56-67% on a >RAM model).
* Prefill streams only what is not resident: a D2D for the used experts the store
holds, ONE coalesced span read + ONE H2D per maximal run of the rest, from 8
parallel readers (+63-67% prefill on a >RAM model), and the prefill logits are
unmoved (mean KLD -0.000000, same-top-p 99.990%).
Measured end to end: a 123.45 GiB model runs on this 123 GiB box; text identical in
every arm (627b2ebd7792 / f586785d7183 / 9ccf62ed39c3 / ee95c45231c3 / 347f9f6f715f /
9b259759672f); the tier is inert on a discrete RDNA4 box by measurement (zero GTT
census lines, gate-host-pool.sh 42/42 with this build, throughput within noise).
Kill switches: MOE_EXPERT_GTT=0 (no store at all, the delivery's previous behaviour
byte for byte), MOE_EXPERT_GTT_RO=0 (register writable), MOE_EXPERT_GTT_MLOCK=0 (do
not lock), MOE_EXPERT_GTT_ARENA=0|1 (force the shape), MOE_EXPERT_GTT_PREFILL=0 (the
per-expert prefill copy), MOE_EXPERT_GTT_FILL_DIRECT=0 (the bounce fill). Gate:
scripts/gate-uma-experts.sh (16 arms, 40 checks), plus scripts/gate-prefill-logits.sh
and scripts/gate-host-pool.sh on the discrete side. Scope: Linux, integrated GPUs;
every other backend keeps its behaviour (the code is gated on prop.integrated).
r277 amendment -- THE PLACEMENT READ QUEUE. Every placement fill (the host pool's
load-time prewarm, its one-shot band re-layout, a covering mirror, and this block's
GTT arena sizing seeds) is now a WORK QUEUE drained by the reader pool this block
already built for the prefill span stream (pf_read_pool/pf_read_submit/pf_read_wait),
so the reads run at depth instead of one at a time: a 576 KiB O_DIRECT read is
2 219 MiB/s at depth 1, 3 896 at 2, 5 307 at 3, 6 348 at 4 and 6 937 at 8, and the
drives plateau at ~6.8 GiB/s (SN7100) / ~14 GB/s (SN8100). Measured load-time
placement: host-pool prewarm 2 694 -> 6 103 MiB/s on the 91 GiB box (and 1 183 ->
6 103 on the default --load-mode mmap arm, because a placement read is O_DIRECT
whatever --load-mode says -- r273's rule for the mirror, now extended to every
placement fill; the DEMAND transport still follows --load-mode/MOE_HOST_POOL_DIO),
covering mirror 4 471 -> 6 640 MiB/s, and on the PCIe-5 box mirror 5 674 -> 13 555
and prewarm 3 296 -> 11 185 MiB/s (whole run -29 %/-40 %). Byte-identical text in
every arm; the pool census reports the queue, and MOE_EXPERT_FILL_QD=1 is the
depth-1 A/B. This block also carries the pool-base alignment shift the mirror
window needs (base_alloc/POOL_PLACE_ALIGN: `base` is congruent to the GGUF tensor
offset, so the mirror fill is ONE aligned window with no bounce and no memcpy;
measured 8 751 vs 5 674 MiB/s at depth 1), and a dead-code/warning cleanup of block
09/12/16 leftovers (6 unused functions, 6 write-only counters, one sign-compare --
no behaviour change; the slot-map occupancy invariant moved onto
pool_slot_assign_locked and the "nothing evicts, so no per-slot drain" rationale
onto the TODO ggml-org#87 note).
…t set served from ONE registered, mlocked region, sized by -lme
On an integrated GPU "VRAM" and host RAM are one DRAM, so r236 refused the whole
host-expert tier there and upstream disables the expert cache outright: a MoE model
whose expert set exceeds RAM simply cannot run. This block adds the tier that can:
ONE anonymous region (mmap + MADV_HUGEPAGE, hipHostRegister(Mapped|ReadOnly) once,
mlock'ed, sliced per (tensor, expert)) that the GPU reads in place at 230-233 GB/s.
* -lme N|auto sizes it (the same flag, units and heat ranking as the discrete
host-expert budget -- the one command line that carries across). The store's
extent is clamped to RLIMIT_MEMLOCK, a model that fits in RAM declines it, and
a model that cannot fit is REFUSED at load with the fix rather than left to
swap.
* The SHAPE follows the budget: a budget that covers the whole expert set PLACES
it (static, no eviction); a budget below it takes the ARENA (the store is the
cache's slot storage, the expert tensors stay as holes in the read-only model
mapping, LFRU residency serves every read, a miss is one buffered pread into the
vacated slot). Measured: the arena holds 13.6 GiB less non-reclaimable memory
than placement at -lme 4 on a 35B, which is what "cap the NON-SWAPPABLE memory
spent on MoE experts" means on an APU.
* -lme is also the opt-in for STREAMING: with it a >RAM model runs on whatever the
lock can hold (measured: a 122B under RLIMIT_MEMLOCK=20 GiB clamps to a 20 GiB
arena and runs); without it a model whose weights do not fit RAM is refused in
0.2 s with the fix, never placed and left to swap.
* The MTP/nextn head is pinned at full residency OUTSIDE that budget (embedded and
separate-drafter shapes), and one store is shared safely by two models.
* The fills run on block 12's adaptive host-read transport; the buffered arm reads
STRAIGHT into the arena slot (no bounce, no H2D); on RDNA3_5 UMA the ladder
STARTS on that arm (+13.7% warm, +56-67% on a >RAM model).
* Prefill streams only what is not resident: a D2D for the used experts the store
holds, ONE coalesced span read + ONE H2D per maximal run of the rest, from 8
parallel readers (+63-67% prefill on a >RAM model), and the prefill logits are
unmoved (mean KLD -0.000000, same-top-p 99.990%).
Measured end to end: a 123.45 GiB model runs on this 123 GiB box; text identical in
every arm (627b2ebd7792 / f586785d7183 / 9ccf62ed39c3 / ee95c45231c3 / 347f9f6f715f /
9b259759672f); the tier is inert on a discrete RDNA4 box by measurement (zero GTT
census lines, gate-host-pool.sh 42/42 with this build, throughput within noise).
Kill switches: MOE_EXPERT_GTT=0 (no store at all, the delivery's previous behaviour
byte for byte), MOE_EXPERT_GTT_RO=0 (register writable), MOE_EXPERT_GTT_MLOCK=0 (do
not lock), MOE_EXPERT_GTT_ARENA=0|1 (force the shape), MOE_EXPERT_GTT_PREFILL=0 (the
per-expert prefill copy), MOE_EXPERT_GTT_FILL_DIRECT=0 (the bounce fill). Gate:
scripts/gate-uma-experts.sh (16 arms, 40 checks), plus scripts/gate-prefill-logits.sh
and scripts/gate-host-pool.sh on the discrete side. Scope: Linux, integrated GPUs;
every other backend keeps its behaviour (the code is gated on prop.integrated).
r277 amendment -- THE PLACEMENT READ QUEUE. Every placement fill (the host pool's
load-time prewarm, its one-shot band re-layout, a covering mirror, and this block's
GTT arena sizing seeds) is now a WORK QUEUE drained by the reader pool this block
already built for the prefill span stream (pf_read_pool/pf_read_submit/pf_read_wait),
so the reads run at depth instead of one at a time: a 576 KiB O_DIRECT read is
2 219 MiB/s at depth 1, 3 896 at 2, 5 307 at 3, 6 348 at 4 and 6 937 at 8, and the
drives plateau at ~6.8 GiB/s (SN7100) / ~14 GB/s (SN8100). Measured load-time
placement: host-pool prewarm 2 694 -> 6 103 MiB/s on the 91 GiB box (and 1 183 ->
6 103 on the default --load-mode mmap arm, because a placement read is O_DIRECT
whatever --load-mode says -- r273's rule for the mirror, now extended to every
placement fill; the DEMAND transport still follows --load-mode/MOE_HOST_POOL_DIO),
covering mirror 4 471 -> 6 640 MiB/s, and on the PCIe-5 box mirror 5 674 -> 13 555
and prewarm 3 296 -> 11 185 MiB/s (whole run -29 %/-40 %). Byte-identical text in
every arm; the pool census reports the queue, and MOE_EXPERT_FILL_QD=1 is the
depth-1 A/B. This block also carries the pool-base alignment shift the mirror
window needs (base_alloc/POOL_PLACE_ALIGN: `base` is congruent to the GGUF tensor
offset, so the mirror fill is ONE aligned window with no bounce and no memcpy;
measured 8 751 vs 5 674 MiB/s at depth 1), and a dead-code/warning cleanup of block
09/12/16 leftovers (6 unused functions, 6 write-only counters, one sign-compare --
no behaviour change; the slot-map occupancy invariant moved onto
pool_slot_assign_locked and the "nothing evicts, so no per-slot drain" rationale
onto the TODO ggml-org#87 note).
…t set served from ONE registered, mlocked region, sized by -lme
On an integrated GPU "VRAM" and host RAM are one DRAM, so r236 refused the whole
host-expert tier there and upstream disables the expert cache outright: a MoE model
whose expert set exceeds RAM simply cannot run. This block adds the tier that can:
ONE anonymous region (mmap + MADV_HUGEPAGE, hipHostRegister(Mapped|ReadOnly) once,
mlock'ed, sliced per (tensor, expert)) that the GPU reads in place at 230-233 GB/s.
* -lme N|auto sizes it (the same flag, units and heat ranking as the discrete
host-expert budget -- the one command line that carries across). The store's
extent is clamped to RLIMIT_MEMLOCK, a model that fits in RAM declines it, and
a model that cannot fit is REFUSED at load with the fix rather than left to
swap.
* The SHAPE follows the budget: a budget that covers the whole expert set PLACES
it (static, no eviction); a budget below it takes the ARENA (the store is the
cache's slot storage, the expert tensors stay as holes in the read-only model
mapping, LFRU residency serves every read, a miss is one buffered pread into the
vacated slot). Measured: the arena holds 13.6 GiB less non-reclaimable memory
than placement at -lme 4 on a 35B, which is what "cap the NON-SWAPPABLE memory
spent on MoE experts" means on an APU.
* -lme is also the opt-in for STREAMING: with it a >RAM model runs on whatever the
lock can hold (measured: a 122B under RLIMIT_MEMLOCK=20 GiB clamps to a 20 GiB
arena and runs); without it a model whose weights do not fit RAM is refused in
0.2 s with the fix, never placed and left to swap.
* The MTP/nextn head is pinned at full residency OUTSIDE that budget (embedded and
separate-drafter shapes), and one store is shared safely by two models.
* The fills run on block 12's adaptive host-read transport; the buffered arm reads
STRAIGHT into the arena slot (no bounce, no H2D); on RDNA3_5 UMA the ladder
STARTS on that arm (+13.7% warm, +56-67% on a >RAM model).
* Prefill streams only what is not resident: a D2D for the used experts the store
holds, ONE coalesced span read + ONE H2D per maximal run of the rest, from 8
parallel readers (+63-67% prefill on a >RAM model), and the prefill logits are
unmoved (mean KLD -0.000000, same-top-p 99.990%).
Measured end to end: a 123.45 GiB model runs on this 123 GiB box; text identical in
every arm (627b2ebd7792 / f586785d7183 / 9ccf62ed39c3 / ee95c45231c3 / 347f9f6f715f /
9b259759672f); the tier is inert on a discrete RDNA4 box by measurement (zero GTT
census lines, gate-host-pool.sh 42/42 with this build, throughput within noise).
Kill switches: MOE_EXPERT_GTT=0 (no store at all, the delivery's previous behaviour
byte for byte), MOE_EXPERT_GTT_RO=0 (register writable), MOE_EXPERT_GTT_MLOCK=0 (do
not lock), MOE_EXPERT_GTT_ARENA=0|1 (force the shape), MOE_EXPERT_GTT_PREFILL=0 (the
per-expert prefill copy), MOE_EXPERT_GTT_FILL_DIRECT=0 (the bounce fill). Gate:
scripts/gate-uma-experts.sh (16 arms, 40 checks), plus scripts/gate-prefill-logits.sh
and scripts/gate-host-pool.sh on the discrete side. Scope: Linux, integrated GPUs;
every other backend keeps its behaviour (the code is gated on prop.integrated).
r277 amendment -- THE PLACEMENT READ QUEUE. Every placement fill (the host pool's
load-time prewarm, its one-shot band re-layout, a covering mirror, and this block's
GTT arena sizing seeds) is now a WORK QUEUE drained by the reader pool this block
already built for the prefill span stream (pf_read_pool/pf_read_submit/pf_read_wait),
so the reads run at depth instead of one at a time: a 576 KiB O_DIRECT read is
2 219 MiB/s at depth 1, 3 896 at 2, 5 307 at 3, 6 348 at 4 and 6 937 at 8, and the
drives plateau at ~6.8 GiB/s (SN7100) / ~14 GB/s (SN8100). Measured load-time
placement: host-pool prewarm 2 694 -> 6 103 MiB/s on the 91 GiB box (and 1 183 ->
6 103 on the default --load-mode mmap arm, because a placement read is O_DIRECT
whatever --load-mode says -- r273's rule for the mirror, now extended to every
placement fill; the DEMAND transport still follows --load-mode/MOE_HOST_POOL_DIO),
covering mirror 4 471 -> 6 640 MiB/s, and on the PCIe-5 box mirror 5 674 -> 13 555
and prewarm 3 296 -> 11 185 MiB/s (whole run -29 %/-40 %). Byte-identical text in
every arm; the pool census reports the queue, and MOE_EXPERT_FILL_QD=1 is the
depth-1 A/B. This block also carries the pool-base alignment shift the mirror
window needs (base_alloc/POOL_PLACE_ALIGN: `base` is congruent to the GGUF tensor
offset, so the mirror fill is ONE aligned window with no bounce and no memcpy;
measured 8 751 vs 5 674 MiB/s at depth 1), and a dead-code/warning cleanup of block
09/12/16 leftovers (6 unused functions, 6 write-only counters, one sign-compare --
no behaviour change; the slot-map occupancy invariant moved onto
pool_slot_assign_locked and the "nothing evicts, so no per-slot drain" rationale
onto the TODO ggml-org#87 note).
…t set served from ONE registered, mlocked region, sized by -lme
On an integrated GPU "VRAM" and host RAM are one DRAM, so r236 refused the whole
host-expert tier there and upstream disables the expert cache outright: a MoE model
whose expert set exceeds RAM simply cannot run. This block adds the tier that can:
ONE anonymous region (mmap + MADV_HUGEPAGE, hipHostRegister(Mapped|ReadOnly) once,
mlock'ed, sliced per (tensor, expert)) that the GPU reads in place at 230-233 GB/s.
* -lme N|auto sizes it (the same flag, units and heat ranking as the discrete
host-expert budget -- the one command line that carries across). The store's
extent is clamped to RLIMIT_MEMLOCK, a model that fits in RAM declines it, and
a model that cannot fit is REFUSED at load with the fix rather than left to
swap.
* The SHAPE follows the budget: a budget that covers the whole expert set PLACES
it (static, no eviction); a budget below it takes the ARENA (the store is the
cache's slot storage, the expert tensors stay as holes in the read-only model
mapping, LFRU residency serves every read, a miss is one buffered pread into the
vacated slot). Measured: the arena holds 13.6 GiB less non-reclaimable memory
than placement at -lme 4 on a 35B, which is what "cap the NON-SWAPPABLE memory
spent on MoE experts" means on an APU.
* -lme is also the opt-in for STREAMING: with it a >RAM model runs on whatever the
lock can hold (measured: a 122B under RLIMIT_MEMLOCK=20 GiB clamps to a 20 GiB
arena and runs); without it a model whose weights do not fit RAM is refused in
0.2 s with the fix, never placed and left to swap.
* The MTP/nextn head is pinned at full residency OUTSIDE that budget (embedded and
separate-drafter shapes), and one store is shared safely by two models.
* The fills run on block 12's adaptive host-read transport; the buffered arm reads
STRAIGHT into the arena slot (no bounce, no H2D); on RDNA3_5 UMA the ladder
STARTS on that arm (+13.7% warm, +56-67% on a >RAM model).
* Prefill streams only what is not resident: a D2D for the used experts the store
holds, ONE coalesced span read + ONE H2D per maximal run of the rest, from 8
parallel readers (+63-67% prefill on a >RAM model), and the prefill logits are
unmoved (mean KLD -0.000000, same-top-p 99.990%).
Measured end to end: a 123.45 GiB model runs on this 123 GiB box; text identical in
every arm (627b2ebd7792 / f586785d7183 / 9ccf62ed39c3 / ee95c45231c3 / 347f9f6f715f /
9b259759672f); the tier is inert on a discrete RDNA4 box by measurement (zero GTT
census lines, gate-host-pool.sh 42/42 with this build, throughput within noise).
Kill switches: MOE_EXPERT_GTT=0 (no store at all, the delivery's previous behaviour
byte for byte), MOE_EXPERT_GTT_RO=0 (register writable), MOE_EXPERT_GTT_MLOCK=0 (do
not lock), MOE_EXPERT_GTT_ARENA=0|1 (force the shape), MOE_EXPERT_GTT_PREFILL=0 (the
per-expert prefill copy), MOE_EXPERT_GTT_FILL_DIRECT=0 (the bounce fill). Gate:
scripts/gate-uma-experts.sh (16 arms, 40 checks), plus scripts/gate-prefill-logits.sh
and scripts/gate-host-pool.sh on the discrete side. Scope: Linux, integrated GPUs;
every other backend keeps its behaviour (the code is gated on prop.integrated).
r277 amendment -- THE PLACEMENT READ QUEUE. Every placement fill (the host pool's
load-time prewarm, its one-shot band re-layout, a covering mirror, and this block's
GTT arena sizing seeds) is now a WORK QUEUE drained by the reader pool this block
already built for the prefill span stream (pf_read_pool/pf_read_submit/pf_read_wait),
so the reads run at depth instead of one at a time: a 576 KiB O_DIRECT read is
2 219 MiB/s at depth 1, 3 896 at 2, 5 307 at 3, 6 348 at 4 and 6 937 at 8, and the
drives plateau at ~6.8 GiB/s (SN7100) / ~14 GB/s (SN8100). Measured load-time
placement: host-pool prewarm 2 694 -> 6 103 MiB/s on the 91 GiB box (and 1 183 ->
6 103 on the default --load-mode mmap arm, because a placement read is O_DIRECT
whatever --load-mode says -- r273's rule for the mirror, now extended to every
placement fill; the DEMAND transport still follows --load-mode/MOE_HOST_POOL_DIO),
covering mirror 4 471 -> 6 640 MiB/s, and on the PCIe-5 box mirror 5 674 -> 13 555
and prewarm 3 296 -> 11 185 MiB/s (whole run -29 %/-40 %). Byte-identical text in
every arm; the pool census reports the queue, and MOE_EXPERT_FILL_QD=1 is the
depth-1 A/B. This block also carries the pool-base alignment shift the mirror
window needs (base_alloc/POOL_PLACE_ALIGN: `base` is congruent to the GGUF tensor
offset, so the mirror fill is ONE aligned window with no bounce and no memcpy;
measured 8 751 vs 5 674 MiB/s at depth 1), and a dead-code/warning cleanup of block
09/12/16 leftovers (6 unused functions, 6 write-only counters, one sign-compare --
no behaviour change; the slot-map occupancy invariant moved onto
pool_slot_assign_locked and the "nothing evicts, so no per-slot drain" rationale
onto the TODO ggml-org#87 note).
…t set served from ONE registered, mlocked region, sized by -lme
On an integrated GPU "VRAM" and host RAM are one DRAM, so r236 refused the whole
host-expert tier there and upstream disables the expert cache outright: a MoE model
whose expert set exceeds RAM simply cannot run. This block adds the tier that can:
ONE anonymous region (mmap + MADV_HUGEPAGE, hipHostRegister(Mapped|ReadOnly) once,
mlock'ed, sliced per (tensor, expert)) that the GPU reads in place at 230-233 GB/s.
* -lme N|auto sizes it (the same flag, units and heat ranking as the discrete
host-expert budget -- the one command line that carries across). The store's
extent is clamped to RLIMIT_MEMLOCK, a model that fits in RAM declines it, and
a model that cannot fit is REFUSED at load with the fix rather than left to
swap.
* The SHAPE follows the budget: a budget that covers the whole expert set PLACES
it (static, no eviction); a budget below it takes the ARENA (the store is the
cache's slot storage, the expert tensors stay as holes in the read-only model
mapping, LFRU residency serves every read, a miss is one buffered pread into the
vacated slot). Measured: the arena holds 13.6 GiB less non-reclaimable memory
than placement at -lme 4 on a 35B, which is what "cap the NON-SWAPPABLE memory
spent on MoE experts" means on an APU.
* -lme is also the opt-in for STREAMING: with it a >RAM model runs on whatever the
lock can hold (measured: a 122B under RLIMIT_MEMLOCK=20 GiB clamps to a 20 GiB
arena and runs); without it a model whose weights do not fit RAM is refused in
0.2 s with the fix, never placed and left to swap.
* The MTP/nextn head is pinned at full residency OUTSIDE that budget (embedded and
separate-drafter shapes), and one store is shared safely by two models.
* The fills run on block 12's adaptive host-read transport; the buffered arm reads
STRAIGHT into the arena slot (no bounce, no H2D); on RDNA3_5 UMA the ladder
STARTS on that arm (+13.7% warm, +56-67% on a >RAM model).
* Prefill streams only what is not resident: a D2D for the used experts the store
holds, ONE coalesced span read + ONE H2D per maximal run of the rest, from 8
parallel readers (+63-67% prefill on a >RAM model), and the prefill logits are
unmoved (mean KLD -0.000000, same-top-p 99.990%).
Measured end to end: a 123.45 GiB model runs on this 123 GiB box; text identical in
every arm (627b2ebd7792 / f586785d7183 / 9ccf62ed39c3 / ee95c45231c3 / 347f9f6f715f /
9b259759672f); the tier is inert on a discrete RDNA4 box by measurement (zero GTT
census lines, gate-host-pool.sh 42/42 with this build, throughput within noise).
Kill switches: MOE_EXPERT_GTT=0 (no store at all, the delivery's previous behaviour
byte for byte), MOE_EXPERT_GTT_RO=0 (register writable), MOE_EXPERT_GTT_MLOCK=0 (do
not lock), MOE_EXPERT_GTT_ARENA=0|1 (force the shape), MOE_EXPERT_GTT_PREFILL=0 (the
per-expert prefill copy), MOE_EXPERT_GTT_FILL_DIRECT=0 (the bounce fill). Gate:
scripts/gate-uma-experts.sh (16 arms, 40 checks), plus scripts/gate-prefill-logits.sh
and scripts/gate-host-pool.sh on the discrete side. Scope: Linux, integrated GPUs;
every other backend keeps its behaviour (the code is gated on prop.integrated).
r277 amendment -- THE PLACEMENT READ QUEUE. Every placement fill (the host pool's
load-time prewarm, its one-shot band re-layout, a covering mirror, and this block's
GTT arena sizing seeds) is now a WORK QUEUE drained by the reader pool this block
already built for the prefill span stream (pf_read_pool/pf_read_submit/pf_read_wait),
so the reads run at depth instead of one at a time: a 576 KiB O_DIRECT read is
2 219 MiB/s at depth 1, 3 896 at 2, 5 307 at 3, 6 348 at 4 and 6 937 at 8, and the
drives plateau at ~6.8 GiB/s (SN7100) / ~14 GB/s (SN8100). Measured load-time
placement: host-pool prewarm 2 694 -> 6 103 MiB/s on the 91 GiB box (and 1 183 ->
6 103 on the default --load-mode mmap arm, because a placement read is O_DIRECT
whatever --load-mode says -- r273's rule for the mirror, now extended to every
placement fill; the DEMAND transport still follows --load-mode/MOE_HOST_POOL_DIO),
covering mirror 4 471 -> 6 640 MiB/s, and on the PCIe-5 box mirror 5 674 -> 13 555
and prewarm 3 296 -> 11 185 MiB/s (whole run -29 %/-40 %). Byte-identical text in
every arm; the pool census reports the queue, and MOE_EXPERT_FILL_QD=1 is the
depth-1 A/B. This block also carries the pool-base alignment shift the mirror
window needs (base_alloc/POOL_PLACE_ALIGN: `base` is congruent to the GGUF tensor
offset, so the mirror fill is ONE aligned window with no bounce and no memcpy;
measured 8 751 vs 5 674 MiB/s at depth 1), and a dead-code/warning cleanup of block
09/12/16 leftovers (6 unused functions, 6 write-only counters, one sign-compare --
no behaviour change; the slot-map occupancy invariant moved onto
pool_slot_assign_locked and the "nothing evicts, so no per-slot drain" rationale
onto the TODO ggml-org#87 note).
…t set served from ONE registered, mlocked region, sized by -lme
On an integrated GPU "VRAM" and host RAM are one DRAM, so r236 refused the whole
host-expert tier there and upstream disables the expert cache outright: a MoE model
whose expert set exceeds RAM simply cannot run. This block adds the tier that can:
ONE anonymous region (mmap + MADV_HUGEPAGE, hipHostRegister(Mapped|ReadOnly) once,
mlock'ed, sliced per (tensor, expert)) that the GPU reads in place at 230-233 GB/s.
* -lme N|auto sizes it (the same flag, units and heat ranking as the discrete
host-expert budget -- the one command line that carries across). The store's
extent is clamped to RLIMIT_MEMLOCK, a model that fits in RAM declines it, and
a model that cannot fit is REFUSED at load with the fix rather than left to
swap.
* The SHAPE follows the budget: a budget that covers the whole expert set PLACES
it (static, no eviction); a budget below it takes the ARENA (the store is the
cache's slot storage, the expert tensors stay as holes in the read-only model
mapping, LFRU residency serves every read, a miss is one buffered pread into the
vacated slot). Measured: the arena holds 13.6 GiB less non-reclaimable memory
than placement at -lme 4 on a 35B, which is what "cap the NON-SWAPPABLE memory
spent on MoE experts" means on an APU.
* -lme is also the opt-in for STREAMING: with it a >RAM model runs on whatever the
lock can hold (measured: a 122B under RLIMIT_MEMLOCK=20 GiB clamps to a 20 GiB
arena and runs); without it a model whose weights do not fit RAM is refused in
0.2 s with the fix, never placed and left to swap.
* The MTP/nextn head is pinned at full residency OUTSIDE that budget (embedded and
separate-drafter shapes), and one store is shared safely by two models.
* The fills run on block 12's adaptive host-read transport; the buffered arm reads
STRAIGHT into the arena slot (no bounce, no H2D); on RDNA3_5 UMA the ladder
STARTS on that arm (+13.7% warm, +56-67% on a >RAM model).
* Prefill streams only what is not resident: a D2D for the used experts the store
holds, ONE coalesced span read + ONE H2D per maximal run of the rest, from 8
parallel readers (+63-67% prefill on a >RAM model), and the prefill logits are
unmoved (mean KLD -0.000000, same-top-p 99.990%).
Measured end to end: a 123.45 GiB model runs on this 123 GiB box; text identical in
every arm (627b2ebd7792 / f586785d7183 / 9ccf62ed39c3 / ee95c45231c3 / 347f9f6f715f /
9b259759672f); the tier is inert on a discrete RDNA4 box by measurement (zero GTT
census lines, gate-host-pool.sh 42/42 with this build, throughput within noise).
Kill switches: MOE_EXPERT_GTT=0 (no store at all, the delivery's previous behaviour
byte for byte), MOE_EXPERT_GTT_RO=0 (register writable), MOE_EXPERT_GTT_MLOCK=0 (do
not lock), MOE_EXPERT_GTT_ARENA=0|1 (force the shape), MOE_EXPERT_GTT_PREFILL=0 (the
per-expert prefill copy), MOE_EXPERT_GTT_FILL_DIRECT=0 (the bounce fill). Gate:
scripts/gate-uma-experts.sh (16 arms, 40 checks), plus scripts/gate-prefill-logits.sh
and scripts/gate-host-pool.sh on the discrete side. Scope: Linux, integrated GPUs;
every other backend keeps its behaviour (the code is gated on prop.integrated).
r277 amendment -- THE PLACEMENT READ QUEUE. Every placement fill (the host pool's
load-time prewarm, its one-shot band re-layout, a covering mirror, and this block's
GTT arena sizing seeds) is now a WORK QUEUE drained by the reader pool this block
already built for the prefill span stream (pf_read_pool/pf_read_submit/pf_read_wait),
so the reads run at depth instead of one at a time: a 576 KiB O_DIRECT read is
2 219 MiB/s at depth 1, 3 896 at 2, 5 307 at 3, 6 348 at 4 and 6 937 at 8, and the
drives plateau at ~6.8 GiB/s (SN7100) / ~14 GB/s (SN8100). Measured load-time
placement: host-pool prewarm 2 694 -> 6 103 MiB/s on the 91 GiB box (and 1 183 ->
6 103 on the default --load-mode mmap arm, because a placement read is O_DIRECT
whatever --load-mode says -- r273's rule for the mirror, now extended to every
placement fill; the DEMAND transport still follows --load-mode/MOE_HOST_POOL_DIO),
covering mirror 4 471 -> 6 640 MiB/s, and on the PCIe-5 box mirror 5 674 -> 13 555
and prewarm 3 296 -> 11 185 MiB/s (whole run -29 %/-40 %). Byte-identical text in
every arm; the pool census reports the queue, and MOE_EXPERT_FILL_QD=1 is the
depth-1 A/B. This block also carries the pool-base alignment shift the mirror
window needs (base_alloc/POOL_PLACE_ALIGN: `base` is congruent to the GGUF tensor
offset, so the mirror fill is ONE aligned window with no bounce and no memcpy;
measured 8 751 vs 5 674 MiB/s at depth 1), and a dead-code/warning cleanup of block
09/12/16 leftovers (6 unused functions, 6 write-only counters, one sign-compare --
no behaviour change; the slot-map occupancy invariant moved onto
pool_slot_assign_locked and the "nothing evicts, so no per-slot drain" rationale
onto the TODO ggml-org#87 note).
…t set served from ONE registered, mlocked region, sized by -lme
On an integrated GPU "VRAM" and host RAM are one DRAM, so r236 refused the whole
host-expert tier there and upstream disables the expert cache outright: a MoE model
whose expert set exceeds RAM simply cannot run. This block adds the tier that can:
ONE anonymous region (mmap + MADV_HUGEPAGE, hipHostRegister(Mapped|ReadOnly) once,
mlock'ed, sliced per (tensor, expert)) that the GPU reads in place at 230-233 GB/s.
* -lme N|auto sizes it (the same flag, units and heat ranking as the discrete
host-expert budget -- the one command line that carries across). The store's
extent is clamped to RLIMIT_MEMLOCK, a model that fits in RAM declines it, and
a model that cannot fit is REFUSED at load with the fix rather than left to
swap.
* The SHAPE follows the budget: a budget that covers the whole expert set PLACES
it (static, no eviction); a budget below it takes the ARENA (the store is the
cache's slot storage, the expert tensors stay as holes in the read-only model
mapping, LFRU residency serves every read, a miss is one buffered pread into the
vacated slot). Measured: the arena holds 13.6 GiB less non-reclaimable memory
than placement at -lme 4 on a 35B, which is what "cap the NON-SWAPPABLE memory
spent on MoE experts" means on an APU.
* -lme is also the opt-in for STREAMING: with it a >RAM model runs on whatever the
lock can hold (measured: a 122B under RLIMIT_MEMLOCK=20 GiB clamps to a 20 GiB
arena and runs); without it a model whose weights do not fit RAM is refused in
0.2 s with the fix, never placed and left to swap.
* The MTP/nextn head is pinned at full residency OUTSIDE that budget (embedded and
separate-drafter shapes), and one store is shared safely by two models.
* The fills run on block 12's adaptive host-read transport; the buffered arm reads
STRAIGHT into the arena slot (no bounce, no H2D); on RDNA3_5 UMA the ladder
STARTS on that arm (+13.7% warm, +56-67% on a >RAM model).
* Prefill streams only what is not resident: a D2D for the used experts the store
holds, ONE coalesced span read + ONE H2D per maximal run of the rest, from 8
parallel readers (+63-67% prefill on a >RAM model), and the prefill logits are
unmoved (mean KLD -0.000000, same-top-p 99.990%).
Measured end to end: a 123.45 GiB model runs on this 123 GiB box; text identical in
every arm (627b2ebd7792 / f586785d7183 / 9ccf62ed39c3 / ee95c45231c3 / 347f9f6f715f /
9b259759672f); the tier is inert on a discrete RDNA4 box by measurement (zero GTT
census lines, gate-host-pool.sh 42/42 with this build, throughput within noise).
Kill switches: MOE_EXPERT_GTT=0 (no store at all, the delivery's previous behaviour
byte for byte), MOE_EXPERT_GTT_RO=0 (register writable), MOE_EXPERT_GTT_MLOCK=0 (do
not lock), MOE_EXPERT_GTT_ARENA=0|1 (force the shape), MOE_EXPERT_GTT_PREFILL=0 (the
per-expert prefill copy), MOE_EXPERT_GTT_FILL_DIRECT=0 (the bounce fill). Gate:
scripts/gate-uma-experts.sh (16 arms, 40 checks), plus scripts/gate-prefill-logits.sh
and scripts/gate-host-pool.sh on the discrete side. Scope: Linux, integrated GPUs;
every other backend keeps its behaviour (the code is gated on prop.integrated).
r277 amendment -- THE PLACEMENT READ QUEUE. Every placement fill (the host pool's
load-time prewarm, its one-shot band re-layout, a covering mirror, and this block's
GTT arena sizing seeds) is now a WORK QUEUE drained by the reader pool this block
already built for the prefill span stream (pf_read_pool/pf_read_submit/pf_read_wait),
so the reads run at depth instead of one at a time: a 576 KiB O_DIRECT read is
2 219 MiB/s at depth 1, 3 896 at 2, 5 307 at 3, 6 348 at 4 and 6 937 at 8, and the
drives plateau at ~6.8 GiB/s (SN7100) / ~14 GB/s (SN8100). Measured load-time
placement: host-pool prewarm 2 694 -> 6 103 MiB/s on the 91 GiB box (and 1 183 ->
6 103 on the default --load-mode mmap arm, because a placement read is O_DIRECT
whatever --load-mode says -- r273's rule for the mirror, now extended to every
placement fill; the DEMAND transport still follows --load-mode/MOE_HOST_POOL_DIO),
covering mirror 4 471 -> 6 640 MiB/s, and on the PCIe-5 box mirror 5 674 -> 13 555
and prewarm 3 296 -> 11 185 MiB/s (whole run -29 %/-40 %). Byte-identical text in
every arm; the pool census reports the queue, and MOE_EXPERT_FILL_QD=1 is the
depth-1 A/B. This block also carries the pool-base alignment shift the mirror
window needs (base_alloc/POOL_PLACE_ALIGN: `base` is congruent to the GGUF tensor
offset, so the mirror fill is ONE aligned window with no bounce and no memcpy;
measured 8 751 vs 5 674 MiB/s at depth 1), and a dead-code/warning cleanup of block
09/12/16 leftovers (6 unused functions, 6 write-only counters, one sign-compare --
no behaviour change; the slot-map occupancy invariant moved onto
pool_slot_assign_locked and the "nothing evicts, so no per-slot drain" rationale
onto the TODO ggml-org#87 note).
…t set served from ONE registered, mlocked region, sized by -lme
On an integrated GPU "VRAM" and host RAM are one DRAM, so r236 refused the whole
host-expert tier there and upstream disables the expert cache outright: a MoE model
whose expert set exceeds RAM simply cannot run. This block adds the tier that can:
ONE anonymous region (mmap + MADV_HUGEPAGE, hipHostRegister(Mapped|ReadOnly) once,
mlock'ed, sliced per (tensor, expert)) that the GPU reads in place at 230-233 GB/s.
* -lme N|auto sizes it (the same flag, units and heat ranking as the discrete
host-expert budget -- the one command line that carries across). The store's
extent is clamped to RLIMIT_MEMLOCK, a model that fits in RAM declines it, and
a model that cannot fit is REFUSED at load with the fix rather than left to
swap.
* The SHAPE follows the budget: a budget that covers the whole expert set PLACES
it (static, no eviction); a budget below it takes the ARENA (the store is the
cache's slot storage, the expert tensors stay as holes in the read-only model
mapping, LFRU residency serves every read, a miss is one buffered pread into the
vacated slot). Measured: the arena holds 13.6 GiB less non-reclaimable memory
than placement at -lme 4 on a 35B, which is what "cap the NON-SWAPPABLE memory
spent on MoE experts" means on an APU.
* -lme is also the opt-in for STREAMING: with it a >RAM model runs on whatever the
lock can hold (measured: a 122B under RLIMIT_MEMLOCK=20 GiB clamps to a 20 GiB
arena and runs); without it a model whose weights do not fit RAM is refused in
0.2 s with the fix, never placed and left to swap.
* The MTP/nextn head is pinned at full residency OUTSIDE that budget (embedded and
separate-drafter shapes), and one store is shared safely by two models.
* The fills run on block 12's adaptive host-read transport; the buffered arm reads
STRAIGHT into the arena slot (no bounce, no H2D); on RDNA3_5 UMA the ladder
STARTS on that arm (+13.7% warm, +56-67% on a >RAM model).
* Prefill streams only what is not resident: a D2D for the used experts the store
holds, ONE coalesced span read + ONE H2D per maximal run of the rest, from 8
parallel readers (+63-67% prefill on a >RAM model), and the prefill logits are
unmoved (mean KLD -0.000000, same-top-p 99.990%).
Measured end to end: a 123.45 GiB model runs on this 123 GiB box; text identical in
every arm (627b2ebd7792 / f586785d7183 / 9ccf62ed39c3 / ee95c45231c3 / 347f9f6f715f /
9b259759672f); the tier is inert on a discrete RDNA4 box by measurement (zero GTT
census lines, gate-host-pool.sh 42/42 with this build, throughput within noise).
Kill switches: MOE_EXPERT_GTT=0 (no store at all, the delivery's previous behaviour
byte for byte), MOE_EXPERT_GTT_RO=0 (register writable), MOE_EXPERT_GTT_MLOCK=0 (do
not lock), MOE_EXPERT_GTT_ARENA=0|1 (force the shape), MOE_EXPERT_GTT_PREFILL=0 (the
per-expert prefill copy), MOE_EXPERT_GTT_FILL_DIRECT=0 (the bounce fill). Gate:
scripts/gate-uma-experts.sh (16 arms, 40 checks), plus scripts/gate-prefill-logits.sh
and scripts/gate-host-pool.sh on the discrete side. Scope: Linux, integrated GPUs;
every other backend keeps its behaviour (the code is gated on prop.integrated).
r277 amendment -- THE PLACEMENT READ QUEUE. Every placement fill (the host pool's
load-time prewarm, its one-shot band re-layout, a covering mirror, and this block's
GTT arena sizing seeds) is now a WORK QUEUE drained by the reader pool this block
already built for the prefill span stream (pf_read_pool/pf_read_submit/pf_read_wait),
so the reads run at depth instead of one at a time: a 576 KiB O_DIRECT read is
2 219 MiB/s at depth 1, 3 896 at 2, 5 307 at 3, 6 348 at 4 and 6 937 at 8, and the
drives plateau at ~6.8 GiB/s (SN7100) / ~14 GB/s (SN8100). Measured load-time
placement: host-pool prewarm 2 694 -> 6 103 MiB/s on the 91 GiB box (and 1 183 ->
6 103 on the default --load-mode mmap arm, because a placement read is O_DIRECT
whatever --load-mode says -- r273's rule for the mirror, now extended to every
placement fill; the DEMAND transport still follows --load-mode/MOE_HOST_POOL_DIO),
covering mirror 4 471 -> 6 640 MiB/s, and on the PCIe-5 box mirror 5 674 -> 13 555
and prewarm 3 296 -> 11 185 MiB/s (whole run -29 %/-40 %). Byte-identical text in
every arm; the pool census reports the queue, and MOE_EXPERT_FILL_QD=1 is the
depth-1 A/B. This block also carries the pool-base alignment shift the mirror
window needs (base_alloc/POOL_PLACE_ALIGN: `base` is congruent to the GGUF tensor
offset, so the mirror fill is ONE aligned window with no bounce and no memcpy;
measured 8 751 vs 5 674 MiB/s at depth 1), and a dead-code/warning cleanup of block
09/12/16 leftovers (6 unused functions, 6 write-only counters, one sign-compare --
no behaviour change; the slot-map occupancy invariant moved onto
pool_slot_assign_locked and the "nothing evicts, so no per-slot drain" rationale
onto the TODO ggml-org#87 note).
…t set served from ONE registered, mlocked region, sized by -lme
On an integrated GPU "VRAM" and host RAM are one DRAM, so r236 refused the whole
host-expert tier there and upstream disables the expert cache outright: a MoE model
whose expert set exceeds RAM simply cannot run. This block adds the tier that can:
ONE anonymous region (mmap + MADV_HUGEPAGE, hipHostRegister(Mapped|ReadOnly) once,
mlock'ed, sliced per (tensor, expert)) that the GPU reads in place at 230-233 GB/s.
* -lme N|auto sizes it (the same flag, units and heat ranking as the discrete
host-expert budget -- the one command line that carries across). The store's
extent is clamped to RLIMIT_MEMLOCK, a model that fits in RAM declines it, and
a model that cannot fit is REFUSED at load with the fix rather than left to
swap.
* The SHAPE follows the budget: a budget that covers the whole expert set PLACES
it (static, no eviction); a budget below it takes the ARENA (the store is the
cache's slot storage, the expert tensors stay as holes in the read-only model
mapping, LFRU residency serves every read, a miss is one buffered pread into the
vacated slot). Measured: the arena holds 13.6 GiB less non-reclaimable memory
than placement at -lme 4 on a 35B, which is what "cap the NON-SWAPPABLE memory
spent on MoE experts" means on an APU.
* -lme is also the opt-in for STREAMING: with it a >RAM model runs on whatever the
lock can hold (measured: a 122B under RLIMIT_MEMLOCK=20 GiB clamps to a 20 GiB
arena and runs); without it a model whose weights do not fit RAM is refused in
0.2 s with the fix, never placed and left to swap.
* The MTP/nextn head is pinned at full residency OUTSIDE that budget (embedded and
separate-drafter shapes), and one store is shared safely by two models.
* The fills run on block 12's adaptive host-read transport; the buffered arm reads
STRAIGHT into the arena slot (no bounce, no H2D); on RDNA3_5 UMA the ladder
STARTS on that arm (+13.7% warm, +56-67% on a >RAM model).
* Prefill streams only what is not resident: a D2D for the used experts the store
holds, ONE coalesced span read + ONE H2D per maximal run of the rest, from 8
parallel readers (+63-67% prefill on a >RAM model), and the prefill logits are
unmoved (mean KLD -0.000000, same-top-p 99.990%).
Measured end to end: a 123.45 GiB model runs on this 123 GiB box; text identical in
every arm (627b2ebd7792 / f586785d7183 / 9ccf62ed39c3 / ee95c45231c3 / 347f9f6f715f /
9b259759672f); the tier is inert on a discrete RDNA4 box by measurement (zero GTT
census lines, gate-host-pool.sh 42/42 with this build, throughput within noise).
Kill switches: MOE_EXPERT_GTT=0 (no store at all, the delivery's previous behaviour
byte for byte), MOE_EXPERT_GTT_RO=0 (register writable), MOE_EXPERT_GTT_MLOCK=0 (do
not lock), MOE_EXPERT_GTT_ARENA=0|1 (force the shape), MOE_EXPERT_GTT_PREFILL=0 (the
per-expert prefill copy), MOE_EXPERT_GTT_FILL_DIRECT=0 (the bounce fill). Gate:
scripts/gate-uma-experts.sh (16 arms, 40 checks), plus scripts/gate-prefill-logits.sh
and scripts/gate-host-pool.sh on the discrete side. Scope: Linux, integrated GPUs;
every other backend keeps its behaviour (the code is gated on prop.integrated).
r277 amendment -- THE PLACEMENT READ QUEUE. Every placement fill (the host pool's
load-time prewarm, its one-shot band re-layout, a covering mirror, and this block's
GTT arena sizing seeds) is now a WORK QUEUE drained by the reader pool this block
already built for the prefill span stream (pf_read_pool/pf_read_submit/pf_read_wait),
so the reads run at depth instead of one at a time: a 576 KiB O_DIRECT read is
2 219 MiB/s at depth 1, 3 896 at 2, 5 307 at 3, 6 348 at 4 and 6 937 at 8, and the
drives plateau at ~6.8 GiB/s (SN7100) / ~14 GB/s (SN8100). Measured load-time
placement: host-pool prewarm 2 694 -> 6 103 MiB/s on the 91 GiB box (and 1 183 ->
6 103 on the default --load-mode mmap arm, because a placement read is O_DIRECT
whatever --load-mode says -- r273's rule for the mirror, now extended to every
placement fill; the DEMAND transport still follows --load-mode/MOE_HOST_POOL_DIO),
covering mirror 4 471 -> 6 640 MiB/s, and on the PCIe-5 box mirror 5 674 -> 13 555
and prewarm 3 296 -> 11 185 MiB/s (whole run -29 %/-40 %). Byte-identical text in
every arm; the pool census reports the queue, and MOE_EXPERT_FILL_QD=1 is the
depth-1 A/B. This block also carries the pool-base alignment shift the mirror
window needs (base_alloc/POOL_PLACE_ALIGN: `base` is congruent to the GGUF tensor
offset, so the mirror fill is ONE aligned window with no bounce and no memcpy;
measured 8 751 vs 5 674 MiB/s at depth 1), and a dead-code/warning cleanup of block
09/12/16 leftovers (6 unused functions, 6 write-only counters, one sign-compare --
no behaviour change; the slot-map occupancy invariant moved onto
pool_slot_assign_locked and the "nothing evicts, so no per-slot drain" rationale
onto the TODO ggml-org#87 note).
…t set served from ONE registered, mlocked region, sized by -lme
On an integrated GPU "VRAM" and host RAM are one DRAM, so r236 refused the whole
host-expert tier there and upstream disables the expert cache outright: a MoE model
whose expert set exceeds RAM simply cannot run. This block adds the tier that can:
ONE anonymous region (mmap + MADV_HUGEPAGE, hipHostRegister(Mapped|ReadOnly) once,
mlock'ed, sliced per (tensor, expert)) that the GPU reads in place at 230-233 GB/s.
* -lme N|auto sizes it (the same flag, units and heat ranking as the discrete
host-expert budget -- the one command line that carries across). The store's
extent is clamped to RLIMIT_MEMLOCK, a model that fits in RAM declines it, and
a model that cannot fit is REFUSED at load with the fix rather than left to
swap.
* The SHAPE follows the budget: a budget that covers the whole expert set PLACES
it (static, no eviction); a budget below it takes the ARENA (the store is the
cache's slot storage, the expert tensors stay as holes in the read-only model
mapping, LFRU residency serves every read, a miss is one buffered pread into the
vacated slot). Measured: the arena holds 13.6 GiB less non-reclaimable memory
than placement at -lme 4 on a 35B, which is what "cap the NON-SWAPPABLE memory
spent on MoE experts" means on an APU.
* -lme is also the opt-in for STREAMING: with it a >RAM model runs on whatever the
lock can hold (measured: a 122B under RLIMIT_MEMLOCK=20 GiB clamps to a 20 GiB
arena and runs); without it a model whose weights do not fit RAM is refused in
0.2 s with the fix, never placed and left to swap.
* The MTP/nextn head is pinned at full residency OUTSIDE that budget (embedded and
separate-drafter shapes), and one store is shared safely by two models.
* The fills run on block 12's adaptive host-read transport; the buffered arm reads
STRAIGHT into the arena slot (no bounce, no H2D); on RDNA3_5 UMA the ladder
STARTS on that arm (+13.7% warm, +56-67% on a >RAM model).
* Prefill streams only what is not resident: a D2D for the used experts the store
holds, ONE coalesced span read + ONE H2D per maximal run of the rest, from 8
parallel readers (+63-67% prefill on a >RAM model), and the prefill logits are
unmoved (mean KLD -0.000000, same-top-p 99.990%).
Measured end to end: a 123.45 GiB model runs on this 123 GiB box; text identical in
every arm (627b2ebd7792 / f586785d7183 / 9ccf62ed39c3 / ee95c45231c3 / 347f9f6f715f /
9b259759672f); the tier is inert on a discrete RDNA4 box by measurement (zero GTT
census lines, gate-host-pool.sh 42/42 with this build, throughput within noise).
Kill switches: MOE_EXPERT_GTT=0 (no store at all, the delivery's previous behaviour
byte for byte), MOE_EXPERT_GTT_RO=0 (register writable), MOE_EXPERT_GTT_MLOCK=0 (do
not lock), MOE_EXPERT_GTT_ARENA=0|1 (force the shape), MOE_EXPERT_GTT_PREFILL=0 (the
per-expert prefill copy), MOE_EXPERT_GTT_FILL_DIRECT=0 (the bounce fill). Gate:
scripts/gate-uma-experts.sh (16 arms, 40 checks), plus scripts/gate-prefill-logits.sh
and scripts/gate-host-pool.sh on the discrete side. Scope: Linux, integrated GPUs;
every other backend keeps its behaviour (the code is gated on prop.integrated).
r277 amendment -- THE PLACEMENT READ QUEUE. Every placement fill (the host pool's
load-time prewarm, its one-shot band re-layout, a covering mirror, and this block's
GTT arena sizing seeds) is now a WORK QUEUE drained by the reader pool this block
already built for the prefill span stream (pf_read_pool/pf_read_submit/pf_read_wait),
so the reads run at depth instead of one at a time: a 576 KiB O_DIRECT read is
2 219 MiB/s at depth 1, 3 896 at 2, 5 307 at 3, 6 348 at 4 and 6 937 at 8, and the
drives plateau at ~6.8 GiB/s (SN7100) / ~14 GB/s (SN8100). Measured load-time
placement: host-pool prewarm 2 694 -> 6 103 MiB/s on the 91 GiB box (and 1 183 ->
6 103 on the default --load-mode mmap arm, because a placement read is O_DIRECT
whatever --load-mode says -- r273's rule for the mirror, now extended to every
placement fill; the DEMAND transport still follows --load-mode/MOE_HOST_POOL_DIO),
covering mirror 4 471 -> 6 640 MiB/s, and on the PCIe-5 box mirror 5 674 -> 13 555
and prewarm 3 296 -> 11 185 MiB/s (whole run -29 %/-40 %). Byte-identical text in
every arm; the pool census reports the queue, and MOE_EXPERT_FILL_QD=1 is the
depth-1 A/B. This block also carries the pool-base alignment shift the mirror
window needs (base_alloc/POOL_PLACE_ALIGN: `base` is congruent to the GGUF tensor
offset, so the mirror fill is ONE aligned window with no bounce and no memcpy;
measured 8 751 vs 5 674 MiB/s at depth 1), and a dead-code/warning cleanup of block
09/12/16 leftovers (6 unused functions, 6 write-only counters, one sign-compare --
no behaviour change; the slot-map occupancy invariant moved onto
pool_slot_assign_locked and the "nothing evicts, so no per-slot drain" rationale
onto the TODO ggml-org#87 note).
…t set served from ONE registered, mlocked region, sized by -lme
On an integrated GPU "VRAM" and host RAM are one DRAM, so r236 refused the whole
host-expert tier there and upstream disables the expert cache outright: a MoE model
whose expert set exceeds RAM simply cannot run. This block adds the tier that can:
ONE anonymous region (mmap + MADV_HUGEPAGE, hipHostRegister(Mapped|ReadOnly) once,
mlock'ed, sliced per (tensor, expert)) that the GPU reads in place at 230-233 GB/s.
* -lme N|auto sizes it (the same flag, units and heat ranking as the discrete
host-expert budget -- the one command line that carries across). The store's
extent is clamped to RLIMIT_MEMLOCK, a model that fits in RAM declines it, and
a model that cannot fit is REFUSED at load with the fix rather than left to
swap.
* The SHAPE follows the budget: a budget that covers the whole expert set PLACES
it (static, no eviction); a budget below it takes the ARENA (the store is the
cache's slot storage, the expert tensors stay as holes in the read-only model
mapping, LFRU residency serves every read, a miss is one buffered pread into the
vacated slot). Measured: the arena holds 13.6 GiB less non-reclaimable memory
than placement at -lme 4 on a 35B, which is what "cap the NON-SWAPPABLE memory
spent on MoE experts" means on an APU.
* -lme is also the opt-in for STREAMING: with it a >RAM model runs on whatever the
lock can hold (measured: a 122B under RLIMIT_MEMLOCK=20 GiB clamps to a 20 GiB
arena and runs); without it a model whose weights do not fit RAM is refused in
0.2 s with the fix, never placed and left to swap.
* The MTP/nextn head is pinned at full residency OUTSIDE that budget (embedded and
separate-drafter shapes), and one store is shared safely by two models.
* The fills run on block 12's adaptive host-read transport; the buffered arm reads
STRAIGHT into the arena slot (no bounce, no H2D); on RDNA3_5 UMA the ladder
STARTS on that arm (+13.7% warm, +56-67% on a >RAM model).
* Prefill streams only what is not resident: a D2D for the used experts the store
holds, ONE coalesced span read + ONE H2D per maximal run of the rest, from 8
parallel readers (+63-67% prefill on a >RAM model), and the prefill logits are
unmoved (mean KLD -0.000000, same-top-p 99.990%).
Measured end to end: a 123.45 GiB model runs on this 123 GiB box; text identical in
every arm (627b2ebd7792 / f586785d7183 / 9ccf62ed39c3 / ee95c45231c3 / 347f9f6f715f /
9b259759672f); the tier is inert on a discrete RDNA4 box by measurement (zero GTT
census lines, gate-host-pool.sh 42/42 with this build, throughput within noise).
Kill switches: MOE_EXPERT_GTT=0 (no store at all, the delivery's previous behaviour
byte for byte), MOE_EXPERT_GTT_RO=0 (register writable), MOE_EXPERT_GTT_MLOCK=0 (do
not lock), MOE_EXPERT_GTT_ARENA=0|1 (force the shape), MOE_EXPERT_GTT_PREFILL=0 (the
per-expert prefill copy), MOE_EXPERT_GTT_FILL_DIRECT=0 (the bounce fill). Gate:
scripts/gate-uma-experts.sh (16 arms, 40 checks), plus scripts/gate-prefill-logits.sh
and scripts/gate-host-pool.sh on the discrete side. Scope: Linux, integrated GPUs;
every other backend keeps its behaviour (the code is gated on prop.integrated).
r277 amendment -- THE PLACEMENT READ QUEUE. Every placement fill (the host pool's
load-time prewarm, its one-shot band re-layout, a covering mirror, and this block's
GTT arena sizing seeds) is now a WORK QUEUE drained by the reader pool this block
already built for the prefill span stream (pf_read_pool/pf_read_submit/pf_read_wait),
so the reads run at depth instead of one at a time: a 576 KiB O_DIRECT read is
2 219 MiB/s at depth 1, 3 896 at 2, 5 307 at 3, 6 348 at 4 and 6 937 at 8, and the
drives plateau at ~6.8 GiB/s (SN7100) / ~14 GB/s (SN8100). Measured load-time
placement: host-pool prewarm 2 694 -> 6 103 MiB/s on the 91 GiB box (and 1 183 ->
6 103 on the default --load-mode mmap arm, because a placement read is O_DIRECT
whatever --load-mode says -- r273's rule for the mirror, now extended to every
placement fill; the DEMAND transport still follows --load-mode/MOE_HOST_POOL_DIO),
covering mirror 4 471 -> 6 640 MiB/s, and on the PCIe-5 box mirror 5 674 -> 13 555
and prewarm 3 296 -> 11 185 MiB/s (whole run -29 %/-40 %). Byte-identical text in
every arm; the pool census reports the queue, and MOE_EXPERT_FILL_QD=1 is the
depth-1 A/B. This block also carries the pool-base alignment shift the mirror
window needs (base_alloc/POOL_PLACE_ALIGN: `base` is congruent to the GGUF tensor
offset, so the mirror fill is ONE aligned window with no bounce and no memcpy;
measured 8 751 vs 5 674 MiB/s at depth 1), and a dead-code/warning cleanup of block
09/12/16 leftovers (6 unused functions, 6 write-only counters, one sign-compare --
no behaviour change; the slot-map occupancy invariant moved onto
pool_slot_assign_locked and the "nothing evicts, so no per-slot drain" rationale
onto the TODO ggml-org#87 note).
…t set served from ONE registered, mlocked region, sized by -lme
On an integrated GPU "VRAM" and host RAM are one DRAM, so r236 refused the whole
host-expert tier there and upstream disables the expert cache outright: a MoE model
whose expert set exceeds RAM simply cannot run. This block adds the tier that can:
ONE anonymous region (mmap + MADV_HUGEPAGE, hipHostRegister(Mapped|ReadOnly) once,
mlock'ed, sliced per (tensor, expert)) that the GPU reads in place at 230-233 GB/s.
* -lme N|auto sizes it (the same flag, units and heat ranking as the discrete
host-expert budget -- the one command line that carries across). The store's
extent is clamped to RLIMIT_MEMLOCK, a model that fits in RAM declines it, and
a model that cannot fit is REFUSED at load with the fix rather than left to
swap.
* The SHAPE follows the budget: a budget that covers the whole expert set PLACES
it (static, no eviction); a budget below it takes the ARENA (the store is the
cache's slot storage, the expert tensors stay as holes in the read-only model
mapping, LFRU residency serves every read, a miss is one buffered pread into the
vacated slot). Measured: the arena holds 13.6 GiB less non-reclaimable memory
than placement at -lme 4 on a 35B, which is what "cap the NON-SWAPPABLE memory
spent on MoE experts" means on an APU.
* -lme is also the opt-in for STREAMING: with it a >RAM model runs on whatever the
lock can hold (measured: a 122B under RLIMIT_MEMLOCK=20 GiB clamps to a 20 GiB
arena and runs); without it a model whose weights do not fit RAM is refused in
0.2 s with the fix, never placed and left to swap.
* The MTP/nextn head is pinned at full residency OUTSIDE that budget (embedded and
separate-drafter shapes), and one store is shared safely by two models.
* The fills run on block 12's adaptive host-read transport; the buffered arm reads
STRAIGHT into the arena slot (no bounce, no H2D); on RDNA3_5 UMA the ladder
STARTS on that arm (+13.7% warm, +56-67% on a >RAM model).
* Prefill streams only what is not resident: a D2D for the used experts the store
holds, ONE coalesced span read + ONE H2D per maximal run of the rest, from 8
parallel readers (+63-67% prefill on a >RAM model), and the prefill logits are
unmoved (mean KLD -0.000000, same-top-p 99.990%).
Measured end to end: a 123.45 GiB model runs on this 123 GiB box; text identical in
every arm (627b2ebd7792 / f586785d7183 / 9ccf62ed39c3 / ee95c45231c3 / 347f9f6f715f /
9b259759672f); the tier is inert on a discrete RDNA4 box by measurement (zero GTT
census lines, gate-host-pool.sh 42/42 with this build, throughput within noise).
Kill switches: MOE_EXPERT_GTT=0 (no store at all, the delivery's previous behaviour
byte for byte), MOE_EXPERT_GTT_RO=0 (register writable), MOE_EXPERT_GTT_MLOCK=0 (do
not lock), MOE_EXPERT_GTT_ARENA=0|1 (force the shape), MOE_EXPERT_GTT_PREFILL=0 (the
per-expert prefill copy), MOE_EXPERT_GTT_FILL_DIRECT=0 (the bounce fill). Gate:
scripts/gate-uma-experts.sh (16 arms, 40 checks), plus scripts/gate-prefill-logits.sh
and scripts/gate-host-pool.sh on the discrete side. Scope: Linux, integrated GPUs;
every other backend keeps its behaviour (the code is gated on prop.integrated).
r277 amendment -- THE PLACEMENT READ QUEUE. Every placement fill (the host pool's
load-time prewarm, its one-shot band re-layout, a covering mirror, and this block's
GTT arena sizing seeds) is now a WORK QUEUE drained by the reader pool this block
already built for the prefill span stream (pf_read_pool/pf_read_submit/pf_read_wait),
so the reads run at depth instead of one at a time: a 576 KiB O_DIRECT read is
2 219 MiB/s at depth 1, 3 896 at 2, 5 307 at 3, 6 348 at 4 and 6 937 at 8, and the
drives plateau at ~6.8 GiB/s (SN7100) / ~14 GB/s (SN8100). Measured load-time
placement: host-pool prewarm 2 694 -> 6 103 MiB/s on the 91 GiB box (and 1 183 ->
6 103 on the default --load-mode mmap arm, because a placement read is O_DIRECT
whatever --load-mode says -- r273's rule for the mirror, now extended to every
placement fill; the DEMAND transport still follows --load-mode/MOE_HOST_POOL_DIO),
covering mirror 4 471 -> 6 640 MiB/s, and on the PCIe-5 box mirror 5 674 -> 13 555
and prewarm 3 296 -> 11 185 MiB/s (whole run -29 %/-40 %). Byte-identical text in
every arm; the pool census reports the queue, and MOE_EXPERT_FILL_QD=1 is the
depth-1 A/B. This block also carries the pool-base alignment shift the mirror
window needs (base_alloc/POOL_PLACE_ALIGN: `base` is congruent to the GGUF tensor
offset, so the mirror fill is ONE aligned window with no bounce and no memcpy;
measured 8 751 vs 5 674 MiB/s at depth 1), and a dead-code/warning cleanup of block
09/12/16 leftovers (6 unused functions, 6 write-only counters, one sign-compare --
no behaviour change; the slot-map occupancy invariant moved onto
pool_slot_assign_locked and the "nothing evicts, so no per-slot drain" rationale
onto the TODO ggml-org#87 note).
…t set served from ONE registered, mlocked region, sized by -lme
On an integrated GPU "VRAM" and host RAM are one DRAM, so r236 refused the whole
host-expert tier there and upstream disables the expert cache outright: a MoE model
whose expert set exceeds RAM simply cannot run. This block adds the tier that can:
ONE anonymous region (mmap + MADV_HUGEPAGE, hipHostRegister(Mapped|ReadOnly) once,
mlock'ed, sliced per (tensor, expert)) that the GPU reads in place at 230-233 GB/s.
* -lme N|auto sizes it (the same flag, units and heat ranking as the discrete
host-expert budget -- the one command line that carries across). The store's
extent is clamped to RLIMIT_MEMLOCK, a model that fits in RAM declines it, and
a model that cannot fit is REFUSED at load with the fix rather than left to
swap.
* The SHAPE follows the budget: a budget that covers the whole expert set PLACES
it (static, no eviction); a budget below it takes the ARENA (the store is the
cache's slot storage, the expert tensors stay as holes in the read-only model
mapping, LFRU residency serves every read, a miss is one buffered pread into the
vacated slot). Measured: the arena holds 13.6 GiB less non-reclaimable memory
than placement at -lme 4 on a 35B, which is what "cap the NON-SWAPPABLE memory
spent on MoE experts" means on an APU.
* -lme is also the opt-in for STREAMING: with it a >RAM model runs on whatever the
lock can hold (measured: a 122B under RLIMIT_MEMLOCK=20 GiB clamps to a 20 GiB
arena and runs); without it a model whose weights do not fit RAM is refused in
0.2 s with the fix, never placed and left to swap.
* The MTP/nextn head is pinned at full residency OUTSIDE that budget (embedded and
separate-drafter shapes), and one store is shared safely by two models.
* The fills run on block 12's adaptive host-read transport; the buffered arm reads
STRAIGHT into the arena slot (no bounce, no H2D); on RDNA3_5 UMA the ladder
STARTS on that arm (+13.7% warm, +56-67% on a >RAM model).
* Prefill streams only what is not resident: a D2D for the used experts the store
holds, ONE coalesced span read + ONE H2D per maximal run of the rest, from 8
parallel readers (+63-67% prefill on a >RAM model), and the prefill logits are
unmoved (mean KLD -0.000000, same-top-p 99.990%).
Measured end to end: a 123.45 GiB model runs on this 123 GiB box; text identical in
every arm (627b2ebd7792 / f586785d7183 / 9ccf62ed39c3 / ee95c45231c3 / 347f9f6f715f /
9b259759672f); the tier is inert on a discrete RDNA4 box by measurement (zero GTT
census lines, gate-host-pool.sh 42/42 with this build, throughput within noise).
Kill switches: MOE_EXPERT_GTT=0 (no store at all, the delivery's previous behaviour
byte for byte), MOE_EXPERT_GTT_RO=0 (register writable), MOE_EXPERT_GTT_MLOCK=0 (do
not lock), MOE_EXPERT_GTT_ARENA=0|1 (force the shape), MOE_EXPERT_GTT_PREFILL=0 (the
per-expert prefill copy), MOE_EXPERT_GTT_FILL_DIRECT=0 (the bounce fill). Gate:
scripts/gate-uma-experts.sh (16 arms, 40 checks), plus scripts/gate-prefill-logits.sh
and scripts/gate-host-pool.sh on the discrete side. Scope: Linux, integrated GPUs;
every other backend keeps its behaviour (the code is gated on prop.integrated).
r277 amendment -- THE PLACEMENT READ QUEUE. Every placement fill (the host pool's
load-time prewarm, its one-shot band re-layout, a covering mirror, and this block's
GTT arena sizing seeds) is now a WORK QUEUE drained by the reader pool this block
already built for the prefill span stream (pf_read_pool/pf_read_submit/pf_read_wait),
so the reads run at depth instead of one at a time: a 576 KiB O_DIRECT read is
2 219 MiB/s at depth 1, 3 896 at 2, 5 307 at 3, 6 348 at 4 and 6 937 at 8, and the
drives plateau at ~6.8 GiB/s (SN7100) / ~14 GB/s (SN8100). Measured load-time
placement: host-pool prewarm 2 694 -> 6 103 MiB/s on the 91 GiB box (and 1 183 ->
6 103 on the default --load-mode mmap arm, because a placement read is O_DIRECT
whatever --load-mode says -- r273's rule for the mirror, now extended to every
placement fill; the DEMAND transport still follows --load-mode/MOE_HOST_POOL_DIO),
covering mirror 4 471 -> 6 640 MiB/s, and on the PCIe-5 box mirror 5 674 -> 13 555
and prewarm 3 296 -> 11 185 MiB/s (whole run -29 %/-40 %). Byte-identical text in
every arm; the pool census reports the queue, and MOE_EXPERT_FILL_QD=1 is the
depth-1 A/B. This block also carries the pool-base alignment shift the mirror
window needs (base_alloc/POOL_PLACE_ALIGN: `base` is congruent to the GGUF tensor
offset, so the mirror fill is ONE aligned window with no bounce and no memcpy;
measured 8 751 vs 5 674 MiB/s at depth 1), and a dead-code/warning cleanup of block
09/12/16 leftovers (6 unused functions, 6 write-only counters, one sign-compare --
no behaviour change; the slot-map occupancy invariant moved onto
pool_slot_assign_locked and the "nothing evicts, so no per-slot drain" rationale
onto the TODO ggml-org#87 note).
…t set served from ONE registered, mlocked region, sized by -lme
On an integrated GPU "VRAM" and host RAM are one DRAM, so r236 refused the whole
host-expert tier there and upstream disables the expert cache outright: a MoE model
whose expert set exceeds RAM simply cannot run. This block adds the tier that can:
ONE anonymous region (mmap + MADV_HUGEPAGE, hipHostRegister(Mapped|ReadOnly) once,
mlock'ed, sliced per (tensor, expert)) that the GPU reads in place at 230-233 GB/s.
* -lme N|auto sizes it (the same flag, units and heat ranking as the discrete
host-expert budget -- the one command line that carries across). The store's
extent is clamped to RLIMIT_MEMLOCK, a model that fits in RAM declines it, and
a model that cannot fit is REFUSED at load with the fix rather than left to
swap.
* The SHAPE follows the budget: a budget that covers the whole expert set PLACES
it (static, no eviction); a budget below it takes the ARENA (the store is the
cache's slot storage, the expert tensors stay as holes in the read-only model
mapping, LFRU residency serves every read, a miss is one buffered pread into the
vacated slot). Measured: the arena holds 13.6 GiB less non-reclaimable memory
than placement at -lme 4 on a 35B, which is what "cap the NON-SWAPPABLE memory
spent on MoE experts" means on an APU.
* -lme is also the opt-in for STREAMING: with it a >RAM model runs on whatever the
lock can hold (measured: a 122B under RLIMIT_MEMLOCK=20 GiB clamps to a 20 GiB
arena and runs); without it a model whose weights do not fit RAM is refused in
0.2 s with the fix, never placed and left to swap.
* The MTP/nextn head is pinned at full residency OUTSIDE that budget (embedded and
separate-drafter shapes), and one store is shared safely by two models.
* The fills run on block 12's adaptive host-read transport; the buffered arm reads
STRAIGHT into the arena slot (no bounce, no H2D); on RDNA3_5 UMA the ladder
STARTS on that arm (+13.7% warm, +56-67% on a >RAM model).
* Prefill streams only what is not resident: a D2D for the used experts the store
holds, ONE coalesced span read + ONE H2D per maximal run of the rest, from 8
parallel readers (+63-67% prefill on a >RAM model), and the prefill logits are
unmoved (mean KLD -0.000000, same-top-p 99.990%).
Measured end to end: a 123.45 GiB model runs on this 123 GiB box; text identical in
every arm (627b2ebd7792 / f586785d7183 / 9ccf62ed39c3 / ee95c45231c3 / 347f9f6f715f /
9b259759672f); the tier is inert on a discrete RDNA4 box by measurement (zero GTT
census lines, gate-host-pool.sh 42/42 with this build, throughput within noise).
Kill switches: MOE_EXPERT_GTT=0 (no store at all, the delivery's previous behaviour
byte for byte), MOE_EXPERT_GTT_RO=0 (register writable), MOE_EXPERT_GTT_MLOCK=0 (do
not lock), MOE_EXPERT_GTT_ARENA=0|1 (force the shape), MOE_EXPERT_GTT_PREFILL=0 (the
per-expert prefill copy), MOE_EXPERT_GTT_FILL_DIRECT=0 (the bounce fill). Gate:
scripts/gate-uma-experts.sh (16 arms, 40 checks), plus scripts/gate-prefill-logits.sh
and scripts/gate-host-pool.sh on the discrete side. Scope: Linux, integrated GPUs;
every other backend keeps its behaviour (the code is gated on prop.integrated).
r277 amendment -- THE PLACEMENT READ QUEUE. Every placement fill (the host pool's
load-time prewarm, its one-shot band re-layout, a covering mirror, and this block's
GTT arena sizing seeds) is now a WORK QUEUE drained by the reader pool this block
already built for the prefill span stream (pf_read_pool/pf_read_submit/pf_read_wait),
so the reads run at depth instead of one at a time: a 576 KiB O_DIRECT read is
2 219 MiB/s at depth 1, 3 896 at 2, 5 307 at 3, 6 348 at 4 and 6 937 at 8, and the
drives plateau at ~6.8 GiB/s (SN7100) / ~14 GB/s (SN8100). Measured load-time
placement: host-pool prewarm 2 694 -> 6 103 MiB/s on the 91 GiB box (and 1 183 ->
6 103 on the default --load-mode mmap arm, because a placement read is O_DIRECT
whatever --load-mode says -- r273's rule for the mirror, now extended to every
placement fill; the DEMAND transport still follows --load-mode/MOE_HOST_POOL_DIO),
covering mirror 4 471 -> 6 640 MiB/s, and on the PCIe-5 box mirror 5 674 -> 13 555
and prewarm 3 296 -> 11 185 MiB/s (whole run -29 %/-40 %). Byte-identical text in
every arm; the pool census reports the queue, and MOE_EXPERT_FILL_QD=1 is the
depth-1 A/B. This block also carries the pool-base alignment shift the mirror
window needs (base_alloc/POOL_PLACE_ALIGN: `base` is congruent to the GGUF tensor
offset, so the mirror fill is ONE aligned window with no bounce and no memcpy;
measured 8 751 vs 5 674 MiB/s at depth 1), and a dead-code/warning cleanup of block
09/12/16 leftovers (6 unused functions, 6 write-only counters, one sign-compare --
no behaviour change; the slot-map occupancy invariant moved onto
pool_slot_assign_locked and the "nothing evicts, so no per-slot drain" rationale
onto the TODO ggml-org#87 note).
…t set served from ONE registered, mlocked region, sized by -lme
On an integrated GPU "VRAM" and host RAM are one DRAM, so r236 refused the whole
host-expert tier there and upstream disables the expert cache outright: a MoE model
whose expert set exceeds RAM simply cannot run. This block adds the tier that can:
ONE anonymous region (mmap + MADV_HUGEPAGE, hipHostRegister(Mapped|ReadOnly) once,
mlock'ed, sliced per (tensor, expert)) that the GPU reads in place at 230-233 GB/s.
* -lme N|auto sizes it (the same flag, units and heat ranking as the discrete
host-expert budget -- the one command line that carries across). The store's
extent is clamped to RLIMIT_MEMLOCK, a model that fits in RAM declines it, and
a model that cannot fit is REFUSED at load with the fix rather than left to
swap.
* The SHAPE follows the budget: a budget that covers the whole expert set PLACES
it (static, no eviction); a budget below it takes the ARENA (the store is the
cache's slot storage, the expert tensors stay as holes in the read-only model
mapping, LFRU residency serves every read, a miss is one buffered pread into the
vacated slot). Measured: the arena holds 13.6 GiB less non-reclaimable memory
than placement at -lme 4 on a 35B, which is what "cap the NON-SWAPPABLE memory
spent on MoE experts" means on an APU.
* -lme is also the opt-in for STREAMING: with it a >RAM model runs on whatever the
lock can hold (measured: a 122B under RLIMIT_MEMLOCK=20 GiB clamps to a 20 GiB
arena and runs); without it a model whose weights do not fit RAM is refused in
0.2 s with the fix, never placed and left to swap.
* The MTP/nextn head is pinned at full residency OUTSIDE that budget (embedded and
separate-drafter shapes), and one store is shared safely by two models.
* The fills run on block 12's adaptive host-read transport; the buffered arm reads
STRAIGHT into the arena slot (no bounce, no H2D); on RDNA3_5 UMA the ladder
STARTS on that arm (+13.7% warm, +56-67% on a >RAM model).
* Prefill streams only what is not resident: a D2D for the used experts the store
holds, ONE coalesced span read + ONE H2D per maximal run of the rest, from 8
parallel readers (+63-67% prefill on a >RAM model), and the prefill logits are
unmoved (mean KLD -0.000000, same-top-p 99.990%).
Measured end to end: a 123.45 GiB model runs on this 123 GiB box; text identical in
every arm (627b2ebd7792 / f586785d7183 / 9ccf62ed39c3 / ee95c45231c3 / 347f9f6f715f /
9b259759672f); the tier is inert on a discrete RDNA4 box by measurement (zero GTT
census lines, gate-host-pool.sh 42/42 with this build, throughput within noise).
Kill switches: MOE_EXPERT_GTT=0 (no store at all, the delivery's previous behaviour
byte for byte), MOE_EXPERT_GTT_RO=0 (register writable), MOE_EXPERT_GTT_MLOCK=0 (do
not lock), MOE_EXPERT_GTT_ARENA=0|1 (force the shape), MOE_EXPERT_GTT_PREFILL=0 (the
per-expert prefill copy), MOE_EXPERT_GTT_FILL_DIRECT=0 (the bounce fill). Gate:
scripts/gate-uma-experts.sh (16 arms, 40 checks), plus scripts/gate-prefill-logits.sh
and scripts/gate-host-pool.sh on the discrete side. Scope: Linux, integrated GPUs;
every other backend keeps its behaviour (the code is gated on prop.integrated).
r277 amendment -- THE PLACEMENT READ QUEUE. Every placement fill (the host pool's
load-time prewarm, its one-shot band re-layout, a covering mirror, and this block's
GTT arena sizing seeds) is now a WORK QUEUE drained by the reader pool this block
already built for the prefill span stream (pf_read_pool/pf_read_submit/pf_read_wait),
so the reads run at depth instead of one at a time: a 576 KiB O_DIRECT read is
2 219 MiB/s at depth 1, 3 896 at 2, 5 307 at 3, 6 348 at 4 and 6 937 at 8, and the
drives plateau at ~6.8 GiB/s (SN7100) / ~14 GB/s (SN8100). Measured load-time
placement: host-pool prewarm 2 694 -> 6 103 MiB/s on the 91 GiB box (and 1 183 ->
6 103 on the default --load-mode mmap arm, because a placement read is O_DIRECT
whatever --load-mode says -- r273's rule for the mirror, now extended to every
placement fill; the DEMAND transport still follows --load-mode/MOE_HOST_POOL_DIO),
covering mirror 4 471 -> 6 640 MiB/s, and on the PCIe-5 box mirror 5 674 -> 13 555
and prewarm 3 296 -> 11 185 MiB/s (whole run -29 %/-40 %). Byte-identical text in
every arm; the pool census reports the queue, and MOE_EXPERT_FILL_QD=1 is the
depth-1 A/B. This block also carries the pool-base alignment shift the mirror
window needs (base_alloc/POOL_PLACE_ALIGN: `base` is congruent to the GGUF tensor
offset, so the mirror fill is ONE aligned window with no bounce and no memcpy;
measured 8 751 vs 5 674 MiB/s at depth 1), and a dead-code/warning cleanup of block
09/12/16 leftovers (6 unused functions, 6 write-only counters, one sign-compare --
no behaviour change; the slot-map occupancy invariant moved onto
pool_slot_assign_locked and the "nothing evicts, so no per-slot drain" rationale
onto the TODO ggml-org#87 note).
…t set served from ONE registered, mlocked region, sized by -lme
On an integrated GPU "VRAM" and host RAM are one DRAM, so r236 refused the whole
host-expert tier there and upstream disables the expert cache outright: a MoE model
whose expert set exceeds RAM simply cannot run. This block adds the tier that can:
ONE anonymous region (mmap + MADV_HUGEPAGE, hipHostRegister(Mapped|ReadOnly) once,
mlock'ed, sliced per (tensor, expert)) that the GPU reads in place at 230-233 GB/s.
* -lme N|auto sizes it (the same flag, units and heat ranking as the discrete
host-expert budget -- the one command line that carries across). The store's
extent is clamped to RLIMIT_MEMLOCK, a model that fits in RAM declines it, and
a model that cannot fit is REFUSED at load with the fix rather than left to
swap.
* The SHAPE follows the budget: a budget that covers the whole expert set PLACES
it (static, no eviction); a budget below it takes the ARENA (the store is the
cache's slot storage, the expert tensors stay as holes in the read-only model
mapping, LFRU residency serves every read, a miss is one buffered pread into the
vacated slot). Measured: the arena holds 13.6 GiB less non-reclaimable memory
than placement at -lme 4 on a 35B, which is what "cap the NON-SWAPPABLE memory
spent on MoE experts" means on an APU.
* -lme is also the opt-in for STREAMING: with it a >RAM model runs on whatever the
lock can hold (measured: a 122B under RLIMIT_MEMLOCK=20 GiB clamps to a 20 GiB
arena and runs); without it a model whose weights do not fit RAM is refused in
0.2 s with the fix, never placed and left to swap.
* The MTP/nextn head is pinned at full residency OUTSIDE that budget (embedded and
separate-drafter shapes), and one store is shared safely by two models.
* The fills run on block 12's adaptive host-read transport; the buffered arm reads
STRAIGHT into the arena slot (no bounce, no H2D); on RDNA3_5 UMA the ladder
STARTS on that arm (+13.7% warm, +56-67% on a >RAM model).
* Prefill streams only what is not resident: a D2D for the used experts the store
holds, ONE coalesced span read + ONE H2D per maximal run of the rest, from 8
parallel readers (+63-67% prefill on a >RAM model), and the prefill logits are
unmoved (mean KLD -0.000000, same-top-p 99.990%).
Measured end to end: a 123.45 GiB model runs on this 123 GiB box; text identical in
every arm (627b2ebd7792 / f586785d7183 / 9ccf62ed39c3 / ee95c45231c3 / 347f9f6f715f /
9b259759672f); the tier is inert on a discrete RDNA4 box by measurement (zero GTT
census lines, gate-host-pool.sh 42/42 with this build, throughput within noise).
Kill switches: MOE_EXPERT_GTT=0 (no store at all, the delivery's previous behaviour
byte for byte), MOE_EXPERT_GTT_RO=0 (register writable), MOE_EXPERT_GTT_MLOCK=0 (do
not lock), MOE_EXPERT_GTT_ARENA=0|1 (force the shape), MOE_EXPERT_GTT_PREFILL=0 (the
per-expert prefill copy), MOE_EXPERT_GTT_FILL_DIRECT=0 (the bounce fill). Gate:
scripts/gate-uma-experts.sh (16 arms, 40 checks), plus scripts/gate-prefill-logits.sh
and scripts/gate-host-pool.sh on the discrete side. Scope: Linux, integrated GPUs;
every other backend keeps its behaviour (the code is gated on prop.integrated).
r277 amendment -- THE PLACEMENT READ QUEUE. Every placement fill (the host pool's
load-time prewarm, its one-shot band re-layout, a covering mirror, and this block's
GTT arena sizing seeds) is now a WORK QUEUE drained by the reader pool this block
already built for the prefill span stream (pf_read_pool/pf_read_submit/pf_read_wait),
so the reads run at depth instead of one at a time: a 576 KiB O_DIRECT read is
2 219 MiB/s at depth 1, 3 896 at 2, 5 307 at 3, 6 348 at 4 and 6 937 at 8, and the
drives plateau at ~6.8 GiB/s (SN7100) / ~14 GB/s (SN8100). Measured load-time
placement: host-pool prewarm 2 694 -> 6 103 MiB/s on the 91 GiB box (and 1 183 ->
6 103 on the default --load-mode mmap arm, because a placement read is O_DIRECT
whatever --load-mode says -- r273's rule for the mirror, now extended to every
placement fill; the DEMAND transport still follows --load-mode/MOE_HOST_POOL_DIO),
covering mirror 4 471 -> 6 640 MiB/s, and on the PCIe-5 box mirror 5 674 -> 13 555
and prewarm 3 296 -> 11 185 MiB/s (whole run -29 %/-40 %). Byte-identical text in
every arm; the pool census reports the queue, and MOE_EXPERT_FILL_QD=1 is the
depth-1 A/B. This block also carries the pool-base alignment shift the mirror
window needs (base_alloc/POOL_PLACE_ALIGN: `base` is congruent to the GGUF tensor
offset, so the mirror fill is ONE aligned window with no bounce and no memcpy;
measured 8 751 vs 5 674 MiB/s at depth 1), and a dead-code/warning cleanup of block
09/12/16 leftovers (6 unused functions, 6 write-only counters, one sign-compare --
no behaviour change; the slot-map occupancy invariant moved onto
pool_slot_assign_locked and the "nothing evicts, so no per-slot drain" rationale
onto the TODO ggml-org#87 note).
…t set served from ONE registered, mlocked region, sized by -lme
On an integrated GPU "VRAM" and host RAM are one DRAM, so r236 refused the whole
host-expert tier there and upstream disables the expert cache outright: a MoE model
whose expert set exceeds RAM simply cannot run. This block adds the tier that can:
ONE anonymous region (mmap + MADV_HUGEPAGE, hipHostRegister(Mapped|ReadOnly) once,
mlock'ed, sliced per (tensor, expert)) that the GPU reads in place at 230-233 GB/s.
* -lme N|auto sizes it (the same flag, units and heat ranking as the discrete
host-expert budget -- the one command line that carries across). The store's
extent is clamped to RLIMIT_MEMLOCK, a model that fits in RAM declines it, and
a model that cannot fit is REFUSED at load with the fix rather than left to
swap.
* The SHAPE follows the budget: a budget that covers the whole expert set PLACES
it (static, no eviction); a budget below it takes the ARENA (the store is the
cache's slot storage, the expert tensors stay as holes in the read-only model
mapping, LFRU residency serves every read, a miss is one buffered pread into the
vacated slot). Measured: the arena holds 13.6 GiB less non-reclaimable memory
than placement at -lme 4 on a 35B, which is what "cap the NON-SWAPPABLE memory
spent on MoE experts" means on an APU.
* -lme is also the opt-in for STREAMING: with it a >RAM model runs on whatever the
lock can hold (measured: a 122B under RLIMIT_MEMLOCK=20 GiB clamps to a 20 GiB
arena and runs); without it a model whose weights do not fit RAM is refused in
0.2 s with the fix, never placed and left to swap.
* The MTP/nextn head is pinned at full residency OUTSIDE that budget (embedded and
separate-drafter shapes), and one store is shared safely by two models.
* The fills run on block 12's adaptive host-read transport; the buffered arm reads
STRAIGHT into the arena slot (no bounce, no H2D); on RDNA3_5 UMA the ladder
STARTS on that arm (+13.7% warm, +56-67% on a >RAM model).
* Prefill streams only what is not resident: a D2D for the used experts the store
holds, ONE coalesced span read + ONE H2D per maximal run of the rest, from 8
parallel readers (+63-67% prefill on a >RAM model), and the prefill logits are
unmoved (mean KLD -0.000000, same-top-p 99.990%).
Measured end to end: a 123.45 GiB model runs on this 123 GiB box; text identical in
every arm (627b2ebd7792 / f586785d7183 / 9ccf62ed39c3 / ee95c45231c3 / 347f9f6f715f /
9b259759672f); the tier is inert on a discrete RDNA4 box by measurement (zero GTT
census lines, gate-host-pool.sh 42/42 with this build, throughput within noise).
Kill switches: MOE_EXPERT_GTT=0 (no store at all, the delivery's previous behaviour
byte for byte), MOE_EXPERT_GTT_RO=0 (register writable), MOE_EXPERT_GTT_MLOCK=0 (do
not lock), MOE_EXPERT_GTT_ARENA=0|1 (force the shape), MOE_EXPERT_GTT_PREFILL=0 (the
per-expert prefill copy), MOE_EXPERT_GTT_FILL_DIRECT=0 (the bounce fill). Gate:
scripts/gate-uma-experts.sh (16 arms, 40 checks), plus scripts/gate-prefill-logits.sh
and scripts/gate-host-pool.sh on the discrete side. Scope: Linux, integrated GPUs;
every other backend keeps its behaviour (the code is gated on prop.integrated).
r277 amendment -- THE PLACEMENT READ QUEUE. Every placement fill (the host pool's
load-time prewarm, its one-shot band re-layout, a covering mirror, and this block's
GTT arena sizing seeds) is now a WORK QUEUE drained by the reader pool this block
already built for the prefill span stream (pf_read_pool/pf_read_submit/pf_read_wait),
so the reads run at depth instead of one at a time: a 576 KiB O_DIRECT read is
2 219 MiB/s at depth 1, 3 896 at 2, 5 307 at 3, 6 348 at 4 and 6 937 at 8, and the
drives plateau at ~6.8 GiB/s (SN7100) / ~14 GB/s (SN8100). Measured load-time
placement: host-pool prewarm 2 694 -> 6 103 MiB/s on the 91 GiB box (and 1 183 ->
6 103 on the default --load-mode mmap arm, because a placement read is O_DIRECT
whatever --load-mode says -- r273's rule for the mirror, now extended to every
placement fill; the DEMAND transport still follows --load-mode/MOE_HOST_POOL_DIO),
covering mirror 4 471 -> 6 640 MiB/s, and on the PCIe-5 box mirror 5 674 -> 13 555
and prewarm 3 296 -> 11 185 MiB/s (whole run -29 %/-40 %). Byte-identical text in
every arm; the pool census reports the queue, and MOE_EXPERT_FILL_QD=1 is the
depth-1 A/B. This block also carries the pool-base alignment shift the mirror
window needs (base_alloc/POOL_PLACE_ALIGN: `base` is congruent to the GGUF tensor
offset, so the mirror fill is ONE aligned window with no bounce and no memcpy;
measured 8 751 vs 5 674 MiB/s at depth 1), and a dead-code/warning cleanup of block
09/12/16 leftovers (6 unused functions, 6 write-only counters, one sign-compare --
no behaviour change; the slot-map occupancy invariant moved onto
pool_slot_assign_locked and the "nothing evicts, so no per-slot drain" rationale
onto the TODO ggml-org#87 note).


The tokenization process of LLaMA is filled with magic numbers and not easily replicable. However, I have found that using the SentencePiece library works well. It's possible that the original LLaMA model also used SentencePiece for its tokenization.
test prompt: '我静静的坐在雨中,思考着'
I sit quietly in the rain, thinking
This sentence was heavily tokenized to <0x??>, making it very difficult to replicate.