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

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 7 23:53:00 PST 2026


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

>From ec104396e2e476c7067fe2efa91ac48232728587 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 -
 .../{amdgcn => generic}/mem_fence/fence.cl    |  0
 libclc/opencl/lib/ptx-nvidiacl/SOURCES        |  1 -
 .../lib/ptx-nvidiacl/mem_fence/fence.cl       | 31 -------------------
 4 files changed, 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/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