The GitHub Actions job "mainline-only" on tvm-ffi.git/main has succeeded.
Run started by GitHub user tqchen (triggered by tqchen).

Head commit for run:
d73a26783488430986fd855ae67ff7a9fb016413 / Tianqi Chen 
<[email protected]>
[BUILD] TVM_FFI_COLD_CODE / TVM_FFI_PREDICT_FALSE macros and cold-marking of 
error paths (#589)

## Summary

Adds three header-only macros (`TVM_FFI_COLD_CODE`,
`TVM_FFI_PREDICT_FALSE`, `TVM_FFI_PREDICT_TRUE`) in
`tvm/ffi/base_details.h` and applies them to a small audited set of
error-only helpers. No CMake changes.

## What

`TVM_FFI_COLD_CODE`: `[[gnu::cold]]` on GCC/Clang, no-op on MSVC.
`TVM_FFI_PREDICT_FALSE` / `TVM_FFI_PREDICT_TRUE`: `__builtin_expect` on
GCC/Clang, no-op on MSVC.

Cold-marked (error / setup / teardown only):

- `details::ErrorBuilder` ctors and the `[[noreturn]]` destructor
- `TVMFFISegFaultHandler`
- `TVMFFIInstallSignalHandler`
- `ForwardPyErrorToFFI`

C ABI exports stay hot per cross-DSO surface hygiene — `TVMFFIError*`
family, `TVMFFIBacktrace`, and `SafeCallContext` setters all remain
ordinary entry points. Deleters are not cold-marked: they run on every
callback destruction during normal program operation, not on an error
path.

`TVM_FFI_PREDICT_FALSE` is applied to `TVM_FFI_CHECK_SAFE_CALL`,
`TVM_FFI_CHECK`, and ~17 error-check branches in the Python→FFI
dispatchers in `tvm_ffi_python_helpers.h`.

## Mechanism

GCC and Clang emit cold-marked functions into per-TU `.text.unlikely`.
The default GNU linker script's `*(.text.unlikely .text.*_unlikely
.text.unlikely.*)` rule gathers them into a contiguous slot inside
`.text`. No `-ffunction-sections` flag required.

Detailed measurements (binary-size matrix, isolation study, perf table,
cold-cluster bounds) posted as a follow-up comment.

Report URL: https://github.com/apache/tvm-ffi/actions/runs/25837870377

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to