Skip to content

Conversation

@yurekami
Copy link
Contributor

Description

Add pytest configuration and reusable fixtures for DeepGEMM tests.

Features

Auto-Configuration

  • Auto-marks tests based on file names (test_fp8.py@pytest.mark.fp8)
  • Auto-skips GPU tests when CUDA is not available

Session Fixtures

Fixture Description
cuda_device Provides CUDA device, skips if unavailable
gpu_arch Returns GPU architecture major version (9=Hopper, 10=Blackwell)
is_hopper Boolean check for SM90 GPU
is_blackwell Boolean check for SM100 GPU
deep_gemm_module Provides imported deep_gemm module
env_vars Dict of common DeepGEMM environment variables

Test Fixtures

Fixture Description
reset_cuda_memory Auto-cleanup CUDA memory after each test (autouse)
random_seed Reproducible random state (seed=42)

Usage Example

def test_fp8_gemm(cuda_device, is_hopper):
    if not is_hopper:
        pytest.skip("Requires Hopper GPU")
    # test code using cuda_device...

Benefits

  • Automatic GPU detection and test skipping
  • Reusable fixtures reduce code duplication
  • Memory cleanup prevents OOM in test suites
  • Works with pytest.ini markers from PR Add pytest configuration #265

Testing

  • Valid Python syntax
  • Verify fixtures work with existing tests

🤖 Generated with Claude Code

Add pytest configuration and reusable fixtures for tests:

Auto-Configuration:
- Auto-mark tests based on file names (fp8, bf16, attention, einsum)
- Auto-skip GPU tests when CUDA is not available

Session Fixtures:
- cuda_device: Provides CUDA device, skips if unavailable
- gpu_arch: Returns GPU architecture major version
- is_hopper: Check for SM90 GPU
- is_blackwell: Check for SM100 GPU
- deep_gemm_module: Provides imported deep_gemm module
- env_vars: Common DeepGEMM environment variables

Test Fixtures:
- reset_cuda_memory: Auto-cleanup CUDA memory after each test
- random_seed: Reproducible random state (seed=42)

Usage:
  def test_fp8_gemm(cuda_device, is_hopper):
      if not is_hopper:
          pytest.skip("Requires Hopper GPU")
      # test code...

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
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