Repository navigation
[CuTeDSL] Sign-extend signed to wider unsigned integer conversions - #3847
Open
Zhonglin1231 wants to merge 1 commit into
Open
Zhonglin1231 wants to merge 1 commit into
Zhonglin1231 wants to merge 1 commit into
Conversation
int_to_int widened Signed -> Unsigned with arith.extui, so a runtime Int8(-1).to(Uint32) gave 255. The constant path, numpy and C all give 4294967295, and every signed to wider unsigned pair had the same mismatch. Widen with arith.extsi, as the same-signedness branch already does, and keep extui for 1-bit sources. Co-authored-by: Ruilin Gao <229880965+ruiling-smartbear@users.noreply.github.com> Signed-off-by: Zhong Lin <125393049+Zhonglin1231@users.noreply.github.com>
This branch has not been deployed
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.
Fixes #3843.
int_to_intwidenedSigned -> Unsignedwitharith.extui, so a runtimeInt8(-1).to(Uint32)gave 255, while the constant path, numpy and C give 4294967295. This widens witharith.extsi, as the same-signedness branch right below already does, and keepsextuifor 1-bit sources for the same reason that branch does.Narrowing and the other branches are unchanged.
Test
test/python/CuTeDSL/test_signed_to_unsigned.pyconverts[-1, -128, 0, 5, 127]in a kernel for all six signed to wider unsigned pairs and checks the bits against torch's signed widening. It needs a CUDA GPU and skips without one, liketest_keep_ir.py.On an A10G with nvidia-cutlass-dsl 4.8.1, all six pairs fail without the fix (
Int8 -1toUint32gives 255) and pass with it.