Skip to content

Commit bc20b5c

Browse files
authored
[Intel] Add a means to check which intel gpu generation for vulkan and directX (#1291)
This change fixes #709
1 parent f724b62 commit bc20b5c

58 files changed

Lines changed: 203 additions & 19 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

include/API/Device.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ class Device {
191191
std::string Description;
192192
std::string DriverName;
193193
std::string DriverVersion;
194+
std::string GPUGeneration;
195+
uint16_t FamilyPrefix = 0;
194196

195197
public:
196198
virtual const Capabilities &getCapabilities() = 0;
@@ -247,6 +249,8 @@ class Device {
247249
llvm::StringRef getDescription() const { return Description; }
248250
llvm::StringRef getDriverName() const { return DriverName; }
249251
llvm::StringRef getDriverVersion() const { return DriverVersion; }
252+
llvm::StringRef getGPUGeneration() const { return GPUGeneration; }
253+
uint16_t getFamilyPrefix() const { return FamilyPrefix; }
250254
};
251255

252256
llvm::Error

lib/API/DX/Device.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,6 +1014,26 @@ class DXDevice : public offloadtest::Device {
10141014
Description = std::move(Desc);
10151015
DriverVersion = std::move(DriverVer);
10161016
DriverName = "DirectX";
1017+
1018+
DXCoreHardwareID HardwareID;
1019+
if (SUCCEEDED(Adapter->GetProperty(DXCoreAdapterProperty::HardwareID,
1020+
&HardwareID))) {
1021+
// 0x8086 is the Vendor ID for Intel
1022+
if (HardwareID.vendorID == 0x8086) {
1023+
FamilyPrefix = static_cast<uint16_t>(HardwareID.deviceID) & 0xFF00;
1024+
const IntelGpuEra Era =
1025+
getIntelGpuEra(static_cast<uint16_t>(HardwareID.deviceID));
1026+
if (Era == IntelGpuEra::Gen7_to_10)
1027+
GPUGeneration = "Intel Gen7-10";
1028+
else if (Era == IntelGpuEra::Gen11_to_14_and_Xe)
1029+
GPUGeneration = "Intel Gen11-14/Xe";
1030+
else
1031+
GPUGeneration = "Intel Unknown";
1032+
} else {
1033+
// We don't have a need yet to identify other GPU vendors.
1034+
GPUGeneration = "Unknown";
1035+
}
1036+
}
10171037
}
10181038
DXDevice(const DXDevice &) = delete;
10191039
DXDevice &operator=(const DXDevice &) = delete;

lib/API/Util.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,27 @@ llvm::Error offloadtest::findAndValidateRenderPassTextureSize(
4747

4848
return llvm::Error::success();
4949
}
50+
51+
offloadtest::IntelGpuEra offloadtest::getIntelGpuEra(uint16_t DeviceId) {
52+
const uint16_t FamilyPrefix = DeviceId & 0xFF00;
53+
switch (FamilyPrefix) {
54+
case 0x5900: // Kaby Lake (7th Gen)
55+
case 0x3E00: // Coffee Lake / Whiskey Lake (8th/9th Gen)
56+
case 0x9B00: // Comet Lake (10th Gen)
57+
case 0x8A00: // Ice Lake (10th Gen)
58+
return IntelGpuEra::Gen7_to_10;
59+
case 0x9A00: // Tiger Lake (11th Gen)
60+
case 0x4C00: // Rocket Lake (11th Gen Desktop)
61+
case 0x4600: // Alder Lake (12th Gen)
62+
case 0xA700: // Raptor Lake (13th Gen)
63+
case 0x7D00: // Meteor Lake (14th Gen Core Ultra)
64+
case 0x5600: // Arc Alchemist (Discrete Xe-HPG)
65+
case 0x4F00: // DG1 (Discrete Xe-LP)
66+
case 0x0B00: // Ponte Vecchio (Xe-HPC / Data Center Max)
67+
case 0xE200: // Battlemage Discrete
68+
case 0x6400: // Lunar Lake Integrated
69+
return IntelGpuEra::Gen11_to_14_and_Xe;
70+
default:
71+
return IntelGpuEra::UnknownOrLegacy;
72+
}
73+
}

lib/API/Util.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ llvm::Error findAndValidateRenderPassTextureSize(const RenderPassBeginDesc &,
2525
uint32_t *OutWidth,
2626
uint32_t *OutHeight);
2727

28+
enum class IntelGpuEra { UnknownOrLegacy, Gen7_to_10, Gen11_to_14_and_Xe };
29+
30+
IntelGpuEra getIntelGpuEra(uint16_t deviceId);
2831
} // namespace offloadtest
2932

30-
#endif // OFFLOADTEST_API_UTIL_H
33+
#endif // OFFLOADTEST_API_UTIL_H

lib/API/VK/Device.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1522,6 +1522,22 @@ class VulkanDevice : public offloadtest::Device {
15221522
const uint64_t DriverInfoSz =
15231523
strnlen(DriverProps.driverInfo, VK_MAX_DRIVER_INFO_SIZE);
15241524
DriverVersion = std::string(DriverProps.driverInfo, DriverInfoSz);
1525+
1526+
// 0x8086 is the Vendor ID for Intel
1527+
if (Props.vendorID == 0x8086) {
1528+
FamilyPrefix = static_cast<uint16_t>(Props.deviceID) & 0xFF00;
1529+
const IntelGpuEra Era =
1530+
getIntelGpuEra(static_cast<uint16_t>(Props.deviceID));
1531+
if (Era == IntelGpuEra::Gen7_to_10)
1532+
GPUGeneration = "Intel Gen7-10";
1533+
else if (Era == IntelGpuEra::Gen11_to_14_and_Xe)
1534+
GPUGeneration = "Intel Gen11-14/Xe";
1535+
else
1536+
GPUGeneration = "Intel Unknown";
1537+
} else {
1538+
// We don't have a need yet to identify other GPU vendors.
1539+
GPUGeneration = "Unknown";
1540+
}
15251541
#if defined(__APPLE__) && defined(__aarch64__)
15261542
// Apple silicon Macs may have multiple Vulkan drivers sharing one device
15271543
// name. Include the driver name in the description to enable
@@ -4284,6 +4300,7 @@ llvm::Error offloadtest::initializeVulkanDevices(
42844300
return Err;
42854301

42864302
for (const auto &PDev : PhysicalDevices) {
4303+
42874304
auto DeviceOrErr = VulkanDevice::create(VulkanInstanceShPtr, PDev,
42884305
AvailableInstanceLayers);
42894306
if (!DeviceOrErr) {

test/Basic/Matrix/matrix_const_single_subscript.i2x3.test

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ DescriptorSets:
9595
# Bug: https://github.com/llvm/offload-test-suite/issues/660
9696
# XFAIL: Vulkan && Clang
9797

98+
# Bug: https://github.com/llvm/offload-test-suite/issues/696
99+
# XFAIL:Intel-Gen-Current && DirectX && Clang
100+
98101
# RUN: split-file %s %t
99102
# RUN: %dxc_target -T cs_6_0 -Fo %t.o %t/source.hlsl
100103
# RUN: %offloader %t/pipeline.yaml %t.o

test/Basic/Matrix/matrix_construct_by_sub_mat.test

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ DescriptorSets:
6161
...
6262
#--- end
6363

64+
# Bug: https://github.com/llvm/offload-test-suite/issues/696
65+
# XFAIL:Intel-Gen-Current && DirectX && Clang
66+
6467
# RUN: split-file %s %t
6568
# RUN: %dxc_target -T cs_6_0 -Fo %t.o %t/source.hlsl
6669
# RUN: %offloader %t/pipeline.yaml %t.o

test/Basic/Matrix/matrix_elementwise_cast.test

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ DescriptorSets:
9898
Binding: 3
9999
...
100100
#--- end
101+
102+
# Bug: https://github.com/llvm/offload-test-suite/issues/696
103+
# XFAIL:Intel-Gen-Current && DirectX && Clang
104+
101105
# RUN: split-file %s %t
102106
# RUN: %dxc_target -T cs_6_0 -Fo %t.o %t/source.hlsl
103107
# RUN: %offloader %t/pipeline.yaml %t.o

test/Basic/Matrix/matrix_elementwise_vector_cast.test

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,10 @@ DescriptorSets:
7373
#--- end
7474

7575
# Bug https://github.com/llvm/offload-test-suite/issues/599
76-
# XFAIL: Intel && Vulkan && Clang
76+
# XFAIL: Intel-Gen-10 && Vulkan && Clang
77+
78+
# Bug: https://github.com/llvm/offload-test-suite/issues/696
79+
# XFAIL:Intel-Gen-Current && DirectX && Clang
7780

7881
# RUN: split-file %s %t
7982
# RUN: %dxc_target -T cs_6_0 -Fo %t.o %t/source.hlsl

test/Basic/Matrix/matrix_scalar_arithmetic.test

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ DescriptorSets:
8282
...
8383
#--- end
8484

85+
# Bug: https://github.com/llvm/offload-test-suite/issues/696
86+
# XFAIL:Intel-Gen-Current && DirectX && Clang
87+
8588
# RUN: split-file %s %t
8689
# RUN: %dxc_target -T cs_6_0 -Fo %t.o %t/source.hlsl
8790
# RUN: %offloader %t/pipeline.yaml %t.o | FileCheck %s

0 commit comments

Comments
 (0)