news.volyx.in

Rust running on every GPU (rust-gpu.github.io)

605 points by littlestymaar · 367 days ago · 205 comments on HN

Article summary

A developer has created a demo of a single Rust codebase that runs on every major GPU platform, including CUDA for NVIDIA GPUs, SPIR-V for Vulkan-compatible GPUs, Metal for Apple devices, DirectX 12 for Windows, and WebGPU for browsers. The code is available on GitHub and uses various Rust features such as conditional compilation, newtypes, and traits to enable cross-platform GPU compute. The project aims to demonstrate that cross-platform GPU compute in Rust is possible. The demo implements a simple bitonic sort and shows that the same compute logic can run on all targets, written entirely in regular Rust.

Main themes

  • Rust on GPU
  • Cross-platform compute
  • GPU programming
  • Abstraction layers
  • Performance optimization
  • GPU architecture

What commenters say

  • The ability to run Rust on GPUs without modification is a significant advantage, unlocking new possibilities for developers.
  • Some commenters are skeptical about the performance of Rust on GPUs compared to native CUDA code.
  • The use of abstraction layers and high-level languages like Rust may lead to performance losses and decreased control over hardware details.
  • Others argue that the benefits of using Rust, such as its strong type system and ecosystem, outweigh potential performance drawbacks.
  • There is a need for a standardized, open API for GPU programming that is supported by all vendors.
  • Some commenters believe that WebGPU is not yet mature enough to be widely adopted, despite its potential.
  • The development of Rust on GPU is seen as a way to expand the audience for GPU programming and make it more accessible.
  • There are concerns about the complexity and fragmentation of the GPU ecosystem, with multiple vendors and APIs, making it difficult to develop cross-platform code.