Ensure that our memory pools can implicitly convert to a resource_ref#7390
Ensure that our memory pools can implicitly convert to a resource_ref#7390miscco merged 3 commits intoNVIDIA:mainfrom
resource_ref#7390Conversation
c155f43 to
5b34a2a
Compare
This comment has been minimized.
This comment has been minimized.
Would it make sense to return a We support turning resource_ref into any_resource by creating a copy of the resource. Because pool -> resource_ref conversion also downgraded the resource from owning to non-owning, when you create any_resource you end up having only the non-owning device_memory_pool_ref wrapped inside. I think I would prefer there to be an explicit |
|
@miscco We discussed this on the working group meeting today and a suggestion from @ericniebler was to move the conversion operator from |
|
@pciolkosz I tried your approach but that is not possible without an intermediary. The issue is that the resource_ref stores a pointer to the temporary created within |
eeb2161 to
241bc9b
Compare
|
@pciolkosz I believe I found an elegant solution to the issue at hand. The underlying problem is that the construction to a However, a relatively simple solution is to just downcast to the There is no functional difference to the current constructor call, because that is what we actually store and the reference allows us to directly convert into a resource_ref I believe that gives us the best of both worlds |
d111cdd to
ecf7660
Compare
This comment has been minimized.
This comment has been minimized.
ecf7660 to
7e01f32
Compare
We want to pass them to APIs that take only a `resource_ref`. However, because those are not copyable we would need to convert them to a `memory_pool_ref` first. However, that also does not work, because the constructor for `resource_ref` does not accept a prvalue. To alleviate that create a conversion operator that does the right thing.
7e01f32 to
0c5ed59
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
🥳 CI Workflow Results🟩 Finished in 1h 21m: Pass: 100%/99 | Total: 1d 02h | Max: 55m 29s | Hits: 97%/251185See results here. |
We want to pass them to APIs that take only a
resource_ref.However, because those are not copyable we would need to convert them to a
memory_pool_reffirst.However, that also does not work, because the constructor for
resource_refdoes not accept a prvalue.To alleviate that create a conversion operator that does the right thing.