Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix more 32-bit Wformat warnings #2185

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "testBase.h"
#include <limits.h>
#include <ctype.h>
#include <cinttypes>
#ifndef _WIN32
#include <unistd.h>
#endif
Expand Down Expand Up @@ -216,7 +217,9 @@ int test_compiler_defines_for_extensions(cl_device_id device, cl_context context
char *extension = (char *)malloc((extension_length + 1) * sizeof(char));
if (extension == NULL)
{
log_error( "Error: unable to allocate memory to hold extension name: %ld chars\n", extension_length );
log_error("Error: unable to allocate memory to hold extension "
"name: %" PRIdPTR " chars\n",
extension_length);
return -1;
}
extensions_supported[num_of_supported_extensions] = extension;
Expand Down
2 changes: 1 addition & 1 deletion test_conformance/computeinfo/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ void dumpConfigInfo(config_info* info)
}
break;
case type_cl_device_id:
log_info("\t%s == %ld\n", info->opcode_name,
log_info("\t%s == %" PRIdPTR "\n", info->opcode_name,
(intptr_t)info->config.device_id);
bashbaug marked this conversation as resolved.
Show resolved Hide resolved
break;
case type_cl_device_affinity_domain:
Expand Down
31 changes: 23 additions & 8 deletions test_conformance/device_timer/test_device_timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// limitations under the License.
//
#include <stdio.h>
#include <cinttypes>
#include <CL/cl.h>
#include "harness/errorHelpers.h"
#include "harness/compat.h"
Expand Down Expand Up @@ -74,13 +75,16 @@ REGISTER_TEST(device_and_host_timers)

if (deviceEndTime <= deviceStartTime) {
log_error("Device timer is not monotonically increasing.\n");
log_error(" deviceStartTime: %lu, deviceEndTime: %lu\n", deviceStartTime, deviceEndTime);
log_error(" deviceStartTime: %" PRIu64 ", deviceEndTime: %" PRIu64
"\n",
deviceStartTime, deviceEndTime);
errors++;
}

if (hostEndTime <= hostStartTime) {
log_error("Error: Host timer is not monotonically increasing.\n");
log_error(" hostStartTime: %lu, hostEndTime: %lu\n", hostStartTime, hostEndTime);
log_error(" hostStartTime: %" PRIu64 ", hostEndTime: %" PRIu64 "\n",
hostStartTime, hostEndTime);
errors++;
}

Expand All @@ -95,29 +99,36 @@ REGISTER_TEST(device_and_host_timers)

if (observedDiff > allowedDiff) {
log_error("Error: Device and host timers did not increase by same amount\n");
log_error(" Observed difference between timers %lu (max allowed %lu).\n", observedDiff, allowedDiff);
log_error(" Observed difference between timers %" PRIu64
" (max allowed %" PRIu64 ").\n",
observedDiff, allowedDiff);
errors++;
}

log_info("Cross-checking results with clGetHostTimer ...\n");

if (hostOnlyEndTime <= hostOnlyStartTime) {
log_error("Error: Host timer is not monotonically increasing.\n");
log_error(" hostStartTime: %lu, hostEndTime: %lu\n", hostOnlyStartTime, hostOnlyEndTime);
log_error(" hostStartTime: %" PRIu64 ", hostEndTime: %" PRIu64 "\n",
hostOnlyStartTime, hostOnlyEndTime);
errors++;
}

if (hostOnlyStartTime < hostStartTime) {
log_error("Error: Host start times do not correlate.\n");
log_error("clGetDeviceAndHostTimer was called before clGetHostTimer but timers are not in that order.\n");
log_error(" clGetDeviceAndHostTimer: %lu, clGetHostTimer: %lu\n", hostStartTime, hostOnlyStartTime);
log_error(" clGetDeviceAndHostTimer: %" PRIu64
", clGetHostTimer: %" PRIu64 "\n",
hostStartTime, hostOnlyStartTime);
errors++;
}

if (hostOnlyEndTime < hostEndTime) {
log_error("Error: Host end times do not correlate.\n");
log_error("clGetDeviceAndHostTimer was called before clGetHostTimer but timers are not in that order.\n");
log_error(" clGetDeviceAndHostTimer: %lu, clGetHostTimer: %lu\n", hostEndTime, hostOnlyEndTime);
log_error(" clGetDeviceAndHostTimer: %" PRIu64
", clGetHostTimer: %" PRIu64 "\n",
hostEndTime, hostOnlyEndTime);
errors++;
}

Expand Down Expand Up @@ -145,7 +156,9 @@ REGISTER_TEST(timer_resolution_queries)
errors++;
}
else {
log_info("CL_DEVICE_PROFILING_TIMER_RESOLUTION == %lu nanoseconds\n", deviceTimerResolution);
log_info("CL_DEVICE_PROFILING_TIMER_RESOLUTION == %" PRIu64
" nanoseconds\n",
deviceTimerResolution);
}

if (platform) {
Expand All @@ -155,7 +168,9 @@ REGISTER_TEST(timer_resolution_queries)
errors++;
}
else {
log_info("CL_PLATFORM_HOST_TIMER_RESOLUTION == %lu nanoseconds\n", hostTimerResolution);
log_info("CL_PLATFORM_HOST_TIMER_RESOLUTION == %" PRIu64
" nanoseconds\n",
hostTimerResolution);
}
}
else {
Expand Down
9 changes: 6 additions & 3 deletions test_conformance/generic_address_space/advanced_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,10 @@ class CAdvancedTest : public CTest {
size_t passCount = std::count(results.begin(), results.end(), 1);
if (passCount != results.size()) {
std::vector<cl_uint>::iterator iter = std::find(results.begin(), results.end(), 0);
log_error("Verification on device failed at index %ld\n", std::distance(results.begin(), iter));
log_error("%ld out of %ld failed\n", (results.size()-passCount), results.size());
log_error("Verification on device failed at index %td\n",
std::distance(results.begin(), iter));
log_error("%zu out of %zu failed\n", (results.size() - passCount),
results.size());
return -1;
}

Expand All @@ -276,7 +278,8 @@ class CAdvancedTest : public CTest {
cl_int result = CL_SUCCESS;

for (std::vector<std::string>::const_iterator it = _kernels.begin(); it != _kernels.end(); ++it) {
log_info("Executing subcase #%ld out of %ld\n", (it - _kernels.begin() + 1), _kernels.size());
log_info("Executing subcase #%zu out of %zu\n",
(it - _kernels.begin() + 1), _kernels.size());

result |= ExecuteSubcase(deviceID, context, queue, num_elements, *it);
}
Expand Down
9 changes: 6 additions & 3 deletions test_conformance/generic_address_space/basic_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@ class CBasicTest : CTest {
size_t passCount = std::count(results.begin(), results.end(), 1);
if (passCount != results.size()) {
std::vector<cl_uint>::iterator iter = std::find(results.begin(), results.end(), 0);
log_error("Verification on device failed at index %ld\n", std::distance(results.begin(), iter));
log_error("%ld out of %ld failed\n", (results.size()-passCount), results.size());
log_error("Verification on device failed at index %td\n",
std::distance(results.begin(), iter));
log_error("%zu out of %zu failed\n", (results.size() - passCount),
results.size());
return -1;
}

Expand All @@ -82,7 +84,8 @@ class CBasicTest : CTest {
cl_int result = CL_SUCCESS;

for (std::vector<std::string>::const_iterator it = _kernels.begin(); it != _kernels.end(); ++it) {
log_info("Executing subcase #%ld out of %ld\n", (it - _kernels.begin() + 1), _kernels.size());
log_info("Executing subcase #%zu out of %zu\n",
(it - _kernels.begin() + 1), _kernels.size());

result |= ExecuteSubcase(deviceID, context, queue, num_elements, *it);
}
Expand Down
9 changes: 6 additions & 3 deletions test_conformance/generic_address_space/stress_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ class CStressTest : public CTest {
size_t passCount = std::count(results.begin(), results.end(), 1);
if (passCount != results.size()) {
std::vector<cl_uint>::iterator iter = std::find(results.begin(), results.end(), 0);
log_error("Verification on device failed at index %ld\n", std::distance(results.begin(), iter));
log_error("%ld out of %ld failed\n", (results.size()-passCount), results.size());
log_error("Verification on device failed at index %td\n",
std::distance(results.begin(), iter));
log_error("%zu out of %zu failed\n", (results.size() - passCount),
results.size());
return -1;
}

Expand All @@ -84,7 +86,8 @@ class CStressTest : public CTest {
cl_int result = CL_SUCCESS;

for (std::vector<std::string>::const_iterator it = _kernels.begin(); it != _kernels.end(); ++it) {
log_info("Executing subcase #%ld out of %ld\n", (it - _kernels.begin() + 1), _kernels.size());
log_info("Executing subcase #%zu out of %zu\n",
(it - _kernels.begin() + 1), _kernels.size());

result |= ExecuteSubcase(deviceID, context, queue, num_elements, *it);
}
Expand Down
Loading