SWDEV-204804 - Detecing pcie atomic support

- check pcie atomci support for printf functionality
- if not enabled printf wont work

Signed-off-by: sdashmiz <shadi.dashmiz@amd.com>
Change-Id: Ib366e8e71772b02210c4a830bca4bd8cc7a11664


[ROCm/clr commit: 15f1632dfa]
Этот коммит содержится в:
sdashmiz
2022-04-01 15:56:14 -04:00
коммит произвёл Shadi Dashmiz
родитель 4d04262d2c
Коммит dafc64ea0a
4 изменённых файлов: 22 добавлений и 1 удалений
+2
Просмотреть файл
@@ -603,6 +603,8 @@ struct Info : public amd::EmbeddedObject {
//! AQL Barrier Value Packet support
bool aqlBarrierValue_;
bool pcie_atomics_; //!< Pcie atomics support flag
};
//! Device settings
+12
Просмотреть файл
@@ -207,6 +207,16 @@ void Device::setupCpuAgent() {
system_segment_.handle, system_coarse_segment_.handle, _bkendDevice.handle);
}
void Device::checkAtomicSupport() {
std::vector<amd::Device::LinkAttrType> link_attrs;
link_attrs.push_back(std::make_pair(LinkAttribute::kLinkAtomicSupport, 0));
if (findLinkInfo(system_segment_, &link_attrs)) {
if (link_attrs[0].second == 1) {
info_.pcie_atomics_ = true;
}
}
}
Device::~Device() {
#ifdef WITH_AMDGPU_PRO
delete pro_device_;
@@ -1167,6 +1177,8 @@ bool Device::populateOCLDeviceConstants() {
setupCpuAgent();
checkAtomicSupport();
assert(system_segment_.handle != 0);
if (HSA_STATUS_SUCCESS != hsa_amd_agent_iterate_memory_pools(
_bkendDevice, Device::iterateGpuMemoryPoolCallback, this)) {
+3
Просмотреть файл
@@ -374,6 +374,9 @@ class Device : public NullDevice {
static const std::vector<AgentInfo>& getCpuAgents() { return cpu_agents_; }
void setupCpuAgent(); // Setup the CPU agent which has the least NUMA distance to this GPU
void checkAtomicSupport(); //!< Check the support for pcie atomics
//! Destructor for the physical HSA device
virtual ~Device();
+5 -1
Просмотреть файл
@@ -2781,7 +2781,7 @@ bool VirtualGPU::submitKernelInternal(const amd::NDRangeContainer& sizes, const
break;
}
case amd::KernelParameterDescriptor::HiddenHostcallBuffer: {
if (amd::IS_HIP) {
if (roc_device_.info().pcie_atomics_) {
uintptr_t buffer = reinterpret_cast<uintptr_t>(
roc_device_.getOrCreateHostcallBuffer(gpu_queue_, coopGroups, cuMask_));
if (!buffer) {
@@ -2790,6 +2790,10 @@ bool VirtualGPU::submitKernelInternal(const amd::NDRangeContainer& sizes, const
return false;
}
WriteAqlArgAt(hidden_arguments, buffer, it.size_, it.offset_);
} else {
ClPrint(amd::LOG_ERROR, amd::LOG_KERN,
"Pcie atomics not enabled, printf not supported");
return false;
}
break;
}