Skip to content

Commit

Permalink
Fix three nits (#8137)
Browse files Browse the repository at this point in the history
1) has_gpu_feature already includes Vulkan, so there's no need to check
for it.

2) Use emplace(...) instead of insert(make_pair(...))

3) Fixed a place that should be using a ScopedValue
  • Loading branch information
abadams authored Mar 13, 2024
1 parent 4988ab5 commit 83616f2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
6 changes: 3 additions & 3 deletions src/BoundsInference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1152,7 +1152,7 @@ class BoundsInference : public IRMutator {
map<string, Function> stage_name_to_func;

if (producing >= 0) {
fused_group.insert(make_pair(f.name(), stage_index));
fused_group.emplace(f.name(), stage_index);
}

if (!no_pipelines && producing >= 0 && !f.has_extern_definition()) {
Expand All @@ -1164,12 +1164,12 @@ class BoundsInference : public IRMutator {
if (!((pair.func_1 == stages[producing].name) && ((int)pair.stage_1 == stage_index)) && is_fused_with_others(fused_groups, fused_pairs_in_groups,
f, stage_index,
pair.func_1, pair.stage_1, var)) {
fused_group.insert(make_pair(pair.func_1, pair.stage_1));
fused_group.emplace(pair.func_1, pair.stage_1);
}
if (!((pair.func_2 == stages[producing].name) && ((int)pair.stage_2 == stage_index)) && is_fused_with_others(fused_groups, fused_pairs_in_groups,
f, stage_index,
pair.func_2, pair.stage_2, var)) {
fused_group.insert(make_pair(pair.func_2, pair.stage_2));
fused_group.emplace(pair.func_2, pair.stage_2);
}
}

Expand Down
5 changes: 1 addition & 4 deletions src/Lower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,7 @@ void lower_impl(const vector<Function> &output_funcs,
s = split_tuples(s, env);
log("Lowering after destructuring tuple-valued realizations:", s);

// Vulkan relies on GPU var canonicalization occurring before
// storage flattening.
if (t.has_gpu_feature() ||
t.has_feature(Target::Vulkan)) {
if (t.has_gpu_feature()) {
debug(1) << "Canonicalizing GPU var names...\n";
s = canonicalize_gpu_vars(s);
log("Lowering after canonicalizing GPU var names:", s);
Expand Down
8 changes: 2 additions & 6 deletions src/StorageFlattening.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,13 +535,9 @@ class FlattenDimensions : public IRMutator {
Interval loop_bounds = Interval(expanded_min, simplify(expanded_min + expanded_extent - 1));
it->loop_vars.push(op->name, loop_bounds);
}
bool old_in_gpu = in_gpu;
if (op->for_type == ForType::GPUBlock ||
op->for_type == ForType::GPUThread) {
in_gpu = true;
}

ScopedValue<bool> old_in_gpu(in_gpu, in_gpu || is_gpu(op->for_type));
Stmt stmt = IRMutator::visit(op);
in_gpu = old_in_gpu;

for (auto &p : hoisted_storages) {
p.loop_vars.pop(op->name);
Expand Down
2 changes: 1 addition & 1 deletion src/autoschedulers/mullapudi2016/AutoSchedule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1359,7 +1359,7 @@ Partitioner::Partitioner(const map<string, Box> &_pipeline_bounds,
for (int s = 0; s < num_stages; s++) {
FStage stg(f.second, s);
Group g(stg, {stg});
groups.insert(make_pair(stg, g));
groups.emplace(stg, g);
}
}

Expand Down

0 comments on commit 83616f2

Please sign in to comment.