Skip to content

Commit caf48e4

Browse files
smilczekigcbot
authored andcommitted
Minor fixes and refactors.
- Remove redundant null checks. - Add asserts to translate media ld/st methods.
1 parent f0cb8dc commit caf48e4

File tree

2 files changed

+9
-16
lines changed

2 files changed

+9
-16
lines changed

visa/Common_ISA_framework.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,7 @@ int CISA_IR_Builder::isaDump(const char *combinedIsaasmName) const {
219219
// function 0 has kernel_f0.visaasm
220220
unsigned funcId = 0;
221221
kTemp->GetFunctionId(funcId);
222-
if (mainKernel) {
223-
asmName << mainKernel->getOutputAsmPath();
224-
} else {
225-
// No mainKernel, use the function name instead
226-
asmName << kTemp->getName();
227-
}
222+
asmName << mainKernel->getOutputAsmPath();
228223
asmName << "_f";
229224
asmName << funcId;
230225
} else {

visa/VisaToG4/TranslateSendMedia.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,10 @@ int IR_Builder::translateVISAMediaLoadInst(
5858

5959
unsigned temp;
6060

61-
unsigned objWidth = 0;
62-
if (blockWidth != 0) {
63-
objWidth = getObjWidth(blockWidth, blockHeight,
64-
dstOpnd->getBase()->asRegVar()->getDeclare());
65-
}
61+
vASSERT(blockWidth != 0);
62+
vASSERT(blockHeight != 0);
63+
unsigned objWidth = getObjWidth(blockWidth, blockHeight,
64+
dstOpnd->getBase()->asRegVar()->getDeclare());
6665
unsigned obj_size = objWidth * blockHeight;
6766

6867
/* mov (8) VX(0,0)<1>, r0:ud */
@@ -251,11 +250,10 @@ int IR_Builder::translateVISAMediaStoreInst(
251250
G4_Operand *yOffOpnd, G4_SrcRegRegion *srcOpnd) {
252251
TIME_SCOPE(VISA_BUILDER_IR_CONSTRUCTION);
253252

254-
int objWidth = 0;
255-
if (blockWidth != 0) {
256-
objWidth = getObjWidth(blockWidth, blockHeight,
257-
srcOpnd->getBase()->asRegVar()->getDeclare());
258-
}
253+
vASSERT(blockWidth != 0);
254+
vASSERT(blockHeight != 0);
255+
unsigned objWidth = getObjWidth(blockWidth, blockHeight,
256+
srcOpnd->getBase()->asRegVar()->getDeclare());
259257
unsigned obj_size = objWidth * blockHeight;
260258
unsigned int new_obj_size = obj_size;
261259

0 commit comments

Comments
 (0)