spear-kernels 1.8.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +214 -32
- package/index.js +214 -32
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -154,11 +154,11 @@ const kernels = {
|
|
|
154
154
|
"gaussian_cdf": {
|
|
155
155
|
id: "gaussian_cdf",
|
|
156
156
|
precise: {
|
|
157
|
-
js: "((x) => (
|
|
158
|
-
eval: ((x) => (
|
|
159
|
-
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (
|
|
160
|
-
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (
|
|
161
|
-
wasmBase64: "
|
|
157
|
+
js: "((x) => { const __erf = (x) => { const s = x < 0 ? -1 : 1; const ax = Math.abs(x); const t = 1 / (1 + 0.3275911 * ax); return s * (1 - ((((1.061405429 * t - 1.453152027) * t + 1.421413741) * t - 0.284496736) * t + 0.254829592) * t * Math.exp(-ax * ax)); }; return (0.5 * (1 + __erf((x * 0.7071067811865475)))); })",
|
|
158
|
+
eval: ((x) => { const __erf = (x) => { const s = x < 0 ? -1 : 1; const ax = Math.abs(x); const t = 1 / (1 + 0.3275911 * ax); return s * (1 - ((((1.061405429 * t - 1.453152027) * t + 1.421413741) * t - 0.284496736) * t + 0.254829592) * t * Math.exp(-ax * ax)); }; return (0.5 * (1 + __erf((x * 0.7071067811865475)))); }),
|
|
159
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (0.5f * (1f + erff((x * 0.707107f))));\n}",
|
|
160
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (0.5 * (1 + torch.erf((x * 0.707107))))",
|
|
161
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgsBA2VudgNlcmYAAQMCAQAHCQEFc3BlYXIAAQomASQARAAAAAAAAOA/RAAAAAAAAPA/IABEzDt/Zp6g5j+iEACgogs=",
|
|
162
162
|
},
|
|
163
163
|
fast: {
|
|
164
164
|
js: "((x) => Math.tanh(x))",
|
|
@@ -168,12 +168,12 @@ const kernels = {
|
|
|
168
168
|
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgwBA2VudgR0YW5oAAEDAgEABwkBBXNwZWFyAAEKCAEGACAAEAAL",
|
|
169
169
|
},
|
|
170
170
|
meta: {
|
|
171
|
-
metric:
|
|
172
|
-
level:
|
|
173
|
-
formulaCost:
|
|
171
|
+
metric: 1.3866695599588098e-34,
|
|
172
|
+
level: 5,
|
|
173
|
+
formulaCost: 4,
|
|
174
174
|
exactCost: 34,
|
|
175
|
-
speedupVsExact:
|
|
176
|
-
vsIterative: {"label":"Monte-Carlo · 1000 tirages","speedup":
|
|
175
|
+
speedupVsExact: 8.5,
|
|
176
|
+
vsIterative: {"label":"Monte-Carlo · 1000 tirages","speedup":11500},
|
|
177
177
|
},
|
|
178
178
|
},
|
|
179
179
|
"damped_pendulum": {
|
|
@@ -615,18 +615,25 @@ const kernels = {
|
|
|
615
615
|
"pendulum_hybrid": {
|
|
616
616
|
id: "pendulum_hybrid",
|
|
617
617
|
precise: {
|
|
618
|
-
js: "((d, th)
|
|
619
|
-
eval: ((d, th)
|
|
620
|
-
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((-0.
|
|
621
|
-
py: "import torch\n\ndef spear_fn(
|
|
622
|
-
wasmBase64: "
|
|
618
|
+
js: "((th, d) => ((0.999982 * Math.max(-2, Math.min(2, (((1 - Math.min(1e4, Math.max(-1e4, (1) / (((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) < 1e-4 && ((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) > -1e-4 ? (((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) >= 0 ? 1e-4 : -1e-4) : ((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))))))) * (-4.33 * (d * (((0.5 * (d) * (d)) + ((6 * (1 - Math.cos(th))) - 12)) * Math.cos(th))))) + (Math.min(1e4, Math.max(-1e4, (1) / (((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) < 1e-4 && ((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) > -1e-4 ? (((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) >= 0 ? 1e-4 : -1e-4) : ((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7))))))))))) * (-((1.72 * Math.sin(th)) + (8.04 * d)))))))) + 0.000009068541028117494))",
|
|
619
|
+
eval: ((th, d) => ((0.999982 * Math.max(-2, Math.min(2, (((1 - Math.min(1e4, Math.max(-1e4, (1) / (((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) < 1e-4 && ((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) > -1e-4 ? (((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) >= 0 ? 1e-4 : -1e-4) : ((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))))))) * (-4.33 * (d * (((0.5 * (d) * (d)) + ((6 * (1 - Math.cos(th))) - 12)) * Math.cos(th))))) + (Math.min(1e4, Math.max(-1e4, (1) / (((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) < 1e-4 && ((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) > -1e-4 ? (((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) >= 0 ? 1e-4 : -1e-4) : ((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7))))))))))) * (-((1.72 * Math.sin(th)) + (8.04 * d)))))))) + 0.000009068541028117494)),
|
|
620
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((0.999982f * fmaxf(-2f, fminf(2f, (((1f - fminf(fmaxf((1f / copysignf(fmaxf(fabsf((1f + expf(fmaxf(-50.0f, fminf(50.0f, (-(10.18f * (cosf(th) - 0.7f)))))))), 1.0e-4f), (1f + expf(fmaxf(-50.0f, fminf(50.0f, (-(10.18f * (cosf(th) - 0.7f))))))))), -1.0e4f), 1.0e4f)) * (-4.33f * (d * (((0.5f * powf(d, 2.0f)) + ((6f * (1f - cosf(th))) - 12f)) * cosf(th))))) + (fminf(fmaxf((1f / copysignf(fmaxf(fabsf((1f + expf(fmaxf(-50.0f, fminf(50.0f, (-(10.18f * (cosf(th) - 0.7f)))))))), 1.0e-4f), (1f + expf(fmaxf(-50.0f, fminf(50.0f, (-(10.18f * (cosf(th) - 0.7f))))))))), -1.0e4f), 1.0e4f) * (-((1.72f * sinf(th)) + (8.04f * d)))))))) + 0.000009f);\n}",
|
|
621
|
+
py: "import torch\n\ndef spear_fn(th, d):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((0.999982 * torch.maximum(-2, torch.minimum(2, (((1 - (1 / (abs((1 + torch.exp(torch.clamp((-(10.18 * (torch.cos(th) - 0.7))), -50.0, 50.0)))) < 1e-4 ? 1e-4 : (1 + torch.exp(torch.clamp((-(10.18 * (torch.cos(th) - 0.7))), -50.0, 50.0)))))) * (-4.33 * (d * (((0.5 * (d * d)) + ((6 * (1 - torch.cos(th))) - 12)) * torch.cos(th))))) + ((1 / (abs((1 + torch.exp(torch.clamp((-(10.18 * (torch.cos(th) - 0.7))), -50.0, 50.0)))) < 1e-4 ? 1e-4 : (1 + torch.exp(torch.clamp((-(10.18 * (torch.cos(th) - 0.7))), -50.0, 50.0))))) * (-((1.72 * torch.sin(th)) + (8.04 * d)))))))) + 0.000009)",
|
|
622
|
+
wasmBase64: "AGFzbQEAAAABDAJgAnx8AXxgAXwBfAIfAwNlbnYDZXhwAAEDZW52A3NpbgABA2VudgNjb3MAAQMCAQAHCQEFc3BlYXIAAwrSAwHPAwBEZ9ZSQNr/7z9EAAAAAAAAAMBEAAAAAAAAAEBEAAAAAAAA8D9EAAAAAAAA8D9EAAAAAAAA8D9EXI/C9ShcJEAgABACRGZmZmZmZuY/oaKaRAAAAAAAAEnApUQAAAAAAABJQKQQAKCZRC1DHOviNho/pUQAAAAAAADwP0Rcj8L1KFwkQCAAEAJEZmZmZmZm5j+hoppEAAAAAAAAScClRAAAAAAAAElApBAAoKajRAAAAAAAiMPApUQAAAAAAIjDQKShRFK4HoXrURHAIAFEAAAAAAAA4D8gASABoqJEAAAAAAAAGEBEAAAAAAAA8D8gABACoaJEAAAAAAAAKEChoCAAEAKioqKiRAAAAAAAAPA/RAAAAAAAAPA/RFyPwvUoXCRAIAAQAkRmZmZmZmbmP6GimkQAAAAAAABJwKVEAAAAAAAASUCkEACgmUQtQxzr4jYaP6VEAAAAAAAA8D9EXI/C9ShcJEAgABACRGZmZmZmZuY/oaKaRAAAAAAAAEnApUQAAAAAAABJQKQQAKCmo0QAAAAAAIjDwKVEAAAAAACIw0CkRIXrUbgehfs/IAAQAaJEFK5H4XoUIEAgAaKgmqKgpKWiREoM1smiBOM+oAs=",
|
|
623
|
+
},
|
|
624
|
+
fast: {
|
|
625
|
+
js: "((th, d) => ((0.999982 * Math.max(-2, Math.min(2, (((1 - Math.min(1e4, Math.max(-1e4, (1) / (((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) < 1e-4 && ((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) > -1e-4 ? (((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) >= 0 ? 1e-4 : -1e-4) : ((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))))))) * (-4.33 * (d * (((0.5 * (d) * (d)) + ((6 * (1 - Math.cos(th))) - 12)) * Math.cos(th))))) + (Math.min(1e4, Math.max(-1e4, (1) / (((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) < 1e-4 && ((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) > -1e-4 ? (((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) >= 0 ? 1e-4 : -1e-4) : ((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7))))))))))) * (-((1.72 * Math.sin(th)) + (8.04 * d)))))))) + 0.000009068541028117494))",
|
|
626
|
+
eval: ((th, d) => ((0.999982 * Math.max(-2, Math.min(2, (((1 - Math.min(1e4, Math.max(-1e4, (1) / (((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) < 1e-4 && ((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) > -1e-4 ? (((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) >= 0 ? 1e-4 : -1e-4) : ((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))))))) * (-4.33 * (d * (((0.5 * (d) * (d)) + ((6 * (1 - Math.cos(th))) - 12)) * Math.cos(th))))) + (Math.min(1e4, Math.max(-1e4, (1) / (((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) < 1e-4 && ((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) > -1e-4 ? (((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) >= 0 ? 1e-4 : -1e-4) : ((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7))))))))))) * (-((1.72 * Math.sin(th)) + (8.04 * d)))))))) + 0.000009068541028117494)),
|
|
627
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((0.999982f * fmaxf(-2f, fminf(2f, (((1f - fminf(fmaxf((1f / copysignf(fmaxf(fabsf((1f + expf(fmaxf(-50.0f, fminf(50.0f, (-(10.18f * (cosf(th) - 0.7f)))))))), 1.0e-4f), (1f + expf(fmaxf(-50.0f, fminf(50.0f, (-(10.18f * (cosf(th) - 0.7f))))))))), -1.0e4f), 1.0e4f)) * (-4.33f * (d * (((0.5f * powf(d, 2.0f)) + ((6f * (1f - cosf(th))) - 12f)) * cosf(th))))) + (fminf(fmaxf((1f / copysignf(fmaxf(fabsf((1f + expf(fmaxf(-50.0f, fminf(50.0f, (-(10.18f * (cosf(th) - 0.7f)))))))), 1.0e-4f), (1f + expf(fmaxf(-50.0f, fminf(50.0f, (-(10.18f * (cosf(th) - 0.7f))))))))), -1.0e4f), 1.0e4f) * (-((1.72f * sinf(th)) + (8.04f * d)))))))) + 0.000009f);\n}",
|
|
628
|
+
py: "import torch\n\ndef spear_fn(th, d):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((0.999982 * torch.maximum(-2, torch.minimum(2, (((1 - (1 / (abs((1 + torch.exp(torch.clamp((-(10.18 * (torch.cos(th) - 0.7))), -50.0, 50.0)))) < 1e-4 ? 1e-4 : (1 + torch.exp(torch.clamp((-(10.18 * (torch.cos(th) - 0.7))), -50.0, 50.0)))))) * (-4.33 * (d * (((0.5 * (d * d)) + ((6 * (1 - torch.cos(th))) - 12)) * torch.cos(th))))) + ((1 / (abs((1 + torch.exp(torch.clamp((-(10.18 * (torch.cos(th) - 0.7))), -50.0, 50.0)))) < 1e-4 ? 1e-4 : (1 + torch.exp(torch.clamp((-(10.18 * (torch.cos(th) - 0.7))), -50.0, 50.0))))) * (-((1.72 * torch.sin(th)) + (8.04 * d)))))))) + 0.000009)",
|
|
629
|
+
wasmBase64: "AGFzbQEAAAABDAJgAnx8AXxgAXwBfAIfAwNlbnYDZXhwAAEDZW52A3NpbgABA2VudgNjb3MAAQMCAQAHCQEFc3BlYXIAAwrSAwHPAwBEZ9ZSQNr/7z9EAAAAAAAAAMBEAAAAAAAAAEBEAAAAAAAA8D9EAAAAAAAA8D9EAAAAAAAA8D9EXI/C9ShcJEAgABACRGZmZmZmZuY/oaKaRAAAAAAAAEnApUQAAAAAAABJQKQQAKCZRC1DHOviNho/pUQAAAAAAADwP0Rcj8L1KFwkQCAAEAJEZmZmZmZm5j+hoppEAAAAAAAAScClRAAAAAAAAElApBAAoKajRAAAAAAAiMPApUQAAAAAAIjDQKShRFK4HoXrURHAIAFEAAAAAAAA4D8gASABoqJEAAAAAAAAGEBEAAAAAAAA8D8gABACoaJEAAAAAAAAKEChoCAAEAKioqKiRAAAAAAAAPA/RAAAAAAAAPA/RFyPwvUoXCRAIAAQAkRmZmZmZmbmP6GimkQAAAAAAABJwKVEAAAAAAAASUCkEACgmUQtQxzr4jYaP6VEAAAAAAAA8D9EXI/C9ShcJEAgABACRGZmZmZmZuY/oaKaRAAAAAAAAEnApUQAAAAAAABJQKQQAKCmo0QAAAAAAIjDwKVEAAAAAACIw0CkRIXrUbgehfs/IAAQAaJEFK5H4XoUIEAgAaKgmqKgpKWiREoM1smiBOM+oAs=",
|
|
623
630
|
},
|
|
624
631
|
meta: {
|
|
625
|
-
metric:
|
|
626
|
-
level:
|
|
627
|
-
formulaCost:
|
|
628
|
-
exactCost:
|
|
629
|
-
speedupVsExact:
|
|
632
|
+
metric: 5.04177596772154e-7,
|
|
633
|
+
level: 2,
|
|
634
|
+
formulaCost: 44,
|
|
635
|
+
exactCost: 40,
|
|
636
|
+
speedupVsExact: 0.9090909090909091,
|
|
630
637
|
vsIterative: null,
|
|
631
638
|
},
|
|
632
639
|
},
|
|
@@ -1319,14 +1326,14 @@ const kernels = {
|
|
|
1319
1326
|
"implied_vol": {
|
|
1320
1327
|
id: "implied_vol",
|
|
1321
1328
|
precise: {
|
|
1322
|
-
js: "((
|
|
1323
|
-
eval: ((
|
|
1324
|
-
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((
|
|
1325
|
-
py: "import torch\n\ndef spear_fn(
|
|
1326
|
-
wasmBase64: "
|
|
1329
|
+
js: "((t, c, s, k) => ((1.0338652122047158 * ((4.540114 * (Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (1) / ((t) < 1e-4 && (t) > -1e-4 ? ((t) >= 0 ? 1e-4 : -1e-4) : (t)))))) * Math.min(1e4, Math.max(-1e4, (((c - ((s - k) * 0.505)) + (0.3183 * Math.min(1e4, Math.max(-1e4, ((((s - k) * 0.25)) * (((s - k) * 0.25))) / (((s + k)) < 1e-4 && ((s + k)) > -1e-4 ? (((s + k)) >= 0 ? 1e-4 : -1e-4) : ((s + k)))))))) / (((s + k)) < 1e-4 && ((s + k)) > -1e-4 ? (((s + k)) >= 0 ? 1e-4 : -1e-4) : ((s + k))))))) + -0.032453)) + -0.011516810558767247))",
|
|
1330
|
+
eval: ((t, c, s, k) => ((1.0338652122047158 * ((4.540114 * (Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (1) / ((t) < 1e-4 && (t) > -1e-4 ? ((t) >= 0 ? 1e-4 : -1e-4) : (t)))))) * Math.min(1e4, Math.max(-1e4, (((c - ((s - k) * 0.505)) + (0.3183 * Math.min(1e4, Math.max(-1e4, ((((s - k) * 0.25)) * (((s - k) * 0.25))) / (((s + k)) < 1e-4 && ((s + k)) > -1e-4 ? (((s + k)) >= 0 ? 1e-4 : -1e-4) : ((s + k)))))))) / (((s + k)) < 1e-4 && ((s + k)) > -1e-4 ? (((s + k)) >= 0 ? 1e-4 : -1e-4) : ((s + k))))))) + -0.032453)) + -0.011516810558767247)),
|
|
1331
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((1.033865f * ((4.540114f * (sqrtf(fabsf(fminf(fmaxf((1f / copysignf(fmaxf(fabsf(t), 1.0e-4f), t)), -1.0e4f), 1.0e4f))) * fminf(fmaxf((((c - ((s - k) * 0.505f)) + (0.3183f * fminf(fmaxf((powf(((s - k) * 0.25f), 2.0f) / copysignf(fmaxf(fabsf((s + k)), 1.0e-4f), (s + k))), -1.0e4f), 1.0e4f))) / copysignf(fmaxf(fabsf((s + k)), 1.0e-4f), (s + k))), -1.0e4f), 1.0e4f))) + -0.032453f)) + -0.011517f);\n}",
|
|
1332
|
+
py: "import torch\n\ndef spear_fn(t, c, s, k):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((1.033865 * ((4.540114 * (torch.sqrt(torch.abs((1 / (abs(t) < 1e-4 ? 1e-4 : t)))) * (((c - ((s - k) * 0.505)) + (0.3183 * ((((s - k) * 0.25) * ((s - k) * 0.25)) / (abs((s + k)) < 1e-4 ? 1e-4 : (s + k))))) / (abs((s + k)) < 1e-4 ? 1e-4 : (s + k))))) + -0.032453)) + -0.011517)",
|
|
1333
|
+
wasmBase64: "AGFzbQEAAAABDgJgBHx8fHwBfGABfAF8AwIBAAcJAQVzcGVhcgAACvABAe0BAET9Qq4/torwP0RtcvikEykSQEQAAAAAAADwPyAAmUQtQxzr4jYaP6UgAKajRAAAAAAAiMPApUQAAAAAAIjDQKSZnyABIAIgA6FEKVyPwvUo4D+ioUR0RpT2Bl/UPyACIAOhRAAAAAAAANA/oiACIAOhRAAAAAAAANA/oqIgAiADoJlELUMc6+I2Gj+lIAIgA6Cmo0QAAAAAAIjDwKVEAAAAAACIw0CkoqAgAiADoJlELUMc6+I2Gj+lIAIgA6Cmo0QAAAAAAIjDwKVEAAAAAACIw0CkoqJE121Q+62doL+gokRiEKIlIJaHv6AL",
|
|
1327
1334
|
},
|
|
1328
1335
|
meta: {
|
|
1329
|
-
metric: 0.
|
|
1336
|
+
metric: 0.013185177440660847,
|
|
1330
1337
|
level: 0,
|
|
1331
1338
|
formulaCost: null,
|
|
1332
1339
|
exactCost: null,
|
|
@@ -1719,11 +1726,11 @@ const kernels = {
|
|
|
1719
1726
|
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AhYCA2VudgNleHAAAQNlbnYEYXNpbgABAwIBAAcJAQVzcGVhcgACCn4BfABECnUC8rJczT8gAEQAAAAAAABJwKVEAAAAAAAASUCkEAAgAEQAAAAAAADwv6VEAAAAAAAA8D+kEAEgAEQAAAAAAADwv6VEAAAAAAAA8D+kEAEgAEQAAAAAAADwv6VEAAAAAAAA8D+kEAGioqIgAKCiRB1ZwOrtSPo/oAs=",
|
|
1720
1727
|
},
|
|
1721
1728
|
fast: {
|
|
1722
|
-
js: "((m) => ((
|
|
1723
|
-
eval: ((m) => ((
|
|
1724
|
-
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (
|
|
1725
|
-
py: "import torch\n\ndef spear_fn(m):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((
|
|
1726
|
-
wasmBase64: "
|
|
1729
|
+
js: "((m) => ((Math.max(m, 0.830492) * ((m) * (m) * Math.max(m, 0.906194))) * Math.max(((m) * (m) * (m)) * ((m) * (m) * (m)) * ((m) * (m) * (m)), 0.598429)))",
|
|
1730
|
+
eval: ((m) => ((Math.max(m, 0.830492) * ((m) * (m) * Math.max(m, 0.906194))) * Math.max(((m) * (m) * (m)) * ((m) * (m) * (m)) * ((m) * (m) * (m)), 0.598429))),
|
|
1731
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((fmaxf(m, 0.830492f) * (powf(m, 2.0f) * fmaxf(m, 0.906194f))) * fmaxf(powf(powf(m, 3.0f), 3.0f), 0.598429f));\n}",
|
|
1732
|
+
py: "import torch\n\ndef spear_fn(m):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((torch.maximum(m, 0.830492) * ((m * m) * torch.maximum(m, 0.906194))) * torch.maximum(((m ** 3) ** 3), 0.598429))",
|
|
1733
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACkgBRgAgAERE3nL1Y5PqP6UgACAAoiAARAebOo+K/+w/paKiIAAgACAAoqIgACAAIACioiAAIAAgAKKioqJEpUv/klQm4z+logs=",
|
|
1727
1734
|
},
|
|
1728
1735
|
meta: {
|
|
1729
1736
|
metric: 0.004333603318947968,
|
|
@@ -2002,8 +2009,183 @@ const kernels = {
|
|
|
2002
2009
|
vsIterative: null,
|
|
2003
2010
|
},
|
|
2004
2011
|
},
|
|
2012
|
+
"rope_freq": {
|
|
2013
|
+
id: "rope_freq",
|
|
2014
|
+
precise: {
|
|
2015
|
+
js: "((x) => ((0.9999991529919943 * ((0.999947 * Math.cos((1023.994 * Math.exp(Math.max(-50, Math.min(50, (-0.28782 * x))))))) + -0.000038)) + 0.00001879512303862185))",
|
|
2016
|
+
eval: ((x) => ((0.9999991529919943 * ((0.999947 * Math.cos((1023.994 * Math.exp(Math.max(-50, Math.min(50, (-0.28782 * x))))))) + -0.000038)) + 0.00001879512303862185)),
|
|
2017
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((0.999999f * ((0.999947f * cosf((1023.994f * expf(fmaxf(-50.0f, fminf(50.0f, (-0.28782f * x))))))) + -0.000038f)) + 0.000019f);\n}",
|
|
2018
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((0.999999 * ((0.999947 * torch.cos((1023.994 * torch.exp(torch.clamp((-0.28782 * x), -50.0, 50.0))))) + -0.000038)) + 0.000019)",
|
|
2019
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AhUCA2VudgNleHAAAQNlbnYDY29zAAEDAgEABwkBBXNwZWFyAAIKWgFYAEQqG0Q5/v/vP0RLd9fZkP/vP0TLoUW28/+PQERBn8iTpGvSvyAAokQAAAAAAABJwKVEAAAAAAAASUCkEACiEAGiRBgK2A5G7AO/oKJEuB45BUe18z6gCw==",
|
|
2020
|
+
},
|
|
2021
|
+
fast: {
|
|
2022
|
+
js: "((x) => Math.cos((1023.994 * Math.exp(Math.max(-50, Math.min(50, (-0.28782 * x)))))))",
|
|
2023
|
+
eval: ((x) => Math.cos((1023.994 * Math.exp(Math.max(-50, Math.min(50, (-0.28782 * x))))))),
|
|
2024
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return cosf((1023.994f * expf(fmaxf(-50.0f, fminf(50.0f, (-0.28782f * x))))));\n}",
|
|
2025
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.cos((1023.994 * torch.exp(torch.clamp((-0.28782 * x), -50.0, 50.0))))",
|
|
2026
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AhUCA2VudgNleHAAAQNlbnYDY29zAAEDAgEABwkBBXNwZWFyAAIKMgEwAETLoUW28/+PQERBn8iTpGvSvyAAokQAAAAAAABJwKVEAAAAAAAASUCkEACiEAEL",
|
|
2027
|
+
},
|
|
2028
|
+
meta: {
|
|
2029
|
+
metric: 8.450097215964813e-7,
|
|
2030
|
+
level: 5,
|
|
2031
|
+
formulaCost: 8,
|
|
2032
|
+
exactCost: 43,
|
|
2033
|
+
speedupVsExact: 5.375,
|
|
2034
|
+
vsIterative: null,
|
|
2035
|
+
},
|
|
2036
|
+
},
|
|
2037
|
+
"bilateral_weight": {
|
|
2038
|
+
id: "bilateral_weight",
|
|
2039
|
+
precise: {
|
|
2040
|
+
js: "((x) => Math.min(1e4, Math.max(-1e4, (Math.exp(Math.max(-50, Math.min(50, (-((x) * (x) * 50)))))) / (((1 + ((x) * (x) * 2))) < 1e-4 && ((1 + ((x) * (x) * 2))) > -1e-4 ? (((1 + ((x) * (x) * 2))) >= 0 ? 1e-4 : -1e-4) : ((1 + ((x) * (x) * 2)))))))",
|
|
2041
|
+
eval: ((x) => Math.min(1e4, Math.max(-1e4, (Math.exp(Math.max(-50, Math.min(50, (-((x) * (x) * 50)))))) / (((1 + ((x) * (x) * 2))) < 1e-4 && ((1 + ((x) * (x) * 2))) > -1e-4 ? (((1 + ((x) * (x) * 2))) >= 0 ? 1e-4 : -1e-4) : ((1 + ((x) * (x) * 2))))))),
|
|
2042
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return fminf(fmaxf((expf(fmaxf(-50.0f, fminf(50.0f, (-(powf(x, 2.0f) * 50f))))) / copysignf(fmaxf(fabsf((1f + (powf(x, 2.0f) * 2f))), 1.0e-4f), (1f + (powf(x, 2.0f) * 2f)))), -1.0e4f), 1.0e4f);\n}",
|
|
2043
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (torch.exp(torch.clamp((-((x * x) * 50)), -50.0, 50.0)) / (abs((1 + ((x * x) * 2))) < 1e-4 ? 1e-4 : (1 + ((x * x) * 2))))",
|
|
2044
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgsBA2VudgNleHAAAQMCAQAHCQEFc3BlYXIAAQp9AXsAIAAgAKJEAAAAAAAASUCimkQAAAAAAABJwKVEAAAAAAAASUCkEABEAAAAAAAA8D8gACAAokQAAAAAAAAAQKKgmUQtQxzr4jYaP6VEAAAAAAAA8D8gACAAokQAAAAAAAAAQKKgpqNEAAAAAACIw8ClRAAAAAAAiMNApAs=",
|
|
2045
|
+
},
|
|
2046
|
+
fast: {
|
|
2047
|
+
js: "((x) => Math.min(1e4, Math.max(-1e4, (Math.exp(Math.max(-50, Math.min(50, (-((x) * (x) * 50)))))) / (((1 + ((x) * (x) * 2))) < 1e-4 && ((1 + ((x) * (x) * 2))) > -1e-4 ? (((1 + ((x) * (x) * 2))) >= 0 ? 1e-4 : -1e-4) : ((1 + ((x) * (x) * 2)))))))",
|
|
2048
|
+
eval: ((x) => Math.min(1e4, Math.max(-1e4, (Math.exp(Math.max(-50, Math.min(50, (-((x) * (x) * 50)))))) / (((1 + ((x) * (x) * 2))) < 1e-4 && ((1 + ((x) * (x) * 2))) > -1e-4 ? (((1 + ((x) * (x) * 2))) >= 0 ? 1e-4 : -1e-4) : ((1 + ((x) * (x) * 2))))))),
|
|
2049
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return fminf(fmaxf((expf(fmaxf(-50.0f, fminf(50.0f, (-(powf(x, 2.0f) * 50f))))) / copysignf(fmaxf(fabsf((1f + (powf(x, 2.0f) * 2f))), 1.0e-4f), (1f + (powf(x, 2.0f) * 2f)))), -1.0e4f), 1.0e4f);\n}",
|
|
2050
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (torch.exp(torch.clamp((-((x * x) * 50)), -50.0, 50.0)) / (abs((1 + ((x * x) * 2))) < 1e-4 ? 1e-4 : (1 + ((x * x) * 2))))",
|
|
2051
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgsBA2VudgNleHAAAQMCAQAHCQEFc3BlYXIAAQp9AXsAIAAgAKJEAAAAAAAASUCimkQAAAAAAABJwKVEAAAAAAAASUCkEABEAAAAAAAA8D8gACAAokQAAAAAAAAAQKKgmUQtQxzr4jYaP6VEAAAAAAAA8D8gACAAokQAAAAAAAAAQKKgpqNEAAAAAACIw8ClRAAAAAAAiMNApAs=",
|
|
2052
|
+
},
|
|
2053
|
+
meta: {
|
|
2054
|
+
metric: 9.336399957342636e-35,
|
|
2055
|
+
level: 5,
|
|
2056
|
+
formulaCost: 11,
|
|
2057
|
+
exactCost: 45,
|
|
2058
|
+
speedupVsExact: 4.090909090909091,
|
|
2059
|
+
vsIterative: null,
|
|
2060
|
+
},
|
|
2061
|
+
},
|
|
2062
|
+
"bs_d1_sigma": {
|
|
2063
|
+
id: "bs_d1_sigma",
|
|
2064
|
+
precise: {
|
|
2065
|
+
js: "((x) => (Math.min(1e4, Math.max(-1e4, (0.21562036) / ((Math.abs(x)) < 1e-4 && (Math.abs(x)) > -1e-4 ? ((Math.abs(x)) >= 0 ? 1e-4 : -1e-4) : (Math.abs(x))))) + (0.25 * Math.abs(x))))",
|
|
2066
|
+
eval: ((x) => (Math.min(1e4, Math.max(-1e4, (0.21562036) / ((Math.abs(x)) < 1e-4 && (Math.abs(x)) > -1e-4 ? ((Math.abs(x)) >= 0 ? 1e-4 : -1e-4) : (Math.abs(x))))) + (0.25 * Math.abs(x)))),
|
|
2067
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (fminf(fmaxf((0.21562f / copysignf(fmaxf(fabsf(fabsf(x)), 1.0e-4f), fabsf(x))), -1.0e4f), 1.0e4f) + (0.25f * fabsf(x)));\n}",
|
|
2068
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((0.21562 / (abs(torch.abs(x)) < 1e-4 ? 1e-4 : torch.abs(x))) + (0.25 * torch.abs(x)))",
|
|
2069
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACkIBQABEop9GrXKZyz8gAJmZRC1DHOviNho/pSAAmaajRAAAAAAAiMPApUQAAAAAAIjDQKREAAAAAAAA0D8gAJmioAs=",
|
|
2070
|
+
},
|
|
2071
|
+
fast: {
|
|
2072
|
+
js: "((x) => (Math.min(1e4, Math.max(-1e4, (3.635301) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) + (4.215319 * x)))",
|
|
2073
|
+
eval: ((x) => (Math.min(1e4, Math.max(-1e4, (3.635301) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) + (4.215319 * x))),
|
|
2074
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (fminf(fmaxf((3.635301f / copysignf(fmaxf(fabsf(x), 1.0e-4f), x)), -1.0e4f), 1.0e4f) + (4.215319f * x));\n}",
|
|
2075
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((3.635301 / (abs(x) < 1e-4 ? 1e-4 : x)) + (4.215319 * x))",
|
|
2076
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACj8BPQBExO3QsBgVDUAgAJlELUMc6+I2Gj+lIACmo0QAAAAAAIjDwKVEAAAAAACIw0CkRGfUfJV83BBAIACioAs=",
|
|
2077
|
+
},
|
|
2078
|
+
meta: {
|
|
2079
|
+
metric: 1.6217711315014304e-18,
|
|
2080
|
+
level: 5,
|
|
2081
|
+
formulaCost: 8,
|
|
2082
|
+
exactCost: 9,
|
|
2083
|
+
speedupVsExact: 1.125,
|
|
2084
|
+
vsIterative: null,
|
|
2085
|
+
},
|
|
2086
|
+
},
|
|
2087
|
+
"mel_scale": {
|
|
2088
|
+
id: "mel_scale",
|
|
2089
|
+
precise: {
|
|
2090
|
+
js: "((x) => (1126.994181 * Math.log(Math.max(1e-30, (1 + (x * 0.0014285714285714286))))))",
|
|
2091
|
+
eval: ((x) => (1126.994181 * Math.log(Math.max(1e-30, (1 + (x * 0.0014285714285714286)))))),
|
|
2092
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (1126.994181f * logf(fmaxf(1.0e-30f, (1f + (x * 0.001429f)))));\n}",
|
|
2093
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (1126.994181 * torch.log(torch.clamp((1 + (x * 0.001429)), min=1e-30)))",
|
|
2094
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgsBA2VudgNsb2cAAQMCAQAHCQEFc3BlYXIAAQowAS4ARDiFlQr6m5FARAAAAAAAAPA/IABEsak05NxnVz+ioESgwuv+S0i0OaUQAKIL",
|
|
2095
|
+
},
|
|
2096
|
+
fast: {
|
|
2097
|
+
js: "((x) => Math.log(Math.max(1e-30, (1 + (x * 0.0014285714285714286)))))",
|
|
2098
|
+
eval: ((x) => Math.log(Math.max(1e-30, (1 + (x * 0.0014285714285714286))))),
|
|
2099
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return logf(fmaxf(1.0e-30f, (1f + (x * 0.001429f))));\n}",
|
|
2100
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.log(torch.clamp((1 + (x * 0.001429)), min=1e-30))",
|
|
2101
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgsBA2VudgNsb2cAAQMCAQAHCQEFc3BlYXIAAQomASQARAAAAAAAAPA/IABEsak05NxnVz+ioESgwuv+S0i0OaUQAAs=",
|
|
2102
|
+
},
|
|
2103
|
+
meta: {
|
|
2104
|
+
metric: 1.4594066099947563e-12,
|
|
2105
|
+
level: 5,
|
|
2106
|
+
formulaCost: 4,
|
|
2107
|
+
exactCost: 23,
|
|
2108
|
+
speedupVsExact: 5.75,
|
|
2109
|
+
vsIterative: null,
|
|
2110
|
+
},
|
|
2111
|
+
},
|
|
2112
|
+
"bs_d2_sigma": {
|
|
2113
|
+
id: "bs_d2_sigma",
|
|
2114
|
+
precise: {
|
|
2115
|
+
js: "((x) => (Math.min(1e4, Math.max(-1e4, (0.21562036) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) + (-(0.25 * x))))",
|
|
2116
|
+
eval: ((x) => (Math.min(1e4, Math.max(-1e4, (0.21562036) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) + (-(0.25 * x)))),
|
|
2117
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (fminf(fmaxf((0.21562f / copysignf(fmaxf(fabsf(x), 1.0e-4f), x)), -1.0e4f), 1.0e4f) + (-(0.25f * x)));\n}",
|
|
2118
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((0.21562 / (abs(x) < 1e-4 ? 1e-4 : x)) + (-(0.25 * x)))",
|
|
2119
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACkABPgBEop9GrXKZyz8gAJlELUMc6+I2Gj+lIACmo0QAAAAAAIjDwKVEAAAAAACIw0CkRAAAAAAAANA/IACimqAL",
|
|
2120
|
+
},
|
|
2121
|
+
fast: {
|
|
2122
|
+
js: "((x) => (Math.min(1e4, Math.max(-1e4, (0.21562036) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) + (-(0.25 * x))))",
|
|
2123
|
+
eval: ((x) => (Math.min(1e4, Math.max(-1e4, (0.21562036) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) + (-(0.25 * x)))),
|
|
2124
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (fminf(fmaxf((0.21562f / copysignf(fmaxf(fabsf(x), 1.0e-4f), x)), -1.0e4f), 1.0e4f) + (-(0.25f * x)));\n}",
|
|
2125
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((0.21562 / (abs(x) < 1e-4 ? 1e-4 : x)) + (-(0.25 * x)))",
|
|
2126
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACkABPgBEop9GrXKZyz8gAJlELUMc6+I2Gj+lIACmo0QAAAAAAIjDwKVEAAAAAACIw0CkRAAAAAAAANA/IACimqAL",
|
|
2127
|
+
},
|
|
2128
|
+
meta: {
|
|
2129
|
+
metric: 1.6217711130493227e-18,
|
|
2130
|
+
level: 5,
|
|
2131
|
+
formulaCost: 7,
|
|
2132
|
+
exactCost: 11,
|
|
2133
|
+
speedupVsExact: 1.5714285714285714,
|
|
2134
|
+
vsIterative: null,
|
|
2135
|
+
},
|
|
2136
|
+
},
|
|
2137
|
+
"a_weighting": {
|
|
2138
|
+
id: "a_weighting",
|
|
2139
|
+
precise: {
|
|
2140
|
+
js: "((x) => ((0.9803615530479888 * ((8.859884 * Math.log(Math.max(1e-30, Math.min(1e4, Math.max(-1e4, (((148691236 * (x) * (x)) * (x) * (x))) / (((((x) * (x) + 424.36) * (Math.sqrt(Math.abs((((x) * (x) + 11599.29) * ((x) * (x) + 544496.41)))) * ((x) * (x) + 148691236)))) < 1e-4 && ((((x) * (x) + 424.36) * (Math.sqrt(Math.abs((((x) * (x) + 11599.29) * ((x) * (x) + 544496.41)))) * ((x) * (x) + 148691236)))) > -1e-4 ? (((((x) * (x) + 424.36) * (Math.sqrt(Math.abs((((x) * (x) + 11599.29) * ((x) * (x) + 544496.41)))) * ((x) * (x) + 148691236)))) >= 0 ? 1e-4 : -1e-4) : ((((x) * (x) + 424.36) * (Math.sqrt(Math.abs((((x) * (x) + 11599.29) * ((x) * (x) + 544496.41)))) * ((x) * (x) + 148691236)))))))))) + 2)) + 0.039276893904016105))",
|
|
2141
|
+
eval: ((x) => ((0.9803615530479888 * ((8.859884 * Math.log(Math.max(1e-30, Math.min(1e4, Math.max(-1e4, (((148691236 * (x) * (x)) * (x) * (x))) / (((((x) * (x) + 424.36) * (Math.sqrt(Math.abs((((x) * (x) + 11599.29) * ((x) * (x) + 544496.41)))) * ((x) * (x) + 148691236)))) < 1e-4 && ((((x) * (x) + 424.36) * (Math.sqrt(Math.abs((((x) * (x) + 11599.29) * ((x) * (x) + 544496.41)))) * ((x) * (x) + 148691236)))) > -1e-4 ? (((((x) * (x) + 424.36) * (Math.sqrt(Math.abs((((x) * (x) + 11599.29) * ((x) * (x) + 544496.41)))) * ((x) * (x) + 148691236)))) >= 0 ? 1e-4 : -1e-4) : ((((x) * (x) + 424.36) * (Math.sqrt(Math.abs((((x) * (x) + 11599.29) * ((x) * (x) + 544496.41)))) * ((x) * (x) + 148691236)))))))))) + 2)) + 0.039276893904016105)),
|
|
2142
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((0.980362f * ((8.859884f * logf(fmaxf(1.0e-30f, fminf(fmaxf((((148691236f * powf(x, 2.0f)) * powf(x, 2.0f)) / copysignf(fmaxf(fabsf(((powf(x, 2.0f) + 424.36f) * (sqrtf(fabsf(((powf(x, 2.0f) + 11599.29f) * (powf(x, 2.0f) + 544496.41f)))) * (powf(x, 2.0f) + 148691236f)))), 1.0e-4f), ((powf(x, 2.0f) + 424.36f) * (sqrtf(fabsf(((powf(x, 2.0f) + 11599.29f) * (powf(x, 2.0f) + 544496.41f)))) * (powf(x, 2.0f) + 148691236f))))), -1.0e4f), 1.0e4f)))) + 2f)) + 0.039277f);\n}",
|
|
2143
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((0.980362 * ((8.859884 * torch.log(torch.clamp((((148691236 * (x * x)) * (x * x)) / (abs((((x * x) + 424.36) * (torch.sqrt(torch.abs((((x * x) + 11599.29) * ((x * x) + 544496.41)))) * ((x * x) + 148691236)))) < 1e-4 ? 1e-4 : (((x * x) + 424.36) * (torch.sqrt(torch.abs((((x * x) + 11599.29) * ((x * x) + 544496.41)))) * ((x * x) + 148691236))))), min=1e-30))) + 2)) + 0.039277)",
|
|
2144
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgsBA2VudgNsb2cAAQMCAQAHCQEFc3BlYXIAAQrxAQHuAQBEphkTMR9f7z9EE7U0t0K4IUBEAAAASLK5oUEgACAAoqIgACAAoqIgACAAokT2KFyPwoV6QKAgACAAokTsUbgepafGQKAgACAAokQfhevR4J0gQaCimZ8gACAAokQAAABIsrmhQaCioplELUMc6+I2Gj+lIAAgAKJE9ihcj8KFekCgIAAgAKJE7FG4HqWnxkCgIAAgAKJEH4Xr0eCdIEGgopmfIAAgAKJEAAAASLK5oUGgoqKmo0QAAAAAAIjDwKVEAAAAAACIw0CkRKDC6/5LSLQ5pRAAokQAAAAAAAAAQKCiRK7HnN0ZHKQ/oAs=",
|
|
2145
|
+
},
|
|
2146
|
+
fast: {
|
|
2147
|
+
js: "((x) => ((8.859884 * Math.log(Math.max(1e-30, Math.min(1e4, Math.max(-1e4, (((148691236 * (x) * (x)) * (x) * (x))) / (((((x) * (x) + 424.36) * (Math.sqrt(Math.abs((((x) * (x) + 11599.29) * ((x) * (x) + 544496.41)))) * ((x) * (x) + 148691236)))) < 1e-4 && ((((x) * (x) + 424.36) * (Math.sqrt(Math.abs((((x) * (x) + 11599.29) * ((x) * (x) + 544496.41)))) * ((x) * (x) + 148691236)))) > -1e-4 ? (((((x) * (x) + 424.36) * (Math.sqrt(Math.abs((((x) * (x) + 11599.29) * ((x) * (x) + 544496.41)))) * ((x) * (x) + 148691236)))) >= 0 ? 1e-4 : -1e-4) : ((((x) * (x) + 424.36) * (Math.sqrt(Math.abs((((x) * (x) + 11599.29) * ((x) * (x) + 544496.41)))) * ((x) * (x) + 148691236)))))))))) + 2))",
|
|
2148
|
+
eval: ((x) => ((8.859884 * Math.log(Math.max(1e-30, Math.min(1e4, Math.max(-1e4, (((148691236 * (x) * (x)) * (x) * (x))) / (((((x) * (x) + 424.36) * (Math.sqrt(Math.abs((((x) * (x) + 11599.29) * ((x) * (x) + 544496.41)))) * ((x) * (x) + 148691236)))) < 1e-4 && ((((x) * (x) + 424.36) * (Math.sqrt(Math.abs((((x) * (x) + 11599.29) * ((x) * (x) + 544496.41)))) * ((x) * (x) + 148691236)))) > -1e-4 ? (((((x) * (x) + 424.36) * (Math.sqrt(Math.abs((((x) * (x) + 11599.29) * ((x) * (x) + 544496.41)))) * ((x) * (x) + 148691236)))) >= 0 ? 1e-4 : -1e-4) : ((((x) * (x) + 424.36) * (Math.sqrt(Math.abs((((x) * (x) + 11599.29) * ((x) * (x) + 544496.41)))) * ((x) * (x) + 148691236)))))))))) + 2)),
|
|
2149
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((8.859884f * logf(fmaxf(1.0e-30f, fminf(fmaxf((((148691236f * powf(x, 2.0f)) * powf(x, 2.0f)) / copysignf(fmaxf(fabsf(((powf(x, 2.0f) + 424.36f) * (sqrtf(fabsf(((powf(x, 2.0f) + 11599.29f) * (powf(x, 2.0f) + 544496.41f)))) * (powf(x, 2.0f) + 148691236f)))), 1.0e-4f), ((powf(x, 2.0f) + 424.36f) * (sqrtf(fabsf(((powf(x, 2.0f) + 11599.29f) * (powf(x, 2.0f) + 544496.41f)))) * (powf(x, 2.0f) + 148691236f))))), -1.0e4f), 1.0e4f)))) + 2f);\n}",
|
|
2150
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((8.859884 * torch.log(torch.clamp((((148691236 * (x * x)) * (x * x)) / (abs((((x * x) + 424.36) * (torch.sqrt(torch.abs((((x * x) + 11599.29) * ((x * x) + 544496.41)))) * ((x * x) + 148691236)))) < 1e-4 ? 1e-4 : (((x * x) + 424.36) * (torch.sqrt(torch.abs((((x * x) + 11599.29) * ((x * x) + 544496.41)))) * ((x * x) + 148691236))))), min=1e-30))) + 2)",
|
|
2151
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgsBA2VudgNsb2cAAQMCAQAHCQEFc3BlYXIAAQrdAQHaAQBEE7U0t0K4IUBEAAAASLK5oUEgACAAoqIgACAAoqIgACAAokT2KFyPwoV6QKAgACAAokTsUbgepafGQKAgACAAokQfhevR4J0gQaCimZ8gACAAokQAAABIsrmhQaCioplELUMc6+I2Gj+lIAAgAKJE9ihcj8KFekCgIAAgAKJE7FG4HqWnxkCgIAAgAKJEH4Xr0eCdIEGgopmfIAAgAKJEAAAASLK5oUGgoqKmo0QAAAAAAIjDwKVEAAAAAACIw0CkRKDC6/5LSLQ5pRAAokQAAAAAAAAAQKAL",
|
|
2152
|
+
},
|
|
2153
|
+
meta: {
|
|
2154
|
+
metric: 2.7800484820648814e-29,
|
|
2155
|
+
level: 5,
|
|
2156
|
+
formulaCost: 26,
|
|
2157
|
+
exactCost: 55,
|
|
2158
|
+
speedupVsExact: 2.1153846153846154,
|
|
2159
|
+
vsIterative: null,
|
|
2160
|
+
},
|
|
2161
|
+
},
|
|
2162
|
+
"layernorm_scale": {
|
|
2163
|
+
id: "layernorm_scale",
|
|
2164
|
+
precise: {
|
|
2165
|
+
js: "((x) => Math.min(1e4, Math.max(-1e4, (1) / ((Math.sqrt(Math.abs(x))) < 1e-4 && (Math.sqrt(Math.abs(x))) > -1e-4 ? ((Math.sqrt(Math.abs(x))) >= 0 ? 1e-4 : -1e-4) : (Math.sqrt(Math.abs(x)))))))",
|
|
2166
|
+
eval: ((x) => Math.min(1e4, Math.max(-1e4, (1) / ((Math.sqrt(Math.abs(x))) < 1e-4 && (Math.sqrt(Math.abs(x))) > -1e-4 ? ((Math.sqrt(Math.abs(x))) >= 0 ? 1e-4 : -1e-4) : (Math.sqrt(Math.abs(x))))))),
|
|
2167
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return fminf(fmaxf((1f / copysignf(fmaxf(fabsf(sqrtf(fabsf(x))), 1.0e-4f), sqrtf(fabsf(x)))), -1.0e4f), 1.0e4f);\n}",
|
|
2168
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (1 / (abs(torch.sqrt(torch.abs(x))) < 1e-4 ? 1e-4 : torch.sqrt(torch.abs(x))))",
|
|
2169
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACjYBNABEAAAAAAAA8D8gAJmfmUQtQxzr4jYaP6UgAJmfpqNEAAAAAACIw8ClRAAAAAAAiMNApAs=",
|
|
2170
|
+
},
|
|
2171
|
+
fast: {
|
|
2172
|
+
js: "((x) => Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (x) / (((x) * (x)) < 1e-4 && ((x) * (x)) > -1e-4 ? (((x) * (x)) >= 0 ? 1e-4 : -1e-4) : ((x) * (x))))))))",
|
|
2173
|
+
eval: ((x) => Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (x) / (((x) * (x)) < 1e-4 && ((x) * (x)) > -1e-4 ? (((x) * (x)) >= 0 ? 1e-4 : -1e-4) : ((x) * (x)))))))),
|
|
2174
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return sqrtf(fabsf(fminf(fmaxf((x / copysignf(fmaxf(fabsf(powf(x, 2.0f)), 1.0e-4f), powf(x, 2.0f))), -1.0e4f), 1.0e4f)));\n}",
|
|
2175
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.sqrt(torch.abs((x / (abs((x * x)) < 1e-4 ? 1e-4 : (x * x)))))",
|
|
2176
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACjMBMQAgACAAIACimUQtQxzr4jYaP6UgACAAoqajRAAAAAAAiMPApUQAAAAAAIjDQKSZnws=",
|
|
2177
|
+
},
|
|
2178
|
+
meta: {
|
|
2179
|
+
metric: 0,
|
|
2180
|
+
level: 5,
|
|
2181
|
+
formulaCost: 6,
|
|
2182
|
+
exactCost: 3,
|
|
2183
|
+
speedupVsExact: 0.5,
|
|
2184
|
+
vsIterative: null,
|
|
2185
|
+
},
|
|
2186
|
+
},
|
|
2005
2187
|
};
|
|
2006
2188
|
|
|
2007
|
-
const kernelIds = ["silu","gelu","sigmoid","kv_cache","free_fall","kepler","gaussian_cdf","damped_pendulum","rl_distillation","lambert_w","rc_circuit","gaussian_kernel","diffusion_beta","bilinear_interp","european_call","temporal_grad","lorentz","hill","kerr","lennard_jones","damped_oscillation","logistic_growth","softplus","kdv_soliton","kerr_spin","pendulum_hybrid","eigen3_sym","ik_reach","idm_following","gemv4","rope_rot","gauss_shader","ema_smooth","smoothstep","srgb_gamma","tanh_sat","atan_unit","srgb_decode","erf_prob","huber_loss","cosh_curve","bessel_j0","bessel_j1","blackbody_r","aces_fit","logsumexp2","probit_quantile","pmt_finance","blackbody_g","blackbody_b","bessel_j2","logit_ml","kelly_criterion","rsi_momentum","implied_vol","michaelis_menten","temperature_softmax","doppler_effect","stefan_boltzmann","mm1_queue_wait","grover_amplitude","concurrence_pure","chsh_correlation","legendre_p2","laguerre_l2","asin_hard","qfi_dephasing","amp_damp_fid","loschmidt_rate","bessel_i0e","elliptic_k","kepler_solver","fast_exp_alu","fresnel_schlick","rayleigh_phase","smootherstep","fog_exp2","back_ease_out","light_falloff_punctual","bias_slope","uncharted2_tonemap","mish"];
|
|
2189
|
+
const kernelIds = ["silu","gelu","sigmoid","kv_cache","free_fall","kepler","gaussian_cdf","damped_pendulum","rl_distillation","lambert_w","rc_circuit","gaussian_kernel","diffusion_beta","bilinear_interp","european_call","temporal_grad","lorentz","hill","kerr","lennard_jones","damped_oscillation","logistic_growth","softplus","kdv_soliton","kerr_spin","pendulum_hybrid","eigen3_sym","ik_reach","idm_following","gemv4","rope_rot","gauss_shader","ema_smooth","smoothstep","srgb_gamma","tanh_sat","atan_unit","srgb_decode","erf_prob","huber_loss","cosh_curve","bessel_j0","bessel_j1","blackbody_r","aces_fit","logsumexp2","probit_quantile","pmt_finance","blackbody_g","blackbody_b","bessel_j2","logit_ml","kelly_criterion","rsi_momentum","implied_vol","michaelis_menten","temperature_softmax","doppler_effect","stefan_boltzmann","mm1_queue_wait","grover_amplitude","concurrence_pure","chsh_correlation","legendre_p2","laguerre_l2","asin_hard","qfi_dephasing","amp_damp_fid","loschmidt_rate","bessel_i0e","elliptic_k","kepler_solver","fast_exp_alu","fresnel_schlick","rayleigh_phase","smootherstep","fog_exp2","back_ease_out","light_falloff_punctual","bias_slope","uncharted2_tonemap","mish","rope_freq","bilateral_weight","bs_d1_sigma","mel_scale","bs_d2_sigma","a_weighting","layernorm_scale"];
|
|
2008
2190
|
|
|
2009
2191
|
module.exports = { kernels, kernelIds, default: kernels };
|
package/index.js
CHANGED
|
@@ -154,11 +154,11 @@ export const kernels = {
|
|
|
154
154
|
"gaussian_cdf": {
|
|
155
155
|
id: "gaussian_cdf",
|
|
156
156
|
precise: {
|
|
157
|
-
js: "((x) => (
|
|
158
|
-
eval: ((x) => (
|
|
159
|
-
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (
|
|
160
|
-
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (
|
|
161
|
-
wasmBase64: "
|
|
157
|
+
js: "((x) => { const __erf = (x) => { const s = x < 0 ? -1 : 1; const ax = Math.abs(x); const t = 1 / (1 + 0.3275911 * ax); return s * (1 - ((((1.061405429 * t - 1.453152027) * t + 1.421413741) * t - 0.284496736) * t + 0.254829592) * t * Math.exp(-ax * ax)); }; return (0.5 * (1 + __erf((x * 0.7071067811865475)))); })",
|
|
158
|
+
eval: ((x) => { const __erf = (x) => { const s = x < 0 ? -1 : 1; const ax = Math.abs(x); const t = 1 / (1 + 0.3275911 * ax); return s * (1 - ((((1.061405429 * t - 1.453152027) * t + 1.421413741) * t - 0.284496736) * t + 0.254829592) * t * Math.exp(-ax * ax)); }; return (0.5 * (1 + __erf((x * 0.7071067811865475)))); }),
|
|
159
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (0.5f * (1f + erff((x * 0.707107f))));\n}",
|
|
160
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (0.5 * (1 + torch.erf((x * 0.707107))))",
|
|
161
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgsBA2VudgNlcmYAAQMCAQAHCQEFc3BlYXIAAQomASQARAAAAAAAAOA/RAAAAAAAAPA/IABEzDt/Zp6g5j+iEACgogs=",
|
|
162
162
|
},
|
|
163
163
|
fast: {
|
|
164
164
|
js: "((x) => Math.tanh(x))",
|
|
@@ -168,12 +168,12 @@ export const kernels = {
|
|
|
168
168
|
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgwBA2VudgR0YW5oAAEDAgEABwkBBXNwZWFyAAEKCAEGACAAEAAL",
|
|
169
169
|
},
|
|
170
170
|
meta: {
|
|
171
|
-
metric:
|
|
172
|
-
level:
|
|
173
|
-
formulaCost:
|
|
171
|
+
metric: 1.3866695599588098e-34,
|
|
172
|
+
level: 5,
|
|
173
|
+
formulaCost: 4,
|
|
174
174
|
exactCost: 34,
|
|
175
|
-
speedupVsExact:
|
|
176
|
-
vsIterative: {"label":"Monte-Carlo · 1000 tirages","speedup":
|
|
175
|
+
speedupVsExact: 8.5,
|
|
176
|
+
vsIterative: {"label":"Monte-Carlo · 1000 tirages","speedup":11500},
|
|
177
177
|
},
|
|
178
178
|
},
|
|
179
179
|
"damped_pendulum": {
|
|
@@ -615,18 +615,25 @@ export const kernels = {
|
|
|
615
615
|
"pendulum_hybrid": {
|
|
616
616
|
id: "pendulum_hybrid",
|
|
617
617
|
precise: {
|
|
618
|
-
js: "((d, th)
|
|
619
|
-
eval: ((d, th)
|
|
620
|
-
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((-0.
|
|
621
|
-
py: "import torch\n\ndef spear_fn(
|
|
622
|
-
wasmBase64: "
|
|
618
|
+
js: "((th, d) => ((0.999982 * Math.max(-2, Math.min(2, (((1 - Math.min(1e4, Math.max(-1e4, (1) / (((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) < 1e-4 && ((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) > -1e-4 ? (((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) >= 0 ? 1e-4 : -1e-4) : ((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))))))) * (-4.33 * (d * (((0.5 * (d) * (d)) + ((6 * (1 - Math.cos(th))) - 12)) * Math.cos(th))))) + (Math.min(1e4, Math.max(-1e4, (1) / (((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) < 1e-4 && ((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) > -1e-4 ? (((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) >= 0 ? 1e-4 : -1e-4) : ((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7))))))))))) * (-((1.72 * Math.sin(th)) + (8.04 * d)))))))) + 0.000009068541028117494))",
|
|
619
|
+
eval: ((th, d) => ((0.999982 * Math.max(-2, Math.min(2, (((1 - Math.min(1e4, Math.max(-1e4, (1) / (((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) < 1e-4 && ((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) > -1e-4 ? (((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) >= 0 ? 1e-4 : -1e-4) : ((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))))))) * (-4.33 * (d * (((0.5 * (d) * (d)) + ((6 * (1 - Math.cos(th))) - 12)) * Math.cos(th))))) + (Math.min(1e4, Math.max(-1e4, (1) / (((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) < 1e-4 && ((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) > -1e-4 ? (((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) >= 0 ? 1e-4 : -1e-4) : ((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7))))))))))) * (-((1.72 * Math.sin(th)) + (8.04 * d)))))))) + 0.000009068541028117494)),
|
|
620
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((0.999982f * fmaxf(-2f, fminf(2f, (((1f - fminf(fmaxf((1f / copysignf(fmaxf(fabsf((1f + expf(fmaxf(-50.0f, fminf(50.0f, (-(10.18f * (cosf(th) - 0.7f)))))))), 1.0e-4f), (1f + expf(fmaxf(-50.0f, fminf(50.0f, (-(10.18f * (cosf(th) - 0.7f))))))))), -1.0e4f), 1.0e4f)) * (-4.33f * (d * (((0.5f * powf(d, 2.0f)) + ((6f * (1f - cosf(th))) - 12f)) * cosf(th))))) + (fminf(fmaxf((1f / copysignf(fmaxf(fabsf((1f + expf(fmaxf(-50.0f, fminf(50.0f, (-(10.18f * (cosf(th) - 0.7f)))))))), 1.0e-4f), (1f + expf(fmaxf(-50.0f, fminf(50.0f, (-(10.18f * (cosf(th) - 0.7f))))))))), -1.0e4f), 1.0e4f) * (-((1.72f * sinf(th)) + (8.04f * d)))))))) + 0.000009f);\n}",
|
|
621
|
+
py: "import torch\n\ndef spear_fn(th, d):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((0.999982 * torch.maximum(-2, torch.minimum(2, (((1 - (1 / (abs((1 + torch.exp(torch.clamp((-(10.18 * (torch.cos(th) - 0.7))), -50.0, 50.0)))) < 1e-4 ? 1e-4 : (1 + torch.exp(torch.clamp((-(10.18 * (torch.cos(th) - 0.7))), -50.0, 50.0)))))) * (-4.33 * (d * (((0.5 * (d * d)) + ((6 * (1 - torch.cos(th))) - 12)) * torch.cos(th))))) + ((1 / (abs((1 + torch.exp(torch.clamp((-(10.18 * (torch.cos(th) - 0.7))), -50.0, 50.0)))) < 1e-4 ? 1e-4 : (1 + torch.exp(torch.clamp((-(10.18 * (torch.cos(th) - 0.7))), -50.0, 50.0))))) * (-((1.72 * torch.sin(th)) + (8.04 * d)))))))) + 0.000009)",
|
|
622
|
+
wasmBase64: "AGFzbQEAAAABDAJgAnx8AXxgAXwBfAIfAwNlbnYDZXhwAAEDZW52A3NpbgABA2VudgNjb3MAAQMCAQAHCQEFc3BlYXIAAwrSAwHPAwBEZ9ZSQNr/7z9EAAAAAAAAAMBEAAAAAAAAAEBEAAAAAAAA8D9EAAAAAAAA8D9EAAAAAAAA8D9EXI/C9ShcJEAgABACRGZmZmZmZuY/oaKaRAAAAAAAAEnApUQAAAAAAABJQKQQAKCZRC1DHOviNho/pUQAAAAAAADwP0Rcj8L1KFwkQCAAEAJEZmZmZmZm5j+hoppEAAAAAAAAScClRAAAAAAAAElApBAAoKajRAAAAAAAiMPApUQAAAAAAIjDQKShRFK4HoXrURHAIAFEAAAAAAAA4D8gASABoqJEAAAAAAAAGEBEAAAAAAAA8D8gABACoaJEAAAAAAAAKEChoCAAEAKioqKiRAAAAAAAAPA/RAAAAAAAAPA/RFyPwvUoXCRAIAAQAkRmZmZmZmbmP6GimkQAAAAAAABJwKVEAAAAAAAASUCkEACgmUQtQxzr4jYaP6VEAAAAAAAA8D9EXI/C9ShcJEAgABACRGZmZmZmZuY/oaKaRAAAAAAAAEnApUQAAAAAAABJQKQQAKCmo0QAAAAAAIjDwKVEAAAAAACIw0CkRIXrUbgehfs/IAAQAaJEFK5H4XoUIEAgAaKgmqKgpKWiREoM1smiBOM+oAs=",
|
|
623
|
+
},
|
|
624
|
+
fast: {
|
|
625
|
+
js: "((th, d) => ((0.999982 * Math.max(-2, Math.min(2, (((1 - Math.min(1e4, Math.max(-1e4, (1) / (((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) < 1e-4 && ((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) > -1e-4 ? (((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) >= 0 ? 1e-4 : -1e-4) : ((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))))))) * (-4.33 * (d * (((0.5 * (d) * (d)) + ((6 * (1 - Math.cos(th))) - 12)) * Math.cos(th))))) + (Math.min(1e4, Math.max(-1e4, (1) / (((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) < 1e-4 && ((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) > -1e-4 ? (((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) >= 0 ? 1e-4 : -1e-4) : ((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7))))))))))) * (-((1.72 * Math.sin(th)) + (8.04 * d)))))))) + 0.000009068541028117494))",
|
|
626
|
+
eval: ((th, d) => ((0.999982 * Math.max(-2, Math.min(2, (((1 - Math.min(1e4, Math.max(-1e4, (1) / (((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) < 1e-4 && ((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) > -1e-4 ? (((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) >= 0 ? 1e-4 : -1e-4) : ((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))))))) * (-4.33 * (d * (((0.5 * (d) * (d)) + ((6 * (1 - Math.cos(th))) - 12)) * Math.cos(th))))) + (Math.min(1e4, Math.max(-1e4, (1) / (((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) < 1e-4 && ((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) > -1e-4 ? (((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7)))))))) >= 0 ? 1e-4 : -1e-4) : ((1 + Math.exp(Math.max(-50, Math.min(50, (-(10.18 * (Math.cos(th) - 0.7))))))))))) * (-((1.72 * Math.sin(th)) + (8.04 * d)))))))) + 0.000009068541028117494)),
|
|
627
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((0.999982f * fmaxf(-2f, fminf(2f, (((1f - fminf(fmaxf((1f / copysignf(fmaxf(fabsf((1f + expf(fmaxf(-50.0f, fminf(50.0f, (-(10.18f * (cosf(th) - 0.7f)))))))), 1.0e-4f), (1f + expf(fmaxf(-50.0f, fminf(50.0f, (-(10.18f * (cosf(th) - 0.7f))))))))), -1.0e4f), 1.0e4f)) * (-4.33f * (d * (((0.5f * powf(d, 2.0f)) + ((6f * (1f - cosf(th))) - 12f)) * cosf(th))))) + (fminf(fmaxf((1f / copysignf(fmaxf(fabsf((1f + expf(fmaxf(-50.0f, fminf(50.0f, (-(10.18f * (cosf(th) - 0.7f)))))))), 1.0e-4f), (1f + expf(fmaxf(-50.0f, fminf(50.0f, (-(10.18f * (cosf(th) - 0.7f))))))))), -1.0e4f), 1.0e4f) * (-((1.72f * sinf(th)) + (8.04f * d)))))))) + 0.000009f);\n}",
|
|
628
|
+
py: "import torch\n\ndef spear_fn(th, d):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((0.999982 * torch.maximum(-2, torch.minimum(2, (((1 - (1 / (abs((1 + torch.exp(torch.clamp((-(10.18 * (torch.cos(th) - 0.7))), -50.0, 50.0)))) < 1e-4 ? 1e-4 : (1 + torch.exp(torch.clamp((-(10.18 * (torch.cos(th) - 0.7))), -50.0, 50.0)))))) * (-4.33 * (d * (((0.5 * (d * d)) + ((6 * (1 - torch.cos(th))) - 12)) * torch.cos(th))))) + ((1 / (abs((1 + torch.exp(torch.clamp((-(10.18 * (torch.cos(th) - 0.7))), -50.0, 50.0)))) < 1e-4 ? 1e-4 : (1 + torch.exp(torch.clamp((-(10.18 * (torch.cos(th) - 0.7))), -50.0, 50.0))))) * (-((1.72 * torch.sin(th)) + (8.04 * d)))))))) + 0.000009)",
|
|
629
|
+
wasmBase64: "AGFzbQEAAAABDAJgAnx8AXxgAXwBfAIfAwNlbnYDZXhwAAEDZW52A3NpbgABA2VudgNjb3MAAQMCAQAHCQEFc3BlYXIAAwrSAwHPAwBEZ9ZSQNr/7z9EAAAAAAAAAMBEAAAAAAAAAEBEAAAAAAAA8D9EAAAAAAAA8D9EAAAAAAAA8D9EXI/C9ShcJEAgABACRGZmZmZmZuY/oaKaRAAAAAAAAEnApUQAAAAAAABJQKQQAKCZRC1DHOviNho/pUQAAAAAAADwP0Rcj8L1KFwkQCAAEAJEZmZmZmZm5j+hoppEAAAAAAAAScClRAAAAAAAAElApBAAoKajRAAAAAAAiMPApUQAAAAAAIjDQKShRFK4HoXrURHAIAFEAAAAAAAA4D8gASABoqJEAAAAAAAAGEBEAAAAAAAA8D8gABACoaJEAAAAAAAAKEChoCAAEAKioqKiRAAAAAAAAPA/RAAAAAAAAPA/RFyPwvUoXCRAIAAQAkRmZmZmZmbmP6GimkQAAAAAAABJwKVEAAAAAAAASUCkEACgmUQtQxzr4jYaP6VEAAAAAAAA8D9EXI/C9ShcJEAgABACRGZmZmZmZuY/oaKaRAAAAAAAAEnApUQAAAAAAABJQKQQAKCmo0QAAAAAAIjDwKVEAAAAAACIw0CkRIXrUbgehfs/IAAQAaJEFK5H4XoUIEAgAaKgmqKgpKWiREoM1smiBOM+oAs=",
|
|
623
630
|
},
|
|
624
631
|
meta: {
|
|
625
|
-
metric:
|
|
626
|
-
level:
|
|
627
|
-
formulaCost:
|
|
628
|
-
exactCost:
|
|
629
|
-
speedupVsExact:
|
|
632
|
+
metric: 5.04177596772154e-7,
|
|
633
|
+
level: 2,
|
|
634
|
+
formulaCost: 44,
|
|
635
|
+
exactCost: 40,
|
|
636
|
+
speedupVsExact: 0.9090909090909091,
|
|
630
637
|
vsIterative: null,
|
|
631
638
|
},
|
|
632
639
|
},
|
|
@@ -1319,14 +1326,14 @@ export const kernels = {
|
|
|
1319
1326
|
"implied_vol": {
|
|
1320
1327
|
id: "implied_vol",
|
|
1321
1328
|
precise: {
|
|
1322
|
-
js: "((
|
|
1323
|
-
eval: ((
|
|
1324
|
-
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((
|
|
1325
|
-
py: "import torch\n\ndef spear_fn(
|
|
1326
|
-
wasmBase64: "
|
|
1329
|
+
js: "((t, c, s, k) => ((1.0338652122047158 * ((4.540114 * (Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (1) / ((t) < 1e-4 && (t) > -1e-4 ? ((t) >= 0 ? 1e-4 : -1e-4) : (t)))))) * Math.min(1e4, Math.max(-1e4, (((c - ((s - k) * 0.505)) + (0.3183 * Math.min(1e4, Math.max(-1e4, ((((s - k) * 0.25)) * (((s - k) * 0.25))) / (((s + k)) < 1e-4 && ((s + k)) > -1e-4 ? (((s + k)) >= 0 ? 1e-4 : -1e-4) : ((s + k)))))))) / (((s + k)) < 1e-4 && ((s + k)) > -1e-4 ? (((s + k)) >= 0 ? 1e-4 : -1e-4) : ((s + k))))))) + -0.032453)) + -0.011516810558767247))",
|
|
1330
|
+
eval: ((t, c, s, k) => ((1.0338652122047158 * ((4.540114 * (Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (1) / ((t) < 1e-4 && (t) > -1e-4 ? ((t) >= 0 ? 1e-4 : -1e-4) : (t)))))) * Math.min(1e4, Math.max(-1e4, (((c - ((s - k) * 0.505)) + (0.3183 * Math.min(1e4, Math.max(-1e4, ((((s - k) * 0.25)) * (((s - k) * 0.25))) / (((s + k)) < 1e-4 && ((s + k)) > -1e-4 ? (((s + k)) >= 0 ? 1e-4 : -1e-4) : ((s + k)))))))) / (((s + k)) < 1e-4 && ((s + k)) > -1e-4 ? (((s + k)) >= 0 ? 1e-4 : -1e-4) : ((s + k))))))) + -0.032453)) + -0.011516810558767247)),
|
|
1331
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((1.033865f * ((4.540114f * (sqrtf(fabsf(fminf(fmaxf((1f / copysignf(fmaxf(fabsf(t), 1.0e-4f), t)), -1.0e4f), 1.0e4f))) * fminf(fmaxf((((c - ((s - k) * 0.505f)) + (0.3183f * fminf(fmaxf((powf(((s - k) * 0.25f), 2.0f) / copysignf(fmaxf(fabsf((s + k)), 1.0e-4f), (s + k))), -1.0e4f), 1.0e4f))) / copysignf(fmaxf(fabsf((s + k)), 1.0e-4f), (s + k))), -1.0e4f), 1.0e4f))) + -0.032453f)) + -0.011517f);\n}",
|
|
1332
|
+
py: "import torch\n\ndef spear_fn(t, c, s, k):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((1.033865 * ((4.540114 * (torch.sqrt(torch.abs((1 / (abs(t) < 1e-4 ? 1e-4 : t)))) * (((c - ((s - k) * 0.505)) + (0.3183 * ((((s - k) * 0.25) * ((s - k) * 0.25)) / (abs((s + k)) < 1e-4 ? 1e-4 : (s + k))))) / (abs((s + k)) < 1e-4 ? 1e-4 : (s + k))))) + -0.032453)) + -0.011517)",
|
|
1333
|
+
wasmBase64: "AGFzbQEAAAABDgJgBHx8fHwBfGABfAF8AwIBAAcJAQVzcGVhcgAACvABAe0BAET9Qq4/torwP0RtcvikEykSQEQAAAAAAADwPyAAmUQtQxzr4jYaP6UgAKajRAAAAAAAiMPApUQAAAAAAIjDQKSZnyABIAIgA6FEKVyPwvUo4D+ioUR0RpT2Bl/UPyACIAOhRAAAAAAAANA/oiACIAOhRAAAAAAAANA/oqIgAiADoJlELUMc6+I2Gj+lIAIgA6Cmo0QAAAAAAIjDwKVEAAAAAACIw0CkoqAgAiADoJlELUMc6+I2Gj+lIAIgA6Cmo0QAAAAAAIjDwKVEAAAAAACIw0CkoqJE121Q+62doL+gokRiEKIlIJaHv6AL",
|
|
1327
1334
|
},
|
|
1328
1335
|
meta: {
|
|
1329
|
-
metric: 0.
|
|
1336
|
+
metric: 0.013185177440660847,
|
|
1330
1337
|
level: 0,
|
|
1331
1338
|
formulaCost: null,
|
|
1332
1339
|
exactCost: null,
|
|
@@ -1719,11 +1726,11 @@ export const kernels = {
|
|
|
1719
1726
|
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AhYCA2VudgNleHAAAQNlbnYEYXNpbgABAwIBAAcJAQVzcGVhcgACCn4BfABECnUC8rJczT8gAEQAAAAAAABJwKVEAAAAAAAASUCkEAAgAEQAAAAAAADwv6VEAAAAAAAA8D+kEAEgAEQAAAAAAADwv6VEAAAAAAAA8D+kEAEgAEQAAAAAAADwv6VEAAAAAAAA8D+kEAGioqIgAKCiRB1ZwOrtSPo/oAs=",
|
|
1720
1727
|
},
|
|
1721
1728
|
fast: {
|
|
1722
|
-
js: "((m) => ((
|
|
1723
|
-
eval: ((m) => ((
|
|
1724
|
-
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (
|
|
1725
|
-
py: "import torch\n\ndef spear_fn(m):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((
|
|
1726
|
-
wasmBase64: "
|
|
1729
|
+
js: "((m) => ((Math.max(m, 0.830492) * ((m) * (m) * Math.max(m, 0.906194))) * Math.max(((m) * (m) * (m)) * ((m) * (m) * (m)) * ((m) * (m) * (m)), 0.598429)))",
|
|
1730
|
+
eval: ((m) => ((Math.max(m, 0.830492) * ((m) * (m) * Math.max(m, 0.906194))) * Math.max(((m) * (m) * (m)) * ((m) * (m) * (m)) * ((m) * (m) * (m)), 0.598429))),
|
|
1731
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((fmaxf(m, 0.830492f) * (powf(m, 2.0f) * fmaxf(m, 0.906194f))) * fmaxf(powf(powf(m, 3.0f), 3.0f), 0.598429f));\n}",
|
|
1732
|
+
py: "import torch\n\ndef spear_fn(m):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((torch.maximum(m, 0.830492) * ((m * m) * torch.maximum(m, 0.906194))) * torch.maximum(((m ** 3) ** 3), 0.598429))",
|
|
1733
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACkgBRgAgAERE3nL1Y5PqP6UgACAAoiAARAebOo+K/+w/paKiIAAgACAAoqIgACAAIACioiAAIAAgAKKioqJEpUv/klQm4z+logs=",
|
|
1727
1734
|
},
|
|
1728
1735
|
meta: {
|
|
1729
1736
|
metric: 0.004333603318947968,
|
|
@@ -2002,8 +2009,183 @@ export const kernels = {
|
|
|
2002
2009
|
vsIterative: null,
|
|
2003
2010
|
},
|
|
2004
2011
|
},
|
|
2012
|
+
"rope_freq": {
|
|
2013
|
+
id: "rope_freq",
|
|
2014
|
+
precise: {
|
|
2015
|
+
js: "((x) => ((0.9999991529919943 * ((0.999947 * Math.cos((1023.994 * Math.exp(Math.max(-50, Math.min(50, (-0.28782 * x))))))) + -0.000038)) + 0.00001879512303862185))",
|
|
2016
|
+
eval: ((x) => ((0.9999991529919943 * ((0.999947 * Math.cos((1023.994 * Math.exp(Math.max(-50, Math.min(50, (-0.28782 * x))))))) + -0.000038)) + 0.00001879512303862185)),
|
|
2017
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((0.999999f * ((0.999947f * cosf((1023.994f * expf(fmaxf(-50.0f, fminf(50.0f, (-0.28782f * x))))))) + -0.000038f)) + 0.000019f);\n}",
|
|
2018
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((0.999999 * ((0.999947 * torch.cos((1023.994 * torch.exp(torch.clamp((-0.28782 * x), -50.0, 50.0))))) + -0.000038)) + 0.000019)",
|
|
2019
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AhUCA2VudgNleHAAAQNlbnYDY29zAAEDAgEABwkBBXNwZWFyAAIKWgFYAEQqG0Q5/v/vP0RLd9fZkP/vP0TLoUW28/+PQERBn8iTpGvSvyAAokQAAAAAAABJwKVEAAAAAAAASUCkEACiEAGiRBgK2A5G7AO/oKJEuB45BUe18z6gCw==",
|
|
2020
|
+
},
|
|
2021
|
+
fast: {
|
|
2022
|
+
js: "((x) => Math.cos((1023.994 * Math.exp(Math.max(-50, Math.min(50, (-0.28782 * x)))))))",
|
|
2023
|
+
eval: ((x) => Math.cos((1023.994 * Math.exp(Math.max(-50, Math.min(50, (-0.28782 * x))))))),
|
|
2024
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return cosf((1023.994f * expf(fmaxf(-50.0f, fminf(50.0f, (-0.28782f * x))))));\n}",
|
|
2025
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.cos((1023.994 * torch.exp(torch.clamp((-0.28782 * x), -50.0, 50.0))))",
|
|
2026
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AhUCA2VudgNleHAAAQNlbnYDY29zAAEDAgEABwkBBXNwZWFyAAIKMgEwAETLoUW28/+PQERBn8iTpGvSvyAAokQAAAAAAABJwKVEAAAAAAAASUCkEACiEAEL",
|
|
2027
|
+
},
|
|
2028
|
+
meta: {
|
|
2029
|
+
metric: 8.450097215964813e-7,
|
|
2030
|
+
level: 5,
|
|
2031
|
+
formulaCost: 8,
|
|
2032
|
+
exactCost: 43,
|
|
2033
|
+
speedupVsExact: 5.375,
|
|
2034
|
+
vsIterative: null,
|
|
2035
|
+
},
|
|
2036
|
+
},
|
|
2037
|
+
"bilateral_weight": {
|
|
2038
|
+
id: "bilateral_weight",
|
|
2039
|
+
precise: {
|
|
2040
|
+
js: "((x) => Math.min(1e4, Math.max(-1e4, (Math.exp(Math.max(-50, Math.min(50, (-((x) * (x) * 50)))))) / (((1 + ((x) * (x) * 2))) < 1e-4 && ((1 + ((x) * (x) * 2))) > -1e-4 ? (((1 + ((x) * (x) * 2))) >= 0 ? 1e-4 : -1e-4) : ((1 + ((x) * (x) * 2)))))))",
|
|
2041
|
+
eval: ((x) => Math.min(1e4, Math.max(-1e4, (Math.exp(Math.max(-50, Math.min(50, (-((x) * (x) * 50)))))) / (((1 + ((x) * (x) * 2))) < 1e-4 && ((1 + ((x) * (x) * 2))) > -1e-4 ? (((1 + ((x) * (x) * 2))) >= 0 ? 1e-4 : -1e-4) : ((1 + ((x) * (x) * 2))))))),
|
|
2042
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return fminf(fmaxf((expf(fmaxf(-50.0f, fminf(50.0f, (-(powf(x, 2.0f) * 50f))))) / copysignf(fmaxf(fabsf((1f + (powf(x, 2.0f) * 2f))), 1.0e-4f), (1f + (powf(x, 2.0f) * 2f)))), -1.0e4f), 1.0e4f);\n}",
|
|
2043
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (torch.exp(torch.clamp((-((x * x) * 50)), -50.0, 50.0)) / (abs((1 + ((x * x) * 2))) < 1e-4 ? 1e-4 : (1 + ((x * x) * 2))))",
|
|
2044
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgsBA2VudgNleHAAAQMCAQAHCQEFc3BlYXIAAQp9AXsAIAAgAKJEAAAAAAAASUCimkQAAAAAAABJwKVEAAAAAAAASUCkEABEAAAAAAAA8D8gACAAokQAAAAAAAAAQKKgmUQtQxzr4jYaP6VEAAAAAAAA8D8gACAAokQAAAAAAAAAQKKgpqNEAAAAAACIw8ClRAAAAAAAiMNApAs=",
|
|
2045
|
+
},
|
|
2046
|
+
fast: {
|
|
2047
|
+
js: "((x) => Math.min(1e4, Math.max(-1e4, (Math.exp(Math.max(-50, Math.min(50, (-((x) * (x) * 50)))))) / (((1 + ((x) * (x) * 2))) < 1e-4 && ((1 + ((x) * (x) * 2))) > -1e-4 ? (((1 + ((x) * (x) * 2))) >= 0 ? 1e-4 : -1e-4) : ((1 + ((x) * (x) * 2)))))))",
|
|
2048
|
+
eval: ((x) => Math.min(1e4, Math.max(-1e4, (Math.exp(Math.max(-50, Math.min(50, (-((x) * (x) * 50)))))) / (((1 + ((x) * (x) * 2))) < 1e-4 && ((1 + ((x) * (x) * 2))) > -1e-4 ? (((1 + ((x) * (x) * 2))) >= 0 ? 1e-4 : -1e-4) : ((1 + ((x) * (x) * 2))))))),
|
|
2049
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return fminf(fmaxf((expf(fmaxf(-50.0f, fminf(50.0f, (-(powf(x, 2.0f) * 50f))))) / copysignf(fmaxf(fabsf((1f + (powf(x, 2.0f) * 2f))), 1.0e-4f), (1f + (powf(x, 2.0f) * 2f)))), -1.0e4f), 1.0e4f);\n}",
|
|
2050
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (torch.exp(torch.clamp((-((x * x) * 50)), -50.0, 50.0)) / (abs((1 + ((x * x) * 2))) < 1e-4 ? 1e-4 : (1 + ((x * x) * 2))))",
|
|
2051
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgsBA2VudgNleHAAAQMCAQAHCQEFc3BlYXIAAQp9AXsAIAAgAKJEAAAAAAAASUCimkQAAAAAAABJwKVEAAAAAAAASUCkEABEAAAAAAAA8D8gACAAokQAAAAAAAAAQKKgmUQtQxzr4jYaP6VEAAAAAAAA8D8gACAAokQAAAAAAAAAQKKgpqNEAAAAAACIw8ClRAAAAAAAiMNApAs=",
|
|
2052
|
+
},
|
|
2053
|
+
meta: {
|
|
2054
|
+
metric: 9.336399957342636e-35,
|
|
2055
|
+
level: 5,
|
|
2056
|
+
formulaCost: 11,
|
|
2057
|
+
exactCost: 45,
|
|
2058
|
+
speedupVsExact: 4.090909090909091,
|
|
2059
|
+
vsIterative: null,
|
|
2060
|
+
},
|
|
2061
|
+
},
|
|
2062
|
+
"bs_d1_sigma": {
|
|
2063
|
+
id: "bs_d1_sigma",
|
|
2064
|
+
precise: {
|
|
2065
|
+
js: "((x) => (Math.min(1e4, Math.max(-1e4, (0.21562036) / ((Math.abs(x)) < 1e-4 && (Math.abs(x)) > -1e-4 ? ((Math.abs(x)) >= 0 ? 1e-4 : -1e-4) : (Math.abs(x))))) + (0.25 * Math.abs(x))))",
|
|
2066
|
+
eval: ((x) => (Math.min(1e4, Math.max(-1e4, (0.21562036) / ((Math.abs(x)) < 1e-4 && (Math.abs(x)) > -1e-4 ? ((Math.abs(x)) >= 0 ? 1e-4 : -1e-4) : (Math.abs(x))))) + (0.25 * Math.abs(x)))),
|
|
2067
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (fminf(fmaxf((0.21562f / copysignf(fmaxf(fabsf(fabsf(x)), 1.0e-4f), fabsf(x))), -1.0e4f), 1.0e4f) + (0.25f * fabsf(x)));\n}",
|
|
2068
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((0.21562 / (abs(torch.abs(x)) < 1e-4 ? 1e-4 : torch.abs(x))) + (0.25 * torch.abs(x)))",
|
|
2069
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACkIBQABEop9GrXKZyz8gAJmZRC1DHOviNho/pSAAmaajRAAAAAAAiMPApUQAAAAAAIjDQKREAAAAAAAA0D8gAJmioAs=",
|
|
2070
|
+
},
|
|
2071
|
+
fast: {
|
|
2072
|
+
js: "((x) => (Math.min(1e4, Math.max(-1e4, (3.635301) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) + (4.215319 * x)))",
|
|
2073
|
+
eval: ((x) => (Math.min(1e4, Math.max(-1e4, (3.635301) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) + (4.215319 * x))),
|
|
2074
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (fminf(fmaxf((3.635301f / copysignf(fmaxf(fabsf(x), 1.0e-4f), x)), -1.0e4f), 1.0e4f) + (4.215319f * x));\n}",
|
|
2075
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((3.635301 / (abs(x) < 1e-4 ? 1e-4 : x)) + (4.215319 * x))",
|
|
2076
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACj8BPQBExO3QsBgVDUAgAJlELUMc6+I2Gj+lIACmo0QAAAAAAIjDwKVEAAAAAACIw0CkRGfUfJV83BBAIACioAs=",
|
|
2077
|
+
},
|
|
2078
|
+
meta: {
|
|
2079
|
+
metric: 1.6217711315014304e-18,
|
|
2080
|
+
level: 5,
|
|
2081
|
+
formulaCost: 8,
|
|
2082
|
+
exactCost: 9,
|
|
2083
|
+
speedupVsExact: 1.125,
|
|
2084
|
+
vsIterative: null,
|
|
2085
|
+
},
|
|
2086
|
+
},
|
|
2087
|
+
"mel_scale": {
|
|
2088
|
+
id: "mel_scale",
|
|
2089
|
+
precise: {
|
|
2090
|
+
js: "((x) => (1126.994181 * Math.log(Math.max(1e-30, (1 + (x * 0.0014285714285714286))))))",
|
|
2091
|
+
eval: ((x) => (1126.994181 * Math.log(Math.max(1e-30, (1 + (x * 0.0014285714285714286)))))),
|
|
2092
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (1126.994181f * logf(fmaxf(1.0e-30f, (1f + (x * 0.001429f)))));\n}",
|
|
2093
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (1126.994181 * torch.log(torch.clamp((1 + (x * 0.001429)), min=1e-30)))",
|
|
2094
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgsBA2VudgNsb2cAAQMCAQAHCQEFc3BlYXIAAQowAS4ARDiFlQr6m5FARAAAAAAAAPA/IABEsak05NxnVz+ioESgwuv+S0i0OaUQAKIL",
|
|
2095
|
+
},
|
|
2096
|
+
fast: {
|
|
2097
|
+
js: "((x) => Math.log(Math.max(1e-30, (1 + (x * 0.0014285714285714286)))))",
|
|
2098
|
+
eval: ((x) => Math.log(Math.max(1e-30, (1 + (x * 0.0014285714285714286))))),
|
|
2099
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return logf(fmaxf(1.0e-30f, (1f + (x * 0.001429f))));\n}",
|
|
2100
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.log(torch.clamp((1 + (x * 0.001429)), min=1e-30))",
|
|
2101
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgsBA2VudgNsb2cAAQMCAQAHCQEFc3BlYXIAAQomASQARAAAAAAAAPA/IABEsak05NxnVz+ioESgwuv+S0i0OaUQAAs=",
|
|
2102
|
+
},
|
|
2103
|
+
meta: {
|
|
2104
|
+
metric: 1.4594066099947563e-12,
|
|
2105
|
+
level: 5,
|
|
2106
|
+
formulaCost: 4,
|
|
2107
|
+
exactCost: 23,
|
|
2108
|
+
speedupVsExact: 5.75,
|
|
2109
|
+
vsIterative: null,
|
|
2110
|
+
},
|
|
2111
|
+
},
|
|
2112
|
+
"bs_d2_sigma": {
|
|
2113
|
+
id: "bs_d2_sigma",
|
|
2114
|
+
precise: {
|
|
2115
|
+
js: "((x) => (Math.min(1e4, Math.max(-1e4, (0.21562036) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) + (-(0.25 * x))))",
|
|
2116
|
+
eval: ((x) => (Math.min(1e4, Math.max(-1e4, (0.21562036) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) + (-(0.25 * x)))),
|
|
2117
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (fminf(fmaxf((0.21562f / copysignf(fmaxf(fabsf(x), 1.0e-4f), x)), -1.0e4f), 1.0e4f) + (-(0.25f * x)));\n}",
|
|
2118
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((0.21562 / (abs(x) < 1e-4 ? 1e-4 : x)) + (-(0.25 * x)))",
|
|
2119
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACkABPgBEop9GrXKZyz8gAJlELUMc6+I2Gj+lIACmo0QAAAAAAIjDwKVEAAAAAACIw0CkRAAAAAAAANA/IACimqAL",
|
|
2120
|
+
},
|
|
2121
|
+
fast: {
|
|
2122
|
+
js: "((x) => (Math.min(1e4, Math.max(-1e4, (0.21562036) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) + (-(0.25 * x))))",
|
|
2123
|
+
eval: ((x) => (Math.min(1e4, Math.max(-1e4, (0.21562036) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) + (-(0.25 * x)))),
|
|
2124
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (fminf(fmaxf((0.21562f / copysignf(fmaxf(fabsf(x), 1.0e-4f), x)), -1.0e4f), 1.0e4f) + (-(0.25f * x)));\n}",
|
|
2125
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((0.21562 / (abs(x) < 1e-4 ? 1e-4 : x)) + (-(0.25 * x)))",
|
|
2126
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACkABPgBEop9GrXKZyz8gAJlELUMc6+I2Gj+lIACmo0QAAAAAAIjDwKVEAAAAAACIw0CkRAAAAAAAANA/IACimqAL",
|
|
2127
|
+
},
|
|
2128
|
+
meta: {
|
|
2129
|
+
metric: 1.6217711130493227e-18,
|
|
2130
|
+
level: 5,
|
|
2131
|
+
formulaCost: 7,
|
|
2132
|
+
exactCost: 11,
|
|
2133
|
+
speedupVsExact: 1.5714285714285714,
|
|
2134
|
+
vsIterative: null,
|
|
2135
|
+
},
|
|
2136
|
+
},
|
|
2137
|
+
"a_weighting": {
|
|
2138
|
+
id: "a_weighting",
|
|
2139
|
+
precise: {
|
|
2140
|
+
js: "((x) => ((0.9803615530479888 * ((8.859884 * Math.log(Math.max(1e-30, Math.min(1e4, Math.max(-1e4, (((148691236 * (x) * (x)) * (x) * (x))) / (((((x) * (x) + 424.36) * (Math.sqrt(Math.abs((((x) * (x) + 11599.29) * ((x) * (x) + 544496.41)))) * ((x) * (x) + 148691236)))) < 1e-4 && ((((x) * (x) + 424.36) * (Math.sqrt(Math.abs((((x) * (x) + 11599.29) * ((x) * (x) + 544496.41)))) * ((x) * (x) + 148691236)))) > -1e-4 ? (((((x) * (x) + 424.36) * (Math.sqrt(Math.abs((((x) * (x) + 11599.29) * ((x) * (x) + 544496.41)))) * ((x) * (x) + 148691236)))) >= 0 ? 1e-4 : -1e-4) : ((((x) * (x) + 424.36) * (Math.sqrt(Math.abs((((x) * (x) + 11599.29) * ((x) * (x) + 544496.41)))) * ((x) * (x) + 148691236)))))))))) + 2)) + 0.039276893904016105))",
|
|
2141
|
+
eval: ((x) => ((0.9803615530479888 * ((8.859884 * Math.log(Math.max(1e-30, Math.min(1e4, Math.max(-1e4, (((148691236 * (x) * (x)) * (x) * (x))) / (((((x) * (x) + 424.36) * (Math.sqrt(Math.abs((((x) * (x) + 11599.29) * ((x) * (x) + 544496.41)))) * ((x) * (x) + 148691236)))) < 1e-4 && ((((x) * (x) + 424.36) * (Math.sqrt(Math.abs((((x) * (x) + 11599.29) * ((x) * (x) + 544496.41)))) * ((x) * (x) + 148691236)))) > -1e-4 ? (((((x) * (x) + 424.36) * (Math.sqrt(Math.abs((((x) * (x) + 11599.29) * ((x) * (x) + 544496.41)))) * ((x) * (x) + 148691236)))) >= 0 ? 1e-4 : -1e-4) : ((((x) * (x) + 424.36) * (Math.sqrt(Math.abs((((x) * (x) + 11599.29) * ((x) * (x) + 544496.41)))) * ((x) * (x) + 148691236)))))))))) + 2)) + 0.039276893904016105)),
|
|
2142
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((0.980362f * ((8.859884f * logf(fmaxf(1.0e-30f, fminf(fmaxf((((148691236f * powf(x, 2.0f)) * powf(x, 2.0f)) / copysignf(fmaxf(fabsf(((powf(x, 2.0f) + 424.36f) * (sqrtf(fabsf(((powf(x, 2.0f) + 11599.29f) * (powf(x, 2.0f) + 544496.41f)))) * (powf(x, 2.0f) + 148691236f)))), 1.0e-4f), ((powf(x, 2.0f) + 424.36f) * (sqrtf(fabsf(((powf(x, 2.0f) + 11599.29f) * (powf(x, 2.0f) + 544496.41f)))) * (powf(x, 2.0f) + 148691236f))))), -1.0e4f), 1.0e4f)))) + 2f)) + 0.039277f);\n}",
|
|
2143
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((0.980362 * ((8.859884 * torch.log(torch.clamp((((148691236 * (x * x)) * (x * x)) / (abs((((x * x) + 424.36) * (torch.sqrt(torch.abs((((x * x) + 11599.29) * ((x * x) + 544496.41)))) * ((x * x) + 148691236)))) < 1e-4 ? 1e-4 : (((x * x) + 424.36) * (torch.sqrt(torch.abs((((x * x) + 11599.29) * ((x * x) + 544496.41)))) * ((x * x) + 148691236))))), min=1e-30))) + 2)) + 0.039277)",
|
|
2144
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgsBA2VudgNsb2cAAQMCAQAHCQEFc3BlYXIAAQrxAQHuAQBEphkTMR9f7z9EE7U0t0K4IUBEAAAASLK5oUEgACAAoqIgACAAoqIgACAAokT2KFyPwoV6QKAgACAAokTsUbgepafGQKAgACAAokQfhevR4J0gQaCimZ8gACAAokQAAABIsrmhQaCioplELUMc6+I2Gj+lIAAgAKJE9ihcj8KFekCgIAAgAKJE7FG4HqWnxkCgIAAgAKJEH4Xr0eCdIEGgopmfIAAgAKJEAAAASLK5oUGgoqKmo0QAAAAAAIjDwKVEAAAAAACIw0CkRKDC6/5LSLQ5pRAAokQAAAAAAAAAQKCiRK7HnN0ZHKQ/oAs=",
|
|
2145
|
+
},
|
|
2146
|
+
fast: {
|
|
2147
|
+
js: "((x) => ((8.859884 * Math.log(Math.max(1e-30, Math.min(1e4, Math.max(-1e4, (((148691236 * (x) * (x)) * (x) * (x))) / (((((x) * (x) + 424.36) * (Math.sqrt(Math.abs((((x) * (x) + 11599.29) * ((x) * (x) + 544496.41)))) * ((x) * (x) + 148691236)))) < 1e-4 && ((((x) * (x) + 424.36) * (Math.sqrt(Math.abs((((x) * (x) + 11599.29) * ((x) * (x) + 544496.41)))) * ((x) * (x) + 148691236)))) > -1e-4 ? (((((x) * (x) + 424.36) * (Math.sqrt(Math.abs((((x) * (x) + 11599.29) * ((x) * (x) + 544496.41)))) * ((x) * (x) + 148691236)))) >= 0 ? 1e-4 : -1e-4) : ((((x) * (x) + 424.36) * (Math.sqrt(Math.abs((((x) * (x) + 11599.29) * ((x) * (x) + 544496.41)))) * ((x) * (x) + 148691236)))))))))) + 2))",
|
|
2148
|
+
eval: ((x) => ((8.859884 * Math.log(Math.max(1e-30, Math.min(1e4, Math.max(-1e4, (((148691236 * (x) * (x)) * (x) * (x))) / (((((x) * (x) + 424.36) * (Math.sqrt(Math.abs((((x) * (x) + 11599.29) * ((x) * (x) + 544496.41)))) * ((x) * (x) + 148691236)))) < 1e-4 && ((((x) * (x) + 424.36) * (Math.sqrt(Math.abs((((x) * (x) + 11599.29) * ((x) * (x) + 544496.41)))) * ((x) * (x) + 148691236)))) > -1e-4 ? (((((x) * (x) + 424.36) * (Math.sqrt(Math.abs((((x) * (x) + 11599.29) * ((x) * (x) + 544496.41)))) * ((x) * (x) + 148691236)))) >= 0 ? 1e-4 : -1e-4) : ((((x) * (x) + 424.36) * (Math.sqrt(Math.abs((((x) * (x) + 11599.29) * ((x) * (x) + 544496.41)))) * ((x) * (x) + 148691236)))))))))) + 2)),
|
|
2149
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((8.859884f * logf(fmaxf(1.0e-30f, fminf(fmaxf((((148691236f * powf(x, 2.0f)) * powf(x, 2.0f)) / copysignf(fmaxf(fabsf(((powf(x, 2.0f) + 424.36f) * (sqrtf(fabsf(((powf(x, 2.0f) + 11599.29f) * (powf(x, 2.0f) + 544496.41f)))) * (powf(x, 2.0f) + 148691236f)))), 1.0e-4f), ((powf(x, 2.0f) + 424.36f) * (sqrtf(fabsf(((powf(x, 2.0f) + 11599.29f) * (powf(x, 2.0f) + 544496.41f)))) * (powf(x, 2.0f) + 148691236f))))), -1.0e4f), 1.0e4f)))) + 2f);\n}",
|
|
2150
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((8.859884 * torch.log(torch.clamp((((148691236 * (x * x)) * (x * x)) / (abs((((x * x) + 424.36) * (torch.sqrt(torch.abs((((x * x) + 11599.29) * ((x * x) + 544496.41)))) * ((x * x) + 148691236)))) < 1e-4 ? 1e-4 : (((x * x) + 424.36) * (torch.sqrt(torch.abs((((x * x) + 11599.29) * ((x * x) + 544496.41)))) * ((x * x) + 148691236))))), min=1e-30))) + 2)",
|
|
2151
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgsBA2VudgNsb2cAAQMCAQAHCQEFc3BlYXIAAQrdAQHaAQBEE7U0t0K4IUBEAAAASLK5oUEgACAAoqIgACAAoqIgACAAokT2KFyPwoV6QKAgACAAokTsUbgepafGQKAgACAAokQfhevR4J0gQaCimZ8gACAAokQAAABIsrmhQaCioplELUMc6+I2Gj+lIAAgAKJE9ihcj8KFekCgIAAgAKJE7FG4HqWnxkCgIAAgAKJEH4Xr0eCdIEGgopmfIAAgAKJEAAAASLK5oUGgoqKmo0QAAAAAAIjDwKVEAAAAAACIw0CkRKDC6/5LSLQ5pRAAokQAAAAAAAAAQKAL",
|
|
2152
|
+
},
|
|
2153
|
+
meta: {
|
|
2154
|
+
metric: 2.7800484820648814e-29,
|
|
2155
|
+
level: 5,
|
|
2156
|
+
formulaCost: 26,
|
|
2157
|
+
exactCost: 55,
|
|
2158
|
+
speedupVsExact: 2.1153846153846154,
|
|
2159
|
+
vsIterative: null,
|
|
2160
|
+
},
|
|
2161
|
+
},
|
|
2162
|
+
"layernorm_scale": {
|
|
2163
|
+
id: "layernorm_scale",
|
|
2164
|
+
precise: {
|
|
2165
|
+
js: "((x) => Math.min(1e4, Math.max(-1e4, (1) / ((Math.sqrt(Math.abs(x))) < 1e-4 && (Math.sqrt(Math.abs(x))) > -1e-4 ? ((Math.sqrt(Math.abs(x))) >= 0 ? 1e-4 : -1e-4) : (Math.sqrt(Math.abs(x)))))))",
|
|
2166
|
+
eval: ((x) => Math.min(1e4, Math.max(-1e4, (1) / ((Math.sqrt(Math.abs(x))) < 1e-4 && (Math.sqrt(Math.abs(x))) > -1e-4 ? ((Math.sqrt(Math.abs(x))) >= 0 ? 1e-4 : -1e-4) : (Math.sqrt(Math.abs(x))))))),
|
|
2167
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return fminf(fmaxf((1f / copysignf(fmaxf(fabsf(sqrtf(fabsf(x))), 1.0e-4f), sqrtf(fabsf(x)))), -1.0e4f), 1.0e4f);\n}",
|
|
2168
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (1 / (abs(torch.sqrt(torch.abs(x))) < 1e-4 ? 1e-4 : torch.sqrt(torch.abs(x))))",
|
|
2169
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACjYBNABEAAAAAAAA8D8gAJmfmUQtQxzr4jYaP6UgAJmfpqNEAAAAAACIw8ClRAAAAAAAiMNApAs=",
|
|
2170
|
+
},
|
|
2171
|
+
fast: {
|
|
2172
|
+
js: "((x) => Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (x) / (((x) * (x)) < 1e-4 && ((x) * (x)) > -1e-4 ? (((x) * (x)) >= 0 ? 1e-4 : -1e-4) : ((x) * (x))))))))",
|
|
2173
|
+
eval: ((x) => Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (x) / (((x) * (x)) < 1e-4 && ((x) * (x)) > -1e-4 ? (((x) * (x)) >= 0 ? 1e-4 : -1e-4) : ((x) * (x)))))))),
|
|
2174
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return sqrtf(fabsf(fminf(fmaxf((x / copysignf(fmaxf(fabsf(powf(x, 2.0f)), 1.0e-4f), powf(x, 2.0f))), -1.0e4f), 1.0e4f)));\n}",
|
|
2175
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.sqrt(torch.abs((x / (abs((x * x)) < 1e-4 ? 1e-4 : (x * x)))))",
|
|
2176
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACjMBMQAgACAAIACimUQtQxzr4jYaP6UgACAAoqajRAAAAAAAiMPApUQAAAAAAIjDQKSZnws=",
|
|
2177
|
+
},
|
|
2178
|
+
meta: {
|
|
2179
|
+
metric: 0,
|
|
2180
|
+
level: 5,
|
|
2181
|
+
formulaCost: 6,
|
|
2182
|
+
exactCost: 3,
|
|
2183
|
+
speedupVsExact: 0.5,
|
|
2184
|
+
vsIterative: null,
|
|
2185
|
+
},
|
|
2186
|
+
},
|
|
2005
2187
|
};
|
|
2006
2188
|
|
|
2007
|
-
export const kernelIds = ["silu","gelu","sigmoid","kv_cache","free_fall","kepler","gaussian_cdf","damped_pendulum","rl_distillation","lambert_w","rc_circuit","gaussian_kernel","diffusion_beta","bilinear_interp","european_call","temporal_grad","lorentz","hill","kerr","lennard_jones","damped_oscillation","logistic_growth","softplus","kdv_soliton","kerr_spin","pendulum_hybrid","eigen3_sym","ik_reach","idm_following","gemv4","rope_rot","gauss_shader","ema_smooth","smoothstep","srgb_gamma","tanh_sat","atan_unit","srgb_decode","erf_prob","huber_loss","cosh_curve","bessel_j0","bessel_j1","blackbody_r","aces_fit","logsumexp2","probit_quantile","pmt_finance","blackbody_g","blackbody_b","bessel_j2","logit_ml","kelly_criterion","rsi_momentum","implied_vol","michaelis_menten","temperature_softmax","doppler_effect","stefan_boltzmann","mm1_queue_wait","grover_amplitude","concurrence_pure","chsh_correlation","legendre_p2","laguerre_l2","asin_hard","qfi_dephasing","amp_damp_fid","loschmidt_rate","bessel_i0e","elliptic_k","kepler_solver","fast_exp_alu","fresnel_schlick","rayleigh_phase","smootherstep","fog_exp2","back_ease_out","light_falloff_punctual","bias_slope","uncharted2_tonemap","mish"];
|
|
2189
|
+
export const kernelIds = ["silu","gelu","sigmoid","kv_cache","free_fall","kepler","gaussian_cdf","damped_pendulum","rl_distillation","lambert_w","rc_circuit","gaussian_kernel","diffusion_beta","bilinear_interp","european_call","temporal_grad","lorentz","hill","kerr","lennard_jones","damped_oscillation","logistic_growth","softplus","kdv_soliton","kerr_spin","pendulum_hybrid","eigen3_sym","ik_reach","idm_following","gemv4","rope_rot","gauss_shader","ema_smooth","smoothstep","srgb_gamma","tanh_sat","atan_unit","srgb_decode","erf_prob","huber_loss","cosh_curve","bessel_j0","bessel_j1","blackbody_r","aces_fit","logsumexp2","probit_quantile","pmt_finance","blackbody_g","blackbody_b","bessel_j2","logit_ml","kelly_criterion","rsi_momentum","implied_vol","michaelis_menten","temperature_softmax","doppler_effect","stefan_boltzmann","mm1_queue_wait","grover_amplitude","concurrence_pure","chsh_correlation","legendre_p2","laguerre_l2","asin_hard","qfi_dephasing","amp_damp_fid","loschmidt_rate","bessel_i0e","elliptic_k","kepler_solver","fast_exp_alu","fresnel_schlick","rayleigh_phase","smootherstep","fog_exp2","back_ease_out","light_falloff_punctual","bias_slope","uncharted2_tonemap","mish","rope_freq","bilateral_weight","bs_d1_sigma","mel_scale","bs_d2_sigma","a_weighting","layernorm_scale"];
|
|
2008
2190
|
|
|
2009
2191
|
export default kernels;
|
package/package.json
CHANGED