diff options
author | Chuanbo Weng <chuanbo.weng@intel.com> | 2017-06-14 00:54:13 +0800 |
---|---|---|
committer | Yang Rong <rong.r.yang@intel.com> | 2017-07-12 18:29:19 +0800 |
commit | 9cb7ff4c285d892616595e5a43793f4d1408eca4 (patch) | |
tree | 335679b4a0e2fb166ae5bb0517a871cde6071529 /backend/src/backend/gen_context.cpp | |
parent | 4933bf9212c9721ca2b0e615097ed2b53fec51c3 (diff) | |
download | beignet-9cb7ff4c285d892616595e5a43793f4d1408eca4.tar.gz |
Implement extension cl_intel_device_side_avc_motion_estimation.
This patch mainly contains:
1. built-in function __gen_ocl_ime implementation.
2. Lots of built-in functions of cl_intel_device_side_avc_motion_estimation
are implemented.
3. This extension is required to run in simd16 mode.
v2: move the utests to seprate patches one by one;
as all the utests has extension function check, no need to put them
in stand alone utest;
uncomment the self test;
fix extension check logic issue, should be && instead of ||.
Signed-off-by: Chuanbo Weng <chuanbo.weng@intel.com>
Signed-off-by: Xionghu Luo <xionghu.luo@intel.com>
Reviewed-by: Yang Rong <rong.r.yang@intel.com>
Diffstat (limited to 'backend/src/backend/gen_context.cpp')
-rw-r--r-- | backend/src/backend/gen_context.cpp | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/backend/src/backend/gen_context.cpp b/backend/src/backend/gen_context.cpp index 79a3e625..0b171ff9 100644 --- a/backend/src/backend/gen_context.cpp +++ b/backend/src/backend/gen_context.cpp @@ -2339,10 +2339,20 @@ namespace gbe const unsigned int msg_type = insn.extra.msg_type; GBE_ASSERT(msg_type == 1); - int rsp_len; - if(msg_type == 1) - rsp_len = 6; uint32_t execWidth_org = p->curr.execWidth; + int virt_pld_len; + int virt_rsp_len; + +#define PHI_VME_PAYLOAD_LEN 5 +#define PHI_VME_WRITEBACK_LEN 6 + + if(msg_type == 1){ + virt_rsp_len = PHI_VME_WRITEBACK_LEN; + if(execWidth_org == 8) + virt_pld_len = PHI_VME_PAYLOAD_LEN; + else if(execWidth_org == 16) + virt_pld_len = (PHI_VME_PAYLOAD_LEN + 1) / 2; + } p->push(); p->curr.predicate = GEN_PREDICATE_NONE; p->curr.noMask = 1; @@ -2354,8 +2364,8 @@ namespace gbe * So we should treat them differently. * */ if(execWidth_org == 8){ - for(int i=0; i < 5; i++){ - GenRegister payload_grf = ra->genReg(insn.dst(rsp_len+i)); + for(int i=0; i < virt_pld_len; i++){ + GenRegister payload_grf = ra->genReg(insn.dst(virt_rsp_len+i)); payload_grf.vstride = GEN_VERTICAL_STRIDE_0; payload_grf.width = GEN_WIDTH_1; payload_grf.hstride = GEN_HORIZONTAL_STRIDE_0; @@ -2372,9 +2382,12 @@ namespace gbe } } else if(execWidth_org == 16){ - for(int i=0; i < 2; i++){ - for(int k = 0; k < 2; k++){ - GenRegister payload_grf = ra->genReg(insn.dst(rsp_len+i)); + for(int i=0; i < virt_pld_len; i++){ + int nr_num = 2; + if( (i == virt_pld_len-1) && (PHI_VME_PAYLOAD_LEN%2 == 1) ) + nr_num = 1; + for(int k = 0; k < nr_num; k++){ + GenRegister payload_grf = ra->genReg(insn.dst(virt_rsp_len+i)); payload_grf.nr += k; payload_grf.vstride = GEN_VERTICAL_STRIDE_0; payload_grf.width = GEN_WIDTH_1; @@ -2391,31 +2404,16 @@ namespace gbe } } } - { - int i = 2; - GenRegister payload_grf = ra->genReg(insn.dst(rsp_len+i)); - payload_grf.vstride = GEN_VERTICAL_STRIDE_0; - payload_grf.width = GEN_WIDTH_1; - payload_grf.hstride = GEN_HORIZONTAL_STRIDE_0; - payload_grf.subphysical = 1; - for(int j=0; j < 8; j++){ - payload_grf.subnr = (7 - j) * typeSize(GEN_TYPE_UD); - GenRegister payload_val = ra->genReg(insn.src(i*16+j)); - payload_val.vstride = GEN_VERTICAL_STRIDE_0; - payload_val.width = GEN_WIDTH_1; - payload_val.hstride = GEN_HORIZONTAL_STRIDE_0; - - p->MOV(payload_grf, payload_val); - } - } } p->pop(); +#undef PHI_VME_PAYLOAD_LEN +#undef PHI_VME_WRITEBACK_LEN p->push(); p->curr.predicate = GEN_PREDICATE_NONE; p->curr.noMask = 1; p->curr.execWidth = 1; - GenRegister payload_did = GenRegister::retype(ra->genReg(insn.dst(rsp_len)), GEN_TYPE_UB); + GenRegister payload_did = GenRegister::retype(ra->genReg(insn.dst(virt_rsp_len)), GEN_TYPE_UB); payload_did.vstride = GEN_VERTICAL_STRIDE_0; payload_did.width = GEN_WIDTH_1; payload_did.hstride = GEN_HORIZONTAL_STRIDE_0; @@ -2425,13 +2423,17 @@ namespace gbe p->MOV(payload_did, grf0); p->pop(); - const GenRegister msgPayload = ra->genReg(insn.dst(rsp_len)); + const GenRegister msgPayload = ra->genReg(insn.dst(virt_rsp_len)); const unsigned char bti = insn.getbti(); const unsigned int vme_search_path_lut = insn.extra.vme_search_path_lut; const unsigned int lut_sub = insn.extra.lut_sub; p->VME(bti, dst, msgPayload, msg_type, vme_search_path_lut, lut_sub); } + void GenContext::emitImeInstruction(const SelectionInstruction &insn) { + GBE_ASSERT(0); + } + void GenContext::scratchWrite(const GenRegister header, uint32_t offset, uint32_t reg_num, uint32_t reg_type, uint32_t channel_mode) { p->push(); uint32_t simdWidth = p->curr.execWidth; |