tft_error_form.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:FPTuner 作者: soarlab 项目源码 文件源码
def scalingUpFactor (self):         
        if   (IR.PREC_CANDIDATES == ["e32", "e64"]): 
            return tft_expr.ConstantExpr(math.pow(2, 21))
        elif (IR.PREC_CANDIDATES == ["e64", "e128"]):
            return tft_expr.ConstantExpr(math.pow(2, 50))
        elif (IR.PREC_CANDIDATES == ["e32", "e64", "e128"]):
            return tft_expr.ConstantExpr(math.pow(2, 48))
        else: 
            sys.exit("Error: invalid setting of IR.PREC_CANDIDATES: " + str(IR.PREC_CANDIDATES))

        # scaling_eps = Fraction(0.0) 
        scaling_eps = Fraction(1.0) 

        for gid,epss in self.gid2epsilons.items(): 
            for eps in epss: 
                assert(eps.value() >= 0.0) 

                if (eps.value() == 0.0): 
                    continue 

#                if (scaling_eps < eps.value()): 
                if (scaling_eps > eps.value()): 
                    scaling_eps = eps.value() 

        up_fac = Fraction(scaling_eps.denominator, scaling_eps.numerator) 
        # return tft_expr.ConstantExpr(up_fac) 
        # return tft_expr.ConstantExpr(up_fac * 512.0) 
        return tft_expr.ConstantExpr(up_fac / 8.0 ) # It is just a heuristic to divide by 8.0
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号