[Beignet] [PATCH 4/7] Using a correct DATAPORT and SFID for some send message of haswell.
junyan.he at inbox.com
junyan.he at inbox.com
Tue Apr 15 17:56:04 PDT 2014
From: Junyan He <junyan.he at linux.intel.com>
Signed-off-by: Yang Rong <rong.r.yang at intel.com>
Signed-off-by: Junyan He <junyan.he at linux.intel.com>
---
backend/src/backend/gen75_encoder.cpp | 32 ++++++++++++++
backend/src/backend/gen75_encoder.hpp | 5 +++
backend/src/backend/gen_defs.hpp | 57 ++++++++++++++++++-------
backend/src/backend/gen_encoder.cpp | 76 ++++++++++++++-------------------
backend/src/backend/gen_encoder.hpp | 9 ++++
5 files changed, 120 insertions(+), 59 deletions(-)
diff --git a/backend/src/backend/gen75_encoder.cpp b/backend/src/backend/gen75_encoder.cpp
index 909b301..dabe599 100644
--- a/backend/src/backend/gen75_encoder.cpp
+++ b/backend/src/backend/gen75_encoder.cpp
@@ -30,4 +30,36 @@
namespace gbe
{
+ void Gen75Encoder::setDPUntypedRW(GenInstruction *insn,
+ uint32_t bti,
+ uint32_t rgba,
+ uint32_t msg_type,
+ uint32_t msg_length,
+ uint32_t response_length)
+ {
+ const GenMessageTarget sfid = GEN_SFID_DATAPORT1_DATA_CACHE;
+ setMessageDescriptor(insn, sfid, msg_length, response_length);
+ insn->bits3.gen7_untyped_rw.msg_type = msg_type;
+ insn->bits3.gen7_untyped_rw.bti = bti;
+ insn->bits3.gen7_untyped_rw.rgba = rgba;
+ if (curr.execWidth == 8)
+ insn->bits3.gen7_untyped_rw.simd_mode = GEN_UNTYPED_SIMD8;
+ else if (curr.execWidth == 16)
+ insn->bits3.gen7_untyped_rw.simd_mode = GEN_UNTYPED_SIMD16;
+ else
+ NOT_SUPPORTED;
+ }
+
+ void Gen75Encoder::setTypedWriteMessage(GenInstruction *insn, unsigned char bti,
+ unsigned char msg_type, uint32_t msg_length, bool header_present)
+ {
+ const GenMessageTarget sfid = GEN_SFID_DATAPORT1_DATA_CACHE;
+ setMessageDescriptor(insn, sfid, msg_length, 0, header_present);
+ insn->bits3.gen7_typed_rw.bti = bti;
+ insn->bits3.gen7_typed_rw.msg_type = msg_type;
+
+ /* Always using the low 8 slots here. */
+ insn->bits3.gen7_typed_rw.slot = 1;
+ }
+
} /* End of the name space. */
diff --git a/backend/src/backend/gen75_encoder.hpp b/backend/src/backend/gen75_encoder.hpp
index 64b47de..57e9060 100644
--- a/backend/src/backend/gen75_encoder.hpp
+++ b/backend/src/backend/gen75_encoder.hpp
@@ -32,6 +32,11 @@ namespace gbe
{
public:
Gen75Encoder(uint32_t simdWidth, uint32_t gen) : GenEncoder(simdWidth, gen) { };
+ virtual void setDPUntypedRW(GenInstruction *insn, uint32_t bti, uint32_t rgba,
+ uint32_t msg_type, uint32_t msg_length, uint32_t response_length);
+ virtual void setTypedWriteMessage(GenInstruction *insn, unsigned char bti,
+ unsigned char msg_type, uint32_t msg_length,
+ bool header_present);
};
}
#endif /* __GBE_GEN75_ENCODER_HPP__ */
diff --git a/backend/src/backend/gen_defs.hpp b/backend/src/backend/gen_defs.hpp
index ffa38c0..f74b82c 100644
--- a/backend/src/backend/gen_defs.hpp
+++ b/backend/src/backend/gen_defs.hpp
@@ -208,7 +208,8 @@ enum GenMessageTarget {
GEN6_SFID_DATAPORT_SAMPLER_CACHE = 4,
GEN6_SFID_DATAPORT_RENDER_CACHE = 5,
GEN6_SFID_DATAPORT_CONSTANT_CACHE = 9,
- GEN_SFID_DATAPORT_DATA_CACHE = 10,
+ GEN_SFID_DATAPORT_DATA_CACHE = 10,
+ GEN_SFID_DATAPORT1_DATA_CACHE = 12,
};
#define GEN_PREDICATE_NONE 0
@@ -306,20 +307,46 @@ enum GenMessageTarget {
#define GEN_BYTE_SCATTER_SIMD8 0
#define GEN_BYTE_SCATTER_SIMD16 1
-/* Data port message type*/
-#define GEN_OBLOCK_READ 0 //0000: OWord Block Read
-#define GEN_UNALIGNED_OBLOCK_READ 1 //0001: Unaligned OWord Block Read
-#define GEN_ODBLOCK_READ 2 //0010: OWord Dual Block Read
-#define GEN_DWORD_GATHER 3 //0011: DWord Scattered Read
-#define GEN_BYTE_GATHER 4 //0100: Byte Scattered Read
-#define GEN_UNTYPED_READ 5 //0101: Untyped Surface Read
-#define GEN_UNTYPED_ATOMIC_READ 6 //0110: Untyped Atomic Operation
-#define GEN_MEMORY_FENCE 7 //0111: Memory Fence
-#define GEN_OBLOCK_WRITE 8 //1000: OWord Block Write
-#define GEN_ODBLOCK_WRITE 10//1010: OWord Dual Block Write
-#define GEN_DWORD_SCATTER 11//1011: DWord Scattered Write
-#define GEN_BYTE_SCATTER 12//1100: Byte Scattered Write
-#define GEN_UNTYPED_WRITE 13//1101: Untyped Surface Write
+/* Data port message type for gen7*/
+#define GEN7_OBLOCK_READ 0 //0000: OWord Block Read
+#define GEN7_UNALIGNED_OBLOCK_READ 1 //0001: Unaligned OWord Block Read
+#define GEN7_ODBLOCK_READ 2 //0010: OWord Dual Block Read
+#define GEN7_DWORD_GATHER 3 //0011: DWord Scattered Read
+#define GEN7_BYTE_GATHER 4 //0100: Byte Scattered Read
+#define GEN7_UNTYPED_READ 5 //0101: Untyped Surface Read
+#define GEN7_UNTYPED_ATOMIC_READ 6 //0110: Untyped Atomic Operation
+#define GEN7_MEMORY_FENCE 7 //0111: Memory Fence
+#define GEN7_OBLOCK_WRITE 8 //1000: OWord Block Write
+#define GEN7_ODBLOCK_WRITE 10//1010: OWord Dual Block Write
+#define GEN7_DWORD_SCATTER 11//1011: DWord Scattered Write
+#define GEN7_BYTE_SCATTER 12//1100: Byte Scattered Write
+#define GEN7_UNTYPED_WRITE 13//1101: Untyped Surface Write
+
+/* Data port0 message type for Gen75*/
+#define GEN75_P0_OBLOCK_READ 0 //0000: OWord Block Read
+#define GEN75_P0_UNALIGNED_OBLOCK_READ 1 //0001: Unaligned OWord Block Read
+#define GEN75_P0_ODBLOCK_READ 2 //0010: OWord Dual Block Read
+#define GEN75_P0_DWORD_GATHER 3 //0011: DWord Scattered Read
+#define GEN75_P0_BYTE_GATHER 4 //0100: Byte Scattered Read
+#define GEN75_P0_MEMORY_FENCE 7 //0111: Memory Fence
+#define GEN75_P0_OBLOCK_WRITE 8 //1000: OWord Block Write
+#define GEN75_P0_ODBLOCK_WRITE 10 //1010: OWord Dual Block Write
+#define GEN75_P0_DWORD_SCATTER 11 //1011: DWord Scattered Write
+#define GEN75_P0_BYTE_SCATTER 12 //1100: Byte Scattered Write
+
+/* Data port1 message type for Gen75*/
+#define GEN75_P1_UNTYPED_READ 1 //0001: Untyped Surface Read
+#define GEN75_P1_UNTYPED_ATOMIC_OP 2 //0010: Untyped Atomic Operation
+#define GEN75_P1_UNTYPED_ATOMIC_OP_4X2 3 //0011: Untyped Atomic Operation SIMD4x2
+#define GEN75_P1_MEDIA_BREAD 4 //0100: Media Block Read
+#define GEN75_P1_TYPED_SURFACE_READ 5 //0101: Typed Surface Read
+#define GEN75_P1_TYPED_ATOMIC_OP 6 //0110: Typed Atomic Operation
+#define GEN75_P1_TYPED_ATOMIC_OP_4X2 7 //0111: Typed Atomic Operation SIMD4x2
+#define GEN75_P1_UNTYPED_SURFACE_WRITE 9 //1001: Untyped Surface Write
+#define GEN75_P1_MEDIA_TYPED_BWRITE 10 //1010: Media Block Write
+#define GEN75_P1_ATOMIC_COUNTER 11 //1011: Atomic Counter Operation
+#define GEN75_P1_ATOMIC_COUNTER_4X2 12 //1100: Atomic Counter Operation 4X2
+#define GEN75_P1_TYPED_SURFACE_WRITE 13 //1101: Typed Surface Write
/* Data port data cache scratch messages*/
#define GEN_SCRATCH_READ 0
diff --git a/backend/src/backend/gen_encoder.cpp b/backend/src/backend/gen_encoder.cpp
index 0664d77..9d58dfb 100644
--- a/backend/src/backend/gen_encoder.cpp
+++ b/backend/src/backend/gen_encoder.cpp
@@ -90,15 +90,11 @@ namespace gbe
return false;
}
- static void setMessageDescriptor(GenEncoder *p,
- GenInstruction *inst,
- enum GenMessageTarget sfid,
- unsigned msg_length,
- unsigned response_length,
- bool header_present = false,
- bool end_of_thread = false)
+ void GenEncoder::setMessageDescriptor(GenInstruction *inst, enum GenMessageTarget sfid,
+ unsigned msg_length, unsigned response_length,
+ bool header_present, bool end_of_thread)
{
- p->setSrc1(inst, GenRegister::immd(0));
+ setSrc1(inst, GenRegister::immd(0));
inst->bits3.generic_gen5.header_present = header_present;
inst->bits3.generic_gen5.response_length = response_length;
inst->bits3.generic_gen5.msg_length = msg_length;
@@ -106,22 +102,18 @@ namespace gbe
inst->header.destreg_or_condmod = sfid;
}
- static void setDPUntypedRW(GenEncoder *p,
- GenInstruction *insn,
- uint32_t bti,
- uint32_t rgba,
- uint32_t msg_type,
- uint32_t msg_length,
- uint32_t response_length)
+ void GenEncoder::setDPUntypedRW(GenInstruction *insn, uint32_t bti,
+ uint32_t rgba, uint32_t msg_type,
+ uint32_t msg_length, uint32_t response_length)
{
const GenMessageTarget sfid = GEN_SFID_DATAPORT_DATA_CACHE;
- setMessageDescriptor(p, insn, sfid, msg_length, response_length);
+ setMessageDescriptor(insn, sfid, msg_length, response_length);
insn->bits3.gen7_untyped_rw.msg_type = msg_type;
insn->bits3.gen7_untyped_rw.bti = bti;
insn->bits3.gen7_untyped_rw.rgba = rgba;
- if (p->curr.execWidth == 8)
+ if (curr.execWidth == 8)
insn->bits3.gen7_untyped_rw.simd_mode = GEN_UNTYPED_SIMD8;
- else if (p->curr.execWidth == 16)
+ else if (curr.execWidth == 16)
insn->bits3.gen7_untyped_rw.simd_mode = GEN_UNTYPED_SIMD16;
else
NOT_SUPPORTED;
@@ -136,7 +128,7 @@ namespace gbe
uint32_t response_length)
{
const GenMessageTarget sfid = GEN_SFID_DATAPORT_DATA_CACHE;
- setMessageDescriptor(p, insn, sfid, msg_length, response_length);
+ p->setMessageDescriptor(insn, sfid, msg_length, response_length);
insn->bits3.gen7_byte_rw.msg_type = msg_type;
insn->bits3.gen7_byte_rw.bti = bti;
insn->bits3.gen7_byte_rw.data_size = elem_size;
@@ -157,7 +149,7 @@ namespace gbe
uint32_t response_length)
{
const GenMessageTarget sfid = GEN_SFID_DATAPORT_DATA_CACHE;
- setMessageDescriptor(p, insn, sfid, msg_length, response_length);
+ p->setMessageDescriptor(insn, sfid, msg_length, response_length);
assert(size == 2 || size == 4);
insn->bits3.gen7_oblock_rw.msg_type = msg_type;
insn->bits3.gen7_oblock_rw.bti = bti;
@@ -178,7 +170,7 @@ namespace gbe
uint32_t return_format)
{
const GenMessageTarget sfid = GEN_SFID_SAMPLER;
- setMessageDescriptor(p, insn, sfid, msg_length, response_length);
+ p->setMessageDescriptor(insn, sfid, msg_length, response_length);
insn->bits3.sampler_gen7.bti = bti;
insn->bits3.sampler_gen7.sampler = sampler;
insn->bits3.sampler_gen7.msg_type = msg_type;
@@ -186,18 +178,16 @@ namespace gbe
}
- static void setTypedWriteMessage(GenEncoder *p,
- GenInstruction *insn,
- unsigned char bti,
- unsigned char msg_type,
- uint32_t msg_length,
- bool header_present)
+ void GenEncoder::setTypedWriteMessage(GenInstruction *insn, unsigned char bti,
+ unsigned char msg_type, uint32_t msg_length,
+ bool header_present)
{
const GenMessageTarget sfid = GEN6_SFID_DATAPORT_RENDER_CACHE;
- setMessageDescriptor(p, insn, sfid, msg_length, 0, header_present);
+ setMessageDescriptor(insn, sfid, msg_length, 0, header_present);
insn->bits3.gen7_typed_rw.bti = bti;
insn->bits3.gen7_typed_rw.msg_type = msg_type;
}
+
static void setDWordScatterMessgae(GenEncoder *p,
GenInstruction *insn,
uint32_t bti,
@@ -207,7 +197,7 @@ namespace gbe
uint32_t response_length)
{
const GenMessageTarget sfid = GEN6_SFID_DATAPORT_CONSTANT_CACHE;
- setMessageDescriptor(p, insn, sfid, msg_length, response_length);
+ p->setMessageDescriptor(insn, sfid, msg_length, response_length);
insn->bits3.gen7_dword_rw.msg_type = msg_type;
insn->bits3.gen7_dword_rw.bti = bti;
insn->bits3.gen7_dword_rw.block_size = block_size;
@@ -459,11 +449,10 @@ namespace gbe
this->setDst(insn, GenRegister::uw16grf(dst.nr, 0));
this->setSrc0(insn, GenRegister::ud8grf(src.nr, 0));
this->setSrc1(insn, GenRegister::immud(0));
- setDPUntypedRW(this,
- insn,
+ setDPUntypedRW(insn,
bti,
untypedRWMask[elemNum],
- GEN_UNTYPED_READ,
+ GEN7_UNTYPED_READ,
msg_length,
response_length);
}
@@ -485,11 +474,10 @@ namespace gbe
NOT_IMPLEMENTED;
this->setSrc0(insn, GenRegister::ud8grf(msg.nr, 0));
this->setSrc1(insn, GenRegister::immud(0));
- setDPUntypedRW(this,
- insn,
+ setDPUntypedRW(insn,
bti,
untypedRWMask[elemNum],
- GEN_UNTYPED_WRITE,
+ GEN7_UNTYPED_WRITE,
msg_length,
response_length);
}
@@ -515,7 +503,7 @@ namespace gbe
insn,
bti,
elemSize,
- GEN_BYTE_GATHER,
+ GEN7_BYTE_GATHER,
msg_length,
response_length);
}
@@ -539,7 +527,7 @@ namespace gbe
insn,
bti,
elemSize,
- GEN_BYTE_SCATTER,
+ GEN7_BYTE_SCATTER,
msg_length,
response_length);
}
@@ -568,7 +556,7 @@ namespace gbe
insn,
bti,
block_size,
- GEN_DWORD_GATHER,
+ GEN7_DWORD_GATHER,
msg_length,
response_length);
@@ -594,8 +582,8 @@ namespace gbe
this->setSrc1(insn, GenRegister::immud(0));
const GenMessageTarget sfid = GEN_SFID_DATAPORT_DATA_CACHE;
- setMessageDescriptor(this, insn, sfid, msg_length, response_length);
- insn->bits3.gen7_atomic_op.msg_type = GEN_UNTYPED_ATOMIC_READ;
+ setMessageDescriptor(insn, sfid, msg_length, response_length);
+ insn->bits3.gen7_atomic_op.msg_type = GEN7_UNTYPED_ATOMIC_READ;
insn->bits3.gen7_atomic_op.bti = bti;
insn->bits3.gen7_atomic_op.return_data = 1;
insn->bits3.gen7_atomic_op.aop_type = function;
@@ -1034,7 +1022,7 @@ namespace gbe
this->setHeader(insn);
this->setDst(insn, GenRegister::null());
this->setSrc0(insn, src);
- setMessageDescriptor(this, insn, GEN_SFID_MESSAGE_GATEWAY, 1, 0);
+ setMessageDescriptor(insn, GEN_SFID_MESSAGE_GATEWAY, 1, 0);
insn->bits3.msg_gateway.sub_function_id = GEN_BARRIER_MSG;
insn->bits3.msg_gateway.notify = 0x1;
}
@@ -1043,7 +1031,7 @@ namespace gbe
this->setHeader(insn);
this->setDst(insn, dst);
this->setSrc0(insn, dst);
- setMessageDescriptor(this, insn, GEN_SFID_DATAPORT_DATA_CACHE, 1, 1, 1);
+ setMessageDescriptor(insn, GEN_SFID_DATAPORT_DATA_CACHE, 1, 1, 1);
insn->bits3.gen7_memory_fence.msg_type = GEN_MEM_FENCE;
insn->bits3.gen7_memory_fence.commit_enable = 0x1;
}
@@ -1242,7 +1230,7 @@ namespace gbe
this->setHeader(insn);
this->setDst(insn, GenRegister::retype(GenRegister::null(), GEN_TYPE_UD));
this->setSrc0(insn, msg);
- setTypedWriteMessage(this, insn, bti, msg_type, msg_length, header_present);
+ setTypedWriteMessage(insn, bti, msg_type, msg_length, header_present);
}
static void setScratchMessage(GenEncoder *p,
GenInstruction *insn,
@@ -1254,7 +1242,7 @@ namespace gbe
uint32_t response_length)
{
const GenMessageTarget sfid = GEN_SFID_DATAPORT_DATA_CACHE;
- setMessageDescriptor(p, insn, sfid, msg_length, response_length, true);
+ p->setMessageDescriptor(insn, sfid, msg_length, response_length, true);
insn->bits3.gen7_scratch_rw.block_size = block_size;
insn->bits3.gen7_scratch_rw.msg_type = msg_type;
insn->bits3.gen7_scratch_rw.channel_mode = channel_mode;
diff --git a/backend/src/backend/gen_encoder.hpp b/backend/src/backend/gen_encoder.hpp
index 094a5c2..a323d94 100644
--- a/backend/src/backend/gen_encoder.hpp
+++ b/backend/src/backend/gen_encoder.hpp
@@ -191,6 +191,15 @@ namespace gbe
// Helper functions to encode
////////////////////////////////////////////////////////////////////////
void setHeader(GenInstruction *insn);
+ virtual void setDPUntypedRW(GenInstruction *insn, uint32_t bti, uint32_t rgba,
+ uint32_t msg_type, uint32_t msg_length,
+ uint32_t response_length);
+ virtual void setTypedWriteMessage(GenInstruction *insn, unsigned char bti,
+ unsigned char msg_type, uint32_t msg_length,
+ bool header_present);
+ void setMessageDescriptor(GenInstruction *inst, enum GenMessageTarget sfid,
+ unsigned msg_length, unsigned response_length,
+ bool header_present = false, bool end_of_thread = false);
void setDst(GenInstruction *insn, GenRegister dest);
void setSrc0(GenInstruction *insn, GenRegister reg);
void setSrc1(GenInstruction *insn, GenRegister reg);
--
1.7.9.5
More information about the Beignet
mailing list