Skip to content

Conversation

Qin-sx
Copy link
Contributor

@Qin-sx Qin-sx commented Jun 10, 2025

PR Category

User Experience

PR Types

Bug fixes

Description

head_size的检查为head_size <= 256即可

#define CHECK_FWD_EXECTUABLE(__seqlen_q, __seqlen_k)                     \
      auto dprops = at::cuda::getCurrentDeviceProperties();              \
      const bool is_sm8x = dprops->major == 8 && dprops->minor >= 0;     \
      const bool is_sm90 = dprops->major == 9 && dprops->minor == 0;     \
      ASSERT_CHECK(is_sm8x || is_sm90);                                  \
      ASSERT_CHECK(batch_size > 0);                                      \
      ASSERT_CHECK(head_size % 8 == 0);                                  \
      ASSERT_CHECK(head_size <= 256);                                    \
      ASSERT_CHECK(num_heads % num_heads_k == 0);                        \
      if (attn_mask) {                                                   \
          ASSERT_CHECK(mask_dims[0] == batch_size);                      \
          ASSERT_CHECK(mask_dims[1] == 1 || mask_dims[1] == num_heads);  \
          ASSERT_CHECK(mask_dims[2] == 1 || mask_dims[2] == __seqlen_q); \
          ASSERT_CHECK(mask_dims[3] == __seqlen_k);                      \
      }

相关pr

	modified:   python/paddle/nn/functional/flash_attention.py
	modified:   test/legacy_test/test_scaled_dot_product_attention.py
Copy link

paddle-bot bot commented Jun 10, 2025

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (develop@917ecbd). Learn more about missing BASE report.

Additional details and impacted files
@@             Coverage Diff             @@
##             develop    #73240   +/-   ##
===========================================
  Coverage           ?   100.00%           
===========================================
  Files              ?         1           
  Lines              ?         1           
  Branches           ?         0           
===========================================
  Hits               ?         1           
  Misses             ?         0           
  Partials           ?         0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@paddle-bot paddle-bot bot added the contributor External developers label Jun 10, 2025
@@ -169,7 +169,7 @@ def test_dot_scale_product_float_mask(self):
)

with sdp_kernel(
enable_math=True, enable_flash=False, enable_mem_efficient=False
enable_math=None, enable_flash=None, enable_mem_efficient=None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议加一些自动后端选择的case,去掉with sdp_kernel,原来的case维持现状

	modified:   test/legacy_test/test_scaled_dot_product_attention.py
Copy link
Contributor

@zhwesky2010 zhwesky2010 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Qin-sx 原来的case不用动,只是额外再加一些case

@Qin-sx
Copy link
Contributor Author

Qin-sx commented Jun 12, 2025

@Qin-sx 原来的case不用动,只是额外再加一些case

嗯,收到,之前有个DCU报错,我想看一下是什么报错。现在加一下新的测试。

	modified:   test/legacy_test/test_scaled_dot_product_attention.py
Copy link
Contributor

@zhwesky2010 zhwesky2010 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zhwesky2010 zhwesky2010 merged commit cbe2fad into PaddlePaddle:develop Jun 16, 2025
48 of 50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants