intel: Add debug hook to dump out BVH after update

INTEL_DEBUG=bvh_update_as will dump out AS after update pass.

Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com>
This commit is contained in:
Sagar Ghuge 2026-01-20 11:48:25 -08:00
parent ac3c99edc5
commit 16831bf3ca
5 changed files with 25 additions and 2 deletions

View file

@ -109,6 +109,7 @@ static const struct debug_control_bitset debug_control[] = {
OPT1("bvh_blas_ir_as", DEBUG_BVH_BLAS_IR_AS),
OPT1("bvh_tlas_ir_as", DEBUG_BVH_TLAS_IR_AS),
OPT1("bvh_pcrel_map", DEBUG_BVH_PCREL_MAP),
OPT1("bvh_update_as", DEBUG_BVH_UPDATE_AS),
OPT1("bvh_no_build", DEBUG_BVH_NO_BUILD),
OPT1("task", DEBUG_TASK),
OPT1("mesh", DEBUG_MESH),

View file

@ -95,6 +95,7 @@ enum intel_debug_flag {
DEBUG_BVH_BLAS_IR_AS,
DEBUG_BVH_TLAS_IR_AS,
DEBUG_BVH_PCREL_MAP,
DEBUG_BVH_UPDATE_AS,
DEBUG_BVH_NO_BUILD,
DEBUG_NO_SEND_GATHER,
DEBUG_NO_VRT,
@ -136,6 +137,7 @@ extern BITSET_WORD intel_debug[BITSET_WORDS(INTEL_DEBUG_MAX)];
INTEL_DEBUG(DEBUG_BVH_TLAS_IR_HDR) || \
INTEL_DEBUG(DEBUG_BVH_BLAS_IR_AS) || \
INTEL_DEBUG(DEBUG_BVH_TLAS_IR_AS) || \
INTEL_DEBUG(DEBUG_BVH_UPDATE_AS) || \
INTEL_DEBUG(DEBUG_BVH_PCREL_MAP)))
extern uint64_t intel_simd;

View file

@ -2567,6 +2567,7 @@ enum bvh_dump_type {
BVH_IR_HDR,
BVH_IR_AS,
BVH_ANV_PCREL,
BVH_ANV_UPDATE
};
struct anv_bvh_dump {

View file

@ -295,6 +295,9 @@ create_bvh_dump_file(struct anv_bvh_dump *bvh)
case BVH_ANV_PCREL:
dump_sub_directory = "BVH_ANV_PCREL";
break;
case BVH_ANV_UPDATE:
dump_sub_directory = "BVH_ANV_UPDATE";
break;
default:
UNREACHABLE("invalid dump type");
}

View file

@ -168,8 +168,15 @@ debug_record_as_to_bvh_dump(struct anv_cmd_buffer *cmd_buffer,
VkDeviceAddress intermediate_header_addr,
VkDeviceAddress intermediate_as_addr,
uint32_t leaf_count,
VkGeometryTypeKHR geometry_type)
VkGeometryTypeKHR geometry_type,
bool after_update)
{
if (INTEL_DEBUG(DEBUG_BVH_UPDATE_AS) && after_update &&
geometry_type != VK_GEOMETRY_TYPE_INSTANCES_KHR) {
add_bvh_dump(cmd_buffer, header_addr, bvh_layout.size, geometry_type,
BVH_ANV_UPDATE);
}
if (INTEL_DEBUG(DEBUG_BVH_PCREL_MAP) &&
geometry_type != VK_GEOMETRY_TYPE_INSTANCES_KHR) {
add_bvh_dump(cmd_buffer, header_addr + bvh_layout.parent_child_map_offset,
@ -543,7 +550,8 @@ anv_init_header(VkCommandBuffer commandBuffer, const struct vk_acceleration_stru
if (INTEL_DEBUG_BVH_ANY) {
debug_record_as_to_bvh_dump(cmd_buffer, header_addr, bvh_layout,
intermediate_header_addr, intermediate_bvh_addr,
state->leaf_node_count, geometry_type);
state->leaf_node_count, geometry_type,
false /* after update */);
}
}
@ -672,6 +680,14 @@ anv_update_as(VkCommandBuffer commandBuffer,
first_id += build_range_info->primitiveCount;
}
if (INTEL_DEBUG_BVH_ANY) {
debug_record_as_to_bvh_dump(cmd_buffer, vk_acceleration_structure_get_va(dst),
bvh_layout, 0, 0,
state->leaf_node_count,
vk_get_as_geometry_type(state->build_info),
true /* after update */);
}
}
static const struct vk_acceleration_structure_build_ops anv_build_ops = {