You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ExecuTorch CUDA graph replay stops replaying when buffers move and shapes change often #4991
With #4983 (not merged yet), the ExecuTorch TensorRT delegate can replay a CUDA graph directly on the caller's buffers. When the caller passes different buffer addresses on every call, the delegate notices that the buffers keep moving and switches to copying them through its own staging buffers.
That learned state is reset every time the input shapes change. So each new set of shapes takes about 3 graph recordings before the first replay, where main needs 1. If the shapes change every 3 or 4 calls, it never replays: in one run of 24 calls it recorded 16 to 18 times and replayed 0 times, where main recorded 6 to 8 times and replayed 8 to 12 times. The outputs stay correct; only the speed is affected.
In a small benchmark of the replay code, with a stub in place of the TensorRT engine, that pattern cost 55 to 63 microseconds per call, against 37 to 39 on main. Callers with fixed buffers are not affected. Callers with moving buffers but fixed shapes pay the 2 extra recordings once, at the start.
To Reproduce
Load a program with the TensorRT delegate and CUDA graph replay on.
Call it with freshly allocated input and output buffers on every call.
Change the input shapes every 3 or 4 calls.
Count graph recordings per call, or time the calls.
Expected behavior
Once the delegate has seen that a caller's buffers move, it keeps that knowledge across shape changes. Then only the first set of shapes pays the extra recordings.
Activity