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
generated kernel file is not deterministic #34086
Comments
cc @stefantsov |
This should be treated as a P1, it blocks landing performance improvements in google3. |
Thanks for the context. I agree with the priority. |
I'm actively working on it. I hope to upload a fix within a few hours. |
I have a workaround in CL 68940. It removes the described non-determinism and seems slightly more preferable than the two described approaches. Compared to using just |
Ok, I didn't think about Also, it would be great to have a test for non-determinism. I'll try to ask around about having it. |
@stefantsov, with your fix patched in I no longer see a difference in the names. But, the order of the "no such method forwarders" is not the same when generating the kernel, and so that has to be fixed to make them deterministic. |
@keertip do you see differences in the order of nsm-forwarders from multiple runs of patched version or you see difference between patched and unpatched version? Later is probably expected. I did few runs of patched versions, kernel dump files all look identical. |
@stefantsov, was testing with a version where the kernel service was not updated with the changes. After updating the kernel service snapshot with the fix, can now generate deterministic kernel. |
Thanks @keertip! I'm happy that it worked. I'm lowering the priority, because the workaround has landed. I'll keep the issue open until we have a test that check for non-determinism or until we decide that it's not needed. |
What's the status on this? |
Considering we haven't heard anything for 3+ years I'll assume this one is fine and close. |
From the same set of sources compiler produces kernel files that are slightly different where "no such method forwarders" for the same private name are transposed.
To repro
Compare dump-mfs.txt from several runs and observe the difference along the lines:
The culprit seems to be
_PrivateName._computeHashCode
function which is built on top ofReference
hashCode
, which is simply inherited fromObject
: https://github.com/dart-lang/sdk/blob/master/pkg/kernel/lib/ast.dart#L4451.One solution might be to remove reference.hashCode from
_PrivateName._computeHashCode
:Another solution might be to define Reference hashCode similarly how it is defined for TreeNode: https://github.com/dart-lang/sdk/blob/master/pkg/kernel/lib/ast.dart#L107 that guarantees unique hashCode for every instance of Reference.
cc @alexmarkov @keertip @davidmorgan
The text was updated successfully, but these errors were encountered: