Skip to content

Add best practice: High-performance memory transfers (MEMSET and MEMCPY) with AMMX - #51

Open
Rudi7503 wants to merge 1 commit into
ApolloTeam-dev:mainfrom
Rudi7503:feature/fast-memory-transfers-ammx
Open

Rudi7503 wants to merge 1 commit into
ApolloTeam-dev:mainfrom
Rudi7503:feature/fast-memory-transfers-ammx

Conversation

@Rudi7503

Copy link
Copy Markdown

Summary

This PR adds a comprehensive best-practice guide (core/best-practices/fast-memory-transfers-ammx.md) for maximizing memset and memcpy bandwidth using 64-bit AMMX instructions, directly solving the slow byte-by-byte memory trap noted in toolchain/pitfalls/libnix-and-header-traps.md.

Key Insights & Hardware Evidence

Measured on physical Vampire V4 Standalone hardware (Core 11350 @ 92 MHz) using the Harness v6 benchmark suite:

Benchmark Kernel Chunk Size Net Cycles / Iteration Cycles / Byte Memory Throughput Total Bus Traffic
AMMX Aligned MEMSET (MEM-010) 32 Bytes 2.6 cyc 0.081 c/B 1,132.3 MB/s 1,132.3 MB/s
AMMX Aligned MEMCPY (MEM-011) 32 Bytes 6.6 cyc 0.206 c/B 446.1 MB/s 892.1 MB/s
Masked Tail-Store (MEM-012) 8 Bytes 1.6 cyc 0.200 c/B 460.0 MB/s 920.0 MB/s
MEMMOVE Streaming (MEM-013) 16 Bytes 2.6 cyc 0.163 c/B 566.2 MB/s 1,132.3 MB/s
Cacheline Burst MEMSET (MEM-020) 64 Bytes 6.6 cyc 0.103 c/B 892.1 MB/s 892.1 MB/s
  • Write-Buffer Saturation: Unrolled 64-bit store streams saturate the FPGA write-combining buffer, achieving > 1.1 GB/s DDR3 throughput.
  • Combined Bus Traffic: In MEM-011, moving 32 bytes performs 32-byte read + 32-byte write in 6.6 cycles, utilizing 892.1 MB/s of bus traffic.
  • Branchless Tail Handling: Demonstrates storeilm with an index mask register to eliminate trailing cleanup loops.
  • Validation: Conforms to AKB schema, passes check_links.py, check_frontmatter.py, and snippet cleanly compiles with vasmm68k_mot 2.0f.

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.

1 participant