diff --git a/rocclr/device/device.cpp b/rocclr/device/device.cpp index e620ff6308..b60e1df167 100644 --- a/rocclr/device/device.cpp +++ b/rocclr/device/device.cpp @@ -683,7 +683,6 @@ char* Device::getExtensionString() { return result; } - } // namespace amd namespace device { diff --git a/rocclr/platform/context.hpp b/rocclr/platform/context.hpp index 4ce9f07652..e8bcacb1ea 100644 --- a/rocclr/platform/context.hpp +++ b/rocclr/platform/context.hpp @@ -174,6 +174,11 @@ class Context : public RuntimeObject { //! Returns the context info structure const Info& info() const { return info_; } + void setInfo(Info info) { + info_ = info; + return; + } + //! Returns a pointer to the original properties const cl_context_properties* properties() const { return properties_; } @@ -208,7 +213,7 @@ class Context : public RuntimeObject { { deviceQueues_[&dev].defDeviceQueue_ = queue; }; private: - const Info info_; //!< Context info structure + Info info_; //!< Context info structure cl_context_properties* properties_; //!< Original properties GLFunctions* glenv_; //!< OpenGL context Device* customHostAllocDevice_; //!< Device responsible for host allocations diff --git a/rocclr/platform/memory.cpp b/rocclr/platform/memory.cpp index 855bd65d58..b1b3ff1229 100644 --- a/rocclr/platform/memory.cpp +++ b/rocclr/platform/memory.cpp @@ -301,6 +301,11 @@ bool Memory::create(void* initFrom, bool sysMemAlloc, bool skipAlloc, bool force LogPrintfError("Can't allocate memory size - 0x%08X bytes!", getSize()); return false; } + if (isInterop()) { + // Interop resources dont' have svm allocations, we use device address for mapping. + amd::MemObjMap::AddMemObj( + reinterpret_cast(static_cast(mem->virtualAddress())), this); + } } } @@ -410,6 +415,10 @@ Memory::~Memory() { if (NULL != deviceMemories_) { // Destroy all device memory objects for (uint i = 0; i < numDevices_; ++i) { + if (isInterop() && deviceMemories_[i].value_ != nullptr) { + amd::MemObjMap::RemoveMemObj(reinterpret_cast( + static_cast(deviceMemories_[i].value_->virtualAddress()))); + } delete deviceMemories_[i].value_; } }