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
6 changes: 4 additions & 2 deletions onnxruntime/core/providers/webgpu/webgpu_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ void WebGpuContext::Initialize(const WebGpuBufferCacheConfig& buffer_cache_confi

LOGS_DEFAULT(VERBOSE) << "WebGPU EP Context is created for: Instance=" << instance_.Get() << ", Device=" << device_.Get() << ".";

// cache device queue
device_queue_ = device_.GetQueue();
// cache adapter info
ORT_ENFORCE(Device().GetAdapterInfo(&adapter_info_));
// cache device limits
Expand Down Expand Up @@ -404,7 +406,7 @@ Status WebGpuContext::Run(ComputeContext& context, const ProgramBase& program) {
}

uniform_buffer = buffer_mgr_->Create(uniform_buffer_total_size, wgpu::BufferUsage::CopyDst | wgpu::BufferUsage::Uniform);
device_.GetQueue().WriteBuffer(uniform_buffer, 0, uniform_data_buffer.data(), uniform_buffer_total_size);
device_queue_.WriteBuffer(uniform_buffer, 0, uniform_data_buffer.data(), uniform_buffer_total_size);
}

const auto& compute_pass_encoder = GetComputePassEncoder();
Expand Down Expand Up @@ -696,7 +698,7 @@ void WebGpuContext::Flush() {
}

auto command_buffer = current_command_encoder_.Finish();
Device().GetQueue().Submit(1, &command_buffer);
device_queue_.Submit(1, &command_buffer);
BufferManager().RefreshPendingBuffers();
current_command_encoder_ = nullptr;
num_pending_dispatches_ = 0;
Expand Down
1 change: 1 addition & 0 deletions onnxruntime/core/providers/webgpu/webgpu_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ class WebGpuContext final {

webgpu::ValidationMode validation_mode_;

wgpu::Queue device_queue_;
wgpu::AdapterInfo adapter_info_;
wgpu::Limits device_limits_;
std::unordered_set<wgpu::FeatureName> device_features_;
Expand Down
Loading