OClCollMeshEngn:*KernelComplete: use WRITE_INVLDT during finalize()
Doing it this way enables us to get the mapBuffer() call working during finalize. But we couldn't get the unmap call working. That has to do with a bug in the Rusticl event waiting code.
This commit is contained in:
@@ -711,16 +711,21 @@ bool OpenClCollatingAndMeshingEngine::stop()
|
|||||||
return wasAcceptingRequests;
|
return wasAcceptingRequests;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenClCollatingAndMeshingEngine::compactKernelComplete()
|
void OpenClCollatingAndMeshingEngine::compactKernelComplete(bool isFinalizing)
|
||||||
{
|
{
|
||||||
|
cl_map_flags mapFlags;
|
||||||
|
|
||||||
/** EXPLANATION:
|
/** EXPLANATION:
|
||||||
* Technically we should only need to do this if we plan to read the
|
* Technically we should only need to do this if we plan to read the
|
||||||
* compacted slots for debugging purposes. Otherwise this is unnecessary.
|
* compacted slots for debugging purposes. Otherwise this is unnecessary.
|
||||||
*/
|
*/
|
||||||
mapAssemblyBuffer(CL_MAP_READ);
|
|
||||||
|
if (isFinalizing) { mapFlags = CL_MAP_WRITE_INVALIDATE_REGION; }
|
||||||
|
else { mapFlags = CL_MAP_READ; }
|
||||||
|
|
||||||
|
mapAssemblyBuffer(mapFlags);
|
||||||
unmapAssemblyBuffer();
|
unmapAssemblyBuffer();
|
||||||
clFlush(commandQueue);
|
clFlush(commandQueue);
|
||||||
clFinish(commandQueue);
|
|
||||||
|
|
||||||
// Stop only compact kernel
|
// Stop only compact kernel
|
||||||
if (compactIsRunning && currentCompactKernelEvent)
|
if (compactIsRunning && currentCompactKernelEvent)
|
||||||
@@ -729,20 +734,26 @@ void OpenClCollatingAndMeshingEngine::compactKernelComplete()
|
|||||||
clReleaseEvent(currentCompactKernelEvent);
|
clReleaseEvent(currentCompactKernelEvent);
|
||||||
currentCompactKernelEvent = nullptr;
|
currentCompactKernelEvent = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clFinish(commandQueue);
|
||||||
compactKernelCb = [](cl_int){};
|
compactKernelCb = [](cl_int){};
|
||||||
compactIsRunning = false;
|
compactIsRunning = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenClCollatingAndMeshingEngine::collateKernelComplete()
|
void OpenClCollatingAndMeshingEngine::collateKernelComplete(bool isFinalizing)
|
||||||
{
|
{
|
||||||
|
cl_map_flags mapFlags;
|
||||||
/** EXPLANATION:
|
/** EXPLANATION:
|
||||||
* Technically we should only need to do this if we plan to read the
|
* Technically we should only need to do this if we plan to read the
|
||||||
* collated dgrams for debugging purposes. Otherwise this is unnecessary.
|
* collated dgrams for debugging purposes. Otherwise this is unnecessary.
|
||||||
*/
|
*/
|
||||||
mapCollationBuffer(CL_MAP_READ);
|
if (isFinalizing) { mapFlags = CL_MAP_WRITE_INVALIDATE_REGION; }
|
||||||
|
else { mapFlags = CL_MAP_READ; }
|
||||||
|
|
||||||
|
mapCollationBuffer(mapFlags);
|
||||||
unmapCollationBuffer();
|
unmapCollationBuffer();
|
||||||
clFlush(commandQueue);
|
clFlush(commandQueue);
|
||||||
clFinish(commandQueue);
|
|
||||||
// Stop only collate kernel
|
// Stop only collate kernel
|
||||||
if (collateIsRunning && currentCollateKernelEvent)
|
if (collateIsRunning && currentCollateKernelEvent)
|
||||||
{
|
{
|
||||||
@@ -750,6 +761,8 @@ void OpenClCollatingAndMeshingEngine::collateKernelComplete()
|
|||||||
clReleaseEvent(currentCollateKernelEvent);
|
clReleaseEvent(currentCollateKernelEvent);
|
||||||
currentCollateKernelEvent = nullptr;
|
currentCollateKernelEvent = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clFinish(commandQueue);
|
||||||
collateKernelCb = [](cl_int){};
|
collateKernelCb = [](cl_int){};
|
||||||
collateIsRunning = false;
|
collateIsRunning = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,8 +60,8 @@ private:
|
|||||||
StagingBuffer& assemblyBuff, StagingBuffer& collationBuff,
|
StagingBuffer& assemblyBuff, StagingBuffer& collationBuff,
|
||||||
collateKernelCbFn callback);
|
collateKernelCbFn callback);
|
||||||
|
|
||||||
void compactKernelComplete();
|
void compactKernelComplete(bool isFinalizing=false);
|
||||||
void collateKernelComplete();
|
void collateKernelComplete(bool isFinalizing=false);
|
||||||
bool stop();
|
bool stop();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
Reference in New Issue
Block a user