Debugging
Debug mode (setting the debug field of DeviceInfo or InstanceInfo to true) is supported only
when a compatible Vulkan SDK
is installed.
Important
The installed Vulkan SDK version must be at least v1.3.281.
While in debug mode vk-graph watches for errors, warnings, and certain performance warnings
emitted from any currently enabled Vulkan debug application layers. Emitted events will cause the
active thread to be parked and log a message indicating how to attach a debugger.
Logging
vk-graph uses log v0.4 for low-overhead logging.
To enable logging, set the RUST_LOG environment variable to trace, debug, info, warn or
error and initialize the logging provider of your choice. Examples use pretty_env_logger.
You may also filter messages, for example:
RUST_LOG=vk_graph::driver=trace,vk_graph=warn cargo run --example ray_trace
TRACE vk_graph::driver::instance > created a Vulkan instance
DEBUG vk_graph::driver::physical_device > physical device: NVIDIA GeForce RTX 3090
DEBUG vk_graph::driver::physical_device > extension "VK_KHR_16bit_storage" v1
DEBUG vk_graph::driver::physical_device > extension "VK_KHR_8bit_storage" v1
DEBUG vk_graph::driver::physical_device > extension "VK_KHR_acceleration_structure" v13
...
Performance Profiling
vk-graph uses profiling v1.0 and supports multiple profiling providers. When
not in use profiling has zero cost.
To enable profiling, compile with one of the profile-with-* features enabled and initialize the
profiling provider of your choice.
Example using puffin:
cargo run --features profile-with-puffin --release --example vsm_omni
Comparing Results
Always profile code using a release-mode build.
You may need to disable CPU thermal throttling in order to get consistent results on some platforms. The inconsistent results are certainly valid, but they do not help in accurately measuring potential changes. This may be done on Intel Linux machines by modifying the Intel P-State driver:
echo 100 | sudo tee /sys/devices/system/cpu/intel_pstate/min_perf_pct
(Source )
Helpful tools
- VulkanSDK
(Required when setting
debugtotrue) - NVIDIA: nvidia-smi
- AMD: RadeonTop
- RenderDoc