Changeset 1309 for trunk/test/benchmark/half.cpp
- Timestamp:
- Apr 29, 2012, 10:02:20 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/benchmark/half.cpp
r942 r1309 47 47 48 48 /* Copy float */ 49 timer.Get Ms();49 timer.Get(); 50 50 for (size_t i = 0; i < HALF_TABLE_SIZE; i++) 51 51 pf[i] = pf[i + 1]; 52 result[0] += timer.Get Ms();52 result[0] += timer.Get(); 53 53 54 54 /* Convert half to float (array) */ 55 timer.Get Ms();55 timer.Get(); 56 56 half::convert(pf, ph, HALF_TABLE_SIZE); 57 result[1] += timer.Get Ms();57 result[1] += timer.Get(); 58 58 59 59 /* Convert half to float (fast) */ 60 timer.Get Ms();60 timer.Get(); 61 61 for (size_t i = 0; i < HALF_TABLE_SIZE; i++) 62 62 pf[i] = (float)ph[i]; 63 result[2] += timer.Get Ms();63 result[2] += timer.Get(); 64 64 65 65 /* Add a half to every float */ 66 timer.Get Ms();66 timer.Get(); 67 67 for (size_t i = 0; i < HALF_TABLE_SIZE; i++) 68 68 pf[i] += ph[i]; 69 result[3] += timer.Get Ms();69 result[3] += timer.Get(); 70 70 71 71 /* Copy half */ 72 timer.Get Ms();72 timer.Get(); 73 73 for (size_t i = 0; i < HALF_TABLE_SIZE; i++) 74 74 ph[i] = ph[i + 1]; 75 result[4] += timer.Get Ms();75 result[4] += timer.Get(); 76 76 77 77 /* Change sign of every half */ 78 timer.Get Ms();78 timer.Get(); 79 79 for (size_t i = 0; i < HALF_TABLE_SIZE; i++) 80 80 ph[i] = -ph[i]; 81 result[5] += timer.Get Ms();81 result[5] += timer.Get(); 82 82 83 83 /* Convert float to half (array) */ 84 timer.Get Ms();84 timer.Get(); 85 85 half::convert(ph, pf, HALF_TABLE_SIZE); 86 result[6] += timer.Get Ms();86 result[6] += timer.Get(); 87 87 88 88 /* Convert float to half (fast) */ 89 timer.Get Ms();89 timer.Get(); 90 90 for (size_t i = 0; i < HALF_TABLE_SIZE; i++) 91 91 ph[i] = (half)pf[i]; 92 result[7] += timer.Get Ms();92 result[7] += timer.Get(); 93 93 94 94 /* Convert float to half (accurate) */ 95 timer.Get Ms();95 timer.Get(); 96 96 for (size_t i = 0; i < HALF_TABLE_SIZE; i++) 97 97 ph[i] = half::makeaccurate(pf[i]); 98 result[8] += timer.Get Ms();98 result[8] += timer.Get(); 99 99 100 100 /* Add a float to every half */ 101 timer.Get Ms();101 timer.Get(); 102 102 for (size_t i = 0; i < HALF_TABLE_SIZE; i++) 103 103 ph[i] += pf[i]; 104 result[9] += timer.Get Ms();104 result[9] += timer.Get(); 105 105 } 106 106 … … 109 109 110 110 for (size_t i = 0; i < sizeof(result) / sizeof(*result); i++) 111 result[i] *= 1 000000.0f / (HALF_TABLE_SIZE * HALF_RUNS);111 result[i] *= 1e9f / (HALF_TABLE_SIZE * HALF_RUNS); 112 112 113 113 Log::Info(" ns/elem\n");
Note: See TracChangeset
for help on using the changeset viewer.