SWDEV-348678 - hipManagedVar to initialize on all devices
Change-Id: Id714b56e89e4930ee067f3a7472a0029057d2711
Šī revīzija ir iekļauta:
@@ -843,7 +843,7 @@ hipError_t StatCO::initStatManagedVarDevicePtr(int deviceId) {
|
||||
DeviceVar* dvar = nullptr;
|
||||
IHIP_RETURN_ONFAIL(var->getStatDeviceVar(&dvar, deviceId));
|
||||
|
||||
amd::HostQueue* queue = hip::getNullStream();
|
||||
amd::HostQueue* queue = g_devices.at(deviceId)->NullStream();
|
||||
if (queue != nullptr) {
|
||||
err = ihipMemcpy(reinterpret_cast<address>(dvar->device_ptr()), var->getManagedVarPtr(),
|
||||
dvar->size(), hipMemcpyHostToDevice, *queue);
|
||||
|
||||
@@ -40,11 +40,16 @@ void __hipGetPCH(const char** pch, unsigned int *size) {
|
||||
namespace hip {
|
||||
|
||||
//Device Vars
|
||||
DeviceVar::DeviceVar(std::string name, hipModule_t hmod) : shadowVptr(nullptr), name_(name),
|
||||
amd_mem_obj_(nullptr), device_ptr_(nullptr),
|
||||
size_(0) {
|
||||
DeviceVar::DeviceVar(std::string name,
|
||||
hipModule_t hmod,
|
||||
int deviceId) :
|
||||
shadowVptr(nullptr), name_(name),
|
||||
amd_mem_obj_(nullptr), device_ptr_(nullptr),
|
||||
size_(0) {
|
||||
amd::Program* program = as_amd(reinterpret_cast<cl_program>(hmod));
|
||||
device::Program* dev_program = program->getDeviceProgram(*hip::getCurrentDevice()->devices()[0]);
|
||||
device::Program* dev_program =
|
||||
program->getDeviceProgram(*g_devices.at(deviceId)->devices()[0]);
|
||||
|
||||
if (dev_program == nullptr) {
|
||||
LogPrintfError("Cannot get Device Program for module: 0x%x \n", hmod);
|
||||
guarantee(false, "Cannot get Device Program");
|
||||
@@ -206,7 +211,7 @@ hipError_t Var::getDeviceVar(DeviceVar** dvar, int deviceId, hipModule_t hmod) {
|
||||
"Device Var not initialized to size");
|
||||
|
||||
if (dVar_[deviceId] == nullptr) {
|
||||
dVar_[deviceId] = new DeviceVar(name_, hmod);
|
||||
dVar_[deviceId] = new DeviceVar(name_, hmod, deviceId);
|
||||
}
|
||||
|
||||
*dvar = dVar_[deviceId];
|
||||
@@ -221,7 +226,7 @@ hipError_t Var::getStatDeviceVar(DeviceVar** dvar, int deviceId) {
|
||||
hipModule_t hmod = nullptr;
|
||||
IHIP_RETURN_ONFAIL((*modules_)->BuildProgram(deviceId));
|
||||
IHIP_RETURN_ONFAIL((*modules_)->GetModule(deviceId, &hmod));
|
||||
dVar_[deviceId] = new DeviceVar(name_, hmod);
|
||||
dVar_[deviceId] = new DeviceVar(name_, hmod, deviceId);
|
||||
}
|
||||
*dvar = dVar_[deviceId];
|
||||
return hipSuccess;
|
||||
|
||||
@@ -18,7 +18,7 @@ class CodeObject;
|
||||
//Device Structures
|
||||
class DeviceVar {
|
||||
public:
|
||||
DeviceVar(std::string name, hipModule_t hmod);
|
||||
DeviceVar(std::string name, hipModule_t hmod, int deviceId);
|
||||
~DeviceVar();
|
||||
|
||||
//Accessors for device ptr and size, populated during constructor.
|
||||
|
||||
@@ -343,7 +343,10 @@ hipError_t ihipModuleLaunchKernel(hipFunction_t f, uint32_t globalWorkSizeX,
|
||||
startEvent, stopEvent, flags, params);
|
||||
|
||||
int deviceId = hip::Stream::DeviceId(hStream);
|
||||
HIP_RETURN_ONFAIL(PlatformState::instance().initStatManagedVarDevicePtr(deviceId));
|
||||
for (size_t dev = 0; dev < g_devices.size(); ++dev) {
|
||||
HIP_RETURN_ONFAIL(PlatformState::instance().initStatManagedVarDevicePtr(dev));
|
||||
}
|
||||
|
||||
if (f == nullptr) {
|
||||
LogPrintfError("%s", "Function passed is null");
|
||||
return hipErrorInvalidImage;
|
||||
|
||||
Atsaukties uz šo jaunā problēmā
Block a user