From: John W. <joe...@us...> - 2004-10-02 08:15:10
|
Update of /cvsroot/javabdd/JavaBDD/buddy/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10960/buddy/src Modified Files: bddop.c Log Message: Turn off prefetching by default. Index: bddop.c =================================================================== RCS file: /cvsroot/javabdd/JavaBDD/buddy/src/bddop.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** bddop.c 1 Oct 2004 04:03:23 -0000 1.5 --- bddop.c 2 Oct 2004 08:13:34 -0000 1.6 *************** *** 643,648 **** --- 643,652 ---- if (andcache.table == NULL && BddCache3_init(&andcache,cachesize) < 0) return bdd_error(BDD_MEMORY); + #if defined(AND_ITR) + return and_itr(l, r); + #else return and_rec(l, r); #endif + #endif #if defined(SPECIALIZE_OR) case bddop_or: *************** *** 775,782 **** --- 779,790 ---- return l; + #if PREFETCH > 0 /* Prefetch nodes to get some concurrency between cache lookup and node table lookup. */ _mm_prefetch(&bddnodes[l], 0); + #if PREFETCH > 1 _mm_prefetch(&bddnodes[r], 0); + #endif + #endif entry = BddCache_lookup(&andcache, ANDHASH(l,r)); *************** *** 822,825 **** --- 830,836 ---- } + static int* gstack; + static int gstack_size; + static BDD and_itr(BDD l0, BDD r0) { *************** *** 827,831 **** --- 838,852 ---- int* s_top; int* s_ptr; + #if defined(USE_ALLOCA) s_top = s_ptr = alloca(bddvarnum * sizeof(int) * 9); + #else + if (gstack_size < bddvarnum) { + if (gstack != NULL) free(gstack); + if ((gstack=NEW(int,bddvarnum*9)) == NULL) + bdd_error(BDD_MEMORY); + gstack_size = bddvarnum; + } + s_top = s_ptr = gstack; + #endif *s_ptr++ = l0; *s_ptr++ = r0; *************** *** 846,853 **** --- 867,878 ---- } else { + #if PREFETCH > 0 /* Prefetch nodes to get some concurrency between cache lookup and node table lookup. */ _mm_prefetch(&bddnodes[l1], 0); + #if PREFETCH > 1 _mm_prefetch(&bddnodes[r1], 0); + #endif + #endif entry = BddCache_lookup(&andcache, ANDHASH(l1,r1)); *************** *** 941,948 **** --- 966,977 ---- return l; + #if PREFETCH > 0 /* Prefetch nodes to get some concurrency between cache lookup and node table lookup. */ _mm_prefetch(&bddnodes[l], 0); + #if PREFETCH > 1 _mm_prefetch(&bddnodes[r], 0); + #endif + #endif entry = BddCache_lookup(&orcache, ORHASH(l,r)); *************** *** 2425,2429 **** --- 2454,2462 ---- return bdd_error(BDD_MEMORY); #endif + #if defined(RELPROD_ITR) + return relprod_itr(l, r); + #else return relprod_rec(l, r); + #endif } #endif *************** *** 2556,2563 **** --- 2589,2598 ---- return quant_rec(r); + #if PREFETCH > 2 /* Prefetch LOW(l) to get some concurrency between cache lookup and node table lookup. LOW(l) is not that expensive because we need to load LEVEL(l) right after this anyway. */ _mm_prefetch(&bddnodes[LOW(l)], 0); + #endif if (LEVEL(l) > quantlast && LEVEL(r) > quantlast) *************** *** 2565,2569 **** applyop = bddop_and; #if defined(SPECIALIZE_AND) ! res = and_rec(l,r); #else res = apply_rec(l,r); --- 2600,2608 ---- applyop = bddop_and; #if defined(SPECIALIZE_AND) ! #if defined(AND_ITR) ! res = and_itr(l, r); ! #else ! res = and_rec(l, r); ! #endif #else res = apply_rec(l,r); *************** *** 2648,2660 **** } else { /* Prefetch LOW(l1) to get some concurrency between cache lookup and node table lookup. LOW(l1) is not that expensive because we need to load LEVEL(l1) right after this anyway. */ _mm_prefetch(&bddnodes[LOW(l1)], 0); if (LEVEL(l1) > quantlast && LEVEL(r1) > quantlast) { applyop = bddop_and; #if defined(SPECIALIZE_AND) ! res1 = and_rec(l1,r1); #else res1 = apply_rec(l1,r1); --- 2687,2705 ---- } else { + #if PREFETCH > 2 /* Prefetch LOW(l1) to get some concurrency between cache lookup and node table lookup. LOW(l1) is not that expensive because we need to load LEVEL(l1) right after this anyway. */ _mm_prefetch(&bddnodes[LOW(l1)], 0); + #endif if (LEVEL(l1) > quantlast && LEVEL(r1) > quantlast) { applyop = bddop_and; #if defined(SPECIALIZE_AND) ! #if defined(AND_ITR) ! res1 = and_itr(l1, r1); ! #else ! res1 = and_rec(l1, r1); ! #endif #else res1 = apply_rec(l1,r1); |