mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-10 14:58:01 +00:00
Conflicting entries of cl_kernel may have been causing problems, and automatically chosen kernel type was not being passed on. Rename the enum to cl_kernels and store the chosen kernel in each clState.
This commit is contained in:
parent
604b2f7645
commit
95a989da4d
@ -205,7 +205,7 @@ static bool config_loaded = false;
|
||||
static char *opt_stderr_cmd = NULL;
|
||||
#endif // defined(unix)
|
||||
|
||||
enum cl_kernel chosen_kernel;
|
||||
enum cl_kernels chosen_kernel;
|
||||
|
||||
bool ping = true;
|
||||
|
||||
|
@ -1078,8 +1078,9 @@ static bool opencl_thread_init(struct thr_info *thr)
|
||||
{
|
||||
const int thr_id = thr->id;
|
||||
struct cgpu_info *gpu = thr->cgpu;
|
||||
|
||||
struct opencl_thread_data *thrdata;
|
||||
_clState *clState = clStates[thr_id];
|
||||
cl_int status;
|
||||
thrdata = calloc(1, sizeof(*thrdata));
|
||||
thr->cgpu_data = thrdata;
|
||||
|
||||
@ -1088,7 +1089,7 @@ static bool opencl_thread_init(struct thr_info *thr)
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (chosen_kernel) {
|
||||
switch (clState->chosen_kernel) {
|
||||
case KL_POCLBM:
|
||||
thrdata->queue_kernel_parameters = &queue_poclbm_kernel;
|
||||
break;
|
||||
@ -1109,9 +1110,6 @@ static bool opencl_thread_init(struct thr_info *thr)
|
||||
return false;
|
||||
}
|
||||
|
||||
_clState *clState = clStates[thr_id];
|
||||
cl_int status;
|
||||
|
||||
status = clEnqueueWriteBuffer(clState->commandQueue, clState->outputBuffer, CL_TRUE, 0,
|
||||
BUFFERSIZE, blank_res, 0, NULL, NULL);
|
||||
if (unlikely(status != CL_SUCCESS)) {
|
||||
|
4
miner.h
4
miner.h
@ -675,7 +675,7 @@ struct work {
|
||||
UT_hash_handle hh;
|
||||
};
|
||||
|
||||
enum cl_kernel {
|
||||
enum cl_kernels {
|
||||
KL_NONE,
|
||||
KL_POCLBM,
|
||||
KL_PHATK,
|
||||
@ -701,7 +701,7 @@ extern void *tq_pop(struct thread_q *tq, const struct timespec *abstime);
|
||||
extern void tq_freeze(struct thread_q *tq);
|
||||
extern void tq_thaw(struct thread_q *tq);
|
||||
extern bool successful_connect;
|
||||
extern enum cl_kernel chosen_kernel;
|
||||
extern enum cl_kernels chosen_kernel;
|
||||
extern void adl(void);
|
||||
|
||||
#endif /* __MINER_H__ */
|
||||
|
11
ocl.c
11
ocl.c
@ -356,22 +356,21 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
|
||||
* have otherwise created. The filename is:
|
||||
* name + kernelname +/i bitalign + v + vectors + w + work_size + sizeof(long) + .bin
|
||||
*/
|
||||
enum cl_kernel this_kernel;
|
||||
char binaryfilename[255];
|
||||
char filename[255];
|
||||
char numbuf[10];
|
||||
|
||||
if (chosen_kernel == KL_NONE) {
|
||||
if (strstr(name, "Tahiti"))
|
||||
this_kernel = KL_DIAKGCN;
|
||||
clState->chosen_kernel = KL_DIAKGCN;
|
||||
else if (!clState->hasBitAlign)
|
||||
this_kernel = KL_POCLBM;
|
||||
clState->chosen_kernel = KL_POCLBM;
|
||||
else
|
||||
this_kernel = KL_PHATK;
|
||||
clState->chosen_kernel = KL_PHATK;
|
||||
} else
|
||||
this_kernel = chosen_kernel;
|
||||
clState->chosen_kernel = chosen_kernel;
|
||||
|
||||
switch (this_kernel) {
|
||||
switch (clState->chosen_kernel) {
|
||||
case KL_DIAKGCN:
|
||||
strcpy(filename, DIAKGCN_KERNNAME".cl");
|
||||
strcpy(binaryfilename, DIAKGCN_KERNNAME);
|
||||
|
3
ocl.h
3
ocl.h
@ -11,6 +11,8 @@
|
||||
#include <CL/cl.h>
|
||||
#endif
|
||||
|
||||
#include "miner.h"
|
||||
|
||||
typedef struct {
|
||||
cl_context context;
|
||||
cl_kernel kernel;
|
||||
@ -22,6 +24,7 @@ typedef struct {
|
||||
cl_uint preferred_vwidth;
|
||||
size_t max_work_size;
|
||||
size_t work_size;
|
||||
enum cl_kernels chosen_kernel;
|
||||
} _clState;
|
||||
|
||||
extern char *file_contents(const char *filename, int *length);
|
||||
|
Loading…
Reference in New Issue
Block a user