add vxpu
This commit is contained in:
17
vllm_kunlun/csrc/vxpu_offload/xpu_helper.h
Normal file
17
vllm_kunlun/csrc/vxpu_offload/xpu_helper.h
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user