@@ -138,11 +138,14 @@ class SolverProjectionStorage : public BaseOp<SolverProjectionStorage<State, Com
138138
139139 std::lock_guard<std::mutex> lock (LifetimeMutex ());
140140 auto it = LifetimeRegistry ().find (state);
141- MATX_ASSERT_STR (it != LifetimeRegistry ().end (),
142- matxInvalidParameter,
143- " Solver projection state lifetime entry is missing" );
144- if (!it->second .execution_mutex ) {
145- it->second .execution_mutex = std::make_shared<std::mutex>();
141+ if (it == LifetimeRegistry ().end ()) {
142+ MATX_THROW (matxInvalidParameter,
143+ " Solver projection state lifetime entry is missing" );
144+ }
145+
146+ auto &execution_mutex = it->second .execution_mutex ;
147+ if (execution_mutex == nullptr ) {
148+ execution_mutex = std::make_shared<std::mutex>();
146149 }
147150 it->second .count ++;
148151 }
@@ -170,17 +173,19 @@ class SolverProjectionStorage : public BaseOp<SolverProjectionStorage<State, Com
170173 static void JITPreRunInput (State *state, Executor &&ex)
171174 {
172175 auto execution_mutex = GetExecutionMutex (state);
173- MATX_ASSERT_STR (execution_mutex != nullptr ,
174- matxInvalidParameter,
175- " Solver projection state lifetime entry is missing" );
176+ if (execution_mutex == nullptr ) {
177+ MATX_THROW (matxInvalidParameter,
178+ " Solver projection state lifetime entry is missing" );
179+ }
176180
177181 std::lock_guard<std::mutex> execution_lock (*execution_mutex);
178182 {
179183 std::lock_guard<std::mutex> lifetime_lock (LifetimeMutex ());
180184 auto it = LifetimeRegistry ().find (state);
181- MATX_ASSERT_STR (it != LifetimeRegistry ().end (),
182- matxInvalidParameter,
183- " Solver projection state lifetime entry is missing" );
185+ if (it == LifetimeRegistry ().end ()) {
186+ MATX_THROW (matxInvalidParameter,
187+ " Solver projection state lifetime entry is missing" );
188+ }
184189 if (it->second .jit_prerun_count > 0 ) {
185190 it->second .jit_prerun_count ++;
186191 return ;
@@ -370,9 +375,10 @@ class SolverProjectionStorage : public BaseOp<SolverProjectionStorage<State, Com
370375 }
371376 else {
372377 auto execution_mutex = GetExecutionMutex (state_);
373- MATX_ASSERT_STR (execution_mutex != nullptr ,
374- matxInvalidParameter,
375- " Solver projection state lifetime entry is missing" );
378+ if (execution_mutex == nullptr ) {
379+ MATX_THROW (matxInvalidParameter,
380+ " Solver projection state lifetime entry is missing" );
381+ }
376382 std::lock_guard<std::mutex> lock (*execution_mutex);
377383 state_->Materialize (std::forward<Executor>(ex));
378384 tensor_ = state_->template Tensor <Component>();
0 commit comments