Skip to content

Commit

Permalink
placeholder for setting proc table
Browse files Browse the repository at this point in the history
  • Loading branch information
fs-eire committed Sep 12, 2024
1 parent 8b61532 commit dce0f18
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
18 changes: 16 additions & 2 deletions onnxruntime/core/providers/webgpu/webgpu_provider_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#include <charconv>

#include <dawn/dawn_proc.h>

#include "core/framework/error_code_helper.h"
#include "core/providers/webgpu/buffer_manager.h"
#include "core/providers/webgpu/webgpu_execution_provider.h"
Expand Down Expand Up @@ -33,7 +35,19 @@ struct WebGpuProviderFactory : IExecutionProviderFactory {

std::shared_ptr<IExecutionProviderFactory> WebGpuProviderFactoryCreator::Create(const ConfigOptions& config_options) {
//
// STEP.1 - prepare WebGpuExecutionProviderInfo
// STEP.1 - set dawn proc table
//
std::string dawn_proc_table_str;
if (config_options.TryGetConfigEntry(kDawnProcTable, dawn_proc_table_str)) {
size_t dawn_proc_table = 0;
ORT_ENFORCE(std::errc{} ==
std::from_chars(dawn_proc_table_str.data(), dawn_proc_table_str.data() + dawn_proc_table_str.size(), dawn_proc_table).ec);
// TODO: do this for static link build
// dawnProcSetProcs(reinterpret_cast<const DawnProcTable*>(dawn_proc_table));
}

//
// STEP.2 - prepare WebGpuExecutionProviderInfo
//
WebGpuExecutionProviderInfo webgpu_ep_info{
// preferred layout is NHWC by default
Expand Down Expand Up @@ -100,7 +114,7 @@ std::shared_ptr<IExecutionProviderFactory> WebGpuProviderFactoryCreator::Create(
LOGS_DEFAULT(VERBOSE) << "WebGPU EP default buffer cache mode: " << webgpu_ep_info.default_buffer_cache_mode;

//
// STEP.2 - prepare WebGpuContext
// STEP.3 - prepare WebGpuContext
//
int context_id = 0;
std::string context_id_str;
Expand Down
2 changes: 2 additions & 0 deletions onnxruntime/core/providers/webgpu/webgpu_provider_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ constexpr const char* kWebGpuInstance = "webgpuInstance";
constexpr const char* kWebGpuAdapter = "webgpuAdapter";
constexpr const char* kWebGpuDevice = "webgpuDevice";

constexpr const char* kDawnProcTable = "dawnProcTable";

constexpr const char* kStorageBufferCacheMode = "storageBufferCacheMode";
constexpr const char* kUniformBufferCacheMode = "uniformBufferCacheMode";
constexpr const char* kQueryResolveBufferCacheMode = "queryResolveBufferCacheMode";
Expand Down

0 comments on commit dce0f18

Please sign in to comment.