hsakmt: Initial Commit for the HSA KMT Model

The over arching goal it so provide an API that pre-silicon models can latch into for software bring up.# Please enter the commit message for your changes. Lines starting


[ROCm/ROCR-Runtime commit: d4b85b6bf5]
This commit is contained in:
jordans
2025-03-11 16:56:02 -04:00
committad av Stratton, Jordan
förälder 9e8859636e
incheckning 938b34da24
20 ändrade filer med 1104 tillägg och 28 borttagningar
@@ -29,6 +29,7 @@
#define _GNU_SOURCE
#include "libhsakmt.h"
#include "hsakmt/hsakmtmodel.h"
#include <stdlib.h>
#include <sys/types.h>
@@ -174,7 +175,10 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtOpenKFD(void)
if (result != HSAKMT_STATUS_SUCCESS)
goto open_failed;
if (hsakmt_kfd_fd < 0) {
// Check if we are using the hsakmtmodel and setup initial state
model_init_env_vars();
if (hsakmt_kfd_fd < 0 && !hsakmt_use_model) {
fd = open(kfd_device_name, O_RDWR | O_CLOEXEC);
if (fd == -1) {
@@ -193,8 +197,9 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtOpenKFD(void)
useSvmStr = getenv("HSA_USE_SVM");
hsakmt_is_svm_api_supported = !(useSvmStr && !strcmp(useSvmStr, "0"));
result = hsakmt_topology_sysfs_get_system_props(&sys_props);
if(!hsakmt_use_model)
result = hsakmt_topology_sysfs_get_system_props(&sys_props);
if (result != HSAKMT_STATUS_SUCCESS)
goto topology_sysfs_failed;