[Windows] Fix '__builtin_clz' on windows #3312
Open
+1
−1
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.
Closes #3273
This recent PR in upstream (triton-lang/triton#5621) brought a new faster logic for
pext_i32
that is used inReduceOpToLLVM
pattern. The new logic ofpext_i32
uses__builtin_clz
intrinsic, that is natively available in GCC and Clang, but is missing in MSVC. It seems that the Windows version of this intrinsic was incorrectly copied from the given source, so that it missesr ^ 31
at the end of it, causingtt.reduce(...)
lowering to produce incorrect llvm IR in some scenarious.p.s. there's a plan to push this fix to upstream, after we test it on our side and make sure it works fine
CI without
test_reduce1d
andtest_reduce_layouts
being failed: https://github.com/intel/intel-xpu-backend-for-triton/actions/runs/13058121108/job/36434174997