Skip to content
Open
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
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,12 @@ endif()
list(APPEND _common_compile_options $<$<CXX_COMPILER_ID:MSVC>:/wd4996>
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wno-deprecated-declarations>
)
# GCC checks no format strings by default; enforce them as errors.
list(
APPEND
_common_compile_options
$<$<CXX_COMPILER_ID:GNU>:-Wformat;-Werror=format>
)
# Set default CMAKE_POSITION_INDEPENDENT_CODE behavior if ON or not set
# (default) (and not for MSVC compiler)
if(NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE
Expand Down
2 changes: 1 addition & 1 deletion backends/apple/metal/runtime/metal_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ class ET_EXPERIMENTAL MetalBackend final
!c10::add_overflows(n_inputs, n_outputs, &n_io_sum) &&
n_io_sum == args.size(),
InvalidArgument,
"number of user input %zd and output %zd generated from AOT Inductor does not match ET runner's %zd. Exit.",
"number of user input %zu and output %zu generated from AOT Inductor does not match ET runner's %zu. Exit.",
n_inputs,
n_outputs,
args.size())
Expand Down
2 changes: 1 addition & 1 deletion backends/cadence/cadence_executor_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ int main(int argc, char** argv) {
ET_LOG(Error, "Program::load failed: 0x%" PRIx32, program.error());
return 1;
}
ET_LOG(Info, "Model buffer loaded, has %u methods", program->num_methods());
ET_LOG(Info, "Model buffer loaded, has %zu methods", program->num_methods());

const char* method_name = nullptr;
{
Expand Down
2 changes: 1 addition & 1 deletion backends/cortex_m/ops/op_transpose.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Tensor& transpose_out(
if (perm.size() != static_cast<int64_t>(rank)) {
ET_LOG(
Error,
"transpose_out: permutation length %zd does not match tensor rank %zu",
"transpose_out: permutation length %zu does not match tensor rank %zu",
perm.size(),
rank);
context.fail(Error::InvalidArgument);
Expand Down
2 changes: 1 addition & 1 deletion backends/cuda/runtime/cuda_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ class ET_EXPERIMENTAL CudaBackend final
!c10::add_overflows(n_inputs, n_outputs, &n_io_sum) &&
n_io_sum == args.size(),
InvalidArgument,
"number of user input %zd and output %zd generated from AOT Inductor does not match ET runner's %zd. Exit.",
"number of user input %zu and output %zu generated from AOT Inductor does not match ET runner's %zu. Exit.",
n_inputs,
n_outputs,
args.size())
Expand Down
11 changes: 8 additions & 3 deletions backends/nxp/runtime/NeutronBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* Implementation of the backend for the NXP Neutron NPU.
*/

#include <cinttypes>

#include <executorch/runtime/backend/interface.h>
#include <executorch/runtime/core/error.h>
#include <executorch/runtime/core/evalue.h>
Expand Down Expand Up @@ -382,15 +384,18 @@ class NeutronBackend final : public PyTorchBackendInterface {
if (neutronRC != ENONE) {
ET_LOG(
Error,
"Neutron model preparation failed with error code %ld",
"Neutron model preparation failed with error code %" PRId32,
neutronRC);
return Error::InvalidProgram;
}

#ifdef EXTERNAL_MEM
neutronRC = neutronSetConfig(&neutronMemCopyConfig);
if (neutronRC != ENONE) {
ET_LOG(Error, "Neutron set config failed with error code %ld", neutronRC);
ET_LOG(
Error,
"Neutron set config failed with error code %" PRId32,
neutronRC);
return Error::InvalidProgram;
}
#endif
Expand Down Expand Up @@ -533,7 +538,7 @@ class NeutronBackend final : public PyTorchBackendInterface {
if (neutronRC != ENONE) {
ET_LOG(
Error,
"Neutron model evaluation failed with error code %ld",
"Neutron model evaluation failed with error code %" PRId32,
neutronRC);
return Error::InvalidProgram;
}
Expand Down
2 changes: 1 addition & 1 deletion backends/samsung/runtime/enn_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class EnnBackend final : public PyTorchBackendInterface {
ET_CHECK_OR_RETURN_ERROR(
args[index]->isTensor(),
InvalidArgument,
"Expected argument to delegate at index %u to be a Tensor, but got %" PRIu32,
"Expected argument to delegate at index %d to be a Tensor, but got %" PRIu32,
index,
static_cast<uint32_t>(args[index]->tag));
Tensor* tensor = &args[index]->toTensor();
Expand Down
6 changes: 3 additions & 3 deletions backends/samsung/runtime/enn_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Error EnnExecutor::initialize(const char* binary_buf_addr, size_t buf_size) {
ET_CHECK_OR_RETURN_ERROR(
ret == ENN_RET_SUCCESS, Internal, "Enn initialize failed.");

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

Expand Down Expand Up @@ -58,13 +58,13 @@ Error EnnExecutor::eval(
ET_CHECK_OR_RETURN_ERROR(
inputs.size() == getInputSize(),
InvalidArgument,
"Invalid number of inputs, expect %" PRIu32 " while get %ld",
"Invalid number of inputs, expect %" PRId32 " while get %zu",
getInputSize(),
inputs.size());
ET_CHECK_OR_RETURN_ERROR(
outputs.size() == getOutputSize(),
InvalidArgument,
"Invalid number of outputs, expected %" PRIu32 " while get %ld",
"Invalid number of outputs, expected %" PRId32 " while get %zu",
getOutputSize(),
outputs.size());

Expand Down
2 changes: 1 addition & 1 deletion examples/arm/executor_runner/arm_perf_monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ void StopMeasurements(int num_inferences) {
ET_LOG(Info, "Ethos-U PMU report:");
ET_LOG(
Info,
"ethosu_pmu_cycle_cntr : % " PRIu64 " (%.2f per inference)",
"ethosu_pmu_cycle_cntr : %" PRIu64 " (%.2f per inference)",
ethosu_pmuCycleCount,
(double)ethosu_pmuCycleCount / num_inferences);

Expand Down
8 changes: 4 additions & 4 deletions examples/portable/executor_runner/executor_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ int main(int argc, char** argv) {

ET_CHECK_MSG(
status == Error::Ok,
"get_program_data() from bundle PTE failed: 0x%x" PRIx32,
"get_program_data() from bundle PTE failed: 0x%" PRIx32,
static_cast<uint32_t>(status));
} else {
ET_LOG(Debug, "PTE Model has no bundled IO");
Expand Down Expand Up @@ -848,7 +848,8 @@ int main(int argc, char** argv) {
i,
j,
tensor.const_data_ptr<int8_t>()[j] ? "true " : "false",
tensor.const_data_ptr<int8_t>()[j]);
static_cast<unsigned int>(
static_cast<uint8_t>(tensor.const_data_ptr<int8_t>()[j])));
}
}
} else {
Expand Down Expand Up @@ -888,8 +889,7 @@ int main(int argc, char** argv) {
} else {
ET_LOG(
Info,
"=== Error calculating stats for testset %zu ERROR: 0x%x" PRIx32
"===",
"=== Error calculating stats for testset %zu ERROR: 0x%" PRIx32 "===",
testset_idx,
static_cast<uint32_t>(stats.status));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Result<Tensor> EncoderRunner::encode(TensorPtr& image_tensor) {
ET_CHECK_MSG(is_method_loaded(), "Encoder method not loaded");

auto tensor_ptr = image_tensor.get();
ET_LOG(Info, "Encoding tensor with numel: %zu", tensor_ptr->numel());
ET_LOG(Info, "Encoding tensor with numel: %zd", tensor_ptr->numel());

std::vector<executorch::runtime::EValue> encoder_inputs;
encoder_inputs.emplace_back(*tensor_ptr);
Expand Down
3 changes: 2 additions & 1 deletion extension/android/jni/jni_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <executorch/runtime/platform/runtime.h>
#include <cassert>
#include <chrono>
#include <cinttypes>
#include <iostream>
#include <memory>
#include <sstream>
Expand Down Expand Up @@ -417,7 +418,7 @@ class ExecuTorchJni : public facebook::jni::HybridClass<ExecuTorchJni> {
auto duration =
std::chrono::duration_cast<std::chrono::milliseconds>(end - start)
.count();
ET_LOG(Debug, "Execution time: %lld ms.", duration);
ET_LOG(Debug, "Execution time: %" PRId64 " ms.", duration);

#else
auto result = module_->execute(method, evalues);
Expand Down
10 changes: 5 additions & 5 deletions extension/data_loader/mmap_data_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Result<MmapDataLoader> MmapDataLoader::from(
return Error::AccessFailed;
}
if ((page_size & ~(page_size - 1)) != page_size) {
ET_LOG(Error, "Page size 0x%ld is not a power of 2", page_size);
ET_LOG(Error, "Page size 0x%lx is not a power of 2", page_size);
return Error::InvalidState;
}

Expand Down Expand Up @@ -211,7 +211,7 @@ Result<FreeableBuffer> MmapDataLoader::load(
ET_CHECK_OR_RETURN_ERROR(
pages != MAP_FAILED,
AccessFailed,
"Failed to map %s: mmap(..., size=%zd, ..., fd=%d, offset=0x%zx)",
"Failed to map %s: mmap(..., size=%zu, ..., fd=%d, offset=0x%zx)",
file_name_,
range.size,
fd_,
Expand All @@ -224,7 +224,7 @@ Result<FreeableBuffer> MmapDataLoader::load(
if (mlock_config_ == MlockConfig::UseMlockIgnoreErrors) {
ET_LOG(
Debug,
"Ignoring mlock error for file %s (off=0x%zd): "
"Ignoring mlock error for file %s (off=0x%zx): "
"mlock(%p, %zu) failed: %s (%d)",
file_name_,
offset,
Expand All @@ -235,7 +235,7 @@ Result<FreeableBuffer> MmapDataLoader::load(
} else {
ET_LOG(
Error,
"File %s (off=0x%zd): mlock(%p, %zu) failed: %s (%d)",
"File %s (off=0x%zx): mlock(%p, %zu) failed: %s (%d)",
file_name_,
offset,
pages,
Expand Down Expand Up @@ -321,7 +321,7 @@ Error MmapDataLoader::load_into(
ET_CHECK_OR_RETURN_ERROR(
pages != MAP_FAILED,
AccessFailed,
"Failed to map %s: mmap(..., size=%zd, ..., fd=%d, offset=0x%zx)",
"Failed to map %s: mmap(..., size=%zu, ..., fd=%d, offset=0x%zx)",
file_name_,
range.size,
fd_,
Expand Down
2 changes: 1 addition & 1 deletion extension/flat_tensor/flat_tensor_data_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Result<const flat_tensor_flatbuffer::NamedData*> get_named_data(
ET_CHECK_OR_RETURN_ERROR(
segment_index >= 0 && segment_index < segments->size(),
InvalidExternalData,
"Segment index %zu for key %.*s is out of bounds for segment size %d. Malformed PTD file.",
"Segment index %zu for key %.*s is out of bounds for segment size %u. Malformed PTD file.",
segment_index,
static_cast<int>(key.size()),
key.data(),
Expand Down
4 changes: 2 additions & 2 deletions extension/llm/runner/multimodal_prefiller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Result<uint64_t> MultimodalPrefiller::prefill(

ET_LOG(
Info,
"Image tensor dim: %zu, dtype: %s",
"Image tensor dim: %zd, dtype: %s",
image_tensor->dim(),
::executorch::runtime::toString(image_tensor->scalar_type()));
// Run image encoder
Expand Down Expand Up @@ -161,7 +161,7 @@ Result<uint64_t> MultimodalPrefiller::prefill(

ET_LOG(
Info,
"Audio tensor dim: %zu, dtype: %s",
"Audio tensor dim: %zd, dtype: %s",
audio_tensor->dim(),
::executorch::runtime::toString(audio_tensor->scalar_type()));

Expand Down
6 changes: 3 additions & 3 deletions extension/llm/runner/stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ inline void print_report(const Stats& stats) {

ET_LOG(
Info,
"\tPrompt Tokens: %" PRIu64 " Generated Tokens: %" PRIu64,
"\tPrompt Tokens: %" PRId64 " Generated Tokens: %" PRId64,
stats.num_prompt_tokens,
stats.num_generated_tokens);

Expand Down Expand Up @@ -188,7 +188,7 @@ inline void print_report(const Stats& stats) {
(double)(stats.inference_end_ms - stats.prompt_eval_end_ms);
ET_LOG(
Info,
"\t\tGenerated %" PRIu64
"\t\tGenerated %" PRId64
" tokens:\t%f (seconds)\t\t Rate: \t%f (tokens/second)",
stats.num_generated_tokens,
eval_time / stats.SCALING_FACTOR_UNITS_PER_SECOND,
Expand All @@ -206,7 +206,7 @@ inline void print_report(const Stats& stats) {

ET_LOG(
Info,
"\tSampling time over %" PRIu64 " tokens:\t%f (seconds)",
"\tSampling time over %" PRId64 " tokens:\t%f (seconds)",
stats.num_prompt_tokens + stats.num_generated_tokens,
(double)stats.aggregate_sampling_time_ms /
stats.SCALING_FACTOR_UNITS_PER_SECOND);
Expand Down
2 changes: 1 addition & 1 deletion extension/llm/runner/text_prefiller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ ::executorch::runtime::Result<uint64_t> TextPrefiller::prefill_chunk(

ET_CHECK_OK_OR_RETURN_ERROR(outputs_res.error());
ET_LOG(
Info, "Prefill token result numel(): %zu", outputs_res.get().numel());
Info, "Prefill token result numel(): %zd", outputs_res.get().numel());

start_pos += num_prompt_tokens;
cur_token =
Expand Down
10 changes: 5 additions & 5 deletions extension/llm/runner/wav_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ inline std::unique_ptr<WavHeader> load_wav_header(
header->RIFF[1],
header->RIFF[2],
header->RIFF[3]);
ET_LOG(Info, "Chunk Size: %d", header->ChunkSize);
ET_LOG(Info, "Chunk Size: %u", header->ChunkSize);
ET_LOG(
Info,
"WAVE Header: %c%c%c%c",
Expand All @@ -194,14 +194,14 @@ inline std::unique_ptr<WavHeader> load_wav_header(
header->fmt[1],
header->fmt[2],
header->fmt[3]);
ET_LOG(Info, "Format Chunk Size: %d", header->Subchunk1Size);
ET_LOG(Info, "Format Chunk Size: %u", header->Subchunk1Size);
ET_LOG(Info, "Audio Format: %d", header->AudioFormat);
ET_LOG(Info, "Number of Channels: %d", header->NumOfChan);
ET_LOG(Info, "Sample Rate: %d", header->SamplesPerSec);
ET_LOG(Info, "Byte Rate: %d", header->bytesPerSec);
ET_LOG(Info, "Sample Rate: %u", header->SamplesPerSec);
ET_LOG(Info, "Byte Rate: %u", header->bytesPerSec);
ET_LOG(Info, "Block Align: %d", header->blockAlign);
ET_LOG(Info, "Bits per Sample: %d", header->bitsPerSample);
ET_LOG(Info, "Subchunk2Size: %d", header->Subchunk2Size);
ET_LOG(Info, "Subchunk2Size: %u", header->Subchunk2Size);

return header;
}
Expand Down
2 changes: 1 addition & 1 deletion extension/runner_util/inputs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Result<BufferCleanup> prepare_input_tensors(
ET_CHECK_OR_RETURN_ERROR(
inputs != nullptr,
MemoryAllocationFailed,
"malloc(%zd) failed",
"malloc(%zu) failed",
num_inputs * sizeof(void*));

// Allocate memory for each input tensor.
Expand Down
2 changes: 1 addition & 1 deletion extension/wasm/wasm_bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ inline void assert_valid_numel(
computed_numel.error(), "Invalid tensor sizes: numel computation failed");
THROW_IF_FALSE(
data.size() >= static_cast<size_t>(computed_numel.get()),
"Required %ld elements, given %ld",
"Required %zd elements, given %zu",
computed_numel.get(),
data.size());
}
Expand Down
2 changes: 1 addition & 1 deletion kernels/portable/cpu/op_view_as_real_copy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Tensor& view_as_real_copy_out(
static_cast<size_t>(self.dim()) < kTensorDimensionLimit,
InvalidArgument,
out,
"Output size buffer is too small. Expected at least %zu, got %zu",
"Output size buffer is too small. Expected at least %zd, got %zu",
self.dim() + 1,
kTensorDimensionLimit);
get_view_as_real_copy_out_target_size(self, expected_output_size);
Expand Down
2 changes: 1 addition & 1 deletion kernels/portable/cpu/util/copy_ops_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ bool check_unbind_copy_args(const Tensor& in, int64_t dim, TensorList out) {
const ssize_t dim_size = in.size(dim);
ET_CHECK_OR_RETURN_FALSE(
dim_size == static_cast<ssize_t>(out.size()),
"out tensorlist's length %zd must equal unbind dim %" PRId64
"out tensorlist's length %zu must equal unbind dim %" PRId64
" size = %zd.",
out.size(),
dim,
Expand Down
Loading
Loading