Skip to content

cuda: declare //cuda:toolchain_type and keep the toolchain hub private - #14521

Merged
TrapsterDK merged 5 commits into
mainfrom
cloud/14447
Nov 21, 2026
Merged

TrapsterDK merged 5 commits into
mainfrom
cloud/14447

Conversation

@TrapsterDK

@TrapsterDK TrapsterDK commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #14447

  • toolchain_type is declared in //cuda. The hub toolchains, cuda/private/toolchain/toolkit_check.bzl and patches/rules_cuda/toolchain_type_alias.patch all point at //cuda:toolchain_type. The hub package default visibility is now //:__subpackages__.
  • //cuda loads no rules_cuda file. cuda/BUILD.bazel now loads cuda_component_library from //cuda/private:components.bzl instead of defs.bzl, so cublas, cufft and curand stay real targets in //cuda with no aliases. That path used to reach rules_cuda only through CudaToolkitInfo in check.bzl, so cuda_toolkit_check moves to cuda/private/toolchain/toolkit_check.bzl. bazel query 'buildfiles(//cuda:toolchain_type)' lists no @rules_cuda file. Its external repos (rules_cc, bazel_features, bazel_skylib, dx_pins_data) are already in every tools/testing/consumer/cold_start/*.txt list.
  • api/labels.txt and docs/supported-surface.md were regenerated with bazel run //tools/api:update; they only add //cuda:toolchain_type.
  • Fixed the constant-glob lint in cuda/private/toolchain/BUILD.bazel.
  • pr-check.yml: the affected-test plan used to expand //patches/rules_cuda:coverage_keep_test and //cuda/tests:msvc_device_link_flags_test into @rules_cuda//... labels. dx test rejects those (invalid_scope). The plan query now drops @repo labels and keeps each main-repo test_suite whose own tests list names an @ label (attr(tests, "@", $u)). That needs no transitive closure. tools/ci/pr_check_test.rs checks it.

Tested: //cuda/tests:all (the non-GPU, non-MSVC tests pass), //tools/testing:toolchain_gate_test, //tools/api:api_test, //tools/ci:workflow_files_test and //tools/ci:actionlint_test passed. tools/dx test //patches/rules_cuda:coverage_keep_test passed (3 tests). I ran the new plan query on //lua/... //cuda/... //patches/... and it succeeded. It returns 119 labels, including both suites, and no @ label. tools/dx check --apply reports no findings on the touched files.

Guard tests: //tools/ci:zero_compat_test, rule_set_loads_test, unreferenced_files_test, starlark_docs_test, hub_literals_test and prose_rules_test fail on main 8c9c770. With this branch their logs report exactly the same problems as on main, so the branch adds none. //tools/testing:language_skeleton_test also fails on main. With this change it no longer reports private-visibility cuda/private/toolchain/hub. It still reports register-label cuda/private/toolchain/hub, because MODULE.bazel still registers a // label, and this PR leaves that as it is.

Evidence: https://github.com/devhusdk/rules_dx/actions/runs/44914285313 ran //tools/testing/consumer:cold_start_test on linux_x86_64. No measured cold-start list fetches rules_cuda. The test fails on main drift that this PR doesn't touch. go, java and rust newly fetch rules_dx++scala_config+dx_scala_toolchains (from #14441). go also newly fetches rules_dx++dx_prebuilt+dx_prebuilt. go and rust no longer fetch rules_proto+.

Other checks that fail on main 8c9c770 without this change:

  • analysis: the dx_crates lockfile is out of date.
  • gazelle tests: julia, ocaml and csharp.
  • Android kotlin_screen_kotlinc_* tests.
  • core/modules tests: consumer_deps_test, versions_contract and loaders_test, plus //config:workspace_policy.
  • //elixir/tests/conformance:coverage_test.
  • docs and IDE tests: dx_docs_typescript_extract_test and lsp_headless_rust_analyzer_test.
  • consumer and nested tests: root_module_test, dx_nested_test and module_extension_srcs_test.
  • the remaining //tools/ci guard tests.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xut2hxC83WkoJY8GRaHfFk

cuda/BUILD.bazel now loads no rules_cuda .bzl file: the cublas, cufft and
curand component libraries move to //cuda/private and stay public as
aliases. The CUDA toolchain_type moves from the hub to //cuda, the hub,
check.bzl and the rules_cuda alias patch point at it, and the hub
package is no longer public.

Closes #14447

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copy link
Copy Markdown
Collaborator Author

/evidence platforms=["linux_x86_64"] task=test scope=//tools/testing/consumer:cold_start_test


Generated by Claude Code

@github-actions

Copy link
Copy Markdown
Contributor

Evidence started on cloud/14447: https://github.com/devhusdk/rules_dx/actions/runs/44914285313

Copy link
Copy Markdown
Collaborator Author

The analysis failure is not from this PR. The dx_crates lockfile is out of date on main. Running bazel mod show_repo --lockfile_mode=error --repo_env=CARGO_BAZEL_DIGEST_CHECK=1 @crates @dx_quality_crates @dx_thrift_crates on main 8c9c770, without this change, fails the same way, with the same digests (current 7440405e…, expected 56870eb4…). This PR touches no Cargo or crate files.


Generated by Claude Code

@TrapsterDK
TrapsterDK marked this pull request as ready for review November 21, 2026 16:01
@TrapsterDK TrapsterDK added the train Tested; land via merge train label Nov 21, 2026 — with Claude

Copy link
Copy Markdown
Collaborator Author

affected tests (linux_x86_64, shard 15) fails in //gazelle/julia:stdlib_test, //gazelle/ocaml:ocaml_test and //gazelle/csharp:generation_test. These failures are not from this PR. All three fail on main 8c9c770 without this change: bazel test //gazelle/julia:stdlib_test //gazelle/ocaml:ocaml_test //gazelle/csharp:generation_test gives 3 failed. This PR touches no gazelle files.


Generated by Claude Code

…fected plan

tests() expands //patches/rules_cuda:coverage_keep_test and
//cuda/tests:msvc_device_link_flags_test into @rules_cuda labels, and dx
test rejects labels outside the main workspace, so the shard holding
them failed with invalid_scope. The plan query now drops @repo labels
and keeps the main-workspace suite that reaches them.

Part of #14447

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copy link
Copy Markdown
Collaborator Author

affected tests (linux_x86_64, shard 0) on af8b571 fails in //android/tests/fixtures/android_library:kotlin_screen_kotlinc_with_sdk and :kotlin_screen_kotlinc_without_sdk. These failures are not from this PR. Both fail on main 8c9c770 without this change. This PR touches no Android files.


Generated by Claude Code

rdeps() preloads the transitive closure of every main-workspace
test_suite, and on a widened plan that closure reaches a target that
does not load, so the plan query failed. attr(tests, "@", $u) reads
each suite's own tests list and needs no closure.

Part of #14447

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copy link
Copy Markdown
Collaborator Author

affected tests (linux_x86_64, shard 4) on 9707d07 fails in //config:workspace_policy, //core/modules/tests:loaders_test, //core/modules:consumer_deps_test and //core/modules:versions_contract. These failures are not from this PR. bazel test of all four fails on main 8c9c770 without this change: 4 failed, including every_bazel_dep_has_a_floor_comment_and_is_newest, every_nested_lock_has_the_root_registry_deps and every_non_dev_bazel_dep_has_a_consumer.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

affected tests (linux_x86_64, shard 25) on 9707d07 has 8 failures. None are from this PR:

  • These five fail on main 8c9c770 without this change: //tools/docs/typescript/extract:dx_docs_typescript_extract_test, //tools/ide:lsp_headless_rust_analyzer_test, //tools/testing/consumer:root_module_test, //tools/testing/nested:dx_nested_test and //tools/testing:module_extension_srcs_test.
  • //tools/testing/consumer:apple_consumer_test and :dart_consumer_test fail the same way in pr-check run 44904228264, a different PR.
  • //tools/testing:language_skeleton_test fails on main. With this PR it no longer reports private-visibility cuda/private/toolchain/hub.

Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

affected tests (linux_x86_64, shard 13) on 9707d07 fails in //elixir/tests/conformance:coverage_test. This failure is not from this PR. The test fails on main 8c9c770 without this change, and this PR touches no Elixir files.


Generated by Claude Code

…out of check.bzl

The aliases added an in-module alias that zero_compat_test rejects.
cuda/BUILD.bazel now loads cuda_component_library from components.bzl
and keeps the real cublas, cufft and curand targets. The only rules_cuda
load on that path was CudaToolkitInfo in check.bzl, so cuda_toolkit_check
moves to toolkit_check.bzl and //cuda loads no rules_cuda file.

Part of #14447

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copy link
Copy Markdown
Collaborator Author

Shards 19, 11 and 22 on 9707d07 fail on main 8c9c770 without this change. These failures are not from this PR:

Shard 15 is the gazelle failure from my earlier comment. The zero_compat_test alias finding from shard 24 was from this PR. 4b8a173 fixes it: cuda/BUILD.bazel keeps the real component targets and no longer has aliases.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

affected tests (linux_x86_64, shard 24) on 4b8a173 fails in 16 //tools/ci guard tests, //tools/docs/ir/ir:site_shard_test and //tools/docs/languages:languages_test. All 18 fail on main 8c9c770 without this change. For the guard tests that could see this PR's files (zero_compat_test, rule_set_loads_test, unreferenced_files_test, starlark_docs_test, hub_literals_test and prose_rules_test), I compared this branch's test logs with main's. They report the same problems, so the branch adds none. The cuda/BUILD.bazel alias finding is gone.


Generated by Claude Code

pr-check.yml takes main's $t intersect //... plan query; pr_check_test asserts it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xut2hw4aq9a55MtjjUhEzN
@TrapsterDK
TrapsterDK merged commit 0fccf18 into main Nov 21, 2026
4 checks passed
@TrapsterDK
TrapsterDK deleted the cloud/14447 branch November 21, 2026 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api train Tested; land via merge train

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cuda: declare //cuda:toolchain_type without loading rules_cuda, so cuda/private/toolchain/hub stops being public (follow-up of #10073)

2 participants