Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 306064

Summary: Barrier Analysis does not match barriers (CDT AST changes)
Product: [Tools] PTP Reporter: Beth Tibbitts <beth>
Component: PLDTAssignee: Beth Tibbitts <beth>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 4.0   
Target Milestone: 4.0.4   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
Image showing the old and new AST structure none

Description Beth Tibbitts CLA 2010-03-16 14:21:35 EDT
On ptp 2.0 M6, barrier analysis does not match barriers in a set as it should
e.g.
if(task==0)
  MPI_Barrier(MPI_COMM_WORLD);  //1
else
  MPI_Barrier(MPI_COMM_WORLD):  //2

Barrier 1 and two should be in sets together and thus removing one of these should
cause a barrier error; it doesn't.
Comment 1 Beth Tibbitts CLA 2010-04-29 10:00:08 EDT
The above should say ptp 4.0, not ptp 2.0
Comment 2 Beth Tibbitts CLA 2010-04-29 10:08:37 EDT
In CDT 6.0 (used by PTP 3.0, and Eclipse 3.5=Galileo, the previous version), function arguments in the AST are wrappered by an IASTExpressionList node.  In CDT 7.0 this node is not there.

PTP MPI Barrier Analysis uses the AST to determine matching barriers, and relied on this node to process function arguments.  That node is no longer there.

While the IASTExpressionList node is not longer in the AST, we can still create a node of that type by calling IASTFunctionCallExpression.getParameterExpression();

However this node will NOT be encountered now when walking the AST tree in the ASTVisitors.

Most of this logic is in MPIMVAnalysis.java
Comment 3 Beth Tibbitts CLA 2010-04-29 10:12:09 EDT
Created attachment 166487 [details]
Image showing the old and new AST structure
Comment 4 Beth Tibbitts CLA 2010-04-29 10:15:19 EDT
For now we will reinstate as much previous behavior as possible by getting the IASTExpressionList node from the IASTFunctionCallExpression.getParameterExpression() when we are processing the IASTFunctionCallExpression node, and do the push/pop/etc of saving state at that time.

Note that both visit() and leave() are used with assumptions about which nodes are contained in which other nodes, so this is complex.
Comment 5 Beth Tibbitts CLA 2010-04-29 14:52:14 EDT
Note: most of the changes necessary are in
MPIMVAnalysis.java
Comment 6 Beth Tibbitts CLA 2010-06-28 10:32:38 EDT
Some additional reference that may be helpful

CDT AST changes in CDT 7.0
http://dev.eclipse.org/mhonarc/lists/cdt-dev/msg18616.html
http://wiki.eclipse.org/CDT/planning/7.0
Comment 7 Beth Tibbitts CLA 2010-09-17 14:53:55 EDT
Fixed in ptp_4_0 branch.  changes to MPIBarrierExpr.java
Need to commit to HEAD too.
Comment 8 Beth Tibbitts CLA 2010-09-17 14:54:30 EDT
should be in 4.0.4
Comment 9 Beth Tibbitts CLA 2010-09-30 11:07:35 EDT
committed to HEAD for PTP 5.0 as well
Comment 10 Beth Tibbitts CLA 2010-09-30 11:08:18 EDT
fixed.