Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Reductions over distributed arrays in default arguments cause compiler segfaults #25045

Open
jabraham17 opened this issue May 14, 2024 · 1 comment

Comments

@jabraham17
Copy link
Member

jabraham17 commented May 14, 2024

Summary of Problem

Description:
Using a distributed array in a reduce expression that is the default argument for a function causes the compiler to segfault

Is this a blocking issue with no known work-arounds?
I don't have a good workaround that keeps the code looking clean

Steps to Reproduce

Source Code:

use BlockDist;

const D = blockDist.createDomain({1..10, 1..10}); // I also observed this with Stencil, it is not specific to the distribution
// using a non-distributed array works perfectly fine
// const D = {1..10, 1..10};
var A: [D] int = 2;

proc foo(a: [], m = (min reduce a)) { // it does not matter the reduction
  writeln("arr ", a);
  writeln("min ", m);
}
foo(A);
// explicitly specifying the default also works
foo(A, min reduce A);

Compile command:
chpl foo.chpl

Associated Future Test(s):
test/functions/default-arguments/default-arg-reduce-distributed.chpl

Configuration Information

  • Output of chpl --version: chpl version 2.1.0 pre-release (281481e)
  • Output of $CHPL_HOME/util/printchplenv --anonymize:
CHPL_TARGET_PLATFORM: darwin
CHPL_TARGET_COMPILER: llvm
CHPL_TARGET_ARCH: arm64
CHPL_TARGET_CPU: native *
CHPL_LOCALE_MODEL: flat
CHPL_COMM: gasnet *
  CHPL_COMM_SUBSTRATE: udp
  CHPL_GASNET_SEGMENT: everything
CHPL_TASKS: qthreads *
CHPL_LAUNCHER: amudprun
CHPL_TIMERS: generic
CHPL_UNWIND: none
CHPL_MEM: jemalloc *
CHPL_ATOMICS: cstdlib
  CHPL_NETWORK_ATOMICS: none
CHPL_GMP: system *
CHPL_HWLOC: bundled *
CHPL_RE2: bundled *
CHPL_LLVM: system *
CHPL_AUX_FILESYS: none
  • Back-end compiler and version, e.g. gcc --version or clang --version: built with LLVM version 18.1.4
jabraham17 added a commit that referenced this issue May 14, 2024
Add future for #25045

[Not reviewed - trivial]
@jabraham17
Copy link
Member Author

jabraham17 commented May 14, 2024

Noting that I hit this while working on #24924. One workaround is to extract the default argument out as a separate helper function.

proc helper(a: []) do return min reduce a;
proc foo(a: [], m = helper(a)) { 
   ...
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant