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

Split and Merge Hlo #27

Closed
merrymercy opened this issue May 12, 2021 · 1 comment
Closed

Split and Merge Hlo #27

merrymercy opened this issue May 12, 2021 · 1 comment
Assignees

Comments

@merrymercy
Copy link
Member

merrymercy commented May 12, 2021

image

Tips

  // insert before the statement "return true;"
  forward_module, backward_module = partition_hlo_module(module);

  PyGILState_STATE gstate = PyGILState_Ensure();
  {
    py::object submodule = py::module_::import("parax.auto_sharding");
    py::object set_forward_backward_module = submodule.attr("set_forward_backward_module");
    set_forward_backward_module(forward_module, backward_module);
  }
  PyGILState_Release(gstate);

in parax/auto_sharding.py

received_forward_module = None
received_backward_module = None
def set_forward_backward_module(forward_module, backward_module):
    global received_forward_module, received_backward_module
    received_forward_module = forward_module
    received_backward_module = backward_module

def split_and_compile(forward_hlo, backward_hlo):
    global received_forward_module, received_backward_module
    merged_hlo = merge(forward_hlo, backward_hlo)
    compile_with_auto_sharidng(merged_hlo)  # this will set received_forward_module and received_backward_module
    forward_binary = compile_without_auto_sharding(received_forward_module)
    backward_binary = compile_without_auto_sharding(received_backward_module)
    return forward_binary, backward_binary
@merrymercy
Copy link
Member Author

#46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants