Skip to content

Commit 64d0420

Browse files
asliwinsigcbot
authored andcommitted
Remove code for reading UBO through sampler
This change removes IGC code for features no longer supported in the driver.
1 parent 1a98d9f commit 64d0420

File tree

2 files changed

+23
-33
lines changed

2 files changed

+23
-33
lines changed

IGC/Compiler/CISACodeGen/ConstantCoalescing.cpp

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,7 +1767,6 @@ void ConstantCoalescing::ScatterToSampler(Instruction *load, Value *bufIdxV, uin
17671767
IGC_ASSERT((!load->getType()->isVectorTy()) ||
17681768
(cast<IGCLLVM::FixedVectorType>(load->getType())->getNumElements() <= 4));
17691769

1770-
const bool useByteAddress = m_ctx->m_DriverInfo.UsesTypedConstantBuffersWithByteAddress();
17711770

17721771
// Code below doesn't support crossing 4 DWORD boundary i.e. mapping a
17731772
// single input load to multiple sampler loads.
@@ -1780,33 +1779,28 @@ void ConstantCoalescing::ScatterToSampler(Instruction *load, Value *bufIdxV, uin
17801779
irBuilder->SetInsertPoint(baseInBytes);
17811780

17821781
WIAnalysis::WIDependancy baseInBytesDep = wiAns->whichDepend(baseInBytes);
1782+
Value *baseAddressInOwords = GetSamplerAlignedAddress(baseInBytes);
1783+
IGC_ASSERT(baseAddressInOwords);
1784+
1785+
// it is possible that baseInBytes is uniform, yet load is non-uniform due to the use location of load
1786+
if (baseAddressInOwords != baseInBytes->getOperand(0)) {
1787+
Value *newVal = irBuilder->CreateShl(baseAddressInOwords, ConstantInt::get(baseAddressInOwords->getType(), 4));
1788+
wiAns->incUpdateDepend(newVal, baseInBytesDep);
1789+
baseInBytes->replaceAllUsesWith(newVal);
1790+
} else if (wiAns->whichDepend(baseAddressInOwords) != baseInBytesDep) {
1791+
// quick fix for a special case: baseAddressInOwords is uniform and baseInBytes is not uniform.
1792+
// If we use baseInBytes-src0 (elementIndx) directly at cf-join point by this transform,
1793+
// we can change the uniformness of baseAddressInOwords
1794+
baseAddressInOwords =
1795+
irBuilder->CreateShl(baseAddressInOwords, ConstantInt::get(baseAddressInOwords->getType(), 0));
1796+
wiAns->incUpdateDepend(baseAddressInOwords, baseInBytesDep);
1797+
Value *newVal = irBuilder->CreateShl(baseAddressInOwords, ConstantInt::get(baseAddressInOwords->getType(), 4));
1798+
wiAns->incUpdateDepend(newVal, baseInBytesDep);
1799+
baseInBytes->replaceAllUsesWith(newVal);
1800+
}
1801+
1802+
Value *chunkBaseAddress = baseAddressInOwords;
17831803

1784-
// Data address for sampler load, either in OWORDs or in bytes
1785-
Value *chunkBaseAddress = baseInBytes;
1786-
if (!useByteAddress) {
1787-
// base address is in OWORDs
1788-
Value *baseAddressInOwords = GetSamplerAlignedAddress(baseInBytes);
1789-
IGC_ASSERT(baseAddressInOwords);
1790-
1791-
// it is possible that baseInBytes is uniform, yet load is non-uniform due to the use location of load
1792-
if (baseAddressInOwords != baseInBytes->getOperand(0)) {
1793-
Value *newVal = irBuilder->CreateShl(baseAddressInOwords, ConstantInt::get(baseAddressInOwords->getType(), 4));
1794-
wiAns->incUpdateDepend(newVal, baseInBytesDep);
1795-
baseInBytes->replaceAllUsesWith(newVal);
1796-
} else if (wiAns->whichDepend(baseAddressInOwords) != baseInBytesDep) {
1797-
// quick fix for a special case: baseAddressInOwords is uniform and baseInBytes is not uniform.
1798-
// If we use baseInBytes-src0 (elementIndx) directly at cf-join point by this transform,
1799-
// we can change the uniformness of baseAddressInOwords
1800-
baseAddressInOwords =
1801-
irBuilder->CreateShl(baseAddressInOwords, ConstantInt::get(baseAddressInOwords->getType(), 0));
1802-
wiAns->incUpdateDepend(baseAddressInOwords, baseInBytesDep);
1803-
Value *newVal = irBuilder->CreateShl(baseAddressInOwords, ConstantInt::get(baseAddressInOwords->getType(), 4));
1804-
wiAns->incUpdateDepend(newVal, baseInBytesDep);
1805-
baseInBytes->replaceAllUsesWith(newVal);
1806-
}
1807-
1808-
chunkBaseAddress = baseAddressInOwords;
1809-
}
18101804
BufChunk *cov_chunk = nullptr;
18111805
for (std::vector<BufChunk *>::reverse_iterator rit = chunk_vec.rbegin(), rie = chunk_vec.rend(); rit != rie;
18121806
++rit) {
@@ -1836,12 +1830,11 @@ void ConstantCoalescing::ScatterToSampler(Instruction *load, Value *bufIdxV, uin
18361830

18371831
Value *dataAddress = chunkBaseAddress;
18381832
if (offsetInBytes >= samplerLoadSizeInBytes) {
1839-
const uint32_t chunkOffset = (useByteAddress) ? (cov_chunk->chunkStart * cov_chunk->elementSize) : // in bytes
1840-
(offsetInBytes / samplerLoadSizeInBytes); // in OWORDs
1833+
const uint32_t chunkOffset = offsetInBytes / samplerLoadSizeInBytes;
18411834
dataAddress = irBuilder->CreateAdd(dataAddress, ConstantInt::get(dataAddress->getType(), chunkOffset));
18421835
wiAns->incUpdateDepend(dataAddress, WIAnalysis::RANDOM);
18431836
}
1844-
if (dataAddress->getType()->getIntegerBitWidth() >= 32 && !useByteAddress) {
1837+
if (dataAddress->getType()->getIntegerBitWidth() >= 32) {
18451838
dataAddress = irBuilder->CreateAnd(dataAddress, ConstantInt::get(dataAddress->getType(), 0x0FFFFFFF));
18461839
wiAns->incUpdateDepend(dataAddress, WIAnalysis::RANDOM);
18471840
}

IGC/Compiler/CISACodeGen/DriverInfo.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,6 @@ class CDriverInfo {
7676
/// The driver uses typed or untyped constant buffers (for ld_raw vs sampler)
7777
virtual bool UsesTypedConstantBuffers3D() const { return true; }
7878

79-
/// The driver uses typed constant buffers requiring byte address access.
80-
virtual bool UsesTypedConstantBuffersWithByteAddress() const { return false; }
81-
8279
/// The driver uses typed or untyped constant buffers (for ld_raw vs sampler)
8380
virtual bool UsesTypedConstantBuffersGPGPU() const { return true; }
8481

0 commit comments

Comments
 (0)