Repository navigation
feat(validator): configurable inference-perf router mode - #1745
Conversation
📝 WalkthroughWalkthroughThe inference performance validator adds Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@validators/performance/inference_perf_constraint.go`:
- Around line 715-718: The inference performance validation currently rejects
invalid router settings even for gateway-EPP workloads. Update the call site
around resolveRouterMode at
validators/performance/inference_perf_constraint.go:715-718 to invoke it only
when routingMode is inferenceRoutingModeDynamoRouter, and make the preflight
validation at validators/performance/inference_perf_constraint.go:2834-2836
routing-mode-aware or defer it to the mode-gated configuration path; gateway-EPP
must bypass router-mode validation.
In `@validators/performance/inference_perf_test.go`:
- Around line 1207-1224: Refactor the router-mode cases in
validatePerfTuningEnvs tests into one table-driven subtest containing each mode
and expected outcome. Iterate over the cases, apply clearTuningEnvs and
envRouterMode per case, then assert ErrCodeInvalidRequest for invalid modes and
no error for valid modes while preserving the existing test names or descriptive
case labels.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Enterprise
Run ID: 2dc46476-4236-478a-a38d-929fd61d77ff
📒 Files selected for processing (4)
docs/contributor/validator.mdvalidators/performance/inference_perf_constraint.govalidators/performance/inference_perf_test.govalidators/performance/testdata/inference/dynamo-deployment.yaml
7b94c84 to
29e94da
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@validators/performance/inference_perf_constraint.go`:
- Around line 2661-2680: Update the comment above resolveRouterMode to remove
the claim that it is consulted only on the dynamo-router path. Clarify that the
resolved value is consumed only by Dynamo routing, while explicitly set invalid
values are still validated when processing gateway-epp configuration through
buildInferenceConfig and validatePerfTuningEnvs.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Enterprise
Run ID: d78a81b3-7851-419a-aa84-63ccc53b1c7b
📒 Files selected for processing (4)
docs/contributor/validator.mdvalidators/performance/inference_perf_constraint.govalidators/performance/inference_perf_test.govalidators/performance/testdata/inference/dynamo-deployment.yaml
29e94da to
d620b01
Compare
…#1374) Add AICR_INFERENCE_PERF_ROUTER_MODE to select the Dynamo frontend routing strategy (DYN_ROUTER_MODE) for the benchmark workload, following the existing AICR_INFERENCE_PERF_* methodology-knob pattern. Default stays least-loaded (the shipped default since NVIDIA#1399); the value is validated against the Dynamo frontend enum (kv, round-robin, random, least-loaded, device-aware-weighted) and fails closed with ErrCodeInvalidRequest on a typo, up front in validatePerfTuningEnvs. The knob only affects the dynamo-router routing path; the gateway-epp template carries no placeholder. Signed-off-by: Yuan Chen <[email protected]>
d620b01 to
a32df1f
Compare
Recipe evidence checkNo leaf overlays affected by this PR. This gate is warning-only and never blocks merge. |
mchmarny
left a comment
There was a problem hiding this comment.
Clean knob addition following the established AICR_INFERENCE_PERF_* pattern. Enum validation fails closed with ErrCodeInvalidRequest up front in validatePerfTuningEnvs (and deliberately not mode-gated — the rationale in the envRouterMode comment is sound), the gateway-epp template correctly keeps direct hardcoded since EPP owns endpoint selection there, and TestParseDynamoTemplate_RouterModeSubstituted guards against the placeholder being hardcoded again. Docs and catalog comments updated. CI is green.
One non-blocking note: the PR body still says "WIP: full make qualify and the coverage-gate comparison against main have not run yet" — CI Test/Lint/E2E are all green, so consider dropping that line before merge.
njhensley
left a comment
There was a problem hiding this comment.
Multi-persona review + adversarial verification — Approve ✅
Reviewed by an independent 3-lens panel (correctness · Dynamo/inference domain · test-coverage), then every safety claim was re-derived from the code by an adversarial meta-reviewer. Fail-closed enum validation, dual-path validation, and the direct-exclusion all hold — and are corroborated by the gateway-epp template itself (--router-mode direct only on internal worker sidecars). Template substitution is injection-safe because the value is enum-constrained to 6 YAML-safe tokens; the resolveRouterMode call on both validatePerfTuningEnvs and buildInferenceConfig is the same belt-and-suspenders pattern the other knobs use (not redundant). Strong table-driven coverage.
Non-blocking follow-ups (tiered 🟡 Minor / 🔵 Nitpick):
- 🟡 No test guards the gateway-epp mode-isolation invariant. The "validated in both modes, consumed only in dynamo-router" design is only half-tested — nothing asserts
dynamo-deployment-gateway-epp.yamlhas no${ROUTER_MODE}/DYN_ROUTER_MODE. A future accidental placeholder there would silently break isolation with no failing test. Consider a test rendering the gateway-epp template and asserting the env is absent. - 🟡 Override is env-only — sibling knobs (
model,concurrency-per-gpu) also support a per-accelerator recipe constraint that outranks the env var. If env-only is intentional for A/B characterization (#1374), a one-line "env-only by design" note would settle it. - 🔵
${ROUTER_MODE}is interpolated unquoted while sibling${MODEL}is deliberately quoted — safe today (all enum tokens are YAML-safe), but quoting would be consistent/defense-in-depth (testdata/inference/dynamo-deployment.yaml). - 🔵
routerModeis logged even under gateway-epp where it's unused (paired withroutingMode, so still disambiguable).
No blockers or majors.
…ge gate Makefile excluded /validators from 'go list ./...' in make test, so regression suites added in NVIDIA#1745/NVIDIA#1748 (and the older nvidia-smi, inference-perf, nccl, conformance tests) never ran in CI. - Drop -e /validators from the make test package filter. - Exclude validators/ from the test-coverage threshold calc (its package coverage is 41-92%, pulling aggregate from 80.0% to 75.7% and breaking the 80% gate) while still running its tests. Fixes NVIDIA#1752 Signed-off-by: Mohit Yadav <[email protected]>
Summary
Adds
AICR_INFERENCE_PERF_ROUTER_MODEso the inference-perf validator's Dynamo frontend routing strategy (DYN_ROUTER_MODE) can be selected per run — replacing the hardcoded value in the deployment template — following the existingAICR_INFERENCE_PERF_*methodology-knob pattern.Motivation / Context
Dynamo v1.2 ships several frontend routing strategies (
kv,round-robin,random,power-of-two,least-loaded,device-aware-weighted; upstream'sdirectis deliberately excluded — it needs per-request worker IDs the benchmark never sends), but the benchmark workload's strategy was compiled into the validator image, so characterizing an alternative required an image rebuild. The default remainsleast-loaded(the shipped default since #1399 / #1197); this knob only changes how a characterization run can deviate from it.Fixes: #1374
Related: #1399, #1197
Type of Change
Component(s) Affected
pkg/validator)docs/,examples/)cmd/aicr,pkg/cli)cmd/aicrd,pkg/server)pkg/recipe)pkg/bundler,pkg/component/*)pkg/collector,pkg/snapshotter)pkg/errors,pkg/k8s)validators/performanceImplementation Notes
resolveRouterMode()resolves env > compiled default (least-loaded) and validates against the Dynamo frontend enum; an unknown value fails closed withErrCodeInvalidRequestinvalidatePerfTuningEnvs, before the multi-minute workload deploys — consistent with the other perf knobs.DYN_ROUTER_MODEvalue became a${ROUTER_MODE}placeholder, substituted per run. The gateway-epp template intentionally carries no placeholder: in that mode EPP performs endpoint selection and worker frontend sidecars run in direct mode, so the knob has no effect there.${MODEL}).docs/contributor/validator.mdenv-knob table.Testing
New coverage: table-driven
TestResolveRouterMode(defaults, all six supported modes, trimming, unknown/direct/case-sensitivity fail-closed),TestValidatePerfTuningEnvsrouter-mode subtests, andTestParseDynamoTemplate_RouterModeSubstitutedguarding the template placeholder.WIP: full
make qualifyand the coverage-gate comparison against main have not run yet — will complete before marking ready for review.Risk Assessment
Rollout notes: No behavior change when the env var is unset (default identical to current hardcoded value). Catalog/env-only knob; no recipe or API surface change.
Checklist
make testwith-race)make lint)git commit -S) — GPG signing info