test: use .float() in in F.cosine_similarity() in bmm_fp8 test#2266
test: use .float() in in F.cosine_similarity() in bmm_fp8 test#2266bkryu merged 1 commit intoflashinfer-ai:mainfrom
Conversation
📝 WalkthroughWalkthroughA test file was modified to explicitly cast both reference and result tensors to float before computing cosine similarity. This ensures the comparison metric is calculated in floating-point precision rather than the tensors' original data types. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello @yongwww, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves intermittent test failures observed on Blackwell boards in the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
/bot run |
There was a problem hiding this comment.
Code Review
This pull request addresses test failures on Blackwell boards by casting the reference and res tensors to float32 before calculating cosine similarity in test_bmm_fp8.py. This is a robust solution to prevent precision loss when working with low-precision dtypes like bfloat16 and float16, especially when dealing with large tensors. The change is correct, well-justified, and improves the stability of the test suite. The code is clean and the change is minimal and well-targeted. I approve this change.
|
[FAILED] Pipeline #40763568: 9/20 passed |
📌 Description
saw some test failures on Blackwell boards after #2261, all the failed assertions are related to the large dim 10304.
Use
.float()to help reduce precision loss duringcosine_similarity(dot(x, y) / (||x|| * ||y||)) check.cc: @zihaoye @bkryu
🔍 Related Issues
🚀 Pull Request Checklist
Thank you for contributing to FlashInfer! Before we review your pull request, please make sure the following items are complete.
✅ Pre-commit Checks
pre-commitby runningpip install pre-commit(or used your preferred method).pre-commit install.pre-commit run --all-filesand fixed any reported issues.🧪 Tests
unittest, etc.).Reviewer Notes
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.