Skip to content

Commit 35bee1c

Browse files
committed
Merge remote-tracking branch 'origin/main' into fs-eire/patch-dawn-em
2 parents bb66eb1 + ed3f8bf commit 35bee1c

9 files changed

Lines changed: 59 additions & 452 deletions

File tree

js/react_native/android/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
cmake_minimum_required(VERSION 3.13)
12
project(OnnxruntimeJSI)
2-
cmake_minimum_required(VERSION 3.9.0)
33

44
set(PACKAGE_NAME "onnxruntime-react-native")
55
set(BUILD_DIR ${CMAKE_SOURCE_DIR}/build)
@@ -97,3 +97,6 @@ target_link_libraries(
9797
${log-lib} # <-- Logcat logger
9898
android # <-- Android JNI core
9999
)
100+
101+
# 16KB page size support (Android 15+ requirement)
102+
target_link_options(onnxruntimejsi PRIVATE "-Wl,-z,max-page-size=16384")

onnxruntime/core/providers/cuda/tensor/grid_sample.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ template <typename T, bool IsNHWC>
5151
GridSample<T, IsNHWC>::GridSample(const OpKernelInfo& info) : CudaKernel(info) {
5252
opset_start_version_ = info.node().SinceVersion();
5353

54-
std::string mode_str = info.GetAttrOrDefault<std::string>("mode", "bilinear");
5554
std::string padding_mode_str = info.GetAttrOrDefault<std::string>("padding_mode", "zeros");
5655
align_corners_ = static_cast<bool>(info.GetAttrOrDefault<int64_t>("align_corners", 0));
5756

onnxruntime/core/providers/nv_tensorrt_rtx/nv_execution_provider_utils.h

Lines changed: 0 additions & 435 deletions
Large diffs are not rendered by default.

onnxruntime/core/providers/nv_tensorrt_rtx/nv_provider_factory.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include "core/framework/plugin_ep_stream.h"
1717
#include "core/providers/nv_tensorrt_rtx/nv_provider_options.h"
1818
#include "core/providers/nv_tensorrt_rtx/nv_execution_provider_custom_ops.h"
19-
#include "core/providers/nv_tensorrt_rtx/nv_execution_provider_utils.h"
2019
#include "core/providers/cuda/cuda_stream_handle.h"
2120

2221
// D3D12 headers for graphics interop on Windows
@@ -30,6 +29,7 @@
3029
#include "nv_provider_factory_creator.h"
3130
#include "nv_data_transfer.h"
3231
#include "nv_allocator.h"
32+
#include "nv_scoped_context.h"
3333

3434
using namespace onnxruntime;
3535

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
// Licensed under the MIT License.
4+
5+
#include "nv_includes.h"
6+
#include "core/providers/cuda/cuda_pch.h"
7+
#include "core/providers/cuda/shared_inc/cuda_call.h"
8+
9+
namespace onnxruntime {
10+
struct ScopedContext {
11+
explicit ScopedContext(int device_id) : pushed_(true) {
12+
CUcontext cu_context = 0;
13+
CU_CALL_THROW(cuCtxGetCurrent(&cu_context));
14+
if (!cu_context) {
15+
// cuCtxGetCurrent succeeded but returned nullptr, which indicates that no CUDA context
16+
// is currently set for this thread. This implicates that there is not user created context.
17+
// We use runtime API to initialize a context for the specified device.
18+
CUDA_CALL_THROW(cudaSetDevice(device_id));
19+
CU_CALL_THROW(cuCtxGetCurrent(&cu_context));
20+
}
21+
CU_CALL_THROW(cuCtxPushCurrent(cu_context));
22+
}
23+
24+
/** \brief Push an existing context (e.g. CIG context); pop on destruction. */
25+
explicit ScopedContext(CUcontext ctx) : pushed_(ctx != nullptr) {
26+
if (ctx != nullptr) {
27+
CU_CALL_THROW(cuCtxPushCurrent(ctx));
28+
}
29+
}
30+
31+
ScopedContext(const ScopedContext&) = delete;
32+
33+
~ScopedContext() {
34+
if (pushed_) {
35+
cuCtxPopCurrent(nullptr);
36+
}
37+
}
38+
39+
private:
40+
bool pushed_ = true;
41+
};
42+
} // namespace onnxruntime

onnxruntime/python/tools/transformers/fusion_skiplayernorm.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,8 @@ def fuse(self, node, input_name_to_nodes, output_name_to_node):
110110
)
111111
return
112112
else:
113-
# Shape inference failed. Use default skip_index=1 (no broadcasting) since both
114-
# Add inputs have already been verified as non-initializer dynamic tensors above.
115-
logger.debug("symbolic shape inference failed, using default skip_index for SkipLayerNormalization")
113+
logger.debug("skip SkipLayerNormalization fusion since symbolic shape inference failed")
114+
return
116115

117116
gather_path = self.model.match_parent_path(add, ["Gather"], [None])
118117
if gather_path is not None and self.model.find_graph_input(gather_path[0].input[1]) is None:

onnxruntime/test/providers/cpu/tensor/grid_sample_test_custom.inc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ TYPED_TEST(GridSampleCustomTest, test_grid_sample_20_4D_linear_zeros_mixed_bound
3737
test.AddAttribute("padding_mode", padding_mode);
3838
test.AddAttribute("align_corners", align_corners);
3939
test.AddOutput<TypeParam>("Y", Y_shape, Y_data);
40-
RunTests(test, GetExecutionProviders(20));
40+
RunTests(test, GetExecutionProviders());
4141
}
4242

4343
TYPED_TEST(GridSampleCustomTest, test_grid_sample_20_4D_linear_zeros_mixed_bounds_left_top) {
@@ -69,6 +69,5 @@ TYPED_TEST(GridSampleCustomTest, test_grid_sample_20_4D_linear_zeros_mixed_bound
6969
test.AddAttribute("padding_mode", padding_mode);
7070
test.AddAttribute("align_corners", align_corners);
7171
test.AddOutput<TypeParam>("Y", Y_shape, Y_data);
72-
RunTests(test, GetExecutionProviders(20));
72+
RunTests(test, GetExecutionProviders());
7373
}
74-

onnxruntime/test/providers/nv_tensorrt_rtx/nv_external_resource_importer_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,7 @@ TEST_F(NvExecutionProviderExternalResourceImporterTest, FullInferenceWithExterna
10821082
// Configure to use our CUDA stream
10831083
char stream_address[32];
10841084
size_t stream_addr_val = reinterpret_cast<size_t>(ort_api_->SyncStream_GetHandle(ort_stream));
1085-
sprintf(stream_address, "%llu", static_cast<uint64_t>(stream_addr_val));
1085+
sprintf_s(stream_address, "%llu", static_cast<uint64_t>(stream_addr_val));
10861086
const char* option_keys[] = {
10871087
// TODO we should no longer require to set the compute stream at this point but there are too many cudaSetDevice calls from allocators and stream handling (NVBUG 5822116)
10881088
onnxruntime::nv::provider_option_names::kUserComputeStream,
@@ -1095,7 +1095,7 @@ TEST_F(NvExecutionProviderExternalResourceImporterTest, FullInferenceWithExterna
10951095
};
10961096
char aux_stream_address[32];
10971097
size_t aux_streams[] = {stream_addr_val};
1098-
sprintf(aux_stream_address, "%llu", reinterpret_cast<uint64_t>(aux_streams));
1098+
sprintf_s(aux_stream_address, "%llu", reinterpret_cast<uint64_t>(aux_streams));
10991099
std::string max_shared_mem_size = std::to_string(1024 * 28); // 28 KiB
11001100
const char* option_values[] = {
11011101
stream_address,

onnxruntime/test/python/transformers/test_attention_fusion.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -395,17 +395,17 @@ def test_qwen3_normalization_fusion(self):
395395
ssln_count = sum(1 for n in nodes if n.op_type == "SkipSimplifiedLayerNormalization")
396396

397397
# 4 RMSNorm patterns: pre-attn, Q-norm, K-norm, post-attn.
398-
# Post-attn RMSNorm has an Add parent (residual) → fused as SkipSimplifiedLayerNormalization.
399-
# Remaining 3 stay as SimplifiedLayerNormalization.
398+
# Fallback for SkipLayerNormalization is disabled, so post-attn RMSNorm does not fuse.
399+
# All 4 stay as SimplifiedLayerNormalization.
400400
self.assertEqual(
401401
sln_count,
402-
3,
403-
f"Expected 3 SimplifiedLayerNormalization (pre-attn + Q-norm + K-norm), got {sln_count}",
402+
4,
403+
f"Expected 4 SimplifiedLayerNormalization (pre-attn + Q-norm + K-norm + post-attn), got {sln_count}",
404404
)
405405
self.assertEqual(
406406
ssln_count,
407-
1,
408-
f"Expected 1 SkipSimplifiedLayerNormalization (residual + post-attn RMSNorm), got {ssln_count}",
407+
0,
408+
f"Expected 0 SkipSimplifiedLayerNormalization (residual + post-attn RMSNorm failed to fuse), got {ssln_count}",
409409
)
410410

411411

0 commit comments

Comments
 (0)