Skip to content

backend: a self-test on the chosen device when the server starts - #129

Open
timoncool wants to merge 1 commit into
ServeurpersoCom:masterfrom
timoncool:device-self-test
Open

timoncool wants to merge 1 commit into
ServeurpersoCom:masterfrom
timoncool:device-self-test

Conversation

@timoncool

@timoncool timoncool commented Oct 26, 2026 •

Copy link
Copy Markdown

A device can initialise and still fail its first kernel: a CUDA driver older than the toolkit rejects the PTX ("the provided PTX was compiled with an unsupported toolchain"), or a broken Vulkan driver faults. Today the server starts, listens, and the first request fails deep in the LM or the DiT.

  • backend.h gets backend_self_test(): rows gathered from an F16 table and a matrix product, the kernels every model starts with, run on the device and are checked against their known sum (132). It logs [Load] Self-test on CUDA0: ok (137.1 ms) or [Load] FATAL: self-test on X failed (status, result, expected 132).
  • backend_check_device() runs it on the device later backend_init calls will use (the one named by --device, or the best available) and frees it again. The processor is not tested.
  • ace-server calls it once at startup, after the log capture is set up. A device that fails stops the server with exit code 1 before it listens, so a launcher can fall back to another device instead of failing the first song.
  • The models still load lazily, at the first request, as before. The CLIs are unchanged.

Checked on Windows with an RTX 4090: --device CUDA0 prints Self-test on CUDA0: ok (137.1 ms) and the server starts; --device CPU starts without the test. The same test has run in two other forks of this engine family since September.

Summary by CodeRabbit

  • Reliability
    • The app now checks the selected compute backend before starting the server.
    • Non-CPU backends must pass a small computation test. If backend initialization or validation fails, the app reports an error and stops startup.
    • The CPU backend is checked for initialization, but does not run the additional computation test.

Rows gathered from an F16 table and a matrix product run on the device and
are checked against their known sum. A device that initialises but fails
its first kernel - a CUDA driver older than the toolkit, a broken Vulkan
driver - stops ace-server at startup with the reason, instead of failing
the first request; the processor is not tested.
@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 094141e1-4513-403d-a35e-612441bde37e
Commits

Reviewing files that changed from the base of the PR and between de858d8 and b6be6a2.

Files selected for processing: 2
  • src/backend.h
  • tools/ace-server.cpp

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Walkthrough

The server now checks backend initialization before scanning models. Non-CPU backends must also pass a computation self-test. A failed check stops startup with exit status 1.

Changes: Startup Backend Validation

Layer / File(s) Summary
Backend initialization and self-test
src/backend.h
The backend check initializes the selected or best available backend. It skips the kernel self-test for CPU and checks a gather-and-matrix-product result for other backends.
Server startup gate
tools/ace-server.cpp
The server exits with status 1 if the backend check fails. Otherwise, it continues to model scanning.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Suggested reviewers: serveurpersocom

Merge Risk: Minimal · up to b6be6

No actionable startup issue is established; the change is mergeable after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: adding a backend self-test on the selected device during server startup.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant