wonnx
wonnx copied to clipboard
Fix/readability
We need to track 'readable' state because wgpu does not allow us to map buffers for reading that are also mappable for writing. We currently do this by passing 'output needs to be readable' flag when traversing the IR DAG.
This PR fixes an issue where if the same node's outputs in the IR DAG are read by more than one node (where it needs to be readable for the 'second' node that reads the output but not for the first), the output buffer is not made readable (as the first node did not require it).
@haixuanTao can you update the CI rust compiler?
error: package `wgpu-hal v0.13.1` cannot be built because it requires rustc 1.59 or newer, while the currently active rustc version is 1.58.1
(I am on the latest 1.62.0 myself)
Feel free to update the CI Rust Compiler.
OK. I'm not very familiar with the GitHub CI stuff so I will have to dig into this later.
@haixuanTao the change turns out to be quite trivial, it is part of #119
Note, this PR basically adds a second pass that traverses the DAG (pre_sequence
followed by sequence
) where the first one exists to mark output nodes and the second actually sequences. There might be ways to fix this issue without the extra pass, but I chose to go this route as it is very likely necessary to have this pass anyway to do the buffer allocation (#47).
I believe (but perhaps we should make this goal explicit) that we are optimizing for runtime rather than compile time (although compile should of course not be slower than necessary) and graph traversal shouldn't be particularly slow, but anyway. Would like to know your opinion.