Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] Fix '__builtin_clz' on windows #3312

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dchigarev
Copy link

@dchigarev dchigarev commented Jan 30, 2025

Closes #3273

This recent PR in upstream (triton-lang/triton#5621) brought a new faster logic for pext_i32 that is used in ReduceOpToLLVM pattern. The new logic of pext_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 misses r ^ 31 at the end of it, causing tt.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 and test_reduce_layouts being failed: https://github.com/intel/intel-xpu-backend-for-triton/actions/runs/13058121108/job/36434174997

Signed-off-by: dchigarev <dmitry.chigarev@intel.com>
Copy link
Contributor

@anmyachev anmyachev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Nice catch!

@dchigarev dchigarev marked this pull request as ready for review January 30, 2025 22:36
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.

Incorrect output in tests: test_reduce1d and test_reduce_layouts
2 participants