Add use_bfc_allocator parameter to StreamExecutor C API#47598
Add use_bfc_allocator parameter to StreamExecutor C API#47598copybara-service[bot] merged 1 commit intotensorflow:masterfrom
Conversation
|
@annarev Thanks for the PR! |
|
Thanks @annarev for the PR. SimpleAllocator can be something straightforward calling into AllocateRaw and that would be fine for us. We had brief discussion of this during the design phase. To keep it simple we can leverage There are few places in pluggable_device_process_state like |
@jzhoulon Sounds about right.
@kulinseth Yep that makes sense. I misread it back then as custom allocator wrapper itself being something customized by the plugin.
Sounds good, you can upload the PR and we can comment on it if anything needs changing. |
No, I mean an opaque handle (void* custom_allocator) in SP_Device. See the following code example: |
I think setting a custom allocator makes things more complicated. I think we should do it only if we think of a usecase that cannot be covered by just implementing |
Agreed, I can queue up the PR after #45784 merges. |
penpornk
left a comment
There was a problem hiding this comment.
I think this should work. I'm approving this now in the interest of time. We can continue the discussion here.
That would be awesome. Thank you very much, Kulin! |
use_bfc_allocatorparameter will decide whether to wrap pluggable deviceSubAllocatorwith BFC allocator or not.I am thinking it can be used as follows:
See lines here:
tensorflow/tensorflow/core/common_runtime/pluggable_device/pluggable_device_process_state.cc
Line 115 in 2c31420
They should be replaced with something like
PluggableDeviceSimpleAllocatorshould just be a minimal wrapper over thesub_allocator(currently not implemented as a part of this PR). This seems much simpler to me than what I was thinking of originally (sorry for the delay).PTAL @penpornk @kulinseth, @jzhoulon