Status: Ready for implementation once Gaudi hardware is available Complexity: Medium (1-2 days) Pattern: CLI-based (similar to AMD/ROCm, not NVML) Date Created: 2026-07-28
- Background Research
- What I Need From You
- Implementation Files
- Step-by-Step Implementation
- Testing Plan
- Risks & Concerns
✅ AVAILABLE:
- Kernel driver (open source, being upstreamed to Linux)
hl-smiCLI tool (Habana Labs System Management Interface)- Official Intel Gaudi software stack (proprietary)
Sources:
- Intel Gaudi hl-smi Documentation
- Intel discontinued open-source driver
- Intel Gaudi AI Accelerator Overview
MCV currently supports 3 GPU vendors:
-
NVIDIA (NVML) - Library-based
- Uses:
github.com/NVIDIA/go-nvml/pkg/nvml(Go bindings) - Detection: Direct library calls
- File:
mcv/pkg/accelerator/devices/nvml.go
- Uses:
-
AMD - CLI-based
- Uses:
amd-smicommand-line tool - Detection: JSON output parsing
- File:
mcv/pkg/accelerator/devices/amd.go
- Uses:
-
ROCm - CLI-based
- Uses:
rocm-smicommand-line tool - Detection: Text output parsing
- File:
mcv/pkg/accelerator/devices/rocm.go
- Uses:
Intel Gaudi will follow the AMD pattern (CLI-based).
The hl-smi tool provides:
- Device enumeration
- Memory information (total, free, used)
- Power consumption (54V + 12V rails)
- Driver version
- Temperature
- Topology information (NUMA, CPU affinity)
- Port status
Key Commands:
# Basic device summary
hl-smi
# Query specific metrics in JSON
hl-smi -Q memory.total,memory.free,memory.used -f json
# Query specific metrics in CSV
hl-smi -Q memory.total,memory.free,memory.used -f csv
# Topology information
hl-smi topo
# Daemon mode (monitoring)
hl-smi dmonOnce you have access to Gaudi hardware, please run these commands and send me the output:
hl-smiWhat this tells us: Number of devices, basic info, driver version
hl-smi -Q memory.total,memory.free,memory.used,power.draw -f jsonWhat this tells us: JSON structure for parsing
hl-smi -Q memory.total,memory.free,memory.used,power.draw -f csvWhat this tells us: CSV structure (might be easier to parse)
hl-smi -h
# Or specifically:
hl-smi -Q --helpWhat this tells us: What fields we can query
hl-smi -Q name,driver_version,uuid,pci.bus_id -f jsonWhat this tells us: Unique identifiers and device naming
hl-smi topoWhat this tells us: NUMA affinity, CPU topology
If you're running in a container:
# Inside container with Gaudi access
hl-smi
echo "Exit code: $?"What this tells us: Whether hl-smi works in containers
- Device Enumeration: How are devices numbered? (0, 1, 2... like NVIDIA/AMD?)
- Product Names: What are the device names? ("Gaudi2"? "Gaudi3"? "HL-205"?)
- Architecture Identifiers: Is there an "arch" field? (for Triton cache matching)
- Memory Units: Are memory values in bytes, KB, MB, GB?
- Driver Version Format: What does the version string look like?
Status: Skeleton created (see below)
Lines of Code: ~350 (estimated)
Pattern: Based on amd.go
Key Functions:
gaudiCheck()- Detect if hl-smi is availablegaudiDeviceStartup()- Initialize devicequeryHLSMI()- Execute hl-smi and parse outputInit()- Enumerate devices and populate GPU infoGetGPUInfo()/GetAllGPUInfo()- Return Triton-compatible infoGetSummary()/GetAllSummaries()- Return device summaries
Line 34-38: Add GAUDI DeviceType
const (
MOCK DeviceType = iota
AMD
NVML
ROCM
GAUDI // ADD THIS
)Line 79: Update String() method
func (d DeviceType) String() string {
return [...]string{"MOCK", "AMD", "NVML", "ROCM", "GAUDI"}[d]
}Line 162: Add gaudiCheck() to registerDevices()
func registerDevices(r *Registry) {
if config.IsStubEnabled() {
cacheFilePath = constants.StubbedCacheFile
logging.Debugf("Running in stubbed mode, loading static device config")
staticCheck(r)
} else {
// Call individual device check functions
amdCheck(r)
rocmCheck(r)
nvmlCheck(r)
gaudiCheck(r) // ADD THIS
}
}Line 298-306: Add GAUDI case to Startup()
switch cachedDevice.DeviceType {
case AMD:
device = &gpuAMD{}
case NVML:
device = &gpuNvml{}
case ROCM:
device = &gpuROCm{}
case GAUDI: // ADD THIS
device = &gpuGaudi{} // ADD THIS
default:
logging.Errorf("Unsupported device type %s", cachedDevice.DeviceType.String())
return nil
}Location: mcv/images/amd64.dockerfile
New Target: mcv-gaudi (similar to mcv-nvidia and mcv-amd)
Base Image Options (TBD - need to research):
- Option 1: Official Intel Gaudi image (if available)
- Option 2: Ubuntu + install Gaudi driver packages
- Option 3: Minimal + hl-smi binary only
Dependencies Needed:
hl-smibinary- Intel Gaudi driver (for container GPU access)
- Possibly:
libhabanalibraries
.PHONY: image-gaudi
image-gaudi:
$(CONTAINER_RUNTIME) build \
--target mcv-gaudi \
-t $(MCV_IMAGE):gaudi \
-f images/amd64.dockerfile \
mcv/mcv/docs/gaudi-support.md- Usage guide- Update
mcv/README.md- Add Gaudi to supported GPUs - Update
mcv/docs/unified-mcv-container.md- Add Gaudi to unified image (future)
- Get hl-smi output samples (from you)
- Create JSON parsing structs based on actual output
- Implement
queryHLSMI()function - Implement
gaudiCheck()detection - Test: Verify hl-smi detection works
- Implement
Init()- Parse devices from hl-smi - Map Gaudi fields to TritonGPUInfo:
- Determine
Backendvalue ("habana"? "gaudi"?) - Determine
Archvalue (Gaudi2 = "gaudi2"?) - Determine
WarpSizeequivalent (or leave empty?) - Map memory, driver version, device name
- Determine
- Implement summary methods
- Test: Enumerate devices, print info
- Implement
SetName/SetDeviceType/SetHwType/SetTritonInfo/SetSummaries - Test: Cache write/read cycle
- Verify: Device survives cache restoration
- Research Gaudi container requirements
- Create Dockerfile target
- Build image
- Test: Run in container with GPU access
- Run preflight checks with Gaudi
- Verify cache detection works
- Test MCV build with Gaudi-compiled kernels
- Update documentation
Create mcv/pkg/accelerator/devices/gaudi_test.go:
func TestGaudiCheck(t *testing.T) {
// Test hl-smi detection
}
func TestGaudiDeviceStartup(t *testing.T) {
// Test device initialization
}
func TestQueryHLSMI(t *testing.T) {
// Test JSON parsing (with mock output)
}
func TestGaudiCacheRestore(t *testing.T) {
// Test cache save/restore cycle
}-
Hardware Detection:
./mcv --detect-gpu # Should show: "Detected Gaudi device(s): X" -
Cache Building (if Triton/vLLM supports Gaudi):
./mcv build --source /path/to/triton/cache # Should create OCI image with Gaudi cache -
Container Test:
podman run --device /dev/accel/accel0 mcv:gaudi --detect-gpu # Should detect Gaudi inside container
-
hl-smidetected when available - Devices enumerated correctly
- Device info matches hl-smi output
- Cache write/restore works
- Container image includes hl-smi
- GPU access works in container
Risk: Intel archived the SynapseAI Core user-space driver in Feb 2025.
Impact:
- May limit long-term support
- Could affect future Gaudi hardware versions
- Community contributions unlikely
Mitigation:
- Document this limitation clearly
- Mark Gaudi support as "experimental"
- Consider this a lower-priority feature
Risk: Unknown if Triton/vLLM supports Gaudi for kernel compilation.
Impact:
- MCV might detect Gaudi but have no caches to package
- Feature would be GPU detection only, not full cache support
Mitigation:
- Research Triton Gaudi support first
- Document limitations if cache compilation unsupported
- Consider this a "nice to have" for future
Risk: hl-smi JSON output format is unknown until hardware available.
Impact:
- Can't finalize implementation until hardware access
- Might need multiple iterations to get parsing right
Mitigation:
- Request comprehensive output samples from you
- Build flexible parsing (handle missing fields gracefully)
Risk: Gaudi might require special container runtime setup.
Impact:
- Standard Docker/Podman might not work
- May need custom device mappings
Mitigation:
- Research Gaudi container requirements
- Document setup instructions clearly
- Test with both Docker and Podman
Risk: Unclear how to map Gaudi architecture to Triton's expectations.
Impact:
- Cache matching might not work correctly
- Runtime might not find correct cached kernels
Mitigation:
- Research Triton's Gaudi backend (if exists)
- Use conservative defaults
- Allow manual override via config
package devices
import (
"context"
"encoding/json"
"fmt"
"os/exec"
"strconv"
"time"
"github.com/redhat-et/GKM/mcv/pkg/config"
"github.com/redhat-et/GKM/mcv/pkg/utils"
logging "github.com/sirupsen/logrus"
)
const gaudiHwType = config.GPU
var (
gaudiAccImpl = gpuGaudi{}
gaudiType DeviceType
)
type gpuGaudi struct {
name string
deviceType DeviceType
hwType string
tritonInfo []TritonGPUInfo
summaries []DeviceSummary
devices map[int]GPUDevice
}
// TODO: Define based on ACTUAL hl-smi JSON output
type HLSMIDevice struct {
DeviceID int `json:"device_id"` // Or "index"? Unknown
DeviceName string `json:"device_name"` // "Gaudi2"? "HL-205"?
MemoryTotal int64 `json:"memory_total"` // Bytes? MB? Unknown
MemoryFree int64 `json:"memory_free"`
DriverVersion string `json:"driver_version"`
UUID string `json:"uuid"` // Does it have UUIDs?
PCIBusID string `json:"pci_bus_id"` // PCIe address
// Add more fields based on actual output
}
func gaudiCheck(r *Registry) {
if !utils.HasApp("hl-smi") {
logging.Debug("hl-smi not found, skipping Gaudi detection")
return
}
gaudiType = GAUDI
if err := addDeviceInterface(r, gaudiType, gaudiHwType, gaudiDeviceStartup); err == nil {
logging.Debugf("Using %s to obtain GPU info", gaudiAccImpl.Name())
} else {
logging.Debugf("Error registering Gaudi: %v", err)
}
}
func gaudiDeviceStartup() Device {
a := gaudiAccImpl
if err := a.InitLib(); err != nil {
logging.Debugf("Error initializing %s: %v", gaudiType.String(), err)
return nil
}
if err := a.Init(); err != nil {
logging.Errorf("failed to Init device: %v", err)
return nil
}
logging.Debugf("Using %s to obtain GPU info", gaudiType.String())
return &a
}
func (g *gpuGaudi) Name() string {
return gaudiType.String()
}
func (g *gpuGaudi) DevType() DeviceType {
return gaudiType
}
func (g *gpuGaudi) HwType() string {
return gaudiHwType
}
func (g *gpuGaudi) InitLib() error {
// No library initialization needed (CLI-based like AMD)
return nil
}
func (g *gpuGaudi) Init() error {
// Query hl-smi to detect and enumerate Gaudi devices
devices, err := queryHLSMI()
if err != nil {
return fmt.Errorf("failed to query hl-smi: %w", err)
}
g.devices = make(map[int]GPUDevice, len(devices))
// Process each device and populate tritonInfo, summaries
for deviceID, deviceInfo := range devices {
// TODO: Map Gaudi-specific fields to Triton format
// CRITICAL UNKNOWNS:
// - Backend: "habana"? "gaudi"? "intel"?
// - Arch: "gaudi2"? "gaudi3"? Need to match Triton expectations
// - WarpSize: Does Gaudi have an equivalent? NVIDIA=32, AMD varies
tritonInfo := TritonGPUInfo{
ID: deviceID,
Name: deviceInfo.DeviceName,
UUID: deviceInfo.UUID,
Backend: "gaudi", // TBD - Need to verify with Triton
Arch: "unknown", // TBD - Need actual device info
WarpSize: 0, // TBD - Unknown if applicable
MemoryTotalMB: deviceInfo.MemoryTotal / (1024 * 1024), // Assuming bytes
// PTXVersion: N/A for Gaudi
// ComputeCapability: N/A for Gaudi
}
summary := DeviceSummary{
ID: strconv.Itoa(deviceID),
ProductName: deviceInfo.DeviceName,
DriverVersion: deviceInfo.DriverVersion,
}
g.devices[deviceID] = GPUDevice{
ID: deviceID,
TritonInfo: tritonInfo,
Summary: summary,
}
logging.Debugf("Gaudi device %d: %+v", deviceID, tritonInfo)
}
return nil
}
func queryHLSMI() (map[int]HLSMIDevice, error) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
// TODO: Adjust command based on actual hl-smi capabilities
// Try JSON format first, fall back to CSV if needed
cmd := exec.CommandContext(ctx, "hl-smi", "-Q",
"memory.total,memory.free,name,driver_version,uuid,pci.bus_id",
"-f", "json")
output, err := cmd.Output()
if err != nil {
// Try alternative format/command
logging.Debugf("Failed to execute hl-smi with JSON: %v, trying alternative", err)
// TODO: Implement fallback parsing
return nil, fmt.Errorf("failed to execute hl-smi: %w", err)
}
// TODO: Parse actual JSON structure
// Structure depends on hl-smi output format
var result map[int]HLSMIDevice
if err := json.Unmarshal(output, &result); err != nil {
logging.Debugf("Failed to parse hl-smi JSON output: %v", err)
logging.Debugf("Raw output: %s", string(output))
return nil, fmt.Errorf("failed to parse hl-smi output: %w", err)
}
return result, nil
}
func (g *gpuGaudi) Shutdown() bool {
// No cleanup needed for CLI-based detection
return true
}
func (g *gpuGaudi) GetGPUInfo(gpuID int) (TritonGPUInfo, error) {
dev, exists := g.devices[gpuID]
if !exists {
return TritonGPUInfo{}, fmt.Errorf("GPU device %d not found", gpuID)
}
return dev.TritonInfo, nil
}
func (g *gpuGaudi) GetAllGPUInfo() ([]TritonGPUInfo, error) {
if len(g.tritonInfo) > 0 {
return g.tritonInfo, nil
}
var allTritonInfo []TritonGPUInfo
for _, dev := range g.devices {
allTritonInfo = append(allTritonInfo, dev.TritonInfo)
}
g.tritonInfo = allTritonInfo
return allTritonInfo, nil
}
func (g *gpuGaudi) GetSummary(gpuID int) (DeviceSummary, error) {
dev, exists := g.devices[gpuID]
if !exists {
return DeviceSummary{}, fmt.Errorf("GPU device %d not found", gpuID)
}
return dev.Summary, nil
}
func (g *gpuGaudi) GetAllSummaries() ([]DeviceSummary, error) {
if len(g.summaries) > 0 {
return g.summaries, nil
}
var allSummaries []DeviceSummary
for _, dev := range g.devices {
allSummaries = append(allSummaries, dev.Summary)
}
g.summaries = allSummaries
return allSummaries, nil
}
// Cache restoration methods (implement following AMD pattern)
func (g *gpuGaudi) SetName(name string) {
g.name = name
}
func (g *gpuGaudi) SetDeviceType(deviceType DeviceType) {
g.deviceType = deviceType
}
func (g *gpuGaudi) SetHwType(hwType string) {
g.hwType = hwType
}
func (g *gpuGaudi) SetTritonInfo(info []TritonGPUInfo) {
g.tritonInfo = info
g.devices = make(map[int]GPUDevice, len(info))
for _, tritonInfo := range info {
g.devices[tritonInfo.ID] = GPUDevice{
ID: tritonInfo.ID,
TritonInfo: tritonInfo,
}
}
}
func (g *gpuGaudi) SetSummaries(summaries []DeviceSummary) {
g.summaries = summaries
if g.devices != nil {
for _, summary := range summaries {
var gpuID int
if _, err := fmt.Sscanf(summary.ID, "%d", &gpuID); err == nil {
if dev, exists := g.devices[gpuID]; exists {
dev.Summary = summary
g.devices[gpuID] = dev
}
}
}
}
}When Gaudi hardware is available:
- Run all commands from "What I Need From You" section
- Send me the outputs
- I'll finalize the JSON parsing logic
- I'll complete the Triton field mappings
- We'll test device detection
- We'll build the container image
- We'll test end-to-end functionality
Current MCV implementations to reference:
-
AMD (CLI pattern):
/home/bmcfall/src/GKM/mcv/pkg/accelerator/devices/amd.go- Lines 258-290:
amdCheck()and device startup - Lines 375-410:
queryAMDSMI()- JSON parsing pattern - Most similar to what Gaudi needs
- Lines 258-290:
-
NVML (Library pattern):
/home/bmcfall/src/GKM/mcv/pkg/accelerator/devices/nvml.go- Lines 101-113:
nvmlCheck()and registration - Different pattern (library vs CLI), but shows Device interface implementation
- Lines 101-113:
-
Device Registry:
/home/bmcfall/src/GKM/mcv/pkg/accelerator/devices/device.go- Lines 34-43: DeviceType enum
- Lines 153-164: Device registration pattern
- Lines 286-356: Startup and cache restoration
Once you have Gaudi hardware access, ping me with the hl-smi output and we'll finalize the implementation!
Estimated Timeline: 1-2 days from receiving hardware output to working implementation.
Questions? Check the "What I Need From You" section for exactly what to run.