summaryrefslogtreecommitdiff
path: root/include/opencl
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2014-11-26 22:30:33 +0200
committerTor Lillqvist <tml@collabora.com>2014-11-27 11:07:37 +0200
commitc1d09b1ad02160850d40c0d242a0d0ec0a8dc1bc (patch)
treee39b6a73639f483a3000cdec31890cfdd051a5af /include/opencl
parentccfb8c78277d4a4f85af5ebbd96cf87f0d729016 (diff)
Work in progress: Move Calc-independend OpenCL configuration out of sc
Intermediate commit. More changes will follow: The device selection logic needs to be moved, too. (And cleaned up.) Instead of the separate formulacalculationoptions dialog we should simply have a normal options page for those OpenCL-related settings that will remain purely Calc-specific, like the formula opcode subsetting. Change-Id: Id60d95e80d377cbbf5780beb473b221bce06b5e5
Diffstat (limited to 'include/opencl')
-rw-r--r--include/opencl/openclconfig.hxx100
-rw-r--r--include/opencl/opencldllapi.h34
-rw-r--r--include/opencl/platforminfo.hxx51
3 files changed, 185 insertions, 0 deletions
diff --git a/include/opencl/openclconfig.hxx b/include/opencl/openclconfig.hxx
new file mode 100644
index 000000000000..c3a11034f1b4
--- /dev/null
+++ b/include/opencl/openclconfig.hxx
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_OPENCL_OPENCLCONFIG_HXX
+#define INCLUDED_OPENCL_OPENCLCONFIG_HXX
+
+#include <ostream>
+#include <set>
+
+#include <opencl/opencldllapi.h>
+#include <opencl/platforminfo.hxx>
+#include <rtl/ustring.hxx>
+
+#include <com/sun/star/uno/Sequence.hxx>
+
+struct OPENCL_DLLPUBLIC OpenCLConfig
+{
+ struct ImplMatcher
+ {
+ OUString maOS;
+ OUString maOSVersion;
+ OUString maPlatformVendor;
+ OUString maDevice;
+ OUString maDriverVersion;
+
+ ImplMatcher()
+ {
+ }
+
+ ImplMatcher(const OUString& rOS,
+ const OUString& rOSVersion,
+ const OUString& rPlatformVendor,
+ const OUString& rDevice,
+ const OUString& rDriverVersion)
+ : maOS(rOS),
+ maOSVersion(rOSVersion),
+ maPlatformVendor(rPlatformVendor),
+ maDevice(rDevice),
+ maDriverVersion(rDriverVersion)
+ {
+ }
+
+ bool operator==(const ImplMatcher& r) const
+ {
+ return maOS == r.maOS &&
+ maOSVersion == r.maOSVersion &&
+ maPlatformVendor == r.maPlatformVendor &&
+ maDevice == r.maDevice &&
+ maDriverVersion == r.maDriverVersion;
+ }
+ bool operator!=(const ImplMatcher& r) const
+ {
+ return !operator==(r);
+ }
+ bool operator<(const ImplMatcher& r) const
+ {
+ return (maOS < r.maOS ||
+ (maOS == r.maOS &&
+ (maOSVersion < r.maOSVersion ||
+ (maOSVersion == r.maOSVersion &&
+ (maPlatformVendor < r.maPlatformVendor ||
+ (maPlatformVendor == r.maPlatformVendor &&
+ (maDevice < r.maDevice ||
+ (maDevice == r.maDevice &&
+ (maDriverVersion < r.maDriverVersion)))))))));
+ }
+ };
+
+ bool mbUseOpenCL;
+
+ typedef std::set<ImplMatcher> ImplMatcherSet;
+
+ ImplMatcherSet maBlackList;
+ ImplMatcherSet maWhiteList;
+
+ OpenCLConfig();
+
+ bool operator== (const OpenCLConfig& r) const;
+ bool operator!= (const OpenCLConfig& r) const;
+
+ static OpenCLConfig get();
+
+ void set();
+
+ bool checkImplementation(const OpenCLPlatformInfo& rPlatform, const OpenCLDeviceInfo& rDevice) const;
+};
+
+OPENCL_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const OpenCLConfig& rConfig);
+OPENCL_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const OpenCLConfig::ImplMatcher& rImpl);
+OPENCL_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const OpenCLConfig::ImplMatcherSet& rSet);
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/opencl/opencldllapi.h b/include/opencl/opencldllapi.h
new file mode 100644
index 000000000000..f62b94cb77fc
--- /dev/null
+++ b/include/opencl/opencldllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OPENCL_OPENCLDLLAPI_H
+#define INCLUDED_OPENCL_OPENCLDLLAPI_H
+
+#include <sal/types.h>
+
+#if defined(OPENCL_DLLIMPLEMENTATION)
+#define OPENCL_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define OPENCL_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define OPENCL_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/opencl/platforminfo.hxx b/include/opencl/platforminfo.hxx
new file mode 100644
index 000000000000..6c40c438ed5a
--- /dev/null
+++ b/include/opencl/platforminfo.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_OPENCL_PLATFORMINFO_HXX
+#define INCLUDED_OPENCL_PLATFORMINFO_HXX
+
+#include <ostream>
+#include <vector>
+
+#include <clew.h>
+
+#include <opencl/opencldllapi.h>
+#include <rtl/ustring.hxx>
+
+// Struct that describs an actual instance of an OpenCL device
+
+struct OPENCL_DLLPUBLIC OpenCLDeviceInfo
+{
+ cl_device_id device;
+ OUString maName;
+ OUString maVendor;
+ OUString maDriver;
+ size_t mnMemory;
+ size_t mnComputeUnits;
+ size_t mnFrequency;
+
+ OpenCLDeviceInfo();
+};
+
+// Struct that describs an actual instance of an OpenCL platform implementation
+
+struct OPENCL_DLLPUBLIC OpenCLPlatformInfo
+{
+ cl_platform_id platform;
+ OUString maVendor;
+ OUString maName;
+ std::vector<OpenCLDeviceInfo> maDevices;
+
+ OpenCLPlatformInfo();
+};
+
+OPENCL_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const OpenCLPlatformInfo& rPlatform);
+OPENCL_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const OpenCLDeviceInfo& rDevice);
+
+#endif