Skip to content

Commit

Permalink
Use pages.yml for github pages [#169] (#216)
Browse files Browse the repository at this point in the history
Fixed mdBook build errors:
- fixed wrong mdBook command
- moved docs/ops under docs/src/ops
- added README with hyperlinks to every file under docs/src (This is a
requirement by mdBook)
- added README under each folder
- wrote a script to autogenerate READMEs (This needs to run as a part of
nightly tests --> will handle in
#215)

I tested the website generation. Right now, it is uploaded as an
artifact but not deployed.
https://github.com/tenstorrent/tt-torch/actions/runs/12889599553 I
assume when merged into main, the website will also be deployed or we
will have more idea about why it's not.
  • Loading branch information
ddilbazTT authored Jan 22, 2025
1 parent cf83a2f commit c4659bc
Show file tree
Hide file tree
Showing 140 changed files with 185 additions and 11 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
name: docs

on:
# push:
# branches: ["main"]
# pull_request:
# branches: ["main"]
push:
branches: ["main"]
workflow_dispatch:

permissions:
Expand Down Expand Up @@ -35,12 +33,12 @@ jobs:
- name: Build documentation
run: |
mdbook build --output ./docs/.mdbook
mdbook build docs
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/.mdbook
path: docs/book

deploy:
environment:
Expand Down
81 changes: 81 additions & 0 deletions docs/generate_summary.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: (c) 2025 Tenstorrent AI ULC
#
# SPDX-License-Identifier: Apache-2.0
import os
from pathlib import Path


def generate_summary(docs_dir):
"""
Generate top level SUMMARY.md which includes references to all pages
"""
summary_lines = ["# Summary\n"]
summary_lines.append("- [Operations](ops/README.md)")
summary_lines.append(" - [StableHLO Operations](ops/stablehlo/README.md)")

# Add all Stablehlo operations
stablehlo_dir = Path(docs_dir) / "ops" / "stablehlo"
if stablehlo_dir.exists():
for file in sorted(stablehlo_dir.glob("*.md")):
if file.name != "README.md":
title = file.stem.replace(".", " ").title()
rel_path = file.relative_to(docs_dir)
summary_lines.append(f" - [{title}]({str(rel_path)})")

summary_lines.append(" - [TTNN Operations](ops/ttnn/README.md)")

# Add all TTNN operations
ttnn_dir = Path(docs_dir) / "ops" / "ttnn"
if ttnn_dir.exists():
for file in sorted(ttnn_dir.glob("*.md")):
if file.name != "README.md":
title = file.stem.replace(".", " ").title()
rel_path = file.relative_to(docs_dir)
summary_lines.append(f" - [{title}]({str(rel_path)})")

return "\n".join(summary_lines)


def ensure_readme_files(docs_dir):
"""
Ensure README.md files exist in necessary directories
"""
required_readmes = [
"ops/README.md",
"ops/stablehlo/README.md",
"ops/ttnn/README.md",
]

for readme_path in required_readmes:
full_path = Path(docs_dir) / readme_path
if not full_path.exists():
full_path.parent.mkdir(parents=True, exist_ok=True)
with open(full_path, "w") as f:
section_name = full_path.parent.name.title()
f.write(f"# {section_name} Documentation\n\n")
f.write(
f"This section contains documentation for {section_name} operations.\n"
)


def main():
docs_src_dir = Path("./docs/src")

if not docs_src_dir.exists():
print(f"Error: {docs_src_dir} directory not found")
return

ensure_readme_files(docs_src_dir)

# Generate and write SUMMARY.md
summary_content = generate_summary(docs_src_dir)
summary_path = docs_src_dir / "SUMMARY.md"
with open(summary_path, "w", encoding="utf-8") as f:
f.write(summary_content)

print(f"Generated SUMMARY.md at {summary_path}")


if __name__ == "__main__":
main()
5 changes: 0 additions & 5 deletions docs/index.md

This file was deleted.

94 changes: 94 additions & 0 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Summary

- [Operations](ops/README.md)
- [StableHLO Operations](ops/stablehlo/README.md)
- [Arith Constant](ops/stablehlo/arith.constant.md)
- [Stablehlo Add](ops/stablehlo/stablehlo.add.md)
- [Stablehlo And](ops/stablehlo/stablehlo.and.md)
- [Stablehlo Broadcast_In_Dim](ops/stablehlo/stablehlo.broadcast_in_dim.md)
- [Stablehlo Ceil](ops/stablehlo/stablehlo.ceil.md)
- [Stablehlo Clamp](ops/stablehlo/stablehlo.clamp.md)
- [Stablehlo Compare](ops/stablehlo/stablehlo.compare.md)
- [Stablehlo Concatenate](ops/stablehlo/stablehlo.concatenate.md)
- [Stablehlo Constant](ops/stablehlo/stablehlo.constant.md)
- [Stablehlo Convert](ops/stablehlo/stablehlo.convert.md)
- [Stablehlo Convolution](ops/stablehlo/stablehlo.convolution.md)
- [Stablehlo Cosine](ops/stablehlo/stablehlo.cosine.md)
- [Stablehlo Divide](ops/stablehlo/stablehlo.divide.md)
- [Stablehlo Dot_General](ops/stablehlo/stablehlo.dot_general.md)
- [Stablehlo Dynamic_Iota](ops/stablehlo/stablehlo.dynamic_iota.md)
- [Stablehlo Exponential](ops/stablehlo/stablehlo.exponential.md)
- [Stablehlo Floor](ops/stablehlo/stablehlo.floor.md)
- [Stablehlo Gather](ops/stablehlo/stablehlo.gather.md)
- [Stablehlo Iota](ops/stablehlo/stablehlo.iota.md)
- [Stablehlo Log](ops/stablehlo/stablehlo.log.md)
- [Stablehlo Logistic](ops/stablehlo/stablehlo.logistic.md)
- [Stablehlo Maximum](ops/stablehlo/stablehlo.maximum.md)
- [Stablehlo Minimum](ops/stablehlo/stablehlo.minimum.md)
- [Stablehlo Multiply](ops/stablehlo/stablehlo.multiply.md)
- [Stablehlo Negate](ops/stablehlo/stablehlo.negate.md)
- [Stablehlo Not](ops/stablehlo/stablehlo.not.md)
- [Stablehlo Power](ops/stablehlo/stablehlo.power.md)
- [Stablehlo Reduce_Stablehlo Add](ops/stablehlo/stablehlo.reduce_stablehlo.add.md)
- [Stablehlo Reduce_Stablehlo And](ops/stablehlo/stablehlo.reduce_stablehlo.and.md)
- [Stablehlo Reduce_Stablehlo Maximum](ops/stablehlo/stablehlo.reduce_stablehlo.maximum.md)
- [Stablehlo Reduce_Window_Stablehlo Add](ops/stablehlo/stablehlo.reduce_window_stablehlo.add.md)
- [Stablehlo Remainder](ops/stablehlo/stablehlo.remainder.md)
- [Stablehlo Reshape](ops/stablehlo/stablehlo.reshape.md)
- [Stablehlo Reverse](ops/stablehlo/stablehlo.reverse.md)
- [Stablehlo Rng](ops/stablehlo/stablehlo.rng.md)
- [Stablehlo Rsqrt](ops/stablehlo/stablehlo.rsqrt.md)
- [Stablehlo Scatter](ops/stablehlo/stablehlo.scatter.md)
- [Stablehlo Select](ops/stablehlo/stablehlo.select.md)
- [Stablehlo Sine](ops/stablehlo/stablehlo.sine.md)
- [Stablehlo Slice](ops/stablehlo/stablehlo.slice.md)
- [Stablehlo Sqrt](ops/stablehlo/stablehlo.sqrt.md)
- [Stablehlo Subtract](ops/stablehlo/stablehlo.subtract.md)
- [Stablehlo Tanh](ops/stablehlo/stablehlo.tanh.md)
- [Stablehlo Transpose](ops/stablehlo/stablehlo.transpose.md)
- [Tensor Empty](ops/stablehlo/tensor.empty.md)
- [TTNN Operations](ops/ttnn/README.md)
- [Ttnn Abs](ops/ttnn/ttnn.abs.md)
- [Ttnn Add](ops/ttnn/ttnn.add.md)
- [Ttnn Clamp](ops/ttnn/ttnn.clamp.md)
- [Ttnn Concat](ops/ttnn/ttnn.concat.md)
- [Ttnn Conv2D](ops/ttnn/ttnn.conv2d.md)
- [Ttnn Cos](ops/ttnn/ttnn.cos.md)
- [Ttnn Div](ops/ttnn/ttnn.div.md)
- [Ttnn Empty](ops/ttnn/ttnn.empty.md)
- [Ttnn Eq](ops/ttnn/ttnn.eq.md)
- [Ttnn Exp](ops/ttnn/ttnn.exp.md)
- [Ttnn Floor](ops/ttnn/ttnn.floor.md)
- [Ttnn From_Device](ops/ttnn/ttnn.from_device.md)
- [Ttnn Full](ops/ttnn/ttnn.full.md)
- [Ttnn Ge](ops/ttnn/ttnn.ge.md)
- [Ttnn Get_Device](ops/ttnn/ttnn.get_device.md)
- [Ttnn Gt](ops/ttnn/ttnn.gt.md)
- [Ttnn Log](ops/ttnn/ttnn.log.md)
- [Ttnn Logical_And](ops/ttnn/ttnn.logical_and.md)
- [Ttnn Logical_Not](ops/ttnn/ttnn.logical_not.md)
- [Ttnn Logical_Or](ops/ttnn/ttnn.logical_or.md)
- [Ttnn Logit](ops/ttnn/ttnn.logit.md)
- [Ttnn Lt](ops/ttnn/ttnn.lt.md)
- [Ttnn Matmul](ops/ttnn/ttnn.matmul.md)
- [Ttnn Max](ops/ttnn/ttnn.max.md)
- [Ttnn Maximum](ops/ttnn/ttnn.maximum.md)
- [Ttnn Minimum](ops/ttnn/ttnn.minimum.md)
- [Ttnn Multiply](ops/ttnn/ttnn.multiply.md)
- [Ttnn Ne](ops/ttnn/ttnn.ne.md)
- [Ttnn Neg](ops/ttnn/ttnn.neg.md)
- [Ttnn Remainder](ops/ttnn/ttnn.remainder.md)
- [Ttnn Reshape](ops/ttnn/ttnn.reshape.md)
- [Ttnn Rsqrt](ops/ttnn/ttnn.rsqrt.md)
- [Ttnn Scatter](ops/ttnn/ttnn.scatter.md)
- [Ttnn Sin](ops/ttnn/ttnn.sin.md)
- [Ttnn Slice](ops/ttnn/ttnn.slice.md)
- [Ttnn Sqrt](ops/ttnn/ttnn.sqrt.md)
- [Ttnn Subtract](ops/ttnn/ttnn.subtract.md)
- [Ttnn Sum](ops/ttnn/ttnn.sum.md)
- [Ttnn Tanh](ops/ttnn/ttnn.tanh.md)
- [Ttnn To_Device](ops/ttnn/ttnn.to_device.md)
- [Ttnn To_Layout](ops/ttnn/ttnn.to_layout.md)
- [Ttnn Transpose](ops/ttnn/ttnn.transpose.md)
- [Ttnn Typecast](ops/ttnn/ttnn.typecast.md)
- [Ttnn Where](ops/ttnn/ttnn.where.md)
3 changes: 3 additions & 0 deletions docs/src/ops/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ops Documentation

This section contains documentation for Ops operations.
3 changes: 3 additions & 0 deletions docs/src/ops/stablehlo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Stablehlo Documentation

This section contains documentation for Stablehlo operations.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit c4659bc

Please sign in to comment.