Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
e7a38f15
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看板
未验证
提交
e7a38f15
编写于
6月 05, 2023
作者:
U
umiswing
提交者:
GitHub
6月 05, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add macro SPCONV_WITH_CUTLASS (#54274)
上级
0b1086b9
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
16 addition
and
15 deletion
+16
-15
cmake/external/cutlass.cmake
cmake/external/cutlass.cmake
+1
-0
paddle/phi/kernels/sparse/gpu/conv_grad_kernel.cu
paddle/phi/kernels/sparse/gpu/conv_grad_kernel.cu
+7
-7
paddle/phi/kernels/sparse/gpu/conv_kernel.cu
paddle/phi/kernels/sparse/gpu/conv_kernel.cu
+3
-3
paddle/phi/kernels/sparse/gpu/cutlass_generator/common.h
paddle/phi/kernels/sparse/gpu/cutlass_generator/common.h
+1
-1
paddle/phi/kernels/sparse/gpu/cutlass_generator/gather_gemm_scatter_manifest.py
...rse/gpu/cutlass_generator/gather_gemm_scatter_manifest.py
+2
-2
paddle/phi/kernels/sparse/gpu/cutlass_generator/gather_gemm_scatter_operation.py
...se/gpu/cutlass_generator/gather_gemm_scatter_operation.py
+1
-1
paddle/phi/kernels/sparse/gpu/gather_gemm_scatter.h
paddle/phi/kernels/sparse/gpu/gather_gemm_scatter.h
+1
-1
未找到文件。
cmake/external/cutlass.cmake
浏览文件 @
e7a38f15
...
@@ -25,6 +25,7 @@ include_directories(
...
@@ -25,6 +25,7 @@ include_directories(
"
${
THIRD_PARTY_PATH
}
/cutlass/src/extern_cutlass/tools/util/include/"
)
"
${
THIRD_PARTY_PATH
}
/cutlass/src/extern_cutlass/tools/util/include/"
)
add_definitions
(
"-DPADDLE_WITH_CUTLASS"
)
add_definitions
(
"-DPADDLE_WITH_CUTLASS"
)
add_definitions
(
"-DSPCONV_WITH_CUTLASS=0"
)
if
(
NOT PYTHON_EXECUTABLE
)
if
(
NOT PYTHON_EXECUTABLE
)
find_package
(
PythonInterp REQUIRED
)
find_package
(
PythonInterp REQUIRED
)
...
...
paddle/phi/kernels/sparse/gpu/conv_grad_kernel.cu
浏览文件 @
e7a38f15
...
@@ -24,7 +24,7 @@ limitations under the License. */
...
@@ -24,7 +24,7 @@ limitations under the License. */
#include "paddle/phi/kernels/funcs/blas/blas.h"
#include "paddle/phi/kernels/funcs/blas/blas.h"
#include "paddle/phi/kernels/funcs/math_function.h"
#include "paddle/phi/kernels/funcs/math_function.h"
#include "paddle/phi/kernels/sparse/gpu/conv.cu.h"
#include "paddle/phi/kernels/sparse/gpu/conv.cu.h"
#if
def PADDLE
_WITH_CUTLASS
#if
defined(PADDLE_WITH_CUTLASS) && SPCONV
_WITH_CUTLASS
#include "paddle/phi/kernels/sparse/gpu/gather_gemm_scatter.h"
#include "paddle/phi/kernels/sparse/gpu/gather_gemm_scatter.h"
#endif
#endif
...
@@ -134,7 +134,7 @@ void Conv3dCooGradGPUKernel(const GPUContext& dev_ctx,
...
@@ -134,7 +134,7 @@ void Conv3dCooGradGPUKernel(const GPUContext& dev_ctx,
phi
::
backends
::
gpu
::
GpuMemsetAsync
(
phi
::
backends
::
gpu
::
GpuMemsetAsync
(
out_index_ptr
,
0
,
sizeof
(
int
)
*
x
.
nnz
()
*
2
,
dev_ctx
.
stream
());
out_index_ptr
,
0
,
sizeof
(
int
)
*
x
.
nnz
()
*
2
,
dev_ctx
.
stream
());
#if
def PADDLE
_WITH_CUTLASS
#if
defined(PADDLE_WITH_CUTLASS) && SPCONV
_WITH_CUTLASS
bool
cutlass
=
true
;
bool
cutlass
=
true
;
if
(
dev_ctx
.
GetComputeCapability
()
<
80
)
cutlass
=
false
;
if
(
dev_ctx
.
GetComputeCapability
()
<
80
)
cutlass
=
false
;
...
@@ -177,7 +177,7 @@ void Conv3dCooGradGPUKernel(const GPUContext& dev_ctx,
...
@@ -177,7 +177,7 @@ void Conv3dCooGradGPUKernel(const GPUContext& dev_ctx,
out_channels
,
out_channels
,
out_grad_features_ptr
);
out_grad_features_ptr
);
#if
def PADDLE
_WITH_CUTLASS
#if
defined(PADDLE_WITH_CUTLASS) && SPCONV
_WITH_CUTLASS
}
}
#endif
#endif
const
T
*
kernel_ptr
=
kernel
.
data
<
T
>
();
const
T
*
kernel_ptr
=
kernel
.
data
<
T
>
();
...
@@ -195,7 +195,7 @@ void Conv3dCooGradGPUKernel(const GPUContext& dev_ctx,
...
@@ -195,7 +195,7 @@ void Conv3dCooGradGPUKernel(const GPUContext& dev_ctx,
T
*
tmp_d_x_ptr
=
d_x_features_ptr
+
offsets
[
i
]
*
in_channels
;
T
*
tmp_d_x_ptr
=
d_x_features_ptr
+
offsets
[
i
]
*
in_channels
;
T
*
tmp_d_kernel_ptr
=
d_kernel_ptr
+
i
*
in_channels
*
out_channels
;
T
*
tmp_d_kernel_ptr
=
d_kernel_ptr
+
i
*
in_channels
*
out_channels
;
#if
def PADDLE
_WITH_CUTLASS
#if
defined(PADDLE_WITH_CUTLASS) && SPCONV
_WITH_CUTLASS
if
(
cutlass
)
{
if
(
cutlass
)
{
const
IntT
*
gather_x_indices
=
rulebook_ptr
+
offsets
[
i
];
const
IntT
*
gather_x_indices
=
rulebook_ptr
+
offsets
[
i
];
const
IntT
*
scatter_x_indices
=
rulebook_ptr
+
offsets
[
i
];
const
IntT
*
scatter_x_indices
=
rulebook_ptr
+
offsets
[
i
];
...
@@ -266,13 +266,13 @@ void Conv3dCooGradGPUKernel(const GPUContext& dev_ctx,
...
@@ -266,13 +266,13 @@ void Conv3dCooGradGPUKernel(const GPUContext& dev_ctx,
tmp_kernel_ptr
,
tmp_kernel_ptr
,
static_cast
<
T
>
(
0
),
static_cast
<
T
>
(
0
),
tmp_d_x_ptr
);
tmp_d_x_ptr
);
#if
def PADDLE
_WITH_CUTLASS
#if
defined(PADDLE_WITH_CUTLASS) && SPCONV
_WITH_CUTLASS
}
}
#endif
#endif
}
}
// 4. scatter
// 4. scatter
#if
def PADDLE
_WITH_CUTLASS
#if
defined(PADDLE_WITH_CUTLASS) && SPCONV
_WITH_CUTLASS
if
(
!
cutlass
)
{
if
(
!
cutlass
)
{
#endif
#endif
phi
::
funcs
::
sparse
::
ScatterV2
<
T
>
(
dev_ctx
,
phi
::
funcs
::
sparse
::
ScatterV2
<
T
>
(
dev_ctx
,
...
@@ -284,7 +284,7 @@ void Conv3dCooGradGPUKernel(const GPUContext& dev_ctx,
...
@@ -284,7 +284,7 @@ void Conv3dCooGradGPUKernel(const GPUContext& dev_ctx,
in_channels
,
in_channels
,
2
,
2
,
x_grad_values_ptr
);
x_grad_values_ptr
);
#if
def PADDLE
_WITH_CUTLASS
#if
defined(PADDLE_WITH_CUTLASS) && SPCONV
_WITH_CUTLASS
}
}
#endif
#endif
}
}
...
...
paddle/phi/kernels/sparse/gpu/conv_kernel.cu
浏览文件 @
e7a38f15
...
@@ -23,7 +23,7 @@ limitations under the License. */
...
@@ -23,7 +23,7 @@ limitations under the License. */
#include "paddle/phi/kernels/funcs/scatter.cu.h"
#include "paddle/phi/kernels/funcs/scatter.cu.h"
#include "paddle/phi/kernels/funcs/sparse/scatter.cu.h"
#include "paddle/phi/kernels/funcs/sparse/scatter.cu.h"
#include "paddle/phi/kernels/sparse/gpu/conv.cu.h"
#include "paddle/phi/kernels/sparse/gpu/conv.cu.h"
#if
def PADDLE
_WITH_CUTLASS
#if
defined(PADDLE_WITH_CUTLASS) && SPCONV
_WITH_CUTLASS
#include "paddle/phi/kernels/sparse/gpu/gather_gemm_scatter.h"
#include "paddle/phi/kernels/sparse/gpu/gather_gemm_scatter.h"
#endif
#endif
...
@@ -159,7 +159,7 @@ void Conv3dCooGPUKernel(const GPUContext& dev_ctx,
...
@@ -159,7 +159,7 @@ void Conv3dCooGPUKernel(const GPUContext& dev_ctx,
dev_ctx
,
x
,
key
,
tmp_rulebook
,
h_counter
,
out
,
rulebook
,
counter
);
dev_ctx
,
x
,
key
,
tmp_rulebook
,
h_counter
,
out
,
rulebook
,
counter
);
}
}
#if
def PADDLE
_WITH_CUTLASS
#if
defined(PADDLE_WITH_CUTLASS) && SPCONV
_WITH_CUTLASS
bool
mixed_precision
=
dev_ctx
.
GetComputeCapability
()
>=
75
&&
bool
mixed_precision
=
dev_ctx
.
GetComputeCapability
()
>=
75
&&
dev_ctx
.
GetComputeCapability
()
<
80
&&
dev_ctx
.
GetComputeCapability
()
<
80
&&
std
::
is_same
<
T
,
float
>::
value
;
std
::
is_same
<
T
,
float
>::
value
;
...
@@ -273,7 +273,7 @@ void Conv3dCooGPUKernel(const GPUContext& dev_ctx,
...
@@ -273,7 +273,7 @@ void Conv3dCooGPUKernel(const GPUContext& dev_ctx,
out_channels
,
out_channels
,
1
,
1
,
out_values_ptr
);
out_values_ptr
);
#if
def PADDLE
_WITH_CUTLASS
#if
defined(PADDLE_WITH_CUTLASS) && SPCONV
_WITH_CUTLASS
}
}
#endif
#endif
}
}
...
...
paddle/phi/kernels/sparse/gpu/cutlass_generator/common.h
浏览文件 @
e7a38f15
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
#pragma once
#pragma once
#if
def PADDLE
_WITH_CUTLASS
#if
defined(PADDLE_WITH_CUTLASS) && SPCONV
_WITH_CUTLASS
#include "cutlass/arch/mma.h"
#include "cutlass/arch/mma.h"
#include "cutlass/device_kernel.h"
#include "cutlass/device_kernel.h"
#include "cutlass/epilogue/thread/linear_combination.h"
#include "cutlass/epilogue/thread/linear_combination.h"
...
...
paddle/phi/kernels/sparse/gpu/cutlass_generator/gather_gemm_scatter_manifest.py
浏览文件 @
e7a38f15
...
@@ -28,13 +28,13 @@ class GatherGemmScatterEmitOperationKindLibrary(EmitOperationKindLibrary):
...
@@ -28,13 +28,13 @@ class GatherGemmScatterEmitOperationKindLibrary(EmitOperationKindLibrary):
self
.
emitters
=
{
self
.
emitters
=
{
OperationKind
.
Gemm
:
EmitGatherGemmScatterConfigurationLibrary
OperationKind
.
Gemm
:
EmitGatherGemmScatterConfigurationLibrary
}
}
self
.
header_template
=
"#pragma once
\n
#if
def PADDLE
_WITH_CUTLASS
\n
#include
\"
paddle/phi/kernels/sparse/gpu/cutlass_generator/common.h
\"\n
"
self
.
header_template
=
"#pragma once
\n
#if
defined(PADDLE_WITH_CUTLASS) && SPCONV
_WITH_CUTLASS
\n
#include
\"
paddle/phi/kernels/sparse/gpu/cutlass_generator/common.h
\"\n
"
self
.
configuration_header_template
=
"""
self
.
configuration_header_template
=
"""
/*
/*
Generated by gemm_operation.py - Do not edit.
Generated by gemm_operation.py - Do not edit.
*/
*/
#pragma once
#pragma once
#if
def PADDLE
_WITH_CUTLASS
#if
defined(PADDLE_WITH_CUTLASS) && SPCONV
_WITH_CUTLASS
"""
"""
self
.
entry_template
=
""
self
.
entry_template
=
""
self
.
configuration_prototype_template
=
""
self
.
configuration_prototype_template
=
""
...
...
paddle/phi/kernels/sparse/gpu/cutlass_generator/gather_gemm_scatter_operation.py
浏览文件 @
e7a38f15
...
@@ -232,7 +232,7 @@ class EmitGatherGemmScatterConfigurationLibrary(EmitGemmConfigurationLibrary):
...
@@ -232,7 +232,7 @@ class EmitGatherGemmScatterConfigurationLibrary(EmitGemmConfigurationLibrary):
Generated by gemm_operation.py - Do not edit.
Generated by gemm_operation.py - Do not edit.
*/
*/
#pragma once
#pragma once
#if
def PADDLE
_WITH_CUTLASS
#if
defined(PADDLE_WITH_CUTLASS) && SPCONV
_WITH_CUTLASS
"""
"""
self
.
namespace_template
=
"""
self
.
namespace_template
=
"""
...
...
paddle/phi/kernels/sparse/gpu/gather_gemm_scatter.h
浏览文件 @
e7a38f15
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
#pragma once
#pragma once
#include <type_traits>
#include <type_traits>
#if
def PADDLE
_WITH_CUTLASS
#if
defined(PADDLE_WITH_CUTLASS) && SPCONV
_WITH_CUTLASS
#include "paddle/phi/backends/gpu/gpu_context.h"
#include "paddle/phi/backends/gpu/gpu_context.h"
#include "paddle/phi/common/data_type.h"
#include "paddle/phi/common/data_type.h"
#include "paddle/phi/kernels/autotune/auto_tune_base.h"
#include "paddle/phi/kernels/autotune/auto_tune_base.h"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录