Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optionally disable debug strings in flatbuffer, greatly reduces compile time #1782

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ option(TTMLIR_ENABLE_RUNTIME "Enable runtime" OFF)
option(TTMLIR_ENABLE_STABLEHLO "Enable StableHLO support" OFF)
option(TTMLIR_ENABLE_OPMODEL "Enable OpModel support" OFF)
option(TTMLIR_ENABLE_SHARED_LIB "Enable Shared lib building" ON)
option(TTMLIR_ENABLE_DEBUG_STRINGS "Enable debug strings in flatbuffer" ON)

if (TTMLIR_ENABLE_DEBUG_STRINGS)
add_compile_definitions(TTMLIR_ENABLE_DEBUG_STRINGS)
endif()

if (NOT TTMLIR_ENABLE_RUNTIME)
set (TTMLIR_ENABLE_SHARED_LIB OFF)
Expand Down
4 changes: 4 additions & 0 deletions include/ttmlir/Target/Utils/FuncOpToProgram.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,14 @@ struct Program {

inline std::string getOpDebugString(mlir::Operation *op,
OpPrintingFlags printFlags) {
#ifdef TTMLIR_ENABLE_DEBUG_STRINGS
std::string str;
llvm::raw_string_ostream os(str);
op->print(os, printFlags);
return str;
#else
return "";
#endif
};

inline std::string getOpLocInfo(mlir::Operation *op) {
Expand Down
Loading