Skip to content

Commit

Permalink
Exclude baseline profile classes from class freqs reordering
Browse files Browse the repository at this point in the history
Summary: Use the existing `initialize_baseline_profile_classes` method to determine whether a class is present in baseline profiles. If it is, do not move it between interactions

Differential Revision: D68651823

fbshipit-source-id: 2e89276aa3a6e9f8556c9b6cdf0c92824f183a98
  • Loading branch information
itang00 authored and facebook-github-bot committed Feb 3, 2025
1 parent 4fcfcb6 commit 3263333
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions opt/interdex/InterDex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ void InterDex::get_movable_coldstart_classes(
: interactions.size();
size_t curr_idx = coldstart_idx;

initialize_baseline_profile_classes();

for (auto* type : interdex_types) {
DexClass* cls = type_class(type);
if (!cls) {
Expand All @@ -284,7 +286,8 @@ void InterDex::get_movable_coldstart_classes(
curr_idx = std::distance(interactions.begin(), index_it);
continue;
}
if (class_freqs.count(cls->get_name()) != 1) {
if (class_freqs.count(cls->get_name()) != 1 ||
this->is_baseline_profile_class(type)) {
continue;
}
auto freqs = class_freqs.at(cls->get_name());
Expand Down Expand Up @@ -1612,9 +1615,10 @@ void InterDex::exclude_baseline_profile_classes() {
}

void InterDex::initialize_baseline_profile_classes() {
always_assert(m_exclude_baseline_profile_classes);
// I.e. this should only ever be called once.
always_assert(!m_baseline_profile_classes);
always_assert(m_exclude_baseline_profile_classes || m_move_coldstart_classes);
if (m_baseline_profile_classes) {
return;
}

m_baseline_profile_classes = std::unordered_set<DexType*>();

Expand Down

0 comments on commit 3263333

Please sign in to comment.