Mesa (master): aco/isel: Add documentation for (u)int64->f16 conversion
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Mar 26 14:50:30 UTC 2021
Module: Mesa
Branch: master
Commit: 8557ac9a1249eac77f6f114f1d8c8884998b5b2c
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8557ac9a1249eac77f6f114f1d8c8884998b5b2c
Author: Tony Wasserka <tony.wasserka at gmx.de>
Date: Fri Mar 12 11:13:51 2021 +0100
aco/isel: Add documentation for (u)int64->f16 conversion
The upper 32 bits are truncated before converting, which still produces
correct results since they never meaningfully contribute to the result.
Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9597>
---
src/amd/compiler/aco_instruction_selection.cpp | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp
index 89b12026a92..b0264b3865c 100644
--- a/src/amd/compiler/aco_instruction_selection.cpp
+++ b/src/amd/compiler/aco_instruction_selection.cpp
@@ -2450,6 +2450,11 @@ void visit_alu_instr(isel_context *ctx, nir_alu_instr *instr)
src = convert_int(ctx, bld, src, input_size, target_size, true);
}
} else if (input_size == 64) {
+ /* Truncate down to 32 bits; if any of the upper bits are relevant,
+ * the value does not fall into the single-precision float range
+ * anyway. SPIR-V does not mandate any specific behavior for such
+ * large inputs.
+ */
src = convert_int(ctx, bld, src, 64, 32, false);
}
@@ -2525,6 +2530,11 @@ void visit_alu_instr(isel_context *ctx, nir_alu_instr *instr)
src = convert_int(ctx, bld, src, input_size, target_size, false);
}
} else if (input_size == 64) {
+ /* Truncate down to 32 bits; if any of the upper bits are non-zero,
+ * the value does not fall into the single-precision float range
+ * anyway. SPIR-V does not mandate any specific behavior for such
+ * large inputs.
+ */
src = convert_int(ctx, bld, src, 64, 32, false);
}
More information about the mesa-commit
mailing list