‹ BackHN Continuity

Thread

Nvidia announces native GPU programming in Rust

970 points · 404 comments · nonmaskable

  1. jacobgorm · · focus · HN ↗
    I strongly dislike CUDA. Once you have allowed that proprietary cr*p into your C++ codebase, it is very hard to get rid, and you end up with code that is either tied to a single vendor or an #ifdef hell, probably both.

    The best way to program GPUs is face up to the reality that they are not the same machine as the CPU, write your kernels in separate files, and launch them manually, like in Metal, OpenCL, and D3D12, etc. These days we even have DSLs like Triton that make kernel writing much more ergonomic than anything you would hope to achieve in Rust.

    1. fg137 · · focus · HN ↗
      > Once you have allowed that proprietary cr*p into your C++ codebase

      People have been doing that all the time for every kind of codebase. It's just part of the business. I don't see how it's worth having any emotions or opinions about it. Seems like you are wasting your energy.

      Are win32 APIs proprietary? So you decide to use them, use a wrapper/UI framework, or don't develop for Windows. Easy choice.

      Developing for embedded devices? So you read the manufacturers manual and implement based on the spec, use some sort of HAL if they are available, or you don't have a job. Even simpler.

      1. worik · · focus · HN ↗
        > Are win32 APIs proprietary?

        Yes. And crap. Not in my code bases.

        1. fsloth · · focus · HN ↗
          The CPU on most machines is quite proprietary. I don’t understand this faux purity dogma.

          Practical computing is not and never has been an abstract pure concept. It’s about making machines built by corporations to do usefull things at scale.

          There is no ”non proprietary” computing unless you make your own stack.

          1. preg_match · · focus · HN ↗
            Yes but there are business costs to using high-level proprietary tools and libraries. If you write your app using win32, you won’t be able to port is very easily. You’re also stuck with whatever bad or bizarre decisions Microsoft made.

            It’s even worse for CUDA. GPUs are expensive, and now you’re vendor locked. You’re between a rock and a hard place. Either spend millions in engineering time, or millions on price-gauged hardware.

            1. pjmlp · · focus · HN ↗
              I wonder which APIs you would use to port easily, because POSIX and Khronos aren't it either, as they are industry standards driven by companies where one has to pay for a seat at Open Group and Khronos offices.
              1. fsloth · · focus · HN ↗
                There is no ”easy” porting.

                Once this is accepted the rest becomes easier as you are not wasting time trying to find a silver bullet.

                I mean it’s then ”just normal work”.

                1. pjmlp · · focus · HN ↗
                  Exactly.
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.