Skip to content

Commit 18e3d2c

Browse files
DianaChenigcbot
authored andcommitted
Revert "vISA: support paired surface"
Revert due to functional issue
1 parent 13a2387 commit 18e3d2c

28 files changed

+86
-401
lines changed

IGC/Compiler/CISACodeGen/CISABuilder.cpp

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2157,22 +2157,6 @@ namespace IGC
21572157
return srcOpnd;
21582158
}
21592159

2160-
VISA_RawOpnd* CEncoder::GetPairedResourceOperand(const ResourceDescriptor& pairedResource)
2161-
{
2162-
VISA_RawOpnd* pairedResourceBSSOOpnd = nullptr;
2163-
if (m_program->m_Platform->hasSamplerFeedbackSurface() &&
2164-
pairedResource.m_surfaceType == ESURFACE_BINDLESS &&
2165-
IGC_IS_FLAG_ENABLED(EnableInsertingPairedResourcePointer))
2166-
{
2167-
pairedResourceBSSOOpnd = GetRawSource(pairedResource.m_resource);
2168-
}
2169-
else
2170-
{
2171-
V(vKernel->CreateVISANullRawOperand(pairedResourceBSSOOpnd, false));
2172-
}
2173-
return pairedResourceBSSOOpnd;
2174-
}
2175-
21762160
VISA_RawOpnd* CEncoder::GetRawDestination(CVariable* var, unsigned offset)
21772161
{
21782162
VISA_RawOpnd* dstOpnd = nullptr;
@@ -2485,7 +2469,6 @@ namespace IGC
24852469
uint writeMask,
24862470
CVariable* offset,
24872471
const ResourceDescriptor& resource,
2488-
const ResourceDescriptor& pairedResource,
24892472
const SamplerDescriptor& sampler,
24902473
uint numSources,
24912474
CVariable* dst,
@@ -2508,7 +2491,6 @@ namespace IGC
25082491
bool isIdxLT16;
25092492
VISA_StateOpndHandle* samplerOpnd = GetSamplerOperand(sampler, isIdxLT16);
25102493
VISA_StateOpndHandle* btiOpnd = GetVISASurfaceOpnd(resource);
2511-
VISA_RawOpnd* pairedResourceBSSOOpnd = GetPairedResourceOperand(pairedResource);
25122494
VISA_RawOpnd* dstVar = GetRawDestination(dst);
25132495
VISA_RawOpnd* opndArray[11];
25142496
for (int i = 0; i < numMsgSpecificOpnds; i++)
@@ -2540,7 +2522,6 @@ namespace IGC
25402522
aoffimmi,
25412523
samplerOpnd,
25422524
btiOpnd,
2543-
pairedResourceBSSOOpnd,
25442525
dstVar,
25452526
numSources,
25462527
opndArray);
@@ -2554,7 +2535,6 @@ namespace IGC
25542535
uint writeMask,
25552536
CVariable* offset,
25562537
const ResourceDescriptor& resource,
2557-
const ResourceDescriptor& pairedResource,
25582538
uint numSources,
25592539
CVariable* dst,
25602540
SmallVector<CVariable*, 4>& payload,
@@ -2570,7 +2550,6 @@ namespace IGC
25702550

25712551
VISA_PredOpnd* predOpnd = GetFlagOperand(m_encoderState.m_flag);
25722552
VISA_StateOpndHandle* surfOpnd = GetVISASurfaceOpnd(resource);
2573-
VISA_RawOpnd* pairedResourceBSSOOpnd = GetPairedResourceOperand(pairedResource);
25742553
VISA_RawOpnd* dstVar = GetRawDestination(dst);
25752554

25762555
VISA_RawOpnd* opndArray[11];
@@ -2593,7 +2572,6 @@ namespace IGC
25932572
ConvertChannelMaskToVisaType(writeMask),
25942573
aoffimmi,
25952574
surfOpnd,
2596-
pairedResourceBSSOOpnd,
25972575
dstVar,
25982576
numSources,
25992577
opndArray);
@@ -2671,7 +2649,6 @@ namespace IGC
26712649
EOPCODE subOpcode,
26722650
CVariable* offset,
26732651
const ResourceDescriptor& resource,
2674-
const ResourceDescriptor& pairedResource,
26752652
const SamplerDescriptor& sampler,
26762653
uint numSources,
26772654
CVariable* dst,
@@ -2693,7 +2670,6 @@ namespace IGC
26932670
VISA_StateOpndHandle* surfOpnd = GetVISASurfaceOpnd(resource);
26942671
uint32_t samplerImmIndex = 0;
26952672
uint32_t surfaceImmIndex = 0;
2696-
VISA_RawOpnd* pairedResourceBSSOOpnd = GetPairedResourceOperand(pairedResource);
26972673
VISA_RawOpnd* dstVar = GetRawDestination(dst);
26982674
VISA_RawOpnd* opndArray[11];
26992675
for (unsigned int i = 0; i < numSources; i++)
@@ -2721,7 +2697,6 @@ namespace IGC
27212697
samplerImmIndex,
27222698
surfOpnd,
27232699
surfaceImmIndex,
2724-
pairedResourceBSSOOpnd,
27252700
dstVar,
27262701
numSources,
27272702
opndArray);

