1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499<p align="center">
<img src="public/logo.webp" alt="RightNow Tile" width="80" />
</p>
<h1 align="center">RightNow Tile</h1>
<p align="center">
<strong>CUDA SIMT to cuTile Python Transpiler</strong><br>
Transform your CUDA kernels for NVIDIA Blackwell GPUs
</p>
<p align="center">
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-green.svg" alt="License: MIT"></a>
<a href="https://nextjs.org/"><img src="https://img.shields.io/badge/Next.js-16-black" alt="Next.js 16"></a>
<a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-5.9-blue" alt="TypeScript"></a>
<a href="https://docs.nvidia.com/cuda/cutile-python/"><img src="https://img.shields.io/badge/cuTile-Blackwell-76B900" alt="cuTile"></a>
<a href="https://discord.gg/sSJqgNnq6X"><img src="https://img.shields.io/badge/Discord-Join%20Us-5865F2" alt="Discord"></a>
</p>
<p align="center">
<a href="https://tile.rightnowai.co">Live Demo</a> โข
<a href="#quick-start">Quick Start</a> โข
<a href="#features">Features</a> โข
<a href="#supported-patterns">Patterns</a> โข
<a href="https://discord.gg/sSJqgNnq6X">Discord</a>
</p>
---
## What is RightNow Tile?
**RightNow Tile** is a production-grade transpiler that converts traditional CUDA SIMT (Single Instruction, Multiple Threads) kernels into [cuTile](https://docs.nvidia.com/cuda/cutile-python/) Python code โ NVIDIA's new tile-based programming model optimized for **Blackwell GPUs** (compute capability 10.x+).
Part of the [RightNow AI](https://rightnowai.co) ecosystem โ a code editor built for GPU kernel development.
<br>
## Why cuTile?
NVIDIA's cuTile represents a paradigm shift in GPU programming:
| Traditional CUDA | cuTile |
|------------------|--------|
| Thread-centric programming | Tile-centric programming |
| Manual memory coalescing | Automatic tile-based loads |
| Complex index calculations | Declarative tile operations |
| Low-level synchronization | High-level tile semantics |
**RightNow Tile** bridges the gap โ take your existing CUDA kernels and transform them for next-gen hardware.
<br>
## Quick Start
```bash
# Clone the repository
git clone https://github.com/RightNow-AI/RightNow-Tile.git
cd RightNow-Tile
# Install dependencies
npm install
# Start development server
npm run dev
```
Open [http://localhost:3000](http://localhost:3000) and start transpiling!
<br>
## Features
### Intelligent Pattern Detection
Automatically identifies **18 computational patterns** with **60+ variant-specific optimizations**:
```
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ Your CUDA โ โโโบ โ Pattern Match โ โโโบ โ Optimized โ
โ Kernel โ โ + Analysis โ โ cuTile Code โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
```
### 9-Stage Transpilation Pipeline
```
CUDA Source
โ
โผ
โโโโโโโโโโโโโโโโ
โ 1. Extractor โ Parse kernel signatures, parameters, memory accesses
โโโโโโโโฌโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโ
โ 2. Parser โ Recognize 150+ CUDA intrinsics & index patterns
โโโโโโโโฌโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโ
โ 3. Semantic โ Detect reductions, dependencies, race conditions
โโโโโโโโฌโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโ
โ 4. Memory โ Analyze coalescing, bank conflicts, access patterns
โโโโโโโโฌโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโ
โ 5. Pattern โ Match against 18 patterns with confidence scoring
โโโโโโโโฌโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโ
โ 6. IR Build โ Generate intermediate representation with config
โโโโโโโโฌโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโ
โ 7. Optimize โ Select optimal tile sizes & configurations
โโโโโโโโฌโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโ
โ 8. CodeGen โ Apply variant-specific templates
โโโโโโโโฌโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโ
โ 9. Validate โ Verify correctness & generate diagnostics
โโโโโโโโดโโโโโโโโ
โ
โผ
cuTile Python
```
### Modern Developer Experience
- **Monaco Editor** โ VS Code-quality editing with syntax highlighting
- **Real-time Transpilation** โ See results instantly
- **Dark/Light Themes** โ Easy on the eyes
- **Expandable Output** โ Full-screen code view
- **One-Click Copy** โ Get your code ready to deploy
<br>
## Supported Patterns
### Core Compute Patterns
| Pattern | Variants | Use Cases | Confidence |
|---------|----------|-----------|------------|
| **GEMM** | `naive`, `tiled`, `register_blocked` | Matrix multiplication, deep learning | High |
| **Reduction** | `tree`, `warp_shuffle`, `multi_block`, `segmented` | Sum, max, min, dot product | High |
| **Scan** | `inclusive`, `exclusive`, `segmented` | Prefix sum, stream compaction | High |
| **Stencil** | `1d_3pt`, `1d_5pt`, `2d_5pt`, `2d_9pt`, `3d` | Image processing, PDE solvers | High |
| **Elementwise** | `simple`, `vectorized` | Point-wise operations | High |
### ML/Deep Learning Patterns
| Pattern | Variants | Use Cases | Confidence |
|---------|----------|-----------|------------|
| **Attention** | `flash_attention`, `flash_attention_v2`, `multi_head`, `causal`, `cross` | Transformer models | High |
| **Normalization** | `layernorm`, `rmsnorm`, `batchnorm`, `groupnorm`, `instancenorm` | Neural network layers | High |
| **Convolution** | `conv1d`, `conv2d`, `conv3d`, `depthwise`, `grouped`, `winograd`, `im2col` | CNNs, signal processing | High |
| **Pooling** | `max_pool_2d`, `avg_pool_2d`, `global_avg`, `global_max`, `adaptive` | Feature downsampling | High |
| **Embedding** | `lookup`, `embedding_bag`, `positional` | NLP, recommender systems | Medium |
### LLM/Transformer-Specific Patterns
| Pattern | Variants | Use Cases | Confidence |
|---------|----------|-----------|------------|
| **RoPE** | `standard`, `neox`, `cached` | Rotary position embeddings | High |
| **KV Cache** | `append`, `paged`, `prefix`, `gqa` | LLM inference optimization | High |
| **Quantization** | `int8`, `int4`, `fp8`, `dequantize` | Model compression | Medium |
| **Fused** | `matmul_activation`, `matmul_bias_activation`, `layernorm_residual` | Kernel fusion | Medium |
### Specialized Patterns
| Pattern | Variants | Use Cases | Confidence |
|---------|----------|-----------|------------|
| **FFT** | `radix2`, `radix4`, `radix8`, `inverse`, `real` | Signal processing | High |
| **Sparse** | `spmv_csr`, `spmv_csr_warp`, `spmv_coo`, `spmv_ell`, `spmm`, `sddmm` | Sparse matrix operations | Medium |
| **Histogram** | `atomic`, `privatized`, `multipass`, `weighted`, `2d` | Data distribution, statistics | Medium |
| **Sorting** | `bitonic`, `bitonic_shared`, `radix`, `merge` | Parallel sorting | Medium |
<br>
## Example
**Input: CUDA SIMT Kernel**
```cuda
__global__ void vectorAdd(float* a, float* b, float* c, int n) {
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < n) {
c[idx] = a[idx] + b[idx];
}
}
```
**Output: cuTile Python**
```python
import cuda_tile as ct
import cupy
TILE_SIZE = 256
@ct.kernel
def vector_add(a, b, c, n: ct.Constant[int], tile_size: ct.Constant[int]):
"""
Elementwise kernel - auto-transpiled from CUDA
Original: vectorAdd
Confidence: 100%
"""
pid = ct.bid(0)
# Load input tiles
a_tile = ct.load(a, index=(pid,), shape=(tile_size,))
b_tile = ct.load(b, index=(pid,), shape=(tile_size,))
# Compute
result = a_tile + b_tile
# Store result
ct.store(c, index=(pid,), tile=result)
def launch_vector_add(a, b, c):
"""Launch the vector_add kernel"""
n = a.shape[0]
grid = (ct.cdiv(n, TILE_SIZE), 1, 1)
stream = cupy.cuda.get_current_stream()
ct.launch(stream, grid, vector_add, (a, b, c, TILE_SIZE))
```
### Flash Attention Example
**Input: Flash Attention CUDA Kernel**
```cuda
__global__ void flash_attention_kernel(
float* Q, float* K, float* V, float* O,
int seq_len, int head_dim, float scale
) {
// Complex multi-phase attention implementation
// with online softmax and tiled matrix multiply
...
}
```
**Output: cuTile Python (Flash Attention)**
```python
import cuda_tile as ct
import cupy
BLOCK_Q = 64
BLOCK_KV = 64
@ct.kernel
def flash_attention(
Q, K, V, O,
seq_len_q: ct.Constant[int],
seq_len_kv: ct.Constant[int],
head_dim: ct.Constant[int],
scale: ct.Constant[float],
block_q: ct.Constant[int],
block_kv: ct.Constant[int]
):
"""
Flash Attention kernel - auto-transpiled from CUDA
Confidence: 95%
Variant: flash_attention_v2
"""
block_q_idx = ct.bid(0)
head_idx = ct.bid(1)
# Initialize output accumulator and softmax stats
acc = ct.zeros((block_q, head_dim), dtype=ct.float32)
m_i = ct.full((block_q,), float('-inf'), dtype=ct.float32)
l_i = ct.zeros((block_q,), dtype=ct.float32)
# Load Q tile (stays in registers)
q_tile = ct.load(Q, index=(head_idx, block_q_idx), shape=(block_q, head_dim))
# Iterate over K,V blocks with online softmax
for block_kv_idx in range(0, ct.cdiv(seq_len_kv, block_kv)):
k_tile = ct.load(K, index=(head_idx, block_kv_idx), shape=(block_kv, head_dim))
v_tile = ct.load(V, index=(head_idx, block_kv_idx), shape=(block_kv, head_dim))
# QK^T with scaling
qk = ct.tile_matmul(q_tile, ct.transpose(k_tile)) * scale
# Online softmax update
m_ij = ct.reduce(qk, op=ct.max, axis=1)
m_new = ct.maximum(m_i, m_ij)
alpha = ct.exp(m_i - m_new)
acc = acc * alpha[:, None]
l_i = l_i * alpha
p = ct.exp(qk - m_new[:, None])
l_ij = ct.reduce(p, op=ct.sum, axis=1)
l_i = l_i + l_ij
# Accumulate output
acc = acc + ct.tile_matmul(p, v_tile)
m_i = m_new
# Normalize and store
out = acc / l_i[:, None]
ct.store(O, index=(head_idx, block_q_idx), tile=out)
```
<br>
## API Usage
Use the transpiler programmatically:
```typescript
import { transpile } from './lib/transpiler';
const result = await transpile(cudaCode);
// Access results
result.tileCode // Generated cuTile Python code
result.pattern.archetype // Detected pattern (e.g., 'attention', 'gemm')
result.pattern.confidence // Confidence score (0-1)
result.pattern.variant // Specific variant (e.g., 'flash_attention_v2')
result.validation.isValid // Validation status
result.diagnostics // Warnings and suggestions
result.memoryAnalysis // Memory access analysis
result.semanticAnalysis // Semantic analysis results
```
### REST API
```bash
curl -X POST http://localhost:3000/api/transpile \
-H "Content-Type: application/json" \
-d '{"code": "__global__ void add(float* a, float* b, float* c, int n) { ... }"}'
```
<br>
## Project Structure
```
rightnow-tile/
โโโ app/
โ โโโ api/transpile/ # REST API endpoint
โ โโโ components/ # React components
โ โ โโโ ScientificVisualization.tsx
โ โ โโโ ThemeProvider.tsx
โ โ โโโ ThemeToggle.tsx
โ โโโ page.tsx # Main UI
โ โโโ globals.css # Styling
โโโ lib/
โ โโโ ast/ # AST extraction & semantic analysis
โ โ โโโ extractor.ts # Kernel parsing
โ โ โโโ semantic-analyzer.ts
โ โ โโโ memory-analyzer.ts
โ โ โโโ phase-analyzer.ts # Multi-phase kernel detection
โ โ โโโ types.ts # 18 archetypes, 60+ variants
โ โโโ parser/
โ โ โโโ intrinsics.ts # 150+ CUDA intrinsics
โ โโโ patterns/ # Pattern matchers (18 patterns)
โ โ โโโ matchers/
โ โ โโโ attention.ts # Flash Attention, MHA
โ โ โโโ fused.ts # Fused kernels
โ โ โโโ fft.ts # FFT variants
โ โ โโโ gemm.ts # Matrix multiply
โ โ โโโ reduction.ts # Reductions
โ โ โโโ scan.ts # Prefix sums
โ โ โโโ stencil.ts # Stencil patterns
โ โ โโโ sparse.ts # Sparse matrix ops
โ โ โโโ histogram.ts # Histogram
โ โ โโโ convolution.ts # CNN convolutions
โ โ โโโ sorting.ts # Sorting algorithms
โ โ โโโ pooling.ts # Pooling layers
โ โ โโโ normalization.ts # Norm layers
โ โ โโโ embedding.ts # Embeddings
โ โ โโโ rope.ts # Rotary embeddings
โ โ โโโ kvcache.ts # KV cache ops
โ โ โโโ quantization.ts # Quantization
โ โ โโโ elementwise.ts
โ โโโ ir/ # Intermediate representation
โ โ โโโ builder.ts # 11 specialized IR types
โ โ โโโ optimizer.ts
โ โ โโโ types.ts
โ โโโ codegen/ # Code generation
โ โ โโโ generator.ts # Routes to all 18 archetypes
โ โ โโโ templates/ # 14 template files
โ โ โโโ attention.ts
โ โ โโโ fused.ts
โ โ โโโ sparse.ts
โ โ โโโ histogram.ts
โ โ โโโ convolution.ts
โ โ โโโ sorting.ts
โ โ โโโ pooling.ts
โ โ โโโ normalization.ts
โ โ โโโ embedding.ts
โ โ โโโ rope.ts
โ โ โโโ kvcache.ts
โ โ โโโ quantization.ts
โ โ โโโ reduction.ts
โ โ โโโ stencil.ts
โ โโโ validation/ # Validation & diagnostics
โ โโโ transpiler.ts # Main entry point
โโโ docs/ # Documentation
โโโ public/ # Static assets
```
<br>
## Tech Stack
- **Framework**: [Next.js 16](https://nextjs.org/) with Turbopack
- **Language**: [TypeScript 5.9](https://www.typescriptlang.org/)
- **UI**: [React 19](https://react.dev/), [Tailwind CSS](https://tailwindcss.com/), [Framer Motion](https://www.framer.com/motion/)
- **Editor**: [Monaco Editor](https://microsoft.github.io/monaco-editor/)
- **Target**: [NVIDIA cuTile](https://docs.nvidia.com/cuda/cutile-python/)
<br>
## Requirements
- **Node.js** 18+
- **npm** or **yarn**
- For running generated code: **NVIDIA Blackwell GPU** (compute capability 10.x+)
<br>
## Production Deployment
```bash
# Build for production
npm run build
# Start production server
npm start
```
Deploy to Vercel, AWS, or any Node.js hosting platform.
<br>
## Contributing
We welcome contributions! Here's how to get started:
1. **Fork** the repository
2. **Create** your feature branch (`git checkout -b feature/amazing-feature`)
3. **Commit** your changes (`git commit -m 'Add amazing feature'`)
4. **Push** to the branch (`git push origin feature/amazing-feature`)
5. **Open** a Pull Request
### Development
```bash
# Run development server
npm run dev
# Type checking
npx tsc --noEmit
# Build
npm run build
```
<br>
## Roadmap
- [x] Support for 18 CUDA patterns with 60+ variants
- [x] Flash Attention and Transformer-specific patterns
- [x] LLM inference patterns (RoPE, KV Cache, Quantization)
- [x] Comprehensive convolution support (Winograd, im2col)
- [ ] Batch transpilation for multiple kernels
- [ ] Performance benchmarking comparisons
- [ ] VS Code extension integration
- [ ] CLI tool for CI/CD pipelines
- [ ] CUDA to Triton transpilation
<br>
## License
This project is licensed under the **MIT License** โ see the [LICENSE](LICENSE) file for details.
<br>
## Links
<p align="center">
<a href="https://rightnowai.co"><strong>RightNow AI</strong></a> ยท GPU Kernel Code Editor<br><br>
<a href="https://tile.rightnowai.co">Live Demo</a> โข
<a href="https://docs.nvidia.com/cuda/cutile-python/">cuTile Docs</a> โข
<a href="https://discord.gg/sSJqgNnq6X">Discord</a> โข
<a href="https://github.com/RightNow-AI/RightNow-Tile/issues">Issues</a>
</p>
---
<p align="center">
Made with โฅ by <a href="https://rightnowai.co">RightNow AI</a>
</p>