Skip to content

atomic ops unsafe, but unclear why #450

@bcolloran

Description

@bcolloran

this is basically a follow up to issue #382, where @nazar-pc said:

"""
Functions like workgroup_memory_barrier_with_group_sync() are unsafe, but it is not clear why (no "Safety" section in docs).

They should either not be unsafe or "Safety" section should be added to corresponding function docs explaining how to use them safely.
"""

Similar concern with the files in e.g. crates/spirv-std/src/arch/atomics.rs -- all of the atomic ops seem to be marked as unsafe. I don't understand the spir-v / Vulkan / whatevs memory model... like... at all... but I always thought atomic ops like these were specifically designed to provide a safe way to update memory that might be touched by multiple threads? If this is not the case, then as @nazar-pc suggested re barriers, a comment saying how to uphold any invariants required for safety would be a big help! Thanks!! :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions