clover: rename platform/device apis using strings

Just add as_string to these to faciliate the non-string ones.

(extracted by airlied from pmoreau patch).

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7520>
This commit is contained in:
Pierre Moreau
2020-11-10 09:44:14 +10:00
committed by Dave Airlie
parent 20a3ec2d77
commit 7507ce1db4
8 changed files with 18 additions and 18 deletions
+3 -3
View File
@@ -321,11 +321,11 @@ clGetDeviceInfo(cl_device_id d_dev, cl_device_info param,
break;
case CL_DEVICE_VERSION:
buf.as_string() = "OpenCL " + dev.device_version() + " Mesa " PACKAGE_VERSION MESA_GIT_SHA1;
buf.as_string() = "OpenCL " + dev.device_version_as_string() + " Mesa " PACKAGE_VERSION MESA_GIT_SHA1;
break;
case CL_DEVICE_EXTENSIONS:
buf.as_string() = dev.supported_extensions();
buf.as_string() = dev.supported_extensions_as_string();
break;
case CL_DEVICE_PLATFORM:
@@ -365,7 +365,7 @@ clGetDeviceInfo(cl_device_id d_dev, cl_device_info param,
break;
case CL_DEVICE_OPENCL_C_VERSION:
buf.as_string() = "OpenCL C " + dev.device_clc_version() + " ";
buf.as_string() = "OpenCL C " + dev.device_clc_version_as_string() + " ";
break;
case CL_DEVICE_PRINTF_BUFFER_SIZE:
@@ -77,7 +77,7 @@ clover::GetPlatformInfo(cl_platform_id d_platform, cl_platform_info param,
break;
case CL_PLATFORM_EXTENSIONS:
buf.as_string() = platform.supported_extensions();
buf.as_string() = platform.supported_extensions_as_string();
break;
case CL_PLATFORM_ICD_SUFFIX_KHR:
+3 -3
View File
@@ -312,14 +312,14 @@ device::endianness() const {
}
std::string
device::device_version() const {
device::device_version_as_string() const {
static const std::string device_version =
debug_get_option("CLOVER_DEVICE_VERSION_OVERRIDE", "1.1");
return device_version;
}
std::string
device::device_clc_version() const {
device::device_clc_version_as_string() const {
static const std::string device_clc_version =
debug_get_option("CLOVER_DEVICE_CLC_VERSION_OVERRIDE", "1.1");
return device_clc_version;
@@ -332,7 +332,7 @@ device::supports_ir(enum pipe_shader_ir ir) const {
}
std::string
device::supported_extensions() const {
device::supported_extensions_as_string() const {
return
"cl_khr_byte_addressable_store"
" cl_khr_global_int32_base_atomics"
+3 -3
View File
@@ -84,13 +84,13 @@ namespace clover {
cl_uint address_bits() const;
std::string device_name() const;
std::string vendor_name() const;
std::string device_version() const;
std::string device_clc_version() const;
std::string device_version_as_string() const;
std::string device_clc_version_as_string() const;
enum pipe_shader_ir ir_format() const;
std::string ir_target() const;
enum pipe_endian endianness() const;
bool supports_ir(enum pipe_shader_ir ir) const;
std::string supported_extensions() const;
std::string supported_extensions_as_string() const;
friend class command_queue;
friend class root_resource;
@@ -41,6 +41,6 @@ platform::platform() : adaptor_range(evals(), devs) {
}
std::string
platform::supported_extensions() const {
platform::supported_extensions_as_string() const {
return "cl_khr_icd";
}
@@ -40,7 +40,7 @@ namespace clover {
platform &
operator=(const platform &platform) = delete;
std::string supported_extensions() const;
std::string supported_extensions_as_string() const;
protected:
std::vector<intrusive_ref<device>> devs;
@@ -209,7 +209,7 @@ namespace {
map(std::mem_fn(&std::string::c_str), opts);
const target &target = ir_target;
const std::string &device_clc_version = dev.device_clc_version();
const std::string &device_clc_version = dev.device_clc_version_as_string();
if (!compat::create_compiler_invocation_from_args(
c->getInvocation(), copts, diag))
@@ -274,7 +274,7 @@ namespace {
// Add definition for the OpenCL version
c.getPreprocessorOpts().addMacroDef("__OPENCL_VERSION__=" +
std::to_string(get_cl_version(
dev.device_version()).version_number));
dev.device_version_as_string()).version_number));
// clc.h requires that this macro be defined:
c.getPreprocessorOpts().addMacroDef("cl_clang_storage_class_specifiers");
@@ -488,7 +488,7 @@ clover::llvm::compile_to_spirv(const std::string &source,
}
if (has_flag(debug::spirv))
debug::log(".spvasm", spirv::print_module(binary, dev.device_version()));
debug::log(".spvasm", spirv::print_module(binary, dev.device_version_as_string()));
return spirv::compile_program(binary, dev, r_log);
}
@@ -681,7 +681,7 @@ clover::spirv::compile_program(const std::vector<char> &binary,
bool validate) {
std::vector<char> source = spirv_to_cpu(binary);
if (validate && !is_valid_spirv(source, dev.device_version(), r_log))
if (validate && !is_valid_spirv(source, dev.device_version_as_string(), r_log))
throw build_error();
if (!check_capabilities(dev, source, r_log))
@@ -751,7 +751,7 @@ clover::spirv::link_program(const std::vector<module> &modules,
std::vector<uint32_t> linked_binary;
const std::string opencl_version = dev.device_version();
const std::string opencl_version = dev.device_version_as_string();
const spv_target_env target_env =
convert_opencl_str_to_target_env(opencl_version);
@@ -771,7 +771,7 @@ clover::spirv::link_program(const std::vector<module> &modules,
throw error(CL_LINK_PROGRAM_FAILURE);
if (has_flag(llvm::debug::spirv))
llvm::debug::log(".spvasm", spirv::print_module(final_binary, dev.device_version()));
llvm::debug::log(".spvasm", spirv::print_module(final_binary, dev.device_version_as_string()));
for (const auto &mod : modules)
m.syms.insert(m.syms.end(), mod.syms.begin(), mod.syms.end());