add parallelism to prepacking/weight loading (#31691)
## Description
Prepacking was not fully parallelized during session initialization.
Memory-mapped weights were retrieved sequentially before each kernel
processed them, so data retrieval did not overlap with the expensive
`PrePack()` work.
This PR:
- dispatches eligible CPU `OpKernel::PrePack()` calls across the session
intra-op thread pool;
- synchronizes shared bookkeeping while leaving the expensive per-kernel
packing work concurrent;
- avoids nested parallelism in `MatMulNBits`;
- keeps cross-session shared prepacked-weight caching on its existing
serialized path;
- enables outer prepack parallelism in all Android variants, including
basic minimal builds.
## Performance
Measured with a ModelBuilder-generated Qwen3.6-27B model quantized to
INT4 on an Intel Xeon Platinum 8480C.
Before:
```text
-- start: 2026-08-06 11:16:48.388195
---- end: 2026-08-06 11:17:32.072674
loading time: 43.68443649681285
-- start: 2026-08-06 11:17:32.072778
---- end: 2026-08-06 11:18:16.123237
loading time: 44.0504179620184
-- start: 2026-08-06 11:18:16.123356
---- end: 2026-08-06 11:19:00.205266
loading time: 44.08187505789101
```
After:
```text
-- start: 2026-08-06 14:56:41.478934
---- end: 2026-08-06 14:56:48.648836
loading time: 7.169875857885927
-- start: 2026-08-06 14:56:48.648966
---- end: 2026-08-06 14:56:57.359275
loading time: 8.710286310408264
-- start: 2026-08-06 14:56:57.359358
---- end: 2026-08-06 14:57:05.959221
loading time: 8.599843401927501
```
## Android minimal binary size
With the outer prepack path included, the Android minimal baseline on
the current merge commit measured **1,594,365 bytes**. The GitHub
Actions and Azure thresholds are raised from **1,585,152** to
**1,595,392 bytes**, retaining approximately 1 KiB of headroom.
## Validation
- Built `onnxruntime_test_all`.
- Ran
`SessionStateTestSharedInitalizersWithPrePacking.ParallelPrepackConvertsExceptionsToStatus`.
- Ran lintrunner on all changed files.
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: tianleiwu <30328909+tianleiwu@users.noreply.github.com>