[Example] add example of vector addition#111
Merged
yaoyaoding merged 2 commits intoNVIDIA:mainfrom Apr 7, 2026
Merged
Conversation
Signed-off-by: William Zhang <wzhang20@yahoo.com>
Member
|
/ok to test 4281491 |
Member
|
Hi @WilliamZhang20 , could you run |
Signed-off-by: William Zhang <wzhang20@yahoo.com>
Member
|
/ok to test c1d50d0 |
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.
Summary
Add a minimal vector add example that shows how to implement elementwise
c[i] = a[i] + b[i]in Tilus. Each thread block loads a contiguous tile fromaandb, adds in registers, and storesc, in a single kernel launch (simple global load/add/store pattern).Kernel uses a fixed tile size (1024 elements per block) and 4 warps per block (no autotune).
Benchmark results (NVIDIA H200 NVL 143 GB)
Test Plan
pytest tests/examples/test_examples.py -v -k "vector_add"passestest_all_examples_are_listedpasses (vector_add registered in EXAMPLES)test_no_missing_examplespassesSigned-off-by: William Zhang wzhang20@yahoo.com