← スキル一覧に戻る

mojo-simd-optimize
by mvillmow
Training framework written in Mojo
⭐ 11🍴 4📅 2026年1月24日
SKILL.md
name: mojo-simd-optimize description: "Apply SIMD optimizations to Mojo code for parallel computation. Use when optimizing performance-critical tensor and array operations." mcp_fallback: none category: mojo agent: test-engineer user-invocable: false
SIMD Optimization Skill
Parallelize tensor and array operations using SIMD.
When to Use
- Optimizing tensor operations
- Vectorizing element-wise computations
- Performance-critical loops (>1000 elements)
- Benchmark results show optimization potential
Quick Reference
from sys.info import simdwidthof
comptime width = simdwidthof[DType.float32]()
# SIMD vector add
for i in range(0, size, width):
result.store(i, a.load[width](i) + b.load[width](i))
Workflow
- Identify bottleneck - Profile code to find hot loops
- Get SIMD width - Use
simdwidthof[dtype]() - Vectorize loop - Process
widthelements per iteration - Handle remainder - Process leftover elements
- Benchmark - Verify performance improvement (4x-8x expected)
Mojo-Specific Notes
- SIMD width varies by CPU and dtype (usually 8-16 for float32)
- Always handle remainder elements with scalar loop
- Prefer
aliasfor compile-time SIMD width constants - Test on target hardware - SIMD width is platform-specific
Error Handling
| Error | Cause | Solution |
|---|---|---|
Out of bounds | Remainder not handled | Add scalar remainder loop |
No speedup | Wrong SIMD width | Use simdwidthof[dtype]() |
Compilation fails | Type mismatch | Check load/store types match |
Segfault | Misaligned access | Ensure stride is correct |
References
.claude/shared/mojo-guidelines.md- SIMD patterns section- Mojo manual: SIMD documentation
スコア
総合スコア
60/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です