onnxruntime
1c34fd5c - Add IOBinding test for preallocated CPU output buffer reuse (#29566)

Commit
108 days ago
Add IOBinding test for preallocated CPU output buffer reuse (#29566) ### Description Adds a CPU IOBinding test that makes the no-copy/in-place contract for preallocated outputs explicit. The new test: - builds the existing in-memory MatMul model used by `io_binding_test.cc`; - binds CPU inputs; - allocates a CPU output `OrtValue` and records its raw tensor buffer pointer; - binds that `OrtValue` as output `Y`; - runs the session with `IOBinding`; - verifies the returned output still points to the exact bound buffer and validates the numeric result. This guards the intended behavior that a preallocated CPU output is written in-place rather than ORT allocating a separate output buffer and copying into/returning that. ### Motivation and Context Preallocated I/O binding is one of the local zero-copy/copy-elision paths that can be validated without a GPU or multi-EP setup. Existing tests checked values; this adds a direct buffer-identity assertion so regressions that accidentally allocate/copy to a different buffer are caught. ### Testing Built `onnxruntime_provider_test` (Release, Windows) and ran: ```powershell .\onnxruntime_provider_test.exe --gtest_filter="InferenceSessionTests.TestBindCpu:InferenceSessionTests.TestBindCpuPreallocatedOutputUsesBoundBuffer" ``` Result: ```text [==========] 2 tests from 1 test suite ran. [ PASSED ] 2 tests. ``` Co-authored-by: Gopalakrishnan Nallasamy <gopalakrishnan.nallasamy@microsoft.com>
Parents
Loading