ViennaCL - The Vienna Computing Library
1.5.2
|
Base class for an operation profile. More...
#include <profile_base.hpp>
Public Types | |
typedef std::list< std::pair < scheduler::statement, scheduler::statement_node > > | statements_type |
Public Member Functions | |
profile_base (unsigned int vectorization, vcl_size_t local_size_1, vcl_size_t local_size_2, vcl_size_t num_kernels) | |
The constructor. | |
virtual | ~profile_base () |
The destructor. | |
virtual void | configure_range_enqueue_arguments (vcl_size_t kernel_id, statements_type const &statements, viennacl::ocl::kernel &k, unsigned int &n_arg) const =0 |
Configures the range and enqueues the arguments associated with the profile. | |
virtual void | kernel_arguments (statements_type const &statements, std::string &arguments_string) const =0 |
unsigned int | vector_size () const |
Get the vector size of the kernel. | |
virtual std::string | csv_representation () const =0 |
csv representation of an operation | |
bool | is_slow (viennacl::ocl::device const &dev) const |
returns whether or not the profile is likely to be slow on a particular device | |
bool | is_invalid (viennacl::ocl::device const &dev, vcl_size_t scalartype_size) const |
returns whether or not the profile leads to undefined behavior on particular device | |
vcl_size_t | num_kernels () const |
Returns the number of kernels needed by this operation. | |
virtual void | operator() (utils::kernel_generation_stream &stream, vcl_size_t device_offset, statements_type const &statements) const |
Generates the code associated with this profile onto the provided stream Redirects to the virtual core() method. | |
Protected Member Functions | |
virtual bool | invalid_impl (viennacl::ocl::device const &, vcl_size_t) const |
virtual bool | is_slow_impl (viennacl::ocl::device const &) const |
virtual vcl_size_t | lmem_used (vcl_size_t) const |
void | configure_local_sizes (viennacl::ocl::kernel &k, vcl_size_t) const |
virtual void | print (std::ostream &s) const |
virtual void | core (vcl_size_t kernel_id, utils::kernel_generation_stream &stream, statements_type const &statements, std::vector< detail::mapping_type > const &mapping) const =0 |
Generates the body of the associated kernel function. | |
Protected Attributes | |
unsigned int | vector_size_ |
vcl_size_t | local_size_1_ |
vcl_size_t | local_size_2_ |
vcl_size_t | num_kernels_ |
Friends | |
std::ostream & | operator<< (std::ostream &, profile_base const &) |
Base class for an operation profile.
typedef std::list< std::pair<scheduler::statement, scheduler::statement_node> > statements_type |
profile_base | ( | unsigned int | vectorization, |
vcl_size_t | local_size_1, | ||
vcl_size_t | local_size_2, | ||
vcl_size_t | num_kernels | ||
) | [inline] |
The constructor.
virtual ~profile_base | ( | ) | [inline, virtual] |
The destructor.
void configure_local_sizes | ( | viennacl::ocl::kernel & | k, |
vcl_size_t | |||
) | const [inline, protected] |
virtual void configure_range_enqueue_arguments | ( | vcl_size_t | kernel_id, |
statements_type const & | statements, | ||
viennacl::ocl::kernel & | k, | ||
unsigned int & | n_arg | ||
) | const [pure virtual] |
Configures the range and enqueues the arguments associated with the profile.
Implemented in scalar_reduction, matrix_saxpy, matrix_product, vector_reduction, and vector_saxpy.
virtual void core | ( | vcl_size_t | kernel_id, |
utils::kernel_generation_stream & | stream, | ||
statements_type const & | statements, | ||
std::vector< detail::mapping_type > const & | mapping | ||
) | const [protected, pure virtual] |
Generates the body of the associated kernel function.
kernel_id | If this profile requires multiple kernel, the index for which the core should be generated |
stream | The output stream the kernel is written to |
statements | the statements for which the code should be generated |
mapping | the mapping of the statement_nodes to the mapped_objects |
virtual std::string csv_representation | ( | ) | const [pure virtual] |
csv representation of an operation
Useful when writing to a file
Implemented in scalar_reduction, matrix_saxpy, matrix_product, vector_reduction, and vector_saxpy.
virtual bool invalid_impl | ( | viennacl::ocl::device const & | , |
vcl_size_t | |||
) | const [inline, protected, virtual] |
bool is_invalid | ( | viennacl::ocl::device const & | dev, |
vcl_size_t | scalartype_size | ||
) | const [inline] |
returns whether or not the profile leads to undefined behavior on particular device
dev | the given device |
scalartype_size | Local memory required to execute the kernel |
bool is_slow | ( | viennacl::ocl::device const & | dev | ) | const [inline] |
returns whether or not the profile is likely to be slow on a particular device
dev | the given device |
virtual bool is_slow_impl | ( | viennacl::ocl::device const & | ) | const [inline, protected, virtual] |
virtual void kernel_arguments | ( | statements_type const & | statements, |
std::string & | arguments_string | ||
) | const [pure virtual] |
Implemented in scalar_reduction, matrix_product, matrix_saxpy, vector_reduction, and vector_saxpy.
virtual vcl_size_t lmem_used | ( | vcl_size_t | ) | const [inline, protected, virtual] |
Reimplemented in scalar_reduction.
vcl_size_t num_kernels | ( | ) | const [inline] |
Returns the number of kernels needed by this operation.
virtual void operator() | ( | utils::kernel_generation_stream & | stream, |
vcl_size_t | device_offset, | ||
statements_type const & | statements | ||
) | const [inline, virtual] |
Generates the code associated with this profile onto the provided stream Redirects to the virtual core() method.
stream | Stream onto which the code should be generated |
device_offset | the index of the device in the context (used for the kernel name) |
statements | the statements associated with this profile |
Get Prototype, initialize mapping
virtual void print | ( | std::ostream & | s | ) | const [inline, protected, virtual] |
unsigned int vector_size | ( | ) | const [inline] |
Get the vector size of the kernel.
std::ostream& operator<< | ( | std::ostream & | os, |
profile_base const & | profile | ||
) | [friend] |
vcl_size_t local_size_1_ [protected] |
vcl_size_t local_size_2_ [protected] |
vcl_size_t num_kernels_ [protected] |
unsigned int vector_size_ [protected] |