From 83616f20c49c6f8e97403acd0add3df41753adeb Mon Sep 17 00:00:00 2001 From: Andrew Adams Date: Tue, 12 Mar 2024 17:00:49 -0700 Subject: [PATCH] Fix three nits (#8137) 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 --- src/BoundsInference.cpp | 6 +++--- src/Lower.cpp | 5 +---- src/StorageFlattening.cpp | 8 ++------ src/autoschedulers/mullapudi2016/AutoSchedule.cpp | 2 +- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/BoundsInference.cpp b/src/BoundsInference.cpp index 5965303197bc..21ca06e07285 100644 --- a/src/BoundsInference.cpp +++ b/src/BoundsInference.cpp @@ -1152,7 +1152,7 @@ class BoundsInference : public IRMutator { map 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()) { @@ -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); } } diff --git a/src/Lower.cpp b/src/Lower.cpp index 79d02323b3bf..f092e2e711ef 100644 --- a/src/Lower.cpp +++ b/src/Lower.cpp @@ -280,10 +280,7 @@ void lower_impl(const vector &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); diff --git a/src/StorageFlattening.cpp b/src/StorageFlattening.cpp index ba4cc9b8acca..5860a7e50d0f 100644 --- a/src/StorageFlattening.cpp +++ b/src/StorageFlattening.cpp @@ -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 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); diff --git a/src/autoschedulers/mullapudi2016/AutoSchedule.cpp b/src/autoschedulers/mullapudi2016/AutoSchedule.cpp index 2ce325538a86..e3cc2ec5e825 100644 --- a/src/autoschedulers/mullapudi2016/AutoSchedule.cpp +++ b/src/autoschedulers/mullapudi2016/AutoSchedule.cpp @@ -1359,7 +1359,7 @@ Partitioner::Partitioner(const map &_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); } }