Tempted to switch to https://github.com/shader-slang/slang for compute shader language. It has some very nice features but I'm a bit worried that I might hit some limits with no workaround (for instance, it doesn't look like they support pointers into groupshared memory)

Anyone has experience with it? Thoughts?

GitHub - shader-slang/slang: Making it easier to work with shaders

Making it easier to work with shaders. Contribute to shader-slang/slang development by creating an account on GitHub.

GitHub

Thinking about it, I'm even more tempted to prototype a C# source generator that would create SPIR-V (compute shader) code directly from C#. There are some challenges with supporting generics but it seems doable thanks to the nice extension mechanism in SPIR-V

C# code would be easier to support than IL, as it maps more naturally to SPIR-V CFG.

More generally expressing Tensor/ML workloads straight from C# would be so cool 😎

Ok, I think I have found my next pet project for April 😅

#dotnet

I have never been convinced by MLIR as I believe that it requires a more agile and higher level way of compositing computation workloads across devices and processors (CPU, GPU, NPU)
@xoofx yes! That's awesome please do and keep us posted, I have been wanting to do something similar for learning more too, so would be happy to help if need be. If I remember correctly ComputeSharp does C# to HLSL which I was thinking could be option and if generalized also cross plat, ComputeSharp isn't due to tight coupling with directx.

@xoofx would be fun to combine with Llm.cs and train a GPT-2 model with 😉

https://github.com/nietras/Llm.cs

GitHub - nietras/Llm.cs: C# port of @karpathy https://github.com/karpathy/llm.c

C# port of @karpathy https://github.com/karpathy/llm.c - nietras/Llm.cs

GitHub
@nietras oh nice! Forgot to star it!
@xoofx a c# to compute shader compiler already exists if you are interested I can link it

@sebify yeah, I have seen some of them around https://github.com/m4rs-mt/ILGPU/ and https://github.com/Alan-Rock-GS/GpuScript

Do you have others?

GitHub - m4rs-mt/ILGPU: ILGPU JIT Compiler for high-performance .Net GPU programs

ILGPU JIT Compiler for high-performance .Net GPU programs - m4rs-mt/ILGPU

GitHub
@xoofx computesharp is the one I actually used and worked like a breeze https://github.com/Sergio0694/ComputeSharp
GitHub - Sergio0694/ComputeSharp: A .NET library to run C# code in parallel on the GPU through DX12, D2D1, and dynamically generated HLSL compute and pixel shaders, with the goal of making GPU computing easy to use for all .NET developers! 🚀

A .NET library to run C# code in parallel on the GPU through DX12, D2D1, and dynamically generated HLSL compute and pixel shaders, with the goal of making GPU computing easy to use for all .NET dev...

GitHub
@sebify oh yeah, I know that one. It is closer to how I would do it - with Roslyn Source Generators.

@xoofx I don't have experience, but positive signs are that it is in active development (https://github.com/shader-slang/slang/releases), and is now the "official future language" of Khronos et al (compared to GLSL which is effectively frozen)

[upd: it is not “official language”, just one of Khronos projects]

Releases · shader-slang/slang

Making it easier to work with shaders. Contribute to shader-slang/slang development by creating an account on GitHub.

GitHub
@aras yeah, exactly, I saw also the news and that's why I was wondering...

@aras @xoofx

Sweet Jesus no it is not.

Slang is NOT the official future language of Khronos.

I told them again and again people would assume that.

None of this is your fault, dear friends and readers.

Hey @thekhronosgroup take note.

@aras @xoofx @thekhronosgroup

Slang is under active development, yes. NVIDIA has been actively working on it for years and gotten great mileage out of that. Great!
The compiler has been open source for a while.

What has changed is that NVIDIA wanted to open up governance of the language. Instead of making a new corporate body (like a Rust Foundation setup), they took it to Khronos. It's about a having a corporate body to absorb IP and other legal risks when corporations collaborate.

@aras @xoofx @thekhronosgroup

In no way is this to be interpreted as Slang being a blessed or preferred language for Vulkan or any other Khronos related property.

Excuse me if I'm shouting but I suffered months of meetings making this point and shaping the charter of the Slang Working Group at Khronos.

Neither Google or I participate in the working group. I wish them well but it's not where I can spend energy.

@dneto @aras @xoofx @thekhronosgroup can confirm. I was also in those months of meetings.
@beanz @dneto @xoofx @thekhronosgroup ohh. well. as you can see, simpletons like me indeed took that announcement as “this is official language now”. communication is hard!
@aras @beanz @dneto @xoofx @thekhronosgroup It's an official language, just not _the designated successor to GLSL_ or similar. One more language in a pool of languages.
@anteru @aras @beanz @dneto @thekhronosgroup thanks folks, no worries, didn't want to trigger bad feelings about this! 😅
I'm going to rely on SPIR-V for my experiment. Seems to be the "perfect" intermediate vehicle these days to target GPU workloads, and will prototype higher level constructs on top of C# instead.
@xoofx @aras @beanz @dneto @thekhronosgroup SPIR-V is fine, D3D will also target it natively, and it's definitely one of the nicer IRs to work with (especially if you want to instrument things and what not.) At some point I wrote a C# disassembler for SPIR-V and it's mostly auto-generated and still works, which shows how well designed the IR is.
@anteru @xoofx @aras @dneto @thekhronosgroup SPIRV is by far the friendliest compilation target for GPUs today. I love me some LLVM, but All the LLVM-based GPU interchange formats are a lot more difficult to work with.

@dneto @aras @xoofx @thekhronosgroup

Hi! I will (perhaps less hyperbolically) concur with David here that Slang isn't intended to be "the blessed language"-- from the POV of Vulkan, it's one of the several routes into SPIR-V. From the POV of Slang, Vulkan is one of several target APIs/platforms. I obviously think Slang is really cool (I am perhaps biased in that regard), but I also believe strongly in an ecosystem with multiple shading languages.