add-cuda-kernel
إضافة نوى CUDA إلى FlashInfer
يحتاج FlashInfer إلى نوى GPU جديدة لكن العملية غير واضحة. يقدم هذا الدليل التعليمي تعليمات خطوة بخطوة لإضافة عمليات CUDA عنصرًا-بعنصر، مع تغطية تعريف النواة، وربط TVM-FFI، وواجهات Python، والاختبار، والقياس.
Télécharger le ZIP du skill
Importer dans Claude
Allez dans Paramètres → Capacités → Skills → Importer un skill
Activez et commencez à utiliser
Tester
Utilisation de "add-cuda-kernel". How do I add a new CUDA kernel to FlashInfer?
Résultat attendu:
- أضِف نواة CUDA في 10 خطوات:
- 1. Define kernel in include/flashinfer/{name}.cuh using raw pointers
- 2. Create launcher in csrc/{name}.cu with TVM-FFI tensor handling
- 3. Export via TVM_FFI_DLL_EXPORT_TYPED_FUNC in csrc/{name}_jit_binding.cu
- 4. Create JIT generator in flashinfer/jit/{name}.py
- 5. Build Python API in flashinfer/{name}.py with @functools.cache
- 6. Write tests in tests/ directory with pytest.mark.parametrize
- 7. Register in flashinfer/aot.py for pre-compiled packages
- 8. Export from flashinfer/__init__.py
- 9. Add benchmark in benchmarks/ directory
- 10. Run pytest to test; kernel auto-compiles on first use
Utilisation de "add-cuda-kernel". What file structure do I need for a new FlashInfer kernel?
Résultat attendu:
- الملفات المطلوبة:
- - include/flashinfer/{name}.cuh - تعريف نواة CUDA
- - csrc/{name}.cu - مُشغِّل PyTorch
- - csrc/{name}_jit_binding.cu - ربط TVM-FFI
- - flashinfer/jit/{name}.py - مولّد JIT
- - flashinfer/{name}.py - واجهة Python
- - tests/test_{name}.py - اختبارات وحدات
- - benchmarks/bench_{name}.py - سكربت قياس الأداء
Audit de sécurité
SûrDocumentation-only skill containing tutorial content. Static findings are false positives triggered by markdown code blocks being misidentified as Ruby/shell backticks, and function/documentation keywords incorrectly flagged as cryptographic algorithms. No executable code, no network access, no file system modifications.
Facteurs de risque
🌐 Accès réseau (1)
📁 Accès au système de fichiers (4)
⚙️ Commandes externes (109)
Score de qualité
Ce que vous pouvez construire
إضافة عمليات جديدة
تعلّم سير العمل الكامل لدمج عمليات CUDA مخصّصة في مكتبة FlashInfer
توسيع FlashInfer
إضافة متغيرات انتباه جديدة، عمليات GEMM، أو نوى مخصّصة وفق أعراف المشروع
عمليات GPU مخصّصة
تنفيذ عمليات موترات متخصصة لخطوط خدمة LLM
Essayez ces prompts
Show me how to add a simple scale operation to FlashInfer that multiplies each tensor element by a scalar factor
How do I add a custom attention kernel to FlashInfer with multiple backends like CUTLASS and cuDNN
How do I specify supported CUDA architectures for my kernel and use CompilationContext for SM90 and SM100 targeting
Show me the pattern for writing unit tests in FlashInfer with pytest parametrization for different dtypes and sizes
Bonnes pratiques
- حافظ على كود النواة مستقلًا عن الإطار باستخدام المؤشرات الخام بدل موترات Torch في مجلد include/
- استخدم @functools.cache للتخزين المؤقت للوحدة ووسم @flashinfer_api للتسجيل
- حدّد معماريات CUDA المدعومة عبر supported_compute_capability وCompilationContext لاستهداف GPU بشكل صحيح
Éviter
- تضمين ترويسات Torch في نوى مجلد include/ - حافظ على استقلالها عن الإطار
- تخطي التحقق في مُزيّن @backend_requirement - تحقّق دائمًا من المدخلات
- ترميز إصدارات معمارية CUDA بشكل ثابت بدل استخدام CompilationContext للمرونة
Foire aux questions
ما معماريات GPU التي يدعمها FlashInfer؟
ما الحد الأدنى لحجم المسألة لنوى FlashInfer؟
كيف أدمج نواتي مع واجهات FlashInfer الحالية؟
هل تنفذ هذه المهارة أي كود على جهازي؟
لماذا لا تُترجم نواتي على GPU لدي؟
كيف يقارن هذا بتطوير CUTLASS الخام؟
Détails du développeur
Structure de fichiers
📄 SKILL.md