main.chpl:28: internal error: MIS0558 chpl Version 1.16.0 Note: This source location is a guess.
Internal errors indicate a bug in the Chapel compiler ("It's us, not you"), and we're sorry for the hassle. We would appreciate your reporting this bug -- please see http://chapel.cray.com/bugs.html for instructions. In the meantime, the filename + line number above may be useful in working around the issue.
I'm using the docker image chapel/chapel:latest
version is 1.16.0 at this moment.
Source Code:
https://github.com/HouseK/k_means/tree/MIS0558
Compile command:
chpl -o output/main main.chpl
(see run.sh)
Execution command:
output/main
(see run.sh)
Output of chpl --version:
chpl Version 1.16.0
Copyright (c) 2004-2017, Cray Inc. (See LICENSE file for more details)
Output of $CHPL_HOME/util/printchplenv --anonymize:
HPL_TARGET_PLATFORM: linux64
CHPL_TARGET_COMPILER: gnu
CHPL_TARGET_ARCH: native
CHPL_LOCALE_MODEL: flat
CHPL_COMM: none
CHPL_TASKS: qthreads
CHPL_LAUNCHER: none
CHPL_TIMERS: generic
CHPL_UNWIND: none
CHPL_MEM: jemalloc
CHPL_MAKE: make
CHPL_ATOMICS: intrinsics
CHPL_GMP: system *
CHPL_HWLOC: hwloc
CHPL_REGEXP: re2
CHPL_WIDE_POINTERS: struct
CHPL_AUX_FILESYS: none
Back-end compiler and version, e.g. gcc --version or clang --version:
gcc (Debian 6.3.0-18) 6.3.0 20170516
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@HouseK - thanks for reporting this.
I compiled with --devel and found that the internal error was caused by an unresolved call:
res[i] = addAverageAccumulator(ma1[i], ma2[i]);
should actually be:
res[i] = addAverageAccumulators(ma1[i], ma2[i]);
That should help you get past this for now.
Thanks for the solution!
@ben-albrecht: I think we should re-open this since it is a bug (we shouldn't be generating an internal error). Let me know if you disagree (I realize you didn't close it, but you didn't reopen it either). Thanks.
I think we should re-open this since it is a bug (we shouldn't be generating an internal error). Let me know if you disagree (I realize you didn't close it, but you didn't reopen it either). Thanks.
Agreed. I was hoping to distill the example down further and open a new issue with a more concrete description, but I haven't gotten as far as I'd like yet.
Here's how far I got on the distillation so far:
proc main() {
param num_means = 5;
var D : [0..99999] real;
var M: [1..num_means] real;
M = [1,2,3,4,5];
forall a in (AddMeansAccumulators reduce toMeansAccumulator(M, D)) do a;
}
class AddMeansAccumulators : ReduceScanOp {
type eltType;
var ma : eltType;
proc accumulate(val: [?] (real,int)){
forall i in ma.domain do
unresolvedCall();
}
}
proc toMeansAccumulator(means: [?dom] real , elem: real) {
var res: [dom] (real, int);
return res;
}
The error seems to depend on being an unresolved call being inside a forall loop that is within a custom reduce intent class. Also, declaring an array with over [dom] (real, int) instead of relying on toMeansAccumulator avoids the internal error.
I closed it because my user issue was fixed but I'm happy to reopen it :)
I can't reproduce this with the original code or the distillation.
Instead, I get (for the original code)
fortytwo@magrathea:~/src/chapel (master)$ chpl main.chpl
main.chpl:54: In function 'kmeans':
main.chpl:62: error: unresolved call 'unmanaged AddMeansAccumulators(_array(unmanaged DefaultRectangularArr(1,int(64),false,(real(64),int(64)),int(64)))).identity()'
main.chpl:62: note: instantiated from kmeans
$CHPL_HOME/modules/internal/ChapelReduce.chpl:162: note: candidates are: SumReduceScanOp.identity [79584]
...
I believe this reflects that the user-defined reduction interface has evolved since the test was written and now requires an identity() method. So the question is whether, upon supplying it, the original code works or breaks.
I modified test/reductions/userdefined.chpl, adding to each class
method (one at a time) a forall loop over the vals array calling an
undefined function, e.g.
proc accumulate(value: eltType) {
forall a in state.vals do unresolvedCall();
accumulateOntoState(state, value);
}
All of them failed with error: unresolved call 'unresolvedCall()'.
Except the one above, which compiled fine. I guess that accumulate
variant isn't used? (It compiles and runs without it entirely.)
It may depend on which reduction / scan forms you use (e.g., standalone operator versus reduce intents). Or it may just not be used anymore. The UDR (User-Defined Reduction) interface is still heavily in flux, but we hope to stabilize in this coming release cycle.
It may well be that one of the accumulate() methods is not used.
We are switching to a new reduction interface soon, so hopefully the quirks of the current interface will not live for much longer. Except for users of the 1.19 release distro. :(
I added a clone and identity method (both required), and was not able to reproduce the original internal error from my previous reproducer:
proc main() {
param num_means = 5;
var D : [0..99999] real;
var M: [1..num_means] real;
M = [1,2,3,4,5];
forall a in (AddMeansAccumulators reduce toMeansAccumulator(M, D)) do a;
}
class AddMeansAccumulators : ReduceScanOp {
type eltType;
var ma : eltType;
proc accumulate(val: [?] (real,int)){
forall i in ma.domain do
unresolvedCall();
}
proc clone() { return new unmanaged AddMeansAccumulators(eltType=eltType); }
proc identity() {
var res: [1..0] (real, int);
return res;
}
}
proc toMeansAccumulator(means: [?dom] real , elem: real) {
var res: [dom] (real, int);
return res;
}
> chpl repro.chpl
repro.chpl:13: In function 'accumulate':
repro.chpl:15: error: unresolved call 'unresolvedCall()'
Maybe we should close this?
Works for me, thanks Ben! (and Paul)
Most helpful comment
@ben-albrecht: I think we should re-open this since it is a bug (we shouldn't be generating an internal error). Let me know if you disagree (I realize you didn't close it, but you didn't reopen it either). Thanks.