CMSIS-DSP: Biquad improvement

Improvement to formatting script.
pull/19/head
Christophe Favergeon 5 years ago
parent 212e9cb805
commit af027f97c5

@ -175,6 +175,112 @@
#if defined(ARM_MATH_MVEI) && !defined(ARM_MATH_AUTOVECTORIZE) #if defined(ARM_MATH_MVEI) && !defined(ARM_MATH_AUTOVECTORIZE)
#include "arm_helium_utils.h" #include "arm_helium_utils.h"
static void arm_biquad_cas_df1_32x64_q31_scalar(const arm_biquad_cas_df1_32x64_ins_q31 * S,
const q31_t * pSrc,
q31_t * pDst,
uint32_t blockSize)
{
const q31_t *pIn = pSrc; /* input pointer initialization */
q31_t *pOut = pDst; /* output pointer initialization */
q63_t *pState = S->pState; /* state pointer initialization */
const q31_t *pCoeffs = S->pCoeffs; /* coeff pointer initialization */
q63_t acc; /* accumulator */
q31_t Xn1, Xn2; /* Input Filter state variables */
q63_t Yn1, Yn2; /* Output Filter state variables */
q31_t b0, b1, b2, a1, a2; /* Filter coefficients */
q31_t Xn; /* temporary input */
int32_t shift = (int32_t) S->postShift + 1; /* Shift to be applied to the output */
uint32_t sample, stage = S->numStages; /* loop counters */
q31_t acc_l, acc_h; /* temporary output */
uint32_t uShift = ((uint32_t) S->postShift + 1U);
uint32_t lShift = 32U - uShift; /* Shift to be applied to the output */
do
{
/* Reading the coefficients */
b0 = *pCoeffs++;
b1 = *pCoeffs++;
b2 = *pCoeffs++;
a1 = *pCoeffs++;
a2 = *pCoeffs++;
/* Reading the state values */
Xn1 = (q31_t) (pState[0]);
Xn2 = (q31_t) (pState[1]);
Yn1 = pState[2];
Yn2 = pState[3];
/* Initialize blkCnt with number of samples */
sample = blockSize;
while (sample > 0U)
{
/* Read the input */
Xn = *pIn++;
/* acc = b0 * x[n] + b1 * x[n-1] + b2 * x[n-2] + a1 * y[n-1] + a2 * y[n-2] */
/* acc = b0 * x[n] */
acc = (q63_t) Xn * b0;
/* acc += b1 * x[n-1] */
acc += (q63_t) Xn1 * b1;
/* acc += b[2] * x[n-2] */
acc += (q63_t) Xn2 * b2;
/* acc += a1 * y[n-1] */
acc += mult32x64(Yn1, a1);
/* acc += a2 * y[n-2] */
acc += mult32x64(Yn2, a2);
/* Every time after the output is computed state should be updated. */
/* The states should be updated as: */
/* Xn2 = Xn1 */
/* Xn1 = Xn */
/* Yn2 = Yn1 */
/* Yn1 = acc */
Xn2 = Xn1;
Xn1 = Xn;
Yn2 = Yn1;
/* The result is converted to 1.63, Yn1 variable is reused */
Yn1 = acc << shift;
/* Calc lower part of acc */
acc_l = acc & 0xffffffff;
/* Calc upper part of acc */
acc_h = (acc >> 32) & 0xffffffff;
/* Apply shift for lower part of acc and upper part of acc */
acc_h = (uint32_t) acc_l >> lShift | acc_h << uShift;
/* Store the output in the destination buffer in 1.31 format. */
*pOut++ = acc_h;
/* Yn1 = acc << shift; */
/* Store the output in the destination buffer in 1.31 format. */
/* *pOut++ = (q31_t) (acc >> (32 - shift)); */
/* decrement loop counter */
sample--;
}
/* The first stage output is given as input to the second stage. */
pIn = pDst;
/* Reset to destination buffer working pointer */
pOut = pDst;
/* Store the updated state variables back into the pState array */
*pState++ = (q63_t) Xn1;
*pState++ = (q63_t) Xn2;
*pState++ = Yn1;
*pState++ = Yn2;
} while (--stage);
}
void arm_biquad_cas_df1_32x64_q31( void arm_biquad_cas_df1_32x64_q31(
const arm_biquad_cas_df1_32x64_ins_q31 * S, const arm_biquad_cas_df1_32x64_ins_q31 * S,
const q31_t * pSrc, const q31_t * pSrc,
@ -193,218 +299,225 @@ void arm_biquad_cas_df1_32x64_q31(
q31x4_t vecCoef, vecIn; q31x4_t vecCoef, vecIn;
q63_t acc; q63_t acc;
do if (blockSize <= 3)
{
arm_biquad_cas_df1_32x64_q31_scalar(S,pSrc,pDst,blockSize);
}
else
{ {
uint32_t i; do
/* {
* Reading the coefficients uint32_t i;
*/ /*
b0 = *pCoeffs++; * Reading the coefficients
b1 = *pCoeffs++; */
b2 = *pCoeffs++; b0 = *pCoeffs++;
a1 = *pCoeffs++; b1 = *pCoeffs++;
a2 = *pCoeffs++; b2 = *pCoeffs++;
a1 = *pCoeffs++;
vecCoef[0] = 0; a2 = *pCoeffs++;
vecCoef[1] = b2;
vecCoef[2] = b1; vecCoef[0] = 0;
vecCoef[3] = b0; vecCoef[1] = b2;
/* vecCoef[2] = b1;
* Reading the state values vecCoef[3] = b0;
*/ /*
Xn1 = pState[0]; * Reading the state values
Xn2 = pState[1]; */
Yn1 = pState[2]; Xn1 = pState[0];
Yn2 = pState[3]; Xn2 = pState[1];
Yn1 = pState[2];
/* Yn2 = pState[3];
* append history with initial samples
*/ /*
q31_t hist[6]; * append history with initial samples
hist[0] = 0; */
hist[1] = Xn2; q31_t hist[6];
hist[2] = Xn1; hist[0] = 0;
hist[3] = pIn[0]; hist[1] = Xn2;
hist[4] = pIn[1]; hist[2] = Xn1;
hist[5] = pIn[2]; hist[3] = pIn[0];
hist[4] = pIn[1];
const q31_t *pIn1 = hist; hist[5] = pIn[2];
q31x4_t vecIn0 = *(q31x4_t *) & pIn[0];
q31x4_t vecIn1 = *(q31x4_t *) & pIn[1]; const q31_t *pIn1 = hist;
q31x4_t vecIn2 = *(q31x4_t *) & pIn[2]; q31x4_t vecIn0 = *(q31x4_t *) & pIn[0];
q31x4_t vecIn1 = *(q31x4_t *) & pIn[1];
i = 3; q31x4_t vecIn2 = *(q31x4_t *) & pIn[2];
do
{ i = 3;
acc = mult32x64(Yn1, a1); do
acc += mult32x64(Yn2, a2); {
Yn2 = Yn1; acc = mult32x64(Yn1, a1);
Yn1 = acc; acc += mult32x64(Yn2, a2);
vecIn = vld1q(pIn1); Yn2 = Yn1;
pIn1 += 1; Yn1 = acc;
Yn1 = vmlaldavaq(Yn1, vecIn, vecCoef); vecIn = vld1q(pIn1);
Yn1 = asrl(Yn1, -shift); pIn1 += 1;
/* Yn1 = vmlaldavaq(Yn1, vecIn, vecCoef);
* Store the output in the destination buffer in 1.31 format. Yn1 = asrl(Yn1, -shift);
*/ /*
*pOut++ = (q31_t) (Yn1 >> 32); * Store the output in the destination buffer in 1.31 format.
} */
while (--i); *pOut++ = (q31_t) (Yn1 >> 32);
}
sample = blockSize - 3; while (--i);
pIn1 = pIn + 3;
sample = blockSize - 3;
i = sample / 4; pIn1 = pIn + 3;
while (i > 0U)
{ i = sample / 4;
while (i > 0U)
acc = mult32x64(Yn1, a1); {
acc += mult32x64(Yn2, a2);
Yn2 = Yn1; acc = mult32x64(Yn1, a1);
Yn1 = acc; acc += mult32x64(Yn2, a2);
Yn1 = vmlaldavaq(Yn1, vecIn0, vecCoef); Yn2 = Yn1;
vecIn = vld1q(pIn1); Yn1 = acc;
pIn1 += 1; Yn1 = vmlaldavaq(Yn1, vecIn0, vecCoef);
Yn1 = asrl(Yn1, -shift); vecIn = vld1q(pIn1);
/* pIn1 += 1;
* Store the output in the destination buffer in 1.31 format. Yn1 = asrl(Yn1, -shift);
*/ /*
*pOut++ = (q31_t) (Yn1 >> 32); * Store the output in the destination buffer in 1.31 format.
*/
acc = mult32x64(Yn1, a1); *pOut++ = (q31_t) (Yn1 >> 32);
acc += mult32x64(Yn2, a2);
Yn2 = Yn1; acc = mult32x64(Yn1, a1);
Yn1 = acc; acc += mult32x64(Yn2, a2);
Yn1 = vmlaldavaq(Yn1, vecIn1, vecCoef); Yn2 = Yn1;
vecIn0 = vld1q(pIn1); Yn1 = acc;
pIn1 += 1; Yn1 = vmlaldavaq(Yn1, vecIn1, vecCoef);
Yn1 = asrl(Yn1, -shift); vecIn0 = vld1q(pIn1);
*pOut++ = (q31_t) (Yn1 >> 32); pIn1 += 1;
Yn1 = asrl(Yn1, -shift);
acc = mult32x64(Yn1, a1); *pOut++ = (q31_t) (Yn1 >> 32);
acc += mult32x64(Yn2, a2);
Yn2 = Yn1; acc = mult32x64(Yn1, a1);
Yn1 = acc; acc += mult32x64(Yn2, a2);
Yn1 = vmlaldavaq(Yn1, vecIn2, vecCoef); Yn2 = Yn1;
vecIn1 = vld1q(pIn1); Yn1 = acc;
pIn1 += 1; Yn1 = vmlaldavaq(Yn1, vecIn2, vecCoef);
Yn1 = asrl(Yn1, -shift); vecIn1 = vld1q(pIn1);
*pOut++ = (q31_t) (Yn1 >> 32); pIn1 += 1;
Yn1 = asrl(Yn1, -shift);
acc = mult32x64(Yn1, a1); *pOut++ = (q31_t) (Yn1 >> 32);
acc += mult32x64(Yn2, a2);
Yn2 = Yn1; acc = mult32x64(Yn1, a1);
Yn1 = acc; acc += mult32x64(Yn2, a2);
Yn1 = vmlaldavaq(Yn1, vecIn, vecCoef); Yn2 = Yn1;
vecIn2 = vld1q(pIn1); Yn1 = acc;
pIn1 += 1; Yn1 = vmlaldavaq(Yn1, vecIn, vecCoef);
Yn1 = asrl(Yn1, -shift); vecIn2 = vld1q(pIn1);
*pOut++ = (q31_t) (Yn1 >> 32); pIn1 += 1;
/* Yn1 = asrl(Yn1, -shift);
* Decrement the loop counter *pOut++ = (q31_t) (Yn1 >> 32);
*/ /*
i--; * Decrement the loop counter
} */
/* i--;
* save input state }
*/ /*
Xn2 = vecIn[2]; * save input state
Xn1 = vecIn[3]; */
Xn2 = vecIn[2];
int loopRemainder = blockSize - 3 - 4 * ((blockSize - 3) / 4); Xn1 = vecIn[3];
if (loopRemainder == 1)
{ int loopRemainder = blockSize - 3 - 4 * ((blockSize - 3) / 4);
/* if (loopRemainder == 1)
* remainder {
*/ /*
acc = mult32x64(Yn1, a1); * remainder
acc += mult32x64(Yn2, a2); */
Yn2 = Yn1; acc = mult32x64(Yn1, a1);
Yn1 = acc; acc += mult32x64(Yn2, a2);
Yn1 = vmlaldavaq(Yn1, vecIn0, vecCoef); Yn2 = Yn1;
Yn1 = asrl(Yn1, -shift); Yn1 = acc;
*pOut++ = (q31_t) (Yn1 >> 32); Yn1 = vmlaldavaq(Yn1, vecIn0, vecCoef);
/* Yn1 = asrl(Yn1, -shift);
* save input state *pOut++ = (q31_t) (Yn1 >> 32);
*/ /*
Xn2 = vecIn0[2]; * save input state
Xn1 = vecIn0[3]; */
Xn2 = vecIn0[2];
} Xn1 = vecIn0[3];
else if (loopRemainder == 2)
{ }
acc = mult32x64(Yn1, a1); else if (loopRemainder == 2)
acc += mult32x64(Yn2, a2); {
Yn2 = Yn1; acc = mult32x64(Yn1, a1);
Yn1 = acc; acc += mult32x64(Yn2, a2);
Yn1 = vmlaldavaq(Yn1, vecIn0, vecCoef); Yn2 = Yn1;
Yn1 = asrl(Yn1, -shift); Yn1 = acc;
*pOut++ = (q31_t) (Yn1 >> 32); Yn1 = vmlaldavaq(Yn1, vecIn0, vecCoef);
Yn1 = asrl(Yn1, -shift);
acc = mult32x64(Yn1, a1); *pOut++ = (q31_t) (Yn1 >> 32);
acc += mult32x64(Yn2, a2);
Yn2 = Yn1; acc = mult32x64(Yn1, a1);
Yn1 = acc; acc += mult32x64(Yn2, a2);
Yn1 = vmlaldavaq(Yn1, vecIn1, vecCoef); Yn2 = Yn1;
Yn1 = asrl(Yn1, -shift); Yn1 = acc;
*pOut++ = (q31_t) (Yn1 >> 32); Yn1 = vmlaldavaq(Yn1, vecIn1, vecCoef);
/* Yn1 = asrl(Yn1, -shift);
* save input state *pOut++ = (q31_t) (Yn1 >> 32);
*/ /*
Xn2 = vecIn1[2]; * save input state
Xn1 = vecIn1[3]; */
Xn2 = vecIn1[2];
} Xn1 = vecIn1[3];
else if (loopRemainder == 3)
{ }
acc = mult32x64(Yn1, a1); else if (loopRemainder == 3)
acc += mult32x64(Yn2, a2); {
Yn2 = Yn1; acc = mult32x64(Yn1, a1);
Yn1 = acc; acc += mult32x64(Yn2, a2);
Yn1 = vmlaldavaq(Yn1, vecIn0, vecCoef); Yn2 = Yn1;
Yn1 = asrl(Yn1, -shift); Yn1 = acc;
*pOut++ = (q31_t) (Yn1 >> 32); Yn1 = vmlaldavaq(Yn1, vecIn0, vecCoef);
Yn1 = asrl(Yn1, -shift);
acc = mult32x64(Yn1, a1); *pOut++ = (q31_t) (Yn1 >> 32);
acc += mult32x64(Yn2, a2);
Yn2 = Yn1; acc = mult32x64(Yn1, a1);
Yn1 = acc; acc += mult32x64(Yn2, a2);
Yn1 = vmlaldavaq(Yn1, vecIn1, vecCoef); Yn2 = Yn1;
Yn1 = asrl(Yn1, -shift); Yn1 = acc;
*pOut++ = (q31_t) (Yn1 >> 32); Yn1 = vmlaldavaq(Yn1, vecIn1, vecCoef);
Yn1 = asrl(Yn1, -shift);
acc = mult32x64(Yn1, a1); *pOut++ = (q31_t) (Yn1 >> 32);
acc += mult32x64(Yn2, a2);
Yn2 = Yn1; acc = mult32x64(Yn1, a1);
Yn1 = acc; acc += mult32x64(Yn2, a2);
Yn1 = vmlaldavaq(Yn1, vecIn2, vecCoef); Yn2 = Yn1;
Yn1 = asrl(Yn1, -shift); Yn1 = acc;
*pOut++ = (q31_t) (Yn1 >> 32); Yn1 = vmlaldavaq(Yn1, vecIn2, vecCoef);
/* Yn1 = asrl(Yn1, -shift);
* save input state *pOut++ = (q31_t) (Yn1 >> 32);
*/ /*
Xn2 = vecIn2[2]; * save input state
Xn1 = vecIn2[3]; */
Xn2 = vecIn2[2];
} Xn1 = vecIn2[3];
/* }
* The first stage output is given as input to the second stage.
*/ /*
pIn = pDst; * The first stage output is given as input to the second stage.
/* */
* Reset to destination buffer working pointer pIn = pDst;
*/ /*
pOut = pDst; * Reset to destination buffer working pointer
/* */
* Store the updated state variables back into the pState array pOut = pDst;
*/ /*
*pState++ = (q63_t) Xn1; * Store the updated state variables back into the pState array
*pState++ = (q63_t) Xn2; */
*pState++ = Yn1; *pState++ = (q63_t) Xn1;
*pState++ = Yn2; *pState++ = (q63_t) Xn2;
*pState++ = Yn1;
*pState++ = Yn2;
}
while (--stage);
} }
while (--stage);
} }
#else #else
void arm_biquad_cas_df1_32x64_q31( void arm_biquad_cas_df1_32x64_q31(

@ -11,6 +11,13 @@
#define ABS_32x64_ERROR_Q31 ((q31_t)25) #define ABS_32x64_ERROR_Q31 ((q31_t)25)
void checkInnerTail(q31_t *b)
{
ASSERT_TRUE(b[0] == 0);
ASSERT_TRUE(b[1] == 0);
ASSERT_TRUE(b[2] == 0);
ASSERT_TRUE(b[3] == 0);
}
void BIQUADQ31::test_biquad_cascade_df1() void BIQUADQ31::test_biquad_cascade_df1()
{ {
@ -112,7 +119,7 @@
the state management of the fir is working.) the state management of the fir is working.)
*/ */
#if 0
arm_biquad_cas_df1_32x64_q31(&this->S32x64,inputp,outp,blockSize); arm_biquad_cas_df1_32x64_q31(&this->S32x64,inputp,outp,blockSize);
outp += blockSize; outp += blockSize;
@ -120,7 +127,27 @@
arm_biquad_cas_df1_32x64_q31(&this->S32x64,inputp,outp,blockSize); arm_biquad_cas_df1_32x64_q31(&this->S32x64,inputp,outp,blockSize);
outp += blockSize; outp += blockSize;
#else
int delta=1;
int k;
for(k=0;k + delta <2*blockSize ; k+=delta)
{
arm_biquad_cas_df1_32x64_q31(&this->S32x64,inputp,outp,delta);
outp += delta;
checkInnerTail(outp);
inputp += delta;
}
if (k < 2*blockSize)
{
delta = 2*blockSize - k;
arm_biquad_cas_df1_32x64_q31(&this->S32x64,inputp,outp,delta);
outp += delta;
checkInnerTail(outp);
inputp += delta;
}
#endif
ASSERT_EMPTY_TAIL(output); ASSERT_EMPTY_TAIL(output);

@ -9,7 +9,6 @@ import os.path
refCoreName="" refCoreName=""
runidCMD = "runid = ?"
# Command to get last runid # Command to get last runid
lastID="""SELECT runid FROM RUN ORDER BY runid DESC LIMIT 1 lastID="""SELECT runid FROM RUN ORDER BY runid DESC LIMIT 1
@ -62,8 +61,7 @@ parser.add_argument('-ratio', action='store_true', help="Compute ratios for regr
parser.add_argument('-ref', nargs='?',type = str, default="M55", help="Reference COREDEF for ratio in db") parser.add_argument('-ref', nargs='?',type = str, default="M55", help="Reference COREDEF for ratio in db")
parser.add_argument('-clampval', nargs='?',type = float, default=8.0, help="Clamp for ratio") parser.add_argument('-clampval', nargs='?',type = float, default=8.0, help="Clamp for ratio")
parser.add_argument('-clamp', action='store_true', help="Clamp enabled for ratio") parser.add_argument('-clamp', action='store_true', help="Clamp enabled for ratio")
parser.add_argument('-keep', nargs='?',type = str, help="Core to keep for ratio") parser.add_argument('-cores', nargs='?',type = str, help="Cores to keep")
parser.add_argument('-disprunid', action='store_true', help="Include runid in html")
# For runid or runid range # For runid or runid range
parser.add_argument('others', nargs=argparse.REMAINDER,help="Run ID") parser.add_argument('others', nargs=argparse.REMAINDER,help="Run ID")
@ -72,36 +70,66 @@ args = parser.parse_args()
c = sqlite3.connect(args.b) c = sqlite3.connect(args.b)
if args.others: coreidSQL="select distinct coreid from CORE where coredef==?"
vals=[]
runidCMD=[] def getCoreID(corename):
runidHeader=[] r=c.execute(coreidSQL,(corename,))
runidVIEWcmd=[] t=r.fetchone()
for t in args.others: if t is None:
print("Unrecognized reference core \"%s\"" % corename)
quit()
return(t[0])
def parseSelector(o,field="runid"):
vals=[]
runidCMD=[]
# parameters are not allowed in VIEWs
runidVIEWcmd=[]
for t in o:
if re.search(r'-',t): if re.search(r'-',t):
bounds=[int(x) for x in t.split("-")] bounds=[int(x) for x in t.split("-")]
vals += bounds vals += bounds
runidHeader += ["%d <= runid <= %d" % tuple(bounds)] runidCMD += ["(%s >= ? AND %s <= ?)" % (field,field)]
runidCMD += ["(runid >= ? AND runid <= ?)"] x=(field,bounds[0],field,bounds[1])
runidVIEWcmd += ["(runid >= %d AND runid <= %d) " % tuple(bounds)] runidVIEWcmd += ["(%s >= %d AND %s <= %d)" % x]
else: else:
theid=int(t) theid=int(t)
runidHeader += ["runid == %d" % theid] runidCMD += ["%s == ?" % field]
runidCMD += ["runid == ?"] runidVIEWcmd += ["%s == %d" % (field,theid)]
runidVIEWcmd += ["runid == %d" % theid]
vals.append(theid) vals.append(theid)
runidval = tuple(vals) runidval = tuple(vals)
runidHeader = "(" + "".join(joinit(runidHeader," OR ")) + ")" runidCMD = "(" + "".join(joinit(runidCMD," OR ")) + ")"
runidCMD = "(" + "".join(joinit(runidCMD," OR ")) + ")" runidVIEWcmd = "(" + "".join(joinit(runidVIEWcmd," OR ")) + ")"
runidVIEWcmd = "(" + "".join(joinit(runidVIEWcmd," OR ")) + ")" return(runidval,runidCMD,runidVIEWcmd)
if args.others:
runidval,runidCMD,runidVIEWcmd = parseSelector(args.others)
else: else:
theid=getLastRunID() theid=getLastRunID()
print("Last run ID = %d\n" % theid) print("Last run ID = %d\n" % theid)
runidval=(theid,) runidval=(theid,)
runidHeader="%d" % theid runidCMD = "runid = ?"
runidVIEWcmd="(runid = %d)" % theid runidVIEWcmd="(runid = %d)" % theid
# None means all
coreidval = []
coreidCMD = []
keepCoreIds=None
if args.cores:
cores=args.cores.split(",")
coreids = [str(getCoreID(x.strip())) for x in cores]
keepCoreIds = coreids.copy()
if args.ref:
coreids.append(str(getCoreID(args.ref.strip())))
#print(coreids)
coreidval,coreidCMD, coreidVIEWcmd = parseSelector(coreids,field="coreid")
runidval += coreidval
runidCMD += " AND %s" % coreidCMD
runidVIEWcmd += " AND %s" % coreidVIEWcmd
# We extract data only from data tables # We extract data only from data tables
# Those tables below are used for descriptions # Those tables below are used for descriptions
@ -703,28 +731,16 @@ referenceCoreID = None
coreidSQL="select distinct coreid from CORE where coredef==?"
def getCoreID(corename):
r=c.execute(coreidSQL,(corename,))
t=r.fetchone()
if t is None:
print("Unrecognized reference core")
quit()
return(t[0])
refCore="""CREATE TEMP VIEW if not exists refCore AS refCore="""CREATE TEMP VIEW if not exists refCore AS
select * from %s where (coreid = %s) and (typeid = %s) select * from %s where (coreid = %s) and (typeid = %s)
and %s and %s
and compilerid = %s""" and compilerid = %s"""
allOtherCores="""CREATE TEMP VIEW if not exists otherCore AS
select * from %s where (coreid != %s) and (typeid = %s)
and %s
and compilerid = %s"""
otherCore="""CREATE TEMP VIEW if not exists otherCore AS otherCore="""CREATE TEMP VIEW if not exists otherCore AS
select * from %s where (coreid = %s) and (typeid = %s) select * from %s where (typeid = %s)
and %s and %s
and compilerid = %s""" and compilerid = %s"""
@ -734,7 +750,7 @@ select * from %s where (coreid = %s)
and compilerid = %s""" and compilerid = %s"""
otherCoreAllTypes="""CREATE TEMP VIEW if not exists otherCore AS otherCoreAllTypes="""CREATE TEMP VIEW if not exists otherCore AS
select * from %s where (coreid = %s) select * from %s where (coreid = %s)
and %s and %s
and compilerid = %s""" and compilerid = %s"""
@ -838,11 +854,10 @@ def computeRatio(benchName,viewParams,refMkViewCmd,otherMkViewCmd,byd):
def computeRatioTable(benchName,referenceCore,typeID,compiler): def computeRatioTable(benchName,referenceCore,typeID,compiler):
viewParams = (benchName,referenceCore,typeID,runidVIEWcmd,compiler) viewParams = (benchName,referenceCore,typeID,runidVIEWcmd,compiler)
refMkViewCmd = refCore % viewParams refMkViewCmd = refCore % viewParams
otherMkViewCmd = allOtherCores % viewParams otherParams = (benchName,typeID,runidVIEWcmd,compiler)
if args.keep: otherMkViewCmd = otherCore % otherParams
keepCoreID = getCoreID(args.keep) #print(refMkViewCmd)
otherParams = (benchName,keepCoreID,typeID,runidVIEWcmd,compiler) #print(otherMkViewCmd)
otherMkViewCmd = otherCore % otherParams
return(computeRatio(benchName,viewParams,refMkViewCmd,otherMkViewCmd,False)) return(computeRatio(benchName,viewParams,refMkViewCmd,otherMkViewCmd,False))
@ -851,6 +866,8 @@ def computeRatioTableForCore(benchName,referenceCore,otherCoreID,compiler):
refMkViewCmd = refCoreAllTypes % viewParams refMkViewCmd = refCoreAllTypes % viewParams
otherParams = (benchName,otherCoreID,runidVIEWcmd,compiler) otherParams = (benchName,otherCoreID,runidVIEWcmd,compiler)
otherMkViewCmd = otherCoreAllTypes % otherParams otherMkViewCmd = otherCoreAllTypes % otherParams
#print(refMkViewCmd)
#print(otherMkViewCmd)
return(computeRatio(benchName,viewParams,refMkViewCmd,otherMkViewCmd,True)) return(computeRatio(benchName,viewParams,refMkViewCmd,otherMkViewCmd,True))
def formatPerfRatio(s): def formatPerfRatio(s):
@ -945,9 +962,10 @@ def addReportFor(document,benchName):
if args.byd: if args.byd:
allCores=getAllExistingCores(benchName) allCores=getAllExistingCores(benchName)
if args.ratio: if args.ratio:
allCores.remove(referenceCoreID) if keepCoreIds:
if args.keep: allCores=keepCoreIds
allCores=[getCoreID(args.keep)] if ("%d" % referenceCoreID) in allCores:
allCores.remove("%d" % referenceCoreID)
for aCoreID in allCores: for aCoreID in allCores:
nbElems = getNbElemsInBenchAndCoreCmd(benchName,aCoreID) nbElems = getNbElemsInBenchAndCoreCmd(benchName,aCoreID)
if nbElems > 0: if nbElems > 0:
@ -1106,10 +1124,7 @@ def createDoc(document,sections,benchtables):
try: try:
benchtables=getBenchTables() benchtables=getBenchTables()
if args.disprunid: document = Document(None)
document = Document(runidHeader)
else:
document = Document(None)
if args.ratio: if args.ratio:
referenceCoreID= getCoreID(args.ref) referenceCoreID= getCoreID(args.ref)

Loading…
Cancel
Save