Make sinusoidal position embeddings compileable (#49482)
* Make sinusoidal position embeddings compileable
`SinusoidalPositionalEmbedding` grows its weight table when the sequence
outgrows it. With a compileable cache, `past_key_values_length` comes
from `Cache.get_seq_length()`, which returns `cumulative_length` as a
tensor, so `max_pos` is a tensor too and the growth check turns into
data-dependent branching on the very first decoding step.
The growth itself cannot run inside a graph either, since `make_weights`
replaces the `self.weights` buffer. Skip the check in exactly the case
where it cannot be traced and leave it in place everywhere else, so
eager and the non-compileable caches keep growing the table as before.
`m2m_100` carried a stale `_can_compile_fullgraph = False` whose comment
pointed at exactly this control flow. Flip it to `True` and mark `xglm`
as well, which enables the existing compile and export tests for both.
`nllb_moe` keeps the flag off, since its expert routing loops over
`expert_hit` and is a separate obstacle.
The same block is duplicated across `xglm`, `nllb_moe`, `kosmos2`,
`kosmos2_5`, `seamless_m4t` and `seamless_m4t_v2` through
`# Copied from`, so all of them are updated.
* Enable fullgraph compile for kosmos2_5 and cover eager growth with a compileable cache
* Explain why both conditions are needed in the growth guard