break;
case CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE:
- buf.as_scalar<cl_uint>() = 2;
+ buf.as_scalar<cl_uint>() = dev.has_doubles() ? 2 : 0;
break;
case CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF:
CL_FP_DENORM | CL_FP_INF_NAN | CL_FP_ROUND_TO_NEAREST;
break;
+ case CL_DEVICE_DOUBLE_FP_CONFIG:
+ if (dev.has_doubles())
+ // This is the "mandated minimum double precision floating-point
+ // capability"
+ buf.as_scalar<cl_device_fp_config>() =
+ CL_FP_FMA
+ | CL_FP_ROUND_TO_NEAREST
+ | CL_FP_ROUND_TO_ZERO
+ | CL_FP_ROUND_TO_INF
+ | CL_FP_INF_NAN
+ | CL_FP_DENORM;
+ else
+ buf.as_scalar<cl_device_fp_config>() = 0;
+ break;
+
case CL_DEVICE_GLOBAL_MEM_CACHE_TYPE:
buf.as_scalar<cl_device_mem_cache_type>() = CL_NONE;
break;
break;
case CL_DEVICE_EXTENSIONS:
- buf.as_string() = "";
+ buf.as_string() = dev.has_doubles() ? "cl_khr_fp64" : "";
break;
case CL_DEVICE_PLATFORM:
break;
case CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE:
- buf.as_scalar<cl_uint>() = 2;
+ buf.as_scalar<cl_uint>() = dev.has_doubles() ? 2 : 0;
break;
case CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF:
PIPE_COMPUTE_CAP_IMAGES_SUPPORTED)[0];
}
+bool
+device::has_doubles() const {
+ return pipe->get_shader_param(pipe, PIPE_SHADER_COMPUTE,
+ PIPE_SHADER_CAP_DOUBLES);
+}
+
std::vector<size_t>
device::max_block_size() const {
auto v = get_compute_param<uint64_t>(pipe, PIPE_COMPUTE_CAP_MAX_BLOCK_SIZE);
cl_uint max_clock_frequency() const;
cl_uint max_compute_units() const;
bool image_support() const;
+ bool has_doubles() const;
std::vector<size_t> max_block_size() const;
std::string device_name() const;