TFLGpuDelegateSetCommandEncoder replaced by TFLGpuDelegateSetCommandBuffer.

PiperOrigin-RevId: 346586647
Change-Id: Ie40d5a9659cd4d031e8073f16fb78e31e7885a84
This commit is contained in:
Raman Sarokin 2020-12-09 10:46:16 -08:00 committed by TensorFlower Gardener
parent d8284109f2
commit 8fe56f0807
2 changed files with 13 additions and 0 deletions

View File

@ -716,6 +716,14 @@ bool TFLGpuDelegateBindMetalBufferToTensor(TfLiteDelegate* delegate, int tensor_
// Note: This function is not exposed in `metal_delegate.h`, but it's exposed in
// `metal_delegate_internal.h`.
bool TFLGpuDelegateSetCommandEncoder(
TfLiteDelegate* delegate, id<MTLComputeCommandEncoder> encoder) {
auto* metal_delegate = ::tflite::gpu::metal::GetMetalDelegate(delegate);
if (!metal_delegate) return false;
metal_delegate->SetCommandEncoder(encoder);
return true;
}
bool TFLGpuDelegateSetCommandBuffer(TfLiteDelegate* delegate,
id<MTLCommandBuffer> command_buffer) {
auto* metal_delegate = ::tflite::gpu::metal::GetMetalDelegate(delegate);

View File

@ -33,6 +33,11 @@ bool TFLGpuDelegateBindMetalBufferToTensor(TfLiteDelegate* delegate,
int tensor_index,
id<MTLBuffer> metal_buffer);
// Binds user-defined MTLComputeCommandEncoder. The delegate puts all GPU tasks
// into this encoder instead of the internal encoder.
bool TFLGpuDelegateSetCommandEncoder(TfLiteDelegate* delegate,
id<MTLComputeCommandEncoder> encoder);
// Binds user-defined MTLCommandBuffer. The delegate puts all GPU tasks
// into this buffer instead of the internal command buffer.
bool TFLGpuDelegateSetCommandBuffer(TfLiteDelegate* delegate,