Skip to content

Commit 9a9cd70

Browse files
authored
[Vulkan][Target] Added the driver name to the vulkan target string. (#8882)
Driver name (e.g. "NVIDIA", "radv", "AMD open-source driver") is read from the `driverName` property in [VkPhysicalDeviceDriverProperties](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkPhysicalDeviceDriverProperties.html), or is left as `"unknown_driver_name"` if the driver does not support querying the driver name.
1 parent b774d7f commit 9a9cd70

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

src/runtime/vulkan/vulkan_device.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@ VulkanDeviceProperties::VulkanDeviceProperties(const VulkanInstance& instance,
156156
device_name = properties.properties.deviceName;
157157
driver_version = properties.properties.driverVersion;
158158

159+
if (device.HasExtension("VK_KHR_driver_properties")) {
160+
driver_name = driver.driverName;
161+
}
162+
159163
switch (properties.properties.deviceType) {
160164
case VK_PHYSICAL_DEVICE_TYPE_OTHER:
161165
device_type = "other";

src/runtime/vulkan/vulkan_device.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ struct VulkanDeviceProperties {
9494
uint32_t max_shared_memory_per_block{16384};
9595
std::string device_type{"unknown_device_type"};
9696
std::string device_name{"unknown_device_name"};
97+
std::string driver_name{"unknown_driver_name"};
9798
uint32_t driver_version{0};
9899
uint32_t vulkan_api_version{VK_API_VERSION_1_0};
99100
uint32_t max_spirv_version{0x10000};

src/runtime/vulkan/vulkan_device_api.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,9 @@ void VulkanDeviceAPI::GetTargetProperty(Device dev, const std::string& property,
242242
if (property == "device_type") {
243243
*rv = prop.device_type;
244244
}
245+
if (property == "driver_name") {
246+
*rv = prop.driver_name;
247+
}
245248
if (property == "driver_version") {
246249
*rv = int64_t(prop.driver_version);
247250
}

src/target/target_kind.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ TVM_REGISTER_TARGET_KIND("vulkan", kDLVulkan)
312312
// Other device properties
313313
.add_attr_option<String>("device_type")
314314
.add_attr_option<String>("device_name")
315+
.add_attr_option<String>("driver_name")
315316
.add_attr_option<Integer>("driver_version")
316317
.add_attr_option<Integer>("vulkan_api_version")
317318
.add_attr_option<Integer>("max_spirv_version")

0 commit comments

Comments
 (0)