-
Notifications
You must be signed in to change notification settings - Fork 139
Open
Labels
Description
Question
I need to run a method created dynamically.
DynamicMethod dm=new DynamicMethod("Test", typeof(void),new Type[]{typeof(Index1D),typeof(ArrayView<Single>)},typeof(Program));
var il= dm.GetILGenerator();
il.Emit(OpCodes.Ret);
var del=dm.CreateDelegate<Action<Index1D,ArrayView<float>>>();
/*
equals to:
static void Test(
Index1D index,ArrayView<float> buffer) // A view of floats to store float results from GPUMath
{
return;
}
*/
using var context = Context.CreateDefault();
using var accelerator = context.GetPreferredDevice(preferCPU: true).CreateAccelerator(context);
var kernel = accelerator.LoadAutoGroupedStreamKernel(del);
using var buffer = accelerator.Allocate1D<float>(128);
kernel((int)buffer.Length, buffer.View);
However, exception System.NotSupportedException: Derived classes must provide an implementation. takes place.
Is there any way to compile a dynamically created method with ILGpu?
And there's no "Derived classes" I think
Environment
- ILGPU version: 1.5.3
- .NET version: 10
- Operating system: Windows10
- Hardware (if GPU-related): this problem may not be related to hardware
Additional context
No response
Reactions are currently unavailable