Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Apr 10, 2022
1 parent 3035387 commit c404205
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
13 changes: 9 additions & 4 deletions taichi/ir/expression_printer.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ class ExpressionHumanFriendlyPrinter : public ExpressionPrinter {
class ExpressionOfflineCacheKeyGenerator
: public ExpressionHumanFriendlyPrinter {
public:
explicit ExpressionOfflineCacheKeyGenerator(Program *prog, std::ostream *os = nullptr)
explicit ExpressionOfflineCacheKeyGenerator(Program *prog,
std::ostream *os = nullptr)
: ExpressionHumanFriendlyPrinter(os), prog_(prog) {
}

Expand Down Expand Up @@ -295,8 +296,10 @@ class ExpressionOfflineCacheKeyGenerator
}
emit(')');
}

private:
const std::string &cache_snode_tree_key(int snode_tree_id, std::string &&key) {
const std::string &cache_snode_tree_key(int snode_tree_id,
std::string &&key) {
if (snode_tree_id >= snode_tree_key_cache_.size()) {
snode_tree_key_cache_.resize(snode_tree_id + 1);
}
Expand All @@ -307,11 +310,13 @@ class ExpressionOfflineCacheKeyGenerator
TI_ASSERT(snode && prog_);
auto snode_tree_id = snode->get_snode_tree_id();
std::string res;
if (snode_tree_id < snode_tree_key_cache_.size() && !snode_tree_key_cache_[snode_tree_id].empty()) {
if (snode_tree_id < snode_tree_key_cache_.size() &&
!snode_tree_key_cache_[snode_tree_id].empty()) {
res = snode_tree_key_cache_[snode_tree_id];
} else {
auto *snode_tree_root = prog_->get_snode_root(snode_tree_id);
auto snode_tree_key = get_hashed_offline_cache_key_of_snode(snode_tree_root);
auto snode_tree_key =
get_hashed_offline_cache_key_of_snode(snode_tree_root);
res = cache_snode_tree_key(snode_tree_id, std::move(snode_tree_key));
}
return res.append(std::to_string(snode->id));
Expand Down
3 changes: 2 additions & 1 deletion taichi/llvm/llvm_offline_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ std::string get_hashed_offline_cache_key(CompileConfig *config,
Kernel *kernel) {
std::string kernel_ast_string;
if (kernel) {
irpass::gen_offline_cache_key(kernel->program, kernel->ir.get(), &kernel_ast_string);
irpass::gen_offline_cache_key(kernel->program, kernel->ir.get(),
&kernel_ast_string);
}

std::vector<std::uint8_t> compile_config_key;
Expand Down

0 comments on commit c404205

Please sign in to comment.