| 1 |
//===----------------------------------------------------------------------===// |
| 2 |
// |
| 3 |
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 |
// See https://llvm.org/LICENSE.txt for license information. |
| 5 |
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 |
// |
| 7 |
//===----------------------------------------------------------------------===// |
| 8 |
|
| 9 |
#include <clc/mem_fence/clc_mem_fence.h> |
| 10 |
#include <clc/opencl/synchronization/utils.h> |
| 11 |
|
| 12 |
_CLC_DEF _CLC_OVERLOAD void mem_fence(cl_mem_fence_flags flags) { |
| 13 |
int memory_scope = __opencl_get_memory_scope(flags); |
| 14 |
int memory_order = __ATOMIC_SEQ_CST; |
| 15 |
__CLC_MemorySemantics memory_semantics = __opencl_get_memory_semantics(flags); |
| 16 |
__clc_mem_fence(memory_scope, memory_order, memory_semantics); |
| 17 |
} |
| 18 |
|
| 19 |
// We do not have separate mechanism for read and write fences. |
| 20 |
_CLC_DEF _CLC_OVERLOAD void read_mem_fence(cl_mem_fence_flags flags) { |
| 21 |
mem_fence(flags); |
| 22 |
} |
| 23 |
|
| 24 |
_CLC_DEF _CLC_OVERLOAD void write_mem_fence(cl_mem_fence_flags flags) { |
| 25 |
mem_fence(flags); |
| 26 |
} |