This commit is contained in:
starkwj
2026-02-05 19:36:06 +08:00
parent 070bfa4a73
commit e273ef01b8
131 changed files with 28539 additions and 2 deletions

View File

@@ -0,0 +1,17 @@
#pragma once
#include "spdlog/spdlog.h"
#include <stdint.h>
#include "xpu/runtime.h"
static inline uint32_t get_device_pci_addr(int device_id) {
uint64_t v;
int ret = xpu_device_get_attr(&v, XPUATTR_PCI_ADDRESS, device_id);
if (ret != XPU_SUCCESS) {
spdlog::error("Failed to get PCI address for device {}: {}", device_id,
xpu_strerror(ret));
return static_cast<uint32_t>(-1);
}
return static_cast<uint32_t>(v);
}