#pragma once #include "spdlog/spdlog.h" #include #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(-1); } return static_cast(v); }