Skip to content

Commit 96f5c44

Browse files
committed
SWDEV-451166 - Disable kernel args for non-XGMI if HDP flush register is invalid
Change-Id: I227e046e2b9cb25476a50240f5d070adbd558f21
1 parent 476dc4c commit 96f5c44

File tree

5 files changed

+41
-20
lines changed

5 files changed

+41
-20
lines changed

hipamd/src/hip_graph_internal.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,9 +396,17 @@ hipError_t GraphExec::CaptureAQLPackets() {
396396
}
397397

398398
if (device_kernarg_pool_ && !device->isXgmi()) {
399-
*device->info().hdpMemFlushCntl = 1u;
400-
if (*device->info().hdpMemFlushCntl != UINT32_MAX) {
401-
LogError("Unexpected HDP Register readback value!");
399+
if (device->info().hdpMemFlushCntl != nullptr) {
400+
*device->info().hdpMemFlushCntl = 1u;
401+
if (*device->info().hdpMemFlushCntl != UINT32_MAX) {
402+
LogError("Unexpected HDP Register readback value!");
403+
}
404+
} else {
405+
amd::Command* command = new amd::Marker(*capture_stream_, true);
406+
if (command != nullptr) {
407+
command->enqueue();
408+
command->release();
409+
}
402410
}
403411
}
404412

rocclr/device/rocm/rocdevice.cpp

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,27 @@ bool Device::create() {
705705
return false;
706706
}
707707

708+
setupCpuAgent();
709+
710+
// Get Agent HDP Flush Register Memory
711+
hsa_amd_hdp_flush_t hdpInfo;
712+
if (HSA_STATUS_SUCCESS !=
713+
hsa_agent_get_info(bkendDevice_,
714+
static_cast<hsa_agent_info_t>(HSA_AMD_AGENT_INFO_HDP_FLUSH), &hdpInfo)) {
715+
LogPrintfError("Unable to determine HDP flush info for HSA device %s", agent_name);
716+
return false;
717+
}
718+
719+
info_.hdpMemFlushCntl = hdpInfo.HDP_MEM_FLUSH_CNTL;
720+
info_.hdpRegFlushCntl = hdpInfo.HDP_REG_FLUSH_CNTL;
721+
722+
bool device_kernel_args = true;
723+
if (!isXgmi_ && ((info_.hdpMemFlushCntl == nullptr) || (info_.hdpRegFlushCntl == nullptr))) {
724+
LogWarning("Unable to determine HDP flush register address. "
725+
"Device kernel arguments are not supported");
726+
device_kernel_args = false;
727+
}
728+
708729
// Create HSA settings
709730
assert(!settings_);
710731
roc::Settings* hsaSettings = new roc::Settings();
@@ -713,7 +734,7 @@ bool Device::create() {
713734
!hsaSettings->create((agent_profile_ == HSA_PROFILE_FULL), isa->versionMajor(),
714735
isa->versionMinor(), isa->versionStepping(),
715736
isa->xnack() == amd::Isa::Feature::Enabled,
716-
coop_groups)) {
737+
coop_groups, device_kernel_args)) {
717738
LogPrintfError("Unable to create settings for HSA device %s (PCI ID %x)", agent_name,
718739
pciDeviceId_);
719740
return false;
@@ -754,17 +775,6 @@ bool Device::create() {
754775
}
755776
info_.pciDomainID = pci_domain_id;
756777

757-
// Get Agent HDP Flush Register Memory
758-
hsa_amd_hdp_flush_t hdpInfo;
759-
if (HSA_STATUS_SUCCESS !=
760-
hsa_agent_get_info(bkendDevice_,
761-
static_cast<hsa_agent_info_t>(HSA_AMD_AGENT_INFO_HDP_FLUSH), &hdpInfo)) {
762-
LogPrintfError("Unable to determine HDP flush info for HSA device %s", agent_name);
763-
return false;
764-
}
765-
info_.hdpMemFlushCntl = hdpInfo.HDP_MEM_FLUSH_CNTL;
766-
info_.hdpRegFlushCntl = hdpInfo.HDP_REG_FLUSH_CNTL;
767-
768778
if (populateOCLDeviceConstants() == false) {
769779
LogPrintfError("populateOCLDeviceConstants failed for HSA device %s (PCI ID %x)", agent_name,
770780
pciDeviceId_);
@@ -1257,7 +1267,6 @@ bool Device::populateOCLDeviceConstants() {
12571267
engineAssignMap_[1 << i] = 0;
12581268
}
12591269

1260-
setupCpuAgent();
12611270

12621271
checkAtomicSupport();
12631272

rocclr/device/rocm/rocsettings.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ Settings::Settings() {
102102

103103
// ================================================================================================
104104
bool Settings::create(bool fullProfile, uint32_t gfxipMajor, uint32_t gfxipMinor,
105-
uint32_t gfxStepping, bool enableXNACK, bool coop_groups) {
105+
uint32_t gfxStepping, bool enableXNACK, bool coop_groups,
106+
bool device_kernel_args) {
106107
customHostAllocator_ = false;
107108

108109
if (fullProfile) {
@@ -168,7 +169,7 @@ bool Settings::create(bool fullProfile, uint32_t gfxipMajor, uint32_t gfxipMinor
168169
// Enable device kernel args for MI300* for now
169170
if (gfxipMajor == 9 && gfxipMinor == 4 &&
170171
(gfxStepping == 0 || gfxStepping == 1 || gfxStepping == 2)) {
171-
device_kernel_args_ = HIP_FORCE_DEV_KERNARG;
172+
device_kernel_args_ = HIP_FORCE_DEV_KERNARG && device_kernel_args;
172173
}
173174

174175
if (gfxipMajor >= 10) {

rocclr/device/rocm/rocsettings.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ class Settings : public device::Settings {
8484

8585
//! Creates settings
8686
bool create(bool fullProfile, uint32_t gfxipMajor, uint32_t gfxipMinor, uint32_t gfxStepping,
87-
bool enableXNACK, bool coop_groups = false);
87+
bool enableXNACK, bool coop_groups = false,
88+
bool device_kernel_args = true);
8889

8990
private:
9091
//! Disable copy constructor

rocclr/device/rocm/rocvirtual.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3210,7 +3210,9 @@ bool VirtualGPU::submitKernelInternal(const amd::NDRangeContainer& sizes,
32103210
}
32113211
}
32123212

3213-
const auto pcieKernargs = !dev().isXgmi() && dev().settings().device_kernel_args_;
3213+
const auto pcieKernargs = !dev().isXgmi() &&
3214+
dev().settings().device_kernel_args_ &&
3215+
roc_device_.info().largeBar_;
32143216
address argBuffer = hidden_arguments;
32153217
bool isGraphCapture = vcmd != nullptr && vcmd->getCapturingState();
32163218

0 commit comments

Comments
 (0)