| 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/opencl/explicit_fence/explicit_memory_fence.h> |
| 10 |
|
| 11 |
_CLC_DEF _CLC_OVERLOAD void mem_fence(cl_mem_fence_flags flags) { |
| 12 |
if (flags & (CLK_GLOBAL_MEM_FENCE | CLK_LOCAL_MEM_FENCE)) |
| 13 |
__nvvm_membar_cta(); |
| 14 |
} |
| 15 |
|
| 16 |
// We do not have separate mechanism for read and write fences. |
| 17 |
_CLC_DEF _CLC_OVERLOAD void read_mem_fence(cl_mem_fence_flags flags) { |
| 18 |
mem_fence(flags); |
| 19 |
} |
| 20 |
|
| 21 |
_CLC_DEF _CLC_OVERLOAD void write_mem_fence(cl_mem_fence_flags flags) { |
| 22 |
mem_fence(flags); |
| 23 |
} |