Skip to content

Commit 27ebd8c

Browse files
Merge pull request #5920 from awallace-cray/chapdev-168
Fix multi-ddata for aligned arrays (cherry-pick #5903) [approved for release/1.15]
2 parents c5f86fc + 415f5c8 commit 27ebd8c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

modules/internal/DefaultRectangular.chpl

+6-6
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ module DefaultRectangular {
926926
high = if rad.stridable then strideAlignDown(high, newDom.dsiDim(mdParDim)) else high;
927927

928928
const rng = low..high;
929-
rad.mData(i).pdr = if !rad.stridable then rng else rng by newDom.dsiDim(mdParDim).stride;
929+
rad.mData(i).pdr = if !rad.stridable then rng else rng by newDom.dsiDim(mdParDim).stride align newDom.dsiDim(mdParDim).alignment;
930930
}
931931

932932
}
@@ -980,7 +980,7 @@ module DefaultRectangular {
980980
high += radLo;
981981

982982
const rng = low..high;
983-
rad.mData(i).pdr = if !rad.stridable then rng else rng by radStr;
983+
rad.mData(i).pdr = if !rad.stridable then rng else rng by radStr align newDom.dsiDim(mdParDim).alignment;
984984
}
985985
}
986986

@@ -1052,7 +1052,7 @@ module DefaultRectangular {
10521052
for i in 1..#mdNumChunks {
10531053
const rng = max(this.mData(i).pdr.low, newDom.dsiDim(rad.mdParDim).low)
10541054
..min(this.mData(i).pdr.high, newDom.dsiDim(rad.mdParDim).high);
1055-
rad.mData(i).pdr = if !rad.stridable then rng else rng by newDom.dsiDim(rad.mdParDim).stride;
1055+
rad.mData(i).pdr = if !rad.stridable then rng else rng by newDom.dsiDim(rad.mdParDim).stride align newDom.dsiDim(rad.mdParDim).alignment;
10561056
}
10571057
} else {
10581058
// If the mdParDim'th dimension is removed, then we switch to
@@ -1069,7 +1069,7 @@ module DefaultRectangular {
10691069
for i in 1..#mdNumChunks {
10701070
const (lo, hi) = rad.mdChunk2Ind(i-1);
10711071
const rng = max(lo, newDom.dsiDim(1).low) .. min(hi, newDom.dsiDim(1).high);
1072-
rad.mData(i).pdr = if !rad.stridable then rng else rng by newDom.dsiDim(1).stride;
1072+
rad.mData(i).pdr = if !rad.stridable then rng else rng by newDom.dsiDim(1).stride align newDom.dsiDim(1).alignment;
10731073
}
10741074
}
10751075
}
@@ -1575,7 +1575,7 @@ module DefaultRectangular {
15751575
if mdNumChunks == 1 {
15761576
if stridable then
15771577
mData(0).pdr = dom.dsiDim(mdParDim).low..dom.dsiDim(mdParDim).high
1578-
by dom.dsiDim(mdParDim).stride;
1578+
by dom.dsiDim(mdParDim).stride align dom.dsiDim(mdParDim).alignment;
15791579
else
15801580
mData(0).pdr = dom.dsiDim(mdParDim).low..dom.dsiDim(mdParDim).high;
15811581
mData(0).data =
@@ -1589,7 +1589,7 @@ module DefaultRectangular {
15891589
mData(i).dataOff = dataOff;
15901590
const (lo, hi) = mdChunk2Ind(i);
15911591
if stridable then
1592-
mData(i).pdr = lo..hi by dom.dsiDim(mdParDim).stride;
1592+
mData(i).pdr = lo..hi by dom.dsiDim(mdParDim).stride align dom.dsiDim(mdParDim).alignment;
15931593
else
15941594
mData(i).pdr = lo..hi;
15951595
const chunkSize = size / mdRLen * mData(i).pdr.length;

0 commit comments

Comments
 (0)