示例#1
0
 public static extern CLError GetKernelWorkGroupInfo(
     [In] IntPtr kernel,
     [In] IntPtr device,
     [In] CLKernelWorkGroupInfoType workGroupInfoType,
     [In] IntPtr maxSize,
     [Out] void *paramValue,
     [Out] IntPtr size);
示例#2
0
文件: CLAPI.cs 项目: karayakar/ILGPU
        /// <summary>
        /// Resolves kernel work-group information as typed structure value of type <typeparamref name="T"/>
        /// </summary>
        /// <typeparam name="T">The target type.</typeparam>
        /// <param name="kernel">The kernel.</param>
        /// <param name="device">The device.</param>
        /// <param name="type">The information type.</param>
        /// <returns>The resolved value.</returns>
        public static T GetKernelWorkGroupInfo <T>(
            IntPtr kernel,
            IntPtr device,
            CLKernelWorkGroupInfoType type)
            where T : struct
        {
            T value = default;

            CLException.ThrowIfFailed(NativeMethods.GetKernelWorkGroupInfo(
                                          kernel,
                                          device,
                                          type,
                                          new IntPtr(Interop.SizeOf <T>()),
                                          Unsafe.AsPointer(ref value),
                                          IntPtr.Zero));
            return(value);
        }
示例#3
0
文件: CLAPI.cs 项目: adamreeve/ILGPU
 /// <summary>
 /// Resolves kernel work-group information as typed array of values of type
 /// <typeparamref name="T"/>.
 /// </summary>
 /// <typeparam name="T">The target type.</typeparam>
 /// <param name="kernel">The kernel.</param>
 /// <param name="device">The device.</param>
 /// <param name="type">The information type.</param>
 /// <param name="elements">The desired elements.</param>
 public static void GetKernelWorkGroupInfo <T>(
     IntPtr kernel,
     IntPtr device,
     CLKernelWorkGroupInfoType type,
     T[] elements)
     where T : unmanaged
 {
     fixed(T *ptr = &elements[0])
     {
         CLException.ThrowIfFailed(NativeMethods.GetKernelWorkGroupInfo(
                                       kernel,
                                       device,
                                       type,
                                       new IntPtr(Interop.SizeOf <T>() * elements.Length),
                                       ptr,
                                       IntPtr.Zero));
     }
 }
示例#4
0
文件: CLAPI.cs 项目: karayakar/ILGPU
        /// <summary>
        /// Resolves kernel work-group information as typed array of values of type <typeparamref name="T"/>.
        /// </summary>
        /// <typeparam name="T">The target type.</typeparam>
        /// <param name="kernel">The kernel.</param>
        /// <param name="device">The device.</param>
        /// <param name="type">The information type.</param>
        /// <param name="elements">The desired elements.</param>
        public static void GetKernelWorkGroupInfo <T>(
            IntPtr kernel,
            IntPtr device,
            CLKernelWorkGroupInfoType type,
            T[] elements)
            where T : struct
        {
            var handle = GCHandle.Alloc(elements, GCHandleType.Pinned);

            try
            {
                CLException.ThrowIfFailed(NativeMethods.GetKernelWorkGroupInfo(
                                              kernel,
                                              device,
                                              type,
                                              new IntPtr(Interop.SizeOf <T>() * elements.Length),
                                              handle.AddrOfPinnedObject().ToPointer(),
                                              IntPtr.Zero));
            }
            finally
            {
                handle.Free();
            }
        }