Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions include/cudnn_frontend/node/scaled_dot_product_flash_attention.h
Original file line number Diff line number Diff line change
Expand Up @@ -1722,6 +1722,11 @@ class CompositeSDPABackwardNode : public NodeCRTP<CompositeSDPABackwardNode> {
sub_nodes.emplace_back(node_);
}

// last_output = last_output - stats
last_output = pointwise(last_output,
attributes.inputs[input_names::Stats],
Pointwise_attributes().set_name("sub_s_m").set_mode(PointwiseMode_t::SUB));

// (optional) Apply padding mask
if (attributes.padding_mask) {
auto graph_ = std::make_shared<Graph>();
Expand All @@ -1734,11 +1739,6 @@ class CompositeSDPABackwardNode : public NodeCRTP<CompositeSDPABackwardNode> {
sub_nodes.emplace_back(node_);
}

// last_output = last_output - stats
last_output = pointwise(last_output,
attributes.inputs[input_names::Stats],
Pointwise_attributes().set_name("sub_s_m").set_mode(PointwiseMode_t::SUB));

// Explicitly put the padding value again after the stats have been loaded
if (attributes.padding_mask && detail::get_backend_version() >= 90000 &&
detail::get_backend_version() < 91000) {
Expand Down
2 changes: 1 addition & 1 deletion test/python/test_mhas_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ def test_sdpa_random_bwd_ragged_L0(env_info, test_no, request, cudnn_handle):
with RandomizationContext(
batches=RandomBatchSize(min=8, max=16),
s_q_s_kv = RandomSequenceLength(s_q_min=1, s_q_max=4096, s_kv_min=1, s_kv_max=4096, s_q_distribution={"s_q=1":0, "s_q=s_kv":5, "s_q=random":10}),
d_qk_d_v=RandomHiddenDimSize(d_qk_min=1, d_qk_max=192, d_v_min=1, d_v_max=128, head_dim_distribution={"d_qk=d_v":5, "d_qk=random":1}, with_high_probability=[(64,64), (128,128), (192,128)]),
d_qk_d_v=RandomHiddenDimSize(d_qk_min=1, d_qk_max=192, d_v_min=1, d_v_max=128, head_dim_distribution={"d_qk=d_v":5, "d_qk=random":1}, with_high_probability=[(64,64), (128,128), (192,128), (256,256)]),
head_count=RandomHeadGenerator(min=1, max=8, head_group_options=(1, 4, 1)),
data_type=RandomChoice({torch.float16 : 1, torch.bfloat16 : 2}),
with_sliding_mask=SlidingWindowMaskGenerator(causal=10, left_window_only=5, right_window_only=5, band_around_diag=10, no_mask=10),
Expand Down