Skip to content

Commit 5f8f4e5

Browse files
committed
[OpenMP][Offload][AMDGPU] Add api to obtain GPU marketing name
This api returns a normalized marketing name of the device through a hsa call. Make it private as it will be used for indexing the evnars for device. We can add a getter function if it needs to expose this attribute.
1 parent 1c0f91c commit 5f8f4e5

File tree

1 file changed

+20
-0
lines changed
  • offload/plugins-nextgen/amdgpu/src

1 file changed

+20
-0
lines changed

offload/plugins-nextgen/amdgpu/src/rtl.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4477,6 +4477,26 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy {
44774477
/// the current configuration.
44784478
bool supportsUnifiedMemoryImpl() override final { return IsXnackEnabled; }
44794479

4480+
/// Get the normalized marketing name of the device.
4481+
/// It only targets Instinct MI series for now.
4482+
/// e.g AMD Instinct MI210 => MI210
4483+
std::string getNormMarketingName() const {
4484+
char MarketingName[64];
4485+
hsa_status_t Status = hsa_agent_get_info(
4486+
Agent, static_cast<hsa_agent_info_t>(HSA_AMD_AGENT_INFO_PRODUCT_NAME),
4487+
MarketingName);
4488+
4489+
if (Status != HSA_STATUS_SUCCESS)
4490+
return "UNKNOWN";
4491+
4492+
// Normalize
4493+
const char *MIPos = strstr(MarketingName, "MI");
4494+
if (MIPos)
4495+
return std::string(MIPos);
4496+
4497+
return "UNKNOWN";
4498+
}
4499+
44804500
/// Envar for controlling the number of HSA queues per device. High number of
44814501
/// queues may degrade performance.
44824502
UInt32Envar OMPX_NumQueues;

0 commit comments

Comments
 (0)