Files
d4r/tools/d4r_gpu_identity.h
T
ayo 2558fcbd39 Improve GPU compatibility, RDNA2 kernels and startup diagnostics
- Match render/compute adapters and gate RR models by GPU capabilities
- Add RDNA2 native texture kernels and fix FP16 rounding
- Harden model builds, cache validation and packaging
- Add startup tracing, timeouts, documentation and regression tests
2026-10-19 11:36:40 -04:00

27 lines
997 B
C

/* PCI identity comparisons shared by the Wine bridge and CPU tests. */
#pragma once
#include <stdio.h>
typedef struct D4rPciAddress { unsigned domain, bus, device, function; } D4rPciAddress;
static int d4r_parse_pci(const char* text, D4rPciAddress* out)
{
char extra;
return text != NULL && sscanf(text, "%x:%x:%x.%x%c", &out->domain, &out->bus,
&out->device, &out->function, &extra) == 4 && out->bus <= 255 && out->device <= 31 && out->function <= 7;
}
static int d4r_same_pci(const char* a, const char* b)
{
D4rPciAddress x, y;
return d4r_parse_pci(a, &x) && d4r_parse_pci(b, &y) && x.domain == y.domain &&
x.bus == y.bus && x.device == y.device && x.function == y.function;
}
static int d4r_pci_matches_kfd(const char* pci, unsigned long domain, unsigned long location)
{
D4rPciAddress address;
return d4r_parse_pci(pci, &address) && address.domain == domain &&
((address.bus << 8) | (address.device << 3) | address.function) == location;
}