Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
22f608e
feat(profiler): move experimental Spica into Dynamo
tedzhouhk Jul 20, 2026
976c9d9
fix(profiler): address Spica migration CI
tedzhouhk Jul 20, 2026
c6cdfdb
fix(profiler): make Spica container tests writable
tedzhouhk Jul 20, 2026
d5b299a
fix(profiler): harden experimental Spica integration
tedzhouhk Jul 21, 2026
bb0f21f
fix(profiler): address Spica CI and review feedback
tedzhouhk Jul 21, 2026
d1d8ebc
fix(docs): use MDX-safe admonition separator
tedzhouhk Jul 21, 2026
d84cc66
Merge remote-tracking branch 'origin/main' into hzhou-codex/move-spic…
tedzhouhk Jul 21, 2026
f261132
fix(profiler): validate Spica planner config after main update
tedzhouhk Jul 21, 2026
7c2e859
Merge branch 'main' into hzhou-codex/move-spica-to-dynamo
tedzhouhk Jul 22, 2026
51b73f4
Merge remote-tracking branch 'origin/main' into hzhou-codex/move-spic…
tedzhouhk Jul 23, 2026
4871677
refactor(aisimulate): isolate experimental Spica distribution
tedzhouhk Jul 23, 2026
8489ca8
fix(aisimulate): gate tests on standalone package
tedzhouhk Jul 23, 2026
95587b1
refactor(aisimulate): adopt package namespace
tedzhouhk Jul 24, 2026
cd016ec
Merge remote-tracking branch 'origin/main' into hzhou-codex/move-spic…
tedzhouhk Jul 27, 2026
d08260a
test(replay): set direct synthetic replay concurrency
tedzhouhk Jul 27, 2026
faadc17
docs(operator): fix Planner configuration link
tedzhouhk Jul 27, 2026
f45ebd5
Update examples/aisimulate/spica/configs/smart_sweep.yaml
tedzhouhk Jul 27, 2026
43133e0
Update examples/aisimulate/spica/configs/glm5-disagg-pareto-frontier.…
tedzhouhk Jul 27, 2026
d8152ee
Update examples/aisimulate/spica/tools/gen_sine_trace.py
tedzhouhk Jul 27, 2026
b214585
Update examples/aisimulate/spica/tools/run_load_predictor_sweep.py
tedzhouhk Jul 27, 2026
dfc582a
Update docs/fern/components/aisimulate/spica/examples/glm5-disagg-par…
tedzhouhk Jul 27, 2026
f70e425
Merge remote-tracking branch 'origin/main' into hzhou-codex/move-spic…
tedzhouhk Jul 27, 2026
e696c56
Merge branch 'main' into hzhou-codex/move-spica-to-dynamo
tedzhouhk Jul 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/codeowners/areas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ areas:
- components/src/dynamo/profiler/tests/
- components/src/dynamo/profiler/utils/
- examples/global_planner/
- examples/profiler/
- label: runtime
github_team: '@ai-dynamo/dynamo-runtime-codeowners'
path_globs:
Expand Down
1 change: 1 addition & 0 deletions .github/filters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ planner:
- 'components/src/dynamo/global_planner/**'
- 'components/src/dynamo/profiler/**'
- 'components/src/dynamo/global_router/**'
- 'scripts/check_spica_packaging.py'
# Power-aware planner (PR #9369): per-node power agent component
- 'deploy/power-agent/**'
- 'deploy/helm/charts/power-agent/**'
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/docs-link-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ jobs:
--host-concurrency 10
--host-request-interval 1s
--host-stats
${{ github.event_name == 'pull_request' && '--exclude https://github.com/ai-dynamo/dynamo/tree/main/examples/profiler/spica' || '' }}
${{ github.event_name == 'pull_request' && '--exclude https://github.com/ai-dynamo/dynamo/tree/main/docs/components/profiler/spica' || '' }}
${{ github.event_name == 'pull_request' && '--exclude https://github.com/ai-dynamo/dynamo/blob/main/examples/profiler/spica/configs/glm5-disagg-pareto-frontier.yaml' || '' }}
.
fail: true
env:
Expand Down
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ repos:
pass_filenames: false
additional_dependencies:
- pyyaml
- id: check-spica-packaging
name: Validate experimental Spica packaging contracts
entry: python3 scripts/check_spica_packaging.py
language: python
files: ^(pyproject\.toml|container/deps/requirements\.planner\.txt|container/templates/wheel_builder\.Dockerfile|components/src/dynamo/profiler/__init__\.py|scripts/check_spica_packaging\.py)$
pass_filenames: false
additional_dependencies:
- tomli>=2.0.1; python_version < '3.11'
- id: DCO check
name: Checks the commit message for a developer certificate of origin signature
entry: python3 scripts/dco_check.py
Expand Down
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
/examples/diffusers/ @ai-dynamo/dynamo-diffusion-codeowners

