Skip to content

Conversation

@keehyuna
Copy link
Collaborator

@keehyunakeehyuna 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-actionsgithub-actionsbot 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
@keehyunakeehyuna self-assigned this Sep 27, 2024
@github-actionsgithub-actionsbot removed component: core Issues re: The core compiler component: runtime labels Sep 30, 2024
else:
raiseAssertionError(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
CollaboratorAuthor

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

@narendasannarendasan left a comment

Choose a reason for hiding this comment

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

LGTM

@narendasannarendasan merged commit c83b403 into pytorch:mainOct 2, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla signedcomponent: api [Python]Issues re: Python APIcomponent: dynamoIssues 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

@keehyuna@narendasan@facebook-github-bot