SWDEV-336024 - Clear device heap to 0 in ROCr path
Change-Id: Id100ca6d6d5bd7fb16ca8c98ff0b12c9df1d69ab
[ROCm/clr commit: 830898753d]
Этот коммит содержится в:
@@ -1087,6 +1087,7 @@ void PAL_STDCALL Device::PalDeveloperCallback(void* pPrivateData, const Pal::uin
|
||||
#endif // PAL_GPUOPEN_OCL
|
||||
}
|
||||
|
||||
// ================================================================================================
|
||||
bool Device::initializeHeapResources() {
|
||||
amd::ScopedLock k(lockForInitHeap_);
|
||||
if (!heapInitComplete_) {
|
||||
@@ -1154,13 +1155,18 @@ bool Device::initializeHeapResources() {
|
||||
xferQueue_->enableSyncedBlit();
|
||||
if (amd::IS_HIP) {
|
||||
// Allocate initial heap for device memory allocator
|
||||
static constexpr size_t HeapBufferSize = 1024 * Ki;
|
||||
static constexpr size_t HeapBufferSize = 128 * Ki;
|
||||
heap_buffer_ = createMemory(HeapBufferSize);
|
||||
if (heap_buffer_ == nullptr) {
|
||||
LogError("Heap buffer allocation failed!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// ================================================================================================
|
||||
device::VirtualDevice* Device::createVirtualDevice(amd::CommandQueue* queue) {
|
||||
bool profiling = false;
|
||||
uint rtCUs = amd::CommandQueue::RealTimeDisabled;
|
||||
|
||||
@@ -540,6 +540,7 @@ void Device::tearDown() {
|
||||
hsa_shut_down();
|
||||
}
|
||||
|
||||
// ================================================================================================
|
||||
bool Device::create() {
|
||||
char agent_name[64] = {0};
|
||||
if (HSA_STATUS_SUCCESS != hsa_agent_get_info(bkendDevice_, HSA_AGENT_INFO_NAME, agent_name)) {
|
||||
@@ -788,13 +789,22 @@ bool Device::create() {
|
||||
|
||||
if (amd::IS_HIP) {
|
||||
// Allocate initial heap for device memory allocator
|
||||
static constexpr size_t HeapBufferSize = 1024 * Ki;
|
||||
static constexpr size_t HeapBufferSize = 128 * Ki;
|
||||
heap_buffer_ = createMemory(HeapBufferSize);
|
||||
// Clear memory to 0 for device library logic
|
||||
if ((heap_buffer_ == nullptr) ||
|
||||
(HSA_STATUS_SUCCESS != hsa_amd_memory_fill(
|
||||
reinterpret_cast<void*>(HeapBuffer()->virtualAddress()), 0,
|
||||
HeapBufferSize / sizeof(uint32_t)))) {
|
||||
LogError("Heap buffer allocation failed!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ================================================================================================
|
||||
device::Program* NullDevice::createProgram(amd::Program& owner, amd::option::Options* options) {
|
||||
device::Program* program;
|
||||
if (settings().useLightning_) {
|
||||
|
||||
Ссылка в новой задаче
Block a user