[polly] r311848 - [Polly][GPGPU] Fixed undefined reference for CUDA's managed memory in Runtime library.
Philipp Schaad via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 27 05:50:52 PDT 2017
Author: phschaad
Date: Sun Aug 27 05:50:51 2017
New Revision: 311848
URL: http://llvm.org/viewvc/llvm-project?rev=311848&view=rev
Log:
[Polly][GPGPU] Fixed undefined reference for CUDA's managed memory in Runtime library.
Modified:
polly/trunk/tools/GPURuntime/GPUJIT.c
Modified: polly/trunk/tools/GPURuntime/GPUJIT.c
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/tools/GPURuntime/GPUJIT.c?rev=311848&r1=311847&r2=311848&view=diff
==============================================================================
--- polly/trunk/tools/GPURuntime/GPUJIT.c (original)
+++ polly/trunk/tools/GPURuntime/GPUJIT.c Sun Aug 27 05:50:51 2017
@@ -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 *
}
}
+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
More information about the llvm-commits
mailing list