Commit 4efd8bf7 by Alan Mishchenko

Debugging 64-bit bug in new semi-canonical form..

parent bf69a345
...@@ -69,6 +69,8 @@ inline int minTemp0_fast(word* pInOut, int iVar, int nWords, int* pDifStart) ...@@ -69,6 +69,8 @@ inline int minTemp0_fast(word* pInOut, int iVar, int nWords, int* pDifStart)
else else
{ {
*pDifStart = i*100; *pDifStart = i*100;
assert( shiftSize >= 0 && shiftSize <= 64 );
if ( shiftSize < 64 )
while(temp == (temp<<(shiftSize*j))>>shiftSize*j) while(temp == (temp<<(shiftSize*j))>>shiftSize*j)
j++; j++;
*pDifStart += 21 - j; *pDifStart += 21 - j;
...@@ -100,6 +102,8 @@ inline int minTemp1_fast(word* pInOut, int iVar, int nWords, int* pDifStart) ...@@ -100,6 +102,8 @@ inline int minTemp1_fast(word* pInOut, int iVar, int nWords, int* pDifStart)
else else
{ {
*pDifStart = i*100; *pDifStart = i*100;
assert( shiftSize >= 0 && shiftSize <= 64 );
if ( shiftSize < 64 )
while(temp == (temp<<(shiftSize*j))>>shiftSize*j) while(temp == (temp<<(shiftSize*j))>>shiftSize*j)
j++; j++;
*pDifStart += 21 - j; *pDifStart += 21 - j;
...@@ -122,29 +126,19 @@ inline int minTemp2_fast(word* pInOut, int iVar, int iQ, int jQ, int nWords, int ...@@ -122,29 +126,19 @@ inline int minTemp2_fast(word* pInOut, int iVar, int iQ, int jQ, int nWords, int
int shiftSize = blockSize*4; int shiftSize = blockSize*4;
word temp; word temp;
printf( "iVar = %d iQ = %d jQ = %d blockSize = %d shiftSize = %d nWords = %d\n",
iVar, iQ, jQ, blockSize, shiftSize, nWords );
for(i=nWords - 1; i>=0; i--) for(i=nWords - 1; i>=0; i--)
{ {
temp = ((pInOut[i] & SFmask[iVar][iQ])<<(iQ*blockSize)) ^ ((pInOut[i] & SFmask[iVar][jQ])<<(jQ*blockSize)); temp = ((pInOut[i] & SFmask[iVar][iQ])<<(iQ*blockSize)) ^ ((pInOut[i] & SFmask[iVar][jQ])<<(jQ*blockSize));
printf( "i = %d temp = %lxu \n", i, temp );
if( temp == 0) if( temp == 0)
continue; continue;
else else
{ {
*pDifStart = i*100; *pDifStart = i*100;
assert( shiftSize >= 0 && shiftSize <= 64 );
if ( shiftSize < 64 )
while(temp == (temp<<(shiftSize*j))>>shiftSize*j) while(temp == (temp<<(shiftSize*j))>>shiftSize*j)
{
printf( "inside shiftSize = %d j = %d temp = %lxu RHS = %lxu exp = %d\n",
shiftSize, j, temp, (temp<<(shiftSize*j))>>shiftSize*j, temp == (temp<<(shiftSize*j))>>shiftSize*j );
j++; j++;
if ( j == 100 )
exit(1);
}
*pDifStart += 21 - j; *pDifStart += 21 - j;
if( ((pInOut[i] & SFmask[iVar][iQ])<<(iQ*blockSize)) <= ((pInOut[i] & SFmask[iVar][jQ])<<(jQ*blockSize)) ) if( ((pInOut[i] & SFmask[iVar][iQ])<<(iQ*blockSize)) <= ((pInOut[i] & SFmask[iVar][jQ])<<(jQ*blockSize)) )
return 0; return 0;
...@@ -170,6 +164,8 @@ inline int minTemp3_fast(word* pInOut, int iVar, int start, int finish, int iQ, ...@@ -170,6 +164,8 @@ inline int minTemp3_fast(word* pInOut, int iVar, int start, int finish, int iQ,
else else
{ {
*pDifStart = i*100; *pDifStart = i*100;
assert( shiftSize >= 0 && shiftSize <= 64 );
if ( shiftSize < 64 )
while(temp == (temp<<(shiftSize*j))>>shiftSize*j) while(temp == (temp<<(shiftSize*j))>>shiftSize*j)
j++; j++;
*pDifStart += 21 - j; *pDifStart += 21 - j;
...@@ -190,13 +186,9 @@ inline void minimalSwapAndFlipIVar_superFast_lessThen5(word* pInOut, int iVar, i ...@@ -190,13 +186,9 @@ inline void minimalSwapAndFlipIVar_superFast_lessThen5(word* pInOut, int iVar, i
int min1, min2, DifStart0, DifStart1, DifStartMin; int min1, min2, DifStart0, DifStart1, DifStartMin;
int M[2]; int M[2];
printf("visit5\n" ), fflush(stdout);
M[0] = minTemp0_fast(pInOut, iVar, nWords, &DifStart0); // 0, 3 M[0] = minTemp0_fast(pInOut, iVar, nWords, &DifStart0); // 0, 3
printf("visit6\n" ), fflush(stdout);
M[1] = minTemp1_fast(pInOut, iVar, nWords, &DifStart1); // 1, 2 M[1] = minTemp1_fast(pInOut, iVar, nWords, &DifStart1); // 1, 2
printf("visit7\n" ), fflush(stdout);
min1 = minTemp2_fast(pInOut, iVar, M[0], M[1], nWords, &DifStartMin); min1 = minTemp2_fast(pInOut, iVar, M[0], M[1], nWords, &DifStartMin);
printf("visit8\n" ), fflush(stdout);
if(DifStart0 != DifStart1) if(DifStart0 != DifStart1)
{ {
if( DifStartMin>=DifStart1 && DifStartMin>=DifStart0 ) if( DifStartMin>=DifStart1 && DifStartMin>=DifStart0 )
...@@ -219,7 +211,6 @@ printf("visit8\n" ), fflush(stdout); ...@@ -219,7 +211,6 @@ printf("visit8\n" ), fflush(stdout);
arrangeQuoters_superFast_lessThen5(pInOut, DifStart0/100, M[min1], M[(min1+1)%2], 3 - M[(min1+1)%2], 3 - M[min1], iVar, nWords, pCanonPerm, pCanonPhase); arrangeQuoters_superFast_lessThen5(pInOut, DifStart0/100, M[min1], M[(min1+1)%2], 3 - M[(min1+1)%2], 3 - M[min1], iVar, nWords, pCanonPerm, pCanonPhase);
} }
} }
printf("visit9\n" ), fflush(stdout);
} }
////////////////////////////////////iVar = 5///////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////iVar = 5/////////////////////////////////////////////////////////////////////////////////////////////
...@@ -576,7 +567,6 @@ inline int minimalSwapAndFlipIVar_superFast_all(word* pInOut, int nVars, int nWo ...@@ -576,7 +567,6 @@ inline int minimalSwapAndFlipIVar_superFast_all(word* pInOut, int nVars, int nWo
int i; int i;
word pDuplicate[1024]; word pDuplicate[1024];
int bitInfoTemp = pStore[0]; int bitInfoTemp = pStore[0];
printf("visit1\n" ), fflush(stdout);
memcpy(pDuplicate,pInOut,nWords*sizeof(word)); memcpy(pDuplicate,pInOut,nWords*sizeof(word));
for(i=0;i<5;i++) for(i=0;i<5;i++)
{ {
...@@ -588,13 +578,11 @@ printf("visit1\n" ), fflush(stdout); ...@@ -588,13 +578,11 @@ printf("visit1\n" ), fflush(stdout);
continue; continue;
} }
} }
printf("visit2\n" ), fflush(stdout);
if(bitInfoTemp == pStore[i+1]) if(bitInfoTemp == pStore[i+1])
minimalSwapAndFlipIVar_superFast_iVar5((unsigned*) pInOut, nWords, pCanonPerm, pCanonPhase); minimalSwapAndFlipIVar_superFast_iVar5((unsigned*) pInOut, nWords, pCanonPerm, pCanonPhase);
else else
bitInfoTemp = pStore[i+1]; bitInfoTemp = pStore[i+1];
printf("visit3\n" ), fflush(stdout);
for(i=6;i<nVars-1;i++) for(i=6;i<nVars-1;i++)
{ {
if(bitInfoTemp == pStore[i+1]) if(bitInfoTemp == pStore[i+1])
...@@ -605,7 +593,6 @@ printf("visit3\n" ), fflush(stdout); ...@@ -605,7 +593,6 @@ printf("visit3\n" ), fflush(stdout);
continue; continue;
} }
} }
printf("visit4\n" ), fflush(stdout);
if(memcmp(pInOut,pDuplicate , nWords*sizeof(word)) == 0) if(memcmp(pInOut,pDuplicate , nWords*sizeof(word)) == 0)
return 0; return 0;
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment