Skip to content

Add vLLM-metax vllm metax cmake presets jobs override#305

Open
ghangz wants to merge 2 commits into
MetaX-MACA:masterfrom
ghangz:mengz/vllm-metax-cmake-presets-jobs-override
Open

Add vLLM-metax vllm metax cmake presets jobs override#305
ghangz wants to merge 2 commits into
MetaX-MACA:masterfrom
ghangz:mengz/vllm-metax-cmake-presets-jobs-override

Conversation

@ghangz

@ghangz ghangz commented Jul 1, 2026

Copy link
Copy Markdown

Summary

  • Adds a focused vllm metax cmake presets jobs override improvement for MetaX-MACA/vLLM-metax.
  • The change targets MetaX MACA development and validation workflows, with emphasis on earlier diagnostics, reproducible logs, or safer benchmark tooling.
  • Existing default behavior is kept compatible; the new logic is scoped to explicit checks, helper tools, or validation metadata.

Validation

  • Verified on Gitee.AI MetaX GPU resources: vLLM-metax_vLLM image batch, 10/10 PASS; PyTorch-MACA batch also covered vLLM-metax runtime tools.
  • Branch validation command: python -m pytest tests/tools/test_generate_cmake_presets_jobs.py
  • Pull request text is intentionally ASCII-only to avoid encoding issues on web forms and API clients.

Review notes

  • Source branch: ghangz:mengz/vllm-metax-cmake-presets-jobs-override
  • Target branch: MetaX-MACA/vLLM-metax:master
  • Maintainers can modify this branch if follow-up adjustments are needed.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for overriding the number of CMake build jobs and NVCC threads via command-line arguments and function parameters, and includes a new unit test to verify this behavior. The reviewer identified a potential bug where get_cpu_cores() returning 0 or None could lead to a ZeroDivisionError or TypeError, and provided a robust code suggestion to handle these edge cases.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +82 to +89
if nvcc_threads is None:
nvcc_threads = min(4, cpu_cores)
elif nvcc_threads < 1:
raise ValueError("nvcc_threads must be at least 1")
if cmake_jobs is None:
cmake_jobs = max(1, cpu_cores // nvcc_threads)
elif cmake_jobs < 1:
raise ValueError("cmake_jobs must be at least 1")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

If get_cpu_cores() returns None (which multiprocessing.cpu_count() can do on some platforms) or returns 0 (which can happen in certain containerized or restricted environments), the current logic will raise a TypeError or a ZeroDivisionError.

Specifically, if cpu_cores is 0, nvcc_threads is set to 0 via min(4, 0). Then, calculating cmake_jobs using cpu_cores // nvcc_threads results in 0 // 0, which raises a ZeroDivisionError.

We can make this logic robust against both None and 0 values by defaulting cpu_cores to at least 1 and ensuring nvcc_threads is at least 1.

Suggested change
if nvcc_threads is None:
nvcc_threads = min(4, cpu_cores)
elif nvcc_threads < 1:
raise ValueError("nvcc_threads must be at least 1")
if cmake_jobs is None:
cmake_jobs = max(1, cpu_cores // nvcc_threads)
elif cmake_jobs < 1:
raise ValueError("cmake_jobs must be at least 1")
if nvcc_threads is None:
nvcc_threads = max(1, min(4, cpu_cores or 1))
elif nvcc_threads < 1:
raise ValueError("nvcc_threads must be at least 1")
if cmake_jobs is None:
cmake_jobs = max(1, (cpu_cores or 1) // nvcc_threads)
elif cmake_jobs < 1:
raise ValueError("cmake_jobs must be at least 1")

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