mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-20 17:00:59 +08:00
Make SVM_GPU allocation OneTimeAubWritable.
Reset Aub/Tbx writable flags on enqueue SVM unmap Change-Id: Ib8370fc049bcbf24d787c5d677520afa12135ee5 Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
0a7a4bfa4d
commit
362a63699f
@@ -30,6 +30,7 @@ class AubHelper : public NonCopyableOrMovableClass {
|
||||
case GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER:
|
||||
case GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR:
|
||||
case GraphicsAllocation::AllocationType::MAP_ALLOCATION:
|
||||
case GraphicsAllocation::AllocationType::SVM_GPU:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
||||
@@ -195,6 +195,9 @@ cl_int CommandQueueHw<GfxFamily>::enqueueSVMUnmap(void *svmPtr,
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
|
||||
svmData->gpuAllocation->setAubWritable(true, GraphicsAllocation::defaultBank);
|
||||
svmData->gpuAllocation->setTbxWritable(true, GraphicsAllocation::defaultBank);
|
||||
|
||||
MultiDispatchInfo dispatchInfo;
|
||||
auto &builder = getDevice().getExecutionEnvironment()->getBuiltIns()->getBuiltinDispatchInfoBuilder(EBuiltInOps::CopyBufferToBuffer,
|
||||
this->getContext(), this->getDevice());
|
||||
|
||||
@@ -1168,6 +1168,58 @@ HWTEST_F(EnqueueSvmTestLocalMemory, givenEnabledLocalMemoryWhenMappedSvmRegionIs
|
||||
clReleaseEvent(event);
|
||||
}
|
||||
|
||||
HWTEST_F(EnqueueSvmTestLocalMemory, givenNonReadOnlyMapWhenUnmappingThenSetAubTbxWritableBeforeUnmapEnqueue) {
|
||||
class MyQueue : public MockCommandQueueHw<FamilyType> {
|
||||
public:
|
||||
using MockCommandQueueHw<FamilyType>::MockCommandQueueHw;
|
||||
|
||||
void enqueueHandlerHook(const unsigned int commandType, const MultiDispatchInfo &dispatchInfo) override {
|
||||
waitUntilCompleteCalled++;
|
||||
if (allocationToVerify) {
|
||||
EXPECT_TRUE(allocationToVerify->isAubWritable(GraphicsAllocation::defaultBank));
|
||||
EXPECT_TRUE(allocationToVerify->isTbxWritable(GraphicsAllocation::defaultBank));
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t waitUntilCompleteCalled = 0;
|
||||
GraphicsAllocation *allocationToVerify = nullptr;
|
||||
};
|
||||
|
||||
MyQueue myQueue(context.get(), pClDevice, nullptr);
|
||||
|
||||
retVal = myQueue.enqueueSVMMap(CL_TRUE, CL_MAP_WRITE, svmPtr, size, 0, nullptr, nullptr, false);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
auto gpuAllocation = mockSvmManager->getSVMAlloc(svmPtr)->gpuAllocation;
|
||||
myQueue.allocationToVerify = gpuAllocation;
|
||||
|
||||
gpuAllocation->setAubWritable(false, GraphicsAllocation::defaultBank);
|
||||
gpuAllocation->setTbxWritable(false, GraphicsAllocation::defaultBank);
|
||||
|
||||
EXPECT_EQ(1u, myQueue.waitUntilCompleteCalled);
|
||||
retVal = myQueue.enqueueSVMUnmap(svmPtr, 0, nullptr, nullptr, false);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_EQ(2u, myQueue.waitUntilCompleteCalled);
|
||||
}
|
||||
|
||||
HWTEST_F(EnqueueSvmTestLocalMemory, givenReadOnlyMapWhenUnmappingThenDontResetAubTbxWritable) {
|
||||
MockCommandQueueHw<FamilyType> queue(context.get(), pClDevice, nullptr);
|
||||
|
||||
retVal = queue.enqueueSVMMap(CL_TRUE, CL_MAP_READ, svmPtr, size, 0, nullptr, nullptr, false);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
auto gpuAllocation = mockSvmManager->getSVMAlloc(svmPtr)->gpuAllocation;
|
||||
|
||||
gpuAllocation->setAubWritable(false, GraphicsAllocation::defaultBank);
|
||||
gpuAllocation->setTbxWritable(false, GraphicsAllocation::defaultBank);
|
||||
|
||||
retVal = queue.enqueueSVMUnmap(svmPtr, 0, nullptr, nullptr, false);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
EXPECT_FALSE(gpuAllocation->isAubWritable(GraphicsAllocation::defaultBank));
|
||||
EXPECT_FALSE(gpuAllocation->isTbxWritable(GraphicsAllocation::defaultBank));
|
||||
}
|
||||
|
||||
HWTEST_F(EnqueueSvmTestLocalMemory, givenEnabledLocalMemoryWhenMappedSvmRegionIsWritableThenExpectMapAndUnmapCopyKernel) {
|
||||
using WALKER_TYPE = typename FamilyType::WALKER_TYPE;
|
||||
MockCommandQueueHw<FamilyType> queue(context.get(), pClDevice, nullptr);
|
||||
|
||||
@@ -737,6 +737,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenWriteMe
|
||||
GraphicsAllocation::AllocationType::IMAGE,
|
||||
GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER,
|
||||
GraphicsAllocation::AllocationType::MAP_ALLOCATION,
|
||||
GraphicsAllocation::AllocationType::SVM_GPU,
|
||||
GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR};
|
||||
|
||||
for (auto allocationType : onlyOneTimeAubWritableTypes) {
|
||||
|
||||
Reference in New Issue
Block a user