Skip to content

[rhaiis] Add CPU support - #184

Open
maryamtahhan wants to merge 14 commits into
openshift-psap:mainfrom
maryamtahhan:feat/rhaiis-cpu
Open

[rhaiis] Add CPU support#184
maryamtahhan wants to merge 14 commits into
openshift-psap:mainfrom
maryamtahhan:feat/rhaiis-cpu

Conversation

@maryamtahhan

@maryamtahhan maryamtahhan commented Aug 25, 2026

Copy link
Copy Markdown

Summary

This PR adds full CPU accelerator support to the RHAIIS orchestration layer,
covering engine configuration, manifest generation, CLI ergonomics, and
concurrent-load testing — plus fixes for regressions introduced during the rebase.

feat: CPU accelerator support (1aed41c)

Engine / config

  • runtime_config.py: get_engine_args returns rhaiis.vllm_args_cpu for CPU; get_serving_image resolves rhaiis.images.cpu / rhaiis.images.cpu-vanilla by flavor; merge_env_vars layers accelerator_env_vars.cpu + accelerator_env_vars.cpu-{flavor} (LD_PRELOAD only on rhaiis)
  • config.d/rhaiis.yaml: adds rhaiis.images.cpu / cpu-vanilla, vllm_args_cpu (trust-remote-code, no-enable-log-requests, tensor-parallel-size: 1), accelerator_env_vars.cpu (VLLM_CPU_KVCACHE_SPACE=40), accelerator_env_vars.cpu-rhaiis (LD_PRELOAD)
  • config.d/models.yaml: adds tinyllama-cpu, qwen3-0-6b-cpu, llama-3-2-1b-cpu, llama-3-2-3b-cpu, granite-3-2-2b-cpu, llama31-8b-w8a8-cpu with per-model max-model-len and vllm_args
  • config.d/workloads.yaml: adds cpu-smoke, cpu-chat-baseline, cpu-rag-baseline, cpu-code-baseline, cpu-summarization-baseline, cpu-chat-realistic, cpu-code-realistic

CLI

  • cli.py test: adds --accelerator cpu, --cpu-flavor {rhaiis,vanilla} flags; _apply_cli_overrides wires accelerator/flavor/engine into config; dry-run prints CPU flavor
  • manifests.py: passes accelerator through to _build_resources; CPU branch in _build_resources sets Guaranteed QoS (limits == requests, no GPU keys)
  • test_phase.py: passes accelerator to manifest builders

Docs / tooling

  • CPU_TESTING.md: full guide — cluster setup (login → diagnose → namespace → secrets → PVC → artifact dir), preset-based smoke test and concurrent-load commands, model/workload/image tables, troubleshooting
  • scripts/diagnose_cpu_cluster.sh: checks node resources, AVX2/AVX-512/AMX, NUMA topology, CPU Manager policy, KServe CRDs

feat: CPU concurrent load matrix (5280090)

  • cpu_concurrent_load_phase.py: run/do_test sweep models × cpu_requests × workloads, calling _run_test with deploy_cfg_overrides={cpu_request: ...} per cell; honours continue_on_error
  • cli.py concurrent-load: new subcommand with --models, --cpu-requests, --workloads, --namespace, --cpu-flavor, --image-pull-secret, --service-account-name, --continue-on-error, --dry-run
  • Defaults: tinyllama-cpu, [8, 16, 32] CPU requests, cpu-chat-baseline

fix: CPU accelerator regressions (388cdee)

  • HF+PVC storageUri (GPU regression): restored if storage_source == "hf" and storage_pvc / elif storage_source != "hf" — the branch had inadvertently flipped the condition to pvc, causing GPU jobs to lose the model cache PVC
  • --image-pull-secret raises on missing key: was calling set_config("rhaiis.deploy.image_pull_secret", ...) (singular, non-existent); now writes [secret] to rhaiis.deploy.image_pull_secrets (the actual list key) in both test and concurrent-load; dry-run updated to match
  • CPU Guaranteed QoS: _build_resources CPU branch now returns early with matching limits and requests for cpu/memory; without limits the pod could burst the whole node
  • --cpu-flavor clobbering presets: concurrent-load --cpu-flavor default changed from "vanilla" to None; flavor is only set_config'd when explicitly passed; cpu_concurrent_load_phase drops the cpu_flavor param entirely so preset values survive
  • Whitespace trim: comma-separated --models, --cpu-requests, --workloads now strip whitespace on split
  • --serving-image key mapping: rhaiis flavor → rhaiis.images.cpu, vanillarhaiis.images.cpu-vanilla (was writing non-existent rhaiis.images.cpu-rhaiis)
  • max-model-len precedence: removed max-model-len from vllm_args_cpu defaults so per-model values (tinyllama-cpu: 2048) are not overridden by the engine default
  • CPU presets restored: adds cpu, cpu-vanilla, cpu-smoke, vanilla-cpu-smoke, cpu-chat-baseline, vanilla-cpu-chat-baseline to presets.d/presets.yaml with memory_request: 64Gi
  • Fournos hardware resolver: ci.py resolve_hardware_request returns {} immediately for accelerator == "cpu" before any GPU/TP lookup
  • Offline validation: test_cpu_config.py checks image selection, LD_PRELOAD isolation, tinyllama max-model-len stays 2048 after merge, and CPU _build_resources Guaranteed QoS

docs: CPU_TESTING.md setup flow (a999cf0)

  • Added model-pvc PVC creation as step 5 of cluster setup (required — KServe mounts it at /mnt/models for the HF download cache)
  • Updated smoke test and concurrent-load examples to use presets (vanilla-cpu-smoke, cpu-smoke, cpu-vanilla, cpu) rather than explicit flags
  • Added first-run download note and StorageClass tip

Test plan

  • Offline: PYTHONPATH=$PWD python projects/rhaiis/orchestration/test_cpu_config.py
  • Dry-run (vanilla): python -m projects.rhaiis.orchestration.cli test --preset vanilla-cpu-smoke --namespace forge-rhaiis --dry-run
  • Dry-run (rhaiis): python -m projects.rhaiis.orchestration.cli test --preset cpu-smoke --namespace forge-rhaiis --image-pull-secret rhaiis-pull-secret --dry-run
  • Dry-run (concurrent-load): python -m projects.rhaiis.orchestration.cli concurrent-load --preset cpu --image-pull-secret rhaiis-pull-secret --dry-run
  • Live smoke: python -m projects.rhaiis.orchestration.cli test --preset vanilla-cpu-smoke --namespace forge-rhaiis
  • GPU run unaffected: confirm storageUri condition is correct for storage_source=hf

🤖 Generated with Claude Code

maryamtahhan and others added 3 commits August 25, 2026 11:32
- Add cpu/cpu-vanilla image fallback keys to rhaiis.yaml
- Add cpu_flavor config key (vanilla/rhaiis) for CPU image selection
- Add vllm_args_cpu section and accelerator_env_vars for cpu/cpu-rhaiis/cpu-vanilla
- Add CPU models: tinyllama-cpu, qwen3-0-6b-cpu, llama-3-2-{1,3}b-cpu,
  granite-3-2-2b-cpu, llama31-8b-w8a8-cpu
- Add CPU workloads: cpu-smoke, cpu-{chat,rag,code,summarization}-baseline,
  cpu-{chat,code}-realistic (matches format-results cpueval suite)
- Add get_cpu_flavor() and cpu-aware get_serving_image(), get_engine_args(),
  merge_env_vars() to runtime_config.py
- Add deploy_cfg_overrides param to _run_test() for per-cell cpu_request sweep
- Fix manifests.py storageUri: hf source never sets storageUri (was using pvc
  URI even when storage_source=hf, causing pod pending on missing PVC)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add cpu_concurrent_load_phase.py: models x cpu_requests x workloads matrix
  orchestrator, matching format-results concurrent-load suite
- Add concurrent-load CLI command with --models/--cpu-requests/--workloads/
  --cpu-flavor/--continue-on-error/--dry-run options
- Extend test CLI --accelerator to accept cpu and l40s; add --cpu-flavor option
- Add scripts/diagnose_cpu_cluster.sh: checks AVX2/AVX-512/AMX instruction
  sets, NUMA topology, CPU Manager policy, KServe CRDs
- Add CPU_TESTING.md: end-to-end guide covering cluster setup, single-run
  tests, concurrent load matrix, model/workload reference tables, and
  troubleshooting (storage-config secret, slow startup, oneDNN warnings)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Restore HF+PVC storageUri condition in build_inferenceservice (GPU regression)
- Wire --image-pull-secret to image_pull_secrets list (fixes set_config on missing key)
- Add CPU Guaranteed QoS in _build_resources (limits == requests, no GPU keys)
- Fix concurrent-load --cpu-flavor default=None so presets are not clobbered
- Remove cpu_flavor param from cpu_concurrent_load_phase run/do_test
- Fix --serving-image key mapping: rhaiis→images.cpu, vanilla→images.cpu-vanilla
- Remove max-model-len from vllm_args_cpu so per-model value (tinyllama: 2048) wins
- Add CPU presets (cpu, cpu-vanilla, cpu-smoke, vanilla-cpu-smoke, cpu-chat-baseline,
  vanilla-cpu-chat-baseline) to presets.d/presets.yaml
- Add explicit CPU guard in ci.py resolve_hardware_request (returns {} early)
- Add test_cpu_config.py: offline validation of image selection, LD_PRELOAD,
  max-model-len precedence, and resource Guaranteed QoS
- Update CPU_TESTING.md: preset table, config validation section, flavor default

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@openshift-ci

openshift-ci Bot commented Aug 25, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign sjmonson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci

openshift-ci Bot commented Aug 25, 2026

Copy link
Copy Markdown

Hi @maryamtahhan. Thanks for your PR.

I'm waiting for a openshift-psap member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-ci openshift-ci Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 25, 2026
@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 397c5cd0-1cfb-4123-a00e-de0071c3b3d3


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

maryamtahhan and others added 4 commits August 25, 2026 12:17
…sed commands

Add model-pvc creation as step 5 of cluster setup. Update smoke test and
concurrent-load examples to use presets (vanilla-cpu-smoke, cpu-smoke,
cpu-vanilla, cpu) rather than explicit --accelerator/--cpu-flavor flags.
Add first-run download note and storageClass tip.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
40 GiB exceeds available NUMA node memory on 16/32 GiB nodes, causing
vLLM to crash at startup. 10 GiB works for smoke/CI workloads on small
clusters; override per-model or via a preset for production nodes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… guidance

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@maryamtahhan maryamtahhan changed the title fix(rhaiis): fix CPU accelerator regressions and config bugs Add CPU support Aug 25, 2026
@maryamtahhan maryamtahhan changed the title Add CPU support Forge: Add CPU support Aug 25, 2026
- runtime_config: fix get_serving_image for CPU — map rhaiis flavor to
  rhaiis.images.cpu and vanilla to rhaiis.images.cpu-vanilla; drop the
  try/except that silently fell back after logging a missing-key error on
  every RHAIIS CPU deploy
- cpu_concurrent_load_phase: honour _run_test non-zero return code;
  previously warnings-only failures were silently swallowed and the matrix
  exited 0
- README: fix Fournos CPU example — swap args: [cpu] for
  args: [cpu-chat-baseline] so the preset supplies model, workload, flavor,
  64 Gi memory and VLLM_CPU_KVCACHE_SPACE=24; fix image override key from
  rhaiis.engines.vllm.images.cpu to rhaiis.images.cpu; add
  rhaiis.images.cpu / rhaiis.images.cpu-vanilla to config-overrides table
- CPU_TESTING.md: add 200 Gi PVC recreation snippet after the 50 Gi smoke
  tip so the 8B / cpu-chat-baseline path is unambiguous

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread projects/rhaiis/scripts/diagnose_cpu_cluster.sh Outdated
maryamtahhan and others added 6 commits August 25, 2026 13:22
- cli.py: concurrent-load now reads tests.rhaiis.model_key /
  workload_key from config (set by preset) when --models / --workloads
  are omitted, falling back to module defaults only if the key is unset;
  fixes --preset cpu-chat-baseline still benching TinyLlama
- cli.py: setting --cpu-flavor now implies accelerator=cpu in both the
  test command (_apply_cli_overrides) and concurrent-load; previously
  flavor alone left the default nvidia accelerator and skipped CPU image
  routing
- CPU_TESTING.md: switch RHAIIS matrix example from --preset cpu to
  --preset cpu-chat-baseline so model, flavor, memory, and
  VLLM_CPU_KVCACHE_SPACE=24 are all applied; drop now-redundant --models
  flag and update the explanatory note

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Port the bash diagnostic script into the rhaiis toolbox DSL so it can
integrate into orchestration (e.g. as a preflight step) and be invoked
via run_toolbox like all other toolbox commands.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fetch node names once in show_node_resources and store in context.nodes
instead of calling oc get nodes at the start of each task.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaced by projects/rhaiis/toolbox/diagnose_cpu_cluster/main.py.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…gnose toolbox

- concurrent-load: replace try/except fallback with snapshot comparison so
  bare runs default to tinyllama-cpu x cpu-chat-baseline instead of GPU keys
- ci.py preflight: call diagnose_cpu_cluster for CPU jobs instead of no-op warning
- CPU_TESTING.md: point step 2 at ./bin/run_toolbox rhaiis diagnose_cpu_cluster
- diagnose toolbox: search full oc debug stdout for AVX flags (banner-safe)
- diagnose toolbox: extract first JSON object before json.loads for cpu_manager_state
- diagnose toolbox: add comment that hardcoded image tags must match config.d/rhaiis.yaml

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…doc wording

- ci.py preflight: drop return of diagnose_cpu_cluster() result (execute_tasks
  returns a context object, not int); always return 0 after the toolbox runs
- cli.py concurrent-load: guard preset-override path with CPU-shape checks
  (endswith -cpu / startswith cpu-) so a GPU model preset never bleeds into
  the CPU matrix defaults
- CPU_TESTING.md: "The script checks:" → "The toolbox checks:"

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@kpouget kpouget changed the title Forge: Add CPU support [rhaiis] Add CPU support Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants