Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
951ea7ef
Kaydet (Commit)
951ea7ef
authored
Eki 29, 2013
tarafından
Kohei Yoshida
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
std::shared_ptr is C++11 specific. Use boost::shared_ptr instead.
Change-Id: I8e6780ae5b5042a0521687f3a3535e74d7a35d23
üst
f571c985
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
26 deletions
+28
-26
formulagroupcl.cxx
sc/source/core/opencl/formulagroupcl.cxx
+22
-22
opbase.cxx
sc/source/core/opencl/opbase.cxx
+1
-1
opbase.hxx
sc/source/core/opencl/opbase.hxx
+5
-3
No files found.
sc/source/core/opencl/formulagroupcl.cxx
Dosyayı görüntüle @
951ea7ef
...
@@ -93,7 +93,7 @@ class ConstStringArgument: public DynamicKernelArgument
...
@@ -93,7 +93,7 @@ class ConstStringArgument: public DynamicKernelArgument
{
{
public
:
public
:
ConstStringArgument
(
const
std
::
string
&
s
,
ConstStringArgument
(
const
std
::
string
&
s
,
std
::
shared_ptr
<
FormulaTreeNode
>
ft
)
:
boost
::
shared_ptr
<
FormulaTreeNode
>
ft
)
:
DynamicKernelArgument
(
s
,
ft
)
{}
DynamicKernelArgument
(
s
,
ft
)
{}
/// Generate declaration
/// Generate declaration
virtual
void
GenDecl
(
std
::
stringstream
&
ss
)
const
virtual
void
GenDecl
(
std
::
stringstream
&
ss
)
const
...
@@ -151,7 +151,7 @@ class DynamicKernelConstantArgument: public DynamicKernelArgument
...
@@ -151,7 +151,7 @@ class DynamicKernelConstantArgument: public DynamicKernelArgument
{
{
public
:
public
:
DynamicKernelConstantArgument
(
const
std
::
string
&
s
,
DynamicKernelConstantArgument
(
const
std
::
string
&
s
,
std
::
shared_ptr
<
FormulaTreeNode
>
ft
)
:
boost
::
shared_ptr
<
FormulaTreeNode
>
ft
)
:
DynamicKernelArgument
(
s
,
ft
)
{}
DynamicKernelArgument
(
s
,
ft
)
{}
/// Generate declaration
/// Generate declaration
virtual
void
GenDecl
(
std
::
stringstream
&
ss
)
const
virtual
void
GenDecl
(
std
::
stringstream
&
ss
)
const
...
@@ -195,7 +195,7 @@ class DynamicKernelStringArgument: public DynamicKernelArgument
...
@@ -195,7 +195,7 @@ class DynamicKernelStringArgument: public DynamicKernelArgument
{
{
public
:
public
:
DynamicKernelStringArgument
(
const
std
::
string
&
s
,
DynamicKernelStringArgument
(
const
std
::
string
&
s
,
std
::
shared_ptr
<
FormulaTreeNode
>
ft
)
:
boost
::
shared_ptr
<
FormulaTreeNode
>
ft
)
:
DynamicKernelArgument
(
s
,
ft
)
{}
DynamicKernelArgument
(
s
,
ft
)
{}
virtual
void
GenSlidingWindowFunction
(
std
::
stringstream
&
)
{}
virtual
void
GenSlidingWindowFunction
(
std
::
stringstream
&
)
{}
...
@@ -268,7 +268,7 @@ class DynamicKernelSlidingArgument: public Base
...
@@ -268,7 +268,7 @@ class DynamicKernelSlidingArgument: public Base
{
{
public
:
public
:
DynamicKernelSlidingArgument
(
const
std
::
string
&
s
,
DynamicKernelSlidingArgument
(
const
std
::
string
&
s
,
std
::
shared_ptr
<
FormulaTreeNode
>
ft
)
:
boost
::
shared_ptr
<
FormulaTreeNode
>
ft
)
:
Base
(
s
,
ft
)
Base
(
s
,
ft
)
{
{
FormulaToken
*
t
=
ft
->
GetFormulaToken
();
FormulaToken
*
t
=
ft
->
GetFormulaToken
();
...
@@ -664,7 +664,7 @@ public:
...
@@ -664,7 +664,7 @@ public:
typedef
std
::
unique_ptr
<
DynamicKernelArgument
>
SubArgument
;
typedef
std
::
unique_ptr
<
DynamicKernelArgument
>
SubArgument
;
DynamicKernelSoPArguments
(
const
std
::
string
&
s
,
DynamicKernelSoPArguments
(
const
std
::
string
&
s
,
std
::
shared_ptr
<
FormulaTreeNode
>
ft
);
boost
::
shared_ptr
<
FormulaTreeNode
>
ft
);
/// Create buffer and pass the buffer to a given kernel
/// Create buffer and pass the buffer to a given kernel
virtual
size_t
Marshal
(
cl_kernel
k
,
int
argno
,
int
nVectorWidth
)
virtual
size_t
Marshal
(
cl_kernel
k
,
int
argno
,
int
nVectorWidth
)
...
@@ -763,7 +763,7 @@ private:
...
@@ -763,7 +763,7 @@ private:
template
<
class
Op
>
template
<
class
Op
>
std
::
unique_ptr
<
DynamicKernelArgument
>
SoPHelper
(
const
std
::
string
&
ts
,
std
::
unique_ptr
<
DynamicKernelArgument
>
SoPHelper
(
const
std
::
string
&
ts
,
std
::
shared_ptr
<
FormulaTreeNode
>
ft
)
boost
::
shared_ptr
<
FormulaTreeNode
>
ft
)
{
{
return
std
::
unique_ptr
<
DynamicKernelArgument
>
(
return
std
::
unique_ptr
<
DynamicKernelArgument
>
(
new
DynamicKernelSoPArguments
<
Op
>
(
ts
,
ft
));
new
DynamicKernelSoPArguments
<
Op
>
(
ts
,
ft
));
...
@@ -771,7 +771,7 @@ std::unique_ptr<DynamicKernelArgument> SoPHelper(const std::string &ts,
...
@@ -771,7 +771,7 @@ std::unique_ptr<DynamicKernelArgument> SoPHelper(const std::string &ts,
template
<
class
Op
>
template
<
class
Op
>
DynamicKernelSoPArguments
<
Op
>::
DynamicKernelSoPArguments
(
const
std
::
string
&
s
,
DynamicKernelSoPArguments
<
Op
>::
DynamicKernelSoPArguments
(
const
std
::
string
&
s
,
std
::
shared_ptr
<
FormulaTreeNode
>
ft
)
:
boost
::
shared_ptr
<
FormulaTreeNode
>
ft
)
:
DynamicKernelArgument
(
s
,
ft
)
{
DynamicKernelArgument
(
s
,
ft
)
{
size_t
nChildren
=
ft
->
Children
.
size
();
size_t
nChildren
=
ft
->
Children
.
size
();
...
@@ -1100,12 +1100,12 @@ DynamicKernelSoPArguments<Op>::DynamicKernelSoPArguments(const std::string &s,
...
@@ -1100,12 +1100,12 @@ DynamicKernelSoPArguments<Op>::DynamicKernelSoPArguments(const std::string &s,
class
SymbolTable
{
class
SymbolTable
{
public
:
public
:
typedef
std
::
map
<
const
FormulaToken
*
,
typedef
std
::
map
<
const
FormulaToken
*
,
std
::
shared_ptr
<
DynamicKernelArgument
>
>
ArgumentMap
;
boost
::
shared_ptr
<
DynamicKernelArgument
>
>
ArgumentMap
;
// This avoids instability caused by using pointer as the key type
// This avoids instability caused by using pointer as the key type
typedef
std
::
list
<
std
::
shared_ptr
<
DynamicKernelArgument
>
>
ArgumentList
;
typedef
std
::
list
<
boost
::
shared_ptr
<
DynamicKernelArgument
>
>
ArgumentList
;
SymbolTable
(
void
)
:
mCurId
(
0
)
{}
SymbolTable
(
void
)
:
mCurId
(
0
)
{}
template
<
class
T
>
template
<
class
T
>
const
DynamicKernelArgument
*
DeclRefArg
(
std
::
shared_ptr
<
FormulaTreeNode
>
);
const
DynamicKernelArgument
*
DeclRefArg
(
boost
::
shared_ptr
<
FormulaTreeNode
>
);
/// Used to generate sliding window helpers
/// Used to generate sliding window helpers
void
DumpSlidingWindowFunctions
(
std
::
stringstream
&
ss
)
void
DumpSlidingWindowFunctions
(
std
::
stringstream
&
ss
)
{
{
...
@@ -1136,7 +1136,7 @@ void SymbolTable::Marshal(cl_kernel k, int nVectorWidth)
...
@@ -1136,7 +1136,7 @@ void SymbolTable::Marshal(cl_kernel k, int nVectorWidth)
/// Code generation
/// Code generation
class
DynamicKernel
{
class
DynamicKernel
{
public
:
public
:
DynamicKernel
(
std
::
shared_ptr
<
FormulaTreeNode
>
r
)
:
mpRoot
(
r
),
DynamicKernel
(
boost
::
shared_ptr
<
FormulaTreeNode
>
r
)
:
mpRoot
(
r
),
mpProgram
(
NULL
),
mpKernel
(
NULL
),
mpResClmem
(
NULL
)
{}
mpProgram
(
NULL
),
mpKernel
(
NULL
),
mpResClmem
(
NULL
)
{}
/// Code generation in OpenCL
/// Code generation in OpenCL
std
::
string
CodeGen
()
{
std
::
string
CodeGen
()
{
...
@@ -1220,8 +1220,8 @@ public:
...
@@ -1220,8 +1220,8 @@ public:
~
DynamicKernel
();
~
DynamicKernel
();
cl_mem
GetResultBuffer
(
void
)
const
{
return
mpResClmem
;
}
cl_mem
GetResultBuffer
(
void
)
const
{
return
mpResClmem
;
}
private
:
private
:
void
TraverseAST
(
std
::
shared_ptr
<
FormulaTreeNode
>
);
void
TraverseAST
(
boost
::
shared_ptr
<
FormulaTreeNode
>
);
std
::
shared_ptr
<
FormulaTreeNode
>
mpRoot
;
boost
::
shared_ptr
<
FormulaTreeNode
>
mpRoot
;
SymbolTable
mSyms
;
SymbolTable
mSyms
;
std
::
string
mKernelSignature
,
mKernelHash
;
std
::
string
mKernelSignature
,
mKernelHash
;
std
::
string
mFullProgramSrc
;
std
::
string
mFullProgramSrc
;
...
@@ -1282,7 +1282,7 @@ void DynamicKernel::CreateKernel(void)
...
@@ -1282,7 +1282,7 @@ void DynamicKernel::CreateKernel(void)
// The template argument T must be a subclass of DynamicKernelArgument
// The template argument T must be a subclass of DynamicKernelArgument
template
<
typename
T
>
template
<
typename
T
>
const
DynamicKernelArgument
*
SymbolTable
::
DeclRefArg
(
const
DynamicKernelArgument
*
SymbolTable
::
DeclRefArg
(
std
::
shared_ptr
<
FormulaTreeNode
>
t
)
boost
::
shared_ptr
<
FormulaTreeNode
>
t
)
{
{
FormulaToken
*
ref
=
t
->
GetFormulaToken
();
FormulaToken
*
ref
=
t
->
GetFormulaToken
();
ArgumentMap
::
iterator
it
=
mSymbols
.
find
(
ref
);
ArgumentMap
::
iterator
it
=
mSymbols
.
find
(
ref
);
...
@@ -1291,7 +1291,7 @@ const DynamicKernelArgument *SymbolTable::DeclRefArg(
...
@@ -1291,7 +1291,7 @@ const DynamicKernelArgument *SymbolTable::DeclRefArg(
std
::
cerr
<<
"DeclRefArg: Allocate a new symbol:"
;
std
::
cerr
<<
"DeclRefArg: Allocate a new symbol:"
;
std
::
stringstream
ss
;
std
::
stringstream
ss
;
ss
<<
"tmp"
<<
mCurId
++
;
ss
<<
"tmp"
<<
mCurId
++
;
std
::
shared_ptr
<
DynamicKernelArgument
>
new_arg
(
new
T
(
ss
.
str
(),
t
));
boost
::
shared_ptr
<
DynamicKernelArgument
>
new_arg
(
new
T
(
ss
.
str
(),
t
));
mSymbols
[
ref
]
=
new_arg
;
mSymbols
[
ref
]
=
new_arg
;
mParams
.
push_back
(
new_arg
);
mParams
.
push_back
(
new_arg
);
std
::
cerr
<<
ss
.
str
()
<<
"
\n
"
;
std
::
cerr
<<
ss
.
str
()
<<
"
\n
"
;
...
@@ -1343,15 +1343,15 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument& rDoc,
...
@@ -1343,15 +1343,15 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument& rDoc,
// Constructing "AST"
// Constructing "AST"
FormulaTokenIterator
aCode
=
rCode
;
FormulaTokenIterator
aCode
=
rCode
;
std
::
list
<
FormulaToken
*>
list
;
std
::
list
<
FormulaToken
*>
list
;
std
::
map
<
FormulaToken
*
,
std
::
shared_ptr
<
FormulaTreeNode
>>
m_hash_map
;
std
::
map
<
FormulaToken
*
,
boost
::
shared_ptr
<
FormulaTreeNode
>>
m_hash_map
;
FormulaToken
*
pCur
;
FormulaToken
*
pCur
;
while
(
(
pCur
=
(
FormulaToken
*
)(
aCode
.
Next
())
)
!=
NULL
)
while
(
(
pCur
=
(
FormulaToken
*
)(
aCode
.
Next
())
)
!=
NULL
)
{
{
OpCode
eOp
=
pCur
->
GetOpCode
();
OpCode
eOp
=
pCur
->
GetOpCode
();
if
(
eOp
!=
ocPush
)
if
(
eOp
!=
ocPush
)
{
{
std
::
shared_ptr
<
FormulaTreeNode
>
m_currNode
=
boost
::
shared_ptr
<
FormulaTreeNode
>
m_currNode
=
std
::
shared_ptr
<
FormulaTreeNode
>
(
new
FormulaTreeNode
(
pCur
));
boost
::
shared_ptr
<
FormulaTreeNode
>
(
new
FormulaTreeNode
(
pCur
));
sal_uInt8
m_ParamCount
=
pCur
->
GetParamCount
();
sal_uInt8
m_ParamCount
=
pCur
->
GetParamCount
();
for
(
int
i
=
0
;
i
<
m_ParamCount
;
i
++
)
for
(
int
i
=
0
;
i
<
m_ParamCount
;
i
++
)
{
{
...
@@ -1365,8 +1365,8 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument& rDoc,
...
@@ -1365,8 +1365,8 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument& rDoc,
}
}
else
else
{
{
std
::
shared_ptr
<
FormulaTreeNode
>
m_ChildTreeNode
=
boost
::
shared_ptr
<
FormulaTreeNode
>
m_ChildTreeNode
=
std
::
shared_ptr
<
FormulaTreeNode
>
(
boost
::
shared_ptr
<
FormulaTreeNode
>
(
new
FormulaTreeNode
(
m_TempFormula
));
new
FormulaTreeNode
(
m_TempFormula
));
m_currNode
->
Children
.
push_back
(
m_ChildTreeNode
);
m_currNode
->
Children
.
push_back
(
m_ChildTreeNode
);
}
}
...
@@ -1378,8 +1378,8 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument& rDoc,
...
@@ -1378,8 +1378,8 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument& rDoc,
list
.
push_back
(
pCur
);
list
.
push_back
(
pCur
);
}
}
std
::
shared_ptr
<
FormulaTreeNode
>
Root
=
boost
::
shared_ptr
<
FormulaTreeNode
>
Root
=
std
::
shared_ptr
<
FormulaTreeNode
>
(
new
FormulaTreeNode
(
NULL
));
boost
::
shared_ptr
<
FormulaTreeNode
>
(
new
FormulaTreeNode
(
NULL
));
Root
->
Children
.
push_back
(
m_hash_map
[
list
.
back
()]);
Root
->
Children
.
push_back
(
m_hash_map
[
list
.
back
()]);
// Code generation
// Code generation
mpKernel
=
new
DynamicKernel
(
Root
);
mpKernel
=
new
DynamicKernel
(
Root
);
...
...
sc/source/core/opencl/opbase.cxx
Dosyayı görüntüle @
951ea7ef
...
@@ -16,7 +16,7 @@ using namespace formula;
...
@@ -16,7 +16,7 @@ using namespace formula;
namespace
sc
{
namespace
opencl
{
namespace
sc
{
namespace
opencl
{
DynamicKernelArgument
::
DynamicKernelArgument
(
const
std
::
string
&
s
,
DynamicKernelArgument
::
DynamicKernelArgument
(
const
std
::
string
&
s
,
std
::
shared_ptr
<
FormulaTreeNode
>
ft
)
:
boost
::
shared_ptr
<
FormulaTreeNode
>
ft
)
:
mSymName
(
s
),
mFormulaTree
(
ft
),
mpClmem
(
NULL
)
{}
mSymName
(
s
),
mFormulaTree
(
ft
),
mpClmem
(
NULL
)
{}
/// Generate declaration
/// Generate declaration
...
...
sc/source/core/opencl/opbase.hxx
Dosyayı görüntüle @
951ea7ef
...
@@ -14,6 +14,8 @@
...
@@ -14,6 +14,8 @@
#include "formula/token.hxx"
#include "formula/token.hxx"
#include <boost/shared_ptr.hpp>
#define ISNAN
#define ISNAN
namespace
sc
{
namespace
opencl
{
namespace
sc
{
namespace
opencl
{
...
@@ -49,7 +51,7 @@ public:
...
@@ -49,7 +51,7 @@ public:
{
{
Children
.
reserve
(
8
);
Children
.
reserve
(
8
);
}
}
std
::
vector
<
std
::
shared_ptr
<
FormulaTreeNode
>
>
Children
;
std
::
vector
<
boost
::
shared_ptr
<
FormulaTreeNode
>
>
Children
;
formula
::
FormulaToken
*
GetFormulaToken
(
void
)
const
formula
::
FormulaToken
*
GetFormulaToken
(
void
)
const
{
{
return
mpCurrentFormula
;
return
mpCurrentFormula
;
...
@@ -66,7 +68,7 @@ private:
...
@@ -66,7 +68,7 @@ private:
class
DynamicKernelArgument
class
DynamicKernelArgument
{
{
public
:
public
:
DynamicKernelArgument
(
const
std
::
string
&
s
,
std
::
shared_ptr
<
FormulaTreeNode
>
ft
);
DynamicKernelArgument
(
const
std
::
string
&
s
,
boost
::
shared_ptr
<
FormulaTreeNode
>
ft
);
const
std
::
string
&
GetNameAsString
(
void
)
const
{
return
mSymName
;
}
const
std
::
string
&
GetNameAsString
(
void
)
const
{
return
mSymName
;
}
/// Generate declaration
/// Generate declaration
...
@@ -94,7 +96,7 @@ public:
...
@@ -94,7 +96,7 @@ public:
const
std
::
string
&
GetName
(
void
)
const
{
return
mSymName
;
}
const
std
::
string
&
GetName
(
void
)
const
{
return
mSymName
;
}
protected
:
protected
:
const
std
::
string
mSymName
;
const
std
::
string
mSymName
;
std
::
shared_ptr
<
FormulaTreeNode
>
mFormulaTree
;
boost
::
shared_ptr
<
FormulaTreeNode
>
mFormulaTree
;
// Used by marshaling
// Used by marshaling
cl_mem
mpClmem
;
cl_mem
mpClmem
;
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment