1 |
commit: 5d15eda65acc6e32daf37f651fa8f216065162f2 |
2 |
Author: Craig Andrews <candrews <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Aug 9 21:47:55 2019 +0000 |
4 |
Commit: Craig Andrews <candrews <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Aug 14 00:27:12 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5d15eda6 |
7 |
|
8 |
dev-libs/rocm-opencl-runtime: Radeon Open Compute OpenCL Compatible Runtime |
9 |
|
10 |
Package-Manager: Portage-2.3.71, Repoman-2.3.17 |
11 |
Signed-off-by: Craig Andrews <candrews <AT> gentoo.org> |
12 |
|
13 |
dev-libs/rocm-opencl-runtime/Manifest | 2 + |
14 |
...pencl-runtime-2.6.0-unbundle-dependencies.patch | 1233 ++++++++++++++++++++ |
15 |
dev-libs/rocm-opencl-runtime/metadata.xml | 14 + |
16 |
.../rocm-opencl-runtime-2.6.0.ebuild | 50 + |
17 |
4 files changed, 1299 insertions(+) |
18 |
|
19 |
diff --git a/dev-libs/rocm-opencl-runtime/Manifest b/dev-libs/rocm-opencl-runtime/Manifest |
20 |
new file mode 100644 |
21 |
index 00000000000..7d10d714262 |
22 |
--- /dev/null |
23 |
+++ b/dev-libs/rocm-opencl-runtime/Manifest |
24 |
@@ -0,0 +1,2 @@ |
25 |
+DIST OpenCL-ICD-Loader-bc9728edf8cace79cf33bf75560be88fc2432dc4.tar.gz 62858 BLAKE2B 931fb7ade12debda99512d8b9fbfb987f47e3b68568863e480de406f842a014d39f0321c44420fb8b68b8757d49cc02cadf82e767c9d2b71e53bdb8e9763cace SHA512 2ab9035fbc0a80a529d1b2f454b0b9a263b6eff601121750e81e2e32581f06189566cdcf201ab741ff3f1491ead825a7858000901f8042af67b1304be622e9fa |
26 |
+DIST rocm-opencl-runtime-2.6.0.tar.gz 986155 BLAKE2B 43469ec3a368e2ee9716a38d08df48c28165a233bd80de54f286011df25782a197e252e8e41ffa8f59eecf93d6beae5434497e8d4b648676252d32a0859ba59a SHA512 bbbbd29bf23f93440135786600cca28a806714bb207b7ad0947d26471fa38470820e7801acc84380000d43d55ff2ec1d95cee9e64b500628b6a3b026744c67df |
27 |
|
28 |
diff --git a/dev-libs/rocm-opencl-runtime/files/rocm-opencl-runtime-2.6.0-unbundle-dependencies.patch b/dev-libs/rocm-opencl-runtime/files/rocm-opencl-runtime-2.6.0-unbundle-dependencies.patch |
29 |
new file mode 100644 |
30 |
index 00000000000..379dd11e9f9 |
31 |
--- /dev/null |
32 |
+++ b/dev-libs/rocm-opencl-runtime/files/rocm-opencl-runtime-2.6.0-unbundle-dependencies.patch |
33 |
@@ -0,0 +1,1233 @@ |
34 |
+diff --git a/CMakeLists.txt b/CMakeLists.txt |
35 |
+index ebdfc25..fb1c3eb 100644 |
36 |
+--- a/CMakeLists.txt |
37 |
++++ b/CMakeLists.txt |
38 |
+@@ -21,6 +21,8 @@ endif() |
39 |
+ |
40 |
+ project(OpenCL-ROCm) |
41 |
+ |
42 |
++include (GNUInstallDirs) |
43 |
++ |
44 |
+ # Add path for custom modules |
45 |
+ set(CMAKE_MODULE_PATH |
46 |
+ ${CMAKE_MODULE_PATH} |
47 |
+@@ -38,38 +40,28 @@ set(CLANG_ENABLE_STATIC_ANALYZER OFF CACHE BOOL "") |
48 |
+ # override default option value in library and driver |
49 |
+ set(GENERIC_IS_ZERO ON CACHE BOOL ON FORCE) |
50 |
+ |
51 |
+-add_subdirectory(compiler/llvm EXCLUDE_FROM_ALL) |
52 |
+- |
53 |
+-find_package(LLVM REQUIRED CONFIG PATHS ${CMAKE_BINARY_DIR}/compiler/llvm NO_DEFAULT_PATH) |
54 |
++find_package(LLVM REQUIRED CONFIG PATHS ${LLVM_DIR} "/opt/rocm/llvm" NO_DEFAULT_PATH) |
55 |
+ |
56 |
+ list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}") |
57 |
+ include(AddLLVM) |
58 |
+ |
59 |
+ add_definitions(${LLVM_DEFINITIONS}) |
60 |
+-# TODO: add find_package for Clang and lld, and also use LLVM/Clang variables got from their config |
61 |
+-include_directories(${CMAKE_SOURCE_DIR}/compiler/llvm/tools/clang/include) |
62 |
+-include_directories(${CMAKE_BINARY_DIR}/compiler/llvm/tools/clang/include) |
63 |
+-include_directories(${CMAKE_SOURCE_DIR}/compiler/llvm/tools/lld/include) |
64 |
+- |
65 |
+-# TODO: move AMDGPU.h header to include folder |
66 |
+-include_directories(${CMAKE_SOURCE_DIR}/compiler/llvm/lib/Target/AMDGPU) |
67 |
+-include_directories(${CMAKE_BINARY_DIR}/compiler/llvm/lib/Target/AMDGPU) |
68 |
+- |
69 |
+-if(${USE_COMGR_LIBRARY} MATCHES "yes") |
70 |
+- set(COMGR_DYN_DLL "yes") |
71 |
+- add_definitions(-DCOMGR_DYN_DLL="yes") |
72 |
+- include_directories(${CMAKE_SOURCE_DIR}/compiler/llvm/include) |
73 |
+- add_definitions(-DUSE_COMGR_LIBRARY) |
74 |
+-else() |
75 |
+- add_subdirectory(compiler/driver EXCLUDE_FROM_ALL) |
76 |
+-endif() |
77 |
++set(USE_COMGR_LIBRARY "yes") |
78 |
++find_package(amd_comgr REQUIRED CONFIG) |
79 |
++add_definitions(-DUSE_COMGR_LIBRARY) |
80 |
++FOREACH(DIR ${LLVM_INCLUDE_DIRS}) |
81 |
++ include_directories("${DIR}") |
82 |
++ include_directories("${DIR}/clang") |
83 |
++ include_directories("${DIR}/lld") |
84 |
++ # TODO: move AMDGPU.h header to include folder |
85 |
++ include_directories("${DIR}/llvm/Target/AMDGPU") |
86 |
++ENDFOREACH() |
87 |
+ |
88 |
+ set(BUILD_HC_LIB OFF CACHE BOOL "") |
89 |
+ set(ROCM_DEVICELIB_INCLUDE_TESTS OFF CACHE BOOL "") |
90 |
+ set(AMDGCN_TARGETS_LIB_LIST "AMDGCN_LIB_TARGETS") |
91 |
+ set(AMDGCN_TARGETS_LIB_DEPS "AMDGCN_DEP_TARGETS") |
92 |
+ set(AMDGPU_TARGET_TRIPLE "amdgcn-amd-amdhsa-amdgizcl") |
93 |
+-add_subdirectory(library/amdgcn EXCLUDE_FROM_ALL) |
94 |
+ |
95 |
+ add_subdirectory(compiler/lib/loaders/elf/utils/libelf) |
96 |
+ |
97 |
+@@ -82,28 +74,6 @@ set(OPENCL_INCLUDE_DIRS |
98 |
+ ${CMAKE_SOURCE_DIR}/api/opencl/khronos/headers/opencl2.2) |
99 |
+ |
100 |
+ add_subdirectory(api/opencl/amdocl) |
101 |
+-add_subdirectory(api/opencl/khronos/icd) |
102 |
+- |
103 |
+-add_subdirectory(tools/clinfo) |
104 |
+- |
105 |
+-install(PROGRAMS $<TARGET_FILE:clang> $<TARGET_FILE:lld> |
106 |
+- DESTINATION bin/x86_64 |
107 |
+- COMPONENT libraries) |
108 |
+- |
109 |
+-install(PROGRAMS $<TARGET_FILE:OpenCL> |
110 |
+- DESTINATION lib/x86_64 |
111 |
+- COMPONENT applications) |
112 |
+- |
113 |
+-install(PROGRAMS $<TARGET_LINKER_FILE:OpenCL> |
114 |
+- DESTINATION lib/x86_64 |
115 |
+- COMPONENT libraries) |
116 |
+- |
117 |
+-install(DIRECTORY |
118 |
+- "${CMAKE_CURRENT_SOURCE_DIR}/api/opencl/khronos/headers/opencl2.2/CL" |
119 |
+- DESTINATION include |
120 |
+- COMPONENT libraries |
121 |
+- USE_SOURCE_PERMISSIONS |
122 |
+- PATTERN cl_egl.h EXCLUDE) |
123 |
+ |
124 |
+ foreach(AMDGCN_LIB_TARGET ${AMDGCN_LIB_TARGETS}) |
125 |
+ get_target_property(lib_file_name ${AMDGCN_LIB_TARGET} ARCHIVE_OUTPUT_NAME) |
126 |
+diff --git a/README.md b/README.md |
127 |
+index a834965..e319be2 100644 |
128 |
+--- a/README.md |
129 |
++++ b/README.md |
130 |
+@@ -7,13 +7,6 @@ Developer preview Version 2 of the new |
131 |
+ * Supports offline ahead of time compilation today; during the Beta phase we will add in-process/in-memory compilation. |
132 |
+ |
133 |
+ |
134 |
+-## GETTING REPO |
135 |
+- |
136 |
+-Repo is a git wrapper that manages a collection of git repositories. Install this tool and add it to the command search PATH: |
137 |
+- |
138 |
+- curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo |
139 |
+- chmod a+x ~/bin/repo |
140 |
+- |
141 |
+ ## GETTING THE SOURCE CODE |
142 |
+ |
143 |
+ Main OpenCLâ„¢ Compatible Components: |
144 |
+@@ -26,11 +19,6 @@ Main OpenCLâ„¢ Compatible Components: |
145 |
+ * https://github.com/RadeonOpenCompute/lld |
146 |
+ * https://github.com/KhronosGroup/OpenCL-ICD-Loader |
147 |
+ |
148 |
+-Download the git projects with the following commands: |
149 |
+- |
150 |
+- ~/bin/repo init -u https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime.git -b master -m opencl.xml |
151 |
+- ~/bin/repo sync |
152 |
+- |
153 |
+ ## INSTALL ROCm |
154 |
+ |
155 |
+ Follow the instructions at https://rocm.github.io/install.html to install ROCm. |
156 |
+@@ -45,6 +33,11 @@ Copy the amdocl64.icd file to /etc/OpenCL/vendors |
157 |
+ |
158 |
+ To install additional dependencies: |
159 |
+ |
160 |
++* ROCm-OpenCL-Runtime |
161 |
++* ROCm-OpenCL-Driver |
162 |
++* ROC versions of LLVM, Clang, and lld |
163 |
++* ROCm-Device-Libs |
164 |
++* OpenCL-ICD-Loader |
165 |
+ * OCaml |
166 |
+ * findlib |
167 |
+ * A Python 2 environment or active virtualenv with the Microsoft Z3 package |
168 |
+diff --git a/api/opencl/amdocl/CMakeLists.txt b/api/opencl/amdocl/CMakeLists.txt |
169 |
+index 91bd42f..8606c98 100644 |
170 |
+--- a/api/opencl/amdocl/CMakeLists.txt |
171 |
++++ b/api/opencl/amdocl/CMakeLists.txt |
172 |
+@@ -21,7 +21,6 @@ include_directories(${CMAKE_SOURCE_DIR}/api/opencl) |
173 |
+ include_directories(${CMAKE_SOURCE_DIR}/api/opencl/khronos) |
174 |
+ include_directories(${CMAKE_SOURCE_DIR}/api/opencl/khronos/headers) |
175 |
+ include_directories(${CMAKE_SOURCE_DIR}/api/opencl/khronos/headers/opencl2.2) |
176 |
+-include_directories(${CMAKE_SOURCE_DIR}/compiler/driver/src) |
177 |
+ include_directories(${CMAKE_SOURCE_DIR}/compiler/lib) |
178 |
+ include_directories(${CMAKE_SOURCE_DIR}/compiler/lib/include) |
179 |
+ include_directories(${CMAKE_SOURCE_DIR}/compiler/lib/backends/common) |
180 |
+@@ -67,6 +66,9 @@ add_library(amdocl64 SHARED |
181 |
+ ${ADDITIONAL_LIBRARIES} |
182 |
+ ) |
183 |
+ |
184 |
+-target_link_libraries(amdocl64 opencl_driver oclelf pthread dl ${ROCR_LIBRARIES}) |
185 |
++target_link_libraries(amdocl64 opencl_driver oclelf pthread dl ${ROCR_LIBRARIES} LLVMBitWriter LLVMIRReader LLVMLinker LLVMMCParser amd_comgr) |
186 |
+ |
187 |
+-install(TARGETS amdocl64 LIBRARY DESTINATION lib/x86_64 COMPONENT applications) |
188 |
++install(TARGETS amdocl64 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT applications) |
189 |
++ |
190 |
++file(GENERATE OUTPUT "${CMAKE_BINARY_DIR}/amdocl64.icd" CONTENT "$<TARGET_FILE_NAME:amdocl64>") |
191 |
++install(FILES "${CMAKE_BINARY_DIR}/amdocl64.icd" DESTINATION "${CMAKE_INSTALL_FULL_SYSCONFDIR}/OpenCL/vendors/") |
192 |
+diff --git a/api/opencl/amdocl/cl_execute.cpp b/api/opencl/amdocl/cl_execute.cpp |
193 |
+index 0336353..ee799e6 100644 |
194 |
+--- a/api/opencl/amdocl/cl_execute.cpp |
195 |
++++ b/api/opencl/amdocl/cl_execute.cpp |
196 |
+@@ -10,7 +10,7 @@ |
197 |
+ #include "platform/program.hpp" |
198 |
+ #include "os/os.hpp" |
199 |
+ |
200 |
+-#include <icd/icd_dispatch.h> |
201 |
++#include <icd/loader/icd_dispatch.h> |
202 |
+ |
203 |
+ /*! \addtogroup API |
204 |
+ * @{ |
205 |
+diff --git a/api/opencl/amdocl/cl_icd.cpp b/api/opencl/amdocl/cl_icd.cpp |
206 |
+index 71b886c..7e4e317 100644 |
207 |
+--- a/api/opencl/amdocl/cl_icd.cpp |
208 |
++++ b/api/opencl/amdocl/cl_icd.cpp |
209 |
+@@ -10,7 +10,7 @@ |
210 |
+ #include "cl_d3d11_amd.hpp" |
211 |
+ #endif //_WIN32 |
212 |
+ |
213 |
+-#include <icd/icd_dispatch.h> |
214 |
++#include <icd/loader/icd_dispatch.h> |
215 |
+ |
216 |
+ #include <mutex> |
217 |
+ |
218 |
+diff --git a/opencl.xml b/opencl.xml |
219 |
+deleted file mode 100644 |
220 |
+index 4813651..0000000 |
221 |
+--- a/opencl.xml |
222 |
++++ /dev/null |
223 |
+@@ -1,17 +0,0 @@ |
224 |
+-<?xml version="1.0" encoding="UTF-8"?> |
225 |
+-<manifest> |
226 |
+- <remote name="RadeonOpenCompute" fetch="https://github.com/RadeonOpenCompute/"/> |
227 |
+- <remote name="KhronosGroup" fetch="https://github.com/KhronosGroup/"/> |
228 |
+- |
229 |
+- <default remote="RadeonOpenCompute" revision="refs/tags/roc-2.6.0" sync-c="true" sync-j="4"/> |
230 |
+- |
231 |
+- <project path="opencl" name="ROCm-OpenCL-Runtime"/> |
232 |
+- <project path="opencl/compiler/driver" name="ROCm-OpenCL-Driver"/> |
233 |
+- <project path="opencl/compiler/llvm" name="llvm" revision="refs/tags/roc-ocl-2.6.0"/> |
234 |
+- <project path="opencl/compiler/llvm/tools/clang" name="clang"/> |
235 |
+- <project path="opencl/compiler/llvm/tools/lld" name="lld" revision="refs/tags/roc-ocl-2.6.0"/> |
236 |
+- |
237 |
+- <project path="opencl/library/amdgcn" name="ROCm-Device-Libs" revision="refs/tags/roc-ocl-2.6.0"/> |
238 |
+- |
239 |
+- <project path="opencl/api/opencl/khronos/icd" name="OpenCL-ICD-Loader" remote="KhronosGroup" revision="7433f2acbf5bbc400f26494ff1dc895da6265bef"/> |
240 |
+-</manifest> |
241 |
+diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt |
242 |
+index 62e2bf7..5e4abae 100644 |
243 |
+--- a/runtime/CMakeLists.txt |
244 |
++++ b/runtime/CMakeLists.txt |
245 |
+@@ -14,8 +14,6 @@ include_directories(${CMAKE_SOURCE_DIR}/api/opencl) |
246 |
+ include_directories(${CMAKE_SOURCE_DIR}/api/opencl/khronos) |
247 |
+ include_directories(${CMAKE_SOURCE_DIR}/api/opencl/khronos/headers) |
248 |
+ include_directories(${CMAKE_SOURCE_DIR}/api/opencl/khronos/headers/opencl2.2) |
249 |
+-include_directories(${CMAKE_SOURCE_DIR}/compiler/llvm/include) |
250 |
+-include_directories(${CMAKE_SOURCE_DIR}/compiler/driver/src) |
251 |
+ include_directories(${CMAKE_SOURCE_DIR}/compiler/lib) |
252 |
+ include_directories(${CMAKE_SOURCE_DIR}/compiler/lib/include) |
253 |
+ include_directories(${CMAKE_SOURCE_DIR}/compiler/lib/backends/common) |
254 |
+@@ -36,6 +34,7 @@ add_library(oclruntime OBJECT |
255 |
+ utils/flags.cpp |
256 |
+ utils/debug.cpp |
257 |
+ device/appprofile.cpp |
258 |
++ device/comgrctx.cpp |
259 |
+ device/device.cpp |
260 |
+ device/hwdebug.cpp |
261 |
+ device/blitcl.cpp |
262 |
+@@ -63,6 +62,8 @@ add_library(oclruntime OBJECT |
263 |
+ ${CMAKE_SOURCE_DIR}/compiler/tools/caching/cache.cpp |
264 |
+ ) |
265 |
+ set_target_properties(oclruntime PROPERTIES POSITION_INDEPENDENT_CODE ON) |
266 |
++add_dependencies(oclruntime opencl1.2-c.amdgcn.inc_target) |
267 |
++add_dependencies(oclruntime opencl2.0-c.amdgcn.inc_target) |
268 |
+ |
269 |
+ set(AMDGCN_DEP_LIST) |
270 |
+ if(AMDGCN_TARGETS_LIB_DEPS) |
271 |
+diff --git a/runtime/device/device.hpp b/runtime/device/device.hpp |
272 |
+index 450cd69..8134fa2 100644 |
273 |
+--- a/runtime/device/device.hpp |
274 |
++++ b/runtime/device/device.hpp |
275 |
+@@ -21,7 +21,7 @@ |
276 |
+ |
277 |
+ #if defined(WITH_LIGHTNING_COMPILER) && !defined(USE_COMGR_LIBRARY) |
278 |
+ #include "caching/cache.hpp" |
279 |
+-#include "driver/AmdCompiler.h" |
280 |
++#include "AmdCompiler.h" |
281 |
+ #endif // defined(WITH_LIGHTNING_COMPILER) && ! defined(USE_COMGR_LIBRARY) |
282 |
+ #include "acl.h" |
283 |
+ |
284 |
+diff --git a/runtime/device/devprogram.cpp b/runtime/device/devprogram.cpp |
285 |
+index 22fb125..3d475b2 100644 |
286 |
+--- a/runtime/device/devprogram.cpp |
287 |
++++ b/runtime/device/devprogram.cpp |
288 |
+@@ -14,7 +14,7 @@ |
289 |
+ |
290 |
+ #if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY) |
291 |
+ #ifndef USE_COMGR_LIBRARY |
292 |
+-#include "driver/AmdCompiler.h" |
293 |
++#include "AmdCompiler.h" |
294 |
+ #include "libraries.amdgcn.inc" |
295 |
+ #include "opencl1.2-c.amdgcn.inc" |
296 |
+ #include "opencl2.0-c.amdgcn.inc" |
297 |
+diff --git a/runtime/device/devprogram.hpp b/runtime/device/devprogram.hpp |
298 |
+index 67af239..8390e7d 100644 |
299 |
+--- a/runtime/device/devprogram.hpp |
300 |
++++ b/runtime/device/devprogram.hpp |
301 |
+@@ -11,7 +11,7 @@ |
302 |
+ |
303 |
+ #if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY) |
304 |
+ #ifndef USE_COMGR_LIBRARY |
305 |
+-#include "driver/AmdCompiler.h" |
306 |
++#include "AmdCompiler.h" |
307 |
+ #else |
308 |
+ #include "amd_comgr.h" |
309 |
+ #endif |
310 |
+diff --git a/runtime/device/rocm/CMakeLists.txt b/runtime/device/rocm/CMakeLists.txt |
311 |
+index 4ce7c45..617bece 100644 |
312 |
+--- a/runtime/device/rocm/CMakeLists.txt |
313 |
++++ b/runtime/device/rocm/CMakeLists.txt |
314 |
+@@ -1,3 +1,21 @@ |
315 |
++find_package(Clang REQUIRED CONFIG) |
316 |
++ |
317 |
++# FIXME: CLANG_CMAKE_DIR seems like the most stable way to find this, but |
318 |
++# really there is no way to reliably discover this header. |
319 |
++# |
320 |
++# We effectively back up to the Clang output directory (for the case of a build |
321 |
++# tree) or install prefix (for the case of an installed copy), and then search |
322 |
++# for a file named opencl-c.h anywhere below that. We take the first result in |
323 |
++# the case where there are multiple (e.g. if there is an installed copy nested |
324 |
++# in a build directory). This is a bit imprecise, but it covers cases like MSVC |
325 |
++# adding some additional configuration-specific subdirectories to the build |
326 |
++# tree but not to an installed copy. |
327 |
++file(GLOB_RECURSE OPENCL_C_H_LIST "${CLANG_CMAKE_DIR}/../../../*/opencl-c.h") |
328 |
++list(GET OPENCL_C_H_LIST 0 OPENCL_C_H) |
329 |
++if (NOT EXISTS "${OPENCL_C_H}" OR IS_DIRECTORY "${OPENCL_C_H}") |
330 |
++ message(FATAL_ERROR "Unable to locate opencl-c.h from the supplied Clang. The path '${CLANG_CMAKE_DIR}/../../../*' was searched.") |
331 |
++endif() |
332 |
++ |
333 |
+ include(bc2h) |
334 |
+ |
335 |
+ set(INC_SUFFIX "amdgcn.inc") |
336 |
+@@ -74,8 +92,8 @@ endforeach() |
337 |
+ |
338 |
+ # generating opencl*.inc files |
339 |
+ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/opencl1.2-c.amdgcn.pch |
340 |
+- COMMAND clang -cc1 -x cl-header -triple amdgcn-amd-amdhsa -Werror -O3 -DNDEBUG -cl-std=CL1.2 -emit-pch -o ${CMAKE_CURRENT_BINARY_DIR}/opencl1.2-c.amdgcn.pch < ${CMAKE_SOURCE_DIR}/compiler/llvm/tools/clang/lib/Headers/opencl-c.h |
341 |
+- DEPENDS clang ${CMAKE_SOURCE_DIR}/compiler/llvm/tools/clang/lib/Headers/opencl-c.h |
342 |
++ COMMAND clang -cc1 -x cl-header -triple amdgcn-amd-amdhsa -Werror -O3 -DNDEBUG -cl-std=CL1.2 -emit-pch -o ${CMAKE_CURRENT_BINARY_DIR}/opencl1.2-c.amdgcn.pch < ${OPENCL_C_H} |
343 |
++ DEPENDS clang ${OPENCL_C_H} |
344 |
+ COMMENT "Generating opencl1.2-c.amdgcn.pch" |
345 |
+ ) |
346 |
+ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/opencl1.2-c.amdgcn.inc |
347 |
+@@ -88,8 +106,8 @@ add_custom_target(opencl1.2-c.amdgcn.inc_target ALL DEPENDS ${CMAKE_CURRENT_BINA |
348 |
+ add_dependencies(oclrocm opencl1.2-c.amdgcn.inc_target) |
349 |
+ |
350 |
+ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/opencl2.0-c.amdgcn.pch |
351 |
+- COMMAND clang -cc1 -x cl-header -triple amdgcn-amd-amdhsa -Werror -O3 -DNDEBUG -cl-std=CL2.0 -emit-pch -o ${CMAKE_CURRENT_BINARY_DIR}/opencl2.0-c.amdgcn.pch < ${CMAKE_SOURCE_DIR}/compiler/llvm/tools/clang/lib/Headers/opencl-c.h |
352 |
+- DEPENDS clang ${CMAKE_SOURCE_DIR}/compiler/llvm/tools/clang/lib/Headers/opencl-c.h |
353 |
++ COMMAND clang -cc1 -x cl-header -triple amdgcn-amd-amdhsa -Werror -O3 -DNDEBUG -cl-std=CL2.0 -emit-pch -o ${CMAKE_CURRENT_BINARY_DIR}/opencl2.0-c.amdgcn.pch < ${OPENCL_C_H} |
354 |
++ DEPENDS clang ${OPENCL_C_H} |
355 |
+ COMMENT "Generating opencl2.0-c.amdgcn.pch" |
356 |
+ ) |
357 |
+ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/opencl2.0-c.amdgcn.inc |
358 |
+diff --git a/runtime/device/rocm/rocdevice.cpp b/runtime/device/rocm/rocdevice.cpp |
359 |
+index 8b9901b..2648459 100644 |
360 |
+--- a/runtime/device/rocm/rocdevice.cpp |
361 |
++++ b/runtime/device/rocm/rocdevice.cpp |
362 |
+@@ -20,7 +20,7 @@ |
363 |
+ #include "device/rocm/rocvirtual.hpp" |
364 |
+ #include "device/rocm/rocprogram.hpp" |
365 |
+ #if defined(WITH_LIGHTNING_COMPILER) && ! defined(USE_COMGR_LIBRARY) |
366 |
+-#include "driver/AmdCompiler.h" |
367 |
++#include "AmdCompiler.h" |
368 |
+ #endif // defined(WITH_LIGHTNING_COMPILER) && ! defined(USE_COMGR_LIBRARY) |
369 |
+ #include "device/rocm/rocmemory.hpp" |
370 |
+ #include "device/rocm/rocglinterop.hpp" |
371 |
+diff --git a/runtime/device/rocm/rockernel.cpp b/runtime/device/rocm/rockernel.cpp |
372 |
+index 8a28acc..7d5b62d 100644 |
373 |
+--- a/runtime/device/rocm/rockernel.cpp |
374 |
++++ b/runtime/device/rocm/rockernel.cpp |
375 |
+@@ -11,7 +11,7 @@ |
376 |
+ |
377 |
+ #if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY) |
378 |
+ #ifndef USE_COMGR_LIBRARY |
379 |
+-#include "driver/AmdCompiler.h" |
380 |
++#include "AmdCompiler.h" |
381 |
+ #endif |
382 |
+ #include "llvm/Support/AMDGPUMetadata.h" |
383 |
+ |
384 |
+diff --git a/runtime/device/rocm/rocprogram.cpp b/runtime/device/rocm/rocprogram.cpp |
385 |
+index 191e58c..58d82e6 100644 |
386 |
+--- a/runtime/device/rocm/rocprogram.cpp |
387 |
++++ b/runtime/device/rocm/rocprogram.cpp |
388 |
+@@ -11,7 +11,7 @@ |
389 |
+ #include <gelf.h> |
390 |
+ #include "libraries.amdgcn.inc" |
391 |
+ #ifndef USE_COMGR_LIBRARY |
392 |
+-#include "driver/AmdCompiler.h" |
393 |
++#include "AmdCompiler.h" |
394 |
+ #endif |
395 |
+ #endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY) |
396 |
+ |
397 |
+diff --git a/runtime/platform/object.hpp b/runtime/platform/object.hpp |
398 |
+index 8ab1b68..b33a9e3 100644 |
399 |
+--- a/runtime/platform/object.hpp |
400 |
++++ b/runtime/platform/object.hpp |
401 |
+@@ -9,7 +9,7 @@ |
402 |
+ #include "os/alloc.hpp" |
403 |
+ #include "thread/monitor.hpp" |
404 |
+ #include "utils/util.hpp" |
405 |
+-#include <icd/icd_dispatch.h> |
406 |
++#include <icd/loader/icd_dispatch.h> |
407 |
+ |
408 |
+ |
409 |
+ #define KHR_CL_TYPES_DO(F) \ |
410 |
+diff --git a/tools/clinfo/CMakeLists.txt b/tools/clinfo/CMakeLists.txt |
411 |
+deleted file mode 100644 |
412 |
+index 974a46f..0000000 |
413 |
+--- a/tools/clinfo/CMakeLists.txt |
414 |
++++ /dev/null |
415 |
+@@ -1,13 +0,0 @@ |
416 |
+-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") |
417 |
+- |
418 |
+-set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) |
419 |
+- |
420 |
+-include_directories(${OPENCL_INCLUDE_DIRS}) |
421 |
+- |
422 |
+-add_definitions(-DHAVE_CL2_HPP) |
423 |
+- |
424 |
+-add_executable(clinfo clinfo.cpp) |
425 |
+- |
426 |
+-target_link_libraries(clinfo OpenCL) |
427 |
+- |
428 |
+-install(TARGETS clinfo DESTINATION bin) |
429 |
+diff --git a/tools/clinfo/clinfo.cpp b/tools/clinfo/clinfo.cpp |
430 |
+deleted file mode 100644 |
431 |
+index c5afb7f..0000000 |
432 |
+--- a/tools/clinfo/clinfo.cpp |
433 |
++++ /dev/null |
434 |
+@@ -1,832 +0,0 @@ |
435 |
+-/* ============================================================ |
436 |
+- |
437 |
+-Copyright (c) 2010 Advanced Micro Devices, Inc. All rights reserved. |
438 |
+- |
439 |
+-Redistribution and use of this material is permitted under the following |
440 |
+-conditions: |
441 |
+- |
442 |
+-Redistributions must retain the above copyright notice and all terms of this |
443 |
+-license. |
444 |
+- |
445 |
+-In no event shall anyone redistributing or accessing or using this material |
446 |
+-commence or participate in any arbitration or legal action relating to this |
447 |
+-material against Advanced Micro Devices, Inc. or any copyright holders or |
448 |
+-contributors. The foregoing shall survive any expiration or termination of |
449 |
+-this license or any agreement or access or use related to this material. |
450 |
+- |
451 |
+-ANY BREACH OF ANY TERM OF THIS LICENSE SHALL RESULT IN THE IMMEDIATE REVOCATION |
452 |
+-OF ALL RIGHTS TO REDISTRIBUTE, ACCESS OR USE THIS MATERIAL. |
453 |
+- |
454 |
+-THIS MATERIAL IS PROVIDED BY ADVANCED MICRO DEVICES, INC. AND ANY COPYRIGHT |
455 |
+-HOLDERS AND CONTRIBUTORS "AS IS" IN ITS CURRENT CONDITION AND WITHOUT ANY |
456 |
+-REPRESENTATIONS, GUARANTEE, OR WARRANTY OF ANY KIND OR IN ANY WAY RELATED TO |
457 |
+-SUPPORT, INDEMNITY, ERROR FREE OR UNINTERRUPTED OPERA TION, OR THAT IT IS FREE |
458 |
+-FROM DEFECTS OR VIRUSES. ALL OBLIGATIONS ARE HEREBY DISCLAIMED - WHETHER |
459 |
+-EXPRESS, IMPLIED, OR STATUTORY - INCLUDING, BUT NOT LIMITED TO, ANY IMPLIED |
460 |
+-WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, |
461 |
+-ACCURACY, COMPLETENESS, OPERABILITY, QUALITY OF SERVICE, OR NON-INFRINGEMENT. |
462 |
+-IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. OR ANY COPYRIGHT HOLDERS OR |
463 |
+-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, PUNITIVE, |
464 |
+-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT |
465 |
+-OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, REVENUE, DATA, OR PROFITS; OR |
466 |
+-BUSINESS INTERRUPTION) HOWEVER CAUSED OR BASED ON ANY THEORY OF LIABILITY |
467 |
+-ARISING IN ANY WAY RELATED TO THIS MATERIAL, EVEN IF ADVISED OF THE POSSIBILITY |
468 |
+-OF SUCH DAMAGE. THE ENTIRE AND AGGREGATE LIABILITY OF ADVANCED MICRO DEVICES, |
469 |
+-INC. AND ANY COPYRIGHT HOLDERS AND CONTRIBUTORS SHALL NOT EXCEED TEN DOLLARS |
470 |
+-(US $10.00). ANYONE REDISTRIBUTING OR ACCESSING OR USING THIS MATERIAL ACCEPTS |
471 |
+-THIS ALLOCATION OF RISK AND AGREES TO RELEASE ADVANCED MICRO DEVICES, INC. AND |
472 |
+-ANY COPYRIGHT HOLDERS AND CONTRIBUTORS FROM ANY AND ALL LIABILITIES, |
473 |
+-OBLIGATIONS, CLAIMS, OR DEMANDS IN EXCESS OF TEN DOLLARS (US $10.00). THE |
474 |
+-FOREGOING ARE ESSENTIAL TERMS OF THIS LICENSE AND, IF ANY OF THESE TERMS ARE |
475 |
+-CONSTRUED AS UNENFORCEABLE, FAIL IN ESSENTIAL PURPOSE, OR BECOME VOID OR |
476 |
+-DETRIMENTAL TO ADVANCED MICRO DEVICES, INC. OR ANY COPYRIGHT HOLDERS OR |
477 |
+-CONTRIBUTORS FOR ANY REASON, THEN ALL RIGHTS TO REDISTRIBUTE, ACCESS OR USE |
478 |
+-THIS MATERIAL SHALL TERMINATE IMMEDIATELY. MOREOVER, THE FOREGOING SHALL |
479 |
+-SURVIVE ANY EXPIRATION OR TERMINATION OF THIS LICENSE OR ANY AGREEMENT OR |
480 |
+-ACCESS OR USE RELATED TO THIS MATERIAL. |
481 |
+- |
482 |
+-NOTICE IS HEREBY PROVIDED, AND BY REDISTRIBUTING OR ACCESSING OR USING THIS |
483 |
+-MATERIAL SUCH NOTICE IS ACKNOWLEDGED, THAT THIS MATERIAL MAY BE SUBJECT TO |
484 |
+-RESTRICTIONS UNDER THE LAWS AND REGULATIONS OF THE UNITED STATES OR OTHER |
485 |
+-COUNTRIES, WHICH INCLUDE BUT ARE NOT LIMITED TO, U.S. EXPORT CONTROL LAWS SUCH |
486 |
+-AS THE EXPORT ADMINISTRATION REGULATIONS AND NATIONAL SECURITY CONTROLS AS |
487 |
+-DEFINED THEREUNDER, AS WELL AS STATE DEPARTMENT CONTROLS UNDER THE U.S. |
488 |
+-MUNITIONS LIST. THIS MATERIAL MAY NOT BE USED, RELEASED, TRANSFERRED, IMPORTED, |
489 |
+-EXPORTED AND/OR RE-EXPORTED IN ANY MANNER PROHIBITED UNDER ANY APPLICABLE LAWS, |
490 |
+-INCLUDING U.S. EXPORT CONTROL LAWS REGARDING SPECIFICALLY DESIGNATED PERSONS, |
491 |
+-COUNTRIES AND NATIONALS OF COUNTRIES SUBJECT TO NATIONAL SECURITY CONTROLS. |
492 |
+-MOREOVER, THE FOREGOING SHALL SURVIVE ANY EXPIRATION OR TERMINATION OF ANY |
493 |
+-LICENSE OR AGREEMENT OR ACCESS OR USE RELATED TO THIS MATERIAL. |
494 |
+- |
495 |
+-NOTICE REGARDING THE U.S. GOVERNMENT AND DOD AGENCIES: This material is |
496 |
+-provided with "RESTRICTED RIGHTS" and/or "LIMITED RIGHTS" as applicable to |
497 |
+-computer software and technical data, respectively. Use, duplication, |
498 |
+-distribution or disclosure by the U.S. Government and/or DOD agencies is |
499 |
+-subject to the full extent of restrictions in all applicable regulations, |
500 |
+-including those found at FAR52.227 and DFARS252.227 et seq. and any successor |
501 |
+-regulations thereof. Use of this material by the U.S. Government and/or DOD |
502 |
+-agencies is acknowledgment of the proprietary rights of any copyright holders |
503 |
+-and contributors, including those of Advanced Micro Devices, Inc., as well as |
504 |
+-the provisions of FAR52.227-14 through 23 regarding privately developed and/or |
505 |
+-commercial computer software. |
506 |
+- |
507 |
+-This license forms the entire agreement regarding the subject matter hereof and |
508 |
+-supersedes all proposals and prior discussions and writings between the parties |
509 |
+-with respect thereto. This license does not affect any ownership, rights, title, |
510 |
+-or interest in, or relating to, this material. No terms of this license can be |
511 |
+-modified or waived, and no breach of this license can be excused, unless done |
512 |
+-so in a writing signed by all affected parties. Each term of this license is |
513 |
+-separately enforceable. If any term of this license is determined to be or |
514 |
+-becomes unenforceable or illegal, such term shall be reformed to the minimum |
515 |
+-extent necessary in order for this license to remain in effect in accordance |
516 |
+-with its terms as modified by such reformation. This license shall be governed |
517 |
+-by and construed in accordance with the laws of the State of Texas without |
518 |
+-regard to rules on conflicts of law of any state or jurisdiction or the United |
519 |
+-Nations Convention on the International Sale of Goods. All disputes arising out |
520 |
+-of this license shall be subject to the jurisdiction of the federal and state |
521 |
+-courts in Austin, Texas, and all defenses are hereby waived concerning personal |
522 |
+-jurisdiction and venue of these courts. |
523 |
+- |
524 |
+-============================================================ */ |
525 |
+- |
526 |
+-#include <iostream> |
527 |
+-#include <map> |
528 |
+-#include <set> |
529 |
+-#include <algorithm> |
530 |
+-#include <string> |
531 |
+-#include <cstdlib> |
532 |
+-#include <cstdio> |
533 |
+-#if !defined(_WIN32) |
534 |
+-#include <errno.h> |
535 |
+-#endif |
536 |
+- |
537 |
+-#ifdef _MSC_VER |
538 |
+-#pragma warning(disable: 4290) |
539 |
+-#endif |
540 |
+- |
541 |
+-#if defined(HAVE_CL2_HPP) |
542 |
+-#define CL_HPP_ENABLE_EXCEPTIONS |
543 |
+-#define CL_HPP_MINIMUM_OPENCL_VERSION 120 |
544 |
+-#define CL_HPP_TARGET_OPENCL_VERSION 200 |
545 |
+-#define CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY |
546 |
+-#include "CL/cl2.hpp" |
547 |
+-#else // !HAVE_CL2_HPP |
548 |
+-#define __CL_ENABLE_EXCEPTIONS |
549 |
+-#define __MAX_DEFAULT_VECTOR_SIZE 50 |
550 |
+-#define CL_USE_DEPRECATED_OPENCL_1_1_APIS |
551 |
+-#define CL_USE_DEPRECATED_OPENCL_2_0_APIS |
552 |
+-#include "cl.hpp" |
553 |
+-#endif // !HAVE_CL2_HPP |
554 |
+- |
555 |
+-bool verbose = false; |
556 |
+- |
557 |
+-/// Returns EXIT_SUCCESS on success, EXIT_FAILURE on failure. |
558 |
+-int |
559 |
+-main(int argc, char** argv) |
560 |
+-{ |
561 |
+- /* Error flag */ |
562 |
+- cl_int err; |
563 |
+- |
564 |
+- //parse input |
565 |
+- for(int i = 1; i < argc; i++){ |
566 |
+- if ((strcmp(argv[i], "-v") == 0) || |
567 |
+- (strcmp(argv[i], "--verbose") == 0)){ |
568 |
+- verbose = true; |
569 |
+- } else if ((strcmp(argv[i], "-h") == 0) || |
570 |
+- (strcmp(argv[i], "--help") == 0)){ |
571 |
+- std::cout << "Usage is: " << argv[0] << " [-v|--verbose]" << std::endl; |
572 |
+- return EXIT_FAILURE; |
573 |
+- } |
574 |
+- } |
575 |
+- |
576 |
+- // Platform info |
577 |
+- std::vector<cl::Platform> platforms; |
578 |
+- |
579 |
+- try { |
580 |
+- err = cl::Platform::get(&platforms); |
581 |
+- |
582 |
+- // Iteratate over platforms |
583 |
+- std::cout << "Number of platforms:\t\t\t\t " |
584 |
+- << platforms.size() |
585 |
+- << std::endl; |
586 |
+- for (std::vector<cl::Platform>::iterator i = platforms.begin(); |
587 |
+- i != platforms.end(); |
588 |
+- ++i) { |
589 |
+- const cl::Platform& platform = *i; |
590 |
+- |
591 |
+- std::cout << " Platform Profile:\t\t\t\t " |
592 |
+- << platform.getInfo<CL_PLATFORM_PROFILE>().c_str() |
593 |
+- << std::endl; |
594 |
+- std::cout << " Platform Version:\t\t\t\t " |
595 |
+- << platform.getInfo<CL_PLATFORM_VERSION>().c_str() |
596 |
+- << std::endl; |
597 |
+- std::cout << " Platform Name:\t\t\t\t " |
598 |
+- << platform.getInfo<CL_PLATFORM_NAME>().c_str() |
599 |
+- << std::endl; |
600 |
+- std::cout << " Platform Vendor:\t\t\t\t " |
601 |
+- << platform.getInfo<CL_PLATFORM_VENDOR>().c_str() << std::endl; |
602 |
+- if (platform.getInfo<CL_PLATFORM_EXTENSIONS>().size() > 0) { |
603 |
+- std::cout << " Platform Extensions:\t\t\t\t " |
604 |
+- << platform.getInfo<CL_PLATFORM_EXTENSIONS>().c_str() |
605 |
+- << std::endl; |
606 |
+- } |
607 |
+- } |
608 |
+- |
609 |
+- std::cout << std::endl << std:: endl; |
610 |
+- // Now Iteratate over each platform and its devices |
611 |
+- for (std::vector<cl::Platform>::iterator p = platforms.begin(); |
612 |
+- p != platforms.end(); |
613 |
+- ++p) { |
614 |
+- const cl::Platform& platform = *p; |
615 |
+- std::cout << " Platform Name:\t\t\t\t " |
616 |
+- << platform.getInfo<CL_PLATFORM_NAME>().c_str() |
617 |
+- << std::endl; |
618 |
+- |
619 |
+- std::vector<cl::Device> devices; |
620 |
+- platform.getDevices(CL_DEVICE_TYPE_ALL, &devices); |
621 |
+- |
622 |
+- // Get OpenCL version |
623 |
+- std::string platformVersionStr = platform.getInfo<CL_PLATFORM_VERSION>(); |
624 |
+- std::string openclVerstionStr(platformVersionStr.c_str()); |
625 |
+- size_t vStart = openclVerstionStr.find(" ", 0); |
626 |
+- size_t vEnd = openclVerstionStr.find(" ", vStart + 1); |
627 |
+- std::string vStrVal = openclVerstionStr.substr(vStart + 1, vEnd - vStart - 1); |
628 |
+- |
629 |
+- std::cout << "Number of devices:\t\t\t\t " << devices.size() << std::endl; |
630 |
+- for (std::vector<cl::Device>::iterator i = devices.begin(); |
631 |
+- i != devices.end(); |
632 |
+- ++i) { |
633 |
+- const cl::Device& device = *i; |
634 |
+- /* Get device name */ |
635 |
+- std::string deviceName = device.getInfo<CL_DEVICE_NAME>(); |
636 |
+- cl_device_type dtype = device.getInfo<CL_DEVICE_TYPE>(); |
637 |
+- |
638 |
+- /* Get CAL driver version in int */ |
639 |
+- std::string driverVersion = device.getInfo<CL_DRIVER_VERSION>(); |
640 |
+- std::string calVersion(driverVersion.c_str()); |
641 |
+- calVersion = calVersion.substr(calVersion.find_last_of(".") + 1); |
642 |
+- int version = atoi(calVersion.c_str()); |
643 |
+- |
644 |
+- std::cout << " Device Type:\t\t\t\t\t " ; |
645 |
+- switch (dtype) { |
646 |
+- case CL_DEVICE_TYPE_ACCELERATOR: |
647 |
+- std::cout << "CL_DEVICE_TYPE_ACCRLERATOR" << std::endl; |
648 |
+- break; |
649 |
+- case CL_DEVICE_TYPE_CPU: |
650 |
+- std::cout << "CL_DEVICE_TYPE_CPU" << std::endl; |
651 |
+- break; |
652 |
+- case CL_DEVICE_TYPE_DEFAULT: |
653 |
+- std::cout << "CL_DEVICE_TYPE_DEFAULT" << std::endl; |
654 |
+- break; |
655 |
+- case CL_DEVICE_TYPE_GPU: |
656 |
+- std::cout << "CL_DEVICE_TYPE_GPU" << std::endl; |
657 |
+- break; |
658 |
+- } |
659 |
+- |
660 |
+- std::cout << " Vendor ID:\t\t\t\t\t " |
661 |
+- << std::hex |
662 |
+- << device.getInfo<CL_DEVICE_VENDOR_ID>() |
663 |
+- << "h" |
664 |
+- << std::dec |
665 |
+- << std::endl; |
666 |
+- |
667 |
+- bool isAMDPlatform = (strcmp(platform.getInfo<CL_PLATFORM_NAME>().c_str(), "AMD Accelerated Parallel Processing") == 0) ? true : false; |
668 |
+- if (isAMDPlatform) |
669 |
+- { |
670 |
+- std::string boardName; |
671 |
+- device.getInfo(CL_DEVICE_BOARD_NAME_AMD, &boardName); |
672 |
+- std::cout << " Board name:\t\t\t\t\t " |
673 |
+- << boardName.c_str() |
674 |
+- << std::endl; |
675 |
+- |
676 |
+- cl_device_topology_amd topology; |
677 |
+- err = device.getInfo(CL_DEVICE_TOPOLOGY_AMD, &topology); |
678 |
+- if (topology.raw.type == CL_DEVICE_TOPOLOGY_TYPE_PCIE_AMD) { |
679 |
+- std::cout << " Device Topology:\t\t\t\t " |
680 |
+- << "PCI[ B#" << (int)topology.pcie.bus |
681 |
+- << ", D#" << (int)topology.pcie.device |
682 |
+- << ", F#" << (int)topology.pcie.function |
683 |
+- << " ]" << std::endl; |
684 |
+- } |
685 |
+- } |
686 |
+- |
687 |
+- std::cout << " Max compute units:\t\t\t\t " |
688 |
+- << device.getInfo<CL_DEVICE_MAX_COMPUTE_UNITS>() |
689 |
+- << std::endl; |
690 |
+- |
691 |
+- std::cout << " Max work items dimensions:\t\t\t " |
692 |
+- << device.getInfo<CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS>() |
693 |
+- << std::endl; |
694 |
+- |
695 |
+- std::vector< ::size_t> witems = |
696 |
+- device.getInfo<CL_DEVICE_MAX_WORK_ITEM_SIZES>(); |
697 |
+- for (unsigned int x = 0; |
698 |
+- x < device.getInfo<CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS>(); |
699 |
+- x++) { |
700 |
+- std::cout << " Max work items[" |
701 |
+- << x << "]:\t\t\t\t " |
702 |
+- << witems[x] |
703 |
+- << std::endl; |
704 |
+- } |
705 |
+- |
706 |
+- std::cout << " Max work group size:\t\t\t\t " |
707 |
+- << device.getInfo<CL_DEVICE_MAX_WORK_GROUP_SIZE>() |
708 |
+- << std::endl; |
709 |
+- |
710 |
+- std::cout << " Preferred vector width char:\t\t\t " |
711 |
+- << device.getInfo<CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR>() |
712 |
+- << std::endl; |
713 |
+- |
714 |
+- std::cout << " Preferred vector width short:\t\t\t " |
715 |
+- << device.getInfo<CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT>() |
716 |
+- << std::endl; |
717 |
+- |
718 |
+- std::cout << " Preferred vector width int:\t\t\t " |
719 |
+- << device.getInfo<CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT>() |
720 |
+- << std::endl; |
721 |
+- |
722 |
+- std::cout << " Preferred vector width long:\t\t\t " |
723 |
+- << device.getInfo<CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG>() |
724 |
+- << std::endl; |
725 |
+- |
726 |
+- std::cout << " Preferred vector width float:\t\t\t " |
727 |
+- << device.getInfo<CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT>() |
728 |
+- << std::endl; |
729 |
+- |
730 |
+- std::cout << " Preferred vector width double:\t\t " |
731 |
+- << device.getInfo<CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE>() |
732 |
+- << std::endl; |
733 |
+- |
734 |
+-#ifdef CL_VERSION_1_1 |
735 |
+- if(vStrVal.compare("1.0") > 0) |
736 |
+- { |
737 |
+- std::cout << " Native vector width char:\t\t\t " |
738 |
+- << device.getInfo<CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR>() |
739 |
+- << std::endl; |
740 |
+- |
741 |
+- std::cout << " Native vector width short:\t\t\t " |
742 |
+- << device.getInfo<CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT>() |
743 |
+- << std::endl; |
744 |
+- |
745 |
+- std::cout << " Native vector width int:\t\t\t " |
746 |
+- << device.getInfo<CL_DEVICE_NATIVE_VECTOR_WIDTH_INT>() |
747 |
+- << std::endl; |
748 |
+- |
749 |
+- std::cout << " Native vector width long:\t\t\t " |
750 |
+- << device.getInfo<CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG>() |
751 |
+- << std::endl; |
752 |
+- |
753 |
+- std::cout << " Native vector width float:\t\t\t " |
754 |
+- << device.getInfo<CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT>() |
755 |
+- << std::endl; |
756 |
+- |
757 |
+- std::cout << " Native vector width double:\t\t\t " |
758 |
+- << device.getInfo<CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE>() |
759 |
+- << std::endl; |
760 |
+- } |
761 |
+-#endif // CL_VERSION_1_1 |
762 |
+- std::cout << " Max clock frequency:\t\t\t\t " |
763 |
+- << device.getInfo<CL_DEVICE_MAX_CLOCK_FREQUENCY>() |
764 |
+- << "Mhz" |
765 |
+- << std::endl; |
766 |
+- |
767 |
+- std::cout << " Address bits:\t\t\t\t\t " |
768 |
+- << device.getInfo<CL_DEVICE_ADDRESS_BITS>() |
769 |
+- << std::endl; |
770 |
+- |
771 |
+- std::cout << " Max memory allocation:\t\t\t " |
772 |
+- << device.getInfo<CL_DEVICE_MAX_MEM_ALLOC_SIZE>() |
773 |
+- << std::endl; |
774 |
+- |
775 |
+- std::cout << " Image support:\t\t\t\t " |
776 |
+- << (device.getInfo<CL_DEVICE_IMAGE_SUPPORT>() ? "Yes" : "No") |
777 |
+- << std::endl; |
778 |
+- |
779 |
+- if (device.getInfo<CL_DEVICE_IMAGE_SUPPORT>()) |
780 |
+- { |
781 |
+- |
782 |
+- std::cout << " Max number of images read arguments:\t\t " |
783 |
+- << device.getInfo<CL_DEVICE_MAX_READ_IMAGE_ARGS>() |
784 |
+- << std::endl; |
785 |
+- |
786 |
+- std::cout << " Max number of images write arguments:\t\t " |
787 |
+- << device.getInfo<CL_DEVICE_MAX_WRITE_IMAGE_ARGS>() |
788 |
+- << std::endl; |
789 |
+- |
790 |
+- std::cout << " Max image 2D width:\t\t\t\t " |
791 |
+- << device.getInfo<CL_DEVICE_IMAGE2D_MAX_WIDTH>() |
792 |
+- << std::endl; |
793 |
+- |
794 |
+- std::cout << " Max image 2D height:\t\t\t\t " |
795 |
+- << device.getInfo<CL_DEVICE_IMAGE2D_MAX_HEIGHT>() |
796 |
+- << std::endl; |
797 |
+- |
798 |
+- std::cout << " Max image 3D width:\t\t\t\t " |
799 |
+- << device.getInfo<CL_DEVICE_IMAGE3D_MAX_WIDTH>() |
800 |
+- << std::endl; |
801 |
+- |
802 |
+- std::cout << " Max image 3D height:\t\t\t\t " |
803 |
+- << device.getInfo<CL_DEVICE_IMAGE3D_MAX_HEIGHT>() |
804 |
+- << std::endl; |
805 |
+- |
806 |
+- std::cout << " Max image 3D depth:\t\t\t\t " |
807 |
+- << device.getInfo<CL_DEVICE_IMAGE3D_MAX_DEPTH>() |
808 |
+- << std::endl; |
809 |
+- |
810 |
+- std::cout << " Max samplers within kernel:\t\t\t " |
811 |
+- << device.getInfo<CL_DEVICE_MAX_SAMPLERS>() |
812 |
+- << std::endl; |
813 |
+- |
814 |
+- if (verbose) |
815 |
+- { |
816 |
+- std::cout << " Image formats supported:" << std::endl; |
817 |
+- std::vector<cl::ImageFormat> formats; |
818 |
+- |
819 |
+- cl_context_properties cps[3] = { CL_CONTEXT_PLATFORM, (cl_context_properties)(*p)(), 0 }; |
820 |
+- std::vector<cl::Device> device; |
821 |
+- device.push_back(*i); |
822 |
+- cl::Context context(device, cps, NULL, NULL, &err); |
823 |
+- |
824 |
+- std::map<int,std::string> channelOrder; |
825 |
+- channelOrder[CL_R] = "CL_R"; |
826 |
+- channelOrder[CL_A] = "CL_A"; |
827 |
+- channelOrder[CL_RG] = "CL_RG"; |
828 |
+- channelOrder[CL_RA] = "CL_RA"; |
829 |
+- channelOrder[CL_RGB] = "CL_RGB"; |
830 |
+- channelOrder[CL_RGBA] = "CL_RGBA"; |
831 |
+- channelOrder[CL_BGRA] = "CL_BGRA"; |
832 |
+- channelOrder[CL_ARGB] = "CL_ARGB"; |
833 |
+- channelOrder[CL_INTENSITY] = "CL_INTENSITY"; |
834 |
+- channelOrder[CL_LUMINANCE] = "CL_LUMINANCE"; |
835 |
+- channelOrder[CL_Rx] = "CL_Rx"; |
836 |
+- channelOrder[CL_RGx] = "CL_RGx"; |
837 |
+- channelOrder[CL_RGBx] = "CL_RGBx"; |
838 |
+- |
839 |
+- std::map<int,std::pair<std::string, std::string> > channelType; |
840 |
+- channelType[CL_SNORM_INT8] = std::make_pair("snorm", "int8"); |
841 |
+- channelType[CL_SNORM_INT16] = std::make_pair("snorm", "int16"); |
842 |
+- channelType[CL_UNORM_INT8] = std::make_pair("unorm", "int8"); |
843 |
+- channelType[CL_UNORM_INT16] = std::make_pair("unorm", "int16"); |
844 |
+- channelType[CL_UNORM_SHORT_565] = std::make_pair("unorm", "short_565"); |
845 |
+- channelType[CL_UNORM_SHORT_555] = std::make_pair("unorm", "short_555"); |
846 |
+- channelType[CL_UNORM_INT_101010] = std::make_pair("unorm", "int_101010"); |
847 |
+- channelType[CL_SIGNED_INT8] = std::make_pair("signed", "int8"); |
848 |
+- channelType[CL_SIGNED_INT16] = std::make_pair("signed", "int16"); |
849 |
+- channelType[CL_SIGNED_INT32] = std::make_pair("signed", "int32"); |
850 |
+- channelType[CL_UNSIGNED_INT8] = std::make_pair("unsigned", "int8"); |
851 |
+- channelType[CL_UNSIGNED_INT16] = std::make_pair("unsigned", "int16"); |
852 |
+- channelType[CL_UNSIGNED_INT32] = std::make_pair("unsigned", "int32"); |
853 |
+- channelType[CL_HALF_FLOAT] = std::make_pair("half_float", ""); |
854 |
+- channelType[CL_FLOAT] = std::make_pair("float", ""); |
855 |
+- |
856 |
+- std::vector<std::pair<int, std::string> > imageDimensions; |
857 |
+- imageDimensions.push_back(std::make_pair(CL_MEM_OBJECT_IMAGE2D, std::string("2D "))); |
858 |
+- imageDimensions.push_back(std::make_pair(CL_MEM_OBJECT_IMAGE3D, std::string("3D "))); |
859 |
+- for(std::vector<std::pair<int, std::string> >::iterator id = imageDimensions.begin(); |
860 |
+- id != imageDimensions.end(); |
861 |
+- id++){ |
862 |
+- |
863 |
+- struct imageAccessStruct { |
864 |
+- std::string name; |
865 |
+- int access; |
866 |
+- std::vector<cl::ImageFormat> formats; |
867 |
+- } imageAccess[] = {{std::string("Read-Write/Read-Only/Write-Only"), CL_MEM_READ_WRITE, std::vector<cl::ImageFormat>()}, |
868 |
+- {std::string("Read-Only"), CL_MEM_READ_ONLY, std::vector<cl::ImageFormat>()}, |
869 |
+- {std::string("Write-Only"), CL_MEM_WRITE_ONLY, std::vector<cl::ImageFormat>()}}; |
870 |
+- |
871 |
+- for(size_t ia=0; ia < sizeof(imageAccess)/sizeof(imageAccessStruct); ia++){ |
872 |
+- context.getSupportedImageFormats(imageAccess[ia].access, (*id).first, &(imageAccess[ia].formats)); |
873 |
+- bool printTopHeader = true; |
874 |
+- for (std::map<int,std::string>::iterator o = channelOrder.begin(); |
875 |
+- o != channelOrder.end(); |
876 |
+- o++) |
877 |
+- { |
878 |
+- bool printHeader = true; |
879 |
+- |
880 |
+- for (std::vector<cl::ImageFormat>::iterator it = imageAccess[ia].formats.begin(); |
881 |
+- it != imageAccess[ia].formats.end(); |
882 |
+- ++it) |
883 |
+- { |
884 |
+- if ( (*o).first == (int)(*it).image_channel_order) |
885 |
+- { |
886 |
+- bool printedAlready = false; |
887 |
+- //see if this was already print in RW/RO/WO |
888 |
+- if (ia !=0) |
889 |
+- { |
890 |
+- for (std::vector<cl::ImageFormat>::iterator searchIt = imageAccess[0].formats.begin(); |
891 |
+- searchIt != imageAccess[0].formats.end(); |
892 |
+- searchIt++) |
893 |
+- { |
894 |
+- if ( ((*searchIt).image_channel_data_type == (*it).image_channel_data_type) && |
895 |
+- ((*searchIt).image_channel_order == (*it).image_channel_order)) |
896 |
+- { |
897 |
+- printedAlready = true; |
898 |
+- break; |
899 |
+- } |
900 |
+- } |
901 |
+- } |
902 |
+- if (printedAlready) |
903 |
+- { |
904 |
+- continue; |
905 |
+- } |
906 |
+- if (printTopHeader) |
907 |
+- { |
908 |
+- std::cout << " " << (*id).second << imageAccess[ia].name << std::endl; |
909 |
+- printTopHeader = false; |
910 |
+- } |
911 |
+- if (printHeader) |
912 |
+- { |
913 |
+- std::cout << " " << (*o).second << ": "; |
914 |
+- printHeader = false; |
915 |
+- } |
916 |
+- std::cout << channelType[(*it).image_channel_data_type].first; |
917 |
+- if (channelType[(*it).image_channel_data_type].second != "") |
918 |
+- { |
919 |
+- std::cout << "-" |
920 |
+- << channelType[(*it).image_channel_data_type].second; |
921 |
+- } |
922 |
+- if (it != (imageAccess[ia].formats.end() - 1)) |
923 |
+- { |
924 |
+- std::cout << " "; |
925 |
+- } |
926 |
+- } |
927 |
+- } |
928 |
+- if (printHeader == false) |
929 |
+- { |
930 |
+- std::cout << std::endl; |
931 |
+- } |
932 |
+- } |
933 |
+- } |
934 |
+- } |
935 |
+- } |
936 |
+- } |
937 |
+- |
938 |
+- std::cout << " Max size of kernel argument:\t\t\t " |
939 |
+- << device.getInfo<CL_DEVICE_MAX_PARAMETER_SIZE>() |
940 |
+- << std::endl; |
941 |
+- |
942 |
+- std::cout << " Alignment (bits) of base address:\t\t " |
943 |
+- << device.getInfo<CL_DEVICE_MEM_BASE_ADDR_ALIGN>() |
944 |
+- << std::endl; |
945 |
+- |
946 |
+- std::cout << " Minimum alignment (bytes) for any datatype:\t " |
947 |
+- << device.getInfo<CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE>() |
948 |
+- << std::endl; |
949 |
+- |
950 |
+- std::cout << " Single precision floating point capability" << std::endl; |
951 |
+- std::cout << " Denorms:\t\t\t\t\t " |
952 |
+- << (device.getInfo<CL_DEVICE_SINGLE_FP_CONFIG>() & |
953 |
+- CL_FP_DENORM ? "Yes" : "No") |
954 |
+- << std::endl; |
955 |
+- std::cout << " Quiet NaNs:\t\t\t\t\t " |
956 |
+- << (device.getInfo<CL_DEVICE_SINGLE_FP_CONFIG>() & |
957 |
+- CL_FP_INF_NAN ? "Yes" : "No") |
958 |
+- << std::endl; |
959 |
+- std::cout << " Round to nearest even:\t\t\t " |
960 |
+- << (device.getInfo<CL_DEVICE_SINGLE_FP_CONFIG>() & |
961 |
+- CL_FP_ROUND_TO_NEAREST ? "Yes" : "No") |
962 |
+- << std::endl; |
963 |
+- std::cout << " Round to zero:\t\t\t\t " |
964 |
+- << (device.getInfo<CL_DEVICE_SINGLE_FP_CONFIG>() & |
965 |
+- CL_FP_ROUND_TO_ZERO ? "Yes" : "No") |
966 |
+- << std::endl; |
967 |
+- std::cout << " Round to +ve and infinity:\t\t\t " |
968 |
+- << (device.getInfo<CL_DEVICE_SINGLE_FP_CONFIG>() & |
969 |
+- CL_FP_ROUND_TO_INF ? "Yes" : "No") |
970 |
+- << std::endl; |
971 |
+- std::cout << " IEEE754-2008 fused multiply-add:\t\t " |
972 |
+- << (device.getInfo<CL_DEVICE_SINGLE_FP_CONFIG>() & |
973 |
+- CL_FP_FMA ? "Yes" : "No") |
974 |
+- << std::endl; |
975 |
+- |
976 |
+- std::cout << " Cache type:\t\t\t\t\t " ; |
977 |
+- switch (device.getInfo<CL_DEVICE_GLOBAL_MEM_CACHE_TYPE>()) { |
978 |
+- case CL_NONE: |
979 |
+- std::cout << "None" << std::endl; |
980 |
+- break; |
981 |
+- case CL_READ_ONLY_CACHE: |
982 |
+- std::cout << "Read only" << std::endl; |
983 |
+- break; |
984 |
+- case CL_READ_WRITE_CACHE: |
985 |
+- std::cout << "Read/Write" << std::endl; |
986 |
+- break; |
987 |
+- } |
988 |
+- |
989 |
+- std::cout << " Cache line size:\t\t\t\t " |
990 |
+- << device.getInfo<CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE>() |
991 |
+- << std::endl; |
992 |
+- |
993 |
+- std::cout << " Cache size:\t\t\t\t\t " |
994 |
+- << device.getInfo<CL_DEVICE_GLOBAL_MEM_CACHE_SIZE>() |
995 |
+- << std::endl; |
996 |
+- |
997 |
+- std::cout << " Global memory size:\t\t\t\t " |
998 |
+- << device.getInfo<CL_DEVICE_GLOBAL_MEM_SIZE>() |
999 |
+- << std::endl; |
1000 |
+- |
1001 |
+- std::cout << " Constant buffer size:\t\t\t\t " |
1002 |
+- << device.getInfo<CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE>() |
1003 |
+- << std::endl; |
1004 |
+- |
1005 |
+- std::cout << " Max number of constant args:\t\t\t " |
1006 |
+- << device.getInfo<CL_DEVICE_MAX_CONSTANT_ARGS>() |
1007 |
+- << std::endl; |
1008 |
+- |
1009 |
+- std::cout << " Local memory type:\t\t\t\t " ; |
1010 |
+- switch (device.getInfo<CL_DEVICE_LOCAL_MEM_TYPE>()) { |
1011 |
+- case CL_LOCAL: |
1012 |
+- std::cout << "Scratchpad" << std::endl; |
1013 |
+- break; |
1014 |
+- case CL_GLOBAL: |
1015 |
+- std::cout << "Global" << std::endl; |
1016 |
+- break; |
1017 |
+- } |
1018 |
+- |
1019 |
+- |
1020 |
+- std::cout << " Local memory size:\t\t\t\t " |
1021 |
+- << device.getInfo<CL_DEVICE_LOCAL_MEM_SIZE>() |
1022 |
+- << std::endl; |
1023 |
+- |
1024 |
+-#if defined(CL_VERSION_2_0) |
1025 |
+- if(vStrVal.compare("2") > 0) |
1026 |
+- { |
1027 |
+- std::cout << " Max pipe arguments:\t\t\t\t " |
1028 |
+- << device.getInfo<CL_DEVICE_MAX_PIPE_ARGS>() |
1029 |
+- << std::endl; |
1030 |
+- |
1031 |
+- std::cout << " Max pipe active reservations:\t\t\t " |
1032 |
+- << device.getInfo<CL_DEVICE_PIPE_MAX_ACTIVE_RESERVATIONS>() |
1033 |
+- << std::endl; |
1034 |
+- |
1035 |
+- std::cout << " Max pipe packet size:\t\t\t\t " |
1036 |
+- << device.getInfo<CL_DEVICE_PIPE_MAX_PACKET_SIZE>() |
1037 |
+- << std::endl; |
1038 |
+- |
1039 |
+- std::cout << " Max global variable size:\t\t\t " |
1040 |
+- << device.getInfo<CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE>() |
1041 |
+- << std::endl; |
1042 |
+- |
1043 |
+- std::cout << " Max global variable preferred total size:\t " |
1044 |
+- << device.getInfo<CL_DEVICE_GLOBAL_VARIABLE_PREFERRED_TOTAL_SIZE>() |
1045 |
+- << std::endl; |
1046 |
+- |
1047 |
+- std::cout << " Max read/write image args:\t\t\t " |
1048 |
+- << device.getInfo<CL_DEVICE_MAX_READ_WRITE_IMAGE_ARGS>() |
1049 |
+- << std::endl; |
1050 |
+- |
1051 |
+- std::cout << " Max on device events:\t\t\t\t " |
1052 |
+- << device.getInfo<CL_DEVICE_MAX_ON_DEVICE_EVENTS>() |
1053 |
+- << std::endl; |
1054 |
+- |
1055 |
+- std::cout << " Queue on device max size:\t\t\t " |
1056 |
+- << device.getInfo<CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE>() |
1057 |
+- << std::endl; |
1058 |
+- |
1059 |
+- std::cout << " Max on device queues:\t\t\t\t " |
1060 |
+- << device.getInfo<CL_DEVICE_MAX_ON_DEVICE_QUEUES>() |
1061 |
+- << std::endl; |
1062 |
+- |
1063 |
+- std::cout << " Queue on device preferred size:\t\t " |
1064 |
+- << device.getInfo<CL_DEVICE_QUEUE_ON_DEVICE_PREFERRED_SIZE>() |
1065 |
+- << std::endl; |
1066 |
+- |
1067 |
+- std::cout << " SVM capabilities:\t\t\t\t " << std::endl; |
1068 |
+- std::cout << " Coarse grain buffer:\t\t\t " |
1069 |
+- << (device.getInfo<CL_DEVICE_SVM_CAPABILITIES>() & |
1070 |
+- CL_DEVICE_SVM_COARSE_GRAIN_BUFFER ? "Yes" : "No") |
1071 |
+- << std::endl; |
1072 |
+- std::cout << " Fine grain buffer:\t\t\t\t " |
1073 |
+- << (device.getInfo<CL_DEVICE_SVM_CAPABILITIES>() & |
1074 |
+- CL_DEVICE_SVM_FINE_GRAIN_BUFFER ? "Yes" : "No") |
1075 |
+- << std::endl; |
1076 |
+- std::cout << " Fine grain system:\t\t\t\t " |
1077 |
+- << (device.getInfo<CL_DEVICE_SVM_CAPABILITIES>() & |
1078 |
+- CL_DEVICE_SVM_FINE_GRAIN_SYSTEM ? "Yes" : "No") |
1079 |
+- << std::endl; |
1080 |
+- std::cout << " Atomics:\t\t\t\t\t " |
1081 |
+- << (device.getInfo<CL_DEVICE_SVM_CAPABILITIES>() & |
1082 |
+- CL_DEVICE_SVM_ATOMICS ? "Yes" : "No") |
1083 |
+- << std::endl; |
1084 |
+- |
1085 |
+- std::cout << " Preferred platform atomic alignment:\t\t " |
1086 |
+- << device.getInfo<CL_DEVICE_PREFERRED_PLATFORM_ATOMIC_ALIGNMENT>() |
1087 |
+- << std::endl; |
1088 |
+- |
1089 |
+- std::cout << " Preferred global atomic alignment:\t\t " |
1090 |
+- << device.getInfo<CL_DEVICE_PREFERRED_GLOBAL_ATOMIC_ALIGNMENT>() |
1091 |
+- << std::endl; |
1092 |
+- |
1093 |
+- std::cout << " Preferred local atomic alignment:\t\t " |
1094 |
+- << device.getInfo<CL_DEVICE_PREFERRED_LOCAL_ATOMIC_ALIGNMENT>() |
1095 |
+- << std::endl; |
1096 |
+- } |
1097 |
+-#endif // CL_VERSION_2_0 |
1098 |
+- |
1099 |
+-#if defined(CL_VERSION_1_1) && !defined(ATI_ARCH_ARM) |
1100 |
+- if(vStrVal.compare("1.0") > 0) |
1101 |
+- { |
1102 |
+- cl_context_properties cps[3] = { CL_CONTEXT_PLATFORM, (cl_context_properties)(*p)(), 0 }; |
1103 |
+- |
1104 |
+- std::vector<cl::Device> device; |
1105 |
+- device.push_back(*i); |
1106 |
+- |
1107 |
+- cl::Context context(device, cps, NULL, NULL, &err); |
1108 |
+- if (err != CL_SUCCESS) { |
1109 |
+- std::cerr << "Context::Context() failed (" << err << ")\n"; |
1110 |
+- return EXIT_FAILURE; |
1111 |
+- } |
1112 |
+- std::string kernelStr("__kernel void hello(){ size_t i = get_global_id(0); size_t j = get_global_id(1);}"); |
1113 |
+- cl::Program::Sources sources(1, std::make_pair(kernelStr.data(), kernelStr.size())); |
1114 |
+- |
1115 |
+- cl::Program program = cl::Program(context, sources, &err); |
1116 |
+- if (err != CL_SUCCESS) { |
1117 |
+- std::cerr << "Program::Program() failed (" << err << ")\n"; |
1118 |
+- return EXIT_FAILURE; |
1119 |
+- } |
1120 |
+- |
1121 |
+- err = program.build(device); |
1122 |
+- if (err != CL_SUCCESS) { |
1123 |
+- |
1124 |
+- if(err == CL_BUILD_PROGRAM_FAILURE) |
1125 |
+- { |
1126 |
+- std::string str = program.getBuildInfo<CL_PROGRAM_BUILD_LOG>((*i)); |
1127 |
+- |
1128 |
+- std::cout << " \n\t\t\tBUILD LOG\n"; |
1129 |
+- std::cout << " ************************************************\n"; |
1130 |
+- std::cout << str.c_str() << std::endl; |
1131 |
+- std::cout << " ************************************************\n"; |
1132 |
+- } |
1133 |
+- |
1134 |
+- std::cerr << "Program::build() failed (" << err << ")\n"; |
1135 |
+- return EXIT_FAILURE; |
1136 |
+- } |
1137 |
+- |
1138 |
+- cl::Kernel kernel(program, "hello", &err); |
1139 |
+- if (err != CL_SUCCESS) { |
1140 |
+- std::cerr << "Kernel::Kernel() failed (" << err << ")\n"; |
1141 |
+- return EXIT_FAILURE; |
1142 |
+- } |
1143 |
+- |
1144 |
+- std::cout << " Kernel Preferred work group size multiple:\t " |
1145 |
+- << kernel.getWorkGroupInfo<CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE>((*i), &err) |
1146 |
+- << std::endl; |
1147 |
+- } |
1148 |
+- |
1149 |
+-#endif // CL_VERSION_1_1 |
1150 |
+- |
1151 |
+- std::cout << " Error correction support:\t\t\t " |
1152 |
+- << device.getInfo<CL_DEVICE_ERROR_CORRECTION_SUPPORT>() |
1153 |
+- << std::endl; |
1154 |
+-#ifdef CL_VERSION_1_1 |
1155 |
+- if(vStrVal.compare("1.0") > 0) |
1156 |
+- { |
1157 |
+- std::cout << " Unified memory for Host and Device:\t\t " |
1158 |
+- << device.getInfo<CL_DEVICE_HOST_UNIFIED_MEMORY>() |
1159 |
+- << std::endl; |
1160 |
+- } |
1161 |
+-#endif // CL_VERSION_1_1 |
1162 |
+- std::cout << " Profiling timer resolution:\t\t\t " |
1163 |
+- << device.getInfo<CL_DEVICE_PROFILING_TIMER_RESOLUTION>() |
1164 |
+- << std::endl; |
1165 |
+- |
1166 |
+- std::cout << " Device endianess:\t\t\t\t " |
1167 |
+- << (device.getInfo<CL_DEVICE_ENDIAN_LITTLE>() ? "Little" : "Big") |
1168 |
+- << std::endl; |
1169 |
+- |
1170 |
+- std::cout << " Available:\t\t\t\t\t " |
1171 |
+- << (device.getInfo<CL_DEVICE_AVAILABLE>() ? "Yes" : "No") |
1172 |
+- << std::endl; |
1173 |
+- |
1174 |
+- std::cout << " Compiler available:\t\t\t\t " |
1175 |
+- << (device.getInfo<CL_DEVICE_COMPILER_AVAILABLE>() ? "Yes" : "No") |
1176 |
+- << std::endl; |
1177 |
+- |
1178 |
+- std::cout << " Execution capabilities:\t\t\t\t " << std::endl; |
1179 |
+- std::cout << " Execute OpenCL kernels:\t\t\t " |
1180 |
+- << (device.getInfo<CL_DEVICE_EXECUTION_CAPABILITIES>() & |
1181 |
+- CL_EXEC_KERNEL ? "Yes" : "No") |
1182 |
+- << std::endl; |
1183 |
+- std::cout << " Execute native function:\t\t\t " |
1184 |
+- << (device.getInfo<CL_DEVICE_EXECUTION_CAPABILITIES>() & |
1185 |
+- CL_EXEC_NATIVE_KERNEL ? "Yes" : "No") |
1186 |
+- << std::endl; |
1187 |
+- |
1188 |
+- std::cout << " Queue on Host properties:\t\t\t\t " << std::endl; |
1189 |
+- std::cout << " Out-of-Order:\t\t\t\t " |
1190 |
+- << (device.getInfo<CL_DEVICE_QUEUE_ON_HOST_PROPERTIES>() & |
1191 |
+- CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE ? "Yes" : "No") |
1192 |
+- << std::endl; |
1193 |
+- std::cout << " Profiling :\t\t\t\t\t " |
1194 |
+- << (device.getInfo<CL_DEVICE_QUEUE_ON_HOST_PROPERTIES>() & |
1195 |
+- CL_QUEUE_PROFILING_ENABLE ? "Yes" : "No") |
1196 |
+- << std::endl; |
1197 |
+- |
1198 |
+-#ifdef CL_VERSION_2_0 |
1199 |
+- if(vStrVal.compare("2") > 0) |
1200 |
+- { |
1201 |
+- std::cout << " Queue on Device properties:\t\t\t\t " << std::endl; |
1202 |
+- std::cout << " Out-of-Order:\t\t\t\t " |
1203 |
+- << (device.getInfo<CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES>() & |
1204 |
+- CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE ? "Yes" : "No") |
1205 |
+- << std::endl; |
1206 |
+- std::cout << " Profiling :\t\t\t\t\t " |
1207 |
+- << (device.getInfo<CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES>() & |
1208 |
+- CL_QUEUE_PROFILING_ENABLE ? "Yes" : "No") |
1209 |
+- << std::endl; |
1210 |
+- } |
1211 |
+-#endif |
1212 |
+- |
1213 |
+- std::cout << " Platform ID:\t\t\t\t\t " |
1214 |
+- << device.getInfo<CL_DEVICE_PLATFORM>() |
1215 |
+- << std::endl; |
1216 |
+- |
1217 |
+- std::cout << " Name:\t\t\t\t\t\t " |
1218 |
+- << device.getInfo<CL_DEVICE_NAME>().c_str() |
1219 |
+- << std::endl; |
1220 |
+- |
1221 |
+- std::cout << " Vendor:\t\t\t\t\t " |
1222 |
+- << device.getInfo<CL_DEVICE_VENDOR>().c_str() |
1223 |
+- << std::endl; |
1224 |
+-#ifdef CL_VERSION_1_1 |
1225 |
+- if(vStrVal.compare("1.0") > 0) |
1226 |
+- { |
1227 |
+- std::cout << " Device OpenCL C version:\t\t\t " |
1228 |
+- << device.getInfo<CL_DEVICE_OPENCL_C_VERSION>().c_str() |
1229 |
+- << std::endl; |
1230 |
+- } |
1231 |
+-#endif // CL_VERSION_1_1 |
1232 |
+- std::cout << " Driver version:\t\t\t\t " |
1233 |
+- << device.getInfo<CL_DRIVER_VERSION>().c_str() |
1234 |
+- << std::endl; |
1235 |
+- |
1236 |
+- std::cout << " Profile:\t\t\t\t\t " |
1237 |
+- << device.getInfo<CL_DEVICE_PROFILE>().c_str() |
1238 |
+- << std::endl; |
1239 |
+- |
1240 |
+- std::cout << " Version:\t\t\t\t\t " |
1241 |
+- << device.getInfo<CL_DEVICE_VERSION>().c_str() |
1242 |
+- << std::endl; |
1243 |
+- |
1244 |
+- |
1245 |
+- std::cout << " Extensions:\t\t\t\t\t " |
1246 |
+- << device.getInfo<CL_DEVICE_EXTENSIONS>().c_str() |
1247 |
+- << std::endl; |
1248 |
+- |
1249 |
+- std::cout << std::endl << std::endl; |
1250 |
+- } |
1251 |
+- } |
1252 |
+- } |
1253 |
+- catch (cl::Error err) |
1254 |
+- { |
1255 |
+- std::cerr |
1256 |
+- << "ERROR: " |
1257 |
+- << err.what() |
1258 |
+- << "(" |
1259 |
+- << err.err() |
1260 |
+- << ")" |
1261 |
+- << std::endl; |
1262 |
+- return EXIT_FAILURE; |
1263 |
+- } |
1264 |
+- |
1265 |
+- return EXIT_SUCCESS; |
1266 |
+-} |
1267 |
|
1268 |
diff --git a/dev-libs/rocm-opencl-runtime/metadata.xml b/dev-libs/rocm-opencl-runtime/metadata.xml |
1269 |
new file mode 100644 |
1270 |
index 00000000000..359755b2e5a |
1271 |
--- /dev/null |
1272 |
+++ b/dev-libs/rocm-opencl-runtime/metadata.xml |
1273 |
@@ -0,0 +1,14 @@ |
1274 |
+<?xml version="1.0" encoding="UTF-8"?> |
1275 |
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> |
1276 |
+<pkgmetadata> |
1277 |
+ <maintainer type="person"> |
1278 |
+ <email>candrews@g.o</email> |
1279 |
+ <name>Craig Andrews</name> |
1280 |
+ </maintainer> |
1281 |
+ <upstream> |
1282 |
+ <remote-id type="github">RadeonOpenCompute/ROCm-OpenCL-Runtime</remote-id> |
1283 |
+ </upstream> |
1284 |
+ <longdescription lang="en"> |
1285 |
+ Radeon Open Compute OpenCL Compatible Runtime |
1286 |
+ </longdescription> |
1287 |
+</pkgmetadata> |
1288 |
|
1289 |
diff --git a/dev-libs/rocm-opencl-runtime/rocm-opencl-runtime-2.6.0.ebuild b/dev-libs/rocm-opencl-runtime/rocm-opencl-runtime-2.6.0.ebuild |
1290 |
new file mode 100644 |
1291 |
index 00000000000..cd44ed80e4d |
1292 |
--- /dev/null |
1293 |
+++ b/dev-libs/rocm-opencl-runtime/rocm-opencl-runtime-2.6.0.ebuild |
1294 |
@@ -0,0 +1,50 @@ |
1295 |
+# Copyright 1999-2019 Gentoo Authors |
1296 |
+# Distributed under the terms of the GNU General Public License v2 |
1297 |
+ |
1298 |
+EAPI=7 |
1299 |
+ |
1300 |
+inherit cmake-utils |
1301 |
+ |
1302 |
+OPENCL_ICD_COMMIT="bc9728edf8cace79cf33bf75560be88fc2432dc4" |
1303 |
+SRC_URI="https://github.com/KhronosGroup/OpenCL-ICD-Loader/archive/${OPENCL_ICD_COMMIT}.tar.gz -> OpenCL-ICD-Loader-${OPENCL_ICD_COMMIT}.tar.gz" |
1304 |
+if [[ ${PV} == *9999 ]] ; then |
1305 |
+ EGIT_REPO_URI="https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime/" |
1306 |
+ inherit git-r3 |
1307 |
+else |
1308 |
+ SRC_URI+=" https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime/archive/roc-${PV}.tar.gz -> ${P}.tar.gz" |
1309 |
+ KEYWORDS="~amd64" |
1310 |
+ S="${WORKDIR}/ROCm-OpenCL-Runtime-roc-${PV}" |
1311 |
+fi |
1312 |
+ |
1313 |
+DESCRIPTION="Radeon Open Compute OpenCL Compatible Runtime" |
1314 |
+HOMEPAGE="https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime" |
1315 |
+ |
1316 |
+LICENSE="Apache-2.0 MIT" |
1317 |
+SLOT="0/$(ver_cut 1-2)" |
1318 |
+ |
1319 |
+RDEPEND="dev-libs/rocr-runtime |
1320 |
+ dev-libs/rocm-comgr |
1321 |
+ dev-libs/rocm-device-libs |
1322 |
+ dev-libs/rocm-opencl-driver" |
1323 |
+DEPEND="${RDEPEND} |
1324 |
+ dev-lang/ocaml |
1325 |
+ dev-ml/findlib" |
1326 |
+ |
1327 |
+PATCHES=( |
1328 |
+ "${FILESDIR}/${P}-unbundle-dependencies.patch" |
1329 |
+) |
1330 |
+ |
1331 |
+src_prepare() { |
1332 |
+ mkdir -p "${S}"/api/opencl/khronos/ || die |
1333 |
+ mv "${WORKDIR}/OpenCL-ICD-Loader-${OPENCL_ICD_COMMIT}" "${S}"/api/opencl/khronos/icd || die |
1334 |
+ cmake-utils_src_prepare |
1335 |
+} |
1336 |
+ |
1337 |
+src_configure() { |
1338 |
+ local mycmakeargs=( |
1339 |
+ -DLLVM_DIR="${EPREFIX}/usr/lib/llvm/roc/" |
1340 |
+ -DClang_DIR="${EPREFIX}/usr/lib/llvm/roc/lib/cmake/clang/" |
1341 |
+ -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/" |
1342 |
+ ) |
1343 |
+ cmake-utils_src_configure |
1344 |
+} |