-
Notifications
You must be signed in to change notification settings - Fork 543
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
Metal revised memory types #2076
Conversation
4fdbb23
to
76903c0
Compare
@@ -65,6 +66,7 @@ impl Shared { | |||
pub(crate) fn new(device: metal::Device) -> Self { | |||
Shared { | |||
queue_pool: Mutex::new(command::QueuePool::default()), | |||
aux_queue: Mutex::new(device.new_command_queue()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if we exceed 64 temporary command buffers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is a problem, since we commit those command buffers right after acquiring them. So in the worst case there is going to be a bit of a delay for GPU to finish.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it depends on how many active deferred commands buffers we actually expect in real use cases, i.e. if it becomes hundreds in practice it would be unfortunate to hit that delay often IMO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. Theoretically, it can become an issue, but it's too early to worry about this right now
@@ -1103,7 +1103,7 @@ impl CommandBuffer { | |||
while data.len() < offset + constants.len() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is anything responsible for shrinking oversized data
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's getting shrunk in clear_resources
, unless you mean the allocation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 I didn't notice the clear in reset_resources
Thanks for taking a look! There appear to be no major concerns. |
2076: Metal revised memory types r=grovesNL a=kvark Fixes #2069 ~~Includes #2070 (please only review the last 2 commits)~~ The PR effectively removes all the complicated memory allocation tracking from the Metal backend, instead relying on mapping the available storage types (with CPU caching policy) more accurately to what can be represented in Vulkan API. With this in, we slice through the whole `memory` section without crashes. The only issue I failed to fix/workaround is filed as #2077 PR checklist: - [x] `make` succeeds (on *nix) - [x] `make reftests` succeeds - [x] tested examples with the following backends: metal Co-authored-by: Dzmitry Malyshau <[email protected]>
.lock() | ||
.unwrap() | ||
.wait_idle(&self.shared.device); | ||
debug!("waiting for idle"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason not to share the wait_idle
implementation across device and command?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it could be shared, yes
Fixes #2069
Includes #2070 (please only review the last 2 commits)The PR effectively removes all the complicated memory allocation tracking from the Metal backend, instead relying on mapping the available storage types (with CPU caching policy) more accurately to what can be represented in Vulkan API.
With this in, we slice through the whole
memory
section without crashes. The only issue I failed to fix/workaround is filed as #2077PR checklist:
make
succeeds (on *nix)make reftests
succeeds