CSFLOC rewrite

Signed-off-by: gothictomato <gothictomato@pm.me>
This commit is contained in:
gothictomato
2022-09-04 10:52:28 -04:00
parent e2b633c802
commit 53a580d0ec
9 changed files with 761 additions and 228 deletions

16
psat.cl
View File

@@ -62,8 +62,6 @@ void mul(uint* c, uint len, uint* a, uint b) {
}
__kernel void vectorSAT(__global const uint* cnfhdr, __global const uint* clausedat, __global const uint* vars, __global const uchar* pars, __global uint* output, __global uint* lctrs) {
uint locid = get_local_id(0);
uint locsz = get_local_size(0);
// uint grpid = get_group_id(0);
// uint grpcn = get_num_groups(0);
uint globid = get_global_id(0);
@@ -75,10 +73,7 @@ __kernel void vectorSAT(__global const uint* cnfhdr, __global const uint* clause
uint index = 0;
uint addval = 0;
output[0] = 0;
//uint ctroff =
uint* ctr = lctrs + wcnt * 2 * globid;
uint* max = lctrs + wcnt * (2 * globid + 1);
@@ -92,7 +87,8 @@ __kernel void vectorSAT(__global const uint* cnfhdr, __global const uint* clause
} else {
mul(max, wcnt, output + 1, globid + 1);
}
// printf("%u %u\n", ctr[0], max[0]);
//printf("%u %u\n", ctr[0], max[0]);
//printf("%u %u\n", wcnt * 2 * globid, wcnt * (2 * globid + 1));
barrier(CLK_LOCAL_MEM_FENCE | CLK_GLOBAL_MEM_FENCE);
@@ -115,7 +111,7 @@ __kernel void vectorSAT(__global const uint* cnfhdr, __global const uint* clause
uchar isbchk2 = isbchk1 & islvar;
uint j = clausedat[3 * chkcls + 2];
mode -= 2 * isbchk2;
// if (isbchk2) printf("j: %u\n", j);
//if (isbchk2 && globid == 0) printf("%u j: %u\n", globid, j);
index = (j >> 5U) * isbchk2 + index * (!isbchk2);
addval = (1U << (j & 0b11111U)) * isbchk2 + addval * (!isbchk2);
addval += ((isbchk1) & (!islvar));
@@ -142,8 +138,10 @@ __kernel void vectorSAT(__global const uint* cnfhdr, __global const uint* clause
}
output[0] = 1;
}
return;
}
return;
//if (globid == 0) printf("fuck %u %u\n", ctr[0], max[0]);
break;
}
uchar cmpdone = cmpcond & (mode == 1); // if comparison completion conditions are satisfied and in CMP mode
uint addindex = (cmpaddind + 1) * !addcond + (wcnt - 1) * addcond; // if add completion is satisfied, set index to most significant word, else increment by 1