You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2020/10/11 14:03:29 UTC

[GitHub] [incubator-tvm] tqchen commented on a change in pull request #6662: Adjust Vulkan queue selection and creation logic

tqchen commented on a change in pull request #6662:
URL: https://github.com/apache/incubator-tvm/pull/6662#discussion_r502919415



##########
File path: src/runtime/vulkan/vulkan.cc
##########
@@ -496,27 +496,30 @@ VulkanDeviceAPI::VulkanDeviceAPI() {
     vkGetPhysicalDeviceQueueFamilyProperties(phy_dev, &queue_prop_count,
                                              dmlc::BeginPtr(queue_props));
     uint32_t queue_family_index = 0;
-    std::vector<VkDeviceQueueCreateInfo> queue_create_info;
-    float priority = 1.0f;
-    for (uint32_t i = 0; i < queue_props.size(); i++) {
-      // find queues that support compute
-      if (VK_QUEUE_COMPUTE_BIT & queue_props[i].queueFlags) {
-        VkDeviceQueueCreateInfo info;
-        info.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
-        info.pNext = nullptr;
-        info.flags = 0;
-        info.queueFamilyIndex = i;
-        info.queueCount = 1;
-        info.pQueuePriorities = &priority;
-
-        queue_create_info.push_back(info);
-        // only use the first available queue for now
-        if (queue_create_info.size() == 0) {
-          queue_family_index = i;
-        }
+    float priority = 0.0f;
+    auto compute_dedicated = std::find_if(queue_props.begin(), queue_props.end(), [](auto prop) {

Review comment:
       Please add a comment indicating that this is for to find the compute decidated queue

##########
File path: src/runtime/vulkan/vulkan.cc
##########
@@ -496,27 +496,30 @@ VulkanDeviceAPI::VulkanDeviceAPI() {
     vkGetPhysicalDeviceQueueFamilyProperties(phy_dev, &queue_prop_count,
                                              dmlc::BeginPtr(queue_props));
     uint32_t queue_family_index = 0;
-    std::vector<VkDeviceQueueCreateInfo> queue_create_info;
-    float priority = 1.0f;
-    for (uint32_t i = 0; i < queue_props.size(); i++) {
-      // find queues that support compute
-      if (VK_QUEUE_COMPUTE_BIT & queue_props[i].queueFlags) {
-        VkDeviceQueueCreateInfo info;
-        info.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
-        info.pNext = nullptr;
-        info.flags = 0;
-        info.queueFamilyIndex = i;
-        info.queueCount = 1;
-        info.pQueuePriorities = &priority;
-
-        queue_create_info.push_back(info);
-        // only use the first available queue for now
-        if (queue_create_info.size() == 0) {
-          queue_family_index = i;
-        }
+    float priority = 0.0f;
+    auto compute_dedicated = std::find_if(queue_props.begin(), queue_props.end(), [](auto prop) {

Review comment:
       Perhaps it is better to put it into a sub member function, e.g. FindComputeQueue

##########
File path: src/runtime/vulkan/vulkan.cc
##########
@@ -496,27 +496,30 @@ VulkanDeviceAPI::VulkanDeviceAPI() {
     vkGetPhysicalDeviceQueueFamilyProperties(phy_dev, &queue_prop_count,
                                              dmlc::BeginPtr(queue_props));
     uint32_t queue_family_index = 0;
-    std::vector<VkDeviceQueueCreateInfo> queue_create_info;
-    float priority = 1.0f;
-    for (uint32_t i = 0; i < queue_props.size(); i++) {
-      // find queues that support compute
-      if (VK_QUEUE_COMPUTE_BIT & queue_props[i].queueFlags) {
-        VkDeviceQueueCreateInfo info;
-        info.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
-        info.pNext = nullptr;
-        info.flags = 0;
-        info.queueFamilyIndex = i;
-        info.queueCount = 1;
-        info.pQueuePriorities = &priority;
-
-        queue_create_info.push_back(info);
-        // only use the first available queue for now
-        if (queue_create_info.size() == 0) {
-          queue_family_index = i;
-        }
+    float priority = 0.0f;
+    auto compute_dedicated = std::find_if(queue_props.begin(), queue_props.end(), [](auto prop) {

Review comment:
       It is still better to find all queues. perhaps putting compute only queue first




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org