Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
2c4ee992
MegEngine
项目概览
MegEngine 天元
/
MegEngine
大约 1 年 前同步成功
通知
399
Star
4705
Fork
582
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
MegEngine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2c4ee992
编写于
8月 04, 2021
作者:
M
Megvii Engine Team
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(dnn): short cutlass filename in windows
GitOrigin-RevId: 83a43fdf87b1fd3480a5d59584bf60e3cd5dd5af
上级
b17b56f3
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
30 addition
and
15 deletion
+30
-15
dnn/scripts/cutlass_generator/BUILD
dnn/scripts/cutlass_generator/BUILD
+6
-6
dnn/scripts/cutlass_generator/conv2d_operation.py
dnn/scripts/cutlass_generator/conv2d_operation.py
+7
-2
dnn/scripts/cutlass_generator/gemm_operation.py
dnn/scripts/cutlass_generator/gemm_operation.py
+9
-3
dnn/scripts/cutlass_generator/generator.py
dnn/scripts/cutlass_generator/generator.py
+5
-4
dnn/scripts/cutlass_generator/library.py
dnn/scripts/cutlass_generator/library.py
+3
-0
未找到文件。
dnn/scripts/cutlass_generator/BUILD
浏览文件 @
2c4ee992
...
@@ -4,12 +4,12 @@ genrule(
...
@@ -4,12 +4,12 @@ genrule(
name
=
"cutlass_kimpls"
,
name
=
"cutlass_kimpls"
,
outs
=
cutlass_gen_list
,
outs
=
cutlass_gen_list
,
cmd
=
"""GEN=$(location //brain/megbrain/dnn/scripts/cutlass_generator:generator.py)
cmd
=
"""GEN=$(location //brain/megbrain/dnn/scripts/cutlass_generator:generator.py)
python3 $$GEN --operations gemm --type simt $(@D)
CUTLASS_WITH_LONG_PATH=true
python3 $$GEN --operations gemm --type simt $(@D)
python3 $$GEN --operations gemv --type simt $(@D)
CUTLASS_WITH_LONG_PATH=true
python3 $$GEN --operations gemv --type simt $(@D)
python3 $$GEN --operations deconv --type simt $(@D)
CUTLASS_WITH_LONG_PATH=true
python3 $$GEN --operations deconv --type simt $(@D)
python3 $$GEN --operations conv2d --type simt $(@D)
CUTLASS_WITH_LONG_PATH=true
python3 $$GEN --operations conv2d --type simt $(@D)
python3 $$GEN --operations conv2d --type tensorop8816 $(@D)
CUTLASS_WITH_LONG_PATH=true
python3 $$GEN --operations conv2d --type tensorop8816 $(@D)
python3 $$GEN --operations conv2d --type tensorop8832 $(@D)
CUTLASS_WITH_LONG_PATH=true
python3 $$GEN --operations conv2d --type tensorop8832 $(@D)
"""
,
"""
,
tools
=
[
"//brain/megbrain/dnn/scripts/cutlass_generator:generator.py"
],
tools
=
[
"//brain/megbrain/dnn/scripts/cutlass_generator:generator.py"
],
visibility
=
[
"//visibility:public"
],
visibility
=
[
"//visibility:public"
],
...
...
dnn/scripts/cutlass_generator/conv2d_operation.py
浏览文件 @
2c4ee992
...
@@ -531,9 +531,10 @@ void initialize_${configuration_name}(Manifest &manifest) {
...
@@ -531,9 +531,10 @@ void initialize_${configuration_name}(Manifest &manifest) {
###################################################################################################
###################################################################################################
class
EmitConvSingleKernelWrapper
():
class
EmitConvSingleKernelWrapper
():
def
__init__
(
self
,
kernel_path
,
operation
):
def
__init__
(
self
,
kernel_path
,
operation
,
short_path
=
False
):
self
.
kernel_path
=
kernel_path
self
.
kernel_path
=
kernel_path
self
.
operation
=
operation
self
.
operation
=
operation
self
.
short_path
=
short_path
if
self
.
operation
.
conv_kind
==
ConvKind
.
Fprop
:
if
self
.
operation
.
conv_kind
==
ConvKind
.
Fprop
:
self
.
instance_emitter
=
EmitConv2dInstance
()
self
.
instance_emitter
=
EmitConv2dInstance
()
...
@@ -582,6 +583,10 @@ void initialize_${operation_name}(Manifest &manifest) {
...
@@ -582,6 +583,10 @@ void initialize_${operation_name}(Manifest &manifest) {
#
#
def
__enter__
(
self
):
def
__enter__
(
self
):
if
self
.
short_path
:
self
.
kernel_path
=
os
.
path
.
join
(
self
.
kernel_path
,
"%s.cu"
%
GlobalCnt
.
cnt
)
GlobalCnt
.
cnt
+=
1
else
:
self
.
kernel_path
=
os
.
path
.
join
(
self
.
kernel_path
,
"%s.cu"
%
self
.
operation
.
procedural_name
())
self
.
kernel_path
=
os
.
path
.
join
(
self
.
kernel_path
,
"%s.cu"
%
self
.
operation
.
procedural_name
())
self
.
kernel_file
=
open
(
self
.
kernel_path
,
"w"
)
self
.
kernel_file
=
open
(
self
.
kernel_path
,
"w"
)
self
.
kernel_file
.
write
(
self
.
header_template
)
self
.
kernel_file
.
write
(
self
.
header_template
)
...
...
dnn/scripts/cutlass_generator/gemm_operation.py
浏览文件 @
2c4ee992
...
@@ -994,7 +994,8 @@ void initialize_${configuration_name}(Manifest &manifest) {
...
@@ -994,7 +994,8 @@ void initialize_${configuration_name}(Manifest &manifest) {
###################################################################################################
###################################################################################################
class
EmitGemmSingleKernelWrapper
:
class
EmitGemmSingleKernelWrapper
:
def
__init__
(
self
,
kernel_path
,
gemm_operation
):
def
__init__
(
self
,
kernel_path
,
gemm_operation
,
short_path
=
False
):
self
.
short_path
=
short_path
self
.
kernel_path
=
kernel_path
self
.
kernel_path
=
kernel_path
self
.
operation
=
gemm_operation
self
.
operation
=
gemm_operation
...
@@ -1070,10 +1071,11 @@ void initialize_${operation_name}(Manifest &manifest) {
...
@@ -1070,10 +1071,11 @@ void initialize_${operation_name}(Manifest &manifest) {
###################################################################################################
###################################################################################################
class
EmitGemvSingleKernelWrapper
:
class
EmitGemvSingleKernelWrapper
:
def
__init__
(
self
,
kernel_path
,
gemm_operation
,
wrapper_path
):
def
__init__
(
self
,
kernel_path
,
gemm_operation
,
wrapper_path
,
short_path
=
False
):
self
.
kernel_path
=
kernel_path
self
.
kernel_path
=
kernel_path
self
.
wrapper_path
=
wrapper_path
self
.
wrapper_path
=
wrapper_path
self
.
operation
=
gemm_operation
self
.
operation
=
gemm_operation
self
.
short_path
=
short_path
self
.
wrapper_template
=
"""
self
.
wrapper_template
=
"""
template void megdnn::cuda::cutlass_wrapper::
template void megdnn::cuda::cutlass_wrapper::
...
@@ -1107,6 +1109,10 @@ ${operation_instance}
...
@@ -1107,6 +1109,10 @@ ${operation_instance}
"""
"""
#
#
def
__enter__
(
self
):
def
__enter__
(
self
):
if
self
.
short_path
:
self
.
kernel_path
=
os
.
path
.
join
(
self
.
kernel_path
,
"%s.cu"
%
GlobalCnt
.
cnt
)
GlobalCnt
.
cnt
+=
1
else
:
self
.
kernel_path
=
os
.
path
.
join
(
self
.
kernel_path
,
"%s.cu"
%
self
.
operation
.
procedural_name
())
self
.
kernel_path
=
os
.
path
.
join
(
self
.
kernel_path
,
"%s.cu"
%
self
.
operation
.
procedural_name
())
self
.
kernel_file
=
open
(
self
.
kernel_path
,
"w"
)
self
.
kernel_file
=
open
(
self
.
kernel_path
,
"w"
)
self
.
kernel_file
.
write
(
SubstituteTemplate
(
self
.
header_template
,
{
self
.
kernel_file
.
write
(
SubstituteTemplate
(
self
.
header_template
,
{
...
...
dnn/scripts/cutlass_generator/generator.py
浏览文件 @
2c4ee992
...
@@ -8,6 +8,7 @@ import enum
...
@@ -8,6 +8,7 @@ import enum
import
os.path
import
os.path
import
shutil
import
shutil
import
argparse
import
argparse
import
platform
from
library
import
*
from
library
import
*
from
manifest
import
*
from
manifest
import
*
...
@@ -634,7 +635,7 @@ if __name__ == "__main__":
...
@@ -634,7 +635,7 @@ if __name__ == "__main__":
default
=
'simt'
,
help
=
"kernel type of CUTLASS kernel generator"
)
default
=
'simt'
,
help
=
"kernel type of CUTLASS kernel generator"
)
gemv_wrapper_path
=
"src/cuda/matrix_mul/cutlass_matrix_mul_wrapper_batched_gemv_strided.cuinl"
gemv_wrapper_path
=
"src/cuda/matrix_mul/cutlass_matrix_mul_wrapper_batched_gemv_strided.cuinl"
short_path
=
(
platform
.
system
()
==
"Windows"
or
platform
.
system
().
find
(
'NT'
)
>=
0
)
and
(
'true'
!=
os
.
getenv
(
"CUTLASS_WITH_LONG_PATH"
,
default
=
'False'
).
lower
())
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
if
args
.
operations
==
"gemm"
:
if
args
.
operations
==
"gemm"
:
...
@@ -648,15 +649,15 @@ if __name__ == "__main__":
...
@@ -648,15 +649,15 @@ if __name__ == "__main__":
if
args
.
operations
==
"conv2d"
or
args
.
operations
==
"deconv"
:
if
args
.
operations
==
"conv2d"
or
args
.
operations
==
"deconv"
:
for
operation
in
operations
:
for
operation
in
operations
:
with
EmitConvSingleKernelWrapper
(
args
.
output
,
operation
)
as
emitter
:
with
EmitConvSingleKernelWrapper
(
args
.
output
,
operation
,
short_path
)
as
emitter
:
emitter
.
emit
()
emitter
.
emit
()
elif
args
.
operations
==
"gemm"
:
elif
args
.
operations
==
"gemm"
:
for
operation
in
operations
:
for
operation
in
operations
:
with
EmitGemmSingleKernelWrapper
(
args
.
output
,
operation
)
as
emitter
:
with
EmitGemmSingleKernelWrapper
(
args
.
output
,
operation
,
short_path
)
as
emitter
:
emitter
.
emit
()
emitter
.
emit
()
elif
args
.
operations
==
"gemv"
:
elif
args
.
operations
==
"gemv"
:
for
operation
in
operations
:
for
operation
in
operations
:
with
EmitGemvSingleKernelWrapper
(
args
.
output
,
operation
,
gemv_wrapper_path
)
as
emitter
:
with
EmitGemvSingleKernelWrapper
(
args
.
output
,
operation
,
gemv_wrapper_path
,
short_path
)
as
emitter
:
emitter
.
emit
()
emitter
.
emit
()
if
args
.
operations
!=
"gemv"
:
if
args
.
operations
!=
"gemv"
:
...
...
dnn/scripts/cutlass_generator/library.py
浏览文件 @
2c4ee992
...
@@ -612,3 +612,6 @@ class TensorDescription:
...
@@ -612,3 +612,6 @@ class TensorDescription:
self
.
complex_transform
=
complex_transform
self
.
complex_transform
=
complex_transform
###################################################################################################
###################################################################################################
class
GlobalCnt
:
cnt
=
0
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录