diff options
author | Philipp Schaad <schaad.phil@gmail.com> | 2017-08-27 12:50:51 +0000 |
---|---|---|
committer | Philipp Schaad <schaad.phil@gmail.com> | 2017-08-27 12:50:51 +0000 |
commit | 8cb2e3245c6890a3d628c5841a7ae1f25b633f25 (patch) | |
tree | 3e98d8ca6191a293bcc2f1d13f90142385f2e66c | |
parent | 23eaf52d7dc9de0d4068de2bb2bf430c08c6eaaa (diff) | |
download | bcm5719-llvm-8cb2e3245c6890a3d628c5841a7ae1f25b633f25.tar.gz bcm5719-llvm-8cb2e3245c6890a3d628c5841a7ae1f25b633f25.zip |
[Polly][GPGPU] Fixed undefined reference for CUDA's managed memory in Runtime library.
llvm-svn: 311848
-rw-r--r-- | polly/tools/GPURuntime/GPUJIT.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/polly/tools/GPURuntime/GPUJIT.c b/polly/tools/GPURuntime/GPUJIT.c index 935d682380a..f68839ae694 100644 --- a/polly/tools/GPURuntime/GPUJIT.c +++ b/polly/tools/GPURuntime/GPUJIT.c @@ -1453,7 +1453,7 @@ int isManagedPtr(void *mem) { return 0; } -void polly_freeManaged(void *mem) { +void freeManagedCUDA(void *mem) { dump_function(); // In a real-world program this was used (COSMO), there were more `free` @@ -1475,7 +1475,7 @@ void polly_freeManaged(void *mem) { } } -void *polly_mallocManaged(size_t size) { +void *mallocManagedCUDA(size_t size) { // Note: [Size 0 allocations] // Sometimes, some runtime computation of size could create a size of 0 // for an allocation. In these cases, we do not wish to fail. @@ -1812,6 +1812,28 @@ void polly_freeContext(PollyGPUContext *Context) { } } +void polly_freeManaged(void *mem) { + dump_function(); + +#ifdef HAS_LIBCUDART + freeManagedCUDA(mem); +#else + fprintf(stderr, "No CUDA Runtime. Managed memory only supported by CUDA\n"); + exit(-1); +#endif +} + +void *polly_mallocManaged(size_t size) { + dump_function(); + +#ifdef HAS_LIBCUDART + return mallocManagedCUDA(size); +#else + fprintf(stderr, "No CUDA Runtime. Managed memory only supported by CUDA\n"); + exit(-1); +#endif +} + /* Initialize GPUJIT with CUDA as runtime library. */ PollyGPUContext *polly_initContextCUDA() { #ifdef HAS_LIBCUDART |