spear-kernels 1.5.0 → 1.7.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.
Files changed (3) hide show
  1. package/index.cjs +349 -103
  2. package/index.js +349 -103
  3. package/package.json +1 -1
package/index.cjs CHANGED
@@ -4,43 +4,50 @@ const kernels = {
4
4
  "silu": {
5
5
  id: "silu",
6
6
  precise: {
7
- js: "((x) => ((0.997587 * (x * (0.501 + (0.587 * Math.min(1e4, Math.max(-1e4, (x) / (((0.815 + Math.sqrt(Math.abs((0.909361 + (x) * (x)))))) < 1e-4 && ((0.815 + Math.sqrt(Math.abs((0.909361 + (x) * (x)))))) > -1e-4 ? (((0.815 + Math.sqrt(Math.abs((0.909361 + (x) * (x)))))) >= 0 ? 1e-4 : -1e-4) : ((0.815 + Math.sqrt(Math.abs((0.909361 + (x) * (x))))))))))))) + -0.005749))",
8
- eval: ((x) => ((0.997587 * (x * (0.501 + (0.587 * Math.min(1e4, Math.max(-1e4, (x) / (((0.815 + Math.sqrt(Math.abs((0.909361 + (x) * (x)))))) < 1e-4 && ((0.815 + Math.sqrt(Math.abs((0.909361 + (x) * (x)))))) > -1e-4 ? (((0.815 + Math.sqrt(Math.abs((0.909361 + (x) * (x)))))) >= 0 ? 1e-4 : -1e-4) : ((0.815 + Math.sqrt(Math.abs((0.909361 + (x) * (x))))))))))))) + -0.005749)),
9
- c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((0.997587f * (x * (0.501f + (0.587f * fminf(fmaxf((x / copysignf(fmaxf(fabsf((0.815f + sqrtf(fabsf((0.909361f + powf(x, 2.0f)))))), 1.0e-4f), (0.815f + sqrtf(fabsf((0.909361f + powf(x, 2.0f))))))), -1.0e4f), 1.0e4f))))) + -0.005749f);\n}",
10
- py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((0.997587 * (x * (0.501 + (0.587 * (x / (abs((0.815 + torch.sqrt(torch.abs((0.909361 + (x * x)))))) < 1e-4 ? 1e-4 : (0.815 + torch.sqrt(torch.abs((0.909361 + (x * x))))))))))) + -0.005749)",
11
- wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACokBAYYBAESmRX2SO+zvPyAARNV46SYxCOA/RGIQWDm0yOI/IABEFK5H4XoU6j9EW0BoPXwZ7T8gACAAoqCZn6CZRC1DHOviNho/pUQUrkfhehTqP0RbQGg9fBntPyAAIACioJmfoKajRAAAAAAAiMPApUQAAAAAAIjDQKSioKKiRPtYwW9DjHe/oAs=",
7
+ js: "((x) => Math.min(1e4, Math.max(-1e4, (x) / (((1 + Math.exp(Math.max(-50, Math.min(50, (-x)))))) < 1e-4 && ((1 + Math.exp(Math.max(-50, Math.min(50, (-x)))))) > -1e-4 ? (((1 + Math.exp(Math.max(-50, Math.min(50, (-x)))))) >= 0 ? 1e-4 : -1e-4) : ((1 + Math.exp(Math.max(-50, Math.min(50, (-x))))))))))",
8
+ eval: ((x) => Math.min(1e4, Math.max(-1e4, (x) / (((1 + Math.exp(Math.max(-50, Math.min(50, (-x)))))) < 1e-4 && ((1 + Math.exp(Math.max(-50, Math.min(50, (-x)))))) > -1e-4 ? (((1 + Math.exp(Math.max(-50, Math.min(50, (-x)))))) >= 0 ? 1e-4 : -1e-4) : ((1 + Math.exp(Math.max(-50, Math.min(50, (-x)))))))))),
9
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return fminf(fmaxf((x / copysignf(fmaxf(fabsf((1f + expf(fmaxf(-50.0f, fminf(50.0f, (-x)))))), 1.0e-4f), (1f + expf(fmaxf(-50.0f, fminf(50.0f, (-x))))))), -1.0e4f), 1.0e4f);\n}",
10
+ py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (x / (abs((1 + torch.exp(torch.clamp((-x), -50.0, 50.0)))) < 1e-4 ? 1e-4 : (1 + torch.exp(torch.clamp((-x), -50.0, 50.0)))))",
11
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgsBA2VudgNleHAAAQMCAQAHCQEFc3BlYXIAAQptAWsAIABEAAAAAAAA8D8gAJpEAAAAAAAAScClRAAAAAAAAElApBAAoJlELUMc6+I2Gj+lRAAAAAAAAPA/IACaRAAAAAAAAEnApUQAAAAAAABJQKQQAKCmo0QAAAAAAIjDwKVEAAAAAACIw0CkCw==",
12
+ },
13
+ fast: {
14
+ js: "((x) => Math.min(1e4, Math.max(-1e4, (x) / (((1 + Math.exp(Math.max(-50, Math.min(50, (-x)))))) < 1e-4 && ((1 + Math.exp(Math.max(-50, Math.min(50, (-x)))))) > -1e-4 ? (((1 + Math.exp(Math.max(-50, Math.min(50, (-x)))))) >= 0 ? 1e-4 : -1e-4) : ((1 + Math.exp(Math.max(-50, Math.min(50, (-x))))))))))",
15
+ eval: ((x) => Math.min(1e4, Math.max(-1e4, (x) / (((1 + Math.exp(Math.max(-50, Math.min(50, (-x)))))) < 1e-4 && ((1 + Math.exp(Math.max(-50, Math.min(50, (-x)))))) > -1e-4 ? (((1 + Math.exp(Math.max(-50, Math.min(50, (-x)))))) >= 0 ? 1e-4 : -1e-4) : ((1 + Math.exp(Math.max(-50, Math.min(50, (-x)))))))))),
16
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return fminf(fmaxf((x / copysignf(fmaxf(fabsf((1f + expf(fmaxf(-50.0f, fminf(50.0f, (-x)))))), 1.0e-4f), (1f + expf(fmaxf(-50.0f, fminf(50.0f, (-x))))))), -1.0e4f), 1.0e4f);\n}",
17
+ py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (x / (abs((1 + torch.exp(torch.clamp((-x), -50.0, 50.0)))) < 1e-4 ? 1e-4 : (1 + torch.exp(torch.clamp((-x), -50.0, 50.0)))))",
18
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgsBA2VudgNleHAAAQMCAQAHCQEFc3BlYXIAAQptAWsAIABEAAAAAAAA8D8gAJpEAAAAAAAAScClRAAAAAAAAElApBAAoJlELUMc6+I2Gj+lRAAAAAAAAPA/IACaRAAAAAAAAEnApUQAAAAAAABJQKQQAKCmo0QAAAAAAIjDwKVEAAAAAACIw0CkCw==",
12
19
  },
13
20
  meta: {
14
- metric: 0.0007795906249592223,
15
- level: 2,
16
- formulaCost: 14,
21
+ metric: 0,
22
+ level: 5,
23
+ formulaCost: 7,
17
24
  exactCost: 34,
18
- speedupVsExact: 2.4285714285714284,
25
+ speedupVsExact: 4.857142857142857,
19
26
  vsIterative: null,
20
27
  },
21
28
  },
22
29
  "gelu": {
23
30
  id: "gelu",
24
31
  precise: {
25
- js: "((x) => ((0.997729 * (x * Math.min(1.002, Math.max(0, ((0.306923 * x) + 0.501))))) + -0.004004))",
26
- eval: ((x) => ((0.997729 * (x * Math.min(1.002, Math.max(0, ((0.306923 * x) + 0.501))))) + -0.004004)),
27
- c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((0.997729f * (x * fminf(1.002f, fmaxf(0.0f, ((0.306923f * x) + 0.501f))))) + -0.004004f);\n}",
28
- py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((0.997729 * (x * torch.minimum(1.002, torch.relu(((0.306923 * x) + 0.501))))) + -0.004004)",
29
- wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACkUBQwBEQ6ooXmXt7z8gAETVeOkmMQjwP0Qr+dhdoKTTPyAAokTVeOkmMQjgP6BEAAAAAAAAAAClpKKiRHfX2ZB/ZnC/oAs=",
32
+ js: "((x) => ((0.999993 * ((0.5 * x) * (1 + Math.tanh((0.797885 * (x + (0.044715 * (x) * (x) * (x)))))))) + -0.000058))",
33
+ eval: ((x) => ((0.999993 * ((0.5 * x) * (1 + Math.tanh((0.797885 * (x + (0.044715 * (x) * (x) * (x)))))))) + -0.000058)),
34
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((0.999993f * ((0.5f * x) * (1f + tanhf((0.797885f * (x + (0.044715f * powf(x, 3.0f)))))))) + -0.000058f);\n}",
35
+ py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((0.999993 * ((0.5 * x) * (1 + torch.tanh((0.797885 * (x + (0.044715 * (x ** 3)))))))) + -0.000058)",
36
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgwBA2VudgR0YW5oAAEDAgEABwkBBXNwZWFyAAEKUAFOAERhU+dR8f/vP0QAAAAAAADgPyAAokQAAAAAAADwP0S4AZ8fRojpPyAARPcBSG3i5KY/IAAgACAAoqKioKIQAKCiokSQvknToGgOv6AL",
30
37
  },
31
38
  fast: {
32
- js: "((x) => (x * Math.min(1, Math.max(0, ((0.295845 * x) + 0.5)))))",
33
- eval: ((x) => (x * Math.min(1, Math.max(0, ((0.295845 * x) + 0.5))))),
34
- c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (x * fminf(1f, fmaxf(0.0f, ((0.295845f * x) + 0.5f))));\n}",
35
- py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (x * torch.minimum(1, torch.relu(((0.295845 * x) + 0.5))))",
36
- wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACjEBLwAgAEQAAAAAAADwP0QC2evdH+/SPyAAokQAAAAAAADgP6BEAAAAAAAAAAClpKIL",
39
+ js: "((x) => Math.max(0, x))",
40
+ eval: ((x) => Math.max(0, x)),
41
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return fmaxf(0.0f, x);\n}",
42
+ py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.relu(x)",
43
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAAChABDgAgAEQAAAAAAAAAAKUL",
37
44
  },
