Stop accessing task count from out-of-bound in opencl and shared ult

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2022-04-01 15:38:38 +00:00
committed by Compute-Runtime-Automation
parent 7c068cb05b
commit 817ba40771
4 changed files with 35 additions and 11 deletions

View File

@ -30,8 +30,6 @@ struct UltCommandStreamReceiverTest
ClDeviceFixture::SetUp();
ClHardwareParse::SetUp();
size_t sizeStream = 512;
size_t alignmentStream = 0x1000;
cmdBuffer = alignedMalloc(sizeStream, alignmentStream);
dshBuffer = alignedMalloc(sizeStream, alignmentStream);
iohBuffer = alignedMalloc(sizeStream, alignmentStream);
@ -42,6 +40,14 @@ struct UltCommandStreamReceiverTest
ASSERT_NE(nullptr, iohBuffer);
ASSERT_NE(nullptr, sshBuffer);
initHeaps();
flushTaskFlags.threadArbitrationPolicy = NEO::HwHelper::get(hardwareInfo.platform.eRenderCoreFamily).getDefaultThreadArbitrationPolicy();
pDevice->getGpgpuCommandStreamReceiver().setupContext(*pDevice->getDefaultEngine().osContext);
}
void initHeaps() {
commandStream.replaceBuffer(cmdBuffer, sizeStream);
auto graphicsAllocation = new MockGraphicsAllocation(cmdBuffer, sizeStream);
commandStream.replaceGraphicsAllocation(graphicsAllocation);
@ -58,18 +64,18 @@ struct UltCommandStreamReceiverTest
ssh.replaceBuffer(sshBuffer, sizeStream);
graphicsAllocation = new MockGraphicsAllocation(sshBuffer, sizeStream);
ssh.replaceGraphicsAllocation(graphicsAllocation);
flushTaskFlags.threadArbitrationPolicy = NEO::HwHelper::get(hardwareInfo.platform.eRenderCoreFamily).getDefaultThreadArbitrationPolicy();
pDevice->getGpgpuCommandStreamReceiver().setupContext(*pDevice->getDefaultEngine().osContext);
}
void TearDown() override {
pDevice->getGpgpuCommandStreamReceiver().flushBatchedSubmissions();
void cleanupHeaps() {
delete dsh.getGraphicsAllocation();
delete ioh.getGraphicsAllocation();
delete ssh.getGraphicsAllocation();
delete commandStream.getGraphicsAllocation();
}
void TearDown() override {
pDevice->getGpgpuCommandStreamReceiver().flushBatchedSubmissions();
cleanupHeaps();
alignedFree(sshBuffer);
alignedFree(iohBuffer);
@ -167,5 +173,8 @@ struct UltCommandStreamReceiverTest
uint32_t latestSentDcFlushTaskCount;
uint32_t latestSentNonDcFlushTaskCount;
uint32_t dcFlushRequiredTaskCount;
const size_t sizeStream = 512;
const size_t alignmentStream = 0x1000;
};
} // namespace NEO