Skip to content

Alternative approach to handling memory offset shift #9406

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

Merged
merged 1 commit into from
Mar 26, 2025

Conversation

JakeStevens
Copy link
Contributor

Summary:
To support embedded system builds which threw an error on the warning for left shift by 32 on a 32 bit dtype, the code was modified to:

    memory_offset |= static_cast<size_t>(memory_offset_high)
        << (sizeof(size_t) - sizeof(uint32_t));

This fails for build of OSS qwen example however.

Instead, we modify to add a check for

sizeof(size_t) > sizeof(uint32_t)

in the conditional instead of changing the computation.

In our builds of interest, this compiles away the if branch

Reviewed By: digantdesai, dpalmasan

Differential Revision: D71488571

Copy link

pytorch-bot bot commented Mar 19, 2025

🔗 Helpful Links

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

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

✅ No Failures

As of commit 7cdc42b with merge base 7159650 (image):
💚 Looks good so far! There are no failures yet. 💚

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 19, 2025
@facebook-github-bot
Copy link
Contributor

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

@swolchok
Copy link
Contributor

this looks fine, but I'll be surprised if it continues to get rid of the warning

@JakeStevens
Copy link
Contributor Author

@pytorchbot label "topic: not user facing"

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

To support embedded system builds which threw an error on the warning for left shift by 32 on a 32 bit dtype, the code was modified to:

```
    memory_offset |= static_cast<size_t>(memory_offset_high)
        << (sizeof(size_t) - sizeof(uint32_t));
```

This fails for build of OSS qwen example however.

Instead, we modify to add a check for

```
sizeof(size_t) > sizeof(uint32_t)
```

in the conditional instead of changing the computation.

In our builds of interest, this compiles away the if branch

Reviewed By: digantdesai, swolchok, dpalmasan

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

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

JakeStevens added a commit to JakeStevens/executorch that referenced this pull request Mar 21, 2025
Summary:
Pull Request resolved: pytorch#9406

To support embedded system builds which threw an error on the warning for left shift by 32 on a 32 bit dtype, the code was modified to:

```
    memory_offset |= static_cast<size_t>(memory_offset_high)
        << (sizeof(size_t) - sizeof(uint32_t));
```

This fails for build of OSS qwen example however.

Instead, we modify to add a check for

```
sizeof(size_t) > sizeof(uint32_t)
```

in the conditional instead of changing the computation.

In our builds of interest, this compiles away the if branch

Reviewed By: digantdesai, swolchok, dpalmasan

Differential Revision: D71488571
@JakeStevens JakeStevens force-pushed the export-D71488571 branch 2 times, most recently from c6c43b5 to da6c3e3 Compare March 24, 2025 14:25
JakeStevens added a commit to JakeStevens/executorch that referenced this pull request Mar 24, 2025
Summary:

To support embedded system builds which threw an error on the warning for left shift by 32 on a 32 bit dtype, the code was modified to:

```
    memory_offset |= static_cast<size_t>(memory_offset_high)
        << (sizeof(size_t) - sizeof(uint32_t));
```

This fails for build of OSS qwen example however.

Instead, we modify to add a check for

```
sizeof(size_t) > sizeof(uint32_t)
```

in the conditional instead of changing the computation.

In our builds of interest, this compiles away the if branch

Reviewed By: digantdesai, swolchok, dpalmasan

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

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

JakeStevens added a commit to JakeStevens/executorch that referenced this pull request Mar 24, 2025
Summary:
Pull Request resolved: pytorch#9406

To support embedded system builds which threw an error on the warning for left shift by 32 on a 32 bit dtype, the code was modified to:

```
    memory_offset |= static_cast<size_t>(memory_offset_high)
        << (sizeof(size_t) - sizeof(uint32_t));
```

This fails for build of OSS qwen example however.

Instead, we modify to add a check for

```
sizeof(size_t) > sizeof(uint32_t)
```

in the conditional instead of changing the computation.

In our builds of interest, this compiles away the if branch

Reviewed By: digantdesai, swolchok, dpalmasan

Differential Revision: D71488571
JakeStevens added a commit to JakeStevens/executorch that referenced this pull request Mar 24, 2025
Summary:

To support embedded system builds which threw an error on the warning for left shift by 32 on a 32 bit dtype, the code was modified to:

```
    memory_offset |= static_cast<size_t>(memory_offset_high)
        << (sizeof(size_t) - sizeof(uint32_t));
```

This fails for build of OSS qwen example however.

Instead, we modify to add a check for

```
sizeof(size_t) > sizeof(uint32_t)
```

in the conditional instead of changing the computation.

In our builds of interest, this compiles away the if branch

Reviewed By: digantdesai, swolchok, dpalmasan

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

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

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

To support embedded system builds which threw an error on the warning for left shift by 32 on a 32 bit dtype, the code was modified to:

```
    memory_offset |= static_cast<size_t>(memory_offset_high)
        << (sizeof(size_t) - sizeof(uint32_t));
```

This fails for build of OSS qwen example however.

Instead, we modify to add a check for

```
sizeof(size_t) > sizeof(uint32_t)
```

in the conditional instead of changing the computation.

In our builds of interest, this compiles away the if branch

Reviewed By: digantdesai, swolchok, dpalmasan

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

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

JakeStevens added a commit to JakeStevens/executorch that referenced this pull request Mar 25, 2025
Summary:
Pull Request resolved: pytorch#9406

To support embedded system builds which threw an error on the warning for left shift by 32 on a 32 bit dtype, the code was modified to:

```
    memory_offset |= static_cast<size_t>(memory_offset_high)
        << (sizeof(size_t) - sizeof(uint32_t));
```

This fails for build of OSS qwen example however.

Instead, we modify to add a check for

```
sizeof(size_t) > sizeof(uint32_t)
```

in the conditional instead of changing the computation.

In our builds of interest, this compiles away the if branch

Reviewed By: digantdesai, swolchok, dpalmasan

Differential Revision: D71488571
@JakeStevens JakeStevens force-pushed the export-D71488571 branch 2 times, most recently from 53db757 to fc27c40 Compare March 26, 2025 13:46
JakeStevens added a commit to JakeStevens/executorch that referenced this pull request Mar 26, 2025
Summary:

To support embedded system builds which threw an error on the warning for left shift by 32 on a 32 bit dtype, the code was modified to:

```
    memory_offset |= static_cast<size_t>(memory_offset_high)
        << (sizeof(size_t) - sizeof(uint32_t));
```

This fails for build of OSS qwen example however.

Instead, we modify to add a check for

```
sizeof(size_t) > sizeof(uint32_t)
```

in the conditional instead of changing the computation.

In our builds of interest, this compiles away the if branch

Reviewed By: digantdesai, swolchok, dpalmasan

Differential Revision: D71488571
Summary:
Pull Request resolved: pytorch#9406

To support embedded system builds which threw an error on the warning for left shift by 32 on a 32 bit dtype, the code was modified to:

```
    memory_offset |= static_cast<size_t>(memory_offset_high)
        << (sizeof(size_t) - sizeof(uint32_t));
```

This fails for build of OSS qwen example however.

Instead, we modify to add a check for

```
sizeof(size_t) > sizeof(uint32_t)
```

in the conditional instead of changing the computation.

In our builds of interest, this compiles away the if branch

Reviewed By: digantdesai, swolchok, dpalmasan

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

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

@JakeStevens JakeStevens merged commit c43d5ad into pytorch:main Mar 26, 2025
83 checks passed
kirklandsign pushed a commit that referenced this pull request Apr 11, 2025
Summary:
To support embedded system builds which threw an error on the warning
for left shift by 32 on a 32 bit dtype, the code was modified to:

```
    memory_offset |= static_cast<size_t>(memory_offset_high)
        << (sizeof(size_t) - sizeof(uint32_t));
```

This fails for build of OSS qwen example however.

Instead, we modify to add a check for

```
sizeof(size_t) > sizeof(uint32_t)
```

in the conditional instead of changing the computation.

In our builds of interest, this compiles away the if branch

Reviewed By: digantdesai, dpalmasan

Differential Revision: D71488571
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. fb-exported topic: not user facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants