Skip to content

Commit ab47dea

Browse files
committed
WIP
1 parent d108f6c commit ab47dea

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

bitcode/malloc.cl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ void* __chip_malloc(unsigned int size) {
126126

127127
// Broadcast the result to all threads in the workgroup
128128
result = (__global void*)work_group_broadcast((uintptr_t)result, 0);
129+
barrier(CLK_LOCAL_MEM_FENCE);
129130
return result;
130131
}
131132

@@ -164,7 +165,8 @@ void __chip_free(void* ptr) {
164165
} else {
165166
ERROR_PRINT("Attempted to free an already free block at %p", ptr);
166167
}
167-
168168
unlock(mutex);
169169
}
170+
171+
barrier(CLK_LOCAL_MEM_FENCE);
170172
}

samples/hipDeviceMalloc/hipDeviceMalloc.hip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ void test2(int size, int stress_iterations);
7878

7979
int main()
8080
{
81-
const int size = 10; // Reduced problem size
81+
const int size = 100; // Reduced problem size
8282
const int stress_iterations = 10000;
8383

8484
test1(size);

0 commit comments

Comments
 (0)