Skip to content

fix: resolve all reflection warnings - #4

Merged
antlobach merged 1 commit into
antlobach:mainfrom
michaelwhitford:fix/reflection-warnings
Oct 14, 2026
Merged

antlobach merged 1 commit into
antlobach:mainfrom
michaelwhitford:fix/reflection-warnings

Conversation

@michaelwhitford

Copy link
Copy Markdown
Contributor

->tensor had no return hint, so nearly every op resolved its JavaCPP overload by reflection on each call (~70-100 µs per op on small tensors, ~2 µs after). Enable warn-on-reflection in every src namespace, hint all 156 sites, and fail release-check on new warnings. The warnings exposed calls that always threw: max/min with a dim, clip, argsort with a dim, and load-state-dict on native modules; these now work and are covered by tests. Native module forward is looked up once per class and cached, since Module declares no forward.

->tensor had no return hint, so nearly every op resolved its JavaCPP overload by reflection on each call (~70-100 µs per op on small tensors, ~2 µs after). Enable *warn-on-reflection* in every src namespace, hint all 156 sites, and fail release-check on new warnings. The warnings exposed calls that always threw: max/min with a dim, clip, argsort with a dim, and load-state-dict on native modules; these now work and are covered by tests. Native module forward is looked up once per class and cached, since Module declares no forward.
@michaelwhitford

Copy link
Copy Markdown
Contributor Author

I have been running this code in my project for a few weeks and it has been stable, and more performant.

@antlobach
antlobach merged commit 3e4b913 into antlobach:main Oct 14, 2026
@michaelwhitford
michaelwhitford deleted the fix/reflection-warnings branch October 14, 2026 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants