Switch WgpuWrapper to a macro and have it compute Send/Sync eagerly - #25512
Switch WgpuWrapper to a macro and have it compute Send/Sync eagerly#25512SkiFire13 wants to merge 12 commits into
Send/Sync eagerly#25512Conversation
|
Honestly i think thw 4 seconds are worth it, and it doesn't seem like many of the types are public if any at all? |
Note that previously |
|
It seems only bevy_pbr needs one of them as public, and for a usecase that i think could easily be changed to not need access to the wgpu wrapper type. tho i haven't looked how much WgpuWrapper is used across the ecosystem. Kinda wish it was easily possible to search all of crates.io (not just all of github) |
|
Could this also be added to a (potential) 0.19.2 release? :> Currently the forward compat warning is printed on every build, even on a no-op build. It can be worked around by manually setting the recursion limit to something higher, but every downstream crate needs to repeat that. It's also possible to Upside is, it only applies to recent nightly rustc versions, so not everyone should run into this. I would expect it to become more common over time though, as more people upgrade their nightly versions. So if a 0.19.2 gets released, it would be great to have this, and/or the related wgpu-fix in that release. |
|
IIRC this is a compile-time optimization discovered while attempting to solve the overflow, but doesn't actually fully solve it. That would mean backporting it would be nice for compile times but not get rid of the warning. |
|
This seems to conclusively solve According to Heaptrack (which i was messing around with trying to understand why) this PR manages to cut the memory needed to compile just I haven't tested this with just the wgpu PR, but if memory is at all correlated to runtime then its likely this is still way worth it. The heaptrack files, for those curious: https://share.yadamiel.com/bevy_benchmarks/wgpu-eager-send-sync/ |
stuartparmenter
left a comment
There was a problem hiding this comment.
Seems reasonable to me and can't think of any obvious reasons why one would need it externally. The only hit I found in my dependencies was a test in Hanabi where it is mocking a RenderQueue.
Probably worth a migration guide or note somewhere though
tychedelia
left a comment
There was a problem hiding this comment.
I think this is fine? Although it's definitely ugly. Not blowing up the compiler is probably a worthwhile fix no matter the cost.
|
I changed the way Moreover I removed the |
Objective
bevy_render-Znext-solverenabled by default #25511Solution
While investigating a wgpu trait overflow issue with the new solver I noticed that eagerly computing its
Send/Syncreduces the compile time ofbevy_renderby around 10 seconds (on my machine debug goes from 20s to 9s and release from 26s to 15s).I don't like too much having to expose all these types though, and we might get the same perf benefits if gfx-rs/wgpu#9953 is merged though (edit: I tested with that PR changes and that alone reduces compile times by ~6 seconds, however when this PR is added it reduces another ~4 seconds).
I also ended up removing the
Arcs used in some of the wgpu wrapper types, as all wgpu types now useArcs under the hood or equivalent.