Bug 189125

Summary: [WHLSL] Implement dynamically uniform expression restrictions
Product: WebKit Reporter: Myles C. Maxfield <mmaxfield>
Component: WebGPUAssignee: Myles C. Maxfield <mmaxfield>
Status: RESOLVED MOVED    
Severity: Normal CC: jonlee, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=189122
https://bugs.webkit.org/show_bug.cgi?id=189123
Bug Depends on:    
Bug Blocks: 176199, 189202    
Attachments:
Description Flags
WIP
none
WIP
none
WIP
none
WIP none

Myles C. Maxfield
Reported 2018-08-29 16:36:49 PDT
Implement dynamically uniform expression restrictions
Attachments
WIP (43.56 KB, patch)
2018-10-04 19:47 PDT, Myles C. Maxfield
no flags
WIP (49.71 KB, patch)
2018-10-05 19:35 PDT, Myles C. Maxfield
no flags
WIP (79.07 KB, patch)
2018-10-09 00:07 PDT, Myles C. Maxfield
no flags
WIP (79.33 KB, patch)
2018-10-09 00:25 PDT, Myles C. Maxfield
no flags
Radar WebKit Bug Importer
Comment 1 2018-09-12 18:50:51 PDT
Myles C. Maxfield
Comment 2 2018-09-24 10:37:06 PDT
Ever value (lvalue and rvalue) will be associated with a "uniformity" attribute, which will be assigned by the compiler. These attributes can even survive being assigned to a variable, if the variable is marked as "uniform" in the program source. Then, after we know whether or not each value is uniform, we can associate each nested scope with a similar uniformity attribute. This is true iff the condition leading to that scope is uniform. We apply the restriction that any AssignmentExpression inside a non-uniform scope must never assign to a uniform variable that is declared in the non-innermost scope. This should guarantee that all uniform variables are, indeed, uniform. Then, we can require any IndexExpression that indexes into an array which contains textures to use a uniform index.
Myles C. Maxfield
Comment 3 2018-09-24 11:14:24 PDT
Functions that return uniform variables must only have a single return point
Myles C. Maxfield
Comment 4 2018-09-24 11:18:09 PDT
UAVs can't hold uniform values
Myles C. Maxfield
Comment 5 2018-09-24 11:25:41 PDT
Conditional continues and breaks should contribute to the uniformity of the blocks they target
Myles C. Maxfield
Comment 6 2018-09-24 11:28:16 PDT
(In reply to Myles C. Maxfield from comment #5) > Conditional continues and breaks should contribute to the uniformity of the > blocks they target This isn't quite right - the continue & break can affect just the remainder of the scope. Also, uniforms should only exist in thread / constant address space.
Myles C. Maxfield
Comment 7 2018-09-24 11:37:48 PDT
(In reply to Myles C. Maxfield from comment #6) > (In reply to Myles C. Maxfield from comment #5) > > Conditional continues and breaks should contribute to the uniformity of the > > blocks they target > > This isn't quite right - the continue & break can affect just the remainder > of the scope. > and "return" In general, returns should be modeled as an assignment to a variable that's outside the function scope.
Myles C. Maxfield
Comment 8 2018-09-24 11:41:52 PDT
(In reply to Myles C. Maxfield from comment #3) > Functions that return uniform variables must only have a single return point Actually, we can do better - just treat early returns as marking the rest of the scope non-uniform, and treating the return as writing to a value that's outside the scope
Myles C. Maxfield
Comment 9 2018-10-04 19:45:53 PDT
*** Bug 189123 has been marked as a duplicate of this bug. ***
Myles C. Maxfield
Comment 10 2018-10-04 19:47:32 PDT
Myles C. Maxfield
Comment 11 2018-10-05 19:35:24 PDT
Myles C. Maxfield
Comment 12 2018-10-09 00:07:01 PDT
Myles C. Maxfield
Comment 13 2018-10-09 00:25:46 PDT
Myles C. Maxfield
Comment 14 2018-10-13 14:48:27 PDT
Note You need to log in before you can comment on or make changes to this bug.