paramgrill: removed useless tests

designed to compensate iter_mode,
but since only time_mode is available now,
all tests are guaranteed to last a minimum amount of time.
This commit is contained in:
Yann Collet 2018-08-27 19:07:17 -07:00
parent 9e26893e07
commit 0ff9b67552

View File

@ -1547,13 +1547,13 @@ static int allBench(BMK_benchResult_t* resultPtr,
const constraint_t target, const constraint_t target,
BMK_benchResult_t* winnerResult, int feas) BMK_benchResult_t* winnerResult, int feas)
{ {
BMK_benchResult_t resultMax, benchres; BMK_benchResult_t benchres;
U64 loopDurationC = 0, loopDurationD = 0; U64 loopDurationC = 0, loopDurationD = 0;
double uncertaintyConstantC = 3., uncertaintyConstantD = 3.; double uncertaintyConstantC = 3., uncertaintyConstantD = 3.;
double winnerRS; double winnerRS;
/* initial benchmarking, gives exact ratio and memory, warms up future runs */ /* initial benchmarking, gives exact ratio and memory, warms up future runs */
CBENCHMARK(1, benchres, tmp, BMK_both, 1); CBENCHMARK(1, benchres, tmp, BMK_both, 2);
winnerRS = resultScore(*winnerResult, buf.srcSize, target); winnerRS = resultScore(*winnerResult, buf.srcSize, target);
DEBUGOUTPUT("WinnerScore: %f\n ", winnerRS); DEBUGOUTPUT("WinnerScore: %f\n ", winnerRS);
@ -1562,12 +1562,12 @@ static int allBench(BMK_benchResult_t* resultPtr,
/* calculate uncertainty in compression / decompression runs */ /* calculate uncertainty in compression / decompression runs */
if(benchres.cSpeed) { if(benchres.cSpeed) {
loopDurationC = ((buf.srcSize * TIMELOOP_NANOSEC) / benchres.cSpeed); loopDurationC = (((U64)buf.srcSize * TIMELOOP_NANOSEC) / benchres.cSpeed);
uncertaintyConstantC = ((loopDurationC + (double)(2 * g_clockGranularity))/loopDurationC); uncertaintyConstantC = ((loopDurationC + (double)(2 * g_clockGranularity))/loopDurationC);
} }
if(benchres.dSpeed) { if(benchres.dSpeed) {
loopDurationD = ((buf.srcSize * TIMELOOP_NANOSEC) / benchres.dSpeed); loopDurationD = (((U64)buf.srcSize * TIMELOOP_NANOSEC) / benchres.dSpeed);
uncertaintyConstantD = ((loopDurationD + (double)(2 * g_clockGranularity))/loopDurationD); uncertaintyConstantD = ((loopDurationD + (double)(2 * g_clockGranularity))/loopDurationD);
} }
@ -1576,17 +1576,14 @@ static int allBench(BMK_benchResult_t* resultPtr,
return WORSE_RESULT; return WORSE_RESULT;
} }
/* ensure all measurements last a minimum time, to reduce measurement errors */
assert(loopDurationC >= TIMELOOP_NANOSEC / 10); assert(loopDurationC >= TIMELOOP_NANOSEC / 10);
assert(loopDurationD >= TIMELOOP_NANOSEC / 10); assert(loopDurationD >= TIMELOOP_NANOSEC / 10);
/* second run, if first run is too short, gives approximate cSpeed + dSpeed */
CBENCHMARK(loopDurationC < TIMELOOP_NANOSEC / 10, benchres, tmp, BMK_compressOnly, 1);
CBENCHMARK(loopDurationD < TIMELOOP_NANOSEC / 10, benchres, tmp, BMK_decodeOnly, 1);
*resultPtr = benchres; *resultPtr = benchres;
/* optimistic assumption of benchres */ /* optimistic assumption of benchres */
resultMax = benchres; { BMK_benchResult_t resultMax = benchres;
resultMax.cSpeed *= uncertaintyConstantC * VARIANCE; resultMax.cSpeed *= uncertaintyConstantC * VARIANCE;
resultMax.dSpeed *= uncertaintyConstantD * VARIANCE; resultMax.dSpeed *= uncertaintyConstantD * VARIANCE;
@ -1596,9 +1593,7 @@ static int allBench(BMK_benchResult_t* resultPtr,
(!feas && (winnerRS > resultScore(resultMax, buf.srcSize, target)))) { (!feas && (winnerRS > resultScore(resultMax, buf.srcSize, target)))) {
return WORSE_RESULT; return WORSE_RESULT;
} }
}
CBENCHMARK(loopDurationC < TIMELOOP_NANOSEC, benchres, tmp, BMK_compressOnly, 1);
CBENCHMARK(loopDurationD < TIMELOOP_NANOSEC, benchres, tmp, BMK_decodeOnly, 1);
*resultPtr = benchres; *resultPtr = benchres;
@ -1612,6 +1607,7 @@ static int allBench(BMK_benchResult_t* resultPtr,
} }
} }
#define INFEASIBLE_THRESHOLD 200 #define INFEASIBLE_THRESHOLD 200
/* Memoized benchmarking, won't benchmark anything which has already been benchmarked before. */ /* Memoized benchmarking, won't benchmark anything which has already been benchmarked before. */
static int benchMemo(BMK_benchResult_t* resultPtr, static int benchMemo(BMK_benchResult_t* resultPtr,
@ -1639,6 +1635,7 @@ static int benchMemo(BMK_benchResult_t* resultPtr,
return res; return res;
} }
typedef struct { typedef struct {
U64 cSpeed_min; U64 cSpeed_min;
U64 dSpeed_min; U64 dSpeed_min;