Fixes
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
#include "../intel/uarch.hpp"
|
#include "../intel/uarch.hpp"
|
||||||
#include "../intel/intel.hpp"
|
#include "../intel/intel.hpp"
|
||||||
#include "../hsa/hsa.hpp"
|
#include "../hsa/hsa.hpp"
|
||||||
|
#include "../hsa/uarch.hpp"
|
||||||
#include "../cuda/cuda.hpp"
|
#include "../cuda/cuda.hpp"
|
||||||
#include "../cuda/uarch.hpp"
|
#include "../cuda/uarch.hpp"
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ struct gpu_info* get_gpu_info_hsa(struct pci_dev *devices, int gpu_idx) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.vendor_name != "AMD") {
|
if (strcmp(info.vendor_name, "AMD") != 0) {
|
||||||
printErr("HSA vendor name is: '%s'. Only AMD is supported!", info.vendor_name);
|
printErr("HSA vendor name is: '%s'. Only AMD is supported!", info.vendor_name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -118,10 +118,9 @@ struct gpu_info* get_gpu_info_hsa(struct pci_dev *devices, int gpu_idx) {
|
|||||||
gpu->topo_h = get_topology_info(info);
|
gpu->topo_h = get_topology_info(info);
|
||||||
gpu->name = (char *) emalloc(sizeof(char) * (strlen(info.device_mkt_name) + 1));
|
gpu->name = (char *) emalloc(sizeof(char) * (strlen(info.device_mkt_name) + 1));
|
||||||
strcpy(gpu->name, info.device_mkt_name);
|
strcpy(gpu->name, info.device_mkt_name);
|
||||||
gpu->arch = get_uarch_from_hsa(gpu);
|
gpu->arch = get_uarch_from_hsa(gpu, info.gpu_name);
|
||||||
|
|
||||||
if (gpu->arch->TARGET_UNKNOWN_HSA) {
|
if (gpu->arch == NULL) {
|
||||||
printErr("Unknown LLVM target: '%s'", gpu->name);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,15 @@
|
|||||||
|
// TODO: Cleanup includes
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
#include "../common/uarch.hpp"
|
||||||
|
#include "../common/global.hpp"
|
||||||
|
#include "../common/gpu.hpp"
|
||||||
|
#include "chips.hpp"
|
||||||
|
|
||||||
// MICROARCH values
|
// MICROARCH values
|
||||||
enum {
|
enum {
|
||||||
UARCH_UNKNOWN,
|
UARCH_UNKNOWN,
|
||||||
@@ -225,7 +237,7 @@ GPUCHIP get_chip_from_target_hsa(int32_t target) {
|
|||||||
|
|
||||||
#define CHECK_TGT_STR_START if (false) {}
|
#define CHECK_TGT_STR_START if (false) {}
|
||||||
#define CHECK_TGT_STR(target, llvm_target, chip) \
|
#define CHECK_TGT_STR(target, llvm_target, chip) \
|
||||||
else if (target == llvm_target) return chip;
|
else if (strcmp(target, llvm_target) == 0) return chip;
|
||||||
#define CHECK_TGT_STR_END else { return TARGET_UNKNOWN_HSA; }
|
#define CHECK_TGT_STR_END else { return TARGET_UNKNOWN_HSA; }
|
||||||
|
|
||||||
// Maps the LLVM target string to the enum value
|
// Maps the LLVM target string to the enum value
|
||||||
@@ -259,13 +271,13 @@ int32_t get_llvm_target_from_str(char* target) {
|
|||||||
CHECK_TGT_STR_END
|
CHECK_TGT_STR_END
|
||||||
}
|
}
|
||||||
|
|
||||||
struct uarch* get_uarch_from_hsa(struct gpu_info* gpu) {
|
struct uarch* get_uarch_from_hsa(struct gpu_info* gpu, char* gpu_name) {
|
||||||
struct uarch* arch = (struct uarch*) emalloc(sizeof(struct uarch));
|
struct uarch* arch = (struct uarch*) emalloc(sizeof(struct uarch));
|
||||||
|
|
||||||
arch->llvm_target = get_llvm_target_from_str(gpu->name);
|
arch->llvm_target = get_llvm_target_from_str(gpu_name);
|
||||||
if (arch->llvm_target == TARGET_UNKNOWN_HSA) {
|
if (arch->llvm_target == TARGET_UNKNOWN_HSA) {
|
||||||
// Return early, error will be handled by the caller.
|
printErr("Unknown LLVM target: '%s'", gpu_name);
|
||||||
return arch;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
arch->chip_str = NULL;
|
arch->chip_str = NULL;
|
||||||
@@ -276,7 +288,7 @@ struct uarch* get_uarch_from_hsa(struct gpu_info* gpu) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Shouldnt we check that arch->uarch is valid?
|
// TODO: Shouldnt we check that arch->uarch is valid?
|
||||||
char* get_str_uarch_hsa(struct uarch* arch) {
|
const char* get_str_uarch_hsa(struct uarch* arch) {
|
||||||
return uarch_str[arch->uarch];
|
return uarch_str[arch->uarch];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
struct uarch;
|
struct uarch;
|
||||||
|
|
||||||
struct uarch* get_uarch_from_hsa(struct gpu_info* gpu);
|
struct uarch* get_uarch_from_hsa(struct gpu_info* gpu, char* gpu_name);
|
||||||
char* get_str_uarch_hsa(struct uarch* arch);
|
char* get_str_uarch_hsa(struct uarch* arch);
|
||||||
char* get_str_process(struct uarch* arch); // TODO: Shouldnt we define this in the cpp?
|
char* get_str_process(struct uarch* arch); // TODO: Shouldnt we define this in the cpp?
|
||||||
void free_uarch_struct(struct uarch* arch);
|
void free_uarch_struct(struct uarch* arch);
|
||||||
|
|||||||
Reference in New Issue
Block a user