Repository navigation
[BugFix][ROCm] Broadcast 8-bit integers with 8 and 16 lanes - #3955
ghostrider0470 wants to merge 1 commit into
Conversation
8-bit integer vectors are stored as 32-bit words, but Broadcast built make_uint2/make_uint4 with one argument per byte and required a constant value. Emit one packed word per 4 lanes, for constant and non-constant values. The output for a constant 4-lane broadcast is unchanged.
|
👋 Hi! Thank you for contributing to the TileLang project. Please remember to run We appreciate you taking this step! Our team will review your contribution, and we look forward to your awesome work! 🚀 |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
zhangnju
left a comment
There was a problem hiding this comment.
Thanks for the fix! Verified the included test on gfx950, gfx1100 (W7900) and gfx1201 (R9700) - all 3 passed on each.
Problem
LegalizeSafeMemoryAccessgives a dynamically indexed copy a zero else branch and binds the zero to a variable. For 8-bit integer vectors, HIP'sBroadcastthen fails in one of two ways:ICHECK(p)onas_const_int, because the value is a variable.make_uint2/make_uint4is emitted with one argument per byte, and hipcc rejects it ("no matching function for call to 'make_uint4'" with 16 arguments).On main (72d986e) the new test reproduces both: the 64-column/256-thread copy hits
Check failed: (p)atcodegen_hip.cc:2246, and the two copies with 8- and 16-lane vectors fail in hipcc.The 4-lane case is also addressed by #3886; this PR's distinct part is the 8- and 16-lane form.
Approach
8-bit integer vectors are stored as 32-bit words (see
PrintType), so emit one packed word per 4 lanes, for constant and non-constant values: the constant path packs the byte as before, the non-constant path emits(uint)(uchar)(v) * 0x01010101u. The output for a constant 4-lane broadcast is unchanged.test_tilelang_hip_uint8_broadcast.pycopies a uint8 row tile through shared memory at 3 column/thread combinations that give 4-, 8- and 16-lane vectors, checks the copied values, and checks that an out-of-bounds index reads zeros. 3 passed on 72d986e with this change on MI250X (gfx90a), ROCm 6.2.4.Not covered: the non-constant value is printed once per packed word, so for 8 and 16 lanes it appears 2 or 4 times in the source. It is always a variable here, but an effectful value is not rejected (#3886 adds that check for 4 lanes).
Rebased onto current main (348e807) without conflicts. The test results above were measured on 72d986e and have not been rerun on the new base.