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
Use OpFUnordNotEqual for floating-point != #2260
Conversation
I think this proposes to make Do we need any specification changes for this? |
I think that this is justified by the current spec. It does propose to make For the purposes of ordered/unordered comparisons, any comparison involving a
which implies that, for |
Is there anything that I need to do to progress this? |
Do we know if all IHVs are ready for this? At least it's been posted here for a while. We also need to bump the code generation number since we are changing a code emission pattern. That will help protect against surprises too. See:
(We are also in the middle of possibly migrating to a new method via @ben-clayton's PRs, e.g., #2277.) |
BTW, it will be good to have the version bump in its own commit for ease of verification. |
I don't know for certain, but this doesn't change the SPIR-V that drivers are being asked to accept, although it obviously changes the balance of how often these different opcodes come up. Both opcodes are currently tested in the CTS (OpFUnordNotEqual and OpFOrdNotEqual), so they should be working in implementations.
Sure, I'll do that now. |
The normal IEEE not equal operation tests whether operands are unordered or not equal (so comparison with a NaN returns true). This corresponds to the SPIR-V OpFUnordNotEqual, so change to using that.
Change to 10 to reflect the change to generating unordered != operations.
Updating the SPIR-V generator version number changes the output of all the SPIR-V tests.
Changes in glsl (see KhronosGroup/glslang#2259 and KhronosGroup/glslang#2260) mean that fcmp will now use une (unordered) rather than one (ordered) ne. This is in line with most high level languages and means that NaN is handled in a more expected way. llpc-lit tests need updating for this change. The change allows for both one and une during the period of transition.
Changes in glsl (see KhronosGroup/glslang#2259 and KhronosGroup/glslang#2260) mean that fcmp will now use une (unordered) rather than one (ordered) ne. This is in line with most high level languages and means that NaN is handled in a more expected way. llpc-lit tests need updating for this change. The change allows for both one and une during the period of transition.
…dNotEqual The glslang compiler was changed in KhronosGroup/glslang#2260 to generate OpFUnordNotEqual rather than OpFOrdNotEqual for a!=b. Without this change the KHR-GL46.gl_spirv.spirv_glsl_to_spirv_builtin_functions_test test generates an InternalError because it can't find the expected mapping. Affects: KHR-GL46.gl_spirv.spirv_glsl_to_spirv_builtin_functions_test Change-Id: Ieda8dc02c0be90a7985b15ca28dbefb1a45cc7c1 Components: OpenGL
The normal IEEE not equal operation tests whether operands are unordered
or not equal (so comparison with a NaN returns true). This corresponds
to the SPIR-V OpFUnordNotEqual, so change to using that.
Fixes #2259