Skip to content

Conversation

tlemo
Copy link
Collaborator

@tlemo tlemo commented Aug 21, 2020

Splits the origin (definition) links between Fusion IR and Kernel IR. This will allow moving the nodes into different containers (as well as cleaning up parts which are not really needed for the Kernel IR, ex. cloning)

Also fixing isConstScalar() and a couple of build warnings in kernel_cache.cpp

Copy link
Collaborator

@naoyam naoyam left a comment

Choose a reason for hiding this comment

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

LGTM

}

for (Val* output : expr->outputs()) {
TORCH_CHECK(inKernelIr(output));
assertInFusion(output);
TORCH_CHECK(origin_.insert({output, expr}).second);
TORCH_CHECK(lowered_origin_.insert({output, expr}).second);
Copy link
Collaborator

Choose a reason for hiding this comment

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

nitpick: can we emplace(output, expr) instead of insert({output, expr}). Upstream guys are slowly updating that in our code base: https://github.com/pytorch/pytorch/pull/43223/files

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

thanks. the whole emplace thing is borderline silly (as it's technically unsound in this case - emplace is only relevant when the copy is expensive, which is not the case here). so indiscriminately using emplace is almost as bad as overusing std::move() :(

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

PS. the upstream changes don't seem to be about insert() vs emplace(), as much as 1. cleaning up an emplace() miss-use (which resulted in the copy operation, ie. practically same as insert()) and 2. working around an old GCC library issue (related to std::unique_ptr not being copyable)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ha thanks for the education, I totally missed the unique_ptr in their PR 😢

@tlemo tlemo merged commit 907782b into 20_8_18_devel Aug 21, 2020
@tlemo tlemo deleted the kernel_ir_part6 branch August 21, 2020 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants