Skip to content
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

tool: Opset coverage notebook #2831

Merged
merged 1 commit into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,8 @@ bazel-tensorrt
bazel-project
build/
wheelhouse/
*_status.json
tests/py/dynamo/models/*.ts
tests/py/dynamo/models/*.ep
*.deb
*.tar.xz
9 changes: 9 additions & 0 deletions py/torch_tensorrt/dynamo/tools/opset_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,15 @@ def opset_coverage(
)


def get_coverage_status(opset: List[Tuple[str, str]], name: str) -> OpsetCoverage:
coverage = opset_coverage(opset)
return coverage


ATEN_COVERAGE = get_coverage_status(ATEN_OPS, "ATen")
PRIMS_COVERAGE = get_coverage_status(PRIM_OPS, "prim")
PY_OVERLOAD_COVERAGE = get_coverage_status(OVERLOADED_PY_OPS, "py_overload")

if __name__ == "__main__":

def find_coverage_status(opset: List[Tuple[str, str]], name: str) -> None:
Expand Down
92 changes: 92 additions & 0 deletions tools/opset_coverage.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import torch_tensorrt\n",
"from torch_tensorrt.dynamo.tools.opset_coverage import ATEN_COVERAGE, PRIMS_COVERAGE, PY_OVERLOAD_COVERAGE, SupportStatus, OpsetCoverage"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"unsupported_ops = {}\n",
"backwards_ops = {}\n",
"\n",
"for target, info in ATEN_COVERAGE.support_status.items():\n",
" if info[\"status\"] == \"FALLBACK\":\n",
" if \"backward\" not in target:\n",
" unsupported_ops.update({target : info[\"schema\"]})\n",
" else:\n",
" backwards_ops.update({target : info[\"schema\"]})\n",
"\n",
"print(\"Unsupported Ops:\")\n",
"for _, schema in unsupported_ops.items():\n",
" print(schema)\n",
"\n",
"print(\"\\nBackwards Ops:\")\n",
"for _, schema in backwards_ops.items():\n",
" print(schema)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"unsupported_ops = {}\n",
"backwards_ops = {}\n",
"\n",
"for target, info in PRIMS_COVERAGE.support_status.items():\n",
" if info[\"status\"] == \"FALLBACK\":\n",
" if \"backward\" not in target:\n",
" unsupported_ops.update({target : info[\"schema\"]})\n",
" else:\n",
" backwards_ops.update({target : info[\"schema\"]})\n",
"\n",
"print(\"Unsupported Ops:\")\n",
"for _, schema in unsupported_ops.items():\n",
" print(schema)\n",
"\n",
"print(\"\\nBackwards Ops:\")\n",
"for _, schema in backwards_ops.items():\n",
" print(schema)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "torch230cu121py311",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.7"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading