Skip to content

Commit a6f80f8

Browse files
committed
[PATCH] Add Fix-support-for-cl_khr_mipmap_image_writes.patch
Also update CMakeLists.txt to set base revision for patches to branch names instead of fixed commits hashes. Also update Remove-extra-semicolon.patch patch to avoid warning messages when it is being applied. Signed-off-by: Alexey Sotkin <[email protected]>
1 parent 9d29b4d commit a6f80f8

File tree

3 files changed

+116
-6
lines changed

3 files changed

+116
-6
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ set(TARGET_NAME ${COMMON_CLANG_LIBRARY_NAME}${BUILD_PLATFORM} )
8181
if(NOT USE_PREBUILT_LLVM)
8282
set(TARGET_BRANCH "ocl-open-80")
8383
set(CLANG_SOURCE_DIR ${LLVM_SOURCE_DIR}/tools/clang)
84-
set(CLANG_BASE_REVISION 2e4c9c5fc864c2c432e4c262a67c42d824b265c6)
84+
set(CLANG_BASE_REVISION release_80)
8585

8686
set(SPIRV_SOURCE_DIR ${LLVM_SOURCE_DIR}/projects/llvm-spirv)
87-
set(SPIRV_BASE_REVISION bb96964181723d32dfe61ef7780dcbdf0f931ccf)
87+
set(SPIRV_BASE_REVISION llvm_release_80)
8888

8989
apply_patches(${CLANG_SOURCE_DIR}
9090
${CMAKE_CURRENT_SOURCE_DIR}/patches/clang
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
From 8e988b0da81d4113bc8a7891e62afad16d396b19 Mon Sep 17 00:00:00 2001
2+
From: Alexey Sotkin <[email protected]>
3+
Date: Mon, 27 Jan 2020 12:25:03 +0300
4+
Subject: [PATCH] Fix support for cl_khr_mipmap_image_writes
5+
6+
Text of the extension is available here:
7+
https://github.com/KhronosGroup/OpenCL-Docs/blob/master/ext/cl_khr_mipmap_image.asciidoc
8+
9+
Patch by Ilya Mashkov
10+
11+
Differential Revision: https://reviews.llvm.org/D71460
12+
---
13+
include/clang/Basic/OpenCLExtensions.def | 1 +
14+
lib/Headers/opencl-c.h | 18 ++++++++++--------
15+
test/SemaOpenCL/extension-version.cl | 12 ++++++++++++
16+
3 files changed, 23 insertions(+), 8 deletions(-)
17+
18+
diff --git a/include/clang/Basic/OpenCLExtensions.def b/include/clang/Basic/OpenCLExtensions.def
19+
index 5e7d2cb..c0ba156 100644
20+
--- a/include/clang/Basic/OpenCLExtensions.def
21+
+++ b/include/clang/Basic/OpenCLExtensions.def
22+
@@ -71,6 +71,7 @@ OPENCLEXT_INTERNAL(cl_khr_spir, 120, ~0U)
23+
OPENCLEXT_INTERNAL(cl_khr_egl_event, 200, ~0U)
24+
OPENCLEXT_INTERNAL(cl_khr_egl_image, 200, ~0U)
25+
OPENCLEXT_INTERNAL(cl_khr_mipmap_image, 200, ~0U)
26+
+OPENCLEXT_INTERNAL(cl_khr_mipmap_image_writes, 200, ~0U)
27+
OPENCLEXT_INTERNAL(cl_khr_srgb_image_writes, 200, ~0U)
28+
OPENCLEXT_INTERNAL(cl_khr_subgroups, 200, ~0U)
29+
OPENCLEXT_INTERNAL(cl_khr_terminate_context, 200, ~0U)
30+
diff --git a/lib/Headers/opencl-c.h b/lib/Headers/opencl-c.h
31+
index 3d3dfb7..514c710 100644
32+
--- a/lib/Headers/opencl-c.h
33+
+++ b/lib/Headers/opencl-c.h
34+
@@ -15032,7 +15032,7 @@ void __ovld write_imagef(write_only image2d_array_depth_t image, int4 coord, flo
35+
36+
// OpenCL Extension v2.0 s9.18 - Mipmaps
37+
#if __OPENCL_C_VERSION__ >= CL_VERSION_2_0
38+
-#ifdef cl_khr_mipmap_image
39+
+#if defined(cl_khr_mipmap_image_writes)
40+
void __ovld write_imagef(write_only image1d_t image, int coord, int lod, float4 color);
41+
void __ovld write_imagei(write_only image1d_t image, int coord, int lod, int4 color);
42+
void __ovld write_imageui(write_only image1d_t image, int coord, int lod, uint4 color);
43+
@@ -15049,15 +15049,16 @@ void __ovld write_imagef(write_only image2d_array_t image_array, int4 coord, int
44+
void __ovld write_imagei(write_only image2d_array_t image_array, int4 coord, int lod, int4 color);
45+
void __ovld write_imageui(write_only image2d_array_t image_array, int4 coord, int lod, uint4 color);
46+
47+
-void __ovld write_imagef(write_only image2d_depth_t image, int2 coord, int lod, float color);
48+
-void __ovld write_imagef(write_only image2d_array_depth_t image, int4 coord, int lod, float color);
49+
+void __ovld write_imagef(write_only image2d_depth_t image, int2 coord, int lod, float depth);
50+
+void __ovld write_imagef(write_only image2d_array_depth_t image, int4 coord, int lod, float depth);
51+
52+
#ifdef cl_khr_3d_image_writes
53+
void __ovld write_imagef(write_only image3d_t image, int4 coord, int lod, float4 color);
54+
void __ovld write_imagei(write_only image3d_t image, int4 coord, int lod, int4 color);
55+
void __ovld write_imageui(write_only image3d_t image, int4 coord, int lod, uint4 color);
56+
-#endif
57+
-#endif //cl_khr_mipmap_image
58+
+#endif //cl_khr_3d_image_writes
59+
+
60+
+#endif //defined(cl_khr_mipmap_image_writes)
61+
#endif //__OPENCL_C_VERSION__ >= CL_VERSION_2_0
62+
63+
// Image write functions for half4 type
64+
@@ -15106,7 +15107,7 @@ void __ovld write_imagef(read_write image2d_array_depth_t image, int4 coord, flo
65+
#endif //cl_khr_depth_images
66+
67+
#if __OPENCL_C_VERSION__ >= CL_VERSION_2_0
68+
-#ifdef cl_khr_mipmap_image
69+
+#if defined(cl_khr_mipmap_image_writes)
70+
void __ovld write_imagef(read_write image1d_t image, int coord, int lod, float4 color);
71+
void __ovld write_imagei(read_write image1d_t image, int coord, int lod, int4 color);
72+
void __ovld write_imageui(read_write image1d_t image, int coord, int lod, uint4 color);
73+
@@ -15130,8 +15131,9 @@ void __ovld write_imagef(read_write image2d_array_depth_t image, int4 coord, int
74+
void __ovld write_imagef(read_write image3d_t image, int4 coord, int lod, float4 color);
75+
void __ovld write_imagei(read_write image3d_t image, int4 coord, int lod, int4 color);
76+
void __ovld write_imageui(read_write image3d_t image, int4 coord, int lod, uint4 color);
77+
-#endif
78+
-#endif //cl_khr_mipmap_image
79+
+#endif //cl_khr_3d_image_writes
80+
+
81+
+#endif //cl_khr_mipmap_image_writes
82+
#endif //__OPENCL_C_VERSION__ >= CL_VERSION_2_0
83+
84+
// Image write functions for half4 type
85+
diff --git a/test/SemaOpenCL/extension-version.cl b/test/SemaOpenCL/extension-version.cl
86+
index d976cfb..dcac956 100644
87+
--- a/test/SemaOpenCL/extension-version.cl
88+
+++ b/test/SemaOpenCL/extension-version.cl
89+
@@ -243,6 +243,18 @@
90+
#pragma OPENCL EXTENSION cl_khr_mipmap_image : enable
91+
92+
#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
93+
+#ifndef cl_khr_mipmap_image_writes
94+
+#error "Missing cl_khr_mipmap_image_writes define"
95+
+#endif
96+
+#else
97+
+#ifdef cl_khr_mipmap_image_writes
98+
+#error "Incorrect cl_khr_mipmap_image_writes define"
99+
+#endif
100+
+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_mipmap_image_writes' - ignoring}}
101+
+#endif
102+
+#pragma OPENCL EXTENSION cl_khr_mipmap_image_writes : enable
103+
+
104+
+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
105+
#ifndef cl_khr_srgb_image_writes
106+
#error "Missing cl_khr_srgb_image_writes define"
107+
#endif
108+
--
109+
2.7.4
110+

patches/spirv/0002-Remove-extra-semicolon.patch

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
From a2c093c8db7b4e3a5612d0fcce9e4fd1756d6e4b Mon Sep 17 00:00:00 2001
1+
From 194e699aef7850b189bdb5816444f44dc467d6a8 Mon Sep 17 00:00:00 2001
22
From: Alexey Sotkin <[email protected]>
33
Date: Mon, 5 Aug 2019 18:18:01 +0300
44
Subject: [PATCH] Remove extra semicolon
@@ -8,12 +8,12 @@ Subject: [PATCH] Remove extra semicolon
88
1 file changed, 1 insertion(+), 1 deletion(-)
99

1010
diff --git a/lib/SPIRV/libSPIRV/SPIRVEnum.h b/lib/SPIRV/libSPIRV/SPIRVEnum.h
11-
index c93a484..3a071e7 100644
11+
index 2d7c870..9260685 100644
1212
--- a/lib/SPIRV/libSPIRV/SPIRVEnum.h
1313
+++ b/lib/SPIRV/libSPIRV/SPIRVEnum.h
14-
@@ -124,7 +124,7 @@ template <> inline void SPIRVMap<SPIRVExtensionKind, std::string>::init() {
15-
add(SPV_INTEL_device_side_avc_motion_estimation,
14+
@@ -121,7 +121,7 @@ template <> inline void SPIRVMap<SPIRVExtensionKind, std::string>::init() {
1615
"SPV_INTEL_device_side_avc_motion_estimation");
16+
add(SPV_INTEL_media_block_io, "SPV_INTEL_media_block_io");
1717
add(SPV_KHR_no_integer_wrap_decoration, "SPV_KHR_no_integer_wrap_decoration");
1818
-};
1919
+}

0 commit comments

Comments
 (0)