这是indexloc提供的服务,不要输入任何密码
Skip to content

Should WGSL expose the concept of coherent buffers? #1621

@alan-baker

Description

@alan-baker

Vulkan SPIR-V and HLSL both support marking buffers as coherent. In SPIR-V, the Coherent decoration can be applied to variables or structure members. In HLSL the globallycoherent modifier can be applied to some buffer declarations.

In the Vulkan memory model, coherent is replaced by private and non-private memory accesses. Non-atomic memory accesses are private by default. This mean they cannot be location ordered with a system-synchronizes-with operation. That boils down to private memory operations not being visible during the operation of a shader between different invocations. Workgroup memory operations are implicitly coherent.

I think we probably expect that read/write storage buffers should be capable of being synchronized between invocations so I would expect we want to say that something to the effect that memory operations are "non-private" (in whatever terms WGSL ends up using) and that translations to SPIR-V and HLSL should mark read/write storage buffers as coherent. Given MSL's inheritance from C++, I would expect MSL to default to coherent buffers, but I have not tested this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    copyeditingPure editorial stuff (copyediting, *.bs file syntax, etc.)wgslWebGPU Shading Language Issues

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions