Skip to content

Conversation

zewenli98
Copy link
Collaborator

Description

Support aten.copy dynamo converter.

Fixes #2435

Type of change

  • 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: api [Python] Issues re: Python API component: conversion Issues re: Conversion stage component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths component: tests Issues re: Tests labels Dec 18, 2023
@github-actions github-actions bot requested a review from peri044 December 18, 2023 23:55
Comment on lines +2560 to +2574
return impl.cast.to_copy(
ctx,
target,
SourceIR.ATEN,
name,
src,
src.dtype,
force_layer=True,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

The force_layer=True does seem useful for the purpose of the test case, but in a normal model we should prefer force_layer=False. This should be a future feature, but to_copy should have an intelligent force_layer mechanism which can select whether to insert the layer based on whether the node is an input node to the TRTEngine.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I agree with you, but for now TensorRT doesn't support the same input and output.

Copy link
Contributor

Choose a reason for hiding this comment

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

I added #2561 to track this proposed feature (in Torch-TRT)

@zewenli98 zewenli98 force-pushed the copy_dynamo_converter branch from cd735dc to 05e02c0 Compare December 28, 2023 16:20
Comment on lines +2560 to +2574
return impl.cast.to_copy(
ctx,
target,
SourceIR.ATEN,
name,
src,
src.dtype,
force_layer=True,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

I added #2561 to track this proposed feature (in Torch-TRT)

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.

Looks good to me!

@zewenli98 zewenli98 merged commit a42dfb3 into pytorch:main Jan 2, 2024
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: conversion Issues re: Conversion stage component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths component: tests Issues re: Tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for aten.copy
3 participants