Skip to content

Commit

Permalink
WIP clear partitioning
Browse files Browse the repository at this point in the history
  • Loading branch information
smirnov-alexey committed Nov 20, 2024
1 parent 0639d2d commit 3b7ebd4
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/plugins/intel_npu/src/plugin/npuw/compiled_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include <iostream>
#include <memory>
#include <string>
#include <chrono>
#include <thread>

#include "accuracy/comparator.hpp"
#include "intel_npu/npu_private_properties.hpp"
Expand Down Expand Up @@ -454,6 +456,12 @@ ov::npuw::CompiledModel::CompiledModel(const std::shared_ptr<ov::Model>& model,
void ov::npuw::CompiledModel::finalize_weights_bank() {
LOG_INFO("Finalizing weights bank...");
LOG_BLOCK();

using namespace std::chrono_literals;
//std::this_thread::sleep_for(10000ms);
int jj = 0;
std::cin >> jj;

// Register lazy tensors
for (std::size_t idx = 0; idx < m_compiled_submodels.size(); ++idx) {
auto& comp_model_desc = m_compiled_submodels[idx];
Expand Down Expand Up @@ -510,7 +518,12 @@ void ov::npuw::CompiledModel::finalize_weights_bank() {
void ov::npuw::CompiledModel::drop_remote_weights() {
LOG_INFO("Dropping remotely allocated weights...");

m_weights_bank.reset();
using namespace std::chrono_literals;
//std::this_thread::sleep_for(10000ms);
int jj = 0;
std::cin >> jj;

//m_weights_bank.reset();

std::cout << "m_compiled_submodels.size() " << m_compiled_submodels.size() << std::endl;

Expand Down Expand Up @@ -563,6 +576,11 @@ void ov::npuw::CompiledModel::drop_remote_weights() {
}
}

using namespace std::chrono_literals;
//std::this_thread::sleep_for(10000ms);
int jjj = 0;
std::cin >> jjj;

LOG_INFO("Done.");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,10 @@ class Compiler {
LOG_INFO("Dumped online partitioning to " << dump_plan_path << ".");
}

std::cout << "WIPING SNAPSHOT" << std::endl;
m_snapshot->wipe();
m_model.reset();

LOG_INFO("DONE.");

return ens;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,15 @@ class Group : public std::enable_shared_from_this<Group> {
std::string specialTags() const;
void addWeightsPrecision(const std::vector<ov::element::Type>& prec);
const std::vector<ov::element::Type>& getConstsPrecision() const;
void wipe() {
m_input_layers.clear();
m_content.clear();
m_output_layers.clear();
m_graph.reset();
m_snapshot.reset();
m_reptrack.clear();
std::cout << "Group wiped!" << std::endl;
}

private:
void includeExtraLayers(detail::OVNodeSet& input_layers,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,14 @@ const OVPortsMap& Snapshot::getPortsMap() const {
return m_ports_map;
}

void Snapshot::wipe() {
m_model.reset();
for (const auto& nh : m_graph->sorted()) {
m_graph->meta(nh).get<Group::GPtr>()->wipe();
}
std::cout << "GRAPH WIPED!" << std::endl;
}

const std::map<std::string, std::vector<std::set<std::string>>>& Snapshot::getMatches() const {
return m_layer_matches;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class Snapshot : public std::enable_shared_from_this<Snapshot> {
void repeat(detail::Pass&& pass);
void setCtx(const PassContext& ctx);
size_t graphSize() const;
void wipe();

private:
detail::GPtrSet getRepGroups(const std::shared_ptr<Group>& group) const;
Expand All @@ -86,6 +87,7 @@ class Snapshot : public std::enable_shared_from_this<Snapshot> {
const std::vector<std::shared_ptr<Group>>& conss);
std::unordered_map<std::shared_ptr<Repeated>, detail::GPtrSet> repeating() const;
void completeRepeating(const std::shared_ptr<Repeated>& reptag, const detail::GPtrSet& gset);
// check destructor

std::shared_ptr<ov::Model> m_model;
std::shared_ptr<own::ade::Graph> m_graph;
Expand Down

0 comments on commit 3b7ebd4

Please sign in to comment.