7.5 KiB
rocBLAS Agent Development Rules
This directory contains agent development rules for AI coding assistants (Cursor, Cline, GitHub Copilot) working with the rocBLAS project.
📁 Files Overview
Core Rules
.cursorrules- Main rules file for Cursor/Cline (15 KB)- Complete project overview and architecture
- Build and testing quickstart (Linux + Windows)
- C++ code style guidelines
- Development workflow and best practices
Cursor-Specific Rules (.cursor/rules/)
-
rocblas-architecture.mdc(3 KB) -alwaysApply: true- BLAS operation levels (1, 2, 3, Extensions)
- Tensile integration
- Data type support
- Component organization
-
building.mdc(4 KB) -alwaysApply: false- Build commands (install.sh, rmake.py)
- Test execution (rtest.py)
- Test levels (smoke, psdb, osdb, cqe)
- Performance benchmarking
-
cpp-style.mdc(6 KB) -globs: ["*.cpp", "*.hpp", "*.h"]- Naming conventions (snake_case)
- BLAS API patterns
- HIP/GPU code examples
- MIT license header template
-
testing.mdc(7 KB) -globs: ["*.cpp", "*.hpp", "*.h", "clients/gtest/**"]- Google Test patterns
- YAML test configuration
- Test categories and filters
- Multi-OS testing framework
GitHub Copilot
.github/copilot-instructions.md(7 KB)- Condensed rules for GitHub Copilot
- Quick reference for common patterns
- API examples and build commands
Documentation
AGENT_RULES_README.md(this file)- Quick overview of all files
- Getting started guide
🚀 Quick Start
For Cursor/Cline Users
- Open any rocBLAS file - Rules activate automatically
- Ask about the project:
- "Explain the rocBLAS architecture"
- "How do I build rocBLAS on Linux?"
- "What are the test levels?"
- Request code changes:
- "Add a new BLAS Level 1 operation"
- "Create a test for gemm_strided_batched"
- Build and test:
- "Build rocBLAS with clients"
- "Run smoke tests"
For GitHub Copilot Users
GitHub Copilot will automatically read .github/copilot-instructions.md and provide context-aware suggestions following rocBLAS conventions.
📖 What Agents Know
Project Structure
- Library components (blas1, blas2, blas3, blas_ex)
- Client structure (gtest, benchmarks, samples)
- Tensile integration for GEMM operations
- Documentation and scripts
Build System
- Linux:
./install.shwith various flags - Windows:
python rmake.py(with HIP_PATH set) - Architecture flags (
--architecture auto) - Dependency management
Testing
- Test Levels:
- smoke (5-10 min) - Quick sanity
- psdb (30-60 min) - PR validation
- osdb (1.5-2 hrs) - Nightly regression
- cqe (3-3.5 hrs) - Complete QE
- Test Execution:
rtest.py -t <level> - Direct Testing:
rocblas-test --gtest_filter=*pattern* - YAML Configuration: Parameterized test definitions
Code Style
- Naming: snake_case for functions/variables
- BLAS Convention:
rocblas_<precision><operation> - Precisions: s=float, d=double, c=complex, z=complex double, h=half, bf16=bfloat16
- Headers: Full MIT license header
- Include Guards:
#pragma once
Testing Workflow
- Test Orchestration:
rtest.pywith multiple test levels - Direct Testing:
rocblas-testwith gtest filters - YAML Configuration: Parameterized test definitions
- Benchmarking:
rocblas-benchfor performance testing
🎯 Key Features
1. BLAS-Specific Conventions
Unlike hipDNN's CamelCase, rocBLAS uses snake_case to match traditional BLAS naming standards.
2. Dual Platform Support
Comprehensive documentation for both Linux (primary) and Windows development.
3. Test Hierarchy
Clear progression from quick smoke tests to comprehensive QE validation.
4. Performance Focus
Includes benchmarking guidance and Tensile kernel optimization.
🔧 Customization
To Modify Rules:
- General changes: Edit
.cursorrules - Architecture info: Edit
.cursor/rules/rocblas-architecture.mdc - Build/test commands: Edit
.cursor/rules/building.mdc - Code style: Edit
.cursor/rules/cpp-style.mdc - Testing patterns: Edit
.cursor/rules/testing.mdc - GitHub Copilot: Edit
.github/copilot-instructions.md
To Add New Rules:
Create new .mdc files in .cursor/rules/ with appropriate metadata:
---
alwaysApply: false
globs: ["*.cpp", "*.hpp"]
---
# Your Rule Title
Your rule content here...
📊 Comparison to hipDNN
| Aspect | hipDNN | rocBLAS |
|---|---|---|
| Naming | CamelCase | snake_case |
| Build | CMake + Ninja | install.sh / rmake.py |
| Testing | Direct binaries | rtest.py orchestration |
| Platform | Linux | Linux + Windows |
| Architecture | Plugin-based | BLAS levels |
| Special | Graph operations | Tensile kernels |
See AGENT_RULES_COMPARISON.md for detailed comparison.
💡 Tips for Agents
When Suggesting Code:
- ✅ Use snake_case naming
- ✅ Follow
rocblas_<precision><operation>pattern - ✅ Include full MIT license header
- ✅ Add tests in
clients/gtest/ - ✅ Consider all data types (s, d, c, z, h, bf16)
- ✅ Use
#pragma oncefor headers
When Building:
- ✅ Use
./install.shon Linux - ✅ Use
python rmake.pyon Windows - ✅ Add
--architecture autofor faster builds - ✅ Only build when explicitly requested
When Testing:
- ✅ Start with
rtest.py -t smoke - ✅ Use appropriate test level for context
- ✅ Use
--gtest_filterfor specific tests - ✅ Use YAML configs for parameterized testing
📚 Additional Resources
- rocBLAS Documentation:
docs/ - Build Guides:
docs/install/ - Test Configuration:
rtest.xml- Test suite definitions - YAML Test Files:
clients/gtest/*.yaml- Parameterized test configurations
🤝 Contributing
For Developers Updating Rules
When updating these rules:
- Test with actual agent interactions
- Update all relevant files (don't forget copilot-instructions.md)
- Document changes in this README
- Consider impact on both Cursor and GitHub Copilot
For AI Agents Using These Rules
Help improve these rules! If you notice:
- ✅ Inconsistencies: Pattern in code differs from documented rule
- ✅ Missing patterns: Critical idioms not documented
- ✅ Outdated examples: Code examples don't match current practices
- ✅ Gaps: Questions these rules should answer but don't
Suggest updates by saying:
"I notice [observation]. The rules in [file] section [section] should be updated to [suggestion]. This will help future agents [benefit]."
This creates a continuous improvement loop where the rules evolve with the codebase.
✅ Verification
To verify the rules are working:
- Open a rocBLAS file in Cursor
- Ask: "What are the BLAS operation levels?"
- Expected: Agent should reference Level 1, 2, 3, and Extensions
- Ask: "How do I build rocBLAS?"
- Expected: Agent should provide platform-specific commands
📝 Version History
- 2026-01-02: Initial creation based on hipDNN rules
- Adapted naming conventions for BLAS
- Added dual platform support
- Documented rtest.py test orchestration
- Documented test hierarchy and YAML configurations
- Added Windows-specific guidance
🙏 Credits
These rules were inspired by the hipDNN project's agent development rules and adapted specifically for rocBLAS development workflows and testing infrastructure.
Questions? See AGENT_RULES_SUMMARY.md for detailed documentation.