mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-19 20:08:06 +02:00
Having a list of all enabled/used extensions in meson allows us to get rid of a lot of boilerplate in every bvh build shader. Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35326> |
||
|---|---|---|
| .. | ||
| anv_build_helpers.h | ||
| anv_build_interface.h | ||
| anv_bvh.h | ||
| copy.comp | ||
| encode.comp | ||
| header.comp | ||
| interpret.py | ||
| meson.build | ||
| README.md | ||
| visualize_json.html | ||
BVH Debug
INTEL_DEBUG=bvh_tlas,bvh_blaswill generatetlas_{id}.txtorblas_{id}.txtinbvh_dump/BVH_ANVdirectory.INTEL_DEBUG=bvh_tlas_ir_hdr,bvh_blas_ir_hdrwill generatetlas_{id}.txtorblas_{id}.txtinbvh_dump/BVH_IR_HDRdirectory.INTEL_DEBUG=bvh_tlas_ir_as,bvh_blas_ir_aswill generatetlas_{id}.txtorblas_{id}.txtinbvh_dump/BVH_IR_ASdirectory.INTEL_DEBUG=bvh_no_buildwill skip the intel-specific-encoding part. This will make the bvh NULL and the HW traversal will see this as a miss.
The dumped text file contains memory dump, byte-by-byte in hex. The contents are contiguous memory of a certain region.
- The dump in
BVH_ANVstarts from the beginning ofanv_accel_struct_headerto the end of the bvh. - The dump in
BVH_IR_HDRrecordsvk_ir_header, which sits at the beginning of ir bvh. - The dump in
BVH_IR_ASrecords allvk_ir_{leaf_type}_nodeandvk_ir_box_nodein ir bvh. The region starts from where leaves are encoded to the end of ir bvh.
Decode the dump
We have a way to decode the dump in BVH_ANV.
- To decode this memory dump, use a python script to parse the file and generate a human-readable json.
- To further visualize the tree, there is a html that parses the json and draws the tree topology and 3D views of bounding boxes.
# Using blas_0 as an example
xxd -r -p bvh_dump/BVH_ANV/blas_0.txt > input.bin
# Use a python script to generate a human-readable json file
cd mesa/src/intel/vulkan/bvh/
python3 interpret.py <path/to/input.bin>
# To further visualize the tree, the html parses the json and draws it in 3D.
cd mesa/src/intel/vulkan/bvh/
python3 -m http.server 8000
# go to localhost:8000/visualize_json.html
Note and Limitations:
- The python script use
ctypesto interpret the memory dump, so the structure defined in the script should match the structure defined in the driver. - The memory dump is a snapshot of a VkBuffer captured at the end of
CmdBuildAccelerationStructurecall. It won't capture any bvh obtained fromCmdCopy. - CPU will wait for the the command buffer to be completed, and saves the recorded bvh into files on disk.