Repository navigation
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
There was a problem hiding this comment.
🟡 Changes recommended
The torch-based fallbacks query device 0 rather than the selected device, potentially supplying incorrect architecture and compute-unit metadata.
2 open findings
What changed in this PR
Fixes metadata generation and broadens GPU detection and stream handling in the build and JIT infrastructure.
Changes:
- Skip kernel prebuilding during metadata-only setup commands.
- Add GPU architecture and compute-unit detection fallbacks.
- Accept generic
torch.Streamobjects when converting arguments.
| File | Description |
|---|---|
| setup.py | Guards prebuilding during metadata generation. |
| csrc/cpp_itfs/torch_utils.py | Converts generic torch streams to native handles. |
| aiter/jit/utils/chip_info.py | Adds architecture and compute-unit fallbacks. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🔵 Needs a closer look
Reported testing covers one environment; shared GPU detection and native-stream conversion still warrant human confirmation across supported configurations.
0 open findings
2 resolved since last review
🧠 Review effort: Balanced
- On Windows setup.py probes for ROCm through aiter/jit/utils/cpp_extension.py, which the test's copy lacks - Set AITER_TRITON_ONLY=1 for that subprocess on Windows only, which skips the probe - aiter_meta/ handling does not depend on it, and Linux still checks that egg_info never imports jit/
- Reading the current device added about 0.22 us to every get_gfx_runtime()/get_cu_num() call, even on uniform nodes - One arch from rocminfo/hipinfo, or AITER_AOT_REPLAY, now caches the arch once for the node - One CU count from rocminfo, or CU_NUM, now caches the CU count once for the node - Mixed nodes and the Torch fallback for empty or missing rocminfo stay per device - The CU check runs in the calling copy of chip_info, since the custom op's body may belong to the other copy - The check runs rocminfo, so a torch.compile trace skips it and keeps the per-device key - cache_clear() also drops the node-wide answers, which dry_run() relies on to swap in its target arch - gfx950, min of 5 x 200k calls: get_gfx_runtime 0.236 -> 0.015 us, get_cu_num 0.235 -> 0.014 us (base 0.016) - torch.compile(fullgraph=True) over get_cu_num() still compiles with eager and inductor, cold or warm - tests/test_chip_info_fallback.py adds a uniform node that stops reading the device after its first answer - It also adds a uniform-arch node with mixed CU counts, whose CU count must stay per device
DRAFT — evaluation pausedPR Self-ReviewRevision This pull request is a draft, so readiness evaluation is paused and no verdict applies. Evaluation resumes when it is marked ready for review and the required CI completes. |
- Resolve the chip_info.py conflict with ROCm#6767: _gpu_info_archs and _gfx_from_text use _GFX_ARCH_PATTERN. - Without it gfx1250-strict was detected as gfx1250 again, so _needs_arch_rebuild would loop on strict .so files. - Point main's strict-runtime test at _gpu_info_archs, which get_gfx_runtime now reads instead of _detect_native. - Clear the _gpu_info_archs cache in the strict-identity test, since _detect_native now reads it.
- The metadata-only change removed aiter_meta/ only after a run that staged it, so clean stopped clearing it. - An interrupted build leaves aiter_meta/ in the checkout; main cleared it on the next clean, which CI runs. - Remove it after a staging run or any run whose commands include clean; egg_info and dist_info still keep it. - tests/test_setup_metadata_only.py covers both: egg_info keeps an existing aiter_meta/, clean removes it.
There was a problem hiding this comment.
🔵 Needs a closer look
Shared architecture/CU caching changes affect runtime dispatch and JIT rebuild decisions, requiring GPU, torch.compile, and Windows validation that could not be independently performed in this source-only review.
No open issues 🎉
Review effort: Balanced
…ixed-arch nodes - _needs_arch_rebuild() asks for a rebuild only when the --offload-arch list the build passes covers the running arch - Without that, a mixed node's device 1 rebuilt for hipinfo's first arch and failed the reload with ModuleNotFoundError - get_build_targets() no longer pairs get_gfx() with the CU count of a device that runs another arch - On such a device it targets every CU count GFX_CU_NUMS_MAP lists for get_gfx(), as GPU_ARCHS would - get_asic_revision() is cached per arch, not once for the first device's arch - Tests mock a mixed gfx950/gfx942 node for all three; the opus AST loader also loads _asic_revision
- Remove aiter_meta/ after clean only when clean ran (dist.have_run), not when it is listed in dist.commands - `setup.py clean --help` lists clean but runs nothing, and used to delete a staged aiter_meta/
There was a problem hiding this comment.
🟡 Changes recommended
The architecture guard accepts a cached gfx950-only extension on a gfx942 GPU despite missing compatible device code; it must reject the extension with an actionable error, and tests must verify that rejection.
1 open issue
Review effort: Balanced
…running arch - _needs_arch_rebuild() warned and returned False, so get_module() loaded a .so without device code for the running GPU - That failed only at the first kernel launch; it now raises RuntimeError that names the GPU_ARCHS fix - Tests expect the error for an explicit GPU_ARCHS that misses the running arch and for Windows' native fallback
There was a problem hiding this comment.
🔵 Needs a closer look
Shared JIT and device-detection changes affect all operators, while gfx942 and Windows fallback behavior remain unverified and relevant owner review is still needed.
No open issues 🎉
1 resolved since last review
Review effort: Balanced
- The .so may have just been built with the current GPU_ARCHS, so "prebuilt" pointed at the wrong cause - The error now prints the .so path and the GPU_ARCHS value that would not rebuild for the running arch - The check stays at load time; the FlyDSL AOT dry run bypasses only _needs_arch_rebuild for cross-arch replay
- _is_metadata_only builds a setuptools Distribution, which reads pyproject.toml from the working directory - setuptools_scm then wrote aiter/_version.py into the checkout under test, which made validate-kernel-pr see a dirty tree - An autouse fixture chdirs each test into its tmp_path; all 26 tests pass and no file is left behind
|
gfx942 (MI300X) validation: all targets pass; INCONCLUSIVE only because an infra PR has no shape grid. chip_info returns the same arch/CU results as base in every mode that works on base, and falls back to gfx942 / 304 CUs where base crashes (missing or empty rocminfo). JIT builds from an empty cache target gfx942. New commits for gfx942: e525991 (clearer load error), eac690b (test isolation). |
There was a problem hiding this comment.
🔵 Needs a closer look
Shared architecture detection and all-op JIT/cache changes require chip_info/JIT owner review and targeted hardware validation, with Windows, gfx942, and real mixed-node behavior still unverified.
No open issues 🎉
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
Shared chip_info and JIT changes affect all ops and may initialize HIP during import, while owner review and validation on gfx942, Windows, and real mixed-device nodes remain outstanding.
No open issues 🎉
Review effort: Balanced
…cover the load-time guard - test_needs_arch_rebuild mocked the running arch but not GPU_ARCHS, which CI runners export as gfx950 - The guard added in this PR raises when GPU_ARCHS omits the running arch, so the test failed on every MI35X shard 4 run - Run its uncovered-arch cases under GPU_ARCHS=native, where a rebuild covers the running arch, as the test intends - Add a test for the guard: it raises naming the module, the .so path, the arch and GPU_ARCHS - The same test checks that a GPU_ARCHS with the arch, or native, rebuilds, and that an unusable one rebuilds - It also checks that a covered arch neither raises nor rebuilds, whatever GPU_ARCHS says - The file passes under GPU_ARCHS unset, gfx942, gfx950 and native; the new test fails with the guard disabled
- One conflict in setup.py: main added aiter.plugin to the package lists this branch splits by run type - Keep the metadata-only, develop and staged-aiter_meta branches and add aiter.plugin to the last two - The metadata-only branch stays at ["aiter"]: it records top-level names only, and its test runs on a one-package tree
- Preserve per-device CU cache clearing alongside upstream CDNA4 XCD-count validation.
…o PR CI runs them - git mv tests/test_chip_info_fallback.py and tests/test_setup_metadata_only.py to op_tests/ - split_tests.sh scans op_tests maxdepth 1; main's CI no longer runs tests/ except the plugin files - Both files compute the repo root as parents[1], which is unchanged
…est in aiter_test.sh - Both files are pytest-style with no __main__, so python3 <file> would exit 0 without running a case - Add them to the pytest-only case arm next to the other function-style op_tests
|
MI300X (gfx942) results, PR head
|
- build_ctypes_module now calls _needs_arch_rebuild after build_module, so a fresh build under a GPU_ARCHS - that omits the running arch raises at load, as the pybind path does through get_module(), not at first launch - Add a cold-cache test: the fake build covers gfx950 only, running gfx942 raises, running gfx950 returns the path - The test fails without the added call (checked on a /tmp copy) - Build the dummy module name from JIT_LIB_EXT and pin IS_WINDOWS to False in the arch guard tests - GPU_ARCHS=native is then not resolved through hipinfo; not verifiable on Windows here
…NELS=1 - Add egg_info and dist_info rows that export PREBUILD_KERNELS=1, so the METADATA_ONLY guard in setup.py is exercised - Without the guard both rows fail with No module named 'jit' (checked on a /tmp copy) - Create the dist_info output dir first, as setuptools rejects a missing one
…test - Satisfy ruff SIM905 for the key list added with the cold ctypes build case
…get_cu_num.cache_clear - aiter/jit/core.py imports chip_info as a top-level module, so the torch custom op may run a second copy of it - get_cu_num.cache_clear() cleared only the aiter.jit.utils copy, leaving the other copy's _device_cu_num stale - Clear both copies and add a test that fails without the change
…s whatever name the caller has - get_cu_num.cache_clear() now names chip_info and aiter.jit.utils.chip_info itself, plus the running module - A cache_clear() called on the top-level copy therefore also clears the packaged copy's cache


Summary
setup.py: metadata-only runs skip installs,aiter_meta/staging and kernel prebuildchip_info.py:get_gfx_runtime()andget_cu_num()answer per device, with a Torch fallbackjit/core.py: loading a.sowithout the running arch raises when a rebuild would not cover ittorch_to_c_typesfix that was here moved to [HIP] [Bugfix] Accept generic torch.Stream in torch_to_c_types #7101Motivation
mainPREBUILD_KERNELS=1 pip install .No module named 'jit'Would install amd-aiter-0.1.0setup.py egg_infoaiter_meta/it did not stageget_gfx_runtime()raises, though Torch sees the GPUget_cu_num()asserts.solacks running arch,GPU_ARCHSomits itGPU_ARCHS, fails laterRuntimeErrorat load, with a hintmain: pybind raisesModuleNotFoundErrorafter the rebuild; ctypes fails at the first launchChanges
setup.py_is_metadata_only()classifies the command line with setuptools' own parser--output-dir build) are never read as commands;clean --all bdist_wheelstill buildsBaseErrorfalls back toDistutilsError, so setuptools 45-58.x still loadsaiter_meta/is removed after a run that staged it, or aftercleanran (notclean --help)aiter/jit/utils/chip_info.py_gpu_info_archs()lists every arch rocminfo/hipinfo reports, keepinggfx1250-strictintactget_gfx(),CU_NUMunset,GPU_ARCHSnative or unset:get_build_targets()targets every CU countGFX_CU_NUMS_MAPlists forget_gfx()get_asic_revision()is cached per archaiter/jit/core.py_needs_arch_rebuild()rebuilds only when the--offload-archlist covers the running archRuntimeErrornaming the.sopath, the arch andGPU_ARCHS.soaiter/aot/flydsl/dry_run.py: pins_gpu_info_archsto the target arch, as it already pinned_detect_nativeop_tests/(moved fromtests/, sincemaindroppedpytest -q tests, [CI] Remove focused regression tests from aiter-test.yaml #8352)aiter_test.shruns them through pytest (no__main__);split_tests.shfinds themPerformance
main6fe1bfc on MI355X, ROCm 7.2.4; the table is not re-run at headmain)get_gfx_runtime(), uniform nodeget_cu_num(), uniform nodeCU_NUMe4201a913vsmain4ba20eba9b(MI355X, ROCm 10.0.0, two runs per side)get_gfx_runtime(): head 0.018 / 0.014 us,main0.016 / 0.016 usget_cu_num(): head 0.014 / 0.014 us,main0.016 / 0.015 usTesting
48123d97b5b075f8b6535602a7c48123d97btest_build_targets_architecture.pytest_jit_arch_guard.pytest_opus_co_profile.pytest_chip_info_fallback.pytest_setup_metadata_only.py.github/scripts/aiter_test.shDocumentation
Dependencies
Breaking Changes
get_gfx_runtime(),get_cu_num(),get_asic_revision()keep.cache_clear()cache_info()and__wrapped__; none is used in-tree or in SGLangimport aiterreads the arch through Torch, which initializes HIP in that process.sowithout the running arch under aGPU_ARCHSthat omits it now raisesRuntimeErrorGPU_ARCHSto include the running archnativealso works, except on a mixed-arch Windows node (it means the first arch hipinfo reports)PR Self-Review
Reviewed revision
48123d97be51df06df80290e5a95c5a22716b98eBehavior and intent
setup.pyruns no longer install, stage or prebuild; onlycleanremovesaiter_meta/GPU_ARCHShint, not at first launchValidation
554f219e9, MI355X (gfx950), ROCm 7.2.4; not re-run at headpytest -q tests op_tests/test_build_targets_architecture.pymainvalidate-kernel-prontest_build_targets_architecture.pyPREBUILD_KERNELS=1 pip install --no-build-isolation --no-deps --dry-run .Would install amd-aiter-0.1.0setup.py cleanwith a staleaiter_meta/10580d99c)setup.py egg_infopasses on setuptools 58.5.3 and 45.0.0test_switching_devices_switches_runtime_infotorch.compile(fullgraph=True)overget_cu_num()still compilesPREBUILD_KERNELS=0 python3 setup.py clean --all bdist_wheelon agit archivetree shipsaiter_meta/AITER_JIT_DIRbuilds and matches Torch; a reused JIT dir imports without a rebuild--checkreports 12 ok[OPUS]and[FlyDSL]come from one-line edits the chip_info change needstest_opus_co_profile.pyloads_asic_revision;dry_run.pypins_gpu_info_archs.github/instructions/aiter-ops-flydsl.instructions.mdexempts such one-line edits from "One Backend Per PR"Unverified
pip install --dry-runat head; MI300X cold-build and existing-cache smokeci:allfor thejit/core.pychange was not requestedjit/core.pyowner sign-off is pending (amd-ruitang3and the otherjit/core.pyowners)GPU_ARCHS=nativeon a mixed-arch nodemainGPU_ARCHSexplicitly theremainJIT_LIB_EXT/IS_WINDOWSpin in the guard tests was not run on WindowsPR-specific question
What changes in dependency, cache or compilation behavior,
and how did you verify a clean build and an existing cache?
setup_requiresfetch in legacypython setup.py egg_infois unchanged and out of scope_needs_arch_rebuild()rebuilds only whenGPU_ARCHScovers the running arch; otherwise it raises at loadChanged op tests
op_tests/test_build_targets_architecture.py_gpu_info_archs(the old ones would read the real tool)op_tests/test_jit_arch_guard.pytest_needs_arch_rebuildruns its uncovered-arch cases underGPU_ARCHS=native.sopath, arch andGPU_ARCHSnativeGPU_ARCHSrebuilds; a covered arch neither raises nor rebuildsbuild_ctypes_moduleop_tests/test_opus_co_profile.py: the AST loader also loads_asic_revisionop_tests/test_chip_info_fallback.py(new)get_asic_revision()cache_cleartest fails with the extra clear removedop_tests/test_setup_metadata_only.py(new): command classification andaiter_meta/handlingegg_infoanddist_infowithPREBUILD_KERNELS=1; both fail without thesetup.pyguard🤖 Generated with Claude Code