Skip to content

Refuse to start with more GPUs than MAX_GPU_COUNT - #16

Merged
ricky-chaoju merged 1 commit into
infinirc:mainfrom
Liquescent-Development:fix/reject-unsupported-gpu-count
Sep 2, 2026
Merged

Refuse to start with more GPUs than MAX_GPU_COUNT#16
ricky-chaoju merged 1 commit into
infinirc:mainfrom
Liquescent-Development:fix/reject-unsupported-gpu-count

Conversation

@richardkiene

Copy link
Copy Markdown
Contributor

Small one. daemon_loop keeps prev_managed[MAX_GPU_COUNT] and the dashboard keeps gpus[MAX_GPU_COUNT], init_mode[MAX_GPU_COUNT][16] and init_speed[MAX_GPU_COUNT], but they're all indexed by device_count (or st->gpu_count, which is set from it). MAX_GPU_COUNT is 8, so on a host with nine or more GPUs those arrays get written past the end.

I don't have such a box, so this just makes gpu_init fail with a message naming the count, the limit and the constant to raise, rather than silently clamping — clamping would leave the extra GPUs under driver control while the daemon and dashboard report success, which seems worse than a clear refusal. The error path calls nvmlShutdown() before returning, same as the existing nvmlDeviceGetCount failure path just above it.

daemon_loop (src/main.c prev_managed[MAX_GPU_COUNT]) and the dashboard
(src/dashboard.c gpus[MAX_GPU_COUNT], init_mode[MAX_GPU_COUNT][16],
init_speed[MAX_GPU_COUNT]) keep per-GPU state in arrays sized by
MAX_GPU_COUNT (8) but indexed by device_count, so a host with nine or
more GPUs overran them. Fail at gpu_init with a message naming the limit
and the constant to raise instead.

@ricky-chaoju ricky-chaoju left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ricky-chaoju
ricky-chaoju merged commit 4fb664a into infinirc:main Sep 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants