2015-07-11 09:36:01 -04:00
|
|
|
#ifndef ISAAC_BACKEND_TEMPLATES_DOT_H
|
|
|
|
#define ISAAC_BACKEND_TEMPLATES_DOT_H
|
2015-01-12 13:20:53 -05:00
|
|
|
|
2015-08-04 20:56:05 -07:00
|
|
|
#include "isaac/kernels/templates/base.h"
|
2015-01-12 13:20:53 -05:00
|
|
|
|
2015-04-29 15:50:57 -04:00
|
|
|
namespace isaac
|
2015-01-12 13:20:53 -05:00
|
|
|
{
|
2015-07-11 09:36:01 -04:00
|
|
|
namespace templates
|
|
|
|
{
|
2015-01-12 13:20:53 -05:00
|
|
|
|
2015-12-12 18:32:06 -05:00
|
|
|
struct reduce_1d_parameters : public base::parameters_type
|
2015-01-12 13:20:53 -05:00
|
|
|
{
|
2015-12-12 18:32:06 -05:00
|
|
|
reduce_1d_parameters(unsigned int _simd_width,
|
2015-01-12 13:20:53 -05:00
|
|
|
unsigned int _group_size, unsigned int _num_groups,
|
|
|
|
fetching_policy_type _fetching_policy);
|
|
|
|
unsigned int num_groups;
|
|
|
|
fetching_policy_type fetching_policy;
|
|
|
|
};
|
|
|
|
|
2015-12-12 18:32:06 -05:00
|
|
|
class reduce_1d : public base_impl<reduce_1d, reduce_1d_parameters>
|
2015-01-12 13:20:53 -05:00
|
|
|
{
|
|
|
|
private:
|
2015-09-30 15:31:41 -04:00
|
|
|
unsigned int lmem_usage(math_expression const & expressions) const;
|
|
|
|
int is_invalid_impl(driver::Device const &, math_expression const &) const;
|
2015-12-18 18:10:05 -05:00
|
|
|
unsigned int temporary_workspace(math_expression const & expressions) const;
|
2015-12-12 18:32:06 -05:00
|
|
|
inline void reduce_1d_local_memory(kernel_generation_stream & stream, unsigned int size, std::vector<mapped_reduce_1d*> exprs,
|
2015-04-29 15:50:57 -04:00
|
|
|
std::string const & buf_str, std::string const & buf_value_str, driver::backend_type backend) const;
|
2015-09-30 15:31:41 -04:00
|
|
|
std::string generate_impl(std::string const & suffix, math_expression const & expressions, driver::Device const & device, mapping_type const & mapping) const;
|
2015-01-12 13:20:53 -05:00
|
|
|
|
|
|
|
public:
|
2015-12-12 18:32:06 -05:00
|
|
|
reduce_1d(reduce_1d::parameters_type const & parameters, binding_policy_t binding_policy = BIND_INDEPENDENT);
|
|
|
|
reduce_1d(unsigned int simd, unsigned int ls, unsigned int ng, fetching_policy_type fetch, binding_policy_t bind = BIND_INDEPENDENT);
|
2015-09-30 15:31:41 -04:00
|
|
|
std::vector<int_t> input_sizes(math_expression const & expressions) const;
|
|
|
|
void enqueue(driver::CommandQueue & queue, driver::Program const & program, std::string const & suffix, base & fallback, execution_handler const &);
|
2015-01-12 13:20:53 -05:00
|
|
|
private:
|
2015-04-29 15:50:57 -04:00
|
|
|
std::vector< driver::Buffer > tmp_;
|
|
|
|
std::vector< driver::Buffer > tmpidx_;
|
2015-01-12 13:20:53 -05:00
|
|
|
};
|
|
|
|
|
2015-07-11 09:36:01 -04:00
|
|
|
}
|
2015-01-12 13:20:53 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|