File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
plugins-nextgen/amdgpu/src Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -420,7 +420,7 @@ struct AMDGPUMemoryManagerTy : public DeviceAllocatorTy {
420420 assert (PtrStorage && " Invalid pointer storage" );
421421
422422 *PtrStorage = MemoryManager->allocate (Size, nullptr );
423- if (*PtrStorage == nullptr )
423+ if (Size && *PtrStorage == nullptr )
424424 return Plugin::error (ErrorCode::OUT_OF_RESOURCES,
425425 " failure to allocate from AMDGPU memory manager" );
426426
@@ -429,8 +429,6 @@ struct AMDGPUMemoryManagerTy : public DeviceAllocatorTy {
429429
430430 // / Release an allocation to be reused.
431431 Error deallocate (void *Ptr) {
432- assert (Ptr && " Invalid pointer" );
433-
434432 if (MemoryManager->free (Ptr))
435433 return Plugin::error (ErrorCode::UNKNOWN,
436434 " failure to deallocate from AMDGPU memory manager" );
@@ -1204,7 +1202,6 @@ struct AMDGPUStreamTy {
12041202 ReleaseBufferArgsTy *Args = reinterpret_cast <ReleaseBufferArgsTy *>(Data);
12051203 assert (Args && " Invalid arguments" );
12061204 assert (Args->MemoryManager && " Invalid memory manager" );
1207- assert (Args->Buffer && " Invalid buffer" );
12081205
12091206 // Release the allocation to the memory manager.
12101207 return Args->MemoryManager ->deallocate (Args->Buffer );
Original file line number Diff line number Diff line change 22
33#include <omp.h>
44#include <stdio.h>
5+ #include <assert.h>
56
67int main () {
78 const int N = 64 ;
@@ -24,4 +25,9 @@ int main() {
2425 printf ("PASS\n" );
2526
2627 omp_free (device_ptr , llvm_omp_target_device_mem_alloc );
28+
29+ // Make sure this interface works.
30+ void * ptr = omp_alloc (0 , llvm_omp_target_device_mem_alloc );
31+ assert (!ptr && "Ptr not (nullptr)" );
32+ omp_free (ptr , llvm_omp_target_device_mem_alloc );
2733}
You can’t perform that action at this time.
0 commit comments