[01/13] Backend: Add sr0 reg helper function and add subnr to notification reg.

Submitted by junyan.he@inbox.com on Nov. 23, 2015, 8:48 a.m.

Details

Message ID 1448268530-4817-1-git-send-email-junyan.he@inbox.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Beignet

Not browsing as part of any series.

Commit Message

junyan.he@inbox.com Nov. 23, 2015, 8:48 a.m.
From: Junyan He <junyan.he@linux.intel.com>

sr0 is used to specify the state reigster where we can get the
state of each EU thread.
We will use n0.2 to wait for the message forwarding, so add a subnr
to notification register.

Signed-off-by: Junyan He <junyan.he@linux.intel.com>
---
 backend/src/backend/gen75_context.cpp |    8 +-------
 backend/src/backend/gen_encoder.cpp   |    4 ++--
 backend/src/backend/gen_encoder.hpp   |    2 +-
 backend/src/backend/gen_register.hpp  |   14 ++++++++++++--
 4 files changed, 16 insertions(+), 12 deletions(-)

Patch hide | download patch | download mbox

diff --git a/backend/src/backend/gen75_context.cpp b/backend/src/backend/gen75_context.cpp
index 7d407c3..fa8b029 100644
--- a/backend/src/backend/gen75_context.cpp
+++ b/backend/src/backend/gen75_context.cpp
@@ -44,13 +44,7 @@  namespace gbe
     p->push();
       p->curr.execWidth = 1;
       p->curr.predicate = GEN_PREDICATE_NONE;
-      GenRegister sr0 = GenRegister(GEN_ARCHITECTURE_REGISTER_FILE,
-                                    GEN_ARF_STATE,
-                                    1,
-                                    GEN_TYPE_UD,
-                                    GEN_VERTICAL_STRIDE_8,
-                                    GEN_WIDTH_8,
-                                    GEN_HORIZONTAL_STRIDE_1);
+      GenRegister sr0 = GenRegister::sr(0, 1);
       p->SHR(sr0, slm_index, GenRegister::immud(16));
     p->pop();
   }
diff --git a/backend/src/backend/gen_encoder.cpp b/backend/src/backend/gen_encoder.cpp
index b153a2c..347bb19 100644
--- a/backend/src/backend/gen_encoder.cpp
+++ b/backend/src/backend/gen_encoder.cpp
@@ -994,9 +994,9 @@  namespace gbe
     this->setSrc1(insn, src1);
   }
 
-  void GenEncoder::WAIT(void) {
+  void GenEncoder::WAIT(uint32_t subnr) {
      GenNativeInstruction *insn = this->next(GEN_OPCODE_WAIT);
-     GenRegister src = GenRegister::notification1();
+     GenRegister src = GenRegister::notification(subnr);
      this->setDst(insn, GenRegister::null());
      this->setSrc0(insn, src);
      this->setSrc1(insn, GenRegister::null());
diff --git a/backend/src/backend/gen_encoder.hpp b/backend/src/backend/gen_encoder.hpp
index e9945e8..5ea7202 100644
--- a/backend/src/backend/gen_encoder.hpp
+++ b/backend/src/backend/gen_encoder.hpp
@@ -162,7 +162,7 @@  namespace gbe
     /*! No-op */
     void NOP(void);
     /*! Wait instruction (used for the barrier) */
-    void WAIT(void);
+    void WAIT(uint32_t subnr = 0);
     /*! Atomic instructions */
     virtual void ATOMIC(GenRegister dst, uint32_t function, GenRegister src, GenRegister bti, uint32_t srcNum);
     /*! Untyped read (upto 4 channels) */
diff --git a/backend/src/backend/gen_register.hpp b/backend/src/backend/gen_register.hpp
index 0a077f2..ecd77f1 100644
--- a/backend/src/backend/gen_register.hpp
+++ b/backend/src/backend/gen_register.hpp
@@ -828,10 +828,20 @@  namespace gbe
                          GEN_HORIZONTAL_STRIDE_0);
     }
 
