Git Product home page Git Product logo

Comments (7)

pezcode avatar pezcode commented on May 17, 2024 2

Just took a look at your additions, and they're great. 👌

I think that the dedicated queue stuff could use some changes, however. Currently it assumes anything but the first queue family is special, but the Vulkan spec makes no guarantees about the order.

What I have in mind is something like this:

// finds a queue family that has compute, but no graphics bit
// return false if there is no such queue family
param.add_dedicated_queue(VK_QUEUE_COMPUTE_BIT, 0.5f); // and [...]_queues() to create multiple queues
// finds a queue family that has transfer but no graphics or compute
param.add_dedicated_queue(VK_QUEUE_TRANSFER_BIT, 0.5f);

and probably remove the old add_dedicated_queues. Might also be worth supporting VK_QUEUE_GRAPHICS_BIT without compute, but that should be it. Combinations of flags for dedicated queues don't really make sense.

I don't know if sorting is still required, depending on how queues are added to params. device::create pushes queues to the front of the graphics/compute/transfer_queue_list but if in the example above the two calls were switched (transfer added before compute), this would happen:

  • graphics: [default]
  • compute: [dedicated_compute, default]
  • transfer: [dedicated_compute, dedicated_transfer, default]

Or maybe it's ok to expect the user to know that the last queue added with a specific bit will be at the front of that list 🤷

from liblava.

pezcode avatar pezcode commented on May 17, 2024 1

Re: 2. I think a sensible implementation would still expose the default queue, but maybe put any found dedicated queues at the front of the list.

E.g. requesting:

  1. GRAPHICS | COMPUTE | TRANSFER
  2. COMPUTE
  3. TRANSFER
    becomes:
  • graphics_queues: [1]
  • compute_queues: [2, 1]
  • transfer_queues: [3, 1]

from liblava.

TheLavaBlock avatar TheLavaBlock commented on May 17, 2024

🔨 created branch queue-creation

from liblava.

TheLavaBlock avatar TheLavaBlock commented on May 17, 2024

Several hardware platforms have more than one VkQueue per queue family. This can be useful by being able to submit work to the same queue family from separate queues. While there can be advantages, it isn't necessarily better to create or use the extra queues. For specific performance recommendations, refer to hardware vendors' best practices guides.

https://github.com/KhronosGroup/Vulkan-Guide/blob/master/chapters/common_pitfalls.md#multiple-queues-per-queue-family

Does anyone have experience or information about the hardware vendors' best practices guides (links?)


I like the suggestion in 1. (first post) - should be easy doable.
And for 2. I would like to change the default behavior so that it runs like the proposal.

from liblava.

TheLavaBlock avatar TheLavaBlock commented on May 17, 2024

Here are some examples how to use add_queues

    app.manager.on_create_param = [](device::create_param& param) {
        param.set_default_queues(); // (1)
        
        param.set_all_queues(); // (2)
        
        param.add_dedicated_queues(0.5f); // (3)

        param.add_queues(VK_QUEUE_COMPUTE_BIT | VK_QUEUE_TRANSFER_BIT, 2); // (4)

        param.add_queue(VK_QUEUE_COMPUTE_BIT | VK_QUEUE_TRANSFER_BIT); // (5)
        param.add_queue(VK_QUEUE_COMPUTE_BIT | VK_QUEUE_TRANSFER_BIT); // (6)
        
        param.add_queues(VK_QUEUE_COMPUTE_BIT, 2); // (7)
        
        param.add_queue(VK_QUEUE_COMPUTE_BIT);  // (8)
        param.add_queue(VK_QUEUE_TRANSFER_BIT);  // (9)
    };
  1. This is the default handling, even if you do not specify param
  2. Shows how to set all queues, param can still be adjusted afterwards
  3. And this will add all dedicated queues (priority: 0.5), if any are available, else will return false
  4. Shows how to add a specific combination of 2 queues (same queue family)
  5. But if 4. fails because you don't get it from one queue family, you can still call...
  6. ... it twice and hopefully get it from different queue families
  7. Just a simple example how to request 2 dedicated queues using one flag
  8. Well, now back to your last post: If you just set this line and...
  9. ... that of course, it will add the 2 dedicated queues to the front of the list 🤠

Added some tests in lava-unit, check tests/unit.cpp

from liblava.

pezcode avatar pezcode commented on May 17, 2024

Awesome, thanks for putting in the time to work on this 🙏
I'm busy with something else currently, but I'll check this out and report back over the weekend.

from liblava.

TheLavaBlock avatar TheLavaBlock commented on May 17, 2024

You're welcome! No hurry, if something stands out when testing, just let me know.

from liblava.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.