sac2c issueshttps://gitlab.sac-home.org/sac-group/sac2c/-/issues2022-02-08T18:19:19Zhttps://gitlab.sac-home.org/sac-group/sac2c/-/issues/2276crash while inferring ranges for set expressions2022-02-08T18:19:19ZRobert Berneckycrash while inferring ranges for set expressionssac2c crashes quickly on this:
```
use Array:{sel};
int main()
{
y = [true, false];
z = with {
//(. <= iv <= .) : sel( sel( iv, y) ? ["0 "] : ["1 "]);
(. <= iv <= .) : sel( true ? ["0 "] : ["1 "]);
} : genar...sac2c crashes quickly on this:
```
use Array:{sel};
int main()
{
y = [true, false];
z = with {
//(. <= iv <= .) : sel( sel( iv, y) ? ["0 "] : ["1 "]);
(. <= iv <= .) : sel( true ? ["0 "] : ["1 "]);
} : genarray([2]);
return(0);
}
```Sven-Bodo ScholzSven-Bodo Scholzhttps://gitlab.sac-home.org/sac-group/sac2c/-/issues/2275Newly cloned sac2c does not like extant ~/.sac2crc folder2021-09-15T19:06:00ZRobert BerneckyNewly cloned sac2c does not like extant ~/.sac2crc folderI ran into this while trying to build a newly cloned sac2c on my system. I don't particularly want to blow
away the other sac2crc stuff...
Regardless of that, the error message is clearly wrong. What's the best
way to handle this?
T...I ran into this while trying to build a newly cloned sac2c on my system. I don't particularly want to blow
away the other sac2crc stuff...
Regardless of that, the error message is clearly wrong. What's the best
way to handle this?
This is my commit after:
commit 9e509b33cd5f24726a0a5a4c78d329044c6a2649 (origin/develop, origin/HEAD, NoSerialize)
```
~/sac2c.Mainbranch/sac2c/build_r$ sudo make install
[sudo] password for sac:
[ 0%] Checking git repo version
[ 0%] Built target check_repo_version
[ 1%] Built target sac2c
[ 1%] Built target cse
[ 1%] Built target echo
[ 1%] Built target sac2tex
[ 2%] Built target csd
[ 2%] Built target cb
[ 2%] Copying over sac2crc file to user's .sac2crc directory
CMake Error at /home/sac/sac2c.Mainbranch/sac2c/cmake/place-sac2crc-prelude-file.cmake:30 (MESSAGE):
No ~/.sac2crc directory found, please create it. If you have a `.sac2crc'
file, please move this to the ~/.sac2crc directory and rename it
`sac2crc.config'.
make[2]: *** [CMakeFiles/copy-sac2crc-prelude-file.dir/build.make:71: CMakeFiles/copy-sac2crc-prelude-file] Error 1
make[1]: *** [CMakeFiles/Makefile2:554: CMakeFiles/copy-sac2crc-prelude-file.dir/all] Error 2
make: *** [Makefile:166: all] Error 2
sac@boa:~/sac2c.Mainbranch/sac2c/build_r$ git status .
On branch develop
Your branch is ahead of 'origin/develop' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
```https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2274TC problem with conditionals2021-09-20T09:40:55ZSven-Bodo ScholzTC problem with conditionalsThe following program
```
int main()
{
bodies = [1,2,3,4,5,6,7];
accs = {[i] -> {[j] -> (_eq_SxS_(i,j) ? _sel_VxA_([i], bodies) : _sel_VxA_([j], bodies)) } };
return(0);
}
```
when compiled with `-noprelude` yields:
```
./b...The following program
```
int main()
{
bodies = [1,2,3,4,5,6,7];
accs = {[i] -> {[j] -> (_eq_SxS_(i,j) ? _sel_VxA_([i], bodies) : _sel_VxA_([j], bodies)) } };
return(0);
}
```
when compiled with `-noprelude` yields:
```
./bodies.sac 5 error: Identifier '_hce_23` used without previous definition
./bodies.sac 5 error: Identifier '_hce_22` used without previous definition
./bodies.sac 5 error: Identifier '_hce_25` used without previous definition
./bodies.sac 5 error: Identifier '_hce_24` used without previous definition
compilation failed while Converting to static single assignment form, 4 error(s).
```
in phase 4 when using
```
sac2c 1.3.3-MijasCosta-721-g71fd
```Sven-Bodo ScholzSven-Bodo Scholzhttps://gitlab.sac-home.org/sac-group/sac2c/-/issues/2273Create a release2021-09-01T11:27:03ZHans-Nikolai ViessmannCreate a releaseIts been a while since we released a 'stable' version of sac2c. I don't see any reason to delay this, I think the compiler is pretty stable at the moment (seq, mt-pth, cuda targets seems to work fine).
Before we do this though, I think ...Its been a while since we released a 'stable' version of sac2c. I don't see any reason to delay this, I think the compiler is pretty stable at the moment (seq, mt-pth, cuda targets seems to work fine).
Before we do this though, I think there are a few things we should consider:
- [ ] what do we name it? _There hasn't been a devcamp in a while, so I guess we're going to have to get creative here..._
- [ ] decide on some schedule, or conditions to help us get into the habit of making releases more regularly (last stable release is 1.3.3-MijasCosta)
- [ ] in https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2269#note_10870, @rbe makes a really good point regarding actually documenting the changes in the compiler (especially new features!). This would help making it more clear how much work is going into the compiler, and what research activities this is driving. For example, we have two presentations at IFL2021 talking about new features that are in the pipeline to be merged in a some point. I think adding a CHANGELOG file to the repo, and as part of a MR filling it in would go a long way. The changelog might also help in figuring out when to make a release (major or minor).
I probably missed out some things to consider, suggestions are welcome!!!Create a releaseHans-Nikolai ViessmannHans-Nikolai Viessmannhttps://gitlab.sac-home.org/sac-group/sac2c/-/issues/2272valgrind value errors detected in sac2c WLIR, PH, TRAVdo...2021-08-29T16:32:12ZRobert Berneckyvalgrind value errors detected in sac2c WLIR, PH, TRAVdo...Holden and I are trying to find out why sac2c runs several orders of magnitude slower than it should.
Our APEX CI tests can't even run the APEX UnitTests in an hour!
I stumbled on this just now, while hoping to find some directions fro...Holden and I are trying to find out why sac2c runs several orders of magnitude slower than it should.
Our APEX CI tests can't even run the APEX UnitTests in an hour!
I stumbled on this just now, while hoping to find some directions from valgrind:
```
Sun 22 Aug 2021 11:41:14 AM EDT
apex@boa:~/apexgit/Ancillary/benchmks/UnitTests/UTTakeDrop/src$ valgrind sac2c UTTakeDrop.sac
==13174== Memcheck, a memory error detector
==13174== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==13174== Using Valgrind-3.16.1 and LibVEX; rerun with -h for copyright info
==13174== Command: sac2c UTTakeDrop.sac
==13174==
==13174== Conditional jump or move depends on uninitialised value(s)
==13174== at 0x51E6D39: merge_dmask (withloop_invariant_removal.c:346)
==13174== by 0x51E6D39: WLIRassign (withloop_invariant_removal.c:779)
==13174== by 0x5213F3C: TRAVdo (traverse.c:97)
==13174== by 0x51E6BF9: WLIRblock (withloop_invariant_removal.c:650)
==13174== by 0x5213F3C: TRAVdo (traverse.c:97)
==13174== by 0x51E6AC3: WLIRfundef (withloop_invariant_removal.c:554)
==13174== by 0x5213F3C: TRAVdo (traverse.c:97)
==13174== by 0x51E7A7D: WLIRdoLoopInvariantRemoval (withloop_invariant_removal.c:1072)
==13174== by 0x51045EF: PHrunCyclePhaseFun (phase.c:588)
==13174== by 0x5104B71: PHDdriveCycleFun_cyc (phase_sac2c.mac:397)
==13174== by 0x5104382: PHrunCycleFun (phase.c:519)
==13174== by 0x5105694: PHDdriveCycle_cyc (phase_sac2c.mac:314)
==13174== by 0x5103C19: PHrunCycle (phase.c:332)
==13174==
```https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2271WLF multi-operator bug2021-08-19T16:12:01ZSven-Bodo ScholzWLF multi-operator bugThe following program:
```
int main()
{
ax,ay = with {
( [0, 0] <= [i,j] < [2,10]) : (2, 2.0);
} : ( genarray( [10,10] ,1),
genarray( [10,10], 1.0 ));
ax,ay = with {
( [0, 0] <= [i...The following program:
```
int main()
{
ax,ay = with {
( [0, 0] <= [i,j] < [2,10]) : (2, 2.0);
} : ( genarray( [10,10] ,1),
genarray( [10,10], 1.0 ));
ax,ay = with {
( [0, 0] <= [i,j] < [2,10]) : (_sel_VxA_([i,j], ax), _sel_VxA_([i,j], ay));
} : ( genarray( [10,10] ,1),
genarray( [10,10], 1.0 ));
return _sel_VxA_( [2,2], ax) ;
}
```
when compiled with
`sac2c 1.3.3-MijasCosta-682-gd1a1`
replaces the second selection wrongly, which subsequently leads to the following error:
```
error: line 9 in file ./reg.sac:
error: Element types of one generator body expression and another generator body expression should be identical; types found:
error: double{1.0...} and int{2}
compilation failed while Running SAC optimizations.
```https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2270WLIDX breakes on multi-operator WL2021-08-10T12:42:56ZSven-Bodo ScholzWLIDX breakes on multi-operator WLName: sac2c
Version: 1.3.3-MijasCosta-682-gd1a1
Build-type: DEBUG
Date: 2021-08-07T23:34:36
User: sbs
Host: SvenBodosAir2.fritz.box
...Name: sac2c
Version: 1.3.3-MijasCosta-682-gd1a1
Build-type: DEBUG
Date: 2021-08-07T23:34:36
User: sbs
Host: SvenBodosAir2.fritz.box
Detected OS string: Darwin-20.3.0
Detected CPU string: x86_64
CMake Generator: Unix Makefiles
CMake Variant: DEBUG
when run with -v3 reg.sac -bopt:wlidx -noprelude
on
```c
int main()
{
zz_c_g = 0;
zz_c_h = 1.0;
zz_a = [1,2];
zz_b = 6;
yy_c_g = 9;
yy_c_h = 3.0;
yy_a = [5,6];
yy_b = 7;
dim = [3,3];
zz_c_g, zz_c_h, zz_a, zz_b = with {
( [0, 0] <= [i,j] < [1,1] ) : (yy_c_g, yy_c_h, yy_a, yy_b);
} : (genarray( dim, zz_c_g),
genarray( dim, zz_c_h),
genarray( dim, zz_a),
genarray( dim, zz_b));
StdIO::print( _sel_VxA_ ([0,0], zz_b) );
return 0;
}
```
breaks with
```
**** Annotating offset variable at with-loops ...
OOOOOOOPS, your program crashed the compiler 8-((
Please, send a bug report to bugs@sac-home.org,
or file a bug in the SaC-Zilla bug management system.
For your convenience, the compiler has pre-fabricated a bug report
in the file "./reg.sacbugreport" !
```https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2269sac2c download package assumes cuda exists2021-09-03T20:07:12ZOliver Fentonsac2c download package assumes cuda existsHolden Hoover is trying to make sac2c work from the package download for ubuntu 18.04, and he is using 21.04.
However, any compile he has tried fails with the linker complaining about cudart and cublas(?).
His machine does not have CUDA...Holden Hoover is trying to make sac2c work from the package download for ubuntu 18.04, and he is using 21.04.
However, any compile he has tried fails with the linker complaining about cudart and cublas(?).
His machine does not have CUDA.
Perhaps the download instructions need improvement, or updating for a more recent ubuntu.
Meanwhile, I think the correct solution is to grant Holden access to the gitlab repository,
as he is working on some sac2c-related work for me.Hans-Nikolai ViessmannHans-Nikolai Viessmannhttps://gitlab.sac-home.org/sac-group/sac2c/-/issues/2268-mt compile dies in code generation: "linksign illegal"2021-07-03T05:13:25ZRobert Bernecky-mt compile dies in code generation: "linksign illegal"I do not recall observing this failure before. Is it new?
It fails with naked "make", too.
```
> [ 94%] Built target seq-prog-schedrAKD
> //home/apex/apexgit/Ancillary/benchmks/benchmksPerf/kroneckerproduct/src/kroneckerproduct.sac:17...I do not recall observing this failure before. Is it new?
It fails with naked "make", too.
```
> [ 94%] Built target seq-prog-schedrAKD
> //home/apex/apexgit/Ancillary/benchmks/benchmksPerf/kroneckerproduct/src/kroneckerproduct.sac:171:3: error:
> => Pragma 'linksign' illegal: mappings allowed exclusively between parameters with identical types
> compilation failed while Preparing C code generation, 1 error(s).
> make[2]: *** [kroneckerproduct/src-mt_pth/CMakeFiles/mt_pth-module-kroneckerproduct.dir/build.make:74: lib/host/mt-pth/libkroneckerproductMod.so] Error 129
> make[2]: Target 'kroneckerproduct/src-mt_pth/CMakeFiles/mt_pth-module-kroneckerproduct.dir/build' not remade because of errors.
> make[1]: *** [CMakeFiles/Makefile2:410: kroneckerproduct/src-mt_pth/CMakeFiles/mt_pth-module-kroneckerproduct.dir/all] Error 2
> //home/apex/apexgit/Ancillary/benchmks/benchmksPerf/kroneckerproduct/src/kroneckerproduct.sac:171:3: error:
> => Pragma 'linksign' illegal: mappings allowed exclusively between parameters with identical types
> compilation failed while Preparing C code generation, 1 error(s).
> make[2]: *** [kroneckerproduct/src-mt_pth/CMakeFiles/mt_pth-prog-kroneckerproduct.dir/build.make:78: lib/host/mt-pth/libkroneckerproductMod.so] Error 129
> make[2]: Target 'kroneckerproduct/src-mt_pth/CMakeFiles/mt_pth-prog-kroneckerproduct.dir/build' not remade because of errors.
> make[1]: *** [CMakeFiles/Makefile2:384: kroneckerproduct/src-mt_pth/CMakeFiles/mt_pth-prog-kroneckerproduct.dir/all] Error 2
> make[1]: Target 'all' not remade because of errors.
> make: *** [Makefile:136: all] Error 2
> make: Target 'default_target' not remade because of errors.
> apex@boa:~/apexgit/Ancillary/benchmks/benchmksPerf/build$
```
```
sac2c -V
sac2c 1.3.3-MijasCosta-677-g0587e
build-type: RELEASE
built-by: "sac" at 2021-06-23T15:20:00
```https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2267negative array shape crash in code generator2021-06-29T20:39:21ZRobert Berneckynegative array shape crash in code generator
```
sac2c_d snp3.codegencrash.sac -v1
Internal compiler error
Assertion "size >= 0" failed at /home/sac/sac2c.AprilFool/sac2c/src/libsac2c/codegen/icm2c_std.c:1250 -- array with size <0 found!
```
```
cat snp3.codegencrash.sac
use ...
```
sac2c_d snp3.codegencrash.sac -v1
Internal compiler error
Assertion "size >= 0" failed at /home/sac/sac2c.AprilFool/sac2c/src/libsac2c/codegen/icm2c_std.c:1250 -- array with size <0 found!
```
```
cat snp3.codegencrash.sac
use Array: {genarray,sum,shape,toi,sel,-,drop,==};
inline // ! ! ! must be inlined to fail
bool[.,.,.] jotdoteqIIB(int [.] x, int [.,.] y)
{ /* AxA outer product */
cell = genarray(shape(y), false);
z = with { (. <= iv <= .) { xitem = x[iv];
} : xitem == y;
} : genarray(shape(x), cell);
return(z);
}
int[.,.] plusslXBIFOLD(bool[.,.,.] y)
{ /* last axis reduce rank-2 or greater matrix w/folding */
zrho = [3,10000];
z = with { (. <= iv <= .)
: sum(toi(y[iv]));
} : genarray(zrho, 0);
return(z);
}
int main()
{
snp_0 = genarray([10000,80000], 2);
A_17=jotdoteqIIB([0, 1, 2],snp_0);
A_56=plusslXBIFOLD( A_17);
return(sum(A_56));
}
```
```
sac2c -V
sac2c 1.3.3-MijasCosta-677-g0587e
build-type: RELEASE
built-by: "sac" at 2021-06-23T15:20:00]
```Artem ShinkarovArtem Shinkarovhttps://gitlab.sac-home.org/sac-group/sac2c/-/issues/2266Bad mt-pth code generation2022-11-20T12:08:54ZRobert BerneckyBad mt-pth code generationThis failure is in the apex Ancillary/benchmks/UnitTests/UTCatenate test, while running make.
```
[ 54%] Building UTCatenate.unittest.sac program for target `mt_pth'
[ 54%] Built target mt_pth-module-UTCatenate
/home/apex/apexgit/Ancil...This failure is in the apex Ancillary/benchmks/UnitTests/UTCatenate test, while running make.
```
[ 54%] Building UTCatenate.unittest.sac program for target `mt_pth'
[ 54%] Built target mt_pth-module-UTCatenate
/home/apex/apexgit/Ancillary/benchmks/UnitTests/build/UTCatenate-mt_pth.c: In function ‘SACf__MAIN_CL_ST___mtspmdf_53698_main__bl_26__bl__bl’:
/home/apex/apexgit/Ancillary/benchmks/UnitTests/build/UTCatenate-mt_pth.c:9558:89: warning: implicit declaration of function ‘NONE’ [-Wimplicit-function-declaration]
9558 | SAC_MT_SYNC_FOLD_out( SACf__MAIN_CL_ST___mtspmdf_53698_main__bl_26__bl__bl, 1, (SACp_emal_51959__pinl_22603__ea_47__flat_310, (SCL, (NHD, (NUQ, (INT, (GLO, (FPO, (NOT, (NDI, (BOO, )))))))))), (SACp_mtspmdfanon_53696__pinl_22603__ea_47__flat_310, (SCL, (NHD, (NUQ, (INT, (GLO, (NON, (NOT, (NDI, (BOO, )))))))))), bool, ND, NONE);
| ^~~~
/usr/bin/ld: /tmp/SAC_1RSJBE/UTCatenate-mt_pth.o: in function `SACf__MAIN_CL_ST___mtspmdf_53698_main__bl_26__bl__bl':
/home/apex/apexgit/Ancillary/benchmks/UnitTests/build/UTCatenate-mt_pth.c:9558: undefined reference to `NONE'
collect2: error: ld returned 1 exit status
abort: System failed to execute shell command
```
```
sac2c -V
sac2c 1.3.3-MijasCosta-667-g56d30
build-type: RELEASE
built-by: "sac" at 2021-05-26T16:16:09
```https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2265test-memrt-lift1 problems2021-06-15T08:36:25ZSven-Bodo Scholztest-memrt-lift1 problemsThese are most likely two bugs in one.
test-memrt-lift1.sac fails in the current cuda-mappings-branch. Closer inspection shows that the develop version exposes some weird code as well.
The original test code is:
```
use Array: all;
i...These are most likely two bugs in one.
test-memrt-lift1.sac fails in the current cuda-mappings-branch. Closer inspection shows that the develop version exposes some weird code as well.
The original test code is:
```
use Array: all;
inline
int[+] onestep (int[+] B)
{
A = with {
(. < x < .) : 2 * (B[x+[1,0]]
+ B[x-[1,0]]
+ B[x+[0,1]]
+ B[x-[0,1]]);
} : modarray (B);
return(A);
}
noinline
int[+] operation (int[+] A)
{
steps = 100;
do {
B = A;
A = onestep (B);
steps--;
} while ((sum (A) > sum (B)) && (steps > 0));
return (A);
}
int main ()
{
A = with {
([0,1] <= x <= .) : 0;
} : genarray ([1000,1000], 500);
A = operation (A);
return _toi_S_ (A[100,100]);
}
```
The develop version ( 1.3.3-MijasCosta-672-g1ad640) generates for operation:
```
int[1000,1000] _MAIN::operation( int[1000,1000] A { ,NN } )
/*
* operation :: ---
*/
{
int_dev[1000,1000] _iwlmem_3481_dev { , NN } ;
int{0} _dlirmov_3445__pinl_840__flat_3 { , NN } ;
int[1000,1000] A__SSA0_1 { , NN } ; /* declared: int[+] */
int{100} steps { , NN } ;
int[1000,1000] _emrl_3478_emr_lifted { , NN } ; /* declared: int[1000,1000] */
steps = 100;
_dlirmov_3445__pinl_840__flat_3 = 0;
/** Is allowed to be moved up **/
_iwlmem_3481_dev = /* ERC () */ _host2device_( _emrl_3478_emr_lifted);
A__SSA0_1 = _MAIN::_dup_64_operation__Loop_1( _dlirmov_3445__pinl_840__flat_3, steps, A, _iwlmem_3481_dev) ;
return( A__SSA0_1);
}
```
ie it transfers an unitialised _emrl_3478_emr_lifted to the device which then correctly acts as ERC.
However, the transfer is not making *any* sense here.
To make matters worse, the current cuda-mappings branch for some reason does not lift the transfer out of the loop at all;
doing an illegal transfer inside the loop:
```
int[1000,1000] _MAIN::_dup_64_operation__Loop_1( int{0} _pinl_840__flat_3 { ,NN } , int steps { ,NN } , int[1000,1000] A { ,NN } , int[1000,1000] _emrl_3497_emr_tmp { ,NN } )
// elided decls
/** Is NOT allowed to be moved up **/
_iwlmem_3501_dev = /* ERC () */ _host2device_( _emrl_3497_emr_tmp);
/** Is NOT allowed to be moved up **/
_iwlmem_3500_dev = /* ERC () */ _host2device_( A);
```
where this function is initially called with
```
int[1000,1000] _MAIN::operation( int[1000,1000] A { ,NN } )
/*
* operation :: ---
*/
{
int{0} _dlirmov_3465__pinl_840__flat_3 { , NN } ;
int[1000,1000] A__SSA0_1 { , NN } ; /* declared: int[+] */
int{100} steps { , NN } ;
int[1000,1000] _emrl_3498_emr_lifted { , NN } ; /* declared: int[1000,1000] */
steps = 100;
_dlirmov_3465__pinl_840__flat_3 = 0;
A__SSA0_1 = _MAIN::_dup_64_operation__Loop_1( _dlirmov_3465__pinl_840__flat_3, steps, A, _emrl_3498_emr_lifted) ;
```
ie, _emrl_3498_emr_lifted is passed without being initialised.....Hans-Nikolai ViessmannHans-Nikolai Viessmannhttps://gitlab.sac-home.org/sac-group/sac2c/-/issues/2264Misleading sac2c -h text or maybe the compiler is busted2021-05-26T20:39:51ZRobert BerneckyMisleading sac2c -h text or maybe the compiler is bustedI did this:
```
cd build
sac2c logd.unittest.sac -o /tmp/crud2/foo.exe
```
This had the effects of:
1. putting foo.exe into the current directory, and
2. putting foo.exe.c into /tmp/crud/foo.exe.c.
I would like to be able to spec...I did this:
```
cd build
sac2c logd.unittest.sac -o /tmp/crud2/foo.exe
```
This had the effects of:
1. putting foo.exe into the current directory, and
2. putting foo.exe.c into /tmp/crud/foo.exe.c.
I would like to be able to specify where sac2c puts the executable, but
it looks like it always puts it in the current directory, regardless
of the -o argument.
sac2c -h suggests that this might be possible:
> When compiling a SAC program, sac2c stores the corresponding
> intermediate C code either in the file a.out.c in the current directory
> (default) or in the file <file>.c if <file> is specified using the -o
> option. Here, any absolute or relative path name may be used.
> The executable program is either written to the file a.out or to any
> file specified using the -o option.
Suggestions welcome.https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2263Implicit function declaration when calling MathArray::exp with -specmode aud2021-05-26T06:21:24ZArtem ShinkarovImplicit function declaration when calling MathArray::exp with -specmode audThis code:
```c
module e; export {foo};
float[*] tof(int[*] x) { return { iv -> _tof_S_ (_sel_VxA_ (iv, x)) }; }
void foo ()
{
StdIO::print(MathArray::exp(tof([1,2,3])));
}
```
causes this warning:
```
In file included from /tmp/sa...This code:
```c
module e; export {foo};
float[*] tof(int[*] x) { return { iv -> _tof_S_ (_sel_VxA_ (iv, x)) }; }
void foo ()
{
StdIO::print(MathArray::exp(tof([1,2,3])));
}
```
causes this warning:
```
In file included from /tmp/sac2c/build_d/include/sac.h:50,
from /tmp/SAC_aHNwH1/header.h:278,
from /tmp/SAC_aHNwH1/fun1.c:1:
/tmp/SAC_aHNwH1/fun1.c: In function ‘SACf_e__foo’:
/tmp/SAC_aHNwH1/fun1.c:459:20: warning: implicit declaration of function ‘SACwf_MathArray__exp__f_S’; did you mean ‘SACf_MathArray__exp__f_P’? [-Wimplicit-function-declaration]
459 | SAC_ND_FUNAP2( SACwf_MathArray__exp__f_S, SAC_ND_ARG_out( SAC_SET_NT_USG( FAG, (SACp_flat_42, (AUD, (NHD, (NUQ, (FLO, (GLO, (NON, (NOT, (NDI, (FLO, ))))))))))), float), SAC_ND_ARG_in( SAC_SET_NT_USG( FAG, (SACp_flat_43, (AUD, (NHD, (NUQ, (FLO, (GLO, (NON, (NOT, (NDI, (FLO, ))))))))))), float))
| ^~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/sac2c/build_d/include/runtime/essentials_h/std.h:331:34: note: in definition of macro ‘SAC_ND_FUNAP2’
331 | #define SAC_ND_FUNAP2(name, ...) name (__VA_ARGS__);
| ^~~~
```https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2262-dtreecheck bug2021-05-23T17:42:08ZSven-Bodo Scholz-dtreecheck bugThis issue has evolved from #2259 and #2261 which now both work without treecheck but fail through treecheck in phase 21:
```
** 21: Generating Code ...
**** Tag preparation ...
-> Running syntax tree checks
**** Creating...This issue has evolved from #2259 and #2261 which now both work without treecheck but fail through treecheck in phase 21:
```
** 21: Generating Code ...
**** Tag preparation ...
-> Running syntax tree checks
**** Creating intermediate code macros ...
-> Running syntax tree checks
warning: mandatory attribute ID_AVIS is NULL
...
warning: mandatory attribute ID_AVIS is NULL
OOOOOOOPS, your program crashed the compiler 8-((
```https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2261l2f problem2021-05-24T13:07:39ZSven-Bodo Scholzl2f problemThe following code does create an illeagal AST after b8:l2f:
```c
module a;
export {NOTmain};
inline int + (int a, int b) { return _add_SxS_ (a, b); }
inline int - (int a, int b) { return _sub_SxS_ (a, b); }
inline int * (int a, int b...The following code does create an illeagal AST after b8:l2f:
```c
module a;
export {NOTmain};
inline int + (int a, int b) { return _add_SxS_ (a, b); }
inline int - (int a, int b) { return _sub_SxS_ (a, b); }
inline int * (int a, int b) { return _mul_SxS_ (a, b); }
inline int - (int b) { return _sub_SxS_ (0, b); }
inline bool < (int a, int b) { return _lt_SxS_ (a, b); }
inline int[.] shape (int[*] a) { return _shape_A_ (a); }
inline int ++ (int a) { return _add_SxS_ (a, 1); }
inline int sel(int[.] idx, int[*] a) { return _sel_VxA_ (idx, a); }
inline int mpybslXII(int[.] y)
{ /* Scan of vector */
size = shape(y);
arg = with{}:genarray(size,1);
z = 42;
for ( i=1; i<size[[0]]; i++) {
z = z + 4 * 3;
}
return(z);
}
int NOTmain ()
{
z=mpybslXII( [2,3,1]);
return(z);
}
```https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2260bug in aud code generation2021-05-23T19:15:42ZSven-Bodo Scholzbug in aud code generationWhen we compile the following example (sac2c 1.3.3-MijasCosta-572-g9eca without flags)
[tutu.sac](/uploads/ce22c0715b9e1e614e674da4514faee6/tutu.sac)
we get a two element vector as result!
Closer inspection shows that there is a proble...When we compile the following example (sac2c 1.3.3-MijasCosta-572-g9eca without flags)
[tutu.sac](/uploads/ce22c0715b9e1e614e674da4514faee6/tutu.sac)
we get a two element vector as result!
Closer inspection shows that there is a problem in the descriptor initialisation for the constant array.
after compilation, we have:
SAC_ND_ALLOC_BEGIN((SACp_emal_2334__flat_18, (AUD, (NHD, (NUQ, (INT, (GLO, (NON, (NOT, (NDI, (INT, )))))))))), 1, 1, int)
ND_CREATE__ARRAY__SHAPE( (SACp_emal_2334__flat_18, (AUD, (NHD, (NUQ, (INT, (GLO, (NON, (NOT, (NDI, (INT, )))))))))), -1, 1, 2, 2, (SACl_f, (AUD, (NHD, (NUQ, (INT, (GLO, (NON, (NOT, (NDI, (INT, )))))))))), (SACl_f, (AUD, (NHD, (NUQ, (INT, (GLO, (NON, (NOT, (NDI, (INT, )))))))))), -2)
SAC_ND_ALLOC_END((SACp_emal_2334__flat_18, (AUD, (NHD, (NUQ, (INT, (GLO, (NON, (NOT, (NDI, (INT, )))))))))), 1, 1, int)
ALLOC_BEGIN is expanded into:
... SACp_emal_2334__flat_18__dim = 1;
subsequently, ND_CREATE__ARRAY__SHAPE does *not* change the dim, but it fills the shape components correctly up until __dim:
...
(((SAC_array_descriptor_t) (((intptr_t)SACp_emal_2334__flat_18__desc) & (-1 ^ (3))))[(6 + (0))]) = 2;
SAC_i = 1;
for (SAC_j = 0; SAC_i < SACp_emal_2334__flat_18__dim; SAC_i++, SAC_j++) {
(((SAC_array_descriptor_t) (((intptr_t)SACp_emal_2334__flat_18__desc) & (-1 ^ (3))))[(6 + (SAC_i))]) = (((SAC_array_descriptor_t) (((intptr_t)SACl_f__desc) & (-1 ^ (3))))[(6 + (SAC_j))]);
}
...
all the data is copied correctly as well!https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2259LUR crashes in "stupid type conversions" when compiling module2021-05-24T13:13:36ZRobert BerneckyLUR crashes in "stupid type conversions" when compiling moduleCompiling with:
`sac2c crudscan.sac -maxoptcyc 1 -d treecheck -chkfreq 4 -v4 `
crashes in LUR's GetLoopIdentifiers, near "stupid type conversions".
```
module UTRepresentation;
use Array:{shape,genarray,<,+,++,-,*,sum,sel,modarray};
e...Compiling with:
`sac2c crudscan.sac -maxoptcyc 1 -d treecheck -chkfreq 4 -v4 `
crashes in LUR's GetLoopIdentifiers, near "stupid type conversions".
```
module UTRepresentation;
use Array:{shape,genarray,<,+,++,-,*,sum,sel,modarray};
export {NOTmain};
inline int mpybslXII(int[.] y)
{ /* Scan of vector */
size = shape(y);
arg = genarray(size,1);
z = 42;
for ( i=1; i<size[[0]]; i++) {
z = z + 4 * 3;
}
return(z);
}
int NOTmain ()
{
z=mpybslXII( [2,3,1]);
return(z);
}
```
Compiled with:
```
rbe@boa:~/JimBrown$ sac2c -V
sac2c 1.3.3-MijasCosta-583-g93687
build-type: DEBUG
built-by: "sac" at 2021-05-03T11:17:13
```Artem ShinkarovArtem Shinkarovhttps://gitlab.sac-home.org/sac-group/sac2c/-/issues/2258Aliasing analysis fails2023-01-24T10:39:26ZSven-Bodo ScholzAliasing analysis failsLook at this code:
```c
noinline
int[10000], int[10000] foo (int len)
{
a = with {
} : genarray( [len], 2);
if( _eq_SxS_( len, 10000)) {
c = a;
} else {
c = with {
} : genarray( [...Look at this code:
```c
noinline
int[10000], int[10000] foo (int len)
{
a = with {
} : genarray( [len], 2);
if( _eq_SxS_( len, 10000)) {
c = a;
} else {
c = with {
} : genarray( [len], 4);
}
return (a, c);
}
int main()
{
a,c = foo (10000);
b = {iv-> _add_SxS_( _sel_VxA_(iv, a),1)};
return _add_SxS_( _sel_VxA_([2], b), _sel_VxA_([2], c));
}
```
The function foo creates a potential alias here. However, it seems the aliasing analysis does not pick this up.
What happens is that the mem phase decides that the increment in main can be done in place! After the selection into `c`, the runtime system attempts a free for a second time:
```
-sbs-Bodos-IMac-> sac2c MEMORY-error-cuda-managed.sac ; a.out
a.out(38071,0x10ca1edc0) malloc: *** error for object 0x7fe95d800000: pointer being freed was not allocated
a.out(38071,0x10ca1edc0) malloc: *** set a breakpoint in malloc_error_break to debug
Abort
```
```
-sbs-Bodos-IMac-> sac2c -V
sac2c 1.3.3-MijasCosta-578-g3920
build-type: RELEASE
built-by: "sbs" at 2021-04-13T19:54:17
```https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2257sac2c target list does not work2021-03-05T18:08:12ZRobert Berneckysac2c target list does not workThis is on a fairly recent installation of sac2c
(sac2c 1.3.3-MijasCosta-566-gc4c42).
I do not have a ~/.sac2crc file.
```
CUSTOMIZATION OPTIONS:
-target <name> Specify a particular compilation target.
-t <name> Compi...This is on a fairly recent installation of sac2c
(sac2c 1.3.3-MijasCosta-566-gc4c42).
I do not have a ~/.sac2crc file.
```
CUSTOMIZATION OPTIONS:
-target <name> Specify a particular compilation target.
-t <name> Compilation targets are used to customize sac2c for
various target architectures, operating systems, and C
compilers.
The target description is either read from the
installation specific file $PREFIX/share/sac2crc or
from a file named .sac2crc within the user's home
directory.
target list can be printed with -list-targets
apex@boa:/tmp/crud/UTEpio/module$ sac2c -list-targets
abort: Configuration files do not contain specification of target 'cuda`
compilation failed while initial.
apex@boa:/tmp/crud/UTEpio/module$ sac2c -t list-targets
abort: Configuration files do not contain specification of target 'list-targets`
compilation failed while initial.
apex@boa:/tmp/crud/UTEpio/module$ sac2c -t -list-targets
error: Missing argument for option: sac2c -t
abort: Configuration files do not contain specification of target 'cuda`
compilation failed while initial, 1 error(s).
apex@boa:/tmp/crud/UTEpio/module$ sac2c -t pthread
abort: Configuration files do not contain specification of target 'pthread`
compilation failed while initial.
```