checkpoint on wavefront-style pdb -> rdi converter

This commit is contained in:
Ryan Fleury
2025-08-15 16:50:28 -07:00
parent f1a1863d5c
commit e566b2ed30
8 changed files with 717 additions and 22 deletions
+1
View File
@@ -136,6 +136,7 @@
#define EachElement(it, array) (U64 it = 0; it < ArrayCount(array); it += 1)
#define EachEnumVal(type, it) (type it = (type)0; it < type##_COUNT; it = (type)(it+1))
#define EachNonZeroEnumVal(type, it) (type it = (type)1; it < type##_COUNT; it = (type)(it+1))
#define EachInRange(it, range) (U64 it = (range).min; it < (range).max; it += 1)
////////////////////////////////
//~ rjf: Memory Operation Macros
+20 -8
View File
@@ -21,6 +21,7 @@ tctx_alloc(void)
TCTX *tctx = push_array(arena, TCTX, 1);
tctx->arenas[0] = arena;
tctx->arenas[1] = arena_alloc();
tctx->lane_count = 1;
return tctx;
}
@@ -72,26 +73,37 @@ tctx_get_scratch(Arena **conflicts, U64 count)
return result;
}
//- rjf: wavefront metadata
//- rjf: lane metadata
internal void
tctx_set_wavefront_info(U64 wavefront_idx, U64 wavefront_count)
tctx_set_lane_info(U64 lane_idx, U64 lane_count)
{
TCTX *tctx = tctx_selected();
OS_Handle barrier = os_barrier_alloc(wavefront_count);
tctx->wavefront_idx = wavefront_idx;
tctx->wavefront_count = wavefront_count;
tctx->wavefront_barrier_id = barrier.u64[0];
OS_Handle barrier = os_barrier_alloc(lane_count);
tctx->lane_idx = lane_idx;
tctx->lane_count = lane_count;
tctx->lane_barrier_id = barrier.u64[0];
}
internal void
tctx_wavefront_barrier_wait(void)
tctx_lane_barrier_wait(void)
{
TCTX *tctx = tctx_selected();
OS_Handle barrier = {tctx->wavefront_barrier_id};
OS_Handle barrier = {tctx->lane_barrier_id};
os_barrier_wait(barrier);
}
internal Rng1U64
tctx_lane_idx_range_from_count(U64 count)
{
U64 idxes_per_lane = count/lane_count();
U64 lane_base_idx = lane_idx()*idxes_per_lane;
U64 lane_opl_idx = lane_base_idx + idxes_per_lane;
U64 lane_opl_idx__clamped = Min(lane_opl_idx, count);
Rng1U64 result = r1u64(lane_base_idx, lane_opl_idx__clamped);
return result;
}
//- rjf: thread names
internal void
+14 -9
View File
@@ -17,10 +17,10 @@ struct TCTX
U8 thread_name[32];
U64 thread_name_size;
// rjf: wavefront info
U64 wavefront_idx;
U64 wavefront_count;
U64 wavefront_barrier_id;
// rjf: lane info
U64 lane_idx;
U64 lane_count;
U64 lane_barrier_id;
// rjf: source location info
char *file_name;
@@ -41,11 +41,16 @@ internal Arena *tctx_get_scratch(Arena **conflicts, U64 count);
#define scratch_begin(conflicts, count) temp_begin(tctx_get_scratch((conflicts), (count)))
#define scratch_end(scratch) temp_end(scratch)
//- rjf: wavefront metadata
internal void tctx_set_wavefront_info(U64 wavefront_idx, U64 wavefront_count);
internal void tctx_wavefront_barrier_wait(void);
#define wavefront_thread(idx, count) tctx_set_wavefront_info((idx), (count))
#define wavefront_barrier() tctx_wavefront_barrier_wait()
//- rjf: lane metadata
internal void tctx_set_lane_info(U64 lane_idx, U64 lane_count);
internal void tctx_lane_barrier_wait(void);
internal Rng1U64 tctx_lane_idx_range_from_count(U64 count);
#define lane_idx() (tctx_selected()->lane_idx)
#define lane_count() (tctx_selected()->lane_count)
#define lane_from_task_idx(idx) ((idx)%lane_count())
#define lane_thread(idx, count) tctx_set_lane_info((idx), (count))
#define lane_sync() tctx_lane_barrier_wait()
#define lane_range(count) tctx_lane_idx_range_from_count(count)
//- rjf: thread names
internal void tctx_set_thread_name(String8 name);