The-OpenROAD-Project / RePlAce

RePlAce global placement tool
BSD 3-Clause "New" or "Revised" License
215 stars 75 forks source link

fastExp function #32

Closed gessfred closed 5 years ago

gessfred commented 5 years ago

I am wondering what is the motivation behind the fastExp function used in net_update_wa. I cannot see that it is faster or more numerically stable than the exp function from std in any meaningful way. And I am interested as to where the expression was found:

inline prec fastExp(prec a) {
    a = 1.0 + a / 1024.0;
    a *= a;
    a *= a;
    a *= a;
    a *= a;
    a *= a;
    a *= a;
    a *= a;
    a *= a;
    a *= a;
    a *= a;
    return a;
}
mgwoo commented 5 years ago

I didn't write that part, but in my previous experience (about calculating exponential in deep-learning hardware for sigmoid), that approximate function was much faster than std::exp() function.

Reference: https://codingforspeed.com/using-faster-exponential-approximation/

gessfred commented 5 years ago

Fair enough, thank you for the information.