Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
fa738761
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
331
Star
4
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
271
列表
看板
标记
里程碑
合并请求
78
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle-Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
271
Issue
271
列表
看板
标记
里程碑
合并请求
78
合并请求
78
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
fa738761
编写于
9月 14, 2018
作者:
D
dolphin8
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
load success
上级
63df324f
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
59 addition
and
47 deletion
+59
-47
metal/paddle-mobile/paddle-mobile.xcodeproj/project.pbxproj
metal/paddle-mobile/paddle-mobile.xcodeproj/project.pbxproj
+4
-2
metal/paddle-mobile/paddle-mobile/Operators/Kernels/ShapeKernel.swift
...-mobile/paddle-mobile/Operators/Kernels/ShapeKernel.swift
+2
-2
metal/paddle-mobile/paddle-mobile/Operators/Kernels/SplitKernel.swift
...-mobile/paddle-mobile/Operators/Kernels/SplitKernel.swift
+1
-1
metal/paddle-mobile/paddle-mobile/Operators/Kernels/metal/Shape.metal
...-mobile/paddle-mobile/Operators/Kernels/metal/Shape.metal
+21
-0
metal/paddle-mobile/paddle-mobile/Operators/Kernels/metal/Split.inc.metal
...ile/paddle-mobile/Operators/Kernels/metal/Split.inc.metal
+14
-3
metal/paddle-mobile/paddle-mobile/Operators/Kernels/metal/Split.metal
...-mobile/paddle-mobile/Operators/Kernels/metal/Split.metal
+17
-39
未找到文件。
metal/paddle-mobile/paddle-mobile.xcodeproj/project.pbxproj
浏览文件 @
fa738761
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
4AA1EAA02148DEEE00D0F791
/* ReshapeKernel.inc.metal in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
4AA1EA9F2148DEEE00D0F791
/* ReshapeKernel.inc.metal */
;
};
4AA1EAA02148DEEE00D0F791
/* ReshapeKernel.inc.metal in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
4AA1EA9F2148DEEE00D0F791
/* ReshapeKernel.inc.metal */
;
};
4AA1EAA2214912CD00D0F791
/* FlattenKernel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
4AA1EAA1214912CC00D0F791
/* FlattenKernel.swift */
;
};
4AA1EAA2214912CD00D0F791
/* FlattenKernel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
4AA1EAA1214912CC00D0F791
/* FlattenKernel.swift */
;
};
4AA1EAA4214A295C00D0F791
/* Split.inc.metal in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
4AA1EAA3214A295C00D0F791
/* Split.inc.metal */
;
};
4AA1EAA4214A295C00D0F791
/* Split.inc.metal in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
4AA1EAA3214A295C00D0F791
/* Split.inc.metal */
;
};
4AA1EAA6214B5F6800D0F791
/* Shape.metal in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
4AA1EAA5214B5F6800D0F791
/* Shape.metal */
;
};
4AF928772133F1DB005B6C3A
/* BoxCoder.metal in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
4AF928762133F1DB005B6C3A
/* BoxCoder.metal */
;
};
4AF928772133F1DB005B6C3A
/* BoxCoder.metal in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
4AF928762133F1DB005B6C3A
/* BoxCoder.metal */
;
};
4AF9287921341661005B6C3A
/* Softmax.metal in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
4AF9287821341661005B6C3A
/* Softmax.metal */
;
};
4AF9287921341661005B6C3A
/* Softmax.metal in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
4AF9287821341661005B6C3A
/* Softmax.metal */
;
};
4AF928822135673D005B6C3A
/* ConcatKernel.metal in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
4AF928812135673D005B6C3A
/* ConcatKernel.metal */
;
};
4AF928822135673D005B6C3A
/* ConcatKernel.metal in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
4AF928812135673D005B6C3A
/* ConcatKernel.metal */
;
};
...
@@ -132,6 +133,7 @@
...
@@ -132,6 +133,7 @@
4AA1EA9F2148DEEE00D0F791
/* ReshapeKernel.inc.metal */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
sourcecode.metal
;
fileEncoding
=
4
;
path
=
ReshapeKernel.inc.metal
;
sourceTree
=
"<group>"
;
};
4AA1EA9F2148DEEE00D0F791
/* ReshapeKernel.inc.metal */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
sourcecode.metal
;
fileEncoding
=
4
;
path
=
ReshapeKernel.inc.metal
;
sourceTree
=
"<group>"
;
};
4AA1EAA1214912CC00D0F791
/* FlattenKernel.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
FlattenKernel.swift
;
sourceTree
=
"<group>"
;
};
4AA1EAA1214912CC00D0F791
/* FlattenKernel.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
FlattenKernel.swift
;
sourceTree
=
"<group>"
;
};
4AA1EAA3214A295C00D0F791
/* Split.inc.metal */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.metal
;
path
=
Split.inc.metal
;
sourceTree
=
"<group>"
;
};
4AA1EAA3214A295C00D0F791
/* Split.inc.metal */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.metal
;
path
=
Split.inc.metal
;
sourceTree
=
"<group>"
;
};
4AA1EAA5214B5F6800D0F791
/* Shape.metal */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.metal
;
path
=
Shape.metal
;
sourceTree
=
"<group>"
;
};
4AF928762133F1DB005B6C3A
/* BoxCoder.metal */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.metal
;
path
=
BoxCoder.metal
;
sourceTree
=
"<group>"
;
};
4AF928762133F1DB005B6C3A
/* BoxCoder.metal */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.metal
;
path
=
BoxCoder.metal
;
sourceTree
=
"<group>"
;
};
4AF9287821341661005B6C3A
/* Softmax.metal */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.metal
;
path
=
Softmax.metal
;
sourceTree
=
"<group>"
;
};
4AF9287821341661005B6C3A
/* Softmax.metal */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.metal
;
path
=
Softmax.metal
;
sourceTree
=
"<group>"
;
};
4AF928812135673D005B6C3A
/* ConcatKernel.metal */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.metal
;
path
=
ConcatKernel.metal
;
sourceTree
=
"<group>"
;
};
4AF928812135673D005B6C3A
/* ConcatKernel.metal */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.metal
;
path
=
ConcatKernel.metal
;
sourceTree
=
"<group>"
;
};
...
@@ -170,7 +172,6 @@
...
@@ -170,7 +172,6 @@
FC0E2DBD20EE460D009C1FAC
/* BatchNormKernel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
BatchNormKernel.swift
;
sourceTree
=
"<group>"
;
};
FC0E2DBD20EE460D009C1FAC
/* BatchNormKernel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
BatchNormKernel.swift
;
sourceTree
=
"<group>"
;
};
FC0E2DBF20EE461F009C1FAC
/* ElementwiseAddKernel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ElementwiseAddKernel.swift
;
sourceTree
=
"<group>"
;
};
FC0E2DBF20EE461F009C1FAC
/* ElementwiseAddKernel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ElementwiseAddKernel.swift
;
sourceTree
=
"<group>"
;
};
FC1B16B220EC9A4F00678B91
/* Kernels.metal */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.metal
;
path
=
Kernels.metal
;
sourceTree
=
"<group>"
;
};
FC1B16B220EC9A4F00678B91
/* Kernels.metal */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.metal
;
path
=
Kernels.metal
;
sourceTree
=
"<group>"
;
};
FC27990D21341016000B6BAD
/* BoxCoder.metal */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.metal
;
path
=
BoxCoder.metal
;
sourceTree
=
"<group>"
;
};
FC292C5321421B2E00CF622F
/* PaddleMobileGPU.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
PaddleMobileGPU.h
;
sourceTree
=
"<group>"
;
};
FC292C5321421B2E00CF622F
/* PaddleMobileGPU.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
PaddleMobileGPU.h
;
sourceTree
=
"<group>"
;
};
FC292C5521421B4600CF622F
/* PaddleMobileGPU.m */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
PaddleMobileGPU.m
;
sourceTree
=
"<group>"
;
};
FC292C5521421B4600CF622F
/* PaddleMobileGPU.m */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
PaddleMobileGPU.m
;
sourceTree
=
"<group>"
;
};
FC292C7C214255BC00CF622F
/* CPUCompute.mm */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.cpp.objcpp
;
path
=
CPUCompute.mm
;
sourceTree
=
"<group>"
;
};
FC292C7C214255BC00CF622F
/* CPUCompute.mm */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.cpp.objcpp
;
path
=
CPUCompute.mm
;
sourceTree
=
"<group>"
;
};
...
@@ -445,13 +446,13 @@
...
@@ -445,13 +446,13 @@
FCEB6837212F00B100D2448E
/* metal */
=
{
FCEB6837212F00B100D2448E
/* metal */
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
FC27990D21341016000B6BAD
/* BoxCoder.metal */
,
4AF928812135673D005B6C3A
/* ConcatKernel.metal */
,
4AF928812135673D005B6C3A
/* ConcatKernel.metal */
,
4AA1EA9D2148D6F900D0F791
/* ConcatKernel.inc.metal */
,
4AA1EA9D2148D6F900D0F791
/* ConcatKernel.inc.metal */
,
4AF9288321357BE3005B6C3A
/* Elementwise.metal */
,
4AF9288321357BE3005B6C3A
/* Elementwise.metal */
,
FC1B16B220EC9A4F00678B91
/* Kernels.metal */
,
FC1B16B220EC9A4F00678B91
/* Kernels.metal */
,
FC4CB74820F0B954007C0C6D
/* ConvKernel.metal */
,
FC4CB74820F0B954007C0C6D
/* ConvKernel.metal */
,
4AF928762133F1DB005B6C3A
/* BoxCoder.metal */
,
4AF928762133F1DB005B6C3A
/* BoxCoder.metal */
,
4AA1EAA5214B5F6800D0F791
/* Shape.metal */
,
4AA1EA8F214664CD00D0F791
/* Split.metal */
,
4AA1EA8F214664CD00D0F791
/* Split.metal */
,
4AA1EAA3214A295C00D0F791
/* Split.inc.metal */
,
4AA1EAA3214A295C00D0F791
/* Split.inc.metal */
,
4AA1EA892146631C00D0F791
/* BilinearInterp.metal */
,
4AA1EA892146631C00D0F791
/* BilinearInterp.metal */
,
...
@@ -627,6 +628,7 @@
...
@@ -627,6 +628,7 @@
4AA1EAA2214912CD00D0F791
/* FlattenKernel.swift in Sources */
,
4AA1EAA2214912CD00D0F791
/* FlattenKernel.swift in Sources */
,
4AA1EA982146666500D0F791
/* FlattenOp.swift in Sources */
,
4AA1EA982146666500D0F791
/* FlattenOp.swift in Sources */
,
FCBCCC652122FCD700D94F7E
/* TransposeOp.swift in Sources */
,
FCBCCC652122FCD700D94F7E
/* TransposeOp.swift in Sources */
,
4AA1EAA6214B5F6800D0F791
/* Shape.metal in Sources */
,
FCD04E6E20F31B4B0007374F
/* ReshapeOp.swift in Sources */
,
FCD04E6E20F31B4B0007374F
/* ReshapeOp.swift in Sources */
,
FC039B9820E11C9A0081E9F8
/* Errors.swift in Sources */
,
FC039B9820E11C9A0081E9F8
/* Errors.swift in Sources */
,
FC039BBF20E11CC20081E9F8
/* Attribute.swift in Sources */
,
FC039BBF20E11CC20081E9F8
/* Attribute.swift in Sources */
,
...
...
metal/paddle-mobile/paddle-mobile/Operators/Kernels/ShapeKernel.swift
浏览文件 @
fa738761
...
@@ -30,9 +30,9 @@ class ShapeKernel<P: PrecisionType>: Kernel, Computable{
...
@@ -30,9 +30,9 @@ class ShapeKernel<P: PrecisionType>: Kernel, Computable{
required
init
(
device
:
MTLDevice
,
param
:
ShapeParam
<
P
>
)
{
required
init
(
device
:
MTLDevice
,
param
:
ShapeParam
<
P
>
)
{
param
.
output
.
initTexture
(
device
:
device
,
computePrecision
:
computePrecision
)
param
.
output
.
initTexture
(
device
:
device
,
computePrecision
:
computePrecision
)
if
computePrecision
==
.
Float32
{
if
computePrecision
==
.
Float32
{
super
.
init
(
device
:
device
,
inFunctionName
:
"s
plit
"
)
super
.
init
(
device
:
device
,
inFunctionName
:
"s
hape
"
)
}
else
if
computePrecision
==
.
Float16
{
}
else
if
computePrecision
==
.
Float16
{
super
.
init
(
device
:
device
,
inFunctionName
:
"s
plit
_half"
)
super
.
init
(
device
:
device
,
inFunctionName
:
"s
hape
_half"
)
}
else
{
}
else
{
fatalError
()
fatalError
()
}
}
...
...
metal/paddle-mobile/paddle-mobile/Operators/Kernels/SplitKernel.swift
浏览文件 @
fa738761
...
@@ -82,7 +82,7 @@ class SplitKernel<P: PrecisionType>: Kernel, Computable{
...
@@ -82,7 +82,7 @@ class SplitKernel<P: PrecisionType>: Kernel, Computable{
fatalError
(
"split unsupported"
)
fatalError
(
"split unsupported"
)
}
}
if
computePrecision
==
.
Float32
{
if
computePrecision
==
.
Float32
{
super
.
init
(
device
:
device
,
inFunctionName
:
"split_
\(
rank
)
_
\(
num
)
_
\(
v
)
"
)
super
.
init
(
device
:
device
,
inFunctionName
:
"split_
\(
rank
)
_
\(
num
)
_
\(
v
)
_float
"
)
}
else
if
computePrecision
==
.
Float16
{
}
else
if
computePrecision
==
.
Float16
{
super
.
init
(
device
:
device
,
inFunctionName
:
"split_
\(
rank
)
_
\(
num
)
_
\(
v
)
_half"
)
super
.
init
(
device
:
device
,
inFunctionName
:
"split_
\(
rank
)
_
\(
num
)
_
\(
v
)
_half"
)
}
else
{
}
else
{
...
...
metal/paddle-mobile/paddle-mobile/Operators/Kernels/metal/Shape.metal
0 → 100644
浏览文件 @
fa738761
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
Licensed 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
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#include <metal_stdlib>
using namespace metal;
kernel void shape() {
}
kernel void shape_half() {
}
metal/paddle-mobile/paddle-mobile/Operators/Kernels/metal/Split.inc.metal
浏览文件 @
fa738761
...
@@ -10,7 +10,17 @@
...
@@ -10,7 +10,17 @@
#define VECTOR(p, n) CONCAT2(p, n)
#define VECTOR(p, n) CONCAT2(p, n)
#define FUNC_R(f, r) CONCAT2_(f, r)
#define FUNC_R(f, r) CONCAT2_(f, r)
kernel void FUNC(split, R, N, V, P)(texture2d_array<P, access::read> input [[texture(0)]],
#if V == VX
#define VV x
#elif V == VY
#define VV y
#elif V == VZ
#define VV z
#else
#define VV normal
#endif
kernel void FUNC(split, R, N, VV, P)(texture2d_array<P, access::read> input [[texture(0)]],
texture2d_array<P, access::write> out1 [[texture(1)]],
texture2d_array<P, access::write> out1 [[texture(1)]],
texture2d_array<P, access::write> out2 [[texture(2)]],
texture2d_array<P, access::write> out2 [[texture(2)]],
#if N >= 3
#if N >= 3
...
@@ -23,7 +33,7 @@ kernel void FUNC(split, R, N, V, P)(texture2d_array<P, access::read> input [[tex
...
@@ -23,7 +33,7 @@ kernel void FUNC(split, R, N, V, P)(texture2d_array<P, access::read> input [[tex
uint3 gid [[thread_position_in_grid]]) {
uint3 gid [[thread_position_in_grid]]) {
VECTOR(P, 4) r = input.read(gid.xy, gid.z);
VECTOR(P, 4) r = input.read(gid.xy, gid.z);
#if V ==
y
#if V ==
VY
int y = gid.y - sp.offset;
int y = gid.y - sp.offset;
if (y < sp.vdim[0]) {
if (y < sp.vdim[0]) {
out1.write(r, gid.xy, gid.z);
out1.write(r, gid.xy, gid.z);
...
@@ -47,7 +57,7 @@ kernel void FUNC(split, R, N, V, P)(texture2d_array<P, access::read> input [[tex
...
@@ -47,7 +57,7 @@ kernel void FUNC(split, R, N, V, P)(texture2d_array<P, access::read> input [[tex
#endif
#endif
}
}
}
}
#elif V ==
x
#elif V ==
VX
int x = gid.x;
int x = gid.x;
if (x < sp.vdim[0]) {
if (x < sp.vdim[0]) {
out1.write(r, gid.xy, gid.z);
out1.write(r, gid.xy, gid.z);
...
@@ -75,4 +85,5 @@ kernel void FUNC(split, R, N, V, P)(texture2d_array<P, access::read> input [[tex
...
@@ -75,4 +85,5 @@ kernel void FUNC(split, R, N, V, P)(texture2d_array<P, access::read> input [[tex
#endif
#endif
}
}
#undef VV
#endif
#endif
metal/paddle-mobile/paddle-mobile/Operators/Kernels/metal/Split.metal
浏览文件 @
fa738761
...
@@ -25,48 +25,26 @@ struct SplitParam {
...
@@ -25,48 +25,26 @@ struct SplitParam {
int32_t vdim[4];
int32_t vdim[4];
};
};
#define VNORMAL 1
#define VX 2
#define VY 3
#define VZ 4
// only support split_{2, 3, 4}_{2, 3, 4}_y_{float, half}
// only support split_{2, 3, 4}_{2, 3, 4}_y_{float, half}
// only support split_{3, 4}_{2, 3, 4}_x_{float, half}
// only support split_{3, 4}_{2, 3, 4}_x_{float, half}
#define V y
// for R in 2..4
#define R 3
// for N in 2..4
#define N 2
#define P float
#include "Split.inc.metal"
#undef P
#define P half
#include "Split.inc.metal"
#undef P
#undef N
// end for N
#undef R
// end for R
#undef V
#define V x
// for R in 3..4
#define R 3
// for N in 2..4
#define N 2
#define P float
#include "Split.inc.metal"
#undef P
#define P half
#include "Split.inc.metal"
#undef P
#undef N
// end for N
#undef R
//// ssd-ar: (R=3, N=2, V=y)
// end for R
#define V VY
#define R 3
#define N 2
#define P float
#include "Split.inc.metal"
#undef P
#define P half
#include "Split.inc.metal"
#undef P
#undef N
#undef R
#undef V
#undef V
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录