Skip to content

Kernel IR refactoring: part 5.1#290

Merged
tlemo merged 72 commits into20_7_6_develfrom
code_ir_part5b
Aug 14, 2020
Merged

Kernel IR refactoring: part 5.1#290
tlemo merged 72 commits into20_7_6_develfrom
code_ir_part5b

Conversation

@tlemo
Copy link
Copy Markdown
Collaborator

@tlemo tlemo commented Aug 13, 2020

We're one step closer to a specialized kernel IR container. This iteration is restructuring some of the state in preparation for this standalone container:

  1. Fusion::values_map_ is no longer necessary!
  2. Fusion::kir_map_ moved to GpuLower::kir_map_
  3. The actual lowering parts of prepareForLowering() is now part of GpuLower

tlemo added 30 commits July 20, 2020 17:55
This reverts commit fc09c1b5a7240701da093406753908eba6f41e1d.
Copy link
Copy Markdown
Owner

@csarofeen csarofeen left a comment

Choose a reason for hiding this comment

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

Seems reasonable, minor comments, pre-approved.

Comment thread torch/csrc/jit/codegen/cuda/kernel_ir.h Outdated
namespace fuser {
namespace kir {

#if 0
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Is there a reason to leave this in the PR?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good catch - no good reason. It's likely going to be back in the next iteration but I will remove it from this PR.


void handle(const TensorDomain* node) override {
const auto lowered_node = new kir::TensorDomain(node);
TORCH_CHECK(gpu_lower_->kir_map_.insert({node, lowered_node}).second);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Why not put gpu_lower_->kir_map_.insert({node, lowered_node}).second in the constructor new kir::TensorDomain(node)

I'm worried people could call kir::TensorDomain(node) directly instead of using loweredValue(node) which would typically be a bad thing to do.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

kir::TensorDomain's constructor doesn't know about GpuLower (or have access to kir_map_). Or have I misunderstood the comment?

I do agree about the potential trouble with people calling the "lowering" constructors directly though. I'm still considering options to limit this, but I haven't spent too much time on it since we need to revisit the whole Kernel IR "builder" interface soon anyway (once it's a separate class hierarchy, we're not going to have the luxury of FusionGuard or Fusion::registerStuff())

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Sounds good, I'm hopeful we can limit it, I got in some trouble when they were called explicitly before, would be nice to hide them if we can.

@tlemo tlemo merged commit b92d496 into 20_7_6_devel Aug 14, 2020
@tlemo tlemo deleted the code_ir_part5b branch August 14, 2020 21:07
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.

5 participants