Skip to content

Commit 8278657

Browse files
author
ssjia
committed
Update on "[ET-VK] Miscellaneous fixes"
Collecting fixes for various models/ops in this diff/PR. They have all been squashed into this single change to make it easier to cherry pick. # Fixes ## Wav2Letter Type: Output correctness failure This is caused by a bug in swiftshader, and not reproducible on any other platform. Specifically, the issue is in the softmax shader; the exact cause of the issue is unknown, but it is related to using shared memory within shaders. The workaround for this issue is to use separate shared memory arrays for the shared max and shared sum. ## ConvNeXT Type: Exception during runtime This is caused by an incompatible memory layout being used for mean2d. More technically, the packed dimension of the tensor cannot be one of the dims being reduced. The current operator registry system did not have a way to select valid tensor representations based on the actual arguments of an op. To fix, we have to introduce a mechanism for ops to specify valid representations once a node's arguments are known. Once the model is exported with supported memory layout, the model test passes. ## Inception_V3/ViT Type: Exception during runtime The root cause of this was an interaction betwen the fuse batch norm pass and how `vulkan_preprocess.py` was applying passes. Essentially, the fuse batch norm pass creates a new param node for the fused weight, but after the pass is applied `_copy_module` is used to copy the transformed graph back into the ExportedProgram. However, it seems that _copy_module lowercases the node names without updating the exported program's graph signature. Therefore, subsequent passes couldn't recognize the weight tensor of convolution tensors as a constant/parameter node. The solution was to migrate vulkan_preprocess.py to use the _transform() API instead of using _copy_module. ## DenseNet 161 (w/ dynamic shapes) Type: Output Mismatch Cause: the native_batch_norm op doesn't support dynamic shapes. However, the backend test runner doesn't set the correct compile option to filter ops without dynamic shape support. Differential Revision: [D83703496](https://our.internmc.facebook.com/intern/diff/D83703496/) [ghstack-poisoned]
2 parents 5148dad + 1b5dc07 commit 8278657

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

.github/workflows/pull.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -973,15 +973,14 @@ jobs:
973973
models="mv2 mv3 edsr resnet18 resnet50 dl3 w2l ic3 ic4 convnext_small vit"
974974
for model in $models; do
975975
python -m examples.vulkan.export --model_name=$model --test
976+
done
976977
977978
# For selected vision models, test with dynamic shapes
978979
models="mv2 mv3 resnet18 resnet50 ic3 ic4 densenet161"
979980
for model in $models; do
980981
python -m examples.vulkan.export --model_name=$model --test -d
981-
982982
done
983983
984-
985984
test-vulkan-operators-linux:
986985
name: test-vulkan-operators-linux
987986
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main

backends/vulkan/op_registry.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,11 @@ def register_softmax_op():
418418
)
419419
def register_reduce_op():
420420
def check_reduce_node(node: torch.fx.Node) -> bool:
421+
# Only one argument implies that the reduction is over the entire tensor, which
422+
# is not supported yet.
423+
if len(node.args) == 1:
424+
return False
425+
421426
dim_list = node.args[1]
422427
# Only 1D and 2D reductions are supported at the moment.
423428
if isinstance(dim_list, list) and len(dim_list) > 2:

extension/llm/tokenizers

0 commit comments

Comments
 (0)