You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are encountering an issue where the Habana Kubernetes Device Plugin does not respect the NUMA topology when allocating devices, even though the topologyManagerPolicy for Kubelet is set to restricted. This results in devices being allocated across different NUMA nodes, which negatively impacts performance and violates the expected behavior of the topology manager.
Steps to Reproduce:
Set the Kubelet topologyManagerPolicy to restricted.
Deploy a Pod requesting four Habana Gaudi devices.
Observe the allocated devices using hl-smi and check their NUMA node affinity.
Expected Behavior:
The Habana Device Plugin should allocate all requested devices from the same NUMA node, as specified by the restricted topology manager policy.
Actual Behavior:
The devices are allocated randomly across multiple NUMA nodes, as evidenced by the HABANA_VISIBLE_DEVICES environment variable and hl-smi output.
Logs and Evidence:
1. Device Plugin Registration Logs:
The logs confirm that the devices are correctly registered with their NUMA topology:
{"time":"2025-01-22T07:20:18.549489477Z","level":"INFO","msg":"Device cpu affinity","service":"habana-device-plugin","id":"0","cpu_affinity":0}
{"time":"2025-01-22T07:20:18.549508177Z","level":"INFO","msg":"Device found","service":"habana-device-plugin","device":"GAUDI","serial":"AN34021114","uuid":"01P0-HL2080A0-15-TK6V51-09-08-03","id":"0","pci_bus_id":"0000:bb:00.0"}
{"time":"2025-01-22T07:20:18.549527415Z","level":"INFO","msg":"Device cpu affinity","service":"habana-device-plugin","id":"0","cpu_affinity":1}
{"time":"2025-01-22T07:20:18.549543432Z","level":"INFO","msg":"Device found","service":"habana-device-plugin","device":"GAUDI","serial":"AN34020893","uuid":"01P0-HL2080A0-15-TK6V51-20-01-05","id":"0","pci_bus_id":"0000:9a:00.0"}
{"time":"2025-01-22T07:20:18.549560288Z","level":"INFO","msg":"Device cpu affinity","service":"habana-device-plugin","id":"0","cpu_affinity":1}
{"time":"2025-01-22T07:20:18.549574602Z","level":"INFO","msg":"Device found","service":"habana-device-plugin","device":"GAUDI","serial":"AN34020866","uuid":"01P0-HL2080A0-15-TK6V56-15-01-05","id":"0","pci_bus_id":"0000:5d:00.0"}
{"time":"2025-01-22T07:20:18.549601408Z","level":"INFO","msg":"Device cpu affinity","service":"habana-device-plugin","id":"0","cpu_affinity":0}
{"time":"2025-01-22T07:20:18.549616894Z","level":"INFO","msg":"Device found","service":"habana-device-plugin","device":"GAUDI","serial":"AN34021116","uuid":"01P0-HL2080A0-15-TK6V53-21-04-02","id":"0","pci_bus_id":"0000:ca:00.0"}
{"time":"2025-01-22T07:20:18.549633699Z","level":"INFO","msg":"Device cpu affinity","service":"habana-device-plugin","id":"0","cpu_affinity":1}
{"time":"2025-01-22T07:20:18.549649198Z","level":"INFO","msg":"Device found","service":"habana-device-plugin","device":"GAUDI","serial":"AN34020927","uuid":"01P0-HL2080A0-15-TK6V49-12-04-06","id":"0","pci_bus_id":"0000:4b:00.0"}
{"time":"2025-01-22T07:20:18.549668234Z","level":"INFO","msg":"Device cpu affinity","service":"habana-device-plugin","id":"0","cpu_affinity":0}
{"time":"2025-01-22T07:20:18.549681995Z","level":"INFO","msg":"Device found","service":"habana-device-plugin","device":"GAUDI","serial":"AN34021108","uuid":"01P0-HL2080A0-15-TK6V56-10-06-00","id":"0","pci_bus_id":"0000:db:00.0"}
{"time":"2025-01-22T07:20:18.54969921Z","level":"INFO","msg":"Device cpu affinity","service":"habana-device-plugin","id":"0","cpu_affinity":1}
{"time":"2025-01-22T07:20:18.549715112Z","level":"INFO","msg":"Device found","service":"habana-device-plugin","device":"GAUDI","serial":"AN34020915","uuid":"01P0-HL2080A0-15-TK6V52-15-02-02","id":"0","pci_bus_id":"0000:18:00.0"}
{"time":"2025-01-22T07:20:18.549732578Z","level":"INFO","msg":"Device cpu affinity","service":"habana-device-plugin","id":"0","cpu_affinity":0}
2. Allocation Logs:
The logs show that the Device Plugin processes the allocation request:
{"time":"2025-01-22T07:25:51.465964458Z","level":"INFO","msg":"Preparing device for registration","service":"habana-device-plugin","device":{"ID":"AN34020915","health":"Healthy","topology":{"nodes":[{}]}}}
{"time":"2025-01-22T07:25:51.46608777Z","level":"INFO","msg":"Getting device handle from hlml","service":"habana-device-plugin"}
{"time":"2025-01-22T07:25:51.466123889Z","level":"INFO","msg":"Getting device minor number","service":"habana-device-plugin"}
{"time":"2025-01-22T07:25:51.466129542Z","level":"INFO","msg":"Getting device module id","service":"habana-device-plugin"}
{"time":"2025-01-22T07:25:51.466291215Z","level":"INFO","msg":"Preparing device for registration","service":"habana-device-plugin","device":{"ID":"AN34020872","health":"Healthy","topology":{"nodes":[{}]}}}
{"time":"2025-01-22T07:25:51.466305474Z","level":"INFO","msg":"Getting device handle from hlml","service":"habana-device-plugin"}
{"time":"2025-01-22T07:25:51.466308218Z","level":"INFO","msg":"Getting device minor number","service":"habana-device-plugin"}
{"time":"2025-01-22T07:25:51.466310175Z","level":"INFO","msg":"Getting device module id","service":"habana-device-plugin"}
{"time":"2025-01-22T07:25:51.4663575Z","level":"INFO","msg":"Preparing device for registration","service":"habana-device-plugin","device":{"ID":"AN34020866","health":"Healthy","topology":{"nodes":[{}]}}}
{"time":"2025-01-22T07:25:51.466361044Z","level":"INFO","msg":"Getting device handle from hlml","service":"habana-device-plugin"}
{"time":"2025-01-22T07:25:51.46636571Z","level":"INFO","msg":"Getting device minor number","service":"habana-device-plugin"}
{"time":"2025-01-22T07:25:51.466367695Z","level":"INFO","msg":"Getting device module id","service":"habana-device-plugin"}
{"time":"2025-01-22T07:25:51.466406187Z","level":"INFO","msg":"Preparing device for registration","service":"habana-device-plugin","device":{"ID":"AN34020927","health":"Healthy","topology":{"nodes":[{}]}}}
{"time":"2025-01-22T07:25:51.466410268Z","level":"INFO","msg":"Getting device handle from hlml","service":"habana-device-plugin"}
{"time":"2025-01-22T07:25:51.46641678Z","level":"INFO","msg":"Getting device minor number","service":"habana-device-plugin"}
{"time":"2025-01-22T07:25:51.46641866Z","level":"INFO","msg":"Getting device module id","service":"habana-device-plugin"}
Notice: At this time, AN34020915, AN34020872, AN34020866, and AN34020927 have been correctly processed. These cards are all on NUMA 0.
AN34020915: index 0 module_id 6
AN34020872: index 2 module_id 7
AN34020866: index 4 module_id 5
AN34020927: index 5 module_id 4 bus_id: 0000:5d:00.0
4. Container Environment Variables and hl-smi Output:
The HABANA_VISIBLE_DEVICES environment variable in the container shows incorrect device allocation:
sudo ctr -n k8s.io c info 5dd335cec1fc1436539facc3fd3d6efb1203dc4ad234bc1c05341554c9c9a02e | grep HABANA
WARN[0000] DEPRECATION: The `mirrors` property of `[plugins."io.containerd.grpc.v1.cri".registry]` is deprecated since containerd v1.5 and will be removed in containerd v2.0. Use `config_path` instead.
WARN[0000] DEPRECATION: The `configs` property of `[plugins."io.containerd.grpc.v1.cri".registry]` is deprecated since containerd v1.5 and will be removed in containerd v2.0. Use `config_path` instead.
"HABANA_LOGS=/var/log/habana_logs/",
"HABANA_SCAL_BIN_PATH=/opt/habanalabs/engines_fw",
"HABANA_PLUGINS_LIB_PATH=/opt/habanalabs/habana_plugins",
"HABANA_VISIBLE_DEVICES=7,0,3,5",
"HABANA_VISIBLE_MODULES=6,7,5,4",
The card with Bus-Id=0000:5d:00.0 should be used, but not!
Root Cause Analysis:
After reviewing the Device Plugin source code, it appears that the issue stems from the use of minor numbers to populate the HABANA_VISIBLE_DEVICES environment variable. Instead, the index should be used to ensure NUMA-aware allocation.
This issue significantly impacts performance-sensitive workloads that rely on NUMA locality. It also undermines the effectiveness of Kubernetes' topology management features.
The text was updated successfully, but these errors were encountered:
We are encountering an issue where the Habana Kubernetes Device Plugin does not respect the NUMA topology when allocating devices, even though the
topologyManagerPolicy
for Kubelet is set torestricted
. This results in devices being allocated across different NUMA nodes, which negatively impacts performance and violates the expected behavior of the topology manager.Steps to Reproduce:
topologyManagerPolicy
torestricted
.hl-smi
and check their NUMA node affinity.Expected Behavior:
The Habana Device Plugin should allocate all requested devices from the same NUMA node, as specified by the
restricted
topology manager policy.Actual Behavior:
The devices are allocated randomly across multiple NUMA nodes, as evidenced by the
HABANA_VISIBLE_DEVICES
environment variable andhl-smi
output.Logs and Evidence:
1. Device Plugin Registration Logs:
The logs confirm that the devices are correctly registered with their NUMA topology:
2. Allocation Logs:
The logs show that the Device Plugin processes the allocation request:
Notice: At this time, AN34020915, AN34020872, AN34020866, and AN34020927 have been correctly processed. These cards are all on NUMA 0.
3.
hl-smi
Output:AN34020915: index 0 module_id 6
AN34020872: index 2 module_id 7
AN34020866: index 4 module_id 5
AN34020927: index 5 module_id 4 bus_id: 0000:5d:00.0
4. Container Environment Variables and
hl-smi
Output:The
HABANA_VISIBLE_DEVICES
environment variable in the container shows incorrect device allocation:The card with Bus-Id=0000:5d:00.0 should be used, but not!
Root Cause Analysis:
After reviewing the Device Plugin source code, it appears that the issue stems from the use of
minor
numbers to populate theHABANA_VISIBLE_DEVICES
environment variable. Instead, theindex
should be used to ensure NUMA-aware allocation.Relevant Code Snippet:
Suggested Fix:
index
instead ofminor
when setting theHABANA_VISIBLE_DEVICES
environment variable.Additional Context:
Impact:
This issue significantly impacts performance-sensitive workloads that rely on NUMA locality. It also undermines the effectiveness of Kubernetes' topology management features.
The text was updated successfully, but these errors were encountered: