适配aarch64架构机器及性能优化。 - #225
Open
Zak-Young wants to merge 6 commits into
Open
Conversation
Directory restructuring: - Move source files to lib/ and examples/ subdirectories - Add separate CMakeLists.txt for lib/ and examples/ aarch64 platform adaptation: - Add aarch64 context switch assembly (coctx_swap.S) - Add aarch64 coctx_make implementation - Add get_sp() helper for stack pointer on aarch64 - Add co_free_sharestack() and co_destruct_curr_thread_env() APIs - Fix memory leaks (set pointers to nullptr after free) - Add shared stack parameter validation
- Split co_memcpy into co_memcpy_save (ldp+stnp) and co_memcpy_swap (ldnp+stp) - save: write-not-immediately-read, non-temporal store avoids cache pollution - swap: write-immediately-read, non-temporal load + temporal store for cache locality - <=1KB uses memcpy_blk (128B blocks), >1KB uses 384B block loop - Parameterized NEON macros: memcpy_blk_neon and memcpy_384B_neon with ld/st hints - 64-byte dst alignment pre-processing preserved
Member
|
|
OP-1: Inline 32B NEON remainder handling in 384B/512B macros,
eliminating memcpy_rem call overhead for common remainder
sizes (32/64/96B). Fixes 4K+64B ~3% regression.
OP-2: Instruction reschedule in 512B loop - load-store spacing
increased to >=3 instructions to hide ARM load latency
(3-4 cycles on Cortex-A72/A76).
OP-3: New 512B (4x128B) block path for >4KB data, reducing loop
overhead by 25% vs 384B. Register reuse (q0-q7 recycled
after G1 stores complete).
OP-4: Remainder handling inherits save/swap temporal strategy
(ldp+stnp for save, ldnp+stp for swap) automatically,
extending cache pollution control to remainder bytes.
OP-5: Retune block-size thresholds: 1K→128B, 2K→384B, 8K→512B,
>8K→1024B. 2K-4K cases now use 512B path (+5% expected).
OP-6: New 1024B (8x128B) block path for >8KB data. Register reuse
across 4 groups (q0-q7, q16-q23 recycled). 50% fewer loop
iterations vs 512B. Tail handles 4/1-block remainders inline.
OP-7: New 1536B (12x128B) block path for >12KB data. Register
reuse across 3 groups (q0-q7, q16-q23 recycled 3 times).
33% fewer loop iterations vs 1024B. Tail handles 8/4/1-block
remainders inline.
Tier thresholds: 1K→128B, 2K→384B, 8K→512B, 12K→1024B, >12K→1536B.
OP-8: New 256B (2x128B) block path for 1K-2K data. Halves loop
iterations vs 128B blocks. Fixes 1088B regression (0.990).
Register reuse: q0-q7 loaded twice per iteration.
6-tier: 1K→128B, 2K→256B, 4K→384B, 8K→512B, 12K→1024B, >12K→1536B
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.
本次提交包含两个commit:
2.1. 针对不同的拷贝长度添加不同的实现。
2.2. 针对拷贝完成后的下一步动作决定读写指令。针对写入堆栈操作,使用ldp+stnp指令,避免写入数据污染cache。针对堆栈恢复操作使用ldnp+stp,将下一步待执行任务导入cache。