Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions app/verify/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,30 @@ def gpu_signals(rec: dict[str, Any], now_year: int) -> list[Signal]:
_cmp_ge("boost_ge_base", rec.get("boost_clock_mhz"), rec.get("base_clock_mhz"), hard=True),
_release_not_future(rec, now_year),
]
# Vendor core field present: nvidia -> cuda_cores, amd/intel -> stream_processors.
# The core count belongs in the vendor's own field: nvidia -> cuda_cores,
# amd/intel -> stream_processors. Carrying the OTHER vendor's field is a
# contradiction and is flagged. Carrying NEITHER is not: it is an absence,
# which `completeness` already scores (both fields are gpu RICH_FIELDS), and
# scoring it here too charged the same gap twice under a name that claims the
# record disagrees with itself. It also misread pre-unified-shader parts —
# an NV1 or a RIVA 128 predates the concept of a CUDA core, so the field is
# inapplicable rather than missing. Of 281 records flagged before this
# change, 279 were plain gaps and 2 were real vendor mismatches.
mfr = str(rec.get("manufacturer") or "").lower()
cuda, stream = _num(rec.get("cuda_cores")), _num(rec.get("stream_processors"))
if mfr == "nvidia":
has_core = _num(rec.get("cuda_cores")) is not None
own, foreign = cuda, stream
elif mfr in {"amd", "intel"}:
has_core = _num(rec.get("stream_processors")) is not None
own, foreign = stream, cuda
else:
has_core = (
_num(rec.get("cuda_cores")) is not None
or _num(rec.get("stream_processors")) is not None
)
out.append(Signal("vendor_core_field", "pass" if has_core else "fail", hard=False))
own, foreign = (cuda if cuda is not None else stream), None
if own is not None:
result = "pass"
elif foreign is not None:
result = "fail" # the count is filed under the wrong vendor's field
else:
result = "na"
out.append(Signal("vendor_core_field", result, hard=False))
# RT / Tensor cores only plausible on post-2018 (Turing / RDNA2) parts.
y = _year_of(rec.get("release_date"))
rt = _num(rec.get("rt_cores"))
Expand Down
19 changes: 19 additions & 0 deletions tests/verify/test_signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,22 @@ def test_real_soc_date_is_compared_exactly():
def test_soc_process_nm_era():
rec = {"process_nm": 5.0, "release_date": "2010-01-01", "gpu_name": "x"}
assert _named(signals.soc_signals(rec, NOW), "process_nm_era").result == "fail"


def test_missing_core_count_is_not_a_contradiction():
"""An absent core count is a gap `completeness` already scores — and on a
pre-unified-shader part the field does not apply at all."""
riva = {"manufacturer": "nvidia", "name": "RIVA 128", "release_date": "1997-08-25"}
assert _named(signals.gpu_signals(riva, NOW), "vendor_core_field").result == "na"


def test_core_count_under_the_wrong_vendor_field_fails():
rec = {"manufacturer": "amd", "cuda_cores": 2048, "release_date": "2020-01-01"}
assert _named(signals.gpu_signals(rec, NOW), "vendor_core_field").result == "fail"
rec = {"manufacturer": "nvidia", "stream_processors": 2048, "release_date": "2020-01-01"}
assert _named(signals.gpu_signals(rec, NOW), "vendor_core_field").result == "fail"


def test_core_count_in_the_right_field_passes():
rec = {"manufacturer": "amd", "stream_processors": 2048, "release_date": "2020-01-01"}
assert _named(signals.gpu_signals(rec, NOW), "vendor_core_field").result == "pass"
Loading