2024-10-15 23:12:17 +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" / >
2025-02-07 04:16:29 +08:00
< meta name = "generator" content = "Doxygen 1.13.2" / >
2024-10-15 23:12:17 +08:00
< meta name = "viewport" content = "width=device-width, initial-scale=1" / >
< title > MLX: mlx/fast.h File Reference< / 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 >
< link href = "navtree.css" rel = "stylesheet" type = "text/css" / >
2025-01-10 05:56:20 +08:00
< script type = "text/javascript" src = "navtreedata.js" > < / script >
< script type = "text/javascript" src = "navtree.js" > < / script >
2024-10-15 23:12:17 +08:00
< script type = "text/javascript" src = "resize.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 >
2025-01-10 05:56:20 +08:00
< script type = "text/javascript" >
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699& dn=expat.txt MIT */
$(function() { init_search(); });
/* @license-end */
< / script >
2024-10-15 23:12:17 +08:00
< 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 >
2025-01-10 05:56:20 +08:00
< td > < div id = "MSearchBox" class = "MSearchBoxInactive" >
< span class = "left" >
< span id = "MSearchSelect" onmouseover = "return searchBox.OnSearchSelectShow()" onmouseout = "return searchBox.OnSearchSelectHide()" >   < / span >
< input type = "text" id = "MSearchField" value = "" placeholder = "Search" accesskey = "S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
< / span > < span class = "right" >
< a id = "MSearchClose" href = "javascript:searchBox.CloseResultsWindow()" > < img id = "MSearchCloseImg" border = "0" src = "search/close.svg" alt = "" / > < / a >
< / span >
< / div >
< / td >
2024-10-15 23:12:17 +08:00
< / tr >
< / tbody >
< / table >
< / div >
<!-- end header part -->
2025-02-07 04:16:29 +08:00
<!-- Generated by Doxygen 1.13.2 -->
2024-10-15 23:12:17 +08:00
< script type = "text/javascript" >
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699& dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
< / script >
< script type = "text/javascript" >
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699& dn=expat.txt MIT */
$(function() { codefold.init(0); });
/* @license-end */
< / script >
2025-01-10 05:56:20 +08:00
< / div > <!-- top -->
< div id = "side-nav" class = "ui-resizable side-nav-resizable" >
< div id = "nav-tree" >
< div id = "nav-tree-contents" >
< div id = "nav-sync" class = "sync" > < / div >
< / div >
< / div >
< div id = "splitbar" style = "-moz-user-select:none;"
class="ui-resizable-handle">
< / div >
< / div >
2024-10-15 23:12:17 +08:00
< script type = "text/javascript" >
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699& dn=expat.txt MIT */
2025-01-10 05:56:20 +08:00
$(function(){initNavTree('fast_8h.html',''); initResizable(true); });
2024-10-15 23:12:17 +08:00
/* @license-end */
< / script >
2025-01-10 05:56:20 +08:00
< div id = "doc-content" >
2024-10-15 23:12:17 +08:00
<!-- 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 class = "header" >
< div class = "summary" >
< a href = "#namespaces" > Namespaces< / a > |
< a href = "#typedef-members" > Typedefs< / a > |
< a href = "#func-members" > Functions< / a > < / div >
< div class = "headertitle" > < div class = "title" > fast.h File Reference< / div > < / div >
< / div > <!-- header -->
< div class = "contents" >
< div class = "textblock" > < code > #include < optional> < / code > < br / >
< code > #include " < a class = "el" href = "utils_8h_source.html" > mlx/utils.h< / a > " < / code > < br / >
< / div >
< p > < a href = "fast_8h_source.html" > Go to the source code of this file.< / a > < / p >
< table class = "memberdecls" >
< tr class = "heading" > < td colspan = "2" > < h2 class = "groupheader" > < a id = "namespaces" name = "namespaces" > < / a >
Namespaces< / h2 > < / td > < / tr >
< tr class = "memitem:" > < td class = "memItemLeft" align = "right" valign = "top" > namespace   < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "namespacemlx.html" > mlx< / a > < / td > < / tr >
< tr class = "separator:" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:" > < td class = "memItemLeft" align = "right" valign = "top" > namespace   < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "namespacemlx_1_1core.html" > mlx::core< / a > < / td > < / tr >
< tr class = "separator:" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:" > < td class = "memItemLeft" align = "right" valign = "top" > namespace   < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "namespacemlx_1_1core_1_1fast.html" > mlx::core::fast< / a > < / td > < / tr >
< tr class = "separator:" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< / table > < table class = "memberdecls" >
< tr class = "heading" > < td colspan = "2" > < h2 class = "groupheader" > < a id = "typedef-members" name = "typedef-members" > < / a >
Typedefs< / h2 > < / td > < / tr >
< tr class = "memitem:a9390693ff7be931f3ef3428e2ea4c3f9" id = "r_a9390693ff7be931f3ef3428e2ea4c3f9" > < td class = "memItemLeft" align = "right" valign = "top" > typedef std::variant< int, bool, < a class = "el" href = "structmlx_1_1core_1_1_dtype.html" > Dtype< / a > >   < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "namespacemlx_1_1core_1_1fast.html#a9390693ff7be931f3ef3428e2ea4c3f9" > mlx::core::fast::TemplateArg< / a > < / td > < / tr >
< tr class = "separator:a9390693ff7be931f3ef3428e2ea4c3f9" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
2025-01-10 05:56:20 +08:00
< tr class = "memitem:aa45bf61e7a5c4ad0114b82ed80ae0dbd" id = "r_aa45bf61e7a5c4ad0114b82ed80ae0dbd" > < td class = "memItemLeft" align = "right" valign = "top" > typedef std::function< std::vector< < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > > (const std::vector< < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > > & , const std::vector< < a class = "el" href = "namespacemlx_1_1core.html#a694e23f2d59606643728ad443d621416" > Shape< / a > > & , const std::vector< < a class = "el" href = "structmlx_1_1core_1_1_dtype.html" > Dtype< / a > > & , std::tuple< int, int, int > , std::tuple< int, int, int > , std::vector< std::pair< std::string, < a class = "el" href = "namespacemlx_1_1core_1_1fast.html#a9390693ff7be931f3ef3428e2ea4c3f9" > TemplateArg< / a > > > , std::optional< float > , bool, < a class = "el" href = "namespacemlx_1_1core.html#a95fc1013cc48fbfee0c54310711a5e58" > StreamOrDevice< / a > )>   < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "namespacemlx_1_1core_1_1fast.html#aa45bf61e7a5c4ad0114b82ed80ae0dbd" > mlx::core::fast::MetalKernelFunction< / a > < / td > < / tr >
< tr class = "separator:aa45bf61e7a5c4ad0114b82ed80ae0dbd" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
2024-10-15 23:12:17 +08:00
< / table > < table class = "memberdecls" >
< tr class = "heading" > < td colspan = "2" > < h2 class = "groupheader" > < a id = "func-members" name = "func-members" > < / a >
Functions< / h2 > < / td > < / tr >
< tr class = "memitem:ac7b620275c6386f822b7aacc6b312e62" id = "r_ac7b620275c6386f822b7aacc6b312e62" > < td class = "memItemLeft" align = "right" valign = "top" > < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a >   < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "namespacemlx_1_1core_1_1fast.html#ac7b620275c6386f822b7aacc6b312e62" > mlx::core::fast::rms_norm< / a > (const < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > & x, const < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > & weight, float eps, < a class = "el" href = "namespacemlx_1_1core.html#a95fc1013cc48fbfee0c54310711a5e58" > StreamOrDevice< / a > s={})< / td > < / tr >
< tr class = "separator:ac7b620275c6386f822b7aacc6b312e62" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:a01bd533ebd0e2415c4ee30032d51d7bf" id = "r_a01bd533ebd0e2415c4ee30032d51d7bf" > < td class = "memItemLeft" align = "right" valign = "top" > < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a >   < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "namespacemlx_1_1core_1_1fast.html#a01bd533ebd0e2415c4ee30032d51d7bf" > mlx::core::fast::layer_norm< / a > (const < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > & x, const std::optional< < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > > & weight, const std::optional< < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > > & bias, float eps, < a class = "el" href = "namespacemlx_1_1core.html#a95fc1013cc48fbfee0c54310711a5e58" > StreamOrDevice< / a > s={})< / td > < / tr >
< tr class = "separator:a01bd533ebd0e2415c4ee30032d51d7bf" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:a534ef357eae24892684a6ecd866d3fab" id = "r_a534ef357eae24892684a6ecd866d3fab" > < td class = "memItemLeft" align = "right" valign = "top" > < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a >   < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "namespacemlx_1_1core_1_1fast.html#a534ef357eae24892684a6ecd866d3fab" > mlx::core::fast::rope< / a > (const < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > & x, int dims, bool traditional, std::optional< float > base, float scale, int offset, const std::optional< < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > > & freqs=std::nullopt, < a class = "el" href = "namespacemlx_1_1core.html#a95fc1013cc48fbfee0c54310711a5e58" > StreamOrDevice< / a > s={})< / td > < / tr >
< tr class = "separator:a534ef357eae24892684a6ecd866d3fab" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
2025-01-10 05:56:20 +08:00
< tr class = "memitem:a1632b78950f0c8c31b24be7d80faeb39" id = "r_a1632b78950f0c8c31b24be7d80faeb39" > < td class = "memItemLeft" align = "right" valign = "top" > < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a >   < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "namespacemlx_1_1core_1_1fast.html#a1632b78950f0c8c31b24be7d80faeb39" > mlx::core::fast::rope< / a > (const < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > & x, int dims, bool traditional, std::optional< float > base, float scale, const < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > & offset, const std::optional< < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > > & freqs=std::nullopt, < a class = "el" href = "namespacemlx_1_1core.html#a95fc1013cc48fbfee0c54310711a5e58" > StreamOrDevice< / a > s={})< / td > < / tr >
< tr class = "separator:a1632b78950f0c8c31b24be7d80faeb39" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
2024-10-15 23:12:17 +08:00
< tr class = "memitem:a3663b50265b0a9c0cca2b5376852e059" id = "r_a3663b50265b0a9c0cca2b5376852e059" > < td class = "memItemLeft" align = "right" valign = "top" > < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a >   < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "namespacemlx_1_1core_1_1fast.html#a3663b50265b0a9c0cca2b5376852e059" > mlx::core::fast::scaled_dot_product_attention< / a > (const < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > & queries, const < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > & keys, const < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > & values, const float scale, const std::optional< < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > > & mask=std::nullopt, const std::optional< int > memory_efficient_threshold=std::nullopt, < a class = "el" href = "namespacemlx_1_1core.html#a95fc1013cc48fbfee0c54310711a5e58" > StreamOrDevice< / a > s={})< / td > < / tr >
< tr class = "memdesc:a3663b50265b0a9c0cca2b5376852e059" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > Computes: O = softmax(Q @ K.T) @ V. < br / > < / td > < / tr >
< tr class = "separator:a3663b50265b0a9c0cca2b5376852e059" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:aa4b5f6886b2288cb6dfdd8598579f080" id = "r_aa4b5f6886b2288cb6dfdd8598579f080" > < td class = "memItemLeft" align = "right" valign = "top" > std::tuple< < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > , < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > , < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > >   < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "namespacemlx_1_1core_1_1fast.html#aa4b5f6886b2288cb6dfdd8598579f080" > mlx::core::fast::affine_quantize< / a > (const < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > & w, int group_size=64, int bits=4, < a class = "el" href = "namespacemlx_1_1core.html#a95fc1013cc48fbfee0c54310711a5e58" > StreamOrDevice< / a > s={})< / td > < / tr >
< tr class = "separator:aa4b5f6886b2288cb6dfdd8598579f080" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:a12c7ef41409d6fb378008e67b6fab328" id = "r_a12c7ef41409d6fb378008e67b6fab328" > < td class = "memItemLeft" align = "right" valign = "top" > < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a >   < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "namespacemlx_1_1core_1_1fast.html#a12c7ef41409d6fb378008e67b6fab328" > mlx::core::fast::affine_dequantize< / a > (const < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > & w, const < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > & scales, const < a class = "el" href = "classmlx_1_1core_1_1array.html" > array< / a > & biases, int group_size=64, int bits=4, < a class = "el" href = "namespacemlx_1_1core.html#a95fc1013cc48fbfee0c54310711a5e58" > StreamOrDevice< / a > s={})< / td > < / tr >
< tr class = "separator:a12c7ef41409d6fb378008e67b6fab328" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
2025-01-10 05:56:20 +08:00
< tr class = "memitem:ab16436b465dc10ce472193d541d8426e" id = "r_ab16436b465dc10ce472193d541d8426e" > < td class = "memItemLeft" align = "right" valign = "top" > < a class = "el" href = "namespacemlx_1_1core_1_1fast.html#aa45bf61e7a5c4ad0114b82ed80ae0dbd" > MetalKernelFunction< / a >   < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "namespacemlx_1_1core_1_1fast.html#ab16436b465dc10ce472193d541d8426e" > mlx::core::fast::metal_kernel< / a > (const std::string & name, const std::vector< std::string > & input_names, const std::vector< std::string > & output_names, const std::string & source, const std::string & header=" " , bool ensure_row_contiguous=true, bool atomic_outputs=false)< / td > < / tr >
2024-10-15 23:12:17 +08:00
< tr class = "separator:ab16436b465dc10ce472193d541d8426e" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< / table >
< / div > <!-- contents -->
< / div > <!-- doc - content -->
2025-01-10 05:56:20 +08:00
<!-- start footer part -->
< div id = "nav-path" class = "navpath" > <!-- id is needed for treeview function! -->
< ul >
< li class = "navelem" > < a class = "el" href = "dir_938ab0ecf10b8b860ff766c820f665fd.html" > mlx< / a > < / li > < li class = "navelem" > < a class = "el" href = "fast_8h.html" > fast.h< / a > < / li >
2025-02-07 04:16:29 +08:00
< li class = "footer" > Generated by < a href = "https://www.doxygen.org/index.html" > < img class = "footer" src = "doxygen.svg" width = "104" height = "31" alt = "doxygen" / > < / a > 1.13.2 < / li >
2025-01-10 05:56:20 +08:00
< / ul >
< / div >
2024-10-15 23:12:17 +08:00
< / body >
< / html >