Skip to content

Conversation

@weiji14
Copy link
Member

@weiji14 weiji14 commented Apr 30, 2025

Mamba state-space model! Repo at https://github.com/state-spaces/mamba

Checklist

  • Title of this PR is meaningful: e.g. "Adding my_nifty_package", not "updated meta.yaml".
  • License file is packaged (see here for an example).
  • Source is from official source.
  • Package does not vendor other packages. (If a package uses the source of another package, they should be separate packages or the licenses of all packages need to be packaged).
  • If static libraries are linked in, the license of the static library is packaged.
  • Package does not ship static libraries. If static libraries are needed, follow CFEP-18.
  • Build number is 0.
  • A tarball (url) rather than a repo (e.g. git_url) is used in your recipe (see here for more details).
  • GitHub users listed in the maintainer section have posted a comment confirming they are willing to be listed there.
  • When in trouble, please check our knowledge base documentation before pinging a team.

@github-actions
Copy link
Contributor

Hi! This is the staged-recipes linter and your PR looks excellent! 🚀

Fixes `NameError: name 'bare_metal_version' is not defined` on platforms without CUDA, xref state-spaces/mamba#602
@conda-forge-admin
Copy link
Contributor

conda-forge-admin commented Apr 30, 2025

Hi! This is the friendly automated conda-forge-linting service.

I wanted to let you know that I linted all conda-recipes in your PR (recipes/mamba-ssm/recipe.yaml) and found some lint.

Here's what I've got...

For recipes/mamba-ssm/recipe.yaml:

  • ❌ Non noarch packages should have python requirement without any version constraints.
  • ❌ Non noarch packages should have python requirement without any version constraints.

This message was generated by GitHub Actions workflow run https://github.com/conda-forge/conda-forge-webservices/actions/runs/14747268959. Examine the logs at this URL for more detail.

@conda-forge-admin
Copy link
Contributor

Hi! This is the friendly automated conda-forge-linting service.

I just wanted to let you know that I linted all conda-recipes in your PR (recipes/mamba-ssm/recipe.yaml) and found it was in an excellent condition.

@weiji14
Copy link
Member Author

weiji14 commented Apr 30, 2025

