# Clone the repository
git clone https://github.com/cmu-cryptosystems/Rotom.git
cd Rotom
# Create virtual environment
python -m venv .venv
source .venv/bin/activate
# Install dependencies
pip install -r requirements.txtfrom frontends.tensor import TensorTerm
from assignment.assignment import LayoutAssignment
import argparse
# Create tensor operations
a = TensorTerm.Tensor("a", [64, 64], True) # 64x64 ciphertext matrix
b = TensorTerm.Tensor("b", [64], False) # 64-element plaintext vector
c = a @ b # Matrix-vector multiplication
# Run layout assignment
args = argparse.Namespace(n=4096, rolls=True, backend="toy")
assignment = LayoutAssignment(c, args)
kernel = assignment.run()
# Execute with toy backend
from backends.toy import Toy
results = Toy(circuit_ir, inputs, args).run()# Unit tests
pytest
# Integration tests
python main.py
# Specific benchmarks
python main.py --benchmark matmul --backend toy --rollsHigh-level Tensor Operations
↓
Frontend (tensor.py)
↓
IR (layout.py, dim.py, roll.py)
↓
Layout Assignment (assignment.py)
↓
Lowering (lower.py)
↓
Backend (toy.py, openfhe_backend.py)
↓
HE Circuit
- Tensor operation definitions
- Shape inference and validation
- High-level API for users
- Dimension definitions (
dim.py) - Roll operations (
roll.py) - Layout representation (
layout.py) - Kernel operations (
kernel.py) - Cost modeling (
kernel_cost.py)
- Code generation for HE libraries
- Runtime execution
- Layout utilities (
layout_util.py) - Kernel utilities (
kernel_util.py) - Shape utilities (
shape_util.py)
- Add operation to
frontends/tensor.py - Create generator in
assignment/gen/ - Add lowering pass in
lower/ - Add backend support if needed
- Create tests in
tests/
- Create backend class in
backends/ - Implement required methods
- Add command line argument
- Update
main.py - Add tests and benchmarks
This project includes comprehensive documentation generated using Sphinx. The documentation covers user guides, API references, and detailed explanations of Rotom's concepts.
- User Guide: Comprehensive guides for using Rotom
- Writing Tensor Programs
- Understanding Layout Representations
- Tensor Operations
- Backend Configuration
- API Reference: Complete API documentation for all modules
- Architecture Overview: Detailed explanation of Rotom's compilation process
# Navigate to docs directory
cd docs
# Generate HTML documentation
python gen_docs.py
# Clean and regenerate
python gen_docs.py --cleancd docs
python serve_docs.py 8000
# Then open http://localhost:8000 in your browserdocs/source/- Sphinx source files and configurationdocs/html/- Generated HTML documentationdocs/gen_docs.py- Documentation generation scriptdocs/serve_docs.py- Local web server for viewing docsdocs/source/writing_tensor_programs.rst- Guide for writing tensor programsdocs/source/understanding_layout_representations.rst- Layout system explanationdocs/source/user_guide/- User guide documentationdocs/source/api_reference/- API reference documentation
This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.