Skip to content

Commit 430a43d

Browse files
authored
Merge pull request llvm#571 from AMD-Lightning-Internal/amd/dev/bsumner_amdeng/cherrypick-add-release
Add release in device free when necessary (llvm#531)
2 parents 708484d + 340cb1c commit 430a43d

File tree

1 file changed

+6
-0
lines changed
  • amd/device-libs/ockl/src

1 file changed

+6
-0
lines changed

amd/device-libs/ockl/src/dm.cl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ typedef struct heap_s {
181181
#define AFO(P, V, O) __opencl_atomic_fetch_or (P, V, O, memory_scope_device)
182182
#define ACE(P, E, V, O) __opencl_atomic_compare_exchange_strong(P, E, V, O, O, memory_scope_device)
183183

184+
#define NEED_RELEASE __oclc_ISA_version >= 9400 && __oclc_ISA_version < 10000
185+
184186
// get the heap pointer
185187
static __global heap_t *
186188
get_heap_ptr(void) {
@@ -385,6 +387,10 @@ __ockl_dm_dealloc(ulong addr)
385387
return;
386388
}
387389

390+
if (NEED_RELEASE) {
391+
__builtin_amdgcn_fence(__ATOMIC_RELEASE, "agent", "global");
392+
}
393+
388394
// Find a slab block
389395
ulong saddr = addr & ~(ulong)0x1fffffUL;
390396
__global slab_t *sptr = (__global slab_t *)saddr;

0 commit comments

Comments
 (0)