Skip to content

fix(QUANT-GGUF-CPU-THREADPOOL): floor the oversubscription threshold at 100 us so 4-vCPU CI does not flake - #3140

Open
localai-org-maint-bot wants to merge 1 commit into
mainfrom
row/QUANT-GGUF-CPU-THREADPOOL-FLAKE
Open

localai-org-maint-bot wants to merge 1 commit into
mainfrom
row/QUANT-GGUF-CPU-THREADPOOL-FLAKE

Conversation

@localai-org-maint-bot

Copy link
Copy Markdown
Collaborator

fix(QUANT-GGUF-CPU-THREADPOOL): floor the oversubscription threshold at 100 us so 4-vCPU CI does not flake

The ratio-based assertion ratio < 100.0 is calibrated on a 20-core box
where the fits arm measures ~1.7 us and the defect produces 3-6 ms.
On a 4-vCPU GitHub runner the arms are 2 and 5 threads, the fits arm can
measure 0.4 us, and normal scheduler jitter in the over arm (42 us) trips
the ratio at 101.5 against the 100.0 threshold.

Floor the right-hand side at 100.0 us: over_us < max(100.0 * fits_us, 100.0).
The defect this test guards produces a full scheduler timeslice (2999-5996 us),
so the 100 us floor sits ~30x below the defect floor and does not mask it.

Closes #3130

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM5.2 [MAKI]

…at 100 us so 4-vCPU CI does not flake

The ratio-based assertion ratio < 100.0 is calibrated on a 20-core box
where the fits arm measures ~1.7 us and the defect produces 3-6 ms.
On a 4-vCPU GitHub runner the arms are 2 and 5 threads, the fits arm can
measure 0.4 us, and normal scheduler jitter in the over arm (42 us) trips
the ratio at 101.5 against the 100.0 threshold.

Floor the right-hand side at 100.0 us: over_us < max(100.0 * fits_us, 100.0).
The defect this test guards produces a full scheduler timeslice (2999-5996 us),
so the 100 us floor sits ~30x below the defect floor and does not mask it.

Closes #3130

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM5.2 [MAKI]
localai-org-maint-bot added a commit that referenced this pull request Sep 12, 2026
…h the ViewOn contract (#3154)

test_rocm_f16_contract (introduced in #3095) failed on clean main
because its check lambda expected `OwnedTensor::View()` and `ViewOn()`
to propagate the layout markers `repacked`, `q8_0_aligned`, and
`elem_kn_repacked`. `ViewOn` deliberately carries only
`weight_value_dtype`: each `ResidentWeight` arm owns a different marker
set and sets them explicitly after the call, and copying them centrally
changed the CPU-alias lane for every model that shares the helper. The
test and the code contradicted each other in the same commit, and
`build-test-cpu` was skipping when #3095 merged so the failure was never
caught.

The fix corrects the check lambda to verify the actual contract:
`weight_value_dtype` IS propagated, layout markers are NOT. The `Slice`
guard is removed because `View()` no longer propagates `repacked`, so
`Slice()` never throws on a view from an `OwnedTensor` that happens to
have `repacked` set.

This unblocks every PR that runs `build-test-cpu` (#3133, #3140, #2906,
and others).

Closes #3153.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:regolo/glm5.2 [maki]

Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
localai-org-maint-bot added a commit that referenced this pull request Sep 12, 2026
…tive in LoadUnaligned (#3156)

Closes #3155

`sanitize-cpu (address,undefined)` fails on every PR with a pre-existing
UBSan alignment error inside `LoadUnaligned<T>` calls in the AVX2 and
AVX512
element matmul kernels (`cpu_matmul_elem_avx2.cpp:231`,
`cpu_matmul_elem_avx512.cpp:121`).

`LoadUnaligned` uses `std::memcpy`, which is the correct way to read an
unaligned address. GCC and Clang recognise that a small
trivially-copyable
`memcpy` is equivalent to a typed load and rewrite it as such under
`-O2`.
UBSan then flags the synthesised load as a misaligned access.

Add `__attribute__((no_sanitize("alignment")))` to `LoadUnaligned` via a
`VT_NO_SANITIZE_ALIGNMENT` macro (empty on MSVC). The attribute
suppresses
the alignment check inside this function only; it is a no-op when UBSan
is
not enabled.

Confirmed pre-existing: appears on #2906 (Sept 5) and #3140 (Sept 11),
independent of their changes.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:regolo/glm5.2 [maki]

Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test_cpu_threadpool: the 100x dispatch ratio is calibrated on 20 cores and flakes on 4-vCPU CI runners

2 participants