location block baking

This commit is contained in:
Ryan Fleury
2025-08-28 14:53:43 -07:00
parent 3b1aae44d0
commit f065ca33a2
3 changed files with 36 additions and 6 deletions
+7
View File
@@ -1467,6 +1467,13 @@ struct RDIM_LocationBakeResult
RDI_U64 location_data_size;
};
typedef struct RDIM_LocationBlockBakeResult RDIM_LocationBlockBakeResult;
struct RDIM_LocationBlockBakeResult
{
RDI_LocationBlock *location_blocks;
RDI_U64 location_blocks_count;
};
typedef struct RDIM_GlobalVariableBakeResult RDIM_GlobalVariableBakeResult;
struct RDIM_GlobalVariableBakeResult
{
+28 -6
View File
@@ -820,36 +820,41 @@ rdim2_bake(Arena *arena, RDIM_BakeParams *params)
rdim2_shared->baked_locations.location_data = push_array(arena, RDI_U8, rdim2_shared->baked_locations.location_data_size);
}
if(lane_idx() == lane_from_task_idx(8))
{
rdim2_shared->baked_location_blocks.location_blocks_count = params->location_cases.total_count+1;
rdim2_shared->baked_location_blocks.location_blocks = push_array(arena, RDI_LocationBlock, rdim2_shared->baked_location_blocks.location_blocks_count);
}
if(lane_idx() == lane_from_task_idx(9))
{
rdim2_shared->baked_global_variables.global_variables_count = params->global_variables.total_count+1;
rdim2_shared->baked_global_variables.global_variables = push_array(arena, RDI_GlobalVariable, rdim2_shared->baked_global_variables.global_variables_count);
}
if(lane_idx() == lane_from_task_idx(9))
if(lane_idx() == lane_from_task_idx(10))
{
rdim2_shared->baked_thread_variables.thread_variables_count = params->thread_variables.total_count+1;
rdim2_shared->baked_thread_variables.thread_variables = push_array(arena, RDI_ThreadVariable, rdim2_shared->baked_thread_variables.thread_variables_count);
}
if(lane_idx() == lane_from_task_idx(10))
if(lane_idx() == lane_from_task_idx(11))
{
rdim2_shared->baked_constants.constants_count = params->constants.total_count+1;
rdim2_shared->baked_constants.constants = push_array(arena, RDI_Constant, rdim2_shared->baked_constants.constants_count);
}
if(lane_idx() == lane_from_task_idx(11))
if(lane_idx() == lane_from_task_idx(12))
{
rdim2_shared->baked_constants.constant_values_count = params->constants.total_count+1;
rdim2_shared->baked_constants.constant_values = push_array(arena, RDI_U32, rdim2_shared->baked_constants.constant_values_count);
}
if(lane_idx() == lane_from_task_idx(12))
if(lane_idx() == lane_from_task_idx(13))
{
rdim2_shared->baked_constants.constant_value_data_size = params->constants.total_value_data_size;
rdim2_shared->baked_constants.constant_value_data = push_array(arena, RDI_U8, rdim2_shared->baked_constants.constant_value_data_size);
}
if(lane_idx() == lane_from_task_idx(13))
if(lane_idx() == lane_from_task_idx(14))
{
rdim2_shared->baked_procedures.procedures_count = params->procedures.total_count+1;
rdim2_shared->baked_procedures.procedures = push_array(arena, RDI_Procedure, rdim2_shared->baked_procedures.procedures_count);
}
if(lane_idx() == lane_from_task_idx(14))
if(lane_idx() == lane_from_task_idx(15))
{
rdim2_shared->baked_inline_sites.inline_sites_count = params->inline_sites.total_count+1;
rdim2_shared->baked_inline_sites.inline_sites = push_array(arena, RDI_InlineSite, rdim2_shared->baked_inline_sites.inline_sites_count);
@@ -1064,6 +1069,23 @@ rdim2_bake(Arena *arena, RDIM_BakeParams *params)
}
}
//- rjf: bake location blocks
ProfScope("bake location blocks")
{
for EachNode(n, RDIM_LocationCaseChunkNode, params->location_cases.first)
{
Rng1U64 range = lane_range(n->count);
for EachInRange(n_idx, range)
{
RDIM_LocationCase2 *src = &n->v[n_idx];
RDI_LocationBlock *dst = &rdim2_shared->baked_location_blocks.location_blocks[n->base_idx + n_idx + 1];
dst->scope_off_first = (RDI_U32)src->voff_range.min; // TODO(rjf): @u64_to_u32
dst->scope_off_opl = (RDI_U32)src->voff_range.max; // TODO(rjf): @u64_to_u32
dst->location_data_off = rdim_off_from_location(src->location);
}
}
}
//- rjf: bake global variables
ProfScope("bake global variables")
{
+1
View File
@@ -54,6 +54,7 @@ struct RDIM2_Shared
RDIM_TypeNodeBakeResult baked_type_nodes;
RDIM_UDTBakeResult baked_udts;
RDIM_LocationBakeResult baked_locations;
RDIM_LocationBlockBakeResult baked_location_blocks;
RDIM_GlobalVariableBakeResult baked_global_variables;
RDIM_ThreadVariableBakeResult baked_thread_variables;
RDIM_ConstantsBakeResult baked_constants;