feat(backend): Add MaskPattern-based TSCATTER instruction and system tests#125
Closed
Crystal-wzy wants to merge 1 commit into
Closed
feat(backend): Add MaskPattern-based TSCATTER instruction and system tests#125Crystal-wzy wants to merge 1 commit into
Crystal-wzy wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the TSCATTER instruction across the common, cost model, and CPU implementations, along with comprehensive unit tests for masked scatter operations. The review feedback identifies a significant bug in the test logic where vector sizing and type handling for half-precision data are incorrect. Additionally, the reviewer pointed out potential memory access safety issues in the CPU implementation's indexing logic and a redundant pointer assignment in the test kernel.
b572c0e to
760ecc9
Compare
…tests Add a new TSCATTER overload that accepts a MaskPattern template parameter (P0101, P1010, P0001, P0010, P0100, P1000, P1111), mirroring the existing TGATHER MaskPattern interface. The implementation scatters source elements into destination positions selected by the mask, zeroing non-selected slots. ## Summary - Add `TSCATTER<maskPattern>(dst, src, events...)` template in common, costmodel, and cpu backends - Implement `TScatter` and `TSCATTER_IMPL` in `TScatter.hpp` with static assertions for 16/32-bit element width, Vec tile type, and row-major layout - Add `tscatter_common.h` shared header for masked test infrastructure - Add `gen_data.py` golden-data generator covering all 7 mask patterns for float32, float16, uint16, int16, uint32, and int32 types - Add parametrized GTest cases in `main.cpp` and kernel implementations in `tscatter_kernel.cpp` - Fix inconsistent `WaitEvents &... events` spacing to `WaitEvents &...events` across costmodel `pto_instr.hpp` ## Testing - [x] All masked TSCATTER parametrized test cases pass - [x] Existing TSCATTER index-based test unaffected - [x] Pre-commit hooks pass
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.
Add a new TSCATTER overload that accepts a MaskPattern template parameter
(P0101, P1010, P0001, P0010, P0100, P1000, P1111), mirroring the existing
TGATHER MaskPattern interface. The implementation scatters source elements
into destination positions selected by the mask, zeroing non-selected slots.
Summary
TSCATTER<maskPattern>(dst, src, events...)template in common,costmodel, and cpu backends
TScatterandTSCATTER_IMPLinTScatter.hppwithstatic assertions for 16/32-bit element width, Vec tile type, and
row-major layout
tscatter_common.hshared header for masked test infrastructuregen_data.pygolden-data generator covering all 7 mask patternsfor float32, float16, uint16, int16, uint32, and int32 types
main.cppand kernel implementationsin
tscatter_kernel.cppWaitEvents &... eventsspacing toWaitEvents &...eventsacross costmodel
pto_instr.hppTesting