-1

I'm trying to use ILGPU to mess with CUDA on my GPU.

When I try to load a kernel and pass it some data:

var krnl = gpu.LoadAutoGroupedStreamKernel<Index1, ArrayView<byte>, int[]>(krnCopyStringToCard);

I get the following error, which is really confusing:

The type 'int[]' must be a non-nullable value type in order to use it as a parameter...

Looking at nullable docs (new to me), it seems like int can be nullable but only if you declare it so. I'm definitely not doing that so what gives?

talonmies
  • 70,661
  • 34
  • 192
  • 269
Jason
  • 43
  • 1
  • 8
  • https://stackoverflow.com/questions/1533757/is-int-a-reference-type-or-a-value-type , https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/arrays/ , https://stackoverflow.com/questions/1113819/arrays-heap-and-stack-and-value-types – user2864740 Sep 25 '21 at 21:53
  • 1
    Do you want an explanation of the error, or do you want to fix the actual problem? If the later, you will need to supply the relevant code – TheGeneral Sep 25 '21 at 21:54
  • I understand the error after the explanation. Unfortunately, unless you can help with the following problem, which is that I can't copy arrays (found a work-around by transferring 1 byte/int/etc. at a time--although that seems horribly ineffecient), I have all I need for now! Thank you. – Jason Sep 26 '21 at 22:48

1 Answers1

5

int is non nullable, but int[] is, since

Array types are reference types.


You can see this on editor:

enter image description here

See also this answer.

deczaloth
  • 7,094
  • 4
  • 24
  • 59