Liboil Reference Manual | ||||
---|---|---|---|---|
Top | Description |
OilFunctionClass; #define OIL_DECLARE_CLASS (klass) #define OIL_DEFINE_CLASS_FULL (klass, string, test) #define OIL_DEFINE_CLASS (klass, string) OilFunctionClass * oil_class_get_by_index (int i); OilFunctionClass * oil_class_get (const char *class_name); void oil_class_optimize (OilFunctionClass *klass); int oil_class_get_n_classes (void); void oil_class_choose_by_name (OilFunctionClass *klass, const char *name); void oil_class_register_impl_by_name (const char *klass_name, OilFunctionImpl *impl); void oil_class_register_impl (OilFunctionClass *klass, OilFunctionImpl *impl); void oil_class_register_impl_full (OilFunctionClass *klass, void (funcvoid) (), const char *name, unsigned int flags);
Functions operate on arrays of data. The arrays can be either source arrays (input only), destination arrays (output only), or in-place arrays (both input and output).
The interpretation of a parameter can usually be determined from its name. Parameters for arrays are of the form d1_1xn, where the first character represents the direction (source, destination, or in-place), the second represents the index for that particular direction, and the characters after the underscore indicate the size of the array. In this case, "1xn" represents an array that is 1 by N. Note that the index and the size can both be omitted, giving a default of 1 for the index and 1xn for the size.
Parameters that represent strides are of the form "d1s". The interpretation is similar to above, except that the s indicates a stride parameter.
The exceptions to the above rule are "dest", "src", "dstr", "sstr", etc. These are aliases for "d1", "s1", "d1s", and "s1s", respectively. This form is deprecated and will be removed in the 0.4 series.
Two special parameters are "n" and "m", which determine the size of the arrays in other parameters.
Data arrays are laid out such that rows are separated by the number of bytes given by the corresponding stride. Elements in each row are contiguous. If there is no stride parameter corresponding to an array, the rows of the array are contiguous.
typedef struct { } OilFunctionClass;
An opaque structure representing a function class.
#define OIL_DECLARE_CLASS(klass)
Declares the Liboil function class klass
.
|
the name of a function class (without the oil_ prefix) |
#define OIL_DEFINE_CLASS_FULL(klass, string, test)
Defines a OilFunctionClass structure for klass
. Classes
defined this way will be automatically at Liboil initialization
time.
|
name of class to declare (without oil_ prefix) |
|
prototype of class |
|
test function |
#define OIL_DEFINE_CLASS(klass, string)
Defines a OilFunctionClass structure for klass
. Classes
defined this way will be automatically at Liboil initialization
time.
|
name of class to declare (without oil_ prefix) |
|
prototype of class |
OilFunctionClass * oil_class_get_by_index (int i);
Returns a pointer to the function class with index i
.
|
index |
Returns : |
an OilFunctionClass
|
OilFunctionClass * oil_class_get (const char *class_name);
Returns a pointer to the function class that has the given class name. If no such class is found, NULL is returned.
|
the name of the function class |
Returns : |
a pointer to a function class |
void oil_class_optimize (OilFunctionClass *klass);
Tests and profiles each implementation for the given function class. Testing compares the output of running each implementation on random input against the reference implementation for the same input.
|
a function class |
int oil_class_get_n_classes (void);
Returns the number of function classes.
Returns : |
the number of function classes |
void oil_class_choose_by_name (OilFunctionClass *klass, const char *name);
Sets the chosen implementation for the given function class to the implementation with the given name. If no implementation having the given name is found, the chosen implementation is not changed.
|
a function class |
|
the name of an implementation |
void oil_class_register_impl_by_name (const char *klass_name, OilFunctionImpl *impl);
Adds impl
to the list of implementations associated with
the function class given by klass_name
.
|
the name of the class |
|
an implementation |
void oil_class_register_impl (OilFunctionClass *klass, OilFunctionImpl *impl);
Adds impl
to the list of implementations associated with
the function class given by klass
.
|
the class |
|
an implementation |
void oil_class_register_impl_full (OilFunctionClass *klass, void (funcvoid) (), const char *name, unsigned int flags);
Adds func
to the list of implementations associated with
the function class given by klass
.
|
the class |
|
the function |
|
name of the function |
|
CPU flags |