[XPU] [CI] Add comprehensive tests for refactored get_padding_offset kernel#1
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
Conversation
Adds test_get_padding_offset_refactor.py with 23 test cases validating the single-kernel refactor (PR PaddlePaddle#7029). Tests include: - Basic case matching the commit's test data - Edge cases: single batch, single token, max_len=1, zero tokens - All sequences at full length (no padding) - All sequences at length 1 (maximum padding) - Mixed/identical/increasing/decreasing sequence lengths - Large batch size (bs=64) - Large int64 token values - Equivalence with old two-kernel implementation (50 random configs) - Property-based invariants (output lengths, monotonicity, value ranges) Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
PR PaddlePaddle#7029 refactored
get_padding_offsetfrom two separate XPU kernels into a single kernel. The existing test only covers one basic scenario (seq_lens=[4,3,6], max_len=10). This PR adds comprehensive test coverage to verify correctness across edge cases and confirm behavioral equivalence with the old implementation.Modifications
Added
tests/operators/test_get_padding_offset_refactor.pywith 23 test cases:Core algorithm tests:
Equivalence verification:
Property-based invariant tests:
Usage or Command
Accuracy Tests
All 23 tests pass locally. The tests validate that:
x_remove_padding,cum_offsets_out,cu_seqlens_q,cu_seqlens_kas the old two-kernel implementationbatch_id_per_tokenoutput correctly stores batch indices (replacing the oldpadding_offsetwhich stored cumulative offsets)Checklist
pre-commitbefore commit.releasebranch, make sure the PR has been submitted to thedevelopbranch. (N/A - targeting develop)Link to Devin session: https://app.devin.ai/sessions/0a98367efe304de197b296c0940bb3d4
Requested by: @ShaneGZhu