Static Analysis
Real-time CUDA code analysis shows performance metrics directly above your kernels.What It Does
CodeLens automatically analyzes your CUDA code and shows:- Execution time and GPU efficiency
- Register and shared memory usage
- Occupancy calculations
- Performance bottlenecks
How to Use
1
Write Your CUDA Code
Open a .cu file and write your kernel.
2
Save the File
Press Ctrl+S. CodeLens updates automatically.
3
See Performance Metrics
Look above your kernel for two lines of performance data.
4
Fix Any Issues
If you see warnings, the CodeLens tells you what’s limiting performance.
What You See

CodeLens Display
Two lines appear above each kernel: Line 1 - Runtime Performance:Performance Indicators
- ✅ Green: Excellent performance
- ⚠️ Yellow: Can be optimized
- ❌ Red: Performance issue needs attention
Understanding the Metrics
Runtime Metrics
- Time: How fast your kernel runs (ms)
- SM: GPU utilization percentage
- Occ: Thread occupancy percentage
- Mem: Memory bandwidth (GB/s)
Static Metrics
- Registers: Per-thread register count
- Shared: Shared memory per block
- Limiting factor: What’s preventing better occupancy
Common Issues and Fixes
”reg-limited”
Too many registers per thread:- Simplify calculations
- Use shared memory for arrays
- Reduce local variables
”smem-limited”
Too much shared memory:- Reduce shared array sizes
- Use dynamic shared memory
- Process data in smaller tiles
Register Spilling
CodeLens shows spill warnings:- Reduce register pressure
- Split complex kernels
- Use compiler flags to limit registers
Advanced Build Settings
Click “Advanced Build Settings” in editor toolbar to:- ✅ Generate .ptx files
- ✅ Generate .cubin files
- ✅ Run after build
Tips
Best Practices
- Keep occupancy above 50%
- Fix red warnings first
- Save file to update metrics
- Use build settings for PTX analysis
Screenshots Needed
- CodeLens two-line display - Both performance lines above kernel
- Static analysis warnings - Yellow/red indicators with messages
- Advanced Build Settings - Checkbox panel with PTX/CUBIN options
Next Steps
- Benchmarking - Measure actual performance
- GPU Emulation - Test on different GPUs
- Core Features - AI optimization help
