cl-cuda
cl-cuda copied to clipboard
Bit shifting operators
I am trying to apply a bit shifting shr operator in a do loop that I found in built-in.lisp (line 127) like so:
(defkernel reduce-array (void ((in float*) (out float*)))
(let ((x thread-idx-x))
(with-shared-memory ((acc float 64))
(set (aref acc x) (aref in x))
(syncthreads)
(do ((j 32 (shr j 1)))
((< j 1))
(when (< x j)
(set (aref acc x) (+ (aref acc x)
(aref acc (+ x j)))))
(syncthreads))
(when (= x 0)
(set (aref out 0) (aref acc 0)))))
However in a Ubuntu 16.04 sbcl I am getting a function undefined error:
The function SHR is undefined.
[Condition of type SIMPLE-ERROR]
The symbol appears to be exported in the built-in.lisp file but it seems like it cannot be found for some reason, when one tries to list all autocomplete symbols in slime, the shr symbol does not appear to be there:
The CL ASH function does not appear (expectedly) to work inside the kernel definition either, so how do I go about applying bit shifting in defkernel? Please excuse me if I am asking something entirely obvious, I am quite rusty on my Lisp skills after all these years.
Thanks for reporting. I will check it.
Not entirely unrelated, but when i tried AVM it complained that coerce was not found.
@guicho271828 Yes, it is reported in https://github.com/takagi/avm/issues/44 . I need to take care of it too.