Skip to content

Commit fa44909

Browse files
Kotynia, Piotrigcbot
authored andcommitted
Deprecate addGTRelativeLocation
Deprecate addGTRelativeLocation function. SLM offset should be emitted for SLM global vars. DW_AT_address_class 1 should be added to type based on dwarfAddressSpace. DW_AT_address_class 1 will be also added to global slm vars because FE doesn't add it to their debug info.
1 parent 4634f45 commit fa44909

File tree

10 files changed

+46
-295
lines changed

10 files changed

+46
-295
lines changed

IGC/Compiler/CISACodeGen/CShader.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1724,7 +1724,7 @@ uint64_t CShader::GetConstantExpr(ConstantExpr* CE) {
17241724
if (ConstantExpr * CE1 = dyn_cast<ConstantExpr>(C))
17251725
return GetConstantExpr(CE1);
17261726
if (GlobalVariable * GV = dyn_cast<GlobalVariable>(C))
1727-
return GetGlobalMappingValue(GV);
1727+
return GetSLMMappingValue(GV);
17281728
break;
17291729
}
17301730
case Instruction::Trunc: {
@@ -1752,14 +1752,14 @@ uint64_t CShader::GetConstantExpr(ConstantExpr* CE) {
17521752
return 0;
17531753
}
17541754

1755-
unsigned int CShader::GetGlobalMappingValue(llvm::Value* c)
1755+
unsigned int CShader::GetSLMMappingValue(llvm::Value* c)
17561756
{
17571757
IGC_ASSERT_MESSAGE(0, "The global variables are not handled");
17581758

17591759
return 0;
17601760
}
17611761

1762-
CVariable* CShader::GetGlobalMapping(llvm::Value* c)
1762+
CVariable* CShader::GetSLMMapping(llvm::Value* c)
17631763
{
17641764
IGC_ASSERT_MESSAGE(0, "The global variables are not handled");
17651765

@@ -1787,7 +1787,7 @@ CVariable* CShader::GetScalarConstant(llvm::Value* const c)
17871787
// GlobalVariables
17881788
if (isa<GlobalVariable>(c))
17891789
{
1790-
return GetGlobalMapping(c);
1790+
return GetSLMMapping(c);
17911791
}
17921792

17931793
// Constant Expression

IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2531,7 +2531,7 @@ namespace IGC
25312531
return true;
25322532
}
25332533

2534-
unsigned int COpenCLKernel::GetGlobalMappingValue(llvm::Value* c)
2534+
unsigned int COpenCLKernel::GetSLMMappingValue(llvm::Value *c)
25352535
{
25362536
unsigned int val = 0;
25372537
auto localIter = m_localOffsetsMap.find(c);
@@ -2546,10 +2546,10 @@ namespace IGC
25462546
return val;
25472547
}
25482548

2549-
CVariable* COpenCLKernel::GetGlobalMapping(llvm::Value* c)
2549+
CVariable *COpenCLKernel::GetSLMMapping(llvm::Value *c)
25502550
{
25512551
VISA_Type type = GetType(c->getType());
2552-
unsigned int val = GetGlobalMappingValue(c);
2552+
unsigned int val = GetSLMMappingValue(c);
25532553
return ImmToVariable(val, type);
25542554
}
25552555

IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ namespace IGC
176176
// Returns the immediate value mapped to GlobalVariable c.
177177
// (GlobalVariables represent the pointer to the global,
178178
// which is a compile-time constant)
179-
unsigned int GetGlobalMappingValue(llvm::Value* c) override;
180-
CVariable* GetGlobalMapping(llvm::Value* c) override;
179+
unsigned int GetSLMMappingValue(llvm::Value *c) override;
180+
CVariable *GetSLMMapping(llvm::Value *c) override;
181181

182182
const SOpenCLKernelInfo& getKernelInfo() const { return m_kernelInfo; }
183183

IGC/Compiler/CISACodeGen/ShaderCodeGen.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,8 @@ class CShader
266266
CVariable* GetScalarConstant(llvm::Value* c);
267267
CVariable* GetUndef(VISA_Type type);
268268
llvm::Constant* findCommonConstant(llvm::Constant* C, uint elts, uint currentEmitElts, bool& allSame);
269-
virtual unsigned int GetGlobalMappingValue(llvm::Value* c);
270-
virtual CVariable* GetGlobalMapping(llvm::Value* c);
269+
virtual unsigned int GetSLMMappingValue(llvm::Value *c);
270+
virtual CVariable *GetSLMMapping(llvm::Value *c);
271271
CVariable* BitCast(CVariable* var, VISA_Type newType);
272272
void CacheArgumentsList();
273273
virtual void MapPushedInputs();

IGC/Compiler/DebugInfo/ScalarVISAModule.cpp

Lines changed: 8 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ const Argument* ScalarVisaModule::GetTracedArgument(const Value* pVal, bool isAd
343343
VISAVariableLocation
344344
ScalarVisaModule::GetVariableLocation(const llvm::Instruction* pInst) const
345345
{
346-
const Value* pVal = nullptr;
346+
Value* pVal = nullptr;
347347
MDNode* pNode = nullptr;
348348
bool isDbgDclInst = false;
349349
if (const DbgDeclareInst * pDbgAddrInst = dyn_cast<DbgDeclareInst>(pInst))
@@ -464,9 +464,7 @@ ScalarVisaModule::GetVariableLocation(const llvm::Instruction* pInst) const
464464
}
465465
}
466466

467-
Value* pValue = const_cast<Value*>(pVal);
468-
469-
Type* pType = pValue->getType();
467+
Type* pType = pVal->getType();
470468

471469
if (isDbgDclInst)
472470
{
@@ -479,49 +477,29 @@ ScalarVisaModule::GetVariableLocation(const llvm::Instruction* pInst) const
479477
pType = IGCLLVM::getNonOpaquePtrEltTy(pType);
480478
}
481479

482-
bool isInSurface = false;
483480
bool isGlobalAddrSpace = false;
484-
unsigned int surfaceReg = 0;
485481
if (pType->isPointerTy())
486482
{
487483
unsigned int addrSpace = pType->getPointerAddressSpace();
488-
if (addrSpace == ADDRESS_SPACE_LOCAL)
489-
{
490-
isInSurface = true;
491-
surfaceReg = TEXTURE_REGISTER_BEGIN + LOCAL_SURFACE_BTI;
492-
}
493484
if (addrSpace == ADDRESS_SPACE_GLOBAL)
494485
{
495486
isGlobalAddrSpace = true;
496487
}
497488
}
498489

499-
if (pVal->getType()->isPointerTy())
490+
// SLM global variable
491+
if (isa<GlobalVariable>(pVal))
500492
{
501-
unsigned int addrSpace = pVal->getType()->getPointerAddressSpace();
502-
if (addrSpace == ADDRESS_SPACE_LOCAL)
503-
{
504-
isInSurface = true;
505-
surfaceReg = TEXTURE_REGISTER_BEGIN + LOCAL_SURFACE_BTI;
506-
}
507-
}
508-
509-
if (isa<GlobalVariable>(pValue))
510-
{
511-
unsigned int offset = m_pShader->GetGlobalMappingValue(pValue);
512-
if (isInSurface)
513-
{
514-
return VISAVariableLocation(surfaceReg, offset, false, isDbgDclInst, 0, false, this);
515-
}
516-
return VISAVariableLocation(offset, false, isDbgDclInst, 0, false, false, this);
493+
unsigned int offset = m_pShader->GetSLMMappingValue(pVal);
494+
return VISAVariableLocation(offset, true, this);
517495
}
518496

519497
// At this point we expect only a register
520498
CVariable* pVar = nullptr;
521-
auto globalSubCVar = m_pShader->GetGlobalCVar(pValue);
499+
auto globalSubCVar = m_pShader->GetGlobalCVar(pVal);
522500

523501
if (!globalSubCVar) {
524-
pVar = m_pShader->GetDebugInfoData().getMapping(*pInst->getFunction(), pValue);
502+
pVar = m_pShader->GetDebugInfoData().getMapping(*pInst->getFunction(), pVal);
525503
if (!pVar)
526504
{
527505
return VISAVariableLocation(this);
@@ -552,12 +530,6 @@ ScalarVisaModule::GetVariableLocation(const llvm::Instruction* pInst) const
552530
{
553531
vectorNumElements = 1;
554532
}
555-
556-
if (isInSurface)
557-
{
558-
return VISAVariableLocation(surfaceReg, reg, true /*isRegister*/, isDbgDclInst,
559-
vectorNumElements, !pVar->IsUniform(), this);
560-
}
561533
VISAVariableLocation genReg(reg, true /*isRegister*/, isDbgDclInst, vectorNumElements,
562534
!pVar->IsUniform(), isGlobalAddrSpace, this);
563535
// SIMD32 locations can't into one register. See VISAVariableLocation::m_locationSecondReg field description for more information

0 commit comments

Comments
 (0)