onnxruntime
e10b9dfc - Verify Level-2 workspace reservations (#32189)

Commit
7 days ago
Verify Level-2 workspace reservations (#32189) ## Summary - Preserve accepted per-node workspace reservations after graph partitioning and through post-partition graph mutations. - Compare final Level-2 workspace declarations with the reservations used during partitioning. - Report larger, equal, smaller, missing-declaration, missing-reservation, and orphaned-reservation counts and byte totals per graph. - Warn by default on declaration overruns and support strict constrained-memory validation with `session.strict_workspace_verification=1`. ## Behavior and scope Verification runs after kernels are created and constant tensors are prepacked, when final Level-2 requirements are available. Strict mode fails session initialization when a declaration exceeds its reservation or when an untracked mutation leaves a nonzero orphaned reservation. Missing partition reservations and zero-byte orphans remain diagnostic-only. Reservation ownership now follows fused capabilities, selector actions, shared and manual fusions, bottom-up removals, intentional eliminations, and training recomputation clones. This includes MatMulScale and QDQ cleanup, Attention and EmbedLayerNorm cleanup paths, Level-4 initializer fusion, GroupQueryAttention, BitmaskDropout, BiasSoftmaxDropout, SCE loss gradient, Triton, and MemoryOptimizer transformations. Strict verification is rejected for ORT-format loads because partition-time reservations are not serialized. Reservation storage and verification remain excluded from ordinary minimal builds; extended-minimal ORT-format loads reject strict mode explicitly. This PR does not repartition the graph or change runtime workspace allocation. #31962 introduced Level-1 workspace estimation and reporting; activation-aware CUDA workspace preallocation remains follow-up work in #32071. ## Validation - Windows Release `onnxruntime_test_all` build: 123 focused tests passed, 4 hardware-dependent tests skipped. - Windows training-enabled Release build: all 10 focused mutation-accounting tests passed. - Windows extended-minimal build: strict ORT-format rejection test passed. - Windows no-ops MinSizeRel minimal shared-library build passed. - `lintrunner` and `git diff --check` passed. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: cdd38fe6-fcf3-45c2-acea-b8e6206a7839 Copilot-Session: 1faf9517-5062-4655-a967-3834143334d0 Copilot-Session: 991be248-6618-43aa-8d4b-5305e52bcd40
Author
Parents
Loading