From 28d8fc637a61d35c6ed889a84f81a83b071c64af Mon Sep 17 00:00:00 2001 From: Engin Kayraklioglu Date: Tue, 3 Sep 2024 11:22:17 -0700 Subject: [PATCH 1/3] Fix an ALA bug due to a missing dsiEqualDMaps overload Signed-off-by: Engin Kayraklioglu --- modules/internal/ArrayViewRankChange.chpl | 4 +++ .../autoLocalAccess/rankChangeDynamic.chpl | 18 ++++++++++++ .../rankChangeDynamic.compopts | 1 + .../autoLocalAccess/rankChangeDynamic.good | 29 +++++++++++++++++++ .../rankChangeDynamic.numlocales | 1 + .../autoLocalAccess/rankChangeDynamic.prediff | 3 ++ 6 files changed, 56 insertions(+) create mode 100644 test/optimizations/autoLocalAccess/rankChangeDynamic.chpl create mode 100644 test/optimizations/autoLocalAccess/rankChangeDynamic.compopts create mode 100644 test/optimizations/autoLocalAccess/rankChangeDynamic.good create mode 100644 test/optimizations/autoLocalAccess/rankChangeDynamic.numlocales create mode 100755 test/optimizations/autoLocalAccess/rankChangeDynamic.prediff diff --git a/modules/internal/ArrayViewRankChange.chpl b/modules/internal/ArrayViewRankChange.chpl index 8eb58a95e262..aca355f10c8d 100644 --- a/modules/internal/ArrayViewRankChange.chpl +++ b/modules/internal/ArrayViewRankChange.chpl @@ -119,6 +119,10 @@ module ArrayViewRankChange { this.idx == that.idx && this.downDist.dsiEqualDMaps(that.downDist)); } + + proc dsiEqualDMaps(that) { + return false; + } } private proc downDomType(param rank : int, diff --git a/test/optimizations/autoLocalAccess/rankChangeDynamic.chpl b/test/optimizations/autoLocalAccess/rankChangeDynamic.chpl new file mode 100644 index 000000000000..ad46c41b080f --- /dev/null +++ b/test/optimizations/autoLocalAccess/rankChangeDynamic.chpl @@ -0,0 +1,18 @@ +use BlockDist; +var BaseArr = blockDist.createArray({1..2, 1..7}, int); + +ref RankChangeViewLocal = BaseArr[1, ..]; +ref RankChangeViewRemote = BaseArr[2, ..]; + +const Dom = {1..7}; + +forall i in Dom { + RankChangeViewLocal[i] = i; +} + +// this should fail the dynamic check +forall i in Dom { + RankChangeViewRemote[i] = i; +} + +writeln(BaseArr); diff --git a/test/optimizations/autoLocalAccess/rankChangeDynamic.compopts b/test/optimizations/autoLocalAccess/rankChangeDynamic.compopts new file mode 100644 index 000000000000..7511f35a4d53 --- /dev/null +++ b/test/optimizations/autoLocalAccess/rankChangeDynamic.compopts @@ -0,0 +1 @@ +-slogAllArrEltAccess diff --git a/test/optimizations/autoLocalAccess/rankChangeDynamic.good b/test/optimizations/autoLocalAccess/rankChangeDynamic.good new file mode 100644 index 000000000000..16b3ccb05a03 --- /dev/null +++ b/test/optimizations/autoLocalAccess/rankChangeDynamic.good @@ -0,0 +1,29 @@ + +Start analyzing forall (rankChangeDynamic.chpl:9) +| Found loop domain (rankChangeDynamic.chpl:7) +| Will attempt static and dynamic optimizations (rankChangeDynamic.chpl:9) +| +| Start analyzing call (rankChangeDynamic.chpl:10) +| Can't determine the domain of access base (rankChangeDynamic.chpl:4) +| This call is a dynamic optimization candidate (rankChangeDynamic.chpl:10) +| +End analyzing forall (rankChangeDynamic.chpl:9) + + +Start analyzing forall (rankChangeDynamic.chpl:14) +| Found loop domain (rankChangeDynamic.chpl:7) +| Will attempt static and dynamic optimizations (rankChangeDynamic.chpl:14) +| +| Start analyzing call (rankChangeDynamic.chpl:15) +| Can't determine the domain of access base (rankChangeDynamic.chpl:5) +| This call is a dynamic optimization candidate (rankChangeDynamic.chpl:15) +| +End analyzing forall (rankChangeDynamic.chpl:14) + +Static check successful. Using localAccess with dynamic check (rankChangeDynamic.chpl:10) +Static check successful. Using localAccess with dynamic check (rankChangeDynamic.chpl:15) +1 2 3 4 5 6 7 +1 2 3 4 5 6 7 + +Numbers collected by prediff: + localAccess was called 7 times diff --git a/test/optimizations/autoLocalAccess/rankChangeDynamic.numlocales b/test/optimizations/autoLocalAccess/rankChangeDynamic.numlocales new file mode 100644 index 000000000000..0cfbf08886fc --- /dev/null +++ b/test/optimizations/autoLocalAccess/rankChangeDynamic.numlocales @@ -0,0 +1 @@ +2 diff --git a/test/optimizations/autoLocalAccess/rankChangeDynamic.prediff b/test/optimizations/autoLocalAccess/rankChangeDynamic.prediff new file mode 100755 index 000000000000..619ecee0c94e --- /dev/null +++ b/test/optimizations/autoLocalAccess/rankChangeDynamic.prediff @@ -0,0 +1,3 @@ +#!/bin/sh + +./PREDIFF-filter-accessors $1 $2 --no-this From 28273eff324c8742c535da8b0b30a4c712ea4051 Mon Sep 17 00:00:00 2001 From: Engin Kayraklioglu Date: Tue, 3 Sep 2024 11:32:39 -0700 Subject: [PATCH 2/3] Add a slice-based test to make sure Signed-off-by: Engin Kayraklioglu --- .../autoLocalAccess/sliceDynamic.chpl | 19 ++++++++++++ .../autoLocalAccess/sliceDynamic.compopts | 1 + .../autoLocalAccess/sliceDynamic.good | 29 +++++++++++++++++++ .../autoLocalAccess/sliceDynamic.numlocales | 1 + .../autoLocalAccess/sliceDynamic.prediff | 3 ++ 5 files changed, 53 insertions(+) create mode 100644 test/optimizations/autoLocalAccess/sliceDynamic.chpl create mode 100644 test/optimizations/autoLocalAccess/sliceDynamic.compopts create mode 100644 test/optimizations/autoLocalAccess/sliceDynamic.good create mode 100644 test/optimizations/autoLocalAccess/sliceDynamic.numlocales create mode 100755 test/optimizations/autoLocalAccess/sliceDynamic.prediff diff --git a/test/optimizations/autoLocalAccess/sliceDynamic.chpl b/test/optimizations/autoLocalAccess/sliceDynamic.chpl new file mode 100644 index 000000000000..4e2252c5ad83 --- /dev/null +++ b/test/optimizations/autoLocalAccess/sliceDynamic.chpl @@ -0,0 +1,19 @@ +use BlockDist; +var BaseArr = blockDist.createArray({1..2, 1..7}, int); + +ref SliceViewLocal = BaseArr[1..1, ..]; +ref SliceViewRemote = BaseArr[2..2, ..]; + +const LocalsDom = {1..1, 1..7}; +const RemotesDom = {2..2, 1..7}; + +forall idx in LocalsDom { + SliceViewLocal[idx] = 1; +} + +// this should fail the dynamic check +forall idx in RemotesDom { + SliceViewRemote[idx] = 2; +} + +writeln(BaseArr); diff --git a/test/optimizations/autoLocalAccess/sliceDynamic.compopts b/test/optimizations/autoLocalAccess/sliceDynamic.compopts new file mode 100644 index 000000000000..7511f35a4d53 --- /dev/null +++ b/test/optimizations/autoLocalAccess/sliceDynamic.compopts @@ -0,0 +1 @@ +-slogAllArrEltAccess diff --git a/test/optimizations/autoLocalAccess/sliceDynamic.good b/test/optimizations/autoLocalAccess/sliceDynamic.good new file mode 100644 index 000000000000..2e8117ed098a --- /dev/null +++ b/test/optimizations/autoLocalAccess/sliceDynamic.good @@ -0,0 +1,29 @@ + +Start analyzing forall (sliceDynamic.chpl:10) +| Found loop domain (sliceDynamic.chpl:7) +| Will attempt static and dynamic optimizations (sliceDynamic.chpl:10) +| +| Start analyzing call (sliceDynamic.chpl:11) +| Can't determine the domain of access base (sliceDynamic.chpl:4) +| This call is a dynamic optimization candidate (sliceDynamic.chpl:11) +| +End analyzing forall (sliceDynamic.chpl:10) + + +Start analyzing forall (sliceDynamic.chpl:15) +| Found loop domain (sliceDynamic.chpl:8) +| Will attempt static and dynamic optimizations (sliceDynamic.chpl:15) +| +| Start analyzing call (sliceDynamic.chpl:16) +| Can't determine the domain of access base (sliceDynamic.chpl:5) +| This call is a dynamic optimization candidate (sliceDynamic.chpl:16) +| +End analyzing forall (sliceDynamic.chpl:15) + +Static check successful. Using localAccess with dynamic check (sliceDynamic.chpl:11) +Static check successful. Using localAccess with dynamic check (sliceDynamic.chpl:16) +1 1 1 1 1 1 1 +2 2 2 2 2 2 2 + +Numbers collected by prediff: + localAccess was called 7 times diff --git a/test/optimizations/autoLocalAccess/sliceDynamic.numlocales b/test/optimizations/autoLocalAccess/sliceDynamic.numlocales new file mode 100644 index 000000000000..0cfbf08886fc --- /dev/null +++ b/test/optimizations/autoLocalAccess/sliceDynamic.numlocales @@ -0,0 +1 @@ +2 diff --git a/test/optimizations/autoLocalAccess/sliceDynamic.prediff b/test/optimizations/autoLocalAccess/sliceDynamic.prediff new file mode 100755 index 000000000000..619ecee0c94e --- /dev/null +++ b/test/optimizations/autoLocalAccess/sliceDynamic.prediff @@ -0,0 +1,3 @@ +#!/bin/sh + +./PREDIFF-filter-accessors $1 $2 --no-this From 049274c577b384be59e9a2b20225bcbfb31ac4b4 Mon Sep 17 00:00:00 2001 From: Engin Kayraklioglu Date: Tue, 3 Sep 2024 11:58:03 -0700 Subject: [PATCH 3/3] Add skipifs Signed-off-by: Engin Kayraklioglu --- test/optimizations/autoLocalAccess/rankChangeDynamic.skipif | 2 ++ test/optimizations/autoLocalAccess/sliceDynamic.skipif | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 test/optimizations/autoLocalAccess/rankChangeDynamic.skipif create mode 100644 test/optimizations/autoLocalAccess/sliceDynamic.skipif diff --git a/test/optimizations/autoLocalAccess/rankChangeDynamic.skipif b/test/optimizations/autoLocalAccess/rankChangeDynamic.skipif new file mode 100644 index 000000000000..874f6f75fbba --- /dev/null +++ b/test/optimizations/autoLocalAccess/rankChangeDynamic.skipif @@ -0,0 +1,2 @@ +# this test's logic is wired for 2 locales +CHPL_COMM==none diff --git a/test/optimizations/autoLocalAccess/sliceDynamic.skipif b/test/optimizations/autoLocalAccess/sliceDynamic.skipif new file mode 100644 index 000000000000..874f6f75fbba --- /dev/null +++ b/test/optimizations/autoLocalAccess/sliceDynamic.skipif @@ -0,0 +1,2 @@ +# this test's logic is wired for 2 locales +CHPL_COMM==none