[v0.11] Handle the case where the GPU is not found in the pci LUT
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
typedef uint32_t GPUCHIP;
|
||||
|
||||
enum {
|
||||
CHIP_UNKNOWN,
|
||||
CHIP_UNKNOWN_CUDA,
|
||||
CHIP_G80,
|
||||
CHIP_G80GL,
|
||||
CHIP_G84,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#define CHECK_PCI_START if (false) {}
|
||||
#define CHECK_PCI(pci, id, chip) \
|
||||
else if (pci->device_id == id) return chip;
|
||||
#define CHECK_PCI_END else { printBug("TODOO"); return CHIP_UNKNOWN; }
|
||||
#define CHECK_PCI_END else { printBug("Unkown CUDA device id: 0x%.4X", pci->device_id); return CHIP_UNKNOWN_CUDA; }
|
||||
|
||||
/*
|
||||
* pci ids were retrieved using https://github.com/pciutils/pciids
|
||||
|
||||
@@ -39,7 +39,7 @@ static const char *uarch_str[] = {
|
||||
#define CHECK_UARCH_START if (false) {}
|
||||
#define CHECK_UARCH(arch, chip_, str, uarch, process) \
|
||||
else if (arch->chip == chip_) fill_uarch(arch, str, uarch, process);
|
||||
#define CHECK_UARCH_END else { printBug("map_chip_to_uarch_cuda: Unknown chip id: %d", arch->chip); fill_uarch(arch, STRING_UNKNOWN, UARCH_UNKNOWN, 0); }
|
||||
#define CHECK_UARCH_END else { if(arch->chip != CHIP_UNKNOWN_CUDA) printBug("map_chip_to_uarch_cuda: Unknown chip id: %d", arch->chip); fill_uarch(arch, STRING_UNKNOWN, UARCH_UNKNOWN, 0); }
|
||||
|
||||
void fill_uarch(struct uarch* arch, char const *str, MICROARCH u, uint32_t process) {
|
||||
arch->chip_str = (char *) emalloc(sizeof(char) * (strlen(str)+1));
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#define CHECK_PCI_START if (false) {}
|
||||
#define CHECK_PCI(pci, id, chip) \
|
||||
else if (pci->device_id == id) return chip;
|
||||
#define CHECK_PCI_END else { printBug("TODOO"); return CHIP_UNKNOWN_INTEL; }
|
||||
#define CHECK_PCI_END else { printBug("Unkown Intel device id: 0x%.4X", pci->device_id); return CHIP_UNKNOWN_INTEL; }
|
||||
|
||||
/*
|
||||
* https://github.com/mesa3d/mesa/blob/main/include/pci_ids/i965_pci_ids.h
|
||||
|
||||
@@ -149,10 +149,14 @@ struct uarch* get_uarch_from_pci(struct pci* pci) {
|
||||
|
||||
arch->chip_str = NULL;
|
||||
arch->chip = get_chip_from_pci_intel(pci);
|
||||
if(arch->chip == CHIP_UNKNOWN_INTEL) {
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
map_chip_to_uarch_intel(arch);
|
||||
|
||||
return arch;
|
||||
}
|
||||
}
|
||||
|
||||
char* get_name_from_uarch(struct uarch* arch) {
|
||||
char* name = (char *) emalloc(sizeof(char) * (strlen(arch->chip_str) + 6 + 1));
|
||||
|
||||
Reference in New Issue
Block a user