Skip to content

wgpu-hal: vulkan: ensure entries to PhysicalDeviceCapabilities use effective api version#4250

Closed
i509VCB wants to merge 1 commit intogfx-rs:trunkfrom
i509VCB:fix-agxv
Closed

wgpu-hal: vulkan: ensure entries to PhysicalDeviceCapabilities use effective api version#4250
i509VCB wants to merge 1 commit intogfx-rs:trunkfrom
i509VCB:fix-agxv

Conversation

@i509VCB
Copy link
Copy Markdown
Contributor

@i509VCB i509VCB commented Oct 17, 2023

This was the cause of an error while testing wgpu-hal on agxv. Specifically I was getting an error about running out of memory while creating the "zero init buffer". This was occuring because PhysicalDeviceCapabilities was reading the instance api version and not the device version. But furthermore this is wrong because the actual api version that can be used is the lower of the instance's api version and device's api version.

agxv does not implement maintenance3 yet, so what was being returned for a max memory allocation size was 0, because ash initialized the value to 0. Then when the gpu allocator is created with a maximum allocation size of 0, all gpu memory allocations fail.

Checklist

  • Run cargo clippy.

Although when running clippy this error shows up. Definitely not a fault of my changes:

error: incorrect implementation of `partial_cmp` on an `Ord` type
   --> wgpu-core/src/id.rs:155:1
    |
155 | /  impl<T> PartialOrd for Id<T> {
156 | |      fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
    | | _____________________________________________________________-
157 | ||         self.0.partial_cmp(&other.0)
158 | ||     }
    | ||_____- help: change this to: `{ Some(self.cmp(other)) }`
159 | |  }
    | |__^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#incorrect_partial_ord_impl_on_ord_type
    = note: `#[deny(clippy::incorrect_partial_ord_impl_on_ord_type)]` on by default
    ```

- [x] Run `cargo clippy --target wasm32-unknown-unknown` if applicable.
- [x] Add change to CHANGELOG.md. See simple instructions inside file.

…fective api version

This was the cause of an error while testing wgpu-hal on agxv. Specifically I was getting an error about running out of memory while creating the "zero init buffer".
This was occuring because PhysicalDeviceCapabilities was reading the instance api version and not the device version. But furthermore this is wrong because the actual api version that can be used is the lower of the instance's api version and device's api version.

agxv does not implement maintenance3 yet, so what was being returned for a max memory allocation size was 0, because ash initialized the value to 0. Then when the gpu allocator is created with a maximum allocation size of 0, all gpu memory allocations fail.

Signed-off-by: i509VCB <git@i509.me>
@i509VCB i509VCB requested a review from a team as a code owner October 17, 2023 04:46
Comment on lines +792 to +795
// Set the effective api version before we test for extension support
capabilities.effective_api_version = self
.driver_api_version
.min(capabilities.properties.api_version);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Moving this up here won't work as capabilities.properties.api_version will be 0.

I opened #4252 as I also wanted to decouple the instance and device API versions for some time now.

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.

4 participants