From 4ac4216e5a8da9c3312b8938936a4592e6d651ec Mon Sep 17 00:00:00 2001 From: Kiss Date: Tue, 19 May 2026 12:02:27 +0200 Subject: [PATCH 1/7] Add markdown button and make llms.txt available --- docs/conf.py | 141 ++++++++++++++++++++++++++++++++++++++++++++++---- docs/llms.txt | 22 ++++++++ 2 files changed, 152 insertions(+), 11 deletions(-) create mode 100644 docs/llms.txt diff --git a/docs/conf.py b/docs/conf.py index a472b88..b69cfe1 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,10 +1,12 @@ """Configuration file for the Sphinx documentation builder.""" import os +from pathlib import Path html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "instinct.docs.amd.com") html_context = {} if os.environ.get("READTHEDOCS", "") == "True": html_context["READTHEDOCS"] = True + project = "AMD Container Runtime Toolkit" version = "1.3.0" @@ -27,23 +29,23 @@ ol_version_numbers = [('9.5'), ('8.10')] azl_version_numbers = ['3.0'] -html_context = { - "ubuntu_version_numbers" : ubuntu_version_numbers, - "debian_version_numbers" : debian_version_numbers, - "sles_version_numbers" : sles_version_numbers, - "rhel_release_version_numbers" : rhel_release_version_numbers, - "rhel_version_numbers" : rhel_version_numbers, - "ol_release_version_numbers" : ol_release_version_numbers, - "ol_version_numbers" : ol_version_numbers, - "azl_version_numbers": azl_version_numbers -} - +html_context.update({ + "ubuntu_version_numbers": ubuntu_version_numbers, + "debian_version_numbers": debian_version_numbers, + "sles_version_numbers": sles_version_numbers, + "rhel_release_version_numbers": rhel_release_version_numbers, + "rhel_version_numbers": rhel_version_numbers, + "ol_release_version_numbers": ol_release_version_numbers, + "ol_version_numbers": ol_version_numbers, + "azl_version_numbers": azl_version_numbers, +}) # Required settings html_theme = "rocm_docs_theme" html_theme_options = { "flavor": "instinct", "link_main_doc": True, + "use_download_button": True, # Add any additional theme options here } extensions = [ @@ -64,3 +66,120 @@ .. |rocm_directory_version| replace:: {rocm_directory_version} .. |amdgpu_install_version| replace:: {amdgpu_install_version} """ + +import re + +EXCLUDED_DIRS = { + "_build", + "_templates", + "_static", + ".git", + ".venv", +} + +MARKUP_PREFIXES = ( + ":::", + "```{", + "```", + ":img-top:", + ":class", + ":link:", + ":link-type:", + ":shadow:", + ":columns:", + ":padding:", + ":gutter:", + ":open:", + ":name:", + ":header-rows:", + ":alt:", + "+++", + "<", + "-->", + "{bdg-", +) + +# Matches lines like "align: center", "alt:", "name: foo" (directive options +# not starting with a colon, common in MyST figure/table fences) +_BARE_DIRECTIVE_RE = re.compile(r"^[a-z][a-z_-]*:\s*\S*$") + +# Matches MyST/RST anchor labels like "(some-label)=" +_ANCHOR_LABEL_RE = re.compile(r"^\(\w[\w-]*\)=$") + +MIN_PROSE_LINES = 10 + + +def should_skip(path: Path) -> bool: + return any(part in EXCLUDED_DIRS for part in path.parts) + + +def is_prose_line(line: str) -> bool: + stripped = line.strip() + if not stripped: + return False + if stripped.startswith(MARKUP_PREFIXES): + return False + # Drop bare directive-option lines (e.g. "align: center", "alt:") + if _BARE_DIRECTIVE_RE.match(stripped): + return False + # Drop MyST/RST anchor labels (e.g. "(some-label)=") + if _ANCHOR_LABEL_RE.match(stripped): + return False + # Drop lines that contain an HTML tag anywhere (e.g. ".

