diff --git a/onnxruntime/core/providers/nv_tensorrt_rtx/nv_execution_provider.cc b/onnxruntime/core/providers/nv_tensorrt_rtx/nv_execution_provider.cc index 93b673f2df5bd..f827b807f2408 100644 --- a/onnxruntime/core/providers/nv_tensorrt_rtx/nv_execution_provider.cc +++ b/onnxruntime/core/providers/nv_tensorrt_rtx/nv_execution_provider.cc @@ -3,6 +3,7 @@ // Licensed under the MIT License. #include #include +#include #include #include "core/providers/shared_library/provider_api.h" #include "core/providers/nv_tensorrt_rtx/nv_provider_options.h" @@ -1056,6 +1057,11 @@ NvExecutionProvider::NvExecutionProvider(const NvExecutionProviderInfo& info) << ", nv_op_types_to_exclude: " << op_types_to_exclude_; } +Status NvExecutionProvider::Sync() const { + CUDA_RETURN_IF_ERROR(cudaStreamSynchronize(stream_)); + return Status::OK(); +} + NvExecutionProvider::~NvExecutionProvider() { // clean up thread local context caches { @@ -1574,8 +1580,8 @@ SubGraphCollection_t NvExecutionProvider::GetSupportedList(SubGraphCollection_t // the initializer was marked as external data by the ORT graph at load time since it was provided in memory size_t size = 0; const void* ptr = nullptr; - c_api.GetTensorSizeInBytes(&initializer_value, &size); - c_api.GetTensorData(&initializer_value, &ptr); + Ort::ThrowOnError(c_api.GetTensorSizeInBytes(&initializer_value, &size)); + Ort::ThrowOnError(c_api.GetTensorData(&initializer_value, &ptr)); userWeights.emplace_back(tp->name(), ptr, size); } else if (utils::HasExternalDataInMemory(*tp)) { // only copy and take ownership of the data if none of the above conditions are met @@ -2394,8 +2400,8 @@ Status NvExecutionProvider::CreateNodeComputeInfoFromGraph(const GraphViewer& gr // the initializer was marked as external data by the ORT graph at load time since it was provided in memory size_t size = 0; const void* ptr = nullptr; - c_api.GetTensorSizeInBytes(&initializer_value, &size); - c_api.GetTensorData(&initializer_value, &ptr); + Ort::ThrowOnError(c_api.GetTensorSizeInBytes(&initializer_value, &size)); + Ort::ThrowOnError(c_api.GetTensorData(&initializer_value, &ptr)); userWeights.emplace_back(tp->name(), ptr, size); } else if (utils::HasExternalDataInMemory(*tp)) { // only copy and take ownership of the data if none of the above conditions are met diff --git a/onnxruntime/core/providers/nv_tensorrt_rtx/nv_execution_provider.h b/onnxruntime/core/providers/nv_tensorrt_rtx/nv_execution_provider.h index 9e5fd03756f02..dc323cd643032 100644 --- a/onnxruntime/core/providers/nv_tensorrt_rtx/nv_execution_provider.h +++ b/onnxruntime/core/providers/nv_tensorrt_rtx/nv_execution_provider.h @@ -285,6 +285,7 @@ class NvExecutionProvider : public IExecutionProvider { IResourceAccountant* /* resource_accountant */) const override; int GetDeviceId() const { return device_id_; } + Status Sync() const; common::Status Compile(const std::vector& fused_nodes_and_graphs, std::vector& node_compute_funcs) override;