From 667b2022695c5057b3120f2d3c4f4664d45a30bf Mon Sep 17 00:00:00 2001 From: Bryan Bernhart <bryan.bernhart@intel.com> Date: Sat, 10 Aug 2024 00:45:51 +0000 Subject: [PATCH] WebNN: avoid staging buffers on first inference Fixes an issue where a staging buffer was always created on first use because its last used fence value was initially set to UINT64_MAX which could never be considered "not in use" until a submission occurred first. Instead, this fence value should of been set the initial value of the queue's fence, which is considered "not in use" without requiring a submission first. Bug: 358594662 Change-Id: I960d4b55f468f92a8a34bcae896816f2d5e18fc6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5777470 Commit-Queue: ningxin hu <ningxin.hu@intel.com> Reviewed-by: ningxin hu <ningxin.hu@intel.com> Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com> Cr-Commit-Position: refs/heads/main@{#1339981} --- services/webnn/dml/buffer_impl_dml.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/webnn/dml/buffer_impl_dml.h b/services/webnn/dml/buffer_impl_dml.h index 94c8360f649ce..ec99239e8e82e 100644 --- a/services/webnn/dml/buffer_impl_dml.h +++ b/services/webnn/dml/buffer_impl_dml.h @@ -52,7 +52,7 @@ class BufferImplDml final : public WebNNBufferImpl { // The fence value used to track progress of GPU execution of commands using // this buffer. Comparing it with the command queue's completed fence can // indicate whether commands have completed execution. - uint64_t last_submission_fence_value_ = UINT64_MAX; + uint64_t last_submission_fence_value_ = 0; base::WeakPtrFactory<BufferImplDml> weak_factory_{this}; }; -- GitLab