|  | 
|  | 1 | +--- | 
|  | 2 | +title: "Announcing Rust GPU 0.10" | 
|  | 3 | +slug: rust-gpu-0.10 | 
|  | 4 | +tags: ["announcement", "release"] | 
|  | 5 | +draft: true | 
|  | 6 | +--- | 
|  | 7 | + | 
|  | 8 | +# Announcing Rust GPU 0.10 | 
|  | 9 | + | 
|  | 10 | +The Rust GPU maintainers are happy to announce a new version of [Rust | 
|  | 11 | +GPU](https://github.com/rust-gpu/rust-gpu), 0.10. Rust GPU makes it possible to write | 
|  | 12 | +and run GPU software in Rust. | 
|  | 13 | + | 
|  | 14 | +This release is our first as a [community-owned project](/blog/transition-announcement). | 
|  | 15 | +One of our goals is to move releases to a more frequent and rapid pace—the last release | 
|  | 16 | +was on July 25, 2023! | 
|  | 17 | + | 
|  | 18 | +We're eager to add more users and contributors. To follow along or get involved, check out the [`rust-gpu` repo on GitHub](https://github.com/rust-gpu/rust-gpu). | 
|  | 19 | + | 
|  | 20 | +<!-- truncate --> | 
|  | 21 | + | 
|  | 22 | +## What's new in 0.10 | 
|  | 23 | + | 
|  | 24 | +### Update Rust requirement to a modern version | 
|  | 25 | + | 
|  | 26 | +Rust GPU includes a compiler backend that compiles regular Rust code into | 
|  | 27 | +[SPIR-V](https://www.khronos.org/spir/), a low-level format that [most GPUs | 
|  | 28 | +understand](https://vulkan.gpuinfo.org/). Because of this deep integration with compiler | 
|  | 29 | +internals, Rust GPU must use a very specific version of the Rust compiler. Rust GPU now | 
|  | 30 | +supports `nightly-2024-11-22` (up from the ancient `nightly-2023-05-27`). This roughly | 
|  | 31 | +corresponds to [Rust 1.83](https://blog.rust-lang.org/2024/11/28/Rust-1.83.0.html). | 
|  | 32 | + | 
|  | 33 | +:::tip | 
|  | 34 | + | 
|  | 35 | +Most real-world projects like [`krnl`](https://github.com/charles-r-earp/krnl) and | 
|  | 36 | +[`renderling`](https://github.com/schell/renderling) compile their GPU code with Rust | 
|  | 37 | +GPU's specific version of nightly while using stable Rust for the rest of their code. We | 
|  | 38 | +are in the process of making this workflow much easier. | 
|  | 39 | + | 
|  | 40 | +::: | 
|  | 41 | + | 
|  | 42 | +Updating to a newer nightly version required heroic effort from | 
|  | 43 | +[@eddyb](https://github.com/eddyb), as significant breaking changes to Rust's [internal | 
|  | 44 | +allocation model](https://github.com/rust-lang/rust/pull/122053) and | 
|  | 45 | +[`#[repr(simd)]`](https://github.com/rust-lang/rust/pull/129403) were introduced in | 
|  | 46 | +`rustc`. [@eddyb](https://github.com/eddyb) was able to [vendor in parts of `rustc` and | 
|  | 47 | +patch out others](https://github.com/Rust-GPU/rust-gpu/pull/170), unblocking the update | 
|  | 48 | +and buying us time to [figure out the best way | 
|  | 49 | +forward](https://github.com/Rust-GPU/rust-gpu/issues/182). | 
|  | 50 | + | 
|  | 51 | +Rust GPU is an "out-of-tree" compiler backend. This enables fast iteration while we | 
|  | 52 | +explore the problem space, but also makes us more susceptible to this sort of breakage. | 
|  | 53 | +One of our long-term goals is to be a supported `rustc` backend. | 
|  | 54 | + | 
|  | 55 | +### **Mesh shader support** | 
|  | 56 | + | 
|  | 57 | +Rust GPU maintainer [@Firestar99](https://github.com/firestar99) and contributor | 
|  | 58 | +[@BeastLe9enD](https://github.com/BeastLe9enD) added support for [mesh | 
|  | 59 | +shaders](https://github.com/Rust-GPU/rust-gpu/pull/44). | 
|  | 60 | + | 
|  | 61 | +[Mesh shaders](https://www.khronos.org/blog/mesh-shading-for-vulkan) are a modern GPU | 
|  | 62 | +feature that replace traditional vertex and geometry shaders. They give GPU developers | 
|  | 63 | +more control over the entire pipeline by letting them directly process batches of | 
|  | 64 | +vertices and primitives in compute-like shaders. This allows for more efficient culling, | 
|  | 65 | +level-of-detail calculations, and custom pipeline logic—all on the GPU. | 
|  | 66 | + | 
|  | 67 | +An example of a Rust GPU mesh shader that outputs points: | 
|  | 68 | + | 
|  | 69 | +``` | 
|  | 70 | +use spirv_std::arch::set_mesh_outputs_ext; | 
|  | 71 | +use spirv_std::glam::{UVec2, Vec4}; | 
|  | 72 | +use spirv_std::spirv; | 
|  | 73 | +
 | 
|  | 74 | +#[spirv(mesh_ext( | 
|  | 75 | +    threads(1), | 
|  | 76 | +    output_vertices = 1, | 
|  | 77 | +    output_primitives_ext = 1, | 
|  | 78 | +    output_points | 
|  | 79 | +))] | 
|  | 80 | +pub fn main( | 
|  | 81 | +    #[spirv(position)] positions: &mut [Vec4; 1], | 
|  | 82 | +    #[spirv(primitive_point_indices_ext)] indices: &mut [u32; 1], | 
|  | 83 | +) { | 
|  | 84 | +    unsafe { | 
|  | 85 | +        set_mesh_outputs_ext(1, 1); | 
|  | 86 | +    } | 
|  | 87 | +
 | 
|  | 88 | +    positions[0] = Vec4::new(-0.5, 0.5, 0.0, 1.0); | 
|  | 89 | +
 | 
|  | 90 | +    indices[0] = 0; | 
|  | 91 | +} | 
|  | 92 | +``` | 
|  | 93 | + | 
|  | 94 | +An example of a Rust GPU mesh task shader: | 
|  | 95 | + | 
|  | 96 | +``` | 
|  | 97 | +use spirv_std::arch::emit_mesh_tasks_ext; | 
|  | 98 | +use spirv_std::spirv; | 
|  | 99 | +
 | 
|  | 100 | +#[spirv(task_ext(threads(1)))] | 
|  | 101 | +pub fn main() { | 
|  | 102 | +    unsafe { | 
|  | 103 | +        emit_mesh_tasks_ext(1, 2, 3); | 
|  | 104 | +    } | 
|  | 105 | +} | 
|  | 106 | +``` | 
|  | 107 | + | 
|  | 108 | +### **Subgroup support** | 
|  | 109 | + | 
|  | 110 | +[@Firestar99](https://github.com/firestar99) also added support for subgroups via | 
|  | 111 | +[subgroup intrinsics](https://github.com/Rust-GPU/rust-gpu/pull/14). | 
|  | 112 | + | 
|  | 113 | +[Subgroups](https://www.khronos.org/blog/vulkan-subgroup-tutorial) are small groups of | 
|  | 114 | +threads within a workgroup that can share data and perform synchronized operations more | 
|  | 115 | +efficiently. For example, using subgroup intrinsics you can: | 
|  | 116 | + | 
|  | 117 | +- Perform reductions (e.g., sum, min, max) across threads in a subgroup. | 
|  | 118 | +- Share intermediate results without relying on global memory, reducing latency. | 
|  | 119 | +- Implement algorithms like prefix sums or parallel sorting more effectively. | 
|  | 120 | + | 
|  | 121 | +Here is a simple Rust GPU example to demonstrate subgroup reduction: | 
|  | 122 | + | 
|  | 123 | +```rust | 
|  | 124 | +use glam::UVec3; | 
|  | 125 | +use spirv_std::spirv; | 
|  | 126 | + | 
|  | 127 | +unsafe fn subgroup_i_add_reduce(value: u32) -> u32 { | 
|  | 128 | +    spirv_std::arch::subgroup_i_add(value) | 
|  | 129 | +} | 
|  | 130 | + | 
|  | 131 | +#[spirv(compute(threads(32, 1, 1)))] | 
|  | 132 | +pub fn main(#[spirv(local_invocation_id)] local_invocation_id: UVec3) { | 
|  | 133 | +    unsafe { | 
|  | 134 | +        subgroup_i_add_reduce(local_invocation_id.x); | 
|  | 135 | +    } | 
|  | 136 | +} | 
|  | 137 | +``` | 
|  | 138 | + | 
|  | 139 | +## Added `TypedBuffer` | 
|  | 140 | + | 
|  | 141 | +[@eddyb](https://github.com/eddyb) and [@Firestar99](https://github.com/firestar99) | 
|  | 142 | +[introduced `TypedBuffer`](https://github.com/Rust-GPU/rust-gpu/pull/16), an explicit | 
|  | 143 | +way to declare inputs and outputs as buffers. This enables declaring an "array of buffer | 
|  | 144 | +descriptors containing something" as is common in [bindless | 
|  | 145 | +textures](https://computergraphics.stackexchange.com/questions/10794/binding-vs-bindless). | 
|  | 146 | + | 
|  | 147 | +Here is an example of using | 
|  | 148 | +[`TypedBuffer`](https://rust-gpu.github.io/rust-gpu/api/spirv_std/struct.TypedBuffer.html) | 
|  | 149 | +in a fragment shader: | 
|  | 150 | + | 
|  | 151 | +```rust | 
|  | 152 | +use glam::Vec4; | 
|  | 153 | +use spirv_std::TypedBuffer; | 
|  | 154 | +use spirv_std::spirv; | 
|  | 155 | + | 
|  | 156 | +#[spirv(fragment)] | 
|  | 157 | +pub fn main( | 
|  | 158 | +    #[spirv(storage_buffer, descriptor_set = 0, binding = 0)] single: &TypedBuffer<Vec4>, | 
|  | 159 | +    #[spirv(storage_buffer, descriptor_set = 0, binding = 1)] single_mut: &mut TypedBuffer<Vec4>, | 
|  | 160 | +) { | 
|  | 161 | +    **single_mut = **single; | 
|  | 162 | +} | 
|  | 163 | +``` | 
|  | 164 | + | 
|  | 165 | +### Read-only buffer support for `ByteAddressableBuffer` | 
|  | 166 | + | 
|  | 167 | +Thanks to [@Firestar99](https://github.com/firestar99), | 
|  | 168 | +[`ByteAddressableBuffer`](https://rust-gpu.github.io/rust-gpu/api/spirv_std/byte_addressable_buffer/struct.ByteAddressableBuffer.html) | 
|  | 169 | +now supports [reading from read-only | 
|  | 170 | +buffers](https://github.com/Rust-GPU/rust-gpu/pull/17). Previously the buffers needed to | 
|  | 171 | +be read-write. Using read-only buffers can improve performance for immutable data. | 
|  | 172 | + | 
|  | 173 | +### Dependency updates | 
|  | 174 | + | 
|  | 175 | +We updated key GPU dependencies like [`glam`](https://github.com/bitshifter/glam-rs). | 
|  | 176 | +One of the unique benefits of Rust on the GPU is that we use the exact `glam` crate from | 
|  | 177 | +[crates.io](https://crates.io/crates/glam), so this was a simple `Cargo.toml` update. | 
|  | 178 | + | 
|  | 179 | +Additionally, examples now use the latest versions of CPU-side crates such as | 
|  | 180 | +[`ash`](https://github.com/ash-rs/ash) and [`wgpu`](https://github.com/gfx-rs/wgpu). | 
|  | 181 | + | 
|  | 182 | +## Other related changes | 
|  | 183 | + | 
|  | 184 | +### SPIR-V atomics in `wgpu` | 
|  | 185 | + | 
|  | 186 | +Rust GPU maintainer [@schell](https://github.com/schell) added [SPIR-V atomic support to | 
|  | 187 | +`wgpu`](https://github.com/gfx-rs/wgpu/issues/4489). This was part of his work on | 
|  | 188 | +[`renderling`](https://github.com/schell/renderling), a project built with Rust GPU. The | 
|  | 189 | +change enables Rust GPU programs to use atomics and integrate with CPU-side code managed | 
|  | 190 | +by [`wgpu`](https://github.com/gfx-rs/wgpu). Funding came from a grant by | 
|  | 191 | +[NLnet](https://nlnet.nl/). | 
|  | 192 | + | 
|  | 193 | +### Rustlantis integration | 
|  | 194 | + | 
|  | 195 | +[@FractalFir](https://github.com/FractalFir) created | 
|  | 196 | +[`rustc_codegen_clr`](https://github.com/FractalFir/rustc_codegen_clr), an experimental | 
|  | 197 | +Rust compiler backend that converts Rust into .NET assemblies or C source files. He | 
|  | 198 | +adapted [Rustlantis](https://github.com/cbeuw/rustlantis), a MIR fuzzer for generating | 
|  | 199 | +complex test programs, to support his project. | 
|  | 200 | + | 
|  | 201 | +When Rust GPU maintainers asked if the changes could help Rust GPU, | 
|  | 202 | +[`@FractalFir`](https://github.com/FractalFir) took the extra step of updating his | 
|  | 203 | +Rustlantis fork to support it as well. This collaboration has already uncovered three | 
|  | 204 | +issues in Rust GPU. We plan to continue investing in Rustlantis support to improve | 
|  | 205 | +automated testing and actively hunt for bugs. | 
|  | 206 | + | 
|  | 207 | +### New website | 
|  | 208 | + | 
|  | 209 | +Rust GPU maintainer [@LegNeato](https://github.com/LegNeato) added a [new website for | 
|  | 210 | +the project](https://rust-gpu.github.io/) using [Docusaurus](https://docusaurus.io/). He | 
|  | 211 | +also created some Docusaurus | 
|  | 212 | +[plugins](https://github.com/Rust-GPU/rust-gpu.github.io/tree/main/src/plugins) and | 
|  | 213 | +[components](https://github.com/Rust-GPU/rust-gpu.github.io/tree/main/src/components/Snippet) | 
|  | 214 | +to better support the project's needs. Finally, he wrote a blog post about [optimizing a | 
|  | 215 | +Rust GPU matmul kernel](/blog/optimizing-matmul) that was popular on | 
|  | 216 | +[Reddit](https://www.reddit.com/r/rust/comments/1gzmchn/optimizing_a_rust_gpu_matmul_kernel/) | 
|  | 217 | +and [Hacker News](https://news.ycombinator.com/item?id=42280697). | 
|  | 218 | + | 
|  | 219 | +## Community | 
|  | 220 | + | 
|  | 221 | +Thank you to the 13 community contributors, most of whom contributed for the first time: | 
|  | 222 | + | 
|  | 223 | +[BeastLe9enD](https://github.com/BeastLe9enD), [beef | 
|  | 224 | +(`@fee1-dead`)](https://github.com/fee1-dead), [Brice Videau | 
|  | 225 | +(`@Kerilk`)](https://github.com/Kerilk) [Bruce Mitchener | 
|  | 226 | +(`@waywardmonkeys`)](https://github.com/waywardmonkeys), | 
|  | 227 | +[`@FractalFir`](https://github.com/FractalFir), [Fredrik Fornwall | 
|  | 228 | +(`@fornwall`)](https://github.com/fornwall), [Gray Olson | 
|  | 229 | +(`@fu5ha`)](https://github.com/fu5ha), [Jake Shadle](https://github.com/Jake-Shadle), | 
|  | 230 | +[Léo Gaspard (`@Ekleog`)](https://github.com/Ekleog), [Rowan Jones | 
|  | 231 | +(`@ArrEssJay`)](https://github.com/ArrEssJay), [Marek Bernat | 
|  | 232 | +(`@mbernat`)](https://github.com/mbernat), [Viktor Zoutman | 
|  | 233 | +(`@VZout`)](https://github.com/VZout), [`@Zanciks`](https://github.com/zanciks) | 
|  | 234 | + | 
|  | 235 | +We're especially grateful that [`@Zanciks`](https://github.com/Zanciks) chose Rust GPU for | 
|  | 236 | +their first ever open source contribution! | 
|  | 237 | + | 
|  | 238 | +## Maintainers | 
|  | 239 | + | 
|  | 240 | +As [previously announced](/blog/transition-announcement), Rust GPU has four active | 
|  | 241 | +maintainers who contributed to this release (in alphabetical order): | 
|  | 242 | + | 
|  | 243 | +1. [Christian Legnitto (LegNeato)](https://github.com/LegNeato) | 
|  | 244 | +2. [Eduard-Mihai Burtescu (eddyb)](https://github.com/eddyb) | 
|  | 245 | +3. [Firestar99](https://github.com/firestar99) | 
|  | 246 | +4. [Schell Carl Scivally (schell)](https://github.com/schell) | 
|  | 247 | + | 
|  | 248 | +<br/> | 
|  | 249 | + | 
|  | 250 | +We're always looking for active contributors to become new maintainers. [Join us](https://github.com/rust-gpu/rust-gpu) and make an impact! | 
0 commit comments