Start to cleanup/unify accelerate and common back-ends (Part 1/N) (#1777)

* start to cleanup/unify accelerate and common back-ends

* more progress

* simplify

* add half type and allow infs in simd exp

* unify softmax + quantized, more dispatches to simd quantized mm

* add sin/cos, use simd in vector-scalar ops

* faster CPU vectorize quant

* faster erf/erfinv
This commit is contained in:
Awni Hannun
2025-01-29 14:34:49 -08:00
committed by GitHub
parent 7064fed1b1
commit 4758c8baa1
47 changed files with 1920 additions and 2640 deletions
+5 -5
View File
@@ -741,7 +741,7 @@ void init_array(nb::module_& m) {
[](const mx::array& a) {
if (mx::issubdtype(a.dtype(), mx::inexact)) {
throw std::invalid_argument(
"Floating point types not allowed with or bitwise inversion.");
"Floating point types not allowed with bitwise inversion.");
}
if (a.dtype() != mx::bool_) {
throw std::invalid_argument(
@@ -791,7 +791,7 @@ void init_array(nb::module_& m) {
if (mx::issubdtype(a.dtype(), mx::inexact) ||
mx::issubdtype(b.dtype(), mx::inexact)) {
throw std::invalid_argument(
"Floating point types not allowed with or bitwise or.");
"Floating point types not allowed with bitwise or.");
}
return mx::bitwise_or(a, b);
},
@@ -806,7 +806,7 @@ void init_array(nb::module_& m) {
if (mx::issubdtype(a.dtype(), mx::inexact) ||
mx::issubdtype(b.dtype(), mx::inexact)) {
throw std::invalid_argument(
"Floating point types not allowed with or bitwise or.");
"Floating point types not allowed with bitwise or.");
}
a.overwrite_descriptor(mx::bitwise_or(a, b));
return a;
@@ -838,7 +838,7 @@ void init_array(nb::module_& m) {
if (mx::issubdtype(a.dtype(), mx::inexact) ||
mx::issubdtype(b.dtype(), mx::inexact)) {
throw std::invalid_argument(
"Floating point types not allowed with or left shift.");
"Floating point types not allowed with left shift.");
}
a.overwrite_descriptor(mx::left_shift(a, b));
return a;
@@ -870,7 +870,7 @@ void init_array(nb::module_& m) {
if (mx::issubdtype(a.dtype(), mx::inexact) ||
mx::issubdtype(b.dtype(), mx::inexact)) {
throw std::invalid_argument(
"Floating point types not allowed with or right shift.");
"Floating point types not allowed with right shift.");
}
a.overwrite_descriptor(mx::right_shift(a, b));
return a;