Skip to content
This repository was archived by the owner on Jan 26, 2024. It is now read-only.

Commit 20ffce7

Browse files
committed
Add ROCr queries for HMM support
Change-Id: I2b5508bf0faf8f48dd7348d6a5202fb28de09876
1 parent 2bcb638 commit 20ffce7

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

device/device.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,10 @@ struct Info : public amd::EmbeddedObject {
556556

557557
//! Target ID string
558558
char targetId_[0x40];
559+
560+
uint32_t hmmSupported_; //!< ROCr supports HMM interfaces
561+
uint32_t hmmCpuMemoryAccessible_; //!< CPU memory is accessible by GPU without pinning/register
562+
uint32_t hmmDirectHostAccess_; //!< HMM memory is accessible from the host without migration
559563
};
560564

561565
//! Device settings

device/rocm/rocdevice.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1418,7 +1418,7 @@ bool Device::populateOCLDeviceConstants() {
14181418
return false;
14191419
}
14201420

1421-
uint32_t asic_revision;
1421+
uint32_t asic_revision = 0;
14221422
if (HSA_STATUS_SUCCESS !=
14231423
hsa_agent_get_info(_bkendDevice,
14241424
static_cast<hsa_agent_info_t>(HSA_AMD_AGENT_INFO_ASIC_REVISION),
@@ -1470,6 +1470,21 @@ bool Device::populateOCLDeviceConstants() {
14701470
? (atoi(sgprValue.c_str()))
14711471
: 0;
14721472
}
1473+
1474+
#if AMD_HMM_SUPPORT
1475+
// Generic support for HMM interfaces
1476+
if (HSA_STATUS_SUCCESS != hsa_system_get_info(HSA_AMD_SYSTEM_INFO_SVM_SUPPORTED,
1477+
&info_.hmmSupported_)) {
1478+
LogError("HSA_AMD_SYSTEM_INFO_SVM_SUPPORTED query failed. HMM will be disabled");
1479+
}
1480+
1481+
// This capability should be available with xnack enabled
1482+
if (HSA_STATUS_SUCCESS != hsa_system_get_info(HSA_AMD_SYSTEM_INFO_SVM_ACCESSIBLE_BY_DEFAULT,
1483+
&info_.hmmCpuMemoryAccessible_)) {
1484+
LogError("HSA_AMD_SYSTEM_INFO_SVM_ACCESSIBLE_BY_DEFAULT query failed.");
1485+
}
1486+
#endif // AMD_HMM_SUPPORT
1487+
14731488
return true;
14741489
}
14751490

0 commit comments

Comments
 (0)