This blog post details creating a basic Windows driver using Rust. It leverages the windows
crate for Windows API bindings and the wdk-sys
crate for lower-level WDK access. The driver implements a minimal "DispatchCreateClose" routine, handling device creation and closure. The post walks through setting up the Rust development environment, including Cargo configuration and build process adjustments for driver compilation. It highlights using the wdk-build
crate for simplifying the build process and generating the necessary INF file for driver installation. Finally, it demonstrates loading and unloading the driver using the DevCon utility, providing a practical example of the entire workflow from development to deployment.
The ROCm Device Support Wishlist GitHub discussion serves as a central hub for users to request and discuss support for new AMD GPUs and other hardware within the ROCm platform. It encourages users to upvote existing requests or submit new ones with detailed system information, emphasizing driver versions and specific models for clarity and to gauge community interest. The goal is to provide the ROCm developers with a clear picture of user demand, helping them prioritize development efforts for broader hardware compatibility.
Hacker News users discussed the ROCm device support wishlist, expressing both excitement and skepticism. Some were enthusiastic about the potential for wider AMD GPU adoption, particularly for scientific computing and AI workloads where open-source solutions are preferred. Others questioned the viability of ROCm competing with CUDA, citing concerns about software maturity, performance consistency, and developer mindshare. The need for more robust documentation and easier installation processes was a recurring theme. Several commenters shared personal experiences with ROCm, highlighting successes with specific applications but also acknowledging difficulties in getting it to work reliably across different hardware configurations. Some expressed hope for better support from AMD to broaden adoption and improve the overall ROCm ecosystem.
Summary of Comments ( 83 )
https://news.ycombinator.com/item?id=42984457
Hacker News users discussed the challenges and advantages of writing Windows drivers in Rust. Several commenters pointed out the difficulty of working with the Windows Driver Kit (WDK) and its C/C++ focus, contrasting it with Rust's memory safety and modern tooling. Some highlighted the potential for improved driver stability and security with Rust. The conversation also touched on existing Rust wrappers for the WDK, the maturity of Rust driver development, and the complexities of interrupt handling. One user questioned the overall benefit, arguing that the difficulty of writing drivers stems from inherent hardware complexities more than language choice. Another pointed out the limited use of high-level languages in kernel-mode drivers due to real-time constraints.
The Hacker News thread for "Writing a simple windows driver in Rust" (https://news.ycombinator.com/item?id=42984457) contains several comments discussing the challenges and advantages of using Rust for Windows driver development.
One commenter highlights the difficulty of writing Windows drivers in general, regardless of language, due to the complexity of the Windows Driver Model (WDM). They point out that even seemingly simple tasks can become convoluted due to the asynchronous nature of driver operations and the need to manage IRQLs (Interrupt Request Levels). They also suggest that the article simplifies the process considerably.
Another commenter mentions that Rust's ownership and borrowing system, while beneficial for memory safety, can introduce complexities when dealing with shared resources, a common scenario in driver development. They further explain that this can lead to challenges when implementing interior mutability, a pattern often employed in concurrent programming, potentially making Rust less ergonomic than C++ in certain driver development scenarios.
Several commenters discuss the trade-offs between using Rust and C/C++ for driver development. Some appreciate Rust's memory safety features and modern tooling, viewing them as significant advantages over the error-prone nature of C/C++. Others express skepticism about Rust's suitability for driver development due to its steeper learning curve and potential performance overhead.
A significant portion of the discussion revolves around the immaturity of the Rust ecosystem for Windows driver development. Commenters point to the lack of mature libraries and tooling compared to the well-established C/C++ ecosystem. They also raise concerns about the potential instability of the Rust for Windows project and the challenges of integrating Rust code with existing C/C++ driver codebases.
One commenter discusses the performance implications of using Rust, noting that while Rust can achieve comparable performance to C/C++, it requires careful optimization and awareness of potential pitfalls, like excessive copying due to Rust's move semantics.
Finally, a few comments delve into the specific technical details mentioned in the article, such as the use of the
windows
crate for interacting with Windows APIs and the challenges of managing memory in a kernel-mode environment. They also discuss alternative approaches to Windows driver development, such as using frameworks like the Windows Driver Framework (WDF).