It is also possible to use/integrate existing libraries for which device functions are defined, hence extending the concept of intrinsic functions to intrinsic types.
Note that in that case, the functions do not need an implementation if no behavior is expected in plain C#.
[IntrinsicType("curandStateMRG32k3a_t")] [IntrinsicIncludeCUDA("curand_kernel.h")] [StructLayout(LayoutKind.Sequential)] public unsafe struct curandStateMRG32k3a_t { public fixed double s1[3]; public fixed double s2[3]; public int boxmuller_flag; public int boxmuller_flag_double; public float boxmuller_extra; public double boxmuller_extra_double; [IntrinsicFunction("curand_init")] public static void curand_init(ulong seed, ulong subsequence, ulong offset, out curandStateMRG32k3a_t state) { throw new NotImplementedException(); } [IntrinsicFunction("curand")] public uint curand() { throw new NotImplementedException(); } [IntrinsicFunction("curand_log_normal")] public float curand_log_normal(float mean, float stdev) { throw new NotImplementedException(); } }