Simd revisited#4742
Merged
shai-almog merged 18 commits intomasterfrom Apr 19, 2026
Merged
Conversation
Contributor
✅ Continuous Quality ReportTest & Coverage
Static Analysis
Generated automatically by the PR CI workflow. |
Collaborator
Author
Contributor
✅ ByteCodeTranslator Quality ReportTest & Coverage
Benchmark Results
Static Analysis
Generated automatically by the PR CI workflow. |
Collaborator
Author
|
Compared 37 screenshots: 37 matched. Native Android coverage
✅ Native Android screenshot tests passed. Native Android coverage
Benchmark ResultsDetailed Performance Metrics
|
6fdde57 to
7493e80
Compare
…e64 SIMD in Java (#4745) * Add NEON-accelerated base64Encode/base64Decode to Simd API and wire into Base64 SIMD methods Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/c218992e-943a-4ce5-8d63-f82c0792416f Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Address code review: clarify loop conditions and comment in NEON base64 Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/c218992e-943a-4ce5-8d63-f82c0792416f Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Add new SIMD generic primitive declarations and remove base64 methods from IOSSimd - Added shl, shrLogical, addWrapping, subWrapping for byte arrays - Added offset-based overloads for unpackUnsignedByteToInt, add, cmpEq, cmpLt, select - Removed base64Encode and base64Decode declarations Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Replace base64 overrides with generic SIMD primitive validation wrappers in JavaSESimd Remove base64Encode and base64Decode overrides. Add validation wrapper overrides for new generic Simd primitives: shl, shrLogical, addWrapping, subWrapping, unpackUnsignedByteToInt, add (int[]), cmpEq, cmpLt, and select. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Replace base64 NEON section with generic SIMD primitives in IOSSimd.m Remove NEON-accelerated Base64 encode/decode implementations and add NEON implementations for new generic Simd primitives: shl, shrLogical, addWrapping, subWrapping, unpackUnsignedByteToInt, add (int), cmpEq, cmpLt, and select (with offset parameters). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Remove base64 methods from Simd; add generic byte/int primitives; rewrite Base64 SIMD in Java - Remove base64Encode/base64Decode from Simd, IOSSimd, JavaSESimd, IOSSimd.m - Add generic byte shift primitives: shl(byte[]), shrLogical(byte[]) - Add wrapping byte arithmetic: addWrapping(byte[]), subWrapping(byte[]) - Add offset-based int overloads: unpackUnsignedByteToInt, add, cmpLt, cmpEq, select - Add NEON implementations for all new primitives in IOSSimd.m - Add validation wrappers in JavaSESimd.java - Rewrite encodeNoNewlineSimd in Java using int-domain SIMD compare/select - Rewrite decodeNoWhitespaceSimd in Java using int-domain SIMD shift/or - Update SimdTest with tests for new primitives - All 2345 tests pass Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/5fc6976c-f0ec-4638-b22b-2cbc9c9ca5dd Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Optimize SIMD Base64: replace slow scatter/gather + per-element SIMD calls with fast inline scalar Java The previous approach called 15+ individual Simd operations per 48-byte chunk (each a virtual dispatch + JNI transition on iOS), plus scalar scatter/gather loops for byte↔int conversion. This added ~2500 JNI transitions per encode of 8KB, making it 64-109% slower than the already-fast scalar code. Replace with the same 4x-unrolled table-lookup approach used by encodeNoNewline(), now with offset support. This matches the scalar CN1 encode/decode performance while maintaining the same API contract. Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/90b8c36e-8f20-47da-9fb4-56344f18a336 Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Revert "Optimize SIMD Base64: replace slow scatter/gather + per-element SIMD calls with fast inline scalar Java" This reverts commit 00e5103. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com>
392ce2c to
ae25d41
Compare
…4755) * Add generic SIMD interleave primitives Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/bbcd3a3b-1fcc-4818-a045-011025111878 Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Tighten iOS SIMD mask blending Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/bbcd3a3b-1fcc-4818-a045-011025111878 Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Implement byte-lane Base64 SIMD hot path Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/c4483141-f308-4c53-9d5b-f8185272067f Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Fix performance comparison table grouping Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/44fd1aa3-15ab-484f-908f-71ae605a2c5f Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Fix iOS benchmark stats extraction Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/43c5792a-216e-4635-bec3-dce6ce1c16da Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Harden iOS Base64 benchmark reporting Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/59bc0cc2-933a-457d-b5f2-7387ab1210f4 Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Refine Base64 benchmark control flow Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/59bc0cc2-933a-457d-b5f2-7387ab1210f4 Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Fail iOS build on benchmark exceptions Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/590ef420-e08c-4863-bc1d-374266ed3221 Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Harden Base64 SIMD scratch initialization Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/0af385dc-375d-435d-b488-72b71b1d5135 Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Add generic VM lookup path for Base64 SIMD Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/f779927e-d85c-407e-862f-61c4d64ddd86 Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Clarify unsigned lookup semantics in IOSSimd Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/f779927e-d85c-407e-862f-61c4d64ddd86 Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Fuse SIMD decode unpack and lookup Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/8587852f-737f-4503-9e44-7dd39ed13c3b Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Clarify generic SIMD lookup behavior Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/8587852f-737f-4503-9e44-7dd39ed13c3b Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Refactor Base64 SIMD scratch handling Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/806ca223-d5e2-458d-88a8-6e4347070c37 Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Clarify native Base64 decode validation Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/806ca223-d5e2-458d-88a8-6e4347070c37 Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Keep SIMD API generic for Base64 path Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/baa9db39-0b7b-4734-ac26-5bf3d2bc986f Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Restore native offset SIMD helpers Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/50ddb198-a41b-4ec4-9be2-201d4a6f9527 Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com>
…ith SIMD on/off (#4771) * Add Image SIMD toggle and benchmarks Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/5dfd66c3-87f7-4e83-a9b0-af5f1401a286 Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Finalize Image SIMD validation Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/5dfd66c3-87f7-4e83-a9b0-af5f1401a286 Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Simplify Image SIMD implementation Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/f2b9cfbc-2c39-4c15-9946-45a6597c9c0f Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Polish simplified Image SIMD code Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/f2b9cfbc-2c39-4c15-9946-45a6597c9c0f Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Simplify Image SIMD toggle and mask path Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/04951212-c075-4568-9953-62a5c5cf6ce3 Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Tighten final Image SIMD cleanup Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/04951212-c075-4568-9953-62a5c5cf6ce3 Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com>
Collaborator
Author
|
Compared 7 screenshots: 7 matched. |
…ng and benchmark/compliance coverage (#4772) * Add SIMD alloca API and stack lowering Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/fe7ec42c-9a02-4f55-a18b-2f038764b2ef Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Refine SIMD alloca coverage Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/fe7ec42c-9a02-4f55-a18b-2f038764b2ef Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Polish SIMD alloca validation Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/fe7ec42c-9a02-4f55-a18b-2f038764b2ef Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Clarify SIMD alloca comments Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/fe7ec42c-9a02-4f55-a18b-2f038764b2ef Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Address SIMD alloca review feedback Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/90bc6a2c-a647-42c2-b5fb-b753d4f84d2e Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Tighten SIMD alloca deprecation notes Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/90bc6a2c-a647-42c2-b5fb-b753d4f84d2e Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Polish alloca verifier follow-up Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/90bc6a2c-a647-42c2-b5fb-b753d4f84d2e Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Polish alloca review nits Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/90bc6a2c-a647-42c2-b5fb-b753d4f84d2e Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Use javadoc deprecation tags for alloca Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/90bc6a2c-a647-42c2-b5fb-b753d4f84d2e Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Refine alloca docs and stack init Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/bb5fa00f-a32c-4546-b631-d21141725593 Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Initialize image SIMD zero lanes Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/9a8f2cf5-e212-48b0-ab89-e71cd2519b4a Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Restore heap scratch buffers for image SIMD paths Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/758e9130-aba3-49bb-a4fc-d03b9b28068d Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Add initialized SIMD alloca helpers Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/12012dc5-195e-484d-9fbd-dee7e4dca265 Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Zero initialize SIMD scratch bytes Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/12012dc5-195e-484d-9fbd-dee7e4dca265 Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Fix SIMD byte memset macros Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/12012dc5-195e-484d-9fbd-dee7e4dca265 Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Optimize translator alloca lowering Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/12012dc5-195e-484d-9fbd-dee7e4dca265 Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Add image SIMD benchmarks and alloca check Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/dad95e7e-e6b1-40a7-94a7-215ceb3e1362 Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Tighten alloca compliance matcher Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/dad95e7e-e6b1-40a7-94a7-215ceb3e1362 Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Refine benchmark and alloca validation Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/dad95e7e-e6b1-40a7-94a7-215ceb3e1362 Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Align image SIMD buffers Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/1db44331-5728-4376-a186-ef114b925450 Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Finalize image SIMD cleanup Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/1db44331-5728-4376-a186-ef114b925450 Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Cache SIMD image RGB results Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/f3eb3bb6-bb5f-492d-80ff-adc83cce9d51 Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Optimize chained SIMD image ops Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/f3eb3bb6-bb5f-492d-80ff-adc83cce9d51 Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Fuse SIMD alpha/mask passes Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/220180d6-f744-495c-9d75-8899303421b8 Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Add ParparVM NEON impls for fused alpha/mask helpers Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/b34e40cc-4df9-45c8-bc5e-059771a6a271 Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Replace image-specific Simd ops with generic primitives Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/72f1389b-a120-4788-959d-fc0e175b8bfa Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Drop SIMD chunking; always return registered rgb arrays from getRGB Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/919c6090-2fc0-4540-904b-1d0e8fba19b3 Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Add Simd.blendByMaskTestNonzero, rewrite modifyAlpha SIMD paths, bump benchmark image to 256x256 Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/9aba781a-23d2-4935-b086-6e0334cecb8f Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Fuse applyMask (4→1 pass) and removeColor (3→1 pass) into new SIMD primitives Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/3e643d42-5622-4542-a45c-e0cc1835193a Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com>
…rformance guide Adds a comprehensive SIMD section to the developer guide covering what SIMD is, when to use the Simd API, alignment and provenance rules, the alloca* stack-lifetime model, build-time compliance verification, and the simulator registry. Previous standalone attempt omitted the core API usage guidance. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
Developer Guide build artifacts are available for download from this workflow run:
Developer Guide quality checks: |
javac with the ASCII file.encoding rejected em-dash, Unicode arrow (U+21D2), and horizontal ellipsis in /// comments on Image.java and Simd.java. Replaced with plain ASCII equivalents. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

No description provided.