ViennaCL - The Vienna Computing Library: viennacl/device_specific/mapped_objects.hpp Source File

ViennaCL - The Vienna Computing Library 1.7.1 Free open-source GPU-accelerated linear algebra and solver library. |

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
mapped_objects.hpp
Go to the documentation of this file.
1 #ifndef VIENNACL_DEVICE_SPECIFIC_MAPPED_TYPE_HPP
2 #define VIENNACL_DEVICE_SPECIFIC_MAPPED_TYPE_HPP
3
4 /* =========================================================================
5 Copyright (c) 2010-2016, Institute for Microelectronics,
6 Institute for Analysis and Scientific Computing,
7 TU Wien.
8 Portions of this software are copyright by UChicago Argonne, LLC.
9
10 -----------------
11 ViennaCL - The Vienna Computing Library
12 -----------------
13
14 Project Head: Karl Rupp rupp@iue.tuwien.ac.at
15
16 (A list of authors and contributors can be found in the manual)
17
18 License: MIT (X11), see file LICENSE in the base directory
19 ============================================================================= */
20
21
26 #include <string>
27
28 #include "viennacl/scheduler/forwards.h"
29 #include "viennacl/device_specific/forwards.h"
30 #include "viennacl/device_specific/utils.hpp"
31
32 namespace viennacl
33 {
34
35 namespace device_specific
36 {
37
43 class mapped_object
44 {
45 private:
46 virtual void postprocess(std::string &) const { }
47
48 protected:
49 struct MorphBase { virtual ~MorphBase(){} };
50 struct MorphBase1D : public MorphBase { public: virtual std::string operator()(std::string const & i) const = 0; };
51 struct MorphBase2D : public MorphBase { public: virtual std::string operator()(std::string const & i, std::string const & j) const = 0; };
52
53 static void replace_offset(std::string & str, MorphBase const & morph)
54 {
55 vcl_size_t pos = 0;
56 while ((pos=str.find("$OFFSET", pos))!=std::string::npos)
57 {
58 std::string postprocessed;
59 vcl_size_t pos_po = str.find('{', pos);
60 vcl_size_t pos_pe = str.find('}', pos_po);
61
62 if (MorphBase2D const * p2d = dynamic_cast<MorphBase2D const *>(&morph))
63 {
64 vcl_size_t pos_comma = str.find(',', pos_po);
65 std::string i = str.substr(pos_po + 1, pos_comma - pos_po - 1);
66 std::string j = str.substr(pos_comma + 1, pos_pe - pos_comma - 1);
67 postprocessed = (*p2d)(i, j);
68 }
69 else if (MorphBase1D const * p1d = dynamic_cast<MorphBase1D const *>(&morph))
70 {
71 std::string i = str.substr(pos_po + 1, pos_pe - pos_po - 1);
72 postprocessed = (*p1d)(i);
73 }
74
75 str.replace(pos, pos_pe + 1 - pos, postprocessed);
76 pos = pos_pe;
77 }
78 }
79
80 void register_attribute(std::string & attribute, std::string const & key, std::string const & value)
81 {
82 attribute = value;
83 keywords_[key] = attribute;
84 }
85
86 public:
87 struct node_info
88 {
89 node_info(mapping_type const * _mapping, scheduler::statement const * _statement, vcl_size_t _root_idx) :
90 mapping(_mapping), statement(_statement), root_idx(_root_idx) { }
91 mapping_type const * mapping;
92 scheduler::statement const * statement;
93 vcl_size_t root_idx;
94 };
95
96 public:
97 mapped_object(std::string const & scalartype, unsigned int id, std::string const & type_key) : type_key_(type_key)
98 {
99 register_attribute(scalartype_, "#scalartype", scalartype);
100 register_attribute(name_, "#name", "obj" + tools::to_string(id));
101 }
102
103 virtual ~mapped_object(){ }
104
105 virtual std::string & append_kernel_arguments(std::set<std::string> &, std::string & str, unsigned int) const { return str; }
106
107 std::string type_key() const { return type_key_; }
108
109 std::string const & name() const { return name_; }
110
111 std::string process(std::string const & in) const
112 {
113 std::string res(in);
114 for (std::map<std::string,std::string>::const_iterator it = keywords_.begin(); it != keywords_.end(); ++it)
115 tools::find_and_replace(res, it->first, it->second);
116 postprocess(res);
117 return res;
118 }
119
120 std::string evaluate(std::map<std::string, std::string> const & accessors) const
121 {
122 if (accessors.find(type_key_)==accessors.end())
123 return name_;
124 return process(at(accessors, type_key_));
125 }
126
127
128 protected:
129 std::string name_;
130 std::string scalartype_;
131 std::string type_key_;
132 std::map<std::string, std::string> keywords_;
133 };
134
135
141 class binary_leaf
142 {
143 public:
144 binary_leaf(mapped_object::node_info info) : info_(info){ }
145
146 void process_recursive(utils::kernel_generation_stream & stream, leaf_t leaf, std::string const & key, std::string const & process_str, std::set<std::string> & already_fetched)
147 {
148 tree_parsing::process(stream, leaf, key, process_str, *info_.statement, info_.root_idx, *info_.mapping, already_fetched);
149 }
150
151 std::string evaluate_recursive(leaf_t leaf, std::map<std::string, std::string> const & accessors)
152 {
153 return tree_parsing::evaluate(leaf, accessors, *info_.statement, info_.root_idx, *info_.mapping);
154 }
155
156 protected:
157 mapped_object::node_info info_;
158 };
159
164 class mapped_matrix_product : public mapped_object, public binary_leaf
165 {
166 public:
167 mapped_matrix_product(std::string const & scalartype, unsigned int id, node_info info) : mapped_object(scalartype, id, "matrix_product"), binary_leaf(info) { }
168 };
169
174 class mapped_reduction : public mapped_object, public binary_leaf
175 {
176 public:
177 mapped_reduction(std::string const & scalartype, unsigned int id, node_info info, std::string const & type_key) : mapped_object(scalartype, id, type_key), binary_leaf(info){ }
178
179 vcl_size_t root_idx() const { return info_.root_idx; }
180 scheduler::statement const & statement() const { return *info_.statement; }
181 scheduler::statement_node root_node() const { return statement().array()[root_idx()]; }
182 bool is_index_reduction() const { return utils::is_index_reduction(info_.statement->array()[info_.root_idx].op); }
183
184 scheduler::op_element root_op() const
185 {
186 scheduler::op_element res = info_.statement->array()[info_.root_idx].op;
187 if (res.type==scheduler::OPERATION_BINARY_MAT_VEC_PROD_TYPE
188 ||res.type==scheduler::OPERATION_BINARY_INNER_PROD_TYPE)
189 res.type = scheduler::OPERATION_BINARY_ADD_TYPE;
190 return res;
191 }
192 };
193
198 class mapped_scalar_reduction : public mapped_reduction
199 {
200 public:
201 mapped_scalar_reduction(std::string const & scalartype, unsigned int id, node_info info) : mapped_reduction(scalartype, id, info, "scalar_reduction"){ }
202 };
203
208 class mapped_row_wise_reduction : public mapped_reduction
209 {
210 public:
211 mapped_row_wise_reduction(std::string const & scalartype, unsigned int id, node_info info) : mapped_reduction(scalartype, id, info, "row_wise_reduction") { }
212 };
213
218 class mapped_host_scalar : public mapped_object
219 {
220 public:
221 mapped_host_scalar(std::string const & scalartype, unsigned int id) : mapped_object(scalartype, id, "host_scalar"){ }
222
223 std::string & append_kernel_arguments(std::set<std::string> & already_generated, std::string & str, unsigned int width) const
224 {
225 if (already_generated.insert(name_).second)
226 str += generate_value_kernel_argument(utils::append_width(scalartype_, width), name_);
227 return str;
228 }
229 };
230
235 class mapped_handle : public mapped_object
236 {
237 private:
238 virtual void append_optional_arguments(std::string &) const = 0;
239
240 public:
241 mapped_handle(std::string const & scalartype, unsigned int id, std::string const & type_key) : mapped_object(scalartype, id, type_key)
242 {
243 register_attribute(pointer_, "#pointer", name_ + "_pointer");
244 }
245
246 std::string & append_kernel_arguments(std::set<std::string> & already_generated, std::string & str, unsigned int width) const
247 {
248 if (already_generated.insert(name_).second)
249 {
250 str += generate_pointer_kernel_argument("__global", utils::append_width(scalartype_, width), pointer_);
251 append_optional_arguments(str);
252 }
253 return str;
254 }
255
256 private:
257 std::string pointer_;
258 };
259
260
265 class mapped_scalar : public mapped_handle
266 {
267 private:
268 void append_optional_arguments(std::string &) const{ }
269
270 public:
271 mapped_scalar(std::string const & scalartype, unsigned int id) : mapped_handle(scalartype, id, "scalar") { }
272 };
273
278 class mapped_buffer : public mapped_handle
279 {
280 public:
281 mapped_buffer(std::string const & scalartype, unsigned int id, std::string const & type_key) : mapped_handle(scalartype, id, type_key){ }
282 };
283
288 class mapped_vector : public mapped_buffer
289 {
290 void append_optional_arguments(std::string & str) const
291 {
292 str += generate_value_kernel_argument("unsigned int", start_);
293 str += generate_value_kernel_argument("unsigned int", stride_);
294 }
295
296 public:
297 mapped_vector(std::string const & scalartype, unsigned int id) : mapped_buffer(scalartype, id, "vector")
298 {
299 register_attribute(start_, "#start", name_ + "_start");
300 register_attribute(stride_, "#stride", name_ + "_stride");
301 }
302
303 private:
304 std::string start_;
305 std::string stride_;
306 };
307
312 class mapped_matrix : public mapped_buffer
313 {
314 private:
315 void append_optional_arguments(std::string & str) const
316 {
317 str += generate_value_kernel_argument("unsigned int", ld_);
318 str += generate_value_kernel_argument("unsigned int", start1_);
319 str += generate_value_kernel_argument("unsigned int", start2_);
320 str += generate_value_kernel_argument("unsigned int", stride1_);
321 str += generate_value_kernel_argument("unsigned int", stride2_);
322 }
323
324 void postprocess(std::string & str) const
325 {
326 struct Morph : public MorphBase2D
327 {
328 Morph(bool _is_row_major, std::string const & _ld) : is_row_major(_is_row_major), ld(_ld){ }
329 std::string operator()(std::string const & i, std::string const & j) const
330 {
331 if (is_row_major)
332 return "(" + i + ") * " + ld + " + (" + j + ")";
333 return "(" + i + ") + (" + j + ") * " + ld;
334 }
335 private:
336 bool is_row_major;
337 std::string const & ld;
338 };
339 replace_offset(str, Morph(row_major_, ld_));
340 }
341
342 public:
343 mapped_matrix(std::string const & scalartype, unsigned int id, bool row_major) : mapped_buffer(scalartype, id, "matrix"), row_major_(row_major)
344 {
345 register_attribute(ld_, "#ld", name_ + "_ld");
346 register_attribute(start1_, "#start1", name_ + "_start1");
347 register_attribute(start2_, "#start2", name_ + "_start2");
348 register_attribute(stride1_, "#stride1", name_ + "_stride1");
349 register_attribute(stride2_, "#stride2", name_ + "_stride2");
350 if (row_major_)
351 keywords_["#nldstride"] = "#stride1";
352 else
353 keywords_["#nldstride"] = "#stride2";
354
355 if (row_major_)
356 {
357 std::swap(start1_, start2_);
358 std::swap(stride1_, stride2_);
359 }
360 }
361
362 bool row_major() const
363 {
364 return row_major_;
365 }
366
367 private:
368 std::string ld_;
369 std::string start1_;
370 std::string start2_;
371 std::string stride1_;
372 std::string stride2_;
373 bool row_major_;
374 };
375
380 class mapped_vector_diag : public mapped_object, public binary_leaf
381 {
382 private:
383 void postprocess(std::string &res) const
384 {
385 std::map<std::string, std::string> accessors;
386 tools::find_and_replace(res, "#diag_offset", tree_parsing::evaluate(RHS_NODE_TYPE, accessors, *info_.statement, info_.root_idx, *info_.mapping));
387 accessors["vector"] = res;
388 res = tree_parsing::evaluate(LHS_NODE_TYPE, accessors, *info_.statement, info_.root_idx, *info_.mapping);
389 }
390
391 public:
392 mapped_vector_diag(std::string const & scalartype, unsigned int id, node_info info) : mapped_object(scalartype, id, "vector_diag"), binary_leaf(info){ }
393 };
394
395
400 class mapped_trans: public mapped_object, public binary_leaf
401 {
402 private:
403 void postprocess(std::string &res) const
404 {
405 std::map<std::string, std::string> accessors;
406 accessors["matrix"] = res;
407 res = tree_parsing::evaluate(LHS_NODE_TYPE, accessors, *info_.statement, info_.root_idx, *info_.mapping);
408 }
409
410 public:
411 mapped_trans(std::string const & scalartype, unsigned int id, node_info info) : mapped_object(scalartype, id, "matrix_trans"), binary_leaf(info){ }
412 };
413
418 class mapped_matrix_row : public mapped_object, binary_leaf
419 {
420 private:
421 void postprocess(std::string &res) const
422 {
423 std::map<std::string, std::string> accessors;
424 tools::find_and_replace(res, "#row", tree_parsing::evaluate(RHS_NODE_TYPE, accessors, *info_.statement, info_.root_idx, *info_.mapping));
425 accessors["matrix"] = res;
426 res = tree_parsing::evaluate(LHS_NODE_TYPE, accessors, *info_.statement, info_.root_idx, *info_.mapping);
427 }
428
429 public:
430 mapped_matrix_row(std::string const & scalartype, unsigned int id, node_info info) : mapped_object(scalartype, id, "matrix_row"), binary_leaf(info)
431 { }
432 };
433
434
439 class mapped_matrix_column : public mapped_object, binary_leaf
440 {
441 private:
442 void postprocess(std::string &res) const
443 {
444 std::map<std::string, std::string> accessors;
445 tools::find_and_replace(res, "#column", tree_parsing::evaluate(RHS_NODE_TYPE, accessors, *info_.statement, info_.root_idx, *info_.mapping));
446 accessors["matrix"] = res;
447 res = tree_parsing::evaluate(LHS_NODE_TYPE, accessors, *info_.statement, info_.root_idx, *info_.mapping);
448 }
449
450 public:
451 mapped_matrix_column(std::string const & scalartype, unsigned int id, node_info info) : mapped_object(scalartype, id, "matrix_column"), binary_leaf(info)
452 { }
453 };
454
459 class mapped_matrix_diag : public mapped_object, binary_leaf
460 {
461 private:
462 void postprocess(std::string &res) const
463 {
464 std::map<std::string, std::string> accessors;
465 tools::find_and_replace(res, "#diag_offset", tree_parsing::evaluate(RHS_NODE_TYPE, accessors, *info_.statement, info_.root_idx, *info_.mapping));
466 accessors["matrix"] = res;
467 res = tree_parsing::evaluate(LHS_NODE_TYPE, accessors, *info_.statement, info_.root_idx, *info_.mapping);
468 }
469
470 public:
471 mapped_matrix_diag(std::string const & scalartype, unsigned int id, node_info info) : mapped_object(scalartype, id, "matrix_diag"), binary_leaf(info)
472 { }
473 };
474
479 class mapped_implicit_vector : public mapped_object
480 {
481 public:
482 mapped_implicit_vector(std::string const & scalartype, unsigned int id) : mapped_object(scalartype, id, "implicit_vector")
483 { }
484
485 std::string & append_kernel_arguments(std::set<std::string> & /*already_generated*/, std::string & str, unsigned int width) const
486 {
487 str += generate_value_kernel_argument(utils::append_width(scalartype_, width), name_);
488 return str;
489 }
490 };
491
496 class mapped_implicit_matrix : public mapped_object
497 {
498 public:
499 mapped_implicit_matrix(std::string const & scalartype, unsigned int id) : mapped_object(scalartype, id, "implicit_matrix")
500 { }
501
502 std::string & append_kernel_arguments(std::set<std::string> & /*already_generated*/, std::string & str, unsigned int width) const
503 {
504 str += generate_value_kernel_argument(utils::append_width(scalartype_, width), name_);
505 return str;
506 }
507 };
508
509 }
510
511 }
512 #endif
viennacl::device_specific::mapped_implicit_vector::append_kernel_arguments
std::string & append_kernel_arguments(std::set< std::string > &, std::string &str, unsigned int width) const
Definition: mapped_objects.hpp:485
viennacl::device_specific::mapped_implicit_matrix::mapped_implicit_matrix
mapped_implicit_matrix(std::string const &scalartype, unsigned int id)
Definition: mapped_objects.hpp:499
viennacl::device_specific::mapped_handle::append_kernel_arguments
std::string & append_kernel_arguments(std::set< std::string > &already_generated, std::string &str, unsigned int width) const
Definition: mapped_objects.hpp:246
viennacl::device_specific::mapped_object::type_key
std::string type_key() const
Definition: mapped_objects.hpp:107
viennacl::scheduler::OPERATION_BINARY_MAT_VEC_PROD_TYPE
Definition: forwards.h:144
viennacl::device_specific::mapped_reduction::root_idx
vcl_size_t root_idx() const
Definition: mapped_objects.hpp:179
viennacl::device_specific::mapped_object::name_
std::string name_
Definition: mapped_objects.hpp:129
viennacl::device_specific::binary_leaf
Binary leaf interface.
Definition: mapped_objects.hpp:141
viennacl::is_row_major
Helper class for checking whether a matrix has a row-major layout.
Definition: forwards.h:484
viennacl::device_specific::mapped_trans
Trans.
Definition: mapped_objects.hpp:400
viennacl::device_specific::binary_leaf::evaluate_recursive
std::string evaluate_recursive(leaf_t leaf, std::map< std::string, std::string > const &accessors)
Definition: mapped_objects.hpp:151
viennacl::device_specific::mapped_host_scalar::append_kernel_arguments
std::string & append_kernel_arguments(std::set< std::string > &already_generated, std::string &str, unsigned int width) const
Definition: mapped_objects.hpp:223
viennacl::device_specific::mapped_implicit_matrix
Implicit matrix.
Definition: mapped_objects.hpp:496
viennacl::device_specific::mapped_handle::mapped_handle
mapped_handle(std::string const &scalartype, unsigned int id, std::string const &type_key)
Definition: mapped_objects.hpp:241
viennacl::device_specific::leaf_t
leaf_t
Definition: forwards.h:180
viennacl::device_specific::mapped_object::append_kernel_arguments
virtual std::string & append_kernel_arguments(std::set< std::string > &, std::string &str, unsigned int) const
Definition: mapped_objects.hpp:105
viennacl::device_specific::mapped_object::type_key_
std::string type_key_
Definition: mapped_objects.hpp:131
viennacl::device_specific::mapped_vector_diag
Vector diag.
Definition: mapped_objects.hpp:380
viennacl::device_specific::mapped_implicit_matrix::append_kernel_arguments
std::string & append_kernel_arguments(std::set< std::string > &, std::string &str, unsigned int width) const
Definition: mapped_objects.hpp:502
viennacl::scheduler::statement::array
container_type const & array() const
Definition: forwards.h:528
viennacl::device_specific::mapped_object::~mapped_object
virtual ~mapped_object()
Definition: mapped_objects.hpp:103
viennacl::device_specific::mapped_object::evaluate
std::string evaluate(std::map< std::string, std::string > const &accessors) const
Definition: mapped_objects.hpp:120
viennacl::scheduler::op_element
Struct for holding the type family as well as the type of an operation (could be addition, subtraction, norm, etc.)
Definition: forwards.h:471
viennacl::device_specific::mapped_matrix_product
Matrix product.
Definition: mapped_objects.hpp:164
viennacl::device_specific::mapped_implicit_vector::mapped_implicit_vector
mapped_implicit_vector(std::string const &scalartype, unsigned int id)
Definition: mapped_objects.hpp:482
viennacl::device_specific::mapped_matrix_column
Matrix column.
Definition: mapped_objects.hpp:439
viennacl::device_specific::mapped_object::node_info::root_idx
vcl_size_t root_idx
Definition: mapped_objects.hpp:93
viennacl::device_specific::mapped_object::MorphBase2D::operator()
virtual std::string operator()(std::string const &i, std::string const &j) const =0
viennacl::device_specific::mapped_matrix_product::mapped_matrix_product
mapped_matrix_product(std::string const &scalartype, unsigned int id, node_info info)
Definition: mapped_objects.hpp:167
viennacl::device_specific::mapped_matrix::row_major
bool row_major() const
Definition: mapped_objects.hpp:362
viennacl::device_specific::mapped_matrix_diag::mapped_matrix_diag
mapped_matrix_diag(std::string const &scalartype, unsigned int id, node_info info)
Definition: mapped_objects.hpp:471
viennacl::device_specific::mapped_host_scalar
Host scalar.
Definition: mapped_objects.hpp:218
viennacl::device_specific::mapped_buffer
Buffered.
Definition: mapped_objects.hpp:278
viennacl::device_specific::mapped_trans::mapped_trans
mapped_trans(std::string const &scalartype, unsigned int id, node_info info)
Definition: mapped_objects.hpp:411
viennacl::device_specific::utils::kernel_generation_stream
Definition: utils.hpp:404
viennacl::traits::ld
vcl_size_t ld(matrix_base< NumericT > const &mat)
Helper routine for obtaining the internal number of entries per row of a ViennaCL matrix...
Definition: size.hpp:398
viennacl::scheduler::OPERATION_BINARY_INNER_PROD_TYPE
Definition: forwards.h:146
viennacl::tools::find_and_replace
int find_and_replace(std::string &source, std::string const &find, std::string const &replace)
Replace in a source string a pattern by another.
Definition: tools.hpp:160
viennacl::device_specific::RHS_NODE_TYPE
Definition: forwards.h:184
viennacl::device_specific::mapped_object::node_info::mapping
mapping_type const * mapping
Definition: mapped_objects.hpp:91
viennacl::device_specific::LHS_NODE_TYPE
Definition: forwards.h:182
viennacl::device_specific::mapped_object::MorphBase1D::operator()
virtual std::string operator()(std::string const &i) const =0
viennacl::device_specific::mapped_object::register_attribute
void register_attribute(std::string &attribute, std::string const &key, std::string const &value)
Definition: mapped_objects.hpp:80
viennacl::device_specific::mapped_reduction::is_index_reduction
bool is_index_reduction() const
Definition: mapped_objects.hpp:182
viennacl::device_specific::mapped_host_scalar::mapped_host_scalar
mapped_host_scalar(std::string const &scalartype, unsigned int id)
Definition: mapped_objects.hpp:221
viennacl::device_specific::tree_parsing::evaluate
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)
Definition: tree_parsing.hpp:293
viennacl::device_specific::mapped_scalar
Scalar.
Definition: mapped_objects.hpp:265
viennacl::device_specific::mapped_implicit_vector
Implicit vector.
Definition: mapped_objects.hpp:479
viennacl::device_specific::mapped_object::MorphBase2D
Definition: mapped_objects.hpp:51
viennacl::device_specific::mapped_object::MorphBase1D
Definition: mapped_objects.hpp:50
viennacl::device_specific::mapped_matrix_diag
Matrix diag.
Definition: mapped_objects.hpp:459
viennacl::device_specific::mapped_object::keywords_
std::map< std::string, std::string > keywords_
Definition: mapped_objects.hpp:132
forwards.h
Forwards declaration.
viennacl::device_specific::binary_leaf::binary_leaf
binary_leaf(mapped_object::node_info info)
Definition: mapped_objects.hpp:144
viennacl::vcl_size_t
std::size_t vcl_size_t
Definition: forwards.h:75
viennacl::device_specific::mapped_object::process
std::string process(std::string const &in) const
Definition: mapped_objects.hpp:111
viennacl::device_specific::mapped_reduction
Reduction.
Definition: mapped_objects.hpp:174
viennacl::device_specific::mapped_vector::mapped_vector
mapped_vector(std::string const &scalartype, unsigned int id)
Definition: mapped_objects.hpp:297
viennacl::device_specific::mapped_vector
Vector.
Definition: mapped_objects.hpp:288
forwards.h
Provides the datastructures for dealing with a single statement such as 'x = y + z;'.
viennacl::device_specific::mapped_object::MorphBase
Definition: mapped_objects.hpp:49
viennacl::linalg::cuda::swap
viennacl::enable_if< viennacl::is_scalar< ScalarT1 >::value &&viennacl::is_scalar< ScalarT2 >::value >::type swap(ScalarT1 &s1, ScalarT2 &s2)
Swaps the contents of two scalars, data is copied.
Definition: scalar_operations.hpp:361
viennacl::device_specific::mapped_object::node_info::node_info
node_info(mapping_type const *_mapping, scheduler::statement const *_statement, vcl_size_t _root_idx)
Definition: mapped_objects.hpp:89
viennacl::device_specific::mapped_matrix_row::mapped_matrix_row
mapped_matrix_row(std::string const &scalartype, unsigned int id, node_info info)
Definition: mapped_objects.hpp:430
viennacl::device_specific::mapping_type
std::map< mapping_key, tools::shared_ptr< mapped_object > > mapping_type
Definition: forwards.h:191
viennacl::device_specific::mapped_object
Mapped Object.
Definition: mapped_objects.hpp:43
viennacl::device_specific::mapped_object::scalartype_
std::string scalartype_
Definition: mapped_objects.hpp:130
viennacl::device_specific::mapped_row_wise_reduction::mapped_row_wise_reduction
mapped_row_wise_reduction(std::string const &scalartype, unsigned int id, node_info info)
Definition: mapped_objects.hpp:211
viennacl::device_specific::mapped_object::node_info
Definition: mapped_objects.hpp:87
viennacl::device_specific::mapped_matrix::mapped_matrix
mapped_matrix(std::string const &scalartype, unsigned int id, bool row_major)
Definition: mapped_objects.hpp:343
viennacl::device_specific::mapped_scalar_reduction
Scalar reduction.
Definition: mapped_objects.hpp:198
viennacl::device_specific::mapped_handle
Handle.
Definition: mapped_objects.hpp:235
viennacl::device_specific::mapped_buffer::mapped_buffer
mapped_buffer(std::string const &scalartype, unsigned int id, std::string const &type_key)
Definition: mapped_objects.hpp:281
utils.hpp
Internal utils.
viennacl::scheduler::op_element::type
operation_node_type type
Definition: forwards.h:474
viennacl::device_specific::mapped_object::mapped_object
mapped_object(std::string const &scalartype, unsigned int id, std::string const &type_key)
Definition: mapped_objects.hpp:97
viennacl::device_specific::mapped_scalar_reduction::mapped_scalar_reduction
mapped_scalar_reduction(std::string const &scalartype, unsigned int id, node_info info)
Definition: mapped_objects.hpp:201
viennacl::device_specific::binary_leaf::process_recursive
void process_recursive(utils::kernel_generation_stream &stream, leaf_t leaf, std::string const &key, std::string const &process_str, std::set< std::string > &already_fetched)
Definition: mapped_objects.hpp:146
viennacl::device_specific::utils::is_index_reduction
bool is_index_reduction(scheduler::op_element const &op)
Definition: utils.hpp:370
viennacl::device_specific::mapped_scalar::mapped_scalar
mapped_scalar(std::string const &scalartype, unsigned int id)
Definition: mapped_objects.hpp:271
viennacl::device_specific::mapped_vector_diag::mapped_vector_diag
mapped_vector_diag(std::string const &scalartype, unsigned int id, node_info info)
Definition: mapped_objects.hpp:392
viennacl::device_specific::mapped_matrix_row
Matrix row.
Definition: mapped_objects.hpp:418
viennacl::scheduler::statement
The main class for representing a statement such as x = inner_prod(y,z); at runtime.
Definition: forwards.h:502
viennacl::scheduler::OPERATION_BINARY_ADD_TYPE
Definition: forwards.h:118
viennacl::device_specific::mapped_reduction::root_op
scheduler::op_element root_op() const
Definition: mapped_objects.hpp:184
viennacl::device_specific::binary_leaf::info_
mapped_object::node_info info_
Definition: mapped_objects.hpp:157
viennacl::device_specific::at
ValueT const & at(std::map< KeyT, ValueT > const &map, KeyT const &key)
Emulation of C++11's .at() member for std::map<>, const-version.
Definition: forwards.h:142
viennacl::device_specific::mapped_matrix
Matrix.
Definition: mapped_objects.hpp:312
viennacl::tools::to_string
std::string to_string(T const t)
Definition: tools.hpp:304
viennacl::device_specific::mapped_object::name
std::string const & name() const
Definition: mapped_objects.hpp:109
viennacl::device_specific::mapped_reduction::mapped_reduction
mapped_reduction(std::string const &scalartype, unsigned int id, node_info info, std::string const &type_key)
Definition: mapped_objects.hpp:177
viennacl::device_specific::mapped_object::replace_offset
static void replace_offset(std::string &str, MorphBase const &morph)
Definition: mapped_objects.hpp:53
viennacl::row_major
A tag for row-major storage of a dense matrix.
Definition: forwards.h:304
viennacl::device_specific::mapped_reduction::statement
scheduler::statement const & statement() const
Definition: mapped_objects.hpp:180
viennacl::device_specific::mapped_object::MorphBase::~MorphBase
virtual ~MorphBase()
Definition: mapped_objects.hpp:49
viennacl::device_specific::mapped_row_wise_reduction
Vector reduction.
Definition: mapped_objects.hpp:208
viennacl::scheduler::statement_node
Main datastructure for an node in the statement tree.
Definition: forwards.h:478
viennacl::device_specific::mapped_matrix_column::mapped_matrix_column
mapped_matrix_column(std::string const &scalartype, unsigned int id, node_info info)
Definition: mapped_objects.hpp:451
viennacl::device_specific::mapped_reduction::root_node
scheduler::statement_node root_node() const
Definition: mapped_objects.hpp:181
viennacl::device_specific::tree_parsing::process
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)
Definition: tree_parsing.hpp:360
viennacl::device_specific::utils::append_width
std::string append_width(std::string const &str, unsigned int width)
Definition: utils.hpp:558
viennacl::device_specific::mapped_object::node_info::statement
scheduler::statement const * statement
Definition: mapped_objects.hpp:92