Skip to content

Commit ee043e3

Browse files
Update
[ghstack-poisoned]
2 parents 136f908 + 5bd34ee commit ee043e3

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

backends/apple/metal/runtime/shims/memory.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,9 @@ AOTITorchError aoti_torch_delete_tensor_object(AOTITensorHandle tensor) {
254254
// Tensor never owned the memory, skip freeing
255255
// Just remove tensor from tracking
256256
tensors.erase(it);
257-
ET_LOG(Debug, "aoti_torch_delete_tensor_object: tensor doesn't own memory, skipping free");
257+
ET_LOG(
258+
Debug,
259+
"aoti_torch_delete_tensor_object: tensor doesn't own memory, skipping free");
258260
return Error::Ok;
259261
} else if (ref_count == 1) {
260262
// Only current tensor using this memory, free it
@@ -265,15 +267,20 @@ AOTITorchError aoti_torch_delete_tensor_object(AOTITensorHandle tensor) {
265267
// This is CPU memory - free immediately
266268
free(data_ptr);
267269
data_ptr = nullptr;
268-
ET_LOG(Debug, "aoti_torch_delete_tensor_object: freeing CPU memory");
270+
ET_LOG(
271+
Debug, "aoti_torch_delete_tensor_object: freeing CPU memory");
269272
}
270273

271274
// Remove from memory tracking
272275
memory_to_n_tensor.erase(memory_it);
273276
} else if (ref_count > 1) {
274277
// Other tensors still using this memory, just decrement count
275278
memory_to_n_tensor[data_ptr] = ref_count - 1;
276-
ET_LOG(Debug, "aoti_torch_delete_tensor_object: decremented ref count from %d to %d", ref_count, ref_count - 1);
279+
ET_LOG(
280+
Debug,
281+
"aoti_torch_delete_tensor_object: decremented ref count from %d to %d",
282+
ref_count,
283+
ref_count - 1);
277284
}
278285
} else {
279286
ET_CHECK_OR_RETURN_ERROR(

0 commit comments

Comments
 (0)