Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 1 | // |
| 2 | // Copyright 2012 Francisco Jerez |
| 3 | // |
| 4 | // Permission is hereby granted, free of charge, to any person obtaining a |
| 5 | // copy of this software and associated documentation files (the "Software"), |
| 6 | // to deal in the Software without restriction, including without limitation |
| 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 | // and/or sell copies of the Software, and to permit persons to whom the |
| 9 | // Software is furnished to do so, subject to the following conditions: |
| 10 | // |
| 11 | // The above copyright notice and this permission notice shall be included in |
| 12 | // all copies or substantial portions of the Software. |
| 13 | // |
| 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
Kenneth Graunke | f0cb66b | 2013-04-21 13:52:08 -0700 | [diff] [blame] | 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
| 18 | // OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 19 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 20 | // OTHER DEALINGS IN THE SOFTWARE. |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 21 | // |
| 22 | |
Aaron Watry | 5e253fe | 2017-08-16 20:44:41 -0500 | [diff] [blame] | 23 | #include <unistd.h> |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 24 | #include "core/device.hpp" |
Francisco Jerez | c4578d2 | 2014-02-18 15:07:11 +0100 | [diff] [blame] | 25 | #include "core/platform.hpp" |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 26 | #include "pipe/p_screen.h" |
| 27 | #include "pipe/p_state.h" |
Aaron Watry | 95ae6c0 | 2017-08-09 22:02:30 -0500 | [diff] [blame] | 28 | #include "util/u_debug.h" |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 29 | |
| 30 | using namespace clover; |
| 31 | |
| 32 | namespace { |
| 33 | template<typename T> |
| 34 | std::vector<T> |
Bas Nieuwenhuizen | 1a5c8c2 | 2016-03-25 02:06:50 +0100 | [diff] [blame] | 35 | get_compute_param(pipe_screen *pipe, pipe_shader_ir ir_format, |
| 36 | pipe_compute_cap cap) { |
| 37 | int sz = pipe->get_compute_param(pipe, ir_format, cap, NULL); |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 38 | std::vector<T> v(sz / sizeof(T)); |
| 39 | |
Bas Nieuwenhuizen | 1a5c8c2 | 2016-03-25 02:06:50 +0100 | [diff] [blame] | 40 | pipe->get_compute_param(pipe, ir_format, cap, &v.front()); |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 41 | return v; |
| 42 | } |
| 43 | } |
| 44 | |
Francisco Jerez | c9e009b | 2013-09-15 20:06:57 -0700 | [diff] [blame] | 45 | device::device(clover::platform &platform, pipe_loader_device *ldev) : |
Francisco Jerez | 1a8ad6c | 2013-04-06 14:35:00 +0200 | [diff] [blame] | 46 | platform(platform), ldev(ldev) { |
Nicolai Hähnle | ae7283d | 2017-08-03 15:02:09 +0200 | [diff] [blame] | 47 | pipe = pipe_loader_create_screen(ldev); |
Tom Stellard | c5f0c98 | 2014-05-08 21:08:32 -0400 | [diff] [blame] | 48 | if (!pipe || !pipe->get_param(pipe, PIPE_CAP_COMPUTE)) { |
| 49 | if (pipe) |
| 50 | pipe->destroy(pipe); |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 51 | throw error(CL_INVALID_DEVICE); |
Tom Stellard | c5f0c98 | 2014-05-08 21:08:32 -0400 | [diff] [blame] | 52 | } |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 53 | } |
| 54 | |
Francisco Jerez | c9e009b | 2013-09-15 20:06:57 -0700 | [diff] [blame] | 55 | device::~device() { |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 56 | if (pipe) |
| 57 | pipe->destroy(pipe); |
| 58 | if (ldev) |
| 59 | pipe_loader_release(&ldev, 1); |
| 60 | } |
| 61 | |
Francisco Jerez | 369419f | 2013-09-16 21:11:16 -0700 | [diff] [blame] | 62 | bool |
| 63 | device::operator==(const device &dev) const { |
| 64 | return this == &dev; |
| 65 | } |
| 66 | |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 67 | cl_device_type |
Francisco Jerez | c9e009b | 2013-09-15 20:06:57 -0700 | [diff] [blame] | 68 | device::type() const { |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 69 | switch (ldev->type) { |
| 70 | case PIPE_LOADER_DEVICE_SOFTWARE: |
| 71 | return CL_DEVICE_TYPE_CPU; |
| 72 | case PIPE_LOADER_DEVICE_PCI: |
Emil Velikov | 2645842 | 2014-01-11 05:19:36 +0000 | [diff] [blame] | 73 | case PIPE_LOADER_DEVICE_PLATFORM: |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 74 | return CL_DEVICE_TYPE_GPU; |
| 75 | default: |
Francisco Jerez | 27c51b5 | 2014-10-08 17:29:14 +0300 | [diff] [blame] | 76 | unreachable("Unknown device type."); |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 77 | } |
| 78 | } |
| 79 | |
| 80 | cl_uint |
Francisco Jerez | c9e009b | 2013-09-15 20:06:57 -0700 | [diff] [blame] | 81 | device::vendor_id() const { |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 82 | switch (ldev->type) { |
| 83 | case PIPE_LOADER_DEVICE_SOFTWARE: |
Emil Velikov | 2645842 | 2014-01-11 05:19:36 +0000 | [diff] [blame] | 84 | case PIPE_LOADER_DEVICE_PLATFORM: |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 85 | return 0; |
| 86 | case PIPE_LOADER_DEVICE_PCI: |
Francisco Jerez | 03e3bc4 | 2012-05-16 15:43:29 +0200 | [diff] [blame] | 87 | return ldev->u.pci.vendor_id; |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 88 | default: |
Francisco Jerez | 27c51b5 | 2014-10-08 17:29:14 +0300 | [diff] [blame] | 89 | unreachable("Unknown device type."); |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 90 | } |
| 91 | } |
| 92 | |
| 93 | size_t |
Francisco Jerez | c9e009b | 2013-09-15 20:06:57 -0700 | [diff] [blame] | 94 | device::max_images_read() const { |
Marek Olšák | b73bec0 | 2015-07-05 14:34:13 +0200 | [diff] [blame] | 95 | return PIPE_MAX_SHADER_IMAGES; |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 96 | } |
| 97 | |
| 98 | size_t |
Francisco Jerez | c9e009b | 2013-09-15 20:06:57 -0700 | [diff] [blame] | 99 | device::max_images_write() const { |
Marek Olšák | b73bec0 | 2015-07-05 14:34:13 +0200 | [diff] [blame] | 100 | return PIPE_MAX_SHADER_IMAGES; |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 101 | } |
| 102 | |
Serge Martin | 05fcc73 | 2016-10-01 18:51:11 +0200 | [diff] [blame] | 103 | size_t |
| 104 | device::max_image_buffer_size() const { |
| 105 | return pipe->get_param(pipe, PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE); |
| 106 | } |
| 107 | |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 108 | cl_uint |
Francisco Jerez | c9e009b | 2013-09-15 20:06:57 -0700 | [diff] [blame] | 109 | device::max_image_levels_2d() const { |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 110 | return pipe->get_param(pipe, PIPE_CAP_MAX_TEXTURE_2D_LEVELS); |
| 111 | } |
| 112 | |
| 113 | cl_uint |
Francisco Jerez | c9e009b | 2013-09-15 20:06:57 -0700 | [diff] [blame] | 114 | device::max_image_levels_3d() const { |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 115 | return pipe->get_param(pipe, PIPE_CAP_MAX_TEXTURE_3D_LEVELS); |
| 116 | } |
| 117 | |
Serge Martin | 05fcc73 | 2016-10-01 18:51:11 +0200 | [diff] [blame] | 118 | size_t |
| 119 | device::max_image_array_number() const { |
| 120 | return pipe->get_param(pipe, PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS); |
| 121 | } |
| 122 | |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 123 | cl_uint |
Francisco Jerez | c9e009b | 2013-09-15 20:06:57 -0700 | [diff] [blame] | 124 | device::max_samplers() const { |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 125 | return pipe->get_shader_param(pipe, PIPE_SHADER_COMPUTE, |
| 126 | PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS); |
| 127 | } |
| 128 | |
| 129 | cl_ulong |
Francisco Jerez | c9e009b | 2013-09-15 20:06:57 -0700 | [diff] [blame] | 130 | device::max_mem_global() const { |
Bas Nieuwenhuizen | 1a5c8c2 | 2016-03-25 02:06:50 +0100 | [diff] [blame] | 131 | return get_compute_param<uint64_t>(pipe, ir_format(), |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 132 | PIPE_COMPUTE_CAP_MAX_GLOBAL_SIZE)[0]; |
| 133 | } |
| 134 | |
| 135 | cl_ulong |
Francisco Jerez | c9e009b | 2013-09-15 20:06:57 -0700 | [diff] [blame] | 136 | device::max_mem_local() const { |
Bas Nieuwenhuizen | 1a5c8c2 | 2016-03-25 02:06:50 +0100 | [diff] [blame] | 137 | return get_compute_param<uint64_t>(pipe, ir_format(), |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 138 | PIPE_COMPUTE_CAP_MAX_LOCAL_SIZE)[0]; |
| 139 | } |
| 140 | |
| 141 | cl_ulong |
Francisco Jerez | c9e009b | 2013-09-15 20:06:57 -0700 | [diff] [blame] | 142 | device::max_mem_input() const { |
Bas Nieuwenhuizen | 1a5c8c2 | 2016-03-25 02:06:50 +0100 | [diff] [blame] | 143 | return get_compute_param<uint64_t>(pipe, ir_format(), |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 144 | PIPE_COMPUTE_CAP_MAX_INPUT_SIZE)[0]; |
| 145 | } |
| 146 | |
| 147 | cl_ulong |
Francisco Jerez | c9e009b | 2013-09-15 20:06:57 -0700 | [diff] [blame] | 148 | device::max_const_buffer_size() const { |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 149 | return pipe->get_shader_param(pipe, PIPE_SHADER_COMPUTE, |
Marek Olšák | 04f2c88 | 2014-07-24 20:32:08 +0200 | [diff] [blame] | 150 | PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE); |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 151 | } |
| 152 | |
| 153 | cl_uint |
Francisco Jerez | c9e009b | 2013-09-15 20:06:57 -0700 | [diff] [blame] | 154 | device::max_const_buffers() const { |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 155 | return pipe->get_shader_param(pipe, PIPE_SHADER_COMPUTE, |
| 156 | PIPE_SHADER_CAP_MAX_CONST_BUFFERS); |
| 157 | } |
| 158 | |
Christoph Bumiller | 5c9bccc | 2012-05-12 19:32:46 +0200 | [diff] [blame] | 159 | size_t |
Francisco Jerez | c9e009b | 2013-09-15 20:06:57 -0700 | [diff] [blame] | 160 | device::max_threads_per_block() const { |
Christoph Bumiller | 5c9bccc | 2012-05-12 19:32:46 +0200 | [diff] [blame] | 161 | return get_compute_param<uint64_t>( |
Bas Nieuwenhuizen | 1a5c8c2 | 2016-03-25 02:06:50 +0100 | [diff] [blame] | 162 | pipe, ir_format(), PIPE_COMPUTE_CAP_MAX_THREADS_PER_BLOCK)[0]; |
Christoph Bumiller | 5c9bccc | 2012-05-12 19:32:46 +0200 | [diff] [blame] | 163 | } |
| 164 | |
Tom Stellard | 71682cf | 2012-09-17 14:29:49 +0000 | [diff] [blame] | 165 | cl_ulong |
Francisco Jerez | c9e009b | 2013-09-15 20:06:57 -0700 | [diff] [blame] | 166 | device::max_mem_alloc_size() const { |
Bas Nieuwenhuizen | 1a5c8c2 | 2016-03-25 02:06:50 +0100 | [diff] [blame] | 167 | return get_compute_param<uint64_t>(pipe, ir_format(), |
Tom Stellard | 71682cf | 2012-09-17 14:29:49 +0000 | [diff] [blame] | 168 | PIPE_COMPUTE_CAP_MAX_MEM_ALLOC_SIZE)[0]; |
| 169 | } |
| 170 | |
Tom Stellard | ca848e8 | 2014-04-18 16:28:41 +0200 | [diff] [blame] | 171 | cl_uint |
| 172 | device::max_clock_frequency() const { |
Bas Nieuwenhuizen | 1a5c8c2 | 2016-03-25 02:06:50 +0100 | [diff] [blame] | 173 | return get_compute_param<uint32_t>(pipe, ir_format(), |
Tom Stellard | ca848e8 | 2014-04-18 16:28:41 +0200 | [diff] [blame] | 174 | PIPE_COMPUTE_CAP_MAX_CLOCK_FREQUENCY)[0]; |
| 175 | } |
| 176 | |
Bruno Jiménez | 2a0dffa | 2014-05-30 17:31:12 +0200 | [diff] [blame] | 177 | cl_uint |
| 178 | device::max_compute_units() const { |
Bas Nieuwenhuizen | 1a5c8c2 | 2016-03-25 02:06:50 +0100 | [diff] [blame] | 179 | return get_compute_param<uint32_t>(pipe, ir_format(), |
Bruno Jiménez | 2a0dffa | 2014-05-30 17:31:12 +0200 | [diff] [blame] | 180 | PIPE_COMPUTE_CAP_MAX_COMPUTE_UNITS)[0]; |
| 181 | } |
| 182 | |
Tom Stellard | 0ec8587 | 2014-07-23 20:37:08 -0400 | [diff] [blame] | 183 | bool |
| 184 | device::image_support() const { |
Bas Nieuwenhuizen | 1a5c8c2 | 2016-03-25 02:06:50 +0100 | [diff] [blame] | 185 | return get_compute_param<uint32_t>(pipe, ir_format(), |
Tom Stellard | 0ec8587 | 2014-07-23 20:37:08 -0400 | [diff] [blame] | 186 | PIPE_COMPUTE_CAP_IMAGES_SUPPORTED)[0]; |
| 187 | } |
| 188 | |
Tom Stellard | c97e902 | 2014-07-02 15:42:43 -0400 | [diff] [blame] | 189 | bool |
| 190 | device::has_doubles() const { |
Nicolai Hähnle | a020cb3 | 2017-01-27 10:35:13 +0100 | [diff] [blame] | 191 | return pipe->get_param(pipe, PIPE_CAP_DOUBLES); |
Tom Stellard | c97e902 | 2014-07-02 15:42:43 -0400 | [diff] [blame] | 192 | } |
| 193 | |
Aaron Watry | d364ab4 | 2017-06-02 21:51:43 -0500 | [diff] [blame] | 194 | bool |
Jan Vesely | fdf0f1d | 2017-09-01 17:48:39 -0400 | [diff] [blame] | 195 | device::has_halves() const { |
| 196 | return pipe->get_shader_param(pipe, PIPE_SHADER_COMPUTE, |
| 197 | PIPE_SHADER_CAP_FP16); |
| 198 | } |
| 199 | |
| 200 | bool |
Jan Vesely | f67ceef | 2017-09-20 16:06:10 -0400 | [diff] [blame] | 201 | device::has_int64_atomics() const { |
| 202 | return pipe->get_shader_param(pipe, PIPE_SHADER_COMPUTE, |
| 203 | PIPE_SHADER_CAP_INT64_ATOMICS); |
| 204 | } |
| 205 | |
| 206 | bool |
Aaron Watry | d364ab4 | 2017-06-02 21:51:43 -0500 | [diff] [blame] | 207 | device::has_unified_memory() const { |
| 208 | return pipe->get_param(pipe, PIPE_CAP_UMA); |
| 209 | } |
| 210 | |
Aaron Watry | 5e253fe | 2017-08-16 20:44:41 -0500 | [diff] [blame] | 211 | cl_uint |
| 212 | device::mem_base_addr_align() const { |
| 213 | return sysconf(_SC_PAGESIZE); |
| 214 | } |
| 215 | |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 216 | std::vector<size_t> |
Francisco Jerez | c9e009b | 2013-09-15 20:06:57 -0700 | [diff] [blame] | 217 | device::max_block_size() const { |
Bas Nieuwenhuizen | 1a5c8c2 | 2016-03-25 02:06:50 +0100 | [diff] [blame] | 218 | auto v = get_compute_param<uint64_t>(pipe, ir_format(), |
| 219 | PIPE_COMPUTE_CAP_MAX_BLOCK_SIZE); |
Francisco Jerez | b70736f | 2012-05-12 19:33:33 +0200 | [diff] [blame] | 220 | return { v.begin(), v.end() }; |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 221 | } |
| 222 | |
Grigori Goronzy | d15b32e | 2015-05-28 13:01:51 +0200 | [diff] [blame] | 223 | cl_uint |
| 224 | device::subgroup_size() const { |
Bas Nieuwenhuizen | 1a5c8c2 | 2016-03-25 02:06:50 +0100 | [diff] [blame] | 225 | return get_compute_param<uint32_t>(pipe, ir_format(), |
| 226 | PIPE_COMPUTE_CAP_SUBGROUP_SIZE)[0]; |
Grigori Goronzy | d15b32e | 2015-05-28 13:01:51 +0200 | [diff] [blame] | 227 | } |
| 228 | |
Jan Vesely | 083746b | 2016-08-28 04:08:15 -0400 | [diff] [blame] | 229 | cl_uint |
| 230 | device::address_bits() const { |
| 231 | return get_compute_param<uint32_t>(pipe, ir_format(), |
| 232 | PIPE_COMPUTE_CAP_ADDRESS_BITS)[0]; |
| 233 | } |
| 234 | |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 235 | std::string |
Francisco Jerez | c9e009b | 2013-09-15 20:06:57 -0700 | [diff] [blame] | 236 | device::device_name() const { |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 237 | return pipe->get_name(pipe); |
| 238 | } |
| 239 | |
| 240 | std::string |
Francisco Jerez | c9e009b | 2013-09-15 20:06:57 -0700 | [diff] [blame] | 241 | device::vendor_name() const { |
Giuseppe Bilotta | 7932b30 | 2015-03-22 07:21:02 +0100 | [diff] [blame] | 242 | return pipe->get_device_vendor(pipe); |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 243 | } |
| 244 | |
Tom Stellard | 613323b | 2012-04-23 12:09:08 -0400 | [diff] [blame] | 245 | enum pipe_shader_ir |
Francisco Jerez | c9e009b | 2013-09-15 20:06:57 -0700 | [diff] [blame] | 246 | device::ir_format() const { |
Pierre Moreau | 67769c9 | 2018-02-10 16:56:11 +0100 | [diff] [blame] | 247 | return PIPE_SHADER_IR_NATIVE; |
Tom Stellard | 613323b | 2012-04-23 12:09:08 -0400 | [diff] [blame] | 248 | } |
| 249 | |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 250 | std::string |
Francisco Jerez | c9e009b | 2013-09-15 20:06:57 -0700 | [diff] [blame] | 251 | device::ir_target() const { |
| 252 | std::vector<char> target = get_compute_param<char>( |
Bas Nieuwenhuizen | 1a5c8c2 | 2016-03-25 02:06:50 +0100 | [diff] [blame] | 253 | pipe, ir_format(), PIPE_COMPUTE_CAP_IR_TARGET); |
Tom Stellard | 613323b | 2012-04-23 12:09:08 -0400 | [diff] [blame] | 254 | return { target.data() }; |
Francisco Jerez | c6db1b3 | 2012-04-20 16:56:19 +0200 | [diff] [blame] | 255 | } |
Tom Stellard | 8c9d3c6 | 2013-07-09 21:21:40 -0700 | [diff] [blame] | 256 | |
| 257 | enum pipe_endian |
Francisco Jerez | c9e009b | 2013-09-15 20:06:57 -0700 | [diff] [blame] | 258 | device::endianness() const { |
Tom Stellard | 8c9d3c6 | 2013-07-09 21:21:40 -0700 | [diff] [blame] | 259 | return (enum pipe_endian)pipe->get_param(pipe, PIPE_CAP_ENDIANNESS); |
| 260 | } |
Aaron Watry | 293b3e0 | 2017-07-21 21:17:50 -0500 | [diff] [blame] | 261 | |
| 262 | std::string |
| 263 | device::device_version() const { |
Aaron Watry | 95ae6c0 | 2017-08-09 22:02:30 -0500 | [diff] [blame] | 264 | static const std::string device_version = |
| 265 | debug_get_option("CLOVER_DEVICE_VERSION_OVERRIDE", "1.1"); |
| 266 | return device_version; |
Aaron Watry | 293b3e0 | 2017-07-21 21:17:50 -0500 | [diff] [blame] | 267 | } |
| 268 | |
| 269 | std::string |
| 270 | device::device_clc_version() const { |
Aaron Watry | 95ae6c0 | 2017-08-09 22:02:30 -0500 | [diff] [blame] | 271 | static const std::string device_clc_version = |
| 272 | debug_get_option("CLOVER_DEVICE_CLC_VERSION_OVERRIDE", "1.1"); |
| 273 | return device_clc_version; |
Aaron Watry | 293b3e0 | 2017-07-21 21:17:50 -0500 | [diff] [blame] | 274 | } |
Pierre Moreau | 505ec3a | 2017-10-03 21:07:45 +0200 | [diff] [blame] | 275 | |
| 276 | bool |
| 277 | device::supports_ir(enum pipe_shader_ir ir) const { |
| 278 | return pipe->get_shader_param(pipe, PIPE_SHADER_COMPUTE, |
| 279 | PIPE_SHADER_CAP_SUPPORTED_IRS) & (1 << ir); |
| 280 | } |
Pierre Moreau | b033620 | 2018-01-21 18:49:00 +0100 | [diff] [blame^] | 281 | |
| 282 | std::string |
| 283 | device::supported_extensions() const { |
| 284 | return |
| 285 | "cl_khr_byte_addressable_store" |
| 286 | " cl_khr_global_int32_base_atomics" |
| 287 | " cl_khr_global_int32_extended_atomics" |
| 288 | " cl_khr_local_int32_base_atomics" |
| 289 | " cl_khr_local_int32_extended_atomics" |
| 290 | + std::string(has_int64_atomics() ? " cl_khr_int64_base_atomics" : "") |
| 291 | + std::string(has_int64_atomics() ? " cl_khr_int64_extended_atomics" : "") |
| 292 | + std::string(has_doubles() ? " cl_khr_fp64" : "") |
| 293 | + std::string(has_halves() ? " cl_khr_fp16" : ""); |
| 294 | } |