Working to make OpenCL recognize the limitations of the device its on, as well as reusing the OpenCL kernel/context for multiple runs.

Signed-off-by: gothictomato <gothictomato@pm.me>
This commit is contained in:
gothictomato
2022-08-27 09:11:29 -04:00
parent 84374e23fd
commit e2b633c802
5 changed files with 424 additions and 16 deletions

12
psat.cl
View File

@@ -61,7 +61,7 @@ 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, __local uint* lctrs) {
__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);
@@ -76,21 +76,23 @@ __kernel void vectorSAT(__global const uint* cnfhdr, __global const uint* clause
uint addval = 0;
if (globid == 0) output[0] = 0;
uint* ctr = lctrs + wcnt * 2 * locid;
uint* max = lctrs + wcnt * (2 * locid + 1);
output[0] = 0;
uint* ctr = lctrs + wcnt * 2 * globid;
uint* max = lctrs + wcnt * (2 * globid + 1);
for (uint i = 0; i < wcnt; ++i) {
ctr[i] = max[i] = 0;
}
mul(ctr, wcnt, output + 1, globid);
if (globid == globsz) {
if (globid == globsz - 1) {
stateaddpow(wcnt, max, cnfhdr[0]);
} else {
mul(max, wcnt, output + 1, globid + 1);
}
// printf("%u %u\n", ctr[0], max[0]);
barrier(CLK_LOCAL_MEM_FENCE | CLK_GLOBAL_MEM_FENCE);