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

Expand AVE to arrays of different types #26372

Merged
merged 2 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions modules/internal/ChapelArrayViewElision.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ module ChapelArrayViewElision {

proc chpl__ave_protoSlicesSupportAssignment(a: chpl__protoSlice,
b: chpl__protoSlice) param: bool {
// for now, only same array types on both sides are supported
if a.ptrToArr.deref().type != b.ptrToArr.deref().type then return false;

// either both sides are rank-changes, or neither is
if a.isRankChange != b.isRankChange then return false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ArrayViewElision supported distributed.chpl:33
rhsIndexingExprs:
range(int(64),both,one)

ArrayViewElision not supported distributed.chpl:46
ArrayViewElision supported distributed.chpl:46
lhsBaseType: [BlockDom(1,int(64),one,unmanaged DefaultDist)] int(64)
lhsIndexingExprs:
range(int(64),both,one)
Expand Down
2 changes: 1 addition & 1 deletion test/optimizations/arrayViewElision/distributed.good
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ArrayViewElision supported (dynamic locality check required) distributed.chpl:33
rhsIndexingExprs:
range(int(64),both,one)

ArrayViewElision not supported distributed.chpl:46
ArrayViewElision supported (dynamic locality check required) distributed.chpl:46
lhsBaseType: [BlockDom(1,int(64),one,unmanaged DefaultDist)] int(64)
lhsIndexingExprs:
range(int(64),both,one)
Expand Down
37 changes: 37 additions & 0 deletions test/optimizations/arrayViewElision/distributedToLocal.chpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const Space = {1..10};

// not exhaustive.
{
use BlockDist;

const D = Space dmapped new blockDist(Space);
var A: [Space] int = 1;
var B: [D] int = 2;

A[3..5] = B[3..5];
writeln(A);
}

{
// this is not supported today. Relevant doi functions need to be adjusted.
// This is not an AVE limitation.
use CyclicDist;

const D = Space dmapped new cyclicDist(Space.first);
var A: [Space] int = 1;
var B: [D] int = 2;

A[3..5] = B[3..5];
writeln(A);
}

{
use StencilDist;

const D = Space dmapped new stencilDist(Space);
var A: [Space] int = 1;
var B: [D] int = 2;

A[3..5] = B[3..5];
writeln(A);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
ArrayViewElision supported distributedToLocal.chpl:11
lhsBaseType: [domain(1,int(64),one)] int(64)
lhsIndexingExprs:
range(int(64),both,one)
rhsBaseType: [BlockDom(1,int(64),one,unmanaged DefaultDist)] int(64)
rhsIndexingExprs:
range(int(64),both,one)

ArrayViewElision supported distributedToLocal.chpl:24
lhsBaseType: [domain(1,int(64),one)] int(64)
lhsIndexingExprs:
range(int(64),both,one)
rhsBaseType: [CyclicDom(1,int(64),one)] int(64)
rhsIndexingExprs:
range(int(64),both,one)

ArrayViewElision supported distributedToLocal.chpl:35
lhsBaseType: [domain(1,int(64),one)] int(64)
lhsIndexingExprs:
range(int(64),both,one)
rhsBaseType: [StencilDom(1,int(64),one,false)] int(64)
rhsIndexingExprs:
range(int(64),both,one)

Performing protoSlice bulk transfer
operator =(a:[],b:[]): in chpl__bulkTransferArray
operator =(a:[],b:[]): attempting doiBulkTransferToKnown
operator =(a:[],b:[]): in chpl__bulkTransferArray
operator =(a:[],b:[]): attempting doiBulkTransferFromKnown
In DefaultRectangular._simpleTransfer(): Alo=(3,), Blo=(3,), len=3, elemSize=8
operator =(a:[],b:[]): successfully completed bulk transfer
operator =(a:[],b:[]): successfully completed bulk transfer
1 1 2 2 2 1 1 1 1 1
Performing protoSlice bulk transfer
operator =(a:[],b:[]): in chpl__bulkTransferArray
operator =(a:[],b:[]): bulk transfer did not happen
1 1 2 2 2 1 1 1 1 1
Performing protoSlice bulk transfer
operator =(a:[],b:[]): in chpl__bulkTransferArray
operator =(a:[],b:[]): attempting doiBulkTransferToKnown
operator =(a:[],b:[]): in chpl__bulkTransferArray
operator =(a:[],b:[]): attempting doiBulkTransferFromKnown
In DefaultRectangular._simpleTransfer(): Alo=(3,), Blo=(3,), len=3, elemSize=8
operator =(a:[],b:[]): successfully completed bulk transfer
operator =(a:[],b:[]): successfully completed bulk transfer
1 1 2 2 2 1 1 1 1 1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--report-array-view-elision -sdebugBulkTransfer
54 changes: 54 additions & 0 deletions test/optimizations/arrayViewElision/distributedToLocal.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
ArrayViewElision supported (dynamic locality check required) distributedToLocal.chpl:11
lhsBaseType: [domain(1,int(64),one)] int(64)
lhsIndexingExprs:
range(int(64),both,one)
rhsBaseType: [BlockDom(1,int(64),one,unmanaged DefaultDist)] int(64)
rhsIndexingExprs:
range(int(64),both,one)

ArrayViewElision supported (dynamic locality check required) distributedToLocal.chpl:24
lhsBaseType: [domain(1,int(64),one)] int(64)
lhsIndexingExprs:
range(int(64),both,one)
rhsBaseType: [CyclicDom(1,int(64),one)] int(64)
rhsIndexingExprs:
range(int(64),both,one)

ArrayViewElision supported (dynamic locality check required) distributedToLocal.chpl:35
lhsBaseType: [domain(1,int(64),one)] int(64)
lhsIndexingExprs:
range(int(64),both,one)
rhsBaseType: [StencilDom(1,int(64),one,false)] int(64)
rhsIndexingExprs:
range(int(64),both,one)

operator =(a:[],b:[]): in chpl__bulkTransferArray
operator =(a:[],b:[]): attempting doiBulkTransferFromKnown
In DefaultRectangular._simpleTransfer(): Alo=(0,), Blo=(0,), len=1, elemSize=8
operator =(a:[],b:[]): successfully completed bulk transfer
operator =(a:[],b:[]): in chpl__bulkTransferArray
operator =(a:[],b:[]): attempting doiBulkTransferFromKnown
In DefaultRectangular._simpleTransfer(): Alo=(0,), Blo=(0,), len=1, elemSize=8
operator =(a:[],b:[]): successfully completed bulk transfer
Performing protoSlice bulk transfer
operator =(a:[],b:[]): in chpl__bulkTransferArray
operator =(a:[],b:[]): attempting doiBulkTransferToKnown
operator =(a:[],b:[]): in chpl__bulkTransferArray
operator =(a:[],b:[]): attempting doiBulkTransferFromKnown
In DefaultRectangular._simpleTransfer(): Alo=(3,), Blo=(3,), len=3, elemSize=8
operator =(a:[],b:[]): successfully completed bulk transfer
operator =(a:[],b:[]): successfully completed bulk transfer
1 1 2 2 2 1 1 1 1 1
Performing protoSlice bulk transfer
operator =(a:[],b:[]): in chpl__bulkTransferArray
operator =(a:[],b:[]): bulk transfer did not happen
1 1 2 2 2 1 1 1 1 1
Performing protoSlice bulk transfer
operator =(a:[],b:[]): in chpl__bulkTransferArray
operator =(a:[],b:[]): attempting doiBulkTransferToKnown
operator =(a:[],b:[]): in chpl__bulkTransferArray
operator =(a:[],b:[]): attempting doiBulkTransferFromKnown
In DefaultRectangular._simpleTransfer(): Alo=(3,), Blo=(3,), len=3, elemSize=8
operator =(a:[],b:[]): successfully completed bulk transfer
operator =(a:[],b:[]): successfully completed bulk transfer
1 1 2 2 2 1 1 1 1 1
37 changes: 37 additions & 0 deletions test/optimizations/arrayViewElision/localToDistributed.chpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const Space = {1..10};

// not exhaustive.
{
use BlockDist;

const D = Space dmapped new blockDist(Space);
var A: [D] int = 1;
var B: [Space] int = 2;

A[3..5] = B[3..5];
writeln(A);
}

{
// this is not supported today. Relevant doi functions need to be adjusted.
// This is not an AVE limitation.
use CyclicDist;

const D = Space dmapped new cyclicDist(Space.first);
var A: [D] int = 1;
var B: [Space] int = 2;

A[3..5] = B[3..5];
writeln(A);
}

{
use StencilDist;

const D = Space dmapped new stencilDist(Space);
var A: [D] int = 1;
var B: [Space] int = 2;

A[3..5] = B[3..5];
writeln(A);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--report-array-view-elision -sdebugBulkTransfer
46 changes: 46 additions & 0 deletions test/optimizations/arrayViewElision/localToDistributed.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
ArrayViewElision supported localToDistributed.chpl:11
lhsBaseType: [BlockDom(1,int(64),one,unmanaged DefaultDist)] int(64)
lhsIndexingExprs:
range(int(64),both,one)
rhsBaseType: [domain(1,int(64),one)] int(64)
rhsIndexingExprs:
range(int(64),both,one)

ArrayViewElision supported localToDistributed.chpl:24
lhsBaseType: [CyclicDom(1,int(64),one)] int(64)
lhsIndexingExprs:
range(int(64),both,one)
rhsBaseType: [domain(1,int(64),one)] int(64)
rhsIndexingExprs:
range(int(64),both,one)

ArrayViewElision supported localToDistributed.chpl:35
lhsBaseType: [StencilDom(1,int(64),one,false)] int(64)
lhsIndexingExprs:
range(int(64),both,one)
rhsBaseType: [domain(1,int(64),one)] int(64)
rhsIndexingExprs:
range(int(64),both,one)

Performing protoSlice bulk transfer
operator =(a:[],b:[]): in chpl__bulkTransferArray
operator =(a:[],b:[]): attempting doiBulkTransferFromKnown
operator =(a:[],b:[]): in chpl__bulkTransferArray
operator =(a:[],b:[]): attempting doiBulkTransferFromKnown
In DefaultRectangular._simpleTransfer(): Alo=(3,), Blo=(3,), len=3, elemSize=8
operator =(a:[],b:[]): successfully completed bulk transfer
operator =(a:[],b:[]): successfully completed bulk transfer
1 1 2 2 2 1 1 1 1 1
Performing protoSlice bulk transfer
operator =(a:[],b:[]): in chpl__bulkTransferArray
operator =(a:[],b:[]): bulk transfer did not happen
1 1 2 2 2 1 1 1 1 1
Performing protoSlice bulk transfer
operator =(a:[],b:[]): in chpl__bulkTransferArray
operator =(a:[],b:[]): attempting doiBulkTransferFromKnown
operator =(a:[],b:[]): in chpl__bulkTransferArray
operator =(a:[],b:[]): attempting doiBulkTransferFromKnown
In DefaultRectangular._simpleTransfer(): Alo=(3,), Blo=(3,), len=3, elemSize=8
operator =(a:[],b:[]): successfully completed bulk transfer
operator =(a:[],b:[]): successfully completed bulk transfer
1 1 2 2 2 1 1 1 1 1