Skip to content

Commit

Permalink
Unify tests
Browse files Browse the repository at this point in the history
  • Loading branch information
orion160 committed Dec 13, 2024
1 parent 2fe674d commit 7c48970
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 264 deletions.
40 changes: 16 additions & 24 deletions test/core/vector/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,36 +39,28 @@ file(CREATE_LINK ${CMAKE_CURRENT_SOURCE_DIR}/mac_widening.json ${CMAKE_CURRENT_B
file(CREATE_LINK ${CMAKE_CURRENT_SOURCE_DIR}/single_dest.json ${CMAKE_CURRENT_BINARY_DIR}/single_dest.json SYMBOLIC)
file(CREATE_LINK ${CMAKE_CURRENT_SOURCE_DIR}/int_ext.json ${CMAKE_CURRENT_BINARY_DIR}/int_ext.json SYMBOLIC)

add_executable(Vuop_test
Vuop_test.cpp ${SIM_BASE}/sim/OlympiaSim.cpp
sparta_named_test(Vector_test_elementwise
Vector_test -l top info vuop_elementwise.out -c test_cores/test_big_core.yaml --input-file elementwise.json
)

target_link_libraries(Vuop_test
PRIVATE
core common_test ${STF_LINK_LIBS} mavis SPARTA::sparta
)
sparta_named_test(Vuop_test_elementwise
Vuop_test -l top info vuop_elementwise.out -c test_cores/test_big_core.yaml --input-file elementwise.json
)
sparta_named_test(Vuop_test_widening
Vuop_test -l top info vuop_widening.out -c test_cores/test_big_core.yaml --input-file widening.json
sparta_named_test(Vector_test_widening
Vector_test -l top info vuop_widening.out -c test_cores/test_big_core.yaml --input-file widening.json
)
sparta_named_test(Vuop_test_widening_mixed
Vuop_test -l top info vuop_widening_mixed.out -c test_cores/test_big_core.yaml --input-file widening_mixed.json
sparta_named_test(Vector_test_widening_mixed
Vector_test -l top info vuop_widening_mixed.out -c test_cores/test_big_core.yaml --input-file widening_mixed.json
)
sparta_named_test(Vuop_test_narrowing
Vuop_test -l top info vuop_narrowing.out -c test_cores/test_big_core.yaml --input-file narrowing.json
sparta_named_test(Vector_test_narrowing
Vector_test -l top info vuop_narrowing.out -c test_cores/test_big_core.yaml --input-file narrowing.json
)
sparta_named_test(Vuop_test_mac
Vuop_test -l top info vuop_mac.out -c test_cores/test_big_core.yaml --input-file mac.json
sparta_named_test(Vector_test_mac
Vector_test -l top info vuop_mac.out -c test_cores/test_big_core.yaml --input-file mac.json
)
sparta_named_test(Vuop_test_mac_widening
Vuop_test -l top info vuop_mac_widening.out -c test_cores/test_big_core.yaml --input-file mac_widening.json
sparta_named_test(Vector_test_mac_widening
Vector_test -l top info vuop_mac_widening.out -c test_cores/test_big_core.yaml --input-file mac_widening.json
)
sparta_named_test(Vuop_test_single_dest
Vuop_test -l top info vuop_single_dest.out -c test_cores/test_big_core.yaml --input-file single_dest.json
sparta_named_test(Vector_test_single_dest
Vector_test -l top info vuop_single_dest.out -c test_cores/test_big_core.yaml --input-file single_dest.json
)

sparta_named_test(Vuop_test_int_ext
Vuop_test -l top info vuop_int_ext.out -c test_cores/test_big_core.yaml --input-file int_ext.json
sparta_named_test(Vector_test_int_ext
Vector_test -l top info vuop_int_ext.out -c test_cores/test_big_core.yaml --input-file int_ext.json
)
123 changes: 99 additions & 24 deletions test/core/vector/Vector_test.cpp
Original file line number Diff line number Diff line change
@@ -1,36 +1,16 @@
#include "CPUFactory.hpp"
#include "CoreUtils.hpp"
#include "Dispatch.hpp"
#include "InstArchInfo.hpp"
#include "MavisUnit.hpp"
#include "OlympiaAllocators.hpp"
#include "OlympiaSim.hpp"
#include "IssueQueue.hpp"
#include "Decode.hpp"
#include "ROB.hpp"
#include "VectorUopGenerator.hpp"

#include "sparta/app/CommandLineSimulator.hpp"
#include "sparta/app/Simulation.hpp"
#include "sparta/events/UniqueEvent.hpp"
#include "sparta/kernel/Scheduler.hpp"
#include "sparta/report/Report.hpp"
#include "sparta/resources/Buffer.hpp"
#include "sparta/simulation/ClockManager.hpp"
#include "sparta/sparta.hpp"
#include "sparta/statistics/StatisticSet.hpp"
#include "sparta/utils/SpartaSharedPointer.hpp"
#include "sparta/utils/SpartaTester.hpp"

#include <cinttypes>
#include <initializer_list>
#include <memory>
#include <sstream>
#include <vector>
TEST_INIT

////////////////////////////////////////////////////////////////////////////////
// Set up the Mavis decoder globally for the testing
olympia::InstAllocator inst_allocator(2000, 1000);

const char USAGE[] = "Usage:\n"
"\n"
"\n";
Expand Down Expand Up @@ -133,8 +113,7 @@ void runTests(int argc, char** argv)
int err_code = 0;
if (!cls.parse(argc, argv, err_code))
{
sparta_assert(false,
"Command line parsing failed"); // Any errors already printed to cerr
sparta_assert(false, "Command line parsing failed");
}

sparta::Scheduler scheduler;
Expand Down Expand Up @@ -310,6 +289,102 @@ void runTests(int argc, char** argv)

vuop_tester.test_num_vuops_generated(4);
}
else if (input_file.find("elementwise.json") != std::string::npos)
{
cls.runSimulator(&sim);

decode_tester.test_lmul(4);
decode_tester.test_vl(256);
decode_tester.test_vta(false);
decode_tester.test_sew(32);
decode_tester.test_vlmax(128);

vuop_tester.test_num_vuops_generated(4);
}
else if (input_file.find("widening.json") != std::string::npos)
{
cls.runSimulator(&sim);

decode_tester.test_lmul(4);
decode_tester.test_vl(256);
decode_tester.test_vta(false);
decode_tester.test_sew(32);
decode_tester.test_vlmax(128);

vuop_tester.test_num_vuops_generated(8);
}
else if (input_file.find("widening_mixed.json") != std::string::npos)
{
cls.runSimulator(&sim);

decode_tester.test_lmul(4);
decode_tester.test_vl(256);
decode_tester.test_vta(false);
decode_tester.test_sew(32);
decode_tester.test_vlmax(128);

vuop_tester.test_num_vuops_generated(8);
}
else if (input_file.find("mac.json") != std::string::npos)
{
cls.runSimulator(&sim);

decode_tester.test_lmul(4);
decode_tester.test_vl(256);
decode_tester.test_vta(false);
decode_tester.test_sew(32);
decode_tester.test_vlmax(128);

vuop_tester.test_num_vuops_generated(4);
}
else if (input_file.find("mac_widening.json") != std::string::npos)
{
cls.runSimulator(&sim);

decode_tester.test_lmul(4);
decode_tester.test_vl(256);
decode_tester.test_vta(false);
decode_tester.test_sew(32);
decode_tester.test_vlmax(128);

vuop_tester.test_num_vuops_generated(8);
}
else if (input_file.find("single_dest.json") != std::string::npos)
{
cls.runSimulator(&sim);

decode_tester.test_lmul(4);
decode_tester.test_vl(256);
decode_tester.test_vta(false);
decode_tester.test_sew(32);
decode_tester.test_vlmax(128);

vuop_tester.test_num_vuops_generated(4);
}
else if (input_file.find("narrowing.json") != std::string::npos)
{
cls.runSimulator(&sim);

decode_tester.test_lmul(4);
decode_tester.test_vl(256);
decode_tester.test_vta(false);
decode_tester.test_sew(32);
decode_tester.test_vlmax(128);

vuop_tester.test_num_vuops_generated(8);
}
else if (input_file.find("int_ext.json") != std::string::npos)
{
cls.runSimulator(&sim);

decode_tester.test_lmul(4);
decode_tester.test_vl(256);
decode_tester.test_vta(false);
decode_tester.test_sew(64);
decode_tester.test_vlmax(64);

vuop_tester.test_num_vuops_generated(12);
}
else
{
sparta_assert(false, "Invalid input file: " << input_file);
Expand Down
Loading

0 comments on commit 7c48970

Please sign in to comment.