From 01b091a119b7e8f1af2dc8eea964744d7133071b Mon Sep 17 00:00:00 2001 From: Kiss Date: Wed, 13 May 2026 12:54:35 +0200 Subject: [PATCH 1/7] Add markdown button and make llms.txt available --- docs/conf.py | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index b063e50..8c7f54e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,5 +1,7 @@ """Configuration file for the Sphinx documentation builder.""" import os +from pathlib import Path +import shutil html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "instinct.docs.amd.com") html_context = {} @@ -45,6 +47,7 @@ "flavor": "amdgpu", "announcement": f"AMD GPU Driver 31.20.0 is a technology preview intended for use only with AMD ROCm 7.12.0 technology preview. For production use, continue to use AMD GPU Driver {version} documentation.", "link_main_doc": True, + "use_download_button": True, # Add any additional theme options here } extensions = [ @@ -58,6 +61,57 @@ exclude_patterns = ['.venv'] +EXCLUDED_DIRS = { + "_build", + "_templates", + "_static", + ".git", + ".venv", +} + +def should_skip(path: Path) -> bool: + return any(part in EXCLUDED_DIRS for part in path.parts) + + +def generate_combined_markdown(app, exception): + if exception: + return + + docs_root = Path(app.srcdir) + output_file = Path(app.outdir) / "llms.txt" + + print(output_file) + + all_files = sorted(docs_root.rglob("*.md")) + + combined = [] + combined.append("# Combined Documentation\n") + + for doc_file in all_files: + if should_skip(doc_file): + continue + + relative = doc_file.relative_to(docs_root) + + combined.append(f"\n---\n") + combined.append(f"\n# {relative}\n") + + try: + content = doc_file.read_text(encoding="utf-8") + combined.append(content) + combined.append("\n") + + except Exception as e: + combined.append(f"\n[ERROR reading file: {e}]\n") + + output_file.write_text( + "\n".join(combined), + encoding="utf-8", + ) + +def setup(app): + app.connect("build-finished", generate_combined_markdown) + # Add the following replacements to every RST file. rst_prolog = f""" .. |version| replace:: {version} From 00ee1cd113b6022e613e1ba32f5d7054deaa8805 Mon Sep 17 00:00:00 2001 From: Kiss Date: Tue, 19 May 2026 14:40:41 +0200 Subject: [PATCH 2/7] Add base llms.txt and add treshold --- docs/conf.py | 97 ++++++++++++++++++++++++++++++++++++++++++--------- docs/llms.txt | 30 ++++++++++++++++ 2 files changed, 111 insertions(+), 16 deletions(-) create mode 100644 docs/llms.txt diff --git a/docs/conf.py b/docs/conf.py index 8c7f54e..bb3ba6a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,7 +1,7 @@ """Configuration file for the Sphinx documentation builder.""" import os +import re from pathlib import Path -import shutil html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "instinct.docs.amd.com") html_context = {} @@ -29,7 +29,7 @@ ol_version_numbers = ['10.1', '9.7', '8.10'] rl_version_numbers = ['9.7'] -html_context = { +html_context.update({ "ubuntu_version_numbers" : ubuntu_version_numbers, "debian_version_numbers" : debian_version_numbers, "sles_version_numbers" : sles_version_numbers, @@ -38,7 +38,7 @@ "ol_release_version_numbers" : ol_release_version_numbers, "ol_version_numbers" : ol_version_numbers, "rl_version_numbers" : rl_version_numbers -} +}) # Required settings @@ -69,46 +69,111 @@ ".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" Install, configure, and optimize the AMD GPU driver (amdgpu) for AMD Instinct and Radeon GPUs on Linux. Covers package manager installation across major distributions, post-install steps, system optimization tuning guides for MI300X and MI300A, GPU partitioning, and conceptual reference for IOMMU, PCIe atomics, and resource oversubscription. + +## Install AMD GPU Driver + +- [Prerequisites](https://instinct.docs.amd.com/projects/amdgpu-docs/en/latest/install/detailed-install/prerequisites.html): System requirements and prerequisites before installing the AMD GPU driver, including kernel version and dependency checks. +- [Install via package manager](https://instinct.docs.amd.com/projects/amdgpu-docs/en/latest/install/package-manager-index.html): Install the AMD GPU driver using native package managers on Ubuntu, Debian, RHEL, Oracle Linux, Rocky Linux, and SUSE Linux Enterprise Server. +- [Post-install instructions](https://instinct.docs.amd.com/projects/amdgpu-docs/en/latest/install/detailed-install/post-install.html): Configure user groups, verify driver loading, and complete required post-installation steps after installing the AMD GPU driver. + +## How to + +- [System optimization](https://instinct.docs.amd.com/projects/amdgpu-docs/en/latest/system-optimization/index.html): Hardware and OS tuning guides for AMD Instinct GPU workloads, including BIOS settings, GRUB configuration, NBIO tuning, and environment variable recommendations. +- [MI300X system optimization](https://instinct.docs.amd.com/projects/amdgpu-docs/en/latest/system-optimization/mi300x.html): AMD Instinct MI300X-specific system settings for HPC and AI workloads, including BIOS, NBIO, and ROCm environment variable tuning. +- [MI300A system optimization](https://instinct.docs.amd.com/projects/amdgpu-docs/en/latest/system-optimization/mi300a.html): AMD Instinct MI300A APU-specific system tuning for high-performance computing workloads. +- [MI200 system optimization](https://instinct.docs.amd.com/projects/amdgpu-docs/en/latest/system-optimization/mi200.html): Performance and system tuning guide for AMD Instinct MI200 series GPUs. +- [MI100 system optimization](https://instinct.docs.amd.com/projects/amdgpu-docs/en/latest/system-optimization/mi100.html): Performance and system tuning guide for AMD Instinct MI100 GPUs. +- [MI300X GPU partitioning overview](https://instinct.docs.amd.com/projects/amdgpu-docs/en/latest/gpu-partitioning/mi300x/overview.html): Overview of GPU partitioning capabilities on AMD Instinct MI300X, including partition modes and resource isolation. +- [MI300X GPU partitioning requirements](https://instinct.docs.amd.com/projects/amdgpu-docs/en/latest/gpu-partitioning/mi300x/requirements.html): Hardware and software requirements for enabling GPU partitioning on AMD Instinct MI300X. +- [MI300X GPU partitioning quick start](https://instinct.docs.amd.com/projects/amdgpu-docs/en/latest/gpu-partitioning/mi300x/quick-start-guide.html): Step-by-step guide to configuring and activating GPU partitioning on AMD Instinct MI300X. +- [MI300X GPU partitioning troubleshooting](https://instinct.docs.amd.com/projects/amdgpu-docs/en/latest/gpu-partitioning/mi300x/troubleshooting.html): Diagnose and resolve common issues when configuring GPU partitioning on AMD Instinct MI300X. +- [MI300A GPU partitioning overview](https://instinct.docs.amd.com/projects/amdgpu-docs/en/latest/gpu-partitioning/mi300a/overview.html): Overview of GPU partitioning on the AMD Instinct MI300A APU. + +## Conceptual + +- [IOMMU](https://instinct.docs.amd.com/projects/amdgpu-docs/en/latest/conceptual/iommu.html): How Input-Output Memory Management Unit (IOMMU) affects AMD GPU DMA operations, PCIe topology, and xGMI configurations. +- [PCIe atomics](https://instinct.docs.amd.com/projects/amdgpu-docs/en/latest/conceptual/pcie-atomics.html): PCIe atomic operations support in ROCm and their role in GPU peer-to-peer communication. +- [Oversubscription](https://instinct.docs.amd.com/projects/amdgpu-docs/en/latest/conceptual/oversubscription.html): Considerations and tradeoffs when oversubscribing hardware resources with AMD GPU workloads. + +--- From 34aa66e8be48d958ff38f81aa5ca6d574d24f9dd Mon Sep 17 00:00:00 2001 From: Kiss Date: Thu, 21 May 2026 12:21:20 +0200 Subject: [PATCH 3/7] Add llms-full.txt and keep the llms.txt as base --- docs/conf.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index bb3ba6a..24ff988 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -61,6 +61,8 @@ exclude_patterns = ['.venv'] +html_extra_path = ["llms.txt"] + EXCLUDED_DIRS = { "_build", "_templates", @@ -98,6 +100,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 @@ -120,6 +125,15 @@ def is_prose_line(line: str) -> bool: # Drop lines that contain an HTML tag anywhere (e.g. ".

") if re.search(r" Date: Fri, 29 May 2026 11:59:25 +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 24ff988..797e508 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -103,6 +103,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 @@ -122,14 +125,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): @@ -176,10 +178,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 b30d5aedc45ea077316e34de881ae460d9841481 Mon Sep 17 00:00:00 2001 From: Kiss Date: Fri, 29 May 2026 13:06:17 +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 797e508..5688a09 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -88,7 +88,6 @@ ":header-rows:", ":alt:", "+++", - "<", "-->", "{bdg-", ) @@ -106,6 +105,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 5688a09..e903980 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -116,6 +116,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 @@ -202,6 +206,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() @@ -213,6 +219,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"): @@ -232,8 +243,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 8294cf23e9ae7315352a357288395ee3a37a8871 Mon Sep 17 00:00:00 2001 From: Kiss Date: Fri, 29 May 2026 14:19:57 +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 e903980..7582586 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -262,7 +262,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")