IGC/Compiler/CISACodeGen/CISABuilder.hpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ namespace IGC
191191
uint writeMask,
192192
CVariable* offset,
193193
const ResourceDescriptor& bindingTableIndex,
194-
const ResourceDescriptor& pairedesource,
195194
const SamplerDescriptor& SamplerIdx,
196195
uint numSources,
197196
CVariable* dst,
@@ -205,7 +204,6 @@ namespace IGC
205204
uint writeMask,
206205
CVariable* offset,
207206
const ResourceDescriptor& resource,
208-
const ResourceDescriptor& pairedesource,
209207
uint numSources,
210208
CVariable* dst,
211209
llvm::SmallVector<CVariable*, 4> & payload,
@@ -218,7 +216,6 @@ namespace IGC
218216
EOPCODE subOpcode,
219217
CVariable* offset,
220218
const ResourceDescriptor& resource,
221-
const ResourceDescriptor& pairedesource,
222219
const SamplerDescriptor& sampler,
223220
uint numSources,
224221
CVariable* dst,
@@ -527,7 +524,6 @@ namespace IGC
527524
VISA_VectorOpnd* GetSourceOperandNoModifier(CVariable* var);
528525
VISA_VectorOpnd* GetDestinationOperand(CVariable* var, const SModifier& mod);
529526
VISA_RawOpnd* GetRawSource(CVariable* var, uint offset = 0);
530-
VISA_RawOpnd* GetPairedResourceOperand(const ResourceDescriptor& pairedResource);
531527
VISA_RawOpnd* GetRawDestination(CVariable* var, unsigned offset = 0);
532528
VISA_PredOpnd* GetFlagOperand(const SFlag& flag);
533529
VISA_StateOpndHandle* GetVISASurfaceOpnd(e_predefSurface surfaceType, CVariable* bti);
@@ -1092,13 +1088,11 @@ namespace IGC
10921088
const ResourceDescriptor& resource, uint numSources, CVariable* dst,
10931089
llvm::SmallVector<CVariable*, 4> & payload, bool feedbackEnable)
10941090
{
1095-
ResourceDescriptor pairedResource{};
10961091
Load(
10971092
subOpcode,
10981093
writeMask,
10991094
offset,
11001095
resource,
1101-
pairedResource,
11021096
numSources,
11031097
dst,
11041098
payload,

IGC/Compiler/CISACodeGen/EmitVISAPass.cpp

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4915,15 +4915,15 @@ void EmitPass::emitLdInstruction(llvm::Instruction* inst)
49154915
{
49164916
uint numOperands = inst->getNumOperands();
49174917
IGC_ASSERT_MESSAGE(7 < numOperands, "Wrong number of operands");
4918-
IGC_ASSERT_MESSAGE(numOperands < 11, "Wrong number of operands");
4918+
IGC_ASSERT_MESSAGE(numOperands < 10, "Wrong number of operands");
49194919

49204920
EOPCODE opCode = GetOpCode(inst);
49214921
//Subtract the offsets, resource sources to get
49224922
//the number of texture coordinates and index to texture source
4923-
uint numSources = numOperands - 6;
4923+
uint numSources = numOperands - 5;
49244924
uint textureArgIdx = numOperands - 5;
49254925

4926-
uint offsetSourceIndex = numSources + 2;
4926+
uint offsetSourceIndex = numSources + 1;
49274927

49284928
SmallVector<CVariable*, 4> payload;
49294929

@@ -5027,11 +5027,6 @@ void EmitPass::emitLdInstruction(llvm::Instruction* inst)
50275027
m_encoder->SetUniformSIMDSize(m_currShader->m_Platform->getMinDispatchMode());
50285028
}
50295029

5030-
SamplerLoadIntrinsic* samplerLoadIntrinsic = llvm::cast<llvm::SamplerLoadIntrinsic>(inst);
5031-
ResourceDescriptor pairedResource = samplerLoadIntrinsic->hasPairedTextureArg() &&
5032-
llvm::isa<llvm::UndefValue>(samplerLoadIntrinsic->getPairedTextureValue()) == false ?
5033-
GetResourceVariable(samplerLoadIntrinsic->getPairedTextureValue()) :
5034-
ResourceDescriptor();
50355030

50365031
CVariable* offset = ComputeSampleIntOffset(inst, offsetSourceIndex);
50375032

@@ -5040,7 +5035,6 @@ void EmitPass::emitLdInstruction(llvm::Instruction* inst)
50405035
writeMask.getEM(),
50415036
offset,
50425037
resource,
5043-
pairedResource,
50445038
numSources,
50455039
dst,
50465040
payload,
@@ -7498,10 +7492,6 @@ void EmitPass::emitSampleInstruction(SampleIntrinsic* inst)
74987492

74997493
m_currShader->SetHasSample();
75007494
ResourceDescriptor resource = GetSampleResourceHelper(inst);
7501-
bool isEval = isUsedOnlyByEval(inst);
7502-
ResourceDescriptor pairedResource = inst->hasPairedTextureArg() && llvm::isa<llvm::UndefValue>(inst->getPairedTextureValue()) == false ?
7503-
GetResourceVariable(inst->getPairedTextureValue()) :
7504-
ResourceDescriptor();
75057495

75067496

75077497
//Get sampler index in the array of operands
@@ -7608,7 +7598,6 @@ void EmitPass::emitSampleInstruction(SampleIntrinsic* inst)
76087598
writeMask.getEM(),
76097599
immOffset,
76107600
resource,
7611-
pairedResource,
76127601
sampler,
76137602
numSources,
76147603
dst,
@@ -7920,10 +7909,6 @@ void EmitPass::emitGather4Instruction(SamplerGatherIntrinsic* inst)
79207909
ResourceDescriptor resource = GetResourceVariable(textureValue);
79217910

79227911
bool isEval = isUsedOnlyByEval(inst);
7923-
ResourceDescriptor pairedResource = llvm::isa<llvm::UndefValue>(inst->getPairedTextureValue()) == false ?
7924-
GetResourceVariable(inst->getPairedTextureValue()) :
7925-
ResourceDescriptor();
7926-
79277912
SamplerDescriptor sampler;
79287913
Value* samplerValue = inst->getSamplerValue();
79297914

@@ -7989,7 +7974,6 @@ void EmitPass::emitGather4Instruction(SamplerGatherIntrinsic* inst)
79897974
opCode,
79907975
offset,
79917976
resource,
7992-
pairedResource,
79937977
sampler,
79947978
numSources,
79957979
dst,

IGC/Compiler/CISACodeGen/UniformAssumptions.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,10 @@ namespace IGC {
8686
}
8787
}
8888
// Figure out the intrinsic operands for texture & sampler
89-
// & paired texture
90-
llvm::Value* pPairedTextureValue = nullptr;
9189
llvm::Value* pTextureValue = nullptr;
9290
llvm::Value*pSamplerValue = nullptr;
9391
IGC::getTextureAndSamplerOperands(
9492
pIntr,
95-
pPairedTextureValue,
9693
pTextureValue,
9794
pSamplerValue);
9895

@@ -106,16 +103,6 @@ namespace IGC {
106103
}
107104
}
108105

109-
if (pPairedTextureValue && pPairedTextureValue->getType()->isPointerTy() &&
110-
!m_WIAnalysis->isUniform(pPairedTextureValue))
111-
{
112-
// Check assumptions for texture:
113-
if (m_forceUniformTexture || IsAssumedUniform(pPairedTextureValue))
114-
{
115-
MakeUniformResourceOperand(pPairedTextureValue, &CI);
116-
}
117-
}
118-
119106
if (pSamplerValue && pSamplerValue->getType()->isPointerTy() &&
120107
!m_WIAnalysis->isUniform(pSamplerValue))
121108
{

IGC/Compiler/CISACodeGen/helper.cpp

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -979,12 +979,7 @@ namespace IGC
979979
case llvm::GenISAIntrinsic::GenISA_ldmsptr:
980980
{
981981
llvm::Value* pTextureValue = cast<SamplerLoadIntrinsic>(pIntr)->getTextureValue();
982-
llvm::Value* pPairedTextureValue = cast<SamplerLoadIntrinsic>(pIntr)->getPairedTextureValue();
983982
overloadedTys.push_back(pCalledFunc->getReturnType());
984-
if (pPairedTextureValue != nullptr)
985-
{
986-
overloadedTys.push_back(pPairedTextureValue == oldPtr ? newPtr->getType() : pPairedTextureValue->getType());
987-
}
988983
overloadedTys.push_back(pTextureValue == oldPtr ? newPtr->getType() : pTextureValue->getType());
989984
break;
990985
}
@@ -1008,22 +1003,15 @@ namespace IGC
10081003
case llvm::GenISAIntrinsic::GenISA_lodptr:
10091004
{
10101005
// Figure out the intrinsic operands for texture & sampler
1011-
// & paired texture
1012-
llvm::Value* pPairedTextureValue = nullptr;
10131006
llvm::Value* pTextureValue = nullptr;
10141007
llvm::Value* pSamplerValue = nullptr;
10151008
IGC::getTextureAndSamplerOperands(
10161009
pIntr,
1017-
pPairedTextureValue,
10181010
pTextureValue,
10191011
pSamplerValue);
10201012

10211013
overloadedTys.push_back(pCalledFunc->getReturnType());
10221014
overloadedTys.push_back(pIntr->getOperand(0)->getType());
1023-
if (pPairedTextureValue != nullptr)
1024-
{
1025-
overloadedTys.push_back(pPairedTextureValue == oldPtr ? newPtr->getType() : pPairedTextureValue->getType());
1026-
}
10271015
overloadedTys.push_back(pTextureValue == oldPtr ? newPtr->getType() : pTextureValue->getType());
10281016
if (pSamplerValue != nullptr)
10291017
{
@@ -1130,41 +1118,24 @@ namespace IGC
11301118
llvm::GenIntrinsicInst* pIntr,
11311119
llvm::Value*& pTextureValue,
11321120
llvm::Value*& pSamplerValue)
1133-
{
1134-
llvm::Value* pUnusedPairedTextureValue;
1135-
getTextureAndSamplerOperands(pIntr, pUnusedPairedTextureValue, pTextureValue, pSamplerValue);
1136-
}
1137-
1138-
///
1139-
/// Returns the sampler/texture/paired texture pointers for resource access intrinsics
1140-
///
1141-
void getTextureAndSamplerOperands(
1142-
llvm::GenIntrinsicInst* pIntr,
1143-
llvm::Value*& pPairedTextureValue,
1144-
llvm::Value*& pTextureValue,
1145-
llvm::Value*& pSamplerValue)
11461121
{
11471122
if (llvm::SamplerLoadIntrinsic * pSamplerLoadInst = llvm::dyn_cast<llvm::SamplerLoadIntrinsic>(pIntr))
11481123
{
1149-
pPairedTextureValue = pSamplerLoadInst->getPairedTextureValue();
11501124
pTextureValue = pSamplerLoadInst->getTextureValue();
11511125
pSamplerValue = nullptr;
11521126
}
11531127
else if (llvm::SampleIntrinsic * pSampleInst = llvm::dyn_cast<llvm::SampleIntrinsic>(pIntr))
11541128
{
1155-
pPairedTextureValue = pSampleInst->getPairedTextureValue();
11561129
pTextureValue = pSampleInst->getTextureValue();
11571130
pSamplerValue = pSampleInst->getSamplerValue();
11581131
}
11591132
else if (llvm::SamplerGatherIntrinsic * pGatherInst = llvm::dyn_cast<llvm::SamplerGatherIntrinsic>(pIntr))
11601133
{
1161-
pPairedTextureValue = pGatherInst->getPairedTextureValue();
11621134
pTextureValue = pGatherInst->getTextureValue();
11631135
pSamplerValue = pGatherInst->getSamplerValue();
11641136
}
11651137
else
11661138
{
1167-
pPairedTextureValue = nullptr;
11681139
pTextureValue = nullptr;
11691140
pSamplerValue = nullptr;
11701141
switch (pIntr->getIntrinsicID())

IGC/Compiler/CISACodeGen/helper.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ namespace IGC
157157
llvm::StoreRawIntrinsic* CreateStoreRawIntrinsic(llvm::StoreInst* inst, llvm::Value* bufPtr, llvm::Value* offsetVal);
158158

159159
void getTextureAndSamplerOperands(llvm::GenIntrinsicInst* pIntr, llvm::Value*& pTextureValue, llvm::Value*& pSamplerValue);
160-
void getTextureAndSamplerOperands(llvm::GenIntrinsicInst* pIntr, llvm::Value*& pPairedTextureValue, llvm::Value*& pTextureValue, llvm::Value*& pSamplerValue);
161160
void ChangePtrTypeInIntrinsic(llvm::GenIntrinsicInst*& pIntr, llvm::Value* oldPtr, llvm::Value* newPtr);
162161

163162
llvm::Value* TracePointerSource(llvm::Value* resourcePtr);

IGC/Compiler/CustomSafeOptPass.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1809,12 +1809,6 @@ void IGC::CustomSafeOptPass::visitLdptr(llvm::SamplerLoadIntrinsic* inst)
18091809
return;
18101810
}
18111811

1812-
// Sampler feedback (GenISA_evaluateSampler) supports GenISA_ldptr and not GenISA_typedread
1813-
llvm::Value* pairedTexture = inst->getPairedTextureValue();
1814-
if (pairedTexture != nullptr && !isa<UndefValue>(pairedTexture))
1815-
{
1816-
return;
1817-
}
18181812
// change
18191813
// % 10 = call fast <4 x float> @llvm.genx.GenISA.ldptr.v4f32.p196608v4f32(i32 %_s1.i, i32 %_s14.i, i32 0, i32 0, <4 x float> addrspace(196608)* null, i32 0, i32 0, i32 0), !dbg !123
18201814
// to
@@ -1950,7 +1944,6 @@ void IGC::CustomSafeOptPass::visitSampleBptr(llvm::SampleIntrinsic* sampleInst)
19501944
llvm::SmallVector<llvm::Type*, 4> overloadedTys;
19511945
overloadedTys.push_back(sampleInst->getCalledFunction()->getReturnType());
19521946
overloadedTys.push_back(sampleInst->getOperand(0)->getType());
1953-
overloadedTys.push_back(sampleInst->getPairedTextureValue()->getType());
19541947
overloadedTys.push_back(sampleInst->getTextureValue()->getType());
19551948
overloadedTys.push_back(sampleInst->getSamplerValue()->getType());
19561949

IGC/Compiler/LegalizationPass.cpp

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2273,31 +2273,20 @@ void Legalization::PromoteFp16ToFp32OnGenSampleCall(llvm::CallInst& I)
22732273

22742274
llvm::SmallVector<Type*, 5> types;
22752275

2276-
llvm::Value* pairedTexture = nullptr;
22772276
llvm::Value* texture = nullptr;
22782277
llvm::Value* sampler = nullptr;
22792278

22802279
if (SampleIntrinsic * inst = llvm::dyn_cast<SampleIntrinsic>(&I))
22812280
{
2282-
pairedTexture = inst->getPairedTextureValue();
22832281
texture = inst->getTextureValue();
22842282
sampler = inst->getSamplerValue();
22852283
}
22862284
else if (SamplerGatherIntrinsic * inst = llvm::dyn_cast<SamplerGatherIntrinsic>(&I))
22872285
{
2288-
pairedTexture = inst->getPairedTextureValue();
22892286
texture = inst->getTextureValue();
22902287
sampler = inst->getSamplerValue();
22912288
}
2292-
if (pairedTexture && pairedTexture->getType()->isPointerTy() &&
2293-
texture && texture->getType()->isPointerTy())
2294-
{
2295-
types.resize(5);
2296-
types[2] = pairedTexture->getType();
2297-
types[3] = texture->getType();
2298-
types[4] = sampler->getType();
2299-
}
2300-
else if (texture && texture->getType()->isPointerTy())
2289+
if (texture && texture->getType()->isPointerTy())
23012290
{
23022291
types.resize(4);
23032292
types[2] = texture->getType();

0 commit comments

Comments
 (0)