") + if re.search(r" Run GPU-accelerated applications in containers on AMD Instinct GPUs. The AMD Container Toolkit provides the `amd-container-runtime` (a Docker-integrated OCI runtime wrapper) and the `amd-ctk` CLI for managing GPU configurations, CDI specifications, and container orchestration integrations with ROCm-based workloads. + +## AMD Container Toolkit + +- [Overview](https://instinct.docs.amd.com/projects/container-toolkit/en/latest/container-runtime/overview.html): Architecture of the AMD Container Toolkit, including the `amd-container-runtime` and `amd-ctk` CLI components and how they integrate with Docker to inject AMD GPUs into containers. +- [Requirements](https://instinct.docs.amd.com/projects/container-toolkit/en/latest/container-runtime/requirements.html): Supported operating systems (Ubuntu 22.04, 24.04, RHEL 9.5), Docker version requirements, ROCm compatibility, and host system prerequisites including group permissions and GPU partitioning requirements. +- [Quick start guide](https://instinct.docs.amd.com/projects/container-toolkit/en/latest/container-runtime/quick-start-guide.html): Install the AMD Container Toolkit on Ubuntu or RHEL, configure Docker for AMD GPUs using `amd-ctk runtime configure`, run containers with `AMD_VISIBLE_DEVICES` or the `--gpus` flag, and enable GPU partitioning. +- [Running workloads](https://instinct.docs.amd.com/projects/container-toolkit/en/latest/container-runtime/running-workloads.html): Run GPU-accelerated containers using CDI specs or the `amd-container-runtime` across Docker, Podman, and other CDI-aware runtimes. +- [Framework integration](https://instinct.docs.amd.com/projects/container-toolkit/en/latest/container-runtime/framework-integration.html): Use the AMD Container Toolkit with TensorFlow, PyTorch, ONNX Runtime, OpenMPI, and other ROCm-compatible AI and HPC frameworks. +- [Troubleshooting](https://instinct.docs.amd.com/projects/container-toolkit/en/latest/container-runtime/troubleshooting.html): Diagnose and resolve common issues with the AMD Container Toolkit, including driver loading failures and Docker runtime configuration problems. +- [Migration guide](https://instinct.docs.amd.com/projects/container-toolkit/en/latest/container-runtime/migration-guide.html): Migrate container workflows from the NVIDIA Container Toolkit (`nvidia-docker`) to the AMD Container Toolkit by updating environment variables, runtime flags, and Docker daemon configuration. +- [Developer guide](https://instinct.docs.amd.com/projects/container-toolkit/en/latest/container-runtime/developer-guide.html): Build the AMD Container Toolkit from source, including build dependencies and packaging steps for deployment. +- [Docker Compose usage](https://instinct.docs.amd.com/projects/container-toolkit/en/latest/container-runtime/docker-compose.html): Configure GPU access in multi-container Docker Compose applications using the AMD container runtime. +- [Enroot and Pyxis installation](https://instinct.docs.amd.com/projects/container-toolkit/en/latest/container-runtime/enroot-pyxis-installation.html): Install and configure Enroot and Pyxis on a SLURM cluster to run containerized AI/HPC workloads with isolated AMD GPU access, including support for GPU partitioning. +- [Docker Swarm integration](https://instinct.docs.amd.com/projects/container-toolkit/en/latest/container-runtime/docker-swarm.html): Deploy GPU-enabled services across Docker Swarm nodes using GPU UUIDs and generic resources in `daemon.json`. +- [Container Device Interface (CDI)](https://instinct.docs.amd.com/projects/container-toolkit/en/latest/container-runtime/cdi-guide.html): Generate and manage CDI specifications for AMD GPUs using `amd-ctk cdi generate`, enabling runtime-agnostic GPU injection without `amd-container-runtime`. +- [GPU Tracker](https://instinct.docs.amd.com/projects/container-toolkit/en/latest/container-runtime/gpu-tracker.html): Track GPU access across Docker containers, enforce shared or exclusive GPU accessibility per device, and query or reset tracker state using the `amd-ctk gpu-tracker` CLI. +- [Release notes](https://instinct.docs.amd.com/projects/container-toolkit/en/latest/container-runtime/release-notes.html): Release history and changelog for the AMD Container Toolkit. + +--- From 563edef3856a2897f161ebb48ebba3613b8f8669 Mon Sep 17 00:00:00 2001 From: Kiss Date: Wed, 20 May 2026 15:24:58 +0200 Subject: [PATCH 2/7] Add RST files stitching to llms.txt --- docs/conf.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index b69cfe1..1a7b0c1 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -106,6 +106,9 @@ # Matches MyST/RST anchor labels like "(some-label)=" _ANCHOR_LABEL_RE = re.compile(r"^\(\w[\w-]*\)=$") +# Matches RST section underlines (e.g. "====", "----", "~~~~") +_RST_UNDERLINE_RE = re.compile(r"^[=\-~^\"\'#*+]{3,}$") + MIN_PROSE_LINES = 10 @@ -128,6 +131,15 @@ def is_prose_line(line: str) -> bool: # Drop lines that contain an HTML tag anywhere (e.g. ".

