Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maxComputeSharedMemorySize isn't available in python #360

Open
SimLeek opened this issue Feb 19, 2024 · 4 comments
Open

maxComputeSharedMemorySize isn't available in python #360

SimLeek opened this issue Feb 19, 2024 · 4 comments

Comments

@SimLeek
Copy link

SimLeek commented Feb 19, 2024

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
Copy link
Member

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:

static pybind11::dict
vkPropertiesToDict(const vk::PhysicalDeviceProperties& properties)
{
std::string deviceName = properties.deviceName;
pybind11::dict pyDict(
"device_name"_a = deviceName,
"max_work_group_count"_a =
pybind11::make_tuple(properties.limits.maxComputeWorkGroupCount[0],
properties.limits.maxComputeWorkGroupCount[1],
properties.limits.maxComputeWorkGroupCount[2]),
"max_work_group_invocations"_a =
properties.limits.maxComputeWorkGroupInvocations,
"max_work_group_size"_a =
pybind11::make_tuple(properties.limits.maxComputeWorkGroupSize[0],
properties.limits.maxComputeWorkGroupSize[1],
properties.limits.maxComputeWorkGroupSize[2]),
"timestamps_supported"_a =
(bool)properties.limits.timestampComputeAndGraphics);
return pyDict;
}

@SimLeek
Copy link
Author

SimLeek commented Feb 19, 2024

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
Copy link
Member

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
Copy link
Author

SimLeek commented Feb 20, 2024

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

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

No branches or pull requests

2 participants