@@ -94,9 +94,11 @@ class TestGPUTypeDetection:
9494 """Test GPU type detection (discrete, integrated, none)."""
9595
9696 def test_nvidia_discrete_by_brand (self ):
97- assert get_gpu_type (NVIDIA , "1234" , "NVIDIA GeForce RTX 4080" ) == "DISCRETE"
98- assert get_gpu_type (NVIDIA , "1234" , "NVIDIA Quadro P1000" ) == "DISCRETE"
99- assert get_gpu_type (NVIDIA , "1234" , "NVIDIA Tesla V100" ) == "DISCRETE"
97+ # Note: In real PCI IDs database, GPU names include architecture codes
98+ # Testing with realistic device names that include arch codes
99+ assert get_gpu_type (NVIDIA , "2704" , "AD103 [GeForce RTX 4080]" ) == "DISCRETE"
100+ assert get_gpu_type (NVIDIA , "1cb1" , "GP107GL [Quadro P1000]" ) == "DISCRETE"
101+ assert get_gpu_type (NVIDIA , "1db4" , "GV100GL [Tesla V100]" ) == "DISCRETE"
100102
101103 def test_nvidia_discrete_by_arch_code (self ):
102104 assert get_gpu_type (NVIDIA , "1234" , "NVIDIA GP104" ) == "DISCRETE"
@@ -151,24 +153,24 @@ class TestPatternConstruction:
151153 """Test that patterns are correctly built without duplication."""
152154
153155 def test_nvidia_discrete_pattern_includes_all_architectures (self ):
154- """Verify NVIDIA_DISCRETE_PATTERN includes all architecture codes."""
156+ """Verify NVIDIA_DISCRETE_PATTERN includes all architecture codes (Kepler+) ."""
155157 from torchruntime .gpu_db import NVIDIA_DISCRETE_PATTERN
156158
157- # Test that all architecture patterns are included
159+ # Test that all architecture patterns are included (Kepler and newer)
158160 arch_codes = ["gk104" , "gm107" , "gp104" , "gv100" , "tu116" , "ga102" , "gh100" , "ad102" , "gb100" ]
159161 for code in arch_codes :
160162 assert NVIDIA_DISCRETE_PATTERN .search (code ), f"Pattern should match { code } "
161163
162- # Test brand names
163- brands = ["GeForce" , "Quadro" , "Tesla" , "RTX" , "GTX" , "Titan" ]
164- for brand in brands :
165- assert NVIDIA_DISCRETE_PATTERN .search (brand ), f"Pattern should match { brand } "
166-
167164 # Test Blackwell model numbers
168165 models = ["5060" , "5070" , "5080" , "5090" ]
169166 for model in models :
170167 assert NVIDIA_DISCRETE_PATTERN .search (model ), f"Pattern should match { model } "
171168
169+ # Brand names alone (without arch codes) are NOT supported for Kepler+ only detection
170+ # Pre-Kepler GPUs like "GeForce 8800 GTX" (G80) should NOT match
171+ assert not NVIDIA_DISCRETE_PATTERN .search ("GeForce 8800 GTX" )
172+ assert not NVIDIA_DISCRETE_PATTERN .search ("GeForce GTX 580" ) # GF110, pre-Kepler
173+
172174 def test_amd_discrete_pattern_separate (self ):
173175 """Verify AMD has a separate discrete pattern."""
174176 from torchruntime .gpu_db import AMD_DISCRETE_PATTERN
0 commit comments