Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION_NUMBER
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.23.0
1.23.1
4 changes: 4 additions & 0 deletions cmake/onnxruntime_unittests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1800,6 +1800,7 @@ endif()
if (WIN32 AND onnxruntime_BUILD_SHARED_LIB AND
NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten" AND
NOT onnxruntime_MINIMAL_BUILD)
# example_plugin_ep
file(GLOB onnxruntime_autoep_test_library_src "${TEST_SRC_DIR}/autoep/library/*.h"
"${TEST_SRC_DIR}/autoep/library/*.cc")
onnxruntime_add_shared_library_module(example_plugin_ep ${onnxruntime_autoep_test_library_src})
Expand All @@ -1822,6 +1823,9 @@ if (WIN32 AND onnxruntime_BUILD_SHARED_LIB AND
set_property(TARGET example_plugin_ep APPEND_STRING PROPERTY LINK_FLAGS
${ONNXRUNTIME_AUTOEP_LIB_LINK_FLAG})

set_target_properties(example_plugin_ep PROPERTIES FOLDER "ONNXRuntimeTest")
source_group(TREE ${TEST_SRC_DIR} FILES ${onnxruntime_autoep_test_library_src})

# test library
file(GLOB onnxruntime_autoep_test_SRC "${ONNXRUNTIME_AUTOEP_TEST_SRC_DIR}/*.h"
"${ONNXRUNTIME_AUTOEP_TEST_SRC_DIR}/*.cc")
Expand Down
76 changes: 76 additions & 0 deletions csharp/src/Microsoft.ML.OnnxRuntime/InferenceSession.shared.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,82 @@ public IReadOnlyDictionary<string, NodeMetadata> OverridableInitializerMetadata
}
}

/// <summary>
/// Fetches memory info for all inputs in the same order as their names.
/// (See InputNames property).
/// </summary>
/// <returns>A disposable readonly collection of OrtMemoryInfo</returns>
public IDisposableReadOnlyCollection<OrtMemoryInfo> GetMemoryInfosForInputs()
{
NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionGetInputCount(_nativeHandle, out UIntPtr numInputs));

if(numInputs == UIntPtr.Zero)
{
return new DisposableList<OrtMemoryInfo>();
}

var memoryInfoArray = new IntPtr[(ulong)numInputs];

NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionGetMemoryInfoForInputs(_nativeHandle,
memoryInfoArray, numInputs));

return new DisposableList<OrtMemoryInfo>(
memoryInfoArray.Select(static ptr => new OrtMemoryInfo(ptr, /* owned= */ false)));
}

/// <summary>
/// Fetches memory info for all outputs in the same order as their names.
/// (See OutputNames property).
/// </summary>
/// <returns>A disposable readonly collection of OrtMemoryInfo</returns>
public IDisposableReadOnlyCollection<OrtMemoryInfo> GetMemoryInfosForOutputs()
{
NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionGetOutputCount(_nativeHandle,
out UIntPtr numOutputs));

if(numOutputs == UIntPtr.Zero)
{
return new DisposableList<OrtMemoryInfo>();
}

var memoryInfoArray = new IntPtr[(ulong)numOutputs];

NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionGetMemoryInfoForOutputs(_nativeHandle,
memoryInfoArray, numOutputs));
return new DisposableList<OrtMemoryInfo>(
memoryInfoArray.Select(static ptr => new OrtMemoryInfo(ptr, /* owned= */ false)));
}

/// <summary>
/// Fetches OrtEpDevice instances for all inputs in the same order as their input names.
/// For inputs that do not have a device, the corresponding entry in the returned list is null.
/// See InputNames property.
/// </summary>
/// <returns>IReadOnlyList<OrtEpDevice></returns>
public IReadOnlyList<OrtEpDevice> GetEpDeviceForInputs()
{
NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionGetInputCount(_nativeHandle,
out UIntPtr numInputs));

if (numInputs == UIntPtr.Zero)
{
// OrtSessionGetEpDeviceForInputs expects numInputs > 0, otherwise it is an invalid arg.
return [];
}

var epDevicesForInputs = new IntPtr[(ulong)numInputs];

NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionGetEpDeviceForInputs(_nativeHandle,
epDevicesForInputs, numInputs));

// Some entries in epDevicesForInputs can be IntPtr.Zero, indicating the input does not
// have a device; return null for those entries.
return epDevicesForInputs
.Select(static ptr => ptr == IntPtr.Zero ? null : new OrtEpDevice(ptr))
.ToList()
.AsReadOnly();
}

/// <summary>
/// Runs the loaded model for the given inputs, and fetches all the outputs.
/// </summary>
Expand Down
Loading
Loading