Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spv-in parsing Op::AtomicIIncrement #5702

Merged
merged 3 commits into from
May 30, 2024

Conversation

schell
Copy link
Contributor

@schell schell commented May 14, 2024

Connections
Partially adresses #4489.

This is mostly for @jimblandy and @cwfitzgerald to ensure that I'm not totally off course on my quest to add atomics.
I'm trying to make my PRs as small as possible to reduce the overhead of reviewing these as they come in :)

Description
Begins work adding support for atomics in naga's SPIR-V frontend.

  • adds a temporary feature spv-in-atomics that enables the new feature
  • adds support for parsing Op::AtomicIIncrement
    • parse instruction
    • insert result expression
    • insert atomic statement
  • adds a lookup map to Frontend to track atomics use for a later pass

This does not generate a valid Module as it predictably fails to type check ;)

Testing
Added a test to parse and validate (with empty flags) a .spv file with an AtomicIIncrement instruction.

Checklist

  • Run cargo fmt.
  • Run cargo clippy. If applicable, add:
    • --target wasm32-unknown-unknown
    • --target wasm32-unknown-emscripten
  • Run cargo xtask test to run tests.
  • Add change to CHANGELOG.md. See simple instructions inside file.

@schell schell force-pushed the feature/spirv-front-atomics-1 branch from 1de7a0e to 0c434df Compare May 14, 2024 02:47
@schell schell marked this pull request as ready for review May 14, 2024 03:42
@schell schell requested a review from a team as a code owner May 14, 2024 03:42
@schell schell changed the title temporary spv-in-atomics feature, parsing Op::AtomicIIncrement spv-in parsing Op::AtomicIIncrement May 14, 2024
Copy link
Member

@cwfitzgerald cwfitzgerald left a comment

Choose a reason for hiding this comment

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

Great to see this!

Can't comment on the code itself (though it generally looks good), but I don't think we need a special feature for it, this can just be part of the main spirv backend.

@schell schell force-pushed the feature/spirv-front-atomics-1 branch from fd148b1 to 2fbdd7a Compare May 21, 2024 03:04
@schell schell requested a review from cwfitzgerald May 21, 2024 03:57
Copy link
Member

@jimblandy jimblandy left a comment

Choose a reason for hiding this comment

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

This looks fine so far. Before we merge this I'd like the test to be turned into a snapshot test.

I'm kind of guessing at a bunch of stuff here so if I say something that doesn't sound right, definitely push back until it makes sense.

naga/src/front/spv/mod.rs Outdated Show resolved Hide resolved
naga/src/front/spv/mod.rs Outdated Show resolved Hide resolved
naga/src/front/spv/mod.rs Outdated Show resolved Hide resolved
naga/src/front/spv/mod.rs Show resolved Hide resolved
@schell schell force-pushed the feature/spirv-front-atomics-1 branch from 2fbdd7a to 4787020 Compare May 24, 2024 20:19
@schell schell requested a review from jimblandy May 24, 2024 20:19
Copy link
Member

@cwfitzgerald cwfitzgerald left a comment

Choose a reason for hiding this comment

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

LGTM

@schell schell force-pushed the feature/spirv-front-atomics-1 branch from 4b4b897 to 292d38a Compare May 29, 2024 21:13
Copy link
Member

@jimblandy jimblandy left a comment

Choose a reason for hiding this comment

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

Two small issues, but otherwise looks good for now. Once you've addressed these, give me a ping and I'll merge it.

naga/src/front/spv/mod.rs Outdated Show resolved Hide resolved
naga/src/front/spv/mod.rs Outdated Show resolved Hide resolved
@schell schell force-pushed the feature/spirv-front-atomics-1 branch from 292d38a to c4ed78c Compare May 30, 2024 01:37
@jimblandy jimblandy enabled auto-merge (squash) May 30, 2024 04:23
@jimblandy
Copy link
Member

jimblandy commented May 30, 2024

This is fine for now, but ideally commit comments should be a clearer explanation of the changes, of the sort one might include in CHANGELOG.txt or something, but with more detail. For example, see: 8d73e5a

[edit: well, maybe that message talks a bit too much about a boring change. But the hope is that at least occasionally the commit message could save someone the time of actually reading the diff.]

@jimblandy
Copy link
Member

Thanks very much! Looking forward to the next episode!

@jimblandy jimblandy merged commit 480d4db into gfx-rs:trunk May 30, 2024
26 checks passed
@schell schell deleted the feature/spirv-front-atomics-1 branch May 30, 2024 04:51
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.

None yet

3 participants