with sufficient threads, split baking threads into two groups: small # of threads to do expensive 'background' baking tasks, use the rest to do wide predictable baking stuff

This commit is contained in:
Ryan Fleury
2025-08-29 13:01:44 -07:00
parent f065ca33a2
commit 8fe4b3524f
6 changed files with 1193 additions and 1078 deletions
-4
View File
@@ -996,8 +996,6 @@ X(RDI_U32, voff_range_first)\
X(RDI_U32, voff_range_opl)\
X(RDI_U32, local_first)\
X(RDI_U32, local_count)\
X(RDI_U32, static_local_idx_run_first)\
X(RDI_U32, static_local_count)\
X(RDI_U32, inline_site_idx)\
#define RDI_InlineSite_XList \
@@ -1446,8 +1444,6 @@ RDI_U32 voff_range_first;
RDI_U32 voff_range_opl;
RDI_U32 local_first;
RDI_U32 local_count;
RDI_U32 static_local_idx_run_first;
RDI_U32 static_local_count;
RDI_U32 inline_site_idx;
};
+10 -2
View File
@@ -335,7 +335,6 @@ rdim_sort_key_array(RDIM_Arena *arena, RDIM_SortKey *keys, RDI_U64 count)
// Also - this sort should be a "stable" sort. In the use case of sorting vmap
// ranges, we want to be able to rely on order, so it needs to be preserved here.
RDIM_ProfBegin("rdim_sort_key_array");
RDIM_Temp scratch = rdim_scratch_begin(&arena, 1);
RDIM_SortKey *result = 0;
@@ -486,7 +485,6 @@ rdim_sort_key_array(RDIM_Arena *arena, RDIM_SortKey *keys, RDI_U64 count)
#endif
rdim_scratch_end(scratch);
RDIM_ProfEnd();
return result;
}
@@ -1291,7 +1289,15 @@ rdim_bake_vmap_from_markers(RDIM_Arena *arena, RDIM_VMapMarker *markers, RDIM_So
RDIM_Temp scratch = rdim_scratch_begin(&arena, 1);
//- rjf: sort markers
#if 0
RDIM_SortKey *sorted_keys = rdim_sort_key_array(scratch.arena, keys, marker_count);
#else
ProfBegin("sort markers");
RDIM_SortKey *sorted_keys = rdim_push_array(scratch.arena, RDIM_SortKey, marker_count);
rdim_memcpy(sorted_keys, keys, marker_count*sizeof(keys[0]));
radsort(sorted_keys, marker_count, rdim_sort_key_is_before);
ProfEnd();
#endif
//- rjf: determine if an extra vmap entry for zero is needed
RDI_U32 extra_vmap_entry = 0;
@@ -1304,6 +1310,7 @@ rdim_bake_vmap_from_markers(RDIM_Arena *arena, RDIM_VMapMarker *markers, RDIM_So
RDI_U32 vmap_count_raw = marker_count - 1 + extra_vmap_entry;
RDI_VMapEntry *vmap = rdim_push_array(arena, RDI_VMapEntry, vmap_count_raw + 1);
RDI_U32 vmap_entry_count_pass_1 = 0;
ProfScope("fill output vmap entries")
{
typedef struct RDIM_VMapRangeTracker RDIM_VMapRangeTracker;
struct RDIM_VMapRangeTracker
@@ -1402,6 +1409,7 @@ rdim_bake_vmap_from_markers(RDIM_Arena *arena, RDIM_VMapMarker *markers, RDIM_So
//- rjf: combine duplicate neighbors
RDI_U32 vmap_entry_count = 0;
ProfScope("combine duplicate neighbors")
{
RDI_VMapEntry *vmap_ptr = vmap;
RDI_VMapEntry *vmap_opl = vmap + vmap_entry_count_pass_1;
+1 -1
View File
@@ -1355,7 +1355,7 @@ internal Barrier
os_barrier_alloc(U64 count)
{
OS_W32_Entity *entity = os_w32_entity_alloc(OS_W32_EntityKind_Barrier);
InitializeSynchronizationBarrier(&entity->sb, count, -1);
BOOL init_good = InitializeSynchronizationBarrier(&entity->sb, count, -1);
Barrier result = {IntFromPtr(entity)};
return result;
}
-2
View File
@@ -1056,8 +1056,6 @@ RDI_ScopeMemberTable:
{voff_range_opl RDI_U32 ""}
{local_first RDI_U32 ""}
{local_count RDI_U32 ""}
{static_local_idx_run_first RDI_U32 ""}
{static_local_count RDI_U32 ""}
{inline_site_idx RDI_U32 ""}
}
File diff suppressed because it is too large Load Diff
+5
View File
@@ -21,6 +21,11 @@ struct RDIM_UnsortedJoinedLineTable
typedef struct RDIM2_Shared RDIM2_Shared;
struct RDIM2_Shared
{
B32 group_split;
U64 group_0_lane_count;
Barrier group_0_barrier;
Barrier group_1_barrier;
RDIM_BakePathTree *path_tree;
RDI_U64 line_tables_count;