File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -347,6 +347,27 @@ FusionCache* FusionCache::get(
347347 if (load_from_default_workspace && fs::exists (file_path)) {
348348 try {
349349 singleton_->deserialize (file_path);
350+
351+ // Check if deserialized cache exceeds max_fusions limit
352+ if (singleton_->fusions_ .size () > max_fusions) {
353+ std::cout
354+ << " Warning: Deserialized cache contains "
355+ << singleton_->fusions_ .size ()
356+ << " fusions, which exceeds the requested max_fusions limit of "
357+ << max_fusions << " . Resetting cache." << std::endl;
358+
359+ // Delete incompatible workspace
360+ std::error_code remove_ec;
361+ fs::remove (file_path, remove_ec);
362+ if (remove_ec) {
363+ std::cout << " Failed to delete common workspace. Exception:\t "
364+ << remove_ec.message () << std::endl;
365+ }
366+
367+ // Reset FusionCache
368+ delete singleton_;
369+ singleton_ = new FusionCache (max_fusions, selected_device);
370+ }
350371 } catch (const std::exception& deserialize_exception) {
351372 // The saved workspace can become out-of-date between nvfuser updates.
352373 // Send warning and delete the incompatible workspace.
You can’t perform that action at this time.
0 commit comments