@@ -1002,7 +1002,6 @@ inline void wait(Context &ctx, std::future<void> &future) {
1002
1002
inline void toCPU (Context &ctx, Tensor &tensor, void *data, size_t bufferSize,
1003
1003
CopyData &op) {
1004
1004
wgpuQueueSubmit (ctx.queue , 1 , &op.commandBuffer );
1005
- wgpuCommandBufferRelease (op.commandBuffer );
1006
1005
CallbackData callbackData = {op.readbackBuffer , bufferSize, data, &op.promise ,
1007
1006
&op.future };
1008
1007
wgpuQueueOnSubmittedWorkDone (
@@ -1063,14 +1062,9 @@ inline void toCPU(Context &ctx, Tensor &tensor, void *data, size_t bufferSize) {
1063
1062
wgpuCommandEncoderCopyBufferToBuffer (commandEncoder, tensor.data .buffer , 0 ,
1064
1063
op.readbackBuffer , 0 , bufferSize);
1065
1064
op.commandBuffer = wgpuCommandEncoderFinish (commandEncoder, nullptr );
1066
- wgpuComputePassEncoderRelease (computePassEncoder);
1067
- wgpuCommandEncoderRelease (commandEncoder);
1068
1065
check (op.commandBuffer , " Create command buffer" , __FILE__, __LINE__);
1069
1066
}
1070
1067
toCPU (ctx, tensor, data, bufferSize, op);
1071
- if (op.readbackBuffer ) {
1072
- wgpuBufferRelease (op.readbackBuffer );
1073
- }
1074
1068
}
1075
1069
1076
1070
/* *
@@ -1109,12 +1103,9 @@ inline void toCPU(Context &ctx, WGPUBuffer buffer, void *data,
1109
1103
wgpuCommandEncoderCopyBufferToBuffer (commandEncoder, buffer, 0 ,
1110
1104
op.readbackBuffer , 0 , bufferSize);
1111
1105
op.commandBuffer = wgpuCommandEncoderFinish (commandEncoder, nullptr );
1112
- wgpuComputePassEncoderRelease (computePassEncoder);
1113
- wgpuCommandEncoderRelease (commandEncoder);
1114
1106
check (op.commandBuffer , " Create command buffer" , __FILE__, __LINE__);
1115
1107
}
1116
1108
wgpuQueueSubmit (ctx.queue , 1 , &op.commandBuffer );
1117
- wgpuCommandBufferRelease (op.commandBuffer );
1118
1109
CallbackData callbackData = {op.readbackBuffer , bufferSize, data, &op.promise ,
1119
1110
&op.future };
1120
1111
wgpuQueueOnSubmittedWorkDone (
@@ -1140,9 +1131,6 @@ inline void toCPU(Context &ctx, WGPUBuffer buffer, void *data,
1140
1131
},
1141
1132
&callbackData);
1142
1133
wait (ctx, op.future );
1143
- if (op.readbackBuffer ) {
1144
- wgpuBufferRelease (op.readbackBuffer );
1145
- }
1146
1134
}
1147
1135
1148
1136
@@ -1229,9 +1217,6 @@ inline void resetCommandBuffer(WGPUDevice &device, Kernel &op) {
1229
1217
op->totalWorkgroups [2 ]);
1230
1218
wgpuComputePassEncoderEnd (computePassEncoder);
1231
1219
op->commandBuffer = wgpuCommandEncoderFinish (commandEncoder, nullptr );
1232
- wgpuComputePassEncoderRelease (computePassEncoder);
1233
- wgpuCommandEncoderRelease (commandEncoder);
1234
-
1235
1220
op->used = false ;
1236
1221
}
1237
1222
}
@@ -1522,7 +1507,6 @@ inline void dispatchKernel(Context &ctx, Kernel &kernel,
1522
1507
resetCommandBuffer (ctx.device , kernel);
1523
1508
}
1524
1509
wgpuQueueSubmit (ctx.queue , 1 , &kernel->commandBuffer );
1525
- wgpuCommandBufferRelease (kernel->commandBuffer );
1526
1510
kernel->used = true ;
1527
1511
wgpuQueueOnSubmittedWorkDone (
1528
1512
ctx.queue ,
0 commit comments