Skip to content

Commit f0216fd

Browse files
Merge branch 'master' into sync_msft_10_4_25
2 parents 4e63ef6 + f12a89e commit f0216fd

File tree

85 files changed

+3868
-1441
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+3868
-1441
lines changed

cmake/CMakeLists.txt

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ option(onnxruntime_ENABLE_TRAINING_OPS "Include training operators but no traini
180180
option(onnxruntime_ENABLE_TRAINING_E2E_TESTS "Enable training end-to-end tests." OFF)
181181
option(onnxruntime_ENABLE_CPU_FP16_OPS "Build with advanced instruction sets" ON)
182182
option(onnxruntime_USE_NCCL "Build with NCCL support" OFF)
183-
option(onnxruntime_USE_MPI "Build with MPI support" OFF)
184183

185184
# WebAssembly options
186185
option(onnxruntime_BUILD_WEBASSEMBLY_STATIC_LIB "Enable this option to create WebAssembly static library" OFF)
@@ -1267,6 +1266,7 @@ function(onnxruntime_set_compile_flags target_name)
12671266
# Unsupported by Clang 18 yet.
12681267
list(REMOVE_ITEM ORT_HIP_WARNING_FLAGS -Wno-dangling-reference)
12691268

1269+
list(REMOVE_ITEM ORT_HIP_WARNING_FLAGS -Wno-interference-size)
12701270
# float16.h:90:12: error: ‘tmp’ is used uninitialized
12711271
list(APPEND ORT_HIP_WARNING_FLAGS -Wno-uninitialized)
12721272
list(APPEND ORT_HIP_WARNING_FLAGS -Wno-deprecated-copy)
@@ -1650,29 +1650,6 @@ if (onnxruntime_ENABLE_DLPACK)
16501650
endif()
16511651

16521652
if (UNIX OR onnxruntime_USE_NCCL)
1653-
# MPI is INDEPENDENT of NCCL for now. You can build NCLL without MPI and launch multi-GPU with your own launcher.
1654-
if (onnxruntime_USE_MPI)
1655-
if (EXISTS "${onnxruntime_MPI_HOME}")
1656-
set(MPI_HOME "${onnxruntime_MPI_HOME}")
1657-
elseif (EXISTS "/bert_ort/openmpi")
1658-
set(MPI_HOME "/bert_ort/openmpi")
1659-
endif()
1660-
find_package(MPI)
1661-
1662-
if (MPI_CXX_FOUND)
1663-
message( STATUS "MPI Version: ${MPI_CXX_VERSION}")
1664-
message( STATUS "MPI (include: ${MPI_CXX_INCLUDE_DIRS}, library: ${MPI_CXX_LIBRARIES})" )
1665-
mark_as_advanced(MPI_CXX_INCLUDE_DIRS MPI_CXX_LIBRARIES)
1666-
list(APPEND onnxruntime_EXTERNAL_LIBRARIES ${MPI_CXX_LIBRARIES} ${MPI_CXX_LINK_FLAGS})
1667-
else ()
1668-
message(
1669-
FATAL_ERROR
1670-
"MPI is not found. Please define onnxruntime_MPI_HOME to specify the path of MPI. Otherwise, NCCL will be disabled."
1671-
"or you can remove --use_mpi from build args to disable MPI."
1672-
)
1673-
endif()
1674-
endif()
1675-
16761653
# Find NCCL
16771654
if (onnxruntime_USE_NCCL)
16781655
if (onnxruntime_USE_CUDA)
@@ -1742,13 +1719,9 @@ if (UNIX OR onnxruntime_USE_NCCL)
17421719
endif()
17431720
else()
17441721
set(onnxruntime_USE_NCCL OFF)
1745-
set(onnxruntime_USE_MPI OFF)
1746-
message( WARNING "MPI and NCCL are disabled because build is on Windows or USE_NCCL is set to OFF." )
1722+
message( WARNING "NCCL is disabled because build is on Windows or USE_NCCL is set to OFF." )
17471723
endif()
17481724

1749-
if (onnxruntime_USE_MPI)
1750-
add_definitions(-DUSE_MPI=1)
1751-
endif()
17521725

17531726
# Default version parts for Microsoft.AI.MachineLearning.dll, onnxruntime.dll, onnxruntime_providers_openvino.dll and onnxruntime_providers_shared.dll in non-ADO pipeline local builds
17541727
set(VERSION_MAJOR_PART 0 CACHE STRING "First part of numeric file/product version.")

cmake/external/onnxruntime_external_deps.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,11 @@ if (onnxruntime_USE_WEBGPU)
719719
# - (private) Remove hard-coded CMAKE_OSX_DEPLOYMENT_TARGET in Dawn's CMake files
720720
# https://github.com/microsoft/onnxruntime/pull/23729
721721
#
722+
# - (private) Reduce unsafe buffer usage warning in aligned_storage.h
723+
# https://github.com/microsoft/onnxruntime/pull/24308
724+
# The patch disables the UNSAFE_BUFFER_USAGE warning around the AlignedStorage struct in aligned_storage.h. This is done
725+
# by using TINT_BEGIN_DISABLE_WARNING and TINT_END_DISABLE_WARNING macros, which helps in warnings related to unsafe buffer usage
726+
# usage when compiling the code, making the build process cleaner and faster.
722727
#
723728
PATCH_COMMAND ${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PROJECT_SOURCE_DIR}/patches/dawn/dawn.patch
724729
EXCLUDE_FROM_ALL

cmake/onnxruntime_framework.cmake

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@ if (onnxruntime_ENABLE_TRAINING_OPS)
7777
onnxruntime_add_include_to_target(onnxruntime_framework Python::Module dlpack::dlpack)
7878
endif()
7979
endif()
80-
if (onnxruntime_USE_MPI)
81-
target_include_directories(onnxruntime_framework PUBLIC ${MPI_CXX_INCLUDE_DIRS})
82-
endif()
8380

8481
if (onnxruntime_ENABLE_ATEN)
8582
onnxruntime_add_include_to_target(onnxruntime_framework dlpack::dlpack)

cmake/onnxruntime_providers_cpu.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ if (onnxruntime_ENABLE_TRAINING)
206206
onnxruntime_add_include_to_target(onnxruntime_providers Python::Module)
207207
endif()
208208

209-
if (onnxruntime_USE_NCCL OR onnxruntime_USE_MPI)
209+
if (onnxruntime_USE_NCCL)
210210
target_include_directories(onnxruntime_providers PUBLIC ${MPI_CXX_INCLUDE_DIRS})
211211
endif()
212212
endif()

cmake/onnxruntime_providers_cuda.cmake

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,6 @@
252252
target_include_directories(${target} PRIVATE ${ORTTRAINING_ROOT} ${MPI_CXX_INCLUDE_DIRS})
253253
endif()
254254

255-
if(onnxruntime_USE_MPI)
256-
target_link_libraries(${target} PRIVATE ${MPI_LIBRARIES} ${MPI_CXX_LINK_FLAGS})
257-
endif()
258-
259255
if (onnxruntime_USE_NCCL)
260256
target_include_directories(${target} PRIVATE ${NCCL_INCLUDE_DIRS})
261257
target_link_libraries(${target} PRIVATE ${NCCL_LIBRARIES})

cmake/onnxruntime_providers_rocm.cmake

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,6 @@
158158

159159
if (onnxruntime_ENABLE_TRAINING)
160160
target_include_directories(onnxruntime_providers_rocm PRIVATE ${ORTTRAINING_ROOT} ${CMAKE_CURRENT_BINARY_DIR}/amdgpu/orttraining ${MPI_CXX_INCLUDE_DIRS})
161-
if(onnxruntime_USE_MPI)
162-
target_link_libraries(onnxruntime_providers_rocm PRIVATE ${MPI_LIBRARIES} ${MPI_CXX_LINK_FLAGS})
163-
endif()
164161

165162
# RCCL is enabled by default for ROCM builds
166163
#if (onnxruntime_USE_NCCL)

cmake/patches/dawn/dawn.patch

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,24 @@ index 5bfac41dcc..71a153daaa 100644
3636
void WGPUBufferImpl::Destroy() {
3737
emwgpuBufferDestroy(this);
3838
AbortPendingMap("Buffer was destroyed before mapping was resolved.");
39+
diff --git a/src/tint/utils/memory/aligned_storage.h b/src/tint/utils/memory/aligned_storage.h
40+
index c532c4fc38..19c950af4c 100644
41+
--- a/src/tint/utils/memory/aligned_storage.h
42+
+++ b/src/tint/utils/memory/aligned_storage.h
43+
@@ -31,6 +31,9 @@
44+
#include <cstddef>
45+
46+
#include "src/tint/utils/memory/bitcast.h"
47+
+#include "src/tint/utils/macros/compiler.h"
48+
+
49+
+TINT_BEGIN_DISABLE_WARNING(UNSAFE_BUFFER_USAGE);
50+
51+
namespace tint {
52+
53+
@@ -50,4 +53,6 @@ struct alignas(alignof(T)) AlignedStorage {
54+
55+
} // namespace tint
56+
57+
+TINT_END_DISABLE_WARNING(UNSAFE_BUFFER_USAGE);
58+
+
59+
#endif // SRC_TINT_UTILS_MEMORY_ALIGNED_STORAGE_H_

java/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ test {
211211
'USE_TENSORRT',
212212
'USE_QNN',
213213
'USE_XNNPACK',
214+
'USE_WEBGPU',
214215
])
215216
testLogging {
216217
events "passed", "skipped", "failed"

java/src/main/java/ai/onnxruntime/OrtSession.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,6 +1339,18 @@ public void addCoreML(Map<String, String> providerOptions) throws OrtException {
13391339
addExecutionProvider(CoreMLProviderName, providerOptions);
13401340
}
13411341

1342+
/**
1343+
* Adds WebGPU as an execution backend.
1344+
*
1345+
* @param providerOptions Configuration options for the WebGPU backend. Refer to the WebGPU
1346+
* execution provider's documentation.
1347+
* @throws OrtException If there was an error in native code.
1348+
*/
1349+
public void addWebGPU(Map<String, String> providerOptions) throws OrtException {
1350+
String webGpuProviderName = "WebGPU";
1351+
addExecutionProvider(webGpuProviderName, providerOptions);
1352+
}
1353+
13421354
private native void setExecutionMode(long apiHandle, long nativeHandle, int mode)
13431355
throws OrtException;
13441356

java/src/test/android/app/src/androidTest/java/ai/onnxruntime/example/javavalidator/SimpleTest.kt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ class SimpleTest {
5252
runSigmoidModelTestImpl(1, OrtProvider.QNN)
5353
}
5454

55+
@Test
56+
fun runSigmoidModelTestWEBGPU() {
57+
runSigmoidModelTestImpl(1, OrtProvider.WEBGPU)
58+
}
59+
5560
@Throws(IOException::class)
5661
private fun readModel(fileName: String): ByteArray {
5762
return InstrumentationRegistry.getInstrumentation().context.assets.open(fileName)
@@ -90,6 +95,16 @@ class SimpleTest {
9095
}
9196
}
9297

98+
OrtProvider.WEBGPU -> {
99+
if (OrtEnvironment.getAvailableProviders().contains(OrtProvider.WEBGPU)) {
100+
val providerOptions = Collections.emptyMap<String, String>()
101+
opts.addWebGPU(providerOptions)
102+
} else {
103+
Log.println(Log.INFO, TAG, "NO WEBGPU EP available, skip the test")
104+
return
105+
}
106+
}
107+
93108
OrtProvider.CPU -> {
94109
// No additional configuration is needed for CPU
95110
}

0 commit comments

Comments
 (0)