forked from M-Labs/artiq
compiler: Add additional math fns available from Rust libm
This commit is contained in:
parent
a39bd69ca4
commit
d35f659d25
|
@ -15,6 +15,7 @@ unary_fp_intrinsics = [(name, "llvm." + name + ".f64") for name in [
|
||||||
"floor",
|
"floor",
|
||||||
"ceil",
|
"ceil",
|
||||||
"trunc",
|
"trunc",
|
||||||
|
"sqrt",
|
||||||
]] + [
|
]] + [
|
||||||
# numpy.rint() seems to (NumPy 1.19.0, Python 3.8.5, Linux x86_64)
|
# numpy.rint() seems to (NumPy 1.19.0, Python 3.8.5, Linux x86_64)
|
||||||
# implement round-to-even, but unfortunately, rust-lang/libm only
|
# implement round-to-even, but unfortunately, rust-lang/libm only
|
||||||
|
@ -36,6 +37,14 @@ unary_fp_runtime_calls = [
|
||||||
("arcsin", "asin"),
|
("arcsin", "asin"),
|
||||||
("arccos", "acos"),
|
("arccos", "acos"),
|
||||||
("arctan", "atan"),
|
("arctan", "atan"),
|
||||||
|
("sinh", "sinh"),
|
||||||
|
("cosh", "cosh"),
|
||||||
|
("tanh", "tanh"),
|
||||||
|
("arcsinh", "asinh"),
|
||||||
|
("arccosh", "acosh"),
|
||||||
|
("arctanh", "atanh"),
|
||||||
|
("expm1", "expm1"),
|
||||||
|
("cbrt", "cbrt"),
|
||||||
]
|
]
|
||||||
|
|
||||||
#: Array handling builtins (special treatment due to allocations).
|
#: Array handling builtins (special treatment due to allocations).
|
||||||
|
|
|
@ -35,7 +35,7 @@ class CompareHostDeviceTest(ExperimentCase):
|
||||||
nonlocal checked
|
nonlocal checked
|
||||||
checked = True
|
checked = True
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
numpy.allclose(host, device),
|
numpy.allclose(host, device, equal_nan=True),
|
||||||
"Discrepancy in binop test for '{}': Expexcted ({}, {}) -> {}, got {}"
|
"Discrepancy in binop test for '{}': Expexcted ({}, {}) -> {}, got {}"
|
||||||
.format(op, a, b, host, device))
|
.format(op, a, b, host, device))
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ class CompareHostDeviceTest(ExperimentCase):
|
||||||
nonlocal checked
|
nonlocal checked
|
||||||
checked = True
|
checked = True
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
numpy.allclose(host, device),
|
numpy.allclose(host, device, equal_nan=True),
|
||||||
"Discrepancy in unaryop test for '{}': Expexcted {} -> {}, got {}"
|
"Discrepancy in unaryop test for '{}': Expexcted {} -> {}, got {}"
|
||||||
.format(op, a, host, device))
|
.format(op, a, host, device))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue