Skip to content

llama : deny -sm tensor for arches with moe amax rescaling - #31081

Merged
ggerganov merged 1 commit into
masterfrom
gg/split-state-pool-1d
Oct 24, 2026
Merged

ggerganov merged 1 commit into
masterfrom
gg/split-state-pool-1d

Conversation

@ggerganov

Copy link
Copy Markdown
Member

Overview

llm_arch_supports_sm_tensor denies --split-mode tensor per architecture. The MoE amax rescaling from #30861 builds a POOL_1D max reduction with k = s = ne[0], so the pooling window spans the entire matmul row. Under --split-mode tensor the MoE intermediate is split along axis 0, which means no device holds a complete row: each one pools over its own slice and gets a partial max. The handle_pool_1d split-state case reported MIRRORED for that input, but the values are not the same per device, so the claim is false and the rescale is not guaranteed to cancel once the partials are summed.

This removes the POOL_1D case from the Meta backend, restoring the previous grouping with the conv and pool ops, and adds mellum and flint to the deny list next to mistral4. Both sites carry a shared [TAG_MOE_AMAX_SCALE] marker so the entries can be dropped together when the rescaling goes away.

Additional information

The graph still applies the rescaling to cur and undoes it on the down-projection output; only the tensor-split path is disabled. test-llama-archs reported NMSE around 9.6e-08 for flint and 9.2e-08 for mellum on the meta backend before this change and now skips both, like every other denied architecture. All 534 cases pass.

Requirements

The amax POOL_1D reduction spans the whole matmul row, so a device cannot
compute it from an axis-0 split. The Meta split-state case reported
MIRRORED, which gives each device a partial max of its own slice. Drop
that case and deny -sm tensor for the arches which build the amax graph,
see [TAG_MOE_AMAX_SCALE].

Assisted-by: dsh:llama.cpp/ggml-org/Qwen3.8-Flash-Next-GGUF (MacBook, M5 Max, 128GB)
@github-actions github-actions Bot added the ggml changes relating to the ggml tensor library for machine learning label Oct 24, 2026
@ggerganov
ggerganov marked this pull request as ready for review October 24, 2026 08:39
@ggerganov
ggerganov merged commit 3032209 into master Oct 24, 2026
28 of 34 checks passed
@ggerganov
ggerganov deleted the gg/split-state-pool-1d branch October 24, 2026 10:48
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 25, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 25, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 26, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 26, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 26, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 26, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 26, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 26, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 26, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 26, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 27, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 27, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 27, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 27, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 27, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 27, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 27, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 27, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 27, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 27, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 29, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 29, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 30, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
edwardyoon pushed a commit to edwardyoon/focus-llama that referenced this pull request Oct 30, 2026
…31081)

The amax POOL_1D reduction spans the whole matmul row, so a device cannot
compute it from an axis-0 split. The Meta split-state case reported
MIRRORED, which gives each device a partial max of its own slice. Drop
that case and deny -sm tensor for the arches which build the amax graph,
see [TAG_MOE_AMAX_SCALE].

Assisted-by: dsh:llama.cpp/ggml-org/Qwen3.8-Flash-Next-GGUF (MacBook, M5 Max, 128GB)
lukekim added a commit to spiceai/llama.cpp that referenced this pull request Oct 30, 2026
…21)

Upstream removed handle_pool_1d in ggml-org#31081 (an axis-0 split gives each
device only a partial max) and moved GGML_OP_POOL_1D into the generic
scalar-only case. The b11984 merge kept the lambda but took upstream's
case, so it is never called and GCC's -Werror=unused-but-set-variable
fails the ubuntu build. POOL_1D is now handled exactly as upstream
b11999 handles it.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 30, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 30, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 30, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 30, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 30, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 31, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 31, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 31, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 31, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 31, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 31, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 1, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 1, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 1, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 1, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 1, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 1, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 1, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 1, 2026
… per-device scalar)

This block is a LOCAL, TEMPORARY relaxation of upstream behaviour, not a
feature of the delivery.  It exists so the MoE amax arches (flint, mellum,
mistral4) can run -sm tensor today; it is expected to be replaced once
upstream lands a real fix, and it can be dropped without touching any other
block.  Limitations are recorded in patches/README.md (block 14) and
GREEDY-PURITY.md; do not treat `-sm relaxed-tensor` as a supported mode.

Why upstream refuses today: ggml-org#30861/ggml-org#31081 -- the MoE amax rescale pools a
whole matmul row (`pool_1d(abs(cur), MAX, k = s = n_ff_exp)`) to divide `cur`
by a power of two and undo it on the down-projection output.  Under
`-sm tensor` no device holds a complete row, so each one can only compute the
max of its own slice.  ggml-org#31081 removed the Meta POOL_1D case (which claimed
MIRRORED, a false claim) and denied -sm tensor for those three arches.

Add a split mode instead of a blanket deny.  `-sm relaxed-tensor` places the
weights exactly like `-sm tensor` (same Meta wrapper, FA required, expert
tables split: 0 extra VRAM) but also admits a replicated tensor whose values
differ per device:

  - ggml: new GGML_BACKEND_SPLIT_AXIS_PER_DEVICE = 12 -- same shape/positions
    everywhere, per-device values.  `handle_pool_1d` produces it for an
    axis-0 split (whole-row MAX only), `handle_bin_bcast` lets it be consumed
    elementwise and broadcast, and every copy/gather/read-back path aborts with
    a message instead of silently returning one device's value.

  - The delayed-reduce MUL-chain in graph_compute accepts it, so the reduce
    point stays AFTER the per-device undo: each device applies its own `e` to
    its own partial and only then is the sum taken.  That is what makes the
    per-device value cancel (`e` is a power of two, so the scaling commutes
    with the sum), and `e_local <= e_global` means every device keeps at least
    the reference's f16 headroom.

  - llama: LLAMA_SPLIT_MODE_RELAXED_TENSOR = 4, `-sm relaxed-tensor`; every
    "is this the tensor path?" site goes through llm_split_mode_is_tensor_like().
    `-sm tensor` keeps upstream's strict behaviour and the deny, but the error
    now points at the new mode.

Measured (Flint Q8_0, 2x R9700): greedy text byte-identical to `-sm layer`
and to itself at 3 GPUs; with the amax divisor forced to 1 (so `e` != 1) the
POOL_1D pooled max differs across devices on ~half of the ~185 per-run calls
and the text still matches `-sm layer` exactly.  A non-amax arch (Qwen3.5-4B)
is byte-identical under tensor and relaxed-tensor.  `ggml_pool_1d` has exactly
one producer in the graph, so the relaxed state is unreachable for any other
arch.

NOT claimed: bit-identity to a single device on a backend whose in-kernel
src1 rescale is non-linear (Vulkan's clamp; RDNA/HIP is exact), any behaviour
under -ncmoe (the expert arena still refuses tensor-like modes), and
mellum/mistral4 at all (enabled by the same change, unvalidated -- no model).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ggml changes relating to the ggml tensor library for machine learning

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants