Skip to content

RFC: Kernel and Op Implementation and Registration API #133

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

Merged
merged 6 commits into from
Jun 4, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update 20190814-kernel-and-op-registration.md
  • Loading branch information
annarev authored Aug 15, 2019
commit 19ad326f69df5cb53acbdc052108d9455729fb2d
15 changes: 6 additions & 9 deletions rfcs/20190814-kernel-and-op-registration.md
Original file line number Diff line number Diff line change
Expand Up @@ -399,12 +399,10 @@ For details on how we plan to switch between `std::function<void>` and `void
### Device Assignment API

This approach lets us construct device objects (e.g. `Eigen::GpuDevice`) on the
plugin side. This is preferred over the approach described in "Alternatives
Considered" because it is more flexible when it comes to Eigen assignments and
operations. Basically, we get an Eigen device object and can apply any
plugin side. Basically, we get an Eigen device object and can apply any
operations we currently apply to an Eigen device.

We could wrap `StreamInterface`, `ThreadPoolInterface` and `Allocator`. These
We could wrap `Eigen::StreamInterface`, `Eigen::ThreadPoolInterface` and `Eigen::Allocator`. These
wrappers will consist of a C API and a C++ wrapper on top of the C API. A
sample C API for `StreamInterface` is given below:

Expand Down Expand Up @@ -546,10 +544,10 @@ TensorFlow core of the form:
void foo(std::function<void()> arg) { ... }
```

We can't pass std::function across the C API boundary. Instead, we plan to wrap it with a struct and break this call up into 3 steps:
We can't pass `std::function` across the C API boundary. Instead, we plan to wrap it with a struct and break this call up into 3 steps:

* Wrap `std::function<void()>` with a struct. The struct will contain pointers
to callbacks for manipulating std::function<void()> pointer. (This will happen
to callbacks for manipulating `std::function<void()>` pointer. (This will happen
on the kernel plugin side).

* Pass the struct across C API boundary.
Expand Down Expand Up @@ -649,9 +647,8 @@ get from a HIP function (on the TensorFlow core side) and pass to another HIP
function (on the kernel side).

Ideally, we should only rely on extern C parts of `hip_runtime_api.h`. There is
now an equivalent in the C API right now for `hipLaunchKernelGGL`. However, AMD
have said they are looking into adding an equivalent function to the C API in
the near future and are willing to add more functions if needed.
no equivalent in the C API right now for `hipLaunchKernelGGL`. However, AMD
might add an equivalent function to the C API in the near future.

Note that we have to update `LAUNCH_GPU_KERNEL` in Eigen to call the HIP C API
once it is available.
Expand Down