# === planner (@ai-dynamo/dynamo-planner-codeowners) ===
/examples/profiler/ @ai-dynamo/dynamo-planner-codeowners
/examples/global_planner/ @ai-dynamo/dynamo-planner-codeowners
/components/src/dynamo/planner/ @ai-dynamo/dynamo-planner-codeowners
/components/src/dynamo/profiler/ @ai-dynamo/dynamo-planner-codeowners
Expand Down
114 changes: 114 additions & 0 deletions components/src/dynamo/profiler/spica/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

"""Experimental replay-backed smart sweeper for Dynamo deployments.

Spica is an experimental feature. Its Python API, configuration schema, output
format, and optimization behavior may change without the compatibility guarantees
provided for stable Dynamo APIs.
"""

from __future__ import annotations

from .config import (
Candidate,
OptimizationGoal,
OptimizationTarget,
SearchSpace,
SLATarget,
SmartSearchConfig,
SweepConfig,
Workload,
)
from .deploy import DeploymentPlan, build_deployment
from .evaluator import ReplayEvaluator
from .kv_estimate import NoPerfDatabase, estimate_kv_tokens, feasible_shape_tokens
from .load_predictor_sweep import (
LoadPredictorResult,
predictor_fields,
sweep_load_predictor,
window_loss,
)
from .model_hw import (
ModelHardware,
NoViableParallelConfig,
parallel_configs_for,
resolve_model_hardware,
)
from .parallel_enum import (
DisaggParallelConfig,
ParallelShape,
ReplicaParallelConfig,
enumerate_disagg_configs,
enumerate_parallel_configs,
enumerate_worker_shapes,
)
from .planner import (
FPM_SAMPLING,
LOAD_SENSITIVITY,
SCALING_POLICIES,
ScalingPolicy,
throughput_intervals,
)
from .sample import unroll_sample
from .sampler import BranchSampler, Suggestion, make_branch_sampler
from .score import is_feasible, make_candidate, objective_value, rank, score_report
from .search import run_smart_search
from .search_space import BranchSpace, enumerate_branches

__all__ = [
"Candidate",
"OptimizationGoal",
"OptimizationTarget",
"SearchSpace",
"SLATarget",
"SmartSearchConfig",
"SweepConfig",
"Workload",
"run_smart_search",
# parallel-config enumeration
"ParallelShape",
"ReplicaParallelConfig",
"DisaggParallelConfig",
"enumerate_parallel_configs",
"enumerate_worker_shapes",
"enumerate_disagg_configs",
# planner preset decode
"SCALING_POLICIES",
"ScalingPolicy",
"throughput_intervals",
"FPM_SAMPLING",
"LOAD_SENSITIVITY",
# load-predictor sweep
"LoadPredictorResult",
"sweep_load_predictor",
"window_loss",
"predictor_fields",
# KV-cache feasibility
"NoPerfDatabase",
"estimate_kv_tokens",
"feasible_shape_tokens",
# sample unroll
"unroll_sample",
# model/hardware resolution + parallel-config enumeration
"ModelHardware",
"NoViableParallelConfig",
"resolve_model_hardware",
"parallel_configs_for",
# candidate space + sampler
"BranchSpace",
"enumerate_branches",
"BranchSampler",
"Suggestion",
"make_branch_sampler",
# deployment translation + evaluation
"DeploymentPlan",
"build_deployment",
"ReplayEvaluator",
# scoring
"objective_value",
"score_report",
"is_feasible",
"make_candidate",
"rank",
]
66 changes: 66 additions & 0 deletions components/src/dynamo/profiler/spica/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

"""Experimental ``python -m dynamo.profiler.spica`` entry point."""

from __future__ import annotations

import argparse
import sys

import yaml
from pydantic import ValidationError

from .config import SmartSearchConfig
from .search import run_smart_search


