diff options
author | Jan Holesovsky <kendy@collabora.com> | 2015-11-24 17:13:21 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2015-11-24 17:41:31 +0100 |
commit | a81de86c47322bd6bc59b462eb2f69e0f1185df4 (patch) | |
tree | 859cd2b779fe4a4b235341456b154013f03d0361 /sc/source/core | |
parent | 8e148863d9683b8b73b28818d144330a607fb511 (diff) |
sc: Implement Software Interpreter subsetting, similarly to openCL one.
And add only the minimum amount of operations we are sure about.
Change-Id: I0dd35968206161e31fcd8bfd0b647329c703e0da
Diffstat (limited to 'sc/source/core')
-rw-r--r-- | sc/source/core/tool/calcconfig.cxx | 11 | ||||
-rw-r--r-- | sc/source/core/tool/token.cxx | 16 |
2 files changed, 27 insertions, 0 deletions
diff --git a/sc/source/core/tool/calcconfig.cxx b/sc/source/core/tool/calcconfig.cxx index 20d5530647c9..f285e138af99 100644 --- a/sc/source/core/tool/calcconfig.cxx +++ b/sc/source/core/tool/calcconfig.cxx @@ -86,6 +86,15 @@ void ScCalcConfig::setOpenCLConfigToDefault() ocSlope, ocSumIfs})); + // opcodes that are known to work well with the software interpreter + static OpCodeSet pDefaultSwInterpreterSubsetOpCodes(new std::set<OpCode>({ + ocAdd, + ocSub, + ocMul, + ocDiv, + ocSum, + ocProduct})); + // Note that these defaults better be kept in sync with those in // officecfg/registry/schema/org/openoffice/Office/Calc.xcs. // Crazy. @@ -93,6 +102,7 @@ void ScCalcConfig::setOpenCLConfigToDefault() mbOpenCLAutoSelect = true; mnOpenCLMinimumFormulaGroupSize = 100; mpOpenCLSubsetOpCodes = pDefaultOpenCLSubsetOpCodes; + mpSwInterpreterSubsetOpCodes = pDefaultSwInterpreterSubsetOpCodes; } void ScCalcConfig::reset() @@ -127,6 +137,7 @@ bool ScCalcConfig::operator== (const ScCalcConfig& r) const maOpenCLDevice == r.maOpenCLDevice && mnOpenCLMinimumFormulaGroupSize == r.mnOpenCLMinimumFormulaGroupSize && *mpOpenCLSubsetOpCodes == *r.mpOpenCLSubsetOpCodes && + *mpSwInterpreterSubsetOpCodes == *r.mpSwInterpreterSubsetOpCodes && true; } diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index 3f978c448693..138e0873c371 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -1319,6 +1319,12 @@ void ScTokenArray::CheckToken( const FormulaToken& r ) return; } + if (!ScCalcConfig::isOpenCLEnabled() && getenv("SC_ALLOW_SOFTWARE_INTERPRETER") != nullptr && ScInterpreter::GetGlobalConfig().mpSwInterpreterSubsetOpCodes->find(eOp) == ScInterpreter::GetGlobalConfig().mpSwInterpreterSubsetOpCodes->end()) + { + meVectorState = FormulaVectorDisabled; + return; + } + // We support vectorization for the following opcodes. switch (eOp) { @@ -1559,6 +1565,16 @@ void ScTokenArray::CheckToken( const FormulaToken& r ) meVectorState = FormulaVectorDisabled; return; } + + if (eOp >= SC_OPCODE_START_BIN_OP && + eOp <= SC_OPCODE_STOP_UN_OP && + !ScCalcConfig::isOpenCLEnabled() && + getenv("SC_ALLOW_SOFTWARE_INTERPRETER") != nullptr && + ScInterpreter::GetGlobalConfig().mpSwInterpreterSubsetOpCodes->find(eOp) == ScInterpreter::GetGlobalConfig().mpSwInterpreterSubsetOpCodes->end()) + { + meVectorState = FormulaVectorDisabled; + return; + } } bool ScTokenArray::ImplGetReference( ScRange& rRange, const ScAddress& rPos, bool bValidOnly ) const |