Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
f5476dad
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2292
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
f5476dad
编写于
5月 06, 2023
作者:
U
umiswing
提交者:
GitHub
5月 06, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use copy_if_different to avoid recompilation of generated cutlass (#53531)
kernels.
上级
d91d758d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
47 addition
and
33 deletion
+47
-33
cmake/external/cutlass.cmake
cmake/external/cutlass.cmake
+20
-7
paddle/phi/kernels/sparse/gpu/cutlass_generator/gather_gemm_scatter_manifest.py
...rse/gpu/cutlass_generator/gather_gemm_scatter_manifest.py
+24
-9
paddle/phi/kernels/sparse/gpu/cutlass_generator/gather_gemm_scatter_operation.py
...se/gpu/cutlass_generator/gather_gemm_scatter_operation.py
+2
-16
paddle/phi/kernels/sparse/gpu/gather_gemm_scatter.h
paddle/phi/kernels/sparse/gpu/gather_gemm_scatter.h
+1
-1
未找到文件。
cmake/external/cutlass.cmake
浏览文件 @
f5476dad
...
...
@@ -42,20 +42,33 @@ ExternalProject_Add(
INSTALL_COMMAND
""
TEST_COMMAND
""
)
set
(
gemm_operations_file
${
CMAKE_SOURCE_DIR
}
/paddle/phi/kernels/sparse/gpu/cutlass_generator/generated/gemm/all_gemm_operations.h
)
set
(
configurations_file
${
CMAKE_SOURCE_DIR
}
/paddle/phi/kernels/sparse/gpu/cutlass_generator/generated/gemm/configurations.h
)
set
(
tmp_gemm_operations_file
${
gemm_operations_file
}
.tmp
)
set
(
tmp_configurations_file
${
configurations_file
}
.tmp
)
add_custom_target
(
cutlass_codegen
COMMAND
rm -rf
${
CMAKE_SOURCE_DIR
}
/paddle/phi/kernels/sparse/gpu/cutlass_generator/build
COMMAND
mkdir -p
${
CMAKE_SOURCE_DIR
}
/paddle/phi/kernels/sparse/gpu/cutlass_generator/build/generated/gemm
COMMAND
${
PYTHON_EXECUTABLE
}
-B
${
CMAKE_SOURCE_DIR
}
/paddle/phi/kernels/sparse/gpu/cutlass_generator/gather_gemm_scatter_generator.py
"
${
THIRD_PARTY_PATH
}
/cutlass/src/extern_cutlass/tools/library/scripts/"
"
${
CMAKE_SOURCE_DIR
}
/paddle/phi/kernels/sparse/gpu/cutlass_generator
/build
"
"
${
CMAKE_SOURCE_DIR
}
/paddle/phi/kernels/sparse/gpu/cutlass_generator"
"
${
CMAKE_CUDA_COMPILER_VERSION
}
"
COMMAND
${
CMAKE_COMMAND
}
-E copy_if_different
${
tmp_gemm_operations_file
}
${
gemm_operations_file
}
COMMAND
${
CMAKE_COMMAND
}
-E echo
"copy_if_different
${
tmp_gemm_operations_file
}
to
${
gemm_operations_file
}
"
COMMAND
${
CMAKE_COMMAND
}
-E copy_if_different
${
tmp_configurations_file
}
${
configurations_file
}
COMMAND
${
CMAKE_COMMAND
}
-E echo
"copy_if_different
${
tmp_configurations_file
}
to
${
configurations_file
}
"
VERBATIM
)
add_library
(
cutlass INTERFACE
)
...
...
paddle/phi/kernels/sparse/gpu/cutlass_generator/gather_gemm_scatter_manifest.py
浏览文件 @
f5476dad
...
...
@@ -29,6 +29,13 @@ class GatherGemmScatterEmitOperationKindLibrary(EmitOperationKindLibrary):
OperationKind
.
Gemm
:
EmitGatherGemmScatterConfigurationLibrary
}
self
.
header_template
=
"#pragma once
\n
#ifdef PADDLE_WITH_CUTLASS
\n
#include
\"
paddle/phi/kernels/sparse/gpu/cutlass_generator/common.h
\"\n
"
self
.
configuration_header_template
=
"""
/*
Generated by gemm_operation.py - Do not edit.
*/
#pragma once
#ifdef PADDLE_WITH_CUTLASS
"""
self
.
entry_template
=
""
self
.
configuration_prototype_template
=
""
self
.
configuration_template
=
""
...
...
@@ -58,11 +65,23 @@ namespace sparse {
self
.
top_level_path
=
os
.
path
.
join
(
self
.
operation_path
,
"all_%s_operations.h"
%
OperationKindNames
[
self
.
kind
],
"all_%s_operations.h
.tmp
"
%
OperationKindNames
[
self
.
kind
],
)
self
.
configuration_path
=
os
.
path
.
join
(
self
.
operation_path
,
"configurations.h.tmp"
).
replace
(
'
\\
'
,
'/'
)
self
.
top_level_file
=
open
(
self
.
top_level_path
,
"w"
)
self
.
top_level_file
.
write
(
self
.
header_template
)
self
.
top_level_file
.
write
(
'#include "'
+
self
.
operation_path
+
'/'
+
'configurations.h"
\n
'
)
self
.
configuration_file
=
open
(
self
.
configuration_path
,
"w"
)
self
.
configuration_file
.
write
(
self
.
configuration_header_template
)
self
.
configuration_file
.
write
(
self
.
namespace_template
)
self
.
configuration_file
.
close
()
self
.
source_files
=
[
self
.
top_level_path
,
...
...
@@ -105,14 +124,6 @@ launchKernel<"""
+
"<>>,"
)
self
.
top_level_file
.
write
(
'#include "'
+
self
.
operation_path
+
'/'
+
configuration_name
+
'.h"
\n
'
)
def
__exit__
(
self
,
exception_type
,
exception_value
,
traceback
):
self
.
top_level_file
.
write
(
SubstituteTemplate
(
...
...
@@ -137,6 +148,10 @@ launchKernel<"""
self
.
top_level_file
.
write
(
self
.
epilogue_template
)
self
.
top_level_file
.
close
()
self
.
configuration_file
=
open
(
self
.
configuration_path
,
"a"
)
self
.
configuration_file
.
write
(
self
.
epilogue_template
)
self
.
configuration_file
.
close
()
class
GatherGemmScatterManifest
(
Manifest
):
def
emit
(
self
,
target
=
GeneratorTarget
.
Library
):
...
...
paddle/phi/kernels/sparse/gpu/cutlass_generator/gather_gemm_scatter_operation.py
浏览文件 @
f5476dad
...
...
@@ -207,7 +207,7 @@ class EmitGatherGemmScatterConfigurationLibrary(EmitGemmConfigurationLibrary):
def
__init__
(
self
,
operation_path
,
configuration_name
):
self
.
configuration_name
=
configuration_name
self
.
configuration_path
=
os
.
path
.
join
(
operation_path
,
"
%s.h"
%
configuration_name
operation_path
,
"
configurations.h.tmp"
).
replace
(
'
\\
'
,
'/'
)
self
.
instance_emitter
=
{
...
...
@@ -246,9 +246,7 @@ namespace sparse {
"""
def
__enter__
(
self
):
self
.
configuration_file
=
open
(
self
.
configuration_path
,
"w"
)
self
.
configuration_file
.
write
(
self
.
header_template
)
self
.
configuration_file
.
write
(
self
.
separator
)
self
.
configuration_file
=
open
(
self
.
configuration_path
,
"a"
)
self
.
includes
=
collections
.
OrderedDict
([])
self
.
instance_definitions
=
[]
...
...
@@ -259,22 +257,10 @@ namespace sparse {
def
__exit__
(
self
,
exception_type
,
exception_value
,
traceback
):
# Write includes
for
incl
,
_
in
self
.
includes
.
items
():
include_statement
=
"#include
\"
%s
\"\n
"
%
incl
self
.
configuration_file
.
write
(
include_statement
)
self
.
configuration_file
.
write
(
self
.
separator
)
self
.
configuration_file
.
write
(
self
.
namespace_template
)
# Write instance definitions in top-level namespace
for
instance_definition
in
self
.
instance_definitions
:
self
.
configuration_file
.
write
(
instance_definition
)
for
instance_wrapper
in
self
.
instance_wrappers
:
self
.
configuration_file
.
write
(
instance_wrapper
)
self
.
configuration_file
.
write
(
self
.
epilogue_template
)
self
.
configuration_file
.
close
()
...
...
paddle/phi/kernels/sparse/gpu/gather_gemm_scatter.h
浏览文件 @
f5476dad
...
...
@@ -18,7 +18,7 @@
#include "paddle/phi/backends/gpu/gpu_context.h"
#include "paddle/phi/common/data_type.h"
#include "paddle/phi/kernels/autotune/auto_tune_base.h"
#include "paddle/phi/kernels/sparse/gpu/cutlass_generator/
build/
generated/gemm/all_gemm_operations.h"
#include "paddle/phi/kernels/sparse/gpu/cutlass_generator/generated/gemm/all_gemm_operations.h"
namespace
phi
{
namespace
sparse
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录