-
-
Notifications
You must be signed in to change notification settings - Fork 22
feat: Out with flushing, in with batching #1684
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
base: main
Are you sure you want to change the base?
Conversation
pkg.pr.new packages
benchmark commit |
86a51f6
to
d3e5837
Compare
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 think pipelines with performacne callback should submit the callback functions to the batch to be run after instead of forcing the flush. This shouldn't affect the results of the performance callback at all and will simplify when we flush.
82d6b71
to
de727ca
Compare
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.
Good job! 🚽
I leave some comments, mostly nits and stylistic preferences.
return; | ||
} | ||
const result = await querySet.read(); | ||
querySet.read().then((result) => { |
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.
We're reading the query set, but it's using its own command encoder, which means we will read the query set before resolving it. @reczkok What do you think?
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've investigated this, and you are right. I'll revisit the changes and add additional tests to avoid similar mistakes in the future.
return; | ||
} | ||
const result = await querySet.read(); | ||
querySet.read().then(async (result) => { |
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.
read
handles flushing
this.count * BigUint64Array.BYTES_PER_ELEMENT, | ||
); | ||
this._group.device.queue.submit([commandEncoder.finish()]); | ||
await this._group.device.queue.onSubmittedWorkDone(); |
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.
we don't need to wait, because mapAsync
waits for us for the busy buffer
Changes:
draw
,drawIndexed
,dispatchWorkgroups
flush immediately by defaultwrite
,writePartial
,read
,console.log
always flush, even inside batch environmentbatch
command onroot['~unstable']
it allows to submit more than 1 command in command encoderbatch
Closes #1667.
TODO:
flush()
andcommandEncoder()
toroot
internalsroot.test.ts
flush
submits encoder, handle null, clears command encodercommandEncoder()
returns always not null, does not recreate withoutflush()
renderPipeline.test.ts
computePipeline.test.ts
batch()
toroot['~unstable']
batch()
nested batchconsole.log