Skip to content

[js/webgpu] support using uniform buffer#17803

Merged
fs-eire merged 3 commits into
mainfrom
fs-eire/uniform
Oct 10, 2023
Merged

[js/webgpu] support using uniform buffer#17803
fs-eire merged 3 commits into
mainfrom
fs-eire/uniform

Conversation

@fs-eire
Copy link
Copy Markdown
Contributor

@fs-eire fs-eire commented Oct 5, 2023

Description

support using uniform buffer.

This PR allows to use uniform buffer in shader program, so that some runtime information (eg. input/output shape) is no longer need to be hardcoded into shader code.

There are 2 commits in this PR:

  • 667f31c: framework changes to support uniform buffer, as well as updates in program manager, gpu data manager and indices helper.
  • 09e1d2a: an example change for operator Transpose to use input's rank-only instead of dims as shader key. With this change, model mobilenetv2-12 shader compile times dropped from 71 to 52.

Comment thread js/web/lib/wasm/jsep/webgpu/ops/where.ts Fixed
Comment thread js/web/lib/wasm/jsep/webgpu/ops/where.ts Fixed
Comment thread js/web/lib/wasm/jsep/webgpu/ops/where.ts Fixed
Comment thread js/web/lib/wasm/jsep/webgpu/ops/where.ts Fixed
Comment thread js/web/lib/wasm/jsep/webgpu/ops/unary-op.ts Fixed
Comment thread js/web/lib/wasm/jsep/webgpu/ops/unary-op.ts Fixed
@fs-eire fs-eire marked this pull request as ready for review October 6, 2023 09:15
@fs-eire fs-eire changed the title [WIP] [js/webgpu] support using uniform buffer [js/webgpu] support using uniform buffer Oct 6, 2023
Copy link
Copy Markdown
Contributor

@github-advanced-security github-advanced-security AI left a comment

Choose a reason for hiding this comment

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

CodeQL found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.

@satyajandhyala satyajandhyala added the ep:WebGPU ort-web webgpu provider label Oct 6, 2023
Comment thread js/web/lib/wasm/jsep/webgpu/ops/reduce.ts
Comment thread js/web/lib/wasm/jsep/webgpu/gpu-data-manager.ts
Comment thread js/web/lib/wasm/jsep/backend-webgpu.ts
Comment thread js/web/lib/wasm/jsep/webgpu/types.ts
Comment thread js/web/lib/wasm/jsep/webgpu/types.ts
Copy link
Copy Markdown
Contributor

@guschmue guschmue left a comment

Choose a reason for hiding this comment

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

lgtm. I ran this with 40+ models - did not see issues there.

@fs-eire fs-eire merged commit d9b9c5a into main Oct 10, 2023
@fs-eire fs-eire deleted the fs-eire/uniform branch October 10, 2023 07:31
kleiti pushed a commit to kleiti/onnxruntime that referenced this pull request Mar 22, 2024
### Description
support using uniform buffer.

This PR allows to use uniform buffer in shader program, so that some
runtime information (eg. input/output shape) is no longer need to be
hardcoded into shader code.

There are 2 commits in this PR:
-
[667f31c](microsoft@667f31c):
framework changes to support uniform buffer, as well as updates in
program manager, gpu data manager and indices helper.
-
[09e1d2a](microsoft@09e1d2a):
an example change for operator `Transpose` to use input's rank-only
instead of dims as shader key. With this change, model mobilenetv2-12
shader compile times dropped from 71 to 52.
siweic0 pushed a commit to siweic0/onnxruntime-web that referenced this pull request May 9, 2024
### Description
support using uniform buffer.

This PR allows to use uniform buffer in shader program, so that some
runtime information (eg. input/output shape) is no longer need to be
hardcoded into shader code.

There are 2 commits in this PR:
-
[667f31c](microsoft@667f31c):
framework changes to support uniform buffer, as well as updates in
program manager, gpu data manager and indices helper.
-
[09e1d2a](microsoft@09e1d2a):
an example change for operator `Transpose` to use input's rank-only
instead of dims as shader key. With this change, model mobilenetv2-12
shader compile times dropped from 71 to 52.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ep:WebGPU ort-web webgpu provider

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants