import os
import re
import shutil
import sys
from pathlib import Path
from subprocess import run
ROCM_VERSION = "7.14.0"
GA_DATE = "2026-07-15"
DOCS_DIR = Path(__file__).parent.resolve()
ROOT_DIR = DOCS_DIR.parent
def copy_rtd_file(src_path: Path, dest_path: Path):
dest_path.parent.mkdir(parents=True, exist_ok=True)
shutil.copy2(src_path, dest_path)
print(f"📁 Copied {src_path} → {dest_path}")
gh_changelog_path = ROOT_DIR / "CHANGELOG.md"
rtd_changelog_path = DOCS_DIR / "release" / "changelog.md"
copy_rtd_file(gh_changelog_path, rtd_changelog_path)
with open(rtd_changelog_path, "r+", encoding="utf-8") as file:
content = file.read()
file.seek(0)
file.write(":orphan:\n" + content)
latex_engine = "xelatex"
latex_elements = {
"fontpkg": r"""
\usepackage{tgtermes}
\usepackage{tgheros}
\renewcommand\ttdefault{txtt}
"""
}
project = "ROCm documentation"
project_path = str(DOCS_DIR).replace("\\", "/")
author = "Advanced Micro Devices, Inc."
copyright = "Copyright (c) %Y Advanced Micro Devices, Inc. All rights reserved."
version = ROCM_VERSION
release = ROCM_VERSION
setting_all_article_info = False
all_article_info_os = ["linux", "windows"]
all_article_info_author = ""
article_pages = [
{"file": "about/release-notes", "date": GA_DATE, "os": ["linux", "windows"]},
{"file": "compatibility/compatibility-matrix"},
]
external_toc_path = "./sphinx/_toc.yml"
sys.path.append(str(DOCS_DIR / "extension"))
extensions = [
"rocm_docs",
"rocm_docs_custom.selector",
"rocm_docs_custom.matrix",
"rocm_docs_custom.icon",
"rocm_docs_custom.csv_list_to_table",
"rocm_docs_custom.remote_content",
"rocm_docs_custom.remote_yaml",
"rocm_docs_custom.version_ref",
"rocm_docs_custom.merge_components",
"sphinxcontrib.datatemplates",
"sphinx_substitution_extensions",
]
templates_path = ["extension/rocm_docs_custom/selector/templates"]
html_static_path = ["sphinx/static"]
html_js_files = ["setup-toc-install-headings.js", "legacy/vllm-benchmark.js"]
html_css_files = ["legacy/vllm-benchmark.css"]
external_projects_current_project = "rocm"
html_theme = "rocm_docs_theme"
html_theme_options = {
"flavor": "rocm",
"link_main_doc": False,
"repository_url": "https://github.com/ROCm/ROCm",
"use_repository_button": True,
"use_issues_button": True,
}
html_title = f"AMD ROCm {ROCM_VERSION}"
html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "rocm.docs.amd.com")
html_context = {
"project_path": {project_path},
"gpu_type": [
("AMD Instinct accelerators", "intrinsic"),
("AMD gfx families", "gfx"),
("NVIDIA families", "nvidia"),
],
"atomics_type": [("HW atomics", "hw-atomics"), ("CAS emulation", "cas-atomics")],
"pcie_type": [("No PCIe atomics", "nopcie"), ("PCIe atomics", "pcie")],
"memory_type": [
("Device DRAM", "device-dram"),
("Migratable Host DRAM", "migratable-host-dram"),
("Pinned Host DRAM", "pinned-host-dram"),
],
"granularity_type": [
("Coarse-grained", "coarse-grained"),
("Fine-grained", "fine-grained"),
],
"scope_type": [("Device", "device"), ("System", "system")],
}
if os.environ.get("READTHEDOCS", "") == "True":
html_context["READTHEDOCS"] = True
myst_substitutions = {"ROCM_VERSION": ROCM_VERSION}
rst_prolog = "\n".join(
f".. |{key}| replace:: {val}" for key, val in myst_substitutions.items()
)
numfig = False
exclude_patterns = [
"exclude/**",
"**/include/**",
"**/extension/**",
"**/images/**",
]
official_branch = run(
["git", "rev-parse", "--abbrev-ref", "HEAD"], capture_output=True, text=True
).stdout.find("docs/")
rocdoc_components_data_current = DOCS_DIR / "data" / "components.yaml"
rocdoc_components_data_previous = DOCS_DIR / "data" / "components-previous.yaml"
rocdoc_components_data_default = DOCS_DIR / "data" / "components-default.yaml"
rocdoc_components_data_output = DOCS_DIR / "_data" / "components.yaml"