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

Transfer Matrix #23

Open
drahnr opened this issue Mar 21, 2017 · 1 comment
Open

Transfer Matrix #23

drahnr opened this issue Mar 21, 2017 · 1 comment

Comments

@drahnr
Copy link

drahnr commented Mar 21, 2017

There is the need to handle transfers between devices more easily.

The current attempt to sync from backend to another is not sufficient/does not scale with more backends.

There are two things to think of (and fallback each):

  1. Inter Framework
  2. Fallback to do a Framework A -> Native -> Framework B
  3. Inter Device (if the framework does not handle it, i.e. CUDA afaik)
  4. Fallback to do a Framework A/Device A -> Native -> Framework A/Device B

Note that the matrix is supposedly symmetrical, but the transfer functions are not identical! Read is not write after all.

Note that this allows to scale very quickly, basically if this becomes a bottleneck, special functions can be registered. If not, and host memory is sufficient, this will default.

Note that: To and from Native is obviously always populated.

Note that: Maybe a big framework matrix is best suited, and then, if necessary a inter device matrix within the framework.

@jonysy
Copy link
Owner

jonysy commented Mar 21, 2017

In addition:

The body of the SharedTensor::autosync method contains the logic in question.

@alexandermorozov's original comment:

Backends may define transfers asymmetrically; for example, CUDA may know how to transfer to and from Native backend, while Native may know nothing about CUDA at all. So if the first attempt fails, we change the order and try again.

Removing that would require moving the logic to the Sync implementations, which could increase complexity. Although that's a disadvantage, the advantage of transferring the responsibility to frameworks would make adding other frameworks less of a hassle as the core codebase wouldn't need to be aware of individual frameworks (i.e., transferring from CUDA to OpenCL).

This may be a case of over-engineering, though. Transferring from framework-x to framework-y is rarely, if ever, done.

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

No branches or pull requests

2 participants