Skip to content

Commit

Permalink
Refactor GPU handling in MetalBackend and Tester
Browse files Browse the repository at this point in the history
- Remove unused GPU index because the Metal backend only uses the system default device.
- Refactor Metal backend to be more efficient and robust.
  • Loading branch information
ChinChangYang committed Nov 12, 2023
1 parent c7840d7 commit 84d95e0
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 163 deletions.
3 changes: 1 addition & 2 deletions cpp/neuralnet/metalbackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ void MetalProcess::createMetalComputeHandle(const ModelDesc* modelDesc,
policyHeadDescToSwift(&modelDesc->policyHead),
valueHeadDescToSwift(&modelDesc->valueHead));

createMetalComputeHandle(gpuIdx, swModelDesc, serverThreadIdx);
createMetalComputeHandle(swModelDesc, serverThreadIdx);
}

//---------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -860,7 +860,6 @@ void MetalProcess::getMetalOutput(
inputBuffers->valueResults,
inputBuffers->ownershipResults,
inputBuffers->scoreValuesResults,
gpuHandle->gpuIndex,
batchSize);

for(size_t row = 0; row < batchSize; row++) {
Expand Down
Loading

0 comments on commit 84d95e0

Please sign in to comment.