未验证 提交 8a184b6b 编写于 作者: S Stas Bekman 提交者: GitHub

[build] fix computer capability arch flags, add PTX, handle PTX (#591)

* fix arch flags, add PTX

* bug fix
Co-authored-by: NJeff Rasley <jerasley@microsoft.com>
上级 0518252d
......@@ -221,7 +221,7 @@ class CUDAOpBuilder(OpBuilder):
1. `TORCH_CUDA_ARCH_LIST` takes priority over `cross_compile_archs`.
2. If neither is set default compute capabilities will be used
3. Under `jit_mode` compute capabilities of all visible cards will be used.
3. Under `jit_mode` compute capabilities of all visible cards will be used plus PTX
Format:
......@@ -243,6 +243,7 @@ class CUDAOpBuilder(OpBuilder):
if cc not in ccs:
ccs.append(cc)
ccs = sorted(ccs)
ccs[-1] += '+PTX'
else:
# Cross-compile mode, compile for various architectures
# env override takes priority
......@@ -260,8 +261,10 @@ class CUDAOpBuilder(OpBuilder):
args = []
for cc in ccs:
cc = cc.replace('.', '')
args.append(f'-gencode=arch=compute_{cc},code=compute_{cc}')
num = cc[0] + cc[2]
args.append(f'-gencode=arch=compute_{num},code=sm_{num}')
if cc.endswith('+PTX'):
args.append(f'-gencode=arch=compute_{num},code=compute_{num}')
return args
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册