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 {
420
420
assert (PtrStorage && " Invalid pointer storage" );
421
421
422
422
*PtrStorage = MemoryManager->allocate (Size, nullptr );
423
- if (*PtrStorage == nullptr )
423
+ if (Size && *PtrStorage == nullptr )
424
424
return Plugin::error (ErrorCode::OUT_OF_RESOURCES,
425
425
" failure to allocate from AMDGPU memory manager" );
426
426
@@ -429,8 +429,6 @@ struct AMDGPUMemoryManagerTy : public DeviceAllocatorTy {
429
429
430
430
// / Release an allocation to be reused.
431
431
Error deallocate (void *Ptr) {
432
- assert (Ptr && " Invalid pointer" );
433
-
434
432
if (MemoryManager->free (Ptr))
435
433
return Plugin::error (ErrorCode::UNKNOWN,
436
434
" failure to deallocate from AMDGPU memory manager" );
@@ -1204,7 +1202,6 @@ struct AMDGPUStreamTy {
1204
1202
ReleaseBufferArgsTy *Args = reinterpret_cast <ReleaseBufferArgsTy *>(Data);
1205
1203
assert (Args && " Invalid arguments" );
1206
1204
assert (Args->MemoryManager && " Invalid memory manager" );
1207
- assert (Args->Buffer && " Invalid buffer" );
1208
1205
1209
1206
// Release the allocation to the memory manager.
1210
1207
return Args->MemoryManager ->deallocate (Args->Buffer );
Original file line number Diff line number Diff line change 2
2
3
3
#include <omp.h>
4
4
#include <stdio.h>
5
+ #include <assert.h>
5
6
6
7
int main () {
7
8
const int N = 64 ;
@@ -24,4 +25,9 @@ int main() {
24
25
printf ("PASS\n" );
25
26
26
27
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 );
27
33
}
You can’t perform that action at this time.
0 commit comments