Skip to content

Support new FX Legacy Registry in opset coverage tool #2366

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

Merged
merged 4 commits into from
Oct 27, 2023

Conversation

laikhtewari
Copy link
Collaborator

@laikhtewari laikhtewari commented Oct 6, 2023

Description

The opset_coverage.py tool was failing with the following error:

Traceback (most recent call last):
  File "/opt/torch_tensorrt/py/torch_tensorrt/dynamo/tools/opset_coverage.py", line 213, in <module>
    find_coverage_status(ATEN_OPS, "ATen")
  File "/opt/torch_tensorrt/py/torch_tensorrt/dynamo/tools/opset_coverage.py", line 199, in find_coverage_status
    coverage = opset_coverage(opset)
  File "/opt/torch_tensorrt/py/torch_tensorrt/dynamo/tools/opset_coverage.py", line 147, in opset_coverage
    elif registry_data["FX ATen Converters Registry"] >= 1:
KeyError: 'FX ATen Converters Registry'

For some reason, some ATen and Prims ops appear with the registry name "FX Legacy ATen Converters Registry"

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code follows the style guidelines of this project (You can use the linters)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas and hacks
  • I have made corresponding changes to the documentation
  • I have added tests to verify my fix or my feature
  • New and existing unit tests pass locally with my changes
  • I have added the relevant labels to my PR in so that relevant reviewers are notified

@github-actions github-actions bot added component: api [Python] Issues re: Python API component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths labels Oct 6, 2023
@github-actions github-actions bot requested a review from peri044 October 6, 2023 01:35
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to C++ style guidelines

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some changes that do not conform to Python style guidelines:

--- /home/runner/work/TensorRT/TensorRT/py/torch_tensorrt/dynamo/tools/opset_coverage.py	2023-10-06 01:35:27.859438+00:00
+++ /home/runner/work/TensorRT/TensorRT/py/torch_tensorrt/dynamo/tools/opset_coverage.py	2023-10-06 01:38:03.371191+00:00
@@ -144,14 +144,23 @@
            _, registry_data = c_registry.get_all_converters_with_target(
                target, return_registry_info=True
            )

            if registry_data is not None:
-                if DYNAMO_REGISTRY_NAME in registry_data and registry_data[DYNAMO_REGISTRY_NAME] >= 1:
+                if (
+                    DYNAMO_REGISTRY_NAME in registry_data
+                    and registry_data[DYNAMO_REGISTRY_NAME] >= 1
+                ):
                    status = SupportStatus.CONVERTED
                    support_count += 1
-                elif (FX_REGISTRY_NAME in registry_data and registry_data[FX_REGISTRY_NAME] >= 1) or (FX_LEGACY_REGISTRY_NAME in registry_data and registry_data[FX_LEGACY_REGISTRY_NAME] >= 1):
+                elif (
+                    FX_REGISTRY_NAME in registry_data
+                    and registry_data[FX_REGISTRY_NAME] >= 1
+                ) or (
+                    FX_LEGACY_REGISTRY_NAME in registry_data
+                    and registry_data[FX_LEGACY_REGISTRY_NAME] >= 1
+                ):
                    status = SupportStatus.LEGACY_CONVERTED
                    legacy_count += 1

                support_status[target_str] = {
                    "schema": f"{target_str.split('.')[0]}.{opset_schemas[target_str]}",

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to C++ style guidelines

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some changes that do not conform to Python style guidelines:

--- /home/runner/work/TensorRT/TensorRT/py/torch_tensorrt/dynamo/tools/opset_coverage.py	2023-10-06 01:38:34.264390+00:00
+++ /home/runner/work/TensorRT/TensorRT/py/torch_tensorrt/dynamo/tools/opset_coverage.py	2023-10-06 01:41:34.649301+00:00
@@ -144,14 +144,23 @@
            _, registry_data = c_registry.get_all_converters_with_target(
                target, return_registry_info=True
            )

            if registry_data is not None:
-                if DYNAMO_REGISTRY_NAME in registry_data and registry_data[DYNAMO_REGISTRY_NAME] >= 1:
+                if (
+                    DYNAMO_REGISTRY_NAME in registry_data
+                    and registry_data[DYNAMO_REGISTRY_NAME] >= 1
+                ):
                    status = SupportStatus.CONVERTED
                    support_count += 1
-                elif (FX_REGISTRY_NAME in registry_data and registry_data[FX_REGISTRY_NAME] >= 1) or (FX_LEGACY_REGISTRY_NAME in registry_data and registry_data[FX_LEGACY_REGISTRY_NAME] >= 1):
+                elif (
+                    FX_REGISTRY_NAME in registry_data
+                    and registry_data[FX_REGISTRY_NAME] >= 1
+                ) or (
+                    FX_LEGACY_REGISTRY_NAME in registry_data
+                    and registry_data[FX_LEGACY_REGISTRY_NAME] >= 1
+                ):
                    status = SupportStatus.LEGACY_CONVERTED
                    legacy_count += 1
                else:
                    raise Exception(f"Op belongs to unknown registry: {registry_data}")

@laikhtewari laikhtewari marked this pull request as ready for review October 6, 2023 01:44
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to C++ style guidelines

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some changes that do not conform to Python style guidelines:

--- /home/runner/work/TensorRT/TensorRT/py/torch_tensorrt/dynamo/tools/opset_coverage.py	2023-10-06 01:41:32.426768+00:00
+++ /home/runner/work/TensorRT/TensorRT/py/torch_tensorrt/dynamo/tools/opset_coverage.py	2023-10-06 01:44:53.379336+00:00
@@ -145,18 +145,18 @@
                target, return_registry_info=True
            )

            if registry_data is not None:
                if (
-                        DYNAMO_REGISTRY_NAME in registry_data
-                        and registry_data[DYNAMO_REGISTRY_NAME] >= 1
+                    DYNAMO_REGISTRY_NAME in registry_data
+                    and registry_data[DYNAMO_REGISTRY_NAME] >= 1
                ):
                    status = SupportStatus.CONVERTED
                    support_count += 1
                elif (
-                        FX_REGISTRY_NAME in registry_data
-                        and registry_data[FX_REGISTRY_NAME] >= 1
+                    FX_REGISTRY_NAME in registry_data
+                    and registry_data[FX_REGISTRY_NAME] >= 1
                ) or (
                    FX_LEGACY_REGISTRY_NAME in registry_data
                    and registry_data[FX_LEGACY_REGISTRY_NAME] >= 1
                ):
                    status = SupportStatus.LEGACY_CONVERTED

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to C++ style guidelines

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to Python style guidelines

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to C++ style guidelines

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to Python style guidelines

Copy link
Collaborator

@narendasan narendasan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@narendasan narendasan merged commit ea70b8c into main Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla signed component: api [Python] Issues re: Python API component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants