SWDEV-533074 - Expose hipDeviceAttributeNumberOfXccs attribute (#336)
[ROCm/clr commit: 5cc172c99c]
This commit is contained in:
committed by
GitHub
parent
1cc35da9be
commit
fc2f5aaf22
@@ -445,6 +445,9 @@ hipError_t hipDeviceGetAttribute(int* pi, hipDeviceAttribute_t attr, int device)
|
||||
case hipDeviceAttributeAccessPolicyMaxWindowSize:
|
||||
*pi = prop.accessPolicyMaxWindowSize;
|
||||
break;
|
||||
case hipDeviceAttributeNumberOfXccs:
|
||||
*pi = static_cast<int>(g_devices[device]->devices()[0]->info().numberOfXccs_);
|
||||
break;
|
||||
default:
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
@@ -725,6 +725,8 @@ Device::Device()
|
||||
vaCacheMap_(nullptr),
|
||||
index_(0) {
|
||||
memset(&info_, '\0', sizeof(info_));
|
||||
// By default consider just 1 xcc per device
|
||||
info_.numberOfXccs_ = 1;
|
||||
}
|
||||
|
||||
Device::~Device() {
|
||||
|
||||
@@ -661,6 +661,8 @@ struct Info : public amd::EmbeddedObject {
|
||||
|
||||
size_t scratchLimitMin; //! Minimum size of scratch limit of this device memory in bytes.
|
||||
size_t scratchLimitMax; //! Maximum size of scratch limit of this device memory in bytes.
|
||||
|
||||
uint32_t numberOfXccs_; //! The number of XCC(s) on the device
|
||||
};
|
||||
|
||||
//! Device settings
|
||||
|
||||
@@ -1668,6 +1668,11 @@ bool Device::populateOCLDeviceConstants() {
|
||||
LogError("HSA_AMD_AGENT_INFO_SVM_DIRECT_HOST_ACCESS query failed.");
|
||||
}
|
||||
|
||||
if (HSA_STATUS_SUCCESS != hsa_agent_get_info(bkendDevice_,
|
||||
static_cast<hsa_agent_info_t>(HSA_AMD_AGENT_INFO_NUM_XCC), &info_.numberOfXccs_)) {
|
||||
LogError("HSA_AMD_AGENT_INFO_NUM_XCC query failed.");
|
||||
}
|
||||
|
||||
ClPrint(amd::LOG_INFO, amd::LOG_INIT, "Gfx Major/Minor/Stepping: %d/%d/%d", isa().versionMajor(),
|
||||
isa().versionMinor(), isa().versionStepping());
|
||||
ClPrint(amd::LOG_INFO, amd::LOG_INIT, "HMM support: %d, XNACK: %d, Direct host access: %d",
|
||||
|
||||
Reference in New Issue
Block a user