Skip to content

Commit bd938b6

Browse files
authored
Merge pull request #516 from ThePortlandGroup/nv_stage
Pull 2018-06-27T16-24 Recent NVIDIA Changes
2 parents 2c2f790 + 8324628 commit bd938b6

File tree

13 files changed

+59
-556
lines changed

13 files changed

+59
-556
lines changed

include/flang/Error/errmsg-accel.n

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,19 @@
2626
.MS S 1014 "Global Threadprivate variables are not supported - $"
2727
.\" skipping to keep same numbers as Fortran front-end
2828
.MS S 1100 "Cannot collapse non-tightly-nested loops"
29+
.MS F 1015 "No shape directive is defined in structure $"
30+
.MS F 1016 "No shape name $ is defined in structure $"
31+
.MS F 1017 "arrays/pointers appearing in the OpenACC shape and policy directives must be a member of current aggregate type"
32+
.MS F 1018 "Only one unnamed Shape directive is allowed in one aggregate type (struct/union)"
33+
.MS F 1019 "Type clause must be used to specified structure type when Shape/Policy is defined outside (struct/union/class) definition"
34+
.MS F 1020 "Data-Type appearing in type clause cannot be found"
35+
.MS F 1021 "Data-Type appearing in type clause must be struct/union type"
36+
.MS F 1022 "Duplicated shape names $ are defined for structure/union/class $"
37+
.MS F 1023 "Duplicated policy names $ are defined for structure/union/class $"
38+
.MS F 1024 "Type clause is not allowed within structure/union/class definition"
39+
.MS F 1025 "The number of dimension section descriptions doesn't match member $ which requires $ dimensions"
40+
.MS F 1026 "Pointers appearing within relative clause must be their sibling members"
41+
.MS F 1027 "As motion clauses, only create, copyin, copyout, copy, update, and deviceptr are allowed in policy directive"
42+
.MS F 1028 "The variable $ doesn't have predefined policy $ available"
43+
.MS F 1029 "The variable $ using policy $ is not a structure-based type"
44+
.MS F 1030 "Policy motion $ is not allowed in $ directive"

runtime/flangmain/flangmain.c

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
2+
* Copyright (c) 1998-2018, NVIDIA CORPORATION. All rights reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@ extern char **__io_environ();
2727
extern void __io_set_argc(int);
2828
extern void __io_set_argv(char **);
2929

