provide u64 broadcasting mechanism in base layer wavefront lane context, allows more flexible data sharing mechanism which does not depend on statics; reshape dasm building codepath for clicking into artifact cache

This commit is contained in:
Ryan Fleury
2025-09-22 16:21:30 -07:00
parent 8a1e6ab2e6
commit 4b1939bd6d
12 changed files with 444 additions and 146 deletions
+12 -3
View File
@@ -4,9 +4,9 @@
////////////////////////////////
//~ rjf: Globals
C_LINKAGE thread_static TCTX* tctx_thread_local;
C_LINKAGE thread_static TCTX *tctx_thread_local;
#if !BUILD_SUPPLEMENTARY_UNIT
C_LINKAGE thread_static TCTX* tctx_thread_local = 0;
C_LINKAGE thread_static TCTX *tctx_thread_local = 0;
#endif
////////////////////////////////
@@ -85,12 +85,21 @@ tctx_set_lane_ctx(LaneCtx lane_ctx)
}
internal void
tctx_lane_barrier_wait(void)
tctx_lane_barrier_wait(void *broadcast_ptr, U64 broadcast_size, U64 broadcast_src_lane_idx)
{
ProfBeginFunction();
ProfColor(0x00000ff);
TCTX *tctx = tctx_selected();
U64 broadcast_size_clamped = ClampTop(broadcast_size, sizeof(tctx->lane_ctx.broadcast_memory[0]));
if(broadcast_ptr != 0 && lane_idx() == broadcast_src_lane_idx)
{
MemoryCopy(tctx->lane_ctx.broadcast_memory, broadcast_ptr, broadcast_size_clamped);
}
os_barrier_wait(tctx->lane_ctx.barrier);
if(broadcast_ptr != 0 && lane_idx() != broadcast_src_lane_idx)
{
MemoryCopy(broadcast_ptr, tctx->lane_ctx.broadcast_memory, broadcast_size_clamped);
}
ProfEnd();
}