Use span instead of bare pointers in Allen::datatype.
This MR changes the underlying type of datatype
from a pointer to a span. This implies that all Allen kernels by default will get the size as part of the datatype. This applies to all existing Allen kernels as well.
The following list of operations become available from a datatype:
get() - returns a span of the type and size.
data() - returns a pointer to the beginning of the datatype.
operator->() - returns a pointer to the beginning of the datatype.
operator type*() - casts to pointer, pointing to the beginning of the datatype.
operator[](index) - accesses element "index" in the datatype.
empty() - returns true if container is empty (size is 0), false otherwise.
size() - returns the size of the container.
size_bytes() - returns the size of the container in bytes.
subspan(offset) - creates a subspan starting from offset, with a proper size according to the remainder of the container.
subspan(offset, count) - creates a subspan starting from offset with count elements.
From the tests, it does not impact throughput.
Some code should be adapted in the following to using spans. This includes:
- Device utils code (under
device/utils
), such as binary searches,shared_or_global
, etc. - Function calls within kernels (all still use pointers and can be safely moved to spans).
- Concretely, some kernels were getting the size as a separate parameter, which would not be needed anymore.
The concrete type of the span
depends on the backend and is compatible (gsl::span
for CPU and CUDA builds, Allen::device::span
for HIP). Possibly HIP 5.4.3 supports gsl::span
, this would allow erasing some compatibility code.
Merge request reports
Activity
added RTA label
- Resolved by Daniel Hugo Campora Perez
@gbassi there seems to be an intermittent behaviour (see https://gitlab.cern.ch/lhcb/Allen/-/jobs/29398865 and https://gitlab.cern.ch/lhcb/Allen/-/jobs/29399323).
EDIT: Now I think this is unrelated to the UT, but let's update the references and double check.
Edited by Daniel Hugo Campora Perez
added enhancement label
added 10 commits
Toggle commit list- Resolved by Sebastien Ponce
/ci-test
added ci-test-triggered label
- [2023-05-11 11:47] Validation started with lhcb-master-mr#7822
- [2023-05-11 15:46] Validation started with lhcb-master-mr#7828
- [2023-05-12 14:57] Validation started with lhcb-master-mr#7838
Edited by Software for LHCbadded hlt1-throughput-decreased label