/// <summary> /// Loads the given kernel and returns a launcher delegate that is associated /// with the given accelerator stream. Consequently, the resulting delegate /// cannot receive other accelerator streams. /// </summary> /// <param name="method">The method to compile into a kernel.</param> /// <param name="stream">The accelerator stream to use.</param> /// <returns>The loaded kernel-launcher delegate.</returns> public TDelegate LoadAutoGroupedStreamKernel <TDelegate>(MethodInfo method, AcceleratorStream stream) where TDelegate : class { var loader = AutoKernelLoader.Default; var launcher = new StreamLauncherProvider(stream); return(LoadGenericKernel <TDelegate, AutoKernelLoader, StreamLauncherProvider>( method, KernelSpecialization.Empty, ref loader, ref launcher)); }
/// <summary> /// Loads the given kernel and returns a launcher delegate that is associated /// with the given accelerator stream. Consequently, the resulting delegate /// cannot receive other accelerator streams. /// </summary> /// <typeparam name="TDelegate">The delegate type.</typeparam> /// <param name="method">The method to compile into a kernel.</param> /// <param name="stream">The accelerator stream to use.</param> /// <param name="specialization">The kernel specialization.</param> /// <returns>The loaded kernel-launcher delegate.</returns> /// <remarks> /// Note that implictly-grouped kernels will be launched with a group size /// of the current warp size of the accelerator. /// </remarks> public TDelegate LoadStreamKernel <TDelegate>(MethodInfo method, AcceleratorStream stream, KernelSpecialization specialization) where TDelegate : class { var loader = DefaultKernelLoader.Default; var launcher = new StreamLauncherProvider(stream); return(LoadGenericKernel <TDelegate, DefaultKernelLoader, StreamLauncherProvider>( method, specialization, ref loader, ref launcher)); }
/// <summary> /// Loads the given kernel and returns a launcher delegate that is associated /// with the given accelerator stream. Consequently, the resulting delegate /// cannot receive other accelerator streams. /// </summary> /// <param name="method">The method to compile into a kernel.</param> /// <param name="customGroupSize">The custom group size to use.</param> /// <param name="stream">The accelerator stream to use.</param> /// <returns>The loaded kernel-launcher delegate.</returns> /// <remarks> /// Note that implictly-grouped kernel will be launched with the given /// group size. /// </remarks> public TDelegate LoadImplicitlyGroupedStreamKernel <TDelegate>( MethodInfo method, int customGroupSize, AcceleratorStream stream) where TDelegate : class { var loader = new GroupedKernelLoader(customGroupSize); var launcher = new StreamLauncherProvider(stream); return(LoadGenericKernel <TDelegate, GroupedKernelLoader, StreamLauncherProvider>( method, new KernelSpecialization(customGroupSize, null), ref loader, ref launcher)); }
/// <summary> /// Loads the given kernel and returns a launcher delegate that is associated /// with the given accelerator stream. Consequently, the resulting delegate /// cannot receive other accelerator streams. /// </summary> /// <param name="method">The method to compile into a kernel.</param> /// <param name="stream">The accelerator stream to use.</param> /// <param name="groupSize">The estimated group size to gain maximum occupancy on this device.</param> /// <param name="minGridSize">The minimum grid size to gain maximum occupancy on this device.</param> /// <returns>The loaded kernel-launcher delegate.</returns> public TDelegate LoadAutoGroupedStreamKernel <TDelegate>( MethodInfo method, AcceleratorStream stream, out int groupSize, out int minGridSize) where TDelegate : class { var loader = AutoKernelLoader.Default; var launcher = new StreamLauncherProvider(stream); var result = LoadGenericKernel <TDelegate, AutoKernelLoader, StreamLauncherProvider>( method, KernelSpecialization.Empty, ref loader, ref launcher); groupSize = loader.GroupSize; minGridSize = loader.MinGridSize; return(result); }