Add total_elements to dace.data descriptors, next to total_size (including Scalar)
- Dominant language
- Python
- Stars
- 593
- Forks
- 163
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 60
Description
Data descriptors expose `total_size`, but there is no `total_elements`. `Array.total_size` is the allocated span, which can exceed the logical element count when strides or padding are given, so callers that need the number of elements recompute `prod(shape)` themselves.
Proposal: add a `total_elements` property to `dace.data` (at least `Data`, `Array`, `Scalar`, `Stream`), with `Scalar` returning 1, so that `total_elements` and `total_size` are both valid on every descriptor, scalars included.
Contributor guide
Research direction
Start by locating the dace.data descriptor classes and the existing total_size implementations. Trace Data, Array, Scalar, and Stream to identify where the shared property belongs and how scalar descriptors are handled. Done means every listed descriptor exposes total_elements, Scalar returns 1, and the logical element count remains distinct from allocated total_size.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 75/100