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

Adjust cpp torch trt logging level with compiler option #3181

Merged
merged 5 commits into from
Oct 2, 2024

Conversation

keehyuna
Copy link
Collaborator

@keehyuna keehyuna commented Sep 26, 2024

Description

Log level of python and native TRT logger is set differently. Same level from compiler option should be helpful to work with development version of torch-TRT module.

  • python trt logger: when compiler option provide debug=True
  • c++ trt logger: compiled at build time

TorchTRTLogger.cpp
#ifndef NDEBUG
static TorchTRTLogger global_logger("[Torch-TensorRT - Debug Build] - ", LogLevel::kDEBUG, true);
#else
static TorchTRTLogger global_logger("[Torch-TensorRT] - ", LogLevel::kWARNING, false);
#endif

And profile option for c++ trt runtime module is enabled by debug level logging. This is helpful to measure/evaluate
performance with development version of torch-TRT module

Fixes # (issue)

Type of change

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

  • New feature (non-breaking change which adds functionality)

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: core Issues re: The core compiler component: api [Python] Issues re: Python API component: runtime component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths labels Sep 26, 2024
@keehyuna keehyuna self-assigned this Sep 27, 2024
@github-actions github-actions bot removed component: core Issues re: The core compiler component: runtime labels Sep 30, 2024
else:
raise AssertionError(f"{level} is not valid log level")

torch.ops.tensorrt.set_logging_level(int(log_level))
Copy link
Collaborator

Choose a reason for hiding this comment

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

What happens in the case that it is a python only build? You might want to use enabled features to gate access to this code to only when the C++ runtime is available.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You're right, I see the problem. Updated the change.

AttributeError: '_OpNamespace' 'tensorrt' object has no attribute 'set_logging_level'

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 c83b403 into pytorch:main Oct 2, 2024
67 checks passed
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