0

I get Fody/Alea: TODO Transform: ILLabel error in VS, when trying to compile following code:

static void Main(string[] args)
{
    var gpu = Gpu.Default;
    gpu.For(0, 100, idx => Do(idx));

    Console.ReadKey();
}

[GpuManaged]
public static void Do(int idx)
{
    bool isTrue = false;
    bool one = true;
    bool two = true;

    for (int i = 0; i < 10; i++)
    {
        if (isTrue)
        {
            if (one)
                continue;

            isTrue = false;
        }
        else
        {
            if (two)
                continue;

            isTrue = true;
        }
    }
}

enter image description here

The issue is only reproducible when putting the [GpuManaged] attribute. Also I have noticed that if you remove if (one) continue; and if (two) continue; then error disappears. How do I fix it?

The code was simplified a lot from my actual solution, but this should be enough to see the issue..

  • win 10 x64
  • alea 3.0.4
  • alea.fody 3.0.4
  • fsharp.core 4.3.4
  • geforce GT 710
Alex
  • 4,607
  • 9
  • 61
  • 99
  • Marking method with `GpuManaged` makes alea to rewrite your method (on IL level) to work on gpu, and not every nonsense can be converted like this. – Evk Apr 17 '18 at 15:34
  • an actual version of the code looks like the one mentioned here: https://stackoverflow.com/questions/49883187/monitor-blinks-and-program-throws-exception-when-using-alea I didn't want people to look at the more complicated version within the scope of this ticket. As they then would have more unrelated questions.. Better keep it as simple as possible. – Alex Apr 17 '18 at 16:42
  • Ok, I just thought that maybe you are just playing with alea and not actually have real code, and wanted to point out that not every code can be run this way. – Evk Apr 17 '18 at 16:43
  • @Evk Actually, the version of the code which I provided in a link is also a simplified in regards to the fact that the data contains either `0` and `false`s. In real data there all kinds of `doubles`, `bool`eans and `int`egers and also the amount of data that is being processed in a loop is `720mil` of records! It takes around 12 hours to process it on my `CPU`. I have migrated the code to `aleagpu` successfully, except, it keeps throwing me exceptions on every occasion. :) I have created 3 separate issues on SO for every issue I encounter, hoping to resolve at least any of the these.. – Alex Apr 17 '18 at 16:52

0 Answers0