ci: install published FlagOS wheels across accelerator jobs - #420
Merged
Merged
Conversation
Part of flagos-ai#378 The seven platform provisioning scripts each carried their own copy of pip_retry (five slightly different spellings), flag_gems_installed and install_flag_gems (six copies each), strip_vendor_paths (three) and venv_is_usable (two), plus a 21-line FlagGems VCS-install rationale duplicated verbatim in six of them. A fix had to be applied seven times and was easy to miss. Add .github/scripts/lib/set_env_common.sh and have every script source it, removing the local copies and the now-duplicated comments (the shared rationale moved into the library). The per-platform main flows, SDK discovery and vendor-torch handling are unchanged; only the shared helpers moved. The interpreter comes from ${VENV_PYTHON:-python}: every script but MetaX sets VENV_PYTHON to its job-local venv, and MetaX runs the image's /opt/venv via PATH and keeps using `python`. pip_retry additionally honours PIP_RETRY_PYTHON (the CUDA script drives several interpreters, so it now sets that per call instead of passing the interpreter as $1), PIP_RETRY_TIMEOUT and PIP_RETRY_NO_CACHE (CUDA keeps its 600s timeout and build cache; the rest keep 300s + --no-cache-dir). Changes: - .github/scripts/lib/set_env_common.sh (new): the five helpers. - .github/scripts/set_env_*.sh: source the library; drop the local helpers and their duplicated comments; CUDA prefixes its 7 pip_retry calls with PIP_RETRY_PYTHON. - tests/unit/test_set_env_common.py (new): the library defines the helpers, no script redefines them, every script sources it, and CUDA still selects its interpreter per call. - .github/workflows/agnostic-checks.yml: bash -n the library; run the new test. Net -675/+285 across the seven scripts (the shared logic now exists once). Tested: bash -n on all scripts and the library; ruff clean; 26 pure-text unit tests pass; the only non-function code removed is CUDA's pip_retry call sites, rewritten in place. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
24 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AI Agent Information
Summary
An observed GCU integration job spent about 40 minutes retrying a FlagGems Git clone and reached its one-hour timeout shortly after tests began. This PR installs published FlagGems 5.4.0 and vendor-specific FlagTree 0.7.0 RC wheels across all seven accelerator scripts; a later GCU run reduced environment preparation from 54m47s to 3m20s and passed integration tests. DCU uses its matching FlagCX RC wheel, while CUDA, MetaX, GCU, and MUSA wheel paths remain gated by toolkit compatibility. CUDA skips the only published native FlagGems C++ wheel because it fails to load with the CI PyTorch 2.10 ABI; it also disables FlagTree's optional TLE distributed loader on CUDA 13.0, since the library that loader discovers requires libcudart.so.12. MUSA stays on its previously running image until the runner driver and image delivery can support MUSA 5.2.
Change Type
Platforms Affected
Problem Analysis
What was broken/missing?
The one-hour integration budget was consumed largely by environment setup rather than tests. The GCU job in run 35949082553 took about 55 minutes to prepare, then ran tests for about two minutes before cancellation.
Why did it happen?
The first FlagGems Git clone ran from 06:08:03 to 06:26:59 and failed with an HTTP/2 error. Its retry ran from 06:27:11 to 06:48:04, consuming about 40 minutes in total. Other platform scripts also cloned FlagGems. Published Python wheels remove those clone steps; the unavailable compatible CUDA native wheel is handled by disabling that optional C++ route.
Investigation process:
Solution Design
Implementation approach:
Install exact binary versions from the appropriate FlagOS index using
--only-binary=:all:and--no-deps, retaining isolated CPU PyTorch environments. Check the installed FlagGems version and importability. Use the matching DCU FlagCX wheel; keep CUDA, MetaX, GCU, and MUSA FlagCX installation conditional on compatible image/toolkit upgrades.Key design decisions:
libtriton_jit.sowith an undefined PyTorch C++ symbol, while the Python FlagGems wheel remains usable.USE_TLE_DIST=0. The CUDA job has no compatible FlagCX wheel, yet FlagTree discovers alibflagcx.sothat requireslibcudart.so.12; importing FlagGems would otherwise fail before tests run. Preserve the gate across CI steps and smoke-test the TLE import during setup.libtorch_npu.so, which the intentionally torch_npu-free environment does not have. No compatible PPU FlagCX wheel was found. Both platforms still receive FlagTree and FlagGems wheels.Code changes by file:
.github/version-pins.env: Pin FlagGems 5.4.0, seven FlagTree RC builds, and available FlagCX variants..github/scripts/lib/set_env_common.sh: Replace VCS installation with checked, binary-only wheel installation..github/scripts/set_env_ascend.sh: Install published Ascend FlagTree and FlagGems wheels and matching runtime dependencies..github/scripts/set_env_cuda.sh: Install the published Python FlagGems wheel, disable the incompatible native C++ route on bootstrap and the CUDA 12-linked TLE distributed loader on CUDA 13.0, and prepare CUDA 13.3 FlagCX behind a toolkit check..github/scripts/set_env_dcu.sh: Install published Hygon FlagTree, FlagGems, and DTK FlagCX wheels, reusing valid preinstalled versions; persist the autoload gate across CI steps..github/scripts/set_env_gcu.sh: Install Enflame wheels and prepare FlagCX for a future TOPS 1.9.10 image, including its autoload gate..github/scripts/set_env_metax.sh: Install MetaX wheels and prepare the isolated venv and FlagCX path for a future MACA 3.8.1.3 image, including its autoload gate..github/scripts/set_env_musa.sh: Install MThreads FlagTree and FlagGems wheels; keep MUSA 5.2 FlagCX as an explicit opt-in for a matching future image/driver..github/scripts/set_env_ppu.sh: Install published PPU FlagTree and FlagGems wheels through the runner's direct route.tests/integration/ops/test_dtype_route_fallback.py: Ignore only the known Ascend FlagTree startup warning in the subprocess-output assertion.tests/integration/test_compute_device_index.py: Use exactly representable addmm inputs so this device-guard test does not fail on normal vendor matmul rounding..github/configs/ascend.yml: Update the expected FlagTree release..github/configs/cuda.yml: Update the expected FlagTree release..github/configs/musa.yml: Pin the previously running MUSA 5.1 image by digest until a 5.2 runner upgrade is ready..github/configs/ppu.yml: Update the expected FlagTree release..github/workflows/agnostic-checks.yml: Included from the prerequisite ci: share the set_env_* helper functions in one library #417 helper refactor; unchanged by the wheel migration commit..github/workflows/integration-test-cuda.yml: Correct the setup comment after removing the native source build..github/workflows/integration-test-musa.yml: Use the same pinned MUSA 5.1 image as the platform config.pyproject.toml: Document the published, vendor-specific FlagCX distribution.tests/unit/test_ci_version_pins.py: Enforce shared wheel pins rather than source revisions.tests/unit/test_set_env_common.py: Keep the CUDA interpreter override contract check valid as calls change.Changes by commit:
cafd32f-ci: share the set_env_* helper functions in one library: prerequisite from ci: share the set_env_* helper functions in one library #417.8f25bed-ci: install published FlagOS wheels across accelerator jobs: binary wheel and toolchain changes in this PR.5176d84-fix: handle FlagCX autoload and Ascend wheel warning in CI: repair two failures found in the first PR CI run.76bb7e2-fix: persist FlagCX autoload gate across CI steps: prevent the isolated wheel build backend from auto-importing FlagCX on DCU and MUSA.a540ce0-fix: keep CI on compatible wheel and image paths: avoid the CUDA C++ ABI mismatch, make MetaX's device-guard assertion numerically stable, and defer the MUSA 5.2 image until its host driver and pull time are addressed.bc0278d-fix: gate FlagTree TLE distributed loader on CUDA 13.0: prevent FlagTree from loading a CUDA 12-linked FlagCX library in the CUDA 13.0 CI environment.Verification
Pre-submission Checklist
ruff check .,ruff format --check .)torchon this macOS host)Linting Results
Test Results
Manual Verification
Performance Impact
Environment setup timing
The published Enflame FlagGems wheel is about 9.4 MB. The measured GCU improvement is from separate CI runs on shared hardware, so network and runner variation can affect it.
Code Quality Verification
Style Consistency
pip_retryand setup libraryEdge Cases Considered
--no-deps, preserve CPU PyTorch isolation, and gate incompatible FlagCX wheels by toolkit/image.--only-binary=:all:fails rather than falling back to a source build.Potential Risks
Rollback Plan
Revert the wheel-migration and follow-up commits starting at
8f25bedif the remaining CI paths cannot be made compatible; leave prerequisite #417 independent.Related Work
Explicitly Not Included
Human Review Notes
Areas needing special attention:
/flagosupgrade path.Questions for reviewer:
Additional Context
The local environment lacks
torch, so full unit and integration collection could not complete here. The measured GCU setup improvement and chip job results are linked above; the latest commit needs another CI run.