Skip to content

variants.yaml causes to rebuild from scratch on every task #6232

Closed

Description

@crusaderky

Checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pixi, using pixi --version.

Reproducible example

$ pixi --version
pixi 0.69.0
$ git clone https://github.com/crusaderky/pixi-llm-recipes.git
$ cd pixi-llm-recipes
$ git checkout 9accdbbf15d126c5d858ea57d232a7288c026914
$ pixi r list-devices   # Builds recipe
$ pixi r list-devices   # Builds recipe _again_

Issue description

In crusaderky/pixi-llm-recipes@9accdbb I have:

├── pixi-recipes
│   ├── llama-cpp
│   │   ├── recipe.yaml
│   │   └── vulkan
│   │       ├── pixi.toml
│   │       └── variants.yaml
└── pixi.toml

with

pixi-recipes/llama-cpp/vulkan/pixi.toml

[workspace]
channels = ["https://prefix.dev/conda-forge"]
preview = ["pixi-build"]
platforms = ["linux-64"]

[package.build.backend]
name = "pixi-build-rattler-build"
version = "*"

[package.build.config]
recipe = "../recipe.yaml"

pixi-recipes/llama-cpp/vulkan/variants.yaml

backend:
  - vulkan

pixi.toml (root dir)

[workspace]
channels = ["https://prefix.dev/conda-forge"]
preview = ["pixi-build"]
platforms = ["linux-64"]

[dependencies]
llama-cpp = { path = "pixi-recipes/llama-cpp/vulkan" }

Whenever I run a task (to test in the actual repo: pixi run list-devices), pixi rebuilds the llama-cpp recipe from scratch. If I run the exact same task immediately afterwards, it rebuilds everything from zero.

Workaround

In crusaderky/pixi-llm-recipes@8f81345 I refactored the recipe:

├── pixi-recipes
│   ├── llama-cpp
│   │   ├── pixi.toml
│   │   └── recipe.yaml
└── pixi.toml

with

pixi-recipes/llama-cpp/pixi.toml

[workspace]
channels = ["https://prefix.dev/conda-forge"]
preview = ["pixi-build"]
platforms = ["linux-64"]

[workspace.build-variants]
backend = ["cpu", "vulkan", "rocm"]

[package.build.backend]
name = "pixi-build-rattler-build"
version = "*"

pixi.toml (root dir)

[workspace]
channels = ["https://prefix.dev/conda-forge"]
preview = ["pixi-build"]
platforms = ["linux-64"]

[workspace.build-variants]
backend = ["vulkan"]

[dependencies]
llama-cpp = { path = "pixi-recipes/llama-cpp" }

The above only triggers a recompilation whenever I change something in the recipe, or after I run pixi clean, as expected.
It is not a perfect solution because I could not find a way to have per-feature variants; in other words I'm missing something like there is for cuda:

# This does not work
[feature.llama-vulkan]
system-requirements = { build-variant = { backend = "vulkan" } }
[feature.llama-cpu]
system-requirements = { build-variant = { backend = "cpu" } }
[feature.llama.dependencies]
llama-cpp = { path = "pixi-recipes/llama-cpp" }

[environments]
llama-cpu = ["llama", "llama-cpu"]
llama-vulkan = ["llama", "llama-vulkan"]

but maybe there is I way to express the above which however I could not find?

Expected behavior

In the reproducer above, the second time I run pixi r list-devices the recipe does not get rebuilt from scratch.

Metadata

Metadata

Assignees

Labels

area:buildbug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions