Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
04b6035d
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 2 年 前同步成功
通知
2325
Star
20933
Fork
5424
代码
文件
提交
分支
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看板
未验证
提交
04b6035d
编写于
8月 15, 2023
作者:
傅
傅剑寒
提交者:
GitHub
8月 15, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify default parallel compile thread (#56282)
上级
47686692
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
9 addition
and
8 deletion
+9
-8
paddle/cinn/hlir/framework/parallel_compiler.cc
paddle/cinn/hlir/framework/parallel_compiler.cc
+6
-6
paddle/cinn/runtime/flags.cc
paddle/cinn/runtime/flags.cc
+3
-2
未找到文件。
paddle/cinn/hlir/framework/parallel_compiler.cc
浏览文件 @
04b6035d
...
@@ -92,9 +92,7 @@ void ParallelCompiler::LaunchTask() {
...
@@ -92,9 +92,7 @@ void ParallelCompiler::LaunchTask() {
RunTask
(
&
tasks_
[
0
]);
RunTask
(
&
tasks_
[
0
]);
// syncthreads.
// syncthreads.
for
(
auto
&
worker
:
threads
)
{
for_each
(
threads
.
begin
(),
threads
.
end
(),
std
::
mem_fn
(
&
std
::
thread
::
join
));
worker
.
join
();
}
}
}
ParallelCompiler
::
CompilationResult
ParallelCompiler
::
MergeResult
()
{
ParallelCompiler
::
CompilationResult
ParallelCompiler
::
MergeResult
()
{
...
@@ -113,7 +111,7 @@ ParallelCompiler::CompilationResult ParallelCompiler::MergeResult() {
...
@@ -113,7 +111,7 @@ ParallelCompiler::CompilationResult ParallelCompiler::MergeResult() {
res
.
instructions
.
emplace_back
(
std
::
move
(
instruction
));
res
.
instructions
.
emplace_back
(
std
::
move
(
instruction
));
}
}
}
}
return
std
::
move
(
res
)
;
return
res
;
}
}
void
ParallelCompiler
::
Task
::
Lowering
()
{
void
ParallelCompiler
::
Task
::
Lowering
()
{
...
@@ -167,7 +165,6 @@ void ParallelCompiler::Task::CodegenAndJit() {
...
@@ -167,7 +165,6 @@ void ParallelCompiler::Task::CodegenAndJit() {
auto
cuda_c
=
codegen
.
Compile
(
dmodule
);
auto
cuda_c
=
codegen
.
Compile
(
dmodule
);
CHECK
(
!
cuda_c
.
empty
())
<<
"Compile CUDA C code failed from device module:
\n
"
CHECK
(
!
cuda_c
.
empty
())
<<
"Compile CUDA C code failed from device module:
\n
"
<<
dmodule
;
<<
dmodule
;
source_codes
.
emplace_back
(
cuda_c
);
cinn
::
backends
::
SourceCodePrint
::
GetInstance
()
->
write
(
cuda_c
);
cinn
::
backends
::
SourceCodePrint
::
GetInstance
()
->
write
(
cuda_c
);
...
@@ -175,13 +172,16 @@ void ParallelCompiler::Task::CodegenAndJit() {
...
@@ -175,13 +172,16 @@ void ParallelCompiler::Task::CodegenAndJit() {
backends
::
nvrtc
::
Compiler
compiler
;
backends
::
nvrtc
::
Compiler
compiler
;
auto
ptx
=
compiler
(
cuda_c
);
auto
ptx
=
compiler
(
cuda_c
);
CHECK
(
!
ptx
.
empty
())
<<
"Compile PTX failed from source code:
\n
"
<<
cuda_c
;
CHECK
(
!
ptx
.
empty
())
<<
"Compile PTX failed from source code:
\n
"
<<
cuda_c
;
source_ptxs
.
emplace_back
(
ptx
);
// load cumodule
// load cumodule
cumodule
.
reset
(
new
CUDAModule
(
ptx
,
cumodule
.
reset
(
new
CUDAModule
(
ptx
,
compiler
.
compile_to_cubin
()
compiler
.
compile_to_cubin
()
?
CUDAModule
::
Kind
::
CUBIN
?
CUDAModule
::
Kind
::
CUBIN
:
CUDAModule
::
Kind
::
PTX
));
:
CUDAModule
::
Kind
::
PTX
));
source_codes
.
emplace_back
(
std
::
move
(
cuda_c
));
source_ptxs
.
emplace_back
(
std
::
move
(
ptx
));
// register kernel
// register kernel
backends
::
RuntimeSymbols
symbols
;
backends
::
RuntimeSymbols
symbols
;
for
(
auto
&
fn
:
dmodule
.
functions
())
{
for
(
auto
&
fn
:
dmodule
.
functions
())
{
...
...
paddle/cinn/runtime/flags.cc
浏览文件 @
04b6035d
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
#include <sys/stat.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/types.h>
#include <unistd.h>
#include <unistd.h>
#include <thread>
#include <unordered_set>
#include <unordered_set>
#include "paddle/cinn/common/target.h"
#include "paddle/cinn/common/target.h"
...
@@ -46,7 +46,8 @@ DEFINE_string(cinn_nvcc_cmd_path,
...
@@ -46,7 +46,8 @@ DEFINE_string(cinn_nvcc_cmd_path,
"Setting nvcc default path!"
);
"Setting nvcc default path!"
);
DEFINE_int32
(
cinn_parallel_compile_thread
,
DEFINE_int32
(
cinn_parallel_compile_thread
,
Int32FromEnv
(
"FLAGS_cinn_parallel_compile_thread"
,
16
),
Int32FromEnv
(
"FLAGS_cinn_parallel_compile_thread"
,
(
std
::
thread
::
hardware_concurrency
()
>>
1
)),
"How much thread the parallel compile used."
);
"How much thread the parallel compile used."
);
DEFINE_bool
(
cinn_use_op_fusion
,
DEFINE_bool
(
cinn_use_op_fusion
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录