Skip to content

Commit 2182f02

Browse files
committed
Remove non-gpu peripherals from the PCI database
1 parent d1ebb51 commit 2182f02

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

scripts/txt_to_db.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,22 @@
1313
SKIP_LINE_REGEX = re.compile(r"^\t{2,}")
1414
VENDOR_REGEX = re.compile(r"^([0-9a-fA-F]{4})\s+(.*)")
1515
DEVICE_REGEX = re.compile(r"^\t([0-9a-fA-F]{4})\s+(.*)")
16+
GPU_NAME_REGEXES = {
17+
AMD: {
18+
"include": re.compile(r"\b(?:radeon|instinct|fire|rage|polaris)\b", re.IGNORECASE),
19+
"exclude": re.compile(r"\b(?:audio|bridge)\b", re.IGNORECASE),
20+
},
21+
INTEL: {
22+
"include": re.compile(r"\b(?:arc)\b", re.IGNORECASE),
23+
"exclude": re.compile(r"\b(?:audio|bridge)\b", re.IGNORECASE),
24+
},
25+
NVIDIA: {
26+
"include": re.compile(r"\b(?:geforce|riva|quadro|tesla|ion|grid|rtx)\b", re.IGNORECASE),
27+
"exclude": re.compile(
28+
r"\b(?:audio|switch|pci|memory|smbus|ide|co-processor|bridge|usb|sata|controller)\b", re.IGNORECASE
29+
),
30+
},
31+
}
1632

1733

1834
def process_pci_file(input_file: str, output_db: str):
@@ -54,7 +70,10 @@ def process_pci_file(input_file: str, output_db: str):
5470
if match_device and vendor_id and vendor_name:
5571
device_id, device_name = match_device.groups()
5672

57-
if vendor_id == INTEL and not ARC_REGEX.search(device_name.lower()):
73+
include_regex = GPU_NAME_REGEXES[vendor_id]["include"]
74+
exclude_regex = GPU_NAME_REGEXES[vendor_id]["exclude"]
75+
76+
if not include_regex.search(device_name) or exclude_regex.search(device_name):
5877
continue
5978

6079
# Insert the vendor and device information into the database

torchruntime/gpu_pci_ids.db

-80 KB
Binary file not shown.

0 commit comments

Comments
 (0)