[Beignet] [PATCH] GBE: disable MulAdd pattern in instruction selection temporarily.

Xing, Homer homer.xing at intel.com
Fri Nov 1 07:21:03 CET 2013


An interesting story ...  This patch looks good to me.

-----Original Message-----
From: beignet-bounces at lists.freedesktop.org [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of Ruiling Song
Sent: Friday, November 1, 2013 2:16 PM
To: beignet at lists.freedesktop.org
Cc: Song, Ruiling
Subject: [Beignet] [PATCH] GBE: disable MulAdd pattern in instruction selection temporarily.

The story starts from 'FP_CONTRACT'. In c99 spec, it describes constract expression as:
"A floating expression may be contracted, that is, evaluated as though it were an atomic operation, thereby omitting rounding errors implied by the source code and the expression evaluation method."

But user can use 'pragma FP_CONTRACT OFF' to disable float contraction, in which condition, we should not do contraction like mad optimization.
In SPIR 1.2, named metadata 'opencl.enable.FP_CONTRACT' will be used to do this.
When Clang is ready, we need refine the backend logic.

Signed-off-by: Ruiling Song <ruiling.song at intel.com>
---
 backend/src/backend/gen_insn_selection.cpp |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/backend/src/backend/gen_insn_selection.cpp b/backend/src/backend/gen_insn_selection.cpp
index 7eae7ca..1f25f0e 100644
--- a/backend/src/backend/gen_insn_selection.cpp
+++ b/backend/src/backend/gen_insn_selection.cpp
@@ -1856,6 +1856,9 @@ namespace gbe
     {
       using namespace ir;
 
+      // XXX TODO: we need a clean support of FP_CONTRACT to remove below line 'return false'
+      // if 'pragma FP_CONTRACT OFF' is used in cl kernel, we should not do mad optimization.
+      return false;
       // MAD tend to increase liveness of the sources (since there are three of
       // them). TODO refine this strategy. Well, we should be able at least to
       // evaluate per basic block register pressure and selectively enable
--
1.7.9.5

_______________________________________________
Beignet mailing list
Beignet at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list