38
45
  meta: {
39
- metric: 0.0005322566020140329,
40
- level: 2,
41
- formulaCost: 7,
46
+ metric: 3.55135869310835e-8,
47
+ level: 5,
48
+ formulaCost: 11,
42
49
  exactCost: 46,
43
- speedupVsExact: 6.571428571428571,
50
+ speedupVsExact: 4.181818181818182,
44
51
  vsIterative: null,
45
52
  },
46
53
  },
@@ -54,11 +61,11 @@ const kernels = {
54
61
  wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgsBA2VudgNleHAAAQMCAQAHCQEFc3BlYXIAAQp9AXsARAAAAAAAAPA/RAAAAAAAAPA/IABEAAAAAAAAScClRAAAAAAAAElApBAAoJlELUMc6+I2Gj+lRAAAAAAAAPA/IABEAAAAAAAAScClRAAAAAAAAElApBAAoKajRAAAAAAAiMPApUQAAAAAAIjDQKSaRAAAAAAAAPA/oAs=",
55
62
  },
56
63
  fast: {
57
- js: "((x) => Math.min(1e4, Math.max(-1e4, (x) / (((1 + Math.abs(x))) < 1e-4 && ((1 + Math.abs(x))) > -1e-4 ? (((1 + Math.abs(x))) >= 0 ? 1e-4 : -1e-4) : ((1 + Math.abs(x)))))))",
58
- eval: ((x) => Math.min(1e4, Math.max(-1e4, (x) / (((1 + Math.abs(x))) < 1e-4 && ((1 + Math.abs(x))) > -1e-4 ? (((1 + Math.abs(x))) >= 0 ? 1e-4 : -1e-4) : ((1 + Math.abs(x))))))),
59
- c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return fminf(fmaxf((x / copysignf(fmaxf(fabsf((1f + fabsf(x))), 1.0e-4f), (1f + fabsf(x)))), -1.0e4f), 1.0e4f);\n}",
60
- py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (x / (abs((1 + torch.abs(x))) < 1e-4 ? 1e-4 : (1 + torch.abs(x))))",
61
- wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACkEBPwAgAEQAAAAAAADwPyAAmaCZRC1DHOviNho/pUQAAAAAAADwPyAAmaCmo0QAAAAAAIjDwKVEAAAAAACIw0CkCw==",
64
+ js: "((x) => Math.atan(x))",
65
+ eval: ((x) => Math.atan(x)),
66
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return atanf(x);\n}",
67
+ py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.atan(x)",
68
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgwBA2VudgRhdGFuAAEDAgEABwkBBXNwZWFyAAEKCAEGACAAEAAL",
62
69
  },
63
70
  meta: {
64
71
  metric: 4.790511494175498e-33,
@@ -154,11 +161,11 @@ const kernels = {
154
161
  wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgwBA2VudgRhdGFuAAEDAgEABwkBBXNwZWFyAAEKOgE4AETOGyeFeY/cP0RsI57sZkbuPyAARBBYObTIdgHApaJEpTLFHARdAECkEACiREPFOH8TCuA/oAs=",
155
162
  },
156
163
  fast: {
157
- js: "((x) => ((0.543518 * Math.min(1e4, Math.max(-1e4, (x) / ((Math.max(1.559472, (0.337459 + Math.abs(x)))) < 1e-4 && (Math.max(1.559472, (0.337459 + Math.abs(x)))) > -1e-4 ? ((Math.max(1.559472, (0.337459 + Math.abs(x)))) >= 0 ? 1e-4 : -1e-4) : (Math.max(1.559472, (0.337459 + Math.abs(x)))))))) + 0.5))",
158
- eval: ((x) => ((0.543518 * Math.min(1e4, Math.max(-1e4, (x) / ((Math.max(1.559472, (0.337459 + Math.abs(x)))) < 1e-4 && (Math.max(1.559472, (0.337459 + Math.abs(x)))) > -1e-4 ? ((Math.max(1.559472, (0.337459 + Math.abs(x)))) >= 0 ? 1e-4 : -1e-4) : (Math.max(1.559472, (0.337459 + Math.abs(x)))))))) + 0.5)),
159
- c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((0.543518f * fminf(fmaxf((x / copysignf(fmaxf(fabsf(fmaxf(1.559472f, (0.337459f + fabsf(x)))), 1.0e-4f), fmaxf(1.559472f, (0.337459f + fabsf(x))))), -1.0e4f), 1.0e4f)) + 0.5f);\n}",
160
- py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((0.543518 * (x / (abs(torch.maximum(1.559472, (0.337459 + torch.abs(x)))) < 1e-4 ? 1e-4 : torch.maximum(1.559472, (0.337459 + torch.abs(x)))))) + 0.5)",
161
- wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACmkBZwBEyjFZ3H9k4T8gAESCcXDpmPP4P0RRai+i7ZjVPyAAmaClmUQtQxzr4jYaP6VEgnFw6Zjz+D9EUWovou2Y1T8gAJmgpaajRAAAAAAAiMPApUQAAAAAAIjDQKSiRAAAAAAAAOA/oAs=",
164
+ js: "((x) => Math.tanh(x))",
165
+ eval: ((x) => Math.tanh(x)),
166
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return tanhf(x);\n}",
167
+ py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.tanh(x)",
168
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgwBA2VudgR0YW5oAAEDAgEABwkBBXNwZWFyAAEKCAEGACAAEAAL",
162
169
  },
163
170
  meta: {
164
171
  metric: 0.000016407954856661242,
@@ -254,11 +261,11 @@ const kernels = {
254
261
  wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AiADA2VudgNleHAAAQNlbnYEYXRhbgABA2VudgNsb2cAAQMCAQAHCQEFc3BlYXIAAwpIAUYARFrhtkDMt/a/RHWuKCUE6wFAIABEAAAAAAAAScClRAAAAAAAAElApBAAEAFEoMLr/ktItDmlEAKhokTf3Weg90IMQKAL",
255
262
  },
256
263
  fast: {
257
- js: "((t) => (((6.643258 - t)) * ((6.643258 - t)) * ((6.643258 - t))) * (((6.643258 - t)) * ((6.643258 - t)) * ((6.643258 - t))))",
258
- eval: ((t) => (((6.643258 - t)) * ((6.643258 - t)) * ((6.643258 - t))) * (((6.643258 - t)) * ((6.643258 - t)) * ((6.643258 - t)))),
259
- c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return powf(powf((6.643258f - t), 3.0f), 2.0f);\n}",
260
- py: "import torch\n\ndef spear_fn(t):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (((6.643258 - t) ** 3) * ((6.643258 - t) ** 3))",
261
- wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAAClEBTwBEvY+jObKSGkAgAKFEvY+jObKSGkAgAKFEvY+jObKSGkAgAKGiokS9j6M5spIaQCAAoUS9j6M5spIaQCAAoUS9j6M5spIaQCAAoaKiogs=",
264
+ js: "((t) => Math.exp(Math.max(-50, Math.min(50, (-t)))))",
265
+ eval: ((t) => Math.exp(Math.max(-50, Math.min(50, (-t))))),
266
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return expf(fmaxf(-50.0f, fminf(50.0f, (-t))));\n}",
267
+ py: "import torch\n\ndef spear_fn(t):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.exp(torch.clamp((-t), -50.0, 50.0))",
268
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgsBA2VudgNleHAAAQMCAQAHCQEFc3BlYXIAAQodARsAIACaRAAAAAAAAEnApUQAAAAAAABJQKQQAAs=",
262
269
  },
263
270
  meta: {
264
271
  metric: 0.00007258403509477666,
@@ -378,6 +385,13 @@ const kernels = {
378
385
  py: "import torch\n\ndef spear_fn(b, a):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (b - a)",
379
386
  wasmBase64: "AGFzbQEAAAABDAJgAnx8AXxgAXwBfAMCAQAHCQEFc3BlYXIAAAoJAQcAIAAgAaEL",
380
387
  },
388
+ fast: {
389
+ js: "((a, b) => (a - b))",
390
+ eval: ((a, b) => (a - b)),
391
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (a - b);\n}",
392
+ py: "import torch\n\ndef spear_fn(a, b):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (a - b)",
393
+ wasmBase64: "AGFzbQEAAAABDAJgAnx8AXxgAXwBfAMCAQAHCQEFc3BlYXIAAAoJAQcAIAAgAaEL",
394
+ },
381
395
  meta: {
382
396
  metric: 0,
383
397
  level: 5,
@@ -676,11 +690,11 @@ const kernels = {
676
690
  wasmBase64: "AGFzbQEAAAABDQJgA3x8fAF8YAF8AXwDAgEABwkBBXNwZWFyAAAK+AEB9QEARJNWfEPhM/0/RGZmZmZmZv4/RAMkmkARyxTARCO6Z12j5eo/IAAgAKIgACAAoqJEje21oPfGsD6ioUTUtfY+VSUDQESscTYdAdzbvyAARILlCBnIs/g/oiAAIAGiRLix2ZHqO8s/oqCloCACmUQtQxzr4jYaP6UgAqajRAAAAAAAiMPApUQAAAAAAIjDQKRE1LX2PlUlA0BErHE2HQHc278gAESC5QgZyLP4P6IgACABokS4sdmR6jvLP6KgpaAgAplELUMc6+I2Gj+lIAKmo0QAAAAAAIjDwKVEAAAAAACIw0CkoqGlpKJEShr5fwEe3z+gCw==",
677
691
  },
678
692
  fast: {
679
- js: "((v, dv, s) => ((1.1414205468162575 * ((1.22047 * Math.min(1.9, Math.max(-7.31, ((1 - (((v) * (v)) * ((v) * (v)) * 0.000001)) - (Math.min(1e4, Math.max(-1e4, ((3.45 + Math.max(-0.05, ((v * 1.45) + ((v * dv) * 0.212766))))) / ((s) < 1e-4 && (s) > -1e-4 ? ((s) >= 0 ? 1e-4 : -1e-4) : (s))))) * (Math.min(1e4, Math.max(-1e4, ((3.45 + Math.max(-0.05, ((v * 1.45) + ((v * dv) * 0.212766))))) / ((s) < 1e-4 && (s) > -1e-4 ? ((s) >= 0 ? 1e-4 : -1e-4) : (s))))))))) + 0.215661)) + 0.024217427345017313))",
680
- eval: ((v, dv, s) => ((1.1414205468162575 * ((1.22047 * Math.min(1.9, Math.max(-7.31, ((1 - (((v) * (v)) * ((v) * (v)) * 0.000001)) - (Math.min(1e4, Math.max(-1e4, ((3.45 + Math.max(-0.05, ((v * 1.45) + ((v * dv) * 0.212766))))) / ((s) < 1e-4 && (s) > -1e-4 ? ((s) >= 0 ? 1e-4 : -1e-4) : (s))))) * (Math.min(1e4, Math.max(-1e4, ((3.45 + Math.max(-0.05, ((v * 1.45) + ((v * dv) * 0.212766))))) / ((s) < 1e-4 && (s) > -1e-4 ? ((s) >= 0 ? 1e-4 : -1e-4) : (s))))))))) + 0.215661)) + 0.024217427345017313)),
681
- c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((1.141421f * ((1.22047f * fminf(1.9f, fmaxf(-7.31f, ((1f - (powf(powf(v, 2.0f), 2.0f) * 0.000001f)) - powf(fminf(fmaxf(((3.45f + fmaxf(-0.05f, ((v * 1.45f) + ((v * dv) * 0.212766f)))) / copysignf(fmaxf(fabsf(s), 1.0e-4f), s)), -1.0e4f), 1.0e4f), 2.0f))))) + 0.215661f)) + 0.024217f);\n}",
682
- py: "import torch\n\ndef spear_fn(v, dv, s):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((1.141421 * ((1.22047 * torch.minimum(1.9, torch.maximum(-7.31, ((1 - (((v * v) * (v * v)) * 0.000001)) - (((3.45 + torch.maximum(-0.05, ((v * 1.45) + ((v * dv) * 0.212766)))) / (abs(s) < 1e-4 ? 1e-4 : s)) * ((3.45 + torch.maximum(-0.05, ((v * 1.45) + ((v * dv) * 0.212766)))) / (abs(s) < 1e-4 ? 1e-4 : s))))))) + 0.215661)) + 0.024217)",
683
- wasmBase64: "AGFzbQEAAAABDQJgA3x8fAF8YAF8AXwDAgEABwkBBXNwZWFyAAAKjAIBiQIARKXu+DBCQ/I/RGX8+4wLh/M/RGZmZmZmZv4/RD0K16NwPR3ARAAAAAAAAPA/IAAgAKIgACAAoqJEje21oPfGsD6ioUSamZmZmZkLQESamZmZmZmpvyAARDMzMzMzM/c/oiAAIAGiRLix2ZHqO8s/oqCloCACmUQtQxzr4jYaP6UgAqajRAAAAAAAiMPApUQAAAAAAIjDQKREmpmZmZmZC0BEmpmZmZmZqb8gAEQzMzMzMzP3P6IgACABokS4sdmR6jvLP6KgpaAgAplELUMc6+I2Gj+lIAKmo0QAAAAAAIjDwKVEAAAAAACIw0CkoqGlpKJEZOYCl8eayz+gokQCq8IJdMyYP6AL",
693
+ js: "((v, dv, s) => Math.min(1.743715, Math.max(-8.6, ((1 - (((v) * (v)) * ((v) * (v)) * 0.0000010828124103295972)) - (Math.min(1e4, Math.max(-1e4, ((2.3 + Math.max(0, ((v * 1.45) + ((v * dv) * 0.2127659574468085))))) / ((s) < 1e-4 && (s) > -1e-4 ? ((s) >= 0 ? 1e-4 : -1e-4) : (s))))) * (Math.min(1e4, Math.max(-1e4, ((2.3 + Math.max(0, ((v * 1.45) + ((v * dv) * 0.2127659574468085))))) / ((s) < 1e-4 && (s) > -1e-4 ? ((s) >= 0 ? 1e-4 : -1e-4) : (s)))))))))",
694
+ eval: ((v, dv, s) => Math.min(1.743715, Math.max(-8.6, ((1 - (((v) * (v)) * ((v) * (v)) * 0.0000010828124103295972)) - (Math.min(1e4, Math.max(-1e4, ((2.3 + Math.max(0, ((v * 1.45) + ((v * dv) * 0.2127659574468085))))) / ((s) < 1e-4 && (s) > -1e-4 ? ((s) >= 0 ? 1e-4 : -1e-4) : (s))))) * (Math.min(1e4, Math.max(-1e4, ((2.3 + Math.max(0, ((v * 1.45) + ((v * dv) * 0.2127659574468085))))) / ((s) < 1e-4 && (s) > -1e-4 ? ((s) >= 0 ? 1e-4 : -1e-4) : (s))))))))),
695
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return fminf(1.743715f, fmaxf(-8.6f, ((1f - (powf(powf(v, 2.0f), 2.0f) * 0.000001f)) - powf(fminf(fmaxf(((2.3f + fmaxf(0f, ((v * 1.45f) + ((v * dv) * 0.212766f)))) / copysignf(fmaxf(fabsf(s), 1.0e-4f), s)), -1.0e4f), 1.0e4f), 2.0f))));\n}",
696
+ py: "import torch\n\ndef spear_fn(v, dv, s):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.minimum(1.743715, torch.maximum(-8.6, ((1 - (((v * v) * (v * v)) * 0.000001)) - (((2.3 + torch.maximum(0, ((v * 1.45) + ((v * dv) * 0.212766)))) / (abs(s) < 1e-4 ? 1e-4 : s)) * ((2.3 + torch.maximum(0, ((v * 1.45) + ((v * dv) * 0.212766)))) / (abs(s) < 1e-4 ? 1e-4 : s))))))",
697
+ wasmBase64: "AGFzbQEAAAABDQJgA3x8fAF8YAF8AXwDAgEABwkBBXNwZWFyAAAK5AEB4QEARNi2KLNB5vs/RDMzMzMzMyHARAAAAAAAAPA/IAAgAKIgACAAoqJEp8L61aQqsj6ioURmZmZmZmYCQEQAAAAAAAAAACAARDMzMzMzM/c/oiAAIAGiRG3UdzbqO8s/oqCloCACmUQtQxzr4jYaP6UgAqajRAAAAAAAiMPApUQAAAAAAIjDQKREZmZmZmZmAkBEAAAAAAAAAAAgAEQzMzMzMzP3P6IgACABokRt1Hc26jvLP6KgpaAgAplELUMc6+I2Gj+lIAKmo0QAAAAAAIjDwKVEAAAAAACIw0CkoqGlpAs=",
684
698
  },
685
699
  meta: {
686
700
  metric: 0.002938652617546022,
@@ -701,11 +715,11 @@ const kernels = {
701
715
  wasmBase64: "AGFzbQEAAAABDgJgBHx8fHwBfGABfAF8AwIBAAcJAQVzcGVhcgAACn8BfQBEP5EnSddM4D8gAES8dJMYBFbqP6IgAUQQWDm0yHbeP6KhIAJEmpmZmZmZ8T+iIANEzosTX+0o07+ioKAgAEQ9CtejcD3qP6IgAUQUrkfhehTeP6KhIAJEoYDtYMR+8T+iIANE3BFOC1700b+ioKCgokQAgG/7jCPVPqAL",
702
716
  },
703
717
  fast: {
704
- js: "((x0, x1, x2, x3) => (((x0 * 0.82) - (x1 * 0.470006)) + ((x2 * 1.1) + (x3 * -0.290238))))",
705
- eval: ((x0, x1, x2, x3) => (((x0 * 0.82) - (x1 * 0.470006)) + ((x2 * 1.1) + (x3 * -0.290238)))),
706
- c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (((x0 * 0.82f) - (x1 * 0.470006f)) + ((x2 * 1.1f) + (x3 * -0.290238f)));\n}",
707
- py: "import torch\n\ndef spear_fn(x0, x1, x2, x3):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (((x0 * 0.82) - (x1 * 0.470006)) + ((x2 * 1.1) + (x3 * -0.290238)))",
708
- wasmBase64: "AGFzbQEAAAABDgJgBHx8fHwBfGABfAF8AwIBAAcJAQVzcGVhcgAACjcBNQAgAEQ9CtejcD3qP6IgAUQlH7sLlBTeP6KhIAJEmpmZmZmZ8T+iIANE2JyDZ0KT0r+ioKAL",
718
+ js: "((x0, x1, x2) => (((x0 * 0.82) - (x1 * 0.47)) + ((x2 * 1.1) + 0.82)))",
719
+ eval: ((x0, x1, x2) => (((x0 * 0.82) - (x1 * 0.47)) + ((x2 * 1.1) + 0.82))),
720
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (((x0 * 0.82f) - (x1 * 0.47f)) + ((x2 * 1.1f) + 0.82f));\n}",
721
+ py: "import torch\n\ndef spear_fn(x0, x1, x2):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (((x0 * 0.82) - (x1 * 0.47)) + ((x2 * 1.1) + 0.82))",
722
+ wasmBase64: "AGFzbQEAAAABDQJgA3x8fAF8YAF8AXwDAgEABwkBBXNwZWFyAAAKNAEyACAARD0K16NwPeo/oiABRBSuR+F6FN4/oqEgAkSamZmZmZnxP6JEPQrXo3A96j+goAs=",
709
723
  },
710
724
  meta: {
711
725
  metric: 1.6074532951505583e-7,
@@ -830,25 +844,25 @@ const kernels = {
830
844
  "tanh_sat": {
831
845
  id: "tanh_sat",
832
846
  precise: {
833
- js: "((x) => (0.900021 * Math.min(1e4, Math.max(-1e4, ((x + (0.053639 * (x) * (x) * (x)))) / (((0.90122 + (0.343141 * (x) * (x)))) < 1e-4 && ((0.90122 + (0.343141 * (x) * (x)))) > -1e-4 ? (((0.90122 + (0.343141 * (x) * (x)))) >= 0 ? 1e-4 : -1e-4) : ((0.90122 + (0.343141 * (x) * (x)))))))))",
834
- eval: ((x) => (0.900021 * Math.min(1e4, Math.max(-1e4, ((x + (0.053639 * (x) * (x) * (x)))) / (((0.90122 + (0.343141 * (x) * (x)))) < 1e-4 && ((0.90122 + (0.343141 * (x) * (x)))) > -1e-4 ? (((0.90122 + (0.343141 * (x) * (x)))) >= 0 ? 1e-4 : -1e-4) : ((0.90122 + (0.343141 * (x) * (x))))))))),
835
- c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (0.900021f * fminf(fmaxf(((x + (0.053639f * powf(x, 3.0f))) / copysignf(fmaxf(fabsf((0.90122f + (0.343141f * powf(x, 2.0f)))), 1.0e-4f), (0.90122f + (0.343141f * powf(x, 2.0f))))), -1.0e4f), 1.0e4f));\n}",
836
- py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (0.900021 * ((x + (0.053639 * (x ** 3))) / (abs((0.90122 + (0.343141 * (x * x)))) < 1e-4 ? 1e-4 : (0.90122 + (0.343141 * (x * x))))))",
837
- wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACnYBdABEqtIW1/jM7D8gAETBjZQtknarPyAAIAAgAKKioqBELQlQU8vW7D9Ezas6qwX21T8gACAAoqKgmUQtQxzr4jYaP6VELQlQU8vW7D9Ezas6qwX21T8gACAAoqKgpqNEAAAAAACIw8ClRAAAAAAAiMNApKIL",
847
+ js: "((x) => Math.tanh(x))",
848
+ eval: ((x) => Math.tanh(x)),
849
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return tanhf(x);\n}",
850
+ py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.tanh(x)",
851
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgwBA2VudgR0YW5oAAEDAgEABwkBBXNwZWFyAAEKCAEGACAAEAAL",
838
852
  },
839
853
  fast: {
840
- js: "((x) => Math.min(1e4, Math.max(-1e4, (x) / (((2.598194 * (4.397731 + (x) * (x)))) < 1e-4 && ((2.598194 * (4.397731 + (x) * (x)))) > -1e-4 ? (((2.598194 * (4.397731 + (x) * (x)))) >= 0 ? 1e-4 : -1e-4) : ((2.598194 * (4.397731 + (x) * (x))))))))",
841
- eval: ((x) => Math.min(1e4, Math.max(-1e4, (x) / (((2.598194 * (4.397731 + (x) * (x)))) < 1e-4 && ((2.598194 * (4.397731 + (x) * (x)))) > -1e-4 ? (((2.598194 * (4.397731 + (x) * (x)))) >= 0 ? 1e-4 : -1e-4) : ((2.598194 * (4.397731 + (x) * (x)))))))),
842
- c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return fminf(fmaxf((x / copysignf(fmaxf(fabsf((2.598194f * (4.397731f + powf(x, 2.0f)))), 1.0e-4f), (2.598194f * (4.397731f + powf(x, 2.0f))))), -1.0e4f), 1.0e4f);\n}",
843
- py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (x / (abs((2.598194 * (4.397731 + (x * x)))) < 1e-4 ? 1e-4 : (2.598194 * (4.397731 + (x * x)))))",
844
- wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAAClkBVwAgAESxTpXvGckEQEToa5bLRpcRQCAAIACioKKZRC1DHOviNho/pUSxTpXvGckEQEToa5bLRpcRQCAAIACioKKmo0QAAAAAAIjDwKVEAAAAAACIw0CkCw==",
854
+ js: "((x) => Math.tanh(x))",
855
+ eval: ((x) => Math.tanh(x)),
856
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return tanhf(x);\n}",
857
+ py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.tanh(x)",
858
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgwBA2VudgR0YW5oAAEDAgEABwkBBXNwZWFyAAEKCAEGACAAEAAL",
845
859
  },
846
860
  meta: {
847
- metric: 0.0000046412770528300585,
848
- level: 4,
849
- formulaCost: 12,
861
+ metric: 0,
862
+ level: 5,
863
+ formulaCost: 1,
850
864
  exactCost: 20,
851
- speedupVsExact: 1.6666666666666667,
865
+ speedupVsExact: 20,
852
866
  vsIterative: null,
853
867
  },
854
868
  },
@@ -912,11 +926,11 @@ const kernels = {
912
926
  wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACnYBdABEeQJhp1i18T8gAEQp7KLogY+hPyAAIAAgAKKioqBE16NwPQrX7z9Ezox+NJwy2D8gACAAoqKgmUQtQxzr4jYaP6VE16NwPQrX7z9Ezox+NJwy2D8gACAAoqKgpqNEAAAAAACIw8ClRAAAAAAAiMNApKIL",
913
927
  },
914
928
  fast: {
915
- js: "((x) => Math.sin(Math.sin(Math.atan(x))))",
916
- eval: ((x) => Math.sin(Math.sin(Math.atan(x)))),
917
- c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return sinf(sinf(atanf(x)));\n}",
918
- py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.sin(torch.sin(torch.atan(x)))",
919
- wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AhYCA2VudgNzaW4AAQNlbnYEYXRhbgABAwIBAAcJAQVzcGVhcgACCgwBCgAgABABEAAQAAs=",
929
+ js: "((x) => Math.atan(x))",
930
+ eval: ((x) => Math.atan(x)),
931
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return atanf(x);\n}",
932
+ py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.atan(x)",
933
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgwBA2VudgRhdGFuAAEDAgEABwkBBXNwZWFyAAEKCAEGACAAEAAL",
920
934
  },
921
935
  meta: {
922
936
  metric: 0.00004650870031371604,
@@ -937,11 +951,11 @@ const kernels = {
937
951
  wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACoABAX4ARJrWYT4kC/C/RDvD1JY6CPI/IAAgAKJExZCcTNwqxL+hoUQ64i18lwLwPyAAmaVEH9YbtcL07z+gmUQtQxzr4jYaP6VEOuItfJcC8D8gAJmlRB/WG7XC9O8/oKajRAAAAAAAiMPApUQAAAAAAIjDQKSiRFTKGPauGd8/oAs=",
938
952
  },
939
953
  fast: {
940
- js: "((x) => Math.min(1e4, Math.max(-1e4, ((x) * (x)) / (((Math.abs(x) + 0.989)) < 1e-4 && ((Math.abs(x) + 0.989)) > -1e-4 ? (((Math.abs(x) + 0.989)) >= 0 ? 1e-4 : -1e-4) : ((Math.abs(x) + 0.989))))))",
941
- eval: ((x) => Math.min(1e4, Math.max(-1e4, ((x) * (x)) / (((Math.abs(x) + 0.989)) < 1e-4 && ((Math.abs(x) + 0.989)) > -1e-4 ? (((Math.abs(x) + 0.989)) >= 0 ? 1e-4 : -1e-4) : ((Math.abs(x) + 0.989)))))),
942
- c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return fminf(fmaxf((powf(x, 2.0f) / copysignf(fmaxf(fabsf((fabsf(x) + 0.989f)), 1.0e-4f), (fabsf(x) + 0.989f))), -1.0e4f), 1.0e4f);\n}",
943
- py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((x * x) / (abs((torch.abs(x) + 0.989)) < 1e-4 ? 1e-4 : (torch.abs(x) + 0.989)))",
944
- wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACkQBQgAgACAAoiAAmUTZzvdT46XvP6CZRC1DHOviNho/pSAAmUTZzvdT46XvP6Cmo0QAAAAAAIjDwKVEAAAAAACIw0CkCw==",
954
+ js: "((x) => Math.max(((x) * (x) * 0.098068), ((Math.abs(x) * 0.72) - 0.381094)))",
955
+ eval: ((x) => Math.max(((x) * (x) * 0.098068), ((Math.abs(x) * 0.72) - 0.381094))),
956
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return fmaxf((powf(x, 2.0f) * 0.098068f), ((fabsf(x) * 0.72f) - 0.381094f));\n}",
957
+ py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.maximum(((x * x) * 0.098068), ((torch.abs(x) * 0.72) - 0.381094))",
958
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACisBKQAgACAAokSdvMgE/Bq5P6IgAJlECtejcD0K5z+iRK/qrBbYY9g/oaUL",
945
959
  },
