-
Notifications
You must be signed in to change notification settings - Fork 139
Open
Description
Describe the bug
There seems to be a bug in the ILGPU compiler.
I have reduced my code to the following minimal example. The given unit test fails with the message: "An internal compiler error has been detected in method Void KernelMethod(ParameterLayer1)". Most changes in the remaining code let the unit test succeed; apparently the problem lies in the somewhat complex nature of the code.
using ILGPU;
using ILGPU.Runtime;
public sealed class FactsClass
{
[Fact]
public void This_unit_test_fails()
{
var context = Context.Create(builder => builder.AllAccelerators());
var device = context.GetPreferredDevice(false);
var accelerator = device.CreateAccelerator(context);
var loadedKernel = accelerator.LoadStreamKernel<ParameterLayer1>(KernelMethod);
}
private static void KernelMethod(ParameterLayer1 p)
{
var v = DataLayer1.StaticMemberStruct.A;
}
private readonly record struct ParameterLayer1(ParameterLayer2 p2);
private readonly record struct ParameterLayer2(ParameterLayer3 p3);
private readonly record struct ParameterLayer3(ParameterLayer4 p4);
private readonly record struct ParameterLayer4(float a, TestVector b);
private readonly struct DataLayer1
{
public static DataLayer2 StaticMemberStruct { get; } = new(new TestVector(float.MaxValue, float.MaxValue, float.MaxValue), float.MaxValue);
}
private readonly struct DataLayer2(TestVector a, float b)
{
public readonly TestVector A = a;
public readonly float B = b;
}
private readonly record struct TestVector(float X, float Y, float Z);
}
Environment
- ILGPU version: 1.5.3
- .NET version: .NET 9
- Operating system: Windows 11
- Hardware: AMD Ryzen 9
Steps to reproduce
- Run the provided unit test.
Expected behavior
The kernel should compile and run successfully.
Additional context
No response