From 37684bbb72121a17066bcaeadc28cb642e042db0 Mon Sep 17 00:00:00 2001 From: Changming Sun Date: Tue, 21 Jan 2025 19:49:55 +0000 Subject: [PATCH 1/3] update headres --- onnxruntime/core/providers/webgpu/buffer_manager.h | 2 +- onnxruntime/core/providers/webgpu/compute_context.h | 2 +- onnxruntime/core/providers/webgpu/program_manager.h | 2 +- onnxruntime/core/providers/webgpu/shader_helper.h | 2 +- onnxruntime/core/providers/webgpu/webgpu_context.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/onnxruntime/core/providers/webgpu/buffer_manager.h b/onnxruntime/core/providers/webgpu/buffer_manager.h index 20bee52835c02..a5bba53c6798b 100644 --- a/onnxruntime/core/providers/webgpu/buffer_manager.h +++ b/onnxruntime/core/providers/webgpu/buffer_manager.h @@ -5,7 +5,7 @@ #include -#include +#include "core/providers/webgpu/webgpu_external_header.h" #include "core/framework/execution_provider.h" diff --git a/onnxruntime/core/providers/webgpu/compute_context.h b/onnxruntime/core/providers/webgpu/compute_context.h index 680e03aef0aa3..23fa10a0d5489 100644 --- a/onnxruntime/core/providers/webgpu/compute_context.h +++ b/onnxruntime/core/providers/webgpu/compute_context.h @@ -3,7 +3,7 @@ #pragma once -#include +#include "core/providers/webgpu/webgpu_external_header.h" #include diff --git a/onnxruntime/core/providers/webgpu/program_manager.h b/onnxruntime/core/providers/webgpu/program_manager.h index 55721770014d2..feeb703b95aa2 100644 --- a/onnxruntime/core/providers/webgpu/program_manager.h +++ b/onnxruntime/core/providers/webgpu/program_manager.h @@ -6,7 +6,7 @@ #include #include -#include +#include "core/providers/webgpu/webgpu_external_header.h" #include "core/common/common.h" diff --git a/onnxruntime/core/providers/webgpu/shader_helper.h b/onnxruntime/core/providers/webgpu/shader_helper.h index dac08f3bd9368..64b4c054f93d4 100644 --- a/onnxruntime/core/providers/webgpu/shader_helper.h +++ b/onnxruntime/core/providers/webgpu/shader_helper.h @@ -5,7 +5,7 @@ #include -#include +#include "core/providers/webgpu/webgpu_external_header.h" #include "core/framework/tensor_shape.h" diff --git a/onnxruntime/core/providers/webgpu/webgpu_context.h b/onnxruntime/core/providers/webgpu/webgpu_context.h index cb0e14f82610b..15819033d2573 100644 --- a/onnxruntime/core/providers/webgpu/webgpu_context.h +++ b/onnxruntime/core/providers/webgpu/webgpu_context.h @@ -6,7 +6,7 @@ #include #include -#include +#include "core/providers/webgpu/webgpu_external_header.h" #include "core/common/common.h" #include "core/framework/library_handles.h" From ddeb11434ee47b419cc678a9e1fefe2411f39b2a Mon Sep 17 00:00:00 2001 From: Yulong Wang <7679871+fs-eire@users.noreply.github.com> Date: Mon, 10 Mar 2025 21:10:45 -0700 Subject: [PATCH 2/3] add missing file --- onnxruntime/core/providers/webgpu/webgpu_pix_frame_generator.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/onnxruntime/core/providers/webgpu/webgpu_pix_frame_generator.h b/onnxruntime/core/providers/webgpu/webgpu_pix_frame_generator.h index 0d9393321284d..16d5420191dc1 100644 --- a/onnxruntime/core/providers/webgpu/webgpu_pix_frame_generator.h +++ b/onnxruntime/core/providers/webgpu/webgpu_pix_frame_generator.h @@ -14,7 +14,7 @@ #include -#include +#include "core/providers/webgpu/webgpu_external_header.h" namespace onnxruntime { From 08ec6563449ac795bfe528d47e5fafbdbe4a878a Mon Sep 17 00:00:00 2001 From: Yulong Wang <7679871+fs-eire@users.noreply.github.com> Date: Mon, 10 Mar 2025 22:08:28 -0700 Subject: [PATCH 3/3] fix pad --- .../core/providers/webgpu/tensor/pad.cc | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/onnxruntime/core/providers/webgpu/tensor/pad.cc b/onnxruntime/core/providers/webgpu/tensor/pad.cc index 6a8bc6554b772..cb019892b006f 100644 --- a/onnxruntime/core/providers/webgpu/tensor/pad.cc +++ b/onnxruntime/core/providers/webgpu/tensor/pad.cc @@ -146,27 +146,21 @@ Status Pad::ComputeInternal(ComputeContext& context) const { uint16_t value = math::floatToHalf(value_); std::memcpy(&value_uint32, &value, sizeof(value)); } else { - value_uint32 = *reinterpret_cast(&value_); + std::memcpy(&value_uint32, &value_, sizeof(value_uint32)); } } else if (value_tensor) { ORT_ENFORCE(value_tensor->DataType() == input_tensor->DataType() && value_tensor->Shape().Size() == 1, "Value tensor should be a 1D tensor of size 1 with the same type as that of the input tensor"); switch (data_type) { - case ONNX_NAMESPACE::TensorProto_DataType_INT32: { - int32_t value = value_tensor->Data()[0]; - value_uint32 = *reinterpret_cast(&value); - } break; - case ONNX_NAMESPACE::TensorProto_DataType_FLOAT: { - float value = value_tensor->Data()[0]; - value_uint32 = *reinterpret_cast(&value); - } break; case ONNX_NAMESPACE::TensorProto_DataType_FLOAT16: { uint16_t value = value_tensor->Data()[0].val; std::memcpy(&value_uint32, &value, sizeof(value)); } break; - case ONNX_NAMESPACE::TensorProto_DataType_UINT32: { - value_uint32 = value_tensor->Data()[0]; - } break; + case ONNX_NAMESPACE::TensorProto_DataType_INT32: + case ONNX_NAMESPACE::TensorProto_DataType_FLOAT: + case ONNX_NAMESPACE::TensorProto_DataType_UINT32: + std::memcpy(&value_uint32, value_tensor->DataRaw(), sizeof(value_uint32)); + break; default: return ORT_MAKE_STATUS(ONNXRUNTIME, INVALID_ARGUMENT, "Unsupported input type: ", static_cast(data_type)); }