@@ -72,6 +72,8 @@ int IR_Builder::translateVISAMediaLoadInst(
72
72
// create MOV inst
73
73
createMovR0Inst (dcl, 0 , 0 , true );
74
74
/* mov (1) VX(0,2)<1>, CONST[R,C] */
75
+ vISA_ASSERT_INPUT (!(blockHeight & 0xFFFF0000 ) && !(blockWidth & 0xFFFF0000 ),
76
+ " upper 16-bits of block height/width should be 0" );
75
77
temp = (blockHeight - 1 ) << 16 | (blockWidth - 1 );
76
78
createMovInst (dcl, 0 , 2 , g4::SIMD1, NULL , NULL , createImm (temp, Type_UD),
77
79
true );
@@ -84,6 +86,44 @@ int IR_Builder::translateVISAMediaLoadInst(
84
86
// create a currDst for VX
85
87
G4_SrcRegRegion *payload = createSrcRegRegion (dcl, getRegionStride1 ());
86
88
89
+ unsigned msgDesc = 0 ;
90
+ if ((mod == MEDIA_LD_top) || (mod == MEDIA_LD_top_mod)) {
91
+ msgDesc += 0x6 << MESSAGE_SPECIFIC_CONTROL; // Read top fields
92
+ } else if ((mod == MEDIA_LD_bottom) || (mod == MEDIA_LD_bottom_mod)) {
93
+ msgDesc += 0x7 << MESSAGE_SPECIFIC_CONTROL; // Read bottom fields
94
+ }
95
+
96
+ SET_DATAPORT_MESSAGE_TYPE (msgDesc, DC1_MEDIA_BLOCK_READ)
97
+
98
+ msgDesc += planeID;
99
+
100
+ unsigned regs2rcv = (obj_size - 1 ) / numEltPerGRF<Type_UB>() + 1 ;
101
+
102
+ if (shouldForceSplitSend (surface) || useSends ()) {
103
+ // message length = 1, response length != 0, header present = 1
104
+ msgDesc += (1 << getSendMsgLengthBitOffset ()) +
105
+ (1 << getSendHeaderPresentBitOffset ());
106
+
107
+ unsigned regs2snd = 1 ;
108
+ unsigned extMsgLength = 0 ;
109
+ uint16_t extFuncCtrl = 0 ;
110
+
111
+ G4_SendDescRaw *desc = createSendMsgDesc (
112
+ msgDesc, regs2rcv, regs2snd, SFID::DP_DC1, extMsgLength, extFuncCtrl,
113
+ SendAccess::READ_ONLY, surface, nullptr );
114
+
115
+ G4_DstRegRegion *d = checkSendDst (dstOpnd->asDstRegRegion ());
116
+ G4_ExecSize send_exec_size (getGenxDataportIOSize ());
117
+ if (IS_WTYPE (d->getType ())) {
118
+ send_exec_size *= 2 ;
119
+ }
120
+
121
+ createSplitSendInst (nullptr , d, payload, nullptr , send_exec_size, desc,
122
+ InstOpt_WriteEnable, false );
123
+
124
+ return VISA_SUCCESS;
125
+ }
126
+
87
127
// mediaread overwrites entire GRF
88
128
bool via_temp = false ;
89
129
G4_Operand *original_dst = NULL ;
@@ -127,25 +167,13 @@ int IR_Builder::translateVISAMediaLoadInst(
127
167
128
168
G4_DstRegRegion *d = checkSendDst (dstOpnd->asDstRegRegion ());
129
169
130
- temp = 0 ;
131
- if ((mod == MEDIA_LD_top) || (mod == MEDIA_LD_top_mod)) {
132
- temp += 0x6 << MESSAGE_SPECIFIC_CONTROL; // Read top fields
133
- } else if ((mod == MEDIA_LD_bottom) || (mod == MEDIA_LD_bottom_mod)) {
134
- temp += 0x7 << MESSAGE_SPECIFIC_CONTROL; // Read bottom fields
135
- }
136
-
137
- SET_DATAPORT_MESSAGE_TYPE (temp, DC1_MEDIA_BLOCK_READ)
138
-
139
- temp += planeID;
140
-
141
170
G4_ExecSize send_exec_size (getGenxDataportIOSize ());
142
171
if (IS_WTYPE (d->getType ())) {
143
172
send_exec_size *= 2 ;
144
173
}
145
174
146
- createSendInst (NULL , d, payload, 1 ,
147
- (obj_size - 1 ) / numEltPerGRF<Type_UB>() + 1 , send_exec_size,
148
- temp, SFID::DP_DC1, 1 , SendAccess::READ_ONLY, surface, NULL ,
175
+ createSendInst (NULL , d, payload, 1 , regs2rcv, send_exec_size, msgDesc,
176
+ SFID::DP_DC1, 1 , SendAccess::READ_ONLY, surface, NULL ,
149
177
InstOpt_WriteEnable, false );
150
178
151
179
if (via_temp) {
0 commit comments