Skip to content

Commit e49f000

Browse files
committed
updating assertions
1 parent 1102389 commit e49f000

18 files changed

Lines changed: 33 additions & 50 deletions

src/gpu/assume.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ void Solver::iunassume()
249249
void Solver::idecide()
250250
{
251251
assert(inf.unassigned);
252-
assert(sp->propagated == trail.size());
252+
assert(isPropagated());
253253
assert(conflict == NOREF);
254254
assert(UNSOLVED(cnfstate));
255255
int level = DL();

src/gpu/cnf.cuh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,29 +96,29 @@ namespace ParaFROST {
9696
_data.size += SCBUCKETS(src.size());
9797

9898
}
99-
_PFROST_H_D_ void print (const uint32& off = 0, const bool& p_ref = true) {
99+
_PFROST_H_D_ void print (const uint32& off = 0, const bool& p_ref = true) const {
100100
for (uint32 i = off; i < size(); i++) {
101-
SCLAUSE& c = clause(i);
101+
const SCLAUSE& c = clause(i);
102102
if (c.size()) {
103103
if (p_ref) printf("c C(%d, r: %lld)->", i, uint64(_refs[i]));
104104
else printf("c C(%d)->", i);
105105
c.print();
106106
}
107107
}
108108
}
109-
_PFROST_H_D_ void printAdded (const uint32& off = 0, const bool& p_ref = true) {
109+
_PFROST_H_D_ void printAdded (const uint32& off = 0, const bool& p_ref = true) const {
110110
for (uint32 i = off; i < size(); i++) {
111-
SCLAUSE& c = clause(i);
111+
const SCLAUSE& c = clause(i);
112112
if (c.size() && c.added()) {
113113
if (p_ref) printf("c C(%d, r: %lld)->", i, uint64(_refs[i]));
114114
else printf("c C(%d)->", i);
115115
c.print();
116116
}
117117
}
118118
}
119-
_PFROST_H_D_ void printDeleted(const uint32& off = 0, const bool& p_ref = true) {
119+
_PFROST_H_D_ void printDeleted(const uint32& off = 0, const bool& p_ref = true) const {
120120
for (uint32 i = off; i < size(); i++) {
121-
SCLAUSE& c = clause(i);
121+
const SCLAUSE& c = clause(i);
122122
if (c.size() && c.deleted()) {
123123
if (p_ref) printf("c C(%d, r: %lld)->", i, uint64(_refs[i]));
124124
else printf("c C(%d)->", i);

src/gpu/debinary.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ void Solver::debinary() {
2424
if (!cnfstate) return;
2525
assert(!DL());
2626
assert(!wt.empty());
27-
assert(sp->propagated == trail.size());
27+
assert(isPropagated());
2828
stats.debinary.calls++;
2929
uVec1D& marked = minimized;
3030
int64 subsumed = 0, units = 0;

src/gpu/decide.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ uint32 Solver::makeAssign(const uint32& v, const bool& tphase)
6363
void Solver::decide()
6464
{
6565
assert(inf.unassigned);
66-
assert(sp->propagated == trail.size());
66+
assert(isPropagated());
6767
assert(conflict == NOREF);
6868
assert(UNSOLVED(cnfstate));
6969
uint32 cand = vsidsEnabled() ? nextVSIDS() : nextVMFQ();

src/gpu/equivalence.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ bool Solver::decompose()
4242
{
4343
if (!cnfstate) return false;
4444
assert(!DL());
45-
assert(sp->propagated == trail.size());
45+
assert(isPropagated());
4646
assert(analyzed.empty());
4747
assert(minimized.empty());
4848
stats.decompose.calls++;

src/gpu/lcve.cu

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -132,33 +132,13 @@ void Solver::varReorder()
132132
bool Solver::LCVE()
133133
{
134134
// reorder variables
135-
uint32* evars = vars->eligible;
136-
uint32* eend = evars + inf.maxVar;
137-
LOGN2(2, " Finding eligible variables for LCVE..");
138-
assert(cuhist.d_hist != NULL);
139-
// NOTE: OT creation will be synced in calcScores call
140-
if (vars->nUnits) calcScores(vars, cuhist.d_hist, ot); // update d_hist & calc scores
141-
else calcScores(vars, cuhist.d_hist);
142-
cuhist.cacheHist(inf.nDualVars, streams[2]);
143-
if (gopts.profile_gpu) cutimer->start(streams[3]);
144-
cacher.insert(cumm.scatter(), cumm.scatterCap());
145-
thrust::sort(thrust::cuda::par(tca).on(streams[3]), evars, eend, GPU_LCV_CMP(vars->scores));
146-
cacher.erase(cumm.scatterCap());
147-
LOGDONE(2, 5);
148-
vars->nUnits = 0;
149-
SYNC(streams[2]);
150-
if (gopts.profile_gpu) cutimer->stop(streams[3]), cutimer->vo += cutimer->gpuTime();
151-
if (verbose == 4) {
152-
LOG0(" Eligible variables:");
153-
for (uint32 v = 0; v < inf.maxVar; v++) {
154-
uint32 x = evars[v], p = V2L(x), n = NEG(p);
155-
LOG1(" e[%d]->(v: %d, p: %d, n: %d, s: %d)", v, x, cuhist[p], cuhist[n], vars->scores[x]);
156-
}
157-
}
135+
varReorder();
158136

159137
// extended LCVE
160138
LOGN2(2, " Electing variables (p-mu: %d, n-mu: %d)..", opts.mu_pos << multiplier, opts.mu_neg << multiplier);
161139
sp->stacktail = sp->tmpstack;
140+
uint32* evars = vars->eligible;
141+
uint32* eend = evars + inf.maxVar;
162142
uint32*& tail = sp->stacktail;
163143
LIT_ST* frozen = sp->frozen;
164144
const uint32 maxoccurs = opts.lcve_max_occurs;

src/gpu/mdm.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ void Solver::MDMInit()
130130
{
131131
if (!last.mdm.rounds) return;
132132
assert(inf.unassigned);
133-
assert(sp->propagated == trail.size());
133+
assert(isPropagated());
134134
assert(conflict == NOREF);
135135
assert(UNSOLVED(cnfstate));
136136
if (opts.mdm_walk_en) {
@@ -207,7 +207,7 @@ void Solver::MDM()
207207
return;
208208
}
209209
assert(inf.unassigned);
210-
assert(sp->propagated == trail.size());
210+
assert(isPropagated());
211211
assert(conflict == NOREF);
212212
assert(UNSOLVED(cnfstate));
213213
stats.mdm.calls++;

src/gpu/probe.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ void Solver::FLE()
111111
{
112112
if (!cnfstate) return;
113113
assert(!DL());
114-
assert(sp->propagated == trail.size());
114+
assert(isPropagated());
115115
SLEEPING(sleep.probe, opts.probe_sleep_en);
116116
SET_BOUNDS(this, probe_limit, probe, probeticks, searchticks, nlogn(maxActive()));
117117
VSTATE* states = sp->vstate;
@@ -137,7 +137,7 @@ void Solver::FLE()
137137
{
138138
assert(!DL());
139139
assert(unassigned(probe));
140-
assert(sp->propagated == trail.size());
140+
assert(isPropagated());
141141
unmarkProbe(probe);
142142
if (currfailed && vhist[probe] == currfailed)
143143
continue;
@@ -150,7 +150,7 @@ void Solver::FLE()
150150
}
151151
else {
152152
assert(DL() == 1);
153-
assert(sp->propagated == trail.size());
153+
assert(isPropagated());
154154
for (uint32 i = propagated; i < trail.size(); i++)
155155
vhist[trail[i]] = currfailed;
156156
backtrack();

src/gpu/recycle.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ void Solver::recycle(CMM& new_cm)
145145

146146
void Solver::recycle()
147147
{
148-
assert(sp->propagated == trail.size());
148+
assert(isPropagated());
149149
assert(conflict == NOREF);
150150
assert(UNSOLVED(cnfstate));
151151
shrink();

src/gpu/reduce.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ bool Solver::chronoHasRoot() {
4848

4949
void Solver::reduce()
5050
{
51-
assert(sp->propagated == trail.size());
51+
assert(isPropagated());
5252
assert(conflict == NOREF);
5353
assert(UNSOLVED(cnfstate));
5454
assert(learnts.size());

0 commit comments

Comments
 (0)