-
Notifications
You must be signed in to change notification settings - Fork 532
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2025-02-02 nightly release (0b2c24f)
- Loading branch information
pytorchbot
committed
Feb 2, 2025
1 parent
7f517ec
commit 61c52b6
Showing
9 changed files
with
69 additions
and
53 deletions.
There are no files selected for viewing
This file contains 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
Submodule cutlass
updated
1 files
+640 −4 | include/cutlass/epilogue/fusion/sm90_visitor_load_tma_warpspecialized.hpp |
This file contains 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
This file contains 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
52 changes: 52 additions & 0 deletions
52
fbgemm_gpu/fbgemm_gpu/sll/triton/triton_jagged_dense_elementwise_add.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
# pyre-unsafe | ||
|
||
import torch | ||
|
||
from fbgemm_gpu.triton.jagged.triton_jagged_tensor_ops import ( | ||
dense_to_jagged, | ||
jagged_to_dense, | ||
) | ||
|
||
|
||
class JaggedDenseAdd(torch.autograd.Function): | ||
@staticmethod | ||
# pyre-fixme | ||
def forward( | ||
ctx, x: torch.Tensor, x_offsets: torch.Tensor, y: torch.Tensor, max_seq_len: int | ||
): | ||
ctx.save_for_backward(x_offsets) | ||
ctx.max_seq_len = max_seq_len | ||
# TODO: what should be the correct behavior when jagged values has length > max seq len? | ||
# current behavior is to not truncate jagged values | ||
# similar for backward grad_output | ||
return dense_to_jagged( | ||
y, [x_offsets], operation_function="add", operation_jagged_values=x | ||
)[0] | ||
|
||
@staticmethod | ||
# pyre-fixme | ||
def backward(ctx, grad_output: torch.Tensor): | ||
(offsets,) = ctx.saved_tensors | ||
grad_dense = jagged_to_dense(grad_output, [offsets], [ctx.max_seq_len]) | ||
return grad_output, None, grad_dense, None | ||
|
||
|
||
def jagged_dense_elementwise_add( | ||
x: torch.Tensor, | ||
x_offsets: torch.Tensor, | ||
y: torch.Tensor, | ||
max_seq_len: int, | ||
use_fbgemm_kernel: bool = True, | ||
): | ||
if use_fbgemm_kernel: | ||
return torch.ops.fbgemm.jagged_dense_elementwise_add_jagged_output( | ||
x, [x_offsets], y | ||
)[0] | ||
else: | ||
return JaggedDenseAdd.apply(x, x_offsets, y, max_seq_len) |
File renamed without changes.
File renamed without changes.
This file contains 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
This file contains 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