-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Documenter.jl
committed
Sep 3, 2024
1 parent
68495b5
commit 607ab28
Showing
27 changed files
with
1,427 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"documenter":{"julia_version":"1.10.5","generation_timestamp":"2024-09-03T11:36:01","documenter_version":"1.5.0"}} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Compiler · Metal.jl</title><meta name="title" content="Compiler · Metal.jl"/><meta property="og:title" content="Compiler · Metal.jl"/><meta property="twitter:title" content="Compiler · Metal.jl"/><meta name="description" content="Documentation for Metal.jl."/><meta property="og:description" content="Documentation for Metal.jl."/><meta property="twitter:description" content="Documentation for Metal.jl."/><meta property="og:url" content="https://metal.juliagpu.org/stable/api/compiler/"/><meta property="twitter:url" content="https://metal.juliagpu.org/stable/api/compiler/"/><link rel="canonical" href="https://metal.juliagpu.org/stable/api/compiler/"/><script data-outdated-warner src="../../assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="../.."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../../assets/documenter.js"></script><script src="../../search_index.js"></script><script src="../../siteinfo.js"></script><script src="../../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/catppuccin-mocha.css" data-theme-name="catppuccin-mocha"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/catppuccin-macchiato.css" data-theme-name="catppuccin-macchiato"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/catppuccin-frappe.css" data-theme-name="catppuccin-frappe"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/catppuccin-latte.css" data-theme-name="catppuccin-latte"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../../assets/themeswap.js"></script><link href="../../assets/favicon.ico" rel="icon" type="image/x-icon"/></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="../../"><img src="../../assets/logo.png" alt="Metal.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="../../">Metal.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="../../">Home</a></li><li><span class="tocitem">Usage</span><ul><li><a class="tocitem" href="../../usage/overview/">Overview</a></li><li><a class="tocitem" href="../../usage/array/">Array programming</a></li><li><a class="tocitem" href="../../usage/kernel/">Kernel programming</a></li></ul></li><li><a class="tocitem" href="../../profiling/">Profiling</a></li><li><span class="tocitem">API reference</span><ul><li><a class="tocitem" href="../essentials/">Essentials</a></li><li class="is-active"><a class="tocitem" href>Compiler</a><ul class="internal"><li><a class="tocitem" href="#Execution"><span>Execution</span></a></li><li><a class="tocitem" href="#Reflection"><span>Reflection</span></a></li></ul></li><li><a class="tocitem" href="../kernel/">Kernel programming</a></li><li><a class="tocitem" href="../array/">Array programming</a></li><li><a class="tocitem" href="../mps/">Metal Performance Shaders</a></li></ul></li><li><span class="tocitem">FAQ</span><ul><li><a class="tocitem" href="../../faq/faq/">Frequently Asked Questions</a></li><li><a class="tocitem" href="../../faq/contributing/">Contributing</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">API reference</a></li><li class="is-active"><a href>Compiler</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Compiler</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/JuliaGPU/Metal.jl/blob/main/docs/src/api/compiler.md#" title="Edit source on GitHub"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Compiler"><a class="docs-heading-anchor" href="#Compiler">Compiler</a><a id="Compiler-1"></a><a class="docs-heading-anchor-permalink" href="#Compiler" title="Permalink"></a></h1><h2 id="Execution"><a class="docs-heading-anchor" href="#Execution">Execution</a><a id="Execution-1"></a><a class="docs-heading-anchor-permalink" href="#Execution" title="Permalink"></a></h2><p>The main entry-point to the compiler is the <code>@metal</code> macro:</p><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Metal.@metal" href="#Metal.@metal"><code>Metal.@metal</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@metal threads=... groups=... [kwargs...] func(args...)</code></pre><p>High-level interface for executing code on a GPU.</p><p>The <code>@metal</code> macro should prefix a call, with <code>func</code> a callable function or object that should return nothing. It will be compiled to a Metal function upon first use, and to a certain extent arguments will be converted and managed automatically using <code>mtlconvert</code>. Finally, a call to <code>mtlcall</code> is performed, creating a command buffer in the current global command queue then committing it.</p><p>There is one supported keyword argument that influences the behavior of <code>@metal</code>:</p><ul><li><code>launch</code>: whether to launch this kernel, defaults to <code>true</code>. If <code>false</code> the returned kernel object should be launched by calling it and passing arguments again.</li><li><code>name</code>: the name of the kernel in the generated code. Defaults to an automatically- generated name.</li><li><code>queue</code>: the command queue to use for this kernel. Defaults to the global command queue.</li></ul></div><a class="docs-sourcelink" target="_blank" href="https://github.com/JuliaGPU/Metal.jl/blob/4db289f712c0d0769487a21b8eba6a6bcc273272/src/compiler/execution.jl#L10-L28">source</a></section></article><p>If needed, you can use a lower-level API that lets you inspect the compiler kernel:</p><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Metal.mtlconvert" href="#Metal.mtlconvert"><code>Metal.mtlconvert</code></a> — <span class="docstring-category">Function</span></header><section><div><p>mtlconvert(x, [cce])</p><p>This function is called for every argument to be passed to a kernel, allowing it to be converted to a GPU-friendly format. By default, the function does nothing and returns the input object <code>x</code> as-is.</p><p>Do not add methods to this function, but instead extend the underlying Adapt.jl package and register methods for the the <code>Metal.Adaptor</code> type.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/JuliaGPU/Metal.jl/blob/4db289f712c0d0769487a21b8eba6a6bcc273272/src/compiler/execution.jl#L146-L155">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Metal.mtlfunction" href="#Metal.mtlfunction"><code>Metal.mtlfunction</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">mtlfunction(f, tt=Tuple{}; kwargs...)</code></pre><p>Low-level interface to compile a function invocation for the currently-active GPU, returning a callable kernel object. For a higher-level interface, use <a href="#Metal.@metal"><code>@metal</code></a>.</p><p>The output of this function is automatically cached, i.e. you can simply call <code>mtlfunction</code> in a hot path without degrading performance. New code will be generated automatically when the function changes, or when different types or keyword arguments are provided.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/JuliaGPU/Metal.jl/blob/4db289f712c0d0769487a21b8eba6a6bcc273272/src/compiler/execution.jl#L168-L177">source</a></section></article><h2 id="Reflection"><a class="docs-heading-anchor" href="#Reflection">Reflection</a><a id="Reflection-1"></a><a class="docs-heading-anchor-permalink" href="#Reflection" title="Permalink"></a></h2><p>If you want to inspect generated code, you can use macros that resemble functionality from the InteractiveUtils standard library:</p><pre><code class="nohighlight hljs">@device_code_lowered | ||
@device_code_typed | ||
@device_code_warntype | ||
@device_code_llvm | ||
@device_code_native | ||
@device_code_agx | ||
@device_code</code></pre><p>For more information, please consult the GPUCompiler.jl documentation. <code>code_agx</code> is actually <code>code_native</code>:</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../essentials/">« Essentials</a><a class="docs-footer-nextpage" href="../kernel/">Kernel programming »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.5.0 on <span class="colophon-date" title="Tuesday 3 September 2024 11:36">Tuesday 3 September 2024</span>. Using Julia version 1.10.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> |
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.