Skip to content

[CuTeDSL] Give integer TensorSSA true division a Float32 result - #3872

Open
ruiling-smartbear wants to merge 1 commit into
NVIDIA:mainfrom
ruiling-smartbear:cutedsl-tensorssa-int-truediv
Open

ruiling-smartbear wants to merge 1 commit into
NVIDIA:mainfrom
ruiling-smartbear:cutedsl-tensorssa-int-truediv

Conversation

@ruiling-smartbear

Copy link
Copy Markdown

Fixes #3871.

For integer TensorSSA values, / produces an f32 vector, but _apply_op keeps the integer element type on the result. Storing it gives wrong values or a type error, and .to(Float32) fails to build IR.

This sets the result type to Float32 for integer true division, the same as the scalar path in base_dsl/typing.py does for Int32 / Int32.

Test

test/python/CuTeDSL/test_tensor_ssa_truediv.py divides Int32, Int8 and Uint8 tensors by a tensor, a tensor by a Python int, and a Python int by a tensor, stores the results into a Float32 tensor (directly and through .to(Float32)) and compares with torch. On an A10G with nvidia-cutlass-dsl 4.8.1 all three types fail without the change and pass with it. The other tests in test/python/CuTeDSL give the same results with and without the change.

The f32 vector from integer / was labeled with the integer type, so storing it
gave wrong values or a type error. Use Float32, as scalar Int32 / Int32 does.
@ruiling-smartbear
ruiling-smartbear force-pushed the cutedsl-tensorssa-int-truediv branch from 3a2604f to 862c796 Compare November 24, 2026 03:54

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] CuTe DSL: integer TensorSSA "/" returns an f32 vector labeled with the integer type

2 participants