This is an archive of the discontinued LLVM Phabricator instance.

[mlir][spirv] Fix math.ctlz for full zero bit cases
ClosedPublic

Authored by antiagainst on Jun 14 2022, 8:03 AM.

Details

Summary

If the integer has all zero bits, GLSL FindUMsb would return -1.
So theoretically (31 - FindUMsb) should still give use the correct
result. However, Adreno GPUshave issues with this:
https://buildkite.com/iree/iree-test-android/builds/6482#01815f05-3926-466f-822a-1e20299e5461
This looks like a driver bug. So handle the corner case explicity
to workaround it.

Diff Detail

Event Timeline

antiagainst created this revision.Jun 14 2022, 8:03 AM
antiagainst requested review of this revision.Jun 14 2022, 8:03 AM
mravishankar accepted this revision.Jun 14 2022, 4:28 PM
This revision is now accepted and ready to land.Jun 14 2022, 4:28 PM
This revision was automatically updated to reflect the committed changes.