Skip to content

Emit ArrayConverter for array payload members - #130

Merged
glopesdev merged 1 commit into
harp-tech:mainfrom
glopesdev:emit-array-converter
Aug 26, 2026
Merged

Emit ArrayConverter for array payload members#130
glopesdev merged 1 commit into
harp-tech:mainfrom
glopesdev:emit-array-converter

Conversation

@glopesdev

Copy link
Copy Markdown
Contributor

An array payload member now generates ArrayConverter over the element type and its count, as in Field(ArrayConverter(np.float32, 3), offset=3), so the generated module type-checks.

Decoding is unchanged. ArrayConverter builds an IdentityConverter over the equivalent sub-array dtype, so the runtime object is the same one it was before and the cross-stack interop test passes without modification.

Notes for review

The IdentityConverter import now belongs to the scalar path alone, so a module whose only passthrough member is an array no longer declares an import it does not use. That has no effect on the expected output here, which has scalar members too, but it matters for device repositories that lint generated code.

core.py and device.coremasks.py are unchanged, since neither declares an array payload member. device.py is the only expected output affected, at one import and four descriptors.

Closes #123

An array payload member now generates ArrayConverter over the element
type and count, so the generated module type-checks. Passing a sub-array
dtype to IdentityConverter would type the member as np.void, which the
NDArray annotation beside it does not accept. The converter builds the
same IdentityConverter over the same dtype, so decoding is unchanged.

The IdentityConverter import now belongs to the scalar path alone, so a
module whose only passthrough is an array member no longer declares an
import it does not use.

Closes harp-tech#123
@glopesdev
glopesdev requested a review from bruno-f-cruz August 26, 2026 00:52
@glopesdev glopesdev added the feature New planned feature label Aug 26, 2026
@glopesdev
glopesdev merged commit 316ebc4 into harp-tech:main Aug 26, 2026
9 checks passed
@glopesdev
glopesdev deleted the emit-array-converter branch August 26, 2026 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New planned feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Emit ArrayConverter for array payload members

2 participants