[HN Gopher] ILGPU: Write GPU programs with C# and F#
       ___________________________________________________________________
        
       ILGPU: Write GPU programs with C# and F#
        
       Author : neonsunset
       Score  : 51 points
       Date   : 2024-05-17 20:25 UTC (2 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | jvanderbot wrote:
       | I'm going through the CUDA courses. I've done GPU and CPU
       | optimization as an enthusiastic amateur in my day job once or
       | twice a year, but it's not my core focus.
       | 
       | It quickly seems that the low level C/Cpp is becoming obsolete,
       | and it's hard to squeeze performance unless you're doing
       | something truly green field / new. Otherwise someone has already
       | optimized the hell out of it.
       | 
       | So what's the use case for porting GPU to higher level languages
       | like C#? What would you use this for?
        
         | sheepscreek wrote:
         | Make it more accessible? Prototyping? Eg. easily determining if
         | your use case is even suited for a GPU workload. Best case - it
         | is, and now you can write a custom CUDA kernel to squeeze out
         | more performance. Worst case, you lose a couple of hours vs
         | weeks before you discover it's not going to work.
        
         | neonsunset wrote:
         | Given IL itself is an abstract stack-based bytecode, it can be
         | compiled to the corresponding IR, which can then target
         | corresponding back-end - this is what ILGPU does.
         | 
         | C# (and F# by extension) also allows to write system-ish code,
         | with references to locals and same C primitives, which means
         | that you're not sacrificing in performance by having the
         | language be higher-level. After all, you're using ILGPUs APIs
         | first and foremost.
         | 
         | It also lets you do things like PTX assembly (learned about it
         | today, haven't seen that sample before):
         | https://github.com/m4rs-mt/ILGPU/blob/master/Samples/InlineP...
        
       ___________________________________________________________________
       (page generated 2024-05-17 23:00 UTC)