Skip to content

Commit d6563b0

Browse files
author
Artem Gindinson
authored
Erase image support macros' definition from opencl-c-base.h (#409)
Whenever OCL Clang is called from within compute runtime's compiler interface, certain OpenCL C extensions may not be enabled depending on the target HW platform. However, series of LLORG commits* override this behaviour by defining the feature macros unconditionally. (*) https://reviews.llvm.org/D95776, https://reviews.llvm.org/D117899 Add a patch to delete such automatic definitions for image support macros. Once https://reviews.llvm.org/D141297 (LLVM 16) is integrated, an alternative approach could be to pass `-D__undef_<feature_macro>` within the Compute Runtime's compiler interface (in applicable situations) or at the OCL Clang's level (upon detecting the lack of extension-defining inputs to `-cl-ext`). Signed-off-by: Artem Gindinson <[email protected]>
1 parent c08746e commit d6563b0

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
From 1e987989037c52c0c786f7c9b6b5bed21b740375 Mon Sep 17 00:00:00 2001
2+
From: Artem Gindinson <[email protected]>
3+
Date: Thu, 23 Mar 2023 10:58:45 +0100
4+
Subject: [PATCH] [PATCH] Do not define image support macros in OpenCL C header
5+
base
6+
7+
---
8+
clang/lib/Headers/opencl-c-base.h | 3 ---
9+
1 file changed, 3 deletions(-)
10+
11+
diff --git a/clang/lib/Headers/opencl-c-base.h b/clang/lib/Headers/opencl-c-base.h
12+
index 5191c41bcd05..8907886aeecf 100644
13+
--- a/clang/lib/Headers/opencl-c-base.h
14+
+++ b/clang/lib/Headers/opencl-c-base.h
15+
@@ -58,9 +58,7 @@
16+
#define __opencl_c_atomic_scope_device 1
17+
#define __opencl_c_atomic_scope_all_devices 1
18+
#define __opencl_c_device_enqueue 1
19+
-#define __opencl_c_read_write_images 1
20+
#define __opencl_c_program_scope_global_variables 1
21+
-#define __opencl_c_images 1
22+
#endif
23+
24+
// Define header-only feature macros for OpenCL C 3.0.
25+
@@ -70,7 +68,6 @@
26+
#define __opencl_c_atomic_order_seq_cst 1
27+
#define __opencl_c_atomic_scope_device 1
28+
#define __opencl_c_atomic_scope_all_devices 1
29+
-#define __opencl_c_read_write_images 1
30+
#endif // defined(__SPIR__)
31+
#endif // (__OPENCL_CPP_VERSION__ == 202100 || __OPENCL_C_VERSION__ == 300)
32+
33+
--
34+
2.34.1
35+

0 commit comments

Comments
 (0)