Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: Adding support for native int64#2789

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
narendasan merged 3 commits intomainfromnative_i64_support
Apr 30, 2024
Merged

Conversation

@narendasan
Copy link
Collaborator

Signed-off-by: Naren Dasannaren@narendasan.com
Signed-off-by: Naren Dasannarens@nvidia.com

Description

Adds support for int64 as a native type in TensorRT

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: testsIssues re: Tests component: conversionIssues re: Conversion stage component: coreIssues re: The core compiler component: api [Python]Issues re: Python API component: runtime component: dynamoIssues relating to the `torch.compile` or `torch._dynamo.export` paths labelsApr 27, 2024
Copy link

@github-actionsgithub-actionsbot 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 C++ style guidelines:

diff --git a/home/runner/work/TensorRT/TensorRT/core/util/trt_util.cpp b/tmp/changes.txtindex 503b88e..3ca5780 100644--- a/home/runner/work/TensorRT/TensorRT/core/util/trt_util.cpp+++ b/tmp/changes.txt@@ -164,8 +164,8 @@ nvinfer1::Dims unsqueezeDims(const nvinfer1::Dims& d, int pos, int val, bool use  // Acceptable range for pos is [-d.nbDims - 1, d.nbDims]  TORCHTRT_ASSERT(      pos >= (-d.nbDims - 1) && pos <= d.nbDims,-      "ERROR: Index to unsqueeze is out of bounds. " << "Expected value in range [" << (-d.nbDims - 1) << ", "-                                                     << d.nbDims << "], but got " << pos);+      "ERROR: Index to unsqueeze is out of bounds. "+          << "Expected value in range [" << (-d.nbDims - 1) << ", " << d.nbDims << "], but got " << pos);  // Unsqueeze with negative dimensions creates a new dimension at that index  pos = (pos < 0) ? (pos + d.nbDims + 1) : pos;ERROR: Some files do not conform to style guidelines

@narendasannarendasan requested review fromgs-olive andperi044 and removed request forbowang007April 27, 2024 01:18
Copy link

@github-actionsgithub-actionsbot 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 C++ style guidelines:

diff --git a/home/runner/work/TensorRT/TensorRT/core/util/trt_util.cpp b/tmp/changes.txtindex 503b88e..3ca5780 100644--- a/home/runner/work/TensorRT/TensorRT/core/util/trt_util.cpp+++ b/tmp/changes.txt@@ -164,8 +164,8 @@ nvinfer1::Dims unsqueezeDims(const nvinfer1::Dims& d, int pos, int val, bool use  // Acceptable range for pos is [-d.nbDims - 1, d.nbDims]  TORCHTRT_ASSERT(      pos >= (-d.nbDims - 1) && pos <= d.nbDims,-      "ERROR: Index to unsqueeze is out of bounds. " << "Expected value in range [" << (-d.nbDims - 1) << ", "-                                                     << d.nbDims << "], but got " << pos);+      "ERROR: Index to unsqueeze is out of bounds. "+          << "Expected value in range [" << (-d.nbDims - 1) << ", " << d.nbDims << "], but got " << pos);  // Unsqueeze with negative dimensions creates a new dimension at that index  pos = (pos < 0) ? (pos + d.nbDims + 1) : pos;ERROR: Some files do not conform to style guidelines

Copy link

@github-actionsgithub-actionsbot 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 C++ style guidelines:

diff --git a/home/runner/work/TensorRT/TensorRT/core/util/trt_util.cpp b/tmp/changes.txtindex 503b88e..3ca5780 100644--- a/home/runner/work/TensorRT/TensorRT/core/util/trt_util.cpp+++ b/tmp/changes.txt@@ -164,8 +164,8 @@ nvinfer1::Dims unsqueezeDims(const nvinfer1::Dims& d, int pos, int val, bool use  // Acceptable range for pos is [-d.nbDims - 1, d.nbDims]  TORCHTRT_ASSERT(      pos >= (-d.nbDims - 1) && pos <= d.nbDims,-      "ERROR: Index to unsqueeze is out of bounds. " << "Expected value in range [" << (-d.nbDims - 1) << ", "-                                                     << d.nbDims << "], but got " << pos);+      "ERROR: Index to unsqueeze is out of bounds. "+          << "Expected value in range [" << (-d.nbDims - 1) << ", " << d.nbDims << "], but got " << pos);  // Unsqueeze with negative dimensions creates a new dimension at that index  pos = (pos < 0) ? (pos + d.nbDims + 1) : pos;ERROR: Some files do not conform to style guidelines

Copy link
Contributor

@gs-olivegs-olive left a comment

Choose a reason for hiding this comment

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

Overall looks good! May need modification to this file as well:

if (
isinstance(input_val,torch.Tensor)
andctx.compilation_settings.truncate_long_and_double
):
ifinput_val.dtype==torch.int64:
input_val=input_val.to(torch.int32)
elifinput_val.dtype==torch.float64:
input_val=input_val.to(torch.float32)
elif (
isinstance(input_val,np.ndarray)
andctx.compilation_settings.truncate_long_and_double
):
ifinput_val.dtype==np.int64:
input_val=input_val.astype(np.int32)
elifinput_val.dtype==np.float64:
input_val=input_val.astype(np.float32)

@github-actionsgithub-actionsbot added the component: convertersIssues re: Specific op converters labelApr 29, 2024
github-actions[bot]

This comment was marked as outdated.

github-actions[bot]

This comment was marked as outdated.

@narendasannarendasanforce-pushed thenative_i64_support branch 3 times, most recently from7b6bdcd toff2f9aeCompareApril 30, 2024 02:03
Copy link
Collaborator

@peri044peri044 left a comment

Choose a reason for hiding this comment

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

LGTM. Minor changes

@narendasannarendasanforce-pushed thenative_i64_support branch 2 times, most recently from9e839df to2d0fa75CompareApril 30, 2024 21:04
Copy link
Contributor

@gs-olivegs-olive left a comment

Choose a reason for hiding this comment

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

Looks good to me

Comment on lines +149 to +153
warnings.warn(
'Compiler option "truncate_long_and_double" is deprecated in favor of "truncate_double" as int64 is now natively supported, this option will be removed in the next version',
DeprecationWarning,
stacklevel=2,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason for not usinglogger here?

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

This is apparently the recommended way to handle deprecation warnings, iirc I configured the logger to pull these messages in in an earlier PR

Signed-off-by: Naren Dasan <naren@narendasan.com>Signed-off-by: Naren Dasan <narens@nvidia.com>
`truncate_long_and_double` has been deprecated in favor of`truncate_double` as int64 is natively supportedSigned-off-by: Naren Dasan <naren@narendasan.com>Signed-off-by: Naren Dasan <narens@nvidia.com>
all layersSigned-off-by: Naren Dasan <naren@narendasan.com>Signed-off-by: Naren Dasan <narens@nvidia.com>
@gs-olive
Copy link
Contributor

  • Verified functional compilation on Stable Diffusion example

@narendasannarendasan merged commit717e11b intomainApr 30, 2024
@narendasannarendasan deleted the native_i64_support branchApril 30, 2024 22:57
narendasan added a commit that referenced this pull requestApr 30, 2024
Signed-off-by: Naren Dasan <naren@narendasan.com>Signed-off-by: Naren Dasan <narens@nvidia.com>
narendasan added a commit that referenced this pull requestMay 1, 2024
Signed-off-by: Naren Dasan <naren@narendasan.com>Signed-off-by: Naren Dasan <narens@nvidia.com>
laikhtewari pushed a commit that referenced this pull requestMay 24, 2024
Signed-off-by: Naren Dasan <naren@narendasan.com>Signed-off-by: Naren Dasan <narens@nvidia.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@peri044peri044peri044 requested changes

@github-actionsgithub-actions[bot]github-actions[bot] requested changes

+1 more reviewer

@gs-olivegs-olivegs-olive approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

cla signedcomponent: api [Python]Issues re: Python APIcomponent: conversionIssues re: Conversion stagecomponent: convertersIssues re: Specific op converterscomponent: coreIssues re: The core compilercomponent: dynamoIssues relating to the `torch.compile` or `torch._dynamo.export` pathscomponent: runtimecomponent: testsIssues re: Tests

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@narendasan@gs-olive@peri044@facebook-github-bot

[8]ページ先頭

©2009-2025 Movatter.jp