Skip to content

Commit 59fcadf

Browse files
committed
Fix printf format specifier mismatches
1 parent 5c9cd91 commit 59fcadf

17 files changed

Lines changed: 42 additions & 37 deletions

File tree

backends/cadence/cadence_executor_runner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ int main(int argc, char** argv) {
110110
ET_LOG(Error, "Program::load failed: 0x%" PRIx32, program.error());
111111
return 1;
112112
}
113-
ET_LOG(Info, "Model buffer loaded, has %u methods", program->num_methods());
113+
ET_LOG(Info, "Model buffer loaded, has %zu methods", program->num_methods());
114114

115115
const char* method_name = nullptr;
116116
{

backends/nxp/runtime/NeutronBackend.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
* Implementation of the backend for the NXP Neutron NPU.
88
*/
99

10+
#include <cinttypes>
11+
1012
#include <executorch/runtime/backend/interface.h>
1113
#include <executorch/runtime/core/error.h>
1214
#include <executorch/runtime/core/evalue.h>
@@ -382,15 +384,18 @@ class NeutronBackend final : public PyTorchBackendInterface {
382384
if (neutronRC != ENONE) {
383385
ET_LOG(
384386
Error,
385-
"Neutron model preparation failed with error code %ld",
387+
"Neutron model preparation failed with error code %" PRId32,
386388
neutronRC);
387389
return Error::InvalidProgram;
388390
}
389391

390392
#ifdef EXTERNAL_MEM
391393
neutronRC = neutronSetConfig(&neutronMemCopyConfig);
392394
if (neutronRC != ENONE) {
393-
ET_LOG(Error, "Neutron set config failed with error code %ld", neutronRC);
395+
ET_LOG(
396+
Error,
397+
"Neutron set config failed with error code %" PRId32,
398+
neutronRC);
394399
return Error::InvalidProgram;
395400
}
396401
#endif
@@ -533,7 +538,7 @@ class NeutronBackend final : public PyTorchBackendInterface {
533538
if (neutronRC != ENONE) {
534539
ET_LOG(
535540
Error,
536-
"Neutron model evaluation failed with error code %ld",
541+
"Neutron model evaluation failed with error code %" PRId32,
537542
neutronRC);
538543
return Error::InvalidProgram;
539544
}

backends/samsung/runtime/enn_backend.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class EnnBackend final : public PyTorchBackendInterface {
6363
ET_CHECK_OR_RETURN_ERROR(
6464
args[index]->isTensor(),
6565
InvalidArgument,
66-
"Expected argument to delegate at index %u to be a Tensor, but got %" PRIu32,
66+
"Expected argument to delegate at index %d to be a Tensor, but got %" PRIu32,
6767
index,
6868
static_cast<uint32_t>(args[index]->tag));
6969
Tensor* tensor = &args[index]->toTensor();

backends/samsung/runtime/enn_executor.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Error EnnExecutor::initialize(const char* binary_buf_addr, size_t buf_size) {
2626
ET_CHECK_OR_RETURN_ERROR(
2727
ret == ENN_RET_SUCCESS, Internal, "Enn initialize failed.");
2828

29-
ET_LOG(Info, "Start to open model %p, %ld", binary_buf_addr, buf_size);
29+
ET_LOG(Info, "Start to open model %p, %zu", binary_buf_addr, buf_size);
3030
ret = enn_api_inst->EnnOpenModelFromMemory(
3131
binary_buf_addr, buf_size, &model_id_);
3232

@@ -58,13 +58,13 @@ Error EnnExecutor::eval(
5858
ET_CHECK_OR_RETURN_ERROR(
5959
inputs.size() == getInputSize(),
6060
InvalidArgument,
61-
"Invalid number of inputs, expect %" PRIu32 " while get %ld",
61+
"Invalid number of inputs, expect %" PRId32 " while get %zu",
6262
getInputSize(),
6363
inputs.size());
6464
ET_CHECK_OR_RETURN_ERROR(
6565
outputs.size() == getOutputSize(),
6666
InvalidArgument,
67-
"Invalid number of outputs, expected %" PRIu32 " while get %ld",
67+
"Invalid number of outputs, expected %" PRId32 " while get %zu",
6868
getOutputSize(),
6969
outputs.size());
7070

examples/arm/executor_runner/arm_perf_monitor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ void StopMeasurements(int num_inferences) {
209209
ET_LOG(Info, "Ethos-U PMU report:");
210210
ET_LOG(
211211
Info,
212-
"ethosu_pmu_cycle_cntr : % " PRIu64 " (%.2f per inference)",
212+
"ethosu_pmu_cycle_cntr : %" PRIu64 " (%.2f per inference)",
213213
ethosu_pmuCycleCount,
214214
(double)ethosu_pmuCycleCount / num_inferences);
215215

examples/portable/executor_runner/executor_runner.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ int main(int argc, char** argv) {
376376

377377
ET_CHECK_MSG(
378378
status == Error::Ok,
379-
"get_program_data() from bundle PTE failed: 0x%x" PRIx32,
379+
"get_program_data() from bundle PTE failed: 0x%" PRIx32,
380380
static_cast<uint32_t>(status));
381381
} else {
382382
ET_LOG(Debug, "PTE Model has no bundled IO");
@@ -888,8 +888,7 @@ int main(int argc, char** argv) {
888888
} else {
889889
ET_LOG(
890890
Info,
891-
"=== Error calculating stats for testset %zu ERROR: 0x%x" PRIx32
892-
"===",
891+
"=== Error calculating stats for testset %zu ERROR: 0x%" PRIx32 "===",
893892
testset_idx,
894893
static_cast<uint32_t>(stats.status));
895894
}

extension/android/jni/jni_layer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <executorch/runtime/platform/runtime.h>
2121
#include <cassert>
2222
#include <chrono>
23+
#include <cinttypes>
2324
#include <iostream>
2425
#include <memory>
2526
#include <sstream>
@@ -417,7 +418,7 @@ class ExecuTorchJni : public facebook::jni::HybridClass<ExecuTorchJni> {
417418
auto duration =
418419
std::chrono::duration_cast<std::chrono::milliseconds>(end - start)
419420
.count();
420-
ET_LOG(Debug, "Execution time: %lld ms.", duration);
421+
ET_LOG(Debug, "Execution time: %" PRId64 " ms.", duration);
421422

422423
#else
423424
auto result = module_->execute(method, evalues);

extension/data_loader/mmap_data_loader.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Result<MmapDataLoader> MmapDataLoader::from(
7979
return Error::AccessFailed;
8080
}
8181
if ((page_size & ~(page_size - 1)) != page_size) {
82-
ET_LOG(Error, "Page size 0x%ld is not a power of 2", page_size);
82+
ET_LOG(Error, "Page size 0x%lx is not a power of 2", page_size);
8383
return Error::InvalidState;
8484
}
8585

@@ -211,7 +211,7 @@ Result<FreeableBuffer> MmapDataLoader::load(
211211
ET_CHECK_OR_RETURN_ERROR(
212212
pages != MAP_FAILED,
213213
AccessFailed,
214-
"Failed to map %s: mmap(..., size=%zd, ..., fd=%d, offset=0x%zx)",
214+
"Failed to map %s: mmap(..., size=%zu, ..., fd=%d, offset=0x%zx)",
215215
file_name_,
216216
range.size,
217217
fd_,
@@ -224,7 +224,7 @@ Result<FreeableBuffer> MmapDataLoader::load(
224224
if (mlock_config_ == MlockConfig::UseMlockIgnoreErrors) {
225225
ET_LOG(
226226
Debug,
227-
"Ignoring mlock error for file %s (off=0x%zd): "
227+
"Ignoring mlock error for file %s (off=0x%zx): "
228228
"mlock(%p, %zu) failed: %s (%d)",
229229
file_name_,
230230
offset,
@@ -235,7 +235,7 @@ Result<FreeableBuffer> MmapDataLoader::load(
235235
} else {
236236
ET_LOG(
237237
Error,
238-
"File %s (off=0x%zd): mlock(%p, %zu) failed: %s (%d)",
238+
"File %s (off=0x%zx): mlock(%p, %zu) failed: %s (%d)",
239239
file_name_,
240240
offset,
241241
pages,
@@ -321,7 +321,7 @@ Error MmapDataLoader::load_into(
321321
ET_CHECK_OR_RETURN_ERROR(
322322
pages != MAP_FAILED,
323323
AccessFailed,
324-
"Failed to map %s: mmap(..., size=%zd, ..., fd=%d, offset=0x%zx)",
324+
"Failed to map %s: mmap(..., size=%zu, ..., fd=%d, offset=0x%zx)",
325325
file_name_,
326326
range.size,
327327
fd_,

extension/flat_tensor/flat_tensor_data_map.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Result<const flat_tensor_flatbuffer::NamedData*> get_named_data(
7171
ET_CHECK_OR_RETURN_ERROR(
7272
segment_index >= 0 && segment_index < segments->size(),
7373
InvalidExternalData,
74-
"Segment index %zu for key %.*s is out of bounds for segment size %d. Malformed PTD file.",
74+
"Segment index %zu for key %.*s is out of bounds for segment size %u. Malformed PTD file.",
7575
segment_index,
7676
static_cast<int>(key.size()),
7777
key.data(),

extension/llm/runner/stats.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ inline void print_report(const Stats& stats) {
156156

157157
ET_LOG(
158158
Info,
159-
"\tPrompt Tokens: %" PRIu64 " Generated Tokens: %" PRIu64,
159+
"\tPrompt Tokens: %" PRId64 " Generated Tokens: %" PRId64,
160160
stats.num_prompt_tokens,
161161
stats.num_generated_tokens);
162162

@@ -188,7 +188,7 @@ inline void print_report(const Stats& stats) {
188188
(double)(stats.inference_end_ms - stats.prompt_eval_end_ms);
189189
ET_LOG(
190190
Info,
191-
"\t\tGenerated %" PRIu64
191+
"\t\tGenerated %" PRId64
192192
" tokens:\t%f (seconds)\t\t Rate: \t%f (tokens/second)",
193193
stats.num_generated_tokens,
194194
eval_time / stats.SCALING_FACTOR_UNITS_PER_SECOND,
@@ -206,7 +206,7 @@ inline void print_report(const Stats& stats) {
206206

207207
ET_LOG(
208208
Info,
209-
"\tSampling time over %" PRIu64 " tokens:\t%f (seconds)",
209+
"\tSampling time over %" PRId64 " tokens:\t%f (seconds)",
210210
stats.num_prompt_tokens + stats.num_generated_tokens,
211211
(double)stats.aggregate_sampling_time_ms /
212212
stats.SCALING_FACTOR_UNITS_PER_SECOND);

0 commit comments

Comments
 (0)