← Back to Pull requests

feat: add support for Tecorigin GPU #3369

Closed
unknown closed this pull request without merging on Nov 16, 2026 05:39 UTC
View on GitHub
unknown unknown commented on Nov 04, 2026 09:12 UTC
Author

What type of PR is this?

/kind feature

What this PR does / why we need it:

This PR adds a Tecorigin GPU backend to the HAMi scheduler extender
(pkg/device/tecorigin, registered as Tecorigin). Tecorigin cards expose a small number of
cores each (3–4); the backend lets a pod request an arbitrary number of cores through the new
resource tecorigin.com/gpucore and places it on the fewest cards that can satisfy the request.

Device model

  • One DeviceInfo per physical card, keyed by the card serial number reported by the vendor

  • library (the string teco-smi prints); the same id is what a pod pins through
    tecorigin.com/use-gpuuuid.
  • Cores are tracked as a bitmask in DeviceUsage.Usedcores: AccumulateCores ORs masks and

  • CountAllocatedCores popcounts them, so the framework never adds masks numerically.
  • The mask reaches the vendor device plugin as the Usedcores field of HAMi's per-container

  • allocation annotation (<uuid>,<type>,<usedmem>,<usedcores>); the plugin expands it into the
    global core indexes of TECO_VISIBLE_DEVICES.
  • tecorigin.com/gpucore is a core count, not a card count. The node advertises the sum of

  • all cards' cores (8 cards × 4 cores = 32), and a request of N reserves N cores.

    Scheduling

  • Fit never spreads a request that fits on one card. GenerateResourceRequests always returns

  • Nums=1 with TotalCoresreq=N, so fitInDevices' Nums > len(typeDevices) check never
    compares a core count against a card count; the real card count is derived inside Fit.
  • Among the splits that use the fewest cards, Fit picks the one that consumes the least free

  • capacity, so already partly-used cards get filled first and whole cards stay whole. The choice
    is exact and independent of node size (cards are bucketed by free-core count, no greedy
    cut-off at some card count).
  • A request that would need more cards than the physical minimum — i.e. one that could only be

  • served by spreading — is rejected with CardInsufficientCore instead of being spread.
  • Non-contiguous free cores are usable: the runtime accepts an arbitrary core mask, so an

  • allocation takes the lowest free bits rather than requiring a contiguous run.
  • Rejection reasons use the standard counters: CardNotHealth, CardTimeSlicingExhausted,

  • CardUUIDMismatch, CardInsufficientCore.
  • Pod annotations tecorigin.com/use-gpuuuid / tecorigin.com/nouse-gpuuuid pin or exclude

  • cards, matched exactly against the card id via device.CheckUUID.

    Registration and health

  • The register annotation hami.io/node-tecorigin-register carries HAMi's 9-field node-device

  • CSV (id,count,memory,devcore,type,numa,health,index,mode), one segment per card, the same
    layout Hygon and Iluvatar publish. All nine fields are required: index is the card's physical
    position and HAMi's scoring breaks ties on it, so the 7-field form (where every card lands at
    index 0) is rejected.
  • Parsing validates a non-empty card id, a core count of 1–4, memory in MiB (1 TiB bound so a

  • value that only makes sense in bytes is rejected), derives the core mask from the core count,
    forces Type/DeviceVendor to Tecorigin, and defaults Mode to hami-core.
  • The optional hami.io/node-tecorigin-cores annotation ({"<uuid>":[global core ids]}) is

  • copied into CustomInfo["coreIDs"] and logged at V(4); scheduling never reads it — it only
    helps trace a TECO_VISIBLE_DEVICES entry back to a card by hand.
  • CheckHealth keeps a node registered only while tecorigin.com/gpucore is allocatable and at

  • least one card is healthy, and fingerprints the resource, the healthy card count and both
    annotations so any change triggers a re-read. It asks for an update on first sight and on
    change; an unchanged node is not re-added. Without the first-sight update, register() never
    calls addNode and every pod asking for teco cores fails with "node unregistered" — covered
    by the new scheduler regression test.
  • The obsolete handshake annotation hami.io/node-handshake-tecorigin is removed on sight and

  • scheduled for deletion by NodeCleanUp, following the HAMi convention.

    Integration

  • pkg/scheduler/config: new tecorigin: config key (resourceCountName), backend registered

  • in InitDevicesWithConfig, accounted for in anyDeviceConfigured, and covered by the config
    tests.
  • Helm chart: devices.tecorigin.{resourceCountName,enabled,customresources} in values.yaml,

  • the extender resource list in _helpers.tpl, tecorigin.resourceCountName in the generated
    scheduler device-config, and the regenerated values table in charts/hami/README.md.

    Tests

  • pkg/device/tecorigin/device_test.go: annotation parsing (valid, invalid, whitespace, missing

  • trailing separator, normalization), mask helpers, the core-id annotation, node device
    extraction, health/registration, request parsing (limits vs requests, zero, fractional), the
    placement matrix (single/multi-card, fragmentation, tight packing on small and large nodes,
    pin/unpin, every rejection reason), annotation patching, and bitmask accounting.

    Which issue(s) this PR fixes:

    Fixes #<!-- TODO: link the tracking issue; none found, open one if required by CONTRIBUTING -->

    Special notes for your reviewer:

  • The Tecorigin device plugin is not part of this PR. It publishes the two node annotations,

  • advertises tecorigin.com/gpucore on the node, and must be installed separately (the chart
    documents devices.tecorigin.enabled: false as "keep the device configuration but do not add
    the resource to the extender").
  • maxCoresPerCard is 4 by design, because the current 3–4-core cards are the only ones served;

  • a future card with more cores needs that bound (and the int64 mask) revisited.
  • MemPercentagereq is 101, HAMi's "no memory requirement" sentinel: cores are the only

  • scheduling dimension and the backend advertises no memory resource.
  • ScoreNode returns 0; placement is entirely card selection inside Fit, so node-level

  • scoring is left to the policy and other plugins.
  • Hardware validation (required by CONTRIBUTING for allocation changes): TODO — fill in card

  • model, driver / teco-smi version, and what was verified (single-card fit, multi-card fit,
    mask expansion in TECO_VISIBLE_DEVICES, shared card).
  • Local verification so far: go test ./pkg/scheduler/... -short passes, golangci-lint reports

  • 0 issues on the touched packages, hack/verify-license.sh, hack/verify-import-aliases.sh
    and hack/verify-rbac.sh pass. go test ./pkg/device/tecorigin/ currently fails in
    TestFitNilPod because Fit calls pod.GetAnnotations() on a nil pod; this must be fixed or
    the test dropped before merge.

    Does this PR introduce a user-facing change?:

    Yes — a new tecorigin.com/gpucore resource, new devices.tecorigin. Helm values, a new Pod
    example, and updated supported-device documentation. No existing behavior changes: the backend
    only registers nodes that advertise the teco resource.

    AI assistance disclosure:

    Per CONTRIBUTING.md, AI assistance must be disclosed in the PR. This description was drafted
    with an AI assistant from the branch diff; the code itself was authored by the contributor.

    Hardware Validation


  • GPU Model: Tecorigin T100

  • Driver Version: 3.3.0

  • OS & Kernel: Ubuntu 22.04.1 LTS

  • Kubernetes Version: v1.30.1

  • HAMi Version: this PR
  • Test Cases:
    1. Device plugin successfully registers and advertises tecorigin.com/gpucore resource on node.
    2. Pod with resource tecorigin.com/gpucore: 1 can be scheduled and run normally.
    3. Multiple pods requesting gpucore resources can be allocated correctly.

    Test Evidence:
    <img width="1487" height="855" alt="image" src="https://github.com/user-attachments/assets/7977501c-8460-4b41-b7c4-f561bf0ea749" />
    <img width="1488" height="833" alt="image" src="https://github.com/user-attachments/assets/d75f9b51-4d1a-49dd-b794-7a2886ff6ae2" />
    <img width="774" height="76" alt="image" src="https://github.com/user-attachments/assets/fa51fc79-5a81-45b2-ac50-2b8478cbfe70" />
    <img width="1399" height="879" alt="image" src="https://github.com/user-attachments/assets/bd686318-6cdb-4d1c-8ba4-dc564726ae90" />
    <img width="1431" height="878" alt="image" src="https://github.com/user-attachments/assets/ccc6f0c6-deef-4545-894a-9e193c980205" />
    <img width="1433" height="882" alt="image" src="https://github.com/user-attachments/assets/d6357751-87ac-4ad5-a28a-f81396bb027d" />

    <!-- TODO: state the extent of AI use for the code (e.g. "code written primarily by ...", "AI used for docs only") and remove this placeholder. -->

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->
    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    Summary by CodeRabbit

    New Features
    Added Tecorigin GPU scheduling support, including GPU-core requests, device health checks, and allocation across available cards.
    Added configurable GPU-core resource names and optional extender-managed resources. Tecorigin scheduling is enabled by default.
    Added a sample Pod manifest requesting one Tecorigin GPU core.
    Documentation
    * Documented the Tecorigin chart settings, defaults, and resource configuration options.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: DSFans2014 Review duration: 17067m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #3369"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%