0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-02 01:59:33 +02:00

ircd:🆑 Enable configure by default; disable runtime by default.

This commit is contained in:
Jason Volk 2021-01-15 16:40:42 -08:00
parent 78133c59cd
commit 1d46cf9f5f
2 changed files with 26 additions and 6 deletions

View file

@ -2253,16 +2253,16 @@ PKG_CHECK_MODULES(MesaOpenCL, [MesaOpenCL],
]) ])
]) ])
AC_MSG_CHECKING(whether to enable use of any found OpenCL) AC_MSG_CHECKING(whether to disable use of any found OpenCL)
AC_ARG_ENABLE(opencl, RB_HELP_STRING([--enable-opencl], [Enable OpenCL support]), 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]) AC_MSG_RESULT([no])
enable_opencl="no" enable_opencl="no"
opencl_enable="disabled" 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" ]) AM_CONDITIONAL([OPENCL], [test "x$have_opencl" = "xyes" && test "x$enable_opencl" = "xyes" ])

View file

@ -18,6 +18,8 @@ namespace ircd::cl
static int throw_on_error(const int &code); static int throw_on_error(const int &code);
template<class func, class... args> static int call(func&&, args&&...); template<class func, class... args> static int call(func&&, args&&...);
template<class T = string_view, class F, class id, class param> static T info(F&&, const id &, const param &, const mutable_buffer &); template<class T = string_view, class F, class id, class param> static T info(F&&, const id &, const param &, const mutable_buffer &);
extern conf::item<bool> enable;
} }
// Runtime state // Runtime state
@ -79,12 +81,30 @@ ircd::cl::version_abi
"OpenCL", info::versions::ABI "OpenCL", info::versions::ABI
}; };
decltype(ircd::cl::enable)
ircd::cl::enable
{
{ "name", "ircd.cl.enable" },
{ "default", false },
{ "persist", false },
};
// //
// init // init
// //
ircd::cl::init::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; const ctx::posix::enable_pthread enable_pthread;
// Setup options // Setup options