Summary: | [WHLSL] Implement dynamically uniform expression restrictions | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Myles C. Maxfield <mmaxfield> | ||||||||||
Component: | WebGPU | Assignee: | 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
Myles C. Maxfield
2018-08-29 16:36:49 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. Functions that return uniform variables must only have a single return point UAVs can't hold uniform values Conditional continues and breaks should contribute to the uniformity of the blocks they target (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. (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. (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 *** Bug 189123 has been marked as a duplicate of this bug. *** Created attachment 351650 [details]
WIP
Created attachment 351711 [details]
WIP
Created attachment 351866 [details]
WIP
Created attachment 351868 [details]
WIP
Migrated to https://github.com/gpuweb/WHLSL/issues/56 |