Skip to content

Commit

Permalink
Kill computeAtBetween (#1911)
Browse files Browse the repository at this point in the history
  • Loading branch information
zasdfgbnm authored Aug 17, 2022
1 parent d0d106a commit 2ec8fc7
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 54 deletions.
45 changes: 0 additions & 45 deletions torch/csrc/jit/codegen/cuda/scheduler/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -600,51 +600,6 @@ TvProperties getProperties(
return properties;
}

void computeAtBetween(
const std::vector<TensorView*>& producers,
const std::vector<TensorView*>& overall_consumers,
int pos,
ComputeAtMode mode,
std::unordered_set<IterDomain*> mapped_to_trivial_reduction) {
for (auto producer : producers) {
// Figure out what's between producer and overall_consumers, will not give
// back any consumers that are not downstream from producer
auto all_vals_between = DependencyCheck::getAllValsBetween(
{producer}, {overall_consumers.begin(), overall_consumers.end()});

std::unordered_set<Val*> all_vals_between_set(
all_vals_between.begin(), all_vals_between.end());

for (auto consumer : overall_consumers) {
if (all_vals_between_set.count(consumer)) {
// The way we generate producers and consumers is that we inch away from
// inputs/outputs. There's a chance we could meet in the middle.
if (producer == consumer) {
continue;
}

auto pos_it = std::find_if(
consumer->domain()->domain().begin(),
consumer->domain()->domain().end(),
[&mapped_to_trivial_reduction](IterDomain* id) {
return mapped_to_trivial_reduction.count(id);
});

auto consumer_pos = pos_it == consumer->domain()->domain().end()
? pos
: std::min(
(int)std::distance(
consumer->domain()->domain().begin(), pos_it) +
1,
(pos < 0 ? pos + (int)consumer->nDims() : pos));
// Assume we don't want to reset computeAt on tensors that have already
// performed it.
producer->computeAt(consumer, consumer_pos, mode);
}
}
}
}

namespace {

// Figure out which persistent buffers are active at the generation of values in
Expand Down
9 changes: 0 additions & 9 deletions torch/csrc/jit/codegen/cuda/scheduler/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,6 @@ TvProperties getProperties(
SchedulerRuntimeInfo& runtime_info,
TensorView* tv);

// Will call computeAt once on each producer, with the first consumer found that
// is a consumer of the individual producer
void computeAtBetween(
const std::vector<TensorView*>& producers,
const std::vector<TensorView*>& consumers,
int pos,
ComputeAtMode mode,
std::unordered_set<IterDomain*> mapped_to_trivial_reduction = {});

// Struct to store persistent buffer sizes. also holds the persistent buffer
// size of the buffers are projected to the inputs.
struct PersistentBufferSizeReturn {
Expand Down

0 comments on commit 2ec8fc7

Please sign in to comment.