‹ 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. fsloth · · focus · HN ↗
              ” If you write your app using win32, you won’t be able to port is very easily.”

              This is wrong way around.

              If you don’t support the platform your app runs on using the native api:s to the hilt your port is just bad.

              If you actually want to support multiple platforms _you actually need to support_ them from the ground up.

              This is speaking industrially and businesswise. A professional software business always has per-platform implementation resources. Or they have just one platform. Or they pretend they are multiplatform and then _everybody_ _daily_ fights with the problems this causes.

              Obviously those elements that can be portable should be. It’s like Einsteins simplicity maxim - your codebase should be as portable as can be but not more.

              ” It’s even worse for CUDA…”

              No these are just the business and market constraints. If this does not make sense for your offering then don’t use it. This feels like false FOMO - CUDA is not a silver bullet but it might be a specific solution to a specific problem.

              1. preg_match · · focus · HN ↗
                It really depends on the application. The reason web is so successful as a platform is because it’s rich enough for most applications, and inherently cross-platform at an OS level.

                And Re: CUDA: yes if it doesn’t make sense then dont use it. That’s sort of my whole argument. It might make some level of sense from a technical perspective, but that needs to be balanced with business risk. I’m saying a lot of people aren’t doing the balancing right, which is why these new tools have value.

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.