Skip to content

Commit

Permalink
Mark all single-arg ctors in autoscheduler code as explicit (#7704)
Browse files Browse the repository at this point in the history
explicit ctors
  • Loading branch information
steven-johnson authored Jul 25, 2023
1 parent fd9bfc8 commit df902e7
Show file tree
Hide file tree
Showing 18 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions src/autoschedulers/adams2019/FunctionDAG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ class Featurizer : public IRVisitor {
// (e.g. a+a, where a is a trivial function),
// so we can't use std::move(matrix) here without making a copy
vector<vector<OptionalRational>> copy = matrix;
e->add_load_jacobian(std::move(copy));
e->add_load_jacobian(LoadJacobian(std::move(copy)));
}
}
}
Expand Down Expand Up @@ -837,7 +837,7 @@ FunctionDAG::FunctionDAG(const vector<Function> &outputs, const Target &target)
int leaves = 0;
Type narrowest_type;
map<string, int> calls;
CheckTypes(const Function &f)
explicit CheckTypes(const Function &f)
: func(f) {
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/autoschedulers/adams2019/FunctionDAG.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class LoadJacobian {
int64_t c;

public:
LoadJacobian(vector<vector<OptionalRational>> &&matrix, int64_t c = 1)
explicit LoadJacobian(vector<vector<OptionalRational>> &&matrix, int64_t c = 1)
: coeffs(matrix), c(c) {
}

Expand Down Expand Up @@ -481,7 +481,7 @@ struct FunctionDAG {
return dependencies[n.id];
};

Stage(Halide::Stage s)
explicit Stage(Halide::Stage s)
: stage(std::move(s)) {
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/autoschedulers/adams2019/Timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct ScopedTimer {
std::chrono::time_point<Clock> start = Clock::now();
std::string msg;

ScopedTimer(const std::string &msg)
explicit ScopedTimer(const std::string &msg)
: msg{msg} {
aslog(0) << "Start: " << msg << "\n";
}
Expand Down
2 changes: 1 addition & 1 deletion src/autoschedulers/anderson2021/FunctionDAG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ FunctionDAG::FunctionDAG(const vector<Function> &outputs, const Target &target)
int leaves = 0;
Type narrowest_type;
map<string, int> calls;
CheckTypes(const Function &f)
explicit CheckTypes(const Function &f)
: func(f) {
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/autoschedulers/anderson2021/FunctionDAG.h
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ struct FunctionDAG {
return dependencies[n.id];
};

Stage(Halide::Stage s)
explicit Stage(Halide::Stage s)
: stage(std::move(s)) {
}

Expand Down Expand Up @@ -674,7 +674,7 @@ class ExprBranching : public VariadicVisitor<ExprBranching, int, int> {
int visit_binary(const Expr &a, const Expr &b);
int visit_nary(const std::vector<Expr> &exprs);

ExprBranching(const NodeMap<int64_t> &inlined)
explicit ExprBranching(const NodeMap<int64_t> &inlined)
: inlined{inlined} {
}

Expand Down
2 changes: 1 addition & 1 deletion src/autoschedulers/anderson2021/GPULoopInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace Autoscheduler {
struct LoopNest;

struct GPULoopInfo {
GPULoopInfo(const LoopNest *root)
explicit GPULoopInfo(const LoopNest *root)
: root{root} {
}

Expand Down
2 changes: 1 addition & 1 deletion src/autoschedulers/anderson2021/GPUMemInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ using LocalMemInfo = MemInfoType<LocalMem>;

struct Strides {
public:
Strides(const std::vector<int64_t> &storage_strides)
explicit Strides(const std::vector<int64_t> &storage_strides)
: storage_strides{storage_strides} {
}

Expand Down
2 changes: 1 addition & 1 deletion src/autoschedulers/anderson2021/LoopNest.h
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ struct Filter {
const LoopNest *loop_nest;
bool logging = false;

Filter(const LoopNest *loop_nest)
explicit Filter(const LoopNest *loop_nest)
: loop_nest{loop_nest}, logging{enable_filter_printing()} {
if (logging) {
std::cerr << "\nState filtered: \n";
Expand Down
2 changes: 1 addition & 1 deletion src/autoschedulers/anderson2021/LoopNestParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class LoopNestParser {
std::unordered_set<std::string> all_stages;

public:
LoopNestParser(const std::vector<std::string> &loop_nest)
explicit LoopNestParser(const std::vector<std::string> &loop_nest)
: loop_nest{loop_nest} {
parse(loop_nest);
}
Expand Down
2 changes: 1 addition & 1 deletion src/autoschedulers/anderson2021/SearchSpace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ vector<ThreadTileOption> SearchSpace::filter_thread_tile_options(vector<Intrusiv

ThreadTileOption o;
o.loop_nest = loop_nest;
o.max_idle_lane_wastage = loop_nest->max_idle_lane_wastage(target, {loop_nest.get()});
o.max_idle_lane_wastage = loop_nest->max_idle_lane_wastage(target, GPULoopInfo(loop_nest.get()));
options.emplace_back(std::move(o));
}

Expand Down
2 changes: 1 addition & 1 deletion src/autoschedulers/anderson2021/SearchSpaceOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct SearchSpaceOptions {

std::bitset<4> options;

SearchSpaceOptions(const std::string &bit_str)
explicit SearchSpaceOptions(const std::string &bit_str)
: options{bit_str} {
aslog(1) << "Search space options:\n";
aslog(1) << "Input string: " << bit_str << "\n";
Expand Down
2 changes: 1 addition & 1 deletion src/autoschedulers/anderson2021/State.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ bool State::compute_featurization(const FunctionDAG &dag, const Anderson2021Para
}

Timer timer;
feature_root->compute_features(dag, params, target, sites, 1, 1, nullptr, nullptr, *feature_root, {feature_root.get()}, true, total_shared_mem_alloc_sizes, nullptr, nullptr, nullptr, features, stats, verbose);
feature_root->compute_features(dag, params, target, sites, 1, 1, nullptr, nullptr, *feature_root, GPULoopInfo(feature_root.get()), true, total_shared_mem_alloc_sizes, nullptr, nullptr, nullptr, features, stats, verbose);

stats.featurization_time += timer.elapsed();
++stats.num_featurizations;
Expand Down
2 changes: 1 addition & 1 deletion src/autoschedulers/anderson2021/Statistics.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct ScopedTimer {
std::chrono::time_point<Clock> start;
std::string msg;

ScopedTimer(const std::string &msg)
explicit ScopedTimer(const std::string &msg)
: start{Clock::now()}, msg{msg} {
aslog(1) << "Start: " << msg << "\n";
}
Expand Down
6 changes: 3 additions & 3 deletions src/autoschedulers/anderson2021/test/thread_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ void test_thread_info() {
std::vector<int64_t> loop_extents;
std::vector<int64_t> max_thread_counts;

loop.push_back({});
loop.push_back({});
loop.emplace_back();
loop.emplace_back();

// 16x8
size.push_back(16);
Expand Down Expand Up @@ -65,7 +65,7 @@ void test_thread_info() {
max_thread_counts.push_back(16);
max_thread_counts.push_back(16);
max_thread_counts.push_back(2);
loop.push_back({});
loop.emplace_back();

{
ThreadInfo info{vectorized_loop_index, size, loop, max_thread_counts};
Expand Down
2 changes: 1 addition & 1 deletion src/autoschedulers/common/ASLog.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class aslog {
const bool logging;

public:
aslog(int verbosity)
explicit aslog(int verbosity)
: logging(verbosity <= aslog_level()) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/autoschedulers/common/PerfectHashMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
struct PerfectHashMapAsserter {
const bool c;

PerfectHashMapAsserter(bool c)
explicit PerfectHashMapAsserter(bool c)
: c(c) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/autoschedulers/common/cmdline.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ inline std::string readable_typename<int>() {
#ifdef HALIDE_WITH_EXCEPTIONS
class cmdline_error : public std::exception {
public:
cmdline_error(const std::string &msg)
explicit cmdline_error(const std::string &msg)
: msg(msg) {
}
~cmdline_error() throw() override = default;
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 @@ -2615,7 +2615,7 @@ class FindVarsUsingVar : public IRVisitor {
public:
Scope<> vars;

FindVarsUsingVar(const string &var) {
explicit FindVarsUsingVar(const string &var) {
vars.push(var);
}
};
Expand Down

0 comments on commit df902e7

Please sign in to comment.