Add query for Xnack enabled

Add system query for whether Xnack is enabled on a system.

Change-Id: I2832110e4f33f6a951d13acd06636442debf27ae


[ROCm/ROCR-Runtime commit: 22becfb1e8]
This commit is contained in:
David Yat Sin
2023-09-19 00:25:30 +00:00
parent d04acccc26
commit 48cb2f5a9e
4 changed files with 13 additions and 0 deletions
@@ -455,6 +455,8 @@ class Runtime {
KfdVersion_t KfdVersion() const { return kfd_version; }
bool VirtualMemApiSupported() const { return virtual_mem_api_supported_; }
bool XnackEnabled() const { return xnack_enabled_; }
void XnackEnabled(bool enable) { xnack_enabled_ = enable; }
protected:
static void AsyncEventsLoop(void*);
@@ -708,6 +710,7 @@ class Runtime {
int GetAmdgpuDeviceArgs(Agent* agent, amdgpu_bo_handle bo, int* drm_fd, uint64_t* cpu_addr);
bool virtual_mem_api_supported_;
bool xnack_enabled_;
typedef void* ThunkHandle;
@@ -351,6 +351,7 @@ void BuildTopology() {
// Determine the Xnack mode to be bound for system
bool xnack_mode = BindXnackMode();
core::Runtime::runtime_singleton_->XnackEnabled(xnack_mode);
// Instantiate ROCr objects to encapsulate Gpu devices
SurfaceGpuList(gpu_usr_list, xnack_mode, true);
@@ -709,6 +709,10 @@ hsa_status_t Runtime::GetSystemInfo(hsa_system_info_t attribute, void* value) {
*((bool*)value) = core::Runtime::runtime_singleton_->VirtualMemApiSupported();
break;
}
case HSA_AMD_SYSTEM_INFO_XNACK_ENABLED: {
*((bool*)value) = core::Runtime::runtime_singleton_->XnackEnabled();
break;
}
default:
return HSA_STATUS_ERROR_INVALID_ARGUMENT;
}
@@ -514,6 +514,11 @@ typedef enum {
* this attribute is bool.
*/
HSA_AMD_SYSTEM_INFO_VIRTUAL_MEM_API_SUPPORTED = 0x205,
/**
* Returns true if XNACK is enabled on this system. The type of
* this attribute is bool.
*/
HSA_AMD_SYSTEM_INFO_XNACK_ENABLED = 0x206,
} hsa_system_info_t;
/**