Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion onnxruntime/core/providers/webgpu/buffer_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include <iosfwd>

#include <webgpu/webgpu_cpp.h>
#include "core/providers/webgpu/webgpu_external_header.h"

#include "core/framework/execution_provider.h"

Expand Down
2 changes: 1 addition & 1 deletion onnxruntime/core/providers/webgpu/compute_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#pragma once

#include <webgpu/webgpu_cpp.h>
#include "core/providers/webgpu/webgpu_external_header.h"

#include <utility>

Expand Down
2 changes: 1 addition & 1 deletion onnxruntime/core/providers/webgpu/program_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <string>
#include <unordered_map>

#include <webgpu/webgpu_cpp.h>
#include "core/providers/webgpu/webgpu_external_header.h"

#include "core/common/common.h"

Expand Down
2 changes: 1 addition & 1 deletion onnxruntime/core/providers/webgpu/shader_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include <sstream>

#include <webgpu/webgpu_cpp.h>
#include "core/providers/webgpu/webgpu_external_header.h"

#include "core/framework/tensor_shape.h"

Expand Down
18 changes: 6 additions & 12 deletions onnxruntime/core/providers/webgpu/tensor/pad.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<const uint32_t*>(&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<int32_t>()[0];
value_uint32 = *reinterpret_cast<uint32_t*>(&value);
} break;
case ONNX_NAMESPACE::TensorProto_DataType_FLOAT: {
float value = value_tensor->Data<float>()[0];
value_uint32 = *reinterpret_cast<uint32_t*>(&value);
} break;
case ONNX_NAMESPACE::TensorProto_DataType_FLOAT16: {
uint16_t value = value_tensor->Data<MLFloat16>()[0].val;
std::memcpy(&value_uint32, &value, sizeof(value));
} break;
case ONNX_NAMESPACE::TensorProto_DataType_UINT32: {
value_uint32 = value_tensor->Data<uint32_t>()[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<int>(data_type));
}
Expand Down
2 changes: 1 addition & 1 deletion onnxruntime/core/providers/webgpu/webgpu_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <memory>
#include <mutex>

#include <webgpu/webgpu_cpp.h>
#include "core/providers/webgpu/webgpu_external_header.h"

#include "core/common/common.h"
#include "core/framework/library_handles.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include <memory>

#include <webgpu/webgpu_cpp.h>
#include "core/providers/webgpu/webgpu_external_header.h"

namespace onnxruntime {

Expand Down