SWDEV-292714 - Add unique id for each allocation to support HIP_POINTER_ATTRIBUTE_BUFFER_ID

Change-Id: Ibb3fcb2d0bbbef03525fc884d5b3e9b5f6c11423


[ROCm/clr commit: c56317b2e0]
This commit is contained in:
Satyanvesh Dittakavi
2021-09-27 19:12:50 +00:00
bovenliggende b3edecda2c
commit 1caf1e4936
2 gewijzigde bestanden met toevoegingen van 8 en 2 verwijderingen
@@ -28,6 +28,9 @@
#include <atomic>
// Stores the no. of memory allocations
std::atomic<uint32_t> numAllocs = 0;
namespace amd {
bool BufferRect::create(const size_t* bufferOrigin, const size_t* region, size_t bufferRowPitch,
@@ -309,6 +312,8 @@ bool Memory::create(void* initFrom, bool sysMemAlloc, bool skipAlloc, bool force
}
}
// Store the unique id for each memory allocation
uniqueId_ = ++numAllocs;
return true;
}
@@ -188,7 +188,8 @@ class Memory : public amd::RuntimeObject {
};
uint32_t flagsEx_;
};
//! unique buffer id for each memory allocation
uint32_t uniqueId_ = 0;
//! used to save the user data during memory allocation.
UserData userData_;
@@ -366,7 +367,7 @@ class Memory : public amd::RuntimeObject {
device::Memory* BaseP2PMemory() const { return deviceMemories_[0].value_; }
device::Memory* svmBase() const { return svmBase_; } //!< Returns SVM base for MGPU case
uint32_t getUniqueId() { return uniqueId_; }
//!save the user data during memory allocation
UserData& getUserData() { return userData_; }