KomputeProject / kompute

General purpose GPU compute framework built on Vulkan to support 1000s of cross vendor graphics cards (AMD, Qualcomm, NVIDIA & friends). Blazing fast, mobile-enabled, asynchronous and optimized for advanced GPU data processing usecases. Backed by the Linux Foundation.
http://kompute.cc/
Apache License 2.0
1.97k stars 151 forks source link

maxComputeSharedMemorySize isn't available in python #360

Open SimLeek opened 7 months ago

SimLeek commented 7 months ago

kp.Manager().get_device_properties() theoretically has access to maxComputeSharedMemorySize through VkPhysicalDeviceLimits, but it's not given in Python.

I need to get maxComputeSharedMemorySize to make sure the spec_consts I'm sending don't end up initializing a shared array that's larger than the GPU can handle. Right now I have to get that variable with another vulkan library.

(Might make a pull request for this. Recording it now as a feature request so it's not lost.)

axsaucedo commented 7 months ago

This would be a relatively simple change, however it can end up quite manual due to the conversion logic required to return as a dict - the list of device options (incl devicelimits) are quite extensive so it would not be very feasible to try to encompass all. How are you currently getting this?

For completness, this is the code:

https://github.com/KomputeProject/kompute/blob/62acb1284e577953b04bc12bd3b46d01a3ab4f21/python/src/utils.hpp#L10-L30

SimLeek commented 7 months ago

I'm currently getting it with some old code I use to try and get VkPhysicalDeviceProperties2 with using pyvulkan. It's extremely messy...

I agree it'd be too much to try to get all the items, but I think maxComputeSharedMemorySize specifically is important enough that it should be included, even if it is mainly important for setting shared arrays using spec consts. Right now I need it for a reduction operation to a small array rather than to a single value.

axsaucedo commented 7 months ago

Ok we can explore addijg these as they become required, but indeed it seems like although pyvulkan is not optimal, it may not be the worse option as it would cover exhaustive options - however happy for this to be extended. Would you be up for opening a PR?

SimLeek commented 7 months ago

Yep! It might take me a bit to get to though.