Delete roc::Program::hsaDevice

Delete roc::Program::hsaDevice and access directly from device
associated with program. This allows to be clear if the device is a
NullDevice which has no meaningful HSA agent backend device.

Change-Id: I81f96aff47bf9b8166d0ff6a5efc7c01f0fb6de3
Этот коммит содержится в:
Tony Tye
2021-01-10 02:32:45 +00:00
родитель c1ea70b539
Коммит 783fe2e01b
2 изменённых файлов: 5 добавлений и 9 удалений
+5 -6
Просмотреть файл
@@ -71,7 +71,7 @@ bool LightningKernel::init() {
// Get the kernel code handle // Get the kernel code handle
hsa_status_t hsaStatus; hsa_status_t hsaStatus;
hsa_executable_symbol_t symbol; hsa_executable_symbol_t symbol;
hsa_agent_t agent = program()->hsaDevice(); hsa_agent_t agent = program()->rocDevice().getBackendDevice();
hsaStatus = hsa_executable_get_symbol_by_name(program()->hsaExecutable(), hsaStatus = hsa_executable_get_symbol_by_name(program()->hsaExecutable(),
symbolName().c_str(), symbolName().c_str(),
&agent, &symbol); &agent, &symbol);
@@ -142,8 +142,8 @@ bool LightningKernel::init() {
} }
uint32_t wavefront_size = 0; uint32_t wavefront_size = 0;
if (hsa_agent_get_info(program()->hsaDevice(), HSA_AGENT_INFO_WAVEFRONT_SIZE, &wavefront_size) != if (hsa_agent_get_info(program()->rocDevice().getBackendDevice(), HSA_AGENT_INFO_WAVEFRONT_SIZE,
HSA_STATUS_SUCCESS) { &wavefront_size) != HSA_STATUS_SUCCESS) {
DevLogPrintfError("[ROC][Kernel] Cannot get Wavefront Size, failed with hsa_status: %d \n", DevLogPrintfError("[ROC][Kernel] Cannot get Wavefront Size, failed with hsa_status: %d \n",
hsaStatus); hsaStatus);
return false; return false;
@@ -177,8 +177,6 @@ bool LightningKernel::init() {
#if defined(WITH_COMPILER_LIB) #if defined(WITH_COMPILER_LIB)
bool HSAILKernel::init() { bool HSAILKernel::init() {
acl_error errorCode; acl_error errorCode;
// compile kernel down to ISA
hsa_agent_t hsaDevice = program()->hsaDevice();
// Pull out metadata from the ELF // Pull out metadata from the ELF
size_t sizeOfArgList; size_t sizeOfArgList;
aclCompiler* compileHandle = program()->rocDevice().compiler(); aclCompiler* compileHandle = program()->rocDevice().compiler();
@@ -222,7 +220,8 @@ bool HSAILKernel::init() {
} }
uint32_t wavefront_size = 0; uint32_t wavefront_size = 0;
hsa_status_t hsaStatus = hsa_agent_get_info(program()->hsaDevice(), HSA_AGENT_INFO_WAVEFRONT_SIZE, &wavefront_size); hsa_status_t hsaStatus = hsa_agent_get_info(program()->rocDevice().getBackendDevice(),
HSA_AGENT_INFO_WAVEFRONT_SIZE, &wavefront_size);
if (HSA_STATUS_SUCCESS != hsaStatus) { if (HSA_STATUS_SUCCESS != hsaStatus) {
DevLogPrintfError("Could not get Wave Info Size: %d, failed with hsa_status: %d \n", DevLogPrintfError("Could not get Wave Info Size: %d, failed with hsa_status: %d \n",
errorCode, hsaStatus); errorCode, hsaStatus);
-3
Просмотреть файл
@@ -57,9 +57,6 @@ class Program : public device::Program {
return static_cast<const Device&>(device()); return static_cast<const Device&>(device());
} }
//! Returns the hsaBinary associated with the program
hsa_agent_t hsaDevice() const { return rocNullDevice().getBackendDevice(); }
hsa_executable_t hsaExecutable() const { hsa_executable_t hsaExecutable() const {
assert(!isNull()); assert(!isNull());
return hsaExecutable_; return hsaExecutable_;