Skip to content

Commit bffabeb

Browse files
nlellaigcbot
authored andcommitted
Update accumulator registers save/restore syntax correctly in Xe2 SIP
Update accumulator registers save/restore syntax correctly in Xe2 SIP
1 parent d4cb697 commit bffabeb

File tree

5 files changed

+32
-42
lines changed

5 files changed

+32
-42
lines changed

IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ inline Value* LoadFromStruct(IGCLLVM::IRBuilder<>& builder, Value* strPtr, Type*
237237
{
238238
Value* indices[] = { builder.getInt32(0), builder.getInt32(i) };
239239
Value* elementPtr = builder.CreateInBoundsGEP(strPtr, indices);
240-
Value* element = builder.CreateLoad(sTy->getElementType(i), elementPtr);
240+
Value* element = builder.CreateLoad(elementPtr);
241241
strVal = builder.CreateInsertValue(strVal, element, i);
242242
}
243243
return strVal;

IGC/AdaptorCommon/TypesLegalizationPass.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ SPDX-License-Identifier: MIT
1313
#include "common/LLVMWarningsPush.hpp"
1414
#include "llvmWrapper/Support/Alignment.h"
1515
#include <llvm/IR/InstIterator.h>
16-
#include <llvmWrapper/IR/Instructions.h>
1716
#include "common/LLVMWarningsPop.hpp"
1817

1918
using namespace llvm;
@@ -236,10 +235,9 @@ TypesLegalizationPass::ResolveValue( Instruction *ip,Value *val,SmallVector<unsi
236235
Value* gep = CreateGEP( builder, ld->getType(), ld->getOperand( 0 ),indices );
237236
auto alignment = IGCLLVM::getAlignmentValue(ld);
238237
unsigned pointerTypeSize = ld->getType()->getScalarSizeInBits() / 8;
239-
Type* gepTy = IGCLLVM::getGEPIndexedType(ld->getType(), indices);
240238
if ( alignment && (alignment_t)pointerTypeSize == alignment )
241-
return builder.CreateAlignedLoad(gepTy, gep, IGCLLVM::getAlign(alignment));
242-
return builder.CreateLoad(gepTy, gep);
239+
return builder.CreateAlignedLoad(ld->getType(), gep, IGCLLVM::getAlign(alignment) );
240+
return builder.CreateLoad( gep );
243241
}
244242
else if(Constant *c = dyn_cast<Constant>(val)) {
245243
IRBuilder<> builder( ip );

IGC/Compiler/CISACodeGen/GenIRLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ bool GEPLowering::simplifyGEP(BasicBlock &BB) const {
522522
Value *V = E.expandCodeFor(P.Offset, P.Idx->getType(), P.GEP);
523523
Builder->SetInsertPoint(P.GEP);
524524
auto *NewGEP = Builder->CreateInBoundsGEP(
525-
P.Base->getResultElementType(), P.Base,
525+
P.Base,
526526
Builder->CreateSExt(V, P.GEP->getOperand(1)->getType()));
527527
P.GEP->replaceAllUsesWith(NewGEP);
528528
DeadInsts.push_back(P.GEP);

IGC/WrapperLLVM/include/llvmWrapper/IR/Instructions.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -241,18 +241,6 @@ inline bool comesBefore(llvm::Instruction* A, llvm::Instruction* B)
241241
return A->comesBefore(B);
242242
#endif
243243
}
244-
245-
inline llvm::Type *getGEPIndexedType(llvm::Type* Ty, llvm::SmallVector<unsigned, 8>& indices) {
246-
llvm::SmallVector< llvm::Value*, 8> gepIndices;
247-
gepIndices.reserve(indices.size() + 1);
248-
auto* int32Ty = llvm::IntegerType::getInt32Ty(Ty->getContext());
249-
gepIndices.push_back(llvm::ConstantInt::get(int32Ty, 0));
250-
for (unsigned idx : indices) {
251-
gepIndices.push_back(llvm::ConstantInt::get(int32Ty, idx));
252-
}
253-
return llvm::GetElementPtrInst::getIndexedType(Ty, gepIndices);
254-
}
255-
256244
}
257245

258246
#endif

IGC/common/SIPKernels/Xe2SIPCSRDebugBindless.h

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*========================== begin_copyright_notice ============================
22

3-
Copyright (C) 2024 Intel Corporation
3+
Copyright (C) 2023-2024 Intel Corporation
44

55
SPDX-License-Identifier: MIT
66

@@ -11,7 +11,7 @@ namespace SIP
1111
const unsigned char Xe2SIPCSRDebugBindless[] =
1212
{
1313
0x61, 0x00, 0x00, 0x80, 0x20, 0x42, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
14-
0x07, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x01, 0x00,
14+
0x09, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x01, 0x00,
1515
0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x80,
1616
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00,
1717
0x61, 0x00, 0x00, 0x80, 0x20, 0x02, 0x01, 0xf0, 0x04, 0x00, 0x00, 0x00,
@@ -243,7 +243,7 @@ const unsigned char Xe2SIPCSRDebugBindless[] =
243243
0x00, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x80,
244244
0x20, 0x02, 0xb5, 0x02, 0x00, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
245245
0x61, 0x00, 0x00, 0x80, 0x20, 0x42, 0x01, 0x30, 0x00, 0x00, 0x00, 0x00,
246-
0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x14, 0x00, 0x10, 0x01, 0x01, 0x00,
246+
0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x10, 0x00, 0x10, 0x01, 0x01, 0x00,
247247
0x05, 0x00, 0x58, 0x11, 0x05, 0x00, 0x58, 0x00, 0x61, 0x00, 0x00, 0x80,
248248
0x20, 0x02, 0xf5, 0x02, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
249249
0x61, 0x00, 0x10, 0x80, 0x20, 0x42, 0x05, 0x03, 0x00, 0x00, 0x00, 0x00,
@@ -260,20 +260,24 @@ const unsigned char Xe2SIPCSRDebugBindless[] =
260260
0x20, 0x02, 0x25, 0x04, 0x20, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
261261
0x61, 0x00, 0x08, 0x80, 0x20, 0x02, 0x85, 0x04, 0x01, 0xb0, 0x34, 0x00,
262262
0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x10, 0x80, 0x20, 0x42, 0x05, 0x05,
263-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x0c, 0x80,
264-
0x20, 0x02, 0x05, 0x05, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
265-
0x61, 0x00, 0x0c, 0x80, 0x20, 0x02, 0x85, 0x05, 0x00, 0x21, 0x00, 0x00,
266-
0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x80, 0x20, 0x82, 0x05, 0x01,
267-
0x04, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x31, 0x20, 0x03, 0x80,
268-
0x00, 0x00, 0x00, 0x00, 0x8c, 0x01, 0x08, 0xfe, 0x27, 0x02, 0xb8, 0xf4,
269-
0x61, 0xa0, 0x10, 0x80, 0x20, 0x42, 0x05, 0x02, 0x00, 0x00, 0x00, 0x00,
270-
0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x0c, 0x80, 0x20, 0x02, 0x05, 0x02,
271-
0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x0c, 0x80,
272-
0x20, 0x02, 0x85, 0x02, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
273-
0x61, 0x00, 0x10, 0x80, 0x20, 0x42, 0x05, 0x03, 0x00, 0x00, 0x00, 0x00,
274-
0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x10, 0x80, 0x20, 0x42, 0x05, 0x04,
275263
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x19, 0x0c, 0x80,
276-
0xa0, 0x0a, 0x05, 0x04, 0x00, 0x23, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
264+
0xa0, 0x0a, 0x05, 0x05, 0x01, 0x20, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00,
265+
0x61, 0x00, 0x0c, 0x80, 0xa0, 0x0a, 0x01, 0x20, 0x01, 0x21, 0x46, 0x00,
266+
0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x0c, 0x80, 0xa0, 0x0a, 0x05, 0x06,
267+
0x01, 0x20, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x11, 0x0c, 0x80,
268+
0xa0, 0x0a, 0x85, 0x05, 0x05, 0x06, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00,
269+
0x40, 0x00, 0x00, 0x80, 0x20, 0x82, 0x05, 0x01, 0x04, 0x01, 0x00, 0x02,
270+
0x00, 0x01, 0x00, 0x00, 0x31, 0x20, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00,
271+
0x8c, 0x01, 0x08, 0xfe, 0x27, 0x02, 0xb8, 0xf4, 0x61, 0xa0, 0x10, 0x80,
272+
0x20, 0x42, 0x05, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
273+
0x61, 0x00, 0x0c, 0x80, 0x20, 0x0a, 0x05, 0x02, 0x01, 0x22, 0x46, 0x00,
274+
0x00, 0x00, 0x00, 0x00, 0x61, 0x19, 0x0c, 0x80, 0xa0, 0x0a, 0x01, 0x22,
275+
0x01, 0x23, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x0c, 0x80,
276+
0xa0, 0x0a, 0x05, 0x03, 0x01, 0x22, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00,
277+
0x61, 0x09, 0x0c, 0x80, 0xa0, 0x0a, 0x85, 0x02, 0x05, 0x03, 0x46, 0x00,
278+
0x00, 0x00, 0x00, 0x00, 0x61, 0x11, 0x10, 0x80, 0x20, 0x42, 0x05, 0x03,
279+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x10, 0x80,
280+
0x20, 0x42, 0x05, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
277281
0x61, 0x00, 0x10, 0x80, 0x20, 0x42, 0x05, 0x05, 0x00, 0x00, 0x00, 0x00,
278282
0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x08, 0x80, 0x20, 0x02, 0x05, 0x05,
279283
0x01, 0x50, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x80,
@@ -288,7 +292,7 @@ const unsigned char Xe2SIPCSRDebugBindless[] =
288292
0x20, 0x02, 0xe5, 0x05, 0x60, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
289293
0x61, 0x00, 0x00, 0x80, 0x20, 0x02, 0xf5, 0x05, 0x70, 0x51, 0x00, 0x00,
290294
0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x80, 0x20, 0x82, 0x05, 0x01,
291-
0x04, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x31, 0x21, 0x01, 0x80,
295+
0x04, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x31, 0x21, 0x03, 0x80,
292296
0x00, 0x00, 0x00, 0x00, 0x8c, 0x01, 0x08, 0xfe, 0x27, 0x02, 0xb8, 0xf4,
293297
0x61, 0xa1, 0x10, 0x80, 0x20, 0x42, 0x05, 0x02, 0x00, 0x00, 0x00, 0x00,
294298
0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x80, 0x20, 0x02, 0x05, 0x02,
@@ -465,8 +469,8 @@ const unsigned char Xe2SIPCSRDebugBindless[] =
465469
0x40, 0x00, 0x00, 0x80, 0x20, 0x82, 0x05, 0x01, 0x04, 0x01, 0x00, 0x06,
466470
0xe0, 0xfd, 0xff, 0xff, 0x31, 0x21, 0x03, 0x80, 0x00, 0x00, 0x24, 0x02,
467471
0x8c, 0x01, 0x00, 0xfe, 0x03, 0x00, 0xb8, 0xf4, 0x61, 0x81, 0x0c, 0x80,
468-
0xa0, 0x02, 0x01, 0x22, 0x04, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
469-
0x61, 0x11, 0x0c, 0x80, 0x20, 0x02, 0x01, 0x23, 0x84, 0x02, 0x00, 0x00,
472+
0xa0, 0x0a, 0x01, 0x22, 0x05, 0x02, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00,
473+
0x61, 0x00, 0x0c, 0x80, 0xa0, 0x0a, 0x01, 0x23, 0x85, 0x02, 0x46, 0x00,
470474
0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x08, 0x80, 0x20, 0x02, 0x01, 0x50,
471475
0x05, 0x05, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x80,
472476
0x20, 0x02, 0x01, 0x51, 0x84, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -480,7 +484,7 @@ const unsigned char Xe2SIPCSRDebugBindless[] =
480484
0x20, 0x02, 0x61, 0x51, 0xe4, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
481485
0x61, 0x00, 0x00, 0x80, 0x20, 0x02, 0x71, 0x51, 0xf4, 0x05, 0x00, 0x00,
482486
0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x80, 0x20, 0x82, 0x05, 0x01,
483-
0x04, 0x01, 0x00, 0x06, 0x00, 0xff, 0xff, 0xff, 0x31, 0x21, 0x03, 0x80,
487+
0x04, 0x01, 0x00, 0x06, 0x00, 0xff, 0xff, 0xff, 0x31, 0x21, 0x01, 0x80,
484488
0x00, 0x00, 0x24, 0x02, 0x8c, 0x01, 0x00, 0xfe, 0x03, 0x00, 0xb8, 0xf4,
485489
0x61, 0x81, 0x10, 0x80, 0x10, 0x01, 0x01, 0x10, 0x05, 0x02, 0x58, 0x00,
486490
0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x80, 0x20, 0x02, 0x01, 0x30,
@@ -502,11 +506,11 @@ const unsigned char Xe2SIPCSRDebugBindless[] =
502506
0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x80, 0x20, 0x02, 0x11, 0x90,
503507
0x14, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x80,
504508
0x20, 0x02, 0x21, 0x90, 0x24, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
505-
0x61, 0x00, 0x0c, 0x80, 0x20, 0x02, 0x01, 0x20, 0x04, 0x05, 0x00, 0x00,
506-
0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x0c, 0x80, 0x20, 0x02, 0x01, 0x21,
507-
0x84, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x80,
509+
0x61, 0x00, 0x0c, 0x80, 0xa0, 0x0a, 0x01, 0x20, 0x05, 0x05, 0x46, 0x00,
510+
0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x0c, 0x80, 0xa0, 0x0a, 0x01, 0x21,
511+
0x85, 0x05, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x80,
508512
0x20, 0x82, 0x05, 0x01, 0x04, 0x01, 0x00, 0x02, 0x00, 0xc1, 0xff, 0xff,
509-
0x31, 0x20, 0x03, 0x80, 0x00, 0x00, 0x24, 0x04, 0x8c, 0x01, 0x00, 0xfe,
513+
0x31, 0x20, 0x01, 0x80, 0x00, 0x00, 0x24, 0x04, 0x8c, 0x01, 0x00, 0xfe,
510514
0x03, 0x00, 0xb8, 0xf4, 0x40, 0xa0, 0x00, 0x80, 0x20, 0x82, 0x05, 0x01,
511515
0x04, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x31, 0x21, 0x03, 0x80,
512516
0x00, 0x00, 0x24, 0x08, 0x8c, 0x01, 0x00, 0xfe, 0x03, 0x00, 0xb8, 0xf4,

0 commit comments

Comments
 (0)