Hi Jiaxing,

I finally ran reserved0-build.py. Three things back, one of them a bug
in the script.

First, it works: pointed at your geom corpus it produces the full
report, 415 lines, no warnings. Thank you for writing it in a way that
runs anywhere - only numpy, and the parts that need your files skip
themselves cleanly.

Second, the bug. Point it one directory higher, at a corpus that also
contains files outside the geometry set, and it dies:

  File "reserved0-build.py", line 431, in dump
    % (o["off"], o["v"], o["RESERVED_0"],
  KeyError: 'v'

The cause is small and I think you will spot it faster than I can
describe it. read_ops() gives an undecoded dispatch a short dict -
dict(off=off, undecoded=True), no "v", no "RESERVED_0". Everywhere else
you are careful about that: the good/bad split, the row groups, the
per-file value sets, and the "mixed" comprehension itself all filter on
"if not o['undecoded']". dump() is the one place that walks f["ops"]
straight through, so the first undecoded dispatch in a dumped file
raises.

It needs a corpus where a file has both more than one RESERVED_0 and at
least one undecoded dispatch. In mine that is exactly one file out of
thirteen: chain, with 2 undecoded dispatches out of 26. It lands in
"others", so dump(others[0]) hits it. Skipping undecoded ops in dump(),
or printing them as a short "undecoded" line, is all it takes.

Third, the corpus I owe you. I have not collected it yet, and I do not
want to give you a date I am not sure of. To be precise about where it
stands: every .rknn on this disk is still yours - 103 files, and all
103 declare the same build string, 2.3.2 (@2025-04-03T08:26:16). So the
axis I offered to test, whether 34/66 <-> 0x4044 survives a different
toolkit version, is still untested. It is on my list, behind the DVFS
series review.

One more thing, unrelated to the script, from your earlier mail: the
/dev/accel/accel2 you saw after two rebind cycles is the same thing I
hit on RK3588, where the minor walked 1 -> 10 over ten cycles and only
rmmod reset it. I traced it in the source afterwards: rocket_device_init()
allocates the DRM device with devm on the shared rknn platform device,
which is only unregistered at module removal, so each unbind leaves a
drm_device alive holding its minor.

You do not need a new patch for it - it is already written and waiting:

  [PATCH v2 1/2] accel/rocket: release the shared device's devres on teardown
  https://lore.kernel.org/all/[email protected]/

That series has your Reviewed-by on 2/2 already. If you rebind on RK3576
often, that patch is worth carrying locally in the meantime.

Thanks again for the script.

Igor

Reply via email to