Skip to content

Tests: pin the host RAM the llama.cpp placement tests launch on - #19283

Merged
danielhanchen merged 1 commit into
mainfrom
ci/placement-tests-pin-host-ram
Nov 24, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci/placement-tests-pin-host-ram

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Problem

On runners with 16 GB of RAM, 35 llama.cpp placement tests fail across (Python 3.13, g-l) and (Python 3.13, m-r). The staging runs for #19113, #19181 and #19244 all show them, for example:

test_llama_cpp_placement.py::test_the_moe_cache_stays_off[ram_cannot_pin_experts-]
  assert _load_mode(cmd) == "none"   (None == 'none')
Load mode: keeping mmap; pinning the host-side weights plus the 9.0 GB llama-server grows into
would hold more than 50% of the 15.3 GB of RAM, which the OS cannot page out.

They pass on larger runners and locally, so this only shows up on some runners.

Cause

#19231 (price llama-server host RAM growth before pinning a spilled load) is correct. A pinned launch (--load-mode none) now also checks that the pinned host-side weights plus llama-server's growth stay under a safe share of total RAM. That total comes from _host_memory_capacity_mib(), which reads the real MemTotal and the cgroup limit.

The placement tests fake the GPUs and, where they care, the available RAM. They never pin the total, so each launch decided against whatever machine ran it. Reproduced locally by stubbing _total_system_memory_mib to 15667 MiB: 35 failed, 770 passed in the three files below.

Fix

  • test_llama_cpp_placement.py gets an autouse fixture, _pinned_host_ram. It pins LlamaCppBackend._total_system_memory_mib to 256 GiB and _cgroup_memory_limit_mib to None, so every launch sees the same host on any runner.
  • test_lookup_table_fit.py and test_prompt_cache_sized_to_context.py launch through that file's helpers, so they import the fixture.
  • Tests that are about host RAM still set their own total in the test body, which overrides the fixture.

Verification

  • The three files on this branch: 805 passed.
  • With the host forced to 15.3 GB (a plugin stubbing _total_system_memory_mib): 805 passed on this branch, and 35 failed on main.
  • All 34 test files that import test_llama_cpp_placement: 2365 passed and 24 skipped.
    • One test failed: test_cached_gguf_routes.py::test_pipeline_class_guard_passes_every_shipped_family.
    • It fails identically on main, because this host has diffusers 0.41.0.dev0 and the test needs 0.42.0. It is unrelated to this change.

#19231 made a pinned (--load-mode none) launch also check that the pinned
weights plus llama-server's growth stay under a share of total RAM, read
from the real host. The placement tests fake the GPUs and the available RAM
but never the total, so on a 16 GB runner the check keeps mmap and 35 tests
that expect a pinned launch or the MoE cache fail (staging runs for #19113,
#19181, #19244); on larger runners they pass.

Pin total RAM to 256 GiB and the cgroup limit to none with an autouse
fixture in test_llama_cpp_placement.py, shared with the two files that
launch through its helpers. Tests about host RAM still set their own.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T15:14:09.124603Z ef2a0d7 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: ef2a0d70bb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit f28190a into main Nov 24, 2026
3 of 25 checks passed
@danielhanchen
danielhanchen deleted the ci/placement-tests-pin-host-ram branch November 24, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant