Commit abb5207
Replace libc printf with eyalroz/printf and add streaming status formatting.
Integrates eyalroz/printf as a vendored dependency to replace all libc
snprintf/vsnprintf calls across the runtime. This gives us a consistent,
portable printf implementation across all platforms (including embedded
and bare-metal targets) with no platform-specific quirks.
Beyond the drop-in replacement, this extends the status formatting API
with streaming support:
- Add iree_status_format_to: callback-based streaming formatter that
avoids contiguous buffers and pre-measurement passes. The callback
returns bool for flow control, enabling early termination on buffer
full or allocation failure.
- Add iree_string_builder_append_status: single-pass status-to-builder
formatting via iree_status_format_to, resolving the status/string_builder
dependency cycle that previously required a local copy in libhsa.c.
- Rewrite iree_status_fprint to stream directly to FILE* with zero
heap allocation (previously required a contiguous buffer).
- Rewrite iree_status_to_string as single-pass using string builder
instead of two-pass measure-then-format.
- Fix va_copy usage in status allocation: use C99 va_copy for the
two-pass measure-then-format pattern instead of calling va_start
twice on the same parameter (implementation-defined behavior).
- Convert Status::ToString (C++) and ApiStatusToString (Python bindings)
from two-pass iree_status_format to single-pass iree_status_format_to.
- Replace HIP dynamic_symbols.c allocate-format-free pattern with
direct iree_string_builder_append_status (eliminates intermediate
heap allocation).
RISC-V toolchain fix: strip debug info from libgcc.a during CMake
configure. eyalroz/printf's long double support in %Lf/%Le compiles
va_arg(args, long double) which on RISC-V (128-bit quad precision)
generates references to __extenddftf2/__trunctfdf2 soft-float builtins.
These are resolved from libgcc.a, but the GCC 12.2.0-compiled objects
in that archive contain DWARF debug info with relocation types 60/61
(in .debug_rnglists and .debug_loclists sections) that LLD cannot
parse. The pre-built RISC-V toolchain lacks compiler-rt builtins as
an alternative, so we strip the debug metadata from libgcc.a at
configure time using llvm-objcopy --strip-debug. This preserves all
code and data sections and is idempotent. The strip runs inside the
RISCV_TOOLCHAIN_ROOT guard so users with their own toolchains are
unaffected. Verified locally with the same toolchain used in CI
(toolchain_iree_manylinux_2_28_20231012).
Co-Authored-By: Claude <[email protected]>1 parent 3a4c991 commit abb5207
72 files changed
Lines changed: 940 additions & 413 deletions
File tree
- build_tools
- bazel_to_cmake
- bazel
- cmake
- scripts/git
- third_party/printf
- runtime
- bindings/python
- src/iree
- async
- cts/socket
- platform
- io_uring
- iocp
- posix
- base
- internal
- threading
- builtins/ukernel/tools
- hal
- drivers
- amdgpu
- util
- cuda
- hip
- metal
- vulkan
- local
- utils
- io
- task
- testing
- tokenizer/model
- vm
- third_party
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1042 | 1042 | | |
1043 | 1043 | | |
1044 | 1044 | | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
1045 | 1048 | | |
1046 | 1049 | | |
1047 | 1050 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
99 | 106 | | |
100 | 107 | | |
101 | 108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| 122 | + | |
122 | 123 | | |
123 | 124 | | |
124 | 125 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
29 | 45 | | |
30 | 46 | | |
31 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | 32 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
44 | 42 | | |
45 | 43 | | |
46 | 44 | | |
| |||
0 commit comments