From ca5dbcd2bd31fb0a0e3f6c2f81b3c0fff6250738 Mon Sep 17 00:00:00 2001 From: Cedric Nugteren Date: Sat, 9 Dec 2017 15:16:53 +0100 Subject: Made the pre-processor run by default for ARM and Qualcomm GPUs --- src/utilities/compile.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/utilities/compile.cpp') diff --git a/src/utilities/compile.cpp b/src/utilities/compile.cpp index 4d1e8929..6243d196 100644 --- a/src/utilities/compile.cpp +++ b/src/utilities/compile.cpp @@ -25,7 +25,8 @@ Program CompileFromSource(const std::string &source_string, const Precision prec const std::string &routine_name, const Device& device, const Context& context, std::vector& options, - const bool run_preprocessor, const bool silent) { + const size_t run_preprocessor, // 0: platform dependent, 1: always, 2: never + const bool silent) { auto header_string = std::string{""}; header_string += "#define PRECISION " + ToString(static_cast(precision)) + "\n"; @@ -75,9 +76,14 @@ Program CompileFromSource(const std::string &source_string, const Precision prec const auto start_time = std::chrono::steady_clock::now(); #endif - // Runs a pre-processor to unroll loops and perform array-to-register promotion + // Runs a pre-processor to unroll loops and perform array-to-register promotion. Most OpenCL + // compilers do this, but some don't. + auto do_run_preprocessor = false; + if (run_preprocessor == 0) { do_run_preprocessor = (device.IsARM() && device.IsGPU()) || + (device.IsQualcomm() && device.IsGPU()); } + if (run_preprocessor == 1) { do_run_preprocessor = true; } auto kernel_string = header_string + source_string; - if (run_preprocessor) { + if (do_run_preprocessor) { log_debug("Running built-in pre-processor"); kernel_string = PreprocessKernelSource(kernel_string); } -- cgit v1.2.3