Skip to content

[ET-VK][BE][ez] vTensor cleanup 3/N - Introduce conversion operators for vec types #5423

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

Closed
wants to merge 4 commits into from

Conversation

SS-JIA
Copy link
Contributor

@SS-JIA SS-JIA commented Sep 17, 2024

Stack from ghstack (oldest at bottom):

Context

Introduce implicit conversion functions to vec types. This allows the following pattern:

utils::ivec3 v1{4, 5, 2};
utils::uvec3  v2 = v1;

Whereas before, we would have to do

utils::ivec3 v1{4, 5, 2};
utils::uvec3 v2(
    safe_downcast<uint32_t>(v1[0],
    safe_downcast<uint32_t>(v1[1],
    safe_downcast<uint32_t>(v1[2]);

The connection with vTensor class cleanup is that this will allow for consolidation of vTensor class methods, specifically circumventing the need to provide two functions to retrieve the logical limits of the Tensor, one to retrieve it as a ivec3 and another to retrieve it as a uvec3.

Differential Revision: D62878650

…for `vec` types

## Context

Introduce implicit conversion functions to `vec` types. This allows the following pattern:

```cpp
utils::ivec3 v1{4, 5, 2};
utils::uvec3  v2 = v1;
```

Whereas before, we would have to do

```cpp
utils::ivec3 v1{4, 5, 2};
utils::uvec3 v2(
    safe_downcast<uint32_t>(v1[0],
    safe_downcast<uint32_t>(v1[1],
    safe_downcast<uint32_t>(v1[2]);
```

The connection with `vTensor` class cleanup is that this will allow for consolidation of `vTensor` class methods, specifically circumventing the need to provide two functions to retrieve the logical limits of the `Tensor`, one to retrieve it as a `ivec3` and another to retrieve it as a `uvec3`.

Differential Revision: [D62878650](https://our.internmc.facebook.com/intern/diff/D62878650/)

[ghstack-poisoned]
Copy link

pytorch-bot bot commented Sep 17, 2024

🔗 Helpful Links

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

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

✅ No Failures

As of commit 5c5f01a with merge base d2a38cc (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 Sep 17, 2024
@facebook-github-bot
Copy link
Contributor

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

SS-JIA added a commit that referenced this pull request Sep 17, 2024
…for `vec` types

## Context

Introduce implicit conversion functions to `vec` types. This allows the following pattern:

```cpp
utils::ivec3 v1{4, 5, 2};
utils::uvec3  v2 = v1;
```

Whereas before, we would have to do

```cpp
utils::ivec3 v1{4, 5, 2};
utils::uvec3 v2(
    safe_downcast<uint32_t>(v1[0],
    safe_downcast<uint32_t>(v1[1],
    safe_downcast<uint32_t>(v1[2]);
```

The connection with `vTensor` class cleanup is that this will allow for consolidation of `vTensor` class methods, specifically circumventing the need to provide two functions to retrieve the logical limits of the `Tensor`, one to retrieve it as a `ivec3` and another to retrieve it as a `uvec3`.

Differential Revision: [D62878650](https://our.internmc.facebook.com/intern/diff/D62878650/)

ghstack-source-id: 243061030
Pull Request resolved: #5423
… operators for `vec` types"

## Context

Introduce implicit conversion functions to `vec` types. This allows the following pattern:

```cpp
utils::ivec3 v1{4, 5, 2};
utils::uvec3  v2 = v1;
```

Whereas before, we would have to do

```cpp
utils::ivec3 v1{4, 5, 2};
utils::uvec3 v2(
    safe_downcast<uint32_t>(v1[0],
    safe_downcast<uint32_t>(v1[1],
    safe_downcast<uint32_t>(v1[2]);
```

The connection with `vTensor` class cleanup is that this will allow for consolidation of `vTensor` class methods, specifically circumventing the need to provide two functions to retrieve the logical limits of the `Tensor`, one to retrieve it as a `ivec3` and another to retrieve it as a `uvec3`.

Differential Revision: [D62878650](https://our.internmc.facebook.com/intern/diff/D62878650/)

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

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

… operators for `vec` types"

## Context

Introduce implicit conversion functions to `vec` types. This allows the following pattern:

```cpp
utils::ivec3 v1{4, 5, 2};
utils::uvec3  v2 = v1;
```

Whereas before, we would have to do

```cpp
utils::ivec3 v1{4, 5, 2};
utils::uvec3 v2(
    safe_downcast<uint32_t>(v1[0],
    safe_downcast<uint32_t>(v1[1],
    safe_downcast<uint32_t>(v1[2]);
```

The connection with `vTensor` class cleanup is that this will allow for consolidation of `vTensor` class methods, specifically circumventing the need to provide two functions to retrieve the logical limits of the `Tensor`, one to retrieve it as a `ivec3` and another to retrieve it as a `uvec3`.

Differential Revision: [D62878650](https://our.internmc.facebook.com/intern/diff/D62878650/)

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

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

… operators for `vec` types"

## Context

Introduce implicit conversion functions to `vec` types. This allows the following pattern:

```cpp
utils::ivec3 v1{4, 5, 2};
utils::uvec3  v2 = v1;
```

Whereas before, we would have to do

```cpp
utils::ivec3 v1{4, 5, 2};
utils::uvec3 v2(
    safe_downcast<uint32_t>(v1[0],
    safe_downcast<uint32_t>(v1[1],
    safe_downcast<uint32_t>(v1[2]);
```

The connection with `vTensor` class cleanup is that this will allow for consolidation of `vTensor` class methods, specifically circumventing the need to provide two functions to retrieve the logical limits of the `Tensor`, one to retrieve it as a `ivec3` and another to retrieve it as a `uvec3`.

Differential Revision: [D62878650](https://our.internmc.facebook.com/intern/diff/D62878650/)

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 958afe1.

@SS-JIA SS-JIA deleted the gh/SS-JIA/81/head branch January 24, 2025 19:43
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 Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants