‹ 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. jacobgorm · · focus · HN ↗
        CUDA is not an API, CUDA is a language, so you cannot make that comparison.
        1. pjmlp · · focus · HN ↗
          CUDA is neither an API, nor a language, it is an ecosystem.
          1. fc417fc802 · · focus · HN ↗
            That's a nice way of saying that it's a dependency clusterfuck.

            I've never understood why we can't just expose the GPU ISA directly the way the CPU does. It's all getting compiled down at the end of the day so someone has to write a compiler for it either way. We'd be substantially better off IMO if it was all built directly into LLVM and then let middleware sort out the details.

            1. pjmlp · · focus · HN ↗
              Because even CPUs rather use JIT runtimes to deal with the various kinds of ISAs that exist.

              Naturally plenty of folks rather use software that doesn't take advantage of the hardware they paid for.

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.