def impl_ldexp(): ldexp_cpu = gen_codegen('ldexp') ldexp_gpu = gen_codegen('__nv_ldexp') ldexpf_cpu = gen_codegen('ldexpf') ldexpf_gpu = gen_codegen('__nv_ldexpf') lower(math.ldexp, float64, int32)(dispatch_codegen(ldexp_cpu, ldexp_gpu)) lower(math.ldexp, float32, int32)(dispatch_codegen(ldexpf_cpu, ldexpf_gpu))
def impl_binary(fname, key, typ): cpu = gen_codegen(fname) gpu = gen_codegen(f"__nv_{fname}") lower_builtin(key, typ, typ)(dispatch_codegen(cpu, gpu))
# logaddexp ufunc_db._ufunc_db[np.logaddexp] = { "ff->f": np_logaddexp_impl, "dd->d": np_logaddexp_impl, } # logaddexp2 ufunc_db._ufunc_db[np.logaddexp2] = { "ff->f": np_logaddexp2_impl, "dd->d": np_logaddexp2_impl, } # nextafter ufunc_db._ufunc_db[np.nextafter] = { "ff->f": dispatch_codegen(np_real_nextafter_impl, gen_codegen("__nv_nextafterf")), "dd->d": dispatch_codegen(np_real_nextafter_impl, gen_codegen("__nv_nextafter")), } # fabs ufunc_db._ufunc_db[np.fabs].update({ "f->f": dispatch_codegen(npyfuncs.np_real_fabs_impl, gen_codegen("__nv_fabsf")), "d->d": dispatch_codegen(npyfuncs.np_real_fabs_impl, gen_codegen("__nv_fabs")), }) # arcsin ufunc_db._ufunc_db[np.arcsin].update({ "f->f":
def impl_unary(fname, key, typ): cpu = gen_codegen(fname) gpu = gen_codegen(f"__nv_{fname}") lower(key, typ)(dispatch_codegen(cpu, gpu))