# SPIR-V Compiler
This crate is a compiler for cubecl_ir that passes through cubecl_opt to generate directly SPIR-V. It is then run with the `cubecl-wgpu` runtime.
## How to debug SPIR-V errors
1. Ensure that VK_LAYER_KHRONOS_validation is installed, it is not enabled by default on most linux distro.
For ubuntu, install it with
```bash
sudo apt install vulkan-validationlayers
```
2. Add a logger for WGPU like [env_logger](https://docs.rs/env_logger/latest/env_logger/) in the environment that you needs crash information.
If the shader generated by cubecl-spirv contains undetected error it will send at the Error level the crash instead of just segfaulting.
## Part 2
You can activate the feature `spirv-dump` and set the environment variable `CUBECL_DEBUG_SPIRV={directory}` to have all shaders saved in that directory.