diff --git a/rocclr/runtime/device/gpu/gpudevice.hpp b/rocclr/runtime/device/gpu/gpudevice.hpp index df65c498f9..5653973eb4 100644 --- a/rocclr/runtime/device/gpu/gpudevice.hpp +++ b/rocclr/runtime/device/gpu/gpudevice.hpp @@ -467,6 +467,9 @@ public: //! Gets the GPU resource associated with the global heap const Memory& globalMem() const { return heap_.resource(); } + //! Gets the device context object + amd::Context& context() const { return *context_; } + //! Gets the global heap object const Heap& heap() const { return heap_; } diff --git a/rocclr/runtime/device/gpu/gpumemory.cpp b/rocclr/runtime/device/gpu/gpumemory.cpp index 0534ffe201..3102545416 100644 --- a/rocclr/runtime/device/gpu/gpumemory.cpp +++ b/rocclr/runtime/device/gpu/gpumemory.cpp @@ -900,8 +900,8 @@ Memory::allocMapTarget( if (memory == NULL) { // for map target of svm buffer , we need use svm host ptr - memory = new(owner()->getContext()) - amd::Buffer(owner()->getContext(), flag, owner()->getSize()); + memory = new(dev().context()) + amd::Buffer(dev().context(), flag, owner()->getSize()); Memory* gpuMemory; do { @@ -1242,8 +1242,8 @@ Image::allocMapTarget( // Allocate a new buffer to use as the map target //! @note Allocate a 1D buffer, since CAL issues with 3D //! Also HW doesn't support untiled images - memory = new (owner()->getContext()) - amd::Buffer(owner()->getContext(), 0, + memory = new (dev().context()) + amd::Buffer(dev().context(), 0, cal()->width_ * height * depth * elementSize()); memory->setVirtualDevice(owner()->getVirtualDevice());