Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions GPU/GPUTracking/Base/metal/GPUReconstructionMetal.mm
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "GPUDefParametersLoad.inc"
#include "GPUReconstructionMetal.h"

#include <chrono>
#include <cstddef>
#include <map>

Expand Down Expand Up @@ -376,13 +377,27 @@ MetalMemRef metalResolve(const GPUReconstructionMetalInternals* internals, const

void GPUReconstructionMetal::DrainStream(int32_t stream)
{
if (mInternals->streamHasWork[stream]) {
CommitStream(stream);
// Hand the GPU what the other streams have encoded too, so it has work
// while the host waits and then works on what it waited for.
for (int32_t i = 0; i < mNStreams; i++) {
if (mInternals->streamHasWork[i]) {
CommitStream(i);
}
}
// Waiting on the buffer that is currently open would block forever: it is not
// committed, so it never completes. Only what was submitted can be waited for.
// The last submitted buffer ends by signalling the stream's order event, once
// all the work before it is done. Watching the event returns sooner than
// waitUntilCompleted, which sleeps until the completion has been processed.
// Only short waits are worth a busy core, so give up after a while.
bool done = false;
const auto t0 = std::chrono::steady_clock::now();
while (!mInternals->submittedBuffers[stream].empty() && !(done = mInternals->streamOrder[stream].signaledValue >= mInternals->streamOrderValue[stream]) && std::chrono::steady_clock::now() - t0 < std::chrono::milliseconds(20)) {
}
for (id<MTLCommandBuffer> cb : mInternals->submittedBuffers[stream]) {
[cb waitUntilCompleted];
if (!done) {
[cb waitUntilCompleted];
}
if (cb.status == MTLCommandBufferStatusError) {
GPUError("Metal command buffer on stream %d failed: %s", stream, [[cb.error description] UTF8String]);
}
Expand Down
2 changes: 1 addition & 1 deletion GPU/GPUTracking/Definitions/Parameters/GPUParameters.csv
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ GPUTPCCFDecodeZSDenseLink,"""GPUCA_WARP_SIZE""",,"[""GPUCA_WARP_SIZE"", 4]","[""
GPUTPCCFGather,"[1024, 1]",,"[1024, 5]","[1024, 1]",,,,,,"[160, 11]","[1024, 1]",736,896,,"[928, 1]",,"[1024, 1]","[320, 2]",
COMPRESSION_GATHER,1024,,1024,1024,,,,,,1024,1024,,1024,,,,,,
GPUTPCGMMergerTrackFit,256,,"[192, 2]","[64, 7]",,,,,,"[32, 16]","[32, 8]","[32, 14]","[160, 2]",,"[32, 24]",,"[64, 8]","[64, 6]","[64, 4]"
GPUTPCGMMergerFollowLoopers,256,,"[256, 5]","[256, 4]",,,,,,"[256, 4]","[128, 4]","[1024, 1]",640,,"[128, 16]",,"[224, 3]","[256, 7]",
GPUTPCGMMergerFollowLoopers,256,,"[256, 5]","[256, 4]",,,,,,"[256, 4]","[128, 4]","[1024, 1]",640,,"[128, 16]",,"[224, 3]","[256, 7]","[1, 16]"
GPUTPCGMMergerSectorRefit,256,,"[64, 4]","[256, 2]",,,,,,"[32, 8]","[64, 5]","[32, 7]","[32, 7]",,"[32, 20]",,"[32, 10]","[64, 4]",
GPUTPCGMMergerUnpackResetIds,256,,256,256,,,,,,256,256,256,256,,256,,256,256,
GPUTPCGMMergerUnpackGlobal,256,,256,256,,,,,,256,256,256,256,,256,,256,256,
Expand Down
Loading