Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/MojoLlama/blob/main/src/mojollama/mojo_engine/test_perf.mojo # MojoLlama Archived Mojo/MAX quantizer and serving research repository (read-only history) Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `MojoLlama / src / mojollama / mojo_engine / test_perf.mojo` 25 lines · 698 bytes Raw Blame History 1 # test_perf.mojo — Test @extern for performance helpers 2 # Tests if custom .so functions resolve via LD_PRELOAD 3 4 @extern("_ml_memalign") 5 def _ml_alloc(sz: Int, align: Int) abi("C") -> Int: ... 6 7 @extern("_ml_free") 8 def _ml_dealloc(p: Int) abi("C") -> None: ... 9 10 @extern("_ml_prefetch_L1") 11 def _ml_pf_L1(addr: Int) abi("C") -> None: ... 12 13 @extern("_ml_pin_process") 14 def _ml_pin_proc() abi("C") -> None: ... 15 16 def main(): 17 print("Testing perf helper @extern...") 18 var p = _ml_alloc(1024, 64) 19 print(" _ml_alloc: address =", p) 20 _ml_pf_L1(p) 21 print(" _ml_prefetch_L1: OK") 22 _ml_pin_proc() 23 print(" _ml_pin_process: OK") 24 _ml_dealloc(p) 25 print(" All @extern resolved OK!")