Skip to content

Commit 1b92ed9

Browse files
cmt0facebook-github-bot
authored andcommitted
Add ETPRIsize_t support to ExecuTorch for Xtensa (#7895)
Summary: topic: not user facing Our Xtensa G3's toolchain, which is as recent as RJ-2024.3 release doesn't have %zu format specifier support. Since we only have the precompiled libc.a provided from cadence -- it seems from the disassembly that only the following are supported %c: character %s: string %d: decimal integer %i: decimal integer (same as %d) %u: unsigned decimal integer %x: hexadecimal integer %X: uppercase hexadecimal integer %p: pointer which is consistent with what I've seen come-out from ET_LOG prints that pass through the vsnprintf specifier Haven't heard of a 64-bit Xtensa DSP, so I think this 'lu' specifier mapping should work for all Xtensa toolchains regardless of vsnprintf implementation. This diff also updates a couple of places where I most commonly see the mishandled %zu specifier. If the changes are okay, I can more widely update print statements in ExecuTorch. It would touch a lot of files, some of which would never be compiled for Xtensa. Differential Revision: D68131252
1 parent 71c0ad8 commit 1b92ed9

File tree

3 files changed

+86
-41
lines changed

3 files changed

+86
-41
lines changed

runtime/core/hierarchical_allocator.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,16 @@ class HierarchicalAllocator final {
6262
ET_CHECK_OR_RETURN_ERROR(
6363
memory_id < buffers_.size(),
6464
InvalidArgument,
65-
"id %" PRIu32 " >= %zu",
65+
"id %" PRIu32 " >= %" ET_PRIsize_t,
6666
memory_id,
6767
buffers_.size());
6868
Span<uint8_t> buffer = buffers_[memory_id];
6969
ET_CHECK_OR_RETURN_ERROR(
7070
offset_bytes + size_bytes <= buffer.size(),
7171
MemoryAllocationFailed,
72-
"offset_bytes (%zu) + size_bytes (%zu) >= allocator size (%zu) "
72+
"offset_bytes (%" ET_PRIsize_t ") + size_bytes (%" ET_PRIsize_t
73+
") >= allocator size (%" ET_PRIsize_t
74+
") "
7375
"for memory_id %" PRIu32,
7476
offset_bytes,
7577
size_bytes,

0 commit comments

Comments
 (0)