m4rs-mt / ILGPU

ILGPU JIT Compiler for high-performance .Net GPU programs
http://www.ilgpu.net
Other
1.41k stars 120 forks source link

Deprecated warning when using Allocate1D? #895

Closed leonbohmann closed 1 year ago

leonbohmann commented 1 year ago

Hello! First of all, thanks for the great work on this! I've been implementing an OpenCL library using java, what a mess.. This is very user friendly and the fact that I can use all of my IDEs functionality to create kernels is just awesome!

I have a question regarding the method Allocate1D, which I am using as follows:

mb_deviceLhs = CalcAccelerator.Allocate1D(MatVector.Matrix);
mb_deviceRhs = CalcAccelerator.Allocate1D(MatVector.Vector);
mb_deviceOut = CalcAccelerator.Allocate1D<double>(Length);

CalcAccelerator is a CudaAccelerator created elsewhere in the code. My concern is, that the method documentation of Allocate1D shows: "This method is not supported on accelerators!": grafik

Is this warning deprecated? What am I supposed to use then? I tried it nevertheless and it works just fine.

And, another thing, as far as I understood, this method allocates shared memory on the GPU, right?

MoFtZ commented 1 year ago

hi @leonbohmann, the documentation is probably a bit misleading here. ILGPU allows you to write C# code that will run on the GPU (the kernel). The documentation is trying to say that the Allocate1D cannot be called from within an GPU kernel.

The method Allocated1D allocates global memory on the GPU. This is memory that is accessible by all threads of the GPU. Shared memory in Cuda refers to memory that can be accessed by threads of the same thread group.

leonbohmann commented 1 year ago

Right, got it!

Is there any publication on ILGPU? I saw a link somewhere when looking through the docs but I can't find it any more..

Thank you!

MoFtZ commented 1 year ago

Do you mean the References for ILGPU?

m4rs-mt commented 1 year ago

@leonbohmann There is no publication on ILGPU. If you want to reference ILGPU, just reference the website https://www.ilgpu.net. We may want to publish an architectural paper next year.

leonbohmann commented 1 year ago

Yes. I wanted to read about how this works. Really interesting, because I tried to use CUDA directly but then just went straight to using ILGPU, much simpler!

Thanks!

MoFtZ commented 1 year ago

@leonbohmann feel free to join our Discord server. It will be easier to discuss topics there.

https://discord.com/invite/X6RBCff