Skip to content

test: make the Hessian, free-threading and 2-GPU gates actually run (#4768) - #4787

Merged
Qubitium merged 1 commit into
mainfrom
fix/issue-4768-test-gates
Nov 17, 2026
Merged

Qubitium merged 1 commit into
mainfrom
fix/issue-4768-test-gates

Conversation

@Qubitium

Copy link
Copy Markdown
Collaborator

Fixes the gate bugs in #4768 parts 1, 3 and 4: coverage that never ran now runs.

1. tests/test_hessian.py: all 17 tests skipped on < 7 GPUs

A module-level pytestmark meant for one benchmark skipped the whole merged file unless
torch.cuda.device_count() > 6. So GPTQ.hessian_inverse damping/flooring, Hessian chunking and the CUDA
workspace locking had no running test on any 1-4 GPU host.

  • removed the module gate; the two benchmarks keep @pytest.mark.slow
  • test_hessian_accumulation_cpu_vs_gpu: explicit CUDA skip (it needs pinned memory) and
    torch.cuda.current_device() instead of cuda:6
  • test_hessian_merge_multi_gpu_with_attention_mask: gated on 2 devices (was 8) and uses cuda:0/cuda:1
    instead of the lab-host cuda:6/cuda:7
  • the other CUDA tests already had their own torch.cuda.is_available() skips

2. PYTHON_GIL=0 subprocess tests: never skipped on a GIL build

hasattr(sys, "_is_gil_enabled") is true on every CPython >= 3.13, including GIL builds, so the gate never
fired and the child died with Fatal Python error: config_read_gil: Disabling the GIL is not supported by this build - a failure, not a skip. Gate on sysconfig.get_config_var("Py_GIL_DISABLED") == 1 in
test_ci_free_threaded_lane.py, test_exl3_dispatch_concurrency.py (2 parametrized cases) and
test_exl3_workspace.py.

3. tests/test_excluded_device_warmup.py: 3 tests failed on one GPU

They schedule cuda:0/cuda:1 warmups and wait for them, but the worker enters torch.cuda.device("cuda:1"),
which raises invalid device ordinal on a 1-GPU host and silently aborts the warmup the test waits for. The tests
assert scheduling, not hardware, so the new autouse fixture pins _device_ctx to a no-op next to the
_activate_thread_device patch they already install.

Measured on this 1-GPU host

file main this PR
tests/test_hessian.py 17 skipped 15 passed, 2 skipped (the two 2-GPU merge tests)
tests/test_excluded_device_warmup.py 3 failed 14 passed, 3 skipped
tests/test_exl3_dispatch_concurrency.py 3 failed 0 failed (GIL cases skip on this GIL build)

tests/test_exl3_workspace.py::test_concurrent_streams_do_not_overwrite_tile_workspace still fails here for the
same environmental reason as main: the EXL3 extension cannot build without CUDA_HOME.

ruff check clean on all five files.

Not in this PR

Part 2 of the issue (hard-coded cuda:6/7/8 in test_gptq.py, test_g2h_tensor_quality.py,
test_cuda_event_stream_activation_buffer.py, test_fp4_llama3_fp4.py) needs per-test device/capability
selection rather than a mechanical index change - the FP4 case is specifically a mixed A100+5090 host. Left as a
follow-up so this PR stays verifiable.

…4768)

Three test-gate bugs hid real coverage on every host that is not the original
7-GPU lab machine.

1. `tests/test_hessian.py` had a module-level `pytestmark` that skipped all 17
   tests unless `device_count() > 6`, so `GPTQ.hessian_inverse`
   damping/flooring, Hessian chunking and the CUDA workspace locking had no
   running test anywhere with fewer than 7 GPUs. The gate was meant for one
   benchmark: drop it, mark the two benchmarks `slow`, keep an explicit
   CUDA-available skip on the pinned-memory CPU-vs-GPU benchmark, use the
   current device instead of `cuda:6`, and gate the multi-GPU merge on 2
   devices with `cuda:0`/`cuda:1` instead of 8 devices with `cuda:6`/`cuda:7`.

2. The `PYTHON_GIL=0` subprocess tests were gated on
   `hasattr(sys, "_is_gil_enabled")`, which is true on every CPython >= 3.13
   including GIL builds, so on a regular 3.14 build the child died with
   "Disabling the GIL is not supported by this build" and the test failed
   instead of skipping. Gate on `sysconfig.get_config_var("Py_GIL_DISABLED")
   == 1` in `test_ci_free_threaded_lane.py`,
   `test_exl3_dispatch_concurrency.py` and `test_exl3_workspace.py`.

3. `tests/test_excluded_device_warmup.py` schedules `cuda:0`/`cuda:1` warmups
   and waited for them, but the worker enters `torch.cuda.device("cuda:1")`,
   which raises `invalid device ordinal` on a one-GPU host and silently
   aborted the warmup. The tests assert scheduling, not hardware: pin
   `_device_ctx` to a no-op alongside the `_activate_thread_device` patch they
   already install, so they run on any host.

Measured on this 1-GPU host:

* `tests/test_hessian.py`: main 17 skipped -> 15 passed, 2 skipped (the two
  2-GPU merge tests).
* `tests/test_excluded_device_warmup.py`: main 3 failed -> 14 passed, 3
  skipped.
* `test_exl3_dispatch_concurrency.py`: main 3 failed -> skipped on this GIL
  build (the third test still needs the EXL3 extension, which cannot build
  here without CUDA_HOME, same as main).

Part 2 of the issue (hard-coded indices in `test_gptq.py`,
`test_g2h_tensor_quality.py`, `test_cuda_event_stream_activation_buffer.py`,
`test_fp4_llama3_fp4.py`) is left for a follow-up: those need per-test device
or capability selection, and the FP4 case is a mixed A100+5090 host.
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