Skip to content

Fix 7 bugs, add 23 tests, rewrite docs with usage guide - #1

Merged
Akasxh merged 1 commit into
mainfrom
fix/bugfixes-and-docs
Mar 27, 2026
Merged

Fix 7 bugs, add 23 tests, rewrite docs with usage guide#1
Akasxh merged 1 commit into
mainfrom
fix/bugfixes-and-docs

Conversation

@Akasxh

@Akasxh Akasxh commented Mar 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fixed 7 bugs identified through automated codebase analysis
  • Added 23 new unit tests (120 total, up from 97)
  • Rewrote README with step-by-step usage guide tested on GTX 1650
  • All 408 tests passing (120 unit + 53 examples + 235 GPU integration)

Bug fixes

  • assert_close mixed-precision: dtype resolution now uses the lower-precision dtype for tolerance lookup regardless of argument order
  • assert_close baseline_2x: removed dead code in the doubled-tolerance path
  • assert_close GPU fast-path: added shape and device equality checks, narrowed RuntimeError catch
  • Blackwell naming: SM100 reports "Blackwell-DC", SM120 reports "Blackwell-Consumer", with alias so require_arch("Blackwell") matches both
  • plugin.py: removed dead _register_fixtures(), wired --gpu-device CLI option, gpu_device always returns GPUDevice
  • regression.py: removed no-op tolist() call
  • CI annotations: fixed comma-separated format, added :: injection sanitization, refactored to table-driven

Test plan

  • 120 unit tests passing (pytest tests/)
  • 53 example tests passing
  • 235 GPU integration tests passing on GTX 1650
  • ruff check: 0 issues
  • mypy strict: 0 errors
  • GPU health verified (47C idle after all tests, 6MB memory)

…date docs

Assertion fixes:
  - Fixed dead code in baseline_2x path (redundant ternaries simplified)
  - Fixed mixed-precision dtype resolution to use lower-precision dtype
  - Added int-vs-float dtype handling (float always wins for tolerance lookup)
  - Narrowed RuntimeError catch in GPU fast-path to avoid swallowing CUDA errors
  - Added same-device check for multi-GPU GPU fast-path safety
  - Added shape equality guard before torch.allclose

Architecture fixes:
  - Blackwell SM100 now reports "Blackwell-DC", SM120 reports "Blackwell-Consumer"
  - Added alias system so require_arch("Blackwell") matches both variants
  - Fixed check_compatibility to search detailed arch map before main map

Plugin fixes:
  - Removed dead _register_fixtures() function
  - Wired --gpu-device CLI option into gpu_device fixture
  - gpu_device fixture now always returns GPUDevice (not raw string)
  - Added device ordinal validation for CLI override

Other fixes:
  - Removed no-op unique_counts.tolist() in Mann-Whitney U
  - Added peak_flops field to RooflinePoint for correct bottleneck classification
  - Refactored CI annotations to table-driven with :: injection sanitization
  - Fixed examples to convert dtype strings via getattr(torch, dtype)

Test additions:
  - 5 tests for baseline_2x and mixed-precision dtype resolution
  - 7 tests for Blackwell naming consistency and alias expansion
  - 10 tests for CI annotation format, JUnit XML, and PR comments
  - GPU integration test fixes for GTX 1650 tensor core edge case
  - Added conftest.py and init fixture for benchmark deep analysis

Documentation:
  - Rewrote README with step-by-step usage guide tested on GTX 1650
  - Added tested hardware section with validation details
  - Added mixed-precision tolerance behavior explanation
  - Updated project structure with full module descriptions
  - Added CLAUDE.md and expert system for development guidance

408 tests passing (120 unit + 53 examples + 235 GPU integration)
Validated on NVIDIA GeForce GTX 1650, PyTorch 2.11.0, CUDA 13.0
@Akasxh
Akasxh merged commit a9a9d44 into main Mar 27, 2026
4 checks passed
Akasxh added a commit that referenced this pull request May 7, 2026
… (T-01)

Replace the module-level `try: import torch as _torch / _has_torch` block in
`src/gpucheck/assertions/close.py` with a cached `_torch_mod()` helper that
performs the import only when an API needs it. Both call sites inside
`assert_close` (device-type detection and the GPU fast-path) bind
`_torch = _torch_mod()` at the top of the function and guard with
`_torch is not None`.

Verified via `python -c "import gpucheck.assertions.close; import sys;
assert 'torch' not in sys.modules"`. All 32 tests in test_assertions.py
remain green.

Source: detector-files Top-3 #1; synthesist ISS-08; planner T-01.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Akasxh added a commit that referenced this pull request May 7, 2026
…ector-files #1, partial)

Two parallel detection stacks lived at:
  - arch/detection.py:133,206  (pynvml + torch -> list[GPUInfo])
  - fixtures/gpu.py:43,90      (pynvml + torch -> GPUDevice)

Drift risk: the two stacks had different fallbacks (NVMLError vs
RuntimeError vs AssertionError catches) and different "no backend"
behavior (one warned, the other silently returned None).

Now there is exactly one detection codepath:

  arch/detection._detect_gpus_or_warn() -> list[GPUInfo] | None
    `-- arch/detection.detect_gpus() (lru_cache wrapper, public API,
                                      maps None -> [])
    `-- fixtures/gpu.detect_gpu()      (calls detect_gpus(), adapts the
                                      first GPUInfo to the smaller
                                      GPUDevice via _to_device())

Public API preserved:
  - arch.detect_gpus() still returns list[GPUInfo] (empty list on no
    backend; was already that way).
  - fixtures.gpu.detect_gpu() still returns GPUDevice | None.
  - The "no detection backend available" UserWarning is preserved (and
    is now lru_cache-deduped, firing at most once per session via
    detect_gpus()).

The plugin.py shim (`_lazy_detect_gpus` / `_gpu_available` / `_gpu_count`
at plugin.py:10-22) is owned by another agent per task instructions and
left untouched; the helper this commit introduces is the foundation that
agent's plugin.py refactor can call into.

Removed:
  - fixtures/gpu._detect_gpu_pynvml (~45 LOC)
  - fixtures/gpu._detect_gpu_torch  (~25 LOC)

Acceptance:
  ruff check src/gpucheck/arch/ src/gpucheck/fixtures/gpu.py -> clean
  mypy src/                                                  -> clean
  pytest -q                                                  -> 230 passed,
                                                                1 skipped
                                                                (unchanged)
Akasxh added a commit that referenced this pull request May 7, 2026
… ~30 mutants)

Add `TestMismatchReportPinnedNumerics` to tests/test_assertions.py with
three new tests that lock down exact numeric values in
`format_mismatch_report` output:

1. `test_max_abs_error_value_is_pinned` — pins max abs error (4.5) and
   mean abs error (2.5) values, plus row labels.
2. `test_mismatch_count_and_location_are_pinned` — pins
   `5 / 6 (83.33%)` count/total/percentage and 2-D max-error location
   `(1, 2)` (forces unravel_index axis mutations to fail).
3. `test_histogram_present_with_pinned_bucket_and_count` — pins
   histogram bucket label `[1e-3, 1e-2)` and count 3 (ANSI-stripped).

Targets `assertions/reporting.py` mutator survivors documented in
`EVIDENCE/mutator-survivors.md` top-leverage #1 (~30 surviving mutants).
No source changes to reporting.py — tests-only per planner T-10.

Test count 230 → 233 passed, 1 skipped.
ruff: clean. mypy: clean.

Source: planner T-10; mutator-survivors top-leverage #1; synthesist ISS-25.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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