SWDEV-486602 - Fix Windows 32 bit build
Windows alings fields to 8 bytes even with 32bit builds. Add BUG_CLR_SYSMEM_POOL to cotnrol sysmempool. Change-Id: I8622aabc9f7391ed7dd8583b252ce9eb41d62293
Dieser Commit ist enthalten in:
@@ -321,12 +321,20 @@ Command::Command(HostQueue& queue, cl_command_type type, const EventWaitList& ev
|
||||
SysmemPool<ComputeCommand>* Command::command_pool_ = new SysmemPool<ComputeCommand>;
|
||||
// ================================================================================================
|
||||
void Command::operator delete(void* ptr) {
|
||||
return command_pool_->Free(ptr);
|
||||
if (DEBUG_CLR_SYSMEM_POOL) {
|
||||
command_pool_->Free(ptr);
|
||||
} else {
|
||||
::operator delete (ptr);
|
||||
}
|
||||
}
|
||||
|
||||
// ================================================================================================
|
||||
void* Command::operator new(size_t size) {
|
||||
return command_pool_->Alloc(size);
|
||||
if (DEBUG_CLR_SYSMEM_POOL) {
|
||||
return command_pool_->Alloc(size);
|
||||
} else {
|
||||
return ::operator new (size);
|
||||
}
|
||||
}
|
||||
|
||||
// ================================================================================================
|
||||
|
||||
@@ -256,14 +256,17 @@ public:
|
||||
// Save the chunk allocation
|
||||
obj->base_ = active_allocs_[chunk_idx]->base_;
|
||||
obj->base_->busy_++;
|
||||
assert((reinterpret_cast<address>(&obj->object_) -
|
||||
reinterpret_cast<address>(obj)) == sizeof(AllocChunk*) && "Incorrect mem obj offset!");
|
||||
return &obj->object_;
|
||||
}
|
||||
|
||||
void Free(void* ptr) {
|
||||
#if IS_WINDOWS
|
||||
auto obj = reinterpret_cast<MemoryObject*>(
|
||||
reinterpret_cast<address>(ptr) - sizeof(MemoryObject*));
|
||||
reinterpret_cast<address>(ptr) - offsetof(MemoryObject, object_));
|
||||
#else
|
||||
auto obj = reinterpret_cast<MemoryObject*>(
|
||||
reinterpret_cast<address>(ptr) - sizeof(AllocChunk*));
|
||||
#endif
|
||||
auto freed = --obj->base_->free_;
|
||||
// If it's the last slot in the chunk, then release memory
|
||||
if (freed == 0) {
|
||||
@@ -300,7 +303,6 @@ private:
|
||||
~AllocChunk() { delete [] allocs_; }
|
||||
};
|
||||
|
||||
|
||||
std::atomic<uint64_t> current_alloc_ = 0; //!< Current allocation, global index
|
||||
std::atomic<size_t> max_chunk_idx_ = 0; //!< Current max chunk index
|
||||
size_t free_chunk_num_ = 0; //!< The number of freed chunks
|
||||
|
||||
@@ -261,6 +261,8 @@ release(uint, DEBUG_HIP_BLOCK_SYNC, 50, \
|
||||
"Blocks synchronization on CPU until the callback processing is done")\
|
||||
release(uint, DEBUG_CLR_MAX_BATCH_SIZE, 1000, \
|
||||
"Forces the callback to clean-up CPU submission queue") \
|
||||
release(bool, DEBUG_CLR_SYSMEM_POOL, true, \
|
||||
"Use sysmem pool implementation in runtime for amd commands") \
|
||||
release(bool, DEBUG_HIP_KERNARG_COPY_OPT, true, \
|
||||
"Enable/Disable multiple kern arg copies") \
|
||||
release(bool, DEBUG_CLR_USE_STDMUTEX_IN_AMD_MONITOR, false, \
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren