Skip to content

Conversation

@wu6u3tw
Copy link
Contributor

@wu6u3tw wu6u3tw commented Sep 20, 2023

Description

To improve the debuggability, we try to set the layer name for each myelin output for a more meaningful naming so that we can replace the "Unnamed Layer #" with its original name.

Fixes # (issue)

Type of change

Please delete options that are not relevant and/or add your own.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

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

@wu6u3tw
Copy link
Contributor Author

wu6u3tw commented Sep 20, 2023

@nvpohanh for viz

Copy link
Contributor

@gs-olive gs-olive left a comment

Choose a reason for hiding this comment

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

This change would be very beneficial for layer naming, thanks for the PR! It would be preferable to add this change to the Dynamo directory instead. Could you copy the function set_layer_name with your changes to the file py/torch_tensorrt/dynamo/conversion/converter_utils.py, and then update imports of set_layer_name in any file within the py/torch_tensorrt/dynamo/ directory to use this version of the function? The fx/ directory should preferably be unchanged.


for i in range(layer.num_outputs):
output = layer.get_output(i)
layer.name.append(f"-[{output.name}]")
Copy link
Contributor

Choose a reason for hiding this comment

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

Should layer.name.append(f"-[{output.name}]") instead be layer.name += f"-[{output.name}]"?

Copy link
Contributor

Choose a reason for hiding this comment

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

@wu6u3tw I think we should set the output tensor's name. Something like: output.name = "..."

Copy link
Contributor

Choose a reason for hiding this comment

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

We should not just append all the output tensor names to layer name because that makes layer name very long

else f"{source_ir}_ops.{target.__name__}"
)
layer.name = f"[{layer.type.name}]-[{target_name}]-[{name}]"
layer.name = f"[{layer.type.name}]-[{target_name}]-[{name}]-[#_of_outputs_{layer.num_outputs}]"
Copy link
Contributor

Choose a reason for hiding this comment

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

Please also set the layer metadata: layer.metadata = ...

Copy link
Contributor

Choose a reason for hiding this comment

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

Consider moving [#_of_outputs_{layer.num_outputs}] into metadata instead of in layer name directly

apbose and others added 21 commits September 21, 2023 12:03
Co-authored-by: gs-olive <113141689+gs-olive@users.noreply.github.com>
Signed-off-by: Torch-TensorRT Github Bot <torch-tensorrt.github.bot@nvidia.com>
Dynamo converter support for torch.ops.aten.erf.default op
Signed-off-by: Torch-TensorRT Github Bot <torch-tensorrt.github.bot@nvidia.com>
Signed-off-by: Torch-TensorRT Github Bot <torch-tensorrt.github.bot@nvidia.com>
Signed-off-by: Torch-TensorRT Github Bot <torch-tensorrt.github.bot@nvidia.com>
Signed-off-by: Torch-TensorRT Github Bot <torch-tensorrt.github.bot@nvidia.com>
Signed-off-by: Torch-TensorRT Github Bot <torch-tensorrt.github.bot@nvidia.com>
Signed-off-by: Bo Wang <bowa@nvidia.com>
Signed-off-by: Torch-TensorRT Github Bot <torch-tensorrt.github.bot@nvidia.com>
@github-actions github-actions bot added component: conversion Issues re: Conversion stage component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths labels Oct 7, 2023
@wu6u3tw
Copy link
Contributor Author

wu6u3tw commented Oct 9, 2023

@gs-olive thanks! I update the PR. Please let me know if there is any other advices.

@github-actions github-actions bot added component: api [C++] Issues re: C++ API component: build system Issues re: Build system component: converters Issues re: Specific op converters component: core Issues re: The core compiler component: lowering Issues re: The lowering / preprocessing passes component: runtime component: tests Issues re: Tests component: torch_compile documentation Improvements or additions to documentation labels Oct 9, 2023
@wu6u3tw wu6u3tw closed this Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla signed component: api [C++] Issues re: C++ API component: api [Python] Issues re: Python API component: build system Issues re: Build system component: conversion Issues re: Conversion stage component: converters Issues re: Specific op converters component: core Issues re: The core compiler component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths component: fx component: lowering Issues re: The lowering / preprocessing passes component: runtime component: tests Issues re: Tests component: torch_compile documentation Improvements or additions to documentation fx

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants