Code Quality: Cleaned warnings

This commit is contained in:
Philippe Tillet
2015-07-20 23:07:53 -07:00
parent 5d301c2c7e
commit 18663d6a93
4 changed files with 37 additions and 37 deletions

View File

@@ -53,9 +53,9 @@ public:
{ {
parameters_type(unsigned int _simd_width, int_t _local_size_1, int_t _local_size_2, int_t _num_kernels); parameters_type(unsigned int _simd_width, int_t _local_size_1, int_t _local_size_2, int_t _num_kernels);
unsigned int simd_width; unsigned int simd_width;
int_t local_size_0; unsigned int local_size_0;
int_t local_size_1; unsigned int local_size_1;
int_t num_kernels; unsigned int num_kernels;
}; };
class invalid_exception : public std::exception class invalid_exception : public std::exception

View File

@@ -14,26 +14,26 @@ class model;
struct gemm_parameters : public base::parameters_type struct gemm_parameters : public base::parameters_type
{ {
gemm_parameters(unsigned int simd_width gemm_parameters(unsigned int simd_width
, int_t local_size_0, int_t KL, int_t local_size_1, int_t D , unsigned int local_size_0, unsigned int KL, unsigned int local_size_1, unsigned int D
, int_t ms, int_t ks, int_t ns , unsigned int ms, unsigned int ks, unsigned int ns
, fetching_policy_type A_fetching_policy, fetching_policy_type B_fetching_policy , fetching_policy_type A_fetching_policy, fetching_policy_type B_fetching_policy
, int_t local_fetch_0, int_t local_fetch_1); , unsigned int local_fetch_0, unsigned int local_fetch_1);
int_t kL; unsigned int kL;
int_t depth; unsigned int depth;
int_t mS; unsigned int mS;
int_t kS; unsigned int kS;
int_t nS; unsigned int nS;
fetching_policy_type A_fetching_policy; fetching_policy_type A_fetching_policy;
fetching_policy_type B_fetching_policy; fetching_policy_type B_fetching_policy;
int_t local_fetch_0; unsigned int local_fetch_0;
int_t local_fetch_1; unsigned int local_fetch_1;
int_t mL; unsigned int mL;
int_t nL; unsigned int nL;
bool prefetch; bool prefetch;
bool unroll_outer; bool unroll_outer;

View File

@@ -836,9 +836,9 @@ template<class T>
void copy(std::vector<T> const & cx, array & x, driver::CommandQueue & queue, bool blocking) void copy(std::vector<T> const & cx, array & x, driver::CommandQueue & queue, bool blocking)
{ {
if(x.ld()==x.shape()[0]) if(x.ld()==x.shape()[0])
assert(cx.size()==x.dsize()); assert((int_t)cx.size()==x.dsize());
else else
assert(cx.size()==prod(x.shape())); assert((int_t)cx.size()==prod(x.shape()));
copy((void const*)cx.data(), x, queue, blocking); copy((void const*)cx.data(), x, queue, blocking);
} }
@@ -846,9 +846,9 @@ template<class T>
void copy(array const & x, std::vector<T> & cx, driver::CommandQueue & queue, bool blocking) void copy(array const & x, std::vector<T> & cx, driver::CommandQueue & queue, bool blocking)
{ {
if(x.ld()==x.shape()[0]) if(x.ld()==x.shape()[0])
assert(cx.size()==x.dsize()); assert((int_t)cx.size()==x.dsize());
else else
assert(cx.size()==prod(x.shape())); assert((int_t)cx.size()==prod(x.shape()));
copy(x, (void*)cx.data(), queue, blocking); copy(x, (void*)cx.data(), queue, blocking);
} }

View File

@@ -14,10 +14,10 @@ namespace templates
{ {
gemm_parameters::gemm_parameters(unsigned int simd_width gemm_parameters::gemm_parameters(unsigned int simd_width
, int_t local_size_0, int_t KL, int_t local_size_1, int_t D , unsigned int local_size_0, unsigned int KL, unsigned int local_size_1, unsigned int D
, int_t ms, int_t ks, int_t ns , unsigned int ms, unsigned int ks, unsigned int ns
, fetching_policy_type A_fetching_policy, fetching_policy_type B_fetching_policy , fetching_policy_type A_fetching_policy, fetching_policy_type B_fetching_policy
, int_t local_fetch_0, int_t local_fetch_1): base::parameters_type(simd_width, local_size_0, local_size_1, 1), , unsigned int local_fetch_0, unsigned int local_fetch_1): base::parameters_type(simd_width, local_size_0, local_size_1, 1),
kL(KL), depth(D), mS(ms), kS(ks), nS(ns), A_fetching_policy(A_fetching_policy), B_fetching_policy(B_fetching_policy), kL(KL), depth(D), mS(ms), kS(ks), nS(ns), A_fetching_policy(A_fetching_policy), B_fetching_policy(B_fetching_policy),
local_fetch_0(local_fetch_0), local_fetch_1(local_fetch_1), local_fetch_0(local_fetch_0), local_fetch_1(local_fetch_1),
mL(ms*local_size_0), nL(ns*local_size_1){} mL(ms*local_size_0), nL(ns*local_size_1){}
@@ -268,8 +268,8 @@ gemm_parameters::gemm_parameters(unsigned int simd_width
stream << "//Fetch A to local memory" << std::endl; stream << "//Fetch A to local memory" << std::endl;
if (A_trans_=='N') if (A_trans_=='N')
{ {
for(int_t k = 0; k < p_.kL; k += p_.local_fetch_1) for(unsigned int k = 0; k < p_.kL; k += p_.local_fetch_1)
for(int_t m = 0; m < p_.mL; m += p_.local_fetch_0*p_.simd_width) for(unsigned int m = 0; m < p_.mL; m += p_.local_fetch_0*p_.simd_width)
{ {
std::string mm = to_string(m/(p_.simd_width*p_.local_fetch_0)); std::string mm = to_string(m/(p_.simd_width*p_.local_fetch_0));
std::string kk = to_string(k); std::string kk = to_string(k);
@@ -280,8 +280,8 @@ gemm_parameters::gemm_parameters(unsigned int simd_width
} }
else else
{ {
for(int_t k = 0; k < p_.kL; k += p_.local_fetch_0*p_.simd_width) for(unsigned int k = 0; k < p_.kL; k += p_.local_fetch_0*p_.simd_width)
for(int_t m = 0; m < p_.mL; m += p_.local_fetch_1) for(unsigned int m = 0; m < p_.mL; m += p_.local_fetch_1)
{ {
std::string mm = to_string(m/p_.local_fetch_1); std::string mm = to_string(m/p_.local_fetch_1);
std::string kk = to_string(k); std::string kk = to_string(k);
@@ -294,8 +294,8 @@ gemm_parameters::gemm_parameters(unsigned int simd_width
stream << "//Fetch B to local memory" << std::endl; stream << "//Fetch B to local memory" << std::endl;
if (B_trans_=='T') if (B_trans_=='T')
{ {
for(int_t k = 0; k < p_.kL; k += p_.local_fetch_1) for(unsigned int k = 0; k < p_.kL; k += p_.local_fetch_1)
for(int_t n = 0; n < p_.nL; n += p_.local_fetch_0*p_.simd_width) for(unsigned int n = 0; n < p_.nL; n += p_.local_fetch_0*p_.simd_width)
{ {
std::string nn = to_string(n/(p_.simd_width*p_.local_fetch_0)); std::string nn = to_string(n/(p_.simd_width*p_.local_fetch_0));
std::string kk = to_string(k); std::string kk = to_string(k);
@@ -306,8 +306,8 @@ gemm_parameters::gemm_parameters(unsigned int simd_width
} }
else else
{ {
for(int_t k = 0; k < p_.kL; k += p_.local_fetch_0*p_.simd_width) for(unsigned int k = 0; k < p_.kL; k += p_.local_fetch_0*p_.simd_width)
for(int_t n = 0; n < p_.nL; n += p_.local_fetch_1) for(unsigned int n = 0; n < p_.nL; n += p_.local_fetch_1)
{ {
std::string nn = to_string(n/p_.local_fetch_1); std::string nn = to_string(n/p_.local_fetch_1);
std::string kk = to_string(k); std::string kk = to_string(k);
@@ -376,9 +376,9 @@ gemm_parameters::gemm_parameters(unsigned int simd_width
stream << "}" << std::endl; stream << "}" << std::endl;
stream << "//FMA computations" << std::endl; stream << "//FMA computations" << std::endl;
for(int_t kk=0 ; kk < p_.kS; ++kk) for(unsigned int kk=0 ; kk < p_.kS; ++kk)
for(int_t nn=0; nn < p_.nS; ++nn) for(unsigned int nn=0; nn < p_.nS; ++nn)
for(int_t mm=0; mm < p_.mS; ++mm) for(unsigned int mm=0; mm < p_.mS; ++mm)
{ {
string res_str, lhs_str, rhs_str; string res_str, lhs_str, rhs_str;
res_str = "rC[" + to_string(mm) + "][" + to_string(nn) + "]"; res_str = "rC[" + to_string(mm) + "][" + to_string(nn) + "]";
@@ -425,20 +425,20 @@ gemm_parameters::gemm_parameters(unsigned int simd_width
stream << "N -= offy;" << std::endl; stream << "N -= offy;" << std::endl;
stream << "M -= offx;" << std::endl; stream << "M -= offx;" << std::endl;
stream << "int ibm[" << p_.mS << "];" << std::endl; stream << "int ibm[" << p_.mS << "];" << std::endl;
for(int_t m=0; m < p_.mS; ++m) for(unsigned int m=0; m < p_.mS; ++m)
{ {
string Ci = to_string((m/p_.simd_width)*(p_.local_size_0*p_.simd_width) + m%p_.simd_width); string Ci = to_string((m/p_.simd_width)*(p_.local_size_0*p_.simd_width) + m%p_.simd_width);
stream << "ibm[" << m << "] = " << Ci << " < M;" << std::endl; stream << "ibm[" << m << "] = " << Ci << " < M;" << std::endl;
} }
for(int_t n=0; n < p_.nS; ++n) for(unsigned int n=0; n < p_.nS; ++n)
{ {
string Cj = to_string((n/p_.simd_width)*(p_.local_size_1*p_.simd_width) + n%p_.simd_width); string Cj = to_string((n/p_.simd_width)*(p_.local_size_1*p_.simd_width) + n%p_.simd_width);
stream << "if(" << Cj << " >= N) return;" << std::endl; stream << "if(" << Cj << " >= N) return;" << std::endl;
for(int_t m=0; m < p_.mS; ++m) for(unsigned int m=0; m < p_.mS; ++m)
stream << "rC[" << m << "][" << n << "] *= alpha;" << std::endl; stream << "rC[" << m << "][" << n << "] *= alpha;" << std::endl;
for(int_t m=0; m < p_.mS; ++m) for(unsigned int m=0; m < p_.mS; ++m)
{ {
string Ci = to_string((m/p_.simd_width)*(p_.local_size_0*p_.simd_width) + m%p_.simd_width); string Ci = to_string((m/p_.simd_width)*(p_.local_size_0*p_.simd_width) + m%p_.simd_width);
stream << "if(ibm[" << m << "]) "; stream << "if(ibm[" << m << "]) ";