Skill站外收录 @skilllib/skill-2117939930272417007
clone-repos
将 SGLang与 FlashInfer 源码克隆至本地 third_party 目录,为内核提取和测试提供基础代码支持,配合现有 flashinfer_trace 数据实现模型分析与验证流程。
开发运维 AI 技能
Skills.MD
# Clone Repositories
Clone SGLang, FlashInfer repositories from GitHub to the `third_party/` directory.
## Description
This skill sets up the required repositories for kernel extraction and testing workflows. It clones two repositories:
- **SGLang**: Inference engine with model implementations and kernel calls
- **FlashInfer**: GPU kernel library with optimized implementations (ground truth)
**Note**: The `flashinfer_trace` directory containing definitions, workloads, and tests is already included in the flashinfer-bench project at `./flashinfer_trace/`. No cloning required.
## Usage
```bash
# Clone all repos to ./third_party directory
/clone-repos
# Force update if repos already exist
/clone-repos --force-update
# Clone specific branches
/clone-repos --sglang-branch v0.4.0 --flashinfer-branch v0.2.0
```
## Parameters
- `force_update` (optional): Force pull latest changes if repos exist (default: false)
- `sglang_branch` (optional): SGLang branch to checkout (default: "main")
- `flashinfer_branch` (optional): FlashInfer branch to checkout (default: "main")
## What This Skill Does
### Step 1: Create third_party Directory
```bash
mkdir -p third_party
```
### Step 2: Clone/Update SGLang Repository
1. Clone from `https://github.com/sgl-project/sglang.git`
2. Checkout specified branch
3. Key directories for kernel extraction:
- `python/sglang/srt/models/` - Model implementations
- `python/sglang/srt/layers/` - Layer implementations (attention, MLP, norms)
- `python/sglang/srt/layers/moe/` - MoE kernel implementations
- `python/sglang/srt/layers/attention/` - Attention kernel implementations
### Step 3: Clone/Update FlashInfer Repository
1. Clone from `https://github.com/flashinfer-ai/flashinfer.git`
2. Checkout specified branch
3. Key directories for ground truth:
- `python/flashinfer/` - Python bindings
- `include/flashinfer/` - C++ headers with kernel implementations
- `csrc/` - CUDA source files
- `tests/` - Test implementations
### Step 4: Verification
1. Verify all repositories cloned successfully
2. Check required directories exist
3. Verify local `flashinfer_trace/` directory exists with definitions and tests
4. Report repository status
## Implementation Steps
When executing this skill:
1. **Check if third_party exists and has repos**:
```bash
ls -la third_party/
```
2. **Clone SGLang** (if not exists):
```bash
git clone --depth 1 https://github.com/sgl-project/sglang.git third_party/sglang
```
3. **Clone FlashInfer** (if not exists):
```bash
git clone --depth 1 https://github.com/flashinfer-ai/flashinfer.git third_party/flashinfer
```
4. **Update if force_update=true**:
```bash
cd third_party/sglang && git fetch origin && git pull origin main
cd third_party/flashinfer && git fetch origin && git pull origin main
```
5. **Verify structure**:
```bash
ls third_party/sglang/python/sglang/srt/models/
ls third_party/flashinfer/python/flashinfer/
ls flashinfer_trace/definitions/
ls flashinfer_trace/tests/references/
```
## Output Directory Structure
```
flashinfer-bench/
├── flashinfer_trace/ # Local (already in project)
│ ├── definitions/ # Kernel definitions
│ │ ├── rmsnorm/
│ │ ├── gemm/
│ │ ├── gqa_paged/
│ │ ├── mla_paged/
│ │ └── moe/
│ ├── workloads/ # Workload configurations
│ └── tests/
│ └── references/ # Reference tests
└── third_party/ # Cloned repositories
├── sglang/ # SGLang repository
│ └── python/sglang/srt/
│ ├── models/ # Model implementations
│ │ ├── llama.py
│ │ ├── deepseek_v3.py
│ │ ├── qwen2_moe.py
│ │ └── ...
│ └── layers/ # Layer implementations
│ ├── attention/
│ ├── moe/
│ └── layernorm.py
└── flashinfer/ # FlashInfer repository
├── python/flashinfer/ # Python bindings (ground truth)
│ ├── attention/
│ ├── norm/
│ └── moe/
└── tests/ # Reference tests
```
## Requirements
- Git
- Network access to GitHub (for sglang, flashinfer)
- Sufficient disk space (~4GB total)
## Error Handling
### Network Errors
- **Error**: Cannot reach GitHub
- **Handling**: Retry with exponential backoff, report specific endpoint failure
### Disk Space Errors
- **Error**: Insufficient disk space
- **Handling**: Report space requirements, suggest cleanup
### Missing Local flashinfer_trace
- **Error**: `flashinfer_trace/` directory not found in project root
- **Handling**: Report error - this directory should be part of the flashinfer-bench repository
## Integration with Other Skills
This skill provides the foundation for:
1. **extract-kernel-definitions**: Uses SGLang model files to extract kernels, outputs to `./flashinfer_trace/definitions/`
2. **add-reference-tests**: Uses FlashInfer for ground truth, outputs tests to `./flashinfer_trace/tests/references/`
Example workflow:
```bash
# Step 1: Clone SGLang and FlashInfer repositories
/clone-repos
# Step 2: Extract kernel definitions from a model
/extract-kernel-definitions --model-name deepseek_v3
# Step 3: Add reference tests
/add-reference-tests --op-type mla_paged
```
## Notes
- Uses shallow clones (--depth 1) by default to save disk space
- SGLang and FlashInfer are actively developed; pin versions for reproducibility
- The `flashinfer_trace/` directory is part of this repository; no external cloning needed
- All output paths are relative to project root
## Maintaining This Document
Update this file when changing repository URLs, directory structure, or adding new repositories.
## See Also
- [extract-kernel-definitions](../extract-kernel-definitions/SKILL.md)
- [add-reference-tests](../add-reference-tests/SKILL.md)
- [workflow](../workflow.md)
评论 0
还没有评论,来抢沙发。
相关内容
同类或同场景的收录内容
building-with-kafka-strimzi
在 Kubernetes 上构建基于 Apache Kafka 的事件驱动系统,支持高可靠的消息传递、事务性处理与精确一次语义,结合 Strimzi 运营商实现集群自动化管理,利用 Schema Registry 保障事件模式演进,适用于微服务间解耦通信与实时数据流处理场景。
站外数据与分析
609 0.0
personal-tool-builder
专注于从个人真实痛点出发快速构建实用工具,涵盖命令行程序、本地优先应用和自动化脚本的开发与演进,强调先满足自身需求再逐步扩展,通过持续自用打磨功能,避免过度设计,确保工具简洁有效且长期可维护。
站外商业与营销
196 0.0
threejs-lighting
实现三维场景中的光照与阴影控制,支持多种光源类型及环境光照明,提供从基础布光到高级阴影优化的完整方案,适用于需要真实感渲染或性能平衡的可视化项目。
站外效率工具
442 0.0
aggregation-helper
提供数据聚合场景的自动化辅助能力,涵盖 SQL 查询编写、统计分析建模、可视化方案设计及商业智能配置,支持从需求理解到生产级代码生成的全流程指导。
站外效率工具数据与分析
217 0.0
举报「clone-repos」
举报信息仅审核团队可见,同一资产 24 小时内仅可举报一次