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

webgpu: Fix a bug in softmax #7607

Merged
merged 1 commit into from
Apr 20, 2023
Merged

Conversation

qjia7
Copy link
Contributor

@qjia7 qjia7 commented Apr 20, 2023

To see the logs from the Cloud Build CI, please join either our discussion or announcement mailing list.


This change is Reviewable

@qjia7 qjia7 requested review from gyagp, xhcao and Linchenn April 20, 2023 07:57
@qjia7
Copy link
Contributor Author

qjia7 commented Apr 20, 2023

@hujiajie Please take a look, thanks.

@qjia7 qjia7 mentioned this pull request Apr 20, 2023
@gyagp gyagp merged commit 78a3a03 into tensorflow:master Apr 20, 2023
mattsoulanille added a commit that referenced this pull request Apr 24, 2023
* webgpu: Fix a bug in softmax (#7607)

* Avoid allocating a large arraybuffer when loading weights (#7598)

The loadWeights function loads weights in 4MB chunks and then concatenates them into a single large ArrayBuffer. That ArrayBuffer is used for splitting the weights data back up into tensors. Allocating large ArrayBuffers (3.5GB) can be unstable on Chrome, so this PR avoids this allocation, instead slicing the weights out of the chunks manually.

The implementation wraps the array of weights (stored as ArrayBuffer[]) in a new CompositeArrayBuffer class. This class implements slice by copying the desired range out of the buffer(s) that it overlaps with.

* Support using a list of ArrayBuffers as model weight data

* Avoid 'Array.flat()'

* Simplify some of the tests

* Do not export 'CompositeArrayBuffer' from tfjs-core

* Update doc for weightData

* Fix tfjs-node

* Remove unused import

---------

Co-authored-by: Jiajia Qin <[email protected]>
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