Open
Conversation
Co-authored-by: Jiacheng Huang <huangjiacheng0709@outlook.com>
Collaborator
Author
|
请 @zhangyue207 初审,@Ziminli 终审。 |
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.
Summary
tests/conftest.pyso skip checks use concrete platform selectors from--deviceswhen they are provided.cuda, instead of probing every CUDA-like platform backend from Python..ciconfiguration.Motivation
Closes #75
The regression is caused by
skip_op_without_platform_implmapping one torch device type to every platform sharing that type. For example,cudawas expanded to NVIDIA, MetaX, and Iluvatar, so a test running on one active CUDA-like backend could still callactive_implementation_indices()for inactive sibling backends and abort in backend dispatch before pytest could skip the case.Type of Change
feat— new feature / new operator / new platformfix— bug fixperf— performance improvement (no behavioral change)refactor— code restructuring without behavior changetest— adding or fixing tests onlydocs— documentation onlybuild/ci— build system or CI configurationchore— tooling, formatting, or other non-code changes!in the Conventional Commits prefix or aBREAKING CHANGE:footer)Platforms Affected
WITH_CPU)WITH_NVIDIA)WITH_ILUVATAR)WITH_METAX)WITH_CAMBRICON)WITH_MOORE)WITH_ASCEND)WITH_TORCH)Test Results on Supported Platforms
pytestResult4151 passed, 1375 skipped in 280.52s (0:04:40)python -m pip install .[dev] && python -m pytest; no #75 crash keywords.5795 passed, 1447 skipped in 274.80s (0:04:34)python -m pip install .[dev] --no-build-isolation && python -m pytest; no #75 crash keywords.5795 passed, 1447 skipped in 341.72s (0:05:41)python -m pip install .[dev] --no-build-isolation && python -m pytest; no #75 crash keywords.12 failed, 3061 passed, 3857 skipped in 897.49s (0:14:57)tests/test_add.pyint16 generation failures fromRuntimeError: "random_" not implemented for 'Short'; no #75 crash keywords.300 failed, 5459 passed, 1483 skipped in 516.71s (0:08:36)MUSA_VISIBLE_DEVICES=6,python -m pip install .[dev] --no-build-isolation && python -m pytest; failures are concentrated intests/test_gemm.py; no #75 crash keywords.3828 passed, 138 skipped in 435.82s (0:07:15)python -m pip install .[dev] && python -m pytest; pytest summary completed, wrapper status wastest=137after summary; no #75 crash keywords.Validation details
Benchmark / Performance Impact
N/A. This change only affects pytest skip-selection logic and does not alter operator implementations or runtime kernels.
Notes for Reviewers
The important behavior is that Python no longer expands
cudainto all CUDA-like platform names before asking each operator for active implementations. If CI passes a concrete platform through--devices, that concrete platform is still used. If CI or a local run uses the torch device name, the selector is passed through to the pybind layer so it can resolve the backend compiled into the current wheel.Iluvatar and Moore now both have completed full pytest summaries. The earlier Moore hang was traced to the runner using
MTHREADS_VISIBLE_DEVICESwithoutMUSA_VISIBLE_DEVICES;torch_musaonly honoredMUSA_VISIBLE_DEVICESfor device visibility in this environment.Checklist
Title, Branch, and Commits
feat(nvidia): …,fix(cuda/gemm): …).<type>/xxx-yyyy-zzzzwhere<type>matches the PR title's Conventional Commits type and words are joined with hyphens (seeCONTRIBUTING.md§Branches).CONTRIBUTING.md§Pull Requests).master— the branch is rebased cleanly on top of the currentmaster.fixup!/squash!/wipcommits remain.Scope and Design
CONTRIBUTING.md§Code/General).printf/std::cout/print(...)left behind, orTODOwithout an owner and issue link.General Code Hygiene (applies to all languages)
CONTRIBUTING.md§Code/General).CONTRIBUTING.md§Code/General).the `seqlens_k` tensor) (CONTRIBUTING.md§Code/General).CONTRIBUTING.md§Code/General).CONTRIBUTING.md§Code/General; §Python).C++ Specific (if C++ files changed)
N/A — no C++ files changed.
Python Specific (if Python files changed)
ruff checkpasses cleanly on CI (see.github/workflows/ruff.yml).ruff format --checkpasses cleanly — if not, runruff formatand commit the result.CONTRIBUTING.md§Python).pytest.skipmessages without terminal period) are honored where applicable (CONTRIBUTING.md§Python).CONTRIBUTING.md§Python).if,for, and similar control-flow statements (CONTRIBUTING.md§Python).return, except when it directly follows a control-flow statement (CONTRIBUTING.md§Python).CONTRIBUTING.md§Python).Testing
pytestwas run locally on every supported platform that this PR can affect, and the results are recorded in the "Test Results" table above (CONTRIBUTING.md§Pull Requests).pytest.mark.parametrizecorrectly: dependent parameters share one decorator (e.g.@pytest.mark.parametrize("dtype, rtol, atol", …)), independent parameters use separate decorators ordered by parameter declaration.Payload-returning tests were added.dtype/deviceparameterization is relied on, or overridden with an explicitpytest.mark.parametrizewhen necessary.master; this PR fixes the test harness path without adding a new test file.Build, CI, and Tooling
pip install .[dev]on at least one affected platform.compile_commands.jsonregeneration was not required for this PR.ruffchecks passed locally.pyproject.toml's[project.optional-dependencies](or justified in the PR description).Documentation
Security and Safety