mlx/docs/build/html/fast_8h_source.html

207 lines
26 KiB
HTML
Raw Normal View History

2024-06-07 11:28:06 +08:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.10.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>MLX: mlx/fast.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script type="text/javascript" src="clipboard.js"></script>
<script type="text/javascript" src="cookie.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">MLX
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.10.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() { codefold.init(0); });
/* @license-end */
</script>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_938ab0ecf10b8b860ff766c820f665fd.html">mlx</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle"><div class="title">fast.h</div></div>
</div><!--header-->
<div class="contents">
<a href="fast_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span><span class="comment">// Copyright © 2023-2024 Apple Inc.</span></div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno"> 2</span> </div>
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno"> 3</span><span class="preprocessor">#pragma once</span></div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span> </div>
2024-08-24 03:14:53 +08:00
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span><span class="preprocessor">#include &lt;map&gt;</span></div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span><span class="preprocessor">#include &lt;optional&gt;</span></div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span> </div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span><span class="preprocessor">#include &quot;<a class="code" href="utils_8h.html">mlx/utils.h</a>&quot;</span></div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span> </div>
<div class="foldopen" id="foldopen00010" data-start="{" data-end="}">
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core_1_1fast.html"> 10</a></span><span class="keyword">namespace </span><a class="code hl_namespace" href="namespacemlx_1_1core_1_1fast.html">mlx::core::fast</a> {</div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span> </div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core_1_1fast.html#ac7b620275c6386f822b7aacc6b312e62"> 12</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#ac7b620275c6386f822b7aacc6b312e62">rms_norm</a>(</div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span> <span class="keyword">const</span> <a class="code hl_class" href="classmlx_1_1core_1_1array.html">array</a>&amp; x,</div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span> <span class="keyword">const</span> <a class="code hl_class" href="classmlx_1_1core_1_1array.html">array</a>&amp; weight,</div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span> <span class="keywordtype">float</span> eps,</div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span> <a class="code hl_typedef" href="namespacemlx_1_1core.html#a95fc1013cc48fbfee0c54310711a5e58">StreamOrDevice</a> s = {});</div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span> </div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core_1_1fast.html#a01bd533ebd0e2415c4ee30032d51d7bf"> 18</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#a01bd533ebd0e2415c4ee30032d51d7bf">layer_norm</a>(</div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> <span class="keyword">const</span> <a class="code hl_class" href="classmlx_1_1core_1_1array.html">array</a>&amp; x,</div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> <span class="keyword">const</span> std::optional&lt;array&gt;&amp; weight,</div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> <span class="keyword">const</span> std::optional&lt;array&gt;&amp; bias,</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> <span class="keywordtype">float</span> eps,</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> <a class="code hl_typedef" href="namespacemlx_1_1core.html#a95fc1013cc48fbfee0c54310711a5e58">StreamOrDevice</a> s = {});</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> </div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core_1_1fast.html#a534ef357eae24892684a6ecd866d3fab"> 25</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#a534ef357eae24892684a6ecd866d3fab">rope</a>(</div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> <span class="keyword">const</span> <a class="code hl_class" href="classmlx_1_1core_1_1array.html">array</a>&amp; x,</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> <span class="keywordtype">int</span> dims,</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> <span class="keywordtype">bool</span> traditional,</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> std::optional&lt;float&gt; base,</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> <span class="keywordtype">float</span> scale,</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> <span class="keywordtype">int</span> offset,</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> <span class="keyword">const</span> std::optional&lt;array&gt;&amp; freqs = std::nullopt,</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> <a class="code hl_typedef" href="namespacemlx_1_1core.html#a95fc1013cc48fbfee0c54310711a5e58">StreamOrDevice</a> s = {});</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> </div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core_1_1fast.html#a8ff2129e77419b7cd32d149cab0766b9"> 36</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#a8ff2129e77419b7cd32d149cab0766b9">scaled_dot_product_attention</a>(</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> <span class="keyword">const</span> <a class="code hl_class" href="classmlx_1_1core_1_1array.html">array</a>&amp; queries,</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> <span class="keyword">const</span> <a class="code hl_class" href="classmlx_1_1core_1_1array.html">array</a>&amp; keys,</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> <span class="keyword">const</span> <a class="code hl_class" href="classmlx_1_1core_1_1array.html">array</a>&amp; values,</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> <span class="keyword">const</span> <span class="keywordtype">float</span> scale,</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> <span class="keyword">const</span> std::optional&lt;array&gt;&amp; mask = std::nullopt,</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> <span class="keyword">const</span> std::optional&lt;int&gt;&amp; memory_efficient_threshold = std::nullopt,</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> <a class="code hl_typedef" href="namespacemlx_1_1core.html#a95fc1013cc48fbfee0c54310711a5e58">StreamOrDevice</a> s = {});</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> </div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core_1_1fast.html#aa4b5f6886b2288cb6dfdd8598579f080"> 45</a></span>std::tuple&lt;array, array, array&gt; <a class="code hl_function" href="namespacemlx_1_1core_1_1fast.html#aa4b5f6886b2288cb6dfdd8598579f080">affine_quantize</a>(</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</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="l00047" name="l00047"></a><span class="lineno"> 47</span> <span class="keywordtype">int</span> group_size = 64,</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> <span class="keywordtype">int</span> bits = 4,</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> <a class="code hl_typedef" href="namespacemlx_1_1core.html#a95fc1013cc48fbfee0c54310711a5e58">StreamOrDevice</a> s = {});</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> </div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core_1_1fast.html#a638c7e9b9ea8677f01786d8f9738baf8"> 51</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="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; w,</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; scales,</div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</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="l00055" name="l00055"></a><span class="lineno"> 55</span> <span class="keywordtype">int</span> group_size = 64,</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> <span class="keywordtype">int</span> bits = 4,</div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> <a class="code hl_typedef" href="namespacemlx_1_1core.html#a95fc1013cc48fbfee0c54310711a5e58">StreamOrDevice</a> s = {});</div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> </div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core_1_1fast.html#a12c7ef41409d6fb378008e67b6fab328"> 59</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="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; w,</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; scales,</div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</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="l00063" name="l00063"></a><span class="lineno"> 63</span> <span class="keywordtype">int</span> group_size = 64,</div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> <span class="keywordtype">int</span> bits = 4,</div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> <a class="code hl_typedef" href="namespacemlx_1_1core.html#a95fc1013cc48fbfee0c54310711a5e58">StreamOrDevice</a> s = {});</div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> </div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core_1_1fast.html#a9390693ff7be931f3ef3428e2ea4c3f9"> 67</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="l00068" name="l00068"></a><span class="lineno"> 68</span> </div>
<div class="foldopen" id="foldopen00069" data-start="{" data-end="};">
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"><a class="line" href="classmlx_1_1core_1_1fast_1_1_metal_kernel.html"> 69</a></span><span class="keyword">class </span><a class="code hl_class" href="classmlx_1_1core_1_1fast_1_1_metal_kernel.html">MetalKernel</a> {</div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> <span class="keyword">public</span>:</div>
<div class="foldopen" id="foldopen00071" data-start="{" data-end="}">
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"><a class="line" href="classmlx_1_1core_1_1fast_1_1_metal_kernel.html#aa3bb7e33f51b36b1d91c551b6aa711b4"> 71</a></span> <a class="code hl_function" href="classmlx_1_1core_1_1fast_1_1_metal_kernel.html#aa3bb7e33f51b36b1d91c551b6aa711b4">MetalKernel</a>(</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> <span class="keyword">const</span> std::string&amp; name,</div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> <span class="keyword">const</span> std::string&amp; source,</div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> <span class="keywordtype">bool</span> ensure_row_contiguous)</div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> : name_(name),</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> source_(source),</div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> ensure_row_contiguous_(ensure_row_contiguous) {}</div>
</div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> </div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"><a class="line" href="classmlx_1_1core_1_1fast_1_1_metal_kernel.html#afcb6509d9140bd9b9b419881a3a998cb"> 79</a></span> std::map&lt;std::string, array&gt; <a class="code hl_function" href="classmlx_1_1core_1_1fast_1_1_metal_kernel.html#afcb6509d9140bd9b9b419881a3a998cb">operator()</a>(</div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> std::map&lt;std::string, array&gt;&amp; inputs,</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> std::map&lt;std::string, std::vector&lt;int&gt;&gt; output_shapes,</div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> std::map&lt;std::string, Dtype&gt; output_dtypes,</div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> std::tuple&lt;int, int, int&gt; grid,</div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> std::tuple&lt;int, int, int&gt; threadgroup,</div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> std::optional&lt;std::map&lt;std::string, TemplateArg&gt;&gt; template_args =</div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> std::nullopt,</div>
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> <span class="keywordtype">bool</span> verbose = <span class="keyword">false</span>,</div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> <a class="code hl_typedef" href="namespacemlx_1_1core.html#a95fc1013cc48fbfee0c54310711a5e58">StreamOrDevice</a> s = {});</div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> </div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> <span class="keyword">private</span>:</div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> std::string name_;</div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> std::string source_;</div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> <span class="keywordtype">bool</span> ensure_row_contiguous_ = <span class="keyword">true</span>;</div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span>};</div>
</div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span>} <span class="comment">// namespace mlx::core::fast</span></div>
2024-06-07 11:28:06 +08:00
</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>
2024-08-24 03:14:53 +08:00
<div class="ttc" id="aclassmlx_1_1core_1_1fast_1_1_metal_kernel_html"><div class="ttname"><a href="classmlx_1_1core_1_1fast_1_1_metal_kernel.html">mlx::core::fast::MetalKernel</a></div><div class="ttdef"><b>Definition</b> fast.h:69</div></div>
<div class="ttc" id="aclassmlx_1_1core_1_1fast_1_1_metal_kernel_html_aa3bb7e33f51b36b1d91c551b6aa711b4"><div class="ttname"><a href="classmlx_1_1core_1_1fast_1_1_metal_kernel.html#aa3bb7e33f51b36b1d91c551b6aa711b4">mlx::core::fast::MetalKernel::MetalKernel</a></div><div class="ttdeci">MetalKernel(const std::string &amp;name, const std::string &amp;source, bool ensure_row_contiguous)</div><div class="ttdef"><b>Definition</b> fast.h:71</div></div>
<div class="ttc" id="aclassmlx_1_1core_1_1fast_1_1_metal_kernel_html_afcb6509d9140bd9b9b419881a3a998cb"><div class="ttname"><a href="classmlx_1_1core_1_1fast_1_1_metal_kernel.html#afcb6509d9140bd9b9b419881a3a998cb">mlx::core::fast::MetalKernel::operator()</a></div><div class="ttdeci">std::map&lt; std::string, array &gt; operator()(std::map&lt; std::string, array &gt; &amp;inputs, std::map&lt; std::string, std::vector&lt; int &gt; &gt; output_shapes, std::map&lt; std::string, Dtype &gt; output_dtypes, std::tuple&lt; int, int, int &gt; grid, std::tuple&lt; int, int, int &gt; threadgroup, std::optional&lt; std::map&lt; std::string, TemplateArg &gt; &gt; template_args=std::nullopt, bool verbose=false, StreamOrDevice s={})</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:10</div></div>
2024-06-07 11:28:06 +08:00
<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>
2024-08-11 00:24:35 +08:00
<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>
2024-08-24 03:14:53 +08:00
<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_a8ff2129e77419b7cd32d149cab0766b9"><div class="ttname"><a href="namespacemlx_1_1core_1_1fast.html#a8ff2129e77419b7cd32d149cab0766b9">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; &amp;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_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:67</div></div>
2024-08-11 00:24:35 +08:00
<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>
2024-06-07 11:28:06 +08:00
<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>
<div class="ttc" id="anamespacemlx_1_1core_html_a95fc1013cc48fbfee0c54310711a5e58"><div class="ttname"><a href="namespacemlx_1_1core.html#a95fc1013cc48fbfee0c54310711a5e58">mlx::core::StreamOrDevice</a></div><div class="ttdeci">std::variant&lt; std::monostate, Stream, Device &gt; StreamOrDevice</div><div class="ttdef"><b>Definition</b> utils.h:14</div></div>
<div class="ttc" id="autils_8h_html"><div class="ttname"><a href="utils_8h.html">utils.h</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.10.0
</small></address>
</body>
</html>