Changeset 27434e9
- Timestamp:
- Jun 23, 2021, 5:19:38 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- b6f39aa
- Parents:
- 2b910f9 (diff), 1d71208 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/locks.hfa
r2b910f9 r27434e9 174 174 }; 175 175 176 static inline void ?{}(fast_lock & this) { this.owner = 0p; } 177 176 178 static inline bool $try_lock(fast_lock & this, $thread * thrd) { 177 179 $thread * exp = 0p; -
libcfa/src/concurrency/ready_queue.cfa
r2b910f9 r27434e9 20 20 21 21 22 //#define USE_RELAXED_FIFO22 #define USE_RELAXED_FIFO 23 23 // #define USE_WORK_STEALING 24 #define USE_CPU_WORK_STEALING24 // #define USE_CPU_WORK_STEALING 25 25 26 26 #include "bits/defs.hfa" … … 760 760 for(i; lanes.count) { 761 761 unsigned long long tsc1 = ts(lanes.data[i]); 762 unsigned long long tsc2 = rdtscl() 762 unsigned long long tsc2 = rdtscl(); 763 763 lanes.tscs[i].tv = min(tsc1, tsc2); 764 764 } -
libcfa/src/containers/array.hfa
r2b910f9 r27434e9 137 137 // Base 138 138 forall( [Nq], Sq & | sized(Sq), Tbase & ) 139 static inline tag(arpk(Nq, Sq, Tbase, Tbase)) enq_( tag(Tbase), tag(Nq), tag(Sq), tag(Tbase) ) {} 139 static inline tag(arpk(Nq, Sq, Tbase, Tbase)) enq_( tag(Tbase), tag(Nq), tag(Sq), tag(Tbase) ) { 140 tag(arpk(Nq, Sq, Tbase, Tbase)) ret; 141 return ret; 142 } 140 143 141 144 // Rec 142 145 forall( [Nq], Sq & | sized(Sq), [N], S & | sized(S), recq &, recr &, Tbase & | { tag(recr) enq_( tag(Tbase), tag(Nq), tag(Sq), tag(recq) ); } ) 143 static inline tag(arpk(N, S, recr, Tbase)) enq_( tag(Tbase), tag(Nq), tag(Sq), tag(arpk(N, S, recq, Tbase)) ) {} 146 static inline tag(arpk(N, S, recr, Tbase)) enq_( tag(Tbase), tag(Nq), tag(Sq), tag(arpk(N, S, recq, Tbase)) ) { 147 tag(arpk(N, S, recr, Tbase)) ret; 148 return ret; 149 } 144 150 145 151 // Wrapper -
src/Parser/DeclarationNode.cc
r2b910f9 r27434e9 1076 1076 if ( variable.tyClass != TypeDecl::NUMBER_OF_KINDS ) { 1077 1077 // otype is internally converted to dtype + otype parameters 1078 static const TypeDecl::Kind kindMap[] = { TypeDecl::Dtype, TypeDecl::D Stype, TypeDecl::Dtype, TypeDecl::Ftype, TypeDecl::Ttype, TypeDecl::Dimension };1078 static const TypeDecl::Kind kindMap[] = { TypeDecl::Dtype, TypeDecl::Dtype, TypeDecl::Dtype, TypeDecl::Ftype, TypeDecl::Ttype, TypeDecl::Dimension }; 1079 1079 static_assert( sizeof(kindMap) / sizeof(kindMap[0]) == TypeDecl::NUMBER_OF_KINDS, "DeclarationNode::build: kindMap is out of sync." ); 1080 1080 assertf( variable.tyClass < sizeof(kindMap)/sizeof(kindMap[0]), "Variable's tyClass is out of bounds." ); 1081 TypeDecl * ret = new TypeDecl( *name, Type::StorageClasses(), nullptr, kindMap[ variable.tyClass ], variable.tyClass == TypeDecl::Otype , variable.initializer ? variable.initializer->buildType() : nullptr );1081 TypeDecl * ret = new TypeDecl( *name, Type::StorageClasses(), nullptr, kindMap[ variable.tyClass ], variable.tyClass == TypeDecl::Otype || variable.tyClass == TypeDecl::DStype, variable.initializer ? variable.initializer->buildType() : nullptr ); 1082 1082 buildList( variable.assertions, ret->get_assertions() ); 1083 1083 return ret; -
src/Parser/parser.yy
r2b910f9 r27434e9 635 635 postfix_expression: 636 636 primary_expression 637 | postfix_expression '[' assignment_expression ',' comma_expression ']' 638 // { $$ = new ExpressionNode( build_binary_val( OperKinds::Index, $1, new ExpressionNode( build_binary_val( OperKinds::Index, $3, $5 ) ) ) ); } 639 { SemanticError( yylloc, "New array subscript is currently unimplemented." ); $$ = nullptr; } 637 | postfix_expression '[' assignment_expression ',' tuple_expression_list ']' 638 // Historic, transitional: Disallow commas in subscripts. 639 // Switching to this behaviour may help check if a C compatibilty case uses comma-exprs in subscripts. 640 // { SemanticError( yylloc, "New array subscript is currently unimplemented." ); $$ = nullptr; } 641 // Current: Commas in subscripts make tuples. 642 { $$ = new ExpressionNode( build_binary_val( OperKinds::Index, $1, new ExpressionNode( build_tuple( (ExpressionNode *)($3->set_last( $5 ) ) )) ) ); } 640 643 | postfix_expression '[' assignment_expression ']' 641 644 // CFA, comma_expression disallowed in this context because it results in a common user error: subscripting a -
tests/.expect/forall.txt
r2b910f9 r27434e9 1 forall.cfa:2 16:25: warning: Compiled1 forall.cfa:242:25: warning: Compiled -
tests/array-container/array-basic.cfa
r2b910f9 r27434e9 105 105 printf("result Ws [][][][] lo = %f\n", result); 106 106 107 result = total1d_low( wxyz[ [all, slice_ix, slice_ix, slice_ix]] );107 result = total1d_low( wxyz[all, slice_ix, slice_ix, slice_ix] ); 108 108 printf("result Ws [,,,] lo = %f\n", result); 109 109 … … 111 111 printf("result Ws [][][][] hi = %f\n", result); 112 112 113 result = total1d_hi( wxyz[ [all, slice_ix, slice_ix, slice_ix]] );113 result = total1d_hi( wxyz[all, slice_ix, slice_ix, slice_ix] ); 114 114 printf("result Ws [,,,] hi = %f\n", result); 115 115 … … 124 124 printf("result Xs [][][][] lo = %f\n", result); 125 125 126 result = total1d_low( wxyz[ [slice_ix, all, slice_ix, slice_ix]] );126 result = total1d_low( wxyz[slice_ix, all, slice_ix, slice_ix] ); 127 127 printf("result Xs [,,,] lo = %f\n", result); 128 128 … … 130 130 printf("result Xs [][][][] hi = %f\n", result); 131 131 132 result = total1d_hi( wxyz[ [slice_ix, all, slice_ix, slice_ix]] );132 result = total1d_hi( wxyz[slice_ix, all, slice_ix, slice_ix] ); 133 133 printf("result Xs [,,,] hi = %f\n", result); 134 134 -
tests/array-container/array-md-sbscr-cases.cfa
r2b910f9 r27434e9 53 53 // order wxyz, natural split (4-0 or 0-4, no intermediate to declare) 54 54 55 assert(( wxyz[ [iw, ix, iy, iz]] == valExpected ));55 assert(( wxyz[iw, ix, iy, iz] == valExpected )); 56 56 57 57 // order wxyz, unnatural split 1-3 (three ways declared) 58 58 59 59 typeof( wxyz[iw] ) xyz1 = wxyz[iw]; 60 assert(( xyz1[ [ix, iy, iz]] == valExpected ));60 assert(( xyz1[ix, iy, iz] == valExpected )); 61 61 62 62 typeof( wxyz[iw] ) xyz2; 63 63 &xyz2 = &wxyz[iw]; 64 assert(( xyz2[ [ix, iy, iz]] == valExpected ));65 66 assert(( wxyz[iw][ [ix, iy, iz]] == valExpected ));64 assert(( xyz2[ix, iy, iz] == valExpected )); 65 66 assert(( wxyz[iw][ix, iy, iz] == valExpected )); 67 67 68 68 // order wxyz, unnatural split 2-2 (three ways declared) 69 69 70 typeof( wxyz[ [iw, ix]] ) yz1 = wxyz[[iw,ix]];71 assert(( yz1[ [iy, iz]] == valExpected ));72 73 typeof( wxyz[ [iw, ix]] ) yz2;74 &yz2 = &wxyz[ [iw, ix]];75 assert(( yz2[ [iy, iz]] == valExpected ));76 77 assert(( wxyz[ [iw, ix]][[iy, iz]] == valExpected ));70 typeof( wxyz[iw, ix] ) yz1 = wxyz[iw,ix]; 71 assert(( yz1[iy, iz] == valExpected )); 72 73 typeof( wxyz[iw, ix] ) yz2; 74 &yz2 = &wxyz[iw, ix]; 75 assert(( yz2[iy, iz] == valExpected )); 76 77 assert(( wxyz[iw, ix][iy, iz] == valExpected )); 78 78 79 79 // order wxyz, unnatural split 3-1 (three ways declared) 80 80 81 typeof( wxyz[ [iw, ix, iy]] ) z1 = wxyz[[iw, ix, iy]];81 typeof( wxyz[iw, ix, iy] ) z1 = wxyz[iw, ix, iy]; 82 82 assert(( z1[iz] == valExpected )); 83 83 84 typeof( wxyz[ [iw, ix, iy]] ) z2;85 &z2 = &wxyz[ [iw, ix, iy]];84 typeof( wxyz[iw, ix, iy] ) z2; 85 &z2 = &wxyz[iw, ix, iy]; 86 86 assert(( z2[iz] == valExpected )); 87 87 88 assert(( wxyz[ [iw, ix, iy]][iz] == valExpected ));88 assert(( wxyz[iw, ix, iy][iz] == valExpected )); 89 89 } 90 90 … … 104 104 // order wxyz (no intermediates to declare) 105 105 106 assert(( wxyz[ [iw , ix , iy , iz ]] == valExpected ));107 assert(( wxyz[ [iw-1, ix , iy , iz ]] != valExpected ));106 assert(( wxyz[iw , ix , iy , iz ] == valExpected )); 107 assert(( wxyz[iw-1, ix , iy , iz ] != valExpected )); 108 108 109 109 // order xyzw: *xyz, w 110 110 111 assert(( wxyz[ [all , ix , iy , iz ]][iw ] == valExpected ));112 assert(( wxyz[ [all , ix-1, iy , iz ]][iw ] != valExpected ));113 assert(( wxyz[ [all , ix , iy , iz ]][iw-1] != valExpected ));111 assert(( wxyz[all , ix , iy , iz ][iw ] == valExpected )); 112 assert(( wxyz[all , ix-1, iy , iz ][iw ] != valExpected )); 113 assert(( wxyz[all , ix , iy , iz ][iw-1] != valExpected )); 114 114 115 115 // order wyzx: w*yz, x 116 116 117 assert(( wxyz[ [iw , all , iy , iz ]][ix ] == valExpected ));118 assert(( wxyz[ [iw , all , iy-1, iz ]][ix ] != valExpected ));119 assert(( wxyz[ [iw , all , iy , iz ]][ix-1] != valExpected ));117 assert(( wxyz[iw , all , iy , iz ][ix ] == valExpected )); 118 assert(( wxyz[iw , all , iy-1, iz ][ix ] != valExpected )); 119 assert(( wxyz[iw , all , iy , iz ][ix-1] != valExpected )); 120 120 121 121 // order wxzy: wx*z, y 122 122 #if 0 123 123 // not working on 32-bit 124 assert(( wxyz[ [iw , ix , all , iz ]][iy ] == valExpected ));125 assert(( wxyz[ [iw , ix , all , iz-1]][iy ] != valExpected ));126 assert(( wxyz[ [iw , ix , all , iz ]][iy-1] != valExpected ));124 assert(( wxyz[iw , ix , all , iz ][iy ] == valExpected )); 125 assert(( wxyz[iw , ix , all , iz-1][iy ] != valExpected )); 126 assert(( wxyz[iw , ix , all , iz ][iy-1] != valExpected )); 127 127 #endif 128 128 } … … 131 131 // The comments specify a covering set of orders, each in its most natural split. 132 132 // Covering means that each edge on the lattice of dimesnions-provided is used. 133 // Natural split means the arity of every -[ [-,...]] tuple equals the dimensionality of its "this" operand, then that the fewest "all" subscripts are given.133 // Natural split means the arity of every -[-,...] tuple equals the dimensionality of its "this" operand, then that the fewest "all" subscripts are given. 134 134 // The commented-out test code shows cases that don't work. We wish all the comment-coverd cases worked. 135 135 forall( [Nw], [Nx], [Ny], [Nz] ) … … 147 147 // order wxyz (no intermediates to declare) 148 148 149 assert(( wxyz[ [iw, ix, iy, iz]] == valExpected ));149 assert(( wxyz[iw, ix, iy, iz] == valExpected )); 150 150 151 151 { … … 153 153 assert( wxyz[iw][all][iy][all] [ix][iz] == valExpected ); 154 154 155 typeof( wxyz[ [iw, all, iy, all]] ) xz1 = wxyz[[iw, all, iy, all]];156 assert(( xz1[ [ix, iz]] == valExpected ));157 158 typeof( wxyz[ [iw, all, iy, all]] ) xz2;159 &xz2 = &wxyz[ [iw, all, iy, all]];160 assert(( xz2[ [ix, iz]] == valExpected ));161 162 assert(( wxyz[ [iw , all, iy , all]][[ix , iz ]] == valExpected ));163 assert(( wxyz[ [iw-1, all, iy , all]][[ix , iz ]] != valExpected ));164 assert(( wxyz[ [iw , all, iy-1, all]][[ix , iz ]] != valExpected ));165 assert(( wxyz[ [iw , all, iy , all]][[ix-1, iz ]] != valExpected ));166 assert(( wxyz[ [iw , all, iy , all]][[ix , iz-1]] != valExpected ));155 typeof( wxyz[iw, all, iy, all] ) xz1 = wxyz[iw, all, iy, all]; 156 assert(( xz1[ix, iz] == valExpected )); 157 158 typeof( wxyz[iw, all, iy, all] ) xz2; 159 &xz2 = &wxyz[iw, all, iy, all]; 160 assert(( xz2[ix, iz] == valExpected )); 161 162 assert(( wxyz[iw , all, iy , all][ix , iz ] == valExpected )); 163 assert(( wxyz[iw-1, all, iy , all][ix , iz ] != valExpected )); 164 assert(( wxyz[iw , all, iy-1, all][ix , iz ] != valExpected )); 165 assert(( wxyz[iw , all, iy , all][ix-1, iz ] != valExpected )); 166 assert(( wxyz[iw , all, iy , all][ix , iz-1] != valExpected )); 167 167 } 168 168 { … … 170 170 assert( wxyz[iw][all][all][iz] [ix][iy] == valExpected ); 171 171 172 // typeof( wxyz[ [iw, all, all, iz]] ) xy1 = wxyz[[iw, all, all, iz]];173 // assert(( xy1[ [ix, iy]] == valExpected ));174 175 // typeof( wxyz[ [iw, all, all, iz]] ) xy2;176 // &xy2 = &wxyz[ [iw, all, all, iz]];177 // assert(( xy2[ [ix, iy]] == valExpected ));178 179 // assert(( wxyz[ [iw , all, all, iz ]][[ix , iy ]] == valExpected ));180 // assert(( wxyz[ [iw-1, all, all, iz ]][[ix , iy ]] != valExpected ));181 // assert(( wxyz[ [iw , all, all, iz-1]][[ix , iy ]] != valExpected ));182 // assert(( wxyz[ [iw , all, all, iz ]][[ix-1, iy ]] != valExpected ));183 // assert(( wxyz[ [iw , all, all, iz ]][[ix , iy-1]] != valExpected ));172 // typeof( wxyz[iw, all, all, iz] ) xy1 = wxyz[iw, all, all, iz]; 173 // assert(( xy1[ix, iy] == valExpected )); 174 175 // typeof( wxyz[iw, all, all, iz] ) xy2; 176 // &xy2 = &wxyz[iw, all, all, iz]; 177 // assert(( xy2[ix, iy] == valExpected )); 178 179 // assert(( wxyz[iw , all, all, iz ][ix , iy ] == valExpected )); 180 // assert(( wxyz[iw-1, all, all, iz ][ix , iy ] != valExpected )); 181 // assert(( wxyz[iw , all, all, iz-1][ix , iy ] != valExpected )); 182 // assert(( wxyz[iw , all, all, iz ][ix-1, iy ] != valExpected )); 183 // assert(( wxyz[iw , all, all, iz ][ix , iy-1] != valExpected )); 184 184 } 185 185 { … … 187 187 assert( wxyz[all][ix][iy][all] [iw][iz] == valExpected ); 188 188 189 typeof( wxyz[ [all, ix, iy, all]] ) wz1 = wxyz[[all, ix, iy, all]];190 assert(( wz1[ [iw, iz]] == valExpected ));191 192 assert(( wxyz[ [all , ix, iy , all]][[iw , iz ]] == valExpected ));189 typeof( wxyz[all, ix, iy, all] ) wz1 = wxyz[all, ix, iy, all]; 190 assert(( wz1[iw, iz] == valExpected )); 191 192 assert(( wxyz[all , ix, iy , all][iw , iz ] == valExpected )); 193 193 } 194 194 { … … 196 196 assert( wxyz[all][ix][all][iz] [iw][iy] == valExpected ); 197 197 198 // assert(( wxyz[ [all , ix , all , iz ]][[iw , iy ]] == valExpected ));198 // assert(( wxyz[all , ix , all , iz ][iw , iy ] == valExpected )); 199 199 } 200 200 { … … 202 202 assert( wxyz[all][all][iy][iz] [iw][ix] == valExpected ); 203 203 204 // assert(( wxyz[ [all , all , iy , iz ]][[iw , ix ]] == valExpected ));204 // assert(( wxyz[all , all , iy , iz ][iw , ix ] == valExpected )); 205 205 } 206 206 { … … 208 208 assert( wxyz[all][ix][all][all] [iw][all][iz] [iy] == valExpected ); 209 209 210 typeof( wxyz[all][ix][all][all] ) wyz_workaround = wxyz[ [all , ix , all , all ]];211 typeof( wyz_workaround[iw][all][iz] ) y_workaround = wyz_workaround[ [iw , all , iz ]];210 typeof( wxyz[all][ix][all][all] ) wyz_workaround = wxyz[all , ix , all , all ]; 211 typeof( wyz_workaround[iw][all][iz] ) y_workaround = wyz_workaround[iw , all , iz ]; 212 212 assert( y_workaround[iy] == valExpected ); 213 213 214 // assert(( wxyz[ [all , ix , all , all ]][[iw , all , iz ]][iy ] == valExpected ));214 // assert(( wxyz[all , ix , all , all ][iw , all , iz ][iy ] == valExpected )); 215 215 } 216 216 { … … 239 239 valExpected = getMagicNumber(2, 3, 4, 5); 240 240 assert(( wxyz [2] [3] [4] [5] == valExpected )); 241 assert(( wxyz[ [2, 3]][4] [5] == valExpected ));242 assert(( wxyz [2][ [3, 4]][5] == valExpected ));243 assert(( wxyz [2] [3][ [4, 5]] == valExpected ));244 assert(( wxyz[ [2, 3, 4]][5] == valExpected ));245 assert(( wxyz [2][ [3, 4, 5]] == valExpected ));246 assert(( wxyz[ [2, 3, 4, 5]] == valExpected ));241 assert(( wxyz[2, 3][4] [5] == valExpected )); 242 assert(( wxyz [2][3, 4][5] == valExpected )); 243 assert(( wxyz [2] [3][4, 5] == valExpected )); 244 assert(( wxyz[2, 3, 4][5] == valExpected )); 245 assert(( wxyz [2][3, 4, 5] == valExpected )); 246 assert(( wxyz[2, 3, 4, 5] == valExpected )); 247 247 248 248 for ( i; Nw ) { 249 assert(( wxyz[ [ i, 3, 4, 5 ]] == getMagicNumber(i, 3, 4, 5) ));249 assert(( wxyz[ i, 3, 4, 5 ] == getMagicNumber(i, 3, 4, 5) )); 250 250 } 251 251 252 252 for ( i; Nx ) { 253 assert(( wxyz[ [ 2, i, 4, 5 ]] == getMagicNumber(2, i, 4, 5) ));253 assert(( wxyz[ 2, i, 4, 5 ] == getMagicNumber(2, i, 4, 5) )); 254 254 } 255 255 256 256 for ( i; Ny ) { 257 assert(( wxyz[ [ 2, 3, i, 5 ]] == getMagicNumber(2, 3, i, 5) ));257 assert(( wxyz[ 2, 3, i, 5 ] == getMagicNumber(2, 3, i, 5) )); 258 258 } 259 259 260 260 for ( i; Nz ) { 261 assert(( wxyz[ [ 2, 3, 4, i ]] == getMagicNumber(2, 3, 4, i) ));261 assert(( wxyz[ 2, 3, 4, i ] == getMagicNumber(2, 3, 4, i) )); 262 262 } 263 263 264 264 for ( i; Nw ) { 265 assert(( wxyz[ [ i, all, 4, 5 ]][3] == getMagicNumber(i, 3, 4, 5) ));265 assert(( wxyz[ i, all, 4, 5 ][3] == getMagicNumber(i, 3, 4, 5) )); 266 266 } 267 267 268 268 for ( i; Nw ) { 269 assert(( wxyz[ [ all, 3, 4, 5 ]][i] == getMagicNumber(i, 3, 4, 5) ));269 assert(( wxyz[ all, 3, 4, 5 ][i] == getMagicNumber(i, 3, 4, 5) )); 270 270 } 271 271 } -
tests/forall.cfa
r2b910f9 r27434e9 199 199 } 200 200 201 forall( T ) void check_otype() { 202 T & tr = *0p; 203 T * tp = 0p; 204 205 &tr += 1; 206 tp += 1; 207 T & tx = tp[1]; 208 209 T t; 210 T t2 = t; 211 } 212 213 forall( T * ) void check_dstype() { 214 T & tr = *0p; 215 T * tp = 0p; 216 217 &tr += 1; 218 tp += 1; 219 T & tx = tp[1]; 220 } 221 222 forall( T & ) void check_dtype() { 223 T & tr = *0p; 224 T * tp = 0p; 225 } 226 201 227 //otype T1 | { void xxx( T1 ); }; 202 228
Note: See TracChangeset
for help on using the changeset viewer.