diff --git a/configure.ac b/configure.ac index 9a0958b93..032b480fb 100644 --- a/configure.ac +++ b/configure.ac @@ -2253,16 +2253,16 @@ PKG_CHECK_MODULES(MesaOpenCL, [MesaOpenCL], ]) ]) -AC_MSG_CHECKING(whether to enable use of any found OpenCL) -AC_ARG_ENABLE(opencl, RB_HELP_STRING([--enable-opencl], [Enable OpenCL support]), +AC_MSG_CHECKING(whether to disable use of any found OpenCL) +AC_ARG_ENABLE(opencl, RB_HELP_STRING([--disable-opencl], [Disable OpenCL support]), [ - AC_MSG_RESULT([yes]) - enable_opencl="yes" - opencl_enable="enabled" -], [ AC_MSG_RESULT([no]) enable_opencl="no" opencl_enable="disabled" +], [ + AC_MSG_RESULT([yes]) + enable_opencl="yes" + opencl_enable="enabled" ]) AM_CONDITIONAL([OPENCL], [test "x$have_opencl" = "xyes" && test "x$enable_opencl" = "xyes" ]) diff --git a/ircd/cl.cc b/ircd/cl.cc index c58577e8f..da8ada84a 100644 --- a/ircd/cl.cc +++ b/ircd/cl.cc @@ -18,6 +18,8 @@ namespace ircd::cl static int throw_on_error(const int &code); template static int call(func&&, args&&...); template static T info(F&&, const id &, const param &, const mutable_buffer &); + + extern conf::item enable; } // Runtime state @@ -79,12 +81,30 @@ ircd::cl::version_abi "OpenCL", info::versions::ABI }; +decltype(ircd::cl::enable) +ircd::cl::enable +{ + { "name", "ircd.cl.enable" }, + { "default", false }, + { "persist", false }, +}; + // // init // ircd::cl::init::init() { + if(!enable) + { + log::dwarning + { + log, "OpenCL hardware acceleration is not available or enabled." + }; + + return; + } + const ctx::posix::enable_pthread enable_pthread; // Setup options