Skip to content

Commit cabb816

Browse files
authored
GPU Metal: do not let Metal track hazards on the memory buffers (#16068)
1 parent 49dec7f commit cabb816

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎GPU/GPUTracking/Base/metal/GPUReconstructionMetal.mm‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,14 @@ uint32_t metalGPUCoreCount()
116116
}
117117

118118
// We only support internal GPUs, so the ownership of the memory is always shared
119-
mInternals->mem_gpu = [mInternals->device newBufferWithLength:mDeviceMemorySize options:MTLResourceStorageModeShared];
119+
mInternals->mem_gpu = [mInternals->device newBufferWithLength:mDeviceMemorySize options:MTLResourceStorageModeShared | MTLResourceHazardTrackingModeUntracked];
120120
if (mInternals->mem_gpu == nil) {
121121
GPUErrorReturn("Metal Memory Allocation Error");
122122
}
123123

124124
// FIXME: until I understand how to enable the gGPUConstantMemBufferSize constexpr
125125
int32_t tmpGPUConstantMemBufferSize = 100000; // gGPUConstantMemBufferSize
126-
mInternals->mem_constant = [mInternals->device newBufferWithLength:tmpGPUConstantMemBufferSize options:MTLResourceStorageModeShared];
126+
mInternals->mem_constant = [mInternals->device newBufferWithLength:tmpGPUConstantMemBufferSize options:MTLResourceStorageModeShared | MTLResourceHazardTrackingModeUntracked];
127127
if (mInternals->mem_constant == nil) {
128128
GPUErrorReturn("Metal Constant Memory Allocation Error");
129129
}
@@ -143,7 +143,7 @@ uint32_t metalGPUCoreCount()
143143
mInternals->streamHasWork[i] = false;
144144
}
145145

146-
mInternals->mem_host = [mInternals->device newBufferWithLength:mHostMemorySize options:MTLResourceStorageModeShared];
146+
mInternals->mem_host = [mInternals->device newBufferWithLength:mHostMemorySize options:MTLResourceStorageModeShared | MTLResourceHazardTrackingModeUntracked];
147147
if (mInternals->mem_host == nil) {
148148
GPUErrorReturn("Error allocating pinned host memory");
149149
}

0 commit comments

Comments
 (0)