-
Notifications
You must be signed in to change notification settings - Fork 7
Built in Functions
angavrilov edited this page Sep 13, 2010
·
5 revisions
These functions are supported in GPU code:
- abs
Translated to C (f|ll)abs(f) functions, depending on the argument type.
- + – * / 1+ 1-
These operations are directly translated to C arithmetic operators, and thus follow C type promotion and rounding rules: e.g, integer division truncates.
As a special exception (/ x) always returns a floating-point value because it would be useless and dangerous otherwise.
- t nil
These constants are interpreted as having boolean type, but nil may be used as an init expression for a declared variable of any type to specify the lack of initialization.
- and or
These support only boolean arguments, and return booleans.
- zerop < <= = /= >= >
- max min
Should work as documented.
- nonzerop
A counterpart to zerop, defined by this package.
- eq eql
Basically equivalent to =, implemented for better macro support.
- logand logior logxor logeqv lognot
- logandc1 logandc2 lognand lognor logorc1 logorc2
- sin asin sinh asinh
- cos acos cosh acosh
- tan atan tanh atanh
- exp sqrt log expt
These function are mapped to C standard library calls and have equivalent precision. In cases when the result would normally be a complex value, NaN is returned.
Unlike the standard lisp library versions, these functions return only one value:
- ffloor fceiling ftruncate fround
Implemented via equivalent library calls; always return a floating point-value.
- floor ceiling truncate round
Always return an integer. In complex cases implemented via the floating-point equivalents.
- array-total-size array-dimension aref
Similar to the lisp versions.
- (raw-aref array index)
Due to the frequent use of pitched allocation to achieve perfect data alignment in gpu arrays, row-major-aref is difficult to implement transparently. This is its functional equivalent that acknowledges the presense of alignment holes in its index range.
- (array-raw-extent array)
Returns the size of the index range for raw-aref. For pitched arrays it is greater than array-total-size.
- (array-raw-stride array dim-idx)
Returns the stepping for the corresponding dimension with corrections for pitch.
(aref a i j k) = (raw-aref a (+ (* i (array-raw-stride a 0)) (* j (array-raw-stride a 1)) k))
The value of the array parameter must be statically resolvable to the original global variable, kernel parameter or fully declared local array variable.