-
Notifications
You must be signed in to change notification settings - Fork 3k
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] Support f16 uniform #19098
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ ONNX_OPERATOR_VERSIONED_KERNEL_EX( | |
2, | ||
10, | ||
kJsExecutionProvider, | ||
(*KernelDefBuilder::Create()).TypeConstraint("T", DataTypeImpl::GetTensorType<float>()), | ||
(*KernelDefBuilder::Create()).TypeConstraint("T", JsepSupportedFloatTypes()), | ||
Pad); | ||
|
||
ONNX_OPERATOR_VERSIONED_KERNEL_EX( | ||
|
@@ -24,7 +24,7 @@ ONNX_OPERATOR_VERSIONED_KERNEL_EX( | |
12, | ||
kJsExecutionProvider, | ||
(*KernelDefBuilder::Create()) | ||
.TypeConstraint("T", DataTypeImpl::GetTensorType<float>()) | ||
.TypeConstraint("T", JsepSupportedFloatTypes()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For version <=10, we can use |
||
.InputMemoryType(OrtMemTypeCPU, 1) | ||
.InputMemoryType(OrtMemTypeCPU, 2) | ||
.InputMemoryType(OrtMemTypeCPU, 3), | ||
|
@@ -37,7 +37,7 @@ ONNX_OPERATOR_VERSIONED_KERNEL_EX( | |
17, | ||
kJsExecutionProvider, | ||
(*KernelDefBuilder::Create()) | ||
.TypeConstraint("T", DataTypeImpl::GetTensorType<float>()) | ||
.TypeConstraint("T", JsepSupportedFloatTypes()) | ||
.InputMemoryType(OrtMemTypeCPU, 1) | ||
.InputMemoryType(OrtMemTypeCPU, 2) | ||
.InputMemoryType(OrtMemTypeCPU, 3), | ||
|
@@ -50,7 +50,7 @@ ONNX_OPERATOR_VERSIONED_KERNEL_EX( | |
18, | ||
kJsExecutionProvider, | ||
(*KernelDefBuilder::Create()) | ||
.TypeConstraint("T", DataTypeImpl::GetTensorType<float>()) | ||
.TypeConstraint("T", JsepSupportedFloatTypes()) | ||
.InputMemoryType(OrtMemTypeCPU, 1) | ||
.InputMemoryType(OrtMemTypeCPU, 2) | ||
.InputMemoryType(OrtMemTypeCPU, 3), | ||
|
@@ -62,7 +62,7 @@ ONNX_OPERATOR_KERNEL_EX( | |
19, | ||
kJsExecutionProvider, | ||
(*KernelDefBuilder::Create()) | ||
.TypeConstraint("T", DataTypeImpl::GetTensorType<float>()) | ||
.TypeConstraint("T", JsepSupportedFloatTypes()) | ||
.InputMemoryType(OrtMemTypeCPU, 1) | ||
.InputMemoryType(OrtMemTypeCPU, 2) | ||
.InputMemoryType(OrtMemTypeCPU, 3), | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to do some preprocessing to pass cpu data to Uint16Array if the cpu data is treated as float32? For example, the pad2~pad10, the
constant_value
is float notT
as input.cc @jzm-intel
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, my example is not correct for this case. If
constant_value
is float, the code will directly go to thefloat32
path notfloat16
case. But the concern is still there.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, user should make sure the "data" is stored float16 bits, for example: If "data" is 1.0, then the corresponding float16 bits is 0x3c00. I am trying to add some warning msg to inform user that this should be unit test only: https://github.com/microsoft/onnxruntime/pull/19307/files#diff-006fc84d3997f96a29b8033bd2075d6a0a9509211bd5812a6b934fc74fedfd9dR520