Skip to content
This repository was archived by the owner on Jan 29, 2025. It is now read-only.

Atomics support#929

Merged
kvark merged 8 commits intogfx-rs:masterfrom
kvark:atomic2
Aug 11, 2021
Merged

Atomics support#929
kvark merged 8 commits intogfx-rs:masterfrom
kvark:atomic2

Conversation

@kvark
Copy link
Copy Markdown
Member

@kvark kvark commented Jun 1, 2021

Fixes #865
Some frontend and backend work is still due, but it's mergeable.
More specifically, here are the current limitations:

@kvark
Copy link
Copy Markdown
Member Author

kvark commented Aug 5, 2021

I've almost gotten atomics work in spv-in, but then stumbled upon the fact that generating new types ruins the guarantee that IR has that a dependent type always shows up before the parent... So I'm going to drop spv-in from this PR and leave it for a follow-up.
For future reference, here is GLSL example for spv parsing:

#version 310 es

layout(local_size_x = 64) in;

// Persistent LIFO structure with a count of elements
layout(std430, binding = 0) restrict buffer SMyBuffer
{
    int count;
    float data[];
} MyBuffer;

void main()
{
    for (uint i = gl_GlobalInvocationID.x; i < 20U; i += gl_WorkGroupSize.x)
    {
            int dataIndex = atomicAdd(MyBuffer.count, 1);
            MyBuffer.data[dataIndex] = float(i);
    }
}

@kvark kvark requested a review from jimblandy August 5, 2021 19:13
@kvark kvark force-pushed the atomic2 branch 2 times, most recently from a4f86ac to 74950e5 Compare August 5, 2021 20:24
@kvark kvark changed the title Atomics in the IR Atomics support Aug 5, 2021
Comment thread src/lib.rs Outdated
Comment thread src/lib.rs Outdated
Comment thread src/lib.rs
Copy link
Copy Markdown
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.

I'm sorry - I still have a ways to go with this. But here are my comments so far - let me know what you think.

Comment thread src/back/glsl/mod.rs Outdated
Comment thread src/back/glsl/mod.rs Outdated
Comment thread src/back/glsl/mod.rs Outdated
Comment thread src/back/glsl/mod.rs
Comment thread src/valid/function.rs Outdated
Comment thread src/back/spv/block.rs
Comment thread src/back/spv/block.rs Outdated
Comment thread src/back/spv/block.rs Outdated
Comment thread src/back/spv/block.rs Outdated
Comment thread src/back/spv/instructions.rs Outdated
@kvark
Copy link
Copy Markdown
Member Author

kvark commented Aug 8, 2021

I think this review is amazing, thank you!
I addressed everything that I felt needed to be addressed.

Copy link
Copy Markdown
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.

Wow, this is a great start for the atomics - so glad to see this happening.

I found a few issues, but over all things look great. I don't think I need to see this again after you've addressed these comments, so I'm just going to approve it.

Comment thread src/valid/expression.rs
Comment thread src/proc/typifier.rs Outdated
Comment thread src/valid/function.rs
Comment thread src/valid/analyzer.rs
Comment thread src/valid/function.rs
Comment thread src/front/wgsl/mod.rs
Comment thread src/front/wgsl/mod.rs
Comment thread tests/out/wgsl/access.wgsl Outdated
Comment thread tests/out/wgsl/access.wgsl Outdated
Comment thread tests/out/glsl/skybox.vs_main.Vertex.glsl
@kvark kvark merged commit 67dd604 into gfx-rs:master Aug 11, 2021
@kvark kvark deleted the atomic2 branch August 11, 2021 01:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Atomic operations

2 participants