mirror of
https://github.com/ml-explore/mlx.git
synced 2025-06-26 02:33:21 +08:00
335 lines
54 KiB
HTML
335 lines
54 KiB
HTML
<!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.13.2"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>MLX: mlx/utils.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>
|
|
<link href="navtree.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="navtreedata.js"></script>
|
|
<script type="text/javascript" src="navtree.js"></script>
|
|
<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>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
|
$(function() { init_search(); });
|
|
/* @license-end */
|
|
</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>
|
|
<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>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.13.2 -->
|
|
<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>
|
|
</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>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
|
$(function(){initNavTree('utils_8h_source.html',''); initResizable(true); });
|
|
/* @license-end */
|
|
</script>
|
|
<div id="doc-content">
|
|
<!-- 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="headertitle"><div class="title">utils.h</div></div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<a href="utils_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>
|
|
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span><span class="preprocessor">#include <exception></span></div>
|
|
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span><span class="preprocessor">#include <variant></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 "<a class="code" href="array_8h.html">mlx/array.h</a>"</span></div>
|
|
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span><span class="preprocessor">#include "<a class="code" href="device_8h.html">mlx/device.h</a>"</span></div>
|
|
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span><span class="preprocessor">#include "<a class="code" href="dtype_8h.html">mlx/dtype.h</a>"</span></div>
|
|
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span><span class="preprocessor">#include "<a class="code" href="stream_8h.html">mlx/stream.h</a>"</span></div>
|
|
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span> </div>
|
|
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span><span class="keyword">namespace </span><a class="code hl_namespace" href="namespacemlx_1_1core.html">mlx::core</a> {</div>
|
|
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span> </div>
|
|
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core.html#a95fc1013cc48fbfee0c54310711a5e58"> 15</a></span><span class="keyword">using </span><a class="code hl_typedef" href="namespacemlx_1_1core.html#a95fc1013cc48fbfee0c54310711a5e58">StreamOrDevice</a> = std::variant<std::monostate, Stream, Device>;</div>
|
|
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core.html#a4734a596e57434492ddfe79f2cb9dbf9"> 16</a></span><a class="code hl_struct" href="structmlx_1_1core_1_1_stream.html">Stream</a> <a class="code hl_function" href="namespacemlx_1_1core.html#a4734a596e57434492ddfe79f2cb9dbf9">to_stream</a>(<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="foldopen" id="foldopen00018" data-start="{" data-end="};">
|
|
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"><a class="line" href="structmlx_1_1core_1_1_stream_context.html"> 18</a></span><span class="keyword">struct </span><a class="code hl_function" href="structmlx_1_1core_1_1_stream_context.html#a89d803151e9d7dce29382aa83d5c6ef1">StreamContext</a> {</div>
|
|
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> <span class="keyword">public</span>:</div>
|
|
<div class="foldopen" id="foldopen00020" data-start="{" data-end="}">
|
|
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"><a class="line" href="structmlx_1_1core_1_1_stream_context.html#a89d803151e9d7dce29382aa83d5c6ef1"> 20</a></span> <a class="code hl_function" href="structmlx_1_1core_1_1_stream_context.html#a89d803151e9d7dce29382aa83d5c6ef1">StreamContext</a>(<a class="code hl_typedef" href="namespacemlx_1_1core.html#a95fc1013cc48fbfee0c54310711a5e58">StreamOrDevice</a> s) : _stream(<a class="code hl_function" href="namespacemlx_1_1core.html#ac198b7e282957c724c84a435e8f1215e">default_stream</a>(<a class="code hl_function" href="namespacemlx_1_1core.html#a0196171cfe6ee2953113abce597dc815">default_device</a>())) {</div>
|
|
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> <span class="keywordflow">if</span> (std::holds_alternative<std::monostate>(s)) {</div>
|
|
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> <span class="keywordflow">throw</span> std::runtime_error(</div>
|
|
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> <span class="stringliteral">"[StreamContext] Invalid argument, please specify a stream or device."</span>);</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"> 25</span> <span class="keyword">auto</span> _s = <a class="code hl_function" href="namespacemlx_1_1core.html#a4734a596e57434492ddfe79f2cb9dbf9">to_stream</a>(s);</div>
|
|
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> <a class="code hl_function" href="namespacemlx_1_1core.html#a312a2de41367fe52caeaf8c0f596a120">set_default_device</a>(_s.device);</div>
|
|
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> <a class="code hl_function" href="namespacemlx_1_1core.html#af35a2b06517d8bb7dbb469692b4f841c">set_default_stream</a>(_s);</div>
|
|
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> }</div>
|
|
</div>
|
|
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> </div>
|
|
<div class="foldopen" id="foldopen00030" data-start="{" data-end="}">
|
|
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"><a class="line" href="structmlx_1_1core_1_1_stream_context.html#ac5be1c576d22b3d0b0a6fcc7e6abe659"> 30</a></span> <a class="code hl_function" href="structmlx_1_1core_1_1_stream_context.html#ac5be1c576d22b3d0b0a6fcc7e6abe659">~StreamContext</a>() {</div>
|
|
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> <a class="code hl_function" href="namespacemlx_1_1core.html#a312a2de41367fe52caeaf8c0f596a120">set_default_device</a>(_stream.device);</div>
|
|
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> <a class="code hl_function" href="namespacemlx_1_1core.html#af35a2b06517d8bb7dbb469692b4f841c">set_default_stream</a>(_stream);</div>
|
|
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> }</div>
|
|
</div>
|
|
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> </div>
|
|
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> <span class="keyword">private</span>:</div>
|
|
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> <a class="code hl_struct" href="structmlx_1_1core_1_1_stream.html">Stream</a> _stream;</div>
|
|
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span>};</div>
|
|
</div>
|
|
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> </div>
|
|
<div class="foldopen" id="foldopen00039" data-start="{" data-end="};">
|
|
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"><a class="line" href="structmlx_1_1core_1_1_print_formatter.html"> 39</a></span><span class="keyword">struct </span><a class="code hl_struct" href="structmlx_1_1core_1_1_print_formatter.html">PrintFormatter</a> {</div>
|
|
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"><a class="line" href="structmlx_1_1core_1_1_print_formatter.html#a79fad4cf5844db8c92b066539146281b"> 40</a></span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="structmlx_1_1core_1_1_print_formatter.html#a79fad4cf5844db8c92b066539146281b">print</a>(std::ostream& os, <span class="keywordtype">bool</span> val);</div>
|
|
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"><a class="line" href="structmlx_1_1core_1_1_print_formatter.html#a8da448a8adae671b26359341ea514316"> 41</a></span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="structmlx_1_1core_1_1_print_formatter.html#a8da448a8adae671b26359341ea514316">print</a>(std::ostream& os, int16_t val);</div>
|
|
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"><a class="line" href="structmlx_1_1core_1_1_print_formatter.html#a9d750c134a6fbfa8251c5b1d01d73287"> 42</a></span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="structmlx_1_1core_1_1_print_formatter.html#a9d750c134a6fbfa8251c5b1d01d73287">print</a>(std::ostream& os, uint16_t val);</div>
|
|
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"><a class="line" href="structmlx_1_1core_1_1_print_formatter.html#adbbb9cbff767f9db73c659a0c07ba633"> 43</a></span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="structmlx_1_1core_1_1_print_formatter.html#adbbb9cbff767f9db73c659a0c07ba633">print</a>(std::ostream& os, int32_t val);</div>
|
|
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"><a class="line" href="structmlx_1_1core_1_1_print_formatter.html#a520adb07fafd911b22bc24b295e4f6cf"> 44</a></span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="structmlx_1_1core_1_1_print_formatter.html#a520adb07fafd911b22bc24b295e4f6cf">print</a>(std::ostream& os, uint32_t val);</div>
|
|
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"><a class="line" href="structmlx_1_1core_1_1_print_formatter.html#ab0c702f1ae201e17cd328c9855cf522e"> 45</a></span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="structmlx_1_1core_1_1_print_formatter.html#ab0c702f1ae201e17cd328c9855cf522e">print</a>(std::ostream& os, int64_t val);</div>
|
|
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"><a class="line" href="structmlx_1_1core_1_1_print_formatter.html#ac59a5137ddd8b32aae057bb9826ee80d"> 46</a></span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="structmlx_1_1core_1_1_print_formatter.html#ac59a5137ddd8b32aae057bb9826ee80d">print</a>(std::ostream& os, uint64_t val);</div>
|
|
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"><a class="line" href="structmlx_1_1core_1_1_print_formatter.html#ac4b7895d1168cfc1a3d1186d8a414d2f"> 47</a></span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="structmlx_1_1core_1_1_print_formatter.html#ac4b7895d1168cfc1a3d1186d8a414d2f">print</a>(std::ostream& os, <a class="code hl_typedef" href="namespacemlx_1_1core.html#afbd2769c30e721afc85a7b9fb55b8e52">float16_t</a> val);</div>
|
|
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"><a class="line" href="structmlx_1_1core_1_1_print_formatter.html#ae21005f92bc641f2d657096f5d176a6d"> 48</a></span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="structmlx_1_1core_1_1_print_formatter.html#ae21005f92bc641f2d657096f5d176a6d">print</a>(std::ostream& os, <a class="code hl_typedef" href="namespacemlx_1_1core.html#acb5d16c9b83778c7621c38e522e0060b">bfloat16_t</a> val);</div>
|
|
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"><a class="line" href="structmlx_1_1core_1_1_print_formatter.html#a57af5c32561b95d6ac2a3a1dc4f5d43e"> 49</a></span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="structmlx_1_1core_1_1_print_formatter.html#a57af5c32561b95d6ac2a3a1dc4f5d43e">print</a>(std::ostream& os, <span class="keywordtype">float</span> val);</div>
|
|
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"><a class="line" href="structmlx_1_1core_1_1_print_formatter.html#a9e1dc67c9afb0a09966336504790823d"> 50</a></span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="structmlx_1_1core_1_1_print_formatter.html#a9e1dc67c9afb0a09966336504790823d">print</a>(std::ostream& os, <a class="code hl_struct" href="structmlx_1_1core_1_1complex64__t.html">complex64_t</a> val);</div>
|
|
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> </div>
|
|
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"><a class="line" href="structmlx_1_1core_1_1_print_formatter.html#adf49a949db36f0ba076842a6d675d79a"> 52</a></span> <span class="keywordtype">bool</span> <a class="code hl_variable" href="structmlx_1_1core_1_1_print_formatter.html#adf49a949db36f0ba076842a6d675d79a">capitalize_bool</a>{<span class="keyword">false</span>};</div>
|
|
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span>};</div>
|
|
</div>
|
|
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> </div>
|
|
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core.html#afc71e62dc5757564486cea5ebb12500e"> 55</a></span><a class="code hl_struct" href="structmlx_1_1core_1_1_print_formatter.html">PrintFormatter</a>& <a class="code hl_function" href="namespacemlx_1_1core.html#afc71e62dc5757564486cea5ebb12500e">get_global_formatter</a>();</div>
|
|
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span></div>
|
|
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core.html#ae1b6e5cfd27b1526285648686898e011"> 58</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="namespacemlx_1_1core.html#ae1b6e5cfd27b1526285648686898e011">abort_with_exception</a>(<span class="keyword">const</span> std::exception& error);</div>
|
|
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span></div>
|
|
<div class="foldopen" id="foldopen00061" data-start="{" data-end="};">
|
|
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"><a class="line" href="structmlx_1_1core_1_1finfo.html"> 61</a></span><span class="keyword">struct </span><a class="code hl_function" href="structmlx_1_1core_1_1finfo.html#a00dee158d75d12768d02a3e7b6709109">finfo</a> {</div>
|
|
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"><a class="line" href="structmlx_1_1core_1_1finfo.html#a00dee158d75d12768d02a3e7b6709109"> 62</a></span> <span class="keyword">explicit</span> <a class="code hl_function" href="structmlx_1_1core_1_1finfo.html#a00dee158d75d12768d02a3e7b6709109">finfo</a>(<a class="code hl_struct" href="structmlx_1_1core_1_1_dtype.html">Dtype</a> <a class="code hl_variable" href="structmlx_1_1core_1_1finfo.html#a4edcbcfae55c1ef3cb8e61d427ac9124">dtype</a>);</div>
|
|
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"><a class="line" href="structmlx_1_1core_1_1finfo.html#a4edcbcfae55c1ef3cb8e61d427ac9124"> 63</a></span> <a class="code hl_struct" href="structmlx_1_1core_1_1_dtype.html">Dtype</a> <a class="code hl_variable" href="structmlx_1_1core_1_1finfo.html#a4edcbcfae55c1ef3cb8e61d427ac9124">dtype</a>;</div>
|
|
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"><a class="line" href="structmlx_1_1core_1_1finfo.html#a91332dcbb502799b6cc8e1c6933c042b"> 64</a></span> <span class="keywordtype">float</span> <a class="code hl_variable" href="structmlx_1_1core_1_1finfo.html#a91332dcbb502799b6cc8e1c6933c042b">min</a>;</div>
|
|
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"><a class="line" href="structmlx_1_1core_1_1finfo.html#a9975908d99d25e9225d0c70bead0abc2"> 65</a></span> <span class="keywordtype">float</span> <a class="code hl_variable" href="structmlx_1_1core_1_1finfo.html#a9975908d99d25e9225d0c70bead0abc2">max</a>;</div>
|
|
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span>};</div>
|
|
</div>
|
|
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</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="namespacemlx_1_1core.html#a8b984eef832f757e28cd262d64a49ae7"> 69</a></span><span class="keyword">inline</span> <a class="code hl_struct" href="structmlx_1_1core_1_1_dtype.html">Dtype</a> <a class="code hl_function" href="namespacemlx_1_1core.html#a8b984eef832f757e28cd262d64a49ae7">result_type</a>(<span class="keyword">const</span> <a class="code hl_class" href="classmlx_1_1core_1_1array.html">array</a>& a, <span class="keyword">const</span> <a class="code hl_class" href="classmlx_1_1core_1_1array.html">array</a>& b) {</div>
|
|
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> <span class="keywordflow">return</span> <a class="code hl_function" href="namespacemlx_1_1core.html#a505922e54acd43114308e3bdbda0e497">promote_types</a>(a.<a class="code hl_function" href="classmlx_1_1core_1_1array.html#ae29e7d6fbfbea1e5e321a8d1ea3cfacd">dtype</a>(), b.<a class="code hl_function" href="classmlx_1_1core_1_1array.html#ae29e7d6fbfbea1e5e321a8d1ea3cfacd">dtype</a>());</div>
|
|
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span>}</div>
|
|
</div>
|
|
<div class="foldopen" id="foldopen00072" data-start="{" data-end="}">
|
|
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core.html#ac457c232f956ba802acb69c5a621633d"> 72</a></span><span class="keyword">inline</span> <a class="code hl_struct" href="structmlx_1_1core_1_1_dtype.html">Dtype</a> <a class="code hl_function" href="namespacemlx_1_1core.html#a8b984eef832f757e28cd262d64a49ae7">result_type</a>(<span class="keyword">const</span> <a class="code hl_class" href="classmlx_1_1core_1_1array.html">array</a>& a, <span class="keyword">const</span> <a class="code hl_class" href="classmlx_1_1core_1_1array.html">array</a>& b, <span class="keyword">const</span> <a class="code hl_class" href="classmlx_1_1core_1_1array.html">array</a>& c) {</div>
|
|
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> <span class="keywordflow">return</span> <a class="code hl_function" href="namespacemlx_1_1core.html#a505922e54acd43114308e3bdbda0e497">promote_types</a>(<a class="code hl_function" href="namespacemlx_1_1core.html#a8b984eef832f757e28cd262d64a49ae7">result_type</a>(a, b), c.<a class="code hl_function" href="classmlx_1_1core_1_1array.html#ae29e7d6fbfbea1e5e321a8d1ea3cfacd">dtype</a>());</div>
|
|
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span>}</div>
|
|
</div>
|
|
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core.html#aafaf24a28297428caf6d0c36c623489e"> 75</a></span><a class="code hl_struct" href="structmlx_1_1core_1_1_dtype.html">Dtype</a> <a class="code hl_function" href="namespacemlx_1_1core.html#a8b984eef832f757e28cd262d64a49ae7">result_type</a>(<span class="keyword">const</span> std::vector<array>& arrays);</div>
|
|
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> </div>
|
|
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core.html#aefa6a2ec6439e9619cafd227a1dc14ab"> 77</a></span><a class="code hl_typedef" href="namespacemlx_1_1core.html#a694e23f2d59606643728ad443d621416">Shape</a> <a class="code hl_function" href="namespacemlx_1_1core.html#aefa6a2ec6439e9619cafd227a1dc14ab">broadcast_shapes</a>(<span class="keyword">const</span> <a class="code hl_typedef" href="namespacemlx_1_1core.html#a694e23f2d59606643728ad443d621416">Shape</a>& s1, <span class="keyword">const</span> <a class="code hl_typedef" href="namespacemlx_1_1core.html#a694e23f2d59606643728ad443d621416">Shape</a>& s2);</div>
|
|
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span></div>
|
|
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core.html#a1cc130b06d9cdd03dddc74a3b1db0167"> 82</a></span><span class="keywordtype">int</span> <a class="code hl_function" href="namespacemlx_1_1core.html#a1cc130b06d9cdd03dddc74a3b1db0167">normalize_axis_index</a>(</div>
|
|
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> <span class="keywordtype">int</span> axis,</div>
|
|
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> <span class="keywordtype">int</span> ndim,</div>
|
|
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> <span class="keyword">const</span> std::string& msg_prefix = <span class="stringliteral">""</span>);</div>
|
|
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> </div>
|
|
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core.html#a1e5c30e316afa30c14bc48b92afdb794"> 87</a></span>std::ostream& <a class="code hl_function" href="group__ops.html#gad656c30f9fd7d9467e405657b325aa7e">operator<<</a>(std::ostream& os, <span class="keyword">const</span> <a class="code hl_struct" href="structmlx_1_1core_1_1_device.html">Device</a>& d);</div>
|
|
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core.html#a4ddd07021b36c848d6fb1dd9ac276822"> 88</a></span>std::ostream& <a class="code hl_function" href="group__ops.html#gad656c30f9fd7d9467e405657b325aa7e">operator<<</a>(std::ostream& os, <span class="keyword">const</span> <a class="code hl_struct" href="structmlx_1_1core_1_1_stream.html">Stream</a>& s);</div>
|
|
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core.html#a0023c267cf81345fad65e7a797954cd3"> 89</a></span>std::ostream& <a class="code hl_function" href="group__ops.html#gad656c30f9fd7d9467e405657b325aa7e">operator<<</a>(std::ostream& os, <span class="keyword">const</span> <a class="code hl_struct" href="structmlx_1_1core_1_1_dtype.html">Dtype</a>& d);</div>
|
|
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core.html#a1fd58658474fb842d648dcf8f7d9f078"> 90</a></span>std::ostream& <a class="code hl_function" href="group__ops.html#gad656c30f9fd7d9467e405657b325aa7e">operator<<</a>(std::ostream& os, <span class="keyword">const</span> <a class="code hl_enumeration" href="structmlx_1_1core_1_1_dtype.html#adb1ea8b45a0c53e04a0e73b168702715">Dtype::Kind</a>& k);</div>
|
|
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core.html#a123331f01188bd76e37623b63b6b4340"> 91</a></span>std::ostream& <a class="code hl_function" href="group__ops.html#gad656c30f9fd7d9467e405657b325aa7e">operator<<</a>(std::ostream& os, <a class="code hl_class" href="classmlx_1_1core_1_1array.html">array</a> a);</div>
|
|
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core.html#a4e733bba89760abed32393e085812b22"> 92</a></span>std::ostream& <a class="code hl_function" href="group__ops.html#gad656c30f9fd7d9467e405657b325aa7e">operator<<</a>(std::ostream& os, <span class="keyword">const</span> std::vector<int>& v);</div>
|
|
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core.html#a5e5bd5c57b1cf19776bdb41e732861d9"> 93</a></span>std::ostream& <a class="code hl_function" href="group__ops.html#gad656c30f9fd7d9467e405657b325aa7e">operator<<</a>(std::ostream& os, <span class="keyword">const</span> std::vector<int64_t>& v);</div>
|
|
<div class="foldopen" id="foldopen00094" data-start="{" data-end="}">
|
|
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core.html#a42a19c8442b173606e714364227e7d45"> 94</a></span><span class="keyword">inline</span> std::ostream& <a class="code hl_function" href="group__ops.html#gad656c30f9fd7d9467e405657b325aa7e">operator<<</a>(std::ostream& os, <span class="keyword">const</span> <a class="code hl_struct" href="structmlx_1_1core_1_1complex64__t.html">complex64_t</a>& v) {</div>
|
|
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> <span class="keywordflow">return</span> os << v.real() << (v.imag() >= 0 ? <span class="stringliteral">"+"</span> : <span class="stringliteral">""</span>) << v.imag() << <span class="stringliteral">"j"</span>;</div>
|
|
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span>}</div>
|
|
</div>
|
|
<div class="foldopen" id="foldopen00097" data-start="{" data-end="}">
|
|
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core.html#a57eb97a5eba99a846ac429795e407574"> 97</a></span><span class="keyword">inline</span> std::ostream& <a class="code hl_function" href="group__ops.html#gad656c30f9fd7d9467e405657b325aa7e">operator<<</a>(std::ostream& os, <span class="keyword">const</span> <a class="code hl_typedef" href="namespacemlx_1_1core.html#afbd2769c30e721afc85a7b9fb55b8e52">float16_t</a>& v) {</div>
|
|
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> <span class="keywordflow">return</span> os << static_cast<float>(v);</div>
|
|
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span>}</div>
|
|
</div>
|
|
<div class="foldopen" id="foldopen00100" data-start="{" data-end="}">
|
|
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core.html#a7db909d54cf07375e89424c32c07a29c"> 100</a></span><span class="keyword">inline</span> std::ostream& <a class="code hl_function" href="group__ops.html#gad656c30f9fd7d9467e405657b325aa7e">operator<<</a>(std::ostream& os, <span class="keyword">const</span> <a class="code hl_typedef" href="namespacemlx_1_1core.html#acb5d16c9b83778c7621c38e522e0060b">bfloat16_t</a>& v) {</div>
|
|
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> <span class="keywordflow">return</span> os << static_cast<float>(v);</div>
|
|
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span>}</div>
|
|
</div>
|
|
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> </div>
|
|
<div class="foldopen" id="foldopen00104" data-start="{" data-end="}">
|
|
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core.html#adacbc4526e8964b267a8ec3eb1bc1a32"> 104</a></span><span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code hl_function" href="namespacemlx_1_1core.html#adacbc4526e8964b267a8ec3eb1bc1a32">is_power_of_2</a>(<span class="keywordtype">int</span> n) {</div>
|
|
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> <span class="keywordflow">return</span> ((n & (n - 1)) == 0) && n != 0;</div>
|
|
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span>}</div>
|
|
</div>
|
|
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> </div>
|
|
<div class="foldopen" id="foldopen00108" data-start="{" data-end="}">
|
|
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core.html#a685c0530e338aabc622325685846ce93"> 108</a></span><span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code hl_function" href="namespacemlx_1_1core.html#a685c0530e338aabc622325685846ce93">next_power_of_2</a>(<span class="keywordtype">int</span> n) {</div>
|
|
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> <span class="keywordflow">if</span> (<a class="code hl_function" href="namespacemlx_1_1core.html#adacbc4526e8964b267a8ec3eb1bc1a32">is_power_of_2</a>(n)) {</div>
|
|
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> <span class="keywordflow">return</span> n;</div>
|
|
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span> }</div>
|
|
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> <span class="keywordflow">return</span> pow(2, std::ceil(std::log2(n)));</div>
|
|
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span>}</div>
|
|
</div>
|
|
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> </div>
|
|
<div class="foldopen" id="foldopen00115" data-start="{" data-end="}">
|
|
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core_1_1env.html"> 115</a></span><span class="keyword">namespace </span><a class="code hl_namespace" href="namespacemlx_1_1core_1_1env.html">env</a> {</div>
|
|
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> </div>
|
|
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core_1_1env.html#a0efecbf9efe695adafad12b5a4945df3"> 117</a></span><span class="keywordtype">int</span> <a class="code hl_function" href="namespacemlx_1_1core_1_1env.html#a0efecbf9efe695adafad12b5a4945df3">get_var</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* name, <span class="keywordtype">int</span> default_value);</div>
|
|
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span> </div>
|
|
<div class="foldopen" id="foldopen00119" data-start="{" data-end="}">
|
|
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core_1_1env.html#ac3266e1259a64c8b56bdc6c7029179f2"> 119</a></span><span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code hl_function" href="namespacemlx_1_1core_1_1env.html#ac3266e1259a64c8b56bdc6c7029179f2">bfs_max_width</a>() {</div>
|
|
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> <span class="keyword">static</span> <span class="keywordtype">int</span> bfs_max_width_ = <a class="code hl_function" href="namespacemlx_1_1core_1_1env.html#a0efecbf9efe695adafad12b5a4945df3">get_var</a>(<span class="stringliteral">"MLX_BFS_MAX_WIDTH"</span>, 20);</div>
|
|
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span> <span class="keywordflow">return</span> bfs_max_width_;</div>
|
|
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span>}</div>
|
|
</div>
|
|
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> </div>
|
|
<div class="foldopen" id="foldopen00124" data-start="{" data-end="}">
|
|
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core_1_1env.html#aedbf4e739553024c33dd0094dd9107aa"> 124</a></span><span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code hl_function" href="namespacemlx_1_1core_1_1env.html#aedbf4e739553024c33dd0094dd9107aa">max_ops_per_buffer</a>() {</div>
|
|
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> <span class="keyword">static</span> <span class="keywordtype">int</span> max_ops_per_buffer_ = <a class="code hl_function" href="namespacemlx_1_1core_1_1env.html#a0efecbf9efe695adafad12b5a4945df3">get_var</a>(<span class="stringliteral">"MLX_MAX_OPS_PER_BUFFER"</span>, 10);</div>
|
|
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span> <span class="keywordflow">return</span> max_ops_per_buffer_;</div>
|
|
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span>}</div>
|
|
</div>
|
|
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span> </div>
|
|
<div class="foldopen" id="foldopen00129" data-start="{" data-end="}">
|
|
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"><a class="line" href="namespacemlx_1_1core_1_1env.html#afa1ecf087fe0c633d5460ddb2c31c945"> 129</a></span><span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code hl_function" href="namespacemlx_1_1core_1_1env.html#afa1ecf087fe0c633d5460ddb2c31c945">metal_fast_synch</a>() {</div>
|
|
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span> <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code hl_function" href="namespacemlx_1_1core_1_1env.html#afa1ecf087fe0c633d5460ddb2c31c945">metal_fast_synch</a> = <a class="code hl_function" href="namespacemlx_1_1core_1_1env.html#a0efecbf9efe695adafad12b5a4945df3">get_var</a>(<span class="stringliteral">"MLX_METAL_FAST_SYNCH"</span>, 0);</div>
|
|
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span> <span class="keywordflow">return</span> <a class="code hl_function" href="namespacemlx_1_1core_1_1env.html#afa1ecf087fe0c633d5460ddb2c31c945">metal_fast_synch</a>;</div>
|
|
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"> 132</span>}</div>
|
|
</div>
|
|
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span> </div>
|
|
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno"> 134</span>} <span class="comment">// namespace env</span></div>
|
|
</div>
|
|
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno"> 135</span> </div>
|
|
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno"> 136</span>} <span class="comment">// namespace mlx::core</span></div>
|
|
<div class="ttc" id="aarray_8h_html"><div class="ttname"><a href="array_8h.html">array.h</a></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:24</div></div>
|
|
<div class="ttc" id="aclassmlx_1_1core_1_1array_html_ae29e7d6fbfbea1e5e321a8d1ea3cfacd"><div class="ttname"><a href="classmlx_1_1core_1_1array.html#ae29e7d6fbfbea1e5e321a8d1ea3cfacd">mlx::core::array::dtype</a></div><div class="ttdeci">Dtype dtype() const</div><div class="ttdoc">Get the arrays data type.</div><div class="ttdef"><b>Definition</b> array.h:131</div></div>
|
|
<div class="ttc" id="adevice_8h_html"><div class="ttname"><a href="device_8h.html">device.h</a></div></div>
|
|
<div class="ttc" id="adtype_8h_html"><div class="ttname"><a href="dtype_8h.html">dtype.h</a></div></div>
|
|
<div class="ttc" id="agroup__ops_html_gad656c30f9fd7d9467e405657b325aa7e"><div class="ttname"><a href="group__ops.html#gad656c30f9fd7d9467e405657b325aa7e">mlx::core::operator<<</a></div><div class="ttdeci">array operator<<(const array &a, const array &b)</div></div>
|
|
<div class="ttc" id="anamespacemlx_1_1core_1_1env_html"><div class="ttname"><a href="namespacemlx_1_1core_1_1env.html">mlx::core::env</a></div><div class="ttdef"><b>Definition</b> utils.h:115</div></div>
|
|
<div class="ttc" id="anamespacemlx_1_1core_1_1env_html_a0efecbf9efe695adafad12b5a4945df3"><div class="ttname"><a href="namespacemlx_1_1core_1_1env.html#a0efecbf9efe695adafad12b5a4945df3">mlx::core::env::get_var</a></div><div class="ttdeci">int get_var(const char *name, int default_value)</div></div>
|
|
<div class="ttc" id="anamespacemlx_1_1core_1_1env_html_ac3266e1259a64c8b56bdc6c7029179f2"><div class="ttname"><a href="namespacemlx_1_1core_1_1env.html#ac3266e1259a64c8b56bdc6c7029179f2">mlx::core::env::bfs_max_width</a></div><div class="ttdeci">int bfs_max_width()</div><div class="ttdef"><b>Definition</b> utils.h:119</div></div>
|
|
<div class="ttc" id="anamespacemlx_1_1core_1_1env_html_aedbf4e739553024c33dd0094dd9107aa"><div class="ttname"><a href="namespacemlx_1_1core_1_1env.html#aedbf4e739553024c33dd0094dd9107aa">mlx::core::env::max_ops_per_buffer</a></div><div class="ttdeci">int max_ops_per_buffer()</div><div class="ttdef"><b>Definition</b> utils.h:124</div></div>
|
|
<div class="ttc" id="anamespacemlx_1_1core_1_1env_html_afa1ecf087fe0c633d5460ddb2c31c945"><div class="ttname"><a href="namespacemlx_1_1core_1_1env.html#afa1ecf087fe0c633d5460ddb2c31c945">mlx::core::env::metal_fast_synch</a></div><div class="ttdeci">bool metal_fast_synch()</div><div class="ttdef"><b>Definition</b> utils.h:129</div></div>
|
|
<div class="ttc" id="anamespacemlx_1_1core_html"><div class="ttname"><a href="namespacemlx_1_1core.html">mlx::core</a></div><div class="ttdef"><b>Definition</b> allocator.h:7</div></div>
|
|
<div class="ttc" id="anamespacemlx_1_1core_html_a0196171cfe6ee2953113abce597dc815"><div class="ttname"><a href="namespacemlx_1_1core.html#a0196171cfe6ee2953113abce597dc815">mlx::core::default_device</a></div><div class="ttdeci">const Device & default_device()</div></div>
|
|
<div class="ttc" id="anamespacemlx_1_1core_html_a1cc130b06d9cdd03dddc74a3b1db0167"><div class="ttname"><a href="namespacemlx_1_1core.html#a1cc130b06d9cdd03dddc74a3b1db0167">mlx::core::normalize_axis_index</a></div><div class="ttdeci">int normalize_axis_index(int axis, int ndim, const std::string &msg_prefix="")</div><div class="ttdoc">Returns the axis normalized to be in the range [0, ndim).</div></div>
|
|
<div class="ttc" id="anamespacemlx_1_1core_html_a312a2de41367fe52caeaf8c0f596a120"><div class="ttname"><a href="namespacemlx_1_1core.html#a312a2de41367fe52caeaf8c0f596a120">mlx::core::set_default_device</a></div><div class="ttdeci">void set_default_device(const Device &d)</div></div>
|
|
<div class="ttc" id="anamespacemlx_1_1core_html_a4734a596e57434492ddfe79f2cb9dbf9"><div class="ttname"><a href="namespacemlx_1_1core.html#a4734a596e57434492ddfe79f2cb9dbf9">mlx::core::to_stream</a></div><div class="ttdeci">Stream to_stream(StreamOrDevice s)</div></div>
|
|
<div class="ttc" id="anamespacemlx_1_1core_html_a505922e54acd43114308e3bdbda0e497"><div class="ttname"><a href="namespacemlx_1_1core.html#a505922e54acd43114308e3bdbda0e497">mlx::core::promote_types</a></div><div class="ttdeci">Dtype promote_types(const Dtype &t1, const Dtype &t2)</div></div>
|
|
<div class="ttc" id="anamespacemlx_1_1core_html_a685c0530e338aabc622325685846ce93"><div class="ttname"><a href="namespacemlx_1_1core.html#a685c0530e338aabc622325685846ce93">mlx::core::next_power_of_2</a></div><div class="ttdeci">int next_power_of_2(int n)</div><div class="ttdef"><b>Definition</b> utils.h:108</div></div>
|
|
<div class="ttc" id="anamespacemlx_1_1core_html_a694e23f2d59606643728ad443d621416"><div class="ttname"><a href="namespacemlx_1_1core.html#a694e23f2d59606643728ad443d621416">mlx::core::Shape</a></div><div class="ttdeci">std::vector< ShapeElem > Shape</div><div class="ttdef"><b>Definition</b> array.h:21</div></div>
|
|
<div class="ttc" id="anamespacemlx_1_1core_html_a8b984eef832f757e28cd262d64a49ae7"><div class="ttname"><a href="namespacemlx_1_1core.html#a8b984eef832f757e28cd262d64a49ae7">mlx::core::result_type</a></div><div class="ttdeci">Dtype result_type(const array &a, const array &b)</div><div class="ttdoc">The type from promoting the arrays' types with one another.</div><div class="ttdef"><b>Definition</b> utils.h:69</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< std::monostate, Stream, Device > StreamOrDevice</div><div class="ttdef"><b>Definition</b> utils.h:15</div></div>
|
|
<div class="ttc" id="anamespacemlx_1_1core_html_ac198b7e282957c724c84a435e8f1215e"><div class="ttname"><a href="namespacemlx_1_1core.html#ac198b7e282957c724c84a435e8f1215e">mlx::core::default_stream</a></div><div class="ttdeci">Stream default_stream(Device d)</div><div class="ttdoc">Get the default stream for the given device.</div></div>
|
|
<div class="ttc" id="anamespacemlx_1_1core_html_acb5d16c9b83778c7621c38e522e0060b"><div class="ttname"><a href="namespacemlx_1_1core.html#acb5d16c9b83778c7621c38e522e0060b">mlx::core::bfloat16_t</a></div><div class="ttdeci">struct _MLX_BFloat16 bfloat16_t</div><div class="ttdef"><b>Definition</b> half_types.h:34</div></div>
|
|
<div class="ttc" id="anamespacemlx_1_1core_html_adacbc4526e8964b267a8ec3eb1bc1a32"><div class="ttname"><a href="namespacemlx_1_1core.html#adacbc4526e8964b267a8ec3eb1bc1a32">mlx::core::is_power_of_2</a></div><div class="ttdeci">bool is_power_of_2(int n)</div><div class="ttdef"><b>Definition</b> utils.h:104</div></div>
|
|
<div class="ttc" id="anamespacemlx_1_1core_html_ae1b6e5cfd27b1526285648686898e011"><div class="ttname"><a href="namespacemlx_1_1core.html#ae1b6e5cfd27b1526285648686898e011">mlx::core::abort_with_exception</a></div><div class="ttdeci">void abort_with_exception(const std::exception &error)</div><div class="ttdoc">Print the exception and then abort.</div></div>
|
|
<div class="ttc" id="anamespacemlx_1_1core_html_aefa6a2ec6439e9619cafd227a1dc14ab"><div class="ttname"><a href="namespacemlx_1_1core.html#aefa6a2ec6439e9619cafd227a1dc14ab">mlx::core::broadcast_shapes</a></div><div class="ttdeci">Shape broadcast_shapes(const Shape &s1, const Shape &s2)</div></div>
|
|
<div class="ttc" id="anamespacemlx_1_1core_html_af35a2b06517d8bb7dbb469692b4f841c"><div class="ttname"><a href="namespacemlx_1_1core.html#af35a2b06517d8bb7dbb469692b4f841c">mlx::core::set_default_stream</a></div><div class="ttdeci">void set_default_stream(Stream s)</div><div class="ttdoc">Make the stream the default for its device.</div></div>
|
|
<div class="ttc" id="anamespacemlx_1_1core_html_afbd2769c30e721afc85a7b9fb55b8e52"><div class="ttname"><a href="namespacemlx_1_1core.html#afbd2769c30e721afc85a7b9fb55b8e52">mlx::core::float16_t</a></div><div class="ttdeci">struct _MLX_Float16 float16_t</div><div class="ttdef"><b>Definition</b> half_types.h:17</div></div>
|
|
<div class="ttc" id="anamespacemlx_1_1core_html_afc71e62dc5757564486cea5ebb12500e"><div class="ttname"><a href="namespacemlx_1_1core.html#afc71e62dc5757564486cea5ebb12500e">mlx::core::get_global_formatter</a></div><div class="ttdeci">PrintFormatter & get_global_formatter()</div></div>
|
|
<div class="ttc" id="astream_8h_html"><div class="ttname"><a href="stream_8h.html">stream.h</a></div></div>
|
|
<div class="ttc" id="astructmlx_1_1core_1_1_device_html"><div class="ttname"><a href="structmlx_1_1core_1_1_device.html">mlx::core::Device</a></div><div class="ttdef"><b>Definition</b> device.h:7</div></div>
|
|
<div class="ttc" id="astructmlx_1_1core_1_1_dtype_html"><div class="ttname"><a href="structmlx_1_1core_1_1_dtype.html">mlx::core::Dtype</a></div><div class="ttdef"><b>Definition</b> dtype.h:13</div></div>
|
|
<div class="ttc" id="astructmlx_1_1core_1_1_dtype_html_adb1ea8b45a0c53e04a0e73b168702715"><div class="ttname"><a href="structmlx_1_1core_1_1_dtype.html#adb1ea8b45a0c53e04a0e73b168702715">mlx::core::Dtype::Kind</a></div><div class="ttdeci">Kind</div><div class="ttdef"><b>Definition</b> dtype.h:30</div></div>
|
|
<div class="ttc" id="astructmlx_1_1core_1_1_print_formatter_html"><div class="ttname"><a href="structmlx_1_1core_1_1_print_formatter.html">mlx::core::PrintFormatter</a></div><div class="ttdef"><b>Definition</b> utils.h:39</div></div>
|
|
<div class="ttc" id="astructmlx_1_1core_1_1_print_formatter_html_a520adb07fafd911b22bc24b295e4f6cf"><div class="ttname"><a href="structmlx_1_1core_1_1_print_formatter.html#a520adb07fafd911b22bc24b295e4f6cf">mlx::core::PrintFormatter::print</a></div><div class="ttdeci">void print(std::ostream &os, uint32_t val)</div></div>
|
|
<div class="ttc" id="astructmlx_1_1core_1_1_print_formatter_html_a57af5c32561b95d6ac2a3a1dc4f5d43e"><div class="ttname"><a href="structmlx_1_1core_1_1_print_formatter.html#a57af5c32561b95d6ac2a3a1dc4f5d43e">mlx::core::PrintFormatter::print</a></div><div class="ttdeci">void print(std::ostream &os, float val)</div></div>
|
|
<div class="ttc" id="astructmlx_1_1core_1_1_print_formatter_html_a79fad4cf5844db8c92b066539146281b"><div class="ttname"><a href="structmlx_1_1core_1_1_print_formatter.html#a79fad4cf5844db8c92b066539146281b">mlx::core::PrintFormatter::print</a></div><div class="ttdeci">void print(std::ostream &os, bool val)</div></div>
|
|
<div class="ttc" id="astructmlx_1_1core_1_1_print_formatter_html_a8da448a8adae671b26359341ea514316"><div class="ttname"><a href="structmlx_1_1core_1_1_print_formatter.html#a8da448a8adae671b26359341ea514316">mlx::core::PrintFormatter::print</a></div><div class="ttdeci">void print(std::ostream &os, int16_t val)</div></div>
|
|
<div class="ttc" id="astructmlx_1_1core_1_1_print_formatter_html_a9d750c134a6fbfa8251c5b1d01d73287"><div class="ttname"><a href="structmlx_1_1core_1_1_print_formatter.html#a9d750c134a6fbfa8251c5b1d01d73287">mlx::core::PrintFormatter::print</a></div><div class="ttdeci">void print(std::ostream &os, uint16_t val)</div></div>
|
|
<div class="ttc" id="astructmlx_1_1core_1_1_print_formatter_html_a9e1dc67c9afb0a09966336504790823d"><div class="ttname"><a href="structmlx_1_1core_1_1_print_formatter.html#a9e1dc67c9afb0a09966336504790823d">mlx::core::PrintFormatter::print</a></div><div class="ttdeci">void print(std::ostream &os, complex64_t val)</div></div>
|
|
<div class="ttc" id="astructmlx_1_1core_1_1_print_formatter_html_ab0c702f1ae201e17cd328c9855cf522e"><div class="ttname"><a href="structmlx_1_1core_1_1_print_formatter.html#ab0c702f1ae201e17cd328c9855cf522e">mlx::core::PrintFormatter::print</a></div><div class="ttdeci">void print(std::ostream &os, int64_t val)</div></div>
|
|
<div class="ttc" id="astructmlx_1_1core_1_1_print_formatter_html_ac4b7895d1168cfc1a3d1186d8a414d2f"><div class="ttname"><a href="structmlx_1_1core_1_1_print_formatter.html#ac4b7895d1168cfc1a3d1186d8a414d2f">mlx::core::PrintFormatter::print</a></div><div class="ttdeci">void print(std::ostream &os, float16_t val)</div></div>
|
|
<div class="ttc" id="astructmlx_1_1core_1_1_print_formatter_html_ac59a5137ddd8b32aae057bb9826ee80d"><div class="ttname"><a href="structmlx_1_1core_1_1_print_formatter.html#ac59a5137ddd8b32aae057bb9826ee80d">mlx::core::PrintFormatter::print</a></div><div class="ttdeci">void print(std::ostream &os, uint64_t val)</div></div>
|
|
<div class="ttc" id="astructmlx_1_1core_1_1_print_formatter_html_adbbb9cbff767f9db73c659a0c07ba633"><div class="ttname"><a href="structmlx_1_1core_1_1_print_formatter.html#adbbb9cbff767f9db73c659a0c07ba633">mlx::core::PrintFormatter::print</a></div><div class="ttdeci">void print(std::ostream &os, int32_t val)</div></div>
|
|
<div class="ttc" id="astructmlx_1_1core_1_1_print_formatter_html_adf49a949db36f0ba076842a6d675d79a"><div class="ttname"><a href="structmlx_1_1core_1_1_print_formatter.html#adf49a949db36f0ba076842a6d675d79a">mlx::core::PrintFormatter::capitalize_bool</a></div><div class="ttdeci">bool capitalize_bool</div><div class="ttdef"><b>Definition</b> utils.h:52</div></div>
|
|
<div class="ttc" id="astructmlx_1_1core_1_1_print_formatter_html_ae21005f92bc641f2d657096f5d176a6d"><div class="ttname"><a href="structmlx_1_1core_1_1_print_formatter.html#ae21005f92bc641f2d657096f5d176a6d">mlx::core::PrintFormatter::print</a></div><div class="ttdeci">void print(std::ostream &os, bfloat16_t val)</div></div>
|
|
<div class="ttc" id="astructmlx_1_1core_1_1_stream_context_html_a89d803151e9d7dce29382aa83d5c6ef1"><div class="ttname"><a href="structmlx_1_1core_1_1_stream_context.html#a89d803151e9d7dce29382aa83d5c6ef1">mlx::core::StreamContext::StreamContext</a></div><div class="ttdeci">StreamContext(StreamOrDevice s)</div><div class="ttdef"><b>Definition</b> utils.h:20</div></div>
|
|
<div class="ttc" id="astructmlx_1_1core_1_1_stream_context_html_ac5be1c576d22b3d0b0a6fcc7e6abe659"><div class="ttname"><a href="structmlx_1_1core_1_1_stream_context.html#ac5be1c576d22b3d0b0a6fcc7e6abe659">mlx::core::StreamContext::~StreamContext</a></div><div class="ttdeci">~StreamContext()</div><div class="ttdef"><b>Definition</b> utils.h:30</div></div>
|
|
<div class="ttc" id="astructmlx_1_1core_1_1_stream_html"><div class="ttname"><a href="structmlx_1_1core_1_1_stream.html">mlx::core::Stream</a></div><div class="ttdef"><b>Definition</b> stream.h:9</div></div>
|
|
<div class="ttc" id="astructmlx_1_1core_1_1complex64__t_html"><div class="ttname"><a href="structmlx_1_1core_1_1complex64__t.html">mlx::core::complex64_t</a></div><div class="ttdef"><b>Definition</b> complex.h:35</div></div>
|
|
<div class="ttc" id="astructmlx_1_1core_1_1finfo_html_a00dee158d75d12768d02a3e7b6709109"><div class="ttname"><a href="structmlx_1_1core_1_1finfo.html#a00dee158d75d12768d02a3e7b6709109">mlx::core::finfo::finfo</a></div><div class="ttdeci">finfo(Dtype dtype)</div></div>
|
|
<div class="ttc" id="astructmlx_1_1core_1_1finfo_html_a4edcbcfae55c1ef3cb8e61d427ac9124"><div class="ttname"><a href="structmlx_1_1core_1_1finfo.html#a4edcbcfae55c1ef3cb8e61d427ac9124">mlx::core::finfo::dtype</a></div><div class="ttdeci">Dtype dtype</div><div class="ttdef"><b>Definition</b> utils.h:63</div></div>
|
|
<div class="ttc" id="astructmlx_1_1core_1_1finfo_html_a91332dcbb502799b6cc8e1c6933c042b"><div class="ttname"><a href="structmlx_1_1core_1_1finfo.html#a91332dcbb502799b6cc8e1c6933c042b">mlx::core::finfo::min</a></div><div class="ttdeci">float min</div><div class="ttdef"><b>Definition</b> utils.h:64</div></div>
|
|
<div class="ttc" id="astructmlx_1_1core_1_1finfo_html_a9975908d99d25e9225d0c70bead0abc2"><div class="ttname"><a href="structmlx_1_1core_1_1finfo.html#a9975908d99d25e9225d0c70bead0abc2">mlx::core::finfo::max</a></div><div class="ttdeci">float max</div><div class="ttdef"><b>Definition</b> utils.h:65</div></div>
|
|
</div><!-- fragment --></div><!-- contents -->
|
|
</div><!-- doc-content -->
|
|
<!-- 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="utils_8h.html">utils.h</a></li>
|
|
<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>
|
|
</ul>
|
|
</div>
|
|
</body>
|
|
</html>
|