[v0.01] First approach to map pci ids to gpu chip/uarch

This commit is contained in:
Dr-Noob
2021-08-13 13:50:25 +02:00
parent bdc4fd7c45
commit a08c06f67a
7 changed files with 1111 additions and 15 deletions

View File

@@ -4,9 +4,10 @@
#include <cstddef>
#include "../common/global.hpp"
#include "../common/gpu.hpp"
#include "chips.hpp"
typedef uint32_t MICROARCH;
typedef uint32_t GPUCHIP;
// Data not available
#define NA -1
@@ -14,6 +15,7 @@ typedef uint32_t GPUCHIP;
// Unknown manufacturing process
#define UNK -1
// MICROARCH values
enum {
UARCH_UNKNOWN,
UARCH_TESLA,
@@ -26,15 +28,6 @@ enum {
UARCH_AMPERE,
};
// TODO
enum {
CHIP_GA100,
CHIP_GA102,
CHIP_GA104,
CHIP_GA106,
CHIP_GA107
};
static const char *uarch_str[] = {
/*[ARCH_UNKNOWN = */ STRING_UNKNOWN,
/*[ARCH_TESLA] = */ "Tesla",
@@ -51,10 +44,13 @@ struct uarch {
int32_t cc_major;
int32_t cc_minor;
int32_t compute_capability;
MICROARCH uarch;
GPUCHIP chip;
char* uarch_str;
int32_t process;
char* uarch_str;
char* chip_str;
};
void map_cc_to_uarch(struct uarch* arch) {
@@ -109,12 +105,15 @@ struct uarch* get_uarch_from_cuda(struct gpu_info* gpu) {
cudaDeviceProp deviceProp;
cudaGetDeviceProperties(&deviceProp, dev);
arch->chip_str = NULL;
arch->cc_major = deviceProp.major;
arch->cc_minor = deviceProp.minor;
arch->compute_capability = deviceProp.major * 10 + deviceProp.minor;
map_cc_to_uarch(arch);
arch->chip = get_chip_from_pci(gpu->pci);
return arch;
}
@@ -133,6 +132,10 @@ char* get_str_process(struct uarch* arch) {
return NULL;
}
char* get_str_chip(struct uarch* arch) {
return arch->chip_str;
}
void free_uarch_struct(struct uarch* arch) {
}