summaryrefslogtreecommitdiff
path: root/dev-libs/rocm-opencl-runtime/files/rocm-opencl-runtime-4.2.0-opencl3-header.patch
blob: 14191adb5d0cf1745e6ada328e065f954717f89d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
See bug #789717.

Once opencl-headers is upgraded to 3.0 or higher this package starts
complaining left and right about missing header definitions for
CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR.  The correct header for this
definiton did move as of opencl-headers 3.0 so this makes some sense.
(Actually I suspect there is a header-guard mismatch behind this problem).

Most of this can be fixed by using -isystem instead of -I for the opencl
headers. Although not terribly well documented, -isystem in lieu of -I
comports with best practices for overriding 3rd-party header files in
system include directories according to the gcc info pages.  Why and how
are apparently undocumented and appear to be somewhere inside the gcc
fixincludes rabbit-hole.

This still leaves a similar issue compiling the amdocl files which
is addressed here with an extra #include.

-gmt

diff -urpN ROCm-OpenCL-Runtime-rocm-4.1.0.orig/amdocl/CMakeLists.txt ROCm-OpenCL-Runtime-rocm-4.1.0/amdocl/CMakeLists.txt
--- ROCm-OpenCL-Runtime-rocm-4.1.0.orig/amdocl/CMakeLists.txt	2021-06-26 14:52:32.446875129 -0700
+++ ROCm-OpenCL-Runtime-rocm-4.1.0/amdocl/CMakeLists.txt	2021-06-26 15:00:30.401582470 -0700
@@ -19,10 +19,10 @@ if(CMAKE_BUILD_TYPE MATCHES "^Debug$")
   add_definitions(-DDEBUG)
 endif()
 
-include_directories(${CMAKE_CURRENT_LIST_DIR}/..)
-include_directories(${CMAKE_CURRENT_LIST_DIR}/../khronos)
-include_directories(${CMAKE_CURRENT_LIST_DIR}/../khronos/headers)
-include_directories(${CMAKE_CURRENT_LIST_DIR}/../khronos/headers/opencl2.2)
+include_directories(SYSTEM ${CMAKE_CURRENT_LIST_DIR}/..)
+include_directories(SYSTEM ${CMAKE_CURRENT_LIST_DIR}/../khronos)
+include_directories(SYSTEM ${CMAKE_CURRENT_LIST_DIR}/../khronos/headers)
+include_directories(SYSTEM ${CMAKE_CURRENT_LIST_DIR}/../khronos/headers/opencl2.2)
 include_directories(/usr/include/rocclr)
 include_directories(/usr/include/rocclr/compiler/lib/include/)
 include_directories(/usr/include/rocclr/elf/)
diff -urpN ROCm-OpenCL-Runtime-rocm-4.1.0.orig/khronos/icd/CMakeLists.txt ROCm-OpenCL-Runtime-rocm-4.1.0/khronos/icd/CMakeLists.txt
--- ROCm-OpenCL-Runtime-rocm-4.1.0.orig/khronos/icd/CMakeLists.txt	2021-06-26 14:52:32.445875109 -0700
+++ ROCm-OpenCL-Runtime-rocm-4.1.0/khronos/icd/CMakeLists.txt	2021-06-26 14:59:01.600778554 -0700
@@ -121,10 +121,10 @@ else()
     endif ()
 endif ()
 
-include_directories (${OPENCL_ICD_LOADER_HEADERS_DIR})
+include_directories (SYSTEM ${OPENCL_ICD_LOADER_HEADERS_DIR})
 add_definitions (-DCL_TARGET_OPENCL_VERSION=220)
 
-target_include_directories (OpenCL PRIVATE ${CMAKE_CURRENT_BINARY_DIR} loader)
+target_include_directories (OpenCL SYSTEM PRIVATE ${CMAKE_CURRENT_BINARY_DIR} loader)
 target_link_libraries (OpenCL ${CMAKE_DL_LIBS})
 
 include (CTest)
diff -urpN ROCm-OpenCL-Runtime-rocm-4.1.0.orig/amdocl/cl_common.hpp ROCm-OpenCL-Runtime-rocm-4.1.0/amdocl/cl_common.hpp
--- ROCm-OpenCL-Runtime-rocm-4.1.0.orig/amdocl/cl_common.hpp	2021-02-02 10:01:38.000000000 -0800
+++ ROCm-OpenCL-Runtime-rocm-4.1.0/amdocl/cl_common.hpp	2021-06-26 15:40:57.584449532 -0700
@@ -21,6 +21,7 @@
 #ifndef CL_COMMON_HPP_
 #define CL_COMMON_HPP_
 
+#include <CL/cl_gl_ext.h>
 #ifdef _WIN32
 #include <CL/cl_d3d11.h>
 #include <CL/cl_d3d10.h>