Bug 200200 - [WebGPU] Replace Vectors with HashSets for tracking resources used by GPUCommandBuffer
Summary: [WebGPU] Replace Vectors with HashSets for tracking resources used by GPUComm...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Justin Fan
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-07-27 17:37 PDT by Justin Fan
Modified: 2019-07-29 17:07 PDT (History)
7 users (show)

See Also:


Attachments
Patch (3.42 KB, patch)
2019-07-27 17:41 PDT, Justin Fan
no flags Details | Formatted Diff | Diff
Patch (8.44 KB, patch)
2019-07-27 19:17 PDT, Justin Fan
no flags Details | Formatted Diff | Diff
Patch (9.27 KB, patch)
2019-07-27 19:28 PDT, Justin Fan
no flags Details | Formatted Diff | Diff
Patch for landing (8.56 KB, patch)
2019-07-29 12:31 PDT, Justin Fan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Justin Fan 2019-07-27 17:37:11 PDT
[WebGPU] Replace Vectors with HashSets for tracking resources used by GPUCommandBuffer
Comment 1 Justin Fan 2019-07-27 17:41:17 PDT
Created attachment 375036 [details]
Patch
Comment 2 Justin Fan 2019-07-27 19:17:54 PDT
Created attachment 375038 [details]
Patch
Comment 3 Justin Fan 2019-07-27 19:28:50 PDT
Created attachment 375039 [details]
Patch
Comment 4 Myles C. Maxfield 2019-07-29 11:10:28 PDT
Comment on attachment 375039 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=375039&action=review

> Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp:-347
> -    auto addResult = m_unnamedTypeMapping.add(&unnamedType, &*iterator);

How did this ever compile? I thought unused variables produced errors

> Source/WebCore/platform/graphics/gpu/GPUCommandBuffer.h:103
> +    void useBuffer(Ref<GPUBuffer>&& buffer) { m_usedBuffers.addVoid(WTFMove(buffer)); }
> +    void useTexture(Ref<GPUTexture>&& texture) { m_usedTextures.addVoid(WTFMove(texture)); }

I see a lot of production, but no consumption. Do the functions that we're using for consumption just happen to be named the same between Vectors and HashSets?
Comment 5 Justin Fan 2019-07-29 12:14:07 PDT
Comment on attachment 375039 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=375039&action=review

>> Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp:-347
>> -    auto addResult = m_unnamedTypeMapping.add(&unnamedType, &*iterator);
> 
> How did this ever compile? I thought unused variables produced errors

No idea. Maybe saam has some local flags turned off. EWS doesn't build WebGPU anymore right?

>> Source/WebCore/platform/graphics/gpu/GPUCommandBuffer.h:103
>> +    void useTexture(Ref<GPUTexture>&& texture) { m_usedTextures.addVoid(WTFMove(texture)); }
> 
> I see a lot of production, but no consumption. Do the functions that we're using for consumption just happen to be named the same between Vectors and HashSets?

Command buffers can't be reused in our impl, so I iterate through this container to process them rather than removing from them. They get released when the command buffer is released.

Bind groups are immutable once created so no issues there.
Comment 6 Justin Fan 2019-07-29 12:31:34 PDT
Created attachment 375090 [details]
Patch for landing
Comment 7 WebKit Commit Bot 2019-07-29 17:06:37 PDT
Comment on attachment 375090 [details]
Patch for landing

Clearing flags on attachment: 375090

Committed r247930: <https://trac.webkit.org/changeset/247930>
Comment 8 WebKit Commit Bot 2019-07-29 17:06:39 PDT
All reviewed patches have been landed.  Closing bug.
Comment 9 Radar WebKit Bug Importer 2019-07-29 17:07:26 PDT
<rdar://problem/53686819>