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

Feature request: Code generation for pytorch #63

Open
jarlebring opened this issue Oct 27, 2021 · 0 comments
Open

Feature request: Code generation for pytorch #63

jarlebring opened this issue Oct 27, 2021 · 0 comments

Comments

@jarlebring
Copy link
Collaborator

jarlebring commented Oct 27, 2021

(Based on a comment from when I presented this result at EPFL.) The generated code is very GPU-friendly. We could generate code also for for PyTorch.

In fact the Bader, Blanes, Casas (in our code graph_bbc) method is currently default in pytorch matrix_exp, and we can do a lot better than the BBC-method so there is certainly room for improvement. It is implemented in the c++ code: mexp_impl and mexp:

https://github.com/pytorch/pytorch/blob/f4dd88489a77ff9b300bf6f9b34c233ca82f76d7/aten/src/ATen/native/LinearAlgebra.cpp#L2111
https://github.com/pytorch/pytorch/blob/f4dd88489a77ff9b300bf6f9b34c233ca82f76d7/aten/src/ATen/native/LinearAlgebra.cpp#L2185
and lower level code compute_T1 ... :
https://github.com/pytorch/pytorch/blob/f4dd88489a77ff9b300bf6f9b34c233ca82f76d7/aten/src/ATen/native/LinearAlgebra.cpp#L1855

I would suggest we add a language with a variant symbol

struct LangCPP
  variant::Symbol
end

If variant=:plain it will generate self-contained C++ code. If variant=:pytorch it generates pytorch-compatible code.

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

1 participant