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

How to install to aarch64 #1142

Open
gongchangsui opened this issue Nov 4, 2024 · 1 comment
Open

How to install to aarch64 #1142

gongchangsui opened this issue Nov 4, 2024 · 1 comment

Comments

@gongchangsui
Copy link

❓ Questions and Help

pip install -v -U git+https://github.com/facebookresearch/xformers.git@main#egg=xformers

Errors:

 5 errors detected in the compilation of "/tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/xformers/csrc/swiglu/cuda/gemm_fused_operand_sum.cu".
  [32/34] c++ -MMD -MF /tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/build/temp.linux-aarch64-cpython-310/xformers/csrc/attention/autograd/matmul.o.d -pthread -B /home/xxx/miniconda3/envs/pytorch_gpu/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O3 -Wall -fPIC -O3 -isystem /home/xxx/miniconda3/envs/pytorch_gpu/include -fPIC -O3 -isystem /home/xxx/miniconda3/envs/pytorch_gpu/include -fPIC -I/tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/xformers/csrc -I/tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/third_party/sputnik -I/tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/third_party/cutlass/include -I/tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/third_party/cutlass/tools/util/include -I/tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/third_party/cutlass/examples -I/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/torch/include -I/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/torch/include/TH -I/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/xxx/miniconda3/envs/pytorch_gpu/include/python3.10 -c -c /tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/xformers/csrc/attention/autograd/matmul.cpp -o /tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/build/temp.linux-aarch64-cpython-310/xformers/csrc/attention/autograd/matmul.o -O3 -std=c++17 -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1016"' -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=1
  [33/34] /usr/local/cuda/bin/nvcc --generate-dependencies-with-compile --dependency-output /tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/build/temp.linux-aarch64-cpython-310/xformers/csrc/sequence_parallel_fused/synchronization_kernels.o.d -I/tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/xformers/csrc -I/tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/third_party/sputnik -I/tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/third_party/cutlass/include -I/tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/third_party/cutlass/tools/util/include -I/tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/third_party/cutlass/examples -I/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/torch/include -I/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/torch/include/TH -I/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/xxx/miniconda3/envs/pytorch_gpu/include/python3.10 -c -c /tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/xformers/csrc/sequence_parallel_fused/synchronization_kernels.cu -o /tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/build/temp.linux-aarch64-cpython-310/xformers/csrc/sequence_parallel_fused/synchronization_kernels.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -DHAS_PYTORCH --use_fast_math -U__CUDA_NO_HALF_OPERATORS__ -U__CUDA_NO_HALF_CONVERSIONS__ --extended-lambda -D_ENABLE_EXTENDED_ALIGNED_STORAGE -std=c++17 --generate-line-info -DNDEBUG --threads 4 --ptxas-options=-v --ptxas-options=-O2 --ptxas-options=-allow-expensive-optimizations=true -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1016"' -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=1 -gencode=arch=compute_80,code=sm_80
  FAILED: /tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/build/temp.linux-aarch64-cpython-310/xformers/csrc/sequence_parallel_fused/synchronization_kernels.o
  /usr/local/cuda/bin/nvcc --generate-dependencies-with-compile --dependency-output /tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/build/temp.linux-aarch64-cpython-310/xformers/csrc/sequence_parallel_fused/synchronization_kernels.o.d -I/tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/xformers/csrc -I/tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/third_party/sputnik -I/tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/third_party/cutlass/include -I/tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/third_party/cutlass/tools/util/include -I/tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/third_party/cutlass/examples -I/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/torch/include -I/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/torch/include/TH -I/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/xxx/miniconda3/envs/pytorch_gpu/include/python3.10 -c -c /tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/xformers/csrc/sequence_parallel_fused/synchronization_kernels.cu -o /tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/build/temp.linux-aarch64-cpython-310/xformers/csrc/sequence_parallel_fused/synchronization_kernels.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -DHAS_PYTORCH --use_fast_math -U__CUDA_NO_HALF_OPERATORS__ -U__CUDA_NO_HALF_CONVERSIONS__ --extended-lambda -D_ENABLE_EXTENDED_ALIGNED_STORAGE -std=c++17 --generate-line-info -DNDEBUG --threads 4 --ptxas-options=-v --ptxas-options=-O2 --ptxas-options=-allow-expensive-optimizations=true -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1016"' -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=1 -gencode=arch=compute_80,code=sm_80
  /usr/include/bits/math-vector.h(30): error: identifier "__Float32x4_t" is undefined
    typedef __Float32x4_t __f32x4_t;
            ^

  /usr/include/bits/math-vector.h(31): error: identifier "__Float64x2_t" is undefined
    typedef __Float64x2_t __f64x2_t;
            ^

  /usr/include/bits/math-vector.h(40): error: identifier "__SVFloat32_t" is undefined
    typedef __SVFloat32_t __sv_f32_t;
            ^

  /usr/include/bits/math-vector.h(41): error: identifier "__SVFloat64_t" is undefined
    typedef __SVFloat64_t __sv_f64_t;
            ^

  /usr/include/bits/math-vector.h(42): error: identifier "__SVBool_t" is undefined
    typedef __SVBool_t __sv_bool_t;
            ^

  5 errors detected in the compilation of "/tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/xformers/csrc/sequence_parallel_fused/synchronization_kernels.cu".
  [34/34] c++ -MMD -MF /tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/build/temp.linux-aarch64-cpython-310/xformers/csrc/swiglu/swiglu_packedw.o.d -pthread -B /home/xxx/miniconda3/envs/pytorch_gpu/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O3 -Wall -fPIC -O3 -isystem /home/xxx/miniconda3/envs/pytorch_gpu/include -fPIC -O3 -isystem /home/xxx/miniconda3/envs/pytorch_gpu/include -fPIC -I/tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/xformers/csrc -I/tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/third_party/sputnik -I/tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/third_party/cutlass/include -I/tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/third_party/cutlass/tools/util/include -I/tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/third_party/cutlass/examples -I/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/torch/include -I/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/torch/include/TH -I/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/xxx/miniconda3/envs/pytorch_gpu/include/python3.10 -c -c /tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/xformers/csrc/swiglu/swiglu_packedw.cpp -o /tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/build/temp.linux-aarch64-cpython-310/xformers/csrc/swiglu/swiglu_packedw.o -O3 -std=c++17 -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1016"' -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=1
  ninja: build stopped: subcommand failed.
  Traceback (most recent call last):
    File "/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 2148, in _run_ninja_build
      subprocess.run(
    File "/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/subprocess.py", line 526, in run
      raise CalledProcessError(retcode, process.args,
  subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

  The above exception was the direct cause of the following exception:

  Traceback (most recent call last):
    File "<string>", line 2, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "/tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/setup.py", line 680, in <module>
      setuptools.setup(
    File "/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/setuptools/__init__.py", line 117, in setup
      return distutils.core.setup(**attrs)
    File "/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 183, in setup
      return run_commands(dist)
    File "/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 199, in run_commands
      dist.run_commands()
    File "/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 954, in run_commands
      self.run_command(cmd)
    File "/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/setuptools/dist.py", line 950, in run_command
      super().run_command(command)
    File "/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 973, in run_command
      cmd_obj.run()
    File "/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/setuptools/command/bdist_wheel.py", line 398, in run
      self.run_command("build")
    File "/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
      self.distribution.run_command(command)
    File "/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/setuptools/dist.py", line 950, in run_command
      super().run_command(command)
    File "/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 973, in run_command
      cmd_obj.run()
    File "/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
      self.distribution.run_command(command)
    File "/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/setuptools/dist.py", line 950, in run_command
      super().run_command(command)
    File "/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 973, in run_command
      cmd_obj.run()
    File "/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 98, in run
      _build_ext.run(self)
    File "/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 359, in run
      self.build_extensions()
    File "/tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/setup.py", line 637, in build_extensions
      super().build_extensions()
    File "/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 900, in build_extensions
      build_ext.build_extensions(self)
    File "/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 476, in build_extensions
      self._build_extensions_serial()
    File "/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 502, in _build_extensions_serial
      self.build_extension(ext)
    File "/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 263, in build_extension
      _build_ext.build_extension(self, ext)
    File "/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 557, in build_extension
      objects = self.compiler.compile(
    File "/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 713, in unix_wrap_ninja_compile
      _write_ninja_file_and_compile_objects(
    File "/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1828, in _write_ninja_file_and_compile_objects
      _run_ninja_build(
    File "/home/xxx/miniconda3/envs/pytorch_gpu/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 2164, in _run_ninja_build
      raise RuntimeError(message) from e
  RuntimeError: Error compiling objects for extension
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /home/xxx/miniconda3/envs/pytorch_gpu/bin/python -u -c '
  exec(compile('"'"''"'"''"'"'
  # This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py
  #
  # - It imports setuptools before invoking setup.py, to enable projects that directly
  #   import from `distutils.core` to work with newer packaging standards.
  # - It provides a clear error message when setuptools is not installed.
  # - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so
  #   setuptools doesn'"'"'t think the script is `-c`. This avoids the following warning:
  #     manifest_maker: standard file '"'"'-c'"'"' not found".
  # - It generates a shim setup.py, for handling setup.cfg-only projects.
  import os, sys, tokenize
  
  try:
      import setuptools
  except ImportError as error:
      print(
          "ERROR: Can not execute `setup.py` since setuptools is not available in "
          "the build environment.",
          file=sys.stderr,
      )
      sys.exit(1)
  
  __file__ = %r
  sys.argv[0] = __file__
  
  if os.path.exists(__file__):
      filename = __file__
      with tokenize.open(__file__) as f:
          setup_py_code = f.read()
  else:
      filename = "<auto-generated setuptools caller>"
      setup_py_code = "from setuptools import setup; setup()"
  
  exec(compile(setup_py_code, filename, "exec"))
  '"'"''"'"''"'"' % ('"'"'/tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/setup.py'"'"',), "<pip-setuptools-caller>", "exec"))' bdist_wheel -d /tmp/pip-wheel-sdqwxwox
  cwd: /tmp/pip-install-6ujyzy46/xformers_e4a4140b42b440b8ad2ecb289ce8d524/
  Building wheel for xformers (setup.py) ... error
  ERROR: Failed building wheel for xformers
  Running setup.py clean for xformers
  Running command python setup.py clean
  running clean
  'build/lib.linux-aarch64-cpython-310' does not exist -- can't clean it
  'build/bdist.linux-aarch64' does not exist -- can't clean it
  'build/scripts-3.10' does not exist -- can't clean it
Failed to build xformers
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (xformers)

@lw
Copy link
Contributor

lw commented Nov 4, 2024

I don't think we support aarch64, sorry. We don't test it, it might just work, but from what you say apparently it doesn't. If you want to submit a fix we might accept it (if it's not too complicated), but we can't guarantee it won't break again.

bertmaher pushed a commit to bertmaher/xformers that referenced this issue Dec 20, 2024
…kresearch#1142)

* flash-attention 2 fwd pass: only scale output at end of loop

* lint

* restore the third_party change (i think)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants