[SYCLomatic] Removing data() from USM_NONE dpct::device_vector #667
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Removing the public member function
data()ofdpct::device_vectorwhenDPCT_USM_LEVEL_NONEis defined.dpct::device_vectorhas two different implementations, one where USM is available and another when USM is not available which that usessycl::bufferinternally for its device memory. This change only effects the implementation when USM is not available andsycl::bufferis used for the memory allocation.This
data()member function does not make a lot of sense to provide when we are usingsycl::bufferas the memory backing fordpct::device_vector. Prior to this PR, it provided a pointer into the virtual memory space used to track and look up buffer allocations. Using this returned virtual pointer (whenDPCT_USM_LEVEL_NONEis defined) to do things likememcpy()or as input to an algorithm would result in a segfault. It's availability in the API only encourages incorrect usage.Getting a pointer to the actual device memory is not supported in any viable way by the SYCL specification when a
sycl::bufferis the backing memory for adpct::device_vector. The public member functionget_buffer()is provided in this case, and can be used for a similar purpose, but without encouraging incorrect usage.