onnxruntime
eed2b754 - Avoid eager static initialization in ORT (#31964)

Commit
12 days ago
Avoid eager static initialization in ORT (#31964) ## Description Avoid two eager dynamic initializers in ONNX Runtime: - Replace the model-package manifest parser's namespace-scope `std::set<std::string>` key tables with constexpr `std::array<std::string_view>` tables. - Move the AVX2 S8-to-U8 transformer's namespace-scope `std::unordered_map` to a function-local static so it is initialized only if the transformer runs. This preserves lookup behavior and source membership while removing unnecessary process-startup initialization. ## Motivation and Context An ARM64 binary-size regression report showed `.CRT$XCU` increasing from 176 to 192 bytes. Exact before/after PDB comparison identified two additional initializer entries: - `_GLOBAL__sub_I_manifest_parser.cc` - `_GLOBAL__sub_I_avx2_weight_s8_to_u8.cc` Each ARM64 `.CRT$XCU` entry is an 8-byte function pointer, accounting for the full 16-byte increase. The issue was isolated to eager initialization. ## Validation - ARM64 official ONNX Runtime build passed. - Benchmark-equivalent `dumpbin /headers /Coffgroup` reports `.CRT$XCU = 0xB0` (176 bytes), restoring the baseline from 192 bytes. - Both causal initializer symbols are absent from the fixed ARM64 PDB. - x64 official inference-engine E2E suite passed: 11/11. - Win32k-lockdown sandbox test passed: 1/1. - `clang-format --dry-run --Werror` passed. - Local AI code review reported no findings.
Author
Parents
Loading