Skip to content

fix(test): unblock root pixi run test workflow#1978

Open
rparolin wants to merge 4 commits intoNVIDIA:mainfrom
rparolin:fix-pixi-run-test
Open

fix(test): unblock root pixi run test workflow#1978
rparolin wants to merge 4 commits intoNVIDIA:mainfrom
rparolin:fix-pixi-run-test

Conversation

@rparolin
Copy link
Copy Markdown
Collaborator

@rparolin rparolin commented Apr 25, 2026

Summary

pixi run test was failing end-to-end. Two stacked root causes:

  1. List-form pixi cmd arrays didn't expand $PIXI_ENVIRONMENT_NAME. The root test-* tasks dropped into each sub-package without forwarding the active environment, so the inner pixi run picked the sub-package's default environment. In cuda_bindings/pixi.toml and cuda_core/pixi.toml, default has no cuda-version pin — the conda solver resolved a CUDA-12.x toolkit, and the build failed compiling Cython output that references CUatomicOperation_enum (a CUDA-13.x-only symbol). Fix: wrap each test-* task in bash -c '…' so the shell expands $PIXI_ENVIRONMENT_NAME and forwards it explicitly via -e to the inner pixi run.

  2. Cython couldn't find cross-package .pxd files under pixi-build's editable install. pixi-build installs cuda-bindings via a PEP 660 finder hook; runtime imports honor it but Cython's filesystem .pxd resolver does not. Fix: replace the cythonize CLI invocation in both cuda_core/tests/cython/build_tests.sh and cuda_bindings/tests/cython/build_tests.sh with a small Python wrapper (build_tests.py) that calls Cython.Build.cythonize() with an explicit include_path resolved at runtime from cuda.bindings.__file__. This avoids platform-specific PYTHONPATH separator handling and surfaces missing-import failures as Python exceptions instead of silent fallbacks.

Files changed

  • pixi.toml — three test-* tasks switched to bash -c '…' form forwarding -e "$PIXI_ENVIRONMENT_NAME"; comment block expanded with rationale and Linux-only scope note.
  • cuda_core/tests/cython/build_tests.sh — adds set -euo pipefail; invokes new build_tests.py instead of the cythonize CLI; still owns CPLUS_INCLUDE_PATH / CL setup.
  • cuda_core/tests/cython/build_tests.pynew; resolves the cuda namespace package's parent dir at runtime and runs cythonize() + setup(... build_ext --inplace) with an explicit include_path.
  • cuda_bindings/tests/cython/build_tests.sh — adds set -euo pipefail; switches to the new wrapper; preserves CPLUS_INCLUDE_PATH / CL setup.
  • cuda_bindings/tests/cython/build_tests.pynew; mirror of the cuda_core wrapper, with nthreads=1 to preserve the previous -j 1 deterministic-build behavior.

Test plan

  • pixi run test — passes 4,293 tests (971 pathfinder + 384 bindings + 2,938 core), 208 skipped, 3 xfailed.
  • pixi run -e cu13 test — passes (same totals).
  • pixi run test-pathfinder, pixi run test-bindings, pixi run test-core — each passes individually.
  • CI: full matrix run on this PR.

Out of scope (follow-ups)

  • Windows/macOS root test task parity (current tasks are gated to [target.linux.tasks.*]).
  • Updating cuda_bindings/tests/cython/build_tests.bat to call the same Python driver.

🤖 Generated with Claude Code

`pixi run test` failed at the cuda_bindings build stage because list-form
pixi `cmd` arrays didn't expand `$PIXI_ENVIRONMENT_NAME` reliably, so the
inner per-package `pixi run` calls picked the cuda_bindings default
environment (no cuda-version pin). The conda solver then resolved
cuda-version=12.9 and the build failed with a missing `CUatomicOperation_enum`
(a CUDA-13.x-only symbol).

Wrap the three test-* tasks in `bash -c '...'` so the shell expands
`$PIXI_ENVIRONMENT_NAME` and forward it explicitly via `-e` to each inner
pixi run.

Once the bindings build was unblocked, cuda_core's cython test build hit a
second issue: `cythonize` cannot resolve `cimport cuda.bindings.*` against
pixi-build's editable install, which exposes the cuda namespace package via a
finder hook that Cython's filesystem .pxd resolver does not consult. Replace
the `cythonize` CLI invocation with a small Python wrapper that calls
`Cython.Build.cythonize()` with an explicit `include_path` resolved from the
imported `cuda.bindings` package.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@rparolin rparolin added this to the cuda.core v1.0.0 milestone Apr 25, 2026
@rparolin rparolin added bug Something isn't working CI/CD CI/CD infrastructure cuda.core Everything related to the cuda.core module labels Apr 25, 2026
@rparolin rparolin requested a review from cpcloud April 25, 2026 08:13
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@rparolin rparolin self-assigned this Apr 25, 2026
Drop cuda_core/tests/cython/build_tests.py in favor of a small PYTHONPATH
shim in build_tests.sh. Same outcome (Cython's .pxd resolver finds
cuda.bindings via the package's parent directory), three lines instead of
a separate setuptools entry point.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@leofang leofang added the P1 Medium priority - Should do label May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working CI/CD CI/CD infrastructure cuda.core Everything related to the cuda.core module P1 Medium priority - Should do

2 participants