Skip to content

9082 educate users on mat mul precision #9103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 41 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
86200a5
initial commit: binding and backends package, no tests.
yaoshiang May 2, 2025
2901b77
Tests for default, high, and highest precision.
yaoshiang May 2, 2025
564685a
clang-format
yaoshiang May 2, 2025
4c0b52e
formatter
yaoshiang May 2, 2025
0d3f44f
Updates to error messages
yaoshiang May 2, 2025
3c333d8
fixed test class names
yaoshiang May 2, 2025
967ccda
typo
yaoshiang May 2, 2025
393257e
typo on error message. unit tested and yapfed.
yaoshiang May 5, 2025
f48d7f6
linter
yaoshiang May 5, 2025
114456b
minor edits.
yaoshiang May 5, 2025
2d05da1
Merge branch '9080-expose-mat_mul_precision' into 9082-educate-users-…
yaoshiang May 6, 2025
587f6e5
initial commit
yaoshiang May 6, 2025
a247bde
adding updated note for __init__
yaoshiang May 6, 2025
69fdb49
removed todo (done!)
yaoshiang May 6, 2025
87cff3d
Updated TODO per review
yaoshiang May 6, 2025
b96f671
Update todo and precision math per comment.
yaoshiang May 6, 2025
c26ad8f
Merge branch 'master' into 9080-expose-mat_mul_precision
yaoshiang May 6, 2025
a825e12
Merge branch '9080-expose-mat_mul_precision' into 9082-educate-users-…
yaoshiang May 6, 2025
8f4b12b
Adding image to second location. Minor typos on README.
yaoshiang May 6, 2025
30d1c19
yapf
yaoshiang May 6, 2025
324bde4
Merge branch '9080-expose-mat_mul_precision' into 9082-educate-users-…
yaoshiang May 6, 2025
e15443f
yapf
yaoshiang May 6, 2025
959b0dc
linter
yaoshiang May 7, 2025
02a5069
parameterized, but in a process isolated way.
yaoshiang May 9, 2025
0205431
Revert "parameterized, but in a process isolated way."
yaoshiang May 9, 2025
8aaa979
parameterized, but in a process isolated way.
yaoshiang May 9, 2025
04516c7
removed dead code
yaoshiang May 9, 2025
c3856c8
added issue for repeatable, unexpected behavior.
yaoshiang May 9, 2025
3fae53c
Merge branch '9080-expose-mat_mul_precision' into 9082-educate-users-…
yaoshiang May 9, 2025
eafc98e
indent
yaoshiang May 9, 2025
6e3fdf9
Updated docstring.
yaoshiang May 9, 2025
a2e2298
Revert "Updated docstring."
yaoshiang May 9, 2025
79af416
Updated docstring.
yaoshiang May 9, 2025
6ff7f59
changed naming of is_on_tpu
yaoshiang May 9, 2025
89c72a8
Merge branch 'master' into 9080-expose-mat_mul_precision
yaoshiang May 9, 2025
9db6e3e
CICD friendly version, hopefully.
yaoshiang May 9, 2025
922b57f
Merge branch '9080-expose-mat_mul_precision' into 9082-educate-users-…
yaoshiang May 9, 2025
4b629d8
Merge branch '9082-educate-users-on-mat-mul-precision' of https://git…
yaoshiang May 9, 2025
bcea8e9
Updates based on comments.
yaoshiang May 9, 2025
56cfbce
addressing comments
yaoshiang May 10, 2025
9c53282
tutorial changes
yaoshiang May 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.ipynb diff=none merge=binary
47 changes: 46 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,49 @@ git push origin gh-pages
To add a new doc please create a `.md` file under this directory. To make this doc show up in our [doc pages](https://pytorch.org/xla/master/index.html), please add a `.rst` file under `source/`.

## Adding images in the doc
Please add your imges to both `_static/img/` and `source/_static/img/` for images to properlly show up in the markdown files as well as our [doc pages](https://pytorch.org/xla/master/index.html).
Please add your imges to both `_static/img/` and `source/_static/img/` for images to properly show up in the markdown files as well as our [doc pages](https://pytorch.org/xla/master/index.html).

## Runnable tutorials

Stylistically, review the [pytorch tutorial contributing guide](https://github.com/pytorch/tutorials/blob/main/CONTRIBUTING.md).

Save your tutorial as `*_tutorial.py`.

We do not yet have an automated build system for runnable tutorials that matches
PyTorch. For now, include manual instructions and check-in the output ipynb and MD files.

TODO: Automate build of runnable tutorials. https://github.com/pytorch/xla/issues/9136

Note that the existing .gitattributes in this directory will prevent diffs and merges
on the ipynb's json representation, which is difficult to diff.

Add your runnable tutorial to the list below with build instructions,
necessary environments, and steps to manually verify correctness.

### source/tutorials/precision_tutorial.py

Run on a TPU machine.

One time installs not in requirements.txt:

```sh
conda install -c conda-forge pandoc
```

Run every time:

```sh
py2nb source/tutorials/precision_tutorial.py
jupyter nbconvert --to notebook --execute --inplace source/tutorials/precision_tutorial.ipynb
# Ignore SIGTERM
# Manually verify that the final line of precision_tutorial.ipynb matches the snippet below.
./docs_build.sh
# Download build/ to your local machine and visually inspect the precision_tutorial.html in a browser.
# Look for issues like headers that didn't render and mathjax that didn't render.
```

The final code output in the ipynb and html should look like this:
```
Z_ref: FORMAT:0b SIGN:0 EXPONENT:01111111 MANTISSA:01110000101000111101100 VALUE=1.440000057220459
Z: FORMAT:0b SIGN:0 EXPONENT:01111111 MANTISSA:01110000101000111101101 VALUE=1.4400001764297485
```
229 changes: 229 additions & 0 deletions docs/_static/img/bit_layout.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/img/decomposing_multiplication.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ docutils==0.16
Jinja2==3.1.3
m2r
-e git+https://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme
py2nb==1.0.0
nbsphinx==0.9.3
lxml[html_clean] # Workaround for an issue in nbsphinx
Loading