This commit is contained in:
CircleCI Docs
2024-11-22 20:24:16 +00:00
parent 6433a22733
commit 8ba8a39e43
905 changed files with 30035 additions and 16934 deletions

View File

@@ -140,7 +140,7 @@ $(function(){ initResizable(false); });
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> <span class="keywordtype">int</span> bits = 4,</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> <a class="code hl_typedef" href="namespacemlx_1_1core.html#a95fc1013cc48fbfee0c54310711a5e58">StreamOrDevice</a> s = {});</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> </div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core_1_1fast.html#a638c7e9b9ea8677f01786d8f9738baf8"> 50</a></span><a class="code hl_class" href="classmlx_1_1core_1_1array.html">array</a> <a class="code hl_function" href="namespacemlx_1_1core_1_1fast.html#aa4b5f6886b2288cb6dfdd8598579f080">affine_quantize</a>(</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core_1_1fast.html#a12c7ef41409d6fb378008e67b6fab328"> 50</a></span><a class="code hl_class" href="classmlx_1_1core_1_1array.html">array</a> <a class="code hl_function" href="namespacemlx_1_1core_1_1fast.html#a12c7ef41409d6fb378008e67b6fab328">affine_dequantize</a>(</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> <span class="keyword">const</span> <a class="code hl_class" href="classmlx_1_1core_1_1array.html">array</a>&amp; w,</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> <span class="keyword">const</span> <a class="code hl_class" href="classmlx_1_1core_1_1array.html">array</a>&amp; scales,</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> <span class="keyword">const</span> <a class="code hl_class" href="classmlx_1_1core_1_1array.html">array</a>&amp; biases,</div>
@@ -148,47 +148,39 @@ $(function(){ initResizable(false); });
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> <span class="keywordtype">int</span> bits = 4,</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> <a class="code hl_typedef" href="namespacemlx_1_1core.html#a95fc1013cc48fbfee0c54310711a5e58">StreamOrDevice</a> s = {});</div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> </div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core_1_1fast.html#a12c7ef41409d6fb378008e67b6fab328"> 58</a></span><a class="code hl_class" href="classmlx_1_1core_1_1array.html">array</a> <a class="code hl_function" href="namespacemlx_1_1core_1_1fast.html#a12c7ef41409d6fb378008e67b6fab328">affine_dequantize</a>(</div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> <span class="keyword">const</span> <a class="code hl_class" href="classmlx_1_1core_1_1array.html">array</a>&amp; w,</div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> <span class="keyword">const</span> <a class="code hl_class" href="classmlx_1_1core_1_1array.html">array</a>&amp; scales,</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> <span class="keyword">const</span> <a class="code hl_class" href="classmlx_1_1core_1_1array.html">array</a>&amp; biases,</div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> <span class="keywordtype">int</span> group_size = 64,</div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> <span class="keywordtype">int</span> bits = 4,</div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> <a class="code hl_typedef" href="namespacemlx_1_1core.html#a95fc1013cc48fbfee0c54310711a5e58">StreamOrDevice</a> s = {});</div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> </div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core_1_1fast.html#a9390693ff7be931f3ef3428e2ea4c3f9"> 66</a></span><span class="keyword">typedef</span> std::variant&lt;int, bool, Dtype&gt; <a class="code hl_typedef" href="namespacemlx_1_1core_1_1fast.html#a9390693ff7be931f3ef3428e2ea4c3f9">TemplateArg</a>;</div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> </div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span><span class="keyword">typedef</span> std::function&lt;std::vector&lt;array&gt;(</div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> <span class="keyword">const</span> std::vector&lt;array&gt;&amp;,</div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> <span class="keyword">const</span> std::vector&lt;std::vector&lt;int&gt;&gt;&amp;,</div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> <span class="keyword">const</span> std::vector&lt;Dtype&gt;&amp;,</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> std::tuple&lt;int, int, int&gt;,</div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> std::tuple&lt;int, int, int&gt;,</div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> std::vector&lt;std::pair&lt;std::string, TemplateArg&gt;&gt;,</div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> std::optional&lt;float&gt;,</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> <span class="keywordtype">bool</span>,</div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> <a class="code hl_typedef" href="namespacemlx_1_1core.html#a95fc1013cc48fbfee0c54310711a5e58">StreamOrDevice</a>)&gt;</div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core_1_1fast.html#a0e8c2c4ea7a946568c8fe5b4810417e0"> 78</a></span> <a class="code hl_typedef" href="namespacemlx_1_1core_1_1fast.html#a0e8c2c4ea7a946568c8fe5b4810417e0">MetalKernelFunction</a>;</div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> </div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core_1_1fast.html#ab16436b465dc10ce472193d541d8426e"> 80</a></span><a class="code hl_typedef" href="namespacemlx_1_1core_1_1fast.html#a0e8c2c4ea7a946568c8fe5b4810417e0">MetalKernelFunction</a> <a class="code hl_function" href="namespacemlx_1_1core_1_1fast.html#ab16436b465dc10ce472193d541d8426e">metal_kernel</a>(</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> <span class="keyword">const</span> std::string&amp; name,</div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> <span class="keyword">const</span> std::vector&lt;std::string&gt;&amp; input_names,</div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> <span class="keyword">const</span> std::vector&lt;std::string&gt;&amp; output_names,</div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> <span class="keyword">const</span> std::string&amp; source,</div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> <span class="keyword">const</span> std::string&amp; header = <span class="stringliteral">&quot;&quot;</span>,</div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> <span class="keywordtype">bool</span> ensure_row_contiguous = <span class="keyword">true</span>,</div>
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> <span class="keywordtype">bool</span> atomic_outputs = <span class="keyword">false</span>);</div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> </div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span>} <span class="comment">// namespace mlx::core::fast</span></div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core_1_1fast.html#a9390693ff7be931f3ef3428e2ea4c3f9"> 58</a></span><span class="keyword">typedef</span> std::variant&lt;int, bool, Dtype&gt; <a class="code hl_typedef" href="namespacemlx_1_1core_1_1fast.html#a9390693ff7be931f3ef3428e2ea4c3f9">TemplateArg</a>;</div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> </div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span><span class="keyword">typedef</span> std::function&lt;std::vector&lt;array&gt;(</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> <span class="keyword">const</span> std::vector&lt;array&gt;&amp;,</div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> <span class="keyword">const</span> std::vector&lt;std::vector&lt;int&gt;&gt;&amp;,</div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> <span class="keyword">const</span> std::vector&lt;Dtype&gt;&amp;,</div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> std::tuple&lt;int, int, int&gt;,</div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> std::tuple&lt;int, int, int&gt;,</div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> std::vector&lt;std::pair&lt;std::string, TemplateArg&gt;&gt;,</div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> std::optional&lt;float&gt;,</div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> <span class="keywordtype">bool</span>,</div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> <a class="code hl_typedef" href="namespacemlx_1_1core.html#a95fc1013cc48fbfee0c54310711a5e58">StreamOrDevice</a>)&gt;</div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core_1_1fast.html#a0e8c2c4ea7a946568c8fe5b4810417e0"> 70</a></span> <a class="code hl_typedef" href="namespacemlx_1_1core_1_1fast.html#a0e8c2c4ea7a946568c8fe5b4810417e0">MetalKernelFunction</a>;</div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> </div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core_1_1fast.html#ab16436b465dc10ce472193d541d8426e"> 72</a></span><a class="code hl_typedef" href="namespacemlx_1_1core_1_1fast.html#a0e8c2c4ea7a946568c8fe5b4810417e0">MetalKernelFunction</a> <a class="code hl_function" href="namespacemlx_1_1core_1_1fast.html#ab16436b465dc10ce472193d541d8426e">metal_kernel</a>(</div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> <span class="keyword">const</span> std::string&amp; name,</div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> <span class="keyword">const</span> std::vector&lt;std::string&gt;&amp; input_names,</div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> <span class="keyword">const</span> std::vector&lt;std::string&gt;&amp; output_names,</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> <span class="keyword">const</span> std::string&amp; source,</div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> <span class="keyword">const</span> std::string&amp; header = <span class="stringliteral">&quot;&quot;</span>,</div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> <span class="keywordtype">bool</span> ensure_row_contiguous = <span class="keyword">true</span>,</div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> <span class="keywordtype">bool</span> atomic_outputs = <span class="keyword">false</span>);</div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> </div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span>} <span class="comment">// namespace mlx::core::fast</span></div>
</div>
<div class="ttc" id="aclassmlx_1_1core_1_1array_html"><div class="ttname"><a href="classmlx_1_1core_1_1array.html">mlx::core::array</a></div><div class="ttdef"><b>Definition</b> array.h:20</div></div>
<div class="ttc" id="anamespacemlx_1_1core_1_1fast_html"><div class="ttname"><a href="namespacemlx_1_1core_1_1fast.html">mlx::core::fast</a></div><div class="ttdef"><b>Definition</b> fast.h:9</div></div>
<div class="ttc" id="anamespacemlx_1_1core_1_1fast_html_a01bd533ebd0e2415c4ee30032d51d7bf"><div class="ttname"><a href="namespacemlx_1_1core_1_1fast.html#a01bd533ebd0e2415c4ee30032d51d7bf">mlx::core::fast::layer_norm</a></div><div class="ttdeci">array layer_norm(const array &amp;x, const std::optional&lt; array &gt; &amp;weight, const std::optional&lt; array &gt; &amp;bias, float eps, StreamOrDevice s={})</div></div>
<div class="ttc" id="anamespacemlx_1_1core_1_1fast_html_a0e8c2c4ea7a946568c8fe5b4810417e0"><div class="ttname"><a href="namespacemlx_1_1core_1_1fast.html#a0e8c2c4ea7a946568c8fe5b4810417e0">mlx::core::fast::MetalKernelFunction</a></div><div class="ttdeci">std::function&lt; std::vector&lt; array &gt;(const std::vector&lt; array &gt; &amp;, const std::vector&lt; std::vector&lt; int &gt; &gt; &amp;, const std::vector&lt; Dtype &gt; &amp;, std::tuple&lt; int, int, int &gt;, std::tuple&lt; int, int, int &gt;, std::vector&lt; std::pair&lt; std::string, TemplateArg &gt; &gt;, std::optional&lt; float &gt;, bool, StreamOrDevice)&gt; MetalKernelFunction</div><div class="ttdef"><b>Definition</b> fast.h:78</div></div>
<div class="ttc" id="anamespacemlx_1_1core_1_1fast_html_a0e8c2c4ea7a946568c8fe5b4810417e0"><div class="ttname"><a href="namespacemlx_1_1core_1_1fast.html#a0e8c2c4ea7a946568c8fe5b4810417e0">mlx::core::fast::MetalKernelFunction</a></div><div class="ttdeci">std::function&lt; std::vector&lt; array &gt;(const std::vector&lt; array &gt; &amp;, const std::vector&lt; std::vector&lt; int &gt; &gt; &amp;, const std::vector&lt; Dtype &gt; &amp;, std::tuple&lt; int, int, int &gt;, std::tuple&lt; int, int, int &gt;, std::vector&lt; std::pair&lt; std::string, TemplateArg &gt; &gt;, std::optional&lt; float &gt;, bool, StreamOrDevice)&gt; MetalKernelFunction</div><div class="ttdef"><b>Definition</b> fast.h:70</div></div>
<div class="ttc" id="anamespacemlx_1_1core_1_1fast_html_a12c7ef41409d6fb378008e67b6fab328"><div class="ttname"><a href="namespacemlx_1_1core_1_1fast.html#a12c7ef41409d6fb378008e67b6fab328">mlx::core::fast::affine_dequantize</a></div><div class="ttdeci">array affine_dequantize(const array &amp;w, const array &amp;scales, const array &amp;biases, int group_size=64, int bits=4, StreamOrDevice s={})</div></div>
<div class="ttc" id="anamespacemlx_1_1core_1_1fast_html_a3663b50265b0a9c0cca2b5376852e059"><div class="ttname"><a href="namespacemlx_1_1core_1_1fast.html#a3663b50265b0a9c0cca2b5376852e059">mlx::core::fast::scaled_dot_product_attention</a></div><div class="ttdeci">array scaled_dot_product_attention(const array &amp;queries, const array &amp;keys, const array &amp;values, const float scale, const std::optional&lt; array &gt; &amp;mask=std::nullopt, const std::optional&lt; int &gt; memory_efficient_threshold=std::nullopt, StreamOrDevice s={})</div><div class="ttdoc">Computes: O = softmax(Q @ K.T) @ V.</div></div>
<div class="ttc" id="anamespacemlx_1_1core_1_1fast_html_a534ef357eae24892684a6ecd866d3fab"><div class="ttname"><a href="namespacemlx_1_1core_1_1fast.html#a534ef357eae24892684a6ecd866d3fab">mlx::core::fast::rope</a></div><div class="ttdeci">array rope(const array &amp;x, int dims, bool traditional, std::optional&lt; float &gt; base, float scale, int offset, const std::optional&lt; array &gt; &amp;freqs=std::nullopt, StreamOrDevice s={})</div></div>
<div class="ttc" id="anamespacemlx_1_1core_1_1fast_html_a9390693ff7be931f3ef3428e2ea4c3f9"><div class="ttname"><a href="namespacemlx_1_1core_1_1fast.html#a9390693ff7be931f3ef3428e2ea4c3f9">mlx::core::fast::TemplateArg</a></div><div class="ttdeci">std::variant&lt; int, bool, Dtype &gt; TemplateArg</div><div class="ttdef"><b>Definition</b> fast.h:66</div></div>
<div class="ttc" id="anamespacemlx_1_1core_1_1fast_html_a9390693ff7be931f3ef3428e2ea4c3f9"><div class="ttname"><a href="namespacemlx_1_1core_1_1fast.html#a9390693ff7be931f3ef3428e2ea4c3f9">mlx::core::fast::TemplateArg</a></div><div class="ttdeci">std::variant&lt; int, bool, Dtype &gt; TemplateArg</div><div class="ttdef"><b>Definition</b> fast.h:58</div></div>
<div class="ttc" id="anamespacemlx_1_1core_1_1fast_html_aa4b5f6886b2288cb6dfdd8598579f080"><div class="ttname"><a href="namespacemlx_1_1core_1_1fast.html#aa4b5f6886b2288cb6dfdd8598579f080">mlx::core::fast::affine_quantize</a></div><div class="ttdeci">std::tuple&lt; array, array, array &gt; affine_quantize(const array &amp;w, int group_size=64, int bits=4, StreamOrDevice s={})</div></div>
<div class="ttc" id="anamespacemlx_1_1core_1_1fast_html_ab16436b465dc10ce472193d541d8426e"><div class="ttname"><a href="namespacemlx_1_1core_1_1fast.html#ab16436b465dc10ce472193d541d8426e">mlx::core::fast::metal_kernel</a></div><div class="ttdeci">MetalKernelFunction metal_kernel(const std::string &amp;name, const std::vector&lt; std::string &gt; &amp;input_names, const std::vector&lt; std::string &gt; &amp;output_names, const std::string &amp;source, const std::string &amp;header=&quot;&quot;, bool ensure_row_contiguous=true, bool atomic_outputs=false)</div></div>
<div class="ttc" id="anamespacemlx_1_1core_1_1fast_html_ac7b620275c6386f822b7aacc6b312e62"><div class="ttname"><a href="namespacemlx_1_1core_1_1fast.html#ac7b620275c6386f822b7aacc6b312e62">mlx::core::fast::rms_norm</a></div><div class="ttdeci">array rms_norm(const array &amp;x, const array &amp;weight, float eps, StreamOrDevice s={})</div></div>