NVIDIA / NVIDIA/tilus

[Feature] Support L1 calling convention in tvm-ffi

Open
#54 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
492
Forks
30
Avg merge
4d 9h
Merged PRs (30d)
2

Description

The current calling convention in Tilus:

import tilus
from tilus import float16, int32, GlobalTensor


class Example(tilus.Script):
    def __call__(
        self, m_size: int32, n_size: int, k_size: int, a_ptr: ~flaot16, b_ptr: ~flaot16, c_ptr: ~flaot16
    ):  # m_size is dynamic, n_size and k_size are JIT constants
        """
        Generate:
            void example(int m, int n, int k, float16 *a, float16 *b, float16 *c) {...}
        """
        ...
        g_a: GlobalTensor = self.global_view(a_ptr, dtype=float16, shape=[m_size, k_size])
        ...

The L1 calling convention:

class ExampleL1(tilus.Script):
    def __call__(
        self, 
        g_a: GlobalTensor[float16, ['m', 'K']],  # m is dynamic,
        g_b: GlobalTensor[float16, ['K', 'N']],  # K and N are JIT constants
        g_c: GlobalTensor[float16, ['m', 'N']],
    ):
        """
        Generate:
            void exampleL1(tvm::ffi::TensorView g_a, tvm::ffi::TensorView g_b, tvm::ffi::TensorView g_c) {...}
        """
        ...

We can also use

        g_a: 'float16[m, K]',
        g_b: 'float16[K, N]',
        g_c: 'float16[m, N]'

as type annotation.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by locating the existing Tilus calling-convention and GlobalTensor type-annotation entry points, then trace how kernel parameters become generated signatures. Done means supporting the L1 TensorView convention with both shown annotation forms while preserving the current convention, with tests covering dynamic and JIT-constant dimensions.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend-api-design, compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.