[AOTInductor] Refine error message for dlopen in AOTInductor (#149812)

Summary:
Refine the error message if dlopen failed in AOTInductor.
The original error message was ominous, modified to recommend user to
rebuild AOTInductor if needed, otherwise it's fine.

Test Plan:
None. Error message change.

Reviewers:

Subscribers:

Tasks:

Tags:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/149812
Approved by: https://github.com/chenyang78, https://github.com/jingsh
This commit is contained in:
Mu-Chu Lee
2025-03-25 10:40:39 -07:00
committed by PyTorch MergeBot
parent 0159f8ed54
commit feb503c1df

View File

@ -73,11 +73,15 @@ AOTIModelContainerRunner::AOTIModelContainerRunner(
#undef LOAD_SYMBOL
// NOLINTBEGIN(performance-avoid-endl)
#define TRY_LOAD_SYMBOL(var, name_str) \
try { \
var = reinterpret_cast<decltype(var)>(model_so_->sym(name_str)); \
} catch (const at::DynamicLibraryError& e) { \
std::cerr << "Could not dlsym " << name_str << std::endl; \
#define TRY_LOAD_SYMBOL(var, name_str) \
try { \
var = reinterpret_cast<decltype(var)>(model_so_->sym(name_str)); \
} catch (const at::DynamicLibraryError& e) { \
std::cerr \
<< "[WARNING] Could not dlsym " << name_str \
<< ". This is okay if you don't need functionality from " << name_str \
<< ". Otherwise consider rebuilding your model with the latest AOTInductor." \
<< std::endl; \
}
// NOLINTEND(performance-avoid-endl)