Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • sac2c sac2c
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 394
    • Issues 394
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 17
    • Merge requests 17
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • sac-group
  • sac2csac2c
  • Issues
  • #2321
Closed
Open
Created Jan 16, 2023 by Sven-Bodo Scholz@sbsOwner

EMRL bug

The following example:

use Array: all;
use StdIO: all;


#define N 20
#define BS 10

noinline
float[N] stencil_1D_fix (float[3] weights, int n, float[N] v)
{
    for (i=0; i<n; i++) {
        v = { iv -> sum (weights * tile ([3], iv-1, v)) | [1] <= iv < [N-1];
              iv -> v[iv] };
    }
    return v;
}

int main()
{
    a = genarray( [N], 0f);
    a[10] = 10f;
    print (a);

    b = stencil_1D_fix ([0.25f,0.5f,0.25f], 10, a);
    print (b);
    print (a);

    return 0;
}

when compiled with

sac2c 1.3.3-MijasCosta-1032-gff7ec
build-type: RELEASE
built-by: "sbs" at 2023-01-16T16:50:26

using no flags, yields the erroneous result:

-sbs-n142121-> ./a.out
Dimension:  1
Shape    : < 20>
<0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 10.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 >
Dimension:  1
Shape    : < 20>
<0.000000 0.000191 0.001812 0.010872 0.046206 0.147858 0.369644 0.739288 1.201344 1.601791 1.761971 1.601791 1.201344 0.739288 0.369644 0.147858 0.046206 0.010872 0.001802 0.000000 >
Dimension:  1
Shape    : < 20>
<0.000000 0.000191 0.001812 0.010872 0.046206 0.147858 0.369644 0.739288 1.201344 1.601791 1.761971 1.601791 1.201344 0.739288 0.369644 0.147858 0.046206 0.010872 0.001802 0.000000 >

When compiled with -noEMRL, we get the correct result:

-sbs-n142121-> ./a.out
Dimension:  1
Shape    : < 20>
<0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 10.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 >
Dimension:  1
Shape    : < 20>
<0.000000 0.000191 0.001812 0.010872 0.046206 0.147858 0.369644 0.739288 1.201344 1.601791 1.761971 1.601791 1.201344 0.739288 0.369644 0.147858 0.046206 0.010872 0.001802 0.000000 >
Dimension:  1
Shape    : < 20>
<0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 10.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 >
Edited Jan 16, 2023 by Sven-Bodo Scholz
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking