Use mwaitx when busy-waiting signals
Use mwaitx instructions when busy waiting for signals to reduce CPU energy usage. This can be disabled by setting HSA_ENABLE_MWAITX=0 Change-Id: Ic207895a491b2bf6dacba47ef0921df3faad5b5a
This commit is contained in:
@@ -71,6 +71,7 @@ const char rocrbuildid[] __attribute__((used)) = "ROCR BUILD ID: " STRING(ROCR_B
|
||||
namespace rocr {
|
||||
namespace core {
|
||||
bool g_use_interrupt_wait = true;
|
||||
bool g_use_mwaitx = true;
|
||||
|
||||
Runtime* Runtime::runtime_singleton_ = NULL;
|
||||
|
||||
@@ -680,6 +681,10 @@ hsa_status_t Runtime::GetSystemInfo(hsa_system_info_t attribute, void* value) {
|
||||
*(bool*)value = ret;
|
||||
break;
|
||||
}
|
||||
case HSA_AMD_SYSTEM_INFO_MWAITX_ENABLED: {
|
||||
*((bool*)value) = g_use_mwaitx;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return HSA_STATUS_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
@@ -1405,6 +1410,7 @@ hsa_status_t Runtime::Load() {
|
||||
|
||||
flag_.Refresh();
|
||||
g_use_interrupt_wait = flag_.enable_interrupt();
|
||||
g_use_mwaitx = flag_.check_mwaitx(cpuinfo.mwaitx);
|
||||
|
||||
if (!AMD::Load()) {
|
||||
return HSA_STATUS_ERROR_OUT_OF_RESOURCES;
|
||||
|
||||
Reference in New Issue
Block a user