[Chapel Merge] Enable automatic local access optimization for loc

Branch: refs/heads/master
Revision: 4487425
Author: e-kayrakli
Log Message:

Merge pull request #17567 from e-kayrakli/local-arrays-ala

Enable automatic local access optimization for local arrays

This PR enables local arrays/domain to be subjected to automatic local access
optimization. The cases where the compiler uses localAccess does not impact
performance of the access itself, however, it signals automatic aggregation the
locality of the access.

Summary of changes:

  • Turn defaultRectangularSupportsAutoLocalAccess to true-by-default

  • Add similar flags and dsiSupportsAutoLocalAccess to DefaultSparse,
    LayoutCS and DefaultAssociative

  • Add a check in _array.localAccess to call this for non-distributed arrays

    (This way we can avoid adding dsiLocalAccess to local array implementations,
    credit goes to @bradcray for the idea)

  • Remove dsiLocalAccess implementations from DefaultRectangularArr

  • Fix a bug with intervening forall expressions

    This PR increased the coverage of the optimization and revealed a bug where an
    intervening forall expression was not recognized as such. Down the road this
    caused assertion errors.

  • Update an unrelated test's good file

    Automatic local access clones foralls and if the original loop has an compiler
    error, this cloning leads to duplicate error messages to be printed out. For
    now, this PR accepts this change in a test. This is recorded in

    https://github.com/Cray/chapel-private/issues/1095

  • Tighten the static checks for slices

    We don't want this optimization to fire for slices that has a different distribution
    than the original array.

Future work:

[Reviewed by @mppf]

Test:

  • [x] standard

  • [x] gasnet

    Modified Files:
    A test/arrays/localQueries/localAccess.chpl
    A test/arrays/localQueries/localAccess.good
    A test/optimizations/autoAggregation/localArrays.chpl
    A test/optimizations/autoAggregation/localArrays.good
    A test/optimizations/autoLocalAccess/differentDistView.chpl
    A test/optimizations/autoLocalAccess/differentDistView.good
    A test/optimizations/autoLocalAccess/interveningForallExpr.chpl
    A test/optimizations/autoLocalAccess/interveningForallExpr.good
    A test/optimizations/autoLocalAccess/localArrays.chpl
    A test/optimizations/autoLocalAccess/localArrays.good
    M compiler/optimizations/forallOptimizations.cpp
    M modules/internal/ChapelArray.chpl
    M modules/internal/ChapelAutoLocalAccess.chpl
    M modules/internal/DefaultAssociative.chpl
    M modules/internal/DefaultRectangular.chpl
    M modules/internal/DefaultSparse.chpl
    M modules/layouts/LayoutCS.chpl
    M test/parallel/forall/checks/const-indices-blc.good

    Compare: Comparing e51c1f1528cb...448742552bb5 · chapel-lang/chapel · GitHub