Skip to content

Commit efdcf84

Browse files
committed
Workaround for AMD SDK
1 parent de59952 commit efdcf84

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Tensors/src/main/scala/com/thoughtworks/compute/Tensors.scala

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,14 @@ trait Tensors extends OpenCL {
6969
def buffer: DeviceBuffer[Float]
7070

7171
def toHostBuffer = {
72-
buffer.toHostBuffer(event)
72+
// We want to read buffer after `event` complete.
73+
// According to OpenCL's specification, we should pass the `event` as an `event_wait_list` to `clEnqueueReadBuffer`.
74+
// Unfortunately it seems not work on AMD SDK
75+
// buffer.toHostBuffer(event)
76+
//
77+
// Instead, we have to wait the event then call `clEnqueueReadBuffer`:
78+
event.waitForComplete() >> buffer.toHostBuffer(event)
79+
7380
}
7481
}
7582
object Tensor {

0 commit comments

Comments
 (0)