Skip to content

Commit

Permalink
Optionally disable debug strings in flatbuffer, greatly reduces compi…
Browse files Browse the repository at this point in the history
…le time
  • Loading branch information
AleksKnezevic committed Jan 15, 2025
1 parent 5b4122a commit 3769401
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
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

0 comments on commit 3769401

Please sign in to comment.