Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Commit eade4df

Browse files
committed
[Polly][GPGPU] Fixed undefined reference for CUDA's managed memory in Runtime library.
git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@311848 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 26bfce0 commit eade4df

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

tools/GPURuntime/GPUJIT.c

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,7 +1453,7 @@ int isManagedPtr(void *mem) {
14531453
return 0;
14541454
}
14551455

1456-
void polly_freeManaged(void *mem) {
1456+
void freeManagedCUDA(void *mem) {
14571457
dump_function();
14581458

14591459
// In a real-world program this was used (COSMO), there were more `free`
@@ -1475,7 +1475,7 @@ void polly_freeManaged(void *mem) {
14751475
}
14761476
}
14771477

1478-
void *polly_mallocManaged(size_t size) {
1478+
void *mallocManagedCUDA(size_t size) {
14791479
// Note: [Size 0 allocations]
14801480
// Sometimes, some runtime computation of size could create a size of 0
14811481
// for an allocation. In these cases, we do not wish to fail.
@@ -1812,6 +1812,28 @@ void polly_freeContext(PollyGPUContext *Context) {
18121812
}
18131813
}
18141814

1815+
void polly_freeManaged(void *mem) {
1816+
dump_function();
1817+
1818+
#ifdef HAS_LIBCUDART
1819+
freeManagedCUDA(mem);
1820+
#else
1821+
fprintf(stderr, "No CUDA Runtime. Managed memory only supported by CUDA\n");
1822+
exit(-1);
1823+
#endif
1824+
}
1825+
1826+
void *polly_mallocManaged(size_t size) {
1827+
dump_function();
1828+
1829+
#ifdef HAS_LIBCUDART
1830+
return mallocManagedCUDA(size);
1831+
#else
1832+
fprintf(stderr, "No CUDA Runtime. Managed memory only supported by CUDA\n");
1833+
exit(-1);
1834+
#endif
1835+
}
1836+
18151837
/* Initialize GPUJIT with CUDA as runtime library. */
18161838
PollyGPUContext *polly_initContextCUDA() {
18171839
#ifdef HAS_LIBCUDART

0 commit comments

Comments
 (0)