def main() -> None:
parser = argparse.ArgumentParser(
prog="python -m dynamo.profiler.spica",
description=(
"[EXPERIMENTAL] Spica smart sweeper. Its configuration, output, and "
"optimization behavior may change without notice."
),
)
parser.add_argument(
"--config", required=True, help="Path to a SmartSearchConfig YAML file"
)
args = parser.parse_args()

try:
config = SmartSearchConfig.from_yaml(args.config)
except OSError as exc: # missing file, a directory, unreadable, etc.
parser.error(f"could not read config {args.config}: {exc}")
except yaml.YAMLError as exc:
parser.error(f"malformed YAML in {args.config}: {exc}")
except ValidationError as exc:
parser.error(f"invalid config {args.config}: {exc}")

candidates = run_smart_search(config)
if not candidates:
print(
"no feasible candidate found "
"(check backends / SLA / gpu_budget / replay errors)",
file=sys.stderr,
)
sys.exit(1)
if config.goal.is_pareto:
# The result is a Pareto front: show every objective + the concrete concurrency, since
# the single `score` (the first objective) hides the tradeoff the front is about.
print(f"pareto front ({len(candidates)} non-dominated):")
for i, candidate in enumerate(candidates):
objectives = ", ".join(
f"{key}={value:.4g}"
for key, value in (candidate.objectives or {}).items()
)
concurrency = candidate.config.get("concurrency")
conc = f" concurrency={concurrency}" if concurrency is not None else ""
print(f"{i}: {objectives}{conc} used_gpus={candidate.used_gpus}")
else:
for i, candidate in enumerate(candidates):
print(f"{i}: score={candidate.score} used_gpus={candidate.used_gpus}")


if __name__ == "__main__":
main()
60 changes: 60 additions & 0 deletions components/src/dynamo/profiler/spica/_quiet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

"""Configure the JAX/Vizier runtime when a Spica sampler is constructed.

Vizier's GP optimizer runs on JAX. The default ``ai-dynamo[spica]`` extra is CPU-only; users can
install the matching JAX CUDA plugin separately for large sweeps. So we:

- pin ``JAX_PLATFORMS=cpu`` only when no CUDA plugin is installed, skipping jax's noisy
*"An NVIDIA GPU may be present ... but a CUDA-enabled jaxlib is not installed. Falling back
to cpu."* warning for the normal CPU install;
- leave the platform unset when ``jax_cuda12_plugin`` is present, allowing JAX to select GPU;
- quiet the ``jax`` / ``absl`` loggers (e.g. absl's *"Python 3.8+ is required"*);
- drop the jax / jaxlib / equinox / jaxopt ``DeprecationWarning``s and the
*"JAXopt is no longer maintained"* notice.

The package root deliberately does not import or execute this module: importing
``dynamo.profiler.spica`` must not mutate process-wide environment, logging, or
warning state. :class:`~dynamo.profiler.spica.sampler.VizierBranchSampler` calls
:func:`configure_vizier_runtime` immediately before importing Vizier. An explicit
``JAX_PLATFORMS`` always wins.
"""

from __future__ import annotations

import logging
import os
import warnings
from importlib.util import find_spec


def configure_vizier_runtime() -> None:
"""Apply Spica's opt-in JAX/Vizier process configuration.

Warning filters are installed on every sampler construction because test runners
and embedding applications may reset the warning filter list between sweeps.
"""

# Must precede the first ``import jax`` (Vizier imports it lazily during a sweep).
if "JAX_PLATFORMS" not in os.environ and find_spec("jax_cuda12_plugin") is None:
os.environ["JAX_PLATFORMS"] = "cpu"

for logger_name in ("jax", "jax._src.xla_bridge", "absl"):
logging.getLogger(logger_name).setLevel(logging.ERROR)

for module in (
r"jax(\..*)?",
r"jaxlib(\..*)?",
r"equinox(\..*)?",
r"jaxopt(\..*)?",
):
warnings.filterwarnings("ignore", category=DeprecationWarning, module=module)
warnings.filterwarnings("ignore", message=".*JAXopt is no longer maintained.*")
# google-vizier 0.1.21 calls protobuf's Python 3.12-deprecated UTC helper.
warnings.filterwarnings(
"ignore",
message=r"datetime\.datetime\.utcnow\(\) is deprecated.*",
category=DeprecationWarning,
module=r"google\.protobuf\.internal\.well_known_types",
)
Loading
Loading