Skip to content

Conversation

@grahamking
Copy link
Contributor

@grahamking grahamking commented Jun 2, 2025

This allows building:

  • only mistral.rs engine: --no-default-features --features mistralrs
  • or only llama.cpp engine: --no-default-features --features llamacpp.

Since llama.cpp became a default we'd only tested building both at once. The docs already said we supported that but there was some combo of Rust features that didn't build. This is the fix.

Summary by CodeRabbit

  • Refactor
    • Improved the logic for selecting the default output engine, making it adapt based on enabled features rather than using a fixed choice. This change ensures more flexible and accurate default engine selection for different model formats.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 2, 2025

Walkthrough

The code refactors the logic for selecting the default output engine in the run function by introducing two new functions, gguf_default() and safetensors_default(). These functions use conditional compilation to determine the default engine based on enabled features, replacing the previous hardcoded selection logic.

Changes

File(s) Change Summary
launch/dynamo-run/src/lib.rs Replaced hardcoded default output engine selection with two new functions using feature flags.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant run()
    participant gguf_default()
    participant safetensors_default()

    User->>run(): Call run()
    alt Model is GGUF
        run()->>gguf_default(): Determine default output
        gguf_default()-->>run(): Output::LlamaCpp / Output::MistralRs / Output::EchoFull
    else Model is safetensors
        run()->>safetensors_default(): Determine default output
        safetensors_default()-->>run(): Output::MistralRs / Output::EchoFull
    end
    run()-->>User: Complete with selected output engine
Loading

Possibly related PRs

Poem

A bunny hopped through feature gates,
Deciding which engine best relates.
No more hardcoded, fixed decree—
Now features guide the output spree!
GGUF or safetensors, let flags decide,
With modular code, the engines reside.
🐇✨


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
launch/dynamo-run/src/lib.rs (1)

415-421: Appropriate default selection for safetensors files.

The safetensors_default() function correctly prioritizes MistralRs for safetensors files since this is the primary engine for that format, with EchoFull as a reasonable fallback when MistralRs is unavailable.

Consider adding documentation comments to explain the priority logic:

+/// Returns the default engine for GGUF files based on enabled features.
+/// Priority: LlamaCpp > MistralRs > EchoFull
 fn gguf_default() -> Output {
+/// Returns the default engine for safetensors files based on enabled features.
+/// Priority: MistralRs > EchoFull  
 fn safetensors_default() -> Output {
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3afbd51 and b3a006c.

📒 Files selected for processing (1)
  • launch/dynamo-run/src/lib.rs (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: Mirror Repository to GitLab
  • GitHub Check: pre-merge-rust (.)
  • GitHub Check: pre-merge-rust (lib/runtime/examples)
  • GitHub Check: pre-merge-rust (lib/bindings/python)
  • GitHub Check: Build and Test - vllm
🔇 Additional comments (2)
launch/dynamo-run/src/lib.rs (2)

119-121: LGTM! Clean integration of conditional engine selection.

The replacement of hardcoded Output::LlamaCpp and Output::MistralRs with function calls provides the flexibility needed to support building with selective features. This change maintains the existing behavior when all features are enabled while gracefully handling single-feature builds.


404-413: Well-designed priority logic for GGUF files.

The gguf_default() function implements a sensible priority hierarchy:

  1. LlamaCpp (native GGUF support) - highest priority
  2. MistralRs (fallback for GGUF) - when LlamaCpp unavailable
  3. EchoFull (universal fallback) - when no engines available

The conditional compilation correctly handles all feature flag combinations and ensures deterministic behavior.

@grahamking grahamking enabled auto-merge (squash) June 2, 2025 18:03
@grahamking grahamking merged commit 9907d10 into main Jun 2, 2025
14 of 15 checks passed
@grahamking grahamking deleted the gk-no-default-features-fix branch June 2, 2025 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants