Make hsa_agent_t handles use pointer to device::Device

For roc devices create hsa_agent_t handles using a pointer to the
device::Device. This ensures each device has a different hsa_agent_t
handle. This may be necessary to ensure the loader symbol lookup will
search only symbols for the correct device.

Change-Id: Iee6dd40d68bf22a02ce8c75cbe5ac8f5a0d9e418


[ROCm/clr commit: 76c371d78a]
This commit is contained in:
Tony Tye
2021-01-10 10:33:58 +00:00
szülő 4bfc88db5f
commit 2476472bcb
4 fájl változott, egészen pontosan 34 új sor hozzáadva és 18 régi sor törölve
@@ -438,10 +438,9 @@ bool LightningKernel::init() {
}
// Copy codeobject of this kernel from the program CPU segment
hsa_agent_t agent;
agent.handle = 1;
hsa_agent_t agent = {amd::Device::toHandle(&(device()))};
auto sym = prog().GetSymbol(symbolName().c_str(), const_cast<hsa_agent_t*>(&agent));
auto sym = prog().GetSymbol(symbolName().c_str(), &agent);
if (!setKernelCode(sym, &akc_)) {
return false;
@@ -452,13 +451,10 @@ bool LightningKernel::init() {
// handle device enqueue
if (!RuntimeHandle().empty()) {
hsa_agent_t agent;
agent.handle = 1;
amd::hsa::loader::Symbol* rth_symbol;
// Get the runtime handle symbol GPU address
rth_symbol = prog().GetSymbol(const_cast<char*>(RuntimeHandle().c_str()),
const_cast<hsa_agent_t*>(&agent));
rth_symbol = prog().GetSymbol(RuntimeHandle().c_str(), &agent);
uint64_t symbol_address;
rth_symbol->GetInfo(HSA_EXECUTABLE_SYMBOL_INFO_VARIABLE_ADDRESS, &symbol_address);