Merge pull request #1353 from facebook/paramgrill
fixed paramgrill wrong assert() conditions
This commit is contained in:
commit
1f8a3df6d8
@ -45,7 +45,7 @@ typedef struct {
|
|||||||
size_t cSize;
|
size_t cSize;
|
||||||
unsigned long long cSpeed; /* bytes / sec */
|
unsigned long long cSpeed; /* bytes / sec */
|
||||||
unsigned long long dSpeed;
|
unsigned long long dSpeed;
|
||||||
size_t cMem; /* ? what is reported ? */
|
size_t cMem; /* memory usage during compression */
|
||||||
} BMK_benchResult_t;
|
} BMK_benchResult_t;
|
||||||
|
|
||||||
VARIANT_ERROR_RESULT(BMK_benchResult_t, BMK_benchOutcome_t);
|
VARIANT_ERROR_RESULT(BMK_benchResult_t, BMK_benchOutcome_t);
|
||||||
|
@ -1552,39 +1552,36 @@ static int allBench(BMK_benchResult_t* resultPtr,
|
|||||||
BMK_benchResult_t* winnerResult, int feas)
|
BMK_benchResult_t* winnerResult, int feas)
|
||||||
{
|
{
|
||||||
BMK_benchResult_t benchres;
|
BMK_benchResult_t benchres;
|
||||||
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 */
|
BMK_benchOutcome_t const outcome = BMK_benchMemInvertible(buf, ctx, BASE_CLEVEL, &cParams, BMK_both, 2);
|
||||||
CBENCHMARK(1, benchres, tmp, BMK_both, 2);
|
if (!BMK_isSuccessful_benchOutcome(outcome)) {
|
||||||
|
DEBUGOUTPUT("Benchmarking failed \n");
|
||||||
|
return ERROR_RESULT;
|
||||||
|
}
|
||||||
|
benchres = BMK_extract_benchResult(outcome);
|
||||||
|
|
||||||
winnerRS = resultScore(*winnerResult, buf.srcSize, target);
|
winnerRS = resultScore(*winnerResult, buf.srcSize, target);
|
||||||
DEBUGOUTPUT("WinnerScore: %f\n ", winnerRS);
|
DEBUGOUTPUT("WinnerScore: %f \n ", winnerRS);
|
||||||
|
|
||||||
*resultPtr = benchres;
|
*resultPtr = benchres;
|
||||||
|
|
||||||
/* calculate uncertainty in compression / decompression runs */
|
|
||||||
if(benchres.cSpeed) {
|
|
||||||
loopDurationC = (((U64)buf.srcSize * TIMELOOP_NANOSEC) / benchres.cSpeed);
|
|
||||||
uncertaintyConstantC = ((loopDurationC + (double)(2 * g_clockGranularity))/loopDurationC);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(benchres.dSpeed) {
|
|
||||||
loopDurationD = (((U64)buf.srcSize * TIMELOOP_NANOSEC) / benchres.dSpeed);
|
|
||||||
uncertaintyConstantD = ((loopDurationD + (double)(2 * g_clockGranularity))/loopDurationD);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* anything with worse ratio in feas is definitely worse, discard */
|
/* anything with worse ratio in feas is definitely worse, discard */
|
||||||
if(feas && benchres.cSize < winnerResult->cSize && !g_optmode) {
|
if(feas && benchres.cSize < winnerResult->cSize && !g_optmode) {
|
||||||
return WORSE_RESULT;
|
return WORSE_RESULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ensure all measurements last a minimum time, to reduce measurement errors */
|
/* calculate uncertainty in compression / decompression runs */
|
||||||
assert(loopDurationC >= TIMELOOP_NANOSEC / 10);
|
if (benchres.cSpeed) {
|
||||||
assert(loopDurationD >= TIMELOOP_NANOSEC / 10);
|
U64 const loopDurationC = (((U64)buf.srcSize * TIMELOOP_NANOSEC) / benchres.cSpeed);
|
||||||
|
uncertaintyConstantC = ((loopDurationC + (double)(2 * g_clockGranularity))/loopDurationC);
|
||||||
|
}
|
||||||
|
|
||||||
*resultPtr = benchres;
|
if (benchres.dSpeed) {
|
||||||
|
U64 const loopDurationD = (((U64)buf.srcSize * TIMELOOP_NANOSEC) / benchres.dSpeed);
|
||||||
|
uncertaintyConstantD = ((loopDurationD + (double)(2 * g_clockGranularity))/loopDurationD);
|
||||||
|
}
|
||||||
|
|
||||||
/* optimistic assumption of benchres */
|
/* optimistic assumption of benchres */
|
||||||
{ BMK_benchResult_t resultMax = benchres;
|
{ BMK_benchResult_t resultMax = benchres;
|
||||||
@ -1599,8 +1596,6 @@ static int allBench(BMK_benchResult_t* resultPtr,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*resultPtr = benchres;
|
|
||||||
|
|
||||||
/* compare by resultScore when in infeas */
|
/* compare by resultScore when in infeas */
|
||||||
/* compare by compareResultLT when in feas */
|
/* compare by compareResultLT when in feas */
|
||||||
if((!feas && (resultScore(benchres, buf.srcSize, target) > resultScore(*winnerResult, buf.srcSize, target))) ||
|
if((!feas && (resultScore(benchres, buf.srcSize, target) > resultScore(*winnerResult, buf.srcSize, target))) ||
|
||||||
@ -1623,7 +1618,10 @@ static int benchMemo(BMK_benchResult_t* resultPtr,
|
|||||||
static int bmcount = 0;
|
static int bmcount = 0;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
if(memoTableGet(memoTableArray, cParams) >= INFEASIBLE_THRESHOLD || redundantParams(cParams, target, buf.maxBlockSize)) { return WORSE_RESULT; }
|
if ( memoTableGet(memoTableArray, cParams) >= INFEASIBLE_THRESHOLD
|
||||||
|
|| redundantParams(cParams, target, buf.maxBlockSize) ) {
|
||||||
|
return WORSE_RESULT;
|
||||||
|
}
|
||||||
|
|
||||||
res = allBench(resultPtr, buf, ctx, cParams, target, winnerResult, feas);
|
res = allBench(resultPtr, buf, ctx, cParams, target, winnerResult, feas);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user