aboutsummaryrefslogtreecommitdiff
path: root/tests/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/main.cpp')
-rw-r--r--tests/main.cpp79
1 files changed, 43 insertions, 36 deletions
diff --git a/tests/main.cpp b/tests/main.cpp
index 17342fc2c1..e862c7627e 100644
--- a/tests/main.cpp
+++ b/tests/main.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2020 ARM Limited.
+ * Copyright (c) 2017-2023 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "support/MemorySupport.h"
+#include "arm_compute/core/Version.h"
#include "support/StringSupport.h"
#include "tests/AssetsLibrary.h"
#include "tests/framework/DatasetModes.h"
@@ -39,15 +39,14 @@
#ifdef ARM_COMPUTE_CL
#include "arm_compute/core/CL/OpenCL.h"
+#include "arm_compute/runtime/CL/CLGEMMHeuristicsHandle.h"
#include "arm_compute/runtime/CL/CLHelpers.h"
#include "arm_compute/runtime/CL/CLScheduler.h"
#include "arm_compute/runtime/CL/CLTuner.h"
#include "utils/TypePrinter.h"
#endif /* ARM_COMPUTE_CL */
-#ifdef ARM_COMPUTE_GC
-#include "arm_compute/runtime/GLES_COMPUTE/GCScheduler.h"
-#endif /* ARM_COMPUTE_GC */
#include "arm_compute/runtime/Scheduler.h"
+#include "src/common/cpuinfo/CpuModel.h"
#include <fstream>
#include <initializer_list>
@@ -118,7 +117,7 @@ int main(int argc, char **argv)
auto filter_id = parser.add_option<utils::SimpleOption<std::string>>("filter-id");
filter_id->set_help("List of test ids. ... can be used to define a range.");
auto stop_on_error = parser.add_option<utils::ToggleOption>("stop-on-error");
- stop_on_error->set_help("Abort execution after the first failed test (useful for debugging)");
+ stop_on_error->set_help("Stop execution after the first failed test (useful for debugging)");
auto seed = parser.add_option<utils::SimpleOption<std::random_device::result_type>>("seed", std::random_device()());
seed->set_help("Global seed for random number generation");
auto list_tests = parser.add_option<utils::ToggleOption>("list-tests", false);
@@ -129,6 +128,8 @@ int main(int argc, char **argv)
error_on_missing_assets->set_help("Mark a test as failed instead of skipping it when assets are missing");
auto assets = parser.add_positional_option<utils::SimpleOption<std::string>>("assets");
assets->set_help("Path to the assets directory");
+ auto print_rerun_command = parser.add_option<utils::ToggleOption>("rerun-cmd");
+ print_rerun_command->set_help("Print out the command to rerun the exact failed testcase");
#ifdef ARM_COMPUTE_CL
auto enable_tuner = parser.add_option<utils::ToggleOption>("enable-tuner");
enable_tuner->set_help("Enable OpenCL dynamic tuner");
@@ -144,11 +145,16 @@ int main(int argc, char **argv)
auto tuner_file = parser.add_option<utils::SimpleOption<std::string>>("tuner-file", "");
tuner_file->set_help("File to load/save CLTuner values");
+
+ auto mlgo_file = parser.add_option<utils::SimpleOption<std::string>>("mlgo-file", "");
+ mlgo_file->set_help("File to load MLGO heuristics");
#endif /* ARM_COMPUTE_CL */
auto threads = parser.add_option<utils::SimpleOption<int>>("threads", 1);
threads->set_help("Number of threads to use");
auto cooldown_sec = parser.add_option<utils::SimpleOption<float>>("delay", -1.f);
cooldown_sec->set_help("Delay to add between test executions in seconds");
+ auto configure_only = parser.add_option<utils::ToggleOption>("configure-only", false);
+ configure_only->set_help("Only configures kernels, without allocating, running or validating. Needed in order to validate OpenCL kernel run-time compilation, without necessarily running or validating the kernels' execution");
try
{
@@ -166,37 +172,25 @@ int main(int argc, char **argv)
Scheduler::get().set_num_threads(threads->value());
// Create CPU context
- auto cpu_ctx = support::cpp14::make_unique<RuntimeContext>();
+ auto cpu_ctx = std::make_unique<RuntimeContext>();
cpu_ctx->set_scheduler(&Scheduler::get());
// Track CPU context
- auto cpu_ctx_track = support::cpp14::make_unique<ContextSchedulerUser>(cpu_ctx.get());
+ auto cpu_ctx_track = std::make_unique<ContextSchedulerUser>(cpu_ctx.get());
// Create parameters
- parameters = support::cpp14::make_unique<ParametersLibrary>();
+ parameters = std::make_unique<ParametersLibrary>();
parameters->set_cpu_ctx(std::move(cpu_ctx));
-#ifdef ARM_COMPUTE_GC
- // Setup OpenGL context
- {
- auto gles_ctx = support::cpp14::make_unique<GCRuntimeContext>();
- ARM_COMPUTE_ERROR_ON(gles_ctx == nullptr);
- {
- // Legacy singletons API: This has been deprecated and the singletons will be removed
- // Setup singleton for backward compatibility
- GCScheduler::get().default_init();
- }
- parameters->set_gc_ctx(std::move(gles_ctx));
- };
-#endif /* ARM_COMPUTE_GC */
-
#ifdef ARM_COMPUTE_CL
- CLTuner cl_tuner(false);
+ CLTuner cl_tuner(false);
+ CLGEMMHeuristicsHandle gemm_heuristics;
if(opencl_is_available())
{
- auto ctx_dev_err = create_opencl_context_and_device();
+ auto ctx_dev_err = create_opencl_context_and_device(CLBackendType::Native);
ARM_COMPUTE_ERROR_ON_MSG(std::get<2>(ctx_dev_err) != CL_SUCCESS, "Failed to create OpenCL context");
- CLScheduler::get().default_init_with_context(std::get<1>(ctx_dev_err), std::get<0>(ctx_dev_err), &cl_tuner);
+ gemm_heuristics.reload_from_file(mlgo_file->value());
+ CLScheduler::get().default_init_with_context(std::get<1>(ctx_dev_err), std::get<0>(ctx_dev_err), &cl_tuner, &gemm_heuristics);
}
if(enable_tuner->is_set())
@@ -245,13 +239,23 @@ int main(int argc, char **argv)
#endif /* ARM_COMPUTE_CL */
const arm_compute::CPUInfo &cpu_info = Scheduler::get().cpu_info();
const unsigned int num_cpus = cpu_info.get_cpu_num();
+
+ p->print_entry("cpu_has_sve", support::cpp11::to_string(cpu_info.has_sve()));
+ p->print_entry("cpu_has_sve2", support::cpp11::to_string(cpu_info.has_sve2()));
+ p->print_entry("cpu_has_svef32mm", support::cpp11::to_string(cpu_info.has_svef32mm()));
+ p->print_entry("cpu_has_svei8mm", support::cpp11::to_string(cpu_info.has_svei8mm()));
+ p->print_entry("cpu_has_svebf16", support::cpp11::to_string(cpu_info.has_svebf16()));
+ p->print_entry("cpu_has_sme", support::cpp11::to_string(cpu_info.has_sme()));
+ p->print_entry("cpu_has_sme2", support::cpp11::to_string(cpu_info.has_sme2()));
p->print_entry("cpu_has_fp16", support::cpp11::to_string(cpu_info.has_fp16()));
+ p->print_entry("cpu_has_bf16", support::cpp11::to_string(cpu_info.has_bf16()));
p->print_entry("cpu_has_dotprod", support::cpp11::to_string(cpu_info.has_dotprod()));
+ p->print_entry("cpu_has_i8mm", support::cpp11::to_string(cpu_info.has_i8mm()));
for(unsigned int j = 0; j < num_cpus; ++j)
{
const CPUModel model = cpu_info.get_cpu_model(j);
- p->print_entry("CPU" + support::cpp11::to_string(j), cpu_model_to_string(model));
+ p->print_entry("CPU" + support::cpp11::to_string(j), cpuinfo::cpu_model_to_string(model));
}
p->print_entry("Iterations", support::cpp11::to_string(options.iterations->value()));
p->print_entry("Threads", support::cpp11::to_string(threads->value()));
@@ -269,13 +273,16 @@ int main(int argc, char **argv)
// Initialize framework
framework::FrameworkConfig fconfig;
- fconfig.instruments = options.instruments->value();
- fconfig.name_filter = filter->value();
- fconfig.id_filter = filter_id->value();
- fconfig.num_iterations = options.iterations->value();
- fconfig.mode = dataset_mode->value();
- fconfig.log_level = options.log_level->value();
- fconfig.cooldown_sec = cooldown_sec->value();
+ fconfig.instruments = options.instruments->value();
+ fconfig.name_filter = filter->value();
+ fconfig.id_filter = filter_id->value();
+ fconfig.num_iterations = options.iterations->value();
+ fconfig.mode = dataset_mode->value();
+ fconfig.log_level = options.log_level->value();
+ fconfig.cooldown_sec = cooldown_sec->value();
+ fconfig.configure_only = configure_only->value();
+ fconfig.print_rerun_cmd = print_rerun_command->value();
+ fconfig.seed = seed->value();
framework.init(fconfig);
for(auto &p : printers)
@@ -312,8 +319,8 @@ int main(int argc, char **argv)
return 0;
}
- library = support::cpp14::make_unique<AssetsLibrary>(assets->value(), seed->value());
- fixed_library = support::cpp14::make_unique<AssetsLibrary>(assets->value(), fixed_seed);
+ library = std::make_unique<AssetsLibrary>(assets->value(), seed->value());
+ fixed_library = std::make_unique<AssetsLibrary>(assets->value(), fixed_seed);
if(!parser.validate())
{