Unverified Commit 8b539079 authored by Quan (Andy) Gan's avatar Quan (Andy) Gan Committed by GitHub
Browse files

[Bug] Fix #1712 (#1714)

* fix debug compilation

* fix

* revert
parent 02d31974
...@@ -254,6 +254,8 @@ struct Add { ...@@ -254,6 +254,8 @@ struct Add {
return *lhs_off + *rhs_off; return *lhs_off + *rhs_off;
} }
}; };
template <typename DType> constexpr bool Add<DType>::use_lhs;
template <typename DType> constexpr bool Add<DType>::use_rhs;
template <typename DType> template <typename DType>
struct Sub { struct Sub {
...@@ -263,6 +265,8 @@ struct Sub { ...@@ -263,6 +265,8 @@ struct Sub {
return *lhs_off - *rhs_off; return *lhs_off - *rhs_off;
} }
}; };
template <typename DType> constexpr bool Sub<DType>::use_lhs;
template <typename DType> constexpr bool Sub<DType>::use_rhs;
template <typename DType> template <typename DType>
struct Mul { struct Mul {
...@@ -272,6 +276,8 @@ struct Mul { ...@@ -272,6 +276,8 @@ struct Mul {
return *lhs_off * *rhs_off; return *lhs_off * *rhs_off;
} }
}; };
template <typename DType> constexpr bool Mul<DType>::use_lhs;
template <typename DType> constexpr bool Mul<DType>::use_rhs;
template <typename DType> template <typename DType>
struct Div { struct Div {
...@@ -281,6 +287,8 @@ struct Div { ...@@ -281,6 +287,8 @@ struct Div {
return *lhs_off / *rhs_off; return *lhs_off / *rhs_off;
} }
}; };
template <typename DType> constexpr bool Div<DType>::use_lhs;
template <typename DType> constexpr bool Div<DType>::use_rhs;
template <typename DType> template <typename DType>
struct CopyLhs { struct CopyLhs {
...@@ -290,6 +298,8 @@ struct CopyLhs { ...@@ -290,6 +298,8 @@ struct CopyLhs {
return *lhs_off; return *lhs_off;
} }
}; };
template <typename DType> constexpr bool CopyLhs<DType>::use_lhs;
template <typename DType> constexpr bool CopyLhs<DType>::use_rhs;
template <typename DType> template <typename DType>
struct CopyRhs { struct CopyRhs {
...@@ -299,6 +309,8 @@ struct CopyRhs { ...@@ -299,6 +309,8 @@ struct CopyRhs {
return *rhs_off; return *rhs_off;
} }
}; };
template <typename DType> constexpr bool CopyRhs<DType>::use_lhs;
template <typename DType> constexpr bool CopyRhs<DType>::use_rhs;
//////////////////////////////// Reduce operators on CPU //////////////////////////////// //////////////////////////////// Reduce operators on CPU ////////////////////////////////
template <typename DType> template <typename DType>
...@@ -309,6 +321,7 @@ struct Max { ...@@ -309,6 +321,7 @@ struct Max {
return accum < val; return accum < val;
} }
}; };
template <typename DType> constexpr DType Max<DType>::zero;
template <typename DType> template <typename DType>
struct Min { struct Min {
...@@ -318,6 +331,7 @@ struct Min { ...@@ -318,6 +331,7 @@ struct Min {
return accum > val; return accum > val;
} }
}; };
template <typename DType> constexpr DType Min<DType>::zero;
#define SWITCH_OP(op, Op, ...) \ #define SWITCH_OP(op, Op, ...) \
do { \ do { \
......
...@@ -22,6 +22,9 @@ struct Add { ...@@ -22,6 +22,9 @@ struct Add {
return lhs[0] + rhs[0]; return lhs[0] + rhs[0];
} }
}; };
template <typename DType> constexpr bool Add<DType>::use_lhs;
template <typename DType> constexpr bool Add<DType>::use_rhs;
template <typename DType> constexpr bool Add<DType>::reduce_last_dim;
template <typename DType> template <typename DType>
struct Sub { struct Sub {
...@@ -33,6 +36,9 @@ struct Sub { ...@@ -33,6 +36,9 @@ struct Sub {
return lhs[0] - rhs[0]; return lhs[0] - rhs[0];
} }
}; };
template <typename DType> constexpr bool Sub<DType>::use_lhs;
template <typename DType> constexpr bool Sub<DType>::use_rhs;
template <typename DType> constexpr bool Sub<DType>::reduce_last_dim;
template <typename DType> template <typename DType>
struct Mul { struct Mul {
...@@ -44,6 +50,9 @@ struct Mul { ...@@ -44,6 +50,9 @@ struct Mul {
return lhs[0] * rhs[0]; return lhs[0] * rhs[0];
} }
}; };
template <typename DType> constexpr bool Mul<DType>::use_lhs;
template <typename DType> constexpr bool Mul<DType>::use_rhs;
template <typename DType> constexpr bool Mul<DType>::reduce_last_dim;
template <typename DType> template <typename DType>
struct Div { struct Div {
...@@ -55,6 +64,9 @@ struct Div { ...@@ -55,6 +64,9 @@ struct Div {
return lhs[0] / rhs[0]; return lhs[0] / rhs[0];
} }
}; };
template <typename DType> constexpr bool Div<DType>::use_lhs;
template <typename DType> constexpr bool Div<DType>::use_rhs;
template <typename DType> constexpr bool Div<DType>::reduce_last_dim;
template <typename DType> template <typename DType>
struct CopyU { struct CopyU {
...@@ -66,6 +78,9 @@ struct CopyU { ...@@ -66,6 +78,9 @@ struct CopyU {
return lhs[0]; return lhs[0];
} }
}; };
template <typename DType> constexpr bool CopyU<DType>::use_lhs;
template <typename DType> constexpr bool CopyU<DType>::use_rhs;
template <typename DType> constexpr bool CopyU<DType>::reduce_last_dim;
template <typename DType> template <typename DType>
struct CopyE { struct CopyE {
...@@ -77,6 +92,9 @@ struct CopyE { ...@@ -77,6 +92,9 @@ struct CopyE {
return rhs[0]; return rhs[0];
} }
}; };
template <typename DType> constexpr bool CopyE<DType>::use_lhs;
template <typename DType> constexpr bool CopyE<DType>::use_rhs;
template <typename DType> constexpr bool CopyE<DType>::reduce_last_dim;
template <typename DType> template <typename DType>
struct Dot { struct Dot {
...@@ -92,6 +110,9 @@ struct Dot { ...@@ -92,6 +110,9 @@ struct Dot {
return rst; return rst;
} }
}; };
template <typename DType> constexpr bool Dot<DType>::use_lhs;
template <typename DType> constexpr bool Dot<DType>::use_rhs;
template <typename DType> constexpr bool Dot<DType>::reduce_last_dim;
} // end of namespace binary } // end of namespace binary
...@@ -116,6 +137,10 @@ struct Sum { ...@@ -116,6 +137,10 @@ struct Sum {
Idx *arg_u_buf, Idx *arg_e_buf, Idx *arg_u_buf, Idx *arg_e_buf,
DType val, DType val_ref, Idx uid, Idx eid) {} DType val, DType val_ref, Idx uid, Idx eid) {}
}; };
template <typename Idx, typename DType, bool atomic>
constexpr DType Sum<Idx, DType, atomic>::zero;
template <typename Idx, typename DType, bool atomic>
constexpr bool Sum<Idx, DType, atomic>::require_arg;
template <typename Idx, template <typename Idx,
typename DType, typename DType,
...@@ -149,6 +174,10 @@ struct Max { ...@@ -149,6 +174,10 @@ struct Max {
} }
} }
}; };
template <typename Idx, typename DType, bool atomic>
constexpr DType Max<Idx, DType, atomic>::zero;
template <typename Idx, typename DType, bool atomic>
constexpr bool Max<Idx, DType, atomic>::require_arg;
template <typename Idx, template <typename Idx,
typename DType, typename DType,
...@@ -182,6 +211,10 @@ struct Min { ...@@ -182,6 +211,10 @@ struct Min {
} }
} }
}; };
template <typename Idx, typename DType, bool atomic>
constexpr DType Min<Idx, DType, atomic>::zero;
template <typename Idx, typename DType, bool atomic>
constexpr bool Min<Idx, DType, atomic>::require_arg;
} // namespace reduce } // namespace reduce
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment