diff options
author | Anthony Barbier <anthony.barbier@arm.com> | 2018-02-28 18:18:24 +0000 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:48:33 +0000 |
commit | 30a6342241e4a0d70c3b05f8149ccc40014a8d1d (patch) | |
tree | 4e7e0bb56ee9261ccd3b546d1626e7bf069894c1 /src/core/CL/CLHelpers.cpp | |
parent | f5dcf79ba060cc042ed77c73c1a907780c5fe863 (diff) | |
download | ComputeLibrary-30a6342241e4a0d70c3b05f8149ccc40014a8d1d.tar.gz |
COMPMID-959 Simplify calls to clGetDeviceInfo
Change-Id: I23fac4230cdc024d669ce01b2763b8a9cf6d6691
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/122714
Tested-by: Jenkins <bsgcomp@arm.com>
Reviewed-by: Pablo Tello <pablo.tello@arm.com>
Diffstat (limited to 'src/core/CL/CLHelpers.cpp')
-rw-r--r-- | src/core/CL/CLHelpers.cpp | 32 |
1 files changed, 3 insertions, 29 deletions
diff --git a/src/core/CL/CLHelpers.cpp b/src/core/CL/CLHelpers.cpp index 54e3e525b4..ef517aa589 100644 --- a/src/core/CL/CLHelpers.cpp +++ b/src/core/CL/CLHelpers.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017 ARM Limited. + * Copyright (c) 2016-2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -167,22 +167,9 @@ const std::string &string_from_target(GPUTarget target) GPUTarget get_target_from_device(cl::Device &device) { - size_t name_size = 0; - // Query device name size - cl_int err = clGetDeviceInfo(device.get(), CL_DEVICE_NAME, 0, nullptr, &name_size); - ARM_COMPUTE_ERROR_ON_MSG((err != 0) || (name_size == 0), "clGetDeviceInfo failed to return valid information"); - ARM_COMPUTE_UNUSED(err); - - std::vector<char> name_buffer(name_size); - - // Query device name - err = clGetDeviceInfo(device.get(), CL_DEVICE_NAME, name_size, name_buffer.data(), nullptr); - ARM_COMPUTE_ERROR_ON_MSG(err != 0, "clGetDeviceInfo failed to return valid information"); - ARM_COMPUTE_UNUSED(err); - + std::string device_name = device.getInfo<CL_DEVICE_NAME>(); std::regex mali_regex(R"(Mali-([TG])(\d+))"); - std::string device_name(name_buffer.begin(), name_buffer.end()); std::smatch name_parts; const bool found_mali = std::regex_search(device_name, name_parts, mali_regex); @@ -224,20 +211,7 @@ bool fp16_support(const cl::Device &device) CLVersion get_cl_version(const cl::Device &device) { - std::vector<char> version; - size_t version_size = 0; - cl_int err = clGetDeviceInfo(device.get(), CL_DEVICE_VERSION, 0, nullptr, &version_size); - ARM_COMPUTE_ERROR_ON_MSG((err != 0) || (version_size == 0), "clGetDeviceInfo failed to return valid information"); - ARM_COMPUTE_UNUSED(err); - - // Resize vector - version.resize(version_size); - // Query version - err = clGetDeviceInfo(device.get(), CL_DEVICE_VERSION, version_size, version.data(), nullptr); - ARM_COMPUTE_ERROR_ON_MSG(err != 0, "clGetDeviceInfo failed to return valid information"); - ARM_COMPUTE_UNUSED(err); - - std::string version_str(version.begin(), version.end()); + std::string version_str = device.getInfo<CL_DEVICE_VERSION>(); if(version_str.find("OpenCL 2") != std::string::npos) { return CLVersion::CL20; |