Phase 3: GPU capability class + single-node routing (#56) #297

Closed
Mark wants to merge 1 commit from mesh-seed/t_7b136d19-r2 into master
Owner

Phase 3 of Mark/mesh-seed#56. Implements a canonical GPU capability class with deterministic single-node routing, registration validation, and intent-side class requirement matching. Federation / multi-node scheduling is explicitly out of scope — the router picks one worker, the class matching rules are node-local, and the extension point is purely on the allocation side (GPUManager.allocate_gpus_for_candidate can grow a node-distribution strategy without touching the class schema or the single-node selector).

Adds:

  • runtime/gpu_class.py: canonical class registry (16 entries: v100, p4, t4, a100, a10g, a40, h100, h200, b200, 4090, 5090, rtx2060, rtx3090, rtx4090, mi250, mi300x), with vendor / min_memory_gb floor / generation ladder. class_satisfies (exact + class_compatible semantics), validate_capability_resources, validate_intent_gpu_constraint.
  • primitives/_bone/gpu_detector.py::_infer_gpu_class: maps the nvidia-smi / rocm-smi model name to the canonical class (substring + token match, longest-wins). get_gpu_resources now surfaces gpu_class and validates before advertising; class is dropped if memory is below the floor so the advertisement is internally consistent.
  • runtime/primitive_registry.py: PrimitiveRecord.resources field with to_dict/from_dict round-trip; _register_template (drops the record) and register (raises ValueError) validate the resources block against gpu_class rules.
  • runtime/intent_router.py: _filter_candidates_by_gpu_class filters candidates after the existing class=="gpu" filter, before scoring and allocation. When the intent pins a class:
    • exact-name match by default
    • class_compatible=true widens to same-vendor generation-or-newer
    • no-match returns gpu_class_unavailable with available_classes
    • unsupported class returns gpu_class_unsupported with the canonical list
    • invalid constraint returns gpu_constraint_invalid with errors
      _route_gpu surfaces the selected gpu_class on the result.
  • schemas/capability.schema.json + schemas/intent.schema.json: gpu_class + class_compatible fields.
  • tests/unit/test_gpu_class.py: 77 focused tests covering the class registry, satisfaction semantics, capability + intent validation, gpu_detector inference + validation, router class filter, _route_gpu integration, and PrimitiveRegistry registration.
  • docs/reference/GPU_CAPABILITY.md: documents the class system, inference, registration validation, router behavior, and the single-node boundary (with the clean extension point for multi-node shard selection).

Local: 1781 passed / 5 skipped — no regressions.

Phase 3 of Mark/mesh-seed#56. Implements a canonical GPU capability class with deterministic single-node routing, registration validation, and intent-side class requirement matching. Federation / multi-node scheduling is explicitly out of scope — the router picks one worker, the class matching rules are node-local, and the extension point is purely on the allocation side (`GPUManager.allocate_gpus_for_candidate` can grow a node-distribution strategy without touching the class schema or the single-node selector). Adds: - `runtime/gpu_class.py`: canonical class registry (16 entries: v100, p4, t4, a100, a10g, a40, h100, h200, b200, 4090, 5090, rtx2060, rtx3090, rtx4090, mi250, mi300x), with vendor / min_memory_gb floor / generation ladder. `class_satisfies` (exact + class_compatible semantics), `validate_capability_resources`, `validate_intent_gpu_constraint`. - `primitives/_bone/gpu_detector.py::_infer_gpu_class`: maps the nvidia-smi / rocm-smi model name to the canonical class (substring + token match, longest-wins). `get_gpu_resources` now surfaces `gpu_class` and validates before advertising; class is dropped if memory is below the floor so the advertisement is internally consistent. - `runtime/primitive_registry.py`: `PrimitiveRecord.resources` field with `to_dict`/`from_dict` round-trip; `_register_template` (drops the record) and `register` (raises `ValueError`) validate the resources block against `gpu_class` rules. - `runtime/intent_router.py`: `_filter_candidates_by_gpu_class` filters candidates after the existing class=="gpu" filter, before scoring and allocation. When the intent pins a class: - exact-name match by default - `class_compatible=true` widens to same-vendor generation-or-newer - no-match returns `gpu_class_unavailable` with `available_classes` - unsupported class returns `gpu_class_unsupported` with the canonical list - invalid constraint returns `gpu_constraint_invalid` with errors `_route_gpu` surfaces the selected `gpu_class` on the result. - `schemas/capability.schema.json` + `schemas/intent.schema.json`: `gpu_class` + `class_compatible` fields. - `tests/unit/test_gpu_class.py`: 77 focused tests covering the class registry, satisfaction semantics, capability + intent validation, gpu_detector inference + validation, router class filter, `_route_gpu` integration, and `PrimitiveRegistry` registration. - `docs/reference/GPU_CAPABILITY.md`: documents the class system, inference, registration validation, router behavior, and the single-node boundary (with the clean extension point for multi-node shard selection). Local: 1781 passed / 5 skipped — no regressions.
feat(gpu): GPU capability class + deterministic single-node routing
Some checks failed
CI / Lint and Format (pull_request) Failing after 27s
CI / Security Check (pull_request) Failing after 1m11s
CI / Code Quality Checks (pull_request) Successful in 10s
CI / Unit Tests (pull_request) Failing after 1m46s
CI / Full Test Suite (pull_request) Has been skipped
CI / Integration Tests (pull_request) Successful in 1m52s
CI / Smoke Tests (pull_request) Failing after 1m45s
Federation Integration / Federation Integration Suite (pull_request) Successful in 1m26s
CI / Type Check (pull_request) Successful in 13m15s
65e8fd63ad
Phase 3 of Mark/mesh-seed#56: implement a canonical GPU capability class
with single-node routing, registration validation, and intent-side
class requirement matching. Federation / multi-node scheduling is
explicitly out of scope — the router picks one worker, the class
matching rules are node-local, and the extension point is purely on
the allocation side.

What's added:
- runtime/gpu_class.py: canonical SUPPORTED_GPU_CLASSES (16 entries:
  v100, p4, t4, a100, a10g, a40, h100, h200, b200, 4090, 5090,
  rtx2060, rtx3090, rtx4090, mi250, mi300x), with vendor, min_memory_gb
  floor, and generation ladder for compatibility matching.
  - class_satisfies(candidate, requested, memory, *, class_compatible):
    exact-name match by default; with class_compatible=True, accepts
    same-vendor, generation-or-newer candidates with sufficient memory.
  - validate_capability_resources(resources): rejects records with
    unknown class, available=true without class, class without
    available=true, memory below class floor, count < 1.
  - validate_intent_gpu_constraint(constraints): rejects unknown
    requested class and min_memory_gb below class floor.
- primitives/_bone/gpu_detector.py::_infer_gpu_class: maps the
  nvidia-smi / rocm-smi model name to the canonical class (substring +
  token match, longest-wins). get_gpu_resources now surfaces gpu_class
  on the advertisement and runs validate_capability_resources before
  returning — class is dropped if memory is below the floor so the
  advertisement is internally consistent.
- runtime/primitive_registry.py: PrimitiveRecord now carries a
  resources field (to_dict / from_dict round-trip), and both
  _register_template (drops the record) and register (raises
  ValueError) validate the resources block against gpu_class rules.
- runtime/intent_router.py: _filter_candidates_by_gpu_class filters
  candidates after the existing class=="gpu" filter, before scoring
  and allocation. When the intent pins a class:
    - exact match by default
    - class_compatible=true widens to same-vendor generation-or-newer
    - no-match returns gpu_class_unavailable with available_classes
    - unsupported class returns gpu_class_unsupported with the canonical
      list
    - invalid constraint returns gpu_constraint_invalid with errors
  _route_gpu surfaces the selected gpu_class on the result.
- schemas/capability.schema.json: resources.gpu.gpu_class field.
- schemas/intent.schema.json: constraints.gpu.gpu_class and
  constraints.gpu.class_compatible fields.
- tests/unit/test_gpu_class.py: 77 focused tests covering the class
  registry, satisfaction semantics, capability + intent validation,
  gpu_detector inference + validation, router class filter,
  _route_gpu integration, and PrimitiveRegistry registration.
- docs/reference/GPU_CAPABILITY.md: documents the class system,
  inference, registration validation, router behavior, and the
  single-node boundary (with the clean extension point for
  multi-node shard selection on the allocation side).

Full unit test sweep: 1781 passed, 5 skipped — no regressions.
Mark closed this pull request 2026-09-21 00:55:06 +00:00
Some checks failed
CI / Lint and Format (pull_request) Failing after 27s
CI / Security Check (pull_request) Failing after 1m11s
CI / Code Quality Checks (pull_request) Successful in 10s
CI / Unit Tests (pull_request) Failing after 1m46s
CI / Full Test Suite (pull_request) Has been skipped
CI / Integration Tests (pull_request) Successful in 1m52s
CI / Smoke Tests (pull_request) Failing after 1m45s
Federation Integration / Federation Integration Suite (pull_request) Successful in 1m26s
CI / Type Check (pull_request) Successful in 13m15s

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Mark/mesh-seed!297
No description provided.