Skip to content

Add DISABLE_TARGET_PROJECTS for architecture-independent targets - #6959

Draft
idubinov wants to merge 13 commits into
ROCm:mainfrom
idubinov:t_ADDSPV_disable_target_projects
Draft

Add DISABLE_TARGET_PROJECTS for architecture-independent targets#6959
idubinov wants to merge 13 commits into
ROCm:mainfrom
idubinov:t_ADDSPV_disable_target_projects

Conversation

@idubinov

Copy link
Copy Markdown

Stacked on #6843. This branch builds on the nightly-SPIR-V PR (#6843), so
until that merges the diff here also contains #6843's commits. Review only the
final commit ("Add DISABLE_TARGET_PROJECTS for architecture-independent
targets"); the rest belongs to #6843.

Problem

EXCLUDE_TARGET_PROJECTS only strips a gfx target from a project's GPU_TARGETS — the project still builds (host-only or via DEFAULT_GPU_TARGETS fallback). It cannot express "this project is meaningless for this target and must not build at all", which is exactly what the build-only amdgcnspirv (gpu-generic) target needs for per-arch device libraries. #6843 worked around this with an ad-hoc therock_project_has_no_targets helper that inspected the EXCLUDE list.

Change

Introduce DISABLE_TARGET_PROJECTS as a first-class primitive:

Keyword Effect Use when
EXCLUDE_TARGET_PROJECTS strip arch from GPU_TARGETS, project still builds kernels don't support the arch, host/API still ships
DISABLE_TARGET_PROJECTS project not declared/built for the arch project is meaningless for the arch by design
  • therock_add_amdgpu_target records DISABLE_TARGET_PROJECTS into THEROCK_AMDGPU_PROJECT_TARGET_DISABLES_<name>.
  • New helper therock_project_disabled replaces therock_project_has_no_targets (introduced in this PR chain, no external users); all gate call sites updated.
  • The amdgcnspirv project list is split: device libraries and their tests/providers/samples → DISABLE (fully skipped); core runtime/tools → EXCLUDE (build host-only). composable_kernel stays in EXCLUDE because its _ck_enabled gate reuses the EXCLUDE-based filter shared with partial-support gfx shards.

Behavior is preserved (the workaround and the primitive skip the same blocks under spirv), but the intent is now explicit and reusable for any future architecture-independent target.

Testing

  • python3 -m unittest build_tools.tests.cmake_amdgpu_targets_test — 11 pass (incl. new parser case for FAMILY terminating at DISABLE_TARGET_PROJECTS).
  • Standalone cmake -P harness exercising therock_add_amdgpu_target + therock_project_disabled — 6 semantic cases pass (device lib disabled under spirv; core-runtime not disabled; not disabled under gfx942; not disabled in mixed gfx942+spirv; not disabled in no-targets generic stage; unknown project not disabled).
  • rocWMMA remains in gfx900/gfx90c/gfx101X/gfx103X EXCLUDE (inner sample/test filter for partial-support shards unchanged).

See docs/10_disable_target_projects_plan.md.

🤖 Generated with Claude Code

idubinov and others added 13 commits July 24, 2026 05:00
Run black on new_amdgpu_family_matrix.py and add unit tests covering the
amdgcnspirv SPIR-V target: build-only/linux-only invariants in the family
matrix, and select_targets honoring the non-gfx 'amdgcnspirv' PR label.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The CI matrix (amdgpu_family_matrix.py / new_amdgpu_family_matrix.py)
emits the amdgcnspirv family as "gpu-generic", but the CMake target was
registered as FAMILY generic. The mismatch made THEROCK_DIST_AMDGPU_FAMILIES
validation fail ("value 'gpu-generic' unknown") and broke Python packaging
(expand_families). "generic" is also reserved for architecture-independent
host artifacts, so use gpu-generic consistently.

Also add gpu-generic to the amdgpu_family choice list in
test_linux_jax_wheels.yml so fetch_package_targets_test passes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Excluded per-arch projects (e.g. all of math-libs/ml-libs for the portable
amdgcnspirv target) previously fell back to an unrelated gfx arch, which then
failed either the project's own gfx allowlist at configure time (rocBLAS) or
the kpack splitter (no device objects matched the requested target). Add
therock_project_has_no_targets() and skip those projects outright, generalizing
the existing composable_kernel idiom.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The cpp-sdk-user smoke test find_package()s each ROCm math/ML library gated on
THEROCK_ENABLE_*. When a library is skipped for the current target (e.g. the
portable amdgcnspirv target), those flags are still ON but the package is not
installed, so the test fails to configure. Feed the example the actual built
status via therock_project_has_no_targets(), matching the existing hipTensor
handling.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
libhipcxx is header-only and produces no per-arch device code, so it builds
fine for amdgcnspirv and must stay available: hipthreads BUILD_DEPs it. Drop it
from the exclude list. hipthreads itself compiles per-arch device bitcode
(USE_TEST_AMDGPU_TARGETS), so it belongs in the exclusion and is now skipped
via the same gate.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The Python packaging job expands dist families to device targets and, under
KPACK_SPLIT_ARTIFACTS, requires a device artifact per target. Architecture-
independent targets (the gpu-generic family, e.g. amdgcnspirv) emit no per-arch
device code, so they have no device artifact and tripped the completeness check.
Filter gpu-generic family members out of the per-device target lists.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The PyTorch device build compiles CK kernels for every family in its matrix via
PYTORCH_ROCM_ARCH. The architecture-independent gpu-generic family (amdgcnspirv)
is not a valid device target and fails the compile (gfx-specific intrinsics).
Filter it out for all refs/platforms, alongside the per-ref unsupported set.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
EXCLUDE_TARGET_PROJECTS only strips a gfx target from a project's
GPU_TARGETS; the project still builds. It cannot express "this project is
meaningless for this target and must not build at all", which is exactly
what the build-only amdgcnspirv (gpu-generic) target needs for per-arch
device libraries.

Add DISABLE_TARGET_PROJECTS as a first-class primitive: projects listed
under it are not declared/built for the target. Replace the ad-hoc
therock_project_has_no_targets helper (which inspected the EXCLUDE list)
with therock_project_disabled, keyed off the new DISABLE metadata.

Split the amdgcnspirv project list: device libraries and their
tests/providers/samples move to DISABLE (fully skipped); core
runtime/tools stay in EXCLUDE (build host-only). composable_kernel stays
in EXCLUDE because its _ck_enabled gate reuses the EXCLUDE-based filter
shared with partial-support gfx shards.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@therock-pr-bot

therock-pr-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

✅ All Checks Passed — Ready for Review

Check Status Details
📝 PR Title/Description ✅ Pass
Forbidden Files ✅ Pass
🧪 Unit Test ✅ Pass
🔎 pre-commit ✅ Pass
🚫 Draft PR 🔜 To Be Enabled
🚩 Feature Flag 🔜 To Be Enabled
📊 Code Coverage 🔜 To Be Enabled
🤖 therock-pr-bot ✅ Pass

🎉 All checks passed! This PR is ready for review.

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

@therock-pr-bot

Copy link
Copy Markdown

🎉 All checks passed! This PR is ready for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: TODO

Development

Successfully merging this pull request may close these issues.

1 participant