Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
c79f45bf
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c79f45bf
编写于
4月 02, 2019
作者:
S
superjomn
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
上级
aac42b9a
变更
31
显示空白变更内容
内联
并排
Showing
31 changed file
with
62 addition
and
46 deletion
+62
-46
paddle/fluid/lite/CMakeLists.txt
paddle/fluid/lite/CMakeLists.txt
+1
-12
paddle/fluid/lite/core/CMakeLists.txt
paddle/fluid/lite/core/CMakeLists.txt
+9
-0
paddle/fluid/lite/core/context.cc
paddle/fluid/lite/core/context.cc
+0
-0
paddle/fluid/lite/core/context.h
paddle/fluid/lite/core/context.h
+7
-1
paddle/fluid/lite/core/executor.cc
paddle/fluid/lite/core/executor.cc
+0
-0
paddle/fluid/lite/core/executor.h
paddle/fluid/lite/core/executor.h
+0
-0
paddle/fluid/lite/core/kernel.h
paddle/fluid/lite/core/kernel.h
+2
-2
paddle/fluid/lite/core/memory.cc
paddle/fluid/lite/core/memory.cc
+1
-1
paddle/fluid/lite/core/memory.h
paddle/fluid/lite/core/memory.h
+0
-0
paddle/fluid/lite/core/op_lite.cc
paddle/fluid/lite/core/op_lite.cc
+0
-0
paddle/fluid/lite/core/op_lite.h
paddle/fluid/lite/core/op_lite.h
+14
-5
paddle/fluid/lite/core/op_registry.cc
paddle/fluid/lite/core/op_registry.cc
+0
-0
paddle/fluid/lite/core/op_registry.h
paddle/fluid/lite/core/op_registry.h
+3
-3
paddle/fluid/lite/core/scope.cc
paddle/fluid/lite/core/scope.cc
+1
-1
paddle/fluid/lite/core/scope.h
paddle/fluid/lite/core/scope.h
+1
-1
paddle/fluid/lite/core/scope_test.cc
paddle/fluid/lite/core/scope_test.cc
+1
-1
paddle/fluid/lite/core/target_wrapper.h
paddle/fluid/lite/core/target_wrapper.h
+6
-3
paddle/fluid/lite/core/tensor.cc
paddle/fluid/lite/core/tensor.cc
+0
-0
paddle/fluid/lite/core/tensor.h
paddle/fluid/lite/core/tensor.h
+0
-0
paddle/fluid/lite/core/variable.cc
paddle/fluid/lite/core/variable.cc
+1
-1
paddle/fluid/lite/core/variable.h
paddle/fluid/lite/core/variable.h
+1
-1
paddle/fluid/lite/kernels/host/fc_compute.cc
paddle/fluid/lite/kernels/host/fc_compute.cc
+1
-1
paddle/fluid/lite/kernels/host/fc_compute.h
paddle/fluid/lite/kernels/host/fc_compute.h
+1
-1
paddle/fluid/lite/kernels/host/relu_compute.cc
paddle/fluid/lite/kernels/host/relu_compute.cc
+1
-1
paddle/fluid/lite/kernels/host/relu_compute.h
paddle/fluid/lite/kernels/host/relu_compute.h
+1
-1
paddle/fluid/lite/model_parser/model_parser.cc
paddle/fluid/lite/model_parser/model_parser.cc
+3
-3
paddle/fluid/lite/operators/fc_op.cc
paddle/fluid/lite/operators/fc_op.cc
+1
-1
paddle/fluid/lite/operators/fc_op.h
paddle/fluid/lite/operators/fc_op.h
+2
-2
paddle/fluid/lite/operators/relu_op.cc
paddle/fluid/lite/operators/relu_op.cc
+1
-1
paddle/fluid/lite/operators/relu_op.h
paddle/fluid/lite/operators/relu_op.h
+2
-2
paddle/fluid/lite/x86/target_wrapper.h
paddle/fluid/lite/x86/target_wrapper.h
+1
-1
未找到文件。
paddle/fluid/lite/CMakeLists.txt
浏览文件 @
c79f45bf
cc_library
(
executor_lite SRCS executor.cc
)
cc_library
(
op_lite SRCS op_lite.cc
)
cc_library
(
memory_lite SRCS memory.cc
)
cc_library
(
tensor_lite SRCS tensor.cc DEPS memory_lite
)
cc_library
(
variable_lite SRCS variable.cc
)
cc_library
(
op_registry_lite SRCS op_registry.cc
)
cc_library
(
scope_lite SRCS scope.cc
)
add_subdirectory
(
core
)
add_subdirectory
(
x86
)
add_subdirectory
(
cuda
)
add_subdirectory
(
operators
)
add_subdirectory
(
kernels
)
add_subdirectory
(
model_parser
)
# tests
cc_test
(
test_scope_lite SRCS scope_test.cc DEPS scope_lite
)
paddle/fluid/lite/core/CMakeLists.txt
0 → 100644
浏览文件 @
c79f45bf
cc_library
(
executor_lite SRCS executor.cc
)
cc_library
(
op_lite SRCS op_lite.cc
)
cc_library
(
memory_lite SRCS memory.cc
)
cc_library
(
tensor_lite SRCS tensor.cc DEPS memory_lite
)
cc_library
(
variable_lite SRCS variable.cc
)
cc_library
(
op_registry_lite SRCS op_registry.cc
)
cc_library
(
scope_lite SRCS scope.cc
)
cc_test
(
test_scope_lite SRCS scope_test.cc DEPS scope_lite
)
paddle/fluid/lite/context.cc
→
paddle/fluid/lite/co
re/co
ntext.cc
浏览文件 @
c79f45bf
文件已移动
paddle/fluid/lite/context.h
→
paddle/fluid/lite/co
re/co
ntext.h
浏览文件 @
c79f45bf
...
...
@@ -25,6 +25,7 @@ class Context {
public:
using
target_wrapper_t
=
TargetWrapper
<
Target
>
;
using
stream_t
=
typename
TargetWrapper
<
Target
>::
stream_t
;
using
event_t
=
typename
TargetWrapper
<
Target
>::
event_t
;
Context
()
=
default
;
Context
(
int
device_id
,
stream_t
compute_stream
,
stream_t
data_stream
)
...
...
@@ -35,15 +36,20 @@ class Context {
void
SetDeviceId
(
int
device_id
)
{
device_id_
=
device_id
;
}
void
SetComputeStream
(
stream_t
x
)
{
compute_stream_
=
x
;
}
void
SetDataStream
(
stream_t
x
)
{
data_stream_
=
x
;
}
void
SetDependEvents
(
const
std
::
vector
<
event_t
>&
events
)
{
depend_events_
=
events
;
}
int
device_id
()
const
{
return
device_id_
;
}
stream_t
compute_stream
()
const
{
return
compute_stream_
;
}
stream_t
data_stream
()
const
{
return
data_stream_
;
}
const
std
::
vector
<
event_t
>&
depend_events
()
const
{
return
depend_events_
;
}
private:
int
device_id_
;
int
device_id_
{
0
}
;
stream_t
compute_stream_
;
stream_t
data_stream_
;
std
::
vector
<
event_t
>
depend_events_
;
};
class
OpContext
final
{
...
...
paddle/fluid/lite/executor.cc
→
paddle/fluid/lite/
core/
executor.cc
浏览文件 @
c79f45bf
文件已移动
paddle/fluid/lite/executor.h
→
paddle/fluid/lite/
core/
executor.h
浏览文件 @
c79f45bf
文件已移动
paddle/fluid/lite/
op_
kernel.h
→
paddle/fluid/lite/
core/
kernel.h
浏览文件 @
c79f45bf
...
...
@@ -19,8 +19,8 @@
#include <map>
#include <string>
#include "paddle/fluid/framework/op_desc.h"
#include "
paddle/fluid/lite/
context.h"
#include "
paddle/fluid/lite/
target_wrapper.h"
#include "context.h"
#include "target_wrapper.h"
#include "paddle/fluid/lite/utils/all.h"
namespace
paddle
{
...
...
paddle/fluid/lite/memory.cc
→
paddle/fluid/lite/
core/
memory.cc
浏览文件 @
c79f45bf
...
...
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "
paddle/fluid/lite/
memory.h"
#include "memory.h"
namespace
paddle
{
namespace
framework
{
...
...
paddle/fluid/lite/memory.h
→
paddle/fluid/lite/
core/
memory.h
浏览文件 @
c79f45bf
文件已移动
paddle/fluid/lite/op_lite.cc
→
paddle/fluid/lite/
core/
op_lite.cc
浏览文件 @
c79f45bf
文件已移动
paddle/fluid/lite/op_lite.h
→
paddle/fluid/lite/
core/
op_lite.h
浏览文件 @
c79f45bf
...
...
@@ -19,7 +19,7 @@
#include <map>
#include <string>
#include "context.h"
#include "
op_
kernel.h"
#include "kernel.h"
#include "paddle/fluid/framework/lod_tensor.h"
#include "paddle/fluid/framework/op_desc.h"
#include "paddle/fluid/framework/variable.h"
...
...
@@ -40,11 +40,13 @@ struct Registry {
* to eliminate overhead of some operations in current framework.
*
* The Operator are designed as follows:
* - it can has some members to hold the argument addresses,
* - it should act just like a function call, no more logic should included.
* - it can has some members to hold the argument and some other computation
* resources,
* - it should act like a function call, no more logic included.
*/
class
OpLite
:
public
Registry
{
public:
// The strategies to pick a kernel from candidates.
enum
class
KernelStrategy
{
// Return the user specified one.
kStatic
=
0
,
...
...
@@ -57,17 +59,24 @@ class OpLite : public Registry {
OpLite
()
{}
OpLite
(
std
::
unique_ptr
<
OpContext
>
&&
x
)
:
op_context_
(
std
::
move
(
x
))
{}
// Check the shape.
virtual
bool
CheckShape
()
const
{
return
true
;
}
// Inference the outputs' shape.
virtual
bool
InferShape
()
const
{
return
true
;
}
// Run this operator.
virtual
bool
Run
()
=
0
;
// Build the operator, attach it with the runtime environment.
virtual
bool
Build
(
const
framework
::
OpDesc
&
opdesc
,
framework
::
Scope
*
scope
)
=
0
;
// Human-readable information.
virtual
std
::
string
DebugString
()
const
=
0
;
protected:
// Specify the kernel to run by default.
virtual
void
StaticPickKernel
(
const
std
::
vector
<
TargetType
>
&
valid_targets
)
=
0
;
void
Pick
Best
Kernel
(
const
std
::
vector
<
TargetType
>
&
valid_places
,
void
PickKernel
(
const
std
::
vector
<
TargetType
>
&
valid_places
,
KernelStrategy
kernel_strategy
=
KernelStrategy
::
kStatic
);
// Create all the kernels for the valid targets.
...
...
paddle/fluid/lite/op_registry.cc
→
paddle/fluid/lite/
core/
op_registry.cc
浏览文件 @
c79f45bf
文件已移动
paddle/fluid/lite/op_registry.h
→
paddle/fluid/lite/
core/
op_registry.h
浏览文件 @
c79f45bf
...
...
@@ -15,9 +15,9 @@
#include <memory>
#include <string>
#include <unordered_map>
#include "
paddle/fluid/lite/op_
kernel.h"
#include "
paddle/fluid/lite/
op_lite.h"
#include "
paddle/fluid/lite/
target_wrapper.h"
#include "kernel.h"
#include "op_lite.h"
#include "target_wrapper.h"
#include "paddle/fluid/lite/utils/all.h"
namespace
paddle
{
...
...
paddle/fluid/lite/scope.cc
→
paddle/fluid/lite/
core/
scope.cc
浏览文件 @
c79f45bf
...
...
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "
paddle/fluid/lite/
scope.h"
#include "scope.h"
#include "scope.h"
namespace
paddle
{
...
...
paddle/fluid/lite/scope.h
→
paddle/fluid/lite/
core/
scope.h
浏览文件 @
c79f45bf
...
...
@@ -19,7 +19,7 @@
#include <unordered_map>
#include <utility>
#include <vector>
#include "
paddle/fluid/lite/
variable.h"
#include "variable.h"
namespace
paddle
{
namespace
lite
{
...
...
paddle/fluid/lite/scope_test.cc
→
paddle/fluid/lite/
core/
scope_test.cc
浏览文件 @
c79f45bf
...
...
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "
paddle/fluid/lite/
scope.h"
#include "scope.h"
#include <gtest/gtest.h>
namespace
paddle
{
...
...
paddle/fluid/lite/target_wrapper.h
→
paddle/fluid/lite/
core/
target_wrapper.h
浏览文件 @
c79f45bf
...
...
@@ -19,6 +19,7 @@ namespace paddle {
namespace
lite
{
enum
class
TargetType
{
kHost
=
0
,
kX86
,
kCUDA
,
kARM
,
kLastAsPlaceHolder
};
// Some helper macro to get a specific TargetType.
#define TARGET(item__) paddle::lite::TargetType::item__
#define TARGET_VAL(item__) static_cast<int>(TARGET(item__))
...
...
@@ -36,20 +37,22 @@ using ARM = Target<TargetType::kARM>;
enum
class
PrecisionType
{
kFloat
=
0
,
kInt8
,
kLastAsPlaceHolder
};
// Some helper macro to get a specific PrecisionType.
#define PRECISION(item__) paddle::lite::PrecisionType::item__
#define PRECISION_VAL(item__) static_cast<int>(PRECISION(item__))
constexpr
int
kNumPrecisions
=
PRECISION_VAL
(
kLastAsPlaceHolder
)
-
PRECISION_VAL
(
kFloat
);
// Event sync for multi-stream devices like CUDA and OpenCL.
// For the devices without support of stream, leave it empty.
template
<
TargetType
Target
>
class
Event
{};
// Memory copy directions.
enum
class
IoDirection
{
HtoH
=
0
,
HtoD
,
DtoH
,
HtoH
=
0
,
// Host to host
HtoD
,
// Host to device
DtoH
,
// Device to host
};
// This interface should be specified by each kind of target.
...
...
paddle/fluid/lite/tensor.cc
→
paddle/fluid/lite/
core/
tensor.cc
浏览文件 @
c79f45bf
文件已移动
paddle/fluid/lite/tensor.h
→
paddle/fluid/lite/
core/
tensor.h
浏览文件 @
c79f45bf
文件已移动
paddle/fluid/lite/variable.cc
→
paddle/fluid/lite/
core/
variable.cc
浏览文件 @
c79f45bf
...
...
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "
paddle/fluid/lite/
variable.h"
#include "variable.h"
namespace
paddle
{
namespace
lite
{}
// namespace lite
...
...
paddle/fluid/lite/variable.h
→
paddle/fluid/lite/
core/
variable.h
浏览文件 @
c79f45bf
...
...
@@ -13,7 +13,7 @@
// limitations under the License.
#pragma once
#include "paddle/fluid/lite/tensor.h"
#include "paddle/fluid/lite/
core/
tensor.h"
#include "paddle/fluid/lite/utils/all.h"
namespace
paddle
{
...
...
paddle/fluid/lite/kernels/host/fc_compute.cc
浏览文件 @
c79f45bf
...
...
@@ -14,7 +14,7 @@
#include "paddle/fluid/lite/kernels/host/fc_compute.h"
#include <Eigen/Core>
#include "paddle/fluid/lite/op_registry.h"
#include "paddle/fluid/lite/
core/
op_registry.h"
namespace
paddle
{
namespace
lite
{
...
...
paddle/fluid/lite/kernels/host/fc_compute.h
浏览文件 @
c79f45bf
...
...
@@ -13,7 +13,7 @@
// limitations under the License.
#pragma once
#include "paddle/fluid/lite/
op_
kernel.h"
#include "paddle/fluid/lite/
core/
kernel.h"
#include "paddle/fluid/lite/operators/fc_op.h"
namespace
paddle
{
...
...
paddle/fluid/lite/kernels/host/relu_compute.cc
浏览文件 @
c79f45bf
...
...
@@ -12,4 +12,4 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "paddle/fluid/lite/kernels/relu_compute.h"
#include "paddle/fluid/lite/kernels/
host/
relu_compute.h"
paddle/fluid/lite/kernels/host/relu_compute.h
浏览文件 @
c79f45bf
...
...
@@ -13,7 +13,7 @@
// limitations under the License.
#pragma once
#include "paddle/fluid/lite/
op_
kernel.h"
#include "paddle/fluid/lite/
core/
kernel.h"
namespace
paddle
{
namespace
lite
{
...
...
paddle/fluid/lite/model_parser/model_parser.cc
浏览文件 @
c79f45bf
...
...
@@ -14,9 +14,9 @@
#include "paddle/fluid/lite/model_parser/model_parser.h"
#include <fstream>
#include "paddle/fluid/lite/scope.h"
#include "paddle/fluid/lite/tensor.h"
#include "paddle/fluid/lite/variable.h"
#include "paddle/fluid/lite/
core/
scope.h"
#include "paddle/fluid/lite/
core/
tensor.h"
#include "paddle/fluid/lite/
core/
variable.h"
namespace
paddle
{
namespace
lite
{
...
...
paddle/fluid/lite/operators/fc_op.cc
浏览文件 @
c79f45bf
...
...
@@ -13,7 +13,7 @@
// limitations under the License.
#include "fc_op.h"
#include "paddle/fluid/lite/op_registry.h"
#include "paddle/fluid/lite/
core/
op_registry.h"
namespace
paddle
{
namespace
lite
{
...
...
paddle/fluid/lite/operators/fc_op.h
浏览文件 @
c79f45bf
...
...
@@ -14,8 +14,8 @@
#include <string>
#include <vector>
#include "paddle/fluid/lite/op_lite.h"
#include "paddle/fluid/lite/tensor.h"
#include "paddle/fluid/lite/
core/
op_lite.h"
#include "paddle/fluid/lite/
core/
tensor.h"
#include "paddle/fluid/lite/utils/all.h"
namespace
paddle
{
...
...
paddle/fluid/lite/operators/relu_op.cc
浏览文件 @
c79f45bf
...
...
@@ -13,7 +13,7 @@
// limitations under the License.
#include "paddle/fluid/lite/operators/relu_op.h"
#include "paddle/fluid/lite/op_registry.h"
#include "paddle/fluid/lite/
core/
op_registry.h"
namespace
paddle
{
namespace
lite
{
...
...
paddle/fluid/lite/operators/relu_op.h
浏览文件 @
c79f45bf
...
...
@@ -14,8 +14,8 @@
#include <string>
#include <vector>
#include "paddle/fluid/lite/op_lite.h"
#include "paddle/fluid/lite/tensor.h"
#include "paddle/fluid/lite/
core/
op_lite.h"
#include "paddle/fluid/lite/
core/
tensor.h"
#include "paddle/fluid/lite/utils/all.h"
namespace
paddle
{
...
...
paddle/fluid/lite/x86/target_wrapper.h
浏览文件 @
c79f45bf
...
...
@@ -13,7 +13,7 @@
// limitations under the License.
#pragma once
#include "paddle/fluid/lite/target_wrapper.h"
#include "paddle/fluid/lite/
core/
target_wrapper.h"
namespace
paddle
{
namespace
framework
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录