3 ms·
> very strongly implies that they're completely interchangeable Not completely but they are interchangeable. C# at its inception was as much inspired by C++ as
by neonsunset 2y ago
> very strongly implies that they're completely interchangeable
Not completely but they are interchangeable. C# at its inception was as much inspired by C++ as it was by Java. Since then, it only further evolved to accommodate far more low-level scenarios and improve their performance.
It provides the kind of capabilities you'd usually expect from C++, so this statement holds true. Calling C exports is one `static extern ...` method away, you can define explicit layout for structs (that satisfy 'unmanaged' constraint), you have fixed arrays in structs, stack buffers, pointers and ability to do raw or abstracted away manual memory management, etc. You can mmap device-shared memory and push data into GPU. You can accept pointers from C or C++ and wrap them into Span<T>s and pass those to most standard library methods.
- almostgotcaught 2y ago> Not completely but they are interchangeable ... <whole lotta words telling me things i'm already extremely well aware of> I'll just ask you this extremely simple question: does C# compile/run/whatever-magic-you-think-it-does on targets that aren't in {x32, x86, ARM64}? Does it target RISC-V? Does it target PTX? Does it target AMDGPU? Are you getting the picture? Pre-empting the most low-brow dismissal: these are only niche targets if you've never heard of a company called NVIDIA.
- Const-me 2y ago> on targets that aren't in {x32, x86, ARM64}? I have personally shipped embedded Linux software running on 32 bit ARMv7 SoC written mostly in C#. The product is long in production and we’re happy with the outcome. > Does it target RISC-V? Not sure if it’s ready for production, but see that article: https://www.phoronix.com/news/Microsoft-dotNET-RISC-V https://www.phoronix.com/news/Microsoft-dotNET-RISC-V > Does it target PTX? According to nVidia, the answer is yes: https://developer.nvidia.com/blog/hybridizer-csharp/ https://developer.nvidia.com/blog/hybridizer-csharp/ > Does it target AMDGPU? Not sure, probably not.
- almostgotcaught 2y ago> Not sure if it’s ready for production, but see that article: https://www.phoronix.com/news/Microsoft-dotNET-RISC-V https://www.phoronix.com/news/Microsoft-dotNET-RISC-V > It's coming from a Samsung engineer, Dong-Heon Jung, who is involved with the .NET platform team and works on it as part of his role at Samsung. answer: no > According to nVidia, the answer is yes: https://developer.nvidia.com/blog/hybridizer-csharp/ https://developer.nvidia.com/blog/hybridizer-csharp/ > Dec 13, 2017 answer: no > Not sure, probably not. correct, the answer is no. again: this isn't politics, this is software, where the details actually matter.
- Const-me 2y ago> Dec 13, 2017 OK, here’s a newer project which does about the same thing i.e. compiles C# to PTX https://ilgpu.net/ https://ilgpu.net/ BTW, it supports OpenCL backend in addition to CUDA.
- almostgotcaught 2y ago> https://github.com/m4rs-mt/ILGPU/releases/tag/v1.5.1 https://github.com/m4rs-mt/ILGPU/releases/tag/v1.5.1 > Sept 2023. you guys just don't get it - there's a reason why CUDA is a dialect of C/C++ and not C# and it's not because the engineers at NVIDIA have just never heard of C#.
- pjmlp 2y agoYou are the one that doesn't get it, just like Intel and AMD creating CUDA clones that only focus on C and C++ APIs from CUDA, and not on CUDA the C, C++, Fortran, and PTX ecosystem.
- pjmlp 2y agoYes, NVidia has support for .NET on the CUDA ecosystem via partners, the only one that matters on GPGPU. Yes, Linaro is doing work for managed runtimes on RISC-V, although it remains questionable how much RISC-V matters outside nerd circles.
- almostgotcaught 2y ago> Yes, NVidia has support for .NET on the CUDA ecosystem via partners, the only one that matters on GPGPU. Ironic because "via partners" is equivalent to "doesn't matter".
- pjmlp 2y agoNo my dear, it matters enough that in a freetards world, there are people willing to pay for such product.
- neonsunset 2y ago> RISC-V The work is underway: https://github.com/dotnet/runtime/pulls?q=label%3Aarch-riscv https://github.com/dotnet/runtime/pulls?q=label%3Aarch-riscv > Nvidia's PTX, AMD https://ilgpu.net/ https://ilgpu.net/ and even https://github.com/m4rs-mt/ILGPU/blob/c3af8f368445d8e6443f36c99488fc601adcd737/Samples/InlinePTXAssembly/Program.cs https://github.com/m4rs-mt/ILGPU/blob/c3af8f368445d8e6443f36... While not PTX, there's also this project: https://github.com/Sergio0694/ComputeSharp https://github.com/Sergio0694/ComputeSharp which partially overlaps with what ILGPU offers Arguably, even C++ itself - you are not using "full" C++ but a special subset that works on top of specific abstraction to compile to GPUs, and I was told that CUDA C++ is considered legacy. The original context of discussion is performance and perceived issue of "having runtime", which is what my reply is targeted at. In that context, C# provides you the tools and a solution other languages in the class of Java, Go, TS and anything else interpreted just don't have. So you could reasonably replace a project written in C++ that requires assurances provided by C++ with C#, and possibly re-apply all the freed-up developer productivity into further optimizations, but you wouldn't be able to do so with the same degree of confidence with most other originally high-level languages. Another upcoming contender is Swift.
- almostgotcaught 2y ago> you are not using "full" C++ but a special subset that works on top of specific abstraction to compile to GPUs you're wrong - GPU offloading is just window dressing (#defines and CMake) around the compiler itself, which supports almost all of C++; see https://libc.llvm.org/gpu/ https://libc.llvm.org/gpu/ which builds libc (which is implemented using C++ in llvm) to amdgpu/ptx/etc. > C# provides you the tools and a solution other languages in the class of Java, Go, TS absolutely no one in their right mind would compare these languages to C++ > So you could reasonably replace a project written in C++ that requires assurances provided by C++ with C# i think people that don't write C++ professionally just don't understand where/how/why C++ is used :shrug:
- pjmlp 2y agoGoverments of the world in their upcoming cybersecurity laws do.