-
Notifications
You must be signed in to change notification settings - Fork 951
Add ndarray.getValuesAsync() method which returns a promise that resolves when values are ready. #146
Conversation
Reviewed 14 of 14 files at r1. src/environment.ts, line 27 at r1 (raw file):
Add short one liner comment on top of each feature explaining what each feature means (e.g. want to understand the diff between the two query time extensions) src/environment_test.ts, line 42 at r1 (raw file):
remove console.log src/util.ts, line 226 at r1 (raw file):
this looks strange, shouldn't it be src/util.ts, line 227 at r1 (raw file):
re-add the return type of src/math/webgl/gpgpu_context.ts, line 266 at r1 (raw file):
s/ellapsed time/ellapsed time in ms/ src/math/webgl/gpgpu_context.ts, line 311 at r1 (raw file):
same here: 1ms = 1000 micro seconds. Why divide by 1 million? src/math/webgl/gpgpu_context.ts, line 349 at r1 (raw file):
1 ms = 1000 micro seconds. Divide by 1000 instead of 1 million ? Comments from Reviewable |
Thanks! Fixed your comments. It's so nice to have a thorough reviewer :) Review status: 9 of 14 files reviewed at latest revision, 7 unresolved discussions, some commit checks pending. src/environment.ts, line 27 at r1 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Done. src/environment_test.ts, line 42 at r1 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Done. src/util.ts, line 226 at r1 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Ah it's not a type here. This argument is a function that maps the step counter to the timeout (so you could do exponential backoff). Here, we always return 0 so we have a setTimeout(fn, 0) loop src/util.ts, line 227 at r1 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Done. src/math/webgl/gpgpu_context.ts, line 266 at r1 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Done. src/math/webgl/gpgpu_context.ts, line 311 at r1 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Done. src/math/webgl/gpgpu_context.ts, line 349 at r1 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Renamed it, it's actually nanoseconds :) Comments from Reviewable |
…lves when values are ready. (tensorflow#146) * async values * merge * fix unit tests * remove loop demo * remove line from ndarray.ts * throw when lose context not supported * WEBGL_lose_context * respond to comments
This implementation will poll the GPU for the availability of the disjoint query object as if we were benchmarking. The cost of polling is negligible, so we can use a setTimeout(fn, 0) to check.
I also removed the exponential backoff in the benchmarks, we can just poll as fast as possible since it's pretty cheap.
When the extension isn't enabled, we just call getValues and resolve immediately.
This change also allows flags to depend on each other, and values get cached so we don't have to construct lots of canvases when evaluating flags.
This change is![Reviewable](https://camo.githubusercontent.com/1541c4039185914e83657d3683ec25920c672c6c5c7ab4240ee7bff601adec0b/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)