1 /* 2 * Copyright (c) 2007-2019, NVIDIA CORPORATION. All rights reserved. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 * 16 */ 17 18 #ifndef PRAGMA_H_ 19 #define PRAGMA_H_ 20 21 /* 22 * pragma scopes 23 */ 24 typedef enum { 25 PR_NOSCOPE = 0, 26 PR_GLOBAL = 1, 27 PR_ROUTINE = 2, 28 PR_LOOP = 3, 29 PR_LINE = 4, 30 } PR_SCOPE; 31 32 /* 33 * PR_ACCREDUCTION operators 34 */ 35 typedef enum { 36 PR_ACCREDUCT_OP_ADD = 0, 37 PR_ACCREDUCT_OP_MUL = 1, 38 PR_ACCREDUCT_OP_MAX = 2, 39 PR_ACCREDUCT_OP_MIN = 3, 40 PR_ACCREDUCT_OP_BITAND = 4, 41 PR_ACCREDUCT_OP_BITIOR = 5, 42 PR_ACCREDUCT_OP_BITEOR = 6, 43 PR_ACCREDUCT_OP_LOGAND = 7, 44 PR_ACCREDUCT_OP_LOGOR = 8, 45 PR_ACCREDUCT_OP_EQV = 9, 46 PR_ACCREDUCT_OP_NEQV = 10, 47 } PR_ACCREDUCT_OP; 48 49 /* 50 * pragma values 51 */ 52 typedef enum { 53 PR_NONE = 0, 54 PR_INLININGON = 1, 55 PR_INLININGOFF = 2, 56 PR_ALWAYSINLINE = 3, 57 PR_MAYINLINE = 4, 58 PR_NEVERINLINE = 5, 59 PR_ACCEL = 6, /* accelerator region directive */ 60 PR_ENDACCEL = 7, /* accelerator end region directive */ 61 PR_INLINEONLY = 8, 62 PR_INLINETYPE = 9, 63 PR_INLINEAS = 10, 64 PR_INLINEALIGN = 11, 65 PR_ACCCOPYIN = 12, /* accelerator copyin clause */ 66 PR_ACCCOPYOUT = 13, /* accelerator copyout clause */ 67 PR_ACCLOCAL = 14, /* accelerator local clause */ 68 PR_ACCELLP = 15, /* accelerator loop directive */ 69 PR_ACCVECTOR = 16, /* accelerator vector clause */ 70 PR_ACCPARALLEL = 17, /* accelerator parallel clause */ 71 PR_ACCSEQ = 18, /* accelerator seq clause */ 72 PR_ACCHOST = 19, /* accelerator host clause */ 73 PR_ACCPRIVATE = 20, /* accelerator private clause */ 74 PR_ACCCACHE = 21, /* accelerator cache clause */ 75 PR_ACCSHORTLOOP = 22, /* accelerator shortloop clause */ 76 PR_ACCBEGINDIR = 23, /* accelerator begin directive */ 77 PR_ACCIF = 24, /* accelerator if clause */ 78 PR_ACCUNROLL = 25, /* accelerator unroll clause */ 79 PR_ACCKERNEL = 26, /* accelerator kernel clause */ 80 PR_ACCCOPY = 27, /* accelerator copy clause */ 81 PR_ACCDATAREG = 28, /* accelerator data region */ 82 PR_ACCENDDATAREG = 29, /* accelerator end data region */ 83 PR_ACCUPDATEHOST = 30, /* accelerator update host data */ 84 PR_ACCUPDATEDEVICE = 31, /* accelerator update device data */ 85 PR_ACCUPDATE = 32, /* update directive */ 86 PR_ACCINDEPENDENT = 33, /* loop is independent */ 87 PR_ACCWAIT = 34, /* wait clause for kernels */ 88 PR_ACCNOWAIT = 35, /* don't wait clause, launch asynchronously */ 89 PR_ACCIMPDATAREG = 36, /* implicit accelerator data region */ 90 PR_ACCENDIMPDATAREG = 37, /* implicit accelerator data region */ 91 PR_ACCMIRROR = 38, /* accelerator mirror clause */ 92 PR_ACCREFLECT = 39, /* accelerator reflected clause */ 93 PR_KERNELBEGIN = 40, /* kernel begin directive */ 94 PR_KERNEL = 41, /* kernel */ 95 PR_ENDKERNEL = 42, /* end kernel */ 96 PR_KERNELTILE = 43, /* kernel tile size */ 97 PR_ACCDEVSYM = 44, /* For communicating from F90 front-end to back-end */ 98 PR_ACCIMPDATAREGX = 45, /* necessary implicit data region */ 99 PR_KERNEL_NEST = 46, /* kernel */ 100 PR_KERNEL_GRID = 47, /* kernel */ 101 PR_KERNEL_BLOCK = 48, /* kernel */ 102 PR_ACCDEVICEPTR = 49, /* C device pointer */ 103 PR_ACCPARUNROLL = 50, /* unroll parallel loop */ 104 PR_ACCVECUNROLL = 51, /* unroll vector loop */ 105 PR_ACCSEQUNROLL = 52, /* unroll sequential loop */ 106 PR_ACCCUDACALL = 53, /* call cuda kernel directly */ 107 PR_ACCSCALARREG = 54, /* scalar region */ 108 PR_ACCENDSCALARREG = 55, /* end scalar region */ 109 PR_ACCPARCONSTRUCT = 56, /* accelerator parallel construct */ 110 PR_ACCENDPARCONSTRUCT = 57, /* end accelerator parallel construct */ 111 PR_ACCKERNELS = 58, /* accelerator kernels construct */ 112 PR_ACCENDKERNELS = 59, /* end accelerator kernels construct */ 113 PR_ACCCREATE = 60, /* create clause, same as local clause */ 114 PR_ACCPRESENT = 61, /* present clause */ 115 PR_ACCPCOPY = 62, /* present_or_copy clause */ 116 PR_ACCPCOPYIN = 63, /* present_or_copyin clause */ 117 PR_ACCPCOPYOUT = 64, /* present_or_copyout clause */ 118 PR_ACCPCREATE = 65, /* present_or_create clause */ 119 PR_ACCASYNC = 66, /* async clause */ 120 PR_KERNEL_STREAM = 67, /* kernel stream argument */ 121 PR_KERNEL_DEVICE = 68, /* kernel device argument */ 122 PR_ACCWAITDIR = 69, /* wait directive */ 123 PR_ACCKLOOP = 70, /* loop in accelerator kernels region */ 124 PR_ACCPLOOP = 71, /* loop in accelerator parallel region */ 125 PR_ACCGANG = 72, /* accelerator gang clause */ 126 PR_ACCWORKER = 73, /* accelerator worker clause */ 127 PR_ACCFIRSTPRIVATE = 74, /* accelerator firstprivate clause */ 128 PR_ACCNUMGANGS = 75, /* accelerator num_gangs clause */ 129 PR_ACCNUMWORKERS = 76, /* accelerator num_workers clause */ 130 PR_ACCVLENGTH = 77, /* accelerator vector_length clause */ 131 PR_ACCWAITARG = 78, /* wait directive argument */ 132 PR_ACCREDUCTION = 79, /* reduction clause */ 133 PR_ACCREDUCTOP = 80, /* reduction operator */ 134 PR_ACCCACHEDIR = 81, /* cache directive */ 135 PR_ACCCACHEARG = 82, /* cache directive argument */ 136 PR_ACCHOSTDATA = 83, /* host_data directive */ 137 PR_ACCENDHOSTDATA = 84, /* end host_data */ 138 PR_ACCUSEDEVICE = 85, /* use_device clause */ 139 PR_ACCCOLLAPSE = 86, /* collapse clause */ 140 PR_ACCDEVICERES = 87, /* device_resident clause */ 141 PR_ACCDEVICEID = 88, /* deviceid clause */ 142 PR_ACCDELETE = 89, /* delete clause on exit data */ 143 PR_ACCPDELETE = 90, /* present_or_delete clause on exit data */ 144 PR_ACCENTERDATA = 91, /* enter data directive */ 145 PR_ACCEXITDATA = 92, /* exit data directive */ 146 PR_ACCLOOPPRIVATE = 93, /* implicitly loop-private symbol */ 147 PR_ACCUPDATESELF = 94, /* accelerator update self data */ 148 PR_ACCLINK = 95, /* 'link' data clause */ 149 PR_ACCTILE = 96, /* 'tile' loop clause */ 150 PR_ACCAUTO = 97, /* 'auto' loop clause */ 151 PR_ACCGANGCHUNK = 98, /* chunk size for scheduling gang loop */ 152 PR_ACCDEFNONE = 99, /* default(none) clause */ 153 PR_ACCPNOT = 100, /* present_or_not clause */ 154 PR_ACCNUMGANGS2 = 101, /* accelerator num_gangs clause, 2nd dimension */ 155 PR_ACCNUMGANGS3 = 102, /* accelerator num_gangs clause, 3rd dimension */ 156 PR_ACCGANGDIM = 103, /* accelerator gang(dim:) clause value */ 157 PR_ACCDEFPRESENT = 104, /* default(present) clause */ 158 PR_ACCFORCECOLLAPSE = 105, /* collapse(force) clause */ 159 PR_CUFLOOPPRIVATE = 106, /* implicitly loop-private symbol */ 160 PR_ACCCACHEREADONLY = 107, /* cache(readonly:*) */ 161 PR_ACCFINALEXITDATA = 108, /* exit data directive with finalize clause */ 162 PR_ACCUPDATEHOSTIFP = 109, /* accelerator update host data if present */ 163 PR_ACCUPDATEDEVICEIFP = 110, /* accelerator update device data if present */ 164 PR_ACCUPDATESELFIFP = 111, /* accelerator update self data if present */ 165 PR_ACCINITDIR = 112, /* accelerator init directive */ 166 PR_ACCSHUTDOWNDIR = 113, /* accelerator shutdown directive */ 167 PR_ACCDEFAULT_ASYNC = 114, /* accelerator default_async clause */ 168 PR_ACCDEVICE_NUM = 115, /* accelerator device_num clause */ 169 PR_ACCSETDIR = 116, /* accelerator set directive */ 170 PR_ACCUSEDEVICEIFP = 117, /* accelerator use device clause combined with if present */ 171 PR_ACCNO_CREATE = 118, /* no_create clause */ 172 PR_ACCSERIAL = 119, /* accelerator serial construct */ 173 PR_ACCENDSERIAL = 120, /* end accelerator serial construct */ 174 PR_ACCSLOOP = 121, /* loop in accelerator serial region */ 175 PR_ACCATTACH = 122, /* attach clause */ 176 PR_ACCDETACH = 123, /* detach clause */ 177 PR_ACCTKLOOP = 124, /* tightly-nested outer loop in kernels construct */ 178 PR_ACCTPLOOP = 125, /* tightly-nested outer loop in parallel construct */ 179 PR_ACCTSLOOP = 126, /* tightly-nested outer loop in serial construct */ 180 PR_ACCCOMPARE = 127, /* pragma that backends into acc_compare (__pgi_uacc_usercompare) */ 181 PR_PGICOMPARE = 128, /* pragma that backends into pgi_compare */ 182 PR_PCASTCOMPARE = 129, /* generic PCAST compare directive */ 183 PR_MAPALLOC = 130, /* OpenMP clause map(alloc: */ 184 PR_MAPDELETE = 131, /* OpenMP clause map(delete: */ 185 PR_MAPFROM = 132, /* OpenMP clause map(from: */ 186 PR_MAPRELEASE = 133, /* OpenMP clause map(release: */ 187 PR_MAPTO = 134, /* OpenMP clause map(to: */ 188 PR_MAPTOFROM = 135, /* OpenMP clause map(tofrom: */ 189 PR_UPDATEFROM = 136, /* OpenMP clause target update from( */ 190 PR_UPDATETO = 137 /* OpenMP clause target update to( */ 191 } PR_PRAGMA; 192 193 /* Ignore data movement pragmas */ 194 #define ACC_DATAMOVEMENT_DISABLED XBIT(195, 0x400) 195 196 /** 197 \brief ... 198 */ 199 void apply_nodepchk(int dir_lineno, int dir_scope); 200 201 /** 202 \brief ... 203 */ 204 void p_pragma(char *pg, int pline); 205 206 /** 207 \brief ... 208 */ 209 void push_lpprg(int beg_line); 210 211 /** 212 \brief ... 213 */ 214 void rouprg_enter(void); 215 216 #endif 217