") if re.search(r" Date: Wed, 20 May 2026 15:56:58 +0200 Subject: [PATCH 3/7] Add llms-full.txt and keep the llms.txt as base --- docs/conf.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 1a7b0c1..3285aaf 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -59,6 +59,8 @@ exclude_patterns = ['.venv'] +html_extra_path = ["llms.txt"] + # Add the following replacements to every RST file. rst_prolog = f""" .. |rocm_version| replace:: {rocm_version} @@ -148,7 +150,7 @@ def generate_combined_markdown(app, exception): return docs_root = Path(app.srcdir) - output_file = Path(app.outdir) / "llms.txt" + output_file = Path(app.outdir) / "llms-full.txt" base_file = docs_root / "llms.txt" combined = [] From e9028d58ca5971d3222b13346961f72065c39bc2 Mon Sep 17 00:00:00 2001 From: Kiss Date: Fri, 29 May 2026 11:58:13 +0200 Subject: [PATCH 4/7] Update the filter function of llms-full.txt generation --- docs/conf.py | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 3285aaf..d8b607d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -111,6 +111,9 @@ # Matches RST section underlines (e.g. "====", "----", "~~~~") _RST_UNDERLINE_RE = re.compile(r"^[=\-~^\"\'#*+]{3,}$") +# Matches RST code block directives (e.g. ".. code-block:: cpp", ".. code:: sh") +_RST_CODE_BLOCK_RE = re.compile(r"^\.\.\s+(code-block|code|sourcecode)::") + MIN_PROSE_LINES = 10 @@ -130,14 +133,13 @@ def is_prose_line(line: str) -> bool: # Drop MyST/RST anchor labels (e.g. "(some-label)=") if _ANCHOR_LABEL_RE.match(stripped): return False - # Drop lines that contain an HTML tag anywhere (e.g. ".

") - if re.search(r"` describes..."). + if re.match(r"^:[A-Za-z][A-Za-z0-9_-]*:(\s|$)", stripped): return False # Drop RST section underlines (e.g. "====", "----", "~~~~") if _RST_UNDERLINE_RE.match(stripped): @@ -184,10 +186,32 @@ def generate_combined_markdown(app, exception): continue relative = doc_file.relative_to(docs_root) - cleaned = "\n".join( - line for line in lines - if line.strip() == "" or is_prose_line(line) - ) + in_backtick_fence = False + in_rst_code_block = False + kept = [] + for line in lines: + stripped = line.strip() + # Backtick fences (MyST/Markdown) + if stripped.startswith("```"): + in_backtick_fence = not in_backtick_fence + kept.append(line) + continue + if in_backtick_fence: + kept.append(line) + continue + # RST code block: exit when a non-blank, non-indented line appears + if in_rst_code_block: + if not stripped or line[0] in (" ", "\t"): + kept.append(line) + continue + in_rst_code_block = False + # RST code block: enter on directive line (directive itself is dropped) + if _RST_CODE_BLOCK_RE.match(stripped): + in_rst_code_block = True + continue + if not stripped or is_prose_line(line): + kept.append(line) + cleaned = "\n".join(kept) combined.append(f"\n\n---\n\n# {relative}\n") combined.append(cleaned.strip()) From 196bfccab34815fd150c941a8413b140098d6011 Mon Sep 17 00:00:00 2001 From: Kiss Date: Fri, 29 May 2026 13:05:43 +0200 Subject: [PATCH 5/7] sync llms filter fixes from rocm-docs-core --- docs/conf.py | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index d8b607d..8a6d0dd 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -96,7 +96,6 @@ ":header-rows:", ":alt:", "+++", - "<", "-->", "{bdg-", ) @@ -114,6 +113,17 @@ # Matches RST code block directives (e.g. ".. code-block:: cpp", ".. code:: sh") _RST_CODE_BLOCK_RE = re.compile(r"^\.\.\s+(code-block|code|sourcecode)::") +# Matches markdown table separator rows (e.g. "|---|---|", "| :--- | ---: |"). +_MD_TABLE_SEP_RE = re.compile(r"^\|[\s|:\-]+\|$") + +# Matches RST directives whose indented body should be discarded (e.g. raw HTML). +_RST_SKIP_BLOCK_RE = re.compile(r"^\.\.\s+raw::") + +# Matches HTML tags (e.g. "
", "

", ") - Add in_html_open_tag state to discard multi-line HTML opening tag continuations --- docs/conf.py | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 8a6d0dd..660d7d0 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -124,6 +124,10 @@ # URL schemes so that multi-line RST inline hyperlinks are preserved. _HTML_TAG_RE = re.compile(r"^<(?!https?://|ftp://|mailto:)[a-zA-Z/!]") +# Matches trailing HTML close tags at the end of a prose line +# (e.g. "Browse blogs.

", "See the guide."). +_TRAILING_HTML_CLOSE_RE = re.compile(r"()+\s*$") + MIN_PROSE_LINES = 10 @@ -210,6 +214,8 @@ def generate_combined_markdown(app, exception): in_backtick_fence = False in_rst_code_block = False in_rst_skip_block = False + in_html_comment = False # inside block + in_html_open_tag = False # inside a multi-line HTML opening tag kept = [] for line in lines: stripped = line.strip() @@ -221,6 +227,11 @@ def generate_combined_markdown(app, exception): if in_backtick_fence: kept.append(line) continue + # HTML comment block (): discard all content until --> + if in_html_comment: + if "-->" in stripped: + in_html_comment = False + continue # RST skip block (e.g. .. raw::): discard all indented content if in_rst_skip_block: if not stripped or line[0] in (" ", "\t"): @@ -240,8 +251,26 @@ def generate_combined_markdown(app, exception): if _RST_CODE_BLOCK_RE.match(stripped): in_rst_code_block = True continue - if not stripped or is_prose_line(line): + # HTML comment open (): discard opener and enter state + if stripped.startswith("" not in stripped: + in_html_comment = True + continue + # Multi-line HTML opening tag: skip continuation lines until > + if in_html_open_tag: + if ">" in stripped: + in_html_open_tag = False + continue + # Detect HTML opening tags that wrap across lines (no > on this line) + if _HTML_TAG_RE.match(stripped) and ">" not in stripped: + in_html_open_tag = True + continue + if not stripped: kept.append(line) + elif is_prose_line(line): + # Strip trailing HTML close tags (e.g. "See the guide.

") + cleaned = _TRAILING_HTML_CLOSE_RE.sub("", line).rstrip() + kept.append(cleaned if cleaned.strip() else line) cleaned = "\n".join(kept) combined.append(f"\n\n---\n\n# {relative}\n") From 2cb4d1d959a6db03ad52edbed9acea8b195f22f5 Mon Sep 17 00:00:00 2001 From: Kiss Date: Fri, 29 May 2026 14:19:51 +0200 Subject: [PATCH 7/7] llms: drop punctuation-only lines after stripping trailing HTML close tags Lines like ".

" from sphinx-design grid cards pass _is_prose_line because they start with ".". After stripping "

", the remaining content is a bare "." with no word characters and should be discarded. Co-Authored-By: Claude Sonnet 4.6 --- docs/conf.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 660d7d0..c4c31da 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -270,7 +270,15 @@ def generate_combined_markdown(app, exception): elif is_prose_line(line): # Strip trailing HTML close tags (e.g. "See the guide.

") cleaned = _TRAILING_HTML_CLOSE_RE.sub("", line).rstrip() - kept.append(cleaned if cleaned.strip() else line) + cleaned_stripped = cleaned.strip() + if not cleaned_stripped: + # Entire line was HTML close tags — keep original (shouldn't + # normally reach here since _is_prose_line filters HTML). + kept.append(line) + elif re.search(r"\w", cleaned_stripped): + # Line has real word content after stripping close tags. + kept.append(cleaned) + # else: only punctuation remains (e.g. bare ".") — discard. cleaned = "\n".join(kept) combined.append(f"\n\n---\n\n# {relative}\n")