Add HSA_AMD_AGENT_INFO_COOPERATIVE_COMPUTE_UNIT_COUNT.

On gfx90a only a reduced number of CUs must be used for cooperative
dispatches due to CWSR and launcher interactions with asymetric
harvest.  We must use one fewer CUs per SE than the lowest count of
CUs on any SE.

Also adds env var HSA_COOP_CU_COUNT which enables the cooperative
CU count computation.  Set to 1 to enable the new computation.
This is an opt-in feature that will become enabled by default (opt-out)
in a future release.

Change-Id: Ifbb75ced3bbc15876eef44922c6a4f6fde8c4c28


[ROCm/ROCR-Runtime commit: 37942c982a]
此提交包含在:
Sean Keely
2022-01-15 10:39:38 -06:00
父節點 df788f1e49
當前提交 e2e10173d2
共有 4 個檔案被更改,包括 27 行新增 和 2 行删除
+1 -1
查看文件
@@ -85,7 +85,7 @@ if (ROCM_CCACHE_BUILD)
endif() # if (ROCM_CCACHE_BUILD)
## Get version strings
get_version ( "1.4.0" )
get_version ( "1.5.0" )
if ( ${ROCM_PATCH_VERSION} )
set ( VERSION_PATCH ${ROCM_PATCH_VERSION})
endif()
+11
查看文件
@@ -1010,6 +1010,17 @@ hsa_status_t GpuAgent::GetInfo(hsa_agent_info_t attribute, void* value) const {
case HSA_AMD_AGENT_INFO_SVM_DIRECT_HOST_ACCESS:
assert(regions_.size() != 0 && "No device local memory found!");
*((bool*)value) = properties_.Capability.ui32.CoherentHostAccess == 1;
case HSA_AMD_AGENT_INFO_COOPERATIVE_COMPUTE_UNIT_COUNT:
if (core::Runtime::runtime_singleton_->flag().coop_cu_count() &&
(isa_->GetMajorVersion() == 9) && (isa_->GetMinorVersion() == 0) &&
(isa_->GetStepping() == 10)) {
uint32_t count = 0;
hsa_status_t err = GetInfo((hsa_agent_info_t)HSA_AMD_AGENT_INFO_COMPUTE_UNIT_COUNT, &count);
assert(err == HSA_STATUS_SUCCESS && "CU count query failed.");
*((uint32_t*)value) = (count & 0xFFFFFFF8) - 8; // value = floor(count/8)*8-8
break;
}
return GetInfo((hsa_agent_info_t)HSA_AMD_AGENT_INFO_COMPUTE_UNIT_COUNT, value);
default:
return HSA_STATUS_ERROR_INVALID_ARGUMENT;
break;
+8
查看文件
@@ -148,6 +148,11 @@ class Flag {
var = os::GetEnvVar("HSA_CU_MASK_SKIP_INIT");
cu_mask_skip_init_ = (var == "1") ? true : false;
// Temporary opt-in for corrected HSA_AMD_AGENT_INFO_COOPERATIVE_COMPUTE_UNIT_COUNT behavior.
// Will become opt-out and possibly removed in future releases.
var = os::GetEnvVar("HSA_COOP_CU_COUNT");
coop_cu_count_ = (var == "1") ? true : false;
}
void parse_masks(uint32_t maxGpu, uint32_t maxCU) {
@@ -214,6 +219,8 @@ class Flag {
bool cu_mask_skip_init() const { return cu_mask_skip_init_; }
bool coop_cu_count() const { return coop_cu_count_; }
private:
bool check_flat_scratch_;
bool enable_vm_fault_message_;
@@ -233,6 +240,7 @@ class Flag {
bool check_sramecc_validity_;
bool debug_;
bool cu_mask_skip_init_;
bool coop_cu_count_;
SDMA_OVERRIDE enable_sdma_;
+7 -1
查看文件
@@ -311,7 +311,13 @@ typedef enum hsa_amd_agent_info_s {
* physically resident in the agent's local memory.
* The type of this attribute is bool.
*/
HSA_AMD_AGENT_INFO_SVM_DIRECT_HOST_ACCESS = 0xA013
HSA_AMD_AGENT_INFO_SVM_DIRECT_HOST_ACCESS = 0xA013,
/**
* Some processors support more CUs than can reliably be used in a cooperative
* dispatch. This queries the count of CUs which are fully enabled for
* cooperative dispatch.
*/
HSA_AMD_AGENT_INFO_COOPERATIVE_COMPUTE_UNIT_COUNT = 0xA014
} hsa_amd_agent_info_t;
typedef struct hsa_amd_hdp_flush_s {