Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] TVM 0.13.0 version does not work with Python 3.8 - Error building tvm #16986

Open
rishabhjainps opened this issue May 10, 2024 · 4 comments
Labels
needs-triage PRs or issues that need to be investigated by maintainers to find the right assignees to address it type: bug

Comments

@rishabhjainps
Copy link

Thanks for participating in the TVM community! We use https://discuss.tvm.ai for any general usage questions and discussions. The issue tracker is used for actionable items such as feature proposals discussion, roadmaps, and bug tracking. You are always welcomed to post on the forum first 😸

Issues that are inactive for a period of time may get closed. We adopt this policy so that we won't lose track of actionable issues that may fall at the bottom of the pile. Feel free to reopen a new one if you feel there is an additional problem that needs attention when an old one gets closed.

Expected behavior

TVM 0.13.0 working with Python 3.8

Actual behavior

Build failed with

In file included from ml_dtypes/_src/dtypes.cc:33:0:
ml_dtypes/_src/custom_float.h: In function ‘bool ml_dtypes::RegisterFloatDtype(PyObject*)’:
ml_dtypes/_src/custom_float.h:942:3: error: there are no arguments to ‘Py_SET_TYPE’ that depend on a template parameter, so a declaration of ‘Py_SET_TYPE’ must be available [-fpermissive]
   Py_SET_TYPE(&descr_proto, &PyArrayDescr_Type);
   ^~~~~~~~~~~
ml_dtypes/_src/custom_float.h:942:3: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
In file included from ml_dtypes/_src/dtypes.cc:34:0:
ml_dtypes/_src/int4_numpy.h: In function ‘bool ml_dtypes::RegisterInt4Dtype(PyObject*)’:
ml_dtypes/_src/int4_numpy.h:842:3: error: there are no arguments to ‘Py_SET_TYPE’ that depend on a template parameter, so a declaration of ‘Py_SET_TYPE’ must be available [-fpermissive]
   Py_SET_TYPE(&descr_proto, &PyArrayDescr_Type);
   ^~~~~~~~~~~
In file included from ml_dtypes/_src/dtypes.cc:33:0:
ml_dtypes/_src/custom_float.h: In instantiation of ‘bool ml_dtypes::RegisterFloatDtype(PyObject*) [with T = Eigen::bfloat16; PyObject = _object]’:
ml_dtypes/_src/dtypes.cc:226:48:   required from here
ml_dtypes/_src/custom_float.h:942:14: error: ‘Py_SET_TYPE’ was not declared in this scope
   Py_SET_TYPE(&descr_proto, &PyArrayDescr_Type);
   ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ml_dtypes/_src/custom_float.h:942:14: note: suggested alternative: ‘__S16_TYPE’
   Py_SET_TYPE(&descr_proto, &PyArrayDescr_Type);
   ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   __S16_TYPE
ml_dtypes/_src/custom_float.h: In instantiation of ‘bool ml_dtypes::RegisterFloatDtype(PyObject*) [with T = ml_dtypes::float8_internal::float8_e4m3b11fnuz; PyObject = _object]’:
ml_dtypes/_src/dtypes.cc:229:58:   required from here
ml_dtypes/_src/custom_float.h:942:14: error: ‘Py_SET_TYPE’ was not declared in this scope
ml_dtypes/_src/custom_float.h:942:14: note: suggested alternative: ‘__S16_TYPE’
   Py_SET_TYPE(&descr_proto, &PyArrayDescr_Type);
   ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   __S16_TYPE
ml_dtypes/_src/custom_float.h: In instantiation of ‘bool ml_dtypes::RegisterFloatDtype(PyObject*) [with T = ml_dtypes::float8_internal::float8_e4m3fn; PyObject = _object]’:
ml_dtypes/_src/dtypes.cc:232:53:   required from here
ml_dtypes/_src/custom_float.h:942:14: error: ‘Py_SET_TYPE’ was not declared in this scope
ml_dtypes/_src/custom_float.h:942:14: note: suggested alternative: ‘__S16_TYPE’
   Py_SET_TYPE(&descr_proto, &PyArrayDescr_Type);
   ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   __S16_TYPE
ml_dtypes/_src/custom_float.h: In instantiation of ‘bool ml_dtypes::RegisterFloatDtype(PyObject*) [with T = ml_dtypes::float8_internal::float8_e4m3fnuz; PyObject = _object]’:
ml_dtypes/_src/dtypes.cc:235:55:   required from here
ml_dtypes/_src/custom_float.h:942:14: error: ‘Py_SET_TYPE’ was not declared in this scope
ml_dtypes/_src/custom_float.h:942:14: note: suggested alternative: ‘__S16_TYPE’
   Py_SET_TYPE(&descr_proto, &PyArrayDescr_Type);
   ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   __S16_TYPE
ml_dtypes/_src/custom_float.h: In instantiation of ‘bool ml_dtypes::RegisterFloatDtype(PyObject*) [with T = ml_dtypes::float8_internal::float8_e5m2; PyObject = _object]’:
ml_dtypes/_src/dtypes.cc:238:51:   required from here
ml_dtypes/_src/custom_float.h:942:14: error: ‘Py_SET_TYPE’ was not declared in this scope
ml_dtypes/_src/custom_float.h:942:14: note: suggested alternative: ‘__S16_TYPE’
   Py_SET_TYPE(&descr_proto, &PyArrayDescr_Type);
   ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   __S16_TYPE
ml_dtypes/_src/custom_float.h: In instantiation of ‘bool ml_dtypes::RegisterFloatDtype(PyObject*) [with T = ml_dtypes::float8_internal::float8_e5m2fnuz; PyObject = _object]’:
ml_dtypes/_src/dtypes.cc:241:55:   required from here
ml_dtypes/_src/custom_float.h:942:14: error: ‘Py_SET_TYPE’ was not declared in this scope
ml_dtypes/_src/custom_float.h:942:14: note: suggested alternative: ‘__S16_TYPE’
   Py_SET_TYPE(&descr_proto, &PyArrayDescr_Type);
   ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   __S16_TYPE
In file included from ml_dtypes/_src/dtypes.cc:34:0:
ml_dtypes/_src/int4_numpy.h: In instantiation of ‘bool ml_dtypes::RegisterInt4Dtype(PyObject*) [with T = ml_dtypes::intN<4, signed char>; PyObject = _object]’:
ml_dtypes/_src/dtypes.cc:245:43:   required from here
ml_dtypes/_src/int4_numpy.h:842:14: error: ‘Py_SET_TYPE’ was not declared in this scope
   Py_SET_TYPE(&descr_proto, &PyArrayDescr_Type);
   ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ml_dtypes/_src/int4_numpy.h:842:14: note: suggested alternative: ‘__S16_TYPE’
   Py_SET_TYPE(&descr_proto, &PyArrayDescr_Type);
   ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   __S16_TYPE
ml_dtypes/_src/int4_numpy.h: In instantiation of ‘bool ml_dtypes::RegisterInt4Dtype(PyObject*) [with T = ml_dtypes::intN<4, unsigned char>; PyObject = _object]’:
ml_dtypes/_src/dtypes.cc:248:44:   required from here
ml_dtypes/_src/int4_numpy.h:842:14: error: ‘Py_SET_TYPE’ was not declared in this scope
ml_dtypes/_src/int4_numpy.h:842:14: note: suggested alternative: ‘__S16_TYPE’
   Py_SET_TYPE(&descr_proto, &PyArrayDescr_Type);
   ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   __S16_TYPE
build/bdist.linux-x86_64/egg/tvm/3rdparty/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_device.py:85: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if mma_tp is 'hmma1688':
build/bdist.linux-x86_64/egg/tvm/3rdparty/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_device.py:88: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif mma_tp is 'imma8816':
build/bdist.linux-x86_64/egg/tvm/3rdparty/libflash_attn/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_sample.py:185: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if self.fuse_gemm_info[i]['A_format'] is 'Col':
build/bdist.linux-x86_64/egg/tvm/3rdparty/libflash_attn/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_sample.py:187: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if self.fuse_gemm_info[i]['B_format'] is 'Row':
build/bdist.linux-x86_64/egg/tvm/3rdparty/libflash_attn/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_sample.py:189: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if self.fuse_gemm_info[i]['C_format'] is 'Col':
build/bdist.linux-x86_64/egg/tvm/3rdparty/libflash_attn/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_turing_and_volta.py:84: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if self.fuse_gemm_info[i]['B_format'] is 'Row':
build/bdist.linux-x86_64/egg/tvm/3rdparty/libflash_attn/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_turing_and_volta.py:295: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if self.fuse_gemm_info[i]['A_format'] is 'Col':
build/bdist.linux-x86_64/egg/tvm/3rdparty/libflash_attn/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_turing_and_volta.py:297: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if self.fuse_gemm_info[i]['B_format'] is 'Row':
build/bdist.linux-x86_64/egg/tvm/3rdparty/libflash_attn/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_turing_and_volta.py:299: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if self.fuse_gemm_info[i]['C_format'] is 'Col':
build/bdist.linux-x86_64/egg/tvm/3rdparty/libflash_attn/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_device.py:85: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if mma_tp is 'hmma1688':
build/bdist.linux-x86_64/egg/tvm/3rdparty/libflash_attn/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_device.py:88: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif mma_tp is 'imma8816':
/usr/lib64/python3.8/site-packages/tvm-0.13.0-py3.8-linux-x86_64.egg/tvm/3rdparty/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_device.py:85: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if mma_tp is 'hmma1688':
/usr/lib64/python3.8/site-packages/tvm-0.13.0-py3.8-linux-x86_64.egg/tvm/3rdparty/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_device.py:88: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif mma_tp is 'imma8816':
/usr/lib64/python3.8/site-packages/tvm-0.13.0-py3.8-linux-x86_64.egg/tvm/3rdparty/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_sample.py:185: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if self.fuse_gemm_info[i]['A_format'] is 'Col':
/usr/lib64/python3.8/site-packages/tvm-0.13.0-py3.8-linux-x86_64.egg/tvm/3rdparty/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_sample.py:187: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if self.fuse_gemm_info[i]['B_format'] is 'Row':
/usr/lib64/python3.8/site-packages/tvm-0.13.0-py3.8-linux-x86_64.egg/tvm/3rdparty/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_sample.py:189: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if self.fuse_gemm_info[i]['C_format'] is 'Col':
/usr/lib64/python3.8/site-packages/tvm-0.13.0-py3.8-linux-x86_64.egg/tvm/3rdparty/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_turing_and_volta.py:84: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if self.fuse_gemm_info[i]['B_format'] is 'Row':
/usr/lib64/python3.8/site-packages/tvm-0.13.0-py3.8-linux-x86_64.egg/tvm/3rdparty/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_turing_and_volta.py:295: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if self.fuse_gemm_info[i]['A_format'] is 'Col':
/usr/lib64/python3.8/site-packages/tvm-0.13.0-py3.8-linux-x86_64.egg/tvm/3rdparty/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_turing_and_volta.py:297: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if self.fuse_gemm_info[i]['B_format'] is 'Row':
/usr/lib64/python3.8/site-packages/tvm-0.13.0-py3.8-linux-x86_64.egg/tvm/3rdparty/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_turing_and_volta.py:299: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if self.fuse_gemm_info[i]['C_format'] is 'Col':
/usr/lib64/python3.8/site-packages/tvm-0.13.0-py3.8-linux-x86_64.egg/tvm/3rdparty/libflash_attn/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_device.py:85: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if mma_tp is 'hmma1688':
/usr/lib64/python3.8/site-packages/tvm-0.13.0-py3.8-linux-x86_64.egg/tvm/3rdparty/libflash_attn/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_device.py:88: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif mma_tp is 'imma8816':
/usr/lib64/python3.8/site-packages/tvm-0.13.0-py3.8-linux-x86_64.egg/tvm/3rdparty/libflash_attn/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_sample.py:185: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if self.fuse_gemm_info[i]['A_format'] is 'Col':
/usr/lib64/python3.8/site-packages/tvm-0.13.0-py3.8-linux-x86_64.egg/tvm/3rdparty/libflash_attn/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_sample.py:187: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if self.fuse_gemm_info[i]['B_format'] is 'Row':
/usr/lib64/python3.8/site-packages/tvm-0.13.0-py3.8-linux-x86_64.egg/tvm/3rdparty/libflash_attn/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_sample.py:189: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if self.fuse_gemm_info[i]['C_format'] is 'Col':
/usr/lib64/python3.8/site-packages/tvm-0.13.0-py3.8-linux-x86_64.egg/tvm/3rdparty/libflash_attn/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_turing_and_volta.py:84: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if self.fuse_gemm_info[i]['B_format'] is 'Row':
/usr/lib64/python3.8/site-packages/tvm-0.13.0-py3.8-linux-x86_64.egg/tvm/3rdparty/libflash_attn/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_turing_and_volta.py:295: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if self.fuse_gemm_info[i]['A_format'] is 'Col':
/usr/lib64/python3.8/site-packages/tvm-0.13.0-py3.8-linux-x86_64.egg/tvm/3rdparty/libflash_attn/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_turing_and_volta.py:297: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if self.fuse_gemm_info[i]['B_format'] is 'Row':
/usr/lib64/python3.8/site-packages/tvm-0.13.0-py3.8-linux-x86_64.egg/tvm/3rdparty/libflash_attn/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_turing_and_volta.py:299: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if self.fuse_gemm_info[i]['C_format'] is 'Col':
/usr/local/lib/python3.8/site[[[###REDACTED_AWS_SECRET_KEY_REDACTED###]]]py:108: _BetaConfiguration: Support for `[tool.setuptools]` in `pyproject.toml` is still *beta*.
  warnings.warn(msg, _BetaConfiguration)
/usr/local/lib/python3.8/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
error: Setup script exited with error: command '/usr/bin/gcc' failed with exit code 1

Environment

Any environment details, such as: Operating System, TVM version, etc

Operating System: AL2
TVM version : Python 3.8
Cuda: 11.8

Steps to reproduce

Preferably a minimal script to cause the issue to occur.

Triage

Please refer to the list of label tags here to find the relevant tags and add them below in a bullet format (example below).

  • needs-triage
@rishabhjainps rishabhjainps added needs-triage PRs or issues that need to be investigated by maintainers to find the right assignees to address it type: bug labels May 10, 2024
@rishabhjainps
Copy link
Author

I had to update gen_requirements.py file to fix ml_dtypes version in https://github.com/apache/tvm/blob/main/python/gen_requirements.py

sed -i '/("matplotlib", None),/a\ ("ml_dtypes", "==0.2.0"),' gen_requirements.py

@tqchen
Copy link
Member

tqchen commented May 10, 2024

this seems to be a ml_dtypes dependency issue rather than tvm

@rishabhjainps
Copy link
Author

rishabhjainps commented May 10, 2024

@tqchen Should tvm install process fix the version of ml_dtypes https://github.com/apache/tvm/blob/main/python/gen_requirements.py to avoid installing higher versions which don't support Python 3.8?

@tqchen
Copy link
Member

tqchen commented May 10, 2024

In this case, we would likely want to depend on a higher level of python version instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage PRs or issues that need to be investigated by maintainers to find the right assignees to address it type: bug
Projects
None yet
Development

No branches or pull requests

2 participants