946
960
  meta: {
947
961
  metric: 2.992203818088443e-7,
@@ -1237,11 +1251,11 @@ const kernels = {
1237
1251
  wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgsBA2VudgNsb2cAAQMCAQAHCQEFc3BlYXIAAQpLAUkAIABEAAAAAAAA8D8gAKGZRC1DHOviNho/pUQAAAAAAADwPyAAoaajRAAAAAAAiMPApUQAAAAAAIjDQKREoMLr/ktItDmlEAAL",
1238
1252
  },
1239
1253
  fast: {
1240
- js: "((x) => Math.log(Math.max(1e-30, Math.min(1e4, Math.max(-1e4, (x) / (((Math.min(1e4, Math.max(-1e4, (x) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) - x)) < 1e-4 && ((Math.min(1e4, Math.max(-1e4, (x) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) - x)) > -1e-4 ? (((Math.min(1e4, Math.max(-1e4, (x) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) - x)) >= 0 ? 1e-4 : -1e-4) : ((Math.min(1e4, Math.max(-1e4, (x) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) - x))))))))",
1241
- eval: ((x) => Math.log(Math.max(1e-30, Math.min(1e4, Math.max(-1e4, (x) / (((Math.min(1e4, Math.max(-1e4, (x) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) - x)) < 1e-4 && ((Math.min(1e4, Math.max(-1e4, (x) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) - x)) > -1e-4 ? (((Math.min(1e4, Math.max(-1e4, (x) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) - x)) >= 0 ? 1e-4 : -1e-4) : ((Math.min(1e4, Math.max(-1e4, (x) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) - x)))))))),
1242
- c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return logf(fmaxf(1.0e-30f, fminf(fmaxf((x / copysignf(fmaxf(fabsf((fminf(fmaxf((x / copysignf(fmaxf(fabsf(x), 1.0e-4f), x)), -1.0e4f), 1.0e4f) - x)), 1.0e-4f), (fminf(fmaxf((x / copysignf(fmaxf(fabsf(x), 1.0e-4f), x)), -1.0e4f), 1.0e4f) - x))), -1.0e4f), 1.0e4f)));\n}",
1243
- 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((x / (abs(((x / (abs(x) < 1e-4 ? 1e-4 : x)) - x)) < 1e-4 ? 1e-4 : ((x / (abs(x) < 1e-4 ? 1e-4 : x)) - x))), min=1e-30))",
1244
- wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgsBA2VudgNsb2cAAQMCAQAHCQEFc3BlYXIAAQqIAQGFAQAgACAAIACZRC1DHOviNho/pSAApqNEAAAAAACIw8ClRAAAAAAAiMNApCAAoZlELUMc6+I2Gj+lIAAgAJlELUMc6+I2Gj+lIACmo0QAAAAAAIjDwKVEAAAAAACIw0CkIAChpqNEAAAAAACIw8ClRAAAAAAAiMNApESgwuv+S0i0OaUQAAs=",
1254
+ js: "((x) => Math.log(Math.max(1e-30, Math.min(1e4, Math.max(-1e4, (x) / (((1 - x)) < 1e-4 && ((1 - x)) > -1e-4 ? (((1 - x)) >= 0 ? 1e-4 : -1e-4) : ((1 - x))))))))",
1255
+ eval: ((x) => Math.log(Math.max(1e-30, Math.min(1e4, Math.max(-1e4, (x) / (((1 - x)) < 1e-4 && ((1 - x)) > -1e-4 ? (((1 - x)) >= 0 ? 1e-4 : -1e-4) : ((1 - x)))))))),
1256
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return logf(fmaxf(1.0e-30f, fminf(fmaxf((x / copysignf(fmaxf(fabsf((1f - x)), 1.0e-4f), (1f - x))), -1.0e4f), 1.0e4f)));\n}",
1257
+ 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((x / (abs((1 - x)) < 1e-4 ? 1e-4 : (1 - x))), min=1e-30))",
1258
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgsBA2VudgNsb2cAAQMCAQAHCQEFc3BlYXIAAQpLAUkAIABEAAAAAAAA8D8gAKGZRC1DHOviNho/pUQAAAAAAADwPyAAoaajRAAAAAAAiMPApUQAAAAAAIjDQKREoMLr/ktItDmlEAAL",
1245
1259
  },
1246
1260
  meta: {
1247
1261
  metric: 0,
@@ -1330,11 +1344,11 @@ const kernels = {
1330
1344
  wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACqcBAaQBAER4zU3WKLkUQCAARAtGJXUC81LAoCAARFILJZNT+w/AoZlELUMc6+I2Gj+lIABEUgslk1P7D8ChpqNEAAAAAACIw8ClRAAAAAAAiMNApEQfTfVk/rEEwCAAIABE2/y/6shxD8ChpZlELUMc6+I2Gj+lIAAgAETb/L/qyHEPwKGlpqNEAAAAAACIw8ClRAAAAAAAiMNApKGiRFK25bNttFdAoAs=",
1331
1345
  },
1332
1346
  fast: {
1333
- js: "((s) => (Math.min(1e4, Math.max(-1e4, (-79.794743) / (((s - -3.997718)) < 1e-4 && ((s - -3.997718)) > -1e-4 ? (((s - -3.997718)) >= 0 ? 1e-4 : -1e-4) : ((s - -3.997718))))) - Math.min(1e4, Math.max(-1e4, (-2.586911) / ((Math.max(-79.794743, (s - -3.930559))) < 1e-4 && (Math.max(-79.794743, (s - -3.930559))) > -1e-4 ? ((Math.max(-79.794743, (s - -3.930559))) >= 0 ? 1e-4 : -1e-4) : (Math.max(-79.794743, (s - -3.930559))))))))",
1334
- eval: ((s) => (Math.min(1e4, Math.max(-1e4, (-79.794743) / (((s - -3.997718)) < 1e-4 && ((s - -3.997718)) > -1e-4 ? (((s - -3.997718)) >= 0 ? 1e-4 : -1e-4) : ((s - -3.997718))))) - Math.min(1e4, Math.max(-1e4, (-2.586911) / ((Math.max(-79.794743, (s - -3.930559))) < 1e-4 && (Math.max(-79.794743, (s - -3.930559))) > -1e-4 ? ((Math.max(-79.794743, (s - -3.930559))) >= 0 ? 1e-4 : -1e-4) : (Math.max(-79.794743, (s - -3.930559)))))))),
1335
- c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (fminf(fmaxf((-79.794743f / copysignf(fmaxf(fabsf((s - -3.997718f)), 1.0e-4f), (s - -3.997718f))), -1.0e4f), 1.0e4f) - fminf(fmaxf((-2.586911f / copysignf(fmaxf(fabsf(fmaxf(-79.794743f, (s - -3.930559f))), 1.0e-4f), fmaxf(-79.794743f, (s - -3.930559f)))), -1.0e4f), 1.0e4f));\n}",
1336
- py: "import torch\n\ndef spear_fn(s):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((-79.794743 / (abs((s - -3.997718)) < 1e-4 ? 1e-4 : (s - -3.997718))) - (-2.586911 / (abs(torch.maximum(-79.794743, (s - -3.930559))) < 1e-4 ? 1e-4 : torch.maximum(-79.794743, (s - -3.930559)))))",
1337
- wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACp4BAZsBAERlbr4R3fJTwCAARFILJZNT+w/AoZlELUMc6+I2Gj+lIABEUgslk1P7D8ChpqNEAAAAAACIw8ClRAAAAAAAiMNApEQfTfVk/rEEwERlbr4R3fJTwCAARNv8v+rIcQ/AoaWZRC1DHOviNho/pURlbr4R3fJTwCAARNv8v+rIcQ/AoaWmo0QAAAAAAIjDwKVEAAAAAACIw0CkoQs=",
1347
+ js: "((s) => Math.min(1e4, Math.max(-1e4, (s) / (((2.92842 + Math.abs(s))) < 1e-4 && ((2.92842 + Math.abs(s))) > -1e-4 ? (((2.92842 + Math.abs(s))) >= 0 ? 1e-4 : -1e-4) : ((2.92842 + Math.abs(s)))))))",
1348
+ eval: ((s) => Math.min(1e4, Math.max(-1e4, (s) / (((2.92842 + Math.abs(s))) < 1e-4 && ((2.92842 + Math.abs(s))) > -1e-4 ? (((2.92842 + Math.abs(s))) >= 0 ? 1e-4 : -1e-4) : ((2.92842 + Math.abs(s))))))),
1349
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return fminf(fmaxf((s / copysignf(fmaxf(fabsf((2.92842f + fabsf(s))), 1.0e-4f), (2.92842f + fabsf(s)))), -1.0e4f), 1.0e4f);\n}",
1350
+ py: "import torch\n\ndef spear_fn(s):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (s / (abs((2.92842 + torch.abs(s))) < 1e-4 ? 1e-4 : (2.92842 + torch.abs(s))))",
1351
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACkEBPwAgAERangd3Z20HQCAAmaCZRC1DHOviNho/pURangd3Z20HQCAAmaCmo0QAAAAAAIjDwKVEAAAAAACIw0CkCw==",
1338
1352
  },
1339
1353
  meta: {
1340
1354
  metric: 6.947760597116317e-10,
@@ -1380,11 +1394,11 @@ const kernels = {
1380
1394
  wasmBase64: "AGFzbQEAAAABDAJgAnx8AXxgAXwBfAMCAQAHCQEFc3BlYXIAAApqAWgARCiSGoUP4IXAIAAgAaBEhA66hENvqT9EtU5cjtdAdUAgAKGhmUQtQxzr4jYaP6VEhA66hENvqT9EtU5cjtdAdUAgAKGhpqNEAAAAAACIw8ClRAAAAAAAiMNApKJEhErJw//fhUCgCw==",
1381
1395
  },
1382
1396
  fast: {
1383
- js: "((vs, vo) => (317.901286 + (vs + vo)))",
1384
- eval: ((vs, vo) => (317.901286 + (vs + vo))),
1385
- c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (317.901286f + (vs + vo));\n}",
1386
- py: "import torch\n\ndef spear_fn(vs, vo):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (317.901286 + (vs + vo))",
1387
- wasmBase64: "AGFzbQEAAAABDAJgAnx8AXxgAXwBfAMCAQAHCQEFc3BlYXIAAAoTAREARHxl3qpr3nNAIAAgAaCgCw==",
1397
+ js: "((vo, vs) => (vo + vs))",
1398
+ eval: ((vo, vs) => (vo + vs)),
1399
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (vo + vs);\n}",
1400
+ py: "import torch\n\ndef spear_fn(vo, vs):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (vo + vs)",
1401
+ wasmBase64: "AGFzbQEAAAABDAJgAnx8AXxgAXwBfAMCAQAHCQEFc3BlYXIAAAoJAQcAIAAgAaAL",
1388
1402
  },
1389
1403
  meta: {
1390
1404
  metric: 9.281797631143672e-10,
@@ -1479,6 +1493,13 @@ const kernels = {
1479
1493
  py: "import torch\n\ndef spear_fn(a, d, b, c):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (2 * torch.abs(((a * d) - (b * c))))",
1480
1494
  wasmBase64: "AGFzbQEAAAABDgJgBHx8fHwBfGABfAF8AwIBAAcJAQVzcGVhcgAAChoBGABEAAAAAAAAAEAgACABoiACIAOioZmiCw==",
1481
1495
  },
1496
+ fast: {
1497
+ js: "((a, d, b, c) => Math.abs(((a * d) - (b * c))))",
1498
+ eval: ((a, d, b, c) => Math.abs(((a * d) - (b * c)))),
1499
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return fabsf(((a * d) - (b * c)));\n}",
1500
+ py: "import torch\n\ndef spear_fn(a, d, b, c):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.abs(((a * d) - (b * c)))",
1501
+ wasmBase64: "AGFzbQEAAAABDgJgBHx8fHwBfGABfAF8AwIBAAcJAQVzcGVhcgAAChABDgAgACABoiACIAOioZkL",
1502
+ },
1482
1503
  meta: {
1483
1504
  metric: 0,
1484
1505
  level: 5,
@@ -1523,11 +1544,11 @@ const kernels = {
1523
1544
  wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACh0BGwBEAAAAAAAA+D8gACAAoqJEAAAAAAAA4L+gCw==",
1524
1545
  },
1525
1546
  fast: {
1526
- js: "((x) => (-0.774693 * (x) * (x)))",
1527
- eval: ((x) => (-0.774693 * (x) * (x))),
1528
- c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (-0.774693f * powf(x, 2.0f));\n}",
1529
- py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (-0.774693 * (x * x))",
1530
- wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAAChMBEQBEhxVu+UjK6L8gACAAoqIL",
1547
+ js: "((x) => (x) * (x))",
1548
+ eval: ((x) => (x) * (x)),
1549
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return powf(x, 2.0f);\n}",
1550
+ py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (x * x)",
1551
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACgkBBwAgACAAogs=",
1531
1552
  },
1532
1553
  meta: {
1533
1554
  metric: 3.250969746125654e-33,
@@ -1573,11 +1594,11 @@ const kernels = {
1573
1594
  wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgwBA2VudgRhc2luAAEDAgEABwkBBXNwZWFyAAEKHAEaACAARAAAAAAAAPC/pUQAAAAAAADwP6QQAAs=",
1574
1595
  },
1575
1596
  fast: {
1576
- js: "((x) => (0.529961 * ((1.930182 * x) + ((0.645691 * (x) * (x)) * (x) * (x) * (x)))))",
1577
- eval: ((x) => (0.529961 * ((1.930182 * x) + ((0.645691 * (x) * (x)) * (x) * (x) * (x))))),
1578
- c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (0.529961f * ((1.930182f * x) + ((0.645691f * powf(x, 2.0f)) * powf(x, 3.0f))));\n}",
1579
- py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (0.529961 * ((1.930182 * x) + ((0.645691 * (x * x)) * (x ** 3))))",
1580
- wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACjMBMQBEf/lkxXD14D9E9z5VhQbi/j8gAKJEBkoKLICp5D8gACAAoqIgACAAIACioqKgogs=",
1597
+ js: "((x) => ((-1.143333 * (Math.acos(Math.max(-1, Math.min(1, x))) + 1)) + 1.482365))",
1598
+ eval: ((x) => ((-1.143333 * (Math.acos(Math.max(-1, Math.min(1, x))) + 1)) + 1.482365)),
1599
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((-1.143333f * (acosf(fmaxf(-1.0f, fminf(1.0f, x))) + 1f)) + 1.482365f);\n}",
1600
+ py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((-1.143333 * (torch.acos(torch.clamp(x, -1.0, 1.0)) + 1)) + 1.482365)",
1601
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgwBA2VudgRhY29zAAEDAgEABwkBBXNwZWFyAAEKOgE4AERHADeLF0vyvyAARAAAAAAAAPC/pUQAAAAAAADwP6QQAEQAAAAAAADwP6CiRLnCu1zEt/c/oAs=",
1581
1602
  },
1582
1603
  meta: {
1583
1604
  metric: 0,
@@ -1673,11 +1694,11 @@ const kernels = {
1673
1694
  wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACl0BWwBE3+V6QIMSzr8gAERrZFdaRqoDwKBECmr4FtaN6T8gAKCZRC1DHOviNho/pUQKavgW1o3pPyAAoKajRAAAAAAAiMPApUQAAAAAAIjDQKSiRGqlYY85LNI/oAs=",
1674
1695
  },
1675
1696
  fast: {
1676
- js: "((x) => Math.min(1e4, Math.max(-1e4, (2.895344) / ((((x + (1.447672 + x)) * 0.661578)) < 1e-4 && (((x + (1.447672 + x)) * 0.661578)) > -1e-4 ? ((((x + (1.447672 + x)) * 0.661578)) >= 0 ? 1e-4 : -1e-4) : (((x + (1.447672 + x)) * 0.661578))))))",
1677
- eval: ((x) => Math.min(1e4, Math.max(-1e4, (2.895344) / ((((x + (1.447672 + x)) * 0.661578)) < 1e-4 && (((x + (1.447672 + x)) * 0.661578)) > -1e-4 ? ((((x + (1.447672 + x)) * 0.661578)) >= 0 ? 1e-4 : -1e-4) : (((x + (1.447672 + x)) * 0.661578)))))),
1678
- c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return fminf(fmaxf((2.895344f / copysignf(fmaxf(fabsf(((x + (1.447672f + x)) * 0.661578f)), 1.0e-4f), ((x + (1.447672f + x)) * 0.661578f))), -1.0e4f), 1.0e4f);\n}",
1679
- py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (2.895344 / (abs(((x + (1.447672 + x)) * 0.661578)) < 1e-4 ? 1e-4 : ((x + (1.447672 + x)) * 0.661578)))",
1680
- wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACmABXgBEzVt1HaopB0AgAETNW3Udqin3PyAAoKBETBk4oKUr5T+imUQtQxzr4jYaP6UgAETNW3Udqin3PyAAoKBETBk4oKUr5T+ipqNEAAAAAACIw8ClRAAAAAAAiMNApAs=",
1697
+ js: "((x) => Math.atan(x))",
1698
+ eval: ((x) => Math.atan(x)),
1699
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return atanf(x);\n}",
1700
+ py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.atan(x)",
1701
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgwBA2VudgRhdGFuAAEDAgEABwkBBXNwZWFyAAEKCAEGACAAEAAL",
1681
1702
  },
1682
1703
  meta: {
1683
1704
  metric: 0.00003054908318748102,
@@ -1756,8 +1777,233 @@ const kernels = {
1756
1777
  vsIterative: null,
1757
1778
  },
1758
1779
  },
1780
+ "fresnel_schlick": {
1781
+ id: "fresnel_schlick",
1782
+ precise: {
1783
+ js: "((x) => ((0.246318 * Math.min(1e4, Math.max(-1e4, (1.466496) / ((Math.min(0.743258, (0.248229 + x))) < 1e-4 && (Math.min(0.743258, (0.248229 + x))) > -1e-4 ? ((Math.min(0.743258, (0.248229 + x))) >= 0 ? 1e-4 : -1e-4) : (Math.min(0.743258, (0.248229 + x))))))) + -0.441372))",
1784
+ eval: ((x) => ((0.246318 * Math.min(1e4, Math.max(-1e4, (1.466496) / ((Math.min(0.743258, (0.248229 + x))) < 1e-4 && (Math.min(0.743258, (0.248229 + x))) > -1e-4 ? ((Math.min(0.743258, (0.248229 + x))) >= 0 ? 1e-4 : -1e-4) : (Math.min(0.743258, (0.248229 + x))))))) + -0.441372)),
1785
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((0.246318f * fminf(fmaxf((1.466496f / copysignf(fmaxf(fabsf(fminf(0.743258f, (0.248229f + x))), 1.0e-4f), fminf(0.743258f, (0.248229f + x)))), -1.0e4f), 1.0e4f)) + -0.441372f);\n}",
1786
+ py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((0.246318 * (1.466496 / (abs(torch.minimum(0.743258, (0.248229 + x))) < 1e-4 ? 1e-4 : torch.minimum(0.743258, (0.248229 + x))))) + -0.441372)",
1787
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACm4BbABEr0M1JVmHzz9E4297gsR29z9EGLFPAMXI5z9Et5p1xvfFzz8gAKCkmUQtQxzr4jYaP6VEGLFPAMXI5z9Et5p1xvfFzz8gAKCkpqNEAAAAAACIw8ClRAAAAAAAiMNApKJE6q9XWHA/3L+gCw==",
1788
+ },
1789
+ fast: {
1790
+ js: "((x) => Math.max(-2.48783, Math.min(1e4, Math.max(-1e4, (-0.19049) / ((Math.min(1.314335, (0.969024 + x))) < 1e-4 && (Math.min(1.314335, (0.969024 + x))) > -1e-4 ? ((Math.min(1.314335, (0.969024 + x))) >= 0 ? 1e-4 : -1e-4) : (Math.min(1.314335, (0.969024 + x))))))))",
1791
+ eval: ((x) => Math.max(-2.48783, Math.min(1e4, Math.max(-1e4, (-0.19049) / ((Math.min(1.314335, (0.969024 + x))) < 1e-4 && (Math.min(1.314335, (0.969024 + x))) > -1e-4 ? ((Math.min(1.314335, (0.969024 + x))) >= 0 ? 1e-4 : -1e-4) : (Math.min(1.314335, (0.969024 + x)))))))),
1792
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return fmaxf(-2.48783f, fminf(fmaxf((-0.19049f / copysignf(fmaxf(fabsf(fminf(1.314335f, (0.969024f + x))), 1.0e-4f), fminf(1.314335f, (0.969024f + x)))), -1.0e4f), 1.0e4f));\n}",
1793
+ py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.maximum(-2.48783, (-0.19049 / (abs(torch.minimum(1.314335, (0.969024 + x))) < 1e-4 ? 1e-4 : torch.minimum(1.314335, (0.969024 + x)))))",
1794
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACmQBYgBEuw9AahPnA8BEboYb8PlhyL9Egc8PI4QH9T9EV0Chnj4C7z8gAKCkmUQtQxzr4jYaP6VEgc8PI4QH9T9EV0Chnj4C7z8gAKCkpqNEAAAAAACIw8ClRAAAAAAAiMNApKUL",
1795
+ },
1796
+ meta: {
1797
+ metric: 0.00010330785959421003,
1798
+ level: 2,
1799
+ formulaCost: 8,
1800
+ exactCost: 12,
1801
+ speedupVsExact: 1.5,
1802
+ vsIterative: null,
1803
+ },
1804
+ },
1805
+ "rayleigh_phase": {
1806
+ id: "rayleigh_phase",
1807
+ precise: {
1808
+ js: "((x) => ((-0.024925 * Math.min(1e4, Math.max(-1e4, ((x + (-0.107884 * (x) * (x) * (x)))) / (((0.404362 + (0.0205 * (x) * (x)))) < 1e-4 && ((0.404362 + (0.0205 * (x) * (x)))) > -1e-4 ? (((0.404362 + (0.0205 * (x) * (x)))) >= 0 ? 1e-4 : -1e-4) : ((0.404362 + (0.0205 * (x) * (x)))))))) + 0.1287))",
1809
+ eval: ((x) => ((-0.024925 * Math.min(1e4, Math.max(-1e4, ((x + (-0.107884 * (x) * (x) * (x)))) / (((0.404362 + (0.0205 * (x) * (x)))) < 1e-4 && ((0.404362 + (0.0205 * (x) * (x)))) > -1e-4 ? (((0.404362 + (0.0205 * (x) * (x)))) >= 0 ? 1e-4 : -1e-4) : ((0.404362 + (0.0205 * (x) * (x)))))))) + 0.1287)),
1810
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((-0.024925f * fminf(fmaxf(((x + (-0.107884f * powf(x, 3.0f))) / copysignf(fmaxf(fabsf((0.404362f + (0.0205f * powf(x, 2.0f)))), 1.0e-4f), (0.404362f + (0.0205f * powf(x, 2.0f))))), -1.0e4f), 1.0e4f)) + 0.1287f);\n}",
1811
+ py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((-0.024925 * ((x + (-0.107884 * (x ** 3))) / (abs((0.404362 + (0.0205 * (x * x)))) < 1e-4 ? 1e-4 : (0.404362 + (0.0205 * (x * x)))))) + 0.1287)",
1812
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACoABAX4ARGdEaW/whZm/IABEafzCK0meu78gACAAIACioqKgRJKwbycR4dk/RMuhRbbz/ZQ/IAAgAKKioJlELUMc6+I2Gj+lRJKwbycR4dk/RMuhRbbz/ZQ/IAAgAKKioKajRAAAAAAAiMPApUQAAAAAAIjDQKSiRLdif9k9ecA/oAs=",
1813
+ },
1814
+ fast: {
1815
+ js: "(() => 0.021241)",
1816
+ eval: (() => 0.021241),
1817
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return 0.021241f;\n}",
1818
+ py: "import torch\n\ndef spear_fn():\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return 0.021241",
1819
+ wasmBase64: "AGFzbQEAAAABCgJgAAF8YAF8AXwDAgEABwkBBXNwZWFyAAAKDQELAEQtXFZhM8CVPws=",
1820
+ },
1821
+ meta: {
1822
+ metric: 0.000028726137982370476,
1823
+ level: 3,
1824
+ formulaCost: 13,
1825
+ exactCost: 5,
1826
+ speedupVsExact: 0.38461538461538464,
1827
+ vsIterative: null,
1828
+ },
1829
+ },
1830
+ "smootherstep": {
1831
+ id: "smootherstep",
1832
+ precise: {
1833
+ js: "((x) => ((1.593609 * Math.max(0.195325, Math.min(x, 0.805))) + -0.296433))",
1834
+ eval: ((x) => ((1.593609 * Math.max(0.195325, Math.min(x, 0.805))) + -0.296433)),
1835
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((1.593609f * fmaxf(0.195325f, fminf(x, 0.805f))) + -0.296433f);\n}",
1836
+ py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((1.593609 * torch.maximum(0.195325, torch.minimum(x, 0.805))) + -0.296433)",
1837
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACi4BLABEvceZJmx/+T9EcayL22gAyT8gAETD9Shcj8LpP6SlokR5IR0ewvjSv6AL",
1838
+ },
1839
+ fast: {
1840
+ js: "((x) => Math.min(1e4, Math.max(-1e4, (0.866475) / (((0.17378 + (x * (x) * (x)))) < 1e-4 && ((0.17378 + (x * (x) * (x)))) > -1e-4 ? (((0.17378 + (x * (x) * (x)))) >= 0 ? 1e-4 : -1e-4) : ((0.17378 + (x * (x) * (x))))))))",
1841
+ eval: ((x) => Math.min(1e4, Math.max(-1e4, (0.866475) / (((0.17378 + (x * (x) * (x)))) < 1e-4 && ((0.17378 + (x * (x) * (x)))) > -1e-4 ? (((0.17378 + (x * (x) * (x)))) >= 0 ? 1e-4 : -1e-4) : ((0.17378 + (x * (x) * (x)))))))),
1842
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return fminf(fmaxf((0.866475f / copysignf(fmaxf(fabsf((0.17378f + (x * powf(x, 2.0f)))), 1.0e-4f), (0.17378f + (x * powf(x, 2.0f))))), -1.0e4f), 1.0e4f);\n}",
1843
+ py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (0.866475 / (abs((0.17378 + (x * (x * x)))) < 1e-4 ? 1e-4 : (0.17378 + (x * (x * x)))))",
1844
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAAClIBUABEtaZ5xym66z9E5nRZTGw+xj8gACAAIACioqCZRC1DHOviNho/pUTmdFlMbD7GPyAAIAAgAKKioKajRAAAAAAAiMPApUQAAAAAAIjDQKQL",
1845
+ },
1846
+ meta: {
1847
+ metric: 0.00032318543387844427,
1848
+ level: 2,
1849
+ formulaCost: 4,
1850
+ exactCost: 9,
1851
+ speedupVsExact: 2.25,
1852
+ vsIterative: null,
1853
+ },
1854
+ },
1855
+ "fog_exp2": {
1856
+ id: "fog_exp2",
1857
+ precise: {
1858
+ js: "((x) => ((-0.1274940863656017 * ((-1.929961 * Math.min(1.668613, x)) + (-4.722092 * Math.min(1.135005, x)))) + -0.09650001036725882))",
1859
+ eval: ((x) => ((-0.1274940863656017 * ((-1.929961 * Math.min(1.668613, x)) + (-4.722092 * Math.min(1.135005, x)))) + -0.09650001036725882)),
1860
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((-0.127494f * ((-1.929961f * fminf(1.668613f, x)) + (-4.722092f * fminf(1.135005f, x)))) + -0.0965f);\n}",
1861
+ py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((-0.127494 * ((-1.929961 * torch.minimum(1.668613, x)) + (-4.722092 * torch.minimum(1.135005, x)))) + -0.0965)",
1862
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACkUBQwBEDdSv6blRwL9EJuMYyR7h/r9EHeOKi6Oy+j8gAKSiRBzQ0hVs4xLARGK+vAD7KPI/IACkoqCiRD1Ol4Q5tLi/oAs=",
1863
+ },
1864
+ fast: {
1865
+ js: "((x) => Math.min(x, 1.295335))",
1866
+ eval: ((x) => Math.min(x, 1.295335)),
1867
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return fminf(x, 1.295335f);\n}",
1868
+ py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.minimum(x, 1.295335)",
1869
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAAChABDgAgAESZ02Uxsbn0P6QL",
1870
+ },
1871
+ meta: {
1872
+ metric: 0.0003272787409612414,
1873
+ level: 2,
1874
+ formulaCost: 7,
1875
+ exactCost: 22,
1876
+ speedupVsExact: 3.142857142857143,
1877
+ vsIterative: null,
1878
+ },
1879
+ },
1880
+ "back_ease_out": {
1881
+ id: "back_ease_out",
1882
+ precise: {
1883
+ js: "((x) => ((7.763933157812422 * Math.min(1e4, Math.max(-1e4, (x) / ((((x + 1.821643) + (5.203625 * (x) * (x)))) < 1e-4 && (((x + 1.821643) + (5.203625 * (x) * (x)))) > -1e-4 ? ((((x + 1.821643) + (5.203625 * (x) * (x)))) >= 0 ? 1e-4 : -1e-4) : (((x + 1.821643) + (5.203625 * (x) * (x)))))))) + 0.011074755141712841))",
1884
+ eval: ((x) => ((7.763933157812422 * Math.min(1e4, Math.max(-1e4, (x) / ((((x + 1.821643) + (5.203625 * (x) * (x)))) < 1e-4 && (((x + 1.821643) + (5.203625 * (x) * (x)))) > -1e-4 ? ((((x + 1.821643) + (5.203625 * (x) * (x)))) >= 0 ? 1e-4 : -1e-4) : (((x + 1.821643) + (5.203625 * (x) * (x)))))))) + 0.011074755141712841)),
1885
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((7.763933f * fminf(fmaxf((x / copysignf(fmaxf(fabsf(((x + 1.821643f) + (5.203625f * powf(x, 2.0f)))), 1.0e-4f), ((x + 1.821643f) + (5.203625f * powf(x, 2.0f))))), -1.0e4f), 1.0e4f)) + 0.011075f);\n}",
1886
+ py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((7.763933 * (x / (abs(((x + 1.821643) + (5.203625 * (x * x)))) < 1e-4 ? 1e-4 : ((x + 1.821643) + (5.203625 * (x * x)))))) + 0.011075)",
1887
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACnMBcQBElolkfkQOH0AgACAARBjMXyFzJf0/oESNl24Sg9AUQCAAIACioqCZRC1DHOviNho/pSAARBjMXyFzJf0/oESNl24Sg9AUQCAAIACioqCmo0QAAAAAAIjDwKVEAAAAAACIw0CkokS4rih5XK6GP6AL",
1888
+ },
1889
+ fast: {
1890
+ js: "((x) => Math.min(1e4, Math.max(-1e4, (x) / ((((x + (x + 2.158024)) + (5.987814 * (x) * (x)))) < 1e-4 && (((x + (x + 2.158024)) + (5.987814 * (x) * (x)))) > -1e-4 ? ((((x + (x + 2.158024)) + (5.987814 * (x) * (x)))) >= 0 ? 1e-4 : -1e-4) : (((x + (x + 2.158024)) + (5.987814 * (x) * (x))))))))",
1891
+ eval: ((x) => Math.min(1e4, Math.max(-1e4, (x) / ((((x + (x + 2.158024)) + (5.987814 * (x) * (x)))) < 1e-4 && (((x + (x + 2.158024)) + (5.987814 * (x) * (x)))) > -1e-4 ? ((((x + (x + 2.158024)) + (5.987814 * (x) * (x)))) >= 0 ? 1e-4 : -1e-4) : (((x + (x + 2.158024)) + (5.987814 * (x) * (x)))))))),
1892
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return fminf(fmaxf((x / copysignf(fmaxf(fabsf(((x + (x + 2.158024f)) + (5.987814f * powf(x, 2.0f)))), 1.0e-4f), ((x + (x + 2.158024f)) + (5.987814f * powf(x, 2.0f))))), -1.0e4f), 1.0e4f);\n}",
1893
+ py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (x / (abs(((x + (x + 2.158024)) + (5.987814 * (x * x)))) < 1e-4 ? 1e-4 : ((x + (x + 2.158024)) + (5.987814 * (x * x)))))",
1894
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACmUBYwAgACAAIABEZt0/FqJDAUCgoESwH2KDhfMXQCAAIACioqCZRC1DHOviNho/pSAAIABEZt0/FqJDAUCgoESwH2KDhfMXQCAAIACioqCmo0QAAAAAAIjDwKVEAAAAAACIw0CkCw==",
1895
+ },
1896
+ meta: {
1897
+ metric: 0.00002740528761995583,
1898
+ level: 3,
1899
+ formulaCost: 10,
1900
+ exactCost: 11,
1901
+ speedupVsExact: 1.1,
1902
+ vsIterative: null,
1903
+ },
1904
+ },
1905
+ "light_falloff_punctual": {
1906
+ id: "light_falloff_punctual",
1907
+ precise: {
1908
+ js: "((x) => ((-1.950692846126142 * Math.min(1e4, Math.max(-1e4, (Math.min(1e4, Math.max(-1e4, (3.068119) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x))))) / (((-0.092287 + Math.min(4.058391, (x * -5.800075)))) < 1e-4 && ((-0.092287 + Math.min(4.058391, (x * -5.800075)))) > -1e-4 ? (((-0.092287 + Math.min(4.058391, (x * -5.800075)))) >= 0 ? 1e-4 : -1e-4) : ((-0.092287 + Math.min(4.058391, (x * -5.800075)))))))) + -0.012507849918452899))",
1909
+ eval: ((x) => ((-1.950692846126142 * Math.min(1e4, Math.max(-1e4, (Math.min(1e4, Math.max(-1e4, (3.068119) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x))))) / (((-0.092287 + Math.min(4.058391, (x * -5.800075)))) < 1e-4 && ((-0.092287 + Math.min(4.058391, (x * -5.800075)))) > -1e-4 ? (((-0.092287 + Math.min(4.058391, (x * -5.800075)))) >= 0 ? 1e-4 : -1e-4) : ((-0.092287 + Math.min(4.058391, (x * -5.800075)))))))) + -0.012507849918452899)),
1910
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((-1.950693f * fminf(fmaxf((fminf(fmaxf((3.068119f / copysignf(fmaxf(fabsf(x), 1.0e-4f), x)), -1.0e4f), 1.0e4f) / copysignf(fmaxf(fabsf((-0.092287f + fminf(4.058391f, (x * -5.800075f)))), 1.0e-4f), (-0.092287f + fminf(4.058391f, (x * -5.800075f))))), -1.0e4f), 1.0e4f)) + -0.012508f);\n}",
1911
+ py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((-1.950693 * ((3.068119 / (abs(x) < 1e-4 ? 1e-4 : x)) / (abs((-0.092287 + torch.minimum(4.058391, (x * -5.800075)))) < 1e-4 ? 1e-4 : (-0.092287 + torch.minimum(4.058391, (x * -5.800075)))))) + -0.012508)",
1912
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACqgBAaUBAERxcqqzCTb/v0TJ42n5gYsIQCAAmUQtQxzr4jYaP6UgAKajRAAAAAAAiMPApUQAAAAAAIjDQKRET5DY7h6gt79E4IWt2co7EEAgAESIY13cRjMXwKKkoJlELUMc6+I2Gj+lRE+Q2O4eoLe/ROCFrdnKOxBAIABEiGNd3EYzF8CipKCmo0QAAAAAAIjDwKVEAAAAAACIw0CkokRIh74yt52Jv6AL",
1913
+ },
1914
+ fast: {
1915
+ js: "((x) => Math.tanh(x))",
1916
+ eval: ((x) => Math.tanh(x)),
1917
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return tanhf(x);\n}",
1918
+ py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.tanh(x)",
1919
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgwBA2VudgR0YW5oAAEDAgEABwkBBXNwZWFyAAEKCAEGACAAEAAL",
1920
+ },
1921
+ meta: {
1922
+ metric: 0.000013132168838441087,
1923
+ level: 2,
1924
+ formulaCost: 13,
1925
+ exactCost: 20,
1926
+ speedupVsExact: 1.5384615384615385,
1927
+ vsIterative: null,
1928
+ },
1929
+ },
1930
+ "bias_slope": {
1931
+ id: "bias_slope",
1932
+ precise: {
1933
+ js: "((x) => Math.min(1e4, Math.max(-1e4, (Math.sqrt(Math.abs((1 - (x) * (x))))) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))))",
1934
+ eval: ((x) => Math.min(1e4, Math.max(-1e4, (Math.sqrt(Math.abs((1 - (x) * (x))))) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x))))),
1935
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return fminf(fmaxf((sqrtf(fabsf((1f - powf(x, 2.0f)))) / copysignf(fmaxf(fabsf(x), 1.0e-4f), x)), -1.0e4f), 1.0e4f);\n}",
1936
+ 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((1 - (x * x)))) / (abs(x) < 1e-4 ? 1e-4 : x))",
1937
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACjoBOABEAAAAAAAA8D8gACAAoqGZnyAAmUQtQxzr4jYaP6UgAKajRAAAAAAAiMPApUQAAAAAAIjDQKQL",
1938
+ },
1939
+ fast: {
1940
+ js: "((x) => Math.min(1e4, Math.max(-1e4, (Math.sqrt(Math.abs((1 - (x) * (x))))) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))))",
1941
+ eval: ((x) => Math.min(1e4, Math.max(-1e4, (Math.sqrt(Math.abs((1 - (x) * (x))))) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x))))),
1942
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return fminf(fmaxf((sqrtf(fabsf((1f - powf(x, 2.0f)))) / copysignf(fmaxf(fabsf(x), 1.0e-4f), x)), -1.0e4f), 1.0e4f);\n}",
1943
+ 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((1 - (x * x)))) / (abs(x) < 1e-4 ? 1e-4 : x))",
1944
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACjoBOABEAAAAAAAA8D8gACAAoqGZnyAAmUQtQxzr4jYaP6UgAKajRAAAAAAAiMPApUQAAAAAAIjDQKQL",
1945
+ },
1946
+ meta: {
1947
+ metric: 0,
1948
+ level: 5,
1949
+ formulaCost: 8,
1950
+ exactCost: 8,
1951
+ speedupVsExact: 1,
1952
+ vsIterative: null,
1953
+ },
1954
+ },
1955
+ "uncharted2_tonemap": {
1956
+ id: "uncharted2_tonemap",
1957
+ precise: {
1958
+ js: "((x) => ((0.37542164283885915 * Math.min(1e4, Math.max(-1e4, ((3.432475 * x)) / (((x + 1.607412)) < 1e-4 && ((x + 1.607412)) > -1e-4 ? (((x + 1.607412)) >= 0 ? 1e-4 : -1e-4) : ((x + 1.607412)))))) + -0.0012480885611314818))",
1959
+ eval: ((x) => ((0.37542164283885915 * Math.min(1e4, Math.max(-1e4, ((3.432475 * x)) / (((x + 1.607412)) < 1e-4 && ((x + 1.607412)) > -1e-4 ? (((x + 1.607412)) >= 0 ? 1e-4 : -1e-4) : ((x + 1.607412)))))) + -0.0012480885611314818)),
1960
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((0.375422f * fminf(fmaxf(((3.432475f * x) / copysignf(fmaxf(fabsf((x + 1.607412f)), 1.0e-4f), (x + 1.607412f))), -1.0e4f), 1.0e4f)) + -0.001248f);\n}",
1961
+ py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((0.375422 * ((3.432475 * x) / (abs((x + 1.607412)) < 1e-4 ? 1e-4 : (x + 1.607412)))) + -0.001248)",
1962
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACl0BWwBEBgaNf+gG2D9EaLPqc7V1C0AgAKIgAETQKjOl9bf5P6CZRC1DHOviNho/pSAARNAqM6X1t/k/oKajRAAAAAAAiMPApUQAAAAAAIjDQKSiRHtUXePcclS/oAs=",
1963
+ },
1964
+ fast: {
1965
+ js: "((x) => (Math.atan(x)) * (Math.atan(x)))",
1966
+ eval: ((x) => (Math.atan(x)) * (Math.atan(x))),
1967
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return powf(atanf(x), 2.0f);\n}",
1968
+ py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (torch.atan(x) * torch.atan(x))",
1969
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgwBA2VudgRhdGFuAAEDAgEABwkBBXNwZWFyAAEKDQELACAAEAAgABAAogs=",
1970
+ },
1971
+ meta: {
1972
+ metric: 9.35135840763872e-9,
1973
+ level: 2,
1974
+ formulaCost: 8,
1975
+ exactCost: 26,
1976
+ speedupVsExact: 3.25,
1977
+ vsIterative: null,
1978
+ },
1979
+ },
1980
+ "mish": {
1981
+ id: "mish",
1982
+ precise: {
1983
+ js: "((x) => (x * Math.tanh(Math.log(Math.max(1e-30, (1 + Math.exp(Math.max(-50, Math.min(50, x)))))))))",
1984
+ eval: ((x) => (x * Math.tanh(Math.log(Math.max(1e-30, (1 + Math.exp(Math.max(-50, Math.min(50, x))))))))),
1985
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (x * tanhf(logf(fmaxf(1.0e-30f, (1f + expf(fmaxf(-50.0f, fminf(50.0f, x))))))));\n}",
1986
+ py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (x * torch.tanh(torch.log(torch.clamp((1 + torch.exp(torch.clamp(x, -50.0, 50.0))), min=1e-30))))",
1987
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AiADA2VudgNleHAAAQNlbnYDbG9nAAEDZW52BHRhbmgAAQMCAQAHCQEFc3BlYXIAAwo3ATUAIABEAAAAAAAA8D8gAEQAAAAAAABJwKVEAAAAAAAASUCkEACgRKDC6/5LSLQ5pRABEAKiCw==",
1988
+ },
1989
+ fast: {
1990
+ js: "((x) => Math.max(0, x))",
1991
+ eval: ((x) => Math.max(0, x)),
1992
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return fmaxf(0.0f, x);\n}",
1993
+ py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.relu(x)",
1994
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAAChABDgAgAEQAAAAAAAAAAKUL",
1995
+ },
1996
+ meta: {
1997
+ metric: 0,
1998
+ level: 5,
1999
+ formulaCost: 5,
2000
+ exactCost: 62,
2001
+ speedupVsExact: 12.4,
2002
+ vsIterative: null,
2003
+ },
2004
+ },
1759
2005
  };
1760
2006
 
1761
- 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"];
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"];
1762
2008
 
1763
2009
  module.exports = { kernels, kernelIds, default: kernels };