added malloc and free device functions

1. Added malloc and free device functions
2. Added test which check malloc and free functions
TODO: Need to add support for multiple device. Works only on one device (multi device support id NOT available).

Change-Id: Id11fc36463915d6ad46c264d5a20c8feb2d2c17c
This commit is contained in:
Aditya Atluri
2016-10-12 19:08:34 -05:00
parent 288f024d00
commit d24a7ef12b
3 changed files with 158 additions and 10 deletions
+13
View File
@@ -604,6 +604,19 @@ __device__ static inline void* memset(void* ptr, uint8_t val, size_t size)
return nullptr;
}
extern "C" __device__ void* __hip_hc_malloc(size_t);
extern "C" __device__ void* __hip_hc_free(void *ptr);
__device__ static inline void* malloc(size_t size)
{
return __hip_hc_malloc(size);
}
__device__ static inline void* free(void *ptr)
{
return __hip_hc_free(ptr);
}
#define __syncthreads() hc_barrier(CLK_LOCAL_MEM_FENCE)
#define HIP_KERNEL_NAME(...) __VA_ARGS__