diff --git a/extra/opencl/ffi/ffi-tests.factor b/extra/opencl/ffi/ffi-tests.factor index 08d13062e1..a1baf084ac 100644 --- a/extra/opencl/ffi/ffi-tests.factor +++ b/extra/opencl/ffi/ffi-tests.factor @@ -1,8 +1,8 @@ ! Copyright (C) 2010 Erik Charlebois. ! See http://factorcode.org/license.txt for BSD license. USING: tools.test opencl.ffi multiline locals kernel io.encodings.ascii -io.encodings.string sequences libc alien.c-types destructors math specialized-arrays -math.order alien ; +io.encodings.string sequences libc alien.c-types destructors math +specialized-arrays alien.data math.order alien ; FROM: alien.c-types => float ; SPECIALIZED-ARRAYS: float void* ; IN: opencl.ffi.tests diff --git a/extra/opencl/opencl-tests.factor b/extra/opencl/opencl-tests.factor index 316d496ac8..15eaf0646c 100644 --- a/extra/opencl/opencl-tests.factor +++ b/extra/opencl/opencl-tests.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: multiline locals io.encodings.ascii io.encodings.string sequences math specialized-arrays alien.c-types math.order alien opencl tools.test -accessors arrays destructors kernel namespaces ; +accessors arrays destructors kernel namespaces alien.data ; FROM: alien.c-types => float ; SPECIALIZED-ARRAY: float IN: opencl.tests @@ -31,13 +31,14 @@ __kernel void square( "" kernel-source 1array &dispose "square" &dispose :> kernel cl-read-access num-bytes in &dispose :> in-buffer cl-write-access num-bytes f &dispose :> out-buffer - + kernel in-buffer out-buffer num-floats uint 3array { num-floats } [ ] cl-queue-kernel &dispose drop cl-finish + out-buffer 0 num-bytes - cl-read-buffer num-floats flloat + cl-read-buffer num-floats \ float ] with-cl-state ] with-destructors ; diff --git a/extra/opencl/opencl.factor b/extra/opencl/opencl.factor index e1c105959d..1641579402 100644 --- a/extra/opencl/opencl.factor +++ b/extra/opencl/opencl.factor @@ -424,7 +424,7 @@ PRIVATE> [ cl-current-device ,, ] when* [ cl-current-context ,, ] when* ] 3curry H{ } make - ] dip with-variable ; inline + ] dip with-variables ; inline : cl-platforms ( -- platforms ) 0 f 0 uint [ clGetPlatformIDs cl-success ] keep uint deref