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

[WebGPU] Control Access Barriers #28525

Open
cmhhelgeson opened this issue May 29, 2024 · 1 comment
Open

[WebGPU] Control Access Barriers #28525

cmhhelgeson opened this issue May 29, 2024 · 1 comment
Labels

Comments

@cmhhelgeson
Copy link
Contributor

Description

At some point, I think it would be great to have the ability to set control access barriers and access more of the WGSL specific functionality within a TSL function. I've tried implementing some of these access barriers myself in a personal branch, using an approach similar to that of the 'vec2', 'vec3', 'etc' ConvertTypes in ShaderNode.js. However, it seems like the node system is heavily weighted towards nodes that explicitly represent some kind of mathematical operation, so, at least from my end, it's not as simple as just adding another node type.

Solution

export const workgroupBarrier = new BarrierType('workgroup');

And then be accessed from a tslFn like so...

tslFn( () => {
	...
	workgroupBarrier()
	...
})

I'm not sure if there's currently a relevant use case for these barriers, but once subgroups become stable, I imagine commands like workgroupBarrier() or subgroupBarrier() would be very useful for things like prefix sums for spatial hash grids.

Alternatives

No response

Additional context

No response

@sunag
Copy link
Collaborator

sunag commented May 29, 2024

I think the code below can work for a tslFn() using as your example?

export const workgroupBarrier = () => expression( 'workgroupBarrier()' ).append();
@Mugen87 Mugen87 added the WebGPU label May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 participants