30-
#if defined(PGDLL) && defined(WINNT) && !defined(WIN64) && !defined(WIN32)
30+
#if defined(PGDLL) && defined(WINNT) && !defined(WIN64)
3131
struct {
3232
char *pghpf_01p;
3333
char *pghpf_02p;
@@ -51,31 +51,21 @@ char *__get_fort_0c_addr(void);
5151
char *__get_fort_type_addr(void);
5252
#endif
5353

54-
int main(argc, argv) int argc;
55-
char **argv;
54+
int main(int argc, char** argv)
5655
{
5756
int i = 0;
5857

59-
#if (defined(INTERIX86) || defined(INTERIX8664) || defined(WIN64) || defined(WIN32) || defined(TARGET_OSX_X86))
60-
_pgimain(argc, argv);
61-
#endif
62-
6358
__io_set_argc(argc);
6459
__io_set_argv(argv);
6560

66-
#if defined(WINNT) && !defined(WIN64) && !defined(WIN32)
67-
#if defined(PGDLL)
61+
#if defined(PGDLL) && defined(WINNT) && !defined(WIN64)
6862
pghpf_0.pghpf_01p = __get_fort_01_addr();
6963
pghpf_0.pghpf_02p = __get_fort_02_addr();
7064
pghpf_0.pghpf_03p = __get_fort_03_addr();
7165
pghpf_0.pghpf_04p = __get_fort_04_addr();
7266
pghpf_0c.pghpf_0cp = __get_fort_0c_addr();
7367
pg_type.pg_typep = __get_fort_type_addr();
7468
#endif
75-
MAIN(argc, argv, __io_environ());
76-
ENTF90(EXIT, exit)(&i);
77-
#else
7869
MAIN_(argc, argv, __io_environ());
7970
ENTF90(EXIT, exit)(&i);
80-
#endif
8171
}

tools/flang1/flang1exe/semsmp.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3753,7 +3753,7 @@ semsmp(int rednum, SST *top)
37533753
bttype = BT_ACCKERNELS | BT_ACCKDO;
37543754
dirname = "ACC KERNELS DO";
37553755
pr1 = PR_ACCKERNELS;
3756-
pr2 = PR_ACCKLOOP;
3756+
pr2 = PR_ACCTKLOOP;
37573757
dignorenested = TRUE;
37583758
goto ACCEL_ENTER_REGION;
37593759
/*
@@ -3765,7 +3765,7 @@ semsmp(int rednum, SST *top)
37653765
bttype = BT_ACCKERNELS | BT_ACCKLOOP;
37663766
dirname = "ACC KERNELS LOOP";
37673767
pr1 = PR_ACCKERNELS;
3768-
pr2 = PR_ACCKLOOP;
3768+
pr2 = PR_ACCTKLOOP;
37693769
dignorenested = TRUE;
37703770
ACCEL_ENTER_REGION:
37713771
SST_ASTP(LHS, 0);
@@ -3780,7 +3780,7 @@ semsmp(int rednum, SST *top)
37803780
bttype = BT_ACCPARALLEL | BT_ACCPDO;
37813781
dirname = "ACC PARALLEL DO";
37823782
pr1 = PR_ACCPARCONSTRUCT;
3783-
pr2 = PR_ACCPLOOP;
3783+
pr2 = PR_ACCTPLOOP;
37843784
dignorenested = TRUE;
37853785
goto ACCEL_ENTER_REGION;
37863786
/*
@@ -3793,7 +3793,7 @@ semsmp(int rednum, SST *top)
37933793
bttype = BT_ACCPARALLEL | BT_ACCPLOOP;
37943794
dirname = "ACC PARALLEL LOOP";
37953795
pr1 = PR_ACCPARCONSTRUCT;
3796-
pr2 = PR_ACCPLOOP;
3796+
pr2 = PR_ACCTPLOOP;
37973797
dignorenested = TRUE;
37983798
goto ACCEL_ENTER_REGION;
37993799
/*
@@ -4158,7 +4158,7 @@ semsmp(int rednum, SST *top)
41584158
bttype = BT_ACCSERIAL | BT_ACCSLOOP;
41594159
dirname = "ACC SERIAL LOOP";
41604160
pr1 = PR_ACCSERIAL;
4161-
pr2 = PR_ACCSLOOP;
4161+
pr2 = PR_ACCTSLOOP;
41624162
dignorenested = TRUE;
41634163
goto ACCEL_ENTER_REGION;
41644164
/*

tools/flang1/flang1exe/symacc.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ sym_init_first(void)
6060
assert(stb.n_base, "sym_init: no room for namtab", stb.n_size, ERR_Fatal);
6161
stb.n_base[0] = 0;
6262
STG_ALLOC(stb.dt, 400);
63-
STG_ALLOC_SIDECAR(stb.dt, stb.dt_shapemap);
6463
assert(stb.dt.stg_base, "sym_init: no room for dtypes", stb.dt.stg_size, ERR_Fatal);
6564
/* basically, this is sidecar of dt_base */
6665

@@ -69,16 +68,6 @@ sym_init_first(void)
6968
assert(stb.w_base, "sym_init: no room for wtab", stb.w_size, ERR_Fatal);
7069
}
7170
/* allocate deepcopy info */
72-
if(stb.dpinfo.stg_base == NULL) {
73-
STG_ALLOC(stb.dpinfo, 1000);
74-
STG_ALLOC(stb.dpdim, 1000);
75-
STG_ALLOC(stb.dpreg, 1000);
76-
}
77-
78-
if(stb.dppolicyidx.stg_base == NULL) {
79-
STG_ALLOC(stb.dppolicyidx, 1000);
80-
STG_ALLOC(stb.dppolicymem, 1000);
81-
}
8271

8372
stb.namavl = 1;
8473
stb.wrdavl = 0;
@@ -506,3 +495,4 @@ symini_interr(const char *txt, int val, int sev)
506495
sprintf(buff, "%7d", val);
507496
symini_error(0, sev, gbl.lineno, txt, buff);
508497
}
498+

tools/flang1/flang1exe/symacc.h

