scheduler: add <gpu_type_regex> plan class option.#7047
Conversation
There was a problem hiding this comment.
Pull request overview
Adds support for selecting “other” (non-NVIDIA/AMD/Intel/Apple) OpenCL GPU types in scheduler plan classes using a <gpu_type_regex> match against the coprocessor-reported type/model, enabling projects to target emerging GPU vendors/models without client/server code changes.
Changes:
- Extend
PLAN_CLASS_SPECto store and parse a compiled<gpu_type_regex>for GPU type matching. - Update plan class selection logic to pick an OpenCL coprocessor by regex when applicable.
- Adjust OpenCL GPU JSON summarization to report vendor + model (instead of a generic
"opencl"type).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| sched/plan_class_spec.h | Adds have_gpu_type_regex and compiled regex_t storage in plan class spec. |
| sched/plan_class_spec.cpp | Parses <gpu_type_regex> and uses it during plan class compatibility checks. |
| lib/opencl_boinc.h | Clarifies that OPENCL_DEVICE_PROP::name represents the device model. |
| lib/coproc.cpp | Changes JSON summary for non-core OpenCL devices to emit vendor as type and device name as model. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| bool have_gpu_type_regex; | ||
| regex_t gpu_type_regex; |
| } else if (have_gpu_type_regex) { | ||
| for (int i=1; i<sreq.coprocs.n_rsc; i++) { | ||
| if (!regexec(&(gpu_type_regex), sreq.coprocs.coprocs[i].type, 0, NULL, 0)) { | ||
| cpp = &sreq.coprocs.coprocs[i]; | ||
| break; | ||
| } | ||
| } | ||
| if (!cpp) { | ||
| if (config.debug_version_select) { | ||
| log_messages.printf(MSG_NORMAL, | ||
| "[version] plan_class_spec: No gpu_type match found\n" | ||
| ); | ||
| } | ||
| return false; | ||
| } |
| if (cpp) { | ||
| if (config.debug_version_select) { | ||
| log_messages.printf(MSG_NORMAL, | ||
| "[version] plan_class_spec: Custom coproc %s found\n", gpu_type | ||
| "[version] plan_class_spec: OpenCL coproc %s found\n", gpu_type | ||
| ); | ||
| } | ||
| if (cpp->bad_gpu_peak_flops("Custom GPU", msg)) { | ||
| if (cpp->bad_gpu_peak_flops("OpenCL coproc", msg)) { | ||
| log_messages.printf(MSG_NORMAL, "%s\n", msg.c_str()); | ||
| } |
There was a problem hiding this comment.
2 issues found across 4 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="sched/plan_class_spec.cpp">
<violation number="1" location="sched/plan_class_spec.cpp:875">
P1: Regex-matched GPUs bypass the general GPU validation block because that block is still gated by `strlen(gpu_type)`. Plan classes using only `gpu_type_regex` may skip RAM/driver-related constraints.</violation>
<violation number="2" location="sched/plan_class_spec.cpp:904">
P2: When the `have_gpu_type_regex` branch (or NVIDIA/AMD/Intel/Apple branches) sets `cpp`, `gpu_type` is empty, so this log message will print "OpenCL coproc found" with a blank name. Use `cpp->type` or `cpp->opencl_prop.name` instead to produce a meaningful diagnostic.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
If the client detects (via OpenCL) a GPU that's not one of the original 4 (NVIDIA, AMD, Intel, Apple) it reports it to the scheduler with its model name as its 'type'. A GPU plan class can now specify its GPU type with a regular expression that's matched against this. This allows BOINC to use new GPU types - such as integrated GPUs on ARM chips - with no changes to client or server software. All that's needed is for projects to develop applications, and to create plan classes with appropriate <gpu_type_regex>
6a2c1bb to
41785ec
Compare
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds support for matching “other” OpenCL GPU devices via a new <gpu_type_regex> plan-class option, and adjusts OpenCL device reporting to expose vendor/name information for better scheduling on new GPU families.
Changes:
- Introduce
gpu_type_regexto plan class parsing and selection logic for OpenCL GPUs. - Apply the same GPU RAM/FLOPS checks to regex-matched devices as for typed devices.
- Modify OpenCL summary JSON emission to output vendor/name rather than the previous generic type.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| sched/plan_class_spec.h | Adds stored state for compiled GPU type regex. |
| sched/plan_class_spec.cpp | Parses/compiles <gpu_type_regex> and uses it during GPU selection and validation. |
| lib/coproc.cpp | Changes the OpenCL JSON summary fields to report vendor and model name. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (xp.parse_str("gpu_type_regex", buf, sizeof(buf))) { | ||
| if (regcomp(&(gpu_type_regex), buf, REG_EXTENDED|REG_NOSUB) ) { | ||
| log_messages.printf(MSG_CRITICAL, | ||
| "BAD GPU TYPE REGEXP: %s\n", buf | ||
| ); | ||
| return ERR_XML_PARSE; | ||
| } | ||
| have_gpu_type_regex = true; | ||
| continue; | ||
| } |
| for (int i=1; i<sreq.coprocs.n_rsc; i++) { | ||
| if (!regexec(&(gpu_type_regex), sreq.coprocs.coprocs[i].type, 0, NULL, 0)) { | ||
| cpp = &sreq.coprocs.coprocs[i]; | ||
| break; | ||
| } | ||
| } |
| if (!cpp) { | ||
| if (config.debug_version_select) { | ||
| log_messages.printf(MSG_NORMAL, | ||
| "[version] plan_class_spec: No gpu_type match found\n" |
| if (cpp) { | ||
| if (config.debug_version_select) { | ||
| log_messages.printf(MSG_NORMAL, | ||
| "[version] plan_class_spec: Custom coproc %s found\n", gpu_type | ||
| "[version] plan_class_spec: OpenCL coproc %s found\n", cpp->type | ||
| ); | ||
| } | ||
| if (cpp->bad_gpu_peak_flops("Custom GPU", msg)) { | ||
| if (cpp->bad_gpu_peak_flops("OpenCL coproc", msg)) { | ||
| log_messages.printf(MSG_NORMAL, "%s\n", msg.c_str()); | ||
| } | ||
| } |
| if (!strlen(cp.opencl_prop.name)) continue; | ||
| if (!out.empty()) out += ",\n"; | ||
| summary_json(buf2, | ||
| "opencl", | ||
| cp.type, | ||
| cp.opencl_prop.vendor, | ||
| cp.opencl_prop.name, | ||
| cp.count, | ||
| (int)((double)cp.opencl_prop.global_mem_size/MEGA), | ||
| cp.opencl_prop.opencl_device_version, |
If the client detects (via OpenCL) a GPU that's not one of the original 4 (NVIDIA, AMD, Intel, Apple)
it reports it to the scheduler with its model name as its 'type'.
A GPU plan class can now specify its GPU type with a regular expression that's matched against this.
This allows BOINC to use new GPU types -
such as integrated GPUs on ARM chips -
with no changes to client or server software.
All that's needed is for projects to develop applications, and to create plan classes with appropriate <gpu_type_regex>
Summary by cubic
Add
gpu_type_regexto GPU plan classes so the scheduler can match OpenCL device model names and schedule apps on new GPU types (e.g., ARM iGPUs) without client updates. Also update the OpenCL summary JSON to reportvendorandname(model).New Features
gpu_type_regex; version selection tries it first, thengpu_type, with clearer debug logs.vendorandnameinstead of a generic type.Migration
gpu_type_regex(e.g.,Mali|Adreno) to plan classes to enable new GPU families.Written for commit 41785ec. Summary will update on new commits. Review in cubic