[v0.11] Adding uarch backend for intel iGPUs
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#ifndef __GPUCHIPS__
|
||||
#define __GPUCHIPS__
|
||||
#ifndef __CUDA_GPUCHIPS__
|
||||
#define __CUDA_GPUCHIPS__
|
||||
|
||||
typedef uint32_t GPUCHIP;
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ struct gpu_info* get_gpu_info_cuda(int gpu_idx) {
|
||||
strcpy(gpu->name, deviceProp.name);
|
||||
|
||||
struct pci_dev *devices = get_pci_devices_from_pciutils();
|
||||
gpu->pci = get_pci_from_pciutils(devices);
|
||||
gpu->pci = get_pci_from_pciutils(devices, PCI_VENDOR_ID_NVIDIA);
|
||||
gpu->arch = get_uarch_from_cuda(gpu);
|
||||
gpu->cach = get_cache_info(deviceProp);
|
||||
gpu->mem = get_memory_info(gpu, deviceProp);
|
||||
|
||||
@@ -10,20 +10,6 @@
|
||||
else if (pci->device_id == id) return chip;
|
||||
#define CHECK_PCI_END else { printBug("TODOO"); return CHIP_UNKNOWN; }
|
||||
|
||||
struct pci {
|
||||
uint16_t vendor_id;
|
||||
uint16_t device_id;
|
||||
};
|
||||
|
||||
struct pci* get_pci_from_pciutils(struct pci_dev *devices) {
|
||||
struct pci* pci = (struct pci*) emalloc(sizeof(struct pci));
|
||||
|
||||
pci->vendor_id = pciutils_get_pci_vendor_id(devices);
|
||||
pci->device_id = pciutils_get_pci_device_id(devices);
|
||||
|
||||
return pci;
|
||||
}
|
||||
|
||||
/*
|
||||
* pci ids were retrieved using https://github.com/pciutils/pciids
|
||||
* and parsed using a custom script to take only the relevant
|
||||
|
||||
@@ -6,6 +6,12 @@
|
||||
#include "../common/pci.hpp"
|
||||
#include "chips.hpp"
|
||||
|
||||
/*
|
||||
* doc: https://wiki.osdev.org/PCI#Class_Codes
|
||||
* https://pci-ids.ucw.cz/read/PC
|
||||
*/
|
||||
#define PCI_VENDOR_ID_NVIDIA 0x10de
|
||||
|
||||
struct pci;
|
||||
|
||||
struct pci* get_pci_from_pciutils(struct pci_dev *devices);
|
||||
|
||||
@@ -3,12 +3,11 @@
|
||||
#include <stdint.h>
|
||||
#include <cstddef>
|
||||
|
||||
#include "../common/uarch.hpp"
|
||||
#include "../common/global.hpp"
|
||||
#include "../common/gpu.hpp"
|
||||
#include "chips.hpp"
|
||||
|
||||
typedef uint32_t MICROARCH;
|
||||
|
||||
// Any clock multiplier
|
||||
#define CM_ANY -1
|
||||
|
||||
@@ -43,19 +42,6 @@ static const char *uarch_str[] = {
|
||||
/*[ARCH_AMPERE] = */ "Ampere",
|
||||
};
|
||||
|
||||
struct uarch {
|
||||
int32_t cc_major;
|
||||
int32_t cc_minor;
|
||||
int32_t compute_capability;
|
||||
|
||||
MICROARCH uarch;
|
||||
GPUCHIP chip;
|
||||
|
||||
int32_t process;
|
||||
char* uarch_str;
|
||||
char* chip_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);
|
||||
|
||||
Reference in New Issue
Block a user