NX-AI / xlstm

Official repository of the xLSTM.
https://www.nx-ai.com/
Apache License 2.0
1.43k stars 101 forks source link

ninja: error: 'xLSTM/xlstm/xlstm/blocks/slstm/src/cuda/slstm.cc', needed by 'slstm.o', missing and no known rule to make it #23

Closed haustzhb closed 3 months ago

haustzhb commented 5 months ago

{'verbose': True, 'with_cuda': True, 'extra_ldflags': ['-LC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\lib', '-lcublas'], 'extra_cflags': ['-DSLSTM_HIDDEN_SIZE=128', '-DSLSTM_BATCH_SIZE=8', '-DSLSTM_NUM_HEADS=4', '-DSLSTM_NUM_STATES=4', '-DSLSTM_DTYPE_B=float', '-DSLSTM_DTYPE_R=nv_bfloat16', '-DSLSTM_DTYPE_W=__nv_bfloat16', '-DSLSTM_DTYPE_G=nv_bfloat16', '-DSLSTM_DTYPE_S=nv_bfloat16', '-DSLSTM_DTYPE_A=float', '-DSLSTM_NUM_GATES=4', '-DSLSTM_SIMPLE_AGG=true', '-DSLSTM_GRADIENT_RECURRENT_CLIPVAL_VALID=false', '-DSLSTM_GRADIENT_RECURRENT_CLIPVAL=0.0', '-DSLSTM_FORWARD_CLIPVAL_VALID=false', '-DSLSTM_FORWARD_CLIPVAL=0.0', '-U__CUDA_NO_HALF_OPERATORS', '-UCUDA_NO_HALF_CONVERSIONS', '-UCUDA_NO_BFLOAT16_OPERATORS', '-UCUDA_NO_BFLOAT16_CONVERSIONS', '-UCUDA_NO_BFLOAT162_OPERATORS', '-UCUDA_NO_BFLOAT162_CONVERSIONS'], 'extra_cuda_cflags': ['-Xptxas="-v"', '-gencode', 'arch=compute_80,code=compute_80', '-res-usage', '--use_fast_math', '-O3', '-Xptxas -O3', '--extra-device-vectorization', '-DSLSTM_HIDDEN_SIZE=128', '-DSLSTM_BATCH_SIZE=8', '-DSLSTM_NUM_HEADS=4', '-DSLSTM_NUM_STATES=4', '-DSLSTM_DTYPE_B=float', '-DSLSTM_DTYPE_R=nv_bfloat16', '-DSLSTM_DTYPE_W=nv_bfloat16', '-DSLSTM_DTYPE_G=nv_bfloat16', '-DSLSTM_DTYPE_S=__nv_bfloat16', '-DSLSTM_DTYPE_A=float', '-DSLSTM_NUM_GATES=4', '-DSLSTM_SIMPLE_AGG=true', '-DSLSTM_GRADIENT_RECURRENT_CLIPVAL_VALID=false', '-DSLSTM_GRADIENT_RECURRENT_CLIPVAL=0.0', '-DSLSTM_FORWARD_CLIPVAL_VALID=false', '-DSLSTM_FORWARD_CLIPVAL=0.0', '-UCUDA_NO_HALF_OPERATORS', '-UCUDA_NO_HALF_CONVERSIONS', '-UCUDA_NO_BFLOAT16_OPERATORS', '-UCUDA_NO_BFLOAT16_CONVERSIONS', '-UCUDA_NO_BFLOAT162_OPERATORS', '-UCUDA_NO_BFLOAT162_CONVERSIONS__']} Using C:\Users\31786\AppData\Local\torch_extensions\torch_extensions\Cache\py311_cu121 as PyTorch extensions root... Detected CUDA files, patching ldflags Emitting ninja build file C:\Users\31786\AppData\Local\torch_extensions\torch_extensions\Cache\py311_cu121\slstm_HS128BS8NH4NS4DBfDRbDWbDGbDSbDAfNG4SA1GRCV0GRC0d0FCV0FC0d0\build.ninja... Building extension module slstm_HS128BS8NH4NS4DBfDRbDWbDGbDSbDAfNG4SA1GRCV0GRC0d0FCV0FC0d0... Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N) ninja: error: 'D:/zhb/AIѧϰ����/xLSTM/xlstm/xlstm/blocks/slstm/src/cuda/slstm.cc', needed by 'slstm.o', missing and no known rule to make it Traceback (most recent call last): File "D:\software\anaconda_install\envs\xlstm\Lib\site-packages\torch\utils\cpp_extension.py", line 2096, in _run_ninja_build subprocess.run( File "D:\software\anaconda_install\envs\xlstm\Lib\subprocess.py", line 571, 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 "xLSTM\xlstm\test\test.py", line 35, in xlstm_stack = xLSTMLMModel(cfg) ^^^^^^^^^^^^^^^^^ File "xLSTM\xlstm\xlstm\xlstm_lm_model.py", line 38, in init self.xlstm_block_stack = xLSTMBlockStack(config=config) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "xLSTM\xlstm\xlstm\xlstm_block_stack.py", line 83, in init self.blocks = self._create_blocks(config=config) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "xLSTM\xlstm\xlstm\xlstm_block_stack.py", line 104, in _create_blocks blocks.append(sLSTMBlock(config=config)) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "xLSTM\xlstm\xlstm\blocks\slstm\block.py", line 32, in init super().init( File "xLSTM\xlstm\xlstm\blocks\xlstm_block.py", line 62, in init self.xlstm = sLSTMLayer(config=self.config.slstm) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "xLSTM\xlstm\xlstm\blocks\slstm\layer.py", line 78, in init self.slstm_cell = sLSTMCell(self.config) ^^^^^^^^^^^^^^^^^^^^^^ File "xLSTM\xlstm\xlstm\blocks\slstm\cell.py", line 780, in new return sLSTMCell_cuda(config, skip_backend_init=skip_backend_init) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "xLSTM\xlstm\xlstm\blocks\slstm\cell.py", line 690, in init self.func = sLSTMCellFuncGenerator(self.training, config) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "xLSTM\xlstm\xlstm\blocks\slstm\cell.py", line 536, in sLSTMCellFuncGenerator slstm_cuda = sLSTMCellCUDA.instance(config=config) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "xLSTM\xlstm\xlstm\blocks\slstm\cell.py", line 515, in instance cls.mod[repr(config)] = load( ^^^^^ File "xLSTM\xlstm\xlstm\blocks\slstm\src\cuda_init.py", line 84, in load mod = _load(name + suffix, sources, **myargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\software\anaconda_install\envs\xlstm\Lib\site-packages\torch\utils\cpp_extension.py", line 1306, in load return _jit_compile( ^^^^^^^^^^^^^ File "D:\software\anaconda_install\envs\xlstm\Lib\site-packages\torch\utils\cpp_extension.py", line 1710, in _jit_compile _write_ninja_file_and_build_library( File "D:\software\anaconda_install\envs\xlstm\Lib\site-packages\torch\utils\cpp_extension.py", line 1823, in _write_ninja_file_and_build_library _run_ninja_build( File "D:\software\anaconda_install\envs\xlstm\Lib\site-packages\torch\utils\cpp_extension.py", line 2112, in _run_ninja_build raise RuntimeError(message) from e RuntimeError: Error building extension 'slstm_HS128BS8NH4NS4DBfDRbDWbDGbDSbDAfNG4SA1GRCV0GRC0d0FCV0FC0d0'

"Hello! I am configuring the environment on Windows, but after running, I found that when trying to compile the C++ extension, Ninja cannot find the 'slstm.cc' file. How should I solve this issue?"

kpoeppel commented 3 months ago

Probably a problem with your paths. slstm.cc is definitely in the codebase.