-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Customize setTimeout #6694
Customize setTimeout #6694
Conversation
The implementation looks good for me. How about enabling setTimeoutWPM behind a flag for a while? For the test case, maybe add a new file util_base_test.js. Test that repeat call |
The function could be called by tf.profile, if you want to write unit cases. You could also view the total of tfjs-models' demos, the time could be reduced. |
With above changes, I get below from unit test: |
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 @gyagp, @lina128, @Linchenn, @mattsoulanille, @qjia7, and @xhcao)
tfjs-core/src/util_base.ts
line 765 at r1 (raw file):
// If the setTimeout nesting level is greater than 5 and timeout is less than // 4ms, timeout will be clamped to 4ms, which hurts the perf. Interleaving // window.postMessage and setTimeout will trick the browser and avoid the
when the postMessage call will reset the timeout counting?
tfjs-core/src/util_base.ts
line 770 at r1 (raw file):
fns.push(fn); setTimeout(() => { window.postMessage({name: messageName, index: fns.length - 1}, '*');
I am curious why you use the index of the functions, instead of simply popping from the function array?
tfjs-core/src/util_base.ts
line 780 at r1 (raw file):
fn(); handledMessageCount++; // console.log(`handledMessageCount=${handledMessageCount},
remove the comments?
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 @gyagp, @lina128, @Linchenn, @mattsoulanille, @qjia7, and @xhcao)
tfjs-core/src/util_base.ts
line 758 at r1 (raw file):
} if (!('setTimeoutWPM' in window)) {
is this only targeting browser? might be better to register this on the browser platform file.
tfjs-core/src/util_base.ts
Outdated
// console.log(`handledMessageCount=${handledMessageCount}, | ||
// fns.length=${fns.length}`); |
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.
// console.log(`handledMessageCount=${handledMessageCount}, | |
// fns.length=${fns.length}`); |
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.
done
tfjs-core/src/util_base.ts
Outdated
}; | ||
|
||
window.addEventListener('message', handleMessage, true); | ||
(window as any).setTimeoutWPM = setTimeoutWPM; |
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.
It may be better to store this in _tfGlobals
(instead of window
), which you can get by calling getGlobalNamespace()
from global_util.ts.
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.
Actually, since this relies on window
, _tfGlobals may be the wrong place for it. Maybe we should add an optional setTimeoutWPM
function to platform.ts and add the function itself to platform_browser.ts (like Ping suggested in his review).
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.
Moved to platform_browser.ts
tfjs-core/src/util_test.ts
Outdated
// If we set a larger number here, an error will be reported as "'expect' | ||
// was used when there was no current spec, this could be because an | ||
// asynchronous test timed out". |
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.
This is because Jasmine does not know you're still testing setTimeout
, so the expect
called in the callback is actually called during another test (or after all tests are complete, which causes the error you're seeing). Marking the test as async
or using a done
callback should fix this. Docs
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.
Thanks for the suggestion. I used done callback to solve this.
tfjs-core/src/util_test.ts
Outdated
// We don't have expect here as in some browsers, like Chrome Canary, | ||
// nesting level threshold is set to 100 instead of 5. |
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.
With the fix for totalCount above, you might be able to increase the count above 100 and add an expect
. Otherwise, it may be best to remove this test or mark it with xit
, since it doesn't appear to be testing anything (unless you're testing that no errors are thrown. If so, you should call expect().nothing()
).
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.
Increased to 100
tfjs-core/src/util_test.ts
Outdated
const totalCount = 8; | ||
const skipCount = 5; | ||
|
||
it('setTimeout', () => { |
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.
Make this test async
or add a done
callback.
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.
done
tfjs-core/src/util_test.ts
Outdated
} | ||
}); | ||
|
||
it('setTimeoutWPM', () => { |
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.
Make this test async
or add a done
callback.
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.
done
tfjs-core/src/util_test.ts
Outdated
// was used when there was no current spec, this could be because an | ||
// asynchronous test timed out". | ||
const totalCount = 8; | ||
const skipCount = 5; |
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.
Nit: Document what this does and why it exists.
const skipCount = 5; | |
// Skip the first few samples because the browser does not throttle them. | |
const skipCount = 5; |
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.
comments added
tfjs-core/src/util_base.ts
Outdated
} | ||
}; | ||
|
||
window.addEventListener('message', handleMessage, true); |
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.
It might be better to add this event listener when the user first calls setTimeoutWPM
. That way, we don't pollute the event listener list if setTimeoutWPM
is never used.
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.
Moved to first call to setTimeoutCustom.
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.
Agree with Ping. If this targets to browser, we probably have to move it to browser platform.
LGTM! Thank you Yang so much for investigating and fulfilling it!
Reviewable status: 0 of 1 approvals obtained (waiting on @gyagp, @lina128, @qjia7, and @xhcao)
tfjs-core/src/util_base.ts
Outdated
@@ -303,7 +303,7 @@ export function rightPad(a: string, size: number): string { | |||
|
|||
export function repeatedTry( | |||
checkFn: () => boolean, delayFn = (counter: number) => 0, | |||
maxCounter?: number): Promise<void> { | |||
maxCounter?: number, scheduleFn?: Function): Promise<void> { |
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.
environment.ts imports util_base, so we couldn't import environment in util_base, which will result in circular import. Thus I introduce scheduleFn here. If we need a custom scheduling function other than setTimeout, we can pass the function in. In our case, it's setTimeoutCustom() from WebGL side. In this way, repeatedTry() keeps to be platform independent.
@@ -82,3 +82,6 @@ ENV.registerFlag('ENGINE_COMPILE_ONLY', () => false); | |||
|
|||
/** Whether to enable canvas2d willReadFrequently for GPU backends */ | |||
ENV.registerFlag('CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU', () => false); | |||
|
|||
/** Whether to use setTimeoutCustom */ | |||
ENV.registerFlag('USE_SETTIMEOUTCUSTOM', () => false); |
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.
I changed to this name as even if we set it, we can't guarantee postMessage version setTimeout is called, as window might be not available in browser.
@@ -46,4 +46,6 @@ export interface Platform { | |||
encode(text: string, encoding: string): Uint8Array; | |||
/** Decode the provided bytes into a string using the provided encoding. */ | |||
decode(bytes: Uint8Array, encoding: string): string; | |||
|
|||
setTimeoutCustom?(functionRef: Function, delay: number): void; |
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.
I changed the parameter names to be aligned with setTimeout definition in browser (https://developer.mozilla.org/en-US/docs/Web/API/setTimeout).
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 @lina128, @mattsoulanille, @pyu10055, @qjia7, and @xhcao)
tfjs-core/src/util_base.ts
line 758 at r1 (raw file):
Previously, pyu10055 (Ping Yu) wrote…
is this only targeting browser? might be better to register this on the browser platform file.
moved to platform_browser
tfjs-core/src/util_base.ts
line 765 at r1 (raw file):
Previously, pyu10055 (Ping Yu) wrote…
when the postMessage call will reset the timeout counting?
The trick here is if we interleave the setTimeout and window.postMessage, it will break the nesting rule of setTimeout (calling setTimeout inside callback).
tfjs-core/src/util_base.ts
line 770 at r1 (raw file):
Previously, pyu10055 (Ping Yu) wrote…
I am curious why you use the index of the functions, instead of simply popping from the function array?
We may call setTimeout with different delays, which means the sequence of call may not be the sequence of callbacks. For example, setTimeout(cb0, 2); setTimeout(cb1, 1); cb1 should be called first, then cb0.
tfjs-core/src/util_base.ts
line 780 at r1 (raw file):
Previously, pyu10055 (Ping Yu) wrote…
remove the comments?
done
Thank you all for the comments! I think I have addressed all of them. Could you please take another look? [setTimeoutCustom] The data shows we can get 2-4ms back. It seems the bots are still not satisfied, but I couldn't figure out the reason after checking the detailed log. Could you please point me to the reason? Thanks! |
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.
Thank you Yang! LGTM.
Reviewable status: 0 of 1 approvals obtained (waiting on @lina128, @mattsoulanille, @pyu10055, @qjia7, and @xhcao)
let count = 0; | ||
let startTime = performance.now(); | ||
let totalTime = 0; | ||
if (env().platformName === 'browser') { |
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.
Can this check for the browser platform happen before this spec?
if (env().platformName === 'browser') {
it('setTimeout', (done) => {
...
});
}
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.
Actually, if all the tests in this describe
block need to run in the browser, you can replace it with
describeWithFlags('setTimeout', BROWSER_ENVS, () => {
...
});
Then, you won't have to check the platform on each test.
tfjs-core/src/util_base.ts
Outdated
@@ -303,7 +303,7 @@ export function rightPad(a: string, size: number): string { | |||
|
|||
export function repeatedTry( | |||
checkFn: () => boolean, delayFn = (counter: number) => 0, | |||
maxCounter?: number): Promise<void> { | |||
maxCounter?: number, scheduleFn?: Function): Promise<void> { |
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.
Use setTimeout
as the default value (see next comment for why).
maxCounter?: number, scheduleFn?: Function): Promise<void> { | |
maxCounter?: number, scheduleFn = setTimeout): Promise<void> { |
The types here might not be correctly inferred, so you might have to manually specify
scheduleFn: (callback: () => void, time: number) => void
or something similar.
tfjs-core/src/util_base.ts
Outdated
if (typeof scheduleFn === 'undefined') { | ||
setTimeout(tryFn, nextBackoff); | ||
} else { | ||
scheduleFn(tryFn, nextBackoff); | ||
} |
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.
Set the default value of scheduleFunction
to setTimeout
to avoid this if statement.
if (typeof scheduleFn === 'undefined') { | |
setTimeout(tryFn, nextBackoff); | |
} else { | |
scheduleFn(tryFn, nextBackoff); | |
} | |
scheduleFn(tryFn, nextBackoff); |
If the setTimeout nesting level is greater than 5 and timeout is less than 4ms, timeout will be clamped to 4ms, which hurts the perf. A custom setTimeout is provided to mitigate the perf impact.
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 @gyagp, @lina128, @mattsoulanille, @pyu10055, @qjia7, and @xhcao)
tfjs-core/src/util_base.ts
line 328 at r4 (raw file):
Previously, mattsoulanille (Matthew Soulanille) wrote…
Set the default value of
scheduleFunction
tosetTimeout
to avoid this if statement.scheduleFn(tryFn, nextBackoff);
This looks more clean. done!
tfjs-core/src/platforms/platform_browser_test.ts
line 102 at r4 (raw file):
Previously, mattsoulanille (Matthew Soulanille) wrote…
Actually, if all the tests in this
describe
block need to run in the browser, you can replace it withdescribeWithFlags('setTimeout', BROWSER_ENVS, () => { ... });Then, you won't have to check the platform on each test.
BROWSER_ENVS is much better. Thanks for the suggestion!
@@ -321,7 +323,7 @@ export function repeatedTry( | |||
reject(); | |||
return; | |||
} | |||
setTimeout(tryFn, nextBackoff); | |||
scheduleFn(tryFn, nextBackoff); |
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.
How do you think to always call setTimeoutCustom(tryFn, nextBackoff)
here? And move setTimeoutCustom(tryFn, nextBackoff)
to a common place since your current implementation setTimeoutCustom
is already a common way and not only for webgl
backend? In this case, you don't need to change gpgpu_context.ts
?
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.
We should replace setTimeout with a custom one only in browser and window is ready. So platform browser may be a good place to host it.
util_base should not be dependent on any env, but setTimeoutCustom relies on env (for both platform check and flag check). So I'm afraid even with your suggestion, we still need to pass setTimeoutCustom as a parameter (Actually I introduced scheduleFn to avoid the dependency with env).
@pyu10055 Can you review again the latest changes? Thanks! |
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.
Thank you Yang! LGTM
I love this improvement as it results in quite significant performance improvements but at the moment it causes conflict with see #6687 (comment) for details |
Thanks @vladmandic , I will investigate this. |
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.
Thanks @gyagp looks good to me, just couple minor comments.
Reviewable status: complete! 3 of 1 approvals obtained (waiting on @gyagp, @mattsoulanille, @pyu10055, @qjia7, and @xhcao)
tfjs-core/src/platforms/platform.ts
line 50 at r3 (raw file):
Previously, gyagp (Yang Gu) wrote…
I changed the parameter names to be aligned with setTimeout definition in browser (https://developer.mozilla.org/en-US/docs/Web/API/setTimeout).
To align with setTimeout, should it return the id for allowing clearTimeout API?
tfjs-core/src/platforms/platform_browser_test.ts
line 112 at r5 (raw file):
if (count === totalCount) { const averageTime = totalTime / (totalCount - skipCount); console.log(`averageTime of setTimeout is ${averageTime} ms`);
remove the console log
tfjs-core/src/platforms/platform_browser_test.ts
line 140 at r5 (raw file):
if (count === totalCount) { const averageTime = totalTime / (totalCount - skipCount); console.log(`averageTime of setTimeoutCustom is ${averageTime} ms`);
remove the console log
tfjs-core/src/platforms/platform_browser_test.ts
line 141 at r5 (raw file):
const averageTime = totalTime / (totalCount - skipCount); console.log(`averageTime of setTimeoutCustom is ${averageTime} ms`); if (window) {
since you are specifying browser_env, there is no need to test window variable, and the false branch should not be triggered
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! 3 of 1 approvals obtained (waiting on @gyagp, @mattsoulanille, @pyu10055, @qjia7, and @xhcao)
tfjs-core/src/platforms/platform.ts
line 50 at r3 (raw file):
Previously, pyu10055 (Ping Yu) wrote…
To align with setTimeout, should it return the id for allowing clearTimeout API?
I don't want to introduce the complexity to implement clearTimeoutCustom. Without it, it's useless to return id, so I intentionally set it as void.
tfjs-core/src/platforms/platform_browser_test.ts
line 112 at r5 (raw file):
Previously, pyu10055 (Ping Yu) wrote…
remove the console log
This is in the test and I intentionally added this to understand the setTimeout delay on various configurations, like node, safari, etc. The results may change as time goes by. For example, Chrome is increasing the throttle nesting level from 5 to 100, which may cause failure of this test in future. With this info, it should be easier to understand the reason.
tfjs-core/src/platforms/platform_browser_test.ts
line 140 at r5 (raw file):
Previously, pyu10055 (Ping Yu) wrote…
remove the console log
same as above
tfjs-core/src/platforms/platform_browser_test.ts
line 141 at r5 (raw file):
Previously, pyu10055 (Ping Yu) wrote…
since you are specifying browser_env, there is no need to test window variable, and the false branch should not be triggered
I was thinking about running this in a worker. It should be unnecessary. Will remove in a follow-up PR.
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 3 of 6 files at r2, 2 of 4 files at r3, 1 of 2 files at r5, 1 of 1 files at r6, all commit messages.
Reviewable status: complete! 3 of 1 approvals obtained (waiting on @gyagp, @mattsoulanille, @pyu10055, @qjia7, and @xhcao)
tfjs-core/src/platforms/platform_browser_test.ts
line 141 at r5 (raw file):
Previously, gyagp (Yang Gu) wrote…
I was thinking about running this in a worker. It should be unnecessary. Will remove in a follow-up PR.
we run worker tests separately, and those tests are typically a separate file.
@pyu10055 @mattsoulanille, given related Emscripten issues were fixed (Thanks @vladmandic !) and @mattsoulanille upgraded Emscripten to include the fixes, can we merge this change now? |
* Customize setTimeout (tensorflow#6694) If the setTimeout nesting level is greater than 5 and timeout is less than 4ms, timeout will be clamped to 4ms, which hurts the perf. A custom setTimeout is provided to mitigate the perf impact. BUG: tensorflow#6687 Co-authored-by: Na Li <[email protected]> * Upgrade windows BrowserStack chrome to 104 (tensorflow#6866) * webgpu: Disable importExternalTexture (tensorflow#6868) WebGPU Working Group recently found some problem with importExtenalTexture in spec, so we have to disable it temporarily. Co-authored-by: Yang Gu <[email protected]> Co-authored-by: Na Li <[email protected]> Co-authored-by: Matthew Soulanille <[email protected]>
* Customize setTimeout (tensorflow#6694) If the setTimeout nesting level is greater than 5 and timeout is less than 4ms, timeout will be clamped to 4ms, which hurts the perf. A custom setTimeout is provided to mitigate the perf impact. BUG: tensorflow#6687 Co-authored-by: Na Li <[email protected]> * Upgrade windows BrowserStack chrome to 104 (tensorflow#6866) * webgpu: Disable importExternalTexture (tensorflow#6868) WebGPU Working Group recently found some problem with importExtenalTexture in spec, so we have to disable it temporarily. Co-authored-by: Yang Gu <[email protected]> Co-authored-by: Na Li <[email protected]> Co-authored-by: Matthew Soulanille <[email protected]>
* Customize setTimeout (tensorflow#6694) If the setTimeout nesting level is greater than 5 and timeout is less than 4ms, timeout will be clamped to 4ms, which hurts the perf. A custom setTimeout is provided to mitigate the perf impact. BUG: tensorflow#6687 Co-authored-by: Na Li <[email protected]> * Upgrade windows BrowserStack chrome to 104 (tensorflow#6866) * webgpu: Disable importExternalTexture (tensorflow#6868) WebGPU Working Group recently found some problem with importExtenalTexture in spec, so we have to disable it temporarily. * Refactored Resizing Layer Unit Tests (#38) * Rescaling Preprocessing Layer Co-authored-by: David Kim (@koyykdy) <[email protected]> Brian Zheng (@Brianzheng123) <[email protected]> * PR issues resolved * linting and PR issues resolved Co-authored-by: Adam Lang (@AdamLang96) <[email protected]> Co-authored-by: (@Brianzheng123) <[email protected]> * initial implementation of image preprocessing: resizing layer, and associated unit tests. Comments and refactoring for image scaling layer * refactoring in computeOutputShape for image resizing layer * Unit tests for image resizing preprocessing layer expanded and refactored * refactored unit tests for resizing layer * Preprocessing-Resizing layer unit test expansion and refactoring. Co-authored-by: Adam Lang <@AdamLang96> ([email protected]) * cleaning up commit diffs * cleaning up commit diffs * PR commit suggestions accepted - code refactored to reflect changes * resizing layer unit test refactoring Co-authored-by: AdamLang96 <[email protected]> * Linting issue resolved: unused import statement culled (#39) * Rescaling Preprocessing Layer Co-authored-by: David Kim (@koyykdy) <[email protected]> Brian Zheng (@Brianzheng123) <[email protected]> * PR issues resolved * linting and PR issues resolved Co-authored-by: Adam Lang (@AdamLang96) <[email protected]> Co-authored-by: (@Brianzheng123) <[email protected]> * initial implementation of image preprocessing: resizing layer, and associated unit tests. Comments and refactoring for image scaling layer * refactoring in computeOutputShape for image resizing layer * Unit tests for image resizing preprocessing layer expanded and refactored * refactored unit tests for resizing layer * Preprocessing-Resizing layer unit test expansion and refactoring. Co-authored-by: Adam Lang <@AdamLang96> ([email protected]) * cleaning up commit diffs * cleaning up commit diffs * PR commit suggestions accepted - code refactored to reflect changes * resizing layer unit test refactoring * linting issues resolved: unusued import statement culled Co-authored-by: AdamLang96 <[email protected]> * Update jasmine_util.ts (tensorflow#6872) FIX * webgl: Fix NaN issue (tensorflow#6828) Fix tensorflow#6822 Problem 1: On some GPUs, even if a and b are both non-NaN, the value of isNaN in vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0)); are still larger than 0., which misleads all values become NAN. 2: After resolving NAN issue, the result is still incorrect. It seems that the isnan_custom is not well supported on the problem GPU. After switching back to builtin isnan, everything works well. Solution: Use the bool type bvec4 instead of float type vec4 to calculate isNaN to avoid the the float precision issue when comparing with zero. Meanwhile, add an env flag WEBGL2_ISNAN_CUSTOM to allow user to specify which isnan to use. * Upgrade nodejs to 18.7.0 (tensorflow#6863) * Upgrade nodejs to 18.7.0 * Fix hash table test string not passed as base64 * fixed prelu fusing code that pre-maturely neg the const on multiply (tensorflow#6876) Co-authored-by: RajeshT <[email protected]> * Update tfjs-layers/src/layers/preprocessing/image_resizing.ts Co-authored-by: Matthew Soulanille <[email protected]> Co-authored-by: Yang Gu <[email protected]> Co-authored-by: Na Li <[email protected]> Co-authored-by: Matthew Soulanille <[email protected]> Co-authored-by: AdamLang96 <[email protected]> Co-authored-by: Linchenn <[email protected]> Co-authored-by: Jiajia Qin <[email protected]> Co-authored-by: Ping Yu <[email protected]> Co-authored-by: RajeshT <[email protected]> Co-authored-by: Matthew Soulanille <[email protected]> Co-authored-by: Yang Gu <[email protected]> Co-authored-by: Na Li <[email protected]> Co-authored-by: Matthew Soulanille <[email protected]> Co-authored-by: AdamLang96 <[email protected]> Co-authored-by: Linchenn <[email protected]> Co-authored-by: Jiajia Qin <[email protected]> Co-authored-by: Ping Yu <[email protected]> Co-authored-by: RajeshT <[email protected]> Co-authored-by: Matthew Soulanille <[email protected]>
// Skip the first few samples because the browser does not clamp the timeout | ||
const skipCount = 5; | ||
|
||
it('setTimeout', (done) => { |
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.
@gyagp I began to see this test fail on Linux, maybe related with https://chromestatus.com/feature/5710690097561600
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.
@hujiajie What's your channel and version of Chrome? I tried both Stable (108.0.5359.124) and Dev (110.0.5478.4) on Linux, but the nesting levels are still 5. I also double checked Windows, with Stable (108.0.5359.125) and Canary (111.0.5491.0), and the nesting levels are also 5.
My testing program is timer.html at https://github.com/webatintel/webatintel.github.io. You need to download it to local (otherwise the result is impacted by the network condition) and type "/timer.html?test=setTimeout&maxCount=30" in the address bar.
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.
Ah, it seems chromestatus is lying here, and the feature is still in field trial. What if you add --enable-features=MaxUnthrottledTimeoutNestingLevel
?
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.
With this option, nesting level is 15. I will do the change once Chrome really enables this in the stable channel.
If the setTimeout nesting level is greater than 5 and timeout is less
than 4ms, timeout will be clamped to 4ms, which hurts the perf. A custom
setTimeout is provided to mitigate the perf impact.
BUG: #6687
To see the logs from the Cloud Build CI, please join either our discussion or announcement mailing list.
This change is