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
I am wondering if we could get a native backend to roll/shuffle information along a single axis for a tensor. This can already kinda be done in triton using the associative scan (credit to srush), with the example below.
Before Roll
exp=tensor([1.0000, 1.5000, 0.8000, 2.0000], device='cuda:0')
vals=tensor([ 1.0000, -1.0000, 0.5000, 2.0000], device='cuda:0')
After Roll
out_exp1=tensor([0.0000, 1.0000, 1.5000, 0.8000], device='cuda:0')
out_vals1=tensor([ 0.0000, 1.0000, -1.0000, 0.5000], device='cuda:0')
Using an associative scan for this is completely unnecessary and could be done with shared mem/ native warp shuffle operations.
The benefit of this operator is for the backward pass in Mamba and many different RNNs which need to shift hidden states to multiply with the gradients. IMO this would be one of the major limiting factors from having Mamba1's implementation in pure triton, other than indexing.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am wondering if we could get a native backend to roll/shuffle information along a single axis for a tensor. This can already kinda be done in triton using the associative scan (credit to srush), with the example below.
Output:
Using an associative scan for this is completely unnecessary and could be done with shared mem/ native warp shuffle operations.
The benefit of this operator is for the backward pass in Mamba and many different RNNs which need to shift hidden states to multiply with the gradients. IMO this would be one of the major limiting factors from having Mamba1's implementation in pure triton, other than indexing.
Beta Was this translation helpful? Give feedback.
All reactions