Unverified Commit 6299bc02 authored by q.yao's avatar q.yao Committed by GitHub
Browse files

Support pre released pytorch2.1.0 (#2865)

parent c8a9ae75
...@@ -319,8 +319,9 @@ struct ShapeBase : public SimpleVector<int, MaxDim> { ...@@ -319,8 +319,9 @@ struct ShapeBase : public SimpleVector<int, MaxDim> {
TV_HOST_DEVICE_INLINE ShapeBase(std::initializer_list<int> shape) TV_HOST_DEVICE_INLINE ShapeBase(std::initializer_list<int> shape)
: SimpleVector<int, MaxDim>(shape) {} : SimpleVector<int, MaxDim>(shape) {}
template <typename scalar_t, template <class...> class Container> // TODO: find out why this template can no be used on windows
ShapeBase(Container<scalar_t> shape) : SimpleVector<int, MaxDim>(shape) {} // 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) TV_HOST_DEVICE_INLINE ShapeBase(const ShapeBase<MaxDim> &shape)
: SimpleVector<int, MaxDim>(shape) {} : SimpleVector<int, MaxDim>(shape) {}
ShapeBase(const std::vector<int> &arr) : SimpleVector<int, MaxDim>(arr) {} ShapeBase(const std::vector<int> &arr) : SimpleVector<int, MaxDim>(arr) {}
......
...@@ -201,13 +201,15 @@ def get_extensions(): ...@@ -201,13 +201,15 @@ def get_extensions():
extra_compile_args = {'cxx': []} extra_compile_args = {'cxx': []}
if platform.system() != 'Windows': if platform.system() != 'Windows':
if parse_version(torch.__version__) <= parse_version('1.12.1'):
extra_compile_args['cxx'] = ['-std=c++14'] extra_compile_args['cxx'] = ['-std=c++14']
else: else:
# TODO: In Windows, C++17 is chosen to compile extensions in extra_compile_args['cxx'] = ['-std=c++17']
# PyTorch2.0 , but a compile error will be reported. else:
# As a temporary solution, force the use of C++14. if parse_version(torch.__version__) <= parse_version('1.12.1'):
if parse_version(torch.__version__) >= parse_version('2.0.0'):
extra_compile_args['cxx'] = ['/std:c++14'] extra_compile_args['cxx'] = ['/std:c++14']
else:
extra_compile_args['cxx'] = ['/std:c++17']
include_dirs = [] include_dirs = []
library_dirs = [] library_dirs = []
...@@ -418,7 +420,10 @@ def get_extensions(): ...@@ -418,7 +420,10 @@ def get_extensions():
# to compile those cpp files, so there is no need to add the # to compile those cpp files, so there is no need to add the
# argument # argument
if 'nvcc' in extra_compile_args and platform.system() != 'Windows': if 'nvcc' in extra_compile_args and platform.system() != 'Windows':
if parse_version(torch.__version__) <= parse_version('1.12.1'):
extra_compile_args['nvcc'] += ['-std=c++14'] extra_compile_args['nvcc'] += ['-std=c++14']
else:
extra_compile_args['nvcc'] += ['-std=c++17']
ext_ops = extension( ext_ops = extension(
name=ext_name, name=ext_name,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment