External Issue: HashedDist fails when dmapped across types not defined with strong types

16821, “ahysing”, “HashedDist fails when dmapped across types not defined with strong types”, “2020-12-07T17:30:22Z”

Summary of Problem

I am trying to hash my own custom records onto the locales. I have set up a record, called State. The challenge is to define a HashedDist across these states.

However HashedDist crashes the compiler when the input type is not explicitly set.
the problematic line is const D: domain(this.eltType) dmapped Hashed(idxType=this.eltType);

To give you some context I am solving the board game connect 4.

Output

chpl POC.chpl 
internal error: UTI-MIS-0788 chpl version 1.23.0

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 https://chapel-lang.org/bugs.html for instructions.  In the meantime,
the filename + line number above may be useful in working around the issue.
chpl POC.chpl --devel
internal error: seg fault [util/misc.cpp:788]

Steps to Reproduce

chpl POC.chpl the source code below.

Source Code:

save this to POC.chpl below


use HashedDist;

enum Player {
  Red,
  Yellow
}

enum Tile {
  Red,
  Yellow,
  Unset
}

const numRows : int = 6;
const numColumns : int = 7;
const DLocal : domain(2) = {0..numColumns, 0..numRows};

record State {
  var player : Player;
  var board : [DLocal] Tile;

  proc init() {
  }

  proc init(player : Player, board) {
    this.player = player;
    this.board = board;
  }
}


public class Searcher {
    type eltType;
    
    
    proc init(type eltType) {
      this.eltType = eltType;
      this.complete();
    }

    /* search function.
    */
    proc search(start : this.eltType) {
      const D: domain(this.eltType) dmapped Hashed(idxType=this.eltType);
      var fScore : [D] real;
      var gScore : [D] real;
    }
}

proc main() {
    const startState = new State();
    var searcher = new Searcher(startState.type);
    searcher.search(startState);
}

Compile command:
chpl POC.chpl

Execution command:
N/A

Associated Future Test(s):
N/A

Configuration Information

  • Output of chpl --version:
chpl version 1.23.0
Copyright 2020 Hewlett Packard Enterprise Development LP
Copyright 2004-2019 Cray Inc.
(See LICENSE file for more details)
  • Output of $CHPL_HOME/util/printchplenv --anonymize:
CHPL_TARGET_PLATFORM: darwin
CHPL_TARGET_COMPILER: clang
CHPL_TARGET_ARCH: x86_64
CHPL_TARGET_CPU: native
CHPL_LOCALE_MODEL: flat
CHPL_COMM: none
CHPL_TASKS: qthreads
CHPL_LAUNCHER: none
CHPL_TIMERS: generic
CHPL_UNWIND: none
CHPL_MEM: jemalloc
CHPL_ATOMICS: cstdlib
CHPL_GMP: gmp
CHPL_HWLOC: hwloc
CHPL_REGEXP: re2
CHPL_LLVM: none
CHPL_AUX_FILESYS: none
  • Back-end compiler and version, e.g. gcc --version or clang --version:
gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.27)
Target: x86_64-apple-darwin20.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
clang --version
Apple clang version 12.0.0 (clang-1200.0.32.27)
Target: x86_64-apple-darwin20.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
  • (For Cray systems only) Output of module list:
    N/A