Skip to content

Conversation

manuelcandales
Copy link
Contributor

Implement the following shims:

  • aoti_torch_create_tensor_from_blob_v2
  • aoti_torch_empty_strided
  • aoti_torch_delete_tensor_object
  • aoti_torch_copy_
  • aoti_torch__reinterpret_tensor

[ghstack-poisoned]
Copy link

pytorch-bot bot commented Oct 10, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/15021

Note: Links to docs will display an error until the docs builds have been completed.

❗ 2 Active SEVs

There are 2 currently active SEVs. If your PR is affected, please view them below:

❌ 5 New Failures, 1 Cancelled Job

As of commit f12117b with merge base 896178e (image):

NEW FAILURES - The following jobs have failed:

CANCELLED JOB - The following job was cancelled. Please retry:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

[ghstack-poisoned]
dtype);
int64_t nbytes = numel * element_size;

if (device_type == 2) { // Metal/MPS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use the function?

int32_t mps_device_type = aoti_torch_device_type_mps();  // Returns 13
if (device_type == mps_device_type) {
  ...
}

ET_LOG(
Debug,
"aoti_torch_delete_tensor_object: successfull (Metal GPU memory)");
return Error::Ok;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

returning early causes memory leak, no?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe explicitly implement metal_free_buffer to properly clean up metal buffers and call the method whenever appropriate

#include <executorch/backends/apple/metal/runtime/shims/tensor_attribute.h>
#include <executorch/backends/apple/metal/runtime/shims/utils.h>
#include <executorch/runtime/platform/log.h>
#include <cstdint>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate declaration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants