-
Notifications
You must be signed in to change notification settings - Fork 950
ensure webgl backend read downloads converted typedarray #1382
Conversation
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.
Reviewable status: 0 of 1 approvals obtained (waiting on @nsthorat)
src/kernels/backend_webgl.ts, line 341 at r1 (raw file):
bufferOrTexture, texShape[0], texShape[1]); } this.cacheOnCPU(dataId, vals);
What would folks think about having cacheOnCPU return the value that gets cached. (i.e. texData.values) since it might do some transformation on it? Might make it easier to predict what it does from skimming. Or calling it convertAndCacheOnCPU or something like that.
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.
Reviewed 2 of 2 files at r1.
Reviewable status: 0 of 1 approvals obtained (waiting on @tafsiri and @nsthorat)
src/kernels/backend_webgl.ts, line 341 at r1 (raw file):
Previously, tafsiri (Yannick Assogba) wrote…
What would folks think about having cacheOnCPU return the value that gets cached. (i.e. texData.values) since it might do some transformation on it? Might make it easier to predict what it does from skimming. Or calling it convertAndCacheOnCPU or something like that.
Yeah that sounds great, stamping but go ahead with that.
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.
Reviewable status: complete! 1 of 1 approvals obtained (waiting on @tafsiri)
src/kernels/backend_webgl.ts, line 338 at r2 (raw file):
bufferOrTexture, texShape[0], texShape[1]); } const dTypeVals: TypedArray = this.convertAndCacheOnCPU(dataId, vals);
you shouldn't have to explicitly type this as TypedArray
also just call this values?
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.
Reviewable status: complete! 1 of 1 approvals obtained (waiting on @tafsiri and @nsthorat)
src/kernels/backend_webgl.ts, line 338 at r2 (raw file):
Previously, nsthorat (Nikhil Thorat) wrote…
you shouldn't have to explicitly type this as TypedArray
also just call this values?
We already have a values above. and vals is already on cpu, so i went with dTypeVals to indicate it has the right dtype (though its really the typed array type). Thoughts?
I'll drop the explicit typing, i had put it in as an extra signal to the diff between vals and dtypeValues.
Fixes a bug where async downloading of a tensor that was uploaded to the GPU would always return a Float32Array.
BUG
This change is