Skip to content

Rename: simpler_setup.Tensor -> simpler_setup.TensorArg - #1741

Merged
ChaoWao merged 1 commit into
hw-native-sys:mainfrom
ChaoWao:rename-simpler-setup-tensor-arg
Aug 8, 2026
Merged

Rename: simpler_setup.Tensor -> simpler_setup.TensorArg#1741
ChaoWao merged 1 commit into
hw-native-sys:mainfrom
ChaoWao:rename-simpler-setup-tensor-arg

Conversation

@ChaoWao

@ChaoWao ChaoWao commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • simpler_setup.Tensor (the NamedTuple test-arg spec used by TaskArgsBuilder) and simpler.task_interface.Tensor (the wire-ABI struct Update: cut task args over to the self-describing Tensor wire ABI #1729 finished wiring up) name two unrelated public types the same thing in two importable namespaces — a violation of .claude/rules/codestyle.md rule 13 (public C++/Python types share one canonical name and semantics), flagged as a deferred follow-up in Update: cut task args over to the self-describing Tensor wire ABI #1729.
  • Update: cut task args over to the self-describing Tensor wire ABI #1729 landed with zero Python call sites on the ABI-side Tensor, so renaming the long-established, 119-call-site test-tooling type is the low-risk direction — a mechanical rename with no behavior change, rather than fighting the design docs' canonical name for the wire element.
  • Renamed the class in simpler_setup/scene_test.py, its export in simpler_setup/__init__.py, and every constructor/isinstance call site across examples/, tests/, plus prose references in docs/testing.md, docs/user/README.md, and .claude/rules/project-layout.md. docs/user/README.md's "one name to watch" caveat about the collision is removed since it no longer applies.

Test plan

  • ruff check / ruff format --check clean on simpler_setup/, examples/, tests/
  • pytest tests/ut — 1251 passed, 13 skipped, 0 failed
  • Live sim run through the renamed spec end-to-end: pytest examples/a2a3/tensormap_and_ringbuffer/vector_example/test_vector_example.py --platform a2a3sim — 1 passed
  • Broader --platform a2a3sim sweep across examples/a2a3 and examples/a5 (the sim-eligible subset) — all green

simpler_setup.Tensor (a NamedTuple test-arg spec used by TaskArgsBuilder)
and simpler.task_interface.Tensor (the wire-ABI struct PR hw-native-sys#1729 wired up)
now name two unrelated public types the same thing in two importable
namespaces, violating codestyle.md rule 13 (public C++/Python types share
one canonical name and semantics). hw-native-sys#1729 landed with zero Python call
sites on the ABI Tensor, so renaming the long-established, 119-call-site
test-tooling type is the low-risk direction: it is a mechanical rename
with no behavior change, versus fighting the design docs' canonical name
for the wire element.

Renamed the class in simpler_setup/scene_test.py, its export in
simpler_setup/__init__.py, and every constructor/isinstance call site
across examples/, tests/, and docs/testing.md, docs/user/README.md,
.claude/rules/project-layout.md. docs/user/README.md's "one name to
watch" caveat about the collision is removed since it no longer applies.

Verified: ruff check/format clean, pyut 1251 passed / 13 skipped / 0
failed, and a live a2a3sim run through TaskArgsBuilder/compute_golden
confirms the renamed spec still round-trips through the harness.
@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 126 files, which is 26 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3fc44cc4-3e61-4ba4-bccd-f1b3f8cb8ab5

📥 Commits

Reviewing files that changed from the base of the PR and between c9e5f3c and e51230c.

📒 Files selected for processing (126)
  • .claude/rules/project-layout.md
  • docs/testing.md
  • docs/user/README.md
  • examples/a2a3/tensormap_and_ringbuffer/benchmark_bgemm/test_benchmark_bgemm.py
  • examples/a2a3/tensormap_and_ringbuffer/merge_pipeline_barrier/test_merge_pipeline_barrier.py
  • examples/a2a3/tensormap_and_ringbuffer/paged_attention/test_paged_attention.py
  • examples/a2a3/tensormap_and_ringbuffer/paged_attention_manual_scope/test_paged_attention_manual_scope.py
  • examples/a2a3/tensormap_and_ringbuffer/paged_attention_ringbuffer/test_paged_attention_ringbuffer.py
  • examples/a2a3/tensormap_and_ringbuffer/paged_attention_unroll_manual_scope/test_paged_attention_unroll_manual_scope.py
  • examples/a2a3/tensormap_and_ringbuffer/prefetch_async_demo/test_prefetch_async_demo.py
  • examples/a2a3/tensormap_and_ringbuffer/scalar_data/test_scalar_data.py
  • examples/a2a3/tensormap_and_ringbuffer/vector_example/test_vector_example.py
  • examples/a5/tensormap_and_ringbuffer/bgemm/test_bgemm.py
  • examples/a5/tensormap_and_ringbuffer/merge_pipeline_barrier/test_merge_pipeline_barrier.py
  • examples/a5/tensormap_and_ringbuffer/paged_attention/test_paged_attention.py
  • examples/a5/tensormap_and_ringbuffer/paged_attention_manual_scope/test_paged_attention_manual_scope.py
  • examples/a5/tensormap_and_ringbuffer/paged_attention_ringbuffer/test_paged_attention_ringbuffer.py
  • examples/a5/tensormap_and_ringbuffer/paged_attention_unroll_manual_scope/test_paged_attention_unroll_manual_scope.py
  • examples/a5/tensormap_and_ringbuffer/scalar_data/test_scalar_data.py
  • examples/a5/tensormap_and_ringbuffer/vector_example/test_vector_example.py
  • simpler_setup/__init__.py
  • simpler_setup/goldens/qwen3_14b_decode.py
  • simpler_setup/scene_test.py
  • tests/st/a2a3/host_build_graph/available_aicore_counts/test_available_aicore_counts.py
  • tests/st/a2a3/host_build_graph/bgemm/test_bgemm.py
  • tests/st/a2a3/host_build_graph/dfx/dep_gen/test_dep_gen.py
  • tests/st/a2a3/host_build_graph/dump_args/test_dump_args_example.py
  • tests/st/a2a3/host_build_graph/graph_execution/test_graph_execution.py
  • tests/st/a2a3/host_build_graph/graph_execution/test_graph_execution_aic_aiv.py
  • tests/st/a2a3/host_build_graph/graph_execution/test_graph_execution_mix_spmd.py
  • tests/st/a2a3/host_build_graph/matmul/test_matmul.py
  • tests/st/a2a3/host_build_graph/native_run_lifecycle/test_native_run_lifecycle.py
  • tests/st/a2a3/host_build_graph/paged_attention/test_paged_attention.py
  • tests/st/a2a3/host_build_graph/predicated_dispatch/test_predicated_dispatch.py
  • tests/st/a2a3/host_build_graph/prepared_callable/test_prepared_callable.py
  • tests/st/a2a3/host_build_graph/run_stream_reuse/test_run_stream_reuse.py
  • tests/st/a2a3/host_build_graph/vector_example/test_vector_example.py
  • tests/st/a2a3/tensormap_and_ringbuffer/alternating_matmul_add/test_alternating_matmul_add.py
  • tests/st/a2a3/tensormap_and_ringbuffer/available_aicore_counts/test_available_aicore_counts.py
  • tests/st/a2a3/tensormap_and_ringbuffer/batch_paged_attention/test_batch_paged_attention.py
  • tests/st/a2a3/tensormap_and_ringbuffer/dfx/args_dump/test_args_dump.py
  • tests/st/a2a3/tensormap_and_ringbuffer/dfx/chip_swimlane/test_chip_swimlane.py
  • tests/st/a2a3/tensormap_and_ringbuffer/dfx/chip_swimlane/test_chip_swimlane_mixed.py
  • tests/st/a2a3/tensormap_and_ringbuffer/dfx/chip_swimlane/test_sync_start_early_local_owner.py
  • tests/st/a2a3/tensormap_and_ringbuffer/dfx/dep_gen/test_dep_gen.py
  • tests/st/a2a3/tensormap_and_ringbuffer/dfx/dep_gen/test_dep_gen_chain.py
  • tests/st/a2a3/tensormap_and_ringbuffer/dfx/pmu/test_pmu.py
  • tests/st/a2a3/tensormap_and_ringbuffer/dfx/scope_stats/test_scope_stats.py
  • tests/st/a2a3/tensormap_and_ringbuffer/dummy_task/test_dummy_task.py
  • tests/st/a2a3/tensormap_and_ringbuffer/dynamic_register/test_dynamic_register.py
  • tests/st/a2a3/tensormap_and_ringbuffer/fanin_lookup_perf/test_fanin_lookup_perf.py
  • tests/st/a2a3/tensormap_and_ringbuffer/heap_empty_ring_rebase/test_heap_empty_ring_rebase.py
  • tests/st/a2a3/tensormap_and_ringbuffer/mixed_example/test_mixed_example.py
  • tests/st/a2a3/tensormap_and_ringbuffer/multi_round_paged_attention/test_multi_round_paged_attention.py
  • tests/st/a2a3/tensormap_and_ringbuffer/orch_so_cache/test_orch_so_cache.py
  • tests/st/a2a3/tensormap_and_ringbuffer/paged_attention_unroll/test_paged_attention_unroll.py
  • tests/st/a2a3/tensormap_and_ringbuffer/paged_attention_unroll_4dims/test_paged_attention_unroll_4dims.py
  • tests/st/a2a3/tensormap_and_ringbuffer/pipeline_slots/test_pipeline_slots.py
  • tests/st/a2a3/tensormap_and_ringbuffer/predicated_dispatch/test_predicated_dispatch.py
  • tests/st/a2a3/tensormap_and_ringbuffer/prepared_callable/test_prepared_callable.py
  • tests/st/a2a3/tensormap_and_ringbuffer/spmd_basic/test_spmd_basic.py
  • tests/st/a2a3/tensormap_and_ringbuffer/spmd_batch_dispatch_oob/test_spmd_batch_dispatch_oob.py
  • tests/st/a2a3/tensormap_and_ringbuffer/spmd_multiblock_aiv/test_spmd_multiblock_aiv.py
  • tests/st/a2a3/tensormap_and_ringbuffer/spmd_multiblock_mix/test_spmd_multiblock_mix.py
  • tests/st/a2a3/tensormap_and_ringbuffer/spmd_paged_attention/test_spmd_paged_attention.py
  • tests/st/a2a3/tensormap_and_ringbuffer/spmd_paged_attention_highperf/test_spmd_paged_attention_highperf.py
  • tests/st/a2a3/tensormap_and_ringbuffer/spmd_starvation/test_spmd_starvation.py
  • tests/st/a2a3/tensormap_and_ringbuffer/spmd_sync_start/test_spmd_sync_start.py
  • tests/st/a2a3/tensormap_and_ringbuffer/spmd_sync_start_aiv/test_spmd_sync_start_aiv.py
  • tests/st/a2a3/tensormap_and_ringbuffer/spmd_sync_start_early_dispatch/test_spmd_sync_start_early_dispatch.py
  • tests/st/a2a3/tensormap_and_ringbuffer/spmd_sync_start_edge/test_spmd_sync_start_edge.py
  • tests/st/a2a3/tensormap_and_ringbuffer/spmd_sync_start_mix_spill/test_spmd_sync_start_mix_spill.py
  • tests/st/a2a3/tensormap_and_ringbuffer/spmd_sync_start_stress/test_spmd_sync_start_stress.py
  • tests/st/a2a3/tensormap_and_ringbuffer/test_l3_dependency.py
  • tests/st/a2a3/tensormap_and_ringbuffer/test_l3_group.py
  • tests/st/a2a3/tensormap_and_ringbuffer/test_l3_launch_acceptance.py
  • tests/st/a5/host_build_graph/dump_args/test_dump_args_example.py
  • tests/st/a5/host_build_graph/paged_attention/test_paged_attention.py
  • tests/st/a5/host_build_graph/prepared_callable/test_prepared_callable.py
  • tests/st/a5/host_build_graph/vector_example/test_vector_example.py
  • tests/st/a5/tensormap_and_ringbuffer/alternating_matmul_add/test_alternating_matmul_add.py
  • tests/st/a5/tensormap_and_ringbuffer/available_aicore_counts/test_available_aicore_counts.py
  • tests/st/a5/tensormap_and_ringbuffer/batch_paged_attention/test_batch_paged_attention.py
  • tests/st/a5/tensormap_and_ringbuffer/dfx/args_dump/test_args_dump.py
  • tests/st/a5/tensormap_and_ringbuffer/dfx/chip_swimlane/test_chip_swimlane.py
  • tests/st/a5/tensormap_and_ringbuffer/dfx/chip_swimlane/test_chip_swimlane_mixed.py
  • tests/st/a5/tensormap_and_ringbuffer/dfx/chip_swimlane/test_sync_start_early_local_owner.py
  • tests/st/a5/tensormap_and_ringbuffer/dfx/dep_gen/test_dep_gen.py
  • tests/st/a5/tensormap_and_ringbuffer/dfx/dep_gen/test_dep_gen_chain.py
  • tests/st/a5/tensormap_and_ringbuffer/dfx/pmu/test_pmu.py
  • tests/st/a5/tensormap_and_ringbuffer/dfx/scope_stats/test_scope_stats.py
  • tests/st/a5/tensormap_and_ringbuffer/dummy_task/test_dummy_task.py
  • tests/st/a5/tensormap_and_ringbuffer/dynamic_register/test_dynamic_register.py
  • tests/st/a5/tensormap_and_ringbuffer/fanin_lookup_perf/test_fanin_lookup_perf.py
  • tests/st/a5/tensormap_and_ringbuffer/heap_empty_ring_rebase/test_heap_empty_ring_rebase.py
  • tests/st/a5/tensormap_and_ringbuffer/mixed_example/test_mixed_example.py
  • tests/st/a5/tensormap_and_ringbuffer/multi_round_paged_attention/test_multi_round_paged_attention.py
  • tests/st/a5/tensormap_and_ringbuffer/mx_fp_gemm/test_mx_fp_gemm.py
  • tests/st/a5/tensormap_and_ringbuffer/orch_so_cache/test_orch_so_cache.py
  • tests/st/a5/tensormap_and_ringbuffer/paged_attention_unroll/test_paged_attention_unroll.py
  • tests/st/a5/tensormap_and_ringbuffer/paged_attention_unroll_4dims/test_paged_attention_unroll_4dims.py
  • tests/st/a5/tensormap_and_ringbuffer/pipeline_slots/test_pipeline_slots.py
  • tests/st/a5/tensormap_and_ringbuffer/predicated_dispatch/test_predicated_dispatch.py
  • tests/st/a5/tensormap_and_ringbuffer/prepared_callable/test_prepared_callable.py
  • tests/st/a5/tensormap_and_ringbuffer/simt_basic/test_simt_basic.py
  • tests/st/a5/tensormap_and_ringbuffer/spmd_basic/test_spmd_basic.py
  • tests/st/a5/tensormap_and_ringbuffer/spmd_batch_dispatch_oob/test_spmd_batch_dispatch_oob.py
  • tests/st/a5/tensormap_and_ringbuffer/spmd_multiblock_aiv/test_spmd_multiblock_aiv.py
  • tests/st/a5/tensormap_and_ringbuffer/spmd_multiblock_mix/test_spmd_multiblock_mix.py
  • tests/st/a5/tensormap_and_ringbuffer/spmd_starvation/test_spmd_starvation.py
  • tests/st/a5/tensormap_and_ringbuffer/spmd_sync_start/test_spmd_sync_start.py
  • tests/st/a5/tensormap_and_ringbuffer/spmd_sync_start_aiv/test_spmd_sync_start_aiv.py
  • tests/st/a5/tensormap_and_ringbuffer/spmd_sync_start_early_dispatch/test_spmd_sync_start_early_dispatch.py
  • tests/st/a5/tensormap_and_ringbuffer/spmd_sync_start_edge/test_spmd_sync_start_edge.py
  • tests/st/a5/tensormap_and_ringbuffer/spmd_sync_start_mix_spill/test_spmd_sync_start_mix_spill.py
  • tests/st/a5/tensormap_and_ringbuffer/spmd_sync_start_stress/test_spmd_sync_start_stress.py
  • tests/st/a5/tensormap_and_ringbuffer/test_l3_dependency.py
  • tests/st/host_build_graph_wide_dispatch/test_host_build_graph_wide_dispatch.py
  • tests/st/worker/collectives/_helpers.py
  • tests/st/worker/collectives/all_to_all/test_all_to_all.py
  • tests/st/worker/collectives/allgather/test_allgather.py
  • tests/st/worker/collectives/broadcast/test_broadcast.py
  • tests/st/worker/collectives/group_reservation/test_group_reservation.py
  • tests/st/worker/collectives/reduce_scatter/test_reduce_scatter.py
  • tests/ut/py/test_scene_test_golden_hooks.py
  • tests/ut/py/test_scene_test_rehost.py

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ChaoWao
ChaoWao merged commit c518869 into hw-native-sys:main Aug 8, 2026
19 checks passed
@ChaoWao
ChaoWao deleted the rename-simpler-setup-tensor-arg branch August 8, 2026 00:55
ChaoWao added a commit that referenced this pull request Aug 8, 2026
PR #1729 (wire flip, merged aa1d7c7) deliberately deferred 6 cleanup
items to its own PR comments rather than growing an already 126-file
change. Item 6 (the simpler_setup.Tensor / simpler.task_interface.Tensor
naming collision) was closed separately by #1741. This closes 4 of the
remaining 5; the 5th needs a C++ signature change and is left for a
follow-up (see below).

MappedArg.buffer ignored the descriptor's access mode and always
returned a writable memoryview, including for FORK_COW backings, whose
whole contract is that a write is invisible to the owner (copy-on-write
splits the page privately). A callable that wrote through it lost data
silently. buffer now returns a read-only view (memoryview.toreadonly())
when access is AccessMode.READ. New test:
test_mapped_arg_buffer_is_read_only_for_a_read_access_descriptor
(fails on the old code, passes after the fix). Note: torch.frombuffer
does not itself honor a read-only memoryview -- it only warns and still
allows the write -- so this closes the contract at the buffer-protocol
layer; it does not stop a torch consumer from writing through its own
tensor view. Fixing that would need actually protecting the COW pages
(e.g. mprotect), out of scope here.

ImportRegistry.materialize_blob and .materialize_args each rebuilt a
snapshot of every identity the endpoint had ever materialized
(self._by_identity in full) on every dispatch, via a now-deleted
materialization_map() helper -- O(every buffer this chip child has ever
seen) instead of O(this task's own tensor count), on the chip and
L2-leaf dispatch path. Both callers only ever look up entries for
tensors they independently re-parsed from the same blob/TaskArgs, so no
entry outside the current call's own tensors was ever consulted. Both
methods now build their returned dict directly from their own loop.
New test: test_materialize_args_scopes_the_returned_map_to_this_calls_tensors,
asserting a second call's returned map does not carry a first call's
identity forward.

ImportRegistry.unregister had zero callers and zero test references
anywhere in the repo. The "import mapping released with handle
lifecycle" invariant it was meant to serve doesn't have a lifecycle to
attach to yet -- release_buffer() doesn't exist in this codebase.
Deleted rather than left as an untested stand-in for a feature that
isn't built.

tests/st/{a2a3,a5}/tensormap_and_ringbuffer/test_l3_host_buffer_registration.py
were still named after register_host_buffer, deleted long ago -- only
the filename was a leftover; the class name (TestPostForkHostBufferZeroCopy)
and docstrings already describe the current create_buffer + POSIX-shm
mechanism accurately. Renamed both arch siblings in this commit to
test_l3_post_fork_host_buffer.py. Also fixed a now-stale cross-reference
in .docs/l3l4/memory-kinds.md and flagged (but did not chase down) an
unrelated pre-existing gap it also pointed at: the ut test it names for
kind3 registration no longer exists in the repo.

Deferred to a follow-up PR: the chip task blob gets decoded twice on
every dispatch -- once by read_args_from_blob (to drive
ImportRegistry.materialize) and again by materialize_tensor_blob's own
C++ read_blob call, on the same bytes. Closing that needs
materialize_tensor_blob to accept the already-parsed view instead of
re-reading raw bytes, which is a signature change on
python/bindings/task_interface.cpp's hot dispatch path -- it deserves
its own PR with dedicated dispatch-latency verification rather than
riding along with these four independent one-line fixes.

Verified: pytest tests/ut 1281 passed / 13 skipped / 0 failed; ruff
check/format clean; a real a2a3 onboard run (test_l3_tensor_dispatch.py,
2 devices) exercising the changed chip-dispatch materialize path;
test_l3_post_fork_host_buffer.py passing under its own a2a3sim platform
restriction on both arch siblings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant