1616#include < executorch/runtime/core/evalue.h>
1717#include < executorch/runtime/executor/pte_data_map.h>
1818
19- #include < cinttypes>
2019#include < memory>
2120#include < mutex>
2221
@@ -101,6 +100,7 @@ class XnnpackBackend final
101100 lock_weights_cache.lock ();
102101 weights_cache_->initialize_for_runtime (
103102 context.get_runtime_allocator (), named_data_map);
103+ workspace->set_uses_weight_cache ();
104104 }
105105
106106 auto [workspace_lock, workspace_ptr] = workspace->acquire ();
@@ -131,16 +131,6 @@ class XnnpackBackend final
131131 return err;
132132 }
133133
134- ET_LOG (
135- Info,
136- " XnnpackBackend::init delegate=%p workspace_id=%" PRIu64
137- " workspace_ptr=%p program_id=0x%" PRIxPTR " weight_cache=%s" ,
138- (void *)executor,
139- workspace->id (),
140- (void *)workspace_ptr,
141- program_id,
142- use_weight_cache ? " true" : " false" );
143-
144134 return executor;
145135 }
146136
@@ -151,18 +141,10 @@ class XnnpackBackend final
151141 auto executor = static_cast <xnnpack::delegate::XNNExecutor*>(handle);
152142
153143 auto workspace = executor->get_workspace ();
154- ET_LOG (
155- Info,
156- " XnnpackBackend::execute begin delegate=%p workspace_id=%" PRIu64
157- " num_args=%zu weight_cache=%s" ,
158- (void *)executor,
159- workspace->id (),
160- (size_t )args.size (),
161- executor->uses_weight_cache () ? " true" : " false" );
162144
163145 std::unique_lock<std::mutex> lock_weights_cache (
164146 weights_cache_mutex_, std::defer_lock);
165- if (executor->uses_weight_cache ()) {
147+ if (executor->uses_weight_cache () || workspace-> uses_weight_cache () ) {
166148 lock_weights_cache.lock ();
167149 }
168150
@@ -183,14 +165,6 @@ class XnnpackBackend final
183165 // Convert output data types if necessary (e.g., int32 -> int64 for Long)
184166 err = executor->convert_outputs (args);
185167
186- ET_LOG (
187- Info,
188- " XnnpackBackend::execute end delegate=%p workspace_id=%" PRIu64
189- " err=0x%x" ,
190- (void *)executor,
191- workspace->id (),
192- (unsigned int )err);
193-
194168 return err;
195169 }
196170
@@ -199,12 +173,6 @@ class XnnpackBackend final
199173 auto executor = static_cast <xnnpack::delegate::XNNExecutor*>(handle);
200174 auto workspace = executor->get_workspace ();
201175
202- ET_LOG (
203- Info,
204- " XnnpackBackend::destroy delegate=%p workspace_id=%" PRIu64,
205- (void *)executor,
206- workspace->id ());
207-
208176 const std::lock_guard<std::mutex> lock_weights_cache (
209177 weights_cache_mutex_);
210178
0 commit comments