onnxruntime
dfaf4b44 - Fix thread-pool param self-assignment and dedupe schema registration in session_state_test (#28799)

Commit
72 days ago
Fix thread-pool param self-assignment and dedupe schema registration in session_state_test (#28799) ## Description Fixes a latent bug and reduces unnecessary resource usage in `session_state_test.cc`. ### Thread-pool parameter initialization `SessionStateTestP.TestInitializerProcessing` contained a self-assignment that silently dropped the test's intended thread count: ```cpp OrtThreadPoolParams to; to.thread_pool_size = to.thread_pool_size; // no-op: leaves thread_pool_size = 0 ``` `thread_pool_size = 0` means "use all physical cores (or half the logical cores)". Across the 8 parametrized instances this spins up large intra-op thread pools regardless of the `thread_count` parameter, adding avoidable thread/memory overhead — which is especially costly under the AddressSanitizer build. This PR: - Corrects the assignment to use the intended parameter: `to.thread_pool_size = param.thread_count;` - Value-initializes all local `OrtThreadPoolParams` instances (`OrtThreadPoolParams to{};`) for consistency and to avoid relying on implicit defaults. ### Deduplicate schema registration `PrePackingTest` was registered into the global ONNX schema registry in two places (`SessionStatePrepackingTest` and the `SessionStateTestSharedInitalizersWithPrePacking` fixture), producing duplicate-registration warnings when both run in the same process. The registration is now centralized behind a `std::call_once` helper so the schema is registered exactly once. ## Motivation and Context While investigating an ASan `onnxruntime_test_all` OOM, `SessionStatePrepackingTest` showed up as the abort site (the process-wide ASan allocator aborts in whichever test is allocating when the limit is hit). The dominant memory driver was addressed separately in #28797 (QDQ Gemm transformer tests). This PR cleans up the genuine, independent issues found in `session_state_test.cc` during that investigation: the self-assignment bug and the duplicate schema registration. ## Testing All affected tests pass locally (RelWithDebInfo): ``` [==========] 19 tests from 4 test suites ran. [ PASSED ] 19 tests. ``` Covers `SessionStateTestP`, `SessionStatePrepackingTest`, `SessionStateAddGetKernelTest`, and `SessionStateTestSharedInitalizersWithPrePacking`. --------- Co-authored-by: Gopalakrishnan Nallasamy <gnallasamy@microsoft.com>
Parents
Loading