Add basic build ability with diakgcn and put all kernel names in configure.ac to avoid changing them in mutliple places.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
diff --git a/Makefile.am b/Makefile.am
index 9c8c294..347b4af 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -17,7 +17,7 @@ INCLUDES = $(PTHREAD_FLAGS) -fno-strict-aliasing $(JANSSON_INCLUDES)
bin_PROGRAMS = cgminer
-bin_SCRIPTS = phatk120203.cl poclbm120203.cl
+bin_SCRIPTS = *.cl
cgminer_LDFLAGS = $(PTHREAD_FLAGS)
cgminer_LDADD = $(DLOPEN_FLAGS) @LIBCURL_LIBS@ @JANSSON_LIBS@ @PTHREAD_LIBS@ \
@@ -44,7 +44,7 @@ cgminer_SOURCES += device-gpu.h device-gpu.c
# the original GPU related sources, unchanged
cgminer_SOURCES += ocl.c ocl.h findnonce.c findnonce.h
cgminer_SOURCES += adl.c adl.h adl_functions.h
-cgminer_SOURCES += phatk120203.cl poclbm120203.cl
+cgminer_SOURCES += *.cl
if HAS_CPUMINE
# original CPU related sources, unchanged
diff --git a/configure.ac b/configure.ac
index 9dcd9b7..b8a26b3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -293,6 +293,11 @@ fi
AC_DEFINE_UNQUOTED([CGMINER_PREFIX], ["$prefix/bin"], [Path to cgminer install])
+AC_DEFINE_UNQUOTED([PHATK_KERNNAME], ["phatk120203"], [Filename for phatk kernel])
+AC_DEFINE_UNQUOTED([POCLBM_KERNNAME], ["poclbm120203"], [Filename for poclbm kernel])
+AC_DEFINE_UNQUOTED([DIAKGCN_KERNNAME], ["diakgcn120208"], [Filename for diakgcn kernel])
+
+
AC_SUBST(OPENCL_LIBS)
AC_SUBST(OPENCL_FLAGS)
AC_SUBST(JANSSON_LIBS)
diff --git a/device-gpu.c b/device-gpu.c
index e05f554..d40db48 100644
--- a/device-gpu.c
+++ b/device-gpu.c
@@ -754,6 +754,43 @@ static cl_int queue_phatk_kernel(_clState *clState, dev_blk_ctx *blk)
return status;
}
+static cl_int queue_diakgcn_kernel(_clState *clState, dev_blk_ctx *blk)
+{
+ cl_kernel *kernel = &clState->kernel;
+ cl_int status = 0;
+ int num = 0;
+
+ status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->ctx_a);
+ status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->ctx_b);
+ status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->ctx_c);
+ status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->ctx_d);
+ status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->ctx_e);
+ status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->ctx_f);
+ status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->ctx_g);
+ status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->ctx_h);
+ status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->cty_b);
+ status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->cty_c);
+ status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->cty_d);
+ status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->cty_f);
+ status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->cty_g);
+ status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->cty_h);
+ status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->nonce);
+
+ status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->fW0);
+ status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->fW1);
+ status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->fW2);
+ status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->fW3);
+ status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->fW15);
+ status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->fW01r);
+ status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->fcty_e);
+ status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->fcty_e2);
+
+ status |= clSetKernelArg(*kernel, num++, sizeof(clState->outputBuffer),
+ (void *)&clState->outputBuffer);
+
+ return status;
+}
+
static void set_threads_hashes(unsigned int vectors, unsigned int *threads,
unsigned int *hashes, size_t *globalThreads,
unsigned int minthreads, int intensity)
@@ -905,9 +942,11 @@ static void opencl_detect()
return;
if (opt_kernel) {
- if (strcmp(opt_kernel, "poclbm") && strcmp(opt_kernel, "phatk"))
- quit(1, "Invalid kernel name specified - must be poclbm or phatk");
- if (!strcmp(opt_kernel, "poclbm"))
+ if (strcmp(opt_kernel, "poclbm") && strcmp(opt_kernel, "phatk") && strcmp(opt_kernel, "diakgcn"))
+ quit(1, "Invalid kernel name specified - must be poclbm, phatk or diakgcn");
+ if (!strcmp(opt_kernel, "diakgcn"))
+ chosen_kernel = KL_DIAKGCN;
+ else if (!strcmp(opt_kernel, "poclbm"))
chosen_kernel = KL_POCLBM;
else
chosen_kernel = KL_PHATK;
@@ -1042,6 +1081,9 @@ static bool opencl_thread_init(struct thr_info *thr)
default:
thrdata->queue_kernel_parameters = &queue_phatk_kernel;
break;
+ case KL_DIAKGCN:
+ thrdata->queue_kernel_parameters = &queue_diakgcn_kernel;
+ break;
}
thrdata->res = calloc(BUFFERSIZE, 1);
diff --git a/miner.h b/miner.h
index 44e6a53..adedaaa 100644
--- a/miner.h
+++ b/miner.h
@@ -675,6 +675,7 @@ enum cl_kernel {
KL_NONE,
KL_POCLBM,
KL_PHATK,
+ KL_DIAKGCN,
};
extern void get_datestamp(char *, struct timeval *);
diff --git a/ocl.c b/ocl.c
index 76ceb60..5311557 100644
--- a/ocl.c
+++ b/ocl.c
@@ -348,21 +348,27 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
char filename[16];
if (chosen_kernel == KL_NONE) {
- if (!clState->hasBitAlign || strstr(name, "Tahiti"))
+ if (strstr(name, "Tahiti"))
+ chosen_kernel = KL_DIAKGCN;
+ else if (!clState->hasBitAlign)
chosen_kernel = KL_POCLBM;
else
chosen_kernel = KL_PHATK;
}
switch (chosen_kernel) {
+ case KL_DIAKGCN:
+ strcpy(filename, DIAKGCN_KERNNAME".cl");
+ strcpy(binaryfilename, DIAKGCN_KERNNAME);
+ break;
case KL_POCLBM:
- strcpy(filename, "poclbm120203.cl");
- strcpy(binaryfilename, "poclbm120203");
+ strcpy(filename, POCLBM_KERNNAME".cl");
+ strcpy(binaryfilename, POCLBM_KERNNAME);
break;
case KL_NONE: /* Shouldn't happen */
case KL_PHATK:
- strcpy(filename, "phatk120203.cl");
- strcpy(binaryfilename, "phatk120203");
+ strcpy(filename, PHATK_KERNNAME".cl");
+ strcpy(binaryfilename, PHATK_KERNNAME);
break;
}