summaryrefslogtreecommitdiff
path: root/src/utilities/compile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/utilities/compile.cpp')
-rw-r--r--src/utilities/compile.cpp12
1 files changed, 9 insertions, 3 deletions
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<std::string>& 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<int>(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);
}