Skip to content

Commit f302140

Browse files
committed
[Intel] Add a means to check which intel gpu generation for vulkan and directX
1 parent 156dade commit f302140

23 files changed

Lines changed: 105 additions & 7 deletions

include/API/Device.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ class Device {
190190
std::string Description;
191191
std::string DriverName;
192192
std::string DriverVersion;
193+
std::string GPUGeneration;
193194

194195
public:
195196
virtual const Capabilities &getCapabilities() = 0;

lib/API/DX/Device.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -997,6 +997,25 @@ class DXDevice : public offloadtest::Device {
997997
Description = std::move(Desc);
998998
DriverVersion = std::move(DriverVer);
999999
DriverName = "DirectX";
1000+
1001+
DXCoreHardwareID HardwareID;
1002+
if (SUCCEEDED(Adapter->GetProperty(DXCoreAdapterProperty::HardwareID,
1003+
&HardwareID))) {
1004+
// 0x8086 is the Vendor ID for Intel
1005+
if (HardwareID.vendorID == 0x8086) {
1006+
const IntelGpuEra Era =
1007+
getIntelGpuEra(static_cast<uint16_t>(HardwareID.deviceID));
1008+
if (Era == IntelGpuEra::Gen7_to_10)
1009+
GPUGeneration = "Intel Gen7-10";
1010+
else if (Era == IntelGpuEra::Gen11_to_14_and_Xe)
1011+
GPUGeneration = "Intel Gen11-14/Xe";
1012+
else
1013+
GPUGeneration = "Intel Unknown";
1014+
} else {
1015+
// We don't have a need yet to identify other GPU vendors.
1016+
GPUGeneration = "Unknown";
1017+
}
1018+
}
10001019
}
10011020
DXDevice(const DXDevice &) = delete;
10021021
DXDevice &operator=(const DXDevice &) = delete;

lib/API/Util.cpp

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

4848
return llvm::Error::success();
4949
}
50+
51+
offloadtest::IntelGpuEra offloadtest::getIntelGpuEra(uint16_t deviceId) {
52+
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+
return IntelGpuEra::Gen11_to_14_and_Xe;
68+
default:
69+
return IntelGpuEra::UnknownOrLegacy;
70+
}
71+
}

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: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,6 +1381,21 @@ class VulkanDevice : public offloadtest::Device {
13811381
const uint64_t DriverInfoSz =
13821382
strnlen(DriverProps.driverInfo, VK_MAX_DRIVER_INFO_SIZE);
13831383
DriverVersion = std::string(DriverProps.driverInfo, DriverInfoSz);
1384+
1385+
// 0x8086 is the Vendor ID for Intel
1386+
if (Props.vendorID == 0x8086) {
1387+
const IntelGpuEra Era =
1388+
getIntelGpuEra(static_cast<uint16_t>(Props.deviceID));
1389+
if (Era == IntelGpuEra::Gen7_to_10)
1390+
GPUGeneration = "Intel Gen7-10";
1391+
else if (Era == IntelGpuEra::Gen11_to_14_and_Xe)
1392+
GPUGeneration = "Intel Gen11-14/Xe";
1393+
else
1394+
GPUGeneration = "Intel Unknown";
1395+
} else {
1396+
// We don't have a need yet to identify other GPU vendors.
1397+
GPUGeneration = "Unknown";
1398+
}
13841399
#if defined(__APPLE__) && defined(__aarch64__)
13851400
// Apple silicon Macs may have multiple Vulkan drivers sharing one device
13861401
// name. Include the driver name in the description to enable
@@ -3901,6 +3916,7 @@ llvm::Error offloadtest::initializeVulkanDevices(
39013916
return Err;
39023917

39033918
for (const auto &PDev : PhysicalDevices) {
3919+
39043920
auto DeviceOrErr = VulkanDevice::create(VulkanInstanceShPtr, PDev,
39053921
AvailableInstanceLayers);
39063922
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-Modern-GPU && 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-Modern-GPU && 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-Modern-GPU && 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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ DescriptorSets:
7575
# Bug https://github.com/llvm/offload-test-suite/issues/599
7676
# XFAIL: Intel && Vulkan && Clang
7777

78+
# Bug: https://github.com/llvm/offload-test-suite/issues/696
79+
# XFAIL: Intel-Modern-GPU && DirectX && Clang
80+
7881
# RUN: split-file %s %t
7982
# RUN: %dxc_target -T cs_6_0 -Fo %t.o %t/source.hlsl
8083
# RUN: %offloader %t/pipeline.yaml %t.o

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-Modern-GPU && 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)