tile-ai / tile-ai/tilelang

Improve both ease of programming and generated CUDA code readability with local scalar variables

Open
#735 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
7.4k
Forks
742
Avg merge
1d 1h
Merged PRs (30d)
104

Description

Allow user to assign to intermediate scalar variables and lower into C local variable, so that index computation can be simplified as is in user program. Redundant index computation may increase the burden of underlying compiler optimizing them away, or even result in redundant integer operations at runtime.

Expected example:

```python
with T.Kernel(N // blk) as bx:
for i0 in T.Parallel(blk):
i = T.var(bx * blk + i0)
x[i] = ... y[i] ... z[i] ...
```

Yet multiple dimension indexing still cannot be simplified on user side; maybe also *should* not? Common Subexpression Elimination is still required.

Contributor guide

Open the contributing guide

Research direction

Start with the issue's Python T.Kernel and T.var example, then trace how intermediate scalar assignments are lowered into generated C/CUDA code. Done means user-side index computation is represented by a local scalar variable, while multidimensional indexing and the need for Common Subexpression Elimination are explicitly accounted for.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.