Add some missing bits of code for Apple GPU

This commit is contained in:
David Anderson 2024-01-28 14:27:44 -08:00
parent 73fba33695
commit 1b894b53fa
4 changed files with 42 additions and 8 deletions

View File

@ -132,13 +132,6 @@ int COPROC::parse(XML_PARSER& xp) {
while (!xp.get_tag()) {
if (!xp.is_tag) continue;
if (xp.match_tag("/coproc")) {
// The client reports the type of Apple GPUs as the model
// (e.g. "Apple M1").
// Change it to just "Apple".
//
if (strstr(type, "Apple")) {
strcpy(type, "Apple");
}
if (!strlen(type)) return ERR_XML_PARSE;
clear_usage();
return 0;
@ -204,7 +197,7 @@ void COPROCS::summary_string(char* buf, int len) {
}
if (apple_gpu.count) {
snprintf(buf2, sizeof(buf2),
"[Apple|%s|%d|%dMB|%s|%d]",
"[Apple GPU|%s|%d|%dMB|%s|%d]",
apple_gpu.name, apple_gpu.count,
(int)(apple_gpu.opencl_prop.global_mem_size/MEGA),
apple_gpu.version,
@ -270,6 +263,15 @@ int COPROCS::parse(XML_PARSER& xp) {
}
continue;
}
if (xp.match_tag("coproc_apple_gpu")) {
retval = apple_gpu.parse(xp);
if (retval) {
apple_gpu.clear();
} else {
coprocs[n_rsc++] = apple_gpu;
}
continue;
}
if (xp.match_tag("coproc")) {
COPROC cp;
retval = cp.parse(xp);
@ -301,6 +303,9 @@ void COPROCS::write_xml(MIOFILE& mf, bool scheduler_rpc) {
case PROC_TYPE_INTEL_GPU:
intel_gpu.write_xml(mf, scheduler_rpc);
break;
case PROC_TYPE_APPLE_GPU:
apple_gpu.write_xml(mf, scheduler_rpc);
break;
default:
coprocs[i].write_xml(mf, scheduler_rpc);
}

View File

@ -148,6 +148,7 @@ struct PROJECT {
RSC_DESC rsc_desc_nvidia;
RSC_DESC rsc_desc_ati;
RSC_DESC rsc_desc_intel_gpu;
RSC_DESC rsc_desc_apple_gpu;
double sched_priority;

View File

@ -314,6 +314,8 @@ int PROJECT::parse(XML_PARSER& xp) {
if (xp.parse_double("ati_backoff_interval", rsc_desc_ati.backoff_interval)) continue;
if (xp.parse_double("intel_gpu_backoff_time", rsc_desc_intel_gpu.backoff_time)) continue;
if (xp.parse_double("intel_gpu_backoff_interval", rsc_desc_intel_gpu.backoff_interval)) continue;
if (xp.parse_double("apple_gpu_backoff_time", rsc_desc_apple_gpu.backoff_time)) continue;
if (xp.parse_double("apple_gpu_backoff_interval", rsc_desc_apple_gpu.backoff_interval)) continue;
if (xp.parse_double("last_rpc_time", last_rpc_time)) continue;
// deprecated elements
@ -335,6 +337,8 @@ int PROJECT::parse(XML_PARSER& xp) {
rsc_desc_ati.backoff_time = value;
} else if (!strcmp(buf, proc_type_name_xml(PROC_TYPE_INTEL_GPU))) {
rsc_desc_intel_gpu.backoff_time = value;
} else if (!strcmp(buf, proc_type_name_xml(PROC_TYPE_APPLE_GPU))) {
rsc_desc_apple_gpu.backoff_time = value;
}
break;
}
@ -355,6 +359,8 @@ int PROJECT::parse(XML_PARSER& xp) {
rsc_desc_ati.backoff_interval = value;
} else if (!strcmp(buf, proc_type_name_xml(PROC_TYPE_INTEL_GPU))) {
rsc_desc_intel_gpu.backoff_interval = value;
} else if (!strcmp(buf, proc_type_name_xml(PROC_TYPE_APPLE_GPU))) {
rsc_desc_apple_gpu.backoff_interval = value;
}
break;
}
@ -372,6 +378,8 @@ int PROJECT::parse(XML_PARSER& xp) {
rsc_desc_ati.no_rsc_ams = true;
} else if (!strcmp(buf, proc_type_name_xml(PROC_TYPE_INTEL_GPU))) {
rsc_desc_intel_gpu.no_rsc_ams = true;
} else if (!strcmp(buf, proc_type_name_xml(PROC_TYPE_APPLE_GPU))) {
rsc_desc_apple_gpu.no_rsc_ams = true;
}
continue;
}
@ -384,6 +392,8 @@ int PROJECT::parse(XML_PARSER& xp) {
rsc_desc_ati.no_rsc_apps = true;
} else if (!strcmp(buf, proc_type_name_xml(PROC_TYPE_INTEL_GPU))) {
rsc_desc_intel_gpu.no_rsc_apps = true;
} else if (!strcmp(buf, proc_type_name_xml(PROC_TYPE_APPLE_GPU))) {
rsc_desc_apple_gpu.no_rsc_apps = true;
}
continue;
}
@ -396,6 +406,8 @@ int PROJECT::parse(XML_PARSER& xp) {
rsc_desc_ati.no_rsc_pref = true;
} else if (!strcmp(buf, proc_type_name_xml(PROC_TYPE_INTEL_GPU))) {
rsc_desc_intel_gpu.no_rsc_pref = true;
} else if (!strcmp(buf, proc_type_name_xml(PROC_TYPE_APPLE_GPU))) {
rsc_desc_apple_gpu.no_rsc_pref = true;
}
continue;
}
@ -408,6 +420,8 @@ int PROJECT::parse(XML_PARSER& xp) {
rsc_desc_ati.no_rsc_config = true;
} else if (!strcmp(buf, proc_type_name_xml(PROC_TYPE_INTEL_GPU))) {
rsc_desc_intel_gpu.no_rsc_config = true;
} else if (!strcmp(buf, proc_type_name_xml(PROC_TYPE_APPLE_GPU))) {
rsc_desc_apple_gpu.no_rsc_config = true;
}
continue;
}

View File

@ -299,6 +299,20 @@ void HOST_INFO::print() {
printf(" %s\n", buf);
}
}
COPROC_APPLE &cap = coprocs.apple_gpu;
if (cap.count) {
printf(" Apple GPU\n");
if (cap.count > 1) {
printf(" Count: %d\n", cap.count);
}
if (cap.have_opencl) {
cap.opencl_prop.peak_flops = cap.peak_flops;
cap.opencl_prop.opencl_available_ram = cap.opencl_prop.global_mem_size;
cap.opencl_prop.is_used = COPROC_USED;
cap.opencl_prop.description(buf, sizeof(buf), "Intel GPU");
printf(" %s\n", buf);
}
}
}
void SIMPLE_GUI_INFO::print() {