Skip to content
Discussion options

You must be logged in to vote

Unfortunately I wasn't able to reproduce your behavior, but seems plausible to me. We assumed data-dependence was sufficient to guarantee ordering of prints in an XLA program, but that assumption is probably wrong!

XLA is a functional compiler and is free to do its own optimizations, such as rematerializing intermediate values instead of storing them. In your program, therefore, XLA could choose to first execute print(sin(x)) and then execute print(x) instead of first storing y = sin(x).

These compiler optimizations should not delete the call to print but more aggressive reordering is possible due to rematerialization.

We should update our docs to reflect this potential behavior.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@hericks
Comment options

Comment options

You must be logged in to vote
1 reply
@hericks
Comment options

Answer selected by hericks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants