Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/Util.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "Util.h"
#include "AutoScheduleUtils.h"
#include "Debug.h"
#include "Error.h"
#include "Function.h"
#include "Introspection.h"
#include <atomic>
#include <chrono>
Expand Down Expand Up @@ -563,6 +565,18 @@ int get_llvm_version() {
} // namespace Internal

void load_plugin(const std::string &lib_name) {
// TODO: this is an ugly hack. inline_all_trivial_functions()
// isn't used by libHalide, but it is used by the Li2018
// autoscheduler plugin, so we need it to be present in the final
// libHalide. Unfortunately, build environments that static-link
// generators might deadstrip this function, causing Li2018
// to fail at load time. This useless call ensures that the function
// is kept around; calling it with empty arguments is close to free
// and this is only called when load_plugin is called anyway.
// (If there is a better, portable way to ensure this function
// isn't dead-stripped, then let's do that instead.)
(void)Halide::Internal::inline_all_trivial_functions({}, {}, {});

#ifdef _WIN32
std::string lib_path = lib_name;
if (lib_path.find('.') == std::string::npos) {
Expand Down