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
2 changes: 2 additions & 0 deletions offload/include/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ struct DeviceTy {
/// Ask the device whether it is an APU.
bool checkIfAPU();

bool checkIfStrixHalo();

bool checkIfGFX90a();

bool checkIfMI300x();
Expand Down
20 changes: 20 additions & 0 deletions offload/plugins-nextgen/amdgpu/src/rtl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3437,6 +3437,10 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy {
if (auto Err = checkIfAPU())
return Err;

// detect if device is StrixHalo.
if (auto Err = checkIfStrixHalo())
return Err;

// detect if device is GFX90a.
if (auto Err = checkIfGFX90a())
return Err;
Expand Down Expand Up @@ -4770,6 +4774,14 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy {
return Plugin::success();
}

Error checkIfStrixHalo() {
llvm::StringRef StrGfxName(ComputeUnitKind);
IsEquippedWithStrixHalo = llvm::StringSwitch<bool>(StrGfxName)
.Case("gfx1151", true)
.Default(false);
return Plugin::success();
}

Error checkIfGFX90a() {
llvm::StringRef StrGfxName(ComputeUnitKind);
IsEquippedWithGFX90A = llvm::StringSwitch<bool>(StrGfxName)
Expand Down Expand Up @@ -4849,6 +4861,9 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy {
// TODO: move the following function in private section.
bool hasMI300xDevice() { return IsEquippedWithMI300X; }

/// Returns whether the device is a StrixHalo.
bool hasStrixHaloDeviceImpl() override final { return IsEquippedWithStrixHalo; }

/// Returns whether the device is a gfx90a.
bool hasGfx90aDeviceImpl() override final { return IsEquippedWithGFX90A; }

Expand Down Expand Up @@ -5088,6 +5103,8 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy {
// Is the device an MI200?
bool IsEquippedWithGFX90A = false;

bool IsEquippedWithStrixHalo = false;

/// True if the system is configured with XNACK-Enabled.
/// False otherwise.
bool IsXnackEnabled = false;
Expand Down Expand Up @@ -6177,9 +6194,12 @@ unsigned AMDGPUKernelTy::computeAchievedOccupancy(GenericDeviceTy &Device,

// Get GPU info.
AMDGPUDeviceTy &AMDDevice = static_cast<AMDGPUDeviceTy &>(Device);
bool IsEquippedWithStrixHalo = Device.hasStrixHaloDevice();
bool IsEquippedWithGFX90A = Device.hasGfx90aDevice();
bool IsEquippedWithMI300 = AMDDevice.checkIfMI300Device();

DP("Halo %d\n", IsEquippedWithStrixHalo);

if (IsEquippedWithGFX90A || IsEquippedWithMI300) {
MaxWavesPerEU = llvm::omp::amdgpu_arch::MaxWavesPerEU8;
}
Expand Down
7 changes: 7 additions & 0 deletions offload/plugins-nextgen/common/include/PluginInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,10 @@ struct GenericDeviceTy : public DeviceAllocatorTy {
bool hasAPUDevice();
virtual bool hasAPUDeviceImpl() { return false; }

// Returns true if the device is a StrixHalo.
bool hasStrixHaloDevice();
virtual bool hasStrixHaloDeviceImpl() { return false; }

// Returns true if the device is a gfx90a.
bool hasGfx90aDevice();
virtual bool hasGfx90aDeviceImpl() { return false; }
Expand Down Expand Up @@ -1781,6 +1785,9 @@ struct GenericPluginTy {
/// Returns if this device is an APU.
bool has_apu_device(int32_t DeviceId);

/// Returns if this discrete GPU is a StrixHalo.
bool is_strixHalo(int32_t DeviceId);

/// Returns if this discrete GPU is a gfx90a.
bool is_gfx90a(int32_t DeviceId);

Expand Down
9 changes: 9 additions & 0 deletions offload/plugins-nextgen/common/src/PluginInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1611,6 +1611,8 @@ uint32_t GenericDeviceTy::queryCoarseGrainMemory(const void *ptr,

bool GenericDeviceTy::hasAPUDevice() { return hasAPUDeviceImpl(); }

bool GenericDeviceTy::hasStrixHaloDevice() { return hasStrixHaloDeviceImpl(); }

bool GenericDeviceTy::hasGfx90aDevice() { return hasGfx90aDeviceImpl(); }

bool GenericDeviceTy::supportsUnifiedMemory() {
Expand Down Expand Up @@ -2014,6 +2016,13 @@ bool GenericPluginTy::has_apu_device(int32_t DeviceId) {
return R;
}

bool GenericPluginTy::is_strixHalo(int32_t DeviceId) {
auto T = logger::log<bool>(__func__, DeviceId);
auto R = [&]() { return getDevice(DeviceId).hasStrixHaloDeviceImpl(); }();
T.res(R);
return R;
}

bool GenericPluginTy::is_gfx90a(int32_t DeviceId) {
auto T = logger::log<bool>(__func__, DeviceId);
auto R = [&]() { return getDevice(DeviceId).hasGfx90aDeviceImpl(); }();
Expand Down