Skip to content

Commit 668de3c

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 bddb1cc + c58fa11 commit 668de3c

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

.github/workflows/pull.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,7 @@ jobs:
970970
PYTHON_EXECUTABLE=python bash backends/vulkan/test/scripts/test_model.sh --build
971971
972972
# Test models serially
973-
models="mv2 mv3 edsr resnet18 resnet50 dl3 w2l ic3 ic4 vit"
973+
models="mv2 mv3 edsr resnet18 resnet50 dl3 w2l ic3 ic4"
974974
for model in $models; do
975975
python -m examples.vulkan.export --model_name=$model --test
976976
done

backends/vulkan/runtime/graph/ops/impl/Permute.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,15 @@ void add_permute_node(
109109
{
110110
IntListPtr permute_dims_ptr = graph.get_int_list(permute_dims);
111111
const int32_t permute_ndim =
112-
utils::safe_downcast<int>(permute_dims_ptr->size());
112+
utils::safe_downcast<int32_t>(permute_dims_ptr->size());
113113

114114
for (int32_t nchw_i = permute_ndim - 1, whcn_i = 0; nchw_i >= 0;
115115
nchw_i--, whcn_i++) {
116-
const int32_t permute_dim_nchw = permute_dims_ptr->at(nchw_i);
116+
int32_t permute_dim_nchw =
117+
utils::safe_downcast<int32_t>(permute_dims_ptr->at(nchw_i));
118+
if (permute_dim_nchw < 0) {
119+
permute_dim_nchw += permute_ndim;
120+
}
117121
const int32_t permute_dim_whcn = permute_ndim - 1 - permute_dim_nchw;
118122

119123
whcn_permute_dims[whcn_i] = permute_dim_whcn;

0 commit comments

Comments
 (0)