Bug 187728 - Minor changes to the WHLSL interpreter to support the new compiler
Summary: Minor changes to the WHLSL interpreter to support the new compiler
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: Thomas Denney
URL:
Keywords: InRadar
Depends on:
Blocks: 187735
  Show dependency treegraph
 
Reported: 2018-07-17 09:51 PDT by Thomas Denney
Modified: 2018-07-24 16:09 PDT (History)
4 users (show)

See Also:


Attachments
Patch (15.83 KB, patch)
2018-07-17 10:03 PDT, Thomas Denney
no flags Details | Formatted Diff | Diff
Patch (20.98 KB, patch)
2018-07-20 12:16 PDT, Thomas Denney
no flags Details | Formatted Diff | Diff
Patch (21.90 KB, patch)
2018-07-24 15:28 PDT, Thomas Denney
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Denney 2018-07-17 09:51:59 PDT
Minor changes to the WHLSL interpreter to support the new compiler
Comment 1 Thomas Denney 2018-07-17 10:03:33 PDT
Created attachment 345161 [details]
Patch
Comment 2 Myles C. Maxfield 2018-07-19 19:37:53 PDT
Comment on attachment 345161 [details]
Patch

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

Your SwizzleOp stuff could have been its own patch.

> Tools/WebGPUShadingLanguageRI/FuncInstantiator.js:34
> +    get instances() { return this._instances; }

Usually we don't make changes that are totally unused anywhere else in the patch. It's fine - just a note for the future.

> Tools/WebGPUShadingLanguageRI/FunctionLikeBlock.js:32
> +        this._func = func;

Is this right? I thought the function would not have its generic types be instantiated, but the FunctionLikeBlock would.

> Tools/WebGPUShadingLanguageRI/Intrinsics.js:665
> +                    for (let i = 0; i < swizzle.outSize; i++)
> +                        outputBuffer.set(i, vec.get(readIndices[swizzle.components[i]]));

Cool trick.

> Tools/WebGPUShadingLanguageRI/Lexer.js:106
> +                this._index += endIndex + 2;

Is there a test for this?

> Tools/WebGPUShadingLanguageRI/MakeArrayRefExpression.js:34
> +        if (!type) {
> +            if (this.lValue.variable && this.lValue.variable.type && this.lValue.variable.type.isArray && this.lValue.variable.type.elementType) {

You can join the if statements with &&.

This is very confusing because this argument is never used, so I have no idea whether or not this line is right. The ChangeLog helps, but in the future, please join all related changes in a single patch.

> Tools/WebGPUShadingLanguageRI/NativeFunc.js:41
> +    get implementationData() { return this._implementationData; }
> +    set implementationData(newImplData) { this._implementationData = newImplData; }

Isn't there a better name for this?
Also, I would sleep better at night if the constructor set it to undefined or null or something, just so it's easier to see all the members the class contains in a single place.

> Tools/WebGPUShadingLanguageRI/Rewriter.js:355
> +            Node.visit(node.func, this),
> +            node.argumentList.map(arg => Node.visit(arg, this))

It looks like the only difference between node.func.visit() and Node.visit(node.func) is that Node.visit() handles the case where the argument is null. When would that ever occur here? Shouldn't func always be non-null?

> Tools/WebGPUShadingLanguageRI/StandardLibrary.js:409
> +class SwizzleOp {

It's pretty weird for the standard library to include objects. I think you should move this out into another file (either another existing file if there is a good candidate, or a new file).

> Tools/WebGPUShadingLanguageRI/StandardLibrary.js:423
> +        return `native vec${this.outSize}<T> operator.${this.components.join("")}<T>(vec${this.inSize}<T> v)`;

Consider adding a performance test, because compiling the standard library is something we want to track.

> Tools/WebGPUShadingLanguageRI/StandardLibrary.js:427
> +// There are 481 swizzle operators. Let's not list them explicitly.

s/list them/compile them all/
Comment 3 Thomas Denney 2018-07-20 12:02:20 PDT
Comment on attachment 345161 [details]
Patch

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

>> Tools/WebGPUShadingLanguageRI/FunctionLikeBlock.js:32
>> +        this._func = func;
> 
> Is this right? I thought the function would not have its generic types be instantiated, but the FunctionLikeBlock would.

FunctionLikeBlocks are only constructed with functions that have been instantiated.

>> Tools/WebGPUShadingLanguageRI/NativeFunc.js:41
>> +    set implementationData(newImplData) { this._implementationData = newImplData; }
> 
> Isn't there a better name for this?
> Also, I would sleep better at night if the constructor set it to undefined or null or something, just so it's easier to see all the members the class contains in a single place.

implementationData is used in a few other places in the interpreter for this kind of thing (e.g. struct accessors) so I'm aiming to be consistent with them.
Comment 4 Thomas Denney 2018-07-20 12:16:13 PDT
Created attachment 345472 [details]
Patch
Comment 5 WebKit Commit Bot 2018-07-24 14:57:23 PDT
Comment on attachment 345472 [details]
Patch

Rejecting attachment 345472 [details] from commit-queue.

Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-02', 'validate-changelog', '--check-oops', '--non-interactive', 345472, '--port=mac']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit

ChangeLog entry in Tools/ChangeLog contains OOPS!.

Full output: https://webkit-queues.webkit.org/results/8642541
Comment 6 Thomas Denney 2018-07-24 15:28:32 PDT
Created attachment 345719 [details]
Patch
Comment 7 WebKit Commit Bot 2018-07-24 16:08:33 PDT
Comment on attachment 345719 [details]
Patch

Clearing flags on attachment: 345719

Committed r234175: <https://trac.webkit.org/changeset/234175>
Comment 8 WebKit Commit Bot 2018-07-24 16:08:35 PDT
All reviewed patches have been landed.  Closing bug.
Comment 9 Radar WebKit Bug Importer 2018-07-24 16:09:16 PDT
<rdar://problem/42560713>