diff --git a/projects/rocr-runtime/src/fmm.c b/projects/rocr-runtime/src/fmm.c index ceae462d79..44492b63f3 100644 --- a/projects/rocr-runtime/src/fmm.c +++ b/projects/rocr-runtime/src/fmm.c @@ -933,6 +933,8 @@ void *fmm_allocate_scratch(uint32_t gpu_id, uint64_t MemorySizeInBytes) munmap(aligned_end, VOID_PTRS_SUB(padded_end, aligned_end)); mem = aligned_start; + + memset(mem, 0, aligned_size); } /* Remember scratch backing aperture for later */ @@ -1131,6 +1133,8 @@ static void *fmm_allocate_host_cpu(uint64_t MemorySizeInBytes, if (mem == MAP_FAILED) return NULL; + memset(mem, 0, MemorySizeInBytes); + pthread_mutex_lock(&cpuvm_aperture.fmm_mutex); vm_obj = aperture_allocate_object(&cpuvm_aperture, mem, 0, MemorySizeInBytes, flags.Value); diff --git a/projects/rocr-runtime/src/queues.c b/projects/rocr-runtime/src/queues.c index c698c5ca6e..42c86a395f 100644 --- a/projects/rocr-runtime/src/queues.c +++ b/projects/rocr-runtime/src/queues.c @@ -323,6 +323,9 @@ static void *allocate_exec_aligned_memory_cpu(uint32_t size) if (ptr == MAP_FAILED) return NULL; + + memset(ptr, 0, size); + return ptr; }