Skip to content

Add atomics to WGSL#1448

Merged
dneto0 merged 6 commits intogpuweb:mainfrom
alan-baker:atomics
Apr 8, 2021
Merged

Add atomics to WGSL#1448
dneto0 merged 6 commits intogpuweb:mainfrom
alan-baker:atomics

Conversation

@alan-baker
Copy link
Copy Markdown
Contributor

Fixes #1360

  • Adds an atomic type
    • restricted to i32 and u32 types
  • Adds atomic built-in functions
    • atomicLoad
    • atomicStore
    • atomicAdd
    • atomicMax
    • atomicMin
    • atomicAnd
    • atomicOr
    • atomicXor
    • atomicExchange
    • atomicCompareExchangeWeak

@github-actions
Copy link
Copy Markdown
Contributor

Previews, as seen at the time of posting this comment:
WebGPU | IDL
WGSL
99aa341

@github-actions
Copy link
Copy Markdown
Contributor

Previews, as seen at the time of posting this comment:
WebGPU | IDL
WGSL
c561e59

@github-actions
Copy link
Copy Markdown
Contributor

Previews, as seen at the time of posting this comment:
WebGPU | IDL
WGSL
8a8e500

@kainino0x kainino0x added the wgsl WebGPU Shading Language Issues label Mar 8, 2021
@alan-baker alan-baker requested review from dneto0 and litherum April 7, 2021 19:33
wgsl/index.bs Outdated
<thead>
<tr><th>Type<th>Description
</thead>
<tr><td>atomic<*T*><td>Atomic of type *T*. *T* must be either [=u32=] or [=i32=].
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.

nit: Suggest using 'algorithm', so you can use |T| to denote a type variable. Clicking on that will highlight all the uses in the same algorithm scope.

   <tr algorithm="atomic type"><td>atomic&lt;|T|&gt;<td>Atomic of type |T|. ....

@dneto0 dneto0 added this to the MVP milestone Apr 7, 2021
Fixes gpuweb#1360

* Adds an atomic type
  * restricted to i32 and u32 types
* Adds atomic built-in functions
  * atomicLoad
  * atomicStore
  * atomicAdd
  * atomicMax
  * atomicMin
  * atomicAnd
  * atomicOr
  * atomicXor
  * atomicExchange
  * atomicCompareExchangeWeak
* Improve descriptions of synchronization guarantees
* fix example
* editorial fixes
Copy link
Copy Markdown
Contributor

@dneto0 dneto0 left a comment

Choose a reason for hiding this comment

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

approve with nit about extra words. Can patch that later.

integral constant in SPIR-V for all `Memory Semantics` operands).
This means synchronization and ordering guarantees only apply among atomic
operations acting on the same [=memory locations=].
No synchronization or ordering guarantees are made apply between atomic and
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.

nit: delete "are made"

@dneto0 dneto0 merged commit 5f46921 into gpuweb:main Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wgsl WebGPU Shading Language Issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Atomics proposal

4 participants