Lines changed: 0 additions & 168 deletions
Original file line numberDiff line numberDiff line change
@@ -102,64 +102,6 @@ void realloc_sym_storage();
102102
#define NEWSYM(sptr) \
103103
sptr = (SPTR)STG_NEXT(stb);
104104

105-
#define NEWDPSHAPE(ishape) \
106-
ishape = STG_NEXT(stb.dpinfo);
107-
108-
#define NEWDPMEMDIM(imemid) \
109-
imemid = STG_NEXT(stb.dpdim);
110-
111-
#define NEWDPSUBREG(isubid) \
112-
isubid = STG_NEXT(stb.dpreg);
113-
114-
#define NEWDPPOLICYIDX(ipolicyid) \
115-
ipolicyid = STG_NEXT(stb.dppolicyidx);
116-
117-
#define NEWDPPOLICYMEM(ipolicymemid) \
118-
ipolicymemid = STG_NEXT(stb.dppolicymem);
119-
120-
#define DP_FIRSTSHAPE(dtype) stb.dt_shapemap.stg_base[dtype]
121-
#define DP_FIRSTPOLICY(dtype) stb.dt_shapemap.stg_base[dtype+1]
122-
/* if this structure/union type, does it include any dynamic member
123-
* in this descendants */
124-
#define DP_INCLUDEDYN(dtype) stb.dt_shapemap.stg_base[dtype+2]
125-
#define DP_INCDYN_FLG_UNSET (0)
126-
#define DP_INCDYN_FLG_HASDYN (1)
127-
#define DP_INCDYN_FLG_NODYN (2)
128-
129-
#define DP_SHAPE_NEXT(ishape) stb.dpinfo.stg_base[ishape].next
130-
#define DP_SHAPE_NAME(ishape) stb.dpinfo.stg_base[ishape].sptr
131-
#define DP_SHAPE_LINENO(ishape) stb.dpinfo.stg_base[ishape].lineno
132-
#define DP_SHAPE_PARENT_TYPE(ishape) stb.dpinfo.stg_base[ishape].typeidx
133-
#define DP_SHAPE_PARENT_TNAME(ishape) stb.dpinfo.stg_base[ishape].typesptr
134-
#define DP_SHAPE_INEX(ishape) stb.dpinfo.stg_base[ishape].inex
135-
#define DP_SHAPE_1ST_MEMID(ishape) stb.dpinfo.stg_base[ishape].memid
136-
137-
#define DP_MEMID_MAP_SPTR(memid) stb.dpdim.stg_base[memid].sptr
138-
#define DP_MEMID_LINENO(memid) stb.dpdim.stg_base[memid].lineno
139-
#define DP_MEMID_TYPE(memid) stb.dpdim.stg_base[memid].type
140-
#define DP_MEMID_NEXT(memid) stb.dpdim.stg_base[memid].next
141-
#define DP_MEMID_1ST_SUBREGION(memid) stb.dpdim.stg_base[memid].subregion
142-
143-
#define DP_SUBREGION_LOW(isubid) stb.dpreg.stg_base[isubid].low
144-
#define DP_SUBREGION_LOW_TYPE(isubid) stb.dpreg.stg_base[isubid].lowtype
145-
#define DP_SUBREGION_HIGH(isubid) stb.dpreg.stg_base[isubid].upper
146-
#define DP_SUBREGION_HIGH_TYPE(isubid) stb.dpreg.stg_base[isubid].uppertype
147-
#define DP_SUBREGION_NEXT(isubid) stb.dpreg.stg_base[isubid].next
148-
149-
#define DP_POLICY_NAME(ipolicyid) stb.dppolicyidx.stg_base[ipolicyid].sptr
150-
#define DP_POLICY_SHAPEID(ipolicyid) stb.dppolicyidx.stg_base[ipolicyid].shapeid
151-
#define DP_POLICY_LINENO(ipolicyid) stb.dppolicyidx.stg_base[ipolicyid].lineno
152-
#define DP_POLICY_PARENT_TYPE(ipolicyid) stb.dppolicyidx.stg_base[ipolicyid].typeidx
153-
#define DP_POLICY_PARENT_TNAME(ipolicyid) stb.dppolicyidx.stg_base[ipolicyid].typesptr
154-
#define DP_POLICY_1ST_MEMID(ipolicyid) stb.dppolicyidx.stg_base[ipolicyid].memid
155-
#define DP_POLICY_INEX_FLAG(ipolicyid) stb.dppolicyidx.stg_base[ipolicyid].inex
156-
#define DP_POLICY_NEXT(ipolicyid) stb.dppolicyidx.stg_base[ipolicyid].next
157-
158-
#define DP_POLICYMEM_NAME(ipolicymemid) stb.dppolicymem.stg_base[ipolicymemid].sptr
159-
#define DP_POLICYMEM_MOTION_TYPE(ipolicymemid) stb.dppolicymem.stg_base[ipolicymemid].mtype
160-
#define DP_POLICYMEM_POLICYIDX(ipolicymemid) stb.dppolicymem.stg_base[ipolicymemid].policyidx
161-
#define DP_POLICYMEM_NEXT(ipolicymemid) stb.dppolicymem.stg_base[ipolicymemid].next
162-
163105
#define LINKSYM(sptr, hashval) \
164106
HASHLKP(sptr, stb.hashtb[hashval]); \
165107
stb.hashtb[hashval] = sptr
@@ -232,102 +174,6 @@ typedef struct SYM {
232174
INT w40;
233175
} SYM;
234176

235-
typedef struct DPSHAPE {
236-
int sptr; /*name of current shape*/
237-
int typeidx; /* this is type in which shape dir applies */
238-
int typesptr; /* parent type name, DTYPEG(typesptr)
239-
* should equal to typeidx */
240-
int memid; /* shape info for the first mem*/
241-
/* default(include/exclude) clause
242-
* 0: default clause not appear
243-
* 1: default is include
244-
* 2: default is exclude */
245-
int inex;
246-
int lineno;
247-
int next; /* next shape */
248-
}DPSHAPE;
249-
250-
typedef enum ACC_DP_SH_TYPE {
251-
ACC_DP_SH_TUNKNOWN = 0,
252-
ACC_DP_SH_TARRAY_SD, /* array section description */
253-
ACC_DP_SH_TINIT_NEEDED,
254-
ACC_DP_SH_RELATIVE
255-
}ACC_DP_SH_TYPE;
256-
257-
typedef struct DPMEMDIM {
258-
int sptr; /* entry to the name of struct/union/class member */
259-
/* if sptr is a scalar, subregion is 0
260-
* it means this scalar var is init_needed */
261-
int subregion;
262-
int lineno;
263-
int type;
264-
int next;
265-
}DPMEMDIM;
266-
267-
typedef enum DPBNDTYPE {
268-
DP_BND_UNKNOWN,
269-
DP_BND_CONST, /* compilation time known constant */
270-
DP_BND_SIBLING_MEM, /* sibling scalar members */
271-
DP_BND_GBL_VAR, /* global variable which will be translated into ptr */
272-
DP_BND_EXP, /* it is an expression. */
273-
DP_BND_TAG /* it is only used to identify pointers
274-
* in relative clause (not start ptr) */
275-
}DPBNDTYPE;
276-
277-
typedef struct DPSUBREG {
278-
int low; /* constant */
279-
DPBNDTYPE lowtype; /* const, sibling mem entry, expression */
280-
int upper;
281-
DPBNDTYPE uppertype; /* const, sibling mem entry, expression */
282-
int next; /* next dimensional info */
283-
}DPSUBREG;
284-
285-
typedef enum ACC_DP_DEFAULTVALUE {
286-
ACC_DP_DEFAULT_NONE=0,
287-
ACC_DP_DEFAULT_INCLUDE,
288-
ACC_DP_DEFAULT_EXCLUDE
289-
}ACC_DP_DEFAULTVALUE;
290-
291-
typedef struct DP_POLICY_IDX {
292-
int sptr; /* policy name */
293-
int shapeid; /* which shape is used by this policy directive */
294-
int typeidx; /* this is type in which policy is declared */
295-
int typesptr; /* parent type name, DTYPEG(typesptr)
296-
* should equal to typeidx */
297-
int memid; /* first member */
298-
/* default(include/exclude) clause
299-
* 0: default clause not appear
300-
* 1: default is include
301-
* 2: default is exclude */
302-
int inex;
303-
int lineno;
304-
int next; /* next policy */
305-
}DP_POLICY_IDX;
306-
307-
/* deepcopy policy motion type
308-
* If this order is changed, the same order
309-
* must be changes in runtime unified.h */
310-
typedef enum DP_POLICY_MTYPE {
311-
ACC_DP_UNKNOWN=0,
312-
ACC_DP_COPYIN,
313-
ACC_DP_COPYOUT,
314-
ACC_DP_COPY,
315-
ACC_DP_CREATE,
316-
ACC_DP_UPDATE,
317-
ACC_DP_DEVPTR,
318-
ACC_DP_NOCREATE, /* NOT IMPLEMENT */
319-
ACC_DP_PRESENT /* NOT IMPLEMENT */
320-
}DP_POLICY_MTYPE;
321-
322-
/* Policy Members */
323-
typedef struct DP_POLICY_MEM {
324-
int sptr; /* member name */
325-
DP_POLICY_MTYPE mtype; /* motion type */
326-
int policyidx;
327-
int lineno;
328-
int next; /* next mem in this policy */
329-
}DP_POLICY_MEM;
330-
331177
/* symbol table data declarations: */
332178
typedef struct {
333179
const char *stypes[ST_MAX + 1];
@@ -345,24 +191,10 @@ typedef struct {
345191
struct{
346192
STG_MEMBERS(ISZ_T);
347193
}dt;
348-
struct{
349-
STG_MEMBERS(ISZ_T);
350-
}dt_shapemap;
351194
int curr_scope;
352195
SPTR hashtb[HASHSIZE + 1];
353196
SPTR firstusym, firstosym;
354197
STG_MEMBERS(SYM);
355-
/* shape info for aggregate data type */
356-
STG_DECLARE(dpinfo, DPSHAPE);
357-
/* deepcopy dimensional info for each mem in a data type
358-
* it points entries in dpreg */
359-
STG_DECLARE(dpdim, DPMEMDIM);
360-
/* low/upper bound of each dim */
361-
STG_DECLARE(dpreg, DPSUBREG);
362-
/* Policy ID */
363-
STG_DECLARE(dppolicyidx, DP_POLICY_IDX);
364-
/* Mem motion definition in the policy directive */
365-
STG_DECLARE(dppolicymem, DP_POLICY_MEM);
366198
char *n_base;
367199
int n_size;
368200
int namavl;

tools/flang2/flang2exe/exp_ftn.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4113,8 +4113,17 @@ exp_misc(ILM_OP opc, ILM *ilmp, int curilm)
41134113
break;
41144114
case PR_ACCKLOOP:
41154115
break;
4116+
case PR_ACCTKLOOP:
4117+
break;
41164118
case PR_ACCPLOOP:
41174119
break;
4120+
case PR_ACCTPLOOP:
4121+
break;
4122+
case PR_ACCSLOOP:
4123+
case PR_ACCTSLOOP:
4124+
/* don't need anything at this for the a
4125+
* loop clause in a serial construct */
4126+
break;
41184127
case PR_ACCUPDATE:
41194128
break;
41204129
case PR_ACCSHORTLOOP:

tools/flang2/flang2exe/ilmutil.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,7 @@ _dumponeilm(ILM_T *ilm_base, int i, int check)
927927
case IM_PRAGMAEXPR:
928928
case IM_PRAGMASYMEXPR:
929929
case IM_PRAGMASELIST:
930+
case IM_PRAGMADPSELIST:
930931
case IM_PRAGMAGEN:
931932
switch (pr) {
932933
case PR_NONE:

tools/flang2/flang2exe/mwd.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3136,6 +3136,7 @@ dumpdtypes(void)
31363136
dumpdtype(dtype);
31373137
}
31383138
fprintf(dfile, "\n");
3139+
31393140
} /* dumpdtypes */
31403141

31413142
void

tools/flang2/flang2exe/mwd.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,26 @@ void printblocksline(void);
753753
*/
754754
void printblocks(void);
755755

756+
/**
757+
\brief ...
758+
*/
759+
void dumpdpshape(int shapeid);
760+
761+
/**
762+
\brief ...
763+
*/
764+
void dumpdppolicy(int policyid);
765+
766+
/**
767+
\brief ...
768+
*/
769+
void dumpdpshapes();
770+
771+
/**
772+
\brief ...
773+
*/
774+
void dumpdppolicies();
775+
756776
/**
757777
\brief ...
758778
*/

0 commit comments

Comments
 (0)