Skip to content

Add GPU workgroup barrier via __sync_threads and Barrier.arrive_and_w… - #27

Merged
K-T0BIAS merged 1 commit into
4-native-gpu-support-cthreads-for-vulkanspir-vfrom
26-gpu-workgroup-sync-threads
Sep 16, 2026
Merged

K-T0BIAS merged 1 commit into
4-native-gpu-support-cthreads-for-vulkanspir-vfrom
26-gpu-workgroup-sync-threads

Conversation

@K-T0BIAS

Copy link
Copy Markdown
Owner

Adds a workgroup-scoped GPU barrier on the @Gpu path. CUDA-style
__sync_threads() and beginner-friendly Barrier.arrive_and_wait() both lower
to the same GLSL barrier() / memoryBarrierShared(). Rejects Barrier(...)
construction inside @Gpu. CPU Barrier(parties) is unchanged.

Features

  • cthreads.sync.__sync_threads: compile-only stub; RuntimeError in plain Python
  • SyncThreadsPlugin: matches __sync_threads() and Barrier.arrive_and_wait()
  • GpuFlow.expr_stmt: Call statements lower via CallPlugins (needed for barriers)
  • Scope: workgroup only (not grid-wide); documented in stub / errors
  • Tests: both forms emit barrier GLSL; Barrier(4) rejected

…ait.

Lower both call forms to the same GLSL barrier and memoryBarrierShared through
a CallPlugin, wire Call expr-stmts on the GPU path, and export a sync stub.
@K-T0BIAS K-T0BIAS self-assigned this Sep 16, 2026
@K-T0BIAS K-T0BIAS added the enhancement New feature or request label Sep 16, 2026
@K-T0BIAS
K-T0BIAS merged commit d3203ac into 4-native-gpu-support-cthreads-for-vulkanspir-v Sep 16, 2026
2 checks passed
@K-T0BIAS
K-T0BIAS deleted the 26-gpu-workgroup-sync-threads branch September 16, 2026 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants