intel: Add debug option to dump out maps

This commit adds new debug options to dump out parent-child relationship
map using INTEL_DEBUG=bvh_pcrel_map and leaf block offset map using
INTEL_DEBUG=bvh_lbo_map.

Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com>
This commit is contained in:
Sagar Ghuge 2026-01-15 14:36:28 -08:00
parent 6a65616aaa
commit 26af065e60
5 changed files with 21 additions and 6 deletions

View file

@ -108,6 +108,7 @@ static const struct debug_control_bitset debug_control[] = {
OPT1("bvh_tlas_ir_hdr", DEBUG_BVH_TLAS_IR_HDR),
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_no_build", DEBUG_BVH_NO_BUILD),
OPT1("task", DEBUG_TASK),
OPT1("mesh", DEBUG_MESH),

View file

@ -94,6 +94,7 @@ enum intel_debug_flag {
DEBUG_BVH_TLAS_IR_HDR,
DEBUG_BVH_BLAS_IR_AS,
DEBUG_BVH_TLAS_IR_AS,
DEBUG_BVH_PCREL_MAP,
DEBUG_BVH_NO_BUILD,
DEBUG_NO_SEND_GATHER,
DEBUG_NO_VRT,
@ -134,7 +135,8 @@ extern BITSET_WORD intel_debug[BITSET_WORDS(INTEL_DEBUG_MAX)];
INTEL_DEBUG(DEBUG_BVH_BLAS_IR_HDR) || \
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_TLAS_IR_AS) || \
INTEL_DEBUG(DEBUG_BVH_PCREL_MAP)))
extern uint64_t intel_simd;
extern uint32_t intel_debug_bkp_before_draw_count;

View file

@ -2564,7 +2564,8 @@ enum anv_object_key_bvh_type {
enum bvh_dump_type {
BVH_ANV,
BVH_IR_HDR,
BVH_IR_AS
BVH_IR_AS,
BVH_ANV_PCREL,
};
struct anv_bvh_dump {

View file

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

View file

@ -150,21 +150,29 @@ add_bvh_dump(struct anv_cmd_buffer *cmd_buffer,
static void
debug_record_as_to_bvh_dump(struct anv_cmd_buffer *cmd_buffer,
VkDeviceAddress header_addr,
uint64_t bvh_anv_size,
struct bvh_layout bvh_layout,
VkDeviceAddress intermediate_header_addr,
VkDeviceAddress intermediate_as_addr,
uint32_t leaf_count,
VkGeometryTypeKHR geometry_type)
{
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,
bvh_layout.leaf_block_map_offset - bvh_layout.parent_child_map_offset,
geometry_type,
BVH_ANV_PCREL);
}
if (INTEL_DEBUG(DEBUG_BVH_BLAS) &&
geometry_type != VK_GEOMETRY_TYPE_INSTANCES_KHR) {
add_bvh_dump(cmd_buffer, header_addr, bvh_anv_size, geometry_type,
add_bvh_dump(cmd_buffer, header_addr, bvh_layout.size, geometry_type,
BVH_ANV);
}
if (INTEL_DEBUG(DEBUG_BVH_TLAS) &&
geometry_type == VK_GEOMETRY_TYPE_INSTANCES_KHR) {
add_bvh_dump(cmd_buffer, header_addr, bvh_anv_size, geometry_type,
add_bvh_dump(cmd_buffer, header_addr, bvh_layout.size, geometry_type,
BVH_ANV);
}
@ -489,7 +497,7 @@ anv_init_header(VkCommandBuffer commandBuffer, const struct vk_acceleration_stru
vk_common_CmdDispatch(commandBuffer, 1, 1, 1);
if (INTEL_DEBUG_BVH_ANY) {
debug_record_as_to_bvh_dump(cmd_buffer, header_addr, bvh_layout.size,
debug_record_as_to_bvh_dump(cmd_buffer, header_addr, bvh_layout,
intermediate_header_addr, intermediate_bvh_addr,
state->leaf_node_count, geometry_type);
}