Skip to content
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

[js/webgpu] Fix max pool shape end with 0 #21559

Closed
wants to merge 3 commits into from

Conversation

axinging
Copy link
Contributor

Bug: #21386

Description

Motivation and Context

@axinging axinging marked this pull request as ready for review August 6, 2024 05:11
@axinging
Copy link
Contributor Author

axinging commented Aug 6, 2024

@qjia7 @xhcao @hujiajie @jzm-intel @gyagp PTAL

Copy link
Contributor

@qjia7 qjia7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly, the error is caused by the 2d shapes of kernelShape/strides/dilations while the 1d shapes are expected since it's pool1d instead of pool2d.

Based on that, I think the right fixing should be passing the right shape to attributes in c++ side instead of modifying it in js. See code here https://github.com/microsoft/onnxruntime/blob/main/onnxruntime/core/providers/js/operators/pool.h#L29-L32, it will always generate a 2d array to attributes.dilations/attributes.kernel_shape/attributes.strides. To get the right attribute shapes, you can refer to conv's implementation here https://github.com/microsoft/onnxruntime/blob/main/onnxruntime/core/providers/js/operators/conv.h#L30-L45 which supports any expected shapes.

@axinging
Copy link
Contributor Author

axinging commented Aug 7, 2024

If I understand correctly, the error is caused by the 2d shapes of kernelShape/strides/dilations while the 1d shapes are expected since it's pool1d instead of pool2d.

Based on that, I think the right fixing should be passing the right shape to attributes in c++ side instead of modifying it in js. See code here https://github.com/microsoft/onnxruntime/blob/main/onnxruntime/core/providers/js/operators/pool.h#L29-L32, it will always generate a 2d array to attributes.dilations/attributes.kernel_shape/attributes.strides. To get the right attribute shapes, you can refer to conv's implementation here https://github.com/microsoft/onnxruntime/blob/main/onnxruntime/core/providers/js/operators/conv.h#L30-L45 which supports any expected shapes.

Thanks @qjia7, updated.

Copy link
Contributor

@qjia7 qjia7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@guschmue @fs-eire @satyajandhyala Please take a look, thanks.

@fs-eire
Copy link
Contributor

fs-eire commented Aug 7, 2024

/azp run Windows ARM64 QNN CI Pipeline,Windows x64 QNN CI Pipeline,Windows CPU CI Pipeline,Windows GPU CI Pipeline,Windows GPU TensorRT CI Pipeline,ONNX Runtime Web CI Pipeline,Linux CPU CI Pipeline,Linux CPU Minimal Build E2E CI Pipeline,Linux GPU CI Pipeline,Linux GPU TensorRT CI Pipeline

@fs-eire
Copy link
Contributor

fs-eire commented Aug 7, 2024

/azp run Linux OpenVINO CI Pipeline,Linux QNN CI Pipeline,MacOS CI Pipeline,orttraining-amd-gpu-ci-pipeline,orttraining-linux-ci-pipeline,orttraining-linux-gpu-ci-pipeline,orttraining-ortmodule-distributed,onnxruntime-binary-size-checks-ci-pipeline,Big Models,Linux Android Emulator QNN CI Pipeline

@fs-eire
Copy link
Contributor

fs-eire commented Aug 7, 2024

/azp run Android CI Pipeline,iOS CI Pipeline,ONNX Runtime React Native CI Pipeline

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

2 similar comments
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@fs-eire
Copy link
Contributor

fs-eire commented Aug 8, 2024

/azp run Windows GPU CUDA CI Pipeline,Windows GPU DML CI Pipeline,Windows GPU Doc Gen CI Pipeline

Copy link

No pipelines are associated with this pull request.

@fs-eire
Copy link
Contributor

fs-eire commented Aug 9, 2024

/azp run Windows GPU CUDA CI Pipeline, Windows GPU DML CI Pipeline, Windows GPU Doc Gen CI Pipeline

Copy link

No pipelines are associated with this pull request.

@fs-eire
Copy link
Contributor

fs-eire commented Aug 9, 2024

/azp run Windows ARM64 QNN CI Pipeline,Windows x64 QNN CI Pipeline,Windows CPU CI Pipeline,Windows GPU CI Pipeline,Windows GPU TensorRT CI Pipeline,Linux CPU CI Pipeline,Linux CPU Minimal Build E2E CI Pipeline,Linux GPU CI Pipeline,Linux GPU TensorRT CI Pipeline,Linux OpenVINO CI Pipeline

@fs-eire
Copy link
Contributor

fs-eire commented Aug 9, 2024

/azp run Linux QNN CI Pipeline,MacOS CI Pipeline,orttraining-amd-gpu-ci-pipeline,orttraining-linux-ci-pipeline,orttraining-linux-gpu-ci-pipeline,orttraining-ortmodule-distributed,Big Models,Linux Android Emulator QNN CI Pipeline,Android CI Pipeline,iOS CI Pipeline

@fs-eire
Copy link
Contributor

fs-eire commented Aug 9, 2024

/azp run ONNX Runtime React Native CI Pipeline

Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

1 similar comment
Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@fs-eire
Copy link
Contributor

fs-eire commented Aug 9, 2024

/azp run Windows ARM64 QNN CI Pipeline,Windows x64 QNN CI Pipeline,Windows CPU CI Pipeline,Windows GPU CUDA CI Pipeline,Windows GPU DML CI Pipeline,Windows GPU Doc Gen CI Pipeline,Windows GPU TensorRT CI Pipeline,ONNX Runtime Web CI Pipeline,Linux CPU CI Pipeline,Linux CPU Minimal Build E2E CI Pipeline

@fs-eire
Copy link
Contributor

fs-eire commented Aug 9, 2024

/azp run Linux GPU CI Pipeline,Linux GPU TensorRT CI Pipeline,Linux OpenVINO CI Pipeline,Linux QNN CI Pipeline,MacOS CI Pipeline,orttraining-amd-gpu-ci-pipeline,orttraining-linux-ci-pipeline,orttraining-linux-gpu-ci-pipeline,orttraining-ortmodule-distributed,onnxruntime-binary-size-checks-ci-pipeline

@fs-eire
Copy link
Contributor

fs-eire commented Aug 9, 2024

/azp run Big Models,Linux Android Emulator QNN CI Pipeline,Android CI Pipeline,iOS CI Pipeline,ONNX Runtime React Native CI Pipeline

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@fs-eire
Copy link
Contributor

fs-eire commented Aug 12, 2024

This PR is replaced by #21698 because the build pipeline failed to trigger.

@fs-eire fs-eire closed this Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants