Skip to content

Remove restrictions on user-defined pointer parameters - #4323

Merged
alan-baker merged 3 commits into
gpuweb:mainfrom
alan-baker:unrestricted-pointer-params
Nov 20, 2023
Merged

alan-baker merged 3 commits into
gpuweb:mainfrom
alan-baker:unrestricted-pointer-params

Conversation

@alan-baker

@alan-baker alan-baker commented Oct 11, 2023 •

Copy link
Copy Markdown
Contributor

Fixes #3546

  • Removes address space and memory view restrictions on pointer
    parameters for user-defined functions
  • removes built-in function address space listing since it is no longer
    relevant
  • adds language extension unrestricted_pointer_parameters

Don't merge this until WGSL v1 is tagged.

@alan-baker alan-baker added wgsl WebGPU Shading Language Issues language extension labels Oct 11, 2023
@alan-baker alan-baker added this to the Milestone 1 milestone Oct 11, 2023
@github-actions

github-actions Bot commented Oct 11, 2023 •

Copy link
Copy Markdown
Contributor

Previews, as seen when this build job started (c6a493d):
WebGPU webgpu.idl | Explainer | Correspondence Reference
WGSL grammar.js | wgsl.lalr.txt

@dneto0 dneto0 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
Thank you!

Comment thread wgsl/index.bs
the following address spaces:
* [=address spaces/function=]
* [=address spaces/private=]
* For [=built-in functions=], a parameter of pointer type [=shader-creation error|must=] be in one of

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I understand the logic of not needing to mention this in the unrestricted_pointer_parameters changelog.

I guess it's because the restriction on built-in functions is already implicitly enforced by the allowed signatures.
So in theory we could have removed this clause form the original text even without any new feature.

If I've gotten that wrong, please let me know.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right we had this there to avoid confusion that user-defined functions had restrictions that were listed.

Comment thread wgsl/index.bs
<td>
<td>*CF*, *CF*
<td>
<tr><td>identifier [=resolves|resolving=] to a [=formal parameter=] of

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It took me a while to see why this completes the coverage of pointer parameters.
That's because pointers for function address space have been desugared away.

LGTM.

Fixes gpuweb#3546

* Removes address space and memory view restrictions on pointer
  parameters for user-defined functions
* removes built-in function address space listing since it is no longer
  relevant
* adds language extension unrestricted_pointer_parameters
* Split formal parameters into more cases
  * non-pointers as before
  * pointer non-read-only storage, workgroup, or private with load rule
    * edge to MayBeNonUniform
  * pointer non-read-only storage, workgroup, or private with no load rule
    * like module scope read only var
  * pointer read-only non-function
    * like module scope read only var
* Move the removed rules to the description of the feature
@alan-baker
alan-baker force-pushed the unrestricted-pointer-params branch from 0a67997 to c6a493d Compare November 20, 2023 20:58
@alan-baker
alan-baker merged commit 1b0ca0b into gpuweb:main Nov 20, 2023
@alan-baker
alan-baker deleted the unrestricted-pointer-params branch December 23, 2024 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

language extension wgsl WebGPU Shading Language Issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support fuller-featured pointers (as per #3276)

2 participants