Skip to content

LuisaGroup/luisa-python-lang

Repository files navigation

luisa-python-lang (WIP)

A new Python DSL frontend for LuisaCompute. Will be integrated into LuisaCompute python package once it's ready.

Content

Introduction

import luisa_lang as lc

Basic Syntax

Types

User-defined Structs

@lc.struct
class Sphere:
    center: lc.float3
    radius: lc.float

Generics

T = TypeVar('T', bound=Any)
@lc.func
def add(a: T, b: T) -> T:
    return a + b

Metaprogramming

luisa_lang provides a metaprogramming feature similar to C++ that allows users to generate code at compile time. This is useful when you want to generate code based on some input parameters, or when you want to generate code that is repetitive.

Standalone Compiler

It is possible to retarget luisa_lang to serve as another DSL. For example, one may want to use it as a customized shader language different from what LuisaCompute provides, or use it to generate customized C++/CUDA source. In this case, one can use the standalone compiler to compile the luisa_lang code into a standalone shader file.

About

A new Python DSL front frontend for LuisaCompute

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published