spear-kernels 1.5.0 → 1.6.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 +201 -1
  2. package/index.js +201 -1
  3. package/package.json +1 -1
package/index.cjs CHANGED
@@ -1756,8 +1756,208 @@ const kernels = {
1756
1756
  vsIterative: null,
1757
1757
  },
1758
1758
  },
1759
+ "fresnel_schlick": {
1760
+ id: "fresnel_schlick",
1761
+ precise: {
1762
+ 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))",
1763
+ 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)),
1764
+ 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}",
1765
+ 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)",
1766
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACm4BbABEr0M1JVmHzz9E4297gsR29z9EGLFPAMXI5z9Et5p1xvfFzz8gAKCkmUQtQxzr4jYaP6VEGLFPAMXI5z9Et5p1xvfFzz8gAKCkpqNEAAAAAACIw8ClRAAAAAAAiMNApKJE6q9XWHA/3L+gCw==",
1767
+ },
1768
+ fast: {
1769
+ 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))))))))",
1770
+ 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)))))))),
1771
+ 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}",
1772
+ 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)))))",
1773
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACmQBYgBEuw9AahPnA8BEboYb8PlhyL9Egc8PI4QH9T9EV0Chnj4C7z8gAKCkmUQtQxzr4jYaP6VEgc8PI4QH9T9EV0Chnj4C7z8gAKCkpqNEAAAAAACIw8ClRAAAAAAAiMNApKUL",
1774
+ },
1775
+ meta: {
1776
+ metric: 0.00010330785959421003,
1777
+ level: 2,
1778
+ formulaCost: 8,
1779
+ exactCost: 12,
1780
+ speedupVsExact: 1.5,
1781
+ vsIterative: null,
1782
+ },
1783
+ },
1784
+ "rayleigh_phase": {
1785
+ id: "rayleigh_phase",
1786
+ precise: {
1787
+ 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))",
1788
+ 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)),
1789
+ 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}",
1790
+ 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)",
1791
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACoABAX4ARGdEaW/whZm/IABEafzCK0meu78gACAAIACioqKgRJKwbycR4dk/RMuhRbbz/ZQ/IAAgAKKioJlELUMc6+I2Gj+lRJKwbycR4dk/RMuhRbbz/ZQ/IAAgAKKioKajRAAAAAAAiMPApUQAAAAAAIjDQKSiRLdif9k9ecA/oAs=",
1792
+ },
1793
+ fast: {
1794
+ js: "(() => 0.021241)",
1795
+ eval: (() => 0.021241),
1796
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return 0.021241f;\n}",
1797
+ py: "import torch\n\ndef spear_fn():\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return 0.021241",
1798
+ wasmBase64: "AGFzbQEAAAABCgJgAAF8YAF8AXwDAgEABwkBBXNwZWFyAAAKDQELAEQtXFZhM8CVPws=",
1799
+ },
1800
+ meta: {
1801
+ metric: 0.000028726137982370476,
1802
+ level: 3,
1803
+ formulaCost: 13,
1804
+ exactCost: 5,
1805
+ speedupVsExact: 0.38461538461538464,
1806
+ vsIterative: null,
1807
+ },
1808
+ },
1809
+ "smootherstep": {
1810
+ id: "smootherstep",
1811
+ precise: {
1812
+ js: "((x) => ((1.593609 * Math.max(0.195325, Math.min(x, 0.805))) + -0.296433))",
1813
+ eval: ((x) => ((1.593609 * Math.max(0.195325, Math.min(x, 0.805))) + -0.296433)),
1814
+ 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}",
1815
+ 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)",
1816
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACi4BLABEvceZJmx/+T9EcayL22gAyT8gAETD9Shcj8LpP6SlokR5IR0ewvjSv6AL",
1817
+ },
1818
+ fast: {
1819
+ 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))))))))",
1820
+ 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)))))))),
1821
+ 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}",
1822
+ 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)))))",
1823
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAAClIBUABEtaZ5xym66z9E5nRZTGw+xj8gACAAIACioqCZRC1DHOviNho/pUTmdFlMbD7GPyAAIAAgAKKioKajRAAAAAAAiMPApUQAAAAAAIjDQKQL",
1824
+ },
1825
+ meta: {
1826
+ metric: 0.00032318543387844427,
1827
+ level: 2,
1828
+ formulaCost: 4,
1829
+ exactCost: 9,
1830
+ speedupVsExact: 2.25,
1831
+ vsIterative: null,
1832
+ },
1833
+ },
1834
+ "fog_exp2": {
1835
+ id: "fog_exp2",
1836
+ precise: {
1837
+ js: "((x) => ((-0.1274940863656017 * ((-1.929961 * Math.min(1.668613, x)) + (-4.722092 * Math.min(1.135005, x)))) + -0.09650001036725882))",
1838
+ eval: ((x) => ((-0.1274940863656017 * ((-1.929961 * Math.min(1.668613, x)) + (-4.722092 * Math.min(1.135005, x)))) + -0.09650001036725882)),
1839
+ 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}",
1840
+ 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)",
1841
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACkUBQwBEDdSv6blRwL9EJuMYyR7h/r9EHeOKi6Oy+j8gAKSiRBzQ0hVs4xLARGK+vAD7KPI/IACkoqCiRD1Ol4Q5tLi/oAs=",
1842
+ },
1843
+ fast: {
1844
+ js: "((x) => Math.min(x, 1.295335))",
1845
+ eval: ((x) => Math.min(x, 1.295335)),
1846
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return fminf(x, 1.295335f);\n}",
1847
+ 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)",
1848
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAAChABDgAgAESZ02Uxsbn0P6QL",
1849
+ },
1850
+ meta: {
1851
+ metric: 0.0003272787409612414,
1852
+ level: 2,
1853
+ formulaCost: 7,
1854
+ exactCost: 22,
1855
+ speedupVsExact: 3.142857142857143,
1856
+ vsIterative: null,
1857
+ },
1858
+ },
1859
+ "back_ease_out": {
1860
+ id: "back_ease_out",
1861
+ precise: {
1862
+ 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))",
1863
+ 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)),
1864
+ 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}",
1865
+ 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)",
1866
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACnMBcQBElolkfkQOH0AgACAARBjMXyFzJf0/oESNl24Sg9AUQCAAIACioqCZRC1DHOviNho/pSAARBjMXyFzJf0/oESNl24Sg9AUQCAAIACioqCmo0QAAAAAAIjDwKVEAAAAAACIw0CkokS4rih5XK6GP6AL",
1867
+ },
1868
+ fast: {
1869
+ 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))))))))",
1870
+ 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)))))))),
1871
+ 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}",
1872
+ 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)))))",
1873
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACmUBYwAgACAAIABEZt0/FqJDAUCgoESwH2KDhfMXQCAAIACioqCZRC1DHOviNho/pSAAIABEZt0/FqJDAUCgoESwH2KDhfMXQCAAIACioqCmo0QAAAAAAIjDwKVEAAAAAACIw0CkCw==",
1874
+ },
1875
+ meta: {
1876
+ metric: 0.00002740528761995583,
1877
+ level: 3,
1878
+ formulaCost: 10,
1879
+ exactCost: 11,
1880
+ speedupVsExact: 1.1,
1881
+ vsIterative: null,
1882
+ },
1883
+ },
1884
+ "light_falloff_punctual": {
1885
+ id: "light_falloff_punctual",
1886
+ precise: {
1887
+ 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))",
1888
+ 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)),
1889
+ 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}",
1890
+ 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)",
1891
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACqgBAaUBAERxcqqzCTb/v0TJ42n5gYsIQCAAmUQtQxzr4jYaP6UgAKajRAAAAAAAiMPApUQAAAAAAIjDQKRET5DY7h6gt79E4IWt2co7EEAgAESIY13cRjMXwKKkoJlELUMc6+I2Gj+lRE+Q2O4eoLe/ROCFrdnKOxBAIABEiGNd3EYzF8CipKCmo0QAAAAAAIjDwKVEAAAAAACIw0CkokRIh74yt52Jv6AL",
1892
+ },
1893
+ fast: {
1894
+ js: "((x) => (Math.min(1e4, Math.max(-1e4, (1.449627) / (((x) * (x)) < 1e-4 && ((x) * (x)) > -1e-4 ? (((x) * (x)) >= 0 ? 1e-4 : -1e-4) : ((x) * (x))))) * 0.237626))",
1895
+ eval: ((x) => (Math.min(1e4, Math.max(-1e4, (1.449627) / (((x) * (x)) < 1e-4 && ((x) * (x)) > -1e-4 ? (((x) * (x)) >= 0 ? 1e-4 : -1e-4) : ((x) * (x))))) * 0.237626)),
1896
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (fminf(fmaxf((1.449627f / copysignf(fmaxf(fabsf(powf(x, 2.0f)), 1.0e-4f), powf(x, 2.0f))), -1.0e4f), 1.0e4f) * 0.237626f);\n}",
1897
+ py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((1.449627 / (abs((x * x)) < 1e-4 ? 1e-4 : (x * x))) * 0.237626)",
1898
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACkIBQABEomDGFKwx9z8gACAAoplELUMc6+I2Gj+lIAAgAKKmo0QAAAAAAIjDwKVEAAAAAACIw0CkRCzzVl2Has4/ogs=",
1899
+ },
1900
+ meta: {
1901
+ metric: 0.000013132168838441087,
1902
+ level: 2,
1903
+ formulaCost: 13,
1904
+ exactCost: 20,
1905
+ speedupVsExact: 1.5384615384615385,
1906
+ vsIterative: null,
1907
+ },
1908
+ },
1909
+ "bias_slope": {
1910
+ id: "bias_slope",
1911
+ precise: {
1912
+ 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)))))",
1913
+ 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))))),
1914
+ 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}",
1915
+ 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))",
1916
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACjoBOABEAAAAAAAA8D8gACAAoqGZnyAAmUQtQxzr4jYaP6UgAKajRAAAAAAAiMPApUQAAAAAAIjDQKQL",
1917
+ },
1918
+ fast: {
1919
+ 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)))))",
1920
+ 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))))),
1921
+ 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}",
1922
+ 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))",
1923
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACjoBOABEAAAAAAAA8D8gACAAoqGZnyAAmUQtQxzr4jYaP6UgAKajRAAAAAAAiMPApUQAAAAAAIjDQKQL",
1924
+ },
1925
+ meta: {
1926
+ metric: 0,
1927
+ level: 5,
1928
+ formulaCost: 8,
1929
+ exactCost: 8,
1930
+ speedupVsExact: 1,
1931
+ vsIterative: null,
1932
+ },
1933
+ },
1934
+ "uncharted2_tonemap": {
1935
+ id: "uncharted2_tonemap",
1936
+ precise: {
1937
+ 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))",
1938
+ 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)),
1939
+ 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}",
1940
+ 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)",
1941
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACl0BWwBEBgaNf+gG2D9EaLPqc7V1C0AgAKIgAETQKjOl9bf5P6CZRC1DHOviNho/pSAARNAqM6X1t/k/oKajRAAAAAAAiMPApUQAAAAAAIjDQKSiRHtUXePcclS/oAs=",
1942
+ },
1943
+ fast: {
1944
+ js: "((x) => Math.min(1e4, Math.max(-1e4, (x) / (((x + 1.032428)) < 1e-4 && ((x + 1.032428)) > -1e-4 ? (((x + 1.032428)) >= 0 ? 1e-4 : -1e-4) : ((x + 1.032428))))))",
1945
+ eval: ((x) => Math.min(1e4, Math.max(-1e4, (x) / (((x + 1.032428)) < 1e-4 && ((x + 1.032428)) > -1e-4 ? (((x + 1.032428)) >= 0 ? 1e-4 : -1e-4) : ((x + 1.032428)))))),
1946
+ 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 + 1.032428f)), 1.0e-4f), (x + 1.032428f))), -1.0e4f), 1.0e4f);\n}",
1947
+ py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (x / (abs((x + 1.032428)) < 1e-4 ? 1e-4 : (x + 1.032428)))",
1948
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACj8BPQAgACAARFKY9zjThPA/oJlELUMc6+I2Gj+lIABEUpj3ONOE8D+gpqNEAAAAAACIw8ClRAAAAAAAiMNApAs=",
1949
+ },
1950
+ meta: {
1951
+ metric: 9.35135840763872e-9,
1952
+ level: 2,
1953
+ formulaCost: 8,
1954
+ exactCost: 26,
1955
+ speedupVsExact: 3.25,
1956
+ vsIterative: null,
1957
+ },
1958
+ },
1759
1959
  };
1760
1960
 
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"];
1961
+ 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"];
1762
1962
 
1763
1963
  module.exports = { kernels, kernelIds, default: kernels };
package/index.js CHANGED
@@ -1756,8 +1756,208 @@ export const kernels = {
1756
1756
  vsIterative: null,
1757
1757
  },
1758
1758
  },
1759
+ "fresnel_schlick": {
1760
+ id: "fresnel_schlick",
1761
+ precise: {
1762
+ 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))",
1763
+ 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)),
1764
+ 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}",
1765
+ 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)",
1766
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACm4BbABEr0M1JVmHzz9E4297gsR29z9EGLFPAMXI5z9Et5p1xvfFzz8gAKCkmUQtQxzr4jYaP6VEGLFPAMXI5z9Et5p1xvfFzz8gAKCkpqNEAAAAAACIw8ClRAAAAAAAiMNApKJE6q9XWHA/3L+gCw==",
1767
+ },
1768
+ fast: {
1769
+ 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))))))))",
1770
+ 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)))))))),
1771
+ 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}",
1772
+ 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)))))",
1773
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACmQBYgBEuw9AahPnA8BEboYb8PlhyL9Egc8PI4QH9T9EV0Chnj4C7z8gAKCkmUQtQxzr4jYaP6VEgc8PI4QH9T9EV0Chnj4C7z8gAKCkpqNEAAAAAACIw8ClRAAAAAAAiMNApKUL",
1774
+ },
1775
+ meta: {
1776
+ metric: 0.00010330785959421003,
1777
+ level: 2,
1778
+ formulaCost: 8,
1779
+ exactCost: 12,
1780
+ speedupVsExact: 1.5,
1781
+ vsIterative: null,
1782
+ },
1783
+ },
1784
+ "rayleigh_phase": {
1785
+ id: "rayleigh_phase",
1786
+ precise: {
1787
+ 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))",
1788
+ 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)),
1789
+ 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}",
1790
+ 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)",
1791
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACoABAX4ARGdEaW/whZm/IABEafzCK0meu78gACAAIACioqKgRJKwbycR4dk/RMuhRbbz/ZQ/IAAgAKKioJlELUMc6+I2Gj+lRJKwbycR4dk/RMuhRbbz/ZQ/IAAgAKKioKajRAAAAAAAiMPApUQAAAAAAIjDQKSiRLdif9k9ecA/oAs=",
1792
+ },
1793
+ fast: {
1794
+ js: "(() => 0.021241)",
1795
+ eval: (() => 0.021241),
1796
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return 0.021241f;\n}",
1797
+ py: "import torch\n\ndef spear_fn():\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return 0.021241",
1798
+ wasmBase64: "AGFzbQEAAAABCgJgAAF8YAF8AXwDAgEABwkBBXNwZWFyAAAKDQELAEQtXFZhM8CVPws=",
1799
+ },
1800
+ meta: {
1801
+ metric: 0.000028726137982370476,
1802
+ level: 3,
1803
+ formulaCost: 13,
1804
+ exactCost: 5,
1805
+ speedupVsExact: 0.38461538461538464,
1806
+ vsIterative: null,
1807
+ },
1808
+ },
1809
+ "smootherstep": {
1810
+ id: "smootherstep",
1811
+ precise: {
1812
+ js: "((x) => ((1.593609 * Math.max(0.195325, Math.min(x, 0.805))) + -0.296433))",
1813
+ eval: ((x) => ((1.593609 * Math.max(0.195325, Math.min(x, 0.805))) + -0.296433)),
1814
+ 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}",
1815
+ 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)",
1816
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACi4BLABEvceZJmx/+T9EcayL22gAyT8gAETD9Shcj8LpP6SlokR5IR0ewvjSv6AL",
1817
+ },
1818
+ fast: {
1819
+ 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))))))))",
1820
+ 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)))))))),
1821
+ 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}",
1822
+ 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)))))",
1823
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAAClIBUABEtaZ5xym66z9E5nRZTGw+xj8gACAAIACioqCZRC1DHOviNho/pUTmdFlMbD7GPyAAIAAgAKKioKajRAAAAAAAiMPApUQAAAAAAIjDQKQL",
1824
+ },
1825
+ meta: {
1826
+ metric: 0.00032318543387844427,
1827
+ level: 2,
1828
+ formulaCost: 4,
1829
+ exactCost: 9,
1830
+ speedupVsExact: 2.25,
1831
+ vsIterative: null,
1832
+ },
1833
+ },
1834
+ "fog_exp2": {
1835
+ id: "fog_exp2",
1836
+ precise: {
1837
+ js: "((x) => ((-0.1274940863656017 * ((-1.929961 * Math.min(1.668613, x)) + (-4.722092 * Math.min(1.135005, x)))) + -0.09650001036725882))",
1838
+ eval: ((x) => ((-0.1274940863656017 * ((-1.929961 * Math.min(1.668613, x)) + (-4.722092 * Math.min(1.135005, x)))) + -0.09650001036725882)),
1839
+ 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}",
1840
+ 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)",
1841
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACkUBQwBEDdSv6blRwL9EJuMYyR7h/r9EHeOKi6Oy+j8gAKSiRBzQ0hVs4xLARGK+vAD7KPI/IACkoqCiRD1Ol4Q5tLi/oAs=",
1842
+ },
1843
+ fast: {
1844
+ js: "((x) => Math.min(x, 1.295335))",
1845
+ eval: ((x) => Math.min(x, 1.295335)),
1846
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return fminf(x, 1.295335f);\n}",
1847
+ 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)",
1848
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAAChABDgAgAESZ02Uxsbn0P6QL",
1849
+ },
1850
+ meta: {
1851
+ metric: 0.0003272787409612414,
1852
+ level: 2,
1853
+ formulaCost: 7,
1854
+ exactCost: 22,
1855
+ speedupVsExact: 3.142857142857143,
1856
+ vsIterative: null,
1857
+ },
1858
+ },
1859
+ "back_ease_out": {
1860
+ id: "back_ease_out",
1861
+ precise: {
1862
+ 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))",
1863
+ 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)),
1864
+ 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}",
1865
+ 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)",
1866
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACnMBcQBElolkfkQOH0AgACAARBjMXyFzJf0/oESNl24Sg9AUQCAAIACioqCZRC1DHOviNho/pSAARBjMXyFzJf0/oESNl24Sg9AUQCAAIACioqCmo0QAAAAAAIjDwKVEAAAAAACIw0CkokS4rih5XK6GP6AL",
1867
+ },
1868
+ fast: {
1869
+ 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))))))))",
1870
+ 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)))))))),
1871
+ 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}",
1872
+ 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)))))",
1873
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACmUBYwAgACAAIABEZt0/FqJDAUCgoESwH2KDhfMXQCAAIACioqCZRC1DHOviNho/pSAAIABEZt0/FqJDAUCgoESwH2KDhfMXQCAAIACioqCmo0QAAAAAAIjDwKVEAAAAAACIw0CkCw==",
1874
+ },
1875
+ meta: {
1876
+ metric: 0.00002740528761995583,
1877
+ level: 3,
1878
+ formulaCost: 10,
1879
+ exactCost: 11,
1880
+ speedupVsExact: 1.1,
1881
+ vsIterative: null,
1882
+ },
1883
+ },
1884
+ "light_falloff_punctual": {
1885
+ id: "light_falloff_punctual",
1886
+ precise: {
1887
+ 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))",
1888
+ 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)),
1889
+ 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}",
1890
+ 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)",
1891
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACqgBAaUBAERxcqqzCTb/v0TJ42n5gYsIQCAAmUQtQxzr4jYaP6UgAKajRAAAAAAAiMPApUQAAAAAAIjDQKRET5DY7h6gt79E4IWt2co7EEAgAESIY13cRjMXwKKkoJlELUMc6+I2Gj+lRE+Q2O4eoLe/ROCFrdnKOxBAIABEiGNd3EYzF8CipKCmo0QAAAAAAIjDwKVEAAAAAACIw0CkokRIh74yt52Jv6AL",
1892
+ },
1893
+ fast: {
1894
+ js: "((x) => (Math.min(1e4, Math.max(-1e4, (1.449627) / (((x) * (x)) < 1e-4 && ((x) * (x)) > -1e-4 ? (((x) * (x)) >= 0 ? 1e-4 : -1e-4) : ((x) * (x))))) * 0.237626))",
1895
+ eval: ((x) => (Math.min(1e4, Math.max(-1e4, (1.449627) / (((x) * (x)) < 1e-4 && ((x) * (x)) > -1e-4 ? (((x) * (x)) >= 0 ? 1e-4 : -1e-4) : ((x) * (x))))) * 0.237626)),
1896
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (fminf(fmaxf((1.449627f / copysignf(fmaxf(fabsf(powf(x, 2.0f)), 1.0e-4f), powf(x, 2.0f))), -1.0e4f), 1.0e4f) * 0.237626f);\n}",
1897
+ py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((1.449627 / (abs((x * x)) < 1e-4 ? 1e-4 : (x * x))) * 0.237626)",
1898
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACkIBQABEomDGFKwx9z8gACAAoplELUMc6+I2Gj+lIAAgAKKmo0QAAAAAAIjDwKVEAAAAAACIw0CkRCzzVl2Has4/ogs=",
1899
+ },
1900
+ meta: {
1901
+ metric: 0.000013132168838441087,
1902
+ level: 2,
1903
+ formulaCost: 13,
1904
+ exactCost: 20,
1905
+ speedupVsExact: 1.5384615384615385,
1906
+ vsIterative: null,
1907
+ },
1908
+ },
1909
+ "bias_slope": {
1910
+ id: "bias_slope",
1911
+ precise: {
1912
+ 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)))))",
1913
+ 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))))),
1914
+ 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}",
1915
+ 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))",
1916
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACjoBOABEAAAAAAAA8D8gACAAoqGZnyAAmUQtQxzr4jYaP6UgAKajRAAAAAAAiMPApUQAAAAAAIjDQKQL",
1917
+ },
1918
+ fast: {
1919
+ 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)))))",
1920
+ 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))))),
1921
+ 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}",
1922
+ 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))",
1923
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACjoBOABEAAAAAAAA8D8gACAAoqGZnyAAmUQtQxzr4jYaP6UgAKajRAAAAAAAiMPApUQAAAAAAIjDQKQL",
1924
+ },
1925
+ meta: {
1926
+ metric: 0,
1927
+ level: 5,
1928
+ formulaCost: 8,
1929
+ exactCost: 8,
1930
+ speedupVsExact: 1,
1931
+ vsIterative: null,
1932
+ },
1933
+ },
1934
+ "uncharted2_tonemap": {
1935
+ id: "uncharted2_tonemap",
1936
+ precise: {
1937
+ 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))",
1938
+ 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)),
1939
+ 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}",
1940
+ 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)",
1941
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACl0BWwBEBgaNf+gG2D9EaLPqc7V1C0AgAKIgAETQKjOl9bf5P6CZRC1DHOviNho/pSAARNAqM6X1t/k/oKajRAAAAAAAiMPApUQAAAAAAIjDQKSiRHtUXePcclS/oAs=",
1942
+ },
1943
+ fast: {
1944
+ js: "((x) => Math.min(1e4, Math.max(-1e4, (x) / (((x + 1.032428)) < 1e-4 && ((x + 1.032428)) > -1e-4 ? (((x + 1.032428)) >= 0 ? 1e-4 : -1e-4) : ((x + 1.032428))))))",
1945
+ eval: ((x) => Math.min(1e4, Math.max(-1e4, (x) / (((x + 1.032428)) < 1e-4 && ((x + 1.032428)) > -1e-4 ? (((x + 1.032428)) >= 0 ? 1e-4 : -1e-4) : ((x + 1.032428)))))),
1946
+ 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 + 1.032428f)), 1.0e-4f), (x + 1.032428f))), -1.0e4f), 1.0e4f);\n}",
1947
+ py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (x / (abs((x + 1.032428)) < 1e-4 ? 1e-4 : (x + 1.032428)))",
1948
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACj8BPQAgACAARFKY9zjThPA/oJlELUMc6+I2Gj+lIABEUpj3ONOE8D+gpqNEAAAAAACIw8ClRAAAAAAAiMNApAs=",
1949
+ },
1950
+ meta: {
1951
+ metric: 9.35135840763872e-9,
1952
+ level: 2,
1953
+ formulaCost: 8,
1954
+ exactCost: 26,
1955
+ speedupVsExact: 3.25,
1956
+ vsIterative: null,
1957
+ },
1958
+ },
1759
1959
  };
1760
1960
 
1761
- 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"];
1961
+ 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"];
1762
1962
 
1763
1963
  export default kernels;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spear-kernels",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "Closed-form kernels discovered by the SPEAR symbolic regression engine, shipped as JS, CUDA C, PyTorch and WebAssembly.",
5
5
  "license": "MIT",
6
6
  "type": "module",