Skip to main content

Adding a New Accelerator Vendor

On this page

This page is the procedure to follow, and it ends with the standard to check such a merge request against. Why the work is divided this way is in ADR 0082.

To add a vendor you write two things: a vendor definition (who it is and what it can do) and a driver (how to read the cards from the vendor's tool, and which devices to hand a workload). The probe sequence, the PCI roster and how devices reach each container runtime are handled by existing code.

What you do not need to change: any runtime driver (internal/agent/runtime/*), the scheduler, or another vendor's files. If you find you have to, stop: that is a gap in the seam, and it should be raised on its own.

Files to Touch

WhatWhere
Vendor definitionNew internal/accelerator/<vendor>.go; the vendor constant in vendor.go; one line in vendorSpecs in vendor_spec.go
DriverNew internal/agent/gpu/<vendor>*.go; one line in defaultProbers in gpu.go
Fixturesinternal/agent/gpu/testdata/, raw tool output captured on real hardware
Metrics (with a new metric)Register the metric name in internal/platformmetrics
Kubernetes (when runtimes lists kube)Add the extended resource name to ClassifyKubeResource in internal/accelerator/kube.go

Registration is two lines and cannot be one: the definition is in a package the server and the agent share, and the driver is in the agent only.

The console takes the vendors' order, names and frameworks from the vendor dictionary the server sends (GET /api/v1/accelerator-vendors), and the "Support Declared in the Definitions" table of the support matrix is generated from the definitions; neither is edited by hand. After changing a definition, regenerate the table and the console's test fixture (see Step 3). What is still added by hand is the icon (ui/src/components/vendorAssets.ts and ui/public/vendor-logos/; without one the console draws a round mark with the first letter, whose colour and letter can be set in VendorLogo.tsx) and the translated name under vendor.<id> in common.json. The vendor names other pages keep for themselves need not be added: without one the template pages (inferenceTemplates.json) use the name the server gives, and the deploy pages (deploy.json) show the id in capitals.

Step 1: The Vendor Definition

Write one vendorSpec value in internal/accelerator/<vendor>.go. What each field means is written on vendorSpec in vendor_spec.go. The fields come in four groups; write them one per line, as an existing vendor's file does (hygon.go, for example).

// exampleVendor is Example. PCI identity measured 2026-12-01 on host-a:
// EX100 1234:0001 class 0x0302 bound to exdrv.
var exampleVendor = vendorSpec{
	id:         VendorExample,
	brand:      "Example",
	frameworks: []string{"exf"},
	named:      contains("example", "exf"),
	precedence: 45,

	tool:           "ex-smi",
	detectCommand:  "ex-smi",
	controlDevices: []string{"/dev/exctl"},
	pciID:          0x1234,
	pci:            &pciVendor{classes: []uint32{pciClass3D}, drivers: []string{"exdrv"}},

	runtimes:        []string{RuntimeDocker, RuntimeNerdctl},
	supports:        []Feature{FeatureMultiNode},
	ownCatalogImage: true,

	cardChecks: true,
}

There is one rule: not declared means not supported.

  • runtimes lists the runtime drivers its cards can be given to a workload on. A node whose runtime is not in the list is refused before scheduling. A vendor that lists none has its cards found and monitored only and carries no workload; a vendor that gets monitoring first and deployment later starts this way.
  • supports lists the platform features offered on its cards. What is not listed is refused by the server before scheduling and by the agent at admission.
  • partition (the dGPU backend), gpuPlugins, healthProbe and the like are left out when the vendor has none.
  • Both lists hold only what was verified on real hardware.
  • precedence decides which vendor a string naming two of them belongs to; the lower is tried first. Do not use a short word in named that another vendor's name contains.
  • Fill in detectCommand only when the tool's name is this vendor's alone (Kunlunxin's xpu-smi shares its name with Intel's, so it has none).
  • pci follows lspci -nn on real hardware, with the machine and the date in the comment above the definition. Do not add the whole 0x03 display class for convenience: a server's BMC display chip is in that class too.
  • When upstream pci.ids has no name for the card, give the model name and where it was read in pciModels.

Step 2: The Driver

A driver implements gpu.Prober. Probe does not write its own sequence; it hands over to probeCards. You answer two things: whether the tool is installed, and how its output becomes cards.

func (p *ExampleProber) Probe(ctx context.Context) ([]proto.GPUInfo, error) {
	_, err := lookCLI("ex-smi")
	return probeCards(ctx, accelerator.VendorExample, p.hostRoot, err == nil, p.list, &p.seen)
}

Rules for list:

  • When the tool cannot be asked, return an error and no cards. The node then reports the PCI roster, which probeCards handles.
  • Fill in each card completely: index, UUID, model, PCI address, total memory (bytes), vendor name; use SetCardFinding when there is a health finding.
  • Refuse the whole listing when the number of rows does not match or an index or address repeats; a truncated output is not a complete listing.
  • Run the tool with queryLogged or RunVendorCLI, which take care of timeouts, isolating a hung process, and running in the host's namespaces. Do not call exec.Command directly; cliCommand only enters the host's namespaces, with no timeout and no isolation of a hung process, so do not call it directly either. A few places in the existing drivers still execute that way (NVIDIA's and Ascend's lookups of the runtime plugin's version, Ascend's docker info, PPU's search for a shared library with ldconfig); do not copy them.

p.seen is a cardBaseline: which card each index was the last time the tool answered. Granting and metrics run after probing, and an index may by then point at another card; compare identities against it and refuse when they differ.

Metric names are the ones registered in internal/platformmetrics.

Optional interfaces a driver implements as needed. The framework uses one that is implemented, and a driver without it does not have that capability; the last two are complete only with the matching declaration in the definition. These are the ones most often needed when adding a vendor; internal/agent/gpu has others that are used by type assertion (topology, NVLink, accelerator ports).

InterfaceWhat it doesAlso needed in the definition
DriverAwareInjectorThe way to grant differs by runtimeNothing
ComputeProcessListerWhich processes are on a card, to tell occupancy from outside the platformNothing
HostRuntimeCheckerHas the vendor's runtime actually use one card on the host (the per-card runtime check)CheckRuntime among checks. Without it the check still runs and a failure still marks the card unusable, but the result is not reported and the console offers no recheck
ContainerRuntimeGraderHow the output is graded when the runtime check runs inside an imagesmokeFramework and smokeScript, without which the check does not run in an image; and CheckRuntime among checks, as in the row above

Granting Devices

RuntimeInjection says which devices this workload gets, and writes no container command-line option:

return RuntimeInjection{
	Env: map[string]string{"EXF_VISIBLE_DEVICES": visible},
	Grant: runtime.DeviceGrant{
		Devices: []runtime.Device{{Path: "/dev/exctl", Access: runtime.DeviceAccessAll}, {Path: node, Access: runtime.DeviceAccessAll}},
		Groups:  groupIDs,
	},
}
  • docker, nerdctl, kube and udocker each turn Grant into their own form.
  • To replace settings the workload carries (another vendor's --gpus or --runtime, certain device mappings), say so in Grant.Replaces; name environment variables to clear in ClearEnv. Do not edit the workload's option strings.
  • When the way to grant differs by runtime, implement DriverAwareInjector and read target.View (the container sees only granted devices, sees the host's devices, or there is no container); do not compare driver names.
  • Find device nodes from sysfs by PCI address and verify the device numbers; do not assume that index N is /dev/xxxN. When verification fails, return UnsupportedReason rather than a grant that may point at the wrong card.

Step 3: Fixtures and Tests

  • A fixture is raw tool output captured on real hardware, placed in testdata/ as it is, with the tool's name in the file name.
  • Parsers are asserted exactly against fixtures: the number of cards, and each card's address and memory.
  • Cover the failure paths: a tool timeout, a failed command with partial output, empty output, garbled or truncated rows, and a grant after indexes have drifted. Each case must fail once the handling it covers is removed.
  • At least one case runs the whole Probe through probeCards, with hostRoot pointed at t.TempDir(); one of them puts another card at the same index after Probe and asserts that the grant is refused (probe_baseline_test.go shows how for PPU and Hygon).
  • Do not write tests that copy the definition out again. The definition is the statement; tests prove behaviour.

After a vendor is added, these existing tests ask you to update them, on purpose:

TestWhat to do
TestVendorDefinitionsAreConsistent in acceleratorFix the definition as the error says. The test names no vendor, and there is no list of exceptions to add to
TestKnownVendorsIsTheClosedSetNormalizeVendorProduces in acceleratorAdd to the expected list
TestVendorRuntimeAdmission in acceleratorAdd a row: the runtimes this vendor is accepted on. It decides what is refused before scheduling, so it is written out
TestDefaultProbersPreserveExistingVendorOrder and TestMixedVendorAutoKeepsExistingProberPriority in agent/gpuAdd to the expected probe order. NVIDIA comes after every vendor that ships a compatible nvidia-smi
TestEngineProfileGoldens in server/deployGPUWORKS_UPDATE_PROFILE_GOLDEN=1 go test -run TestEngineProfileGoldens ./internal/server/deploy/
TestSupportMatrixTableIsWrittenFromTheDefinitions in acceleratorGPUWORKS_UPDATE_SUPPORT_MATRIX=1 go test -run TestSupportMatrixTableIsWrittenFromTheDefinitions ./internal/accelerator/, then python3 docs-site/check_translations.py --write docs/reference/support-matrix.md to record that page's new source hash
TestAcceleratorVendorsWireJSONIsTheConsoleFixture in server/apiGPUWORKS_UPDATE_VENDOR_FIXTURE=1 go test -run TestAcceleratorVendorsWireJSONIsTheConsoleFixture ./internal/server/api/

Step 4: Before Submitting

make test
make test-l2
make test-l3
go test -race ./internal/accelerator/... ./internal/agent/gpu/...

Verification on Real Hardware

Offline tests prove parsing and sequence only. The following can only be answered on real hardware; until they are, do not write them into runtimes, supports or the support matrix:

  • Which numbering selects cards inside a container: select a card other than 0, and several that are not adjacent, and check that the container sees those cards in that order.
  • Cards that were not granted really cannot be used in the container.
  • One real engine start and one chat on each runtime listed.
  • How probing and granting behave when a card is passed through or drops out and the indexes are renumbered.

Review Standard

Check a merge request that adds a vendor or a runtime against each row. Every row has a check that can be carried out; a row whose result cannot be stated counts as not met.

#RequirementHow to check
1Only its own files are touchedThe production files in git diff --stat <base> are only: the new vendor's definition and driver files, one vendor constant in vendor.go, one line in vendor_spec.go, one line in gpu.go, the icon and translated name in the front end, and the generated support-matrix table and console fixture; with a new metric, its registration in internal/platformmetrics as well, and when it lists kube, its extended resource name in kube.go. Tests, goldens and the other documents do not count. If a runtime driver, the scheduler or another vendor's file appears, ask for a separate merge request
2The definition is consistentgo test -run TestVendorDefinitionsAreConsistent ./internal/accelerator/ passes, and that test file is unchanged
3No budget grewmake check-architecture passes, and git diff <base> -- scripts/arch-constraints.txt raises no number
4The driver writes no container command-line optionCommand 4 below the table prints nothing
5The driver does not branch on a runtime's nameCommand 5 below the table prints nothing. It matches ==, !=, case, EqualFold and Contains against a driver's name, as a literal or one of the three sets of constants
6Probe goes through probeCardsCommand 6 below the table has one hit; the driver does not call Roster and has no type of its own for the cards seen last time. A driver that checks a card's identity when it grants (any that finds device nodes by index has to; among the existing drivers Ascend builds /dev/davinciN from the chip number without checking, a known gap not to copy) passes its own baseline, not nil, and has a case that runs Probe, then puts another card at the same index, and the grant is refused
7Metric names are registeredgo test -run TestEveryMetricLiteralIsRegistered ./internal/platformmetrics/ passes
8Every item in runtimes and supports has evidence from real hardwareThe verification section of the merge request gives, for each item, the machine, the driver version, the image digest and the actual command. An item without evidence is removed from the definition
9Fixtures are raw outputThe commit message or a note beside the fixture gives the machine and the date; the comments on the PCI identity and pciModels say where they were read
10The failure-path tests really testThe reviewer picks any one failure-path case, removes the handling it covers from the driver, and confirms the case turns red
11No test copies a tableNo new test asserts the definition's field values listed out again. The row in TestVendorRuntimeAdmission is the exception: it states which runtimes are accepted and refused before scheduling
12The documents state only what was verifiedEach cell added to the support matrix has matching evidence in the verification section

The commands for rows 4, 5 and 6 (a table cannot hold a vertical bar, so they are written out here; replace <vendor> with the file name prefix):

# 4: prints nothing
grep -nE '"--(device|gpus|runtime|group-add|tmpfs)"' internal/agent/gpu/<vendor>*.go | grep -v '_test\.go'
# 5: prints nothing. The pattern is the one of agent_runtime_name_comparisons in scripts/arch-constraints.md
N='"(docker|nerdctl|udocker|kube|host)"|(agent)?runtime\.Driver[A-Z]|proto\.RuntimeDriver|kube\.DriverName|hostproc\.DriverName|accelerator\.Runtime(Docker|Nerdctl|Udocker|Kube|Host)'
grep -nE "(==|!=) *($N)|($N) *(==|!=)|case .*($N)|(EqualFold|Contains)\(.*($N)" internal/agent/gpu/<vendor>*.go | grep -v '_test\.go'
# 6: one hit; for a driver that checks identity when it grants, the last argument is its own baseline (&p.seen), not nil
grep -n 'probeCards(' internal/agent/gpu/<vendor>*.go | grep -v '_test\.go'

What Not to Do

  • Do not add a vendor branch to a runtime driver, and do not add a function to udocker that infers the vendor from environment variable names.
  • Do not change logic every vendor shares (the scheduling of checks, how occupancy is judged, how the roster is merged) in the merge request that adds a vendor. If it needs changing, raise it separately and compare existing vendors against a baseline.
  • Do not take "the device node exists" or "the environment variable is set" for "inference runs".

Was this page helpful?