Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
b2df4c76
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
b2df4c76
编写于
6月 21, 2022
作者:
S
Sing_chan
提交者:
GitHub
6月 21, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove .clang-format in paddle/fluid to use the same config (#43678)
上级
f586110d
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
30 addition
and
34 deletion
+30
-34
.clang-format
.clang-format
+2
-0
paddle/fluid/.clang-format
paddle/fluid/.clang-format
+0
-5
paddle/fluid/framework/paddle2cinn/cinn_graph_symbolization.cc
...e/fluid/framework/paddle2cinn/cinn_graph_symbolization.cc
+26
-17
paddle/fluid/framework/paddle2cinn/cinn_graph_symbolization.h
...le/fluid/framework/paddle2cinn/cinn_graph_symbolization.h
+2
-3
paddle/fluid/framework/paddle2cinn/transform_desc.h
paddle/fluid/framework/paddle2cinn/transform_desc.h
+0
-3
paddle/infrt/dialect/infrt/ir/infrt_dialect.cc
paddle/infrt/dialect/infrt/ir/infrt_dialect.cc
+0
-2
paddle/infrt/tests/models/test_abs.cc
paddle/infrt/tests/models/test_abs.cc
+0
-2
paddle/phi/kernels/gpu/gelu_grad_kernel.cu
paddle/phi/kernels/gpu/gelu_grad_kernel.cu
+0
-2
未找到文件。
.clang-format
浏览文件 @
b2df4c76
...
...
@@ -24,4 +24,6 @@ Standard: Cpp11
AllowAllParametersOfDeclarationOnNextLine: true
BinPackParameters: false
BinPackArguments: false
IncludeBlocks: Preserve
IncludeIsMainSourceRegex: (\.cu)$
...
paddle/fluid/.clang-format
已删除
100644 → 0
浏览文件 @
f586110d
---
Language: Cpp
BasedOnStyle: Google
Standard: Cpp11
...
paddle/fluid/framework/paddle2cinn/cinn_graph_symbolization.cc
浏览文件 @
b2df4c76
...
...
@@ -12,7 +12,6 @@ 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. */
// clang-format off
#include "paddle/fluid/framework/paddle2cinn/cinn_graph_symbolization.h"
#include <algorithm>
...
...
@@ -31,7 +30,6 @@ limitations under the License. */
#include "paddle/fluid/framework/convert_utils.h"
#include "paddle/fluid/platform/enforce.h"
#include "paddle/fluid/platform/errors.h"
// clang-format on
namespace
paddle
{
namespace
framework
{
...
...
@@ -79,7 +77,8 @@ FeedInfoMap CinnGraphSymbolization::GetFeedInfoMapFromInput() const {
for
(
auto
&
feed_pair
:
input_tensors_
)
{
const
auto
&
feed_name
=
feed_pair
.
first
;
const
auto
*
tensor
=
feed_pair
.
second
;
PADDLE_ENFORCE_NE
(
tensor
,
nullptr
,
PADDLE_ENFORCE_NE
(
tensor
,
nullptr
,
platform
::
errors
::
PreconditionNotMet
(
"The input variable %s's tensor cannot be NULL,"
"we need the variable's dtype and shape from tensor."
,
...
...
@@ -96,7 +95,8 @@ FeedInfoMap CinnGraphSymbolization::GetFeedInfoMapFromInput() const {
}
PADDLE_ENFORCE_NE
(
feed_map
[
feed_name
].
shape
.
size
(),
0UL
,
feed_map
[
feed_name
].
shape
.
size
(),
0UL
,
platform
::
errors
::
PreconditionNotMet
(
"The input variable %s's tensor shape cannot be empty,"
"we need the variable's dtype and shape from tensor."
,
...
...
@@ -136,7 +136,8 @@ CinnGraphSymbolization::CreateCinnScope(const FeedInfoMap& feed_map) {
for
(
const
auto
&
param_name
:
parameter_names
)
{
PADDLE_ENFORCE_GT
(
feed_map
.
count
(
param_name
),
0UL
,
feed_map
.
count
(
param_name
),
0UL
,
platform
::
errors
::
NotFound
(
"Cannot find parameter %s from input list,"
"please add the tensor into input."
,
param_name
.
c_str
()));
...
...
@@ -162,12 +163,12 @@ CinnGraphSymbolization::CreateCinnScope(const FeedInfoMap& feed_map) {
std
::
vector
<
Node
*>
CinnGraphSymbolization
::
TopologicalSort
()
const
{
std
::
unordered_set
<
Node
*>
op_nodes
;
std
::
for_each
(
graph_
.
Nodes
().
begin
(),
graph_
.
Nodes
().
end
(),
[
&
op_nodes
](
Node
*
n
)
{
if
(
n
->
IsOp
())
{
op_nodes
.
emplace
(
n
);
}
});
std
::
for_each
(
graph_
.
Nodes
().
begin
(),
graph_
.
Nodes
().
end
(),
[
&
op_nodes
](
Node
*
n
)
{
if
(
n
->
IsOp
())
{
op_nodes
.
emplace
(
n
);
}
});
std
::
unordered_map
<
Node
*
,
std
::
unordered_map
<
Node
*
,
size_t
>>
adj_list
;
std
::
unordered_map
<
Node
*
,
size_t
>
in_degrees
;
...
...
@@ -210,7 +211,8 @@ std::vector<Node*> CinnGraphSymbolization::TopologicalSort() const {
}
}
PADDLE_ENFORCE_EQ
(
sorted_ops
.
size
(),
op_nodes
.
size
(),
PADDLE_ENFORCE_EQ
(
sorted_ops
.
size
(),
op_nodes
.
size
(),
platform
::
errors
::
PreconditionNotMet
(
"The sorting graph contains cycles."
));
return
sorted_ops
;
...
...
@@ -234,7 +236,8 @@ void CinnGraphSymbolization::RunOp(const CinnOpDesc& op_desc,
const
OpMapperContext
&
ctx
)
const
{
const
auto
&
op_type
=
op_desc
.
Type
();
auto
*
kernel
=
::
cinn
::
frontend
::
OpMapperRegistry
::
Global
()
->
Find
(
op_type
);
PADDLE_ENFORCE_NE
(
kernel
,
nullptr
,
PADDLE_ENFORCE_NE
(
kernel
,
nullptr
,
platform
::
errors
::
NotFound
(
"Op %s is Not Supported by CINN, please register"
" this op in the CINN repo."
,
...
...
@@ -256,10 +259,12 @@ std::unordered_set<std::string> CinnGraphSymbolization::GetFetchIds() const {
std
::
unordered_set
<
std
::
string
>
fetch_names
;
fetch_names
.
reserve
(
fetch_var_names_
.
size
());
std
::
for_each
(
fetch_var_names_
.
begin
(),
fetch_var_names_
.
end
(),
fetch_var_names_
.
begin
(),
fetch_var_names_
.
end
(),
[
this
,
&
fetch_names
](
const
std
::
string
&
name
)
{
PADDLE_ENFORCE_EQ
(
var_model_to_program_map_
.
count
(
name
),
1
,
var_model_to_program_map_
.
count
(
name
),
1
,
platform
::
errors
::
PreconditionNotMet
(
"Cannot find %s in var_model_to_program_map_"
,
name
.
c_str
()));
fetch_names
.
insert
(
var_model_to_program_map_
.
at
(
name
));
...
...
@@ -276,8 +281,12 @@ std::unordered_set<std::string> CinnGraphSymbolization::GetFetchIds() const {
auto
feed_map
=
GetFeedInfoMapFromInput
();
auto
cinn_scope
=
CreateCinnScope
(
feed_map
);
OpMapperContext
ctx
(
*
cinn_scope
,
target_
,
&
builder
,
&
var_map_
,
&
var_model_to_program_map_
,
&
fetch_var_names_
);
OpMapperContext
ctx
(
*
cinn_scope
,
target_
,
&
builder
,
&
var_map_
,
&
var_model_to_program_map_
,
&
fetch_var_names_
);
// add all tensor's feed info into context
for
(
auto
&
feed_pair
:
feed_map
)
{
ctx
.
AddFeedInfo
(
feed_pair
.
first
,
feed_pair
.
second
);
...
...
paddle/fluid/framework/paddle2cinn/cinn_graph_symbolization.h
浏览文件 @
b2df4c76
...
...
@@ -14,7 +14,6 @@ limitations under the License. */
#pragma once
// clang-format off
#include <map>
#include <string>
#include <unordered_map>
...
...
@@ -27,7 +26,6 @@ limitations under the License. */
#include "cinn/frontend/net_builder.h"
#include "cinn/frontend/op_mapper_registry.h"
// clang-format on
namespace
paddle
{
namespace
framework
{
...
...
@@ -65,7 +63,8 @@ namespace paddle2cinn {
class
CinnGraphSymbolization
{
public:
CinnGraphSymbolization
(
int64_t
graph_id
,
const
ir
::
Graph
&
graph
,
int64_t
graph_id
,
const
ir
::
Graph
&
graph
,
const
::
cinn
::
common
::
Target
&
target
,
const
std
::
map
<
std
::
string
,
const
LoDTensor
*>&
input_tensors
)
:
graph_id_
(
graph_id
),
...
...
paddle/fluid/framework/paddle2cinn/transform_desc.h
浏览文件 @
b2df4c76
...
...
@@ -14,8 +14,6 @@
#pragma once
// The headers cant be sorted by clang-format or compilint error occurs.
// clang-format off
#include "paddle/fluid/framework/block_desc.h"
#include "paddle/fluid/framework/op_desc.h"
#include "paddle/fluid/framework/program_desc.h"
...
...
@@ -26,7 +24,6 @@
#include "cinn/frontend/paddle/cpp/op_desc.h"
#include "cinn/frontend/paddle/cpp/program_desc.h"
#include "cinn/frontend/paddle/cpp/var_desc.h"
// clang-format on
namespace
paddle
{
namespace
framework
{
...
...
paddle/infrt/dialect/infrt/ir/infrt_dialect.cc
浏览文件 @
b2df4c76
...
...
@@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// clang-format off
#include "paddle/infrt/dialect/infrt/ir/infrt_dialect.h"
#include <llvm/ADT/TypeSwitch.h>
...
...
@@ -61,7 +60,6 @@ void InfrtDialect::initialize() {
#include "paddle/infrt/dialect/infrt/ir/test_kernels.cpp.inc"
>
();
}
// clang-format on
/// Parse a type registered to this dialect.
mlir
::
Type
InfrtDialect
::
parseType
(
::
mlir
::
DialectAsmParser
&
parser
)
const
{
...
...
paddle/infrt/tests/models/test_abs.cc
浏览文件 @
b2df4c76
...
...
@@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// clang-format off
#include <gtest/gtest.h>
#include <llvm/Support/CommandLine.h>
#include <mlir/Pass/PassManager.h>
...
...
@@ -50,7 +49,6 @@
#include "paddle/infrt/dialect/phi/ir/infrt_phi_tensor.h"
#include "paddle/infrt/dialect/phi/ir/phi_base.h"
#include "paddle/infrt/dialect/phi/ir/phi_kernels.h"
// clang-format on
static
llvm
::
cl
::
list
<
std
::
string
>
cl_shared_libs
(
// NOLINT
"shared_libs"
,
...
...
paddle/phi/kernels/gpu/gelu_grad_kernel.cu
浏览文件 @
b2df4c76
...
...
@@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// clang-format off
#include "paddle/phi/kernels/gelu_kernel.h"
#include "paddle/phi/backends/gpu/gpu_context.h"
...
...
@@ -21,7 +20,6 @@
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/kernels/funcs/broadcast_function.h"
#include "paddle/phi/kernels/gpu/gelu_funcs.h"
// clang-format on
DECLARE_bool
(
use_fast_math
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录