fix: validate gpu counts and custom vram capacities - #51
rupayon123 wants to merge 4 commits into
Conversation
How to test: python -m pytest -q (75 passed); eight invalid target cases failed before the fix.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 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. Comment |
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| Security | 2 critical 2 medium |
🟢 Metrics 10 complexity · 0 duplication
Metric Results Complexity 10 Duplication 0
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
Additional fixes pushed to this branch:
All 84 local tests pass. ROCm and Intel cases use command-output fixtures. The Apple Silicon capability probe was also checked on this Mac; this does not validate an actual GPU allocation or the memory availability heuristic. Prepared with AI assistance. Changes are submitted for review; this is not a claim of maintainer approval. |
Summary
Reject zero GPU counts and nonpositive/non-finite custom VRAM capacities. Previously
0x RTX4090produced a zero-device target,nan/infentered memory estimates, and-1was normalized to positive1before parsing.Parse numeric capacity from the unnormalized target while retaining the existing vendor-name and hyphen normalization for known GPU names.
Type of Change
How Has This Been Tested?
Eight invalid-target cases failed before the fix. Three valid target cases confirm fractional capacities, multi-GPU capacities, and hyphenated GPU names still work. Full suite: 75 passed on Python 3.11.
ruff check tests/test_gpu_target_validation.pyandgit diff --checkpass.Checklist
Prepared with AI assistance and tested locally.