Skip to content

apr-cli: gate realizar/CUDA imports behind feature flags for aarch64 builds #480

@noahgift

Description

@noahgift

Problem

cargo build -p apr-cli --no-default-features --features training fails with 40 errors because apr-cli code imports realizar types without #[cfg(feature = "inference")] guards.

This blocks aarch64 builds on NVIDIA GB10 (gx10) where we want CPU/GPU training via entrenar without the full inference stack.

Root Cause

apr-cli's Cargo.toml already has realizar as optional (inference feature), but ~25 source files import realizar::* unconditionally. The TODO at line 86 acknowledges this:

# Note: cuda/gpu features hardcoded here because apr-cli code has ungated CUDA imports.
# TODO: Gate all CUDA code in apr-cli with #[cfg(feature = "cuda")] then remove from here.

Affected Files (25)

bench, cbtop, chat, chat_generate_session, compare_hf, comparison, data, diff_benchmark_report, distill, finetune, forward_error, golden_output, import, output_verification, profile_pct_change_classify, ptx_explain, publish, pull_remove_resolve_model, qa, run, safetensors, showcase/demo, showcase/pipeline, speedup, validate

Error Categories

Error Count Fix
realizar not found 5 #[cfg(feature = "inference")]
results_a/b not found 11 Gate comparison code behind inference
ChatSession field errors 6 Gate chat code behind inference
ureq method errors 2 Gate HF hub code behind hf-hub
Type annotation cascades 8 Resolved by above fixes
hf_hub import 1 #[cfg(feature = "hf-hub")]
safetensors functions 5 Gate behind safetensors-compare

Expected Outcome

cargo build -p apr-cli --no-default-features --features training compiles on aarch64 and x86_64, producing an apr binary with apr train apply support.

Verification

# On gx10 (aarch64):
cargo build --release -p apr-cli --no-default-features --features training
./target/release/apr train apply --task pretrain --config configs/train/pretrain-350m-cuda-test.yaml

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions