mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Re-enabling narrowing errors (#1144)
Fixes narrowing conversion build errors in test_common Removing disable of narrowing errors in main CMakeLists.txt and moving it down to specific test_conformance suite's CMakeLists.txt where there are many more build errors revealed from this fix. Fixes a few simple issues under test_conformance in the process. Contributes #787 Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com> --------- Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
This commit is contained in:
@@ -1624,7 +1624,7 @@ Version get_device_cl_c_version(cl_device_id device)
|
||||
&opencl_c_version_size_in_bytes);
|
||||
test_error_ret(error,
|
||||
"clGetDeviceInfo failed for CL_DEVICE_OPENCL_C_VERSION\n",
|
||||
(Version{ -1, 0 }));
|
||||
(Version{ 0, 0 }));
|
||||
|
||||
std::string opencl_c_version(opencl_c_version_size_in_bytes, '\0');
|
||||
error =
|
||||
@@ -1633,13 +1633,13 @@ Version get_device_cl_c_version(cl_device_id device)
|
||||
|
||||
test_error_ret(error,
|
||||
"clGetDeviceInfo failed for CL_DEVICE_OPENCL_C_VERSION\n",
|
||||
(Version{ -1, 0 }));
|
||||
(Version{ 0, 0 }));
|
||||
|
||||
// Scrape out the major, minor pair from the string.
|
||||
auto major = opencl_c_version[opencl_c_version.find('.') - 1];
|
||||
auto minor = opencl_c_version[opencl_c_version.find('.') + 1];
|
||||
|
||||
return Version{ major - '0', minor - '0' };
|
||||
return Version{ (cl_uint)(major - '0'), (cl_uint)(minor - '0') };
|
||||
}
|
||||
|
||||
Version get_device_latest_cl_c_version(cl_device_id device)
|
||||
@@ -1657,7 +1657,7 @@ Version get_device_latest_cl_c_version(cl_device_id device)
|
||||
&opencl_c_all_versions_size_in_bytes);
|
||||
test_error_ret(
|
||||
error, "clGetDeviceInfo failed for CL_DEVICE_OPENCL_C_ALL_VERSIONS",
|
||||
(Version{ -1, 0 }));
|
||||
(Version{ 0, 0 }));
|
||||
std::vector<cl_name_version> name_versions(
|
||||
opencl_c_all_versions_size_in_bytes / sizeof(cl_name_version));
|
||||
error = clGetDeviceInfo(device, CL_DEVICE_OPENCL_C_ALL_VERSIONS,
|
||||
@@ -1665,14 +1665,14 @@ Version get_device_latest_cl_c_version(cl_device_id device)
|
||||
name_versions.data(), nullptr);
|
||||
test_error_ret(
|
||||
error, "clGetDeviceInfo failed for CL_DEVICE_OPENCL_C_ALL_VERSIONS",
|
||||
(Version{ -1, 0 }));
|
||||
(Version{ 0, 0 }));
|
||||
|
||||
Version max_supported_cl_c_version{};
|
||||
for (const auto &name_version : name_versions)
|
||||
{
|
||||
Version current_version{
|
||||
static_cast<int>(CL_VERSION_MAJOR(name_version.version)),
|
||||
static_cast<int>(CL_VERSION_MINOR(name_version.version))
|
||||
static_cast<cl_uint>(CL_VERSION_MAJOR(name_version.version)),
|
||||
static_cast<cl_uint>(CL_VERSION_MINOR(name_version.version))
|
||||
};
|
||||
max_supported_cl_c_version =
|
||||
(current_version > max_supported_cl_c_version)
|
||||
@@ -1693,7 +1693,7 @@ Version get_max_OpenCL_C_for_context(cl_context context)
|
||||
auto error = clGetContextInfo(context, CL_CONTEXT_DEVICES, 0, nullptr,
|
||||
&devices_size_in_bytes);
|
||||
test_error_ret(error, "clGetDeviceInfo failed for CL_CONTEXT_DEVICES",
|
||||
(Version{ -1, 0 }));
|
||||
(Version{ 0, 0 }));
|
||||
std::vector<cl_device_id> devices(devices_size_in_bytes
|
||||
/ sizeof(cl_device_id));
|
||||
error = clGetContextInfo(context, CL_CONTEXT_DEVICES, devices_size_in_bytes,
|
||||
@@ -1757,8 +1757,8 @@ bool device_supports_cl_c_version(cl_device_id device, Version version)
|
||||
for (const auto &name_version : name_versions)
|
||||
{
|
||||
Version current_version{
|
||||
static_cast<int>(CL_VERSION_MAJOR(name_version.version)),
|
||||
static_cast<int>(CL_VERSION_MINOR(name_version.version))
|
||||
static_cast<cl_uint>(CL_VERSION_MAJOR(name_version.version)),
|
||||
static_cast<cl_uint>(CL_VERSION_MINOR(name_version.version))
|
||||
};
|
||||
if (current_version == version)
|
||||
{
|
||||
|
||||
@@ -240,7 +240,7 @@ void UnFlushToZero(void *p)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(_MSC_VER)
|
||||
union {
|
||||
void *p;
|
||||
int i;
|
||||
unsigned int i;
|
||||
} u = { p };
|
||||
_mm_setcsr(u.i);
|
||||
#elif defined(__arm__) || defined(__aarch64__)
|
||||
|
||||
@@ -25,22 +25,28 @@
|
||||
class Version {
|
||||
public:
|
||||
Version(): m_major(0), m_minor(0) {}
|
||||
Version(int major, int minor): m_major(major), m_minor(minor) {}
|
||||
bool operator>(const Version &rhs) const { return to_int() > rhs.to_int(); }
|
||||
bool operator<(const Version &rhs) const { return to_int() < rhs.to_int(); }
|
||||
Version(cl_uint major, cl_uint minor): m_major(major), m_minor(minor) {}
|
||||
bool operator>(const Version &rhs) const
|
||||
{
|
||||
return to_uint() > rhs.to_uint();
|
||||
}
|
||||
bool operator<(const Version &rhs) const
|
||||
{
|
||||
return to_uint() < rhs.to_uint();
|
||||
}
|
||||
bool operator<=(const Version &rhs) const
|
||||
{
|
||||
return to_int() <= rhs.to_int();
|
||||
return to_uint() <= rhs.to_uint();
|
||||
}
|
||||
bool operator>=(const Version &rhs) const
|
||||
{
|
||||
return to_int() >= rhs.to_int();
|
||||
return to_uint() >= rhs.to_uint();
|
||||
}
|
||||
bool operator==(const Version &rhs) const
|
||||
{
|
||||
return to_int() == rhs.to_int();
|
||||
return to_uint() == rhs.to_uint();
|
||||
}
|
||||
int to_int() const { return m_major * 10 + m_minor; }
|
||||
cl_uint to_uint() const { return m_major * 10 + m_minor; }
|
||||
std::string to_string() const
|
||||
{
|
||||
std::stringstream ss;
|
||||
@@ -49,8 +55,8 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
int m_major;
|
||||
int m_minor;
|
||||
cl_uint m_major;
|
||||
cl_uint m_minor;
|
||||
};
|
||||
|
||||
Version get_device_cl_version(cl_device_id device);
|
||||
|
||||
Reference in New Issue
Block a user