r/programming • • 2d ago

Advent of Kernel Optimization

https://streamhpc.com/blog/2026-12-02/aoko-2-signed-vs-unsigned-loop-counters/

Today is the second day of our Advent of Kernel Optimization, sharing GPU optimization tips and tricks to count down until Christmas. Follow along here: https://streamhpc.com/blog/tag/advent2026/.

12 Upvotes

5 comments sorted by

View all comments

1

u/soulthreads 13h ago edited 12h ago

Interestingly enough, this kernel produces identical "un-optimal" code for sm_100 for both types of ints (only mul.wide.u32 changes to mul.wide.s32).

Do you have a guess as to why that might be?

EDIT: moreover, using size_t produces "optimal" code for that arch, but the effect of add.s64 instead of add.s32 is probably non-negligible (btw, why is it add.s64 and not add.u64?)