Logo: Apple Silicon

Apple Silicon

Communautéit
mohitmishra786
apple-silicon

Apple Silicon skill for M-series development and profiling. Use when leveraging unified memory, Metal Performance Shaders, Instruments profiling, sysctl hardware queries, Rosetta 2 behavior, or 16KB page size considerations. Activates on queries about Apple Silicon, unified memory, AMX, MPS, Instruments, Rosetta, or M-series page size.

Iwwersiicht

Editeurmohitmishra786
Repositorylow-level-dev-skills
Skill-Nummapple-silicon
Stären
266
Forks
31
Matgeliwwert Dateien
Nëmmen Instruktiounen
LizenzMIT
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • Alles an den Instruktiounen

    Alles, wat de Modell brauch, steet an den Instruktiounen — keng zousätzlech Dateien ze synchroniséieren.

  • Open Source

    mohitmishra786 huet de Skill op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Apple Silicon an TypingMind, fir e mat all LLM ze benotzen, oder setzt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vu GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier, déi hei drënner steet, an a bestätegt d'Installatioun.
    https://github.com/mohitmishra786/low-level-dev-skills/tree/main/skills/platform/apple-silicon
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill derbäisetzen → Iwwer eng GitHub-URL. Pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an d'Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/mohitmishra786/low-level-dev-skills.git /tmp/low-level-dev-skills
mkdir -p .claude/skills
cp -r /tmp/low-level-dev-skills/skills/platform/apple-silicon .claude/skills/apple-silicon
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Apple Silicon an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Apple Silicon automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Apple Silicon net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Schlësselen.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Apple Silicon

Purpose

Guide agents through Apple Silicon (M-series) development: unified memory architecture, AMX matrix coprocessor access via Accelerate, Metal Performance Shaders for GPU compute, sysctl hardware queries, Instruments profiling, command-line leak tools, Rosetta 2 translation behavior, and 16KB page size implications.

When to Use

  • Optimizing native ARM64 apps on macOS for M1/M2/M3/M4
  • Using GPU/NPU compute without discrete GPU PCIe transfers
  • Profiling memory and CPU with Instruments or command-line tools
  • Understanding Rosetta 2 compatibility for x86 binaries
  • Adapting code for 16KB page size on Apple Silicon
  • Accessing matrix acceleration via Accelerate/vDSP/BLAS

Workflow

1. Unified memory architecture

Apple Silicon SoC
├── CPU cores (P + E cores)
├── GPU cores
├── Neural Engine (NPU)
└── Unified DRAM — single address space, no PCIe copy

Implications:

  • cudaMemcpy equivalent is unnecessary for CPU↔GPU on Metal
  • Memory bandwidth shared across agents — profile holistically
  • Process memory includes all unified allocations

2. Hardware information

bash
# CPU and chip info
sysctl -n machdep.cpu.brand_string
sysctl hw.physicalcpu hw.logicalcpu
sysctl hw.memsize

# ARM64 features (keys vary by chip — grep if specific FEAT_* is missing)
sysctl -a hw.optional.arm 2>/dev/null | grep -iE 'sve|bf16|mte'

# Cache line size
sysctl hw.cachelinesize

# Page size (16KB on macOS Apple Silicon)
sysctl hw.pagesize    # 16384
getconf PAGESIZE

3. 16KB page size considerations

macOS on Apple Silicon uses 16KB pages (not 4KB):

c
// Align hot buffers to page size
size_t page = sysconf(_SC_PAGESIZE);  // 16384
void *buf = aligned_alloc(page, size);

// mmap alignment must be page-aligned
mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);

Impact:

  • posix_memalign minimum alignment often 16KB for large allocs
  • JVM/Go runtimes auto-tune; custom allocators must adapt
  • Test on device — x86 CI may use 4KB pages

4. AMX (Apple Matrix Coprocessor)

AMX is undocumented at ISA level; access through frameworks:

c
// Accelerate framework — uses AMX internally for matrix ops
#include <Accelerate/Accelerate.h>

void matrix_multiply(const float *A, const float *B, float *C,
                     int M, int N, int K) {
    cblas_sgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans,
                M, N, K, 1.0f, A, K, B, N, 0.0f, C, N);
}
bash
# Link Accelerate (default on macOS)
clang -framework Accelerate -o gemm gemm.c -lcblas

For custom AMX kernels: study community reverse engineering or use Metal Performance Shaders as supported path.

5. Metal Performance Shaders (MPS)

objc
// Objective-C / Swift — GPU compute via MPS
#import <Metal/Metal.h>
#import <MetalPerformanceShaders/MetalPerformanceShaders.h>

id<MTLDevice> device = MTLCreateSystemDefaultDevice();
id<MTLCommandQueue> queue = [device newCommandQueue];

MPSMatrixMultiplication *gemm = [[MPSMatrixMultiplication alloc]
    initWithDevice:device transposeLeft:NO transposeRight:NO
    resultRows:M columns:N interiorColumns:K alpha:1.0 beta:0.0];

Metal provides unified memory path to GPU — no explicit copy for buffers allocated with MTLResourceStorageModeShared.

6. Instruments profiling

bash
# Command-line Instruments (xctrace)
xctrace record --template 'Time Profiler' --launch -- /path/to/app
xctrace record --template 'Allocations' --launch -- /path/to/app
xctrace record --template 'Leaks' --launch -- /path/to/app
xctrace export --input trace.trace --toc
TemplateUse
Time ProfilerCPU hotspots, P/E core usage
AllocationsHeap growth, allocation call trees
LeaksRetained memory
System TraceThread scheduling, syscalls

GUI: Xcode → Product → Profile (⌘I)

7. Command-line debugging tools

bash
# Process memory map
vmmap <pid>

# Heap analysis
heap <pid>
heap <pid> -addresses all  # all allocations

# Leak detection
leaks <pid>
leaks --list <pid>

# Sample call stacks
sample <pid> 5 -file sample.txt

8. Rosetta 2 translation

bash
# Check if process runs under Rosetta
sysctl sysctl.proc_translated   # 1 = translated x86

# Force arch
arch -arm64 ./native_binary
arch -x86_64 ./x86_binary

# Universal binary info
lipo -info myapp
file myapp
Runs native ARM64Runs under Rosetta
ARM64 buildx86_64-only binary
-arch arm64 compileDownloaded Intel-only app

Rosetta 2: translates x86_64 to ARM64 with JIT cache. AVX/AVX2 translated but may be slower. Not for kernel extensions or VM guests.

9. Memory tagging (ARM MTE)

Future Apple hardware may expose MTE — monitor via:

bash
sysctl hw.optional.arm.FEAT_MTE  # when available

Prepare with pointer authentication already on ARM64e Apple platforms.

10. Build and perf tips

bash
# Native optimized build
clang -arch arm64 -O3 -mcpu=apple-m1 -o app app.c
# Use -mcpu matching target: apple-m1, apple-m2, apple-m3, apple-m4

# P/E core awareness — dispatch heavy work to performance cores
# pthread_set_qos_class_self_np(QOS_CLASS_USER_INITIATED, 0);

Common Problems

SymptomCauseFix
mmap fails with EINVAL4KB alignment on 16KB systemAlign to sysconf(_SC_PAGESIZE)
Slow x86 binaryRosetta overheadShip universal or arm64-only build
Metal buffer nilSimulator vs deviceTest GPU on real hardware
Accelerate wrong resultsRow/column major mismatchCheck BLAS leading dimensions
Instruments empty traceSandbox/permissionsRun from Xcode or sign app
sysctl not foundWrong key name`sysctl -a

Related Skills

  • skills/low-level-programming/assembly-arm — Darwin ABI, AArch64
  • skills/platform/arm-sve — SVE2 on M4+
  • skills/gpu/cuda — NVIDIA not on Apple Silicon; use Metal instead
  • skills/profilers/heaptrack — cross-platform heap profiling concepts
  • skills/compilers/clang — Apple Clang flags
  • skills/low-level-programming/cpu-cache-opt — cache optimization on unified memory

Heefeg gestallte Froen

Wat mécht de KI-Skill Apple Silicon?

Apple Silicon skill for M-series development and profiling. Use when leveraging unified memory, Metal Performance Shaders, Instruments profiling, sysctl hardware queries, Rosetta 2 behavior, or 16KB page size considerations. Activates on queries about Apple Silicon, unified memory, AMX, MPS, Instruments, Rosetta, or M-series page size.

Firwat Apple Silicon op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Apple Silicon besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt, amplaz en Abonnement pro Benotzerplaz ze bezuelen. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Apple Silicon an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/mohitmishra786/low-level-dev-skills/tree/main/skills/platform/apple-silicon an. TypingMind liest d'Datei SKILL.md an installéiert de Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Apple Silicon benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Apple Silicon benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Apple Silicon domat benotzen – zum Beispill mat GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Apple Silicon gratis?

Jo. mohitmishra786 huet de Skill ënner der Lizenz MIT op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbare Pak vun Instruktiounen, deen engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt e maache soll a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a kee Lafzäitëmfeld a funktionéiere mat all Modell.

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