Skip to content

Conversation

@krzysz00
Copy link
Contributor

Draft note: I'm stashing my work so I can get back to it next week. I intend to amend our tests to make sure the changes were effective.

Recently, I added an upstream PR
( llvm/llvm-project#177425 ) that adds the ability for gpu barriers to declare what address spaces they fence on in addition to allowing the __syncthreads() semantics.

This PR uses this support pervasively in IREE's GPU code generation, either by explicitly specifying the address spaces fenced by barrier ops we create or by inhereting it from address spaces on memrefs (which we know will b in shared memory).

We were already using such barriers on AMD GPU targets, where we had a rewrite pattern to unconditionally rewrite gpu.barrie' to amdgpu.lds_barrier`, which always only fences workgroup memory and doesn't synthronize global memory. This commit removes that rewrite, which allows us to be more explicit abuht the semantics we're using and will allow us to synchronize global memory accesses within a workgrop if we ever need to do so.

This PR also adds explanatory notes explaining the memory semantics we're expecting where needed.

While I'm here, this PR removes an unmanitained and stale copy of the gpu barrier elimination logic from the IREE transform ops and delegates to the upstream version instead.

Recently, I added an upstream PR
( llvm/llvm-project#177425 ) that adds the
ability for gpu barriers to declare what address spaces they fence on
in addition to allowing the __syncthreads() semantics.

This PR uses this support pervasively in IREE's GPU code generation,
either by explicitly specifying the address spaces fenced by barrier
ops we create or by inhereting it from address spaces on
memrefs (which we know will b in shared memory).

We were **already** using such barriers on AMD GPU targets, where we
had a rewrite pattern to unconditionally rewrite `gpu.barrie' to
`amdgpu.lds_barrier`, which always only fences workgroup memory and
doesn't synthronize global memory. This commit removes that rewrite,
which allows us to be more explicit abuht the semantics we're
using **and** will allow us to synchronize global memory accesses
within a workgrop if we ever need to do so.

This PR also adds explanatory notes explaining the memory semantics
we're expecting where needed.

While I'm here, this PR removes an unmanitained and stale copy of the
gpu barrier elimination logic from the IREE transform ops and
delegates to the upstream version instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant