cdvmDDe (1158399), страница 4
Текст из файла (страница 4)
DVM( REALIGN array "["dummy-var"]"...
WITH base "["align-expr"]"... ) ;
Proposed compiler output.
DVM_REALIGN(arr,base,k,i,a,b,new);
Note. The executable directive is converted to the statement.
Implementation.
The function wfREALIGN verifies an array and issues a message if
-
it is not defined;
-
it is not specified by a ALIGN directive;
-
ranks mismatch.
Other parts of the directive are verified as for ALIGN directive.
Required subtrees are built by the function wfREALIGN.
3.1.7TEMPLATE clause
Context and syntax.
DVM(DISTRIBUTE ... ; TEMPLATE [ "["size"]"... ] )
void * template-id ;
Proposed compiler output.
AMViewRef template-id;
Note. Source declaration is substituted. Distribution formats will be used in the template creation. If size is specified the creation will be implicit.
Implementation.
The function ISWFdcltr verifies (besides all) that the template-id is declared as void *, and issues a message otherwise. The function wfTEMPLATE verifies a TEMPLATE subdirective parameter and issues a message if ranks mismatch.
The function crRef(N,type) changes the type "void*" by the RTL type "AMViewRef".
3.1.8CREATE_TEMPLATE directive
Context and syntax.
DVM(CREATE_TEMPLATE template-id "["size"]"... ) ;
Proposed compiler output.
DVM_CREATE_TEMPLATE(am,t,r,di);
DVM_DISTRIBUTE(amv,ps,k,axs);
Note. The executable directive is converted to the statement.
Implementation.
The function wfLX_CRTEMP verifies the directive and issues a message if
-
the template-id is not defined;
-
it is not specified as TEMPLATE;
-
it is a "static" template (so created automatically);
-
ranks mismatch.
Required subtrees are built by the function mk_templ(amv,dims,dir).
3.2Distribution of computations (loops and tasks)
3.2.1PARALLEL directive
Context and syntax.
DVM ( PARALLEL "["loop-var"]"...
ON base "["align_expr"]"...
[ ; sub-directives]...)
loop-nest
Proposed compiler output.
{
[ dvm_create_rg ]
DVM_PARALLEL(n,r);
[ other sub-directives... ]
DVM_DO_ON((n,r,vs,ls,hs,ss,base,rb,is,as,bs);
[ dvm_reduction or dvm_reduction20 ]
{
DVM_DOPL(n)
loop-headers DVM_FOR...
{
loop-body
}
}
[ end_reduction ]
DVM_END_PARALLEL(n);
}
Implementation.
The core of the directive are verified as for ALIGN directive. The function wfDVMvar verifies the loop-var list comparing it with loop headers and issues a message if it consists of not all loop variables or contains them in other order.
Required subtrees are built by the function pLoop. It also inserts subtrees built for subdirectives into appropriate place in a paralle loop shell.
3.2.2ACROSS clause
Context and syntax.
DVM ( PARALLEL ... ; ACROSS array "["widths"]"... )
Proposed compiler output.
dvm_parallel ... sub_directives
DVM_ACROSS(loopid, (
DVM_ACROSS_SH(a,k,ls,hs,corner) // for each renewee
...
))
{ dvm_dopl
loop-headers...
loop-body
}
DVM_END_ACROSS()
[ end_reduction ]
dvm_end_parallel
Implementation.
The function wfDVMshw() verifies shadow edge width list and issues a message if:
-
ranks mismatch;
-
declared (or default) maximal edge width is exceeded.
The function wfDVMshad() verifies renewee and issues a message if CORNER is used for 1-D array (warning).
Required subtrees are built by the function wfACROSS. Final tree building is performed by the function Ploop, after the loop is entirely parsed. It inserts early created subtree into appropriate point of a parallel loop shell.
3.2.3PROCESSORS directive and NUMBER_OF_PROCESSORS() function
Context and syntax.
DVM(PROCESSORS "["dim"]"...) void * proc_id ;
Proposed compiler output.
PSRef proc_id;
...
DVM_PROCESSORS(Iproc_id),r,dims);
Note. Source declaration is substituted. The macro is generated not at the point of declaration, but in a sequence of implicit actions.
Implementation.
The function ISWFdcltr verifies (besides all) that the proc-id is declared as void *, and issues a message otherwise. The function ISWFdclr also builds a tree for the macro DVM_PROCESSORS and keeps it using function addIMloc in temporary local or global list. Statements will be inserted in appropriate place by functions genIMglob or genIMloc.
The function crRef(N,type) changes the type "void*" by the RTL type "PSRef".
3.2.4TASK directive
Context and syntax.
DVM(TASK) void * task-id "["size"]"
Proposed compiler output.
AMViewRef AMV_task-id;
PSRef task-id [ size ]={0};
...
DVM_TASK(task-id,n);
Note. Source declaration is substituted. The macro is generated not at the point of declaration, but in a sequence of implicit actions.
Implementation.
The function ISWFdcltr verifies (besides all) that the task-id is declared as void *, and issues a message otherwise. The function ISWFdclr also builds a tree for the macro DVM_TASK and keeps it using function addIMloc in temporary local or global list. Statements will be inserted in appropriate place by functions genIMglob or genIMloc.
The function crRef(N,type) changes the type "void*" by the RTL type "PSRef" and creates a declaration of AM-representation variable AMV_.... The function crAMVdcltrs(N) creates a declarator for it.
3.2.5MAP directive
Context and syntax.
DVM(MAP task-id"["task_ind"]" ONTO proc-section );
Proposed compiler output.
DVM_MAP(task,ind, [ DVM_ONTO(ps,k,ls,hs) ]) ;
Note. The executable directive is converted to the statement.
Implementation.
Required subtrees are built by the function wfMAP, using the tree built for the ONTO clause.
3.2.6TASK_REGION directive
Context and syntax.
DVM(TASK_REGION task-id)
{
ON-block... | ON-loop
}
Proposed compiler output.
{DVM_TASKREGION(no,task);
...
}
Implementation.
The function wfTASKREGION verifies compound statement. All their statements must be an ON-blocks or it should consist of single statement - ON-loop. Then the function builds required subtree including statements for a REDUCTION sub-directive, and for the debugger (-dx option).
3.2.7ON-block construct
Context and syntax.
DVM(ON task-id "["task-ind"]")
{ C-statements }
Proposed compiler output.
if(DVM_RUN(task,ind))
{ statements
DVM_STOP();
}
Implementation.
The function wfLXItask verifies task-id and issues a message if it is not defined or not specified as a TASK.
Required subtrees are built by the function mkRUNAM().
3.2.8ON-loop construct
Context and syntax.
DVM(PARALLEL "["var"]" ON task-id "["var"]")
DO(var, ..., ..., ...)
{ C-statements }
Proposed compiler output.
for(var=0; ...)
if(DVM_RUN(task,var))
{ statements
DVM_STOP();
}
Implementation.
The function wfLXItask verifies task-id and issues a message if it is not defined or not specified as a TASK.
Required subtrees are built by the function mkRUNAM().
3.3Shadow edges
3.3.1SHADOW clause
Context and syntax.
DVM( DISTRIBUTE | ALIGN ...
; SHADOW "["widths"]"... )
Note. Nothing is generated at this point. Compiler keeps provided widths as the maximal ones. They will be used at array creation.
Implementation.
The function wfSHADOW verifies the width list and issues a message if ranks mismatch.
3.3.2SHADOW_RENEW clause
Context and syntax.
DVM(PARALLEL ... ; SHADOW_RENEW renewee... ... )
renewee ::= array [ "["widhs"]"... ] [ CORNER ]
Proposed compiler output.
DVM_SHADOW_RENEW(loop-number,
(DVM_SHADOWS(a,k,ls,hs,corner), // for each renewee
...
))
Note. It is shorthand for the sequence "CREATE_SHADOW_GROUP; SHADOW_START; SHADOW_WAIT;" with temporary shadow edge group, performed before the loop.
Implementation.
The function wfDVMshw() verifies shadow edge width list and issues a message if:
-
ranks mismatch;
-
declared (or default) maximum width is exceeded.
The function wfDVMshad() verifies renewee and issues a message if CORNER is used for 1-D array (warning).
Required subtrees are built by the function wfSHRENEW. Final tree building is performed by the function Ploop, after the loop is entirely parsed. It inserts early created subtree into appropriate point of a parallel loop shell.
3.3.3SHADOW_GROUP directive
Context and syntax.
DVM(SHADOW_GROUP) void * sh-group-id;
Proposed compiler output.















