Skip to content
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

simplify [p]xla.py by in-lining single-caller function #1667

Merged
merged 3 commits into from
Nov 13, 2019
Merged

Conversation

mattjj
Copy link
Collaborator

@mattjj mattjj commented Nov 11, 2019

The functions xla._compile_jaxpr and pxla.compile_replicated only had one caller each. The logic was confusing, and they had grown many arguments (and needed more!).

By in-lining them we got a few other cleanups:

  • remove _parameter_or_create_token in favor of a common xla._xla_callable_args (which is only used at the top-level, replacing the need for inner)
  • fix a bug in the interaction between token inputs and arg tupling
  • finally plumb the user function name through to XLA metadata (!!)

FYI I got started on these cleanups because they make the lazy-sublanguage change I'm working on (#1668) easier to implement.

The functions xla._compile_jaxpr and pxla.compile_replicated only had one
caller each. The logic was confusing, and they had grown many arguments (and
needed more!).

By in-lining them we got a few other cleanups:
  - remove _parameter_or_create_token in favor of a common xla._xla_callable_args
  - fix a bug in the interaction between token inputs and arg tupling
  - finally plumb the user function name through to XLA metadata (!!)
@mattjj mattjj requested a review from hawkinsp November 11, 2019 22:38
@mattjj mattjj removed the request for review from hawkinsp November 11, 2019 22:39
@mattjj
Copy link
Collaborator Author

mattjj commented Nov 11, 2019

Just noticed I forgot to add back a couple functions! Will do...

EDIT: done!

@mattjj mattjj requested a review from hawkinsp November 11, 2019 23:09
@mattjj mattjj mentioned this pull request Nov 12, 2019
11 tasks
@mattjj mattjj merged commit 9392824 into master Nov 13, 2019
@mattjj mattjj deleted the cleanups branch November 13, 2019 20:26
mattjj added a commit that referenced this pull request Nov 20, 2019
When #1667 inlined a function into its caller, it mixed up two distinct
values referred to as `nrep` in the two functions: num_global_replicas
vs num_local_replicas. The result caused errors on multi-host setups.

Co-authored-by: Jonathan Heek <jheek@google.com>
mattjj added a commit that referenced this pull request Nov 20, 2019
When #1667 inlined a function into its caller, it mixed up two distinct
values referred to as `nrep` in the two functions: num_global_replicas
vs num_local_replicas. The result caused errors on multi-host setups.

Co-authored-by: Jonathan Heek <jheek@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants