[FlyDSL AOT] Skip kernels for unrequested arches when GPU_ARCHS is set#3321
Open
eppaneamd wants to merge 8 commits into
Open
[FlyDSL AOT] Skip kernels for unrequested arches when GPU_ARCHS is set#3321eppaneamd wants to merge 8 commits into
eppaneamd wants to merge 8 commits into
Conversation
Contributor
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR optimizes FlyDSL AOT compilation by honoring GPU_ARCHS (when explicitly set) to avoid compiling tuned kernels for architectures that won’t be used, reducing build time and work.
Changes:
- Added a
_job_arch(job)helper to derive a target arch from different FlyDSL AOT job shapes (cu_num-based vs explicit"arch"). - Updated
start_aot()to filter the collected AOT jobs againstGPU_ARCHS(excluding"native"), and emit a summary of skipped kernels.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+323
to
+341
| gpu_archs_env = os.environ.get("GPU_ARCHS", "").strip() | ||
| if gpu_archs_env and gpu_archs_env.lower() != "native": | ||
| from aiter.jit.utils.build_targets import _parse_gpu_archs_env | ||
|
|
||
| requested = set(_parse_gpu_archs_env(gpu_archs_env)) | ||
| before = len(all_jobs) | ||
| all_jobs = [ | ||
| (kind, job) | ||
| for kind, job in all_jobs | ||
| if (arch := _job_arch(job)) is None or arch in requested | ||
| ] | ||
| filtered = before - len(all_jobs) | ||
| if filtered: | ||
| print( | ||
| f"[aiter] FlyDSL AOT: GPU_ARCHS={gpu_archs_env!r} skipped" | ||
| f" {filtered} kernels for unrequested arches" | ||
| f" ({len(all_jobs)} remaining)" | ||
| ) | ||
|
|
Collaborator
|
@zhiding512 take a look? |
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
When
GPU_ARCHSis set to a specific arch at build time (e.g.gfx942), FlyDSL AOT previously compiled all kernels unconditionally, including hundreds of kernels tuned for other arches (that will not be used)._job_arch(job)helper that returns the target arch from any job dict (cu_num→cu_num_to_archfor GEMM/MoE; explicit"arch"field for CHUNK_GDN_H;Nonefor untuned/arch-agnostic jobs that must always compile).start_aot(), filterall_jobsagainstGPU_ARCHSafter collection. Uses_parse_gpu_archs_envfrombuild_targets.py(;-separated, consistent with the rest of the codebase). Import is deferred inside the branch to avoid triggeringaiter/__init__duringsetup.py's early import ofcommon.py.GPU_ARCHSunset or"native"preserves existing behaviour.Test plan
_job_archand filter logic: tuned GEMM/MoE, CHUNK_GDN_H explicit arch, untuned jobs, single arch, multi-arch (gfx942;gfx950), unset, andnative.mainwithGPU_ARCHS=gfx942: filter fires correctly, 2001 gfx950-only kernels skipped, build completes without errors.