- File:
-
- 1 edited
-
tests/array-container/array-md-sbscr-cases.cfa (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tests/array-container/array-md-sbscr-cases.cfa
rb9dae14c r938885d3 27 27 } 28 28 29 // Work around a compiler optimization that can lead to false failures. 30 // Think of `valExpected` as a constant local to each test function. 31 // When implemented that way, an optimization, run on some hardware, makes 32 // its value be off-by-a-little, compared with the values that have been 33 // stored-loaded (in the array under test). This effect has been observed 34 // on x86-32 with -O3. Declaring it as below forces the expected value 35 // to be stored-loaded too, which keeps the (admittedly lazily done) 36 // `assert(f1 == f2)` checks passing, when the intended <w,x,y,z> location 37 // is recovered, which is the point of all these tests. 38 volatile float valExpected = 0.0; 39 29 40 // Tests all the ways to split dimensions into CFA-supported chunks, by the only order that C supports: coarsest to finest stride. 30 41 forall( [Nw], [Nx], [Ny], [Nz] ) … … 36 47 ptrdiff_t iw = 2, ix = 3, iy=4, iz=5; 37 48 38 const float valExpected = getMagicNumber(iw, ix, iy, iz); 39 assert( wxyz[iw][ix][iy][iz] == valExpected ); 49 valExpected = getMagicNumber(iw, ix, iy, iz); 50 float valGot = wxyz[iw][ix][iy][iz]; 51 assert( valGot == valExpected ); 40 52 41 53 // order wxyz, natural split (4-0 or 0-4, no intermediate to declare) … … 86 98 ptrdiff_t iw = 2, ix = 3, iy=4, iz=5; 87 99 88 const floatvalExpected = getMagicNumber(iw, ix, iy, iz);100 valExpected = getMagicNumber(iw, ix, iy, iz); 89 101 assert( wxyz[iw][ix][iy][iz] == valExpected ); 90 102 … … 108 120 109 121 // order wxzy: wx*z, y 110 122 #if 0 123 // not working on 32-bit 111 124 assert(( wxyz[[iw , ix , all , iz ]][iy ] == valExpected )); 112 125 assert(( wxyz[[iw , ix , all , iz-1]][iy ] != valExpected )); 113 126 assert(( wxyz[[iw , ix , all , iz ]][iy-1] != valExpected )); 127 #endif 114 128 } 115 129 … … 127 141 ptrdiff_t iw = 2, ix = 3, iy=4, iz=5; 128 142 129 const floatvalExpected = getMagicNumber(iw, ix, iy, iz);143 valExpected = getMagicNumber(iw, ix, iy, iz); 130 144 assert( wxyz[iw][ix][iy][iz] == valExpected ); 131 145 … … 223 237 fillHelloData(wxyz); 224 238 225 const floatvalExpected = getMagicNumber(2, 3, 4, 5);239 valExpected = getMagicNumber(2, 3, 4, 5); 226 240 assert(( wxyz [2] [3] [4] [5] == valExpected )); 227 241 assert(( wxyz[[2, 3]][4] [5] == valExpected ));
Note:
See TracChangeset
for help on using the changeset viewer.