[libclc] libclc: Remove target opencl copies of mem_fence (PR #185207)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 8 00:02:58 PST 2026


https://github.com/arsenm updated https://github.com/llvm/llvm-project/pull/185207

>From f41cc21a17f6001e9b01636ee5a1db3522879c9a Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Sat, 7 Mar 2026 17:47:37 +0100
Subject: [PATCH] libclc: Remove target opencl copies of mem_fence

---
 libclc/opencl/lib/amdgcn/SOURCES              |  1 -
 libclc/opencl/lib/generic/SOURCES             |  1 +
 .../{amdgcn => generic}/mem_fence/fence.cl    |  0
 libclc/opencl/lib/ptx-nvidiacl/SOURCES        |  1 -
 .../lib/ptx-nvidiacl/mem_fence/fence.cl       | 31 -------------------
 5 files changed, 1 insertion(+), 33 deletions(-)
 rename libclc/opencl/lib/{amdgcn => generic}/mem_fence/fence.cl (100%)
 delete mode 100644 libclc/opencl/lib/ptx-nvidiacl/SOURCES
 delete mode 100644 libclc/opencl/lib/ptx-nvidiacl/mem_fence/fence.cl

diff --git a/libclc/opencl/lib/amdgcn/SOURCES b/libclc/opencl/lib/amdgcn/SOURCES
index caf08495e8dae..8771edfc28f48 100644
--- a/libclc/opencl/lib/amdgcn/SOURCES
+++ b/libclc/opencl/lib/amdgcn/SOURCES
@@ -1,5 +1,4 @@
 async/wait_group_events.cl
-mem_fence/fence.cl
 printf/__printf_alloc.cl
 subgroup/subgroup.cl
 synchronization/sub_group_barrier.cl
diff --git a/libclc/opencl/lib/generic/SOURCES b/libclc/opencl/lib/generic/SOURCES
index 398e326ffe482..c29f79b82e882 100644
--- a/libclc/opencl/lib/generic/SOURCES
+++ b/libclc/opencl/lib/generic/SOURCES
@@ -175,6 +175,7 @@ math/tanh.cl
 math/tanpi.cl
 math/tgamma.cl
 math/trunc.cl
+mem_fence/fence.cl
 misc/shuffle.cl
 misc/shuffle2.cl
 relational/all.cl
diff --git a/libclc/opencl/lib/amdgcn/mem_fence/fence.cl b/libclc/opencl/lib/generic/mem_fence/fence.cl
similarity index 100%
rename from libclc/opencl/lib/amdgcn/mem_fence/fence.cl
rename to libclc/opencl/lib/generic/mem_fence/fence.cl
diff --git a/libclc/opencl/lib/ptx-nvidiacl/SOURCES b/libclc/opencl/lib/ptx-nvidiacl/SOURCES
deleted file mode 100644
index f20917346a3bc..0000000000000
--- a/libclc/opencl/lib/ptx-nvidiacl/SOURCES
+++ /dev/null
@@ -1 +0,0 @@
-mem_fence/fence.cl
diff --git a/libclc/opencl/lib/ptx-nvidiacl/mem_fence/fence.cl b/libclc/opencl/lib/ptx-nvidiacl/mem_fence/fence.cl
deleted file mode 100644
index 38fb15c2c1de8..0000000000000
--- a/libclc/opencl/lib/ptx-nvidiacl/mem_fence/fence.cl
+++ /dev/null
@@ -1,31 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include <clc/mem_fence/clc_mem_fence.h>
-#include <clc/opencl/synchronization/utils.h>
-
-_CLC_DEF _CLC_OVERLOAD void mem_fence(cl_mem_fence_flags flags) {
-  int memory_scope = __MEMORY_SCOPE_WRKGRP;
-  int memory_order = __ATOMIC_ACQ_REL;
-  __CLC_MemorySemantics memory_semantics = __opencl_get_memory_semantics(flags);
-  __clc_mem_fence(memory_scope, memory_order, memory_semantics);
-}
-
-_CLC_DEF _CLC_OVERLOAD void read_mem_fence(cl_mem_fence_flags flags) {
-  int memory_scope = __MEMORY_SCOPE_WRKGRP;
-  int memory_order = __ATOMIC_ACQUIRE;
-  __CLC_MemorySemantics memory_semantics = __opencl_get_memory_semantics(flags);
-  __clc_mem_fence(memory_scope, memory_order, memory_semantics);
-}
-
-_CLC_DEF _CLC_OVERLOAD void write_mem_fence(cl_mem_fence_flags flags) {
-  int memory_scope = __MEMORY_SCOPE_WRKGRP;
-  int memory_order = __ATOMIC_RELEASE;
-  __CLC_MemorySemantics memory_semantics = __opencl_get_memory_semantics(flags);
-  __clc_mem_fence(memory_scope, memory_order, memory_semantics);
-}



More information about the cfe-commits mailing list