Skip to content

platforms: NPU graph cache compiles a new graph for every prefill length above the largest bucket #171

Closed

Description

@gspark-etri

Problem

_bucket returns n itself when T exceeds the largest bucket (256 RNGD, 64 ATOM). Prefill rows reach run() unchunked, so every new prompt length compiles a graph (one per expert in baked mode) and _graphs grows without bound.

Evidence and reproduction

opt_prime/opt_prime/accel/platforms/npu_graph.py:77-80,241-269. Ran with a stub backend: lengths 300-303 gave 4 compiles in inputs mode and 32 in baked mode.

Environment

optimus-rm @253be20; Python 3.10, torch 2.10.0+cu128, transformers 5.1.0; RNGD+A100 host (CPU / one A100 for the checks).

Scope

npu_graph.py.

Done when

run() chunks rows to the largest bucket; a test feeds T above it and sees no new compiles.

Owner

@gspark-etri

Activity

  1. gspark-etri commented on Oct 23, 2026

    @gspark-etri
    CollaboratorAuthor

    Fixed by #180, squash-merged into optimus-rm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions