Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix in Ethos runtime backend #9517

Merged
merged 1 commit into from
Mar 24, 2025

Conversation

limintang
Copy link
Contributor

@limintang limintang commented Mar 21, 2025

Summary: Cortex-M is 32-bit, so pointer type in the runtime backend is also 32-bit. If the address >= 0x80000000, direct cast to uint64_t treates it as signed integer and sign extends it to 0xFFFFFFFFXXXXXXXX, which causes address validity check in Ethos driver to fail. First cast it to unsigned type uintptr_t then cast to uint64_t avoids this issue.

Differential Revision: D71658384

@limintang limintang requested a review from digantdesai as a code owner March 21, 2025 23:39
Copy link

pytorch-bot bot commented Mar 21, 2025

🔗 Helpful Links

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

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

✅ You can merge normally! (1 Unrelated Failure)

As of commit e85d40c with merge base 5c5b84e (image):

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 21, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D71658384

@limintang
Copy link
Contributor Author

@pytorchbot label "topic: not user facing"

limintang added a commit to limintang/executorch that referenced this pull request Mar 22, 2025
Summary:

See the comment in source for explanation.

Differential Revision: D71658384
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D71658384

limintang added a commit to limintang/executorch that referenced this pull request Mar 22, 2025
Summary:

See the comment in source for explanation.

Differential Revision: D71658384
limintang added a commit to limintang/executorch that referenced this pull request Mar 22, 2025
Summary:

See the comment in source for explanation.

Also change the default MACs for U85 to 256, which is default on FVP SSE-320.

Differential Revision: D71658384
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D71658384

limintang added a commit to limintang/executorch that referenced this pull request Mar 22, 2025
Summary:

See the comment in source for explanation.

Also change the default MACs in U85 compile spec to 256, which is default on FVP SSE-320.

Differential Revision: D71658384
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D71658384

limintang added a commit to limintang/executorch that referenced this pull request Mar 22, 2025
Summary:

Cortex-M is 32-bit, so pointer type in the runtime backend is also 32-bit. If the address >= 0x80000000, direct cast to uint64_t treates it as signed integer and signed extends it to 0xFFFFFFFFXXXXXXXX, which causes address validity check in Ethos driver to fail. First cast it to unsigned type uintptr_t then cast to uint64_t avoids this issue.

Also change the default MACs in U85 compile spec to 256, which is default on FVP SSE-320.

Differential Revision: D71658384
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D71658384

@zingo zingo added module: arm Issues related to arm backend ciflow/trunk labels Mar 24, 2025
limintang added a commit to limintang/executorch that referenced this pull request Mar 24, 2025
Summary:

Cortex-M is 32-bit, so pointer type in the runtime backend is also 32-bit. If the address >= 0x80000000, direct cast to uint64_t treates it as signed integer and sign extends it to 0xFFFFFFFFXXXXXXXX, which causes address validity check in Ethos driver to fail. First cast it to unsigned type uintptr_t then cast to uint64_t avoids this issue.

Also change the default MACs in U85 compile spec to 256, which is default on FVP SSE-320.

Differential Revision: D71658384
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D71658384

Copy link
Contributor

@digantdesai digantdesai left a comment

Choose a reason for hiding this comment

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

Thank you!

@zingo zingo self-requested a review March 24, 2025 19:53
Copy link
Collaborator

@zingo zingo left a comment

Choose a reason for hiding this comment

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

Thanks for the fix, good find. The fix is really good but there is just a small lintrunner error that needs to be fixed to keep HEAD clean if its OK🙏
If not I can also create a new PR tomorrow with fix for both this and the lint problem, no problem. Thanks for the help.

limintang added a commit to limintang/executorch that referenced this pull request Mar 24, 2025
Summary:

Cortex-M is 32-bit, so pointer type in the runtime backend is also 32-bit. If the address >= 0x80000000, direct cast to uint64_t treates it as signed integer and sign extends it to 0xFFFFFFFFXXXXXXXX, which causes address validity check in Ethos driver to fail. First cast it to unsigned type uintptr_t then cast to uint64_t avoids this issue.

Reviewed By: digantdesai

Differential Revision: D71658384
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D71658384

Summary:

Cortex-M is 32-bit, so pointer type in the runtime backend is also 32-bit. If the address >= 0x80000000, direct cast to uint64_t treates it as signed integer and sign extends it to 0xFFFFFFFFXXXXXXXX, which causes address validity check in Ethos driver to fail. First cast it to unsigned type uintptr_t then cast to uint64_t avoids this issue.

Reviewed By: digantdesai

Differential Revision: D71658384
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D71658384

@facebook-github-bot facebook-github-bot merged commit 06ec67c into pytorch:main Mar 24, 2025
166 of 167 checks passed
@limintang limintang deleted the export-D71658384 branch March 24, 2025 22:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported module: arm Issues related to arm backend topic: not user facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants