Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merging simplified HAL bindings branch. (#18366)
This removes the concept of descriptor sets and pipeline layouts from the HAL and switches programs to using a flat list of bindings per dispatch as real programs rarely benefited and will do so less as command buffer reuse is enabled. Command buffer recording is now stateless as the information in push constants and push descriptor set commands are carried per dispatch and there's no need to track pipeline layouts. Pipeline layouts are still present in a reduced form in the compiler IR in order to handle dispatch ABI in a normalized way but it's up to the TargetBackends to encode them. Encoded metadata for pipeline layouts is now embedded in the target-specific executables for targets that require them (Metal/Vulkan/WebGPU/D3D12) and a reduced set of information is embedded for others. This simplifies the HAL API quite a bit, makes implementing the HAL easier as targets have more freedom in how constants and bindings are mapped to lower-level implementations, and in practice improves command buffer recording latency as there are fewer VM calls per dispatch on average. Since the flatbuffers needed to change to include the new metadata that previously was handled via the HAL APIs this branch also modernizes and normalizes the flatbuffers across targets to both better match the implementation and support features like multiple shader modules/kernel libraries/etc per HAL executable (even if the compiler isn't linking them yet). This reorganization is required to effectively manage cached resources - before the compiler would deduplicate pipeline layouts across all executables but now that each executable is responsible for that having 1000 executables means that there will be 1000 pipeline layouts even if most are the same. Perhaps this will serve as good motivation to finally finish linking in all backends :) Debug info is also consistently added for all targets and processed for tracing and factored such that new debug info can be added per-exported function without needing to change per-target code. There are many IR changes here and many test updates: most of the tests that were updated are in codegen and should not be using HAL ops at all. As codegen test cleanup continues to switch from HAL ops to basic functions future changes to the HAL IR will be easier. Notable changes include: * Renamed `push_constants` to `constants` (as there is no longer a `push_constants` API) * Dropped `#hal.descriptor_set.layout` * Removed ordinal from `#hal.descriptor_set.binding` (as ordinals are now implicit) * Renamed `#hal.descriptor_set.binding` to `#hal.pipeline.binding` * Removed `set` from `hal.interface.binding.subspan` * Removed `#hal.interface.binding` and the spooky action at a distance `hal.interface.binding` attr now that ordinals are implicit Metal/CUDA/Vulkan/HIP/CPU have all been updated to the new binding model. WebGPU has had some changes applied but needs some significant specialized work due to its existing push constant emulation requiring compiler-side descriptor sets. That's left for future work when that experimental backend is revived. This bumps the HAL version to 5 (types removed and methods changed) and the CPU executable library version to 5 (added reserved per-export fields for future use). Fixes #18154.
- Loading branch information