• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

IntelPython / dpnp / 42653797008
84%

Build:
DEFAULT BRANCH: master
Ran 09 Nov 2026 06:20PM UTC
Jobs 1
Files 265
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

09 Nov 2026 04:20PM UTC coverage: 84.407% (+0.003%) from 84.404%
42653797008

push

github

web-flow
Build `usm_ndarray.flags` through a cimported `Flags` factory (#3168)

Every access to `usm_ndarray.flags` (and so to `dpnp.ndarray.flags`)
looked up the `_flags` module global and its `Flags` attribute, then
built the object through `type.__call__`, which packs the arguments into
a tuple and parses them in `__cinit__`. Internal code reads `.flags`
often, e.g. `dpt.asarray` reads it three times on its zero-copy path.

The PR adds `dpnp/tensor/_flags.pxd`, which declares `Flags` with a
`cdef inline` `_create` factory, and `_usmarray` cimports it. `_create`
allocates the object with `Flags.__new__(Flags)` and sets the two fields
directly. For that `__cinit__` becomes `__init__`, so `Flags(arr,
flags)` from Python works as before. The `.pxd` sets `linetrace=True`,
since the factory is compiled from it and coverage traces it there. The
generated `_usmarray*.h` C-API headers are unchanged.

It also fixes a segfault: the typed `usm_ndarray arr` argument accepted
`None`, so `Flags(None, 0).writable = True` called `_set_writable_flag`
on `None` and crashed the interpreter. `arr` is now `not None`, and the
`writable` setter raises `TypeError` for a `Flags` created by
`Flags.__new__(Flags)` without an array. `test_flags_without_array`
covers both cases; it fails on master.

Time per call on Panther Lake U (P-core, OpenCL CPU device), median over
8 processes run in ABBA order:

| case | master | PR |
| --- | ---: | ---: |
| `x.flags` (`usm_ndarray`) | 38.9 ns | 22.9 ns |
| `x.flags.c_contiguous` | 51.7 ns | 34.6 ns |
| `a.flags` (`dpnp.ndarray`) | 47.0 ns | 30.1 ns |
| `a.flags['C']` | 69.7 ns | 53.6 ns |
| `dpt.asarray(x)` | 1596 ns | 1541 ns |
| `x.shape` (control) | 29.5 ns | 29.5 ns |

On a full call such as `dpt.asarray` the gain is a few percent, within
the run-to-run spread.

The 40 test files that use `flags` (`dpnp/tests/tensor`, `dpnp/tests`
and `third_party/cupy`) pass on the OpenCL CPU device: 42916 passed. The
rebuilt `_usmarray` and `_flags` module... (continued)

1792 of 2998 branches covered (59.77%)

Branch coverage included in aggregate %.

7 of 8 new or added lines in 3 files covered. (87.5%)

29625 of 34223 relevant lines covered (86.56%)

39087.54 hits per line

Uncovered Changes

Lines Coverage ∆ File
1
80.0
dpnp/tensor/_flags.pxd
Jobs
ID Job ID Ran Files Coverage
1 42653797008.1 09 Nov 2026 06:20PM UTC 265
84.41
GitHub Action Run
Source Files on build 42653797008
  • Tree
  • List 265
  • Changed 2
  • Source Changed 2
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #42653797008
  • 98cf8c67 on github
  • Prev Build on master (#42529225061)
  • Next Build on master (#42674140598)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc