Skip to content

Commit d11df69

Browse files
Kalrothveox
authored andcommitted
--rawintensity option, by request of Dead2.
This setting allows to set the GPU intensity value directly without any modifiers, it does not get any more raw than this! Look at the xintensity description raw for examples of regular intensity values. You can also set this value through the ncurses interface by pressing: G -> A -> select device id -> enter value. Minor xintensity code cleanup as well. Conflicts: driver-opencl.c miner.h sgminer.c
1 parent 967c757 commit d11df69

File tree

4 files changed

+106
-15
lines changed

4 files changed

+106
-15
lines changed

driver-opencl.c

+92-12
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,7 @@ char *set_intensity(char *arg)
564564
tt = &gpus[device].intensity;
565565
*tt = val;
566566
gpus[device].xintensity = 0; // Disable shader based intensity
567+
gpus[device].rawintensity = 0; // Disable raw intensity
567568
}
568569

569570
device++;
@@ -580,6 +581,7 @@ char *set_intensity(char *arg)
580581
tt = &gpus[device].intensity;
581582
*tt = val;
582583
gpus[device].xintensity = 0; // Disable shader based intensity
584+
gpus[device].rawintensity = 0; // Disable raw intensity
583585
}
584586
device++;
585587
}
@@ -588,6 +590,7 @@ char *set_intensity(char *arg)
588590
gpus[i].dynamic = gpus[0].dynamic;
589591
gpus[i].intensity = gpus[0].intensity;
590592
gpus[i].xintensity = 0; // Disable shader based intensity
593+
gpus[i].rawintensity = 0; // Disable raw intensity
591594
}
592595
}
593596

@@ -604,10 +607,11 @@ char *set_xintensity(char *arg)
604607
return "Invalid parameters for shader based intensity";
605608
val = atoi(nextptr);
606609
if (val < MIN_XINTENSITY || val > MAX_XINTENSITY)
607-
return "Invalid value passed to set shader intensity";
610+
return "Invalid value passed to set shader-based intensity";
608611

609612
gpus[device].dynamic = false; // Disable dynamic intensity
610613
gpus[device].intensity = 0; // Disable regular intensity
614+
gpus[device].rawintensity = 0; // Disable raw intensity
611615
gpus[device].xintensity = val;
612616
device++;
613617

@@ -617,13 +621,54 @@ char *set_xintensity(char *arg)
617621
return "Invalid value passed to set shader based intensity";
618622
gpus[device].dynamic = false; // Disable dynamic intensity
619623
gpus[device].intensity = 0; // Disable regular intensity
624+
gpus[device].rawintensity = 0; // Disable raw intensity
620625
gpus[device].xintensity = val;
621626
device++;
622627
}
623628
if (device == 1)
624629
for (i = device; i < MAX_GPUDEVICES; i++) {
625-
gpus[i].dynamic = gpus[0].dynamic; // Disable dynamic intensity
626-
gpus[i].intensity = gpus[0].intensity; // Disable regular intensity
630+
gpus[i].dynamic = gpus[0].dynamic;
631+
gpus[i].intensity = gpus[0].intensity;
632+
gpus[i].rawintensity = gpus[0].rawintensity;
633+
gpus[i].xintensity = gpus[0].xintensity;
634+
}
635+
636+
return NULL;
637+
}
638+
639+
char *set_rawintensity(char *arg)
640+
{
641+
int i, device = 0, val = 0;
642+
char *nextptr;
643+
644+
nextptr = strtok(arg, ",");
645+
if (nextptr == NULL)
646+
return "Invalid parameters for raw intensity";
647+
val = atoi(nextptr);
648+
if (val < MIN_RAWINTENSITY || val > MAX_RAWINTENSITY)
649+
return "Invalid value passed to set raw intensity";
650+
651+
gpus[device].dynamic = false; // Disable dynamic intensity
652+
gpus[device].intensity = 0; // Disable regular intensity
653+
gpus[device].xintensity = 0; // Disable xintensity
654+
gpus[device].rawintensity = val;
655+
device++;
656+
657+
while ((nextptr = strtok(NULL, ",")) != NULL) {
658+
val = atoi(nextptr);
659+
if (val < MIN_RAWINTENSITY || val > MAX_RAWINTENSITY)
660+
return "Invalid value passed to set raw intensity";
661+
gpus[device].dynamic = false; // Disable dynamic intensity
662+
gpus[device].intensity = 0; // Disable regular intensity
663+
gpus[device].xintensity = 0; // Disable xintensity
664+
gpus[device].rawintensity = val;
665+
device++;
666+
}
667+
if (device == 1)
668+
for (i = device; i < MAX_GPUDEVICES; i++) {
669+
gpus[i].dynamic = gpus[0].dynamic;
670+
gpus[i].intensity = gpus[0].intensity;
671+
gpus[i].rawintensity = gpus[0].rawintensity;
627672
gpus[i].xintensity = gpus[0].xintensity;
628673
}
629674

@@ -693,10 +738,10 @@ void manage_gpu(void)
693738
mhash_base = false;
694739
}
695740

696-
wlog("GPU %d: %.1f / %.1f %sh/s | A:%d R:%d HW:%d U:%.2f/m I:%d xI:%d\n",
741+
wlog("GPU %d: %.1f / %.1f %sh/s | A:%d R:%d HW:%d U:%.2f/m I:%d xI:%d rI:%d\n",
697742
gpu, displayed_rolling, displayed_total, mhash_base ? "M" : "K",
698743
cgpu->accepted, cgpu->rejected, cgpu->hw_errors,
699-
cgpu->utility, cgpu->intensity, cgpu->xintensity);
744+
cgpu->utility, cgpu->intensity, cgpu->xintensity, cgpu->rawintensity);
700745
#ifdef HAVE_ADL
701746
if (gpus[gpu].has_adl) {
702747
int engineclock = 0, memclock = 0, activity = 0, fanspeed = 0, fanpercent = 0, powertune = 0;
@@ -764,7 +809,7 @@ void manage_gpu(void)
764809
wlog("\n");
765810
}
766811

767-
wlogprint("[E]nable [D]isable [I]ntensity [x]Intensity [R]estart GPU %s\n",adl_active ? "[C]hange settings" : "");
812+
wlogprint("[E]nable [D]isable [I]ntensity [x]Intensity R[a]w Intensity [R]estart GPU %s\n",adl_active ? "[C]hange settings" : "");
768813

769814
wlogprint("Or press any other key to continue\n");
770815
logwin_update();
@@ -850,7 +895,8 @@ void manage_gpu(void)
850895
}
851896
gpus[selected].dynamic = false;
852897
gpus[selected].intensity = intensity;
853-
gpus[selected].xintensity = 0; // disable
898+
gpus[selected].xintensity = 0; // Disable xintensity when enabling intensity
899+
gpus[selected].rawintensity = 0; // Disable raw intensity when enabling intensity
854900
wlogprint("Intensity on gpu %d set to %d\n", selected, intensity);
855901
pause_dynamic_threads(selected);
856902
goto retry;
@@ -877,11 +923,41 @@ void manage_gpu(void)
877923
goto retry;
878924
}
879925
gpus[selected].dynamic = false;
880-
gpus[selected].intensity = 0; // disable
926+
gpus[selected].intensity = 0; // Disable intensity when enabling xintensity
927+
gpus[selected].rawintensity = 0; // Disable raw intensity when enabling xintensity
881928
gpus[selected].xintensity = xintensity;
882929
wlogprint("Experimental intensity on gpu %d set to %d\n", selected, xintensity);
883930
pause_dynamic_threads(selected);
884931
goto retry;
932+
} else if (!strncasecmp(&input, "a", 1)) {
933+
int rawintensity;
934+
char *intvar;
935+
936+
if (selected)
937+
selected = curses_int("Select GPU to change raw intensity on");
938+
if (selected < 0 || selected >= nDevs) {
939+
wlogprint("Invalid selection\n");
940+
goto retry;
941+
}
942+
943+
intvar = curses_input("Set raw GPU scan intensity (" MIN_RAWINTENSITY_STR " -> " MAX_RAWINTENSITY_STR ")");
944+
if (!intvar) {
945+
wlogprint("Invalid input\n");
946+
goto retry;
947+
}
948+
rawintensity = atoi(intvar);
949+
free(intvar);
950+
if (rawintensity < MIN_RAWINTENSITY || rawintensity > MAX_RAWINTENSITY) {
951+
wlogprint("Invalid selection\n");
952+
goto retry;
953+
}
954+
gpus[selected].dynamic = false;
955+
gpus[selected].intensity = 0; // Disable intensity when enabling raw intensity
956+
gpus[selected].xintensity = 0; // Disable xintensity when enabling raw intensity
957+
gpus[selected].rawintensity = rawintensity;
958+
wlogprint("Raw intensity on gpu %d set to %d\n", selected, rawintensity);
959+
pause_dynamic_threads(selected);
960+
goto retry;
885961
} else if (!strncasecmp(&input, "r", 1)) {
886962
if (selected)
887963
selected = curses_int("Select GPU to attempt to restart");
@@ -942,11 +1018,13 @@ static cl_int queue_scrypt_kernel(_clState *clState, dev_blk_ctx *blk, __maybe_u
9421018
}
9431019

9441020
static void set_threads_hashes(unsigned int vectors, unsigned int compute_shaders, int64_t *hashes, size_t *globalThreads,
945-
unsigned int minthreads, __maybe_unused int *intensity, __maybe_unused int *xintensity)
1021+
unsigned int minthreads, __maybe_unused int *intensity, __maybe_unused int *xintensity, __maybe_unused int *rawintensity)
9461022
{
9471023
unsigned int threads = 0;
9481024
while (threads < minthreads) {
949-
if (*xintensity > 0) {
1025+
if (*rawintensity > 0) {
1026+
threads = *rawintensity;
1027+
} else if (*xintensity > 0) {
9501028
threads = compute_shaders * *xintensity;
9511029
} else {
9521030
threads = 1 << *intensity;
@@ -1145,7 +1223,9 @@ static void get_opencl_statline_before(char *buf, size_t bufsiz, struct cgpu_inf
11451223

11461224
static void get_opencl_statline(char *buf, size_t bufsiz, struct cgpu_info *gpu)
11471225
{
1148-
if (gpu->xintensity > 0)
1226+
if (gpu->rawintensity > 0)
1227+
tailsprintf(buf, bufsiz, " rI:%3d", gpu->rawintensity);
1228+
else if (gpu->xintensity > 0)
11491229
tailsprintf(buf, bufsiz, " xI:%3d", gpu->xintensity);
11501230
else
11511231
tailsprintf(buf, bufsiz, " I:%2d", gpu->intensity);
@@ -1314,7 +1394,7 @@ static int64_t opencl_scanhash(struct thr_info *thr, struct work *work,
13141394
gpu->intervals = 0;
13151395
}
13161396

1317-
set_threads_hashes(clState->vwidth, clState->compute_shaders, &hashes, globalThreads, localThreads[0], &gpu->intensity, &gpu->xintensity);
1397+
set_threads_hashes(clState->vwidth, clState->compute_shaders, &hashes, globalThreads, localThreads[0], &gpu->intensity, &gpu->xintensity, &gpu->rawintensity);
13181398
if (hashes > gpu->max_hashes)
13191399
gpu->max_hashes = hashes;
13201400

driver-opencl.h

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ extern char *set_temp_overheat(char *arg);
1818
extern char *set_temp_target(char *arg);
1919
extern char *set_intensity(char *arg);
2020
extern char *set_xintensity(char *arg);
21+
extern char *set_rawintensity(char *arg);
2122
extern char *set_vector(char *arg);
2223
extern char *set_worksize(char *arg);
2324
extern char *set_shaders(char *arg);

miner.h

+7-2
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,7 @@ struct cgpu_info {
465465
int virtual_adl;
466466
int intensity;
467467
int xintensity;
468+
int rawintensity;
468469
bool dynamic;
469470

470471
cl_uint vwidth;
@@ -1052,8 +1053,12 @@ extern bool add_pool_details(struct pool *pool, bool live, char *url, char *user
10521053
#define MAX_INTENSITY_STR "31"
10531054
#define MIN_XINTENSITY 1
10541055
#define MIN_XINTENSITY_STR "1"
1055-
#define MAX_XINTENSITY 999
1056-
#define MAX_XINTENSITY_STR "999"
1056+
#define MAX_XINTENSITY 9999
1057+
#define MAX_XINTENSITY_STR "9999"
1058+
#define MIN_RAWINTENSITY 1
1059+
#define MIN_RAWINTENSITY_STR "1"
1060+
#define MAX_RAWINTENSITY 2147483647
1061+
#define MAX_RAWINTENSITY_STR "2147483647"
10571062

10581063
extern bool hotplug_mode;
10591064
extern int hotplug_time;

sgminer.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,12 @@ static struct opt_table opt_config_table[] = {
10891089
",default: d to maintain desktop interactivity)"),
10901090
OPT_WITH_ARG("--xintensity|-X",
10911091
set_xintensity, NULL, NULL,
1092-
"Shader based intensity of GPU scanning (0 to 9999), overrides --intensity|-I."),
1092+
"Shader based intensity of GPU scanning (" MIN_XINTENSITY_STR " to "
1093+
MAX_XINTENSITY_STR "), overrides --intensity|-I and -rawintensity."),
1094+
OPT_WITH_ARG("--rawintensity",
1095+
set_rawintensity, NULL, NULL,
1096+
"Raw intensity of GPU scanning (" MIN_RAWINTENSITY_STR " to "
1097+
MAX_RAWINTENSITY_STR "), overrides --intensity|-I and --xintensity|-X."),
10931098
OPT_WITH_ARG("--kernel-path|-K",
10941099
opt_set_charp, opt_show_charp, &opt_kernel_path,
10951100
"Specify a path to where kernel files are"),

0 commit comments

Comments
 (0)