diff --git a/test_common/harness/kernelHelpers.cpp b/test_common/harness/kernelHelpers.cpp index 49a448c512..ef8a0ab72a 100644 --- a/test_common/harness/kernelHelpers.cpp +++ b/test_common/harness/kernelHelpers.cpp @@ -1745,7 +1745,7 @@ Version get_device_cl_c_version(cl_device_id device) auto major = opencl_c_version[opencl_c_version.find('.') - 1]; auto minor = opencl_c_version[opencl_c_version.find('.') + 1]; - return Version{ (uint)(major - '0'), (uint)(minor - '0') }; + return Version{ (cl_uint)(major - '0'), (cl_uint)(minor - '0') }; } Version get_device_latest_cl_c_version(cl_device_id device) diff --git a/test_common/harness/rounding_mode.cpp b/test_common/harness/rounding_mode.cpp index fd31146713..bb7539dd19 100644 --- a/test_common/harness/rounding_mode.cpp +++ b/test_common/harness/rounding_mode.cpp @@ -203,7 +203,7 @@ void *FlushToZero(void) #if defined(__APPLE__) || defined(__linux__) || defined(_WIN32) #if defined(__i386__) || defined(__x86_64__) || defined(_MSC_VER) union { - uint i; + unsigned int i; void *p; } u = { _mm_getcsr() }; _mm_setcsr(u.i | 0x8040); @@ -235,7 +235,7 @@ void UnFlushToZero(void *p) #if defined(__i386__) || defined(__x86_64__) || defined(_MSC_VER) union { void *p; - uint i; + unsigned int i; } u = { p }; _mm_setcsr(u.i); #elif defined(__arm__) || defined(__aarch64__) diff --git a/test_common/harness/testHarness.h b/test_common/harness/testHarness.h index 15dfdf52b8..326789de7f 100644 --- a/test_common/harness/testHarness.h +++ b/test_common/harness/testHarness.h @@ -26,22 +26,28 @@ class Version { public: Version(): m_major(0), m_minor(0) {} - Version(uint major, uint 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; @@ -50,8 +56,8 @@ class Version { } private: - uint m_major; - uint m_minor; + cl_uint m_major; + cl_uint m_minor; }; Version get_device_cl_version(cl_device_id device); diff --git a/test_conformance/basic/test_preprocessors.cpp b/test_conformance/basic/test_preprocessors.cpp index 2038d15076..6fa38dc96d 100644 --- a/test_conformance/basic/test_preprocessors.cpp +++ b/test_conformance/basic/test_preprocessors.cpp @@ -217,7 +217,7 @@ int test_kernel_preprocessor_macros(cl_device_id deviceID, cl_context context, c // The OpenCL version reported by the macro reports the feature level supported by the compiler. Since // this doesn't directly match any property we can query, we just check to see if it's a sane value auto device_cl_version = get_device_cl_version(deviceID); - int device_cl_version_int = device_cl_version.to_int() * 10; + int device_cl_version_int = device_cl_version.to_uint() * 10; if ((results[2] < 100) || (results[2] > device_cl_version_int)) { log_error("ERROR: Kernel preprocessor __OPENCL_VERSION__ does not make " @@ -241,14 +241,16 @@ int test_kernel_preprocessor_macros(cl_device_id deviceID, cl_context context, c int cl_c_minor_version = (results[3] / 10) % 10; if ((results[3] < 100) || (!device_supports_cl_c_version( - deviceID, Version{ cl_c_major_version, cl_c_minor_version }))) + deviceID, + Version{ (cl_uint)cl_c_major_version, + (cl_uint)cl_c_minor_version }))) { auto device_version = get_device_cl_c_version(deviceID); log_error( "ERROR: Kernel preprocessor __OPENCL_C_VERSION__ does not make " "sense w.r.t. device's version string! " "(preprocessor states %d, CL_DEVICE_OPENCL_C_VERSION is %d (%s))\n", - results[3], device_version.to_int() * 10, + results[3], device_version.to_uint() * 10, device_version.to_string().c_str()); log_error("This means that CL_DEVICE_OPENCL_C_VERSION < " "__OPENCL_C_VERSION__");