1 #ifndef VIENNACL_DEVICE_SPECIFIC_FORWARDS_H
2 #define VIENNACL_DEVICE_SPECIFIC_FORWARDS_H
41 namespace device_specific
45 static const int TEMPLATE_VALID = 0;
46 static const int TEMPLATE_LOCAL_MEMORY_OVERFLOW = -1;
47 static const int TEMPLATE_WORK_GROUP_SIZE_OVERFLOW = -2;
48 static const int TEMPLATE_LOCAL_SIZE_0_OVERFLOW = -3;
49 static const int TEMPLATE_LOCAL_SIZE_1_OVERFLOW = -4;
50 static const int TEMPLATE_LOCAL_SIZE_2_OVERFLOW = -5;
51 static const int TEMPLATE_LOCAL_SIZE_NOT_WARP_MULTIPLE = -6;
52 static const int TEMPLATE_INVALID_SIMD_WIDTH = -7;
53 static const int TEMPLATE_INVALID_FETCHING_POLICY_TYPE= -9;
55 static const int TEMPLATE_GLOBAL_MEMORY_REQUIRES_ZERO_LOCAL_FETCH = -10;
56 static const int TEMPLATE_MS_NS_MUST_BE_SIMD_WIDTH_MULTIPLE = -11;
57 static const int TEMPLATE_KS_MUST_BE_SMALLER_THAN_KL = -12;
58 static const int TEMPLATE_SIMD_WIDTH_MUST_BE_ONE = -13;
59 static const int TEMPLATE_LOCAL_FETCH_PRODUCT_MUST_MATCH_LOCAL_SIZE_PRODUCT = -14;
60 static const int TEMPLATE_LOCAL_FETCH_0_MUST_BE_KL_MULTIPLE = -15;
61 static const int TEMPLATE_LOCAL_FETCH_0_MUST_BE_NL_MULTIPLE = -16;
62 static const int TEMPLATE_LOCAL_FETCH_1_MUST_BE_KL_MULTIPLE = -17;
63 static const int TEMPLATE_LOCAL_FETCH_1_MUST_BE_ML_MULTIPLE = -18;
68 index_tuple(std::string
const & _i, std::string
const & _bound0, std::string
const & _j, std::string
const & _bound1) :
i(_i),
bound0(_bound0),
j(_j),
bound1(_bound1){ }
124 default :
return "INVALID EXPRESSION";
129 static std::string generate_value_kernel_argument(std::string
const & scalartype, std::string
const & name)
131 return scalartype +
' ' + name +
",";
135 static std::string generate_pointer_kernel_argument(std::string
const & address_space, std::string
const & scalartype, std::string
const & name)
137 return address_space +
" " + scalartype +
"* " + name +
",";
141 template<
typename KeyT,
typename ValueT>
142 ValueT
const &
at(std::map<KeyT, ValueT>
const & map, KeyT
const & key)
144 typename std::map<KeyT, ValueT>::const_iterator it = map.find(key);
148 throw std::out_of_range(
"Generator: Key not found in map");
152 template<
typename KeyT,
typename ValueT>
153 ValueT &
at(std::map<KeyT, ValueT> & map, KeyT
const & key)
155 typename std::map<KeyT, ValueT>::iterator it = map.find(key);
159 throw std::out_of_range(
"Generator: Key not found in map");
168 virtual const char*
what()
const throw() {
return message_.c_str(); }
171 std::string message_;
191 typedef std::map<mapping_key, tools::shared_ptr<mapped_object> >
mapping_type;
194 namespace tree_parsing
231 unsigned int current_arg_;
232 std::map<void*,unsigned int> memory;
242 unsigned int current_arg_;
243 std::map<void*,unsigned int> memory;
282 std::list<scheduler::statement>
const &
data()
const {
return data_; }
287 std::list<scheduler::statement> data_;
This file provides the forward declarations for the OpenCL layer of ViennaCL.
virtual const char * what() const
virtual ~generator_not_supported_exception()
Exception for the case the generator is unable to deal with the operation.
std::string device_name_type
index_tuple(std::string const &_i, std::string const &_bound0)
Some helper routines for reading/writing/printing scheduler expressions.
bool bind(viennacl::backend::mem_handle const *)
void traverse(scheduler::statement const &statement, vcl_size_t root_idx, Fun const &fun, bool inspect)
Recursively execute a functor on a statement.
statements_container(scheduler::statement const &s0, scheduler::statement const &s1, order_type order)
statement_node_type_family type_family
viennacl::scalar< float > s1
std::list< scheduler::statement > const & data() const
operation_node_type_family type_family
Implementation of a shared pointer class (cf. std::shared_ptr, boost::shared_ptr). Will be used until C++11 is widely available.
scheduler::statement_node const & lhs_most(scheduler::statement::container_type const &array, vcl_size_t root)
Main namespace in ViennaCL. Holds all the basic types such as vector, matrix, etc. and defines operations upon them.
bool is_scalar_reduction(scheduler::statement_node const &node)
std::vector< value_type > container_type
virtual ~symbolic_binder()
generator_not_supported_exception()
const char * expression_type_to_string(expression_type type)
generator_not_supported_exception(std::string message)
index_tuple(std::string const &_i, std::string const &_bound0, std::string const &_j, std::string const &_bound1)
virtual bool bind(viennacl::backend::mem_handle const *ph)=0
std::string evaluate(leaf_t leaf, std::map< std::string, std::string > const &accessors, scheduler::statement const &statement, vcl_size_t root_idx, mapping_type const &mapping)
Implements the multi-memory-domain handle.
statements_container(data_type const &data, order_type order)
std::list< scheduler::statement > data_type
Provides the datastructures for dealing with a single statement such as 'x = y + z;'.
std::map< mapping_key, tools::shared_ptr< mapped_object > > mapping_type
statements_container(scheduler::statement const &s0)
cl_device_type device_type
bool bind(viennacl::backend::mem_handle const *ph)
Main abstraction class for multiple memory domains. Represents a buffer in either main RAM...
The main class for representing a statement such as x = inner_prod(y,z); at runtime.
bool is_vector_reduction(scheduler::statement_node const &node)
ValueT const & at(std::map< KeyT, ValueT > const &map, KeyT const &key)
Emulation of C++11's .at() member for std::map<>, const-version.
std::pair< vcl_size_t, leaf_t > mapping_key
Main datastructure for an node in the statement tree.
tools::shared_ptr< symbolic_binder > make_binder(binding_policy_t policy)
void process(utils::kernel_generation_stream &stream, leaf_t leaf, std::string const &type_key, std::string const &to_process, scheduler::statement const &statement, vcl_size_t root_idx, mapping_type const &mapping, std::set< std::string > &already_processed)