From e848d776cc7cfaa22612318618f4b83816a035bc Mon Sep 17 00:00:00 2001 From: Lukas Steiner Date: Wed, 22 Feb 2023 17:11:17 +0100 Subject: [PATCH] Fix Trace Analyzer cmake. --- extensions/apps/traceAnalyzer/CMakeLists.txt | 1 - lib/sqlite3/CMakeLists.txt | 2 +- src/gem5/CMakeLists.txt | 4 -- src/gem5/main.cpp | 5 --- .../DRAMSys/simulation/DRAMSysRecordable.cpp | 41 ++++++++++--------- .../DRAMSys/simulation/DRAMSysRecordable.h | 13 ++++-- src/simulator/CMakeLists.txt | 4 -- src/simulator/simulator/main.cpp | 6 +-- 8 files changed, 33 insertions(+), 43 deletions(-) diff --git a/extensions/apps/traceAnalyzer/CMakeLists.txt b/extensions/apps/traceAnalyzer/CMakeLists.txt index e1212b9d..2576b624 100644 --- a/extensions/apps/traceAnalyzer/CMakeLists.txt +++ b/extensions/apps/traceAnalyzer/CMakeLists.txt @@ -42,7 +42,6 @@ project(TraceAnalyzer) file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS *.cpp) file(GLOB_RECURSE HEADER_FILES CONFIGURE_DEPENDS *.h;*.hpp) -#file(GLOB_RECURSE UI_FILES CONFIGURE_DEPENDS *.ui) # Add Python3 Dependency: find_package(Python3 COMPONENTS Development) diff --git a/lib/sqlite3/CMakeLists.txt b/lib/sqlite3/CMakeLists.txt index 69cb461e..7aed6b6f 100644 --- a/lib/sqlite3/CMakeLists.txt +++ b/lib/sqlite3/CMakeLists.txt @@ -19,6 +19,6 @@ set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER lib) ### Compile options ### # refer to https://www.sqlite.org/compile.html -target_compile_definitions(${PROJECT_NAME} PUBLIC SQLITE_ENABLE_RTREE) +target_compile_definitions(${PROJECT_NAME} PUBLIC SQLITE_ENABLE_RTREE SQLITE_OMIT_LOAD_EXTENSION) add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) \ No newline at end of file diff --git a/src/gem5/CMakeLists.txt b/src/gem5/CMakeLists.txt index 527055c2..06ee211e 100644 --- a/src/gem5/CMakeLists.txt +++ b/src/gem5/CMakeLists.txt @@ -42,10 +42,6 @@ set(DCMAKE_SH="CMAKE_SH-NOTFOUND") find_library(GEM5_LIBRARY gem5_${GEM5_VARIANT} PATHS $ENV{GEM5}/build/${GEM5_ISA}/) -if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/../library/src/simulation/DRAMSysRecordable.cpp) - add_definitions(-DRECORDING) -endif() - add_executable(DRAMSys_gem5 main.cpp $ENV{GEM5}/util/systemc/gem5_within_systemc/sc_logger.cc diff --git a/src/gem5/main.cpp b/src/gem5/main.cpp index 8f680099..63801b9d 100644 --- a/src/gem5/main.cpp +++ b/src/gem5/main.cpp @@ -52,10 +52,7 @@ #include "Configuration.h" #include "simulation/DRAMSys.h" - -#ifdef RECORDING #include "simulation/DRAMSysRecordable.h" -#endif using namespace sc_core; using namespace tlm; @@ -167,11 +164,9 @@ int sc_main(int argc, char **argv) // Instantiate DRAMSys: std::unique_ptr dramSys; -#ifdef RECORDING if (configLib.simConfig.databaseRecording.value_or(false)) dramSys = std::make_unique("DRAMSys", configLib); else -#endif dramSys = std::make_unique("DRAMSys", configLib); // Instantiate gem5: diff --git a/src/libdramsys/DRAMSys/simulation/DRAMSysRecordable.cpp b/src/libdramsys/DRAMSys/simulation/DRAMSysRecordable.cpp index 5f7490c0..744fd1df 100644 --- a/src/libdramsys/DRAMSys/simulation/DRAMSysRecordable.cpp +++ b/src/libdramsys/DRAMSys/simulation/DRAMSysRecordable.cpp @@ -62,10 +62,10 @@ #include -using namespace sc_core; +namespace DRAMSys { -DRAMSysRecordable::DRAMSysRecordable(const sc_module_name& name, const ::DRAMSys::Config::Configuration& configLib) - : DRAMSys(name, configLib, false) +DRAMSysRecordable::DRAMSysRecordable(const sc_core::sc_module_name& name, const ::DRAMSys::Config::Configuration& configLib) + : DRAMSys(name, configLib, false) { // If a simulation file is passed as argument to DRAMSys the simulation ID // is prepended to the simulation name if found. @@ -89,15 +89,16 @@ void DRAMSysRecordable::end_of_simulation() // Report power before TLM recorders are finalized if (config.powerAnalysis) { - for (auto& dram : drams) + for (auto& dram: drams) dram->reportPower(); } - for (auto& tlmRecorder : tlmRecorders) + for (auto& tlmRecorder: tlmRecorders) tlmRecorder.finalize(); } -void DRAMSysRecordable::setupTlmRecorders(const std::string& traceName, const ::DRAMSys::Config::Configuration& configLib) +void DRAMSysRecordable::setupTlmRecorders(const std::string& traceName, + const ::DRAMSys::Config::Configuration& configLib) { // Create TLM Recorders, one per channel. // Reserve is required because the recorders use double buffers that are accessed with pointers. @@ -116,8 +117,8 @@ void DRAMSysRecordable::setupTlmRecorders(const std::string& traceName, const :: } } -void DRAMSysRecordable::instantiateModules(const std::string &traceName, - const ::DRAMSys::Config::Configuration &configLib) +void DRAMSysRecordable::instantiateModules(const std::string& traceName, + const ::DRAMSys::Config::Configuration& configLib) { addressDecoder = std::make_unique(config, configLib.addressMapping); addressDecoder->print(); @@ -143,34 +144,34 @@ void DRAMSysRecordable::instantiateModules(const std::string &traceName, if (memoryType == MemSpec::MemoryType::DDR3) drams.emplace_back(std::make_unique>(("dram" + std::to_string(i)).c_str(), - config, tlmRecorders[i])); + config, tlmRecorders[i])); else if (memoryType == MemSpec::MemoryType::DDR4) drams.emplace_back(std::make_unique>(("dram" + std::to_string(i)).c_str(), - config, tlmRecorders[i])); + config, tlmRecorders[i])); else if (memoryType == MemSpec::MemoryType::WideIO) drams.emplace_back(std::make_unique>(("dram" + std::to_string(i)).c_str(), - config, tlmRecorders[i])); + config, tlmRecorders[i])); else if (memoryType == MemSpec::MemoryType::LPDDR4) drams.emplace_back(std::make_unique>(("dram" + std::to_string(i)).c_str(), - config, tlmRecorders[i])); + config, tlmRecorders[i])); else if (memoryType == MemSpec::MemoryType::WideIO2) drams.emplace_back(std::make_unique>(("dram" + std::to_string(i)).c_str(), - config, tlmRecorders[i])); + config, tlmRecorders[i])); else if (memoryType == MemSpec::MemoryType::HBM2) drams.emplace_back(std::make_unique>(("dram" + std::to_string(i)).c_str(), - config, tlmRecorders[i])); + config, tlmRecorders[i])); else if (memoryType == MemSpec::MemoryType::GDDR5) drams.emplace_back(std::make_unique>(("dram" + std::to_string(i)).c_str(), - config, tlmRecorders[i])); + config, tlmRecorders[i])); else if (memoryType == MemSpec::MemoryType::GDDR5X) drams.emplace_back(std::make_unique>(("dram" + std::to_string(i)).c_str(), - config, tlmRecorders[i])); + config, tlmRecorders[i])); else if (memoryType == MemSpec::MemoryType::GDDR6) drams.emplace_back(std::make_unique>(("dram" + std::to_string(i)).c_str(), - config, tlmRecorders[i])); + config, tlmRecorders[i])); else if (memoryType == MemSpec::MemoryType::STTMRAM) drams.emplace_back(std::make_unique>(("dram" + std::to_string(i)).c_str(), - config, tlmRecorders[i])); + config, tlmRecorders[i])); #ifdef DDR5_SIM else if (memoryType == MemSpec::MemoryType::DDR5) drams.emplace_back(std::make_unique>(("dram" + std::to_string(i)).c_str(), @@ -189,6 +190,8 @@ void DRAMSysRecordable::instantiateModules(const std::string &traceName, if (config.checkTLM2Protocol) controllersTlmCheckers.emplace_back(std::make_unique> - (("TLMCheckerController" + std::to_string(i)).c_str())); + (("TLMCheckerController" + std::to_string(i)).c_str())); } } + +} \ No newline at end of file diff --git a/src/libdramsys/DRAMSys/simulation/DRAMSysRecordable.h b/src/libdramsys/DRAMSys/simulation/DRAMSysRecordable.h index 64eb636e..b22315f0 100644 --- a/src/libdramsys/DRAMSys/simulation/DRAMSysRecordable.h +++ b/src/libdramsys/DRAMSys/simulation/DRAMSysRecordable.h @@ -42,10 +42,12 @@ #include "DRAMSys/config/DRAMSysConfiguration.h" -class DRAMSysRecordable : public DRAMSys::DRAMSys +namespace DRAMSys { + +class DRAMSysRecordable : public DRAMSys { public: - DRAMSysRecordable(const sc_core::sc_module_name &name, const ::DRAMSys::Config::Configuration& configLib); + DRAMSysRecordable(const sc_core::sc_module_name& name, const ::DRAMSys::Config::Configuration& configLib); protected: void end_of_simulation() override; @@ -55,8 +57,11 @@ private: // They generate the output databases. std::vector tlmRecorders; - void setupTlmRecorders(const std::string &traceName, const ::DRAMSys::Config::Configuration& configLib); - void instantiateModules(const std::string &traceName, const ::DRAMSys::Config::Configuration& configLib); + void setupTlmRecorders(const std::string& traceName, const ::DRAMSys::Config::Configuration& configLib); + + void instantiateModules(const std::string& traceName, const ::DRAMSys::Config::Configuration& configLib); }; +} + #endif // DRAMSYSRECORDABLE_H diff --git a/src/simulator/CMakeLists.txt b/src/simulator/CMakeLists.txt index e37a01ec..9c2f9032 100644 --- a/src/simulator/CMakeLists.txt +++ b/src/simulator/CMakeLists.txt @@ -46,10 +46,6 @@ file(GLOB_RECURSE HEADER_FILES CONFIGURE_DEPENDS *.h;*.hpp) add_executable(DRAMSys ${SOURCE_FILES} ${HEADER_FILES}) target_include_directories(DRAMSys PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) -if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/../library/src/simulation/DRAMSysRecordable.cpp) - target_compile_definitions(DRAMSys PRIVATE RECORDING) -endif() - target_link_libraries(DRAMSys PRIVATE Threads::Threads diff --git a/src/simulator/simulator/main.cpp b/src/simulator/simulator/main.cpp index a5d0b6ff..769fb23c 100644 --- a/src/simulator/simulator/main.cpp +++ b/src/simulator/simulator/main.cpp @@ -41,9 +41,7 @@ #include "simulator/TrafficInitiator.h" #include "DRAMSys/simulation/DRAMSys.h" -#ifdef RECORDING #include "DRAMSys/simulation/DRAMSysRecordable.h" -#endif #include "DRAMSys/config/DRAMSysConfiguration.h" #include @@ -101,11 +99,9 @@ int sc_main(int argc, char **argv) // Instantiate DRAMSys: std::unique_ptr dramSys; -#ifdef RECORDING if (configLib.simConfig.databaseRecording.value_or(false)) - dramSys = std::make_unique("DRAMSys", configLib); + dramSys = std::make_unique("DRAMSys", configLib); else -#endif dramSys = std::make_unique("DRAMSys", configLib); if (!configLib.traceSetup.has_value())