Skip to content

Thread synchronization barrier (__syncthreads) #5

@tetsuo-cpp

Description

@tetsuo-cpp

Summary

Add a BARRIER word that maps to GPU thread barrier synchronization.

Motivation

Required for any shared-memory algorithm. After writing to shared memory, all threads in a block must synchronize before any thread reads, to avoid data races.

Word to implement

Word Stack effect Description
BARRIER ( -- ) Block-level thread barrier

Implementation notes

  • This is a side-effecting operation with no stack effect
  • MLIR mapping: gpu.barrier op
  • In the NVVM lowering path, this becomes llvm.nvvm.barrier0
  • The op should have no operands/results on the Forth stack (stack passes through unchanged)

Priority

High — required for any shared-memory algorithm. Closely tied to shared memory support.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions