Skip to content
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

Bit shifting operators #85

Open
Disclosure opened this issue Jan 22, 2017 · 3 comments
Open

Bit shifting operators #85

Disclosure opened this issue Jan 22, 2017 · 3 comments

Comments

@Disclosure
Copy link

Disclosure commented Jan 22, 2017

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:

capture

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.

@takagi
Copy link
Owner

takagi commented Jan 23, 2017

Thanks for reporting. I will check it.

@guicho271828
Copy link

Not entirely unrelated, but when i tried AVM it complained that coerce was not found.

@takagi
Copy link
Owner

takagi commented Jan 23, 2017

@guicho271828 Yes, it is reported in takagi/avm#44 . I need to take care of it too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants