Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions src/topology.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,14 +528,16 @@ static HSAKMT_STATUS topology_sysfs_get_node_props(uint32_t node_id,
props.FComputeIdLo = 0;
props.Capability.ui32.ASICRevision = device->AsicRevision();
props.Capability.ui32.WatchPointsTotalBits =
std::log2(device->WatchPointsNum());
props.MaxWavesPerSIMD = device->WavePerCu() / device->SimdPerCu();
device->WatchPointsNum() ? std::log2(device->WatchPointsNum()) : 0;
props.MaxWavesPerSIMD =
device->SimdPerCu() ? device->WavePerCu() / device->SimdPerCu() : 0;
props.LDSSizeInKB = device->LdsSize() / 1024;
props.GDSSizeInKB = 0;
props.WaveFrontSize = device->WavefrontSize();
props.NumShaderBanks = device->NumShaderEngine();
props.NumArrays = device->ShaderArrayPerShaderEngine();
props.NumCUPerArray = device->ComputeUnitCount() / props.NumArrays;
props.NumCUPerArray = props.NumArrays
? device->ComputeUnitCount() / props.NumArrays : 0;
props.NumSIMDPerCU = device->SimdPerCu();
props.MaxSlotsScratchCU = device->MaxScratchSlotsPerCu();
props.VendorId = 0x1002;
Expand Down Expand Up @@ -592,6 +594,18 @@ static HSAKMT_STATUS topology_sysfs_get_node_props(uint32_t node_id,
props.EngineId.ui32.Minor = device->Minor();
props.EngineId.ui32.Stepping = device->Stepping();

/* GFX version should already be populated by ParseDeviceInfo() via
* HSA_OVERRIDE_GFX_VERSION or device-specific detection. Fall back to
* the topology-level override as a last resort; log an error if still 0. */
if (!props.EngineId.ui32.Major) {
if (props.OverrideEngineId.ui32.Major) {
props.EngineId = props.OverrideEngineId;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rocr would handle the EngineId and OverrideEngineId

pr_warn("GFX version from HSA_OVERRIDE_GFX_VERSION\n");
} else {
pr_err("GFX version is 0 — set HSA_OVERRIDE_GFX_VERSION\n");
}
}

snprintf((char *)props.AMDName, sizeof(props.AMDName) - 1, "GFX%06x",
HSA_GET_GFX_VERSION_FULL(props.EngineId.ui32));

Expand All @@ -603,9 +617,8 @@ static HSAKMT_STATUS topology_sysfs_get_node_props(uint32_t node_id,
props.SGPRSizePerCU = SGPR_SIZE_PER_CU;
props.VGPRSizePerCU = get_vgpr_size_per_cu(props.EngineId);

if (props.NumFComputeCores)
assert(props.EngineId.ui32.Major &&
"HSA_OVERRIDE_GFX_VERSION may be needed");
if (props.NumFComputeCores && !props.EngineId.ui32.Major)
pr_err("GFX version still unknown - set HSA_OVERRIDE_GFX_VERSION\n");

return ret;
}
Expand Down
6 changes: 4 additions & 2 deletions src/wddm/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -549,8 +549,10 @@ NTSTATUS WDDMCreateDevices(std::vector<WDDMDevice *> &devices)

ret = WDDMQueryAdapter(info[i].hAdapter, KMTQAITYPE_PHYSICALADAPTERDEVICEIDS,
&query, sizeof(query));
if (ret != STATUS_SUCCESS)
goto err_out1;
if (ret != STATUS_SUCCESS) {
pr_debug("adapter %d query failed (0x%x), skipping\n", i, ret);
continue; /* non-fatal: skip adapters that cannot be queried */
}

if (query.DeviceIds.VendorID != 0x1002)
continue;
Expand Down