diff --git a/projects/clr/rocclr/runtime/device/device.hpp b/projects/clr/rocclr/runtime/device/device.hpp index e455832513..b9d45cfe22 100644 --- a/projects/clr/rocclr/runtime/device/device.hpp +++ b/projects/clr/rocclr/runtime/device/device.hpp @@ -732,6 +732,9 @@ class Memory : public amd::HeapObject { virtual uint64_t virtualAddress() const { return 0; } + //! Returns CPU pointer to HW state + virtual const address cpuSrd() const { return nullptr; } + virtual void IpcCreate(size_t offset, size_t* mem_size, void* handle) const { ShouldNotReachHere(); } @@ -778,7 +781,7 @@ class Memory : public amd::HeapObject { class Sampler : public amd::HeapObject { public: //! Constructor - Sampler() : hwSrd_(0) {} + Sampler() : hwSrd_(0), hwState_(nullptr) {} //! Default destructor for the device memory object virtual ~Sampler(){}; @@ -786,8 +789,12 @@ class Sampler : public amd::HeapObject { //! Returns device specific HW state for the sampler uint64_t hwSrd() const { return hwSrd_; } + //! Returns CPU pointer to HW state + const address hwState() const { return hwState_; } + protected: uint64_t hwSrd_; //!< Device specific HW state for the sampler + address hwState_; //!< CPU pointer to HW state private: //! Disable default copy constructor diff --git a/projects/clr/rocclr/runtime/device/pal/paldevice.hpp b/projects/clr/rocclr/runtime/device/pal/paldevice.hpp index d95faa1377..4528954dc2 100644 --- a/projects/clr/rocclr/runtime/device/pal/paldevice.hpp +++ b/projects/clr/rocclr/runtime/device/pal/paldevice.hpp @@ -169,8 +169,6 @@ class Sampler : public device::Sampler { bool create(const amd::Sampler& owner //!< AMD sampler object ); - const void* hwState() const { return hwState_; } - private: //! Disable default copy constructor Sampler& operator=(const Sampler&); @@ -179,7 +177,6 @@ class Sampler : public device::Sampler { Sampler(const Sampler&); const Device& dev_; //!< Device object associated with the sampler - address hwState_; //!< GPU HW state (\todo legacy path) }; //! A GPU device ordinal (physical GPU device) diff --git a/projects/clr/rocclr/runtime/device/pal/palmemory.hpp b/projects/clr/rocclr/runtime/device/pal/palmemory.hpp index 00fd8736d3..d84b23cbe6 100644 --- a/projects/clr/rocclr/runtime/device/pal/palmemory.hpp +++ b/projects/clr/rocclr/runtime/device/pal/palmemory.hpp @@ -119,6 +119,8 @@ class Memory : public device::Memory, public Resource { virtual uint64_t virtualAddress() const override { return vmAddress(); } + virtual const address cpuSrd() const { return reinterpret_cast(const_cast(hwState())); } + //! Allocates host memory for synchronization with MGPU context void mgpuCacheWriteBack(); diff --git a/projects/clr/rocclr/runtime/device/rocm/rocmemory.hpp b/projects/clr/rocclr/runtime/device/rocm/rocmemory.hpp index 3b9611c1df..3788f5a237 100644 --- a/projects/clr/rocclr/runtime/device/rocm/rocmemory.hpp +++ b/projects/clr/rocclr/runtime/device/rocm/rocmemory.hpp @@ -78,6 +78,8 @@ class Memory : public device::Memory { virtual uint64_t virtualAddress() const override { return reinterpret_cast(getDeviceMemory()); } + virtual const address cpuSrd() const override { return reinterpret_cast(getDeviceMemory()); } + // Accessors for indirect map memory object amd::Memory* mapMemory() const { return mapMemory_; }