Skip to content
Merged
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
a20104c
Add in BF16 datatype and quantization support to MIGraphX EP
apwojcik Jul 28, 2025
5506dfa
Fixing corrupted flags issue DML and MGX
urpetkov-amd Jul 28, 2025
fa11154
Check migraphx_onnx_options_set_external_data_path exists
apwojcik Jul 28, 2025
131512d
Use #ifdef instead of #if
apwojcik Jul 23, 2025
8e15865
Simlify MIGraphX EP CMake
apwojcik Jul 23, 2025
e70b8dc
Use SHARED lib not MODULE for MIGraphX EP
apwojcik Jul 23, 2025
d74ecba
Use integer type equivalent to architecture to represent memory addre…
apwojcik Jul 23, 2025
5bb4cee
Declaration of 'param_shapes' hides previous local declaration
apwojcik Jul 23, 2025
9820413
Add inline to header file function definitions
apwojcik Jul 23, 2025
e7ce7ff
use string_view
apwojcik Jul 28, 2025
f8450f1
Use std::string_view for literals
apwojcik Jul 29, 2025
2314625
Use MIGraphX ONNXRT DLL location to search for MIGX and HIP runtime DLLs
apwojcik May 29, 2025
303129c
Reduce number of log messages
apwojcik Jul 28, 2025
7edd17b
implement cpplint suggestions
apwojcik Jul 28, 2025
bc1ca7a
Use OrtDevice::DeviceId instead of int
apwojcik Jul 23, 2025
c87168e
Use int instead of 'bool' for ONNXRT C interface
apwojcik Jul 23, 2025
8c0d09d
allocate memory for an option value
apwojcik Jul 28, 2025
e4d1c3e
Support for saving and loading MXR files automaticaly
apwojcik Jul 28, 2025
48989b8
The C# interface for MIGraphX execution provider
apwojcik Jul 29, 2025
453ebf5
Trim the output names of non-digits
apwojcik Jul 28, 2025
71f2729
Use member variables for EP configuration instead of the info member …
apwojcik Jul 29, 2025
7d8e4f2
Bundle MIGraphX and HIP runtime binaries in C# NuGet and Python wheel
apwojcik May 21, 2025
9686e40
Add Attention and SkipLayerNormalization Contrib op support (#100)
TedThemistokleous Jul 7, 2025
6589ef9
Remove redundant initialization of execution provider
apwojcik Jun 23, 2025
e614347
Remove redundant allocator static method
apwojcik Jul 28, 2025
b2bf6ae
MIGraphX cherry-picks for WCR
apwojcik Jul 29, 2025
71fc0b9
Remove ROCm EP dependencies after drop
apwojcik Jul 2, 2025
64eff87
changed back the type to bool
apwojcik Aug 4, 2025
0ade80d
Merge branch 'main' into amd_migx_ep_sync
apwojcik Aug 5, 2025
e6e5e54
do not modify provider ABI
apwojcik Aug 5, 2025
ed86438
use std::string_view variant to reduce binary size
apwojcik Aug 5, 2025
90f1ea4
review comment: use std::string directly
apwojcik Aug 5, 2025
b2bef03
review comment: fix security bug in StrDup(wchar_t)
apwojcik Aug 5, 2025
b46d46d
review comment: CANN update
apwojcik Aug 5, 2025
e06f1ee
review comment: remove unused dependencies
apwojcik Aug 5, 2025
d823753
review comment: fix source code formatting
apwojcik Aug 5, 2025
27e60f8
review comment: fix security bug
apwojcik Aug 5, 2025
fcd9198
fix Python wheel name for MIGraphX
apwojcik Aug 5, 2025
4b2acf1
Revert "The C# interface for MIGraphX execution provider"
apwojcik Aug 5, 2025
06ebb42
Merge branch 'main' into amd_migx_ep_sync
apwojcik Aug 5, 2025
20ed3a7
Merge branch 'main' into amd_migx_ep_sync
apwojcik Aug 6, 2025
ef8c968
Use auto Ep version from 'main' branch
apwojcik Aug 6, 2025
781fa34
Create C# NuGet package for MIGraphX
apwojcik Aug 6, 2025
cd65f69
Merge branch 'main' into amd_migx_ep_sync
apwojcik Aug 7, 2025
42441ff
fix pybind compilation after merging 'main'
apwojcik Aug 7, 2025
7e38f71
do not alter OrtMIGraphXProvierOptions
apwojcik Aug 7, 2025
8be40b0
remove nested MIGraphXExecutionProviderInfo
apwojcik Aug 7, 2025
b9d7e26
lintrunner
apwojcik Aug 7, 2025
481c854
disable C4065 warning for the switch statement
apwojcik Aug 7, 2025
1ac92bc
Update onnxruntime/python/onnxruntime_pybind_ortvalue.cc
apwojcik Aug 7, 2025
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# build, distribute, and bins (+ python proto bindings)
build.*/
build
build_*/
.build_debug/*
Expand Down
1 change: 1 addition & 0 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ include(CheckLanguage)
include(CMakeDependentOption)
include(FetchContent)
include(CheckFunctionExists)
include(CheckSymbolExists)
include(GNUInstallDirs) # onnxruntime_providers_* require CMAKE_INSTALL_* variables

# TODO: update this once all system adapt c++20
Expand Down
81 changes: 51 additions & 30 deletions cmake/onnxruntime_providers_migraphx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,11 @@
# Licensed under the MIT License.

add_definitions(-DUSE_MIGRAPHX=1)
set(BUILD_LIBRARY_ONLY 1)
add_definitions("-DONNX_ML=1")
add_definitions("-DONNX_NAMESPACE=onnx")
include_directories(${protobuf_SOURCE_DIR} ${eigen_SOURCE_DIR})
set(MIGRAPHX_ROOT ${onnxruntime_MIGRAPHX_HOME})
include_directories(${onnx_SOURCE_DIR})
include_directories(${protobuf_SOURCE_DIR} ${eigen_SOURCE_DIR} ${onnx_SOURCE_DIR})
set(OLD_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
if ( CMAKE_COMPILER_IS_GNUCC )
if (CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter -Wno-missing-field-initializers")
endif()
set(CXX_VERSION_DEFINED TRUE)
set(CMAKE_CXX_FLAGS ${OLD_CMAKE_CXX_FLAGS})
if ( CMAKE_COMPILER_IS_GNUCC )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter")
endif()

# Add search paths for default rocm installation
list(APPEND CMAKE_PREFIX_PATH /opt/rocm/hcc /opt/rocm/hip /opt/rocm $ENV{HIP_PATH})
Expand All @@ -33,23 +23,21 @@
find_package(hip REQUIRED)
find_package(migraphx REQUIRED PATHS ${AMD_MIGRAPHX_HOME})

set(migraphx_libs migraphx::c hip::host)

file(GLOB_RECURSE onnxruntime_providers_migraphx_cc_srcs CONFIGURE_DEPENDS
"${ONNXRUNTIME_ROOT}/core/providers/migraphx/*.h"
"${ONNXRUNTIME_ROOT}/core/providers/migraphx/*.cc"
"${ONNXRUNTIME_ROOT}/core/providers/shared_library/*.h"
"${ONNXRUNTIME_ROOT}/core/providers/shared_library/*.cc"
)
source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_migraphx_cc_srcs})
onnxruntime_add_shared_library_module(onnxruntime_providers_migraphx ${onnxruntime_providers_migraphx_cc_srcs})
onnxruntime_add_shared_library(onnxruntime_providers_migraphx ${onnxruntime_providers_migraphx_cc_srcs})
onnxruntime_add_include_to_target(onnxruntime_providers_migraphx onnxruntime_common onnx flatbuffers::flatbuffers Boost::mp11 safeint_interface)
add_dependencies(onnxruntime_providers_migraphx onnxruntime_providers_shared ${onnxruntime_EXTERNAL_DEPENDENCIES})
target_link_libraries(onnxruntime_providers_migraphx PRIVATE ${migraphx_libs} ${ONNXRUNTIME_PROVIDERS_SHARED} onnx flatbuffers::flatbuffers Boost::mp11 safeint_interface)
target_include_directories(onnxruntime_providers_migraphx PRIVATE ${ONNXRUNTIME_ROOT} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/amdgpu/onnxruntime)
add_dependencies(onnxruntime_providers_migraphx ${onnxruntime_EXTERNAL_DEPENDENCIES})
target_link_libraries(onnxruntime_providers_migraphx PRIVATE migraphx::c hip::host ${ONNXRUNTIME_PROVIDERS_SHARED} onnx flatbuffers::flatbuffers Boost::mp11 safeint_interface)
target_include_directories(onnxruntime_providers_migraphx PRIVATE ${ONNXRUNTIME_ROOT} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/migraphx/onnxruntime)
set_target_properties(onnxruntime_providers_migraphx PROPERTIES LINKER_LANGUAGE CXX)
set_target_properties(onnxruntime_providers_migraphx PROPERTIES FOLDER "ONNXRuntime")
target_compile_definitions(onnxruntime_providers_migraphx PRIVATE ONNXIFI_BUILD_LIBRARY=1)
target_compile_definitions(onnxruntime_providers_migraphx PRIVATE ONNXIFI_BUILD_LIBRARY=1 ONNX_ML=1 ONNX_NAMESPACE=onnx)
if(MSVC)
set_property(TARGET onnxruntime_providers_migraphx APPEND_STRING PROPERTY LINK_FLAGS /DEF:${ONNXRUNTIME_ROOT}/core/providers/migraphx/symbols.def)
target_link_libraries(onnxruntime_providers_migraphx PRIVATE ws2_32)
Expand All @@ -62,6 +50,15 @@
target_link_libraries(onnxruntime_providers_migraphx PRIVATE stdc++fs)
endif()

set(CMAKE_REQUIRED_LIBRARIES migraphx::c)

check_symbol_exists(migraphx_onnx_options_set_external_data_path
"migraphx/migraphx.h" HAVE_MIGRAPHX_API_ONNX_OPTIONS_SET_EXTERNAL_DATA_PATH)

if(HAVE_MIGRAPHX_API_ONNX_OPTIONS_SET_EXTERNAL_DATA_PATH)
target_compile_definitions(onnxruntime_providers_migraphx PRIVATE HAVE_MIGRAPHX_API_ONNX_OPTIONS_SET_EXTERNAL_DATA_PATH=1)
endif()

if (onnxruntime_ENABLE_TRAINING_OPS)
onnxruntime_add_include_to_target(onnxruntime_providers_migraphx onnxruntime_training)
target_link_libraries(onnxruntime_providers_migraphx PRIVATE onnxruntime_training)
Expand All @@ -71,15 +68,39 @@
endif()

if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
install(TARGETS onnxruntime_providers_migraphx
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_BINDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
else()
install(TARGETS onnxruntime_providers_migraphx
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
foreach(file migraphx-hiprtc-driver.exe migraphx.dll migraphx_c.dll migraphx_cpu.dll migraphx_device.dll migraphx_gpu.dll migraphx_onnx.dll migraphx_tf.dll)
set(_source "${AMD_MIGRAPHX_HOME}/bin/${file}")
if(EXISTS "${_source}")
add_custom_command(TARGET onnxruntime_providers_migraphx
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${_source} $<TARGET_FILE_DIR:onnxruntime_providers_migraphx>)
set(_target "$<TARGET_FILE_DIR:onnxruntime_providers_migraphx>/${file}")
list(APPEND _migraphx_targets ${_target})
endif()
endforeach()
set(MIGRAPHX_LIB_FILES ${_migraphx_targets} CACHE INTERNAL "" FORCE)
install(FILES ${_migraphx_targets}
DESTINATION ${CMAKE_INSTALL_BINDIR})
get_property(_amdhip64_location TARGET hip::amdhip64 PROPERTY IMPORTED_LOCATION_RELEASE)
cmake_path(GET _amdhip64_location PARENT_PATH _hipsdk_path)
foreach(file amd_comgr0602.dll amd_comgr0604.dll amd_comgr0700.dll hiprtc0602.dll hiprtc0604.dll hiprtc0700.dll hiprtc-builtins0602.dll hiprtc-builtins0604.dll hiprtc-builtins0700.dll)
set(_source "${_hipsdk_path}/${file}")
if(EXISTS "${_source}")
add_custom_command(TARGET onnxruntime_providers_migraphx
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${_source} $<TARGET_FILE_DIR:onnxruntime_providers_migraphx>)
set(_target "$<TARGET_FILE_DIR:onnxruntime_providers_migraphx>/${file}")
list(APPEND _hipsdk_targets ${_target})
endif()
endforeach()
set(HIPSDK_LIB_FILES ${_hipsdk_targets} CACHE INTERNAL "" FORCE)
install(FILES ${_hipsdk_targets}
DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()

install(TARGETS onnxruntime_providers_migraphx
EXPORT onnxruntime_providers_migraphxTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
FRAMEWORK DESTINATION ${CMAKE_INSTALL_BINDIR})
15 changes: 15 additions & 0 deletions cmake/onnxruntime_python.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,21 @@ if (onnxruntime_USE_OPENVINO)
)
endif()

if (onnxruntime_USE_MIGRAPHX)
if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
add_custom_command(
TARGET onnxruntime_pybind11_state POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${MIGRAPHX_LIB_FILES}
$<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/capi/)
add_custom_command(
TARGET onnxruntime_pybind11_state POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${HIPSDK_LIB_FILES}
$<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/capi/)
endif()
endif()

if (onnxruntime_ENABLE_EXTERNAL_CUSTOM_OP_SCHEMAS)
add_custom_command(
TARGET onnxruntime_pybind11_state POST_BUILD
Expand Down
4 changes: 0 additions & 4 deletions cmake/onnxruntime_unittests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,6 @@ endif()

if(onnxruntime_USE_MIGRAPHX)
list(APPEND onnxruntime_test_framework_libs onnxruntime_providers_migraphx)
list(APPEND onnxruntime_test_providers_dependencies onnxruntime_providers_migraphx onnxruntime_providers_shared)
endif()

if(onnxruntime_USE_COREML)
Expand Down Expand Up @@ -691,9 +690,6 @@ endif()

if(onnxruntime_USE_MIGRAPHX)
list(APPEND onnxruntime_test_framework_src_patterns ${TEST_SRC_DIR}/providers/migraphx/*)
list(APPEND onnxruntime_test_framework_src_patterns "${ONNXRUNTIME_ROOT}/core/providers/migraphx/migraphx_execution_provider_utils.h")
list(APPEND onnxruntime_test_framework_libs onnxruntime_providers_migraphx)
list(APPEND onnxruntime_test_providers_dependencies onnxruntime_providers_migraphx onnxruntime_providers_shared)
endif()

if(onnxruntime_USE_NNAPI_BUILTIN)
Expand Down
20 changes: 17 additions & 3 deletions include/onnxruntime/core/common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,12 +294,26 @@ inline std::string ToUTF8String(const std::string& s) { return s; }
/**
* Convert a wide character string to a UTF-8 string
*/
std::string ToUTF8String(const std::wstring& s);

std::wstring ToWideString(const std::string& s);
std::string ToUTF8String(std::wstring_view s);
inline std::string ToUTF8String(const wchar_t* s) {
return ToUTF8String(std::wstring_view{s});
}
inline std::string ToUTF8String(const std::wstring& s) {
return ToUTF8String(std::wstring_view{s});
}
std::wstring ToWideString(std::string_view s);
inline std::wstring ToWideString(const char* s) {
return ToWideString(std::string_view{s});
}
inline std::wstring ToWideString(const std::string& s) {
return ToWideString(std::string_view{s});
}
inline std::wstring ToWideString(const std::wstring& s) { return s; }
inline std::wstring ToWideString(std::wstring_view s) { return std::wstring{s}; }
#else
inline std::string ToWideString(const std::string& s) { return s; }
inline std::string ToWideString(const char* s) { return s; }
inline std::string ToWideString(std::string_view s) { return std::string{s}; }
#endif

constexpr size_t kMaxStrLen = 4096;
Expand Down
6 changes: 5 additions & 1 deletion include/onnxruntime/core/common/string_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@
// forward declaration
struct OrtAllocator;
namespace onnxruntime {
char* StrDup(const std::string& str, OrtAllocator* allocator);
char* StrDup(std::string_view str, OrtAllocator* allocator);
inline char* StrDup(const std::string& str, OrtAllocator* allocator) {
return StrDup(std::string_view{str}, allocator);
}
wchar_t* StrDup(std::wstring_view str, OrtAllocator* allocator);
} // namespace onnxruntime
38 changes: 37 additions & 1 deletion include/onnxruntime/core/framework/provider_options_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,24 @@ class ProviderOptionsParser {
template <typename ValueParserType>
ProviderOptionsParser& AddValueParser(
const std::string& name, ValueParserType value_parser) {
return AddValueParser(std::string_view{name}, value_parser);
}

template <typename ValueParserType>
ProviderOptionsParser& AddValueParser(
std::string_view name, ValueParserType value_parser) {
ORT_ENFORCE(
value_parsers_.emplace(name, ValueParser{value_parser}).second,
"Provider option \"", name, "\" already has a value parser.");
return *this;
}

template <typename ValueParserType>
ProviderOptionsParser& AddValueParser(
const char* name, ValueParserType value_parser) {
return AddValueParser<ValueParserType>(std::string_view{name}, value_parser);
}

/**
* Adds a parser for a particular provider option value which converts a
* value to the right type and assigns it to the given reference.
Expand All @@ -104,13 +116,25 @@ class ProviderOptionsParser {
template <typename ValueType>
ProviderOptionsParser& AddAssignmentToReference(
const std::string& name, ValueType& dest) {
return AddAssignmentToReference(std::string_view{name}, dest);
}

template <typename ValueType>
ProviderOptionsParser& AddAssignmentToReference(
std::string_view name, ValueType& dest) {
return AddValueParser(
name,
[&dest](const std::string& value_str) -> Status {
[&dest](std::string_view value_str) -> Status {
return ParseStringWithClassicLocale(value_str, dest);
});
}

template <typename ValueType>
ProviderOptionsParser& AddAssignmentToReference(
const char* name, ValueType& dest) {
return AddAssignmentToReference<ValueType>(std::string_view{name}, dest);
}

/**
* Adds a parser for a particular provider option value which maps an
* enumeration name to a value and assigns it to the given reference.
Expand All @@ -128,13 +152,25 @@ class ProviderOptionsParser {
template <typename EnumType>
ProviderOptionsParser& AddAssignmentToEnumReference(
const std::string& name, const EnumNameMapping<EnumType>& mapping, EnumType& dest) {
return AddAssignmentToEnumReference(std::string_view{name}, mapping, dest);
}

template <typename EnumType>
ProviderOptionsParser& AddAssignmentToEnumReference(
std::string_view name, const EnumNameMapping<EnumType>& mapping, EnumType& dest) {
return AddValueParser(
name,
[&mapping, &dest](const std::string& value_str) -> Status {
return NameToEnum(mapping, value_str, dest);
});
}

template <typename EnumType>
ProviderOptionsParser& AddAssignmentToEnumReference(
const char* name, const EnumNameMapping<EnumType>& mapping, EnumType& dest) {
return AddAssignmentToEnumReference<EnumType>(std::string_view{name}, mapping, dest);
}

/**
* Parses the given provider options.
*/
Expand Down
9 changes: 5 additions & 4 deletions include/onnxruntime/core/session/onnxruntime_c_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -754,13 +754,13 @@ typedef struct OrtMIGraphXProviderOptions {
int migraphx_fp16_enable; // MIGraphX FP16 precision. Default 0 = false, nonzero = true
int migraphx_fp8_enable; // MIGraphX FP8 precision. Default 0 = false, nonzero = true
int migraphx_int8_enable; // MIGraphX INT8 precision. Default 0 = false, nonzero = true
int migraphx_use_native_calibration_table; // MIGraphx INT8 cal table. Default 0 = false, noznero = true
int migraphx_use_native_calibration_table; // MIGraphx INT8 cal table. Default 0 = false, nonzero = true
const char* migraphx_int8_calibration_table_name; // MIGraphx INT8 calibration table name
int migraphx_save_compiled_model; // migraphx save compiled model. Default 0 = false, noznero = true
int migraphx_save_compiled_model; // migraphx save compiled model. Default 0 = false, nonzero = true
const char* migraphx_save_model_path; // migraphx model path name
int migraphx_load_compiled_model; // migraphx int8 cal table. Default 0 = false, noznero = true
int migraphx_load_compiled_model; // migraphx int8 cal table. Default 0 = false, nonzero = true
const char* migraphx_load_model_path; // migraphx model path name
bool migraphx_exhaustive_tune; // migraphx tuned compile Default = false
bool migraphx_exhaustive_tune; // MIGraphX tuned compile. Default = false, nonzero = true

/** \brief MIGraphX memory limit (To use all possible memory pass in maximum size_t)
* Defaults to SIZE_MAX.
Expand All @@ -776,6 +776,7 @@ typedef struct OrtMIGraphXProviderOptions {
*/
int migraphx_arena_extend_strategy;

// This is the legacy struct and don't add new fields here.
} OrtMIGraphXProviderOptions;

/** \brief OpenVINO Provider Options
Expand Down
4 changes: 2 additions & 2 deletions onnxruntime/core/common/helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

namespace onnxruntime {
#ifdef _WIN32
std::string ToUTF8String(const std::wstring& s) {
std::string ToUTF8String(std::wstring_view s) {
if (s.size() >= static_cast<size_t>(std::numeric_limits<int>::max()))
ORT_THROW("length overflow");

Expand All @@ -33,7 +33,7 @@ std::string ToUTF8String(const std::wstring& s) {
return ret;
}

std::wstring ToWideString(const std::string& s) {
std::wstring ToWideString(std::string_view s) {
if (s.size() >= static_cast<size_t>(std::numeric_limits<int>::max()))
ORT_THROW("length overflow");

Expand Down
14 changes: 14 additions & 0 deletions onnxruntime/core/common/path_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ inline PathString ToPathString(const PathString& s) {

static_assert(std::is_same<PathString, std::wstring>::value, "PathString is not std::wstring!");

inline PathString ToPathString(std::string_view s) {
return ToWideString(s);
}
inline PathString ToPathString(const char* s) {
return ToWideString(s);
}
inline PathString ToPathString(const std::string& s) {
return ToWideString(s);
}
Expand All @@ -56,6 +62,14 @@ inline std::string PathToUTF8String(const PathString& s) {

static_assert(std::is_same<PathString, std::string>::value, "PathString is not std::string!");

inline PathString ToPathString(const char* s) {
return s;
}

inline PathString ToPathString(std::string_view s) {
return PathString{s};
}

inline PathChar ToLowerPathChar(PathChar c) {
return std::tolower(c);
}
Expand Down
2 changes: 1 addition & 1 deletion onnxruntime/core/providers/migraphx/gpu_data_transfer.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#pragma once

#include "migraphx_inc.h"
#include "core/providers/migraphx/migraphx_inc.h"
#include "core/framework/data_transfer.h"

namespace onnxruntime {
Expand Down
Loading
Loading