SWDEV-543723 - Change agentInfo parameter in hostAlloc to void* (#995)

This commit is contained in:
Ioannis Assiouras
2025-09-18 11:43:15 +01:00
committed by GitHub
orang tua a29e1d08d4
melakukan 5c1eebab84
3 mengubah file dengan 5 tambahan dan 4 penghapusan
@@ -539,7 +539,7 @@ class Device : public NullDevice {
//! host memory alloc
virtual void* hostAlloc(size_t size, size_t alignment, MemorySegment mem_seg = kNoAtomics,
const void* agentInfo = nullptr) const;
const void* agentInfo = nullptr) const override;
//! SVM allocation
virtual void* svmAlloc(amd::Context& context, size_t size, size_t alignment,
@@ -2007,13 +2007,14 @@ hsa_amd_memory_pool_t Device::getHostMemoryPool(MemorySegment mem_seg,
// ================================================================================================
void* Device::hostAlloc(size_t size, size_t alignment, MemorySegment mem_seg,
const AgentInfo* agentInfo) const {
const void* agentInfo) const {
void* ptr = nullptr;
uint32_t memFlags = 0;
if (mem_seg == kKernArg) {
memFlags |= HSA_AMD_MEMORY_POOL_EXECUTABLE_FLAG;
}
hsa_amd_memory_pool_t pool = getHostMemoryPool(mem_seg, agentInfo);
hsa_amd_memory_pool_t pool =
getHostMemoryPool(mem_seg, static_cast<const amd::roc::AgentInfo*>(agentInfo));
hsa_status_t stat = hsa_amd_memory_pool_allocate(pool, size, memFlags, &ptr);
ClPrint(amd::LOG_DEBUG, amd::LOG_MEM,
"Allocate hsa host memory %p, size 0x%zx,"
@@ -414,7 +414,7 @@ class Device : public NullDevice {
virtual bool globalFreeMemory(size_t* freeMemory) const;
virtual void* hostAlloc(size_t size, size_t alignment,
MemorySegment mem_seg = MemorySegment::kNoAtomics,
const AgentInfo* agentInfo = nullptr) const; // nullptr uses default CPU agent
const void* agentInfo = nullptr) const override; // nullptr uses default CPU agent
virtual void hostFree(void* ptr, size_t size = 0) const;
bool deviceAllowAccess(void* dst) const;