From 91d39a7639030d8664fa66dfda79ea159d3801dc Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Thu, 12 Jan 2023 20:31:33 +0000 Subject: [PATCH] tint/resolver: Reduce Hashmap fixed sizes for UA Uniformity analysis can have very deep call stacks, and we're on the cusp of stack overflowing. Reducing these sizes helps avoid cache misses at the cost of more heap allocations. Change-Id: I4685d1d888d062456c296d9dc25231a48d72e941 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116878 Kokoro: Kokoro Reviewed-by: Dan Sinclair Commit-Queue: Ben Clayton --- src/tint/resolver/uniformity.cc | 12 ++++++------ src/tint/scope_stack.h | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/tint/resolver/uniformity.cc b/src/tint/resolver/uniformity.cc index 762aba5914..a5aa37ddfd 100644 --- a/src/tint/resolver/uniformity.cc +++ b/src/tint/resolver/uniformity.cc @@ -240,9 +240,9 @@ struct FunctionInfo { /// The type of this control flow construct. std::string type; /// The input values for local variables at the start of this construct. - utils::Hashmap var_in_nodes; + utils::Hashmap var_in_nodes; /// The exit values for local variables at the end of this construct. - utils::Hashmap var_exit_nodes; + utils::Hashmap var_exit_nodes; }; /// @returns a LoopSwitchInfo for the given statement, allocating the LoopSwitchInfo if this is @@ -497,7 +497,7 @@ class UniformityGraph { }, [&](const ast::BlockStatement* b) { - utils::Hashmap scoped_assignments; + utils::Hashmap scoped_assignments; { // Push a new scope for variable assignments in the block. current_function_->variables.Push(); @@ -819,15 +819,15 @@ class UniformityGraph { v->affects_control_flow = true; v->AddEdge(v_cond); - utils::Hashmap true_vars; - utils::Hashmap false_vars; + utils::Hashmap true_vars; + utils::Hashmap false_vars; // Helper to process a statement with a new scope for variable assignments. // Populates `assigned_vars` with new nodes for any variables that are assigned in // this statement. auto process_in_scope = [&](Node* cf_in, const ast::Statement* s, - utils::Hashmap& assigned_vars) { + utils::Hashmap& assigned_vars) { // Push a new scope for variable assignments. current_function_->variables.Push(); diff --git a/src/tint/scope_stack.h b/src/tint/scope_stack.h index 75c50b48c6..4a1af1e2c3 100644 --- a/src/tint/scope_stack.h +++ b/src/tint/scope_stack.h @@ -67,7 +67,7 @@ class ScopeStack { /// Return the top scope of the stack. /// @returns the top scope of the stack - const utils::Hashmap& Top() const { return stack_.Back(); } + const utils::Hashmap& Top() const { return stack_.Back(); } /// Clear the scope stack. void Clear() { @@ -76,7 +76,7 @@ class ScopeStack { } private: - utils::Vector, 8> stack_ = {{}}; + utils::Vector, 8> stack_ = {{}}; }; } // namespace tint