Bug 170444 - WebGPU: implement ComputeCommandEncoder and related components
Summary: WebGPU: implement ComputeCommandEncoder and related components
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGL (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-04 02:31 PDT by Yuichiro Kikura
Modified: 2017-04-07 17:21 PDT (History)
5 users (show)

See Also:


Attachments
Patch (76.29 KB, patch)
2017-04-04 02:49 PDT, Yuichiro Kikura
no flags Details | Formatted Diff | Diff
Patch (84.16 KB, patch)
2017-04-06 19:04 PDT, Yuichiro Kikura
no flags Details | Formatted Diff | Diff
Patch (84.07 KB, patch)
2017-04-07 01:48 PDT, Yuichiro Kikura
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yuichiro Kikura 2017-04-04 02:31:12 PDT
WebGPU: implement ComputeCommandEncoder and related components
Comment 1 Yuichiro Kikura 2017-04-04 02:49:38 PDT
Created attachment 306167 [details]
Patch
Comment 2 Alex Christensen 2017-04-05 09:00:28 PDT
Comment on attachment 306167 [details]
Patch

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

This is really cool!
A few thoughts:
1) This needs to compile successfully on the iOS simulator for us to commit it.  See https://webkit.org/blog/3457/building-webkit-for-ios-simulator/ for help figuring out how.
2) I'm not sure if bounds checks or other validation steps will be needed.  Imagine a malicious web developer trying to overflow a buffer somewhere.
3) There should be a test for this.  I'm not sure what the status of the WebGPU tests are because it's in a prototyping state right now, but we will need to have tests that cover the new functionality to make sure it is accessible from javascript and has the correct behavior.  See LayoutTests/fast/canvas/webgpu which has some serious room for improvement.

> Source/WebCore/ChangeLog:8
> +        I implemented WebGPUComputeCommandEncoder and related components based on the WebGPU proposal.

Could you put a link to the proposal?  I haven't been following closely enough to know what you're talking about.

> Source/WebCore/ChangeLog:21
> +        If my understand is right, WebKit doesn't support promise attribute.

If we don't support it and it's needed, we might need to implement it.  Is something missing in the bindings generators?  See Source/WebCore/bindings/scripts/generate-bindings.pl and the other scripts there.
Comment 3 Yuichiro Kikura 2017-04-06 19:04:08 PDT
Created attachment 306455 [details]
Patch
Comment 4 Yuichiro Kikura 2017-04-06 19:11:00 PDT
Dear Alex Christensen,

Thank you for the comment. I fixed bugs and problems you pointed out. The problem about Promise attribute is just my misunderstanding, sorry. 

The problem about buffer-overrun may still remain, but sorry, I'm not sure. I just used WebGPUBuffer implementation which had been implemented already.
Comment 5 Alex Christensen 2017-04-06 20:16:18 PDT
Comment on attachment 306455 [details]
Patch

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

I'd appreciate Dean looking at this.

> Source/WebCore/bindings/js/JSWebGPUCommandBufferCustom.cpp:2
> + * Copyright (C) 2016 Apple Inc. All rights reserved.

This is inconsistent.

> Source/WebCore/platform/graphics/cocoa/GPUComputeCommandEncoderMetal.mm:2
> + * Copyright (C) 2017 Apple Inc. All rights reserved.

Ditto

> LayoutTests/fast/canvas/webgpu/webgpu-dispatch.html:38
> +        window.testRunner.notifyDone();

This doesn't make sense here.
Comment 6 Yuichiro Kikura 2017-04-07 01:48:01 PDT
Created attachment 306477 [details]
Patch
Comment 7 Yuichiro Kikura 2017-04-07 01:48:43 PDT
I fixed licenses and the test.
Comment 8 Myles C. Maxfield 2017-04-07 14:42:00 PDT
I think this is good and we probably want to accept this.

However, we should probably be clear about some things:

- Our implementation of WebGPU is just an experiment. It is designed to help us understand what kind of performance is possible. It is also designed to help us understand any design issues which may appear.

- The WebKit project tries to be standards-compliant where possible. We are currently involved in the "GPU on the Web"[1] standardization group. This group is still very young, and does not have a draft specification document. Therefore, as this group develops, our implementation will probably change dramatically. The changes will probably include both fundamental design as well as details of implementation.

- The apparent direction of this patch is to mirror the Metal API in Javascript. This is the approach that our current implication has taken. However, we will switch approaches to, instead, pursue the work being done in the standardization group. Therefore, this patch is acceptable because it is an extension of what we have already done, but the existing approach, including this patch, will likely have to be dramatically changed soon.

[1] https://www.w3.org/community/gpu/
Comment 9 Myles C. Maxfield 2017-04-07 14:43:55 PDT
(In reply to Myles C. Maxfield from comment #8)
> This is the approach that our current implication has taken.

s/implication/implementation/
Comment 10 Alex Christensen 2017-04-07 16:52:14 PDT
Comment on attachment 306477 [details]
Patch

Given that disclaimer, let's do this!
Comment 11 WebKit Commit Bot 2017-04-07 17:21:30 PDT
Comment on attachment 306477 [details]
Patch

Clearing flags on attachment: 306477

Committed r215131: <http://trac.webkit.org/changeset/215131>
Comment 12 WebKit Commit Bot 2017-04-07 17:21:32 PDT
All reviewed patches have been landed.  Closing bug.