Skip to content

Commit

Permalink
Support pre released pytorch2.1.0 (#2865)
Browse files Browse the repository at this point in the history
  • Loading branch information
q.yao authored and zhouzaida committed Dec 26, 2023
1 parent ed4303e commit 62d7092
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
5 changes: 3 additions & 2 deletions mmcv/ops/csrc/common/utils/spconv/tensorview/tensorview.h
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,9 @@ struct ShapeBase : public SimpleVector<int, MaxDim> {
TV_HOST_DEVICE_INLINE ShapeBase(std::initializer_list<int> shape)
: SimpleVector<int, MaxDim>(shape) {}

template <typename scalar_t, template <class...> class Container>
ShapeBase(Container<scalar_t> shape) : SimpleVector<int, MaxDim>(shape) {}
// TODO: find out why this template can no be used on windows
// template <typename scalar_t, template <class...> class Container>
// ShapeBase(Container<scalar_t> shape) : SimpleVector<int, MaxDim>(shape) {}
TV_HOST_DEVICE_INLINE ShapeBase(const ShapeBase<MaxDim> &shape)
: SimpleVector<int, MaxDim>(shape) {}
ShapeBase(const std::vector<int> &arr) : SimpleVector<int, MaxDim>(arr) {}
Expand Down
15 changes: 13 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,15 @@ def get_extensions():
# to compile those cpp files, so there is no need to add the
# argument
if platform.system() != 'Windows':
extra_compile_args['cxx'] = ['-std=c++14']
if parse_version(torch.__version__) <= parse_version('1.12.1'):
extra_compile_args['cxx'] = ['-std=c++14']
else:
extra_compile_args['cxx'] = ['-std=c++17']
else:
if parse_version(torch.__version__) <= parse_version('1.12.1'):
extra_compile_args['cxx'] = ['/std:c++14']
else:
extra_compile_args['cxx'] = ['/std:c++17']

include_dirs = []

Expand Down Expand Up @@ -456,7 +464,10 @@ def get_mluops_version(file_path):
# to compile those cpp files, so there is no need to add the
# argument
if 'nvcc' in extra_compile_args and platform.system() != 'Windows':
extra_compile_args['nvcc'] += ['-std=c++14']
if parse_version(torch.__version__) <= parse_version('1.12.1'):
extra_compile_args['nvcc'] += ['-std=c++14']
else:
extra_compile_args['nvcc'] += ['-std=c++17']

ext_ops = extension(
name=ext_name,
Expand Down

0 comments on commit 62d7092

Please sign in to comment.