Skip to content

Fix family queue selection in tests#448

Merged
axsaucedo merged 2 commits intoKomputeProject:masterfrom
TinyTinni:fix-familyQueue-selection-in-tests
Jan 29, 2026
Merged

Fix family queue selection in tests#448
axsaucedo merged 2 commits intoKomputeProject:masterfrom
TinyTinni:fix-familyQueue-selection-in-tests

Conversation

@TinyTinni
Copy link
Contributor

Closes #445.

This PR will add a check in the Manager class to check, if the given family queues exists and have compute capabilities.
If the selected queue has no compute capability, it can lead to problems e.g. a display freeze on my current AMD Linux system.

The PR also tries to generalize the test TestAsyncOperations for a wider range of GPUs. The test will be skipped, if the GPU does not support multiple queue families with compute capabilities.

Signed-off-by: Matthias Möller <m_moeller@live.de>
@TinyTinni TinyTinni force-pushed the fix-familyQueue-selection-in-tests branch 2 times, most recently from 89a125f to acbb3d6 Compare January 27, 2026 18:53
// * Queue family 0 and 2 have compute capabilities
// This test assumes:
// * There are at least 2 different Queue families with compute capabilities
// * GPU is able to process parallel shader code across different families
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This requires not only compute enabled queues, but it actually requres parallel enabled queues. This is something not all GPUs support, would be interesting if there's a way to actually check for parallel enabled queues

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean GPUs which have the second implementation referenced in the vulkan doc for the queues?

How a VkQueue is mapped to the underlying hardware is implementation-defined. Some implementations will have multiple hardware queues and submitting work to multiple VkQueue​s will proceed independently and concurrently. Some implementations will do scheduling at a kernel driver level before submitting work to the hardware. There is no current way in Vulkan to expose the exact details how each VkQueue is mapped.

(emphasize mine) source: https://docs.vulkan.org/guide/latest/queues.html

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No - I mean queues that can actually run workloads in parallel (ref https://towardsdatascience.com/parallelizing-heavy-gpu-workloads-via-multi-queue-operations-50a38b15a1dc)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I see the problem. If the queues are not executed in parallel, the test can fail because of the failed timing measurement.

// The speedup should be at least 40%
EXPECT_LT(durationAsync, durationSync * 0.6);

I didn't expect timing measurement in a test. Wouldn't it be better to declare this test as a benchmark? Or copy it and just add this assert to the benchmark. Logically, the test should run fine even on hardware with just serial execution, except that it is probably not that much faster, which doesn't invalidate the correctness.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct - indeed it's commented explicitly in the test. I think it'd be valid to mark it as benchmark, but indeed it's not a bug as initially assumed.

We have a benchmark section that it can be moved to - would also be interesting if its possible to identify parallel enabled queues, but previously i had to look at GPU manuals to find out which are the parallel supported queues.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is currently no way on how to get this information. There is some discussion on the vulkan github [1] about it, but it is from 2020 and it is probably not going forward.

What do you think, should we move the whole test to benchmark or alternatively, we add at least a message to the assert. When it fails, at least there will be an explanation to the user on why it fails and that maybe his hardware does not support parallel execution (or the 2 specific queues cannot run in parallel, which can also happen on AMD systems when they are queued next to each other, like someone mentioned in [1]).

Something like

EXPECT_LT(durationAsync, durationSync * 0.6) << "There was no speedup in using multiple queues from different QueueFamilies. Maybe your GPU does not support parallel execution."; 

[1] KhronosGroup/Vulkan-Docs#569

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok that sounds like a good suggestion!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the message to the assertion.

Signed-off-by: Matthias Möller <m_moeller@live.de>
@TinyTinni TinyTinni force-pushed the fix-familyQueue-selection-in-tests branch from acbb3d6 to e35633f Compare January 28, 2026 17:33
Copy link
Member

@axsaucedo axsaucedo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks

@axsaucedo axsaucedo merged commit a85321f into KomputeProject:master Jan 29, 2026
9 checks passed
@TinyTinni TinyTinni deleted the fix-familyQueue-selection-in-tests branch January 29, 2026 16:28
eokeeffe pushed a commit to eokeeffe/kompute that referenced this pull request Feb 3, 2026
* checks if given family queue has compute capability

Signed-off-by: Matthias Möller <m_moeller@live.de>

* test will search for queues with compute capabilities

Signed-off-by: Matthias Möller <m_moeller@live.de>

---------

Signed-off-by: Matthias Möller <m_moeller@live.de>
Signed-off-by: evanokeeffe <evan.okeeffe@tas-2.com>
axsaucedo pushed a commit that referenced this pull request Feb 3, 2026
* checks if given family queue has compute capability

Signed-off-by: Matthias Möller <m_moeller@live.de>

* test will search for queues with compute capabilities

Signed-off-by: Matthias Möller <m_moeller@live.de>

---------

Signed-off-by: Matthias Möller <m_moeller@live.de>
Signed-off-by: evanokeeffe <evan.okeeffe@tas-2.com>
Signed-off-by: Alejandro Saucedo <alejandro.saucedo@zalando.de>
eokeeffe pushed a commit to eokeeffe/kompute that referenced this pull request Feb 3, 2026
* checks if given family queue has compute capability

Signed-off-by: Matthias Möller <m_moeller@live.de>

* test will search for queues with compute capabilities

Signed-off-by: Matthias Möller <m_moeller@live.de>

---------

Signed-off-by: Matthias Möller <m_moeller@live.de>
Signed-off-by: evanokeeffe <evan.okeeffe@tas-2.com>
eokeeffe pushed a commit to eokeeffe/kompute that referenced this pull request Feb 4, 2026
* checks if given family queue has compute capability

Signed-off-by: Matthias Möller <m_moeller@live.de>

* test will search for queues with compute capabilities

Signed-off-by: Matthias Möller <m_moeller@live.de>

---------

Signed-off-by: Matthias Möller <m_moeller@live.de>
Signed-off-by: evanokeeffe <evan.okeeffe@tas-2.com>
axsaucedo added a commit that referenced this pull request Feb 27, 2026
* add datatype enum to python module (#404)

* add datatype enum to python module

Signed-off-by: koubaa <koubaa@github.com>

* add datatype enum to python module

Signed-off-by: koubaa <koubaa@github.com>

* add doc

Signed-off-by: koubaa <koubaa@github.com>

---------

Signed-off-by: koubaa <koubaa@github.com>
Co-authored-by: koubaa <koubaa@github.com>
Signed-off-by: evanokeeffe <evan.okeeffe@tas-2.com>

* Add noexcept to all constructors to explicitly state no exception thrown #44 (#411)

* Sequence con/destructor is noexcept

Signed-off-by: Andrea Calabrese <andrea.calabrese@amarulasolutions.com>
Signed-off-by: Andrea Calabrese <andrea1995.c@live.com>

* Operations are noexcept

Signed-off-by: Andrea Calabrese <andrea.calabrese@amarulasolutions.com>
Signed-off-by: Andrea Calabrese <andrea1995.c@live.com>

* Algorithm is noexcept

Signed-off-by: Andrea Calabrese <andrea.calabrese@amarulasolutions.com>
Signed-off-by: Andrea Calabrese <andrea1995.c@live.com>

---------

Signed-off-by: Andrea Calabrese <andrea.calabrese@amarulasolutions.com>
Signed-off-by: Andrea Calabrese <andrea1995.c@live.com>
Signed-off-by: evanokeeffe <evan.okeeffe@tas-2.com>

* Remove copy operations from classes in Kompute (#412)

* Operations are non-copy

As for Issue #20, operations should be non-copy. Instead of creating a
base NonCopyable class, I prefer to keep this inside the classes
themselves, so that we do not create new inherited structures.

Signed-off-by: Andrea Calabrese <andrea.calabrese@amarulasolutions.com>
Signed-off-by: Andrea Calabrese <andrea1995.c@live.com>

* Make Algorithm uncopyable

Same as previous commit

Signed-off-by: Andrea Calabrese <andrea.calabrese@amarulasolutions.com>
Signed-off-by: Andrea Calabrese <andrea1995.c@live.com>

* Image is non-copy

Signed-off-by: Andrea Calabrese <andrea.calabrese@amarulasolutions.com>
Signed-off-by: Andrea Calabrese <andrea1995.c@live.com>

* Manager is non-copy

Signed-off-by: Andrea Calabrese <andrea.calabrese@amarulasolutions.com>
Signed-off-by: Andrea Calabrese <andrea1995.c@live.com>

* Memory is non-copy

Signed-off-by: Andrea Calabrese <andrea.calabrese@amarulasolutions.com>
Signed-off-by: Andrea Calabrese <andrea1995.c@live.com>

* Sequence is non-copy

Signed-off-by: Andrea Calabrese <andrea.calabrese@amarulasolutions.com>
Signed-off-by: Andrea Calabrese <andrea1995.c@live.com>

* Tensor is non-copy

Signed-off-by: Andrea Calabrese <andrea.calabrese@amarulasolutions.com>
Signed-off-by: Andrea Calabrese <andrea1995.c@live.com>

---------

Signed-off-by: Andrea Calabrese <andrea.calabrese@amarulasolutions.com>
Signed-off-by: Andrea Calabrese <andrea1995.c@live.com>
Signed-off-by: evanokeeffe <evan.okeeffe@tas-2.com>

* Fix noexcept missing from OpMemoryBarrier (#413)

Signed-off-by: Alejandro Saucedo <alejandro.saucedo@zalando.de>
Signed-off-by: evanokeeffe <evan.okeeffe@tas-2.com>

* 414 support for 1 4 headers (#415)

* Added guard for vk 1.4 headers

Signed-off-by: Alejandro Saucedo <alejandro.saucedo@zalando.de>

* CI test for 1.4 compatibility

Signed-off-by: Alejandro Saucedo <alejandro.saucedo@zalando.de>

CI test for 1.4 compatibility

Signed-off-by: Alejandro Saucedo <alejandro.saucedo@zalando.de>

CI test for 1.4 compatibility

Signed-off-by: Alejandro Saucedo <alejandro.saucedo@zalando.de>

CI test for 1.4 compatibility

Signed-off-by: Alejandro Saucedo <alejandro.saucedo@zalando.de>

CI test for 1.4 compatibility

Signed-off-by: Alejandro Saucedo <alejandro.saucedo@zalando.de>

CI test for 1.4 compatibility

Signed-off-by: Alejandro Saucedo <alejandro.saucedo@zalando.de>

Updated cast to match vk namespace

Signed-off-by: Alejandro Saucedo <alejandro.saucedo@zalando.de>

Updated cast to match vk namespace

Signed-off-by: Alejandro Saucedo <alejandro.saucedo@zalando.de>

* Updated debugMessageCallback func to vk:: ns

Signed-off-by: Alejandro Saucedo <alejandro.saucedo@zalando.de>

* Updated debugMessageCallback func to vk:: ns

Signed-off-by: Alejandro Saucedo <alejandro.saucedo@zalando.de>

---------

Signed-off-by: Alejandro Saucedo <alejandro.saucedo@zalando.de>
Signed-off-by: evanokeeffe <evan.okeeffe@tas-2.com>

* Fix syntax error (MSVC) in Manager.cpp (#418)

Change VKAPI_PTR to VKAPI_ATTR

Tested only on:
MSVC version: `Microsoft (R) C/C++ Optimizing Compiler Version 19.43.34808 for
x86`
VulkanSDK version: 1.4.309.0
Latest kompute commit: 299b11f

Signed-off-by: jamorphy <maps@jax2.net>
Signed-off-by: evanokeeffe <evan.okeeffe@tas-2.com>

* Fix compile error in android (#423)

Signed-off-by: zlaazlaa <2889827787@qq.com>
Signed-off-by: evanokeeffe <evan.okeeffe@tas-2.com>

* Make spdlog and fmt mutually exclusive and support -Werror=missing-braces (#419)

* Update bin2h.cmake to avoid -Werror=missing-braces

Signed-off-by: zachferguson <zach.ferguson@clo3d.com>
Signed-off-by: Zachary Ferguson <zach.ferguson@clo3d.com>

* Use the fmt inside spdlog if using spdlog

Signed-off-by: zachferguson <zach.ferguson@clo3d.com>
Signed-off-by: Zachary Ferguson <zach.ferguson@clo3d.com>

* Fix python build by linking fmt when KOMPUTE_OPT_LOG_LEVEL_DISABLED

Signed-off-by: Zachary Ferguson <zach.ferguson@clo3d.com>

---------

Signed-off-by: zachferguson <zach.ferguson@clo3d.com>
Signed-off-by: Zachary Ferguson <zach.ferguson@clo3d.com>
Signed-off-by: evanokeeffe <evan.okeeffe@tas-2.com>

* Add missing eDeviceAndHost MemoryType to the Python Bindings (#424)

* Add eDeviceAndHost to Python bindings for MemoryTypes.

Update docstrings so that the build works.

Signed-off-by: Robert Quill <robert.quill@imgtec.com>

* Typo fix

Signed-off-by: Robert Quill <robert.quill@imgtec.com>

---------

Signed-off-by: Robert Quill <robert.quill@imgtec.com>
Signed-off-by: evanokeeffe <evan.okeeffe@tas-2.com>

* feat: Add log library linking to Android build (#428)

Signed-off-by: zlaazlaa <2889827787@qq.com>
Signed-off-by: evanokeeffe <evan.okeeffe@tas-2.com>

* Fix python SpecConst and PushConst bugs (#430)

* Fix push const inconsistent type bug

Signed-off-by: Alejandro Saucedo <alejandro.saucedo@zalando.de>

* Fix push const bug

Signed-off-by: Alejandro Saucedo <alejandro.saucedo@zalando.de>

* Added test to consts

Signed-off-by: Alejandro Saucedo <alejandro.saucedo@zalando.de>

* Added tests for const types@

Signed-off-by: Alejandro Saucedo <alejandro.saucedo@zalando.de>

* Added test to consts

Signed-off-by: Alejandro Saucedo <alejandro.saucedo@zalando.de>

* Added test to consts

Signed-off-by: Alejandro Saucedo <alejandro.saucedo@zalando.de>

* Added test to consts

Signed-off-by: Alejandro Saucedo <alejandro.saucedo@zalando.de>

---------

Signed-off-by: Alejandro Saucedo <alejandro.saucedo@zalando.de>
Signed-off-by: evanokeeffe <evan.okeeffe@tas-2.com>

* Update Python Matmul examples (#434)

* feat: Add utility function to compile GLSL source to SPIR-V

Signed-off-by: n-jay <nuwanjayawardene@gmail.com>

* refactor: Replace kp.Shader.compile_source with utility function compile_source

Signed-off-by: n-jay <nuwanjayawardene@gmail.com>

---------

Signed-off-by: n-jay <nuwanjayawardene@gmail.com>
Signed-off-by: evanokeeffe <evan.okeeffe@tas-2.com>

* update internal gtest to v1.17.0 (#437)

Signed-off-by: Matthias Möller <m_moeller@live.de>
Signed-off-by: evanokeeffe <evan.okeeffe@tas-2.com>

* Fix incorrect creation of python arrays in Tensor.data (#440)

Previously the Python array would just be filled with the first element
of the data repeated to fill the array.

Fixes a number of the Python tests.

Signed-off-by: Robert Quill <robert.quill@imgtec.com>
Signed-off-by: evanokeeffe <evan.okeeffe@tas-2.com>

* Updated to pybind 3.0.0 (#431)

Signed-off-by: Alejandro Saucedo <alejandro.saucedo@zalando.de>
Signed-off-by: evanokeeffe <evan.okeeffe@tas-2.com>

* Clarify status of llama.cpp in README (#446)

Updated description for llama.cpp to indicate it is now decommissioned.

Signed-off-by: Alejandro Saucedo <alejandro.saucedo@zalando.de>
Signed-off-by: evanokeeffe <evan.okeeffe@tas-2.com>

* adding kompute example using debug printf

Signed-off-by: evanokeeffe <evan.okeeffe@tas-2.com>

* adding link to the draft article

Signed-off-by: evanokeeffe <evan.okeeffe@tas-2.com>

* Updating the readme for the debug statement example

Signed-off-by: evanokeeffe <evan.okeeffe@tas-2.com>

* Adding in the example shader, gitignore targets it so needed to force in

Signed-off-by: evanokeeffe <evan.okeeffe@tas-2.com>

* Modifying the comment to include bytes in the comment on message length

Signed-off-by: evanokeeffe <evan.okeeffe@tas-2.com>

* Correcting the readme for spelling mistakes in vulkan_ext_printf

Signed-off-by: evanokeeffe <evan.okeeffe@tas-2.com>

* Fix family queue selection in tests (#448)

* checks if given family queue has compute capability

Signed-off-by: Matthias Möller <m_moeller@live.de>

* test will search for queues with compute capabilities

Signed-off-by: Matthias Möller <m_moeller@live.de>

---------

Signed-off-by: Matthias Möller <m_moeller@live.de>
Signed-off-by: evanokeeffe <evan.okeeffe@tas-2.com>

* removes compile definition defining for spdlog target (#449)

spdlog is not build when the CMake option
"KOMPUTE_OPT_USE_BUILT_IN_SPDLOG" is set to false. When activating
spdlog for logging via CMake option "KOMPUTE_OPT_USE_SPDLOG", CMake will
deliver an error, as the current CMake file tries to add a definition to
the spdlog target.

Defining the compiler definition "SPDLOG_ACTIVE_LEVEL" has no effect on
spdlog itself, it just has an effect on spdlog target consumers.
Therefore, it can be removed so that the project can be build with the
mentioned CMake options.

Signed-off-by: Matthias Möller <m_moeller@live.de>
Signed-off-by: evanokeeffe <evan.okeeffe@tas-2.com>

* adding kompute example using debug printf

Signed-off-by: evanokeeffe <evan.okeeffe@tas-2.com>

* adding link to the draft article

Signed-off-by: evanokeeffe <evan.okeeffe@tas-2.com>

* Updating the readme for the debug statement example

Signed-off-by: evanokeeffe <evan.okeeffe@tas-2.com>

---------

Signed-off-by: koubaa <koubaa@github.com>
Signed-off-by: evanokeeffe <evan.okeeffe@tas-2.com>
Signed-off-by: Andrea Calabrese <andrea.calabrese@amarulasolutions.com>
Signed-off-by: Andrea Calabrese <andrea1995.c@live.com>
Signed-off-by: Alejandro Saucedo <alejandro.saucedo@zalando.de>
Signed-off-by: jamorphy <maps@jax2.net>
Signed-off-by: zlaazlaa <2889827787@qq.com>
Signed-off-by: zachferguson <zach.ferguson@clo3d.com>
Signed-off-by: Zachary Ferguson <zach.ferguson@clo3d.com>
Signed-off-by: Robert Quill <robert.quill@imgtec.com>
Signed-off-by: n-jay <nuwanjayawardene@gmail.com>
Signed-off-by: Matthias Möller <m_moeller@live.de>
Co-authored-by: Mohamed Koubaa <koubaa.m@gmail.com>
Co-authored-by: koubaa <koubaa@github.com>
Co-authored-by: Andrea Calabrese <18246320+ThePseudo@users.noreply.github.com>
Co-authored-by: Alejandro Saucedo <axsauze@gmail.com>
Co-authored-by: jamorphy <148006242+jamorphy@users.noreply.github.com>
Co-authored-by: zlaa <72907523+zlaazlaa@users.noreply.github.com>
Co-authored-by: Zachary Ferguson <zy.fergus@gmail.com>
Co-authored-by: Robert Quill <robert.quill@imgtec.com>
Co-authored-by: Nuwan Jayawardene <nuwanjayawardene@gmail.com>
Co-authored-by: Matthias Möller <m_moeller@live.de>
Co-authored-by: evanokeeffe <evan.okeeffe@tas-2.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect Vulkan API usage

2 participants