There's an RuntimeError on the import mamba_ssm test, e.g. at https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=1236098&view=logs&j=df9408f7-e795-500f-143d-aa7735a0ed8b&t=47addc80-ccbf-566b-ee3a-66cdb8436937&l=1297:

 Installing test environment
 ✔ Successfully updated the test environment
 + python $SRC_DIR/conda_build_script.py
 Traceback (most recent call last):
   File "$SRC_DIR/conda_build_script.py", line 1, in <module>
     import mamba_ssm
   File "$PREFIX/lib/python3.12/site-packages/mamba_ssm/__init__.py", line 3, in <module>
     from mamba_ssm.ops.selective_scan_interface import selective_scan_fn, mamba_inner_fn
   File "$PREFIX/lib/python3.12/site-packages/mamba_ssm/ops/selective_scan_interface.py", line 16, in <module>
     from mamba_ssm.ops.triton.layer_norm import _layer_norm_fwd
   File "$PREFIX/lib/python3.12/site-packages/mamba_ssm/ops/triton/layer_norm.py", line 169, in <module>
     @triton.autotune(
      ^^^^^^^^^^^^^^^^
   File "$PREFIX/lib/python3.12/site-packages/triton/runtime/autotuner.py", line 352, in decorator
     return Autotuner(fn, fn.arg_names, configs, key, reset_to_zero, restore_value, pre_hook=pre_hook,
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "$PREFIX/lib/python3.12/site-packages/triton/runtime/autotuner.py", line 127, in __init__
     self.do_bench = driver.active.get_benchmarker()
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "$PREFIX/lib/python3.12/site-packages/triton/runtime/driver.py", line 23, in __getattr__
     self._initialize_obj()
   File "$PREFIX/lib/python3.12/site-packages/triton/runtime/driver.py", line 20, in _initialize_obj
     self._obj = self._init_fn()
                 ^^^^^^^^^^^^^^^
   File "$PREFIX/lib/python3.12/site-packages/triton/runtime/driver.py", line 8, in _create_driver
     raise RuntimeError(f"{len(actives)} active drivers ({actives}). There should only be one.")
 RuntimeError: 0 active drivers ([]). There should only be one.
 × error Script failed with status 1
 × error Work directory: '/tmp/.tmpKdXIy2'
 × error To debug the build, run it manually in the work directory (execute the `./conda_build.sh` or `conda_build.bat` script)

Should have been fixed in triton-lang/triton#6570 (see also triton-lang/triton#6150). Could either skip the import check (import should technically work on a CUDA-enabled device), or wait for a new release of triton>3.3.0 with that patch? Edit: found another workaround by pinning to triton<3.2.0, at the expense of only supporting pytorch=2.5.

@conda-forge-admin
Copy link
Contributor

Hi! This is the friendly automated conda-forge-linting service.

I wanted to let you know that I linted all conda-recipes in your PR (recipes/mamba-ssm/recipe.yaml) and found some lint.

Here's what I've got...

For recipes/mamba-ssm/recipe.yaml:

  • ❌ The recipe must have some tests.

This message was generated by GitHub Actions workflow run https://github.com/conda-forge/conda-forge-webservices/actions/runs/14764654406. Examine the logs at this URL for more detail.

Will revert back to the proper `pip_check` when triton>3.3.0 comes out.
@conda-forge-admin
Copy link
Contributor

Hi! This is the friendly automated conda-forge-linting service.

I just wanted to let you know that I linted all conda-recipes in your PR (recipes/mamba-ssm/recipe.yaml) and found it was in an excellent condition.

Because we need to match triton=3.1.0 with pytorch 2.5 cuda*, cannot pull in pytorch 2.6 yet. The `import mamba_ssm` check should now work, but still need to disable pip_check because of ninja import, xref conda-forge/ninja-feedstock#26
@weiji14 weiji14 marked this pull request as ready for review May 1, 2025 00:13
@weiji14
Copy link
Member Author

weiji14 commented May 1, 2025

@conda-forge/help-python, ready for review!

@weiji14 weiji14 marked this pull request as draft July 4, 2025 01:06
@weiji14 weiji14 marked this pull request as ready for review July 4, 2025 01:28
@weiji14
Copy link
Member Author

weiji14 commented Jul 4, 2025

Gentle ping again @conda-forge/help-python to see if this can be reviewed and merged 🙏

Comment on lines 16 to 20
skip:
# mamba-ssm requires CUDA (or ROCm) GPU
- cuda_compiler_version == "None"
# CUDA < 12 not supported by pytorch anymore
- cuda_compiler_version == "11.8"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a pytorch cuda user, but can't this be noarch?

Copy link
Member Author

@weiji14 weiji14 Jul 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this CUDA-dependent package is Linux only. And actually, the reason I'm packaging this is to get builds working on arm64 which aren't available on the release page at https://github.com/state-spaces/mamba/releases/tag/v2.2.4, so it's probably not a noarch package.

Copy link
Member

@ocefpaf ocefpaf Jul 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't you need compilers then? @jakirkham or @isuruf you have more experience with cuda recipes. Can you chime in and help us?

Copy link
Contributor

@danielnachun danielnachun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made some suggestions for what I think are the basic CUDA requirements but there will probably be more needed.

Since patch from triton-lang/triton#6570 is out in triton=3.4.0 on conda-forge now.
Avoid `$PREFIX/lib/python3.9/site-packages/torch/utils/cpp_extension.py:480: UserWarning: The detected CUDA version (12.6) has a minor version mismatch with the version that was used to compile PyTorch (12.9). Most likely this shouldn't be a problem`.
This reverts commit 98e0ed1. Updated note to say that pin can be remove when pytorch builds with triton>=3.4.0.
@weiji14 weiji14 requested a review from danielnachun August 19, 2025 00:29
Comment on lines +53 to +54
# disabled pip check because ninja is not available
# see https://github.com/conda-forge/ninja-feedstock/issues/26
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add ninja as a test-only dependency here?

Copy link
Member Author

@weiji14 weiji14 Aug 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think there's a way to add test-only dependencies with v1 recipes for python tests - https://rattler.build/latest/reference/recipe_file/#python-tests, only able to set the python-version.

Copy link
Member Author

@weiji14 weiji14 Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gentle nudge again @danielnachun, are you ok with me keeping pip check disabled, or would you prefer another solution from conda-forge/ninja-feedstock#26?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point you can probably just patch out ninja from the pyproject.toml - if pip check doesn't work for this package, it also won't work for any Python package that ever depends on this, which is more of a concern. A simple sed -i 's/"ninja",//g' pyproject.toml should hopefully let pip check pass.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I've added the patch, and Python 3.10 build's pip check seems to have passed. Just need to wait for the other matrix CI builds to finish.

@weiji14
Copy link
Member Author

weiji14 commented Sep 3, 2025

Linter error seems to be due to #30936, and windows build error can be ignored since this recipe is for CUDA-enabled Linux builds only.

Comment on lines +21 to +23
skip:
# mamba-ssm requires CUDA (or ROCm) GPU
- cuda_compiler_version == "None"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
skip:
# mamba-ssm requires CUDA (or ROCm) GPU
- cuda_compiler_version == "None"
skip:
# mamba-ssm requires CUDA (or ROCm) GPU
- cuda_compiler_version == "None"
- not linux

I think we should also just be skipping macOS and Windows altogether here since this requires a CUDA compiler.

@danielnachun
Copy link
Contributor

Linter error seems to be due to #30936, and windows build error can be ignored since this recipe is for CUDA-enabled Linux builds only.

That does appear to be unrelated, but let's give the upstream team a chance to respond since that issue so new just to make sure there isn't some weird cryptic issue with the recipe itself here.

@danielnachun
Copy link
Contributor

My apologies but it appears a separate PR for this was already merged: #30861. In that case we'll have to close this, but please feel free to add yourself as a maintainer to the feedstock at https://github.com/conda-forge/mamba-ssm-feedstock.

@weiji14
Copy link
Member Author

weiji14 commented Sep 3, 2025

Oh great, I'll try and bring the changes from here into https://github.com/conda-forge/mamba-ssm-feedstock then. Thanks again for your time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants