-
Notifications
You must be signed in to change notification settings - Fork 599
[ET-VK] Use dim order when converting buffer index to tensor index #11600
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
Conversation
## Changes * Update callsites to `bufi_to_tidx` to account for the tensor dim order * Remove existing functions which do not accept dim order as argument. ## Motivation > Update callsites to `bufi_to_tidx` to account for the tensor dim order > Remove existing functions which do not accept dim order as argument. As mentioned in the below diff, dim order is required to properly convert from a linear buffer index to N-dimension tensor index using a tensor's strides. Technically the dim order can be inferred from the strides array by performing an index sort. However, for the sake of efficiency it is better to just pass the dim order directly into the compute shader. Currently the `bufi_to_tidx` function which performs the conversion between buffer index and tensor index assumes that the dim order follows a specific pattern using the packed dim as an input. However, it is not guaranteed that the dim order is the same as what is assumed. Furthermore, there is an existing bug when calling `bufi_to_tidx` without providing `packed_dim` as an input. In this case, the function will infer the packed dim by finding the first dim with a stride of 1. However, this causes issues when multiple dims may have a stride of 1, which may occur when there are dims with a size of 1. In this case the wrong packed dim may be inferred and therefore the assumed dim order is completely wrong. To address these issues, make it standard to either account for the packed dim when converting bufi to tidx, or to explicitly call out an assumption about the tensor's dim order. ## Performance Impact * None expected Differential Revision: [D76393428](https://our.internmc.facebook.com/intern/diff/D76393428/) [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/11600
Note: Links to docs will display an error until the docs builds have been completed. ❌ 4 New Failures, 2 Cancelled Jobs, 11 Unrelated FailuresAs of commit 2ab67d1 with merge base 4a14fdd ( NEW FAILURES - The following jobs have failed:
CANCELLED JOBS - The following jobs were cancelled. Please retry:
FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This pull request was exported from Phabricator. Differential Revision: D76393428 |
This PR needs a
|
…or index" ## Changes * Update callsites to `bufi_to_tidx` to account for the tensor dim order * Remove existing functions which do not accept dim order as argument. ## Motivation > Update callsites to `bufi_to_tidx` to account for the tensor dim order > Remove existing functions which do not accept dim order as argument. As mentioned in the below diff, dim order is required to properly convert from a linear buffer index to N-dimension tensor index using a tensor's strides. Technically the dim order can be inferred from the strides array by performing an index sort. However, for the sake of efficiency it is better to just pass the dim order directly into the compute shader. Currently the `bufi_to_tidx` function which performs the conversion between buffer index and tensor index assumes that the dim order follows a specific pattern using the packed dim as an input. However, it is not guaranteed that the dim order is the same as what is assumed. Furthermore, there is an existing bug when calling `bufi_to_tidx` without providing `packed_dim` as an input. In this case, the function will infer the packed dim by finding the first dim with a stride of 1. However, this causes issues when multiple dims may have a stride of 1, which may occur when there are dims with a size of 1. In this case the wrong packed dim may be inferred and therefore the assumed dim order is completely wrong. To address these issues, make it standard to either account for the packed dim when converting bufi to tidx, or to explicitly call out an assumption about the tensor's dim order. ## Performance Impact * None expected Differential Revision: [D76393428](https://our.internmc.facebook.com/intern/diff/D76393428/) [ghstack-poisoned]
This pull request was exported from Phabricator. Differential Revision: D76393428 |
…or index" ## Changes * Update callsites to `bufi_to_tidx` to account for the tensor dim order * Remove existing functions which do not accept dim order as argument. ## Motivation > Update callsites to `bufi_to_tidx` to account for the tensor dim order > Remove existing functions which do not accept dim order as argument. As mentioned in the below diff, dim order is required to properly convert from a linear buffer index to N-dimension tensor index using a tensor's strides. Technically the dim order can be inferred from the strides array by performing an index sort. However, for the sake of efficiency it is better to just pass the dim order directly into the compute shader. Currently the `bufi_to_tidx` function which performs the conversion between buffer index and tensor index assumes that the dim order follows a specific pattern using the packed dim as an input. However, it is not guaranteed that the dim order is the same as what is assumed. Furthermore, there is an existing bug when calling `bufi_to_tidx` without providing `packed_dim` as an input. In this case, the function will infer the packed dim by finding the first dim with a stride of 1. However, this causes issues when multiple dims may have a stride of 1, which may occur when there are dims with a size of 1. In this case the wrong packed dim may be inferred and therefore the assumed dim order is completely wrong. To address these issues, make it standard to either account for the packed dim when converting bufi to tidx, or to explicitly call out an assumption about the tensor's dim order. ## Performance Impact * None expected Differential Revision: [D76393428](https://our.internmc.facebook.com/intern/diff/D76393428/) [ghstack-poisoned]
This pull request was exported from Phabricator. Differential Revision: D76393428 |
ffe65a9
into
gh/SS-JIA/241/base
Stack from ghstack (oldest at bottom):
cat
operator #11508vTensor
member variables and exposedim order
UBO and push constant #11599Changes
bufi_to_tidx
to account for the tensor dim orderMotivation
As mentioned in the below diff, dim order is required to properly convert from a linear buffer index to N-dimension tensor index using a tensor's strides. Technically the dim order can be inferred from the strides array by performing an index sort. However, for the sake of efficiency it is better to just pass the dim order directly into the compute shader.
Currently the
bufi_to_tidx
function which performs the conversion between buffer index and tensor index assumes that the dim order follows a specific pattern using the packed dim as an input. However, it is not guaranteed that the dim order is the same as what is assumed.Furthermore, there is an existing bug when calling
bufi_to_tidx
without providingpacked_dim
as an input. In this case, the function will infer the packed dim by finding the first dim with a stride of 1. However, this causes issues when multiple dims may have a stride of 1, which may occur when there are dims with a size of 1. In this case the wrong packed dim may be inferred and therefore the assumed dim order is completely wrong.To address these issues, make it standard to either account for the packed dim when converting bufi to tidx, or to explicitly call out an assumption about the tensor's dim order.
Performance Impact
Differential Revision: D76393428