-    static INLINE GenRegister notification1(void) {
+    static INLINE GenRegister sr(uint32_t nr, uint32_t subnr = 0) {
+      return GenRegister(GEN_ARCHITECTURE_REGISTER_FILE,
+                         GEN_ARF_STATE | nr,
+                         subnr,
+                         GEN_TYPE_UD,
+                         GEN_VERTICAL_STRIDE_8,
+                         GEN_WIDTH_8,
+                         GEN_HORIZONTAL_STRIDE_1);
+    }
+
+    static INLINE GenRegister notification(uint32_t subnr = 0) {
       return GenRegister(GEN_ARCHITECTURE_REGISTER_FILE,
                          GEN_ARF_NOTIFICATION_COUNT,
-                         0,
+                         subnr,
                          GEN_TYPE_UD,
                          GEN_VERTICAL_STRIDE_0,
                          GEN_WIDTH_1,

Comments

This patch implement reduce max/min/add for uint and float.
It needs to base on the previous workgroup broadcast patchset(5 patches).

On Mon, Nov 23, 2015 at 04:48:38PM +0800, junyan.he@inbox.com wrote:
> Date: Mon, 23 Nov 2015 16:48:38 +0800
> From: junyan.he@inbox.com
> To: beignet@lists.freedesktop.org
> Subject: [Beignet] [PATCH 01/13] Backend: Add sr0 reg helper function and
>  add subnr to notification reg.
> X-Mailer: git-send-email 1.7.9.5
> 
> From: Junyan He <junyan.he@linux.intel.com>
> 
> sr0 is used to specify the state reigster where we can get the
> state of each EU thread.
> We will use n0.2 to wait for the message forwarding, so add a subnr
> to notification register.
> 
> Signed-off-by: Junyan He <junyan.he@linux.intel.com>
> ---
>  backend/src/backend/gen75_context.cpp |    8 +-------
>  backend/src/backend/gen_encoder.cpp   |    4 ++--
>  backend/src/backend/gen_encoder.hpp   |    2 +-
>  backend/src/backend/gen_register.hpp  |   14 ++++++++++++--
>  4 files changed, 16 insertions(+), 12 deletions(-)
> 
> diff --git a/backend/src/backend/gen75_context.cpp b/backend/src/backend/gen75_context.cpp
> index 7d407c3..fa8b029 100644
> --- a/backend/src/backend/gen75_context.cpp
> +++ b/backend/src/backend/gen75_context.cpp
> @@ -44,13 +44,7 @@ namespace gbe
>      p->push();
>        p->curr.execWidth = 1;
>        p->curr.predicate = GEN_PREDICATE_NONE;
> -      GenRegister sr0 = GenRegister(GEN_ARCHITECTURE_REGISTER_FILE,
> -                                    GEN_ARF_STATE,
> -                                    1,
> -                                    GEN_TYPE_UD,
> -                                    GEN_VERTICAL_STRIDE_8,
> -                                    GEN_WIDTH_8,
> -                                    GEN_HORIZONTAL_STRIDE_1);
> +      GenRegister sr0 = GenRegister::sr(0, 1);
>        p->SHR(sr0, slm_index, GenRegister::immud(16));
>      p->pop();
>    }
> diff --git a/backend/src/backend/gen_encoder.cpp b/backend/src/backend/gen_encoder.cpp
> index b153a2c..347bb19 100644
> --- a/backend/src/backend/gen_encoder.cpp
> +++ b/backend/src/backend/gen_encoder.cpp
> @@ -994,9 +994,9 @@ namespace gbe
>      this->setSrc1(insn, src1);
>    }
>  
> -  void GenEncoder::WAIT(void) {
> +  void GenEncoder::WAIT(uint32_t subnr) {
>       GenNativeInstruction *insn = this->next(GEN_OPCODE_WAIT);
> -     GenRegister src = GenRegister::notification1();
> +     GenRegister src = GenRegister::notification(subnr);
>       this->setDst(insn, GenRegister::null());
>       this->setSrc0(insn, src);
>       this->setSrc1(insn, GenRegister::null());
> diff --git a/backend/src/backend/gen_encoder.hpp b/backend/src/backend/gen_encoder.hpp
> index e9945e8..5ea7202 100644
> --- a/backend/src/backend/gen_encoder.hpp
> +++ b/backend/src/backend/gen_encoder.hpp
> @@ -162,7 +162,7 @@ namespace gbe
>      /*! No-op */
>      void NOP(void);
>      /*! Wait instruction (used for the barrier) */
> -    void WAIT(void);
> +    void WAIT(uint32_t subnr = 0);
>      /*! Atomic instructions */
>      virtual void ATOMIC(GenRegister dst, uint32_t function, GenRegister src, GenRegister bti, uint32_t srcNum);
>      /*! Untyped read (upto 4 channels) */
> diff --git a/backend/src/backend/gen_register.hpp b/backend/src/backend/gen_register.hpp
> index 0a077f2..ecd77f1 100644
> --- a/backend/src/backend/gen_register.hpp
> +++ b/backend/src/backend/gen_register.hpp
> @@ -828,10 +828,20 @@ namespace gbe
>                           GEN_HORIZONTAL_STRIDE_0);
>      }
>  
> -    static INLINE GenRegister notification1(void) {
> +    static INLINE GenRegister sr(uint32_t nr, uint32_t subnr = 0) {
> +      return GenRegister(GEN_ARCHITECTURE_REGISTER_FILE,
> +                         GEN_ARF_STATE | nr,
> +                         subnr,
> +                         GEN_TYPE_UD,
> +                         GEN_VERTICAL_STRIDE_8,
> +                         GEN_WIDTH_8,
> +                         GEN_HORIZONTAL_STRIDE_1);
> +    }
> +
> +    static INLINE GenRegister notification(uint32_t subnr = 0) {
>        return GenRegister(GEN_ARCHITECTURE_REGISTER_FILE,
>                           GEN_ARF_NOTIFICATION_COUNT,
> -                         0,
> +                         subnr,
>                           GEN_TYPE_UD,
>                           GEN_VERTICAL_STRIDE_0,
>                           GEN_WIDTH_1,
> -- 
> 1.7.9.5
> 
> 
> 
> _______________________________________________
> Beignet mailing list
> Beignet@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet