Generate a protobuf-free AcceleratorPolicy header

Author: sanchitmonga22Created Sep 11, 2026Updated Sep 19, 2026
LabelsP3tech-debt

Follow-up from #755 by @ayaangazali — thanks again for that PR!

What

Three files hand-copy pieces of the AcceleratorPolicy enum from idl/model_types.proto instead of using a generated constant: core/src/core/model_lifecycle.cpp:163-164 (UNSPECIFIED=0, NPU=4), engines/llamacpp/rac_backend_llamacpp_register.cpp:59-60 (CPU=2, GPU=3, pre-existing), and now engines/llamacpp/rac_llamacpp_vlm_ops.cpp:123-124 (CPU=2, GPU=3, added in #755). The root AGENTS.md says proto types are canonical and enum values should never be hand-written.

Why it matters

Three independent copies of slices of the same enum, across two components, can silently drift if AcceleratorPolicy in idl/model_types.proto ever changes — nothing today would catch it.

Suggested approach

Have the idl codegen emit a small protobuf-free C header of the AcceleratorPolicy integer values (the llamacpp engine deliberately doesn't link protobuf, so this can't be the generated protobuf enum itself), and switch all three call sites to include it instead of hand-writing constants.

Done when

  • A generated, protobuf-free AcceleratorPolicy header exists.
  • model_lifecycle.cpp, rac_backend_llamacpp_register.cpp, and rac_llamacpp_vlm_ops.cpp all use it instead of hand-written constants.

Not blocking #755. @ayaangazali, you know this code well now — you're welcome to take this one if you're interested.

Opened with help from Claude Code and Codex.

Reviewed with help from Claude Code and Codex.

Source: RunanywhereAI/runanywhere-sdks