From cf3479557ee83ddd4c6bc51c7506178a251bd8e0 Mon Sep 17 00:00:00 2001 From: Dan Hoeflinger Date: Wed, 3 Apr 2024 09:56:02 -0400 Subject: [PATCH 1/5] returning a device_pointer from .data() Signed-off-by: Dan Hoeflinger --- .../dpct-rt/include/dpct/dpl_extras/vector.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/clang/runtime/dpct-rt/include/dpct/dpl_extras/vector.h b/clang/runtime/dpct-rt/include/dpct/dpl_extras/vector.h index 8d1805a88a98..4dd20f9f8ebf 100644 --- a/clang/runtime/dpct-rt/include/dpct/dpl_extras/vector.h +++ b/clang/runtime/dpct-rt/include/dpct/dpl_extras/vector.h @@ -159,8 +159,8 @@ class device_vector { using reference = device_reference; using const_reference = const reference; using value_type = T; - using pointer = T *; - using const_pointer = const T *; + using pointer = device_pointer; + using const_pointer = const device_pointer; using difference_type = typename ::std::iterator_traits::difference_type; using size_type = ::std::size_t; @@ -171,7 +171,7 @@ class device_vector { Allocator _alloc; size_type _size; size_type _capacity; - pointer _storage; + T* _storage; size_type _min_capacity() const { return size_type(1); } @@ -462,8 +462,8 @@ class device_vector { reference front() { return *begin(); } const_reference back(void) const { return *(end() - 1); } reference back(void) { return *(end() - 1); } - pointer data(void) { return _storage; } - const_pointer data(void) const { return _storage; } + pointer data(void) { return pointer(_storage); } + const_pointer data(void) const { return pointer(_storage); } void shrink_to_fit(void) { if (_size != capacity() && capacity() > _min_capacity()) { size_type tmp_capacity = ::std::max(_size, _min_capacity()); @@ -622,8 +622,8 @@ class device_vector { using reference = device_reference; using const_reference = const reference; using value_type = T; - using pointer = T *; - using const_pointer = const T *; + using pointer = device_pointer; + using const_pointer = const device_pointer; using difference_type = typename std::iterator_traits::difference_type; using size_type = std::size_t; @@ -850,9 +850,9 @@ class device_vector { reference front() { return *begin(); } const_reference back(void) const { return *(end() - 1); } reference back(void) { return *(end() - 1); } - pointer data(void) { return reinterpret_cast(_storage); } + pointer data(void) { return pointer(reinterpret_cast(_storage)); } const_pointer data(void) const { - return reinterpret_cast(_storage); + return const_pointer(reinterpret_cast(_storage)); } void shrink_to_fit(void) { if (_size != capacity()) { From 0adcc3a0d3d82d9dcb25c9ee4b7ca73736523133 Mon Sep 17 00:00:00 2001 From: Dan Hoeflinger Date: Wed, 3 Apr 2024 09:57:18 -0400 Subject: [PATCH 2/5] formatting Signed-off-by: Dan Hoeflinger --- clang/runtime/dpct-rt/include/dpct/dpl_extras/vector.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/runtime/dpct-rt/include/dpct/dpl_extras/vector.h b/clang/runtime/dpct-rt/include/dpct/dpl_extras/vector.h index 4dd20f9f8ebf..61a10e803333 100644 --- a/clang/runtime/dpct-rt/include/dpct/dpl_extras/vector.h +++ b/clang/runtime/dpct-rt/include/dpct/dpl_extras/vector.h @@ -171,7 +171,7 @@ class device_vector { Allocator _alloc; size_type _size; size_type _capacity; - T* _storage; + T *_storage; size_type _min_capacity() const { return size_type(1); } @@ -850,7 +850,7 @@ class device_vector { reference front() { return *begin(); } const_reference back(void) const { return *(end() - 1); } reference back(void) { return *(end() - 1); } - pointer data(void) { return pointer(reinterpret_cast(_storage)); } + pointer data(void) { return pointer(reinterpret_cast(_storage)); } const_pointer data(void) const { return const_pointer(reinterpret_cast(_storage)); } From cf715b3c3ff9acd5ce9fdd81d7d6be39e09fd76c Mon Sep 17 00:00:00 2001 From: Dan Hoeflinger Date: Wed, 3 Apr 2024 09:59:27 -0400 Subject: [PATCH 3/5] fix const pointer USM_NONE Signed-off-by: Dan Hoeflinger --- clang/runtime/dpct-rt/include/dpct/dpl_extras/vector.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/runtime/dpct-rt/include/dpct/dpl_extras/vector.h b/clang/runtime/dpct-rt/include/dpct/dpl_extras/vector.h index 61a10e803333..130e16ee3550 100644 --- a/clang/runtime/dpct-rt/include/dpct/dpl_extras/vector.h +++ b/clang/runtime/dpct-rt/include/dpct/dpl_extras/vector.h @@ -852,7 +852,7 @@ class device_vector { reference back(void) { return *(end() - 1); } pointer data(void) { return pointer(reinterpret_cast(_storage)); } const_pointer data(void) const { - return const_pointer(reinterpret_cast(_storage)); + return const_pointer(reinterpret_cast(_storage)); } void shrink_to_fit(void) { if (_size != capacity()) { From b58429b7addb3bca03fb3b21212082697849f462 Mon Sep 17 00:00:00 2001 From: Dan Hoeflinger Date: Wed, 3 Apr 2024 15:40:27 -0400 Subject: [PATCH 4/5] fix const pointer return Signed-off-by: Dan Hoeflinger --- clang/runtime/dpct-rt/include/dpct/dpl_extras/vector.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/runtime/dpct-rt/include/dpct/dpl_extras/vector.h b/clang/runtime/dpct-rt/include/dpct/dpl_extras/vector.h index 130e16ee3550..bee95df8d2ec 100644 --- a/clang/runtime/dpct-rt/include/dpct/dpl_extras/vector.h +++ b/clang/runtime/dpct-rt/include/dpct/dpl_extras/vector.h @@ -463,7 +463,7 @@ class device_vector { const_reference back(void) const { return *(end() - 1); } reference back(void) { return *(end() - 1); } pointer data(void) { return pointer(_storage); } - const_pointer data(void) const { return pointer(_storage); } + const_pointer data(void) const { return const_pointer(_storage); } void shrink_to_fit(void) { if (_size != capacity() && capacity() > _min_capacity()) { size_type tmp_capacity = ::std::max(_size, _min_capacity()); From 2c5dece8d5decab5a27ee1b45a2457fb4d5796f1 Mon Sep 17 00:00:00 2001 From: Dan Hoeflinger Date: Wed, 17 Apr 2024 22:27:08 -0400 Subject: [PATCH 5/5] fixing const pointer Signed-off-by: Dan Hoeflinger --- clang/runtime/dpct-rt/include/dpct/dpl_extras/vector.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/runtime/dpct-rt/include/dpct/dpl_extras/vector.h b/clang/runtime/dpct-rt/include/dpct/dpl_extras/vector.h index bee95df8d2ec..967dfd203436 100644 --- a/clang/runtime/dpct-rt/include/dpct/dpl_extras/vector.h +++ b/clang/runtime/dpct-rt/include/dpct/dpl_extras/vector.h @@ -160,7 +160,7 @@ class device_vector { using const_reference = const reference; using value_type = T; using pointer = device_pointer; - using const_pointer = const device_pointer; + using const_pointer = device_pointer; using difference_type = typename ::std::iterator_traits::difference_type; using size_type = ::std::size_t; @@ -623,7 +623,7 @@ class device_vector { using const_reference = const reference; using value_type = T; using pointer = device_pointer; - using const_pointer = const device_pointer; + using const_pointer = device_pointer; using difference_type = typename std::iterator_traits::difference_type; using size_type = std::size_t; @@ -852,7 +852,7 @@ class device_vector { reference back(void) { return *(end() - 1); } pointer data(void) { return pointer(reinterpret_cast(_storage)); } const_pointer data(void) const { - return const_pointer(reinterpret_cast(_storage)); + return const_pointer(reinterpret_cast(_storage)); } void shrink_to_fit(void) { if (_size != capacity()) {