Repository navigation
Conversation
Merging two dims read both sizes at the default dim-size device (CPU), which under static tracing is a device-to-host copy (copy_to_device raises, illegal under CUDA graph capture). Now the sizes are read on the device of the mask then. Eager is unchanged.
Two nested states, each a bounded per-hypothesis history dim and a KV tensor over it: masked lengths, the masked KV refers to the merged dim, and under static tracing on CUDA the lengths stay on the device and the capacity is kept. Same check for an ordinary eager CPU caller.
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.
For #2014.
rf.nested.mask_nestedmerging two dims read both sizes at the default dim-size device (CPU).Under static tracing that is a device-to-host copy, which
copy_to_devicerejects(illegal under CUDA graph capture).
Now the sizes are read on the device of the mask then; the capacity of the merged dim is kept as before.
Eager is unchanged.
Hit in the beam search under static tracing: the per-hypothesis KV history dims are merged by
mask_nested.Tests in
tests/test_rf_array.py, both on two nested states, each a bounded per-hypothesis history dimand a KV tensor over it (masked lengths, the masked KV refers to the merged dim):
test_mask_nested_kv_states_static_traceable_cuda(CUDA only, skipped in CI):under static tracing, the lengths stay on the device and the capacity is kept.
test_mask_nested_kv_states_eager_cpu: an ordinary eager CPU caller.RZ H100, torch 2.12: both pass, together with the existing
mask_nestedtest.On master the CUDA one fails with
copy_to_device: device-to-host copy of Tensor{'a', ['batch'(3)], dtype='int32'} under static traceable,the CPU one passes (unchanged behavior).