Skip to content

Commit 2e9386f

Browse files
committed
small fixes
1 parent 27b089d commit 2e9386f

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

frontend/packages/common/MLIRLayerAnalysis.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@ export const opSameExceptLocAndChildren = (leftData, rightData,valueMapping, fir
149149

150150
export const goUp = (opId, relalgBaseRef, info) => {
151151
let collectedChildren = []
152+
if (!info.indexedOps[opId]) {
153+
console.log("could not find op", opId)
154+
return []
155+
}
152156
collectChildren(info.indexedOps[opId], collectedChildren)
153157
let res = []
154158
collectedChildren.forEach((childId) => {
@@ -168,6 +172,10 @@ export const goUp = (opId, relalgBaseRef, info) => {
168172
}
169173
export const goUpDirect = (opId, relalgBaseRef, info) => {
170174
let res = []
175+
if (!info.indexedOps[opId]) {
176+
console.log("could not find op", opId)
177+
return []
178+
}
171179
let curr = opId
172180
while (curr) {
173181
let op = info.indexedOps[curr]
@@ -182,6 +190,10 @@ export const goUpDirect = (opId, relalgBaseRef, info) => {
182190

183191
export const goDown = (opId, subOpBaseRef, info) => {
184192
let collectedChildren = []
193+
if (!info.indexedOps[opId]) {
194+
console.log("could not find op", opId)
195+
return []
196+
}
185197
collectChildren(info.indexedOps[opId], collectedChildren)
186198
let res = []
187199
const descend = (curr)=>{
@@ -203,6 +215,10 @@ export const goDown = (opId, subOpBaseRef, info) => {
203215
}
204216
export const goDownDirect = (opId, subOpBaseRef, info) => {
205217
let res = []
218+
if (!info.indexedOps[opId]) {
219+
console.log("could not find op", opId)
220+
return []
221+
}
206222
const descend = (curr)=>{
207223
let op = info.indexedOps[curr]
208224
if (op.id.startsWith(subOpBaseRef + ":")) {

frontend/packages/insights/src/ProfilingView.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,11 @@ export const ProfilingView = ({data, onClose}) => {
128128
leftChildren.forEach((op)=>{
129129
if(op&&op.id) {
130130
const related = goDownDirect(op.id, rightDiffBaseRef, layerInfo)
131-
console.log(op.id, "related", related)
132131
if(related.length===0){
133132
leftBackground[op.id]="lightgray"
134133
}
135134
if(related.length===1){
136135
const same=opSameExceptLocAndChildren(leftOps[op.id],rightOps[related[0]],valueMapping,true)
137-
console.log("compare", leftOps[op.id], rightOps[related[0]],same)
138136
if(!same) {
139137
leftBackground[op.id] = "#ffebba"
140138
}else{
@@ -153,13 +151,11 @@ export const ProfilingView = ({data, onClose}) => {
153151
rightChildren.forEach((op)=>{
154152
if(op&&op.id) {
155153
const related = goUpDirect(op.id, leftDiffBaseRef, layerInfo)
156-
console.log(op.id, "related", related)
157154
if(related.length===0){
158155
rightBackground[op.id]="lightgray"
159156
}
160157
if(related.length===1){
161158
const same=opSameExceptLocAndChildren(leftOps[related[0]],rightOps[op.id],valueMapping,true)
162-
console.log("compare", rightOps[op.id], leftOps[related[0]],same)
163159
if(!same) {
164160
rightBackground[op.id] = "#ffebba"
165161
}else{
@@ -173,7 +169,6 @@ export const ProfilingView = ({data, onClose}) => {
173169
})
174170
setLeftDiffBackground(leftBackground)
175171
setRightDiffBackground(rightBackground)
176-
console.log("left",leftBackground)
177172
}
178173

179174

@@ -200,7 +195,6 @@ export const ProfilingView = ({data, onClose}) => {
200195
displayedLayers.forEach((l) => {
201196
if (l.idx && selectedLayer !== l.idx) {
202197
const baseRef = getBaseReference(data.layers[l.idx].passInfo.file)
203-
console.log("baseRef", baseRef, "goingDown", selectedLayer < l.idx, selectedLayer, l.index)
204198
const relatedOps = selectedLayer < l.idx ? goDown(selectedOp, baseRef, layerInfo) : goUp(selectedOp, baseRef, layerInfo)
205199
l.fn(relatedOps)
206200
} else if (l.idx) {
@@ -210,15 +204,14 @@ export const ProfilingView = ({data, onClose}) => {
210204
}
211205
}, [data, layerInfo,relalgMLIRData,subopMLIRData,imperativeMLIRData,llvmMLIRData, selectedOp, selectedLayer])
212206
useEffect(() => {
213-
if (selectedOp && selectedLayer) {
207+
if (selectedOp && selectedLayer&&leftDiffIndex&&rightDiffIndex) {
214208
const displayedLayers = [{idx: leftDiffIndex, fn: setSelectedLeftOps}, {
215209
idx: rightDiffIndex,
216210
fn: setSelectedRightOps
217211
}]
218212
displayedLayers.forEach((l) => {
219213
if (l.idx && selectedLayer !== l.idx) {
220214
const baseRef = getBaseReference(data.layers[l.idx].passInfo.file)
221-
console.log("baseRef", baseRef, "goingDown", selectedLayer < l.idx, selectedLayer, l.index)
222215
const relatedOps = selectedLayer < l.idx ? goDown(selectedOp, baseRef, layerInfo) : goUp(selectedOp, baseRef, layerInfo)
223216
l.fn(relatedOps)
224217
} else if (l.idx) {
@@ -262,7 +255,6 @@ export const ProfilingView = ({data, onClose}) => {
262255
}
263256
const handleInstrClick = (instr) => {
264257
if (instr.loc) {
265-
console.log("selected llvm", [instr.loc])
266258
const op = instr.loc
267259
handleLLVMOpSelection(op)
268260

0 commit comments

Comments
 (0)