Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
Merge branch 'develop' into add_op_test
Browse files Browse the repository at this point in the history
  • Loading branch information
Xreki committed Nov 18, 2021
2 parents 3221e6a + 456c125 commit 2bce9c8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
2 changes: 1 addition & 1 deletion cinn/hlir/pe/pe_elementwise_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ void TestElementwisePE(const std::string &fn_name,
bool isnan(float e) { return std::isnan(e); }
bool isfinite(float e) { return std::isfinite(e); }
bool isinf(float e) { return std::isinf(e); }
bool rsqrt(float e) { return 1.0f / std::sqrt(e); }
float rsqrt(float e) { return 1.0f / std::sqrt(e); }

#define TEST_ELEMENTWISE_PE_FP32(test_name__, PE__) \
TEST(elementwise_pe, test_name__) { TestElementwisePE("PE_Elementwise_" #test_name__ "_fp32", PE__, test_name__); }
Expand Down
11 changes: 1 addition & 10 deletions cinn/lang/builtin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Expr logic_or(const std::vector<Expr>& conds) {
EXTERN_CALL_IMP(Exp, exp);
EXTERN_CALL_IMP_NO_VEC(Erf, erf);
EXTERN_CALL_IMP(Sqrt, sqrt);
EXTERN_CALL_IMP(Rsqrt, rsqrt);
EXTERN_CALL_IMP(Log, log);
EXTERN_CALL_IMP(Log2, log2);
EXTERN_CALL_IMP(Log10, log10);
Expand All @@ -77,16 +78,6 @@ EXTERN_CALL_IMP_NO_VEC(Asinh, asinh);
EXTERN_CALL_IMP_NO_VEC(Atan, atan);
EXTERN_CALL_IMP_NO_VEC(Atanh, atanh);

#ifdef CINN_WITH_CUDA
EXTERN_CALL_IMP(Rsqrt, rsqrt);
#else
Expr Rsqrt(Expr e) {
// TODO(Xreki): add the rsqrt's intrinsic of X86 and remove the ifdef.
auto one = make_const(e->type(), 1);
return one / Sqrt(e);
}
#endif

Expr min_value(const Type& type) {
CHECK_EQ(type.lanes(), 1);
#define FOR_CASE(type__) \
Expand Down
2 changes: 1 addition & 1 deletion cinn/optim/lower_intrin.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static const std::set<std::string> kIntrinsicCalls{
{"exp", "exp2", "sqrt", "log", "log2", "log10", "floor",
"ceil", "round", "trunc", "cos", "cosh", "tan", "tanh",
"sin", "sinh", "fabs", "isnan", "isfinite", "isinf", "left_shift",
"right_shift", "bitwise_or", "bitwise_and", "bitwise_xor", "bitwise_not", "fma"}};
"right_shift", "bitwise_or", "bitwise_and", "bitwise_xor", "bitwise_not", "fma", "rsqrt"}};

/**
* Map the Call nodes to llvm intrinsic.
Expand Down

0 comments on commit 2bce9c8

Please sign in to comment.