Skip to content

Commit ba45577

Browse files
committed
Completely refactor accessor::iterator
Now iterators for non-ranged accessors should be almost equal to plain pointers and only iterator dereference for a ranged accessor is a costly operation which requires various calculations including division.
1 parent 36364a0 commit ba45577

File tree

3 files changed

+264
-329
lines changed

3 files changed

+264
-329
lines changed

sycl/include/sycl/accessor.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2030,12 +2030,11 @@ class __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
20302030
bool operator!=(const accessor &Rhs) const { return !(*this == Rhs); }
20312031

20322032
iterator begin() const noexcept {
2033-
return iterator::__get_begin(this, get_offset(),
2034-
get_offset() + get_range());
2033+
return iterator::__get_begin(this, getMemoryRange());
20352034
}
20362035

20372036
iterator end() const noexcept {
2038-
return iterator::__get_end(this, get_offset(), get_offset() + get_range());
2037+
return iterator::__get_end(this, getMemoryRange());
20392038
}
20402039

20412040
private:

0 commit comments

Comments
 (0)