diff --git a/docs/Project.toml b/docs/Project.toml index 9d0c7ba803..1452a831b2 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,14 +1,13 @@ [deps] Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" DocumenterVitepress = "4710194d-e776-4893-9690-8d956a29c365" -Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306" Reactant = "3c362404-f566-11ee-1572-e11a4b42c853" ReactantCore = "a3311ec8-5e00-46d5-b541-4f83e724a433" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" -[compat] -Documenter = "1.4.1" - [sources] Reactant = {path = ".."} ReactantCore = {path = "../lib/ReactantCore"} + +[compat] +Documenter = "1.4.1" diff --git a/docs/make.jl b/docs/make.jl index 1aa45822c8..9a0888067b 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -3,59 +3,6 @@ using Documenter, DocumenterVitepress DocMeta.setdocmeta!(Reactant, :DocTestSetup, :(using Reactant); recursive=true) -# Helper functions -function first_letter_uppercase(str) - return uppercase(str[1]) * str[2:end] -end - -# Generate examples - -using Literate - -const EXAMPLES_DIR = joinpath(@__DIR__, "..", "examples") -const OUTPUT_DIR = joinpath(@__DIR__, "src/generated") - -examples = Pair{String,String}[] - -for (_, name) in examples - example_filepath = joinpath(EXAMPLES_DIR, string(name, ".jl")) - Literate.markdown(example_filepath, OUTPUT_DIR; documenter=true) -end - -examples = [ - title => joinpath("generated", string(name, ".md")) for (title, name) in examples -] - -pages = [ - "Reactant.jl" => "index.md", - "Introduction" => [ - "Getting Started" => "introduction/index.md", - "Configuration" => "introduction/configuration.md", - ], - "Tutorials" => [ - "Overview" => "tutorials/index.md", - "Profiling" => "tutorials/profiling.md", - "Distributed" => "tutorials/multihost.md", - "Local build" => "tutorials/local-build.md", - ], - "API Reference" => [ - "Reactant API" => "api/api.md", - "Ops" => "api/ops.md", - "Dialects" => sort!( - [ - first_letter_uppercase(first(splitext(basename(file)))) => - joinpath("api/dialects", file) for - file in readdir(joinpath(@__DIR__, "src/api/dialects")) if - splitext(file)[2] == ".md" - ]; - by=first, - ), - "MLIR API" => "api/mlirc.md", - "XLA" => "api/xla.md", - "Internal API" => "api/internal.md", - ], -] - makedocs(; modules=[ Reactant, @@ -82,7 +29,6 @@ makedocs(; # build_vitepress=false, # Uncomment for local testing ), # clean=false, # Uncomment for local testing - pages=pages, doctest=true, warnonly=[:cross_references], ) diff --git a/docs/package.json b/docs/package.json index 5633b4976b..3a29a27e02 100644 --- a/docs/package.json +++ b/docs/package.json @@ -1,15 +1,20 @@ { + "devDependencies": { + "@nolebase/vitepress-plugin-enhanced-readabilities": "^2.15.0", + "@types/d3-format": "^3.0.4", + "@types/node": "^22.13.9", + "markdown-it": "^14.1.0", + "markdown-it-mathjax3": "^4.3.2", + "vitepress": "^1.6.3", + "vitepress-plugin-tabs": "^0.6.0" + }, "scripts": { "docs:dev": "vitepress dev build/.documenter", "docs:build": "vitepress build build/.documenter", "docs:preview": "vitepress preview build/.documenter" }, "dependencies": { - "@shikijs/transformers": "^1.1.7", - "markdown-it": "^14.1.0", - "markdown-it-footnote": "^4.0.0", - "markdown-it-mathjax3": "^4.3.2", - "vitepress": "^1.1.4", - "vitepress-plugin-tabs": "^0.5.0" + "d3-format": "^3.1.0", + "markdown-it-footnote": "^4.0.0" } -} +} \ No newline at end of file diff --git a/docs/src/.vitepress/config.mts b/docs/src/.vitepress/config.mts index f7a3fa27b8..3c571fc65c 100644 --- a/docs/src/.vitepress/config.mts +++ b/docs/src/.vitepress/config.mts @@ -3,6 +3,7 @@ import { tabsMarkdownPlugin } from "vitepress-plugin-tabs"; import mathjax3 from "markdown-it-mathjax3"; import footnote from "markdown-it-footnote"; import { transformerMetaWordHighlight } from "@shikijs/transformers"; +import path from 'path' const baseTemp = { base: 'REPLACE_ME_DOCUMENTER_VITEPRESS', // TODO: replace this in makedocs! @@ -15,9 +16,35 @@ export default defineConfig({ description: "Documentation for Reactant.jl", cleanUrls: true, outDir: 'REPLACE_ME_DOCUMENTER_VITEPRESS', // This is required for MarkdownVitepress to work correctly... - ignoreDeadLinks: true, // tested in Documenter.jl directly - + lastUpdated: true, + + head: [ + ['link', { rel: "icon", href: `${baseTemp.base}favicon.ico` }], + ['script', {src: `/versions.js` }], + ['script', { src: `${baseTemp.base}siteinfo.js` }], + ], + vite: { + resolve: { + alias: { + '@': path.resolve(__dirname, '../components') + } + }, + optimizeDeps: { + exclude: [ + '@nolebase/vitepress-plugin-enhanced-readabilities/client', + 'vitepress', + '@nolebase/ui', + ], + }, + ssr: { + noExternal: [ + // If there are other packages that need to be processed by Vite, you can add them here. + '@nolebase/vitepress-plugin-enhanced-readabilities', + '@nolebase/ui', + ], + }, + }, markdown: { math: true, config(md) { @@ -30,12 +57,6 @@ export default defineConfig({ codeTransformers: [transformerMetaWordHighlight()], }, - head: [ - ["link", { rel: "icon", href: "REPLACE_ME_DOCUMENTER_VITEPRESS_FAVICON" }], - ["script", { src: `/versions.js` }], - ["script", { src: `${baseTemp.base}siteinfo.js` }], - ], - themeConfig: { outline: "deep", // https://vitepress.dev/reference/default-theme-config @@ -110,15 +131,18 @@ export default defineConfig({ }, ], sidebar: { - "/introduction/": { + "/introduction/": [ + { text: "Getting Started", collapsed: false, items: [ { text: "Introduction", link: "/introduction" }, { text: "Configuration", link: "/introduction/configuration" }, ], - }, - "/tutorials/": { + } + ], + "/tutorials/": [ + { text: "Tutorials", collapsed: false, items: [ @@ -127,8 +151,10 @@ export default defineConfig({ { text: "Distributed", link: "/tutorials/multihost" }, { text: "Local build", link: "/tutorials/local-build" }, ], - }, - "/api/": { + } + ], + "/api/": [ + { text: "API Reference", collapsed: false, items: [ @@ -171,14 +197,14 @@ export default defineConfig({ }, { text: "Internal API", link: "/api/internal" }, ], - }, + } + ], }, editLink: { pattern: "https://github.com/EnzymeAD/Reactant.jl/edit/main/docs/src/:path", text: "Edit this page on GitHub", }, socialLinks: [ - { icon: "github", link: "https://github.com/EnzymeAD/Reactant.jl" }, { icon: "slack", link: "https://julialang.org/slack/" }, ], footer: { diff --git a/docs/src/.vitepress/theme/index.ts b/docs/src/.vitepress/theme/index.ts index 33e4dc5035..0223476bc6 100644 --- a/docs/src/.vitepress/theme/index.ts +++ b/docs/src/.vitepress/theme/index.ts @@ -1,22 +1,42 @@ // .vitepress/theme/index.ts import { h } from 'vue' -import type { Theme } from 'vitepress' import DefaultTheme from 'vitepress/theme' -import AsideTrustees from '../../components/AsideTrustees.vue' -import VersionPicker from "../../components/VersionPicker.vue"; +import type { Theme as ThemeConfig } from 'vitepress' +import { + NolebaseEnhancedReadabilitiesMenu, + NolebaseEnhancedReadabilitiesScreenMenu, +} from '@nolebase/vitepress-plugin-enhanced-readabilities/client' + +import AsideTrustees from '@/AsideTrustees.vue' +import VersionPicker from "@/VersionPicker.vue" +import StarUs from '@/StarUs.vue' +import AuthorBadge from '@/AuthorBadge.vue' +import Authors from '@/Authors.vue' import { enhanceAppWithTabs } from 'vitepress-plugin-tabs/client' -import './style.css' -export default { +import '@nolebase/vitepress-plugin-enhanced-readabilities/client/style.css' +import './style.css' // You could setup your own, or else a default will be copied. +import './docstrings.css' // You could setup your own, or else a default will be copied. + +export const Theme: ThemeConfig = { extends: DefaultTheme, Layout() { return h(DefaultTheme.Layout, null, { 'aside-ads-before': () => h(AsideTrustees), + 'nav-bar-content-after': () => [ + h(StarUs), + h(NolebaseEnhancedReadabilitiesMenu), // Enhanced Readabilities menu + ], + // A enhanced readabilities menu for narrower screens (usually smaller than iPad Mini) + 'nav-screen-content-after': () => h(NolebaseEnhancedReadabilitiesScreenMenu), }) }, - enhanceApp({ app }) { + enhanceApp({ app, router, siteData }) { enhanceAppWithTabs(app); app.component('VersionPicker', VersionPicker); + app.component('AuthorBadge', AuthorBadge) + app.component('Authors', Authors) } -} satisfies Theme \ No newline at end of file +} +export default Theme \ No newline at end of file diff --git a/docs/src/.vitepress/theme/style.css b/docs/src/.vitepress/theme/style.css deleted file mode 100644 index ebc9cad521..0000000000 --- a/docs/src/.vitepress/theme/style.css +++ /dev/null @@ -1,210 +0,0 @@ -/* Customize default theme styling by overriding CSS variables: -https://github.com/vuejs/vitepress/blob/main/src/client/theme-default/styles/vars.css - */ - -/* Layouts */ - -.VPHero .clip { - white-space: pre; - max-width: 500px; -} - -/* Fonts */ - -@font-face { - font-family: JuliaMono-Regular; - src: url("https://cdn.jsdelivr.net/gh/cormullion/juliamono/webfonts/JuliaMono-Regular.woff2"); -} - -:root { - /* Typography */ - --vp-font-family-base: "Barlow", "Inter var experimental", "Inter var", - -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, - Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; - - /* Code Snippet font */ - --vp-font-family-mono: JuliaMono-Regular, monospace; - - /* - Disable the 'calt' (contextual alternates, often called ligatures) font feature - for monospaced text, which is usually enabled by default. This feature changes - the display of character combinations such "-" + ">", and "|" + ">". These can - be confusing for beginners, particularly if the font has 'unusual' designs. - */ - font-feature-settings: "calt" 0; -} - -.mono { - pre { - font-family: JuliaMono-Light; - } - - code { - font-family: JuliaMono-Light; - } -} - -/* Colors */ - -:root { - --julia-blue: #4063d8; - --julia-purple: #9558b2; - --julia-red: #cb3c33; - --julia-green: #389826; - - --vp-c-brand: #389826; - --vp-c-brand-light: #3dd027; - --vp-c-brand-lighter: #9499ff; - --vp-c-brand-lightest: #bcc0ff; - --vp-c-brand-dark: #535bf2; - --vp-c-brand-darker: #454ce1; - --vp-c-brand-dimm: #212425; -} - -/* Component: Button */ - -:root { - --vp-button-brand-border: var(--vp-c-brand-light); - --vp-button-brand-text: var(--vp-c-white); - --vp-button-brand-bg: var(--vp-c-brand); - --vp-button-brand-hover-border: var(--vp-c-brand-light); - --vp-button-brand-hover-text: var(--vp-c-white); - --vp-button-brand-hover-bg: var(--vp-c-brand-light); - --vp-button-brand-active-border: var(--vp-c-brand-light); - --vp-button-brand-active-text: var(--vp-c-white); - --vp-button-brand-active-bg: var(--vp-button-brand-bg); -} - -/* Component: Home */ - -:root { - --vp-home-hero-name-color: transparent; - --vp-home-hero-name-background: -webkit-linear-gradient( - 120deg, - #9558b2 30%, - #cb3c33 - ); - - --vp-home-hero-image-background-image: linear-gradient( - -45deg, - #9558b2 30%, - #389826 30%, - #cb3c33 - ); - --vp-home-hero-image-filter: blur(40px); -} - -@media (min-width: 640px) { - :root { - --vp-home-hero-image-filter: blur(56px); - } -} - -@media (min-width: 960px) { - :root { - --vp-home-hero-image-filter: blur(72px); - } -} - -/* Component: Custom Block */ - -:root.dark { - --vp-custom-block-tip-border: var(--vp-c-brand); - --vp-custom-block-tip-text: var(--vp-c-brand-lightest); - --vp-custom-block-tip-bg: var(--vp-c-brand-dimm); - - /* // Tweak the color palette for blacks and dark grays */ - --vp-c-black: hsl(220 20% 9%); - --vp-c-black-pure: hsl(220, 24%, 4%); - --vp-c-black-soft: hsl(220 16% 13%); - --vp-c-black-mute: hsl(220 14% 17%); - --vp-c-gray: hsl(220 8% 56%); - --vp-c-gray-dark-1: hsl(220 10% 39%); - --vp-c-gray-dark-2: hsl(220 12% 28%); - --vp-c-gray-dark-3: hsl(220 12% 23%); - --vp-c-gray-dark-4: hsl(220 14% 17%); - --vp-c-gray-dark-5: hsl(220 16% 13%); - - /* // Backgrounds */ - /* --vp-c-bg: hsl(240, 2%, 11%); */ - --vp-custom-block-info-bg: hsl(220 14% 17%); - /* --vp-c-gutter: hsl(220 20% 9%); - - --vp-c-bg-alt: hsl(220 20% 9%); - --vp-c-bg-soft: hsl(220 14% 17%); - --vp-c-bg-mute: hsl(220 12% 23%); - */ -} - -/* Component: Algolia */ - -.DocSearch { - --docsearch-primary-color: var(--vp-c-brand) !important; -} - -/* Component: MathJax */ - -mjx-container > svg { - display: block; - margin: auto; -} - -mjx-container { - padding: 0.5rem 0; -} - -mjx-container { - display: inline; - margin: auto 2px -2px; -} - -mjx-container > svg { - margin: auto; - display: inline; -} - -/** - * Colors links - * -------------------------------------------------------------------------- */ - -:root { - --vp-c-brand-1: #cb3c33; - --vp-c-brand-2: #cb3c33; - --vp-c-brand-3: #cb3c33; - --vp-c-sponsor: #ca2971; - --vitest-c-sponsor-hover: #c13071; -} - -.dark { - --vp-c-brand-1: #91dd33; - --vp-c-brand-2: #91dd33; - --vp-c-brand-3: #91dd33; - --vp-c-sponsor: #91dd33; - --vitest-c-sponsor-hover: #e51370; -} - -/** - * Change images from light to dark theme - * -------------------------------------------------------------------------- */ - -:root:not(.dark) .dark-only { - display: none; -} - -:root:is(.dark) .light-only { - display: none; -} - -/* Component: Docstring Custom Block */ - -.jldocstring.custom-block { - border: 1px solid var(--vp-c-gray-2); - color: var(--vp-c-text-1); -} - -.jldocstring.custom-block summary { - font-weight: 700; - cursor: pointer; - user-select: none; - margin: 0 0 8px; -} diff --git a/docs/src/components/StarUs.vue b/docs/src/components/StarUs.vue new file mode 100644 index 0000000000..5dfdb48366 --- /dev/null +++ b/docs/src/components/StarUs.vue @@ -0,0 +1,95 @@ + + + + + + \ No newline at end of file diff --git a/docs/src/components/VersionPicker.vue b/docs/src/components/VersionPicker.vue deleted file mode 100644 index b65054027a..0000000000 --- a/docs/src/components/VersionPicker.vue +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - - diff --git a/docs/src/components/stargazers.data.ts b/docs/src/components/stargazers.data.ts new file mode 100644 index 0000000000..6098710107 --- /dev/null +++ b/docs/src/components/stargazers.data.ts @@ -0,0 +1,28 @@ +const REPO = "EnzymeAD/Reactant.jl"; + +export default { + async load() { + let stargazers_count; + try { + ({stargazers_count} = await github(`/repos/${REPO}`)); + } catch (error) { + if (process.env.CI) throw error; + stargazers_count = NaN; + } + return stargazers_count; + } +}; + +async function github( + path, + { + authorization = process.env.GITHUB_TOKEN && `token ${process.env.GITHUB_TOKEN}`, + accept = "application/vnd.github.v3+json" + } = {} +) { + const url = new URL(path, "https://api.github.com"); + const headers = {...(authorization && {authorization}), accept}; + const response = await fetch(url, {headers}); + if (!response.ok) throw new Error(`fetch error: ${response.status} ${url}`); + return await response.json(); +} diff --git a/docs/src/public/favicon.ico b/docs/src/public/favicon.ico new file mode 100644 index 0000000000..3b623b9e7a Binary files /dev/null and b/docs/src/public/favicon.ico differ diff --git a/src/Profiler.jl b/src/Profiler.jl index 71b0e92275..e63ca273a7 100644 --- a/src/Profiler.jl +++ b/src/Profiler.jl @@ -23,7 +23,7 @@ end ``` !!! note - When profiling compiled functions make sure to [`@compile`](@ref) with the `sync=true` option so that the compiled execution is captured by the profiler. + When profiling compiled functions make sure to [`Reactant.Compiler.@compile`](@ref) with the `sync=true` option so that the compiled execution is captured by the profiler. """ function with_profiler( diff --git a/src/mlir/Dialects/Affine.jl b/src/mlir/Dialects/Affine.jl index 9ce90aa908..15af9e4133 100755 --- a/src/mlir/Dialects/Affine.jl +++ b/src/mlir/Dialects/Affine.jl @@ -16,7 +16,7 @@ import ...API """ `apply` -The `affine.apply` operation applies an [affine mapping](#affine-maps) +The `affine.apply` operation applies an [affine mapping](https://mlir.llvm.org/docs/Dialects/Affine/#affine-maps) to a list of SSA values, yielding a single SSA value. The number of dimension and symbol arguments to `affine.apply` must be equal to the respective number of dimensional and symbolic inputs to the affine mapping; @@ -151,9 +151,9 @@ shorthand-bound ::= ssa-id | `-`? integer-literal The `affine.for` operation represents an affine loop nest. It has one region containing its body. This region must contain one block that terminates with -[`affine.yield`](#affineyield-mliraffineyieldop). *Note:* when +[`affine.yield`](https://mlir.llvm.org/docs/Dialects/Affine/#affineyield-affineaffineyieldop). *Note:* when `affine.for` is printed in custom format, the terminator is omitted. The -block has one argument of [`index`](Builtin.md/#indextype) type that +block has one argument of [`index`](https://mlir.llvm.org/docs/Dialects/Builtin/#indextype) type that represents the induction variable of the loop. The `affine.for` operation executes its body a number of times iterating @@ -164,7 +164,7 @@ lower bound but does not include the upper bound. The lower and upper bounds of a `affine.for` operation are represented as an application of an affine mapping to a list of SSA values passed to the map. -The [same restrictions](#restrictions-on-dimensions-and-symbols) hold for +The [same restrictions](https://mlir.llvm.org/docs/Dialects/Affine/#restrictions-on-dimensions-and-symbols) hold for these SSA values as for all bindings of SSA values to dimensions and symbols. @@ -296,9 +296,9 @@ iteration space defined by an integer set (a conjunction of affine constraints). A single `affine.if` may end with an optional `else` clause. The condition of the `affine.if` is represented by an -[integer set](#integer-sets) (a conjunction of affine constraints), +[integer set](https://mlir.llvm.org/docs/Dialects/Affine/#integer-sets) (a conjunction of affine constraints), and the SSA values bound to the dimensions and symbols in the integer set. -The [same restrictions](#restrictions-on-dimensions-and-symbols) hold for +The [same restrictions](https://mlir.llvm.org/docs/Dialects/Affine/#restrictions-on-dimensions-and-symbols) hold for these SSA values as for all bindings of SSA values to dimensions and symbols. @@ -548,7 +548,7 @@ end operation ::= ssa-id `=` `affine.min` affine-map-attribute dim-and-symbol-use-list ``` -The `affine.min` operation applies an [affine mapping](#affine-expressions) +The `affine.min` operation applies an [affine mapping](https://mlir.llvm.org/docs/Dialects/Affine/#affine-expressions) to a list of SSA values, and returns the minimum value of all result expressions. The number of dimension and symbol arguments to `affine.min` must be equal to the respective number of dimensional and symbolic inputs to @@ -791,9 +791,9 @@ end `vector_load` The `affine.vector_load` is the vector counterpart of -[affine.load](#affineload-mliraffineloadop). It reads a slice from a -[MemRef](Builtin.md/#memreftype), supplied as its first operand, -into a [vector](Builtin.md/#vectortype) of the same base elemental type. +[affine.load](https://mlir.llvm.org/docs/Dialects/Affine/#affineload-affineaffineloadop). It reads a slice from a +[MemRef](https://mlir.llvm.org/docs/Dialects/Builtin/#memreftype), supplied as its first operand, +into a [vector](https://mlir.llvm.org/docs/Dialects/Builtin/#vectortype) of the same base elemental type. The index for each memref dimension is an affine expression of loop induction variables and symbols. These indices determine the start position of the read within the memref. The shape of the return vector type determines the shape of @@ -824,7 +824,7 @@ Example 3: 2-dim f32 vector load. TODOs: * Add support for strided vector loads. * Consider adding a permutation map to permute the slice that is read from memory -(see [vector.transfer_read](../Vector/#vectortransfer_read-mlirvectortransferreadop)). +(see [vector.transfer_read](https://mlir.llvm.org/docs/Dialects/Vector/#vectortransfer_read-vectortransferreadop)). """ function vector_load( memref::Value, indices::Vector{Value}; result::IR.Type, map, location=Location() @@ -851,9 +851,9 @@ end `vector_store` The `affine.vector_store` is the vector counterpart of -[affine.store](#affinestore-mliraffinestoreop). It writes a -[vector](Builtin.md/#vectortype), supplied as its first operand, -into a slice within a [MemRef](Builtin.md/#memreftype) of the same base +[affine.store](https://mlir.llvm.org/docs/Dialects/Affine/#affinestore-affineaffinestoreop). It writes a +[vector](https://mlir.llvm.org/docs/Dialects/Builtin/#vectortype), supplied as its first operand, +into a slice within a [MemRef](https://mlir.llvm.org/docs/Dialects/Builtin/#memreftype) of the same base elemental type, supplied as its second operand. The index for each memref dimension is an affine expression of loop induction variables and symbols. These indices determine the start position @@ -886,7 +886,7 @@ affine.vector_store %v0, %0[%i0, %i1] : memref<100x100xf32>, vector<2x8xf32> TODOs: * Add support for strided vector stores. * Consider adding a permutation map to permute the slice that is written to memory -(see [vector.transfer_write](../Vector/#vectortransfer_write-mlirvectortransferwriteop)). +(see [vector.transfer_write](https://mlir.llvm.org/docs/Dialects/Vector/#vectortransfer_write-vectortransferwriteop)). """ function vector_store( value::Value, memref::Value, indices::Vector{Value}; map, location=Location() diff --git a/src/mlir/Dialects/Arith.jl b/src/mlir/Dialects/Arith.jl index 01289a12fd..61ba166dc7 100755 --- a/src/mlir/Dialects/Arith.jl +++ b/src/mlir/Dialects/Arith.jl @@ -219,7 +219,7 @@ value of equal bit width. When operating on vectors, casts elementwise. Note that this implements a logical bitcast independent of target endianness. This allows constant folding without target information and is -consitent with the bitcast constant folders in LLVM (see +consistent with the bitcast constant folders in LLVM (see https://github.com/llvm/llvm-project/blob/18c19414eb/llvm/lib/IR/ConstantFold.cpp#L168) For targets where the source and target type have the same endianness (which is the standard), this cast will also change no bits at runtime, but it may @@ -253,7 +253,7 @@ end Signed integer division. Rounds towards positive infinity, i.e. `7 / -2 = -3`. -Divison by zero, or signed division overflow (minimum value divided by -1) +Division by zero, or signed division overflow (minimum value divided by -1) is undefined behavior. When applied to `vector` and `tensor` values, the behavior is undefined if _any_ of its elements are divided by zero or has a signed division overflow. @@ -419,16 +419,16 @@ main reason being that comparison operations have diverging sets of attributes: integers require sign specification while floats require various floating point-related particularities, e.g., `-ffast-math` behavior, IEEE754 compliance, etc -([rationale](../Rationale/Rationale.md#splitting-floating-point-vs-integer-operations)). +([rationale](https://mlir.llvm.org/docs/Rationale/Rationale/#splitting-floating-point-vs-integer-operations)). The type of comparison is specified as attribute to avoid introducing ten similar operations, taking into account that they are often implemented using the same operation downstream -([rationale](../Rationale/Rationale.md#specifying-comparison-kind-as-attribute)). The +([rationale](https://mlir.llvm.org/docs/Rationale/Rationale/#specifying-comparison-kind-as-attribute)). The separation between signed and unsigned order comparisons is necessary because of integers being signless. The comparison operation must know how to interpret values with the foremost bit being set: negatives in two\'s complement or large positives -([rationale](../Rationale/Rationale.md#specifying-sign-in-integer-comparison-operations)). +([rationale](https://mlir.llvm.org/docs/Rationale/Rationale/#specifying-sign-in-integer-comparison-operations)). # Example diff --git a/src/mlir/Dialects/Builtin.jl b/src/mlir/Dialects/Builtin.jl index df4b466079..9bb2ed7b5f 100755 --- a/src/mlir/Dialects/Builtin.jl +++ b/src/mlir/Dialects/Builtin.jl @@ -17,11 +17,11 @@ import ...API `module_` A `module` represents a top-level container operation. It contains a single -[graph region](../LangRef.md#control-flow-and-ssacfg-regions) containing a single block +[graph region](https://mlir.llvm.org/docs/LangRef/#control-flow-and-ssacfg-regions) containing a single block which can contain any operations and does not have a terminator. Operations within this region cannot implicitly capture values defined outside the module, -i.e. Modules are [IsolatedFromAbove](../Traits.md#isolatedfromabove). Modules have -an optional [symbol name](../SymbolsAndSymbolTables.md) which can be used to refer +i.e. Modules are [IsolatedFromAbove](https://mlir.llvm.org/docs/Traits/#isolatedfromabove). Modules have +an optional [symbol name](https://mlir.llvm.org/docs/SymbolsAndSymbolTables/) which can be used to refer to them in operations. # Example diff --git a/src/mlir/Dialects/Func.jl b/src/mlir/Dialects/Func.jl index dcadfd219c..cff4482698 100755 --- a/src/mlir/Dialects/Func.jl +++ b/src/mlir/Dialects/Func.jl @@ -121,7 +121,7 @@ to a `func.func` operation MLIR does not allow direct references to functions in SSA operands because the compiler is multithreaded, and disallowing SSA values to directly reference a function simplifies this -([rationale](../Rationale/Rationale.md#multithreading-the-compiler)). +([rationale](https://mlir.llvm.org/docs/Rationale/Rationale/#multithreading-the-compiler)). """ function constant(; result_0::IR.Type, value, location=Location()) op_ty_results = IR.Type[result_0,] diff --git a/src/mlir/Dialects/MemRef.jl b/src/mlir/Dialects/MemRef.jl index e09b4cdb0a..7a4834e3ba 100644 --- a/src/mlir/Dialects/MemRef.jl +++ b/src/mlir/Dialects/MemRef.jl @@ -206,7 +206,7 @@ element type of the memref. A set `nontemporal` attribute indicates that this load is not expected to be reused in the cache. For details, refer to the -[https://llvm.org/docs/LangRef.html#load-instruction](LLVM load instruction). +[LLVM load instruction](https://llvm.org/docs/LangRef.html#load-instruction). # Example @@ -315,7 +315,7 @@ end The `alloca` operation allocates memory on the stack, to be automatically released when control transfers back from the region of its closest surrounding operation with an -[`AutomaticAllocationScope`](../Traits.md/#automaticallocationscope) trait. +[`AutomaticAllocationScope`](https://mlir.llvm.org/docs/Traits/#automaticallocationscope) trait. The amount of memory allocated is specified by its memref and additional operands. For example: @@ -1238,7 +1238,7 @@ memref. ``` If the result memref has a dynamic shape, a result dimension operand is -needed to spefify its dynamic dimension. In the example below, the ssa value +needed to specify its dynamic dimension. In the example below, the ssa value \'%d\' specifies the unknown dimension of the result memref. ```mlir @@ -1431,7 +1431,7 @@ be in-bounds: `0 <= idx < dim_size` A set `nontemporal` attribute indicates that this store is not expected to be reused in the cache. For details, refer to the -[https://llvm.org/docs/LangRef.html#store-instruction](LLVM store instruction). +[LLVM store instruction](https://llvm.org/docs/LangRef.html#store-instruction). # Example diff --git a/src/mlir/IR/IntegerSet.jl b/src/mlir/IR/IntegerSet.jl index 408eb7b460..7ac339224e 100644 --- a/src/mlir/IR/IntegerSet.jl +++ b/src/mlir/IR/IntegerSet.jl @@ -67,7 +67,7 @@ context(set::IntegerSet) = Context(API.mlirIntegerSetGetContext(set.set)) """ isempty(set) -Checks whether the given set is a canonical empty set, e.g., the set returned by [`mlirIntegerSetEmptyGet`](@ref). +Checks whether the given set is a canonical empty set, e.g., the set returned by [`Reactant.MLIR.API.mlirIntegerSetEmptyGet`](@ref). """ Base.isempty(set::IntegerSet) = API.mlirIntegerSetIsCanonicalEmpty(set) diff --git a/src/mlir/IR/Type.jl b/src/mlir/IR/Type.jl index 075457ca33..fd4519663d 100644 --- a/src/mlir/IR/Type.jl +++ b/src/mlir/IR/Type.jl @@ -440,7 +440,7 @@ isvector(type::Type) = API.mlirTypeIsAVector(type) TensorType(shape, elementType, encoding=Attribute(); location=Location(), check=false) Creates a tensor type of a fixed rank with the given shape, element type, and optional encoding in the same context as the element type. -The type is owned by the context. Tensor types without any specific encoding field should assign [`mlirAttributeGetNull`](@ref) to this parameter. +The type is owned by the context. Tensor types without any specific encoding field should assign [`Reactant.MLIR.API.mlirAttributeGetNull`](@ref) to this parameter. If `check=true`, emits appropriate diagnostics on illegal arguments. """ Base.@nospecializeinfer function TensorType( diff --git a/src/mlir/libMLIR_h.jl b/src/mlir/libMLIR_h.jl index b156f22602..c3bcfda24e 100644 --- a/src/mlir/libMLIR_h.jl +++ b/src/mlir/libMLIR_h.jl @@ -260,6 +260,9 @@ struct MlirDialectRegistry ptr::Ptr{Cvoid} end +""" + MlirOperation +""" struct MlirOperation ptr::Ptr{Cvoid} end @@ -284,6 +287,9 @@ struct MlirSymbolTable ptr::Ptr{Cvoid} end +""" + MlirAttribute +""" struct MlirAttribute ptr::Ptr{Cvoid} end @@ -292,6 +298,10 @@ struct MlirIdentifier ptr::Ptr{Cvoid} end +""" + MlirLocation +A location in MLIR. +""" struct MlirLocation ptr::Ptr{Cvoid} end @@ -300,6 +310,10 @@ struct MlirModule ptr::Ptr{Cvoid} end +""" + MlirType +A type in MLIR. +""" struct MlirType ptr::Ptr{Cvoid} end @@ -3358,7 +3372,7 @@ end """ mlirIntegerSetIsCanonicalEmpty(set) -Checks whether the given set is a canonical empty set, e.g., the set returned by [`mlirIntegerSetEmptyGet`](@ref). +Checks whether the given set is a canonical empty set, e.g., the set returned by [`Reactant.MLIR.API.mlirIntegerSetEmptyGet`](@ref). """ function mlirIntegerSetIsCanonicalEmpty(set) @ccall mlir_c.mlirIntegerSetIsCanonicalEmpty(set::MlirIntegerSet)::Bool @@ -5713,7 +5727,7 @@ end """ mlirRankedTensorTypeGet(rank, shape, elementType, encoding) -Creates a tensor type of a fixed rank with the given shape, element type, and optional encoding in the same context as the element type. The type is owned by the context. Tensor types without any specific encoding field should assign [`mlirAttributeGetNull`](@ref)() to this parameter. +Creates a tensor type of a fixed rank with the given shape, element type, and optional encoding in the same context as the element type. The type is owned by the context. Tensor types without any specific encoding field should assign [`Reactant.MLIR.API.mlirAttributeGetNull`](@ref)() to this parameter. """ function mlirRankedTensorTypeGet(rank, shape, elementType, encoding) @ccall mlir_c.mlirRankedTensorTypeGet( @@ -8493,6 +8507,9 @@ function mlirInferShapedTypeOpInterfaceInferReturnTypes( )::MlirLogicalResult end +""" + MlirPass +""" struct MlirPass ptr::Ptr{Cvoid} end @@ -10601,4 +10618,7 @@ function sdyManualAxesAttrGetAxesElem(attr, pos) )::MlirStringRef end +""" + MLIR_CAPI_DWARF_ADDRESS_SPACE_NULL +""" const MLIR_CAPI_DWARF_ADDRESS_SPACE_NULL = -1