Skip to content

Commit

Permalink
remove extra sync, and make sure copyNext is always synchronous with …
Browse files Browse the repository at this point in the history
…the cuda stream
  • Loading branch information
abellina committed Nov 22, 2024
1 parent 2619cab commit b48b801
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,8 @@ object SpillableHostBufferHandle extends Logging {
while (chunkedPacker.hasNext) {
withResource(chunkedPacker.next(bb)) { n =>
builder.copyNext(n, Cuda.DEFAULT_STREAM)
// we are calling chunked packer on `bb` again each time, we need
// to synchronize before we ask for the next chunk
Cuda.DEFAULT_STREAM.sync()
// copyNext is synchronous w.r.t. the cuda stream passed,
// no need to synchronize here.
}
}
}
Expand All @@ -221,7 +220,6 @@ object SpillableHostBufferHandle extends Logging {
withResource(
SpillFramework.stores.hostStore.makeBuilder(handle)) { builder =>
builder.copyNext(buff, Cuda.DEFAULT_STREAM)
Cuda.DEFAULT_STREAM.sync()
builder.build
}
}
Expand Down Expand Up @@ -1163,7 +1161,7 @@ class SpillableHostStore(val maxSize: Option[Long] = None)

override def copyNext(mb: DeviceMemoryBuffer, stream: Cuda.Stream): Unit = {
GpuTaskMetrics.get.spillToHostTime {
singleShotBuffer.copyFromMemoryBufferAsync(
singleShotBuffer.copyFromMemoryBuffer(
copied,
mb,
0,
Expand Down

0 comments on commit b48b801

Please sign in to comment.