[HN Gopher] Zig and GPUs
       ___________________________________________________________________
        
       Zig and GPUs
        
       Author : Cloudef
       Score  : 40 points
       Date   : 2025-04-18 09:33 UTC (13 hours ago)
        
 (HTM) web link (alichraghi.github.io)
 (TXT) w3m dump (alichraghi.github.io)
        
       | LegNeato wrote:
       | See also https://github.com/Rust-GPU/rust-gpu and
       | https://github.com/rust-gpu/rust-cuda
        
         | ladyanita22 wrote:
         | Surprisingly, it seems this project just supports Spir-V and
         | PTX, but not DXIL or AMDGCN.
         | 
         | I say surprisingly, because I'd expect Rust support to be more
         | mature than Zig's.
        
       | skywal_l wrote:
       | I am a complete noob in GPU but is AMDGCN the older generation
       | with the new one being RDNA? If you generate a binary for AMDGCN,
       | will it run on the newest cards?
       | 
       | Also, I though that these GPU ISAs were "proprietary". I wonder
       | how reliable the binary generation can be.
        
         | AliChraghi wrote:
         | AMD ISAs are changing for almost every generation so LLVM[1]
         | continues to keep the architecture name "amdgcn" and handle the
         | variation based on the model flag (e.g., -mcpu=gfx1030 for
         | RDNA2, -mcpu=gfx1100 for RDNA3).
         | 
         | > I though that these GPU ISAs were "proprietary"
         | 
         | PTX spec[2] is publicly available but the actual hardware
         | assembly (SASS) is not. Although i believe Nsight allows you to
         | view it.
         | 
         | 1. https://llvm.org/docs/AMDGPUUsage.html#processors
         | 
         | 2. https://docs.nvidia.com/cuda/parallel-thread-execution
        
       | SomaticPirate wrote:
       | While I admire the work of hobbyists it still looks like C/C++
       | will be the default until a GPU vender makes the decision to
       | support these libraries.
       | 
       | From my understanding, Vulkan and OpenGL are nice but the true
       | performance lies in the specific toolkits (ie CUDA, Metal).
       | 
       | Wrapping the vendor provided frameworks is liable to break and
       | that isn't tenable for someone who wants to do this on a
       | professional basis.
        
         | pjmlp wrote:
         | They also miss that on CUDA's case it is an ecosystem.
         | 
         | Actually it is C, C++, Fortran, OpenACC and OpenMP, PTX support
         | for Java, Haskell, Julia, C#, alongside the libraries, IDE
         | tooling and GPU graphical debugging.
         | 
         | Likewise Metal is plain C++14 plus extensions.
         | 
         | On the graphics side, HLSL dominates, following by GLSL and now
         | slang. There are then MSL, PSSL and whatever NVN uses.
         | 
         | By the way, at GTC NVIDIA announced going all in with Python
         | JIT compilers for CUDA, with feature parity with existing C++
         | tooling. There is now a new IR for doing array programming,
         | Tile IR.
        
         | dismalaf wrote:
         | I don't quite get this comment.
         | 
         | This is supposed to be used _in place of_ CUDA, HIP, Metal,
         | Vulkan, OpenGL, etc... It 's targeting the hardware directly so
         | doesn't need to be supported as such.
         | 
         | The site also seems to clearly state it's a work in progress.
         | It's just an interesting blog post...
        
       ___________________________________________________________________
       (page generated 2025-04-18 23:01 UTC)