Deprecated PASID

Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
Change-Id: Ib008f80f3d736172079358c0ceb3ebca87340d28


[ROCm/amdsmi commit: c89b5db09d]
This commit is contained in:
Maisam Arif
2025-05-30 19:47:41 -05:00
committed by Arif, Maisam
orang tua 16d60f3411
melakukan 00ad72baf9
9 mengubah file dengan 9 tambahan dan 69 penghapusan
@@ -3415,7 +3415,7 @@ Output: List of python dicts each containing a process information
Field | Description
---|---
`process_id` | Process ID
`pasid` | PASID (Not working in ROCm 6.4+, deprecating in 7.0)
`pasid` | PASID (Not working in ROCm 6.4+, Deprecated in 7.0)
`vram_usage` | VRAM usage
`sdma_usage` | SDMA usage in microseconds
`cu_occupancy` | Compute Unit usage in percents
@@ -2035,7 +2035,6 @@ typedef struct {
*/
typedef struct {
uint32_t process_id; //!< Process ID
uint32_t pasid; //!< PASID (Not working in ROCm 6.4+, deprecating in 7.0)
uint64_t vram_usage; //!< VRAM usage in MB
uint64_t sdma_usage; //!< SDMA usage in microseconds
uint32_t cu_occupancy; //!< Compute Unit usage in percent
@@ -4836,7 +4836,6 @@ def amdsmi_get_gpu_compute_process_info() -> List[Dict[str, int]]:
return [
{
"process_id": proc.process_id,
"pasid": proc.pasid, # Not working in ROCm 6.4+, deprecating in 7.0
"vram_usage": proc.vram_usage,
"sdma_usage": proc.sdma_usage,
"cu_occupancy": proc.cu_occupancy,
@@ -4858,7 +4857,6 @@ def amdsmi_get_gpu_compute_process_info_by_pid(pid: int) -> Dict[str, int]:
return {
"process_id": proc.process_id,
"pasid": proc.pasid, # Not working in ROCm 6.4+, deprecating in 7.0
"vram_usage": proc.vram_usage,
"sdma_usage": proc.sdma_usage,
"cu_occupancy": proc.cu_occupancy,
@@ -2085,11 +2085,11 @@ class struct_amdsmi_process_info_t(Structure):
struct_amdsmi_process_info_t._pack_ = 1 # source:False
struct_amdsmi_process_info_t._fields_ = [
('process_id', ctypes.c_uint32),
('pasid', ctypes.c_uint32),
('PADDING_0', ctypes.c_ubyte * 4),
('vram_usage', ctypes.c_uint64),
('sdma_usage', ctypes.c_uint64),
('cu_occupancy', ctypes.c_uint32),
('PADDING_0', ctypes.c_ubyte * 4),
('PADDING_1', ctypes.c_ubyte * 4),
]
amdsmi_process_info_t = struct_amdsmi_process_info_t
@@ -1406,7 +1406,6 @@ typedef struct {
*/
typedef struct {
uint32_t process_id; //!< Process ID
uint32_t pasid; //!< PASID: (Process Address Space ID) (Not working in ROCm 6.4+, deprecating in 7.0)
uint64_t vram_usage; //!< VRAM usage
uint64_t sdma_usage; //!< SDMA usage in microseconds
uint32_t cu_occupancy; //!< Compute Unit usage in percent
@@ -50,8 +50,6 @@ namespace smi {
static const char *kKFDProcPathRoot = "/sys/class/kfd/kfd/proc";
static const char *kKFDNodesPathRoot = "/sys/class/kfd/kfd/topology/nodes";
// Sysfs file names
static const char *kKFDPasidFName = "pasid";
@@ -302,29 +300,8 @@ int GetProcessInfo(rsmi_process_info_t *procs, uint32_t num_allocated,
continue;
}
if (procs && *num_procs_found < num_allocated) {
int err;
std::string tmp;
procs[*num_procs_found].process_id =
static_cast<uint32_t>(std::stoi(proc_id_str));
std::string pasid_str_path = kKFDProcPathRoot;
pasid_str_path += "/";
pasid_str_path += proc_id_str;
pasid_str_path += "/";
pasid_str_path += kKFDPasidFName;
err = ReadSysfsStr(pasid_str_path, &tmp);
if (err) {
dentry = readdir(proc_dir);
continue;
}
assert(is_number(tmp) && "Unexpected value in pasid file");
if (!is_number(tmp)) {
closedir(proc_dir);
return EINVAL;
}
procs[*num_procs_found].pasid = static_cast<uint32_t>(std::stoi(tmp));
}
++(*num_procs_found);
@@ -437,21 +414,6 @@ int GetProcessInfoForPID(uint32_t pid, rsmi_process_info_t *proc,
}
proc->process_id = pid;
std::string pasid_str_path = proc_str_path;
pasid_str_path += "/";
pasid_str_path += kKFDPasidFName;
err = ReadSysfsStr(pasid_str_path, &tmp);
if (err) {
return err;
}
assert(is_number(tmp) && "Unexpected value in pasid file");
if (!is_number(tmp)) {
return EINVAL;
}
proc->pasid = static_cast<uint32_t>(std::stoi(tmp));
proc->vram_usage = 0;
proc->sdma_usage = 0;
proc->cu_occupancy = 0;
@@ -2280,7 +2280,6 @@ const _: () = {
#[derive(Debug, Copy, Clone)]
pub struct AmdsmiProcessInfoT {
pub process_id: u32,
pub pasid: u32,
pub vram_usage: u64,
pub sdma_usage: u64,
pub cu_occupancy: u32,
@@ -2291,14 +2290,12 @@ const _: () = {
["Alignment of AmdsmiProcessInfoT"][::std::mem::align_of::<AmdsmiProcessInfoT>() - 8usize];
["Offset of field: AmdsmiProcessInfoT::process_id"]
[::std::mem::offset_of!(AmdsmiProcessInfoT, process_id) - 0usize];
["Offset of field: AmdsmiProcessInfoT::pasid"]
[::std::mem::offset_of!(AmdsmiProcessInfoT, pasid) - 4usize];
["Offset of field: AmdsmiProcessInfoT::vram_usage"]
[::std::mem::offset_of!(AmdsmiProcessInfoT, vram_usage) - 8usize];
[::std::mem::offset_of!(AmdsmiProcessInfoT, vram_usage) - 4usize];
["Offset of field: AmdsmiProcessInfoT::sdma_usage"]
[::std::mem::offset_of!(AmdsmiProcessInfoT, sdma_usage) - 16usize];
[::std::mem::offset_of!(AmdsmiProcessInfoT, sdma_usage) - 12usize];
["Offset of field: AmdsmiProcessInfoT::cu_occupancy"]
[::std::mem::offset_of!(AmdsmiProcessInfoT, cu_occupancy) - 24usize];
[::std::mem::offset_of!(AmdsmiProcessInfoT, cu_occupancy) - 20usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
+1 -14
Melihat File
@@ -136,10 +136,6 @@ amdsmi_status_t gpuvsmi_get_pid_info(const amdsmi_bdf_t &bdf, long int pid,
d = opendir(path.c_str());
if (!d) return AMDSMI_STATUS_NO_PERM;
/* Vectors to check if repated fd pasid */
// TODO remove pasid Not working in ROCm 6.4+, deprecating in 7.0
std::vector<int> pasids;
memset(&info, 0, sizeof(info));
/* Iterate through all fdinfos */
while ((dir = readdir(d)) != NULL) {
@@ -159,12 +155,7 @@ amdsmi_status_t gpuvsmi_get_pid_info(const amdsmi_bdf_t &bdf, long int pid,
std::ifstream fdinfo(file.c_str());
for (std::string line; getline(fdinfo, line);) {
if (line.find("pasid:") != std::string::npos) {
int pasid;
if (sscanf(line.c_str(), "pasid: %d", &pasid) != 1) continue;
auto it = std::find(pasids.begin(), pasids.end(), pasid);
if (it == pasids.end()) pasids.push_back(pasid);
} else if (line.find("drm-memory-gtt:") != std::string::npos) {
if (line.find("drm-memory-gtt:") != std::string::npos) {
unsigned long mem;
if (sscanf(line.c_str(), "drm-memory-gtt: %" PRIu64, &mem) != 1) continue;
info.mem += mem * 1000;
@@ -223,10 +214,6 @@ amdsmi_status_t gpuvsmi_get_pid_info(const amdsmi_bdf_t &bdf, long int pid,
}
info.pid = (uint32_t)pid;
if (!pasids.size()) {
return AMDSMI_STATUS_NOT_FOUND;
}
return AMDSMI_STATUS_SUCCESS;
}
@@ -34,7 +34,7 @@
TestProcInfoRead::TestProcInfoRead() : TestBase() {
set_title("AMDSMI Process Info Read Test");
set_description("This test verifies that process information such as the "
"process ID, PASID, etc. can be read properly.");
"process ID, etc. can be read properly.");
}
TestProcInfoRead::~TestProcInfoRead(void) {
@@ -64,10 +64,9 @@ void TestProcInfoRead::Close() {
static void dumpProcess(amdsmi_process_info_t *p) {
assert(p != nullptr);
std::cout << "\t** ProcessID: " << p->process_id << " ";
// TODO remove pasid Not working in ROCm 6.4+, deprecating in 7.0
std::cout << "PASID: " << p->pasid << " ";
std::cout << std::endl;
}
void TestProcInfoRead::Run(void) {
amdsmi_status_t err;
uint32_t num_proc_found;
@@ -180,7 +179,6 @@ void TestProcInfoRead::Run(void) {
} else {
CHK_ERR_ASRT(err)
ASSERT_EQ(proc_info.process_id, procs[j].process_id);
ASSERT_EQ(proc_info.pasid, procs[j].pasid);
std::cout << "\t** Process ID: " <<
procs[j].process_id << " VRAM Usage: " <<
proc_info.vram_usage <<