Code Quality: renamed base_impl -> parameterized_base

This commit is contained in:
Philippe Tillet
2016-10-03 14:12:57 -04:00
parent 294fc96a93
commit 889b4cffdf
13 changed files with 24 additions and 24 deletions

View File

@@ -91,12 +91,12 @@ public:
}; };
class base_impl : public base class parameterized_base : public base
{ {
private: private:
virtual int is_invalid_impl(driver::Device const &, expression_tree const &) const; virtual int is_invalid_impl(driver::Device const &, expression_tree const &) const;
public: public:
base_impl(unsigned int _vwidth, int_t _ls0, int_t _ls1); parameterized_base(unsigned int _vwidth, int_t _ls0, int_t _ls1);
unsigned int ls0() const; unsigned int ls0() const;
unsigned int ls1() const; unsigned int ls1() const;
/** @brief returns whether or not the profile has undefined behavior on particular device */ /** @brief returns whether or not the profile has undefined behavior on particular device */

View File

@@ -29,7 +29,7 @@ namespace isaac
namespace templates namespace templates
{ {
class elementwise_1d : public base_impl class elementwise_1d : public parameterized_base
{ {
private: private:
virtual int is_invalid_impl(driver::Device const &, expression_tree const &) const; virtual int is_invalid_impl(driver::Device const &, expression_tree const &) const;

View File

@@ -30,7 +30,7 @@ namespace isaac
namespace templates namespace templates
{ {
class elementwise_2d : public base_impl class elementwise_2d : public parameterized_base
{ {
private: private:
int is_invalid_impl(driver::Device const &, expression_tree const &) const; int is_invalid_impl(driver::Device const &, expression_tree const &) const;

View File

@@ -31,7 +31,7 @@ namespace isaac
namespace templates namespace templates
{ {
class gemm : public base_impl class gemm : public parameterized_base
{ {
private: private:
unsigned int temporary_workspace(expression_tree const & expressions) const; unsigned int temporary_workspace(expression_tree const & expressions) const;

View File

@@ -29,7 +29,7 @@ namespace isaac
namespace templates namespace templates
{ {
class reduce_1d : public base_impl class reduce_1d : public parameterized_base
{ {
private: private:
unsigned int lmem_usage(expression_tree const & expressions) const; unsigned int lmem_usage(expression_tree const & expressions) const;

View File

@@ -32,7 +32,7 @@ namespace isaac
namespace templates namespace templates
{ {
class reduce_2d : public base_impl class reduce_2d : public parameterized_base
{ {
protected: protected:
reduce_2d(unsigned int vwidth, unsigned int ls0, unsigned int ls1, unsigned int ng0, unsigned int ng1, fetch_type fetch, operation_type_family); reduce_2d(unsigned int vwidth, unsigned int ls0, unsigned int ls1, unsigned int ng0, unsigned int ng1, fetch_type fetch, operation_type_family);

View File

@@ -66,19 +66,19 @@ std::string base::generate(std::string const & suffix, expression_tree const &
return generate_impl(suffix, expression, device, mapping); return generate_impl(suffix, expression, device, mapping);
} }
int base_impl::is_invalid_impl(driver::Device const &, expression_tree const &) const int parameterized_base::is_invalid_impl(driver::Device const &, expression_tree const &) const
{ return TEMPLATE_VALID; } { return TEMPLATE_VALID; }
base_impl::base_impl(unsigned int vwidth, int_t ls0, int_t ls1): vwidth_(vwidth), ls0_(ls0), ls1_(ls1) parameterized_base::parameterized_base(unsigned int vwidth, int_t ls0, int_t ls1): vwidth_(vwidth), ls0_(ls0), ls1_(ls1)
{ } { }
unsigned int base_impl::ls0() const unsigned int parameterized_base::ls0() const
{ return ls0_; } { return ls0_; }
unsigned int base_impl::ls1() const unsigned int parameterized_base::ls1() const
{ return ls1_; } { return ls1_; }
int base_impl::is_invalid(expression_tree const & expressions, driver::Device const & device) const int parameterized_base::is_invalid(expression_tree const & expressions, driver::Device const & device) const
{ {
//Query device informations //Query device informations
size_t lmem_available = device.local_mem_size(); size_t lmem_available = device.local_mem_size();

View File

@@ -111,7 +111,7 @@ std::string elementwise_1d::generate_impl(std::string const & suffix, expression
} }
elementwise_1d::elementwise_1d(unsigned int vwidth, unsigned int ls, unsigned int ng, fetch_type fetch): elementwise_1d::elementwise_1d(unsigned int vwidth, unsigned int ls, unsigned int ng, fetch_type fetch):
base_impl(vwidth,ls,1), ng_(ng), fetch_(fetch) parameterized_base(vwidth,ls,1), ng_(ng), fetch_(fetch)
{} {}

View File

@@ -106,7 +106,7 @@ std::string elementwise_2d::generate_impl(std::string const & suffix, expression
elementwise_2d::elementwise_2d(unsigned int vwidth, unsigned int ls0, unsigned int ls1, elementwise_2d::elementwise_2d(unsigned int vwidth, unsigned int ls0, unsigned int ls1,
unsigned int ng0, unsigned int ng1, fetch_type fetch): unsigned int ng0, unsigned int ng1, fetch_type fetch):
base_impl(vwidth, ls0, ls1), ng0_(ng0), ng1_(ng1), fetch_(fetch) parameterized_base(vwidth, ls0, ls1), ng0_(ng0), ng1_(ng1), fetch_(fetch)
{} {}
std::vector<int_t> elementwise_2d::input_sizes(expression_tree const & expression) const{ std::vector<int_t> elementwise_2d::input_sizes(expression_tree const & expression) const{

View File

@@ -683,7 +683,7 @@ namespace templates
,int_t ms, int_t ks, int_t ns ,int_t ms, int_t ks, int_t ns
,fetch_type Afetch , fetch_type Bfetch ,fetch_type Afetch , fetch_type Bfetch
,int_t lf0, int_t lf1, char A_trans, char B_trans) : ,int_t lf0, int_t lf1, char A_trans, char B_trans) :
base_impl(vwidth, ls0, ls1), mL_(ms*ls0), kL_(kL), nL_(ns*ls1), depth_(D), mS_(ms), kS_(ks), nS_(ns), parameterized_base(vwidth, ls0, ls1), mL_(ms*ls0), kL_(kL), nL_(ns*ls1), depth_(D), mS_(ms), kS_(ks), nS_(ns),
Afetch_(Afetch), Bfetch_(Bfetch), lf0_(lf0), lf1_(lf1), A_trans_(A_trans), B_trans_(B_trans) Afetch_(Afetch), Bfetch_(Bfetch), lf0_(lf0), lf1_(lf1), A_trans_(A_trans), B_trans_(B_trans)
{ {
if(A_trans_=='N' && B_trans_=='N') type_ = GEMM_NN; if(A_trans_=='N' && B_trans_=='N') type_ = GEMM_NN;

View File

@@ -250,7 +250,7 @@ std::string reduce_1d::generate_impl(std::string const & suffix, expression_tree
} }
reduce_1d::reduce_1d(unsigned int vwidth, unsigned int ls, unsigned int ng, fetch_type fetch): reduce_1d::reduce_1d(unsigned int vwidth, unsigned int ls, unsigned int ng, fetch_type fetch):
base_impl(vwidth,ls,1), ng_(ng), fetch_(fetch) parameterized_base(vwidth,ls,1), ng_(ng), fetch_(fetch)
{} {}
std::vector<int_t> reduce_1d::input_sizes(expression_tree const & x) const std::vector<int_t> reduce_1d::input_sizes(expression_tree const & x) const

View File

@@ -278,7 +278,7 @@ std::string reduce_2d::generate_impl(std::string const & suffix, expression_tree
reduce_2d::reduce_2d(unsigned int vwidth, unsigned int ls0, unsigned int ls1, unsigned int ng0, unsigned int ng1, fetch_type fetch, reduce_2d::reduce_2d(unsigned int vwidth, unsigned int ls0, unsigned int ls1, unsigned int ng0, unsigned int ng1, fetch_type fetch,
operation_type_family rtype) : operation_type_family rtype) :
base_impl(vwidth, ls0, ls1), ng0_(ng0), ng1_(ng1), fetch_(fetch), parameterized_base(vwidth, ls0, ls1), ng0_(ng0), ng1_(ng1), fetch_(fetch),
reduction_type_(rtype){ } reduction_type_(rtype){ }
std::vector<int_t> reduce_2d::input_sizes(expression_tree const & tree) const std::vector<int_t> reduce_2d::input_sizes(expression_tree const & tree) const

View File

@@ -68,17 +68,17 @@ void export_templates()
#undef __PROP #undef __PROP
} }
bp::class_<tpt::base_impl, bp::bases<tpt::base>, boost::noncopyable>("base_impl", bp::no_init) bp::class_<tpt::parameterized_base, bp::bases<tpt::base>, boost::noncopyable>("parameterized_base", bp::no_init)
.add_property("ls0", &tpt::base_impl::ls0) .add_property("ls0", &tpt::parameterized_base::ls0)
.add_property("ls1", &tpt::base_impl::ls1); .add_property("ls1", &tpt::parameterized_base::ls1);
#define WRAP_BASE(name) bp::class_<tpt::name, bp::bases<tpt::base_impl>, boost::noncopyable>(#name, bp::no_init); #define WRAP_BASE(name) bp::class_<tpt::name, bp::bases<tpt::parameterized_base>, boost::noncopyable>(#name, bp::no_init);
#define WRAP_TEMPLATE(name, basename, ...) bp::class_<tpt::name, std::shared_ptr<tpt::name>, bp::bases<basename>>(#name, bp::init<__VA_ARGS__>())\ #define WRAP_TEMPLATE(name, basename, ...) bp::class_<tpt::name, std::shared_ptr<tpt::name>, bp::bases<basename>>(#name, bp::init<__VA_ARGS__>())\
; ;
WRAP_TEMPLATE(elementwise_1d, tpt::base_impl, uint, uint, uint, tpt::fetch_type) WRAP_TEMPLATE(elementwise_1d, tpt::parameterized_base, uint, uint, uint, tpt::fetch_type)
WRAP_TEMPLATE(elementwise_2d, tpt::base_impl, uint, uint, uint, uint, uint, tpt::fetch_type) WRAP_TEMPLATE(elementwise_2d, tpt::parameterized_base, uint, uint, uint, uint, uint, tpt::fetch_type)
WRAP_TEMPLATE(reduce_1d, tpt::base_impl, uint, uint, uint, tpt::fetch_type) WRAP_TEMPLATE(reduce_1d, tpt::parameterized_base, uint, uint, uint, tpt::fetch_type)
WRAP_BASE(reduce_2d) WRAP_BASE(reduce_2d)
WRAP_TEMPLATE(reduce_2d_rows, tpt::reduce_2d, uint, uint, uint, uint, uint, tpt::fetch_type) WRAP_TEMPLATE(reduce_2d_rows, tpt::reduce_2d, uint, uint, uint, uint, uint, tpt::fetch_type)
WRAP_TEMPLATE(reduce_2d_cols, tpt::reduce_2d, uint, uint, uint, uint, uint, tpt::fetch_type) WRAP_TEMPLATE(reduce_2d_cols, tpt::reduce_2d, uint, uint, uint, uint, uint, tpt::fetch_type)