From 71dbef4795f1c9db8bfc386457d8780f5d492cbc Mon Sep 17 00:00:00 2001
From: Xiaochun Tong pass a value by value, this is only a marker and should not be called pass a value by ref, this is only a marker and should not be called Mark a class as a DSL opaque type. Example: Mark a class as a DSL struct. Example: Mark a function as a DSL function.
+To mark an argument as byref, use the Example: Generates Rust API code for a given DSL module [Function parameter name, Type or Value].
+The reason for using parameter name instead of GenericParameter is that python supports passing type[T] as a parameter, Contains a delegate that can be resolved to a function.
+This is to support generic functions as well as meta-programming.
+Since each time the function is called in DSL, user meta-programming code in the function body
+will be called, we need to keep the AST of the function. Helper class that provides a standard way to create an ABC using
+inheritance. Helper class that provides a standard way to create an ABC using
+inheritance. Helper class that provides a standard way to create an ABC using
+inheritance. Helper class that provides a standard way to create an ABC using
+inheritance. Helper class that provides a standard way to create an ABC using
+inheritance. Helper class that provides a standard way to create an ABC using
+inheritance. Helper class that provides a standard way to create an ABC using
+inheritance. Helper class that provides a standard way to create an ABC using
+inheritance. Helper class that provides a standard way to create an ABC using
+inheritance. Helper class that provides a standard way to create an ABC using
+inheritance. Helper class that provides a standard way to create an ABC using
+inheritance. Helper class that provides a standard way to create an ABC using
+inheritance. Helper class that provides a standard way to create an ABC using
+inheritance. Helper class that provides a standard way to create an ABC using
+inheritance. Helper class that provides a standard way to create an ABC using
+inheritance. A GenericParameter contains three parts:
+ name@ctx_name: bound a string describing the context (where the generic parameter is defined), e.g. 'some_function' Helper class that provides a standard way to create an ABC using
+inheritance. Helper class that provides a standard way to create an ABC using
+inheritance. The definition of a parametric type, e.g. class Foo[T]: ... An instance of a parametric type, e.g. Foo[int] Helper class that provides a standard way to create an ABC using
+inheritance. Helper class that provides a standard way to create an ABC using
+inheritance. Base class for all nodes in the HIR. A node could be a value, a reference, or a statement.
+Nodes equality is based on their identity. Base class for all nodes in the HIR. A node could be a value, a reference, or a statement.
+Nodes equality is based on their identity. A node with a type, which can either be values or references. A node with a type, which can either be values or references. A node with a type, which can either be values or references. A node with a type, which can either be values or references. A node with a type, which can either be values or references. A node with a type, which can either be values or references. A node with a type, which can either be values or references. A node with a type, which can either be values or references. A node with a type, which can either be values or references. A node with a type, which can either be values or references. A node with a type, which can either be values or references. A node with a type, which can either be values or references. A node with a type, which can either be values or references. A node with a type, which can either be values or references. A node with a type, which can either be values or references. A temporary variable A node with a type, which can either be values or references. A node with a type, which can either be values or references. A node with a type, which can either be values or references. A node with a type, which can either be values or references. Common base class for all non-exit exceptions. Common base class for all non-exit exceptions. Common base class for all non-exit exceptions. Common base class for all non-exit exceptions. Common base class for all non-exit exceptions. Base class for all nodes in the HIR. A node could be a value, a reference, or a statement.
+Nodes equality is based on their identity. Base class for all nodes in the HIR. A node could be a value, a reference, or a statement.
+Nodes equality is based on their identity. Base class for all nodes in the HIR. A node could be a value, a reference, or a statement.
+Nodes equality is based on their identity. Base class for all nodes in the HIR. A node could be a value, a reference, or a statement.
+Nodes equality is based on their identity. Base class for all nodes in the HIR. A node could be a value, a reference, or a statement.
+Nodes equality is based on their identity. Base class for all nodes in the HIR. A node could be a value, a reference, or a statement.
+Nodes equality is based on their identity. Base class for all nodes in the HIR. A node could be a value, a reference, or a statement.
+Nodes equality is based on their identity. Base class for all nodes in the HIR. A node could be a value, a reference, or a statement.
+Nodes equality is based on their identity. A node with a type, which can either be values or references. Allow a type to be remapped to another type within DSL code.
+Parameters:
+target (type): The type to be remapped.
+alias (type): The type to which the target type will be remapped.
+Example: For example, Abstract base class for generic types. A generic type is typically declared by inheriting from
+this class parameterized with one or more type variables.
+For example, a generic mapping type might be defined as:: class Mapping(Generic[KT, VT]):
+ def __getitem__(self, key: KT) -> VT:
+ ...
+ # Etc. This class can then be used as follows:: def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
+ try:
+ return mapping[key]
+ except KeyError:
+ return default Abstract base class for generic types. A generic type is typically declared by inheriting from
+this class parameterized with one or more type variables.
+For example, a generic mapping type might be defined as:: class Mapping(Generic[KT, VT]):
+ def __getitem__(self, key: KT) -> VT:
+ ...
+ # Etc. This class can then be used as follows:: def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
+ try:
+ return mapping[key]
+ except KeyError:
+ return default Allowing mixing normal python object as compile-time value with DSL code.
+Usage:
+ - Attempt to convert the value to the target type. Attempt to convert the value to the target type, preserving the bit representation. Assert that the condition is true at runtime. Aborts the kernel execution implicit_type_params: Tuple[List[Tuple[str,
+ classinfo.VarType]], classinfo.VarType] Increment the line number and end line number of each node in the tree
+starting at node by n. This is useful to "move code" to a different
+location in a file. Dedent the lines and return the indentation level of the first line. Find the constraints and bounds of a TypeVar.
+Only one of the two can be present.
+luisa_lang
+
+
+
+
+
+
+
+
+
+
+luisa_lang
+
+
+
+
+
+
+ 1from dataclasses import dataclass
+ 2from typing import Any, Callable, List, Optional, Set, TypeVar
+ 3import typing
+ 4from luisa_lang import hir
+ 5import inspect
+ 6from luisa_lang.utils import get_full_name, get_union_args, unique_hash, unwrap
+ 7from luisa_lang.classinfo import MethodType, VarType, GenericInstance, UnionType, _get_cls_globalns, register_class, class_typeinfo
+ 8from enum import auto, Enum
+ 9from luisa_lang import classinfo, parse
+ 10import inspect
+ 11from typing import (
+ 12 Callable,
+ 13 Dict,
+ 14 List,
+ 15 Optional,
+ 16 Sequence,
+ 17 Set,
+ 18 Tuple,
+ 19 TypeAlias,
+ 20 TypeVar,
+ 21 Union,
+ 22 Generic,
+ 23 Literal,
+ 24 overload,
+ 25 Any,
+ 26)
+ 27
+ 28T = TypeVar('T')
+ 29_T = TypeVar("_T", bound=type)
+ 30_F = TypeVar("_F", bound=Callable[..., Any])
+ 31
+ 32
+ 33def intrinsic(name: str, ret_type: type[T], *args, **kwargs) -> T:
+ 34 raise NotImplementedError(
+ 35 "intrinsic functions should not be called in host-side Python code. "
+ 36 "Did you mistakenly called a DSL function?"
+ 37 )
+ 38
+ 39
+ 40def byval(value: T) -> T:
+ 41 """pass a value by value, this is only a marker and should not be called"""
+ 42
+ 43 raise NotImplementedError(
+ 44 "byval should not be called in host-side Python code. "
+ 45 "Did you mistakenly called a DSL function?"
+ 46 )
+ 47
+ 48
+ 49def byref(value: T) -> T:
+ 50 """pass a value by ref, this is only a marker and should not be called"""
+ 51
+ 52 raise NotImplementedError(
+ 53 "byref should not be called in host-side Python code. "
+ 54 "Did you mistakenly called a DSL function?"
+ 55 )
+ 56
+ 57
+ 58def _is_method(f):
+ 59 if inspect.ismethod(f):
+ 60 return True
+ 61 return inspect.isfunction(f) and hasattr(f, '__qualname__') and '.' in f.__qualname__
+ 62
+ 63
+ 64class _ObjKind(Enum):
+ 65 BUILTIN_TYPE = auto()
+ 66 STRUCT = auto()
+ 67 FUNC = auto()
+ 68 KERNEL = auto()
+ 69
+ 70
+ 71def _make_func_template(f: Callable[..., Any], func_name: str, func_sig: Optional[MethodType],
+ 72 func_globals: Dict[str, Any], foreign_type_var_ns: Dict[TypeVar, hir.Type],
+ 73 props: hir.FuncProperties, self_type: Optional[hir.Type] = None):
+ 74 # parsing_ctx = _parse.ParsingContext(func_name, func_globals)
+ 75 # func_sig_parser = _parse.FuncParser(func_name, f, parsing_ctx, self_type)
+ 76 # func_sig = func_sig_parser.parsed_func
+ 77 # params = [v.name for v in func_sig_parser.params]
+ 78 # is_generic = func_sig_parser.p_ctx.type_vars != {}
+ 79 if func_sig is None:
+ 80 func_sig = classinfo.parse_func_signature(f, func_globals, [])
+ 81
+ 82 func_sig_converted, sig_parser = parse.convert_func_signature(
+ 83 func_sig, func_name, props, func_globals, foreign_type_var_ns, {}, self_type)
+ 84 implicit_type_params = sig_parser.implicit_type_params
+ 85 implicit_generic_params: Set[hir.GenericParameter] = set()
+ 86 for p in implicit_type_params.values():
+ 87 assert isinstance(p, hir.SymbolicType)
+ 88 implicit_generic_params.add(p.param)
+ 89
+ 90 def parsing_func(args: hir.FunctionTemplateResolvingArgs) -> hir.Function:
+ 91 type_var_ns: Dict[TypeVar, hir.Type] = foreign_type_var_ns.copy()
+ 92 mapped_implicit_type_params: Dict[str,
+ 93 hir.Type] = dict()
+ 94 assert func_sig is not None
+ 95 type_parser = parse.TypeParser(
+ 96 func_name, func_globals, type_var_ns, self_type, 'instantiate')
+ 97 for (tv, t) in func_sig.env.items():
+ 98 type_var_ns[tv] = unwrap(type_parser.parse_type(t))
+ 99 if is_generic:
+100 mapping = hir.match_func_template_args(func_sig_converted, args)
+101 if isinstance(mapping, hir.TypeInferenceError):
+102 raise mapping
+103 if len(mapping) != len(func_sig_converted.generic_params):
+104 raise hir.TypeInferenceError(
+105 None, "not all type parameters are resolved")
+106 for p in func_sig_converted.generic_params:
+107 if p not in mapping:
+108 raise hir.TypeInferenceError(
+109 None, f"type parameter {p} is not resolved")
+110 if p not in implicit_generic_params:
+111 type_var_ns[sig_parser.generic_param_to_type_var[p]
+112 ] = mapping[p]
+113
+114 for name, itp, in implicit_type_params.items():
+115 assert isinstance(itp, hir.SymbolicType)
+116 gp = itp.param
+117 mapped_type = mapping[gp]
+118 assert isinstance(mapped_type, hir.Type)
+119 mapped_implicit_type_params[name] = mapped_type
+120
+121 func_sig_instantiated, _p = parse.convert_func_signature(
+122 func_sig, func_name, props, func_globals, type_var_ns, mapped_implicit_type_params, self_type, mode='instantiate')
+123 # print(func_name, func_sig)
+124 assert len(
+125 func_sig_instantiated.generic_params) == 0, f"generic params should be resolved but found {func_sig_instantiated.generic_params}"
+126 assert not isinstance(
+127 func_sig_instantiated.return_type, hir.SymbolicType)
+128 func_parser = parse.FuncParser(
+129 func_name, f, func_sig_instantiated, func_globals, type_var_ns, self_type, props.returning_ref)
+130 ret = func_parser.parse_body()
+131 ret.inline_hint = props.inline
+132 ret.export = props.export
+133 return ret
+134 params = [v[0] for v in func_sig.args]
+135 is_generic = len(func_sig_converted.generic_params) > 0
+136 # print(
+137 # f"func {func_name} is_generic: {is_generic} {func_sig_converted.generic_params}")
+138 return hir.FunctionTemplate(func_name, params, parsing_func, is_generic)
+139
+140
+141_TT = TypeVar('_TT')
+142
+143
+144def _dsl_func_impl(f: _TT, kind: _ObjKind, attrs: Dict[str, Any]) -> _TT:
+145 import sourceinspect
+146 assert inspect.isfunction(f), f"{f} is not a function"
+147 # print(hir.GlobalContext.get)
+148 ctx = hir.GlobalContext.get()
+149 func_name = get_full_name(f)
+150 func_globals: Any = getattr(f, "__globals__", {})
+151 props = _parse_func_kwargs(attrs)
+152 is_method = _is_method(f)
+153 setattr(f, '__luisa_func_props__', props)
+154 if is_method:
+155 return typing.cast(_TT, f)
+156 if kind == _ObjKind.FUNC:
+157 template = _make_func_template(
+158 f, func_name, None, func_globals, {}, props)
+159 ctx.functions[f] = template
+160 setattr(f, "__luisa_func__", template)
+161 return typing.cast(_TT, f)
+162 else:
+163 raise NotImplementedError()
+164 # return cast(_T, f)
+165
+166
+167_MakeTemplateFn = Callable[[List[hir.GenericParameter]], hir.Type]
+168_InstantiateFn = Callable[[List[hir.Type]], hir.Type]
+169
+170
+171def _dsl_struct_impl(cls: type[_TT], attrs: Dict[str, Any], ir_ty_override: hir.Type | Tuple[_MakeTemplateFn, _InstantiateFn] | None = None, opqaue_override: str | None = None) -> type[_TT]:
+172 ctx = hir.GlobalContext.get()
+173 register_class(cls)
+174 assert not (ir_ty_override is not None and opqaue_override is not None)
+175 cls_info = class_typeinfo(cls)
+176 globalns = _get_cls_globalns(cls)
+177 globalns[cls.__name__] = cls
+178 type_var_to_generic_param: Dict[TypeVar, hir.GenericParameter] = {}
+179 for type_var in cls_info.type_vars:
+180 type_var_to_generic_param[type_var] = hir.GenericParameter(
+181 type_var.__name__, cls.__qualname__)
+182 generic_params = [type_var_to_generic_param[tv]
+183 for tv in cls_info.type_vars]
+184
+185 def parse_fields(tp: parse.TypeParser, self_ty: hir.Type):
+186 fields: List[Tuple[str, hir.Type]] = []
+187 for name, field in cls_info.fields.items():
+188 field_ty = tp.parse_type(field)
+189 if field_ty is None:
+190 raise hir.TypeInferenceError(
+191 None, f"Cannot infer type for field {name} of {cls.__name__}")
+192 fields.append((name, field_ty))
+193 if len(fields) > 0:
+194 if isinstance(self_ty, hir.StructType):
+195 self_ty.fields = fields
+196 elif isinstance(self_ty, hir.BoundType):
+197 assert isinstance(self_ty.instantiated, hir.StructType)
+198 self_ty.instantiated.fields = fields
+199 else:
+200 raise NotImplementedError()
+201
+202 def parse_methods(type_var_ns: Dict[TypeVar, hir.Type | Any], self_ty: hir.Type,):
+203 for name in cls_info.methods:
+204 if name == '__setitem__': # __setitem__ is ignored deliberately
+205 continue
+206 method_object = getattr(cls, name)
+207 props: hir.FuncProperties
+208 if hasattr(method_object, '__luisa_func_props__'):
+209 props = getattr(method_object, '__luisa_func_props__')
+210 else:
+211 props = hir.FuncProperties()
+212 if name == '__getitem__':
+213 props.returning_ref = True
+214 template = _make_func_template(
+215 method_object, get_full_name(method_object), cls_info.methods[name], globalns, type_var_ns, props, self_type=self_ty)
+216 if isinstance(self_ty, hir.BoundType):
+217 assert isinstance(self_ty.instantiated,
+218 (hir.ArrayType, hir.StructType, hir.OpaqueType))
+219 self_ty.instantiated.methods[name] = template
+220 else:
+221 self_ty.methods[name] = template
+222 ir_ty: hir.Type
+223 if ir_ty_override is not None:
+224 if isinstance(ir_ty_override, hir.Type):
+225 ir_ty = ir_ty_override
+226 else:
+227 ir_ty = ir_ty_override[0](generic_params)
+228 elif opqaue_override is not None:
+229 ir_ty = hir.OpaqueType(opqaue_override)
+230 else:
+231 ir_ty = hir.StructType(
+232 f'{cls.__name__}_{unique_hash(cls.__qualname__)}', cls.__qualname__, [])
+233 type_parser = parse.TypeParser(
+234 cls.__qualname__, globalns, {}, ir_ty, 'parse')
+235
+236 parse_fields(type_parser, ir_ty)
+237 is_generic = len(cls_info.type_vars) > 0
+238 if is_generic:
+239 def monomorphization_func(args: List[hir.Type]) -> hir.Type:
+240 assert isinstance(ir_ty, hir.ParametricType)
+241 type_var_ns = {}
+242 if len(args) != len(cls_info.type_vars):
+243 raise hir.TypeInferenceError(
+244 None, f"Expected {len(cls_info.type_vars)} type arguments but got {len(args)}")
+245 for i, arg in enumerate(args):
+246 type_var_ns[cls_info.type_vars[i]] = arg
+247 hash_s = unique_hash(f'{cls.__qualname__}_{args}')
+248 inner_ty: hir.Type
+249 if ir_ty_override is not None:
+250 assert isinstance(ir_ty_override, tuple)
+251 inner_ty = ir_ty_override[1](args)
+252 elif opqaue_override:
+253 inner_ty = hir.OpaqueType(opqaue_override, args[:])
+254 else:
+255 inner_ty = hir.StructType(
+256 f'{cls.__name__}_{hash_s}M', f'{cls.__qualname__}[{",".join([str(a) for a in args])}]', [])
+257 mono_self_ty = hir.BoundType(ir_ty, args, inner_ty)
+258 mono_type_parser = parse.TypeParser(
+259 cls.__qualname__, globalns, type_var_ns, mono_self_ty, 'instantiate')
+260 parse_fields(mono_type_parser, mono_self_ty)
+261 parse_methods(type_var_ns, mono_self_ty)
+262 return inner_ty
+263 ir_ty = hir.ParametricType(
+264 list(type_var_to_generic_param.values()), ir_ty, monomorphization_func)
+265 else:
+266 pass
+267 ctx.types[cls] = ir_ty
+268 if not is_generic:
+269 parse_methods({}, ir_ty)
+270 return cls
+271
+272
+273def _dsl_decorator_impl(obj: _TT, kind: _ObjKind, attrs: Dict[str, Any]) -> _TT:
+274 if kind == _ObjKind.STRUCT:
+275 assert isinstance(obj, type), f"{obj} is not a type"
+276 return typing.cast(_TT, _dsl_struct_impl(obj, attrs))
+277 elif kind == _ObjKind.FUNC or kind == _ObjKind.KERNEL:
+278 return _dsl_func_impl(obj, kind, attrs)
+279 raise NotImplementedError()
+280
+281
+282def opaque(name: str) -> Callable[[type[_TT]], type[_TT]]:
+283 """
+284 Mark a class as a DSL opaque type.
+285
+286 Example:
+287 ```python
+288 @luisa.opaque("Buffer")
+289 class Buffer(Generic[T]):
+290 pass
+291 ```
+292 """
+293 def wrapper(cls: type[_TT]) -> type[_TT]:
+294 return _dsl_struct_impl(cls, {}, opqaue_override=name)
+295 return wrapper
+296
+297
+298def struct(cls: type[_TT]) -> type[_TT]:
+299 """
+300 Mark a class as a DSL struct.
+301
+302 Example:
+303 ```python
+304 @luisa.struct
+305 class Sphere:
+306 center: luisa.float3
+307 radius: luisa.float
+308
+309 def volume(self) -> float:
+310 return 4.0 / 3.0 * math.pi * self.radius ** 3
+311 ```
+312 """
+313 return _dsl_decorator_impl(cls, _ObjKind.STRUCT, {})
+314
+315
+316def builtin_type(ty: hir.Type, *args, **kwargs) -> Callable[[type[_TT]], type[_TT]]:
+317 def decorator(cls: type[_TT]) -> type[_TT]:
+318 return typing.cast(type[_TT], _dsl_struct_impl(cls, {}, ir_ty_override=ty))
+319 return decorator
+320
+321
+322def builtin_generic_type(make_template: _MakeTemplateFn, instantiate: _InstantiateFn) -> Callable[[type[_TT]], type[_TT]]:
+323 def decorator(cls: type[_TT]) -> type[_TT]:
+324 return typing.cast(type[_TT], _dsl_struct_impl(cls, {}, ir_ty_override=(make_template, instantiate)))
+325 return decorator
+326
+327
+328_KernelType = TypeVar("_KernelType", bound=Callable[..., None])
+329
+330
+331@overload
+332def kernel(f: _KernelType) -> _KernelType: ...
+333
+334
+335@overload
+336def kernel(export: bool = False, **kwargs) -> Callable[[
+337 _KernelType], _KernelType]: ...
+338
+339
+340def kernel(*args, **kwargs) -> _KernelType | Callable[[_KernelType], _KernelType]:
+341 if len(args) == 1 and len(kwargs) == 0:
+342 f = args[0]
+343 return f
+344
+345 def decorator(f):
+346 return f
+347
+348 return decorator
+349
+350
+351class InoutMarker:
+352 value: str
+353
+354 def __init__(self, value: str):
+355 self.value = value
+356
+357
+358def _parse_func_kwargs(kwargs: Dict[str, Any]) -> hir.FuncProperties:
+359 props = hir.FuncProperties()
+360 props.byref = set()
+361 return_ = kwargs.get("return", None)
+362 if return_ is not None:
+363 if return_ == 'ref':
+364 props.returning_ref = True
+365 else:
+366 raise ValueError(
+367 f"invalid value for return: {return_}, expected 'ref'")
+368 inline = kwargs.get("inline", False)
+369 if isinstance(inline, bool):
+370 props.inline = inline
+371 elif inline == "always":
+372 props.inline = "always"
+373 else:
+374 raise ValueError(f"invalid value for inline: {inline}")
+375
+376 props.export = kwargs.get("export", False)
+377 if not isinstance(props.export, bool):
+378 raise ValueError(f"export should be a bool")
+379
+380 for k, v in kwargs.items():
+381 if k not in ["inline", "export"]:
+382 if v is byref:
+383 props.byref.add(k)
+384 return props
+385
+386
+387@overload
+388def func(f: _F) -> _F: ...
+389
+390
+391@overload
+392def func(**kwargs) -> Callable[[_F], _F]: ...
+393
+394
+395def func(*args, **kwargs) -> _F | Callable[[_F], _F]:
+396 """
+397 Mark a function as a DSL function.
+398 To mark an argument as byref, use the `var=byref` syntax in decorator arguments.
+399 Acceptable kwargs:
+400 - inline: bool | "always" # hint for inlining
+401 - export: bool # hint for exporting (for bundled C++ codegen)
+402
+403 Example:
+404 ```python
+405 @luisa.func(a=byref, b=byref)
+406 def swap(a: int, b: int):
+407 a, b = b, a
+408 ```
+409 """
+410
+411 def impl(f: _F) -> _F:
+412 return _dsl_decorator_impl(f, _ObjKind.FUNC, kwargs)
+413
+414 if len(args) == 1 and len(kwargs) == 0:
+415 f = args[0]
+416 return impl(f)
+417
+418 def decorator(f):
+419 return impl(f)
+420
+421 return decorator
+
41def byval(value: T) -> T:
+42 """pass a value by value, this is only a marker and should not be called"""
+43
+44 raise NotImplementedError(
+45 "byval should not be called in host-side Python code. "
+46 "Did you mistakenly called a DSL function?"
+47 )
+
50def byref(value: T) -> T:
+51 """pass a value by ref, this is only a marker and should not be called"""
+52
+53 raise NotImplementedError(
+54 "byref should not be called in host-side Python code. "
+55 "Did you mistakenly called a DSL function?"
+56 )
+
283def opaque(name: str) -> Callable[[type[_TT]], type[_TT]]:
+284 """
+285 Mark a class as a DSL opaque type.
+286
+287 Example:
+288 ```python
+289 @luisa.opaque("Buffer")
+290 class Buffer(Generic[T]):
+291 pass
+292 ```
+293 """
+294 def wrapper(cls: type[_TT]) -> type[_TT]:
+295 return _dsl_struct_impl(cls, {}, opqaue_override=name)
+296 return wrapper
+
+@luisa.opaque("Buffer")
+class Buffer(Generic[T]):
+ pass
+
299def struct(cls: type[_TT]) -> type[_TT]:
+300 """
+301 Mark a class as a DSL struct.
+302
+303 Example:
+304 ```python
+305 @luisa.struct
+306 class Sphere:
+307 center: luisa.float3
+308 radius: luisa.float
+309
+310 def volume(self) -> float:
+311 return 4.0 / 3.0 * math.pi * self.radius ** 3
+312 ```
+313 """
+314 return _dsl_decorator_impl(cls, _ObjKind.STRUCT, {})
+
+@luisa.struct
+class Sphere:
+ center: luisa.float3
+ radius: luisa.float
+
+ def volume(self) -> float:
+ return 4.0 / 3.0 * math.pi * self.radius ** 3
+
323def builtin_generic_type(make_template: _MakeTemplateFn, instantiate: _InstantiateFn) -> Callable[[type[_TT]], type[_TT]]:
+324 def decorator(cls: type[_TT]) -> type[_TT]:
+325 return typing.cast(type[_TT], _dsl_struct_impl(cls, {}, ir_ty_override=(make_template, instantiate)))
+326 return decorator
+
352class InoutMarker:
+353 value: str
+354
+355 def __init__(self, value: str):
+356 self.value = value
+
396def func(*args, **kwargs) -> _F | Callable[[_F], _F]:
+397 """
+398 Mark a function as a DSL function.
+399 To mark an argument as byref, use the `var=byref` syntax in decorator arguments.
+400 Acceptable kwargs:
+401 - inline: bool | "always" # hint for inlining
+402 - export: bool # hint for exporting (for bundled C++ codegen)
+403
+404 Example:
+405 ```python
+406 @luisa.func(a=byref, b=byref)
+407 def swap(a: int, b: int):
+408 a, b = b, a
+409 ```
+410 """
+411
+412 def impl(f: _F) -> _F:
+413 return _dsl_decorator_impl(f, _ObjKind.FUNC, kwargs)
+414
+415 if len(args) == 1 and len(kwargs) == 0:
+416 f = args[0]
+417 return impl(f)
+418
+419 def decorator(f):
+420 return impl(f)
+421
+422 return decorator
+
var=byref
syntax in decorator arguments.
+Acceptable kwargs:
+
+
+
+@luisa.func(a=byref, b=byref)
+def swap(a: int, b: int):
+ a, b = b, a
+
+luisa_lang
+
+
+
+
+
+
+ 1import inspect
+ 2from types import NoneType
+ 3import types
+ 4import typing
+ 5from typing import (
+ 6 Any,
+ 7 Callable,
+ 8 List,
+ 9 Literal,
+ 10 Optional,
+ 11 Set,
+ 12 Tuple,
+ 13 TypeVar,
+ 14 Generic,
+ 15 Dict,
+ 16 Type,
+ 17 Union,
+ 18)
+ 19import functools
+ 20from dataclasses import dataclass
+ 21
+ 22
+ 23class GenericInstance:
+ 24 origin: type
+ 25 args: List["VarType"]
+ 26
+ 27 def __init__(self, origin: type, args: List["VarType"]):
+ 28 self.origin = origin
+ 29 self.args = args
+ 30
+ 31 def __repr__(self):
+ 32 return f"{self.origin}[{', '.join(map(repr, self.args))}]"
+ 33
+ 34
+ 35class UnionType:
+ 36 types: List["VarType"]
+ 37
+ 38 def __init__(self, types: List["VarType"]):
+ 39 self.types = types
+ 40
+ 41 def __repr__(self):
+ 42 return f"Union[{', '.join(map(repr, self.types))}]"
+ 43
+ 44
+ 45class AnyType:
+ 46 def __repr__(self):
+ 47 return "Any"
+ 48
+ 49 def __eq__(self, other):
+ 50 return isinstance(other, AnyType)
+ 51
+ 52
+ 53class SelfType:
+ 54 def __repr__(self):
+ 55 return "Self"
+ 56
+ 57 def __eq__(self, other):
+ 58 return isinstance(other, SelfType)
+ 59
+ 60class LiteralType:
+ 61 value: Any
+ 62
+ 63 def __init__(self, value: Any):
+ 64 self.value = value
+ 65
+ 66 def __repr__(self):
+ 67 return f"Literal[{self.value}]"
+ 68
+ 69 def __eq__(self, other):
+ 70 return isinstance(other, LiteralType) and self.value == other.value
+ 71
+ 72
+ 73VarType = Union[TypeVar, Type, GenericInstance, UnionType, SelfType, AnyType, LiteralType]
+ 74
+ 75
+ 76def subst_type(ty: VarType, env: Dict[TypeVar, VarType]) -> VarType:
+ 77 match ty:
+ 78 case TypeVar():
+ 79 return env.get(ty, ty)
+ 80 case GenericInstance(origin=origin, args=args):
+ 81 return GenericInstance(origin, [subst_type(arg, env) for arg in args])
+ 82 case _:
+ 83 return ty
+ 84
+ 85
+ 86class MethodType:
+ 87 type_vars: List[TypeVar]
+ 88 args: List[Tuple[str, VarType]]
+ 89 return_type: VarType
+ 90 env: Dict[TypeVar, VarType]
+ 91 is_static: bool
+ 92
+ 93 def __init__(
+ 94 self, type_vars: List[TypeVar], args: List[Tuple[str, VarType]], return_type: VarType, env: Optional[Dict[TypeVar, VarType]] = None, is_static: bool = False
+ 95 ):
+ 96 self.type_vars = type_vars
+ 97 self.args = args
+ 98 self.return_type = return_type
+ 99 self.env = env or {}
+100 self.is_static = is_static
+101
+102 def __repr__(self):
+103 # [a, b, c](x: T, y: U) -> V
+104 return f"[{', '.join(map(repr, self.type_vars))}]({', '.join(map(repr, self.args))}) -> {self.return_type}"
+105
+106 def substitute(self, env: Dict[TypeVar, VarType]) -> "MethodType":
+107 return MethodType([], [(arg[0], subst_type(arg[1], env)) for arg in self.args], subst_type(self.return_type, env), env)
+108
+109
+110class ClassType:
+111 type_vars: List[TypeVar]
+112 fields: Dict[str, VarType]
+113 methods: Dict[str, MethodType]
+114
+115 def __init__(
+116 self,
+117 type_vars: List[TypeVar],
+118 fields: Dict[str, VarType],
+119 methods: Dict[str, MethodType],
+120 ):
+121 self.type_vars = type_vars
+122 self.fields = fields
+123 self.methods = methods
+124
+125 def __repr__(self):
+126 # class[T, U]:
+127 # a: T
+128 # b: U
+129 # def foo(x: T, y: U) -> V
+130 return (
+131 f"class[{', '.join(map(repr, self.type_vars))}]:\n"
+132 + "\n".join(f" {name}: {type}" for name,
+133 type in self.fields.items())
+134 + "\n"
+135 + "\n".join(
+136 f" def {name}{method}" for name, method in self.methods.items()
+137 )
+138 )
+139
+140 def instantiate(self, type_args: List[VarType]) -> "ClassType":
+141 if len(type_args) != len(self.type_vars):
+142 raise RuntimeError(
+143 f"Expected {len(self.type_vars)} type arguments but got {len(type_args)}"
+144 )
+145 env = dict(zip(self.type_vars, type_args))
+146 return ClassType(
+147 [], {name: subst_type(ty, env) for name, ty in self.fields.items()}, {
+148 name: method.substitute(env) for name, method in self.methods.items()}
+149 )
+150
+151
+152_CLS_TYPE_INFO: Dict[type, ClassType] = {}
+153
+154
+155def class_typeinfo(cls: type) -> ClassType:
+156 if cls in _CLS_TYPE_INFO:
+157 return _CLS_TYPE_INFO[cls]
+158 raise RuntimeError(f"Class {cls} is not registered.")
+159
+160
+161def _is_class_registered(cls: type) -> bool:
+162 return cls in _CLS_TYPE_INFO
+163
+164
+165_BUILTIN_ANNOTATION_BASES = set([typing.Generic, typing.Protocol, object])
+166
+167
+168def _get_base_classinfo(cls: type, globalns) -> List[tuple[str, ClassType]]:
+169 if not hasattr(cls, "__orig_bases__"):
+170 return []
+171 info = []
+172 for base in cls.__orig_bases__:
+173 if hasattr(base, "__origin__"):
+174 base_params = []
+175 base_orig = base.__origin__
+176 if not _is_class_registered(base_orig) and base_orig not in _BUILTIN_ANNOTATION_BASES:
+177 raise RuntimeError(
+178 f"Base class {base_orig} of {cls} is not registered."
+179 )
+180 for arg in base.__args__:
+181 if isinstance(arg, typing.ForwardRef):
+182 arg: type = typing._eval_type( # type: ignore
+183 arg, globalns, globalns) # type: ignore
+184 base_params.append(arg)
+185 if base_orig in _BUILTIN_ANNOTATION_BASES:
+186 pass
+187 else:
+188 base_info = class_typeinfo(base_orig)
+189 info.append(
+190 (base.__name__, base_info.instantiate(base_params)))
+191 else:
+192 if _is_class_registered(base):
+193 info.append((base.__name__, class_typeinfo(base)))
+194 return info
+195
+196
+197def _get_cls_globalns(cls: type) -> Dict[str, Any]:
+198 module = inspect.getmodule(cls)
+199 assert module is not None
+200 return module.__dict__
+201
+202
+203def parse_type_hint(hint: Any) -> VarType:
+204 # print(hint, type(hint))
+205 if hint is None:
+206 return NoneType
+207 if isinstance(hint, TypeVar):
+208 return hint
+209 if isinstance(hint, types.UnionType):
+210 return UnionType([parse_type_hint(arg) for arg in hint.__args__])
+211 if hint is typing.Any:
+212 return AnyType()
+213 origin = typing.get_origin(hint)
+214 if origin:
+215 if isinstance(origin, type):
+216 # assert isinstance(origin, type), f"origin must be a type but got {origin}"
+217 args = list(typing.get_args(hint))
+218 return GenericInstance(origin, [parse_type_hint(arg) for arg in args])
+219 elif origin is Union:
+220 return UnionType([parse_type_hint(arg) for arg in typing.get_args(hint)])
+221 elif origin is Literal:
+222 return LiteralType(typing.get_args(hint)[0])
+223 else:
+224 raise RuntimeError(f"Unsupported origin type: {origin}")
+225
+226 if isinstance(hint, type):
+227 return hint
+228 if hint == typing.Self:
+229 return SelfType()
+230 raise RuntimeError(f"Unsupported type hint: {hint}")
+231
+232
+233def extract_type_vars_from_hint(hint: typing.Any) -> List[TypeVar]:
+234 if isinstance(hint, TypeVar):
+235 return [hint]
+236 if hasattr(hint, "__args__"): # Handle custom generic types like Foo[T]
+237 type_vars = []
+238 for arg in hint.__args__:
+239 type_vars.extend(extract_type_vars_from_hint(arg))
+240 return type_vars
+241 return []
+242
+243
+244def get_type_vars(func: typing.Callable) -> List[TypeVar]:
+245 type_hints = typing.get_type_hints(func)
+246 type_vars = []
+247 for hint in type_hints.values():
+248 type_vars.extend(extract_type_vars_from_hint(hint))
+249 return list(set(type_vars)) # Return unique type vars
+250
+251
+252def parse_func_signature(func: object, globalns: Dict[str, Any], foreign_type_vars: List[TypeVar], is_static: bool = False) -> MethodType:
+253 assert inspect.isfunction(func)
+254 signature = inspect.signature(func)
+255 method_type_hints = typing.get_type_hints(func, globalns)
+256 param_types: List[Tuple[str, VarType]] = []
+257 type_vars = get_type_vars(func)
+258 for param in signature.parameters.values():
+259 if param.name == "self":
+260 param_types.append((param.name, SelfType()))
+261 elif param.name in method_type_hints:
+262 param_types.append((param.name, parse_type_hint(
+263 method_type_hints[param.name])))
+264 else:
+265 param_types.append((param.name, AnyType()))
+266 if "return" in method_type_hints:
+267 return_type = parse_type_hint(method_type_hints.get("return"))
+268 else:
+269 return_type = AnyType()
+270 # remove foreign type vars from type_vars
+271 type_vars = [tv for tv in type_vars if tv not in foreign_type_vars]
+272 return MethodType(type_vars, param_types, return_type, is_static=is_static)
+273
+274
+275def is_static(cls: type, method_name: str) -> bool:
+276 method = getattr(cls, method_name, None)
+277 if method is None:
+278 return False
+279 # Using inspect to retrieve the method directly from the class
+280 method = cls.__dict__.get(method_name, None)
+281 return isinstance(method, staticmethod)
+282
+283
+284def register_class(cls: type) -> None:
+285 cls_qualname = cls.__qualname__
+286 globalns = _get_cls_globalns(cls)
+287 globalns[cls.__name__] = cls
+288 assert (
+289 "<locals>" not in cls_qualname
+290 ), f"Cannot use local class {cls_qualname} as a DSL type. Must be a top-level class!"
+291
+292 origin = typing.get_origin(cls)
+293 type_args: List[Type]
+294 type_vars: Any
+295 if origin:
+296 type_hints = typing.get_type_hints(origin, globalns)
+297 type_args = list(typing.get_args(cls))
+298 type_vars = getattr(origin, "__parameters__", None)
+299 else:
+300 type_hints = typing.get_type_hints(cls, globalns)
+301 type_args = []
+302 type_vars = getattr(cls, "__parameters__", None)
+303 assert type_args == []
+304 assert not type_vars or isinstance(type_vars, tuple), type_vars
+305 # print(type_hints)
+306 # if hasattr(cls, "__orig_bases__"):
+307 # print(cls.__base__)
+308 # print(cls.__orig_bases__)
+309 base_infos = _get_base_classinfo(cls, globalns)
+310
+311 base_fields: Set[str] = set()
+312 base_methods: Set[str] = set()
+313
+314 for _base_name, base_info in base_infos:
+315 base_fields.update(base_info.fields.keys())
+316 base_methods.update(base_info.methods.keys())
+317
+318 local_fields: Set[str] = set()
+319 local_methods: Set[str] = set()
+320 for name, hint in type_hints.items():
+321 if name in base_fields:
+322 continue
+323 local_fields.add(name)
+324 for name, member in inspect.getmembers(cls, inspect.isfunction):
+325 if name in base_methods:
+326 continue
+327 local_methods.add(name)
+328
+329 cls_ty = ClassType([], {}, {})
+330 for _base_name, base_info in base_infos:
+331 cls_ty.fields.update(base_info.fields)
+332 cls_ty.methods.update(base_info.methods)
+333
+334 if type_vars:
+335 for tv in type_vars:
+336 cls_ty.type_vars.append(tv)
+337 for name, member in inspect.getmembers(cls):
+338 if name in local_methods:
+339 # print(f'Found local method: {name} in {cls}')
+340 cls_ty.methods[name] = parse_func_signature(
+341 member, globalns, cls_ty.type_vars, is_static=is_static(cls, name))
+342 for name in local_fields:
+343 cls_ty.fields[name] = parse_type_hint(type_hints[name])
+344 _CLS_TYPE_INFO[cls] = cls_ty
+
24class GenericInstance:
+25 origin: type
+26 args: List["VarType"]
+27
+28 def __init__(self, origin: type, args: List["VarType"]):
+29 self.origin = origin
+30 self.args = args
+31
+32 def __repr__(self):
+33 return f"{self.origin}[{', '.join(map(repr, self.args))}]"
+
36class UnionType:
+37 types: List["VarType"]
+38
+39 def __init__(self, types: List["VarType"]):
+40 self.types = types
+41
+42 def __repr__(self):
+43 return f"Union[{', '.join(map(repr, self.types))}]"
+
61class LiteralType:
+62 value: Any
+63
+64 def __init__(self, value: Any):
+65 self.value = value
+66
+67 def __repr__(self):
+68 return f"Literal[{self.value}]"
+69
+70 def __eq__(self, other):
+71 return isinstance(other, LiteralType) and self.value == other.value
+
87class MethodType:
+ 88 type_vars: List[TypeVar]
+ 89 args: List[Tuple[str, VarType]]
+ 90 return_type: VarType
+ 91 env: Dict[TypeVar, VarType]
+ 92 is_static: bool
+ 93
+ 94 def __init__(
+ 95 self, type_vars: List[TypeVar], args: List[Tuple[str, VarType]], return_type: VarType, env: Optional[Dict[TypeVar, VarType]] = None, is_static: bool = False
+ 96 ):
+ 97 self.type_vars = type_vars
+ 98 self.args = args
+ 99 self.return_type = return_type
+100 self.env = env or {}
+101 self.is_static = is_static
+102
+103 def __repr__(self):
+104 # [a, b, c](x: T, y: U) -> V
+105 return f"[{', '.join(map(repr, self.type_vars))}]({', '.join(map(repr, self.args))}) -> {self.return_type}"
+106
+107 def substitute(self, env: Dict[TypeVar, VarType]) -> "MethodType":
+108 return MethodType([], [(arg[0], subst_type(arg[1], env)) for arg in self.args], subst_type(self.return_type, env), env)
+
94 def __init__(
+ 95 self, type_vars: List[TypeVar], args: List[Tuple[str, VarType]], return_type: VarType, env: Optional[Dict[TypeVar, VarType]] = None, is_static: bool = False
+ 96 ):
+ 97 self.type_vars = type_vars
+ 98 self.args = args
+ 99 self.return_type = return_type
+100 self.env = env or {}
+101 self.is_static = is_static
+
111class ClassType:
+112 type_vars: List[TypeVar]
+113 fields: Dict[str, VarType]
+114 methods: Dict[str, MethodType]
+115
+116 def __init__(
+117 self,
+118 type_vars: List[TypeVar],
+119 fields: Dict[str, VarType],
+120 methods: Dict[str, MethodType],
+121 ):
+122 self.type_vars = type_vars
+123 self.fields = fields
+124 self.methods = methods
+125
+126 def __repr__(self):
+127 # class[T, U]:
+128 # a: T
+129 # b: U
+130 # def foo(x: T, y: U) -> V
+131 return (
+132 f"class[{', '.join(map(repr, self.type_vars))}]:\n"
+133 + "\n".join(f" {name}: {type}" for name,
+134 type in self.fields.items())
+135 + "\n"
+136 + "\n".join(
+137 f" def {name}{method}" for name, method in self.methods.items()
+138 )
+139 )
+140
+141 def instantiate(self, type_args: List[VarType]) -> "ClassType":
+142 if len(type_args) != len(self.type_vars):
+143 raise RuntimeError(
+144 f"Expected {len(self.type_vars)} type arguments but got {len(type_args)}"
+145 )
+146 env = dict(zip(self.type_vars, type_args))
+147 return ClassType(
+148 [], {name: subst_type(ty, env) for name, ty in self.fields.items()}, {
+149 name: method.substitute(env) for name, method in self.methods.items()}
+150 )
+
141 def instantiate(self, type_args: List[VarType]) -> "ClassType":
+142 if len(type_args) != len(self.type_vars):
+143 raise RuntimeError(
+144 f"Expected {len(self.type_vars)} type arguments but got {len(type_args)}"
+145 )
+146 env = dict(zip(self.type_vars, type_args))
+147 return ClassType(
+148 [], {name: subst_type(ty, env) for name, ty in self.fields.items()}, {
+149 name: method.substitute(env) for name, method in self.methods.items()}
+150 )
+
204def parse_type_hint(hint: Any) -> VarType:
+205 # print(hint, type(hint))
+206 if hint is None:
+207 return NoneType
+208 if isinstance(hint, TypeVar):
+209 return hint
+210 if isinstance(hint, types.UnionType):
+211 return UnionType([parse_type_hint(arg) for arg in hint.__args__])
+212 if hint is typing.Any:
+213 return AnyType()
+214 origin = typing.get_origin(hint)
+215 if origin:
+216 if isinstance(origin, type):
+217 # assert isinstance(origin, type), f"origin must be a type but got {origin}"
+218 args = list(typing.get_args(hint))
+219 return GenericInstance(origin, [parse_type_hint(arg) for arg in args])
+220 elif origin is Union:
+221 return UnionType([parse_type_hint(arg) for arg in typing.get_args(hint)])
+222 elif origin is Literal:
+223 return LiteralType(typing.get_args(hint)[0])
+224 else:
+225 raise RuntimeError(f"Unsupported origin type: {origin}")
+226
+227 if isinstance(hint, type):
+228 return hint
+229 if hint == typing.Self:
+230 return SelfType()
+231 raise RuntimeError(f"Unsupported type hint: {hint}")
+
234def extract_type_vars_from_hint(hint: typing.Any) -> List[TypeVar]:
+235 if isinstance(hint, TypeVar):
+236 return [hint]
+237 if hasattr(hint, "__args__"): # Handle custom generic types like Foo[T]
+238 type_vars = []
+239 for arg in hint.__args__:
+240 type_vars.extend(extract_type_vars_from_hint(arg))
+241 return type_vars
+242 return []
+
253def parse_func_signature(func: object, globalns: Dict[str, Any], foreign_type_vars: List[TypeVar], is_static: bool = False) -> MethodType:
+254 assert inspect.isfunction(func)
+255 signature = inspect.signature(func)
+256 method_type_hints = typing.get_type_hints(func, globalns)
+257 param_types: List[Tuple[str, VarType]] = []
+258 type_vars = get_type_vars(func)
+259 for param in signature.parameters.values():
+260 if param.name == "self":
+261 param_types.append((param.name, SelfType()))
+262 elif param.name in method_type_hints:
+263 param_types.append((param.name, parse_type_hint(
+264 method_type_hints[param.name])))
+265 else:
+266 param_types.append((param.name, AnyType()))
+267 if "return" in method_type_hints:
+268 return_type = parse_type_hint(method_type_hints.get("return"))
+269 else:
+270 return_type = AnyType()
+271 # remove foreign type vars from type_vars
+272 type_vars = [tv for tv in type_vars if tv not in foreign_type_vars]
+273 return MethodType(type_vars, param_types, return_type, is_static=is_static)
+
276def is_static(cls: type, method_name: str) -> bool:
+277 method = getattr(cls, method_name, None)
+278 if method is None:
+279 return False
+280 # Using inspect to retrieve the method directly from the class
+281 method = cls.__dict__.get(method_name, None)
+282 return isinstance(method, staticmethod)
+
285def register_class(cls: type) -> None:
+286 cls_qualname = cls.__qualname__
+287 globalns = _get_cls_globalns(cls)
+288 globalns[cls.__name__] = cls
+289 assert (
+290 "<locals>" not in cls_qualname
+291 ), f"Cannot use local class {cls_qualname} as a DSL type. Must be a top-level class!"
+292
+293 origin = typing.get_origin(cls)
+294 type_args: List[Type]
+295 type_vars: Any
+296 if origin:
+297 type_hints = typing.get_type_hints(origin, globalns)
+298 type_args = list(typing.get_args(cls))
+299 type_vars = getattr(origin, "__parameters__", None)
+300 else:
+301 type_hints = typing.get_type_hints(cls, globalns)
+302 type_args = []
+303 type_vars = getattr(cls, "__parameters__", None)
+304 assert type_args == []
+305 assert not type_vars or isinstance(type_vars, tuple), type_vars
+306 # print(type_hints)
+307 # if hasattr(cls, "__orig_bases__"):
+308 # print(cls.__base__)
+309 # print(cls.__orig_bases__)
+310 base_infos = _get_base_classinfo(cls, globalns)
+311
+312 base_fields: Set[str] = set()
+313 base_methods: Set[str] = set()
+314
+315 for _base_name, base_info in base_infos:
+316 base_fields.update(base_info.fields.keys())
+317 base_methods.update(base_info.methods.keys())
+318
+319 local_fields: Set[str] = set()
+320 local_methods: Set[str] = set()
+321 for name, hint in type_hints.items():
+322 if name in base_fields:
+323 continue
+324 local_fields.add(name)
+325 for name, member in inspect.getmembers(cls, inspect.isfunction):
+326 if name in base_methods:
+327 continue
+328 local_methods.add(name)
+329
+330 cls_ty = ClassType([], {}, {})
+331 for _base_name, base_info in base_infos:
+332 cls_ty.fields.update(base_info.fields)
+333 cls_ty.methods.update(base_info.methods)
+334
+335 if type_vars:
+336 for tv in type_vars:
+337 cls_ty.type_vars.append(tv)
+338 for name, member in inspect.getmembers(cls):
+339 if name in local_methods:
+340 # print(f'Found local method: {name} in {cls}')
+341 cls_ty.methods[name] = parse_func_signature(
+342 member, globalns, cls_ty.type_vars, is_static=is_static(cls, name))
+343 for name in local_fields:
+344 cls_ty.fields[name] = parse_type_hint(type_hints[name])
+345 _CLS_TYPE_INFO[cls] = cls_ty
+
+luisa_lang
+
+
+
+
+
+
+ 1from luisa_lang.codegen.base import *
+
+luisa_lang
+
+
+
+
+
+
+ 1class CodeGen:
+ 2 pass
+ 3
+ 4
+ 5class ScratchBuffer:
+ 6 body: str
+ 7 indent: int
+ 8
+ 9 def __init__(self, indent: int = 0):
+10 self.body = ""
+11 self.indent = indent
+12
+13 def writeln(self, line: str):
+14 self.body += " " * self.indent * 4 + line + "\n"
+15
+16 def write(self, line: str):
+17 self.body += " " * self.indent * 4 + line
+18
+19 def __str__(self):
+20 return self.body
+21
+22 def merge(self, other: "ScratchBuffer"):
+23 self.body += other.body
+
6class ScratchBuffer:
+ 7 body: str
+ 8 indent: int
+ 9
+10 def __init__(self, indent: int = 0):
+11 self.body = ""
+12 self.indent = indent
+13
+14 def writeln(self, line: str):
+15 self.body += " " * self.indent * 4 + line + "\n"
+16
+17 def write(self, line: str):
+18 self.body += " " * self.indent * 4 + line
+19
+20 def __str__(self):
+21 return self.body
+22
+23 def merge(self, other: "ScratchBuffer"):
+24 self.body += other.body
+
+luisa_lang
+
+
+
+
+
+
+ 1from functools import cache
+ 2from luisa_lang import hir
+ 3from luisa_lang.utils import unique_hash, unwrap
+ 4from luisa_lang.codegen import CodeGen, ScratchBuffer
+ 5from typing import Any, Callable, Dict, Optional, Set, Tuple, Union
+ 6
+ 7from luisa_lang.hir import get_dsl_func
+ 8
+ 9
+ 10@cache
+ 11def _get_cpp_lib() -> str:
+ 12 from luisa_lang.codegen.cpp_lib import CPP_LIB_COMPRESSED
+ 13 import bz2
+ 14 import base64
+ 15 return bz2.decompress(base64.b64decode(CPP_LIB_COMPRESSED)).decode('utf-8')
+ 16
+ 17
+ 18class TypeCodeGenCache:
+ 19 cache: Dict[hir.Type, str]
+ 20 impl: ScratchBuffer
+ 21
+ 22 def __init__(self) -> None:
+ 23 self.cache = {}
+ 24 self.impl = ScratchBuffer(0)
+ 25
+ 26 def gen(self, ty: hir.Type) -> str:
+ 27 if ty in self.cache:
+ 28 return self.cache[ty]
+ 29 else:
+ 30 res = self.gen_impl(ty)
+ 31 self.cache[ty] = res
+ 32 return res
+ 33
+ 34 def gen_impl(self, ty: hir.Type) -> str:
+ 35 match ty:
+ 36 case hir.IntType(bits=bits, signed=signed):
+ 37 int_names = {
+ 38 '8':'byte',
+ 39 '16':'short',
+ 40 '32':'int',
+ 41 '64':'long',
+ 42 }
+ 43 if signed:
+ 44 return f"lc_{int_names[str(bits)]}"
+ 45 else:
+ 46 return f"lc_u{int_names[str(bits)]}"
+ 47 case hir.FloatType(bits=bits):
+ 48 match bits:
+ 49 case 16:
+ 50 return 'lc_half'
+ 51 case 32:
+ 52 return 'lc_float'
+ 53 case 64:
+ 54 return 'lc_double'
+ 55 case _:
+ 56 raise RuntimeError("invalid float type")
+ 57 case hir.BoolType():
+ 58 return "lc_bool"
+ 59 case hir.PointerType(element=element):
+ 60 return f"lc_ptr<{self.gen(element)}>"
+ 61 case hir.VectorType(element=element, count=count):
+ 62 return f"{self.gen(element)}{count}>"
+ 63 case hir.ArrayType(element=element, count=count):
+ 64 return f"lc_array<{self.gen(element)}, {count}>"
+ 65 case hir.StructType(name=name, fields=fields):
+ 66 self.impl.writeln(f'struct {name} {{')
+ 67 for field in fields:
+ 68 self.impl.writeln(f' {self.gen(field[1])} {field[0]};')
+ 69 self.impl.writeln('};')
+ 70 return name
+ 71 case hir.UnitType():
+ 72 return 'void'
+ 73 case hir.TupleType():
+ 74 def do():
+ 75 elements = [self.gen(e) for e in ty.elements]
+ 76 name = f'Tuple_{unique_hash("".join(elements))}'
+ 77 self.impl.writeln(f'struct {name} {{')
+ 78 for i, element in enumerate(elements):
+ 79 self.impl.writeln(f' {element} _{i};')
+ 80 self.impl.writeln('};')
+ 81 return name
+ 82 return do()
+ 83 case hir.BoundType():
+ 84 assert ty.instantiated
+ 85 return self.gen(ty.instantiated)
+ 86 case hir.FunctionType():
+ 87 name = f'func_{unique_hash(ty.func_like.name)}_t'
+ 88 self.impl.writeln(f'struct {name} {{}}; // function type of {ty.func_like.name}')
+ 89 return name
+ 90 case hir.TypeConstructorType():
+ 91 name = f'type_{unique_hash(self.gen(ty.inner))}_t'
+ 92 self.impl.writeln(f'struct {name} {{}}; // type constructor of {ty.inner}')
+ 93 return name
+ 94 case hir.OpaqueType():
+ 95 def do():
+ 96 match ty.name:
+ 97 case 'Buffer':
+ 98 elem_ty = self.gen(ty.extra_args[0])
+ 99 return f'__builtin__Buffer<{elem_ty}>'
+100 case _:
+101 raise NotImplementedError(f"unsupported opaque type: {ty.name}")
+102 return do()
+103 case hir.GenericIntType():
+104 return 'int'
+105 case hir.GenericFloatType():
+106 return 'float'
+107 case _:
+108 raise NotImplementedError(f"unsupported type: {ty}")
+109
+110
+111_OPERATORS: Set[str] = set([
+112 '__add__',
+113 '__sub__',
+114 '__mul__',
+115 '__truediv__',
+116 '__floordiv__',
+117 '__mod__',
+118 '__pow__',
+119 '__and__',
+120 '__or__',
+121 '__xor__',
+122 '__lshift__',
+123 '__rshift__',
+124 '__eq__',
+125 '__ne__',
+126 '__lt__',
+127 '__le__',
+128 '__gt__',
+129 '__ge__',
+130])
+131
+132
+133@cache
+134def map_builtin_to_cpp_func(name: str) -> str:
+135 comps = name.split(".")
+136 if comps[0] == "luisa_lang" and comps[1] == "math_types":
+137 if comps[3] in _OPERATORS:
+138 return f'{comps[3]}<{comps[2]}>'
+139 return f'{comps[2]}_{comps[3]}'
+140
+141 else:
+142 raise NotImplementedError(f"unsupported builtin function: {name}")
+143
+144
+145def mangle_name(name: str) -> str:
+146 return name.replace(".", "_")
+147
+148
+149class Mangling:
+150 cache: Dict[hir.Type | hir.Function, str]
+151
+152 def __init__(self) -> None:
+153 self.cache = {}
+154
+155 def mangle(self, obj: Union[hir.Type, hir.Function]) -> str:
+156 if obj in self.cache:
+157 return self.cache[obj]
+158 else:
+159 res = self.mangle_impl(obj)
+160 self.cache[obj] = res
+161 return res
+162
+163 def mangle_impl(self, obj: Union[hir.Type, hir.Function]) -> str:
+164
+165 match obj:
+166 case hir.UnitType():
+167 return 'u'
+168 case hir.IntType(bits=bits, signed=signed):
+169 if signed:
+170 return f"i{bits}"
+171 else:
+172 return f"u{bits}"
+173 case hir.FloatType(bits=bits):
+174 return f"f{bits}"
+175 case hir.BoolType():
+176 return "b"
+177 case hir.PointerType(element=element):
+178 return f"P{self.mangle(element)}"
+179 case hir.ArrayType(element=element, count=count):
+180 return f"A{count}{self.mangle(element)}"
+181 case hir.VectorType(element=element, count=count):
+182 return f"V{count}{self.mangle(element)}"
+183 case hir.Function(name=name, params=params, return_type=ret):
+184 assert ret
+185 name = mangle_name(name)
+186 # params = list(filter(lambda p: not isinstance(
+187 # p.type, (hir.FunctionType)), params))
+188 return f'{name}_' + unique_hash(f"F{name}_{self.mangle(ret)}{''.join(self.mangle(unwrap(p.type)) for p in params)}")
+189 case hir.StructType(name=name):
+190 return name
+191 case hir.TupleType():
+192 elements = [self.mangle(e) for e in obj.elements]
+193 return f"T{unique_hash(''.join(elements))}"
+194 case hir.BoundType():
+195 assert obj.instantiated
+196 return self.mangle(obj.instantiated)
+197 case hir.OpaqueType():
+198 return obj.name
+199 case hir.TypeConstructorType():
+200 return self.mangle(obj.inner)
+201 case hir.FunctionType():
+202 return f'func_{unique_hash(obj.func_like.name)}'
+203 case hir.GenericFloatType():
+204 return 'f32'
+205 case hir.GenericIntType():
+206 return 'i32'
+207 case _:
+208 raise NotImplementedError(f"unsupported object: {obj}")
+209
+210
+211class CppCodeGen(CodeGen):
+212 type_cache: TypeCodeGenCache
+213 func_cache: Dict[int, Tuple[hir.Function, str]]
+214 mangling: Mangling
+215 generated_code: ScratchBuffer
+216
+217 def __init__(self) -> None:
+218 super().__init__()
+219 self.type_cache = TypeCodeGenCache()
+220 self.func_cache = {}
+221 self.mangling = Mangling()
+222 self.generated_code = ScratchBuffer()
+223
+224 def gen_function(self, func: hir.Function | Callable[..., Any]) -> str:
+225 if callable(func):
+226 dsl_func = get_dsl_func(func)
+227 assert dsl_func is not None
+228 assert not dsl_func.is_generic, f"Generic functions should be resolved before codegen: {func}"
+229 func_tmp = dsl_func.resolve([])
+230 assert isinstance(
+231 func_tmp, hir.Function), f"Expected function, got {func_tmp}"
+232 func = func_tmp
+233 if id(func) in self.func_cache:
+234 return self.func_cache[id(func)][1]
+235 func_code_gen = FuncCodeGen(self, func)
+236 name = func_code_gen.name
+237 self.func_cache[id(func)] = (func, name)
+238 func_code_gen.gen()
+239 self.generated_code.merge(func_code_gen.body)
+240 return name
+241
+242 def finalize_code(self) -> str:
+243 return _get_cpp_lib() + self.type_cache.impl.body + self.generated_code.body
+244
+245
+246class FuncCodeGen:
+247 base: CppCodeGen
+248 body: ScratchBuffer
+249 name: str
+250 signature: str
+251 func: hir.Function
+252 params: Set[str]
+253 node_map: Dict[hir.Node, str]
+254 vid_cnt: int
+255
+256 def gen_var(self, var: hir.Var) -> str:
+257 assert var.type
+258 ty = self.base.type_cache.gen(var.type)
+259 if var.semantic == hir.ParameterSemantic.BYVAL:
+260 return f"{ty} {var.name}"
+261 else:
+262 return f"{ty} & {var.name}"
+263
+264 def __init__(self, base: CppCodeGen, func: hir.Function) -> None:
+265 self.base = base
+266 self.name = base.mangling.mangle(func)
+267 self.func = func
+268 params = ",".join(self.gen_var(
+269 p) for p in func.params)
+270 assert func.return_type
+271
+272 self.signature = f'auto {self.name}({params}) -> {base.type_cache.gen(func.return_type)}'
+273 if func.export:
+274 self.signature = f'extern "C" {self.signature}'
+275 if func.inline_hint == True:
+276 self.signature = f"inline {self.signature}"
+277 elif func.inline_hint == 'always':
+278 self.signature = f"__lc_always_inline__ {self.signature}"
+279 elif func.inline_hint == 'never':
+280 self.signature = f"__lc_never_inline {self.signature}"
+281 self.body = ScratchBuffer()
+282 self.params = set(p.name for p in func.params)
+283 self.node_map = {}
+284 self.vid_cnt = 0
+285
+286 def new_vid(self) -> int:
+287 self.vid_cnt += 1
+288 return self.vid_cnt
+289
+290 def gen_ref(self, ref: hir.Ref) -> str:
+291 if ref in self.node_map:
+292 return self.node_map[ref]
+293 match ref:
+294 case hir.Var() as var:
+295 return var.name
+296 case hir.MemberRef() as member:
+297 base = self.gen_ref(member.base)
+298 return f"{base}.{member.field}"
+299 case hir.IndexRef() as index:
+300 base = self.gen_ref(index.base)
+301 idx = self.gen_expr(index.index)
+302 return f"{base}[{idx}]"
+303 case hir.IntrinsicRef() as intrin:
+304 def do():
+305 intrin_name = intrin.name
+306 gened_args = [self.gen_value_or_ref(
+307 arg) for arg in intrin.args]
+308 match intrin_name:
+309 case 'buffer.ref' | 'array.ref':
+310 return f"{gened_args[0]}[{gened_args[1]}]"
+311 case 'buffer.size' | 'array.size':
+312 return f"{gened_args[0]}.size"
+313 case _:
+314 raise RuntimeError(f"unsupported intrinsic reference: {intrin_name}")
+315 return do()
+316 case _:
+317 raise NotImplementedError(f"unsupported reference: {ref}")
+318
+319 def gen_func(self, f: hir.Function) -> str:
+320 if isinstance(f, hir.Function):
+321 return self.base.gen_function(f)
+322 else:
+323 raise NotImplementedError(f"unsupported constant")
+324
+325 def gen_value_or_ref(self, value: hir.Value | hir.Ref) -> str:
+326 match value:
+327 case hir.Value() as value:
+328 return self.gen_node_checked(value)
+329 case hir.Ref() as ref:
+330 return self.gen_ref(ref)
+331 case _:
+332 raise NotImplementedError(
+333 f"unsupported value or reference: {value}")
+334
+335 def gen_node_checked(self, node: hir.Node) -> str:
+336 if isinstance(node, hir.Constant):
+337 return self.gen_expr(node)
+338 if isinstance(node, hir.TypedNode) and isinstance(node.type, (hir.TypeConstructorType, hir.FunctionType)):
+339 assert node.type
+340 return f'{self.base.type_cache.gen(node.type)}{{}}'
+341
+342 return self.node_map[node]
+343
+344 def gen_expr(self, expr: hir.Value) -> str:
+345 # if expr.type and isinstance(expr.type, hir.FunctionType):
+346 # return ''
+347 if isinstance(expr, hir.Constant):
+348 value = expr.value
+349 if isinstance(value, int):
+350 return f"{value}"
+351 elif isinstance(value, float):
+352 return f"{value}f"
+353 elif isinstance(value, bool):
+354 return "true" if value else "false"
+355 elif isinstance(value, str):
+356 return f"\"{value}\""
+357 elif isinstance(value, hir.Function):
+358 return self.gen_func(value)
+359 else:
+360 raise NotImplementedError(
+361 f"unsupported constant: {expr}")
+362 if expr in self.node_map:
+363 return self.node_map[expr]
+364 vid = self.new_vid()
+365
+366 def impl() -> None:
+367 match expr:
+368 case hir.TypeValue() as type_value:
+369 assert type_value.type
+370 self.base.type_cache.gen(type_value.type)
+371 return
+372 case hir.Load() as load:
+373 self.body.writeln(
+374 f"const auto &v{vid} = {self.gen_ref(load.ref)}; // load")
+375 case hir.Index() as index:
+376 base = self.gen_expr(index.base)
+377 idx = self.gen_expr(index.index)
+378 self.body.writeln(f"const auto v{vid} = {base}[{idx}];")
+379 case hir.Member() as member:
+380 base = self.gen_expr(member.base)
+381 self.body.writeln(
+382 f"const auto v{vid} = {base}.{member.field};")
+383 case hir.Call() as call:
+384 op = self.gen_func(call.op)
+385 args_s = ','.join(self.gen_value_or_ref(
+386 arg) for arg in call.args)
+387 if call.type != hir.UnitType():
+388 self.body.writeln(
+389 f"auto v{vid} = {op}({args_s});")
+390 else:
+391 self.body.writeln(f"{op}({args_s});")
+392 case hir.AggregateInit():
+393 assert expr.type
+394 ty = self.base.type_cache.gen(expr.type)
+395 self.body.writeln(
+396 f"{ty} v{vid}{{ {','.join(self.gen_expr(e) for e in expr.args)} }};")
+397 case hir.Intrinsic() as intrin:
+398 def do():
+399 intrin_name = intrin.name
+400 comps = intrin_name.split('.')
+401 gened_args = [self.gen_value_or_ref(
+402 arg) for arg in intrin.args]
+403 if comps[0] == 'init':
+404 assert expr.type
+405 ty = self.base.type_cache.gen(expr.type)
+406 self.body.writeln(
+407 f"{ty} v{vid}{{ {','.join(gened_args)} }};")
+408 elif comps[0] == 'cmp':
+409 cmp_dict = {
+410 '__eq__': '==',
+411 '__ne__': '!=',
+412 '__lt__': '<',
+413 '__le__': '<=',
+414 '__gt__': '>',
+415 '__ge__': '>=',
+416 }
+417 if comps[1] in cmp_dict:
+418 cmp = cmp_dict[comps[1]]
+419 self.body.writeln(
+420 f"auto v{vid} = {gened_args[0]} {cmp} {gened_args[1]};")
+421 else:
+422 raise NotImplementedError(
+423 f"unsupported cmp intrinsic: {intrin_name}")
+424 elif comps[0] == 'unary':
+425 unary_dict = {
+426 '__neg__': '-',
+427 '__pos__': '+',
+428 '__invert__': '~',
+429 }
+430 if comps[1] in unary_dict:
+431 unary = unary_dict[comps[1]]
+432 self.body.writeln(
+433 f"auto v{vid} = {unary}{gened_args[0]};")
+434 else:
+435 raise NotImplementedError(
+436 f"unsupported unary intrinsic: {intrin_name}")
+437 elif comps[0] == 'binop':
+438 binop_dict = {
+439 '__add__': '+',
+440 '__sub__': '-',
+441 '__mul__': '*',
+442 '__truediv__': '/',
+443 '__floordiv__': '/', # TODO: fix floordiv
+444 '__mod__': '%',
+445 '__pow__': '**',
+446 '__and__': '&',
+447 '__or__': '|',
+448 '__xor__': '^',
+449 '__lshift__': '<<',
+450 '__rshift__': '>>',
+451 '__eq__': '==',
+452 '__ne__': '!=',
+453 '__lt__': '<',
+454 '__le__': '<=',
+455 '__gt__': '>',
+456 '__ge__': '>=',
+457 }
+458 ibinop_dict = {
+459 '__iadd__': '+=',
+460 '__isub__': '-=',
+461 '__imul__': '*=',
+462 '__itruediv__': '/=',
+463 '__ifloordiv__': '/=', # TODO: fix floordiv
+464 '__imod__': '%=',
+465 '__ipow__': '**=',
+466 '__iand__': '&=',
+467 '__ior__': '|=',
+468 '__ixor__': '^=',
+469 '__ilshift__': '<<=',
+470 '__irshift__': '>>=',
+471 }
+472 if comps[1] in binop_dict:
+473 binop = binop_dict[comps[1]]
+474 self.body.writeln(
+475 f"auto v{vid} = {gened_args[0]} {binop} {gened_args[1]};")
+476 elif comps[1] in ibinop_dict:
+477 binop = ibinop_dict[comps[1]]
+478 self.body.writeln(
+479 f"{gened_args[0]} {binop} {gened_args[1]}; auto& v{vid} = {gened_args[0]};")
+480 else:
+481 raise NotImplementedError(
+482 f"unsupported binop intrinsic: {intrin_name}")
+483 elif comps[0] == 'math':
+484 args_s = ','.join(gened_args)
+485 self.body.writeln(
+486 f"auto v{vid} = lc_{comps[1]}({args_s});")
+487 else:
+488 intrin_name = intrin.name.replace('.', '_')
+489 args_s = ','.join(gened_args)
+490 self.body.writeln(
+491 f"auto v{vid} = __intrin__{intrin_name}({args_s});")
+492
+493 do()
+494 case _:
+495 raise NotImplementedError(
+496 f"unsupported expression: {expr}")
+497
+498 impl()
+499 self.node_map[expr] = f'v{vid}'
+500 return f'v{vid}'
+501
+502 def gen_node(self, node: hir.Node) -> Optional[hir.BasicBlock]:
+503
+504 match node:
+505 case hir.Return() as ret:
+506 if ret.value:
+507 self.body.writeln(
+508 f"return {self.gen_node_checked(ret.value)};")
+509 else:
+510 self.body.writeln("return;")
+511 case hir.Assign() as assign:
+512 if isinstance(assign.ref.type, (hir.FunctionType, hir.TypeConstructorType)):
+513 return None
+514 ref = self.gen_ref(assign.ref)
+515 value = self.gen_node_checked(assign.value)
+516 self.body.writeln(f"{ref} = {value};")
+517 case hir.If() as if_stmt:
+518 cond = self.gen_node_checked(if_stmt.cond)
+519 self.body.writeln(f"if ({cond}) {{")
+520 self.body.indent += 1
+521 self.gen_bb(if_stmt.then_body)
+522 self.body.indent -= 1
+523 self.body.writeln("}")
+524 if if_stmt.else_body:
+525 self.body.writeln("else {")
+526 self.body.indent += 1
+527 self.gen_bb(if_stmt.else_body)
+528 self.body.indent -= 1
+529 self.body.writeln("}")
+530 return if_stmt.merge
+531 case hir.Break():
+532 self.body.writeln("__loop_break = true; break;")
+533 case hir.Continue():
+534 self.body.writeln("break;")
+535 case hir.Loop() as loop:
+536 """
+537 while(true) {
+538 bool loop_break = false;
+539 prepare();
+540 if (!cond()) break;
+541 do {
+542 // break => { loop_break = true; break; }
+543 // continue => { break; }
+544 } while(false);
+545 if (loop_break) break;
+546 update();
+547 }
+548
+549 """
+550 self.body.writeln("while(true) {")
+551 self.body.indent += 1
+552 self.body.writeln("bool __loop_break = false;")
+553 self.gen_bb(loop.prepare)
+554 if loop.cond:
+555 cond = self.gen_node_checked(loop.cond)
+556 self.body.writeln(f"if (!{cond}) break;")
+557 self.body.writeln("do {")
+558 self.body.indent += 1
+559 self.gen_bb(loop.body)
+560 self.body.indent -= 1
+561 self.body.writeln("} while(false);")
+562 self.body.writeln("if (__loop_break) break;")
+563 if loop.update:
+564 self.gen_bb(loop.update)
+565 self.body.indent -= 1
+566 self.body.writeln("}")
+567 return loop.merge
+568 case hir.Alloca() as alloca:
+569 vid = self.new_vid()
+570 assert alloca.type
+571 ty = self.base.type_cache.gen(alloca.type)
+572 self.body.writeln(f"{ty} v{vid}{{}};")
+573 self.node_map[alloca] = f"v{vid}"
+574 case hir.AggregateInit() | hir.Intrinsic() | hir.Call() | hir.Constant() | hir.Load() | hir.Index() | hir.Member() | hir.TypeValue() | hir.FunctionValue():
+575 self.gen_expr(node)
+576 case hir.Member() | hir.Index():
+577 pass
+578 return None
+579
+580 def gen_bb(self, bb: hir.BasicBlock):
+581
+582 while True:
+583 loop_again = False
+584 old_bb = bb
+585 self.body.writeln(f"// BasicBlock Begin {bb.span}")
+586 for i, node in enumerate(bb.nodes):
+587 if (next := self.gen_node(node)) and next is not None:
+588 assert i == len(bb.nodes) - 1
+589 loop_again = True
+590 bb = next
+591 break
+592 self.body.writeln(f"// BasicBlock End {old_bb.span}")
+593 if not loop_again:
+594 break
+595
+596 def gen_locals(self):
+597 for local in self.func.locals:
+598 if local.name in self.params:
+599 continue
+600 # if isinstance(local.type, (hir.FunctionType, hir.TypeConstructorType)):
+601 # continue
+602 assert (
+603 local.type
+604 ), f"Local variable `{local.name}` contains unresolved type"
+605 self.body.writeln(
+606 f"{self.base.type_cache.gen(local.type)} {local.name}{{}};"
+607 )
+608
+609 def gen(self) -> None:
+610 self.body.writeln(f"{self.signature} {{")
+611 self.body.indent += 1
+612 self.gen_locals()
+613 if self.func.body:
+614 self.gen_bb(self.func.body)
+615 self.body.indent -= 1
+616 self.body.writeln("}")
+
19class TypeCodeGenCache:
+ 20 cache: Dict[hir.Type, str]
+ 21 impl: ScratchBuffer
+ 22
+ 23 def __init__(self) -> None:
+ 24 self.cache = {}
+ 25 self.impl = ScratchBuffer(0)
+ 26
+ 27 def gen(self, ty: hir.Type) -> str:
+ 28 if ty in self.cache:
+ 29 return self.cache[ty]
+ 30 else:
+ 31 res = self.gen_impl(ty)
+ 32 self.cache[ty] = res
+ 33 return res
+ 34
+ 35 def gen_impl(self, ty: hir.Type) -> str:
+ 36 match ty:
+ 37 case hir.IntType(bits=bits, signed=signed):
+ 38 int_names = {
+ 39 '8':'byte',
+ 40 '16':'short',
+ 41 '32':'int',
+ 42 '64':'long',
+ 43 }
+ 44 if signed:
+ 45 return f"lc_{int_names[str(bits)]}"
+ 46 else:
+ 47 return f"lc_u{int_names[str(bits)]}"
+ 48 case hir.FloatType(bits=bits):
+ 49 match bits:
+ 50 case 16:
+ 51 return 'lc_half'
+ 52 case 32:
+ 53 return 'lc_float'
+ 54 case 64:
+ 55 return 'lc_double'
+ 56 case _:
+ 57 raise RuntimeError("invalid float type")
+ 58 case hir.BoolType():
+ 59 return "lc_bool"
+ 60 case hir.PointerType(element=element):
+ 61 return f"lc_ptr<{self.gen(element)}>"
+ 62 case hir.VectorType(element=element, count=count):
+ 63 return f"{self.gen(element)}{count}>"
+ 64 case hir.ArrayType(element=element, count=count):
+ 65 return f"lc_array<{self.gen(element)}, {count}>"
+ 66 case hir.StructType(name=name, fields=fields):
+ 67 self.impl.writeln(f'struct {name} {{')
+ 68 for field in fields:
+ 69 self.impl.writeln(f' {self.gen(field[1])} {field[0]};')
+ 70 self.impl.writeln('};')
+ 71 return name
+ 72 case hir.UnitType():
+ 73 return 'void'
+ 74 case hir.TupleType():
+ 75 def do():
+ 76 elements = [self.gen(e) for e in ty.elements]
+ 77 name = f'Tuple_{unique_hash("".join(elements))}'
+ 78 self.impl.writeln(f'struct {name} {{')
+ 79 for i, element in enumerate(elements):
+ 80 self.impl.writeln(f' {element} _{i};')
+ 81 self.impl.writeln('};')
+ 82 return name
+ 83 return do()
+ 84 case hir.BoundType():
+ 85 assert ty.instantiated
+ 86 return self.gen(ty.instantiated)
+ 87 case hir.FunctionType():
+ 88 name = f'func_{unique_hash(ty.func_like.name)}_t'
+ 89 self.impl.writeln(f'struct {name} {{}}; // function type of {ty.func_like.name}')
+ 90 return name
+ 91 case hir.TypeConstructorType():
+ 92 name = f'type_{unique_hash(self.gen(ty.inner))}_t'
+ 93 self.impl.writeln(f'struct {name} {{}}; // type constructor of {ty.inner}')
+ 94 return name
+ 95 case hir.OpaqueType():
+ 96 def do():
+ 97 match ty.name:
+ 98 case 'Buffer':
+ 99 elem_ty = self.gen(ty.extra_args[0])
+100 return f'__builtin__Buffer<{elem_ty}>'
+101 case _:
+102 raise NotImplementedError(f"unsupported opaque type: {ty.name}")
+103 return do()
+104 case hir.GenericIntType():
+105 return 'int'
+106 case hir.GenericFloatType():
+107 return 'float'
+108 case _:
+109 raise NotImplementedError(f"unsupported type: {ty}")
+
35 def gen_impl(self, ty: hir.Type) -> str:
+ 36 match ty:
+ 37 case hir.IntType(bits=bits, signed=signed):
+ 38 int_names = {
+ 39 '8':'byte',
+ 40 '16':'short',
+ 41 '32':'int',
+ 42 '64':'long',
+ 43 }
+ 44 if signed:
+ 45 return f"lc_{int_names[str(bits)]}"
+ 46 else:
+ 47 return f"lc_u{int_names[str(bits)]}"
+ 48 case hir.FloatType(bits=bits):
+ 49 match bits:
+ 50 case 16:
+ 51 return 'lc_half'
+ 52 case 32:
+ 53 return 'lc_float'
+ 54 case 64:
+ 55 return 'lc_double'
+ 56 case _:
+ 57 raise RuntimeError("invalid float type")
+ 58 case hir.BoolType():
+ 59 return "lc_bool"
+ 60 case hir.PointerType(element=element):
+ 61 return f"lc_ptr<{self.gen(element)}>"
+ 62 case hir.VectorType(element=element, count=count):
+ 63 return f"{self.gen(element)}{count}>"
+ 64 case hir.ArrayType(element=element, count=count):
+ 65 return f"lc_array<{self.gen(element)}, {count}>"
+ 66 case hir.StructType(name=name, fields=fields):
+ 67 self.impl.writeln(f'struct {name} {{')
+ 68 for field in fields:
+ 69 self.impl.writeln(f' {self.gen(field[1])} {field[0]};')
+ 70 self.impl.writeln('};')
+ 71 return name
+ 72 case hir.UnitType():
+ 73 return 'void'
+ 74 case hir.TupleType():
+ 75 def do():
+ 76 elements = [self.gen(e) for e in ty.elements]
+ 77 name = f'Tuple_{unique_hash("".join(elements))}'
+ 78 self.impl.writeln(f'struct {name} {{')
+ 79 for i, element in enumerate(elements):
+ 80 self.impl.writeln(f' {element} _{i};')
+ 81 self.impl.writeln('};')
+ 82 return name
+ 83 return do()
+ 84 case hir.BoundType():
+ 85 assert ty.instantiated
+ 86 return self.gen(ty.instantiated)
+ 87 case hir.FunctionType():
+ 88 name = f'func_{unique_hash(ty.func_like.name)}_t'
+ 89 self.impl.writeln(f'struct {name} {{}}; // function type of {ty.func_like.name}')
+ 90 return name
+ 91 case hir.TypeConstructorType():
+ 92 name = f'type_{unique_hash(self.gen(ty.inner))}_t'
+ 93 self.impl.writeln(f'struct {name} {{}}; // type constructor of {ty.inner}')
+ 94 return name
+ 95 case hir.OpaqueType():
+ 96 def do():
+ 97 match ty.name:
+ 98 case 'Buffer':
+ 99 elem_ty = self.gen(ty.extra_args[0])
+100 return f'__builtin__Buffer<{elem_ty}>'
+101 case _:
+102 raise NotImplementedError(f"unsupported opaque type: {ty.name}")
+103 return do()
+104 case hir.GenericIntType():
+105 return 'int'
+106 case hir.GenericFloatType():
+107 return 'float'
+108 case _:
+109 raise NotImplementedError(f"unsupported type: {ty}")
+
134@cache
+135def map_builtin_to_cpp_func(name: str) -> str:
+136 comps = name.split(".")
+137 if comps[0] == "luisa_lang" and comps[1] == "math_types":
+138 if comps[3] in _OPERATORS:
+139 return f'{comps[3]}<{comps[2]}>'
+140 return f'{comps[2]}_{comps[3]}'
+141
+142 else:
+143 raise NotImplementedError(f"unsupported builtin function: {name}")
+
150class Mangling:
+151 cache: Dict[hir.Type | hir.Function, str]
+152
+153 def __init__(self) -> None:
+154 self.cache = {}
+155
+156 def mangle(self, obj: Union[hir.Type, hir.Function]) -> str:
+157 if obj in self.cache:
+158 return self.cache[obj]
+159 else:
+160 res = self.mangle_impl(obj)
+161 self.cache[obj] = res
+162 return res
+163
+164 def mangle_impl(self, obj: Union[hir.Type, hir.Function]) -> str:
+165
+166 match obj:
+167 case hir.UnitType():
+168 return 'u'
+169 case hir.IntType(bits=bits, signed=signed):
+170 if signed:
+171 return f"i{bits}"
+172 else:
+173 return f"u{bits}"
+174 case hir.FloatType(bits=bits):
+175 return f"f{bits}"
+176 case hir.BoolType():
+177 return "b"
+178 case hir.PointerType(element=element):
+179 return f"P{self.mangle(element)}"
+180 case hir.ArrayType(element=element, count=count):
+181 return f"A{count}{self.mangle(element)}"
+182 case hir.VectorType(element=element, count=count):
+183 return f"V{count}{self.mangle(element)}"
+184 case hir.Function(name=name, params=params, return_type=ret):
+185 assert ret
+186 name = mangle_name(name)
+187 # params = list(filter(lambda p: not isinstance(
+188 # p.type, (hir.FunctionType)), params))
+189 return f'{name}_' + unique_hash(f"F{name}_{self.mangle(ret)}{''.join(self.mangle(unwrap(p.type)) for p in params)}")
+190 case hir.StructType(name=name):
+191 return name
+192 case hir.TupleType():
+193 elements = [self.mangle(e) for e in obj.elements]
+194 return f"T{unique_hash(''.join(elements))}"
+195 case hir.BoundType():
+196 assert obj.instantiated
+197 return self.mangle(obj.instantiated)
+198 case hir.OpaqueType():
+199 return obj.name
+200 case hir.TypeConstructorType():
+201 return self.mangle(obj.inner)
+202 case hir.FunctionType():
+203 return f'func_{unique_hash(obj.func_like.name)}'
+204 case hir.GenericFloatType():
+205 return 'f32'
+206 case hir.GenericIntType():
+207 return 'i32'
+208 case _:
+209 raise NotImplementedError(f"unsupported object: {obj}")
+
164 def mangle_impl(self, obj: Union[hir.Type, hir.Function]) -> str:
+165
+166 match obj:
+167 case hir.UnitType():
+168 return 'u'
+169 case hir.IntType(bits=bits, signed=signed):
+170 if signed:
+171 return f"i{bits}"
+172 else:
+173 return f"u{bits}"
+174 case hir.FloatType(bits=bits):
+175 return f"f{bits}"
+176 case hir.BoolType():
+177 return "b"
+178 case hir.PointerType(element=element):
+179 return f"P{self.mangle(element)}"
+180 case hir.ArrayType(element=element, count=count):
+181 return f"A{count}{self.mangle(element)}"
+182 case hir.VectorType(element=element, count=count):
+183 return f"V{count}{self.mangle(element)}"
+184 case hir.Function(name=name, params=params, return_type=ret):
+185 assert ret
+186 name = mangle_name(name)
+187 # params = list(filter(lambda p: not isinstance(
+188 # p.type, (hir.FunctionType)), params))
+189 return f'{name}_' + unique_hash(f"F{name}_{self.mangle(ret)}{''.join(self.mangle(unwrap(p.type)) for p in params)}")
+190 case hir.StructType(name=name):
+191 return name
+192 case hir.TupleType():
+193 elements = [self.mangle(e) for e in obj.elements]
+194 return f"T{unique_hash(''.join(elements))}"
+195 case hir.BoundType():
+196 assert obj.instantiated
+197 return self.mangle(obj.instantiated)
+198 case hir.OpaqueType():
+199 return obj.name
+200 case hir.TypeConstructorType():
+201 return self.mangle(obj.inner)
+202 case hir.FunctionType():
+203 return f'func_{unique_hash(obj.func_like.name)}'
+204 case hir.GenericFloatType():
+205 return 'f32'
+206 case hir.GenericIntType():
+207 return 'i32'
+208 case _:
+209 raise NotImplementedError(f"unsupported object: {obj}")
+
212class CppCodeGen(CodeGen):
+213 type_cache: TypeCodeGenCache
+214 func_cache: Dict[int, Tuple[hir.Function, str]]
+215 mangling: Mangling
+216 generated_code: ScratchBuffer
+217
+218 def __init__(self) -> None:
+219 super().__init__()
+220 self.type_cache = TypeCodeGenCache()
+221 self.func_cache = {}
+222 self.mangling = Mangling()
+223 self.generated_code = ScratchBuffer()
+224
+225 def gen_function(self, func: hir.Function | Callable[..., Any]) -> str:
+226 if callable(func):
+227 dsl_func = get_dsl_func(func)
+228 assert dsl_func is not None
+229 assert not dsl_func.is_generic, f"Generic functions should be resolved before codegen: {func}"
+230 func_tmp = dsl_func.resolve([])
+231 assert isinstance(
+232 func_tmp, hir.Function), f"Expected function, got {func_tmp}"
+233 func = func_tmp
+234 if id(func) in self.func_cache:
+235 return self.func_cache[id(func)][1]
+236 func_code_gen = FuncCodeGen(self, func)
+237 name = func_code_gen.name
+238 self.func_cache[id(func)] = (func, name)
+239 func_code_gen.gen()
+240 self.generated_code.merge(func_code_gen.body)
+241 return name
+242
+243 def finalize_code(self) -> str:
+244 return _get_cpp_lib() + self.type_cache.impl.body + self.generated_code.body
+
225 def gen_function(self, func: hir.Function | Callable[..., Any]) -> str:
+226 if callable(func):
+227 dsl_func = get_dsl_func(func)
+228 assert dsl_func is not None
+229 assert not dsl_func.is_generic, f"Generic functions should be resolved before codegen: {func}"
+230 func_tmp = dsl_func.resolve([])
+231 assert isinstance(
+232 func_tmp, hir.Function), f"Expected function, got {func_tmp}"
+233 func = func_tmp
+234 if id(func) in self.func_cache:
+235 return self.func_cache[id(func)][1]
+236 func_code_gen = FuncCodeGen(self, func)
+237 name = func_code_gen.name
+238 self.func_cache[id(func)] = (func, name)
+239 func_code_gen.gen()
+240 self.generated_code.merge(func_code_gen.body)
+241 return name
+
247class FuncCodeGen:
+248 base: CppCodeGen
+249 body: ScratchBuffer
+250 name: str
+251 signature: str
+252 func: hir.Function
+253 params: Set[str]
+254 node_map: Dict[hir.Node, str]
+255 vid_cnt: int
+256
+257 def gen_var(self, var: hir.Var) -> str:
+258 assert var.type
+259 ty = self.base.type_cache.gen(var.type)
+260 if var.semantic == hir.ParameterSemantic.BYVAL:
+261 return f"{ty} {var.name}"
+262 else:
+263 return f"{ty} & {var.name}"
+264
+265 def __init__(self, base: CppCodeGen, func: hir.Function) -> None:
+266 self.base = base
+267 self.name = base.mangling.mangle(func)
+268 self.func = func
+269 params = ",".join(self.gen_var(
+270 p) for p in func.params)
+271 assert func.return_type
+272
+273 self.signature = f'auto {self.name}({params}) -> {base.type_cache.gen(func.return_type)}'
+274 if func.export:
+275 self.signature = f'extern "C" {self.signature}'
+276 if func.inline_hint == True:
+277 self.signature = f"inline {self.signature}"
+278 elif func.inline_hint == 'always':
+279 self.signature = f"__lc_always_inline__ {self.signature}"
+280 elif func.inline_hint == 'never':
+281 self.signature = f"__lc_never_inline {self.signature}"
+282 self.body = ScratchBuffer()
+283 self.params = set(p.name for p in func.params)
+284 self.node_map = {}
+285 self.vid_cnt = 0
+286
+287 def new_vid(self) -> int:
+288 self.vid_cnt += 1
+289 return self.vid_cnt
+290
+291 def gen_ref(self, ref: hir.Ref) -> str:
+292 if ref in self.node_map:
+293 return self.node_map[ref]
+294 match ref:
+295 case hir.Var() as var:
+296 return var.name
+297 case hir.MemberRef() as member:
+298 base = self.gen_ref(member.base)
+299 return f"{base}.{member.field}"
+300 case hir.IndexRef() as index:
+301 base = self.gen_ref(index.base)
+302 idx = self.gen_expr(index.index)
+303 return f"{base}[{idx}]"
+304 case hir.IntrinsicRef() as intrin:
+305 def do():
+306 intrin_name = intrin.name
+307 gened_args = [self.gen_value_or_ref(
+308 arg) for arg in intrin.args]
+309 match intrin_name:
+310 case 'buffer.ref' | 'array.ref':
+311 return f"{gened_args[0]}[{gened_args[1]}]"
+312 case 'buffer.size' | 'array.size':
+313 return f"{gened_args[0]}.size"
+314 case _:
+315 raise RuntimeError(f"unsupported intrinsic reference: {intrin_name}")
+316 return do()
+317 case _:
+318 raise NotImplementedError(f"unsupported reference: {ref}")
+319
+320 def gen_func(self, f: hir.Function) -> str:
+321 if isinstance(f, hir.Function):
+322 return self.base.gen_function(f)
+323 else:
+324 raise NotImplementedError(f"unsupported constant")
+325
+326 def gen_value_or_ref(self, value: hir.Value | hir.Ref) -> str:
+327 match value:
+328 case hir.Value() as value:
+329 return self.gen_node_checked(value)
+330 case hir.Ref() as ref:
+331 return self.gen_ref(ref)
+332 case _:
+333 raise NotImplementedError(
+334 f"unsupported value or reference: {value}")
+335
+336 def gen_node_checked(self, node: hir.Node) -> str:
+337 if isinstance(node, hir.Constant):
+338 return self.gen_expr(node)
+339 if isinstance(node, hir.TypedNode) and isinstance(node.type, (hir.TypeConstructorType, hir.FunctionType)):
+340 assert node.type
+341 return f'{self.base.type_cache.gen(node.type)}{{}}'
+342
+343 return self.node_map[node]
+344
+345 def gen_expr(self, expr: hir.Value) -> str:
+346 # if expr.type and isinstance(expr.type, hir.FunctionType):
+347 # return ''
+348 if isinstance(expr, hir.Constant):
+349 value = expr.value
+350 if isinstance(value, int):
+351 return f"{value}"
+352 elif isinstance(value, float):
+353 return f"{value}f"
+354 elif isinstance(value, bool):
+355 return "true" if value else "false"
+356 elif isinstance(value, str):
+357 return f"\"{value}\""
+358 elif isinstance(value, hir.Function):
+359 return self.gen_func(value)
+360 else:
+361 raise NotImplementedError(
+362 f"unsupported constant: {expr}")
+363 if expr in self.node_map:
+364 return self.node_map[expr]
+365 vid = self.new_vid()
+366
+367 def impl() -> None:
+368 match expr:
+369 case hir.TypeValue() as type_value:
+370 assert type_value.type
+371 self.base.type_cache.gen(type_value.type)
+372 return
+373 case hir.Load() as load:
+374 self.body.writeln(
+375 f"const auto &v{vid} = {self.gen_ref(load.ref)}; // load")
+376 case hir.Index() as index:
+377 base = self.gen_expr(index.base)
+378 idx = self.gen_expr(index.index)
+379 self.body.writeln(f"const auto v{vid} = {base}[{idx}];")
+380 case hir.Member() as member:
+381 base = self.gen_expr(member.base)
+382 self.body.writeln(
+383 f"const auto v{vid} = {base}.{member.field};")
+384 case hir.Call() as call:
+385 op = self.gen_func(call.op)
+386 args_s = ','.join(self.gen_value_or_ref(
+387 arg) for arg in call.args)
+388 if call.type != hir.UnitType():
+389 self.body.writeln(
+390 f"auto v{vid} = {op}({args_s});")
+391 else:
+392 self.body.writeln(f"{op}({args_s});")
+393 case hir.AggregateInit():
+394 assert expr.type
+395 ty = self.base.type_cache.gen(expr.type)
+396 self.body.writeln(
+397 f"{ty} v{vid}{{ {','.join(self.gen_expr(e) for e in expr.args)} }};")
+398 case hir.Intrinsic() as intrin:
+399 def do():
+400 intrin_name = intrin.name
+401 comps = intrin_name.split('.')
+402 gened_args = [self.gen_value_or_ref(
+403 arg) for arg in intrin.args]
+404 if comps[0] == 'init':
+405 assert expr.type
+406 ty = self.base.type_cache.gen(expr.type)
+407 self.body.writeln(
+408 f"{ty} v{vid}{{ {','.join(gened_args)} }};")
+409 elif comps[0] == 'cmp':
+410 cmp_dict = {
+411 '__eq__': '==',
+412 '__ne__': '!=',
+413 '__lt__': '<',
+414 '__le__': '<=',
+415 '__gt__': '>',
+416 '__ge__': '>=',
+417 }
+418 if comps[1] in cmp_dict:
+419 cmp = cmp_dict[comps[1]]
+420 self.body.writeln(
+421 f"auto v{vid} = {gened_args[0]} {cmp} {gened_args[1]};")
+422 else:
+423 raise NotImplementedError(
+424 f"unsupported cmp intrinsic: {intrin_name}")
+425 elif comps[0] == 'unary':
+426 unary_dict = {
+427 '__neg__': '-',
+428 '__pos__': '+',
+429 '__invert__': '~',
+430 }
+431 if comps[1] in unary_dict:
+432 unary = unary_dict[comps[1]]
+433 self.body.writeln(
+434 f"auto v{vid} = {unary}{gened_args[0]};")
+435 else:
+436 raise NotImplementedError(
+437 f"unsupported unary intrinsic: {intrin_name}")
+438 elif comps[0] == 'binop':
+439 binop_dict = {
+440 '__add__': '+',
+441 '__sub__': '-',
+442 '__mul__': '*',
+443 '__truediv__': '/',
+444 '__floordiv__': '/', # TODO: fix floordiv
+445 '__mod__': '%',
+446 '__pow__': '**',
+447 '__and__': '&',
+448 '__or__': '|',
+449 '__xor__': '^',
+450 '__lshift__': '<<',
+451 '__rshift__': '>>',
+452 '__eq__': '==',
+453 '__ne__': '!=',
+454 '__lt__': '<',
+455 '__le__': '<=',
+456 '__gt__': '>',
+457 '__ge__': '>=',
+458 }
+459 ibinop_dict = {
+460 '__iadd__': '+=',
+461 '__isub__': '-=',
+462 '__imul__': '*=',
+463 '__itruediv__': '/=',
+464 '__ifloordiv__': '/=', # TODO: fix floordiv
+465 '__imod__': '%=',
+466 '__ipow__': '**=',
+467 '__iand__': '&=',
+468 '__ior__': '|=',
+469 '__ixor__': '^=',
+470 '__ilshift__': '<<=',
+471 '__irshift__': '>>=',
+472 }
+473 if comps[1] in binop_dict:
+474 binop = binop_dict[comps[1]]
+475 self.body.writeln(
+476 f"auto v{vid} = {gened_args[0]} {binop} {gened_args[1]};")
+477 elif comps[1] in ibinop_dict:
+478 binop = ibinop_dict[comps[1]]
+479 self.body.writeln(
+480 f"{gened_args[0]} {binop} {gened_args[1]}; auto& v{vid} = {gened_args[0]};")
+481 else:
+482 raise NotImplementedError(
+483 f"unsupported binop intrinsic: {intrin_name}")
+484 elif comps[0] == 'math':
+485 args_s = ','.join(gened_args)
+486 self.body.writeln(
+487 f"auto v{vid} = lc_{comps[1]}({args_s});")
+488 else:
+489 intrin_name = intrin.name.replace('.', '_')
+490 args_s = ','.join(gened_args)
+491 self.body.writeln(
+492 f"auto v{vid} = __intrin__{intrin_name}({args_s});")
+493
+494 do()
+495 case _:
+496 raise NotImplementedError(
+497 f"unsupported expression: {expr}")
+498
+499 impl()
+500 self.node_map[expr] = f'v{vid}'
+501 return f'v{vid}'
+502
+503 def gen_node(self, node: hir.Node) -> Optional[hir.BasicBlock]:
+504
+505 match node:
+506 case hir.Return() as ret:
+507 if ret.value:
+508 self.body.writeln(
+509 f"return {self.gen_node_checked(ret.value)};")
+510 else:
+511 self.body.writeln("return;")
+512 case hir.Assign() as assign:
+513 if isinstance(assign.ref.type, (hir.FunctionType, hir.TypeConstructorType)):
+514 return None
+515 ref = self.gen_ref(assign.ref)
+516 value = self.gen_node_checked(assign.value)
+517 self.body.writeln(f"{ref} = {value};")
+518 case hir.If() as if_stmt:
+519 cond = self.gen_node_checked(if_stmt.cond)
+520 self.body.writeln(f"if ({cond}) {{")
+521 self.body.indent += 1
+522 self.gen_bb(if_stmt.then_body)
+523 self.body.indent -= 1
+524 self.body.writeln("}")
+525 if if_stmt.else_body:
+526 self.body.writeln("else {")
+527 self.body.indent += 1
+528 self.gen_bb(if_stmt.else_body)
+529 self.body.indent -= 1
+530 self.body.writeln("}")
+531 return if_stmt.merge
+532 case hir.Break():
+533 self.body.writeln("__loop_break = true; break;")
+534 case hir.Continue():
+535 self.body.writeln("break;")
+536 case hir.Loop() as loop:
+537 """
+538 while(true) {
+539 bool loop_break = false;
+540 prepare();
+541 if (!cond()) break;
+542 do {
+543 // break => { loop_break = true; break; }
+544 // continue => { break; }
+545 } while(false);
+546 if (loop_break) break;
+547 update();
+548 }
+549
+550 """
+551 self.body.writeln("while(true) {")
+552 self.body.indent += 1
+553 self.body.writeln("bool __loop_break = false;")
+554 self.gen_bb(loop.prepare)
+555 if loop.cond:
+556 cond = self.gen_node_checked(loop.cond)
+557 self.body.writeln(f"if (!{cond}) break;")
+558 self.body.writeln("do {")
+559 self.body.indent += 1
+560 self.gen_bb(loop.body)
+561 self.body.indent -= 1
+562 self.body.writeln("} while(false);")
+563 self.body.writeln("if (__loop_break) break;")
+564 if loop.update:
+565 self.gen_bb(loop.update)
+566 self.body.indent -= 1
+567 self.body.writeln("}")
+568 return loop.merge
+569 case hir.Alloca() as alloca:
+570 vid = self.new_vid()
+571 assert alloca.type
+572 ty = self.base.type_cache.gen(alloca.type)
+573 self.body.writeln(f"{ty} v{vid}{{}};")
+574 self.node_map[alloca] = f"v{vid}"
+575 case hir.AggregateInit() | hir.Intrinsic() | hir.Call() | hir.Constant() | hir.Load() | hir.Index() | hir.Member() | hir.TypeValue() | hir.FunctionValue():
+576 self.gen_expr(node)
+577 case hir.Member() | hir.Index():
+578 pass
+579 return None
+580
+581 def gen_bb(self, bb: hir.BasicBlock):
+582
+583 while True:
+584 loop_again = False
+585 old_bb = bb
+586 self.body.writeln(f"// BasicBlock Begin {bb.span}")
+587 for i, node in enumerate(bb.nodes):
+588 if (next := self.gen_node(node)) and next is not None:
+589 assert i == len(bb.nodes) - 1
+590 loop_again = True
+591 bb = next
+592 break
+593 self.body.writeln(f"// BasicBlock End {old_bb.span}")
+594 if not loop_again:
+595 break
+596
+597 def gen_locals(self):
+598 for local in self.func.locals:
+599 if local.name in self.params:
+600 continue
+601 # if isinstance(local.type, (hir.FunctionType, hir.TypeConstructorType)):
+602 # continue
+603 assert (
+604 local.type
+605 ), f"Local variable `{local.name}` contains unresolved type"
+606 self.body.writeln(
+607 f"{self.base.type_cache.gen(local.type)} {local.name}{{}};"
+608 )
+609
+610 def gen(self) -> None:
+611 self.body.writeln(f"{self.signature} {{")
+612 self.body.indent += 1
+613 self.gen_locals()
+614 if self.func.body:
+615 self.gen_bb(self.func.body)
+616 self.body.indent -= 1
+617 self.body.writeln("}")
+
265 def __init__(self, base: CppCodeGen, func: hir.Function) -> None:
+266 self.base = base
+267 self.name = base.mangling.mangle(func)
+268 self.func = func
+269 params = ",".join(self.gen_var(
+270 p) for p in func.params)
+271 assert func.return_type
+272
+273 self.signature = f'auto {self.name}({params}) -> {base.type_cache.gen(func.return_type)}'
+274 if func.export:
+275 self.signature = f'extern "C" {self.signature}'
+276 if func.inline_hint == True:
+277 self.signature = f"inline {self.signature}"
+278 elif func.inline_hint == 'always':
+279 self.signature = f"__lc_always_inline__ {self.signature}"
+280 elif func.inline_hint == 'never':
+281 self.signature = f"__lc_never_inline {self.signature}"
+282 self.body = ScratchBuffer()
+283 self.params = set(p.name for p in func.params)
+284 self.node_map = {}
+285 self.vid_cnt = 0
+
291 def gen_ref(self, ref: hir.Ref) -> str:
+292 if ref in self.node_map:
+293 return self.node_map[ref]
+294 match ref:
+295 case hir.Var() as var:
+296 return var.name
+297 case hir.MemberRef() as member:
+298 base = self.gen_ref(member.base)
+299 return f"{base}.{member.field}"
+300 case hir.IndexRef() as index:
+301 base = self.gen_ref(index.base)
+302 idx = self.gen_expr(index.index)
+303 return f"{base}[{idx}]"
+304 case hir.IntrinsicRef() as intrin:
+305 def do():
+306 intrin_name = intrin.name
+307 gened_args = [self.gen_value_or_ref(
+308 arg) for arg in intrin.args]
+309 match intrin_name:
+310 case 'buffer.ref' | 'array.ref':
+311 return f"{gened_args[0]}[{gened_args[1]}]"
+312 case 'buffer.size' | 'array.size':
+313 return f"{gened_args[0]}.size"
+314 case _:
+315 raise RuntimeError(f"unsupported intrinsic reference: {intrin_name}")
+316 return do()
+317 case _:
+318 raise NotImplementedError(f"unsupported reference: {ref}")
+
326 def gen_value_or_ref(self, value: hir.Value | hir.Ref) -> str:
+327 match value:
+328 case hir.Value() as value:
+329 return self.gen_node_checked(value)
+330 case hir.Ref() as ref:
+331 return self.gen_ref(ref)
+332 case _:
+333 raise NotImplementedError(
+334 f"unsupported value or reference: {value}")
+
336 def gen_node_checked(self, node: hir.Node) -> str:
+337 if isinstance(node, hir.Constant):
+338 return self.gen_expr(node)
+339 if isinstance(node, hir.TypedNode) and isinstance(node.type, (hir.TypeConstructorType, hir.FunctionType)):
+340 assert node.type
+341 return f'{self.base.type_cache.gen(node.type)}{{}}'
+342
+343 return self.node_map[node]
+
345 def gen_expr(self, expr: hir.Value) -> str:
+346 # if expr.type and isinstance(expr.type, hir.FunctionType):
+347 # return ''
+348 if isinstance(expr, hir.Constant):
+349 value = expr.value
+350 if isinstance(value, int):
+351 return f"{value}"
+352 elif isinstance(value, float):
+353 return f"{value}f"
+354 elif isinstance(value, bool):
+355 return "true" if value else "false"
+356 elif isinstance(value, str):
+357 return f"\"{value}\""
+358 elif isinstance(value, hir.Function):
+359 return self.gen_func(value)
+360 else:
+361 raise NotImplementedError(
+362 f"unsupported constant: {expr}")
+363 if expr in self.node_map:
+364 return self.node_map[expr]
+365 vid = self.new_vid()
+366
+367 def impl() -> None:
+368 match expr:
+369 case hir.TypeValue() as type_value:
+370 assert type_value.type
+371 self.base.type_cache.gen(type_value.type)
+372 return
+373 case hir.Load() as load:
+374 self.body.writeln(
+375 f"const auto &v{vid} = {self.gen_ref(load.ref)}; // load")
+376 case hir.Index() as index:
+377 base = self.gen_expr(index.base)
+378 idx = self.gen_expr(index.index)
+379 self.body.writeln(f"const auto v{vid} = {base}[{idx}];")
+380 case hir.Member() as member:
+381 base = self.gen_expr(member.base)
+382 self.body.writeln(
+383 f"const auto v{vid} = {base}.{member.field};")
+384 case hir.Call() as call:
+385 op = self.gen_func(call.op)
+386 args_s = ','.join(self.gen_value_or_ref(
+387 arg) for arg in call.args)
+388 if call.type != hir.UnitType():
+389 self.body.writeln(
+390 f"auto v{vid} = {op}({args_s});")
+391 else:
+392 self.body.writeln(f"{op}({args_s});")
+393 case hir.AggregateInit():
+394 assert expr.type
+395 ty = self.base.type_cache.gen(expr.type)
+396 self.body.writeln(
+397 f"{ty} v{vid}{{ {','.join(self.gen_expr(e) for e in expr.args)} }};")
+398 case hir.Intrinsic() as intrin:
+399 def do():
+400 intrin_name = intrin.name
+401 comps = intrin_name.split('.')
+402 gened_args = [self.gen_value_or_ref(
+403 arg) for arg in intrin.args]
+404 if comps[0] == 'init':
+405 assert expr.type
+406 ty = self.base.type_cache.gen(expr.type)
+407 self.body.writeln(
+408 f"{ty} v{vid}{{ {','.join(gened_args)} }};")
+409 elif comps[0] == 'cmp':
+410 cmp_dict = {
+411 '__eq__': '==',
+412 '__ne__': '!=',
+413 '__lt__': '<',
+414 '__le__': '<=',
+415 '__gt__': '>',
+416 '__ge__': '>=',
+417 }
+418 if comps[1] in cmp_dict:
+419 cmp = cmp_dict[comps[1]]
+420 self.body.writeln(
+421 f"auto v{vid} = {gened_args[0]} {cmp} {gened_args[1]};")
+422 else:
+423 raise NotImplementedError(
+424 f"unsupported cmp intrinsic: {intrin_name}")
+425 elif comps[0] == 'unary':
+426 unary_dict = {
+427 '__neg__': '-',
+428 '__pos__': '+',
+429 '__invert__': '~',
+430 }
+431 if comps[1] in unary_dict:
+432 unary = unary_dict[comps[1]]
+433 self.body.writeln(
+434 f"auto v{vid} = {unary}{gened_args[0]};")
+435 else:
+436 raise NotImplementedError(
+437 f"unsupported unary intrinsic: {intrin_name}")
+438 elif comps[0] == 'binop':
+439 binop_dict = {
+440 '__add__': '+',
+441 '__sub__': '-',
+442 '__mul__': '*',
+443 '__truediv__': '/',
+444 '__floordiv__': '/', # TODO: fix floordiv
+445 '__mod__': '%',
+446 '__pow__': '**',
+447 '__and__': '&',
+448 '__or__': '|',
+449 '__xor__': '^',
+450 '__lshift__': '<<',
+451 '__rshift__': '>>',
+452 '__eq__': '==',
+453 '__ne__': '!=',
+454 '__lt__': '<',
+455 '__le__': '<=',
+456 '__gt__': '>',
+457 '__ge__': '>=',
+458 }
+459 ibinop_dict = {
+460 '__iadd__': '+=',
+461 '__isub__': '-=',
+462 '__imul__': '*=',
+463 '__itruediv__': '/=',
+464 '__ifloordiv__': '/=', # TODO: fix floordiv
+465 '__imod__': '%=',
+466 '__ipow__': '**=',
+467 '__iand__': '&=',
+468 '__ior__': '|=',
+469 '__ixor__': '^=',
+470 '__ilshift__': '<<=',
+471 '__irshift__': '>>=',
+472 }
+473 if comps[1] in binop_dict:
+474 binop = binop_dict[comps[1]]
+475 self.body.writeln(
+476 f"auto v{vid} = {gened_args[0]} {binop} {gened_args[1]};")
+477 elif comps[1] in ibinop_dict:
+478 binop = ibinop_dict[comps[1]]
+479 self.body.writeln(
+480 f"{gened_args[0]} {binop} {gened_args[1]}; auto& v{vid} = {gened_args[0]};")
+481 else:
+482 raise NotImplementedError(
+483 f"unsupported binop intrinsic: {intrin_name}")
+484 elif comps[0] == 'math':
+485 args_s = ','.join(gened_args)
+486 self.body.writeln(
+487 f"auto v{vid} = lc_{comps[1]}({args_s});")
+488 else:
+489 intrin_name = intrin.name.replace('.', '_')
+490 args_s = ','.join(gened_args)
+491 self.body.writeln(
+492 f"auto v{vid} = __intrin__{intrin_name}({args_s});")
+493
+494 do()
+495 case _:
+496 raise NotImplementedError(
+497 f"unsupported expression: {expr}")
+498
+499 impl()
+500 self.node_map[expr] = f'v{vid}'
+501 return f'v{vid}'
+
503 def gen_node(self, node: hir.Node) -> Optional[hir.BasicBlock]:
+504
+505 match node:
+506 case hir.Return() as ret:
+507 if ret.value:
+508 self.body.writeln(
+509 f"return {self.gen_node_checked(ret.value)};")
+510 else:
+511 self.body.writeln("return;")
+512 case hir.Assign() as assign:
+513 if isinstance(assign.ref.type, (hir.FunctionType, hir.TypeConstructorType)):
+514 return None
+515 ref = self.gen_ref(assign.ref)
+516 value = self.gen_node_checked(assign.value)
+517 self.body.writeln(f"{ref} = {value};")
+518 case hir.If() as if_stmt:
+519 cond = self.gen_node_checked(if_stmt.cond)
+520 self.body.writeln(f"if ({cond}) {{")
+521 self.body.indent += 1
+522 self.gen_bb(if_stmt.then_body)
+523 self.body.indent -= 1
+524 self.body.writeln("}")
+525 if if_stmt.else_body:
+526 self.body.writeln("else {")
+527 self.body.indent += 1
+528 self.gen_bb(if_stmt.else_body)
+529 self.body.indent -= 1
+530 self.body.writeln("}")
+531 return if_stmt.merge
+532 case hir.Break():
+533 self.body.writeln("__loop_break = true; break;")
+534 case hir.Continue():
+535 self.body.writeln("break;")
+536 case hir.Loop() as loop:
+537 """
+538 while(true) {
+539 bool loop_break = false;
+540 prepare();
+541 if (!cond()) break;
+542 do {
+543 // break => { loop_break = true; break; }
+544 // continue => { break; }
+545 } while(false);
+546 if (loop_break) break;
+547 update();
+548 }
+549
+550 """
+551 self.body.writeln("while(true) {")
+552 self.body.indent += 1
+553 self.body.writeln("bool __loop_break = false;")
+554 self.gen_bb(loop.prepare)
+555 if loop.cond:
+556 cond = self.gen_node_checked(loop.cond)
+557 self.body.writeln(f"if (!{cond}) break;")
+558 self.body.writeln("do {")
+559 self.body.indent += 1
+560 self.gen_bb(loop.body)
+561 self.body.indent -= 1
+562 self.body.writeln("} while(false);")
+563 self.body.writeln("if (__loop_break) break;")
+564 if loop.update:
+565 self.gen_bb(loop.update)
+566 self.body.indent -= 1
+567 self.body.writeln("}")
+568 return loop.merge
+569 case hir.Alloca() as alloca:
+570 vid = self.new_vid()
+571 assert alloca.type
+572 ty = self.base.type_cache.gen(alloca.type)
+573 self.body.writeln(f"{ty} v{vid}{{}};")
+574 self.node_map[alloca] = f"v{vid}"
+575 case hir.AggregateInit() | hir.Intrinsic() | hir.Call() | hir.Constant() | hir.Load() | hir.Index() | hir.Member() | hir.TypeValue() | hir.FunctionValue():
+576 self.gen_expr(node)
+577 case hir.Member() | hir.Index():
+578 pass
+579 return None
+
581 def gen_bb(self, bb: hir.BasicBlock):
+582
+583 while True:
+584 loop_again = False
+585 old_bb = bb
+586 self.body.writeln(f"// BasicBlock Begin {bb.span}")
+587 for i, node in enumerate(bb.nodes):
+588 if (next := self.gen_node(node)) and next is not None:
+589 assert i == len(bb.nodes) - 1
+590 loop_again = True
+591 bb = next
+592 break
+593 self.body.writeln(f"// BasicBlock End {old_bb.span}")
+594 if not loop_again:
+595 break
+
597 def gen_locals(self):
+598 for local in self.func.locals:
+599 if local.name in self.params:
+600 continue
+601 # if isinstance(local.type, (hir.FunctionType, hir.TypeConstructorType)):
+602 # continue
+603 assert (
+604 local.type
+605 ), f"Local variable `{local.name}` contains unresolved type"
+606 self.body.writeln(
+607 f"{self.base.type_cache.gen(local.type)} {local.name}{{}};"
+608 )
+
+luisa_lang
+
+
+
+
+
+
+ 1CPP_LIB_COMPRESSED = """QlpoOTFBWSZTWZ+vjFgAASh/gGcQxARrf///v+ffC7/v//9gjH58+yEmt9nWmGzbbNTbFPd3KVW23j7Vi9HuAj7vVefKGy2JD5SUM6tmwaAFuum3u8HgA9wSAHWngABzPeruFee7xvTnufW7tlgAAAA7YN2AADHfYrL19B6AH3m7mcOjPfAZF4jReAAAM94wifQABgBe29YhpgIbNobWorSkLnQp0AJ9Pvj64X2QKUCB7ve8OzIBVD5h3EOjnmmIaN4DuveHHIpre97OvAAHM5xxKA000sAGaKZjHoA3zWVlHr3dcAMAAAISAgqRACgAABmAAAGSVyZSAPl6A6DdnRAAAFejB5lw16PQAdPWgCgACnO21xGICsgFCEipPY97Z402PDmGqflE09T9UIwmyibSlTGkaADRo0AAAAAAaemlRJRpPUpvVMnqaNNNNBoAGgAAAAAAGntVSUJmpqeVJ+mKn+pR6QABkaBkMgAAANqASeqUUgSEwZImmT1AANAANqAAAANAKSkRE0BNEyZTyKn5NEym1Noh6mmaNRtNIADTJsoCokgjSE0CCeo9ENGhqDFPSaT9T0pvVG0n6poA8U9J6j2Ur6BlHpq/D+jXJdX+H8N/d1xsHWraNpbFT+/cg2Mb15z8Z+Gu3++JLvYtcY4/9damr+Gv12Rry3zbI2Vab+P8vAdPPv/Hj/z/lxlf06/6a+v2enjqoSTmmWVbKtWqiJKIiMpbEXd1W0abDmquZNmGqm1U2lbDYtpbVTaqbVTaqbVTaqjbaNV213XLkRtlKxsbMsWMY1ts1G0bU2tsbYqjaMltGTVXrbVrkREREREbY2tY2qNqiobKTaRbKTaobSW1Q2KbSq2qG0lsqtlVtaotXu9dtVAAAAAAAAAAAAVWz2RV1g/ksBdZG0jmtJDjari1L51uBt8OwHy+Nb9S2vlte7lrdddub165htJdKOfUhemKi4Ui71d21vl63fPbc/Z/8/YAAAAd3c2v4tVeW1+F7AAANVeaq84AAA20tr3gAC220lkc/RI/T/lKyBVSL3c8d8zMzMzu7u7lvravK31vSAWry1ecAq7dbd6VVVXdbvj7/2b3+/33v+AADu7ube615be3oQDWvNa84ADbLb3gAKlXm83evN5e+t5tZK2xWppP8K/0If0n7/938PWQPZ/bMf9sfwVLS1/t+f6Pj/rP0z/L/PMz4Jy/y+ppMnxLK+liv4v6n0KfQxowx35f/b/ZM6Sy2aV3KakWLYpdNaaYVkiyWysphhgw8ft/H3u2u9vb2+Hx+4AAAW2+O27zbb969AgFW8q3nAAGqVXvAAGpV9LdmmUkbfm31vo8Om89ryd3h4Yxj6c+X1/J08HZwnY7tNNR9QAABbbzbd5tt9d6qq1QVbyrecAAapVe8AFtsKPOSfYgcvd09XtP9HxJ5N3OL15W23tr57zmzXa2ZmZmta1sAAABbb3bbvNtvnvVVWqqttvKt5wABqlV7wABqtt7u28zeu3z3bbf6992/Lt7/f8QAAO7lXzq3lV9b0CAVbyrecAAapVe8AAalXxXu/1aj/p1Ej5s0fatf6YzeBk8/pyal/Kv82oB/l36/x267fh+v6fhbx/H793reu9fh+IAADuVe1byq++9AgFW8q3nAAGqVXvAAGpVz3u7u7u7u7u5b21eVvb0gFq8tXnAVXbrbvSqqq7rcvQAADuVe1byq9vQIBVvKt5wABqlV7wABqVfy7tVfT7XK5+R7HwdD8Qzzi78meQDIgIMMYUuoCBdqPsIEOzs+1/zY3bt3295J927ly/o7uz+j+jw/o7uzgbzfDfDeb6/XfNPnP4/PX6vyT8ft+oAAB3d3d3d3Nr9vVXltfK9gAAGqvNVecAAAbaW17wCqqqq267t7vl+e57vXwAAACr51byq+d6BAKt5VvOAANUqveAANSrnvd3d3dwAFtvW27zbb1vVVWqqtt3m1vOAANUqveAANSpegABbvW7bzbvW9Vqqrdt5urzgA1lb3gA2Wfzvtft1vj+L63j0/6/gd9P1b/n1/Ez7dfpr2Rj9CftV+kxT/qxUu937X6fyAAAu78u3bzd3reqrVVWtea15wAG2W3vAAVNvX0ezy9iZmJmItxMzExr0+6WpFJVpMWNkYstgxYbKxZNixYtkxZWwxYNliyNjFibMCo/yi5IqO76PH9n8Pw/Cd77NtO/etnW2cE5tnXz8ZDadbZxv24/v2T+smifF+h+l+hjGOurexhvJvJvJujOZzO0jGM/ckYxmkYxjIxjNItNNjTTT63J3SkxKSlFZiVSzF5g44WYsxZizF+RHRTWq3+q4HF80zGsLWVkCtDWWNqyoY6kdXFSIwh+NP4p3dPDzdvOrS21rbeZluMy26zMzMzMzMzMzMzMzeepatW+hPIMccccta1uh++qKEsqUoSypSgqle0ns/u7vjLt7Tnbp06Y2NNMYrFVXep/dx9rSqqqqySSSSSSSSSSSRmr03p6ei90ebwH8dU9oX5ao2tU1amoa1lNWTRNNZGWtWjRNWsTVhqGjWo1atQ1NZGrLUNLWhq01DVawasahoa1WrWoajWVqzUNJrS1bSZAaNa0hjKLGUWtUoatStWn4kRERERERREREREREREREREREa2r5/FkrJWX3UE++eeaSnOMhUY4oCX48G25SlOUpTlKWQFw5FBffvw1rXvN97fu+Ps2B6PBLUqk0Q/F48eMwAAAPw+Hw3flt9dbWta3Wtaqp3m36PfnCWpalqX3F5L6/1XN0zMTDd9PL62r6fT6AAAD3etvdXv23dtOcTMxMzE/v6xwSGuzx9siSRH0okTNE/PAh+OKLvJS7LELYJ9afkvrfBmZmZfBmZm58f252rZZ33/P7/n+srlfzVyviuVyv4zvJ+3P5J1999+K5XK5XK5XK5XK/Pr7yfj3dIGK+vtfCR2dxd93ZXZ2Lvu7k8dyTqSTbnp0j0XmTuZF56dPv35fb7fb8lfJ5tvFcr+KuVVcrlfkk/KSEk+0kne+++/Fcr9K/X19TvnvvvxXK5X5PNt9K+T6n1J3z3336V+T5PknXp0J+pnfXz58+lcrldta1trWuzv3R5wiklWSD8dnX46TX2bSTxE1T4Yvp9Ll1TY56ZkXQeIm7ws0ePFxdU2OeM0TqHiJqRtRvvMhqRaZvVQes16enp7Na16vRxvv56rlcr/An4T7Sd8999+K/J8nyTv0dCSHEOU0h6/Dj568e/vhdJ5iah8u7uR1TuJkO+7srpO4mqu+7tT5WL6eF5NIdS1wyjz5u5HV2akm3aTue0hOkm3bp0978e/P7/f7qqqq+zvJxOJ33888/Sr7PtJ3yfPfffiuVyuVy9fH0XxMQ90tcMo+Pxu5HV2ah33dldXZkO+7uT42q+BNqsBYNkwFlbTUU1DWS1qNeDUcWaZlta1mLVcsrrNds2rqSyUTJKm27St1l5E82lXVm1+W9umpIYsarudjcp0scaTi1rMNrTJWVbprXUySomSVNW6a10xLQxKassWzNsoY2LWTIZsWtNBlsrWqyGNi1kyGbFrTILFZmqaqUVMtmqkUyWg1DWS1qMssxa0MRjMNZWIzMa0sRlmLWhiMZhrKxGZjWloMti1oaDGw1laDMSHHTju7jv0fl+X5foVyv6Fcqq5XK/Uk76nEnSfU733336Vyv0r9STzbKviuXXYThKQ7Jxxxx21rW7lyTEd6k7c8899acr+CuVyuVyv4T8JO+u6Sd8999+lcr21rXSb7bbb61rkd1LZbEd0id/PEspB3LXLKPj8buR1d2od93ZXV3Z0k27dOn6O/L7fb7fkrlcrlcr7Pwk78pZ3z3334rlcr5PknfJ8999+K5XK+d5tvFf0efYTvR5eU1ENRrU0SaNamojym+6ecsQ7lrlZR583cjq7rUO+7srq7rId93cnm8+F5rEO5a5WUefN3I6u61Dvu7K6u6yHfd3J5vPg/XnpYh4lrllHp6Xcjq7tQ77uyuruyHfd3J6Xy8AF8L4XwuVyr3fp7nuO57jue5jLPxjCMIxnM6zrHDh810saZdLGmXSxp0ulxcOHD5rpYxl0sYy6WMdLpcXE4nE7XSyZMulkyZdLJk6XS4uJxOJ8l0smTLpZMmXSyZOl0uLicTidrpZMmXSyZMulkydOnHl0zpnTpdLi4nE4na6WTJl0smTLpZMnS6XFxOJxPC6WTJl0smTLpZMnS6XFxOJxO10smTLpZMmXSyZPUCSd9id0Z5559RXRX5FdFWK6K6K8CHKkqkqk+CeXaTZOXHNzKuZmO7pc7u7u76b6MyTRMk0gmttu85es1Jr2sS6ZCyVamvnts2lWk5eFsurlwdOrHDDjR1Zxq2WzQ2TZkMNjStNMJpYtJdEtGGYYMvlneq1XtIk71IWkLFSNYrYZqKjRttrFqzRNhAn0E7hz/H9bukI/Zqu7b5/T4/QAAAD8Pv7bdv2/n8N5tw/Lonn+Pfjhnr48eMzNtt/rv5kIkkac885MmTJ07v0fw/w9P1CU87p4BfDEBkgiQGSbx8PBKed0MJAZIIkBkngAfO6d193p6JTzungF8MQGSCJAZJvHw8Ep53QwkBkgiQGSeAB87p3X3enolPO6eAXwxAZIIkBkm8fDwSnndHrxHlTx4jyr4B868AfOuAeVwDyvkA9rgHlcA8tegAAPbXAAAPLXAAAPLXyAAAe2uAAAeWuAAAeWvQAAHtrgAAHlrgAAHlrgAAHlrgAAHlrgAAHlr0AAB7a4AAB5a4AAB5a9AAAe2uAAAeWuAAAfhqr+1av7dW/VVv3BfiL6i/NJ6RX1FhZH9Un8gmpHSdDodDodDpJzIdCip1J0NQOkOhOhOhOhOhOkRzCToSiVDqI6E0kdE6DoOg6DoOiTlIdBQpOknQa73jTnXbvnXfrV7662iN5GyTiScyTtJOpJ3ROSPdVqtT3S9ldQeyPYXsL2F7C9heyT0ivYWFke0nsLqDpDoToToToToTpEcwk6EolQ6iOhNJHROg6DoOg6Dok5SHQUKTpJ0GkjonQdB0HQdB0ScpDoKFJ0k6DSR0ToOg6DoOg6JOUh0FCk6SdBpI6J0HQdB0HQdEnKQ6ChSdJOg1I6TodDodDodJOZDoUVOpOhqR0nQ6HQ6HQ6ScyHQoqdSdDtDtO0yTGTMsXGZWXL8H0k9MxPfPhNp8OO/X45468dJm4wlM3GEpm4wlP9LD1nJMndMgWfP1+TRVPJuSrE2466X6X7sI/f32oh5xInL2+6q6g7zZVfPw8evy+XyzM227O77OYcw5htIJ0pKpKqe+SS+nht9XLbpP/x+a39Of27nu/Kknh47vlv0X0SgAAAA1qqqqqqrtxQAAAAa1VVVVVVu4pBoMUAAAAGtVVVVVVdug0GKAAAADWqqqqqqu3QaDFAAAABrVVVVVVXboNBigAAAA1qqqqqqrbndndndnOczMzM5znOc5znOc5znOc5zaDQYoAAAANaqqqqqq3cUKAAAADWqqqqqqu3QaDFAAAABrVVVVVVXboNBigAAAA1qqqqqqrt0GgxQAAAAa1VVAAABO60KW2237zpL+cbvziuiv60V0VYroror+18kk/P9z8Z37c/Xl5nvaaeTgN8u7du23DfPXy+d8/nbfZWxow0U2KaKYU7CR5R9TGpxVu9W3JmVwACAibCfl/L+Xu734fGr4r4PByVyVyVyVyVyVznOc5w4cOrq6vfQ+O4BBoC4A+WvZPZOw9Vnqt6r1o7WdrdLunqoTp7OhOlnQnT43wwlM3GEpm4xq5eu6RPE6gZA6kVI/MQnrN3Ltb46eNlprWtKXbqdTymTJk23vF4rTx+JbU7xxG6d17u7tJsumm0d4scRYyLHaAeVke96Z0kUkd5FkkG7hzb47vGwGMseJp9fX2tunsJ5CfhPrtz31x3nHPHZLN0kngh3SMIH4fk+7iosjx5c5ma1rzTQAAAe3rt3fq97tt27u7fbd3W3+Pd3bvPl/Z/dAAAu793t283d/X3oIBrXmtecABtlt7wAAEkO7+tG+HnM8xzzeJrCPM/d6Sd3VPsC+xD+lJGoX+zgaDFX+ov9e4RO1LfuWWsVtJrK1tkNaTTFZlY0m1atUcqTgAAW1u4a2vi1V9/+b8NmSPpkboH7FfV+p+v7//T9HUjqR1I7a1r7X2fOR3AAAAAAAAAAAAJMzm7fk/ffF87XztLOiTTTpp0Z02n1PPPLbOOJZZZsHyz9yl/TxvJfnzWqH7X7UnftzXjMtZ0n26X+Lrfd93xAHy3nngAAAH72/c1tHL5/o+6SZmmompqaTSIrWtExjRpJK1rRMzTQdu3bGMYxj8WmmmMYxhBBBBBBB3dpzncLvxdo/R9ea7mY/PlSVKUF8xSipThxs48ePGMYxjHcknm2bNmZmMY+uCbzzz6743r16AAAAHq7zwP0fov24f1P6ErBZWCz58+W2yy8E+vfkPnyVgs7wLvhuHbLLIZPIHLIKQMpDJwSSSSTkkSSTXt7e3t8vbXt7Z5rzze3y+X3AAD2888AW237fb8J3nnltssvBGRne/n+f/7dPnyfJFAAAPnz5888AAD58kVtttttttvz58+e++0ADbNs2wZmZm/Rt35/n/N+e/MJ0/YI5Pnv38zoRQ0pSk6EUNKUpp2755KU0kkklK6Ls1dT32JMpL8uNJ/h+ot4iPv/adMkl+1p+D+LGVCoC3/GeLiRK/L78hqAEJDXH3l4xHhDD17I9nz79+50IoaUpTFjTTRflmB9scZfRA22PDzoiT4kuoifzm+/5rN4pL58+ToPnz4MtZSlkN8LY7wN0MProjo9evXU6EUNKUpox3zJl27Lq+8kknpuc/KRJJO+56y0wRJ5kveMT6rff1tN4pLrrqdB10+5W+Q3wtjvgN0MProjo9evXU6EUNKUpjrrmku/fuuqUokkkkussr77/MpSSSSSXHB6z7QiTzJe3E+rX39bzeKS666nQdY9jvuggggghbDag2SJ+uiOj169dToRQ0pSk6EUNKUpjGI7duySlPmnruqoko+cMH6xHlv6nhhhla8Y5U+r3oS/r6wlfSS9SmN/oni5EYdvnBC4xeXjginr2R7Pv379zoRQ0pSmOo0Omkvk7vmOMvRA22PDzFESUfdPMfOR8NJ/NsmT8+SmPnz4Mct6Wjbcin10R0evXrqdCKGlKUzY7akyS7dp9X3kk9NznVIkknfc9ZaDBElH1TrHqo6NJ9b5MnrqUx11D2vthrsRT66I6PXr11OhFDSlKY9vrVJd5Sl3739UpRJJLrLK+++spSSSSSXHB6z7CESUfVOn1YdGk+uMmT11KY6wzFr/rojo/t/d9vfv7RH3fc5kTLbbcQ25kTLbbcQ32+32SXvbq8Xi+4kb7/XGhGh444444iOOHMiZbbbiG9QO3bn70x97PP8E7hatajPOtdyNzWtddaxFauZEy223EN76kkk9+9a33k100rfeSSSTWtc8613I3Na111rEVq5kTLbbcQ3vvqkkkktda1pSiSr27VpSiSSSSSVazExMWGmldyNzWtddaxFauZEy223ENuZEy223EN666pLfbe8Xi+4kb7240I0PHHHHHERxw5kTLbbcQ3rcO3a1p2zztO4WrWozzrXcjc1rXXWsRWrmRMtttxDe+pJJJPfvWt99dNK33kkkk1rXPOtdyNzWtddaxFauZEy223EN776pJJJJJa61rSlK9u1aUokkkkklWuQA6+95ARCKIJCKK3snZOya3u9WsuVay5Vu6bpumMZmZgAAAB9t9fu+342/G+32+34fh9oj16cyJlttuIbcyJlttuIb111SXO3i8Xi+4kb78caEaHjjjjjiI44cyJlttuIb1F1oi2uvr1FwtzyMMOediNjzzzttzEc8uZEy223EN7akkkkk84487bc844kkkk884Yc87EbHnnnbbmI55cyJlttuIb221SSSSSSSXLfO+/PLbSSSSSS+OmmmMY+Ca1rMzGMlrRpPLy8vLaOeXIoAAB8+fPnngAAfPkitttttttt+fMMKUokkkkklYaafkAFwGW5G5rWvfvWIrVzImW224htzImW224hvbbZJeNx+D9b0cBgMLiRzzTx2I7Hx48ePHiI8eHMiZbbbiG9RdaItMa6+vU7vNrcm1g3fbgjg2tbji0RazmRMtttxDfGpJJJJNscbX3k7bWtfeSTa1qmzc7cEcG1rccWiLWcyJlttuIb441SSSSSSSVm7UpRJb72tSlEkkrWtY+Rll58EeD58+fHjzEefLmRMtttxDbmRMtttxDfjx4SXjYeOPBwGAwuJHjxTx2I7Hx48ePHiI8eHMiZbbbiG9Rd5iPM7tdfPmY82tybWDd9uCODa1uOLRFrOZEy223EN8akkkkk2xxtfeSTtta195NrWqbNztwRwbWtxxaItZzImW224hvjjVJJJJJJJWbtSlEkkt97WpSiSta1j5GWXXrkjk+vXrnn1EevTmRMtttxDbmRMtttxDfPPKS53mJidxI338b5kZnfffffeI33cyJlttuIb1F3qI9TA119ep155GGHPOxGx555225iOeXMiZbbbiG9tSSSSSecceb7ySSdtueb7+ecMOediNjzzzttzEc8uZEy223EN7bapJJJJJJLlvmlKJJJLM93u+Px444+OpGpGpGJiYmSZJkmZmDBgwYMGDBgwYMGDBgxMTEwYMGSMkZIwYMGNm2bZubm53O53O53O4O7O7OnKcpynFxcXFxcXK5XK5XK5WZmZmDBgwYMGDBgwYMGDBgwYMGDBgwYMGDBgwYMGJiYmJiYmDBwcHBwcpynKcpynKcHBgwYMGDBgwYMGJiYmbm5udzudzudzudzudzudzuAAZmZmZmArMzf0f3N69evPXbzZdjZWzMNts1Ppfd9/6nLlyxjHyI52bNpbbZe/YVsssssssss/jyeTbeMYyyzGZnZtpv/y+x9nl4jt6e8aHaQ6hJMFSNbXfyX8pFzkXORc5FzkXOLdw+IcCUYOEiJFGDQlGDUiJGgzQsnZ+p1447B7NZrzVq+vOed8YkyyNb4mqb7a0c1a78O2+vZh5ucPgO0yL92PKzW9y548NQ8qnijXE8tvLdG1FS06zU1N5ZxNp1OZtNpsIZO07zpebtHm8xXC1qva5c29eK5qd5cx27a0dqtduHffXWFVpWzd3cNmzYJju7u5w2Jw4SGEtiqi9Sst7YkyyNqmU7dtaO1Wu3DvvrrC3V2378bbbCZ3793GyccSGC2LYvS7nlhHta7j3D2D9gfd7Hy/H+bZ+W+fDn9F/P9P7j6fwclr3vg+TH4Pjr9dvff+e3d8/lzAy2mZZ5/X9S1/L+LMmRmNYzUZj5bf4ckOpHukf2SPED76f1l9jmnLe7P8Esb/oq5G9+rbnee6Bg8V2VrCYGTvhn6WSb7t9I7/V2gbaa0kcTTWpHnJprUDfTWkjeaa1I3k1wO45x+xwhj3zgLsLTAnnhcAA5RtSQUCJgTiBdcO10o3pIL6n1pN9fXdP09z9p95pOfL0kmYs7p9uYvdPe597w9hJ5J29vSSZizunnMXunvc/aSfW2JrfIHOmtJHM01qRzJrJHY+nqCnVOjrqFOqdHXUKdU6Hrq9fZttffmt3MMC43fQIA1zCAGBuuzzGed9+azzmMwLjdmCAM8wgBgbrs8xnnffms85jMC43ZggDPMLPNkHl15XXlnl5bPIlnkseF8eGQeO/i68Z48bPBLPCx4Xx4ZB47+Lrxnjxs8Es8LHhe/T32d3ed555PPJ3d53nnk88nd3nbTad3eed55PPJ3d553nk88nd3nneeTzyd3btptO7t202nd2k7zvDyeeTu7zt3h5PPJ3d527w8nnk7u87d4eTzyd3edu8PJ55O7vO3eHk88nd3neabTu7ds77Vd3fbvtV30uxl6vV9Hq8l8vpyDyxZ3T78xe6fwO59jOJc9JJ6xZ3T3mL3T3ubJw3pJPGLO6ecxe6edzZOG9JJ4xZ3TzmL3TzubJw3pJPGLO6ectakbya4k8T1Tz9D1byPVY7ySvKcnb33ZH5vl29bfyB81D1D3B+2/y4dt5j2MxZiy233dV+19QAAAAPi3x59O7gBQAtrZu7nbdnbdjtuztuzmzZzZtdc53O5s7nc5zvfXdXMcxzHMcxzHMcxzHMcxzHMzc2ZubM3NmbmzNzZm5szc2OY5mbmzNzZm5sczNzY5jmOY5jmOY5jm/ubbzzvMcxzHMczbNt2BmTGMTDGJh8eJrXs+KqWVOGybGMTDjibNk2NT2/gxPkzLUfKVOU5Rvhtzc3bNuZubM3NjmOY5jmOY5jmOY5mbmzNzY5mbmzNzZm5szc2ZubM3NjsYxMMYmGZMZIxAyBkjEDkHKcQcg5TiDkHKcQcg5TiDkHKcQcg5TiDkHKcQcg5TiDkHKcQZAxiYYxMMyY08+duFbuGaf97u/m/m9Xg573y8jNGn0eVZtjf36Rz4nrtjVe3iPe/IZJ51akkpJdue3zk4HocHY8Ya9Pv3m23nnsAAAAAAGZmZoJ9Tdvv5Tk4kTmyMh1xj5U51nss8mvxvnsjvIRUd98d6d9Z3s7td3fZHeIi9+GpGtaaGMZDNNK0hrGlag88zd7/u+QAAAKqqqqqg+3Vba80a8rbXlba8rbXlba8rbXlba8rbXlba8rbXlba8rbXmjXlba8rbXlba80a8rbXlba8rbXmjXlba8rbXlba8rbXlba8rbXlba80a8rbXlba8rbaV5ohQeaIUHmiFB5ohQeYghbXmiFB5ohQeaIULa80QoPNEKDzRCg80QoPMQQtrzRCg80QoPNEKDzW2vK215W2vK215o15W2vK215W2vK215W2vK215W2vNGvK215W2vK215W2vK215o15W2vK215W2vK215W2vK215W2vNGvK215W2vK215W2vNGvK215W2vK215W2vK215W2vK215W2vK215W2vK215W2vK215o15W2vK215W2vK215W2vK215W2vNGvK215W2vK215W2vK215o15W2vK215W2vK215W2vK215o15W2vK215W2vK215W2vK215o15W2vK215XMzU1l1m3KQfhxPx8PgsOZISdgTf4b59fty/XeIA57Iy5YZcsMrKMsyyZa5bmua5blc25uVcuaufiq++vS+CpV/kJOuW3kfIXqHRX/n/6/9PVRXqkvX933drp7DicVew4mDE9hkwyfhTp4cvquU6g8KfRdJpJNEaTSNJJoj0b1uyrjDLcXMVlxYnvgWWB/wz2iHbtOynuKTCaGyJH1IbobpE3SJuQ8fanR9DumjH6j9b9Zs2Nmxs2Nnqn6fafbmFp7lXl83zXzXzPEk/kNjwPAvAvAeEfV2uF6ydzqvC+yO1ee3buO1d99R0rrLxO68Lo444cx5VH8zp7zw8PNk971v5M1NMa001rWtdJJ6p9j0jf0/Nl80mpPZlivSTxPT08iPHr38eOk1PE508SeHK5a5/UAXDTT7tH20uEuwuiQ7XXdhgNgu/bAC4aaZRnkBryhzRNPI8PDw4STw9Y8deMvUGh4yyvCePHjwR48u/jx0mpXSddevj18iPLy9fHn5+carzTz8/LwR48duuujXR3d3cJ7I4HCcOOOAd+HDhxxwDjjdvvuDf2E3N27cJ2jmTsnDjjgHbhw4cccA443b77g337JbItC222hyMIYGDEJOTly5Cdo5k5ThxxwDtw4cOOOAccbt99wb9hMTtHMnZNGMYZTsdnZoJxG8nCcOOOAduHDhxxwDjjdvvuDfY2bNgnMcScpw444Bzw4cOOOAccbt99wb7GzZsE5jiTlOHHHAOeHDhxxwDjjdvvuDfmRxA5SMTEMJkmRGJMyYwYJgfFNDQmgwYJgYMEwMGCYGJiGEwYJgZIyBiRgwTAwYJgcXEcLlck4rlck4rnLjxTqmWWrVthhhhhhhhhhllhhqamGGGGWWrVq1baDqDIyNJpNawsLCwsLCwsLCwsjIwsLQaDCwsLCyMjSaTSaTWsp0pixZWVmYMGDBgwYMGDBixYMGUymDBgwYsWVlZWVmdl7lyHxHAm4nIbkPSeb3ZMZjGZmcu8+Tvk46zrPx7bntNNpppttvw/OedJ53TvFLwj2SfAvWDgvxwFHIPsdpHaB2gdkjhJP2eENBuG4ZNfs1U5ERERERFb5Xfk/R2Z59J2Q3Q5JhIyRYDQomC6Dio5T1oXKcoduLi7NBxTtBxTodC4H5kfv/d+/qutJD96S/dxYyZViX9p8f0c+f636+VzSVJKlWSVEX5sfd8/rX25y4cOVcb2yE+b6sB+RCkiMD4/Lx9n4Y+qzalveo1X5ac6ZN1b/fiffY2qdhZO9b1ze9mdnbUnDstWrmMryeV8kZItShqjJbYiIhIiSIiEitWwQsJJucoej842HMPEOz7IeXt+nMzwNOUOuV7zyCFlSzZPJMmBdBcfV5Xl2C7YkrXrV9bLwspe60HV0uC+Yu7i+xcXF814I6X2L60vEHyLC9lJTVfJ9roL5tKnuvBeVL5r7RZ9X3PQH1SqmF76vnS9l91LsPovVfcuQfdT5Cyn7adLKeRe8IzLPmvguMrZToLj6PgfN2F4jBeGJKVkoe6HiJ8fGPjTz1nts8Neb47SHbbHanbWdrOzXZ22kdt2Zi1cYrKxWYxHKmFIcKkaaMDYNmHYww7G4mjk7obpHcUOpESKjw9Hbaq8bV+O1UEREBEBDZs222bNpUaIrp4LypfJfcLwHkqqwvRXwpeq+2l2H0p6e/35mYYYakeYnvkbyQ4DpO7JxuqIiIiIi+6qt4p+SvlXJaaBj2OXsbA3EoN1EkLiKF9YeInv8se+nnrPbZ4a83v2kO22O1O2s7WdmuzttI7bszFq4xWVisxkc1iocWRrTBsNsdmMdm5NOXeG8juYe+KtPfenQc1HwQbbNmzYBEBERARGttS1B8mqu/A8kfI+0PRVV5D1L4I7HvQ2D1kenv9+ZmMY8w0bjuTsy+2n4fi/TH/QsCv0pH6f2n939n3n+df2fFwzGH0Pg+xwwPi84FcJsbNzY1NTT7d29Wqm83m7f9jn0Kti1FssxhMSrbastWqqt8Ycu5U6YxKp3PrX8a4e6tcXTZr+k45myf0snwe/+8pPpJ6QixImu9tth8Pans9zD2MeuzY7yfP6dfm2fWt6AAAEREq1atWrVrc3mz3PPxN1qpu3bt9nB2lKj9r/gxqYmkzTZ4UPV936LbbbaDr9Nvl7egLLApQJe3qRVpYp7lP3v3scckwV08372x8NvoRBXHwZA/Piev0sVjD4PofQ6eFkqV+iUm5BJdKTcsA/wdzxFzkXOcAADkRwOcAAeV3ADxFzkXOcDnAAAfbe23317WvPa11VfFCg2KDAWBq5VuyN4ZtofNjwSmhhIEpSA64wlIlIEpSBpNcYSmhhIEpSA64wlI7mbObmbd2HQxOiYTE0lbRIDNcYSmbjCUiSbVMJRk2UwlOmbjCUJMuMJTNxhKXiMOeOeOvHdm4wlI7KYSnTNxhKEmXGEp0zcYSkdQokCctVaVuYxlxdXd1dWu7XVrll1xCbKYSmbjCUjpoxhNCMJYTN88vhinknNxhKeNxhKUpSkQY46+JeefHXgADARpb3bxTwSmbjCUzcYSlkxcYSmbjCUzcYSkSkClL5SH62s/f0+fN8PRKfL8+fPffh6JT5fnz5778PRKfL8+b0O8nlnnz57jwSnt99889PBKe333zz08Ep7fWT3y+nglM3GEpm4wlI2TbYwlM3GEpm4wlIECBAiGtEgdHXGEpm4wlM3GEpEGTCmEpm4wlM3GEp0zcYSmbjCUzcYShJlxhKZuMJTNxhKdM3GEpm4wlM3GEpu6FIFKQKYSBKci5yLnI8qcjtqnI5yOcjttOREc5HOR08eIulqyWrJaslqyWrJasiPKpyIjrapyIjnI5yOcjnI6+fnnoK8RwLBCTvAuGEqFFHW7QaaaaymJiYEgggnMTnOd9B3eSfQKqqq1d3xfB+J8mzyPQ9HrnV9bq5foSE9zS1ZUtVS1a+JHfdJHx5zteLq5fjE321vd7q5doGoGQNoFgdwaDqDQcg0HfXO93utzbaza7XVy9OKnt+hhWMPi9HDuslSuypNyCS6Um5UA+3c8Rc5Fw5wAAORHA5wAB5XcAPEXORc5wOcAAB9d7bfava157Wuqr4qKDYoMBYGrlW7IrVu8MrI+bHglNDCQJSkB1xhKRKQucj2ve9evHPZ68Rc5HnvevXjl45Fzke5V5UrXlaVaVp06VtEgSgzKYSmbjCUzcYSmbjCUiSbVMJTNxhKMmymEpm4wlOmbjCUzcYShJlxhKZuMJTNxhKXiMOeOeOvHdm4wlM3GEpHZTCUzcYSnTNxhKZuMJQky4wlM3GEp0zcY8c987168cvPeLniLs22a2cpROs5ymEpI8QmymEpHZ818MU3knZ8PBKeNxhKUpSkQJwULPIvPPjrwABgI0t7q+PPHw8czcYSlnYuMJTNxhKRKQKUvlIdDvPHHglPPM+HglPDB3eeKeCUzcYSndm4wlM3GEpGzttjCUzcYSkCBAgRDWiQO51xhKZuMJSIM7CmEpm4wlO7NxhKZuMJQnZcYSmbjCU7s3GEr3zvXrxz3acjnI568Rc5FzkXOR5U5HbVORzkc5HbaciI5yOcjp48Rc5FzkXORc5FzkXORc5HlU5ER1tU5ERzkc5HORzkdfHnnoNeK4GwQT471xRgZRV3ISMpcgZjkdAj0N0ORMeZD0LATGgyHsT233X3XVy/SBUkfHbN7vdXL8Ym+2t7vdXm7U6U4p2plO1Mp0plOLoTumbjCUzcYSmbjCUzcYSvvvkr9N997fObLL5Sk3IJLpSbloB9O54i5yLnOAAByI4HOAAPK7gB4i5yLnOBzgAAPnvbTsbEa2IwG4KDYoMBZJIlIGnTzpLmTKTeS4ZcyULZKBSOlwayULZKaTXGEpoYSBOcjz3vXrxy8ci5yPcq8qVrytKtK01rvO54jx4u9u9Hq99uwQxNpcTE2lwGJtLghibS4mOgTaXAYm0uCGJtLjSATaXAYm0uCGJtLidibS4DE2lwQxNpcEhibS4DE2lwQxNpcLcYSl4jDnjnjrxJEm0uAxNpcEMTaXEwE2lwGJtLghibS4nYm0uAxNpcEMTaXBIYm0uAxNpcEMTaXE7E2lwGJtLghibS4m1DniLs22a2cpS3WZkjz3z497wxTyTm4wlPCJjCUkWpSkSdDjr4l558deAANsBGlu63TvLjwSlnTFxhKRt4LbL5SEkA7zxx4JTwwd088U8Ep3TNxhKRs6bbGEoHAHBENaJA7o64wlIgzphTCU7pm4wlCdMuMJTu3rx6vV5L13Y6qyR682UbKNlGy82x1O7bHVWSrJO7tKIjnI5yOnjxFzkXORc5FzkXORc5FzkeVTkRHW1TkRHORzkc5HOR18eeegt4rcCoIP218p8H4Y7Hc4fW9jkeTvnV6url8/R30kj04zm83Vw+/TvM+HglN3R7pe6buh3Td0O6PdDul7od0zcYSmbjCUzcYSmbjCUzcYSmbjCUzcYSmbjCU/CeR7Xwejw2e1XB6sklU9XZ8fV8a4V0w6cqadHhw9seHZ74UxPb/Rd5p2VXh2d1fFpueGlNOnr71exJ+1KlkEp/W9PHm98/hrWt39+2zaZmf4wn8H11+FQel/q+Wf2X6n938NvDf3d7/dd8P3v7Ye3l5eeeAAAD9Pv/kw0TZKlTc/c2xSe97n42n+5wrts2e2x87GSSek+79rPou/trupbPwvs9bce+96+Fh52R536fLW7n/X6dOUjeJaqSS2RPT0/XprfHbXytW2828a1+mr9bda5ERERFViIiiIvvYtX7jbfPfb8/5z7Sq+GGxSnfffl5223iPhdXSCe/J8MSeKoYVI1O4NSOGMoK+HHr7VnmzJs1jUs1LPn9qQ/4oUZYWRgxbarUwsjCyMGLBiwYsGLDLKW/DagAAAAAAAAAAAAAAAAAfz/LVa8trKtrKtXfPE+m9P6PPU3RzRU6ucCnLnIqcucipy5xKnLnIqcucipy5wKcucipy5yKnLnIqadQf1/93OGr+HOQHUHsLqDsXVOh1ToagaE1A0JpI0GkjQbZm21iarqTqrqDoXUHQuoOhdQdC6U6DpToOlOg6U6DpToOlOg6U6DpToOqdDq15V5teVebXlXvKv2S77r5cAAAAAAAAAPb6qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqrQAAAAAaqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqrBfOkndJ53STvt/M/H5fy52VF/F+TO8mUTyQoqUSoUKW2q1MLIwsjBiwYlCkoUlFSipukmz8/3/dmZmZgBgAftff+V+V5L+h93nnut6vJ13nXeZZm8ePEeS8l5KS8ePEePHiPzbV9wAAAAAAAAAAAAAAAAAfs+ft8l8/pd9Dy15a8te2lr2mTpMnEydoOkHEHaDIO0GQdIMg4gyDuDqDkHcGg7g0HUGgyBYGwNAwGwKDYFBoFBgKDbWbXa6uXaRqRyndNTump1TU5TU7k6k5J3JpO5NJ1JpOSaTvrne73W5j6+fX5Cl7CO+ITilif8Jfgr363v/7mf2/2Kv/aJo5iX7y1L/mn+cT/U/xicn/Gv+Uvd63F/o/Yv7//rGmyv7/senWvn/b31fv0a3/B/x/+evlgfyv6V/kXLWta1rFpVxxczLrt3d0mVNta5t1SRgrSjbLaxLbT+r3kUp8P2FH7u7dP3QMsD4RCRI/7h/eqVPwPwammgXnmI8yHHWP+779Ok7p3T2Tuk973vfavOsia2scxubNt5t3mrbzV5ykpKS67p5Lx03ddeXTedO1hGEIQjOvVeYyHMseOsIyxl6FljCEbeZGtgSEq8x4kZZZYMaYYjQ1q3TMtpmsNKrUpVP2bv6W+pxszukjPeIEJ+/06TundM+Bba5z6qqfOqvtKkL/aT+iq/lXWr90vP7vBUhf6ep+yw1qNYa0fr21UovxmKloNSoaDWqUxRXW2GtTWGsNatYaytYa1dr+q/sDah/Ev8txJ8Xhc/Syke+m0zElpS1NpmpFpS1NpmIWqi7U7anKJ0swMUaZhYoxmRki87bNQgdd6mydXUpzrinOepzpV9LWhxSQuQM7zcpQ/TFS9EM0qzDUszVpVWoZhWtGpbM22mFVqlmKsYaq1s2NVS7sizKtTSqusjaVToTNJaRWkZgsCshmpMSXVjNtb9nwAH+e7gA661daut3AArK3W7gAWW6vlWmp0CBft+J+qfs3eekD19h81tttt/wKqvsnQkk6fN8nsfoPqeEud5HMN5I9e07ycpum03JrNm7TTDRre2lN29VRrNm7Wsaa3tqt29WnLyXx7FRIZSVziS+MMwrKRpZqLKRozBYkvjqMZS/rsJHVGZSykZWZFlI0ZgtWtVtAQEBAQEBAQFbbAQEBAWgICAgKrV+O3xu2t5WvCnB7mDoXrcVV0aPS0SPXFmEvEWaqYkajMUxWprJtabVrfKVtv71vAAdauKsV8YNROCzKxRoZixRkzFqpDUM0TFRqWYTFRqM0TBVZRmUYqNKzKMVGJmEyFWkZqGJGpZiMSNDNUaiXi3Pp9bTFkejL6kynSNCsjIylkZSxKQ0Y5jB2si6/3syzeamazGMZmZznf2BYdHhZODHFk+JU9abSqE9KVSdQcXi8Z8a9UD3cxEQERLStlZW1vzW2+u8qeL/W9mfGRSnzR3TxBofA96ycGOLJ71081Iq/9BJL432zYODlKkqVGCmJUaeQ+TvIT0+aFVdyST1fUfYe5Re2D8MiVGGI9ahelPpe55e55RJik/Xn83+J+G7jeY2qrPhNYWEtkgCqrW/o62zW/VPVlgAGYAUpaWgAaaEmU0oAAAGYAGYEgABoAAAAAGgAAAABqpqoFKAAAAABmAAAAAAbAAAA2AAAAW0toAU0IQAAAAAIygAAAAQAbQANoAkBtNoAA2zbNmpkyDINBoMDA21NTSaTb69Sj74/X+XG2KWWVcTlK/ondMTSVhKmFYmK4uLOHC8330GYqBqIqyIpT75FKe+pFXqu1JC94jiwvLuflrJ7e58rT7v0hUL3SNOiHZAe+Pp9ZHry3Bvy6UlUsxZizFmT32pd3fqqPDvVtaZbTGm0yiI4aqp3RrzNfj8AAHALeWcKUCTwAAcAt5ZwpQKu6NnpEHUm9y5mZmYq222QSpF0gxhHX4mLlZ6XNVi5VVi5WauarFykbJJ9B6cRCRI2JHLq2/8umd/xeD++sXyJ4pCLxeuR8UnxVc89yKU8VHC8Aur7vEX6vzfT7Krb8/DGoUjaIHSFgs8rlz9P284DAD1tvXfxbu99u7fTfNbVzds5mwvJUj3fXlU9NNTVFOqr2nRoSF0/wCUuBdEwuVVMq964qSeH+kHx+SK+/1Vke8viTLM4qrwx9CTlOe9x5sVcquvpCvP5aD9XtI+dF8a66F9YPpeCr2hUL7/0U6vWSSap4VPRVzunvb9Sr4nyqaiBfNhxSQtT6QqF94fSfVZOT9NZPt6d2jLKnwqUo+X5f8+x/uavk+xJd6qQ8n2ettlltVbbrvzrP17fRr3e78nMdWcxL8XvRJlJVzzx+Sllm4SWjUiSi4xOOOFCfwyl2MSWNERoVGjWS0jBYLSYUiSjlTAxlhQk5m6BdIXIWWWXwulxei9L3Lu+F2u17L2XwvZe5K5C5C7O5XZ3FiaJOclnllnnKWebhJZtSJKLjve/fni2uTDClKeGjDg4djZ4bGx3O54dHcxhh4ZPKXptlt8tZ5ePHl5a1nm4SWbUiSi4xOOOFCTgEECCCMpBCgpAn42bO7u8dO7MY8Y8nJH5jz6nuYw0qWtisy/oZU+/w1LkvwhOlDzRDK0BP6/z5488Avf92Zs1lrKqadpYR8nc+rv9X5fLhNuBnNQtkQXQeutlWaFzQ2SpG0v4YKbD7dWT9O3i07nesnfTu1a1a07Vb+bno1V0v8Xurl9C8Po1qpT9CVbrbdW3VW2IiSIjVtYmSCfik4T8PqKeFXgX3vxd/L81YasNWGrVqw1YasYtaff4m8T0SBI+TU9sossduy1aqMESyssrEREpUoLVq1aqlUyaljeRQH1ctFPJEq7PFp8wEfooC1AjJVTZtlVWVVZKqZKqZKqZKqYqqxVVto1WjVZZNacurTyq1y1egyo/UK1hH9Mo6U+qr0eko9bSRV+9SQuEfb4+/2/h8arzBhfbR8dT+Kn0Cq/hTwzMzM2azMzMhfGMgzVPV6xfrtQpMakC6TxEnr7QSH+bfDFtbIMwWwV/OrVJXz+Gy+O6pjlEgRVqTBlVlVkgAAAAAFtltmYBM0qP0+a8teWgBGmhJmBAAABpJAmDKqVUAAAAK0rQANAZg0AFMwJAFIABAANAAAAA0AAAAAAAAAAAAAANVNVAkkCYMqpVQAAAArStAAANABmANAABQAFIAQA2AAAGwAAAAAAAAAAAAAtpbQAkkCYMqpVRAAgAK0rRAAAA0ABGUABoAAEKAKQgG0IQNoCAAAQAAAAAAkBtNoAAOuuIlMJBNpaWqZBoNBgYG2pqaTSbfpx7uw8Zn+HDY2O78Pt+13ckUp3OtZOjzadTrWTh1adl+sj/dF+D7/uX2p+kqhOfZFP5Sh9bFXVtM377Z4HW6UyrXmlVppuXEtG502mrt1Vi4q661oc2nOC7EI6T2EOqL4UPm18mH6sqck0mWmT9VyXMZWFkaU2MrC1LQbGVhaRov1JU3Fllpk6uK4YyMOtI4Y1LTmK4Y0jHMLQpkjgtStaRlhZZDFqGMa2sUyrNYrrl1tmsCmSWWLZlVduq5Wgt+tZutdSTZsl51yWtK0Laa0VG0laYteA9V4kiqps2SveuTa0rSC2hVSVG0lqY29RF6rzZtFatWZd8czJMTbKakKjaTVMW9YxvVeZG1brKmQ4sLLQxjW1v2ZFxVmMqyzMsNha1V4uJzCDWZLLIlrStC2ltjWTVMWvW2rrLIm1pWgW0NWjWTbMbctt1lkS1rE2ymJbSzK1suaLJU0uGTBZFhpqdXKXGbTAyGFh1pHGbTAyGg05iuM2mBkNSY5halTVLi0jGTBZFhpqdXEuM2mBkMLDrSOM2mBkNBpzFcZtMDIakxzCyVNAl42ZZlU2ZqzKltZqsyELoGIyMUYWIyMiyyejSri1a2mWZZlmWZZlmWZZlY0YLIsNNTxcS4zYwMhqmHjSOM2MDIYGnMVxmxgZDJMcwslTFcWUZaJlllpk6uK4YyMOtI4Y1LTmK4Y0jHMLQpuGWEasFkWGmq6uJcZsMDIalh1pHGbDAyGI05iuM2GBkMqY5hZKm4aWCyLDTVdXEuM2GBkNSw60jjNhgZDEacxXGbDAyGVMcwslTcMb04uBZFhpk7uJcZsYGQ1TDvSOM2MDIYGnMVxmxgZDJMcwslTfD8L8tVL/PtoPcpfYkHjSyYih5p6waVZGkaTEa0sLCe+yuCwWFgsLBYWVMjKMLUWg1VYWCwsqZGkaTJNJiNYQjwyqriVUylUc5dL8btZjZ998yPSD8agqZfbr7r9P534ffv19MutmZkyZLcmMW4zPD0liB7xERPUMNJUYKYlSVKjO9KW22gJgyqyqyXbdwAAAAALbLbMwCZpqdpa60ADTQkyhAAABJIEwZVSqgAAABWlaAAaDMBoApmBIAoAAgAAGgAAAAaAAAAAAAAAAAAQBqpqoEkgTBlVKqAAAAFaVoAAAGgMwAGgAKAAoAIABsAAANgAAAAAAAAAABAFtLaAEkgTBlVKqIAEABWlaAkJCQkJYSMwSEhFBISFAFBADaQgG0EAAAgAAAAAAgDabQAAdOyJTCQC0tLVS1U1U0MDA21NTSaTbtD3o+vpyOz606fGwPVeDwLz0qzXutVpbJtGrl+fN5ZUkWVK2LSpVEbSVM1JaktjSVbLZNkLxfzeyr3yqE/Ja9vzTg2STtPhXvg7TsbJJ5qeLXAABISLLApQGb6KvKB7l8gqvWi9/ovUo8Y7u7d3b3bd79XsyqMqjKoVqOVRlUZVG7bc3b37v+Gbdzz1tYh05xc5trWtZnHT4vdXtVd1PEHzJ6FqdNVeOVBU9qLWJStfFt92vNa+QHncId2rrLLduuAWUpXbrgGSXXVvUbTMay01SWqsoqXgXegAAAAAEILLLLAClKUAJJfLtoKn75FKe0Khez3R48qsrXqoomvSpFrS6GVtyGQJesG61R1fapUT4qn6CRX/M5mzY2bNmRpT75FKcvtJOQqF7rwSff098FR580tWXt8vjiP4J6XRdE9yqVXlRRPxgqOIfBV2fR+IOVVF/taUTEbWqo9JX4fYoHzqaqVXOU+C/WRKunYLwHrYF9H7qj1nd1ndzOn6e7p507u/Hyfonv8GX95YqxVirNNtoqxVikkk086d056d32J3d+xPhPQTZ6c45KnoD+mB+WrkkkckbSCCkPAN58cHhPelRgy4snipSj+T3/veaXwhULl75XsVN62+dJSMxR45KE+TvhVR1F81XRfAnuVen1vyHpJJPhT3e1RSn45HqC/NVp7z20h8sZn8aZOZWWBtL+GXMlNoVsEbIXWP7tXWCtlFTbYVrRWaFbSQtilspMtVi1WLVsmzzqvWvJQWZXXP0p6DU99PD87UCPs1SoeNsqVDaU+x73lfSp9ggLKnVL8/tr8nuPzx+73nwWT3VX3U1PFPOsnfnPNp8JKP/4myYvRpck0ki1T5SLiF16RR9NUoeSG81TUIhn1RrUkkyiHiBr057OdLFfmm2YrWC1i7abLCSefeBZ3XrPcR3y41ms1tUqGvw7+Fd92lVMuTGZm5bW1SpWXxLbYAABERERERFyCqHms89XXV+2wtapmTabWxq+N8JPhtJ+y6XrfQaRSnn8vm20dwr6Pn2tlYxaw2FdfdpkSFEgKrKrJAAAAAALbLbMwCQpTaWgAaaEmUiAAACkkACqlVAAAACtK0AADM0A0DMCQAAAAAAAANAAAA0AAAAAAAAAAAANVNVAkkACqlVAAAACtK0AAAADM0AANAAAAAAAADYAAbAAAAAAAAAAAALaW0AJJAAqpVRAAgAK0rRAAAAAAjMoAAABoEAAkAhG0A2iAAAQAAAAAAkBtNoAAPyTsiUwkE2lpaGQaDQYGBtqamk2tC+1XlZtfitlr7vQAD7rXfFCnN313HlM2bCjM274bt289wAA9AW+LOFKBN1fqcfn3xbb57bfk+28vySmgA/K4HfvdzMJAv0PqN9s5IPlavxW/al9dUmqRV7y8Sj9beup7kGVLIMqWQZUsgypZBqpZBlSyDKlkGVLIMqWQZUsg1Re3u2222222xNJtvWpSjyh3Va+XgXz9z4+sOpBOxD6oRKli9TD0zT1xb8fGPqsm3GKlMKU1A3SQ1q1V2ZwHTfmrV1XxtsvfQ7uaq+TGqjPOXym3ejsV5tvhqjbOo1ra3My3MstEUJgShKExjFrO3d67u7W7zyhQoUKFChQoUKFChQoUKFNubu5u7rd3W7ubOddc7ihQpt3utvN5rWGm1s2trs2SlqKxZptQ1daWlru47lCjMW1E2zs7Xa7GZzMQl69eOO+u7u7u7uj7CRxZKT3Ic3vW3Vr+RcxzHO1aTSaTXd6egUKFChXnKqtVVd63r1p3bXryhQoUKFO3Trt2dXPcnHLhlaqrsuo6dszi44zHdihRdtKnV26UKLq3d1ttm22tttbbYUxQoUKFChQoUKFCm2bdm3a27W3ZihQpuKFWyUKFM5113CmKtkoV2FOKbbZ2u2uddc3FCnM1rChQqqdm1t2lChQoUKFTdKFCnFChVslChTFChVVVOK7ChQpxQoVbJQoUKFCuwoUKqqoUKOO7gAAAAA7uO7gUKFChQqqqqqqqqqqqnd2Kdind3YoU7bZAyBYFgZmW5mW5DGKrEw1rO3FCmXbSp1dulCixbZVXVUqpVXdx2u47uO5QoUKFChQoUKbZt2bdrbtbdmKcUKFCm4oUKFWyUKFChTOdddwoUxQq2ShQoV2FCmxTbbO13Sm4pihQqqbZtbdpQoUKFTbShTihVuShTFCqqqcV3ChTihVuShQoV3ChVVVChQoQAAAAA7uO7ju47lChQoVVVVVVVVVVVTu3FO4p3d2KFN3Zu7N3a3drd2FChQp2zNazczWs7uKFF20qdXbpQourd3W22bba221tthTFUKAqhQFChQoUKbZt2bdrbtbdmKFChQoUKbihQoUKFWyUKFChQoUznXXcKFCmKFCrZKFChQoV2FChTim22drt0oU4pxTuza3baUKTU26U4q3ZKYrWtacV3YU4q3ZKFd2Fa1VUKFChrWtVVVVVVVVChQoUKOO7ju4AAAAAOrWKdsU7u7FCndndndru13YUKFChQoUK/P79vXr1Xq8urjWvWesYFNGCmjBTRoU0YKaMCmjBTRQkWFCR4333tzMtyZMllmZluGa1hQpim7N2btbtbs3bZxBxBkGQcg5ByDQWBgMBgKCgzMtyRknKampyTknJNJpOc5tubzurze+rt8ra+NVdb7gABW3zrPsAt+izhSgSegADgFvLOFKBL21W226V+q2rcGSkZlqLIU/B9wX3Z4Kur4VPbqpSj41PzL3Yv8z7FXSFVfZT6evspUTuSSfS+575D6dT8MVHx098sfCI7I9ogE0knN+rAffqy30Qdmj/b+u/71fk01dn228f/TTFYpzu/d+7bin5kPtnoRA+8E+cQWfJn/P88jeAh/BfW5FVX4H8QvSq/bH+LSfw+b6TaZ0n7QgXuqirr+CZV+35PN8FKievjYfsplAOUND/G/3v58v5R/8DsdpxPMBzy1pcUC5B0q7VdCPIu3il1SU8jyPI8eeNXE6TxSU8BwOlMTwTsV4Dy8MLqKvI8jyPHnjViNI3Qkm4wakVG6Ngbjhv95H8j7vgT3u7DvQULz/1UQ8Rxb+sCAgICAgICAgICA8tWrXa2rtrovR978ryp9uVeYPtpinoov59En4YV9HbiLWC5fZ0dEHjUI+6lXidyiaOgLaoK2ttU5g22TYNtqtv6EHSI4ZRdEcwmyTLgOItSSuJynrTUynQuU66U6U1NTUxLrpTatptDYs0hliTFklsG20bBttCxi2VLa0VQaiqDbZK2TFP3Kn9ap+9U/jHi9yD7YVCydcRQnUHugxTU0VaDe5Re/EvKy6sgPhzhB3lC5kneRa/Vcvg7qXKQc1Cpd0pallVrWX8CCIKIxUYxYgiHVXXIIgiCIIh2rbavJVV5bAAADZWAAAFZTBlxiZdQcFxcpxZTFwwdU8ddfPnL879BHi/jlfsEg8G+oAABWaqbTabTbar8eqn2xjGMYxjGMm1bVfh9AAAm11ry2/gREYgbNmzZtwoe/RBxohM6EEEEEEEEEE24iTkGosOQZaDGpqch4U/iq+HZH9EdevjbJ36Zs2bCIiIhtLabS2m0tVfW2lb6AAADVa1W/d+/a/Da/V3RRH93Z/Pd157de8HqPUlbbbbbp1TqnVOuqdKdQcpxTkHKcU5BynFOQcpxTkHKcU5BynFOQcpxTkHKcU5By7N3Z22zuzd2dtt8f1/3gAAGZmZmZmZZHugaSOfbvI7JHaRZFkWnrTKcpqekHpB6qe9Uuc9Oc4AAAAPlzu3u7bb1u7fb7/9/t7ewAAAAHt/5u3a67q7drlsy2NaZrTLZLZLZLZNjYW/WAABbW61TV+vipJMlFKVtZD/8/Q37sK1R2aLMqG6uRIc1TNAqwbdapqpsBtZWpYDVmwG1ui2hWr+R/B933fh+n836Du47u7FMMAfp7bb9/vv27Z3bzuzuzts/VByDinhTinxUfHjc0r/l163+zJmvdpNpNpNpNpNpNpNpNpNpNqPXXrpXOuue3Gdd3ffJdVusI7kmOnd9y7P3JvdCeb7k7HTwknGb5YR3JJMdOgt1hHcndMTpBbrCO5J3Y7uFusI7k6SYk4W6wjuSTpjpBbrCO5O7picLdYR28Wt6zzzvel55vpb43qsbRWKxWKxWKxWKxtfA/Gq+1gIte0Hm+oviP2Cwn/+LuSKcKEhP18YsA="""
+
+luisa_lang
+
+
+
+
+
+
+ 1from typing import List, NamedTuple, Tuple, Dict, Any, Optional, Union
+ 2from luisa_lang.codegen import ScratchBuffer
+ 3from luisa_lang.codegen.cpp import mangle_name, Mangling
+ 4from luisa_lang import hir
+ 5from luisa_lang.utils import unique_hash
+ 6class TypeCodeGenCache:
+ 7 cache: Dict[hir.Type, str]
+ 8 impl: ScratchBuffer
+ 9
+10 def __init__(self) -> None:
+11 self.cache = {}
+12 self.impl = ScratchBuffer(0)
+13
+14 def gen(self, ty: hir.Type) -> str:
+15 if ty in self.cache:
+16 return self.cache[ty]
+17 else:
+18 res = self.gen_impl(ty)
+19 self.cache[ty] = res
+20 return res
+21
+22 def gen_impl(self, ty: hir.Type) -> str:
+23 match ty:
+24 case hir.IntType(bits=bits, signed=signed):
+25 if signed:
+26 return f"i{bits}"
+27 else:
+28 return f"u{bits}"
+29 case hir.FloatType(bits=bits):
+30 return f"f{bits}"
+31 case hir.BoolType():
+32 return "bool"
+33 case hir.VectorType(element=element, count=count):
+34 return f"vec<{self.gen(element)}, {count}>"
+35 case hir.StructType(name=name, fields=fields):
+36 self.impl.writeln(f'struct {name} {{')
+37 for field in fields:
+38 self.impl.writeln(f' {self.gen(field[1])} {field[0]};')
+39 self.impl.writeln('};')
+40 return name
+41 case hir.UnitType():
+42 return 'void'
+43 case hir.TupleType():
+44 def do():
+45 elements = [self.gen(e) for e in ty.elements]
+46 name = f'Tuple_{unique_hash("".join(elements))}'
+47 self.impl.writeln(f'struct {name} {{')
+48 for i, element in enumerate(elements):
+49 self.impl.writeln(f' {element} _{i};')
+50 self.impl.writeln('};')
+51 return name
+52 return do()
+53 case hir.BoundType():
+54 assert ty.instantiated
+55 return self.gen(ty.instantiated)
+56 case hir.FunctionType():
+57 return ''
+58 case hir.TypeConstructorType():
+59 return ''
+60 case _:
+61 raise NotImplementedError(f"unsupported type: {ty}")
+62
+63class RustAPIGenerator:
+64 """
+65 Generates Rust API code for a given DSL module
+66 """
+67
+68 def __init__(self):
+69 pass
+
7class TypeCodeGenCache:
+ 8 cache: Dict[hir.Type, str]
+ 9 impl: ScratchBuffer
+10
+11 def __init__(self) -> None:
+12 self.cache = {}
+13 self.impl = ScratchBuffer(0)
+14
+15 def gen(self, ty: hir.Type) -> str:
+16 if ty in self.cache:
+17 return self.cache[ty]
+18 else:
+19 res = self.gen_impl(ty)
+20 self.cache[ty] = res
+21 return res
+22
+23 def gen_impl(self, ty: hir.Type) -> str:
+24 match ty:
+25 case hir.IntType(bits=bits, signed=signed):
+26 if signed:
+27 return f"i{bits}"
+28 else:
+29 return f"u{bits}"
+30 case hir.FloatType(bits=bits):
+31 return f"f{bits}"
+32 case hir.BoolType():
+33 return "bool"
+34 case hir.VectorType(element=element, count=count):
+35 return f"vec<{self.gen(element)}, {count}>"
+36 case hir.StructType(name=name, fields=fields):
+37 self.impl.writeln(f'struct {name} {{')
+38 for field in fields:
+39 self.impl.writeln(f' {self.gen(field[1])} {field[0]};')
+40 self.impl.writeln('};')
+41 return name
+42 case hir.UnitType():
+43 return 'void'
+44 case hir.TupleType():
+45 def do():
+46 elements = [self.gen(e) for e in ty.elements]
+47 name = f'Tuple_{unique_hash("".join(elements))}'
+48 self.impl.writeln(f'struct {name} {{')
+49 for i, element in enumerate(elements):
+50 self.impl.writeln(f' {element} _{i};')
+51 self.impl.writeln('};')
+52 return name
+53 return do()
+54 case hir.BoundType():
+55 assert ty.instantiated
+56 return self.gen(ty.instantiated)
+57 case hir.FunctionType():
+58 return ''
+59 case hir.TypeConstructorType():
+60 return ''
+61 case _:
+62 raise NotImplementedError(f"unsupported type: {ty}")
+
23 def gen_impl(self, ty: hir.Type) -> str:
+24 match ty:
+25 case hir.IntType(bits=bits, signed=signed):
+26 if signed:
+27 return f"i{bits}"
+28 else:
+29 return f"u{bits}"
+30 case hir.FloatType(bits=bits):
+31 return f"f{bits}"
+32 case hir.BoolType():
+33 return "bool"
+34 case hir.VectorType(element=element, count=count):
+35 return f"vec<{self.gen(element)}, {count}>"
+36 case hir.StructType(name=name, fields=fields):
+37 self.impl.writeln(f'struct {name} {{')
+38 for field in fields:
+39 self.impl.writeln(f' {self.gen(field[1])} {field[0]};')
+40 self.impl.writeln('};')
+41 return name
+42 case hir.UnitType():
+43 return 'void'
+44 case hir.TupleType():
+45 def do():
+46 elements = [self.gen(e) for e in ty.elements]
+47 name = f'Tuple_{unique_hash("".join(elements))}'
+48 self.impl.writeln(f'struct {name} {{')
+49 for i, element in enumerate(elements):
+50 self.impl.writeln(f' {element} _{i};')
+51 self.impl.writeln('};')
+52 return name
+53 return do()
+54 case hir.BoundType():
+55 assert ty.instantiated
+56 return self.gen(ty.instantiated)
+57 case hir.FunctionType():
+58 return ''
+59 case hir.TypeConstructorType():
+60 return ''
+61 case _:
+62 raise NotImplementedError(f"unsupported type: {ty}")
+
64class RustAPIGenerator:
+65 """
+66 Generates Rust API code for a given DSL module
+67 """
+68
+69 def __init__(self):
+70 pass
+
+luisa_lang
+
+
+
+
+
+
+ 1import ast
+ 2from dataclasses import dataclass
+ 3from enum import Enum, auto
+ 4import os
+ 5import sys
+ 6from typing import (
+ 7 Any,
+ 8 Callable,
+ 9 List,
+ 10 Literal,
+ 11 Optional,
+ 12 Set,
+ 13 Tuple,
+ 14 Dict,
+ 15 Union,
+ 16)
+ 17import typing
+ 18from typing_extensions import override
+ 19from luisa_lang import classinfo
+ 20from luisa_lang.utils import Span, round_to_align, unwrap
+ 21from abc import ABC, abstractmethod
+ 22
+ 23PATH_PREFIX = "luisa_lang"
+ 24
+ 25
+ 26# @dataclass
+ 27# class FunctionTemplateResolveResult:
+ 28# func: Optional[Function]
+ 29# matched: bool
+ 30
+ 31
+ 32FunctionTemplateResolvingArgs = List[Tuple[str,
+ 33 Union['Type', Any]]]
+ 34"""
+ 35[Function parameter name, Type or Value].
+ 36The reason for using parameter name instead of GenericParameter is that python supports passing type[T] as a parameter,
+ 37"""
+ 38
+ 39
+ 40FunctionTemplateResolvingFunc = Callable[[
+ 41 FunctionTemplateResolvingArgs], Union['Function', 'TemplateMatchingError']]
+ 42
+ 43
+ 44class FuncProperties:
+ 45 inline: bool | Literal["never", "always"]
+ 46 export: bool
+ 47 byref: Set[str]
+ 48 returning_ref: bool
+ 49
+ 50 def __init__(self):
+ 51 self.inline = False
+ 52 self.export = False
+ 53 self.byref = set()
+ 54 self.returning_ref = False
+ 55
+ 56
+ 57class FunctionTemplate:
+ 58 """
+ 59 Contains a delegate that can be resolved to a function.
+ 60 This is to support generic functions as well as meta-programming.
+ 61 Since each time the function is called in DSL, user meta-programming code in the function body
+ 62 will be called, we need to keep the AST of the function.
+ 63
+ 64 """
+ 65 parsing_func: FunctionTemplateResolvingFunc
+ 66 _resolved: Dict[Tuple[Tuple[str,
+ 67 Union['Type', Any]], ...], "Function"]
+ 68 is_generic: bool
+ 69 name: str
+ 70 params: List[str]
+ 71 props: Optional[FuncProperties]
+ 72 """Function parameters (NOT type parameters)"""
+ 73
+ 74 def __init__(self, name: str, params: List[str], parsing_func: FunctionTemplateResolvingFunc, is_generic: bool) -> None:
+ 75 self.parsing_func = parsing_func
+ 76 self._resolved = {}
+ 77 self.params = params
+ 78 self.is_generic = is_generic
+ 79 self.name = name
+ 80 self.props = None
+ 81
+ 82 def resolve(self, args: FunctionTemplateResolvingArgs | None) -> Union["Function", 'TemplateMatchingError']:
+ 83 args = args or []
+ 84 if not self.is_generic:
+ 85 key = tuple(args)
+ 86 else:
+ 87 key = tuple()
+ 88 if key in self._resolved:
+ 89 return self._resolved[key]
+ 90 func = self.parsing_func(args)
+ 91 if isinstance(func, TemplateMatchingError):
+ 92 return func
+ 93 self._resolved[key] = func
+ 94 return func
+ 95
+ 96 def reset(self) -> None:
+ 97 self._resolved = {}
+ 98
+ 99 def inline_hint(self) -> bool | Literal['always', 'never']:
+ 100 if self.props is None:
+ 101 return False
+ 102 return self.props.inline
+ 103
+ 104
+ 105class DynamicIndex:
+ 106 pass
+ 107
+ 108
+ 109class Type(ABC):
+ 110 methods: Dict[str, Union["Function", FunctionTemplate]]
+ 111 is_builtin: bool
+ 112
+ 113 def __init__(self):
+ 114 self.methods = {}
+ 115 self.is_builtin = False
+ 116
+ 117 @abstractmethod
+ 118 def size(self) -> int:
+ 119 pass
+ 120
+ 121 @abstractmethod
+ 122 def align(self) -> int:
+ 123 pass
+ 124
+ 125 @abstractmethod
+ 126 def __eq__(self, value: object) -> bool:
+ 127 pass
+ 128
+ 129 @abstractmethod
+ 130 def __hash__(self) -> int:
+ 131 pass
+ 132
+ 133 def member(self, field: Any) -> Optional['Type']:
+ 134 if isinstance(field, str):
+ 135 m = self.methods.get(field)
+ 136 if not m:
+ 137 return None
+ 138 return FunctionType(m, None)
+ 139 return None
+ 140
+ 141 def method(self, name: str) -> Optional[Union["Function", FunctionTemplate]]:
+ 142 m = self.methods.get(name)
+ 143 if m:
+ 144 return m
+ 145 return None
+ 146
+ 147 def is_concrete(self) -> bool:
+ 148 return True
+ 149
+ 150 def __len__(self) -> int:
+ 151 return 1
+ 152
+ 153class LiteralType(Type):
+ 154 value: Any
+ 155
+ 156 def __init__(self, value: Any) -> None:
+ 157 super().__init__()
+ 158 self.value = value
+ 159
+ 160 def size(self) -> int:
+ 161 raise RuntimeError("LiteralType has no size")
+ 162
+ 163 def align(self) -> int:
+ 164 raise RuntimeError("LiteralType has no align")
+ 165
+ 166 def is_concrete(self) -> bool:
+ 167 return False
+ 168
+ 169 def __eq__(self, value: object) -> bool:
+ 170 return isinstance(value, LiteralType) and value.value == self.value
+ 171
+ 172 def __hash__(self) -> int:
+ 173 return hash((LiteralType, self.value))
+ 174
+ 175class AnyType(Type):
+ 176 def size(self) -> int:
+ 177 raise RuntimeError("AnyType has no size")
+ 178
+ 179 def align(self) -> int:
+ 180 raise RuntimeError("AnyType has no align")
+ 181
+ 182 def __eq__(self, value: object) -> bool:
+ 183 return isinstance(value, AnyType)
+ 184
+ 185 def __hash__(self) -> int:
+ 186 return hash(AnyType)
+ 187
+ 188 def __str__(self) -> str:
+ 189 return "AnyType"
+ 190
+ 191
+ 192class UnitType(Type):
+ 193 def size(self) -> int:
+ 194 return 0
+ 195
+ 196 def align(self) -> int:
+ 197 return 1
+ 198
+ 199 def __eq__(self, value: object) -> bool:
+ 200 return isinstance(value, UnitType)
+ 201
+ 202 def __hash__(self) -> int:
+ 203 return hash(UnitType)
+ 204
+ 205 def __str__(self) -> str:
+ 206 return "UnitType"
+ 207
+ 208
+ 209class ScalarType(Type):
+ 210 pass
+ 211
+ 212
+ 213class BoolType(ScalarType):
+ 214 def size(self) -> int:
+ 215 return 1
+ 216
+ 217 def align(self) -> int:
+ 218 return 1
+ 219
+ 220 def __eq__(self, value: object) -> bool:
+ 221 return isinstance(value, BoolType)
+ 222
+ 223 def __hash__(self) -> int:
+ 224 return hash(BoolType)
+ 225
+ 226 def __str__(self) -> str:
+ 227 return "bool"
+ 228
+ 229
+ 230class IntType(ScalarType):
+ 231 bits: int
+ 232 signed: bool
+ 233
+ 234 def __init__(self, bits: int, signed: bool) -> None:
+ 235 super().__init__()
+ 236 self.bits = bits
+ 237 self.signed = signed
+ 238
+ 239 def size(self) -> int:
+ 240 return self.bits // 8
+ 241
+ 242 def align(self) -> int:
+ 243 return self.size()
+ 244
+ 245 def __eq__(self, value: object) -> bool:
+ 246 return (
+ 247 isinstance(value, IntType)
+ 248 and value.bits == self.bits
+ 249 and value.signed == self.signed
+ 250 )
+ 251
+ 252 def __hash__(self) -> int:
+ 253 return hash((IntType, self.bits, self.signed))
+ 254
+ 255 def __repr__(self) -> str:
+ 256 return f"IntType({self.bits}, {self.signed})"
+ 257
+ 258 def __str__(self) -> str:
+ 259 return f"{'i' if self.signed else 'u'}{self.bits}"
+ 260
+ 261
+ 262class GenericFloatType(ScalarType):
+ 263 @override
+ 264 def __eq__(self, value: object) -> bool:
+ 265 return isinstance(value, GenericFloatType)
+ 266
+ 267 @override
+ 268 def __hash__(self) -> int:
+ 269 return hash(GenericFloatType)
+ 270
+ 271 @override
+ 272 def size(self) -> int:
+ 273 raise RuntimeError("GenericFloatType has no size")
+ 274
+ 275 @override
+ 276 def align(self) -> int:
+ 277 raise RuntimeError("GenericFloatType has no align")
+ 278
+ 279 @override
+ 280 def __repr__(self) -> str:
+ 281 return f"GenericFloatType()"
+ 282
+ 283 @override
+ 284 def __str__(self) -> str:
+ 285 return "float"
+ 286
+ 287 @override
+ 288 def is_concrete(self) -> bool:
+ 289 return False
+ 290
+ 291
+ 292class GenericIntType(ScalarType):
+ 293 @override
+ 294 def __eq__(self, value: object) -> bool:
+ 295 return isinstance(value, GenericIntType)
+ 296
+ 297 @override
+ 298 def __hash__(self) -> int:
+ 299 return hash(GenericIntType)
+ 300
+ 301 @override
+ 302 def size(self) -> int:
+ 303 raise RuntimeError("GenericIntType has no size")
+ 304
+ 305 @override
+ 306 def align(self) -> int:
+ 307 raise RuntimeError("GenericIntType has no align")
+ 308
+ 309 @override
+ 310 def __repr__(self) -> str:
+ 311 return f"GenericIntType()"
+ 312
+ 313 @override
+ 314 def __str__(self) -> str:
+ 315 return "int"
+ 316
+ 317 @override
+ 318 def is_concrete(self) -> bool:
+ 319 return False
+ 320
+ 321
+ 322class FloatType(ScalarType):
+ 323 bits: int
+ 324
+ 325 def __init__(self, bits: int) -> None:
+ 326 super().__init__()
+ 327 self.bits = bits
+ 328
+ 329 def size(self) -> int:
+ 330 return self.bits // 8
+ 331
+ 332 def align(self) -> int:
+ 333 return self.size()
+ 334
+ 335 def __eq__(self, value: object) -> bool:
+ 336 return isinstance(value, FloatType) and value.bits == self.bits
+ 337
+ 338 def __repr__(self) -> str:
+ 339 return f"FloatType({self.bits})"
+ 340
+ 341 def __hash__(self) -> int:
+ 342 return hash((FloatType, self.bits))
+ 343
+ 344 def __str__(self) -> str:
+ 345 return f"f{self.bits}"
+ 346
+ 347
+ 348class VectorType(Type):
+ 349 element: Type
+ 350 count: int
+ 351 _align: int
+ 352 _size: int
+ 353
+ 354 def __init__(self, element: Type, count: int, align: int | None = None) -> None:
+ 355 super().__init__()
+ 356 if align is None:
+ 357 align = element.align()
+ 358 self.element = element
+ 359 self.count = count
+ 360 self._align = align
+ 361 assert (self.element.size() * self.count) % self._align == 0
+ 362 self._size = round_to_align(
+ 363 self.element.size() * self.count, self._align)
+ 364
+ 365 def size(self) -> int:
+ 366 return self._size
+ 367
+ 368 def align(self) -> int:
+ 369 return self._align
+ 370
+ 371 def __eq__(self, value: object) -> bool:
+ 372 return (
+ 373 isinstance(value, VectorType)
+ 374 and value.element == self.element
+ 375 and value.count == self.count
+ 376 )
+ 377
+ 378 def __repr__(self) -> str:
+ 379 return f"VectorType({self.element}, {self.count})"
+ 380
+ 381 def __hash__(self) -> int:
+ 382 return hash((VectorType, self.element, self.count))
+ 383
+ 384 def __str__(self) -> str:
+ 385 return f"<{self.count} x {self.element}>"
+ 386
+ 387 @override
+ 388 def member(self, field: Any) -> Optional['Type']:
+ 389 comps = 'xyzw'[:self.count]
+ 390 if isinstance(field, str) and field in comps:
+ 391 return self.element
+ 392 return Type.member(self, field)
+ 393
+ 394 def __len__(self) -> int:
+ 395 return self.count
+ 396
+ 397
+ 398class ArrayType(Type):
+ 399 element: Type
+ 400 count: Union[int, "SymbolicConstant"]
+ 401
+ 402 def __init__(self, element: Type, count: Union[int, "SymbolicConstant"]) -> None:
+ 403 super().__init__()
+ 404 self.element = element
+ 405 self.count = count
+ 406
+ 407 def size(self) -> int:
+ 408 if isinstance(self.count, SymbolicConstant):
+ 409 raise RuntimeError("ArrayType size is symbolic")
+ 410 return self.element.size() * self.count
+ 411
+ 412 def align(self) -> int:
+ 413 if isinstance(self.count, SymbolicConstant):
+ 414 raise RuntimeError("ArrayType align is symbolic")
+ 415 return self.element.align()
+ 416
+ 417 def __eq__(self, value: object) -> bool:
+ 418 return (
+ 419 isinstance(value, ArrayType)
+ 420 and value.element == self.element
+ 421 and value.count == self.count
+ 422 )
+ 423
+ 424 def __repr__(self) -> str:
+ 425 return f"ArrayType({self.element}, {self.count})"
+ 426
+ 427 def __hash__(self) -> int:
+ 428 return hash((ArrayType, self.element, self.count))
+ 429
+ 430 def __str__(self) -> str:
+ 431 return f"[{self.count} x {self.element}]"
+ 432
+ 433
+ 434class PointerType(Type):
+ 435 element: Type
+ 436
+ 437 def __init__(self, element: Type) -> None:
+ 438 super().__init__()
+ 439 self.element = element
+ 440
+ 441 def size(self) -> int:
+ 442 return 8
+ 443
+ 444 def align(self) -> int:
+ 445 return 8
+ 446
+ 447 def __eq__(self, value: object) -> bool:
+ 448 return isinstance(value, PointerType) and value.element == self.element
+ 449
+ 450 def __repr__(self) -> str:
+ 451 return f"PointerType({self.element})"
+ 452
+ 453 def __hash__(self) -> int:
+ 454 return hash((PointerType, self.element))
+ 455
+ 456 def __str__(self) -> str:
+ 457 return f"*{self.element}"
+ 458
+ 459
+ 460class TupleType(Type):
+ 461 elements: List[Type]
+ 462
+ 463 def __init__(self, elements: List[Type]) -> None:
+ 464 super().__init__()
+ 465 self.elements = elements
+ 466
+ 467 def size(self) -> int:
+ 468 return sum(element.size() for element in self.elements)
+ 469
+ 470 def align(self) -> int:
+ 471 return max(element.align() for element in self.elements)
+ 472
+ 473 def __eq__(self, value: object) -> bool:
+ 474 return self is value or (isinstance(value, TupleType) and value.elements == self.elements)
+ 475
+ 476 def __repr__(self) -> str:
+ 477 return f"TupleType({self.elements})"
+ 478
+ 479 def __hash__(self) -> int:
+ 480 return hash((TupleType, tuple(self.elements)))
+ 481
+ 482 def __str__(self) -> str:
+ 483 return f"({', '.join(str(e) for e in self.elements)})"
+ 484
+ 485 @override
+ 486 def member(self, field: Any) -> Optional['Type']:
+ 487 if isinstance(field, int):
+ 488 if field < len(self.elements):
+ 489 return self.elements[field]
+ 490 return Type.member(self, field)
+ 491
+ 492
+ 493class StructType(Type):
+ 494 name: str
+ 495 display_name: str
+ 496 _fields: List[Tuple[str, Type]]
+ 497 _field_dict: Dict[str, Type]
+ 498 # _monomorphification_cache: Dict[Tuple['GenericParameter', Type | 'Value'], Type]
+ 499
+ 500 def __init__(self, name: str, display_name: str, fields: List[Tuple[str, Type]]) -> None:
+ 501 super().__init__()
+ 502 self.name = name
+ 503 self._fields = fields
+ 504 self.display_name = display_name
+ 505 self._field_dict = {name: ty for name, ty in fields}
+ 506
+ 507 @property
+ 508 def fields(self) -> List[Tuple[str, Type]]:
+ 509 return self._fields
+ 510
+ 511 @fields.setter
+ 512 def fields(self, value: List[Tuple[str, Type]]) -> None:
+ 513 self._fields = value
+ 514 self._field_dict = {name: ty for name, ty in value}
+ 515
+ 516 def size(self) -> int:
+ 517 return sum(field.size() for _, field in self.fields)
+ 518
+ 519 def align(self) -> int:
+ 520 return max(field.align() for _, field in self.fields)
+ 521
+ 522 def __str__(self) -> str:
+ 523 return self.display_name
+ 524
+ 525 @override
+ 526 def __eq__(self, value: object) -> bool:
+ 527 return value is self or (
+ 528 isinstance(
+ 529 value, StructType) and value.fields == self.fields and value.name == self.name
+ 530 )
+ 531
+ 532 @override
+ 533 def member(self, field: Any) -> Optional['Type']:
+ 534 if isinstance(field, str):
+ 535 if field in self._field_dict:
+ 536 return self._field_dict[field]
+ 537 return Type.member(self, field)
+ 538
+ 539 @override
+ 540 def __hash__(self) -> int:
+ 541 return hash((StructType, tuple(self.fields), self.name))
+ 542
+ 543
+ 544class TypeBound:
+ 545 @abstractmethod
+ 546 def satisfied_by(self, ty: Type) -> bool:
+ 547 pass
+ 548
+ 549
+ 550class AnyBound(TypeBound):
+ 551 @override
+ 552 def satisfied_by(self, ty: Type) -> bool:
+ 553 return True
+ 554
+ 555
+ 556class SubtypeBound(TypeBound):
+ 557 super_type: Type
+ 558 exact_match: bool
+ 559
+ 560 def __init__(self, super_type: Type, exact_match: bool) -> None:
+ 561 self.super_type = super_type
+ 562 self.exact_match = exact_match
+ 563
+ 564 def __repr__(self) -> str:
+ 565 return f"SubtypeBound({self.super_type})"
+ 566
+ 567 def __eq__(self, value: object) -> bool:
+ 568 return isinstance(value, SubtypeBound) and value.super_type == self.super_type
+ 569
+ 570 @override
+ 571 def satisfied_by(self, ty: Type) -> bool:
+ 572 if self.exact_match:
+ 573 return is_type_compatible_to(ty, self.super_type)
+ 574 else:
+ 575 raise NotImplementedError()
+ 576
+ 577
+ 578class UnionBound(TypeBound):
+ 579 bounds: List[SubtypeBound]
+ 580
+ 581 def __init__(self, bounds: List[SubtypeBound]) -> None:
+ 582 self.bounds = bounds
+ 583
+ 584 def __repr__(self) -> str:
+ 585 return f"UnionBound({self.bounds})"
+ 586
+ 587 def __eq__(self, value: object) -> bool:
+ 588 return isinstance(value, UnionBound) and value.bounds == self.bounds
+ 589
+ 590 @override
+ 591 def satisfied_by(self, ty: Type) -> bool:
+ 592 return any(b.satisfied_by(ty) for b in self.bounds)
+ 593
+ 594
+ 595class GenericParameter:
+ 596 """
+ 597 A GenericParameter contains three parts:
+ 598 name@ctx_name: bound
+ 599 """
+ 600 name: str
+ 601 """ name of the generic parameter in source code, e.g. 'T'"""
+ 602 ctx_name: str
+ 603 """ a string describing the context (where the generic parameter is defined), e.g. 'some_function' """
+ 604 bound: TypeBound | None
+ 605
+ 606 def __init__(
+ 607 self, name: str, ctx_name: str, bound: TypeBound | None = None
+ 608 ) -> None:
+ 609 self.name = name
+ 610 self.ctx_name = ctx_name
+ 611 self.bound = bound
+ 612
+ 613 def __eq__(self, value: object) -> bool:
+ 614 return (
+ 615 value is self or (
+ 616 isinstance(value, GenericParameter)
+ 617 and value.name == self.name
+ 618 and value.ctx_name == self.ctx_name)
+ 619 )
+ 620
+ 621 def __hash__(self) -> int:
+ 622 return hash((GenericParameter, self.name, self.ctx_name))
+ 623
+ 624 def __repr__(self) -> str:
+ 625 bound_str = f" : {self.bound}" if self.bound else ""
+ 626 return f"GenericParameter({self.name}, {self.ctx_name}, {bound_str})"
+ 627
+ 628
+ 629class OpaqueType(Type):
+ 630 name: str
+ 631 extra_args: List[Any]
+ 632
+ 633 def __init__(self, name: str, extra: List[Any] | None = None) -> None:
+ 634 super().__init__()
+ 635 self.name = name
+ 636 self.extra_args = extra or []
+ 637
+ 638 def size(self) -> int:
+ 639 raise RuntimeError("OpaqueType has no size")
+ 640
+ 641 def align(self) -> int:
+ 642 raise RuntimeError("OpaqueType has no align")
+ 643
+ 644 def __eq__(self, value: object) -> bool:
+ 645 return isinstance(value, OpaqueType) and value.name == self.name and value.extra_args == self.extra_args
+ 646
+ 647 def __hash__(self) -> int:
+ 648 return hash((OpaqueType, self.name, tuple(self.extra_args)))
+ 649
+ 650 def __str__(self) -> str:
+ 651 return self.name
+ 652
+ 653 @override
+ 654 def is_concrete(self) -> bool:
+ 655 return False
+ 656
+ 657
+ 658class SymbolicType(Type):
+ 659 param: GenericParameter
+ 660
+ 661 def __init__(self, param: GenericParameter) -> None:
+ 662 super().__init__()
+ 663 self.param = param
+ 664
+ 665 def size(self) -> int:
+ 666 raise RuntimeError("SymbolicType has no size")
+ 667
+ 668 def align(self) -> int:
+ 669 raise RuntimeError("SymbolicType has no align")
+ 670
+ 671 def __eq__(self, value: object) -> bool:
+ 672 return isinstance(value, SymbolicType) and value.param == self.param
+ 673
+ 674 def __hash__(self) -> int:
+ 675 return hash((SymbolicType, self.param))
+ 676
+ 677 def __str__(self) -> str:
+ 678 return f'~{self.param.name}@{self.param.ctx_name}'
+ 679
+ 680 def __repr__(self) -> str:
+ 681 return f"SymbolicType({self.param})"
+ 682
+ 683
+ 684MonomorphizationFunc = Callable[[List[Type]], Type]
+ 685
+ 686
+ 687class ParametricType(Type):
+ 688 """
+ 689 The definition of a parametric type, e.g. class Foo[T]: ...
+ 690 """
+ 691 params: List[GenericParameter]
+ 692 body: Type
+ 693 monomorphification_cache: Dict[Tuple[Union['Type', Any], ...], 'Type']
+ 694 monomorphification_func: Optional[MonomorphizationFunc]
+ 695
+ 696 def __init__(self, params: List[GenericParameter],
+ 697 body: Type,
+ 698 monomorphification_func: MonomorphizationFunc | None = None) -> None:
+ 699 super().__init__()
+ 700 self.params = params
+ 701 self.body = body
+ 702 self.monomorphification_func = monomorphification_func
+ 703 self.monomorphification_cache = {}
+ 704
+ 705 def instantiate(self, args: List[Union[Type, Any]]) -> 'Type':
+ 706 keys = tuple(args)
+ 707 if keys in self.monomorphification_cache:
+ 708 return self.monomorphification_cache[keys]
+ 709 if self.monomorphification_func is not None:
+ 710 ty = self.monomorphification_func(args)
+ 711 self.monomorphification_cache[keys] = ty
+ 712 return ty
+ 713 raise RuntimeError("monomorphification_func is not set")
+ 714
+ 715 def size(self) -> int:
+ 716 raise RuntimeError("ParametricType has no size")
+ 717
+ 718 def align(self) -> int:
+ 719 raise RuntimeError("ParametricType has no align")
+ 720
+ 721 def __eq__(self, value: object) -> bool:
+ 722 return (
+ 723 isinstance(value, ParametricType)
+ 724 and value.params == self.params
+ 725 and value.body == self.body
+ 726 )
+ 727
+ 728 def __hash__(self) -> int:
+ 729 return hash((ParametricType, tuple(self.params), self.body))
+ 730
+ 731
+ 732class BoundType(Type):
+ 733 """
+ 734 An instance of a parametric type, e.g. Foo[int]
+ 735 """
+ 736 generic: ParametricType
+ 737 args: List[Union[Type, Any]]
+ 738 instantiated: Optional[Type]
+ 739
+ 740 def __init__(self, generic: ParametricType, args: List[Union[Type, Any]], instantiated: Optional[Type] = None) -> None:
+ 741 super().__init__()
+ 742 self.generic = generic
+ 743 self.args = args
+ 744 self.instantiated = instantiated
+ 745
+ 746 def size(self) -> int:
+ 747 raise RuntimeError("don't call size on BoundedType")
+ 748
+ 749 def align(self) -> int:
+ 750 raise RuntimeError("don't call align on BoundedType")
+ 751
+ 752 def __eq__(self, value: object) -> bool:
+ 753 return (
+ 754 isinstance(value, BoundType)
+ 755 and value.generic == self.generic
+ 756 and value.args == self.args
+ 757 )
+ 758
+ 759 def __hash__(self):
+ 760 return hash((BoundType, self.generic, tuple(self.args)))
+ 761
+ 762 @override
+ 763 def member(self, field) -> Optional['Type']:
+ 764 if self.instantiated is not None:
+ 765 return self.instantiated.member(field)
+ 766 else:
+ 767 raise RuntimeError("member access on uninstantiated BoundType")
+ 768
+ 769 @override
+ 770 def method(self, name) -> Optional[Union["Function", FunctionTemplate]]:
+ 771 if self.instantiated is not None:
+ 772 return self.instantiated.method(name)
+ 773 else:
+ 774 raise RuntimeError("method access on uninstantiated BoundType")
+ 775
+ 776
+ 777class TypeConstructorType(Type):
+ 778 inner: Type
+ 779
+ 780 def __init__(self, inner: Type) -> None:
+ 781 super().__init__()
+ 782 self.inner = inner
+ 783
+ 784 def size(self) -> int:
+ 785 raise RuntimeError("TypeConstructorType has no size")
+ 786
+ 787 def align(self) -> int:
+ 788 raise RuntimeError("TypeConstructorType has no align")
+ 789
+ 790 def __eq__(self, value: object) -> bool:
+ 791 return isinstance(value, TypeConstructorType) and value.inner == self.inner
+ 792
+ 793 def __hash__(self) -> int:
+ 794 return hash((TypeConstructorType, self.inner))
+ 795
+ 796
+ 797class FunctionType(Type):
+ 798 func_like: Union["Function", FunctionTemplate]
+ 799 bound_object: Optional['Ref']
+ 800
+ 801 def __init__(self, func_like: Union["Function", FunctionTemplate], bound_object: Optional['Ref']) -> None:
+ 802 super().__init__()
+ 803 self.func_like = func_like
+ 804 self.bound_object = bound_object
+ 805
+ 806 def __eq__(self, value: object) -> bool:
+ 807 if self.bound_object is not None:
+ 808 return value is self
+ 809 return isinstance(value, FunctionType) and value.func_like is self.func_like and value.bound_object is None
+ 810
+ 811 def __hash__(self) -> int:
+ 812 return hash((FunctionType, id(self.func_like), id(self.bound_object)))
+ 813
+ 814 def size(self) -> int:
+ 815 raise RuntimeError("FunctionType has no size")
+ 816
+ 817 def align(self) -> int:
+ 818 raise RuntimeError("FunctionType has no align")
+ 819
+ 820
+ 821class Node:
+ 822 """
+ 823 Base class for all nodes in the HIR. A node could be a value, a reference, or a statement.
+ 824 Nodes equality is based on their identity.
+ 825 """
+ 826 span: Optional[Span]
+ 827
+ 828 def __init__(self, span: Optional[Span] = None) -> None:
+ 829 self.span = None
+ 830
+ 831 def __eq__(self, value: object) -> bool:
+ 832 return value is self
+ 833
+ 834 def __hash__(self) -> int:
+ 835 return id(self)
+ 836
+ 837
+ 838NodeT = typing.TypeVar("NodeT", bound=Node)
+ 839
+ 840
+ 841class BasicBlock(Node):
+ 842 nodes: List[Node]
+ 843 terminated: bool
+ 844
+ 845 def __init__(self, span: Optional[Span] = None) -> None:
+ 846 self.nodes = []
+ 847 self.terminated = False
+ 848 self.span = span
+ 849
+ 850 def append(self, node: NodeT) -> NodeT:
+ 851 if isinstance(node, Terminator):
+ 852 assert not self.terminated
+ 853 self.terminated = True
+ 854 self.nodes.append(node)
+ 855 return node
+ 856
+ 857
+ 858class TypedNode(Node):
+ 859 """
+ 860 A node with a type, which can either be values or references.
+ 861 """
+ 862 type: Optional[Type]
+ 863
+ 864 def __init__(
+ 865 self, type: Optional[Type] = None, span: Optional[Span] = None
+ 866 ) -> None:
+ 867 super().__init__()
+ 868 self.type = type
+ 869 self.span = span
+ 870
+ 871
+ 872class Ref(TypedNode):
+ 873 pass
+ 874
+ 875
+ 876class LocalRef(Ref):
+ 877 value: 'Value'
+ 878
+ 879 def __init__(self, value: 'Value') -> None:
+ 880 super().__init__(value.type)
+ 881 self.value = value
+ 882 self.span = value.span
+ 883
+ 884
+ 885class Value(TypedNode):
+ 886 pass
+ 887
+ 888
+ 889class Unit(Value):
+ 890 def __init__(self) -> None:
+ 891 super().__init__(UnitType())
+ 892
+ 893
+ 894class SymbolicConstant(Value):
+ 895 generic: GenericParameter
+ 896
+ 897 def __init__(
+ 898 self, generic: GenericParameter, type: Optional[Type] = None, span: Optional[Span] = None
+ 899 ) -> None:
+ 900 super().__init__(type, span)
+ 901 self.generic = generic
+ 902
+ 903
+ 904class ParameterSemantic(Enum):
+ 905 BYVAL = auto()
+ 906 BYREF = auto()
+ 907
+ 908
+ 909class Var(Ref):
+ 910 name: str
+ 911 semantic: ParameterSemantic
+ 912
+ 913 def __init__(
+ 914 self, name: str, type: Optional[Type], span: Optional[Span], semantic=ParameterSemantic.BYVAL
+ 915 ) -> None:
+ 916 super().__init__(type, span)
+ 917 self.name = name
+ 918 self.type = type
+ 919 self.semantic = semantic
+ 920
+ 921
+ 922class Member(Value):
+ 923 base: Value
+ 924 field: str
+ 925
+ 926 def __init__(self, base: Value, field: str, type: Type, span: Optional[Span]) -> None:
+ 927 super().__init__(type, span)
+ 928 self.base = base
+ 929 self.field = field
+ 930
+ 931
+ 932class Index(Value):
+ 933 base: Value
+ 934 index: Value
+ 935
+ 936 def __init__(self, base: Value, index: Value, type: Type, span: Optional[Span]) -> None:
+ 937 super().__init__(type, span)
+ 938 self.base = base
+ 939 self.index = index
+ 940
+ 941
+ 942class MemberRef(Ref):
+ 943 base: Ref
+ 944 field: str
+ 945
+ 946 def __init__(self, base: Ref, field: str, type: Type, span: Optional[Span]) -> None:
+ 947 super().__init__(type, span)
+ 948 self.base = base
+ 949 self.field = field
+ 950
+ 951
+ 952class IndexRef(Ref):
+ 953 base: Ref
+ 954 index: Value
+ 955
+ 956 def __init__(self, base: Ref, index: Value, type: Type, span: Optional[Span]) -> None:
+ 957 super().__init__(type, span)
+ 958 self.base = base
+ 959 self.index = index
+ 960
+ 961
+ 962class Load(Value):
+ 963 ref: Ref
+ 964
+ 965 def __init__(self, ref: Ref) -> None:
+ 966 super().__init__(ref.type, ref.span)
+ 967 self.ref = ref
+ 968
+ 969
+ 970class Constant(Value):
+ 971 value: Any
+ 972
+ 973 def __init__(self, value: Any, type: Type | None = None, span: Optional[Span] = None) -> None:
+ 974 super().__init__(type, span)
+ 975 self.value = value
+ 976
+ 977 def __eq__(self, value: object) -> bool:
+ 978 return isinstance(value, Constant) and type(value.value) == type(self.value) and value.value == self.value
+ 979
+ 980 def __hash__(self) -> int:
+ 981 return hash((Constant, self.value))
+ 982
+ 983
+ 984class TypeValue(Value):
+ 985 def __init__(self, ty: Type, span: Optional[Span] = None) -> None:
+ 986 super().__init__(TypeConstructorType(ty), span)
+ 987
+ 988 def inner_type(self) -> Type:
+ 989 assert isinstance(self.type, TypeConstructorType)
+ 990 return self.type.inner
+ 991
+ 992
+ 993class FunctionValue(Value):
+ 994 def __init__(self, ty: FunctionType, span: Optional[Span] = None) -> None:
+ 995 super().__init__(ty, span)
+ 996
+ 997
+ 998class Alloca(Ref):
+ 999 """
+1000 A temporary variable
+1001 """
+1002
+1003 def __init__(self, ty: Type, span: Optional[Span] = None) -> None:
+1004 super().__init__(ty, span)
+1005
+1006
+1007# class Init(Value):
+1008# init_call: 'Call'
+1009
+1010# def __init__(self, init_call: 'Call', ty: Type, span: Optional[Span] = None) -> None:
+1011# super().__init__(ty, span)
+1012# self.init_call = init_call
+1013
+1014class AggregateInit(Value):
+1015 args: List[Value]
+1016
+1017 def __init__(self, args: List[Value], type: Type, span: Optional[Span] = None) -> None:
+1018 super().__init__(type, span)
+1019 self.args = args
+1020
+1021
+1022class Intrinsic(Value):
+1023 name: str
+1024 args: List[Value | Ref]
+1025
+1026 def __init__(self, name: str, args: List[Value | Ref], type: Type, span: Optional[Span] = None) -> None:
+1027 super().__init__(type, span)
+1028 self.name = name
+1029 self.args = args
+1030
+1031 def __str__(self) -> str:
+1032 return f'Intrinsic({self.name}, {self.args})'
+1033
+1034 def __repr__(self) -> str:
+1035 return f'Intrinsic({self.name}, {self.args})'
+1036
+1037class IntrinsicRef(Ref):
+1038 name: str
+1039 args: List[Value | Ref]
+1040
+1041 def __init__(self, name: str, args: List[Value | Ref], type: Type, span: Optional[Span] = None) -> None:
+1042 super().__init__(type, span)
+1043 self.name = name
+1044 self.args = args
+1045
+1046 def __str__(self) -> str:
+1047 return f'IntrinsicRef({self.name}, {self.args})'
+1048
+1049 def __repr__(self) -> str:
+1050 return f'IntrinsicRef({self.name}, {self.args})'
+1051
+1052class Call(Value):
+1053 op: "Function"
+1054 """After type inference, op should be a Value."""
+1055
+1056 args: List[Value | Ref]
+1057
+1058 def __init__(
+1059 self,
+1060 op: "Function",
+1061 args: List[Value | Ref],
+1062 type: Type,
+1063 span: Optional[Span] = None,
+1064 ) -> None:
+1065 super().__init__(type, span)
+1066 self.op = op
+1067 self.args = args
+1068
+1069
+1070class TemplateMatchingError(Exception):
+1071 span: Span | None
+1072 message: str
+1073
+1074 def __init__(self, node: Node | Span | None, message: str) -> None:
+1075 if node is not None:
+1076 if isinstance(node, Node):
+1077 self.span = node.span
+1078 else:
+1079 self.span = node
+1080 else:
+1081 self.span = None
+1082 self.message = message
+1083
+1084 def __str__(self) -> str:
+1085 if self.span is None:
+1086 return f"Template matching error:\n\t{self.message}"
+1087 return f"Template matching error at {self.span}:\n\t{self.message}"
+1088
+1089
+1090class SpannedError(Exception):
+1091 span: Span | None
+1092 message: str
+1093
+1094 def __init__(self, node: Node | Span | ast.AST | None, message: str) -> None:
+1095 if node is not None:
+1096 match node:
+1097 case Node():
+1098 self.span = node.span
+1099 case Span():
+1100 self.span = node
+1101 case ast.AST():
+1102 self.span = Span.from_ast(node)
+1103 else:
+1104 self.span = None
+1105 self.message = message
+1106
+1107
+1108class ParsingError(SpannedError):
+1109 def __str__(self) -> str:
+1110 if self.span is None:
+1111 return f"Parsing error:\n\t{self.message}"
+1112 return f"Parsing error at {self.span}:\n\t{self.message}"
+1113
+1114
+1115class InlineError(SpannedError):
+1116 def __str__(self) -> str:
+1117 if self.span is None:
+1118 return f"Inline error:\n\t{self.message}"
+1119 return f"Inline error at {self.span}:\n\t{self.message}"
+1120
+1121
+1122class TypeInferenceError(SpannedError):
+1123 def __str__(self) -> str:
+1124 if self.span is None:
+1125 return f"Type inference error:\n\t{self.message}"
+1126 return f"Type inference error at {self.span}:\n\t{self.message}"
+1127
+1128
+1129class Assign(Node):
+1130 ref: Ref
+1131 value: Value
+1132
+1133 def __init__(self, ref: Ref, value: Value, span: Optional[Span] = None) -> None:
+1134 assert not isinstance(value.type, (FunctionType, TypeConstructorType))
+1135 super().__init__(span)
+1136 self.ref = ref
+1137 self.value = value
+1138
+1139
+1140class Terminator(Node):
+1141 pass
+1142
+1143
+1144class Loop(Terminator):
+1145 prepare: BasicBlock
+1146 cond: Optional[Value]
+1147 body: BasicBlock
+1148 update: Optional[BasicBlock]
+1149 merge: BasicBlock
+1150
+1151 def __init__(
+1152 self,
+1153 prepare: BasicBlock,
+1154 cond: Optional[Value],
+1155 body: BasicBlock,
+1156 update: Optional[BasicBlock],
+1157 merge: BasicBlock,
+1158 span: Optional[Span] = None,
+1159 ) -> None:
+1160 super().__init__(span)
+1161 self.prepare = prepare
+1162 self.cond = cond
+1163 self.body = body
+1164 self.update = update
+1165 self.merge = merge
+1166
+1167
+1168class Break(Terminator):
+1169 target: Loop | None
+1170
+1171 def __init__(self, target: Loop | None, span: Optional[Span] = None) -> None:
+1172 super().__init__(span)
+1173 self.target = target
+1174
+1175
+1176class Continue(Terminator):
+1177 target: Loop | None
+1178
+1179 def __init__(self, target: Loop | None, span: Optional[Span] = None) -> None:
+1180 super().__init__(span)
+1181 self.target = target
+1182
+1183
+1184class If(Terminator):
+1185 cond: Value
+1186 then_body: BasicBlock
+1187 else_body: Optional[BasicBlock]
+1188 merge: BasicBlock
+1189
+1190 def __init__(
+1191 self,
+1192 cond: Value,
+1193 then_body: BasicBlock,
+1194 else_body: Optional[BasicBlock],
+1195 merge: BasicBlock,
+1196 span: Optional[Span] = None,
+1197 ) -> None:
+1198 super().__init__(span)
+1199 self.cond = cond
+1200 self.then_body = then_body
+1201 self.else_body = else_body
+1202 self.merge = merge
+1203
+1204
+1205class Return(Terminator):
+1206 value: Optional[Value]
+1207
+1208 def __init__(self, value: Optional[Value], span: Optional[Span] = None) -> None:
+1209 super().__init__(span)
+1210 self.value = value
+1211
+1212
+1213class ReturnRef(Terminator):
+1214 value: Ref
+1215
+1216 def __init__(self, value: Ref, span: Optional[Span] = None) -> None:
+1217 super().__init__(span)
+1218 self.value = value
+1219
+1220
+1221class Range(Value):
+1222 start: Value
+1223 step: Value
+1224 stop: Value
+1225
+1226 def __init__(self, start: Value, stop: Value, step: Value, span: Optional[Span] = None) -> None:
+1227 super().__init__(None, span)
+1228 self.start = start
+1229 self.stop = stop
+1230 self.step = step
+1231
+1232 def value_type(self) -> Type:
+1233 types = [self.start.type, self.stop.type, self.step.type]
+1234 for ty in types:
+1235 if not isinstance(ty, GenericIntType):
+1236 return unwrap(ty)
+1237 return unwrap(types[0])
+1238
+1239
+1240class ComptimeValue:
+1241 value: Any
+1242 update_func: Optional[Callable[[Any], None]]
+1243
+1244 def __init__(self, value: Any, update_func: Callable[[Any], None] | None) -> None:
+1245 self.value = value
+1246 self.update_func = update_func
+1247
+1248 def update(self, value: Any) -> None:
+1249 if self.update_func is not None:
+1250 self.update_func(value)
+1251 else:
+1252 raise RuntimeError("unable to update comptime value")
+1253
+1254 def __str__(self) -> str:
+1255 return f"ComptimeValue({self.value})"
+1256
+1257
+1258class FunctionSignature:
+1259 params: List[Var]
+1260 return_type: Type | None
+1261 generic_params: List[GenericParameter]
+1262
+1263 def __init__(self, generic_params: List[GenericParameter], params: List[Var], return_type: Type | None) -> None:
+1264 self.params = params
+1265 self.return_type = return_type
+1266 self.generic_params = generic_params
+1267
+1268
+1269class Function:
+1270 name: str
+1271 params: List[Var]
+1272 return_type: Type | None
+1273 body: Optional[BasicBlock]
+1274 export: bool
+1275 locals: List[Var]
+1276 complete: bool
+1277 is_method: bool
+1278 _inline_hint: bool | Literal['always', 'never']
+1279 returning_ref: bool
+1280
+1281 def __init__(
+1282 self,
+1283 name: str,
+1284 params: List[Var],
+1285 return_type: Type | None,
+1286 is_method: bool,
+1287 returning_ref: bool,
+1288 ) -> None:
+1289 self.name = name
+1290 self.params = params
+1291 self.return_type = return_type
+1292 self.body = None
+1293 self.export = False
+1294 self.locals = []
+1295 self.complete = False
+1296 self.is_method = is_method
+1297 self._inline_hint = False
+1298 self.returning_ref = returning_ref
+1299
+1300 def inline_hint(self) -> bool | Literal['always', 'never']:
+1301 return self._inline_hint
+1302
+1303
+1304def match_template_args(
+1305 template: List[Tuple[str, Type]],
+1306 args: List[Type]) -> Dict[GenericParameter, Type] | TypeInferenceError:
+1307 mapping: Dict[GenericParameter, Type] = {}
+1308
+1309 def unify(a: Type, b: Type):
+1310 """
+1311 Perform unification on two types or values, only a could contain generic parameters.
+1312 """
+1313 if a is b:
+1314 return
+1315
+1316 # unify type
+1317 match a:
+1318 case SymbolicType():
+1319 if a.param.name in mapping:
+1320 return unify(mapping[a.param], b)
+1321 if a.param.bound is None:
+1322 if isinstance(b, GenericFloatType) or isinstance(b, GenericIntType):
+1323 raise TypeInferenceError(None,
+1324 f"float/int literal cannot be used to infer generic type for `{a.param.name}` directly, wrap it with a concrete type")
+1325 else:
+1326 if not a.param.bound.satisfied_by(b):
+1327 raise TypeInferenceError(
+1328 None, f"{b} does not satisfy bound {a.param.bound}")
+1329 if isinstance(a.param.bound, UnionBound):
+1330 for bound in a.param.bound.bounds:
+1331 if bound.satisfied_by(b) and bound.super_type.is_concrete():
+1332 mapping[a.param] = bound.super_type
+1333 return
+1334 mapping[a.param] = b
+1335 return
+1336 case VectorType():
+1337 if not isinstance(b, VectorType):
+1338 raise TypeInferenceError(
+1339 None, f"expected {a}, got {b}")
+1340 if a.count != b.count:
+1341 raise TypeInferenceError(
+1342 None, f"vector length mismach, expected {a}, got {b}")
+1343 unify(a.element, b.element)
+1344 case ArrayType():
+1345 if not isinstance(b, ArrayType):
+1346 raise TypeInferenceError(
+1347 None, f"expected {a}, got {b}")
+1348 # TODO: handle generic array length
+1349 if a.count != b.count:
+1350 raise TypeInferenceError(
+1351 None, f"array length mismach, expected {a}, got {b}")
+1352 unify(a.element, b.element)
+1353 case PointerType():
+1354 if not isinstance(b, PointerType):
+1355 raise TypeInferenceError(
+1356 None, f"expected {a}, got {b}")
+1357 unify(a.element, b.element)
+1358 case TupleType():
+1359 def do() -> None:
+1360 if not isinstance(b, TupleType):
+1361 raise TypeInferenceError(
+1362 None, f"expected {a}, got {b}")
+1363 if len(a.elements) != len(b.elements):
+1364 raise TypeInferenceError(
+1365 None, f"expected {a}, got {b}")
+1366 for ea, eb in zip(a.elements, b.elements):
+1367 unify(ea, eb)
+1368 do()
+1369 case StructType():
+1370 raise RuntimeError(
+1371 "StructType should not appear in match_template_args")
+1372 # if not isinstance(b, StructType):
+1373 # raise TypeInferenceError(
+1374 # None, f"expected {a}, got {b}")
+1375 # if len(a.fields) != len(b.fields):
+1376 # raise TypeInferenceError(
+1377 # None, f"field cound mismatch, expected {a}, got {b}")
+1378 # for (fa, ta), (fb, tb) in zip(a.fields, b.fields):
+1379 # if fa != fb:
+1380 # raise TypeInferenceError(
+1381 # None, f"field name mismatch,expected {a}, got {b}")
+1382 # unify(ta, tb)
+1383 case BoundType():
+1384 def do() -> None:
+1385 if not isinstance(b, BoundType):
+1386 if isinstance(b, TypeConstructorType) and isinstance(a.generic.body, TypeConstructorType):
+1387 assert len(a.args) == 1
+1388 unify(a.args[0], b.inner)
+1389 return
+1390
+1391 raise TypeInferenceError(
+1392 None, f"{b} is not a BoundType")
+1393 if len(a.args) != len(b.args):
+1394 raise TypeInferenceError(
+1395 None, f"expected {len(a.args)} arguments, got {len(b.args)}")
+1396 for ea, eb in zip(a.args, b.args):
+1397 unify(ea, eb)
+1398 unify(a.generic.body, b.generic.body)
+1399 do()
+1400 case ParametricType():
+1401 raise RuntimeError(
+1402 "ParametricType should not appear in match_template_args")
+1403 case _:
+1404 if not is_type_compatible_to(b, a):
+1405 raise TypeInferenceError(
+1406 None, f"expected {a}, got {b}")
+1407 return False
+1408 try:
+1409 if len(template) != len(args):
+1410 return TypeInferenceError(None, f"expected {len(template)} arguments, got {len(args)}")
+1411 for i in range(len(template)):
+1412 unify(template[i][1], args[i])
+1413 return mapping
+1414 except TypeInferenceError as e:
+1415 return e
+1416
+1417
+1418def match_func_template_args(sig: FunctionSignature, args: FunctionTemplateResolvingArgs) -> Dict[GenericParameter, Type] | TypeInferenceError:
+1419 if len(sig.params) != len(args):
+1420 return TypeInferenceError(
+1421 None, f"expected {len(sig.params)} arguments, got {len(args)}")
+1422
+1423 template_args: List[Tuple[str, Type]] = []
+1424 for param in sig.params:
+1425 assert param.type is not None
+1426 template_args.append((param.name, param.type))
+1427 matching_args = [arg[1] for arg in args]
+1428 return match_template_args(template_args, matching_args)
+1429
+1430
+1431_global_context: Optional["GlobalContext"] = None
+1432
+1433
+1434class GlobalContext:
+1435 types: Dict[type, Type]
+1436 functions: Dict[Callable[..., Any], FunctionTemplate]
+1437
+1438 @staticmethod
+1439 def get() -> "GlobalContext":
+1440 global _global_context
+1441 if _global_context is None:
+1442 _global_context = GlobalContext()
+1443 return _global_context
+1444
+1445 def __init__(self) -> None:
+1446 assert _global_context is None, "GlobalContext should be a singleton"
+1447 self.types = {
+1448 type(None): UnitType(),
+1449 int: GenericIntType(),
+1450 float: GenericFloatType(),
+1451 bool: BoolType(),
+1452 }
+1453 self.functions = {}
+1454
+1455
+1456class FuncMetadata:
+1457 pass
+1458
+1459
+1460class StructMetadata:
+1461 pass
+1462
+1463
+1464def get_dsl_func(func: Callable[..., Any]) -> Optional[FunctionTemplate]:
+1465 func_ = GlobalContext.get().functions.get(func)
+1466 # print(func, GlobalContext.get().functions)
+1467 if not func_:
+1468 # check if __luisa_func__ is set
+1469 luisa_func = getattr(func, "__luisa_func__", None)
+1470 if luisa_func and isinstance(luisa_func, FunctionTemplate):
+1471 func_ = luisa_func
+1472 return func_
+1473
+1474
+1475def get_dsl_type(cls: type) -> Optional[Type]:
+1476 return GlobalContext.get().types.get(cls)
+1477
+1478
+1479def is_type_compatible_to(ty: Type, target: Type) -> bool:
+1480 if ty == target or isinstance(ty, AnyType):
+1481 return True
+1482 if isinstance(target, FloatType):
+1483 return isinstance(ty, GenericFloatType)
+1484 if isinstance(target, IntType):
+1485 return isinstance(ty, GenericIntType)
+1486 return False
+1487
+1488
+1489class FunctionInliner:
+1490 mapping: Dict[Ref | Value, Ref | Value]
+1491 ret: Value | Ref | None
+1492
+1493 def __init__(self, func: Function, args: List[Value | Ref], body: BasicBlock, span: Optional[Span] = None) -> None:
+1494 self.mapping = {}
+1495 self.ret = None
+1496 for param, arg in zip(func.params, args):
+1497 self.mapping[param] = arg
+1498 assert func.body
+1499 self.do_inline(func.body, body)
+1500
+1501 def do_inline(self, func_body: BasicBlock, body: BasicBlock) -> None:
+1502 for node in func_body.nodes:
+1503 assert node not in self.mapping
+1504
+1505 match node:
+1506 case Var():
+1507 assert node.type
+1508 assert node.semantic == ParameterSemantic.BYVAL
+1509 self.mapping[node] = Alloca(node.type, node.span)
+1510 case Load():
+1511 mapped_var = self.mapping[node.ref]
+1512 if isinstance(node.ref, Ref) and isinstance(mapped_var, Value):
+1513 self.mapping[node] = mapped_var
+1514 else:
+1515 assert isinstance(mapped_var, Ref)
+1516 self.mapping[node] = body.append(Load(mapped_var))
+1517 case Index():
+1518 base = self.mapping.get(node.base)
+1519 assert isinstance(base, Value)
+1520 index = self.mapping.get(node.index)
+1521 assert isinstance(index, Value)
+1522 assert node.type
+1523 self.mapping[node] = body.append(
+1524 Index(base, index, node.type, node.span))
+1525 case IndexRef():
+1526 base = self.mapping.get(node.base)
+1527 index = self.mapping.get(node.index)
+1528 assert isinstance(base, Ref)
+1529 assert isinstance(index, Value)
+1530 assert node.type
+1531 self.mapping[node] = body.append(IndexRef(
+1532 base, index, node.type, node.span))
+1533 case Member():
+1534 base = self.mapping.get(node.base)
+1535 assert isinstance(base, Value)
+1536 assert node.type
+1537 self.mapping[node] = body.append(Member(
+1538 base, node.field, node.type, node.span))
+1539 case MemberRef():
+1540 base = self.mapping.get(node.base)
+1541 assert isinstance(base, Ref)
+1542 assert node.type
+1543 self.mapping[node] = body.append(MemberRef(
+1544 base, node.field, node.type, node.span))
+1545 case Call() as call:
+1546 def do():
+1547 args: List[Ref | Value] = []
+1548 for arg in call.args:
+1549 mapped_arg = self.mapping.get(arg)
+1550 if mapped_arg is None:
+1551 raise InlineError(
+1552 node, "unable to inline call")
+1553 args.append(mapped_arg)
+1554 assert call.type
+1555 self.mapping[call] = body.append(
+1556 Call(call.op, args, call.type, node.span))
+1557 do()
+1558 case Intrinsic() as intrin:
+1559 def do():
+1560 args: List[Ref | Value] = []
+1561 for arg in intrin.args:
+1562 mapped_arg = self.mapping.get(arg)
+1563 if mapped_arg is None:
+1564 raise InlineError(
+1565 node, "unable to inline intrinsic")
+1566 args.append(mapped_arg)
+1567 assert intrin.type
+1568 self.mapping[intrin] = body.append(
+1569 Intrinsic(intrin.name, args, intrin.type, node.span))
+1570 do()
+1571 case IntrinsicRef() as intrin:
+1572 def do():
+1573 args: List[Ref | Value] = []
+1574 for arg in intrin.args:
+1575 mapped_arg = self.mapping.get(arg)
+1576 if mapped_arg is None:
+1577 raise InlineError(
+1578 node, "unable to inline intrinsic")
+1579 args.append(mapped_arg)
+1580 assert intrin.type
+1581 self.mapping[intrin] = body.append(
+1582 IntrinsicRef(intrin.name, args, intrin.type, node.span))
+1583 do()
+1584 case ReturnRef() | Return():
+1585 if self.ret is not None:
+1586 raise InlineError(node, "multiple return statement")
+1587 assert node.value is not None
+1588 mapped_value = self.mapping.get(node.value)
+1589 if mapped_value is None:
+1590 raise InlineError(node, "unable to inline return")
+1591 self.ret = mapped_value
+1592 case _:
+1593 raise ParsingError(node, f"invalid node {node} for inlining")
+1594
+1595 @staticmethod
+1596 def inline(func: Function, args: List[Value | Ref], body: BasicBlock, span: Optional[Span] = None) -> Value | Ref:
+1597 inliner = FunctionInliner(func, args, body, span)
+1598 assert inliner.ret
+1599 return inliner.ret
+1600
+1601
+1602def register_dsl_type_alias(target: type, alias: type):
+1603 """
+1604 Allow a type to be remapped to another type within DSL code.
+1605 Parameters:
+1606 target (type): The type to be remapped.
+1607 alias (type): The type to which the target type will be remapped.
+1608 Example:
+1609
+1610 For example,
+1611 ```python
+1612 @lc.struct
+1613 class Foo:
+1614 x: int
+1615 y: int
+1616
+1617 class SomeOtherFoo:
+1618 components: List[int]
+1619
+1620 register_dsl_type_alias(SomeOtherFoo, Foo)
+1621
+1622 @lc.func
+1623 def foo(f: SomeOtherFoo): # SomeOtherFoo is interpreted as Foo
+1624 ...
+1625
+1626 ```
+1627 """
+1628 ctx = GlobalContext.get()
+1629 alias_ty = get_dsl_type(alias)
+1630 assert alias_ty, f"alias type {alias} is not a DSL type"
+1631 ctx.types[target] = alias_ty
+
58class FunctionTemplate:
+ 59 """
+ 60 Contains a delegate that can be resolved to a function.
+ 61 This is to support generic functions as well as meta-programming.
+ 62 Since each time the function is called in DSL, user meta-programming code in the function body
+ 63 will be called, we need to keep the AST of the function.
+ 64
+ 65 """
+ 66 parsing_func: FunctionTemplateResolvingFunc
+ 67 _resolved: Dict[Tuple[Tuple[str,
+ 68 Union['Type', Any]], ...], "Function"]
+ 69 is_generic: bool
+ 70 name: str
+ 71 params: List[str]
+ 72 props: Optional[FuncProperties]
+ 73 """Function parameters (NOT type parameters)"""
+ 74
+ 75 def __init__(self, name: str, params: List[str], parsing_func: FunctionTemplateResolvingFunc, is_generic: bool) -> None:
+ 76 self.parsing_func = parsing_func
+ 77 self._resolved = {}
+ 78 self.params = params
+ 79 self.is_generic = is_generic
+ 80 self.name = name
+ 81 self.props = None
+ 82
+ 83 def resolve(self, args: FunctionTemplateResolvingArgs | None) -> Union["Function", 'TemplateMatchingError']:
+ 84 args = args or []
+ 85 if not self.is_generic:
+ 86 key = tuple(args)
+ 87 else:
+ 88 key = tuple()
+ 89 if key in self._resolved:
+ 90 return self._resolved[key]
+ 91 func = self.parsing_func(args)
+ 92 if isinstance(func, TemplateMatchingError):
+ 93 return func
+ 94 self._resolved[key] = func
+ 95 return func
+ 96
+ 97 def reset(self) -> None:
+ 98 self._resolved = {}
+ 99
+100 def inline_hint(self) -> bool | Literal['always', 'never']:
+101 if self.props is None:
+102 return False
+103 return self.props.inline
+
83 def resolve(self, args: FunctionTemplateResolvingArgs | None) -> Union["Function", 'TemplateMatchingError']:
+84 args = args or []
+85 if not self.is_generic:
+86 key = tuple(args)
+87 else:
+88 key = tuple()
+89 if key in self._resolved:
+90 return self._resolved[key]
+91 func = self.parsing_func(args)
+92 if isinstance(func, TemplateMatchingError):
+93 return func
+94 self._resolved[key] = func
+95 return func
+
110class Type(ABC):
+111 methods: Dict[str, Union["Function", FunctionTemplate]]
+112 is_builtin: bool
+113
+114 def __init__(self):
+115 self.methods = {}
+116 self.is_builtin = False
+117
+118 @abstractmethod
+119 def size(self) -> int:
+120 pass
+121
+122 @abstractmethod
+123 def align(self) -> int:
+124 pass
+125
+126 @abstractmethod
+127 def __eq__(self, value: object) -> bool:
+128 pass
+129
+130 @abstractmethod
+131 def __hash__(self) -> int:
+132 pass
+133
+134 def member(self, field: Any) -> Optional['Type']:
+135 if isinstance(field, str):
+136 m = self.methods.get(field)
+137 if not m:
+138 return None
+139 return FunctionType(m, None)
+140 return None
+141
+142 def method(self, name: str) -> Optional[Union["Function", FunctionTemplate]]:
+143 m = self.methods.get(name)
+144 if m:
+145 return m
+146 return None
+147
+148 def is_concrete(self) -> bool:
+149 return True
+150
+151 def __len__(self) -> int:
+152 return 1
+
154class LiteralType(Type):
+155 value: Any
+156
+157 def __init__(self, value: Any) -> None:
+158 super().__init__()
+159 self.value = value
+160
+161 def size(self) -> int:
+162 raise RuntimeError("LiteralType has no size")
+163
+164 def align(self) -> int:
+165 raise RuntimeError("LiteralType has no align")
+166
+167 def is_concrete(self) -> bool:
+168 return False
+169
+170 def __eq__(self, value: object) -> bool:
+171 return isinstance(value, LiteralType) and value.value == self.value
+172
+173 def __hash__(self) -> int:
+174 return hash((LiteralType, self.value))
+
Inherited Members
+
+
+
+ 176class AnyType(Type):
+177 def size(self) -> int:
+178 raise RuntimeError("AnyType has no size")
+179
+180 def align(self) -> int:
+181 raise RuntimeError("AnyType has no align")
+182
+183 def __eq__(self, value: object) -> bool:
+184 return isinstance(value, AnyType)
+185
+186 def __hash__(self) -> int:
+187 return hash(AnyType)
+188
+189 def __str__(self) -> str:
+190 return "AnyType"
+
Inherited Members
+
+
+
+ 193class UnitType(Type):
+194 def size(self) -> int:
+195 return 0
+196
+197 def align(self) -> int:
+198 return 1
+199
+200 def __eq__(self, value: object) -> bool:
+201 return isinstance(value, UnitType)
+202
+203 def __hash__(self) -> int:
+204 return hash(UnitType)
+205
+206 def __str__(self) -> str:
+207 return "UnitType"
+
Inherited Members
+
+
+
+ Inherited Members
+
+
+
+ 214class BoolType(ScalarType):
+215 def size(self) -> int:
+216 return 1
+217
+218 def align(self) -> int:
+219 return 1
+220
+221 def __eq__(self, value: object) -> bool:
+222 return isinstance(value, BoolType)
+223
+224 def __hash__(self) -> int:
+225 return hash(BoolType)
+226
+227 def __str__(self) -> str:
+228 return "bool"
+
Inherited Members
+
+
+
+ 231class IntType(ScalarType):
+232 bits: int
+233 signed: bool
+234
+235 def __init__(self, bits: int, signed: bool) -> None:
+236 super().__init__()
+237 self.bits = bits
+238 self.signed = signed
+239
+240 def size(self) -> int:
+241 return self.bits // 8
+242
+243 def align(self) -> int:
+244 return self.size()
+245
+246 def __eq__(self, value: object) -> bool:
+247 return (
+248 isinstance(value, IntType)
+249 and value.bits == self.bits
+250 and value.signed == self.signed
+251 )
+252
+253 def __hash__(self) -> int:
+254 return hash((IntType, self.bits, self.signed))
+255
+256 def __repr__(self) -> str:
+257 return f"IntType({self.bits}, {self.signed})"
+258
+259 def __str__(self) -> str:
+260 return f"{'i' if self.signed else 'u'}{self.bits}"
+
Inherited Members
+
+
+
+ 263class GenericFloatType(ScalarType):
+264 @override
+265 def __eq__(self, value: object) -> bool:
+266 return isinstance(value, GenericFloatType)
+267
+268 @override
+269 def __hash__(self) -> int:
+270 return hash(GenericFloatType)
+271
+272 @override
+273 def size(self) -> int:
+274 raise RuntimeError("GenericFloatType has no size")
+275
+276 @override
+277 def align(self) -> int:
+278 raise RuntimeError("GenericFloatType has no align")
+279
+280 @override
+281 def __repr__(self) -> str:
+282 return f"GenericFloatType()"
+283
+284 @override
+285 def __str__(self) -> str:
+286 return "float"
+287
+288 @override
+289 def is_concrete(self) -> bool:
+290 return False
+
Inherited Members
+
+
+
+ 293class GenericIntType(ScalarType):
+294 @override
+295 def __eq__(self, value: object) -> bool:
+296 return isinstance(value, GenericIntType)
+297
+298 @override
+299 def __hash__(self) -> int:
+300 return hash(GenericIntType)
+301
+302 @override
+303 def size(self) -> int:
+304 raise RuntimeError("GenericIntType has no size")
+305
+306 @override
+307 def align(self) -> int:
+308 raise RuntimeError("GenericIntType has no align")
+309
+310 @override
+311 def __repr__(self) -> str:
+312 return f"GenericIntType()"
+313
+314 @override
+315 def __str__(self) -> str:
+316 return "int"
+317
+318 @override
+319 def is_concrete(self) -> bool:
+320 return False
+
Inherited Members
+
+
+
+ 323class FloatType(ScalarType):
+324 bits: int
+325
+326 def __init__(self, bits: int) -> None:
+327 super().__init__()
+328 self.bits = bits
+329
+330 def size(self) -> int:
+331 return self.bits // 8
+332
+333 def align(self) -> int:
+334 return self.size()
+335
+336 def __eq__(self, value: object) -> bool:
+337 return isinstance(value, FloatType) and value.bits == self.bits
+338
+339 def __repr__(self) -> str:
+340 return f"FloatType({self.bits})"
+341
+342 def __hash__(self) -> int:
+343 return hash((FloatType, self.bits))
+344
+345 def __str__(self) -> str:
+346 return f"f{self.bits}"
+
Inherited Members
+
+
+
+ 349class VectorType(Type):
+350 element: Type
+351 count: int
+352 _align: int
+353 _size: int
+354
+355 def __init__(self, element: Type, count: int, align: int | None = None) -> None:
+356 super().__init__()
+357 if align is None:
+358 align = element.align()
+359 self.element = element
+360 self.count = count
+361 self._align = align
+362 assert (self.element.size() * self.count) % self._align == 0
+363 self._size = round_to_align(
+364 self.element.size() * self.count, self._align)
+365
+366 def size(self) -> int:
+367 return self._size
+368
+369 def align(self) -> int:
+370 return self._align
+371
+372 def __eq__(self, value: object) -> bool:
+373 return (
+374 isinstance(value, VectorType)
+375 and value.element == self.element
+376 and value.count == self.count
+377 )
+378
+379 def __repr__(self) -> str:
+380 return f"VectorType({self.element}, {self.count})"
+381
+382 def __hash__(self) -> int:
+383 return hash((VectorType, self.element, self.count))
+384
+385 def __str__(self) -> str:
+386 return f"<{self.count} x {self.element}>"
+387
+388 @override
+389 def member(self, field: Any) -> Optional['Type']:
+390 comps = 'xyzw'[:self.count]
+391 if isinstance(field, str) and field in comps:
+392 return self.element
+393 return Type.member(self, field)
+394
+395 def __len__(self) -> int:
+396 return self.count
+
355 def __init__(self, element: Type, count: int, align: int | None = None) -> None:
+356 super().__init__()
+357 if align is None:
+358 align = element.align()
+359 self.element = element
+360 self.count = count
+361 self._align = align
+362 assert (self.element.size() * self.count) % self._align == 0
+363 self._size = round_to_align(
+364 self.element.size() * self.count, self._align)
+
Inherited Members
+
+
+
+ 399class ArrayType(Type):
+400 element: Type
+401 count: Union[int, "SymbolicConstant"]
+402
+403 def __init__(self, element: Type, count: Union[int, "SymbolicConstant"]) -> None:
+404 super().__init__()
+405 self.element = element
+406 self.count = count
+407
+408 def size(self) -> int:
+409 if isinstance(self.count, SymbolicConstant):
+410 raise RuntimeError("ArrayType size is symbolic")
+411 return self.element.size() * self.count
+412
+413 def align(self) -> int:
+414 if isinstance(self.count, SymbolicConstant):
+415 raise RuntimeError("ArrayType align is symbolic")
+416 return self.element.align()
+417
+418 def __eq__(self, value: object) -> bool:
+419 return (
+420 isinstance(value, ArrayType)
+421 and value.element == self.element
+422 and value.count == self.count
+423 )
+424
+425 def __repr__(self) -> str:
+426 return f"ArrayType({self.element}, {self.count})"
+427
+428 def __hash__(self) -> int:
+429 return hash((ArrayType, self.element, self.count))
+430
+431 def __str__(self) -> str:
+432 return f"[{self.count} x {self.element}]"
+
Inherited Members
+
+
+
+ 435class PointerType(Type):
+436 element: Type
+437
+438 def __init__(self, element: Type) -> None:
+439 super().__init__()
+440 self.element = element
+441
+442 def size(self) -> int:
+443 return 8
+444
+445 def align(self) -> int:
+446 return 8
+447
+448 def __eq__(self, value: object) -> bool:
+449 return isinstance(value, PointerType) and value.element == self.element
+450
+451 def __repr__(self) -> str:
+452 return f"PointerType({self.element})"
+453
+454 def __hash__(self) -> int:
+455 return hash((PointerType, self.element))
+456
+457 def __str__(self) -> str:
+458 return f"*{self.element}"
+
Inherited Members
+
+
+
+ 461class TupleType(Type):
+462 elements: List[Type]
+463
+464 def __init__(self, elements: List[Type]) -> None:
+465 super().__init__()
+466 self.elements = elements
+467
+468 def size(self) -> int:
+469 return sum(element.size() for element in self.elements)
+470
+471 def align(self) -> int:
+472 return max(element.align() for element in self.elements)
+473
+474 def __eq__(self, value: object) -> bool:
+475 return self is value or (isinstance(value, TupleType) and value.elements == self.elements)
+476
+477 def __repr__(self) -> str:
+478 return f"TupleType({self.elements})"
+479
+480 def __hash__(self) -> int:
+481 return hash((TupleType, tuple(self.elements)))
+482
+483 def __str__(self) -> str:
+484 return f"({', '.join(str(e) for e in self.elements)})"
+485
+486 @override
+487 def member(self, field: Any) -> Optional['Type']:
+488 if isinstance(field, int):
+489 if field < len(self.elements):
+490 return self.elements[field]
+491 return Type.member(self, field)
+
Inherited Members
+
+
+
+ 494class StructType(Type):
+495 name: str
+496 display_name: str
+497 _fields: List[Tuple[str, Type]]
+498 _field_dict: Dict[str, Type]
+499 # _monomorphification_cache: Dict[Tuple['GenericParameter', Type | 'Value'], Type]
+500
+501 def __init__(self, name: str, display_name: str, fields: List[Tuple[str, Type]]) -> None:
+502 super().__init__()
+503 self.name = name
+504 self._fields = fields
+505 self.display_name = display_name
+506 self._field_dict = {name: ty for name, ty in fields}
+507
+508 @property
+509 def fields(self) -> List[Tuple[str, Type]]:
+510 return self._fields
+511
+512 @fields.setter
+513 def fields(self, value: List[Tuple[str, Type]]) -> None:
+514 self._fields = value
+515 self._field_dict = {name: ty for name, ty in value}
+516
+517 def size(self) -> int:
+518 return sum(field.size() for _, field in self.fields)
+519
+520 def align(self) -> int:
+521 return max(field.align() for _, field in self.fields)
+522
+523 def __str__(self) -> str:
+524 return self.display_name
+525
+526 @override
+527 def __eq__(self, value: object) -> bool:
+528 return value is self or (
+529 isinstance(
+530 value, StructType) and value.fields == self.fields and value.name == self.name
+531 )
+532
+533 @override
+534 def member(self, field: Any) -> Optional['Type']:
+535 if isinstance(field, str):
+536 if field in self._field_dict:
+537 return self._field_dict[field]
+538 return Type.member(self, field)
+539
+540 @override
+541 def __hash__(self) -> int:
+542 return hash((StructType, tuple(self.fields), self.name))
+
Inherited Members
+
+
+
+ 557class SubtypeBound(TypeBound):
+558 super_type: Type
+559 exact_match: bool
+560
+561 def __init__(self, super_type: Type, exact_match: bool) -> None:
+562 self.super_type = super_type
+563 self.exact_match = exact_match
+564
+565 def __repr__(self) -> str:
+566 return f"SubtypeBound({self.super_type})"
+567
+568 def __eq__(self, value: object) -> bool:
+569 return isinstance(value, SubtypeBound) and value.super_type == self.super_type
+570
+571 @override
+572 def satisfied_by(self, ty: Type) -> bool:
+573 if self.exact_match:
+574 return is_type_compatible_to(ty, self.super_type)
+575 else:
+576 raise NotImplementedError()
+
579class UnionBound(TypeBound):
+580 bounds: List[SubtypeBound]
+581
+582 def __init__(self, bounds: List[SubtypeBound]) -> None:
+583 self.bounds = bounds
+584
+585 def __repr__(self) -> str:
+586 return f"UnionBound({self.bounds})"
+587
+588 def __eq__(self, value: object) -> bool:
+589 return isinstance(value, UnionBound) and value.bounds == self.bounds
+590
+591 @override
+592 def satisfied_by(self, ty: Type) -> bool:
+593 return any(b.satisfied_by(ty) for b in self.bounds)
+
596class GenericParameter:
+597 """
+598 A GenericParameter contains three parts:
+599 name@ctx_name: bound
+600 """
+601 name: str
+602 """ name of the generic parameter in source code, e.g. 'T'"""
+603 ctx_name: str
+604 """ a string describing the context (where the generic parameter is defined), e.g. 'some_function' """
+605 bound: TypeBound | None
+606
+607 def __init__(
+608 self, name: str, ctx_name: str, bound: TypeBound | None = None
+609 ) -> None:
+610 self.name = name
+611 self.ctx_name = ctx_name
+612 self.bound = bound
+613
+614 def __eq__(self, value: object) -> bool:
+615 return (
+616 value is self or (
+617 isinstance(value, GenericParameter)
+618 and value.name == self.name
+619 and value.ctx_name == self.ctx_name)
+620 )
+621
+622 def __hash__(self) -> int:
+623 return hash((GenericParameter, self.name, self.ctx_name))
+624
+625 def __repr__(self) -> str:
+626 bound_str = f" : {self.bound}" if self.bound else ""
+627 return f"GenericParameter({self.name}, {self.ctx_name}, {bound_str})"
+
630class OpaqueType(Type):
+631 name: str
+632 extra_args: List[Any]
+633
+634 def __init__(self, name: str, extra: List[Any] | None = None) -> None:
+635 super().__init__()
+636 self.name = name
+637 self.extra_args = extra or []
+638
+639 def size(self) -> int:
+640 raise RuntimeError("OpaqueType has no size")
+641
+642 def align(self) -> int:
+643 raise RuntimeError("OpaqueType has no align")
+644
+645 def __eq__(self, value: object) -> bool:
+646 return isinstance(value, OpaqueType) and value.name == self.name and value.extra_args == self.extra_args
+647
+648 def __hash__(self) -> int:
+649 return hash((OpaqueType, self.name, tuple(self.extra_args)))
+650
+651 def __str__(self) -> str:
+652 return self.name
+653
+654 @override
+655 def is_concrete(self) -> bool:
+656 return False
+
Inherited Members
+
+
+
+ 659class SymbolicType(Type):
+660 param: GenericParameter
+661
+662 def __init__(self, param: GenericParameter) -> None:
+663 super().__init__()
+664 self.param = param
+665
+666 def size(self) -> int:
+667 raise RuntimeError("SymbolicType has no size")
+668
+669 def align(self) -> int:
+670 raise RuntimeError("SymbolicType has no align")
+671
+672 def __eq__(self, value: object) -> bool:
+673 return isinstance(value, SymbolicType) and value.param == self.param
+674
+675 def __hash__(self) -> int:
+676 return hash((SymbolicType, self.param))
+677
+678 def __str__(self) -> str:
+679 return f'~{self.param.name}@{self.param.ctx_name}'
+680
+681 def __repr__(self) -> str:
+682 return f"SymbolicType({self.param})"
+
Inherited Members
+
+
+
+ 688class ParametricType(Type):
+689 """
+690 The definition of a parametric type, e.g. class Foo[T]: ...
+691 """
+692 params: List[GenericParameter]
+693 body: Type
+694 monomorphification_cache: Dict[Tuple[Union['Type', Any], ...], 'Type']
+695 monomorphification_func: Optional[MonomorphizationFunc]
+696
+697 def __init__(self, params: List[GenericParameter],
+698 body: Type,
+699 monomorphification_func: MonomorphizationFunc | None = None) -> None:
+700 super().__init__()
+701 self.params = params
+702 self.body = body
+703 self.monomorphification_func = monomorphification_func
+704 self.monomorphification_cache = {}
+705
+706 def instantiate(self, args: List[Union[Type, Any]]) -> 'Type':
+707 keys = tuple(args)
+708 if keys in self.monomorphification_cache:
+709 return self.monomorphification_cache[keys]
+710 if self.monomorphification_func is not None:
+711 ty = self.monomorphification_func(args)
+712 self.monomorphification_cache[keys] = ty
+713 return ty
+714 raise RuntimeError("monomorphification_func is not set")
+715
+716 def size(self) -> int:
+717 raise RuntimeError("ParametricType has no size")
+718
+719 def align(self) -> int:
+720 raise RuntimeError("ParametricType has no align")
+721
+722 def __eq__(self, value: object) -> bool:
+723 return (
+724 isinstance(value, ParametricType)
+725 and value.params == self.params
+726 and value.body == self.body
+727 )
+728
+729 def __hash__(self) -> int:
+730 return hash((ParametricType, tuple(self.params), self.body))
+
697 def __init__(self, params: List[GenericParameter],
+698 body: Type,
+699 monomorphification_func: MonomorphizationFunc | None = None) -> None:
+700 super().__init__()
+701 self.params = params
+702 self.body = body
+703 self.monomorphification_func = monomorphification_func
+704 self.monomorphification_cache = {}
+
706 def instantiate(self, args: List[Union[Type, Any]]) -> 'Type':
+707 keys = tuple(args)
+708 if keys in self.monomorphification_cache:
+709 return self.monomorphification_cache[keys]
+710 if self.monomorphification_func is not None:
+711 ty = self.monomorphification_func(args)
+712 self.monomorphification_cache[keys] = ty
+713 return ty
+714 raise RuntimeError("monomorphification_func is not set")
+
Inherited Members
+
+
+
+ 733class BoundType(Type):
+734 """
+735 An instance of a parametric type, e.g. Foo[int]
+736 """
+737 generic: ParametricType
+738 args: List[Union[Type, Any]]
+739 instantiated: Optional[Type]
+740
+741 def __init__(self, generic: ParametricType, args: List[Union[Type, Any]], instantiated: Optional[Type] = None) -> None:
+742 super().__init__()
+743 self.generic = generic
+744 self.args = args
+745 self.instantiated = instantiated
+746
+747 def size(self) -> int:
+748 raise RuntimeError("don't call size on BoundedType")
+749
+750 def align(self) -> int:
+751 raise RuntimeError("don't call align on BoundedType")
+752
+753 def __eq__(self, value: object) -> bool:
+754 return (
+755 isinstance(value, BoundType)
+756 and value.generic == self.generic
+757 and value.args == self.args
+758 )
+759
+760 def __hash__(self):
+761 return hash((BoundType, self.generic, tuple(self.args)))
+762
+763 @override
+764 def member(self, field) -> Optional['Type']:
+765 if self.instantiated is not None:
+766 return self.instantiated.member(field)
+767 else:
+768 raise RuntimeError("member access on uninstantiated BoundType")
+769
+770 @override
+771 def method(self, name) -> Optional[Union["Function", FunctionTemplate]]:
+772 if self.instantiated is not None:
+773 return self.instantiated.method(name)
+774 else:
+775 raise RuntimeError("method access on uninstantiated BoundType")
+
Inherited Members
+
+
+
+ 778class TypeConstructorType(Type):
+779 inner: Type
+780
+781 def __init__(self, inner: Type) -> None:
+782 super().__init__()
+783 self.inner = inner
+784
+785 def size(self) -> int:
+786 raise RuntimeError("TypeConstructorType has no size")
+787
+788 def align(self) -> int:
+789 raise RuntimeError("TypeConstructorType has no align")
+790
+791 def __eq__(self, value: object) -> bool:
+792 return isinstance(value, TypeConstructorType) and value.inner == self.inner
+793
+794 def __hash__(self) -> int:
+795 return hash((TypeConstructorType, self.inner))
+
Inherited Members
+
+
+
+ 798class FunctionType(Type):
+799 func_like: Union["Function", FunctionTemplate]
+800 bound_object: Optional['Ref']
+801
+802 def __init__(self, func_like: Union["Function", FunctionTemplate], bound_object: Optional['Ref']) -> None:
+803 super().__init__()
+804 self.func_like = func_like
+805 self.bound_object = bound_object
+806
+807 def __eq__(self, value: object) -> bool:
+808 if self.bound_object is not None:
+809 return value is self
+810 return isinstance(value, FunctionType) and value.func_like is self.func_like and value.bound_object is None
+811
+812 def __hash__(self) -> int:
+813 return hash((FunctionType, id(self.func_like), id(self.bound_object)))
+814
+815 def size(self) -> int:
+816 raise RuntimeError("FunctionType has no size")
+817
+818 def align(self) -> int:
+819 raise RuntimeError("FunctionType has no align")
+
Inherited Members
+
+
+
+ 822class Node:
+823 """
+824 Base class for all nodes in the HIR. A node could be a value, a reference, or a statement.
+825 Nodes equality is based on their identity.
+826 """
+827 span: Optional[Span]
+828
+829 def __init__(self, span: Optional[Span] = None) -> None:
+830 self.span = None
+831
+832 def __eq__(self, value: object) -> bool:
+833 return value is self
+834
+835 def __hash__(self) -> int:
+836 return id(self)
+
842class BasicBlock(Node):
+843 nodes: List[Node]
+844 terminated: bool
+845
+846 def __init__(self, span: Optional[Span] = None) -> None:
+847 self.nodes = []
+848 self.terminated = False
+849 self.span = span
+850
+851 def append(self, node: NodeT) -> NodeT:
+852 if isinstance(node, Terminator):
+853 assert not self.terminated
+854 self.terminated = True
+855 self.nodes.append(node)
+856 return node
+
859class TypedNode(Node):
+860 """
+861 A node with a type, which can either be values or references.
+862 """
+863 type: Optional[Type]
+864
+865 def __init__(
+866 self, type: Optional[Type] = None, span: Optional[Span] = None
+867 ) -> None:
+868 super().__init__()
+869 self.type = type
+870 self.span = span
+
877class LocalRef(Ref):
+878 value: 'Value'
+879
+880 def __init__(self, value: 'Value') -> None:
+881 super().__init__(value.type)
+882 self.value = value
+883 self.span = value.span
+
895class SymbolicConstant(Value):
+896 generic: GenericParameter
+897
+898 def __init__(
+899 self, generic: GenericParameter, type: Optional[Type] = None, span: Optional[Span] = None
+900 ) -> None:
+901 super().__init__(type, span)
+902 self.generic = generic
+
910class Var(Ref):
+911 name: str
+912 semantic: ParameterSemantic
+913
+914 def __init__(
+915 self, name: str, type: Optional[Type], span: Optional[Span], semantic=ParameterSemantic.BYVAL
+916 ) -> None:
+917 super().__init__(type, span)
+918 self.name = name
+919 self.type = type
+920 self.semantic = semantic
+
923class Member(Value):
+924 base: Value
+925 field: str
+926
+927 def __init__(self, base: Value, field: str, type: Type, span: Optional[Span]) -> None:
+928 super().__init__(type, span)
+929 self.base = base
+930 self.field = field
+
933class Index(Value):
+934 base: Value
+935 index: Value
+936
+937 def __init__(self, base: Value, index: Value, type: Type, span: Optional[Span]) -> None:
+938 super().__init__(type, span)
+939 self.base = base
+940 self.index = index
+
943class MemberRef(Ref):
+944 base: Ref
+945 field: str
+946
+947 def __init__(self, base: Ref, field: str, type: Type, span: Optional[Span]) -> None:
+948 super().__init__(type, span)
+949 self.base = base
+950 self.field = field
+
953class IndexRef(Ref):
+954 base: Ref
+955 index: Value
+956
+957 def __init__(self, base: Ref, index: Value, type: Type, span: Optional[Span]) -> None:
+958 super().__init__(type, span)
+959 self.base = base
+960 self.index = index
+
963class Load(Value):
+964 ref: Ref
+965
+966 def __init__(self, ref: Ref) -> None:
+967 super().__init__(ref.type, ref.span)
+968 self.ref = ref
+
971class Constant(Value):
+972 value: Any
+973
+974 def __init__(self, value: Any, type: Type | None = None, span: Optional[Span] = None) -> None:
+975 super().__init__(type, span)
+976 self.value = value
+977
+978 def __eq__(self, value: object) -> bool:
+979 return isinstance(value, Constant) and type(value.value) == type(self.value) and value.value == self.value
+980
+981 def __hash__(self) -> int:
+982 return hash((Constant, self.value))
+
985class TypeValue(Value):
+986 def __init__(self, ty: Type, span: Optional[Span] = None) -> None:
+987 super().__init__(TypeConstructorType(ty), span)
+988
+989 def inner_type(self) -> Type:
+990 assert isinstance(self.type, TypeConstructorType)
+991 return self.type.inner
+
994class FunctionValue(Value):
+995 def __init__(self, ty: FunctionType, span: Optional[Span] = None) -> None:
+996 super().__init__(ty, span)
+
999class Alloca(Ref):
+1000 """
+1001 A temporary variable
+1002 """
+1003
+1004 def __init__(self, ty: Type, span: Optional[Span] = None) -> None:
+1005 super().__init__(ty, span)
+
1015class AggregateInit(Value):
+1016 args: List[Value]
+1017
+1018 def __init__(self, args: List[Value], type: Type, span: Optional[Span] = None) -> None:
+1019 super().__init__(type, span)
+1020 self.args = args
+
1023class Intrinsic(Value):
+1024 name: str
+1025 args: List[Value | Ref]
+1026
+1027 def __init__(self, name: str, args: List[Value | Ref], type: Type, span: Optional[Span] = None) -> None:
+1028 super().__init__(type, span)
+1029 self.name = name
+1030 self.args = args
+1031
+1032 def __str__(self) -> str:
+1033 return f'Intrinsic({self.name}, {self.args})'
+1034
+1035 def __repr__(self) -> str:
+1036 return f'Intrinsic({self.name}, {self.args})'
+
1038class IntrinsicRef(Ref):
+1039 name: str
+1040 args: List[Value | Ref]
+1041
+1042 def __init__(self, name: str, args: List[Value | Ref], type: Type, span: Optional[Span] = None) -> None:
+1043 super().__init__(type, span)
+1044 self.name = name
+1045 self.args = args
+1046
+1047 def __str__(self) -> str:
+1048 return f'IntrinsicRef({self.name}, {self.args})'
+1049
+1050 def __repr__(self) -> str:
+1051 return f'IntrinsicRef({self.name}, {self.args})'
+
1053class Call(Value):
+1054 op: "Function"
+1055 """After type inference, op should be a Value."""
+1056
+1057 args: List[Value | Ref]
+1058
+1059 def __init__(
+1060 self,
+1061 op: "Function",
+1062 args: List[Value | Ref],
+1063 type: Type,
+1064 span: Optional[Span] = None,
+1065 ) -> None:
+1066 super().__init__(type, span)
+1067 self.op = op
+1068 self.args = args
+
1071class TemplateMatchingError(Exception):
+1072 span: Span | None
+1073 message: str
+1074
+1075 def __init__(self, node: Node | Span | None, message: str) -> None:
+1076 if node is not None:
+1077 if isinstance(node, Node):
+1078 self.span = node.span
+1079 else:
+1080 self.span = node
+1081 else:
+1082 self.span = None
+1083 self.message = message
+1084
+1085 def __str__(self) -> str:
+1086 if self.span is None:
+1087 return f"Template matching error:\n\t{self.message}"
+1088 return f"Template matching error at {self.span}:\n\t{self.message}"
+
1091class SpannedError(Exception):
+1092 span: Span | None
+1093 message: str
+1094
+1095 def __init__(self, node: Node | Span | ast.AST | None, message: str) -> None:
+1096 if node is not None:
+1097 match node:
+1098 case Node():
+1099 self.span = node.span
+1100 case Span():
+1101 self.span = node
+1102 case ast.AST():
+1103 self.span = Span.from_ast(node)
+1104 else:
+1105 self.span = None
+1106 self.message = message
+
1095 def __init__(self, node: Node | Span | ast.AST | None, message: str) -> None:
+1096 if node is not None:
+1097 match node:
+1098 case Node():
+1099 self.span = node.span
+1100 case Span():
+1101 self.span = node
+1102 case ast.AST():
+1103 self.span = Span.from_ast(node)
+1104 else:
+1105 self.span = None
+1106 self.message = message
+
1109class ParsingError(SpannedError):
+1110 def __str__(self) -> str:
+1111 if self.span is None:
+1112 return f"Parsing error:\n\t{self.message}"
+1113 return f"Parsing error at {self.span}:\n\t{self.message}"
+
Inherited Members
+
+
+
+ 1116class InlineError(SpannedError):
+1117 def __str__(self) -> str:
+1118 if self.span is None:
+1119 return f"Inline error:\n\t{self.message}"
+1120 return f"Inline error at {self.span}:\n\t{self.message}"
+
Inherited Members
+
+
+
+ 1123class TypeInferenceError(SpannedError):
+1124 def __str__(self) -> str:
+1125 if self.span is None:
+1126 return f"Type inference error:\n\t{self.message}"
+1127 return f"Type inference error at {self.span}:\n\t{self.message}"
+
Inherited Members
+
+
+
+ 1130class Assign(Node):
+1131 ref: Ref
+1132 value: Value
+1133
+1134 def __init__(self, ref: Ref, value: Value, span: Optional[Span] = None) -> None:
+1135 assert not isinstance(value.type, (FunctionType, TypeConstructorType))
+1136 super().__init__(span)
+1137 self.ref = ref
+1138 self.value = value
+
1145class Loop(Terminator):
+1146 prepare: BasicBlock
+1147 cond: Optional[Value]
+1148 body: BasicBlock
+1149 update: Optional[BasicBlock]
+1150 merge: BasicBlock
+1151
+1152 def __init__(
+1153 self,
+1154 prepare: BasicBlock,
+1155 cond: Optional[Value],
+1156 body: BasicBlock,
+1157 update: Optional[BasicBlock],
+1158 merge: BasicBlock,
+1159 span: Optional[Span] = None,
+1160 ) -> None:
+1161 super().__init__(span)
+1162 self.prepare = prepare
+1163 self.cond = cond
+1164 self.body = body
+1165 self.update = update
+1166 self.merge = merge
+
1152 def __init__(
+1153 self,
+1154 prepare: BasicBlock,
+1155 cond: Optional[Value],
+1156 body: BasicBlock,
+1157 update: Optional[BasicBlock],
+1158 merge: BasicBlock,
+1159 span: Optional[Span] = None,
+1160 ) -> None:
+1161 super().__init__(span)
+1162 self.prepare = prepare
+1163 self.cond = cond
+1164 self.body = body
+1165 self.update = update
+1166 self.merge = merge
+
1169class Break(Terminator):
+1170 target: Loop | None
+1171
+1172 def __init__(self, target: Loop | None, span: Optional[Span] = None) -> None:
+1173 super().__init__(span)
+1174 self.target = target
+
1177class Continue(Terminator):
+1178 target: Loop | None
+1179
+1180 def __init__(self, target: Loop | None, span: Optional[Span] = None) -> None:
+1181 super().__init__(span)
+1182 self.target = target
+
1185class If(Terminator):
+1186 cond: Value
+1187 then_body: BasicBlock
+1188 else_body: Optional[BasicBlock]
+1189 merge: BasicBlock
+1190
+1191 def __init__(
+1192 self,
+1193 cond: Value,
+1194 then_body: BasicBlock,
+1195 else_body: Optional[BasicBlock],
+1196 merge: BasicBlock,
+1197 span: Optional[Span] = None,
+1198 ) -> None:
+1199 super().__init__(span)
+1200 self.cond = cond
+1201 self.then_body = then_body
+1202 self.else_body = else_body
+1203 self.merge = merge
+
1191 def __init__(
+1192 self,
+1193 cond: Value,
+1194 then_body: BasicBlock,
+1195 else_body: Optional[BasicBlock],
+1196 merge: BasicBlock,
+1197 span: Optional[Span] = None,
+1198 ) -> None:
+1199 super().__init__(span)
+1200 self.cond = cond
+1201 self.then_body = then_body
+1202 self.else_body = else_body
+1203 self.merge = merge
+
1206class Return(Terminator):
+1207 value: Optional[Value]
+1208
+1209 def __init__(self, value: Optional[Value], span: Optional[Span] = None) -> None:
+1210 super().__init__(span)
+1211 self.value = value
+
1214class ReturnRef(Terminator):
+1215 value: Ref
+1216
+1217 def __init__(self, value: Ref, span: Optional[Span] = None) -> None:
+1218 super().__init__(span)
+1219 self.value = value
+
1222class Range(Value):
+1223 start: Value
+1224 step: Value
+1225 stop: Value
+1226
+1227 def __init__(self, start: Value, stop: Value, step: Value, span: Optional[Span] = None) -> None:
+1228 super().__init__(None, span)
+1229 self.start = start
+1230 self.stop = stop
+1231 self.step = step
+1232
+1233 def value_type(self) -> Type:
+1234 types = [self.start.type, self.stop.type, self.step.type]
+1235 for ty in types:
+1236 if not isinstance(ty, GenericIntType):
+1237 return unwrap(ty)
+1238 return unwrap(types[0])
+
1241class ComptimeValue:
+1242 value: Any
+1243 update_func: Optional[Callable[[Any], None]]
+1244
+1245 def __init__(self, value: Any, update_func: Callable[[Any], None] | None) -> None:
+1246 self.value = value
+1247 self.update_func = update_func
+1248
+1249 def update(self, value: Any) -> None:
+1250 if self.update_func is not None:
+1251 self.update_func(value)
+1252 else:
+1253 raise RuntimeError("unable to update comptime value")
+1254
+1255 def __str__(self) -> str:
+1256 return f"ComptimeValue({self.value})"
+
1259class FunctionSignature:
+1260 params: List[Var]
+1261 return_type: Type | None
+1262 generic_params: List[GenericParameter]
+1263
+1264 def __init__(self, generic_params: List[GenericParameter], params: List[Var], return_type: Type | None) -> None:
+1265 self.params = params
+1266 self.return_type = return_type
+1267 self.generic_params = generic_params
+
1270class Function:
+1271 name: str
+1272 params: List[Var]
+1273 return_type: Type | None
+1274 body: Optional[BasicBlock]
+1275 export: bool
+1276 locals: List[Var]
+1277 complete: bool
+1278 is_method: bool
+1279 _inline_hint: bool | Literal['always', 'never']
+1280 returning_ref: bool
+1281
+1282 def __init__(
+1283 self,
+1284 name: str,
+1285 params: List[Var],
+1286 return_type: Type | None,
+1287 is_method: bool,
+1288 returning_ref: bool,
+1289 ) -> None:
+1290 self.name = name
+1291 self.params = params
+1292 self.return_type = return_type
+1293 self.body = None
+1294 self.export = False
+1295 self.locals = []
+1296 self.complete = False
+1297 self.is_method = is_method
+1298 self._inline_hint = False
+1299 self.returning_ref = returning_ref
+1300
+1301 def inline_hint(self) -> bool | Literal['always', 'never']:
+1302 return self._inline_hint
+
1282 def __init__(
+1283 self,
+1284 name: str,
+1285 params: List[Var],
+1286 return_type: Type | None,
+1287 is_method: bool,
+1288 returning_ref: bool,
+1289 ) -> None:
+1290 self.name = name
+1291 self.params = params
+1292 self.return_type = return_type
+1293 self.body = None
+1294 self.export = False
+1295 self.locals = []
+1296 self.complete = False
+1297 self.is_method = is_method
+1298 self._inline_hint = False
+1299 self.returning_ref = returning_ref
+
1305def match_template_args(
+1306 template: List[Tuple[str, Type]],
+1307 args: List[Type]) -> Dict[GenericParameter, Type] | TypeInferenceError:
+1308 mapping: Dict[GenericParameter, Type] = {}
+1309
+1310 def unify(a: Type, b: Type):
+1311 """
+1312 Perform unification on two types or values, only a could contain generic parameters.
+1313 """
+1314 if a is b:
+1315 return
+1316
+1317 # unify type
+1318 match a:
+1319 case SymbolicType():
+1320 if a.param.name in mapping:
+1321 return unify(mapping[a.param], b)
+1322 if a.param.bound is None:
+1323 if isinstance(b, GenericFloatType) or isinstance(b, GenericIntType):
+1324 raise TypeInferenceError(None,
+1325 f"float/int literal cannot be used to infer generic type for `{a.param.name}` directly, wrap it with a concrete type")
+1326 else:
+1327 if not a.param.bound.satisfied_by(b):
+1328 raise TypeInferenceError(
+1329 None, f"{b} does not satisfy bound {a.param.bound}")
+1330 if isinstance(a.param.bound, UnionBound):
+1331 for bound in a.param.bound.bounds:
+1332 if bound.satisfied_by(b) and bound.super_type.is_concrete():
+1333 mapping[a.param] = bound.super_type
+1334 return
+1335 mapping[a.param] = b
+1336 return
+1337 case VectorType():
+1338 if not isinstance(b, VectorType):
+1339 raise TypeInferenceError(
+1340 None, f"expected {a}, got {b}")
+1341 if a.count != b.count:
+1342 raise TypeInferenceError(
+1343 None, f"vector length mismach, expected {a}, got {b}")
+1344 unify(a.element, b.element)
+1345 case ArrayType():
+1346 if not isinstance(b, ArrayType):
+1347 raise TypeInferenceError(
+1348 None, f"expected {a}, got {b}")
+1349 # TODO: handle generic array length
+1350 if a.count != b.count:
+1351 raise TypeInferenceError(
+1352 None, f"array length mismach, expected {a}, got {b}")
+1353 unify(a.element, b.element)
+1354 case PointerType():
+1355 if not isinstance(b, PointerType):
+1356 raise TypeInferenceError(
+1357 None, f"expected {a}, got {b}")
+1358 unify(a.element, b.element)
+1359 case TupleType():
+1360 def do() -> None:
+1361 if not isinstance(b, TupleType):
+1362 raise TypeInferenceError(
+1363 None, f"expected {a}, got {b}")
+1364 if len(a.elements) != len(b.elements):
+1365 raise TypeInferenceError(
+1366 None, f"expected {a}, got {b}")
+1367 for ea, eb in zip(a.elements, b.elements):
+1368 unify(ea, eb)
+1369 do()
+1370 case StructType():
+1371 raise RuntimeError(
+1372 "StructType should not appear in match_template_args")
+1373 # if not isinstance(b, StructType):
+1374 # raise TypeInferenceError(
+1375 # None, f"expected {a}, got {b}")
+1376 # if len(a.fields) != len(b.fields):
+1377 # raise TypeInferenceError(
+1378 # None, f"field cound mismatch, expected {a}, got {b}")
+1379 # for (fa, ta), (fb, tb) in zip(a.fields, b.fields):
+1380 # if fa != fb:
+1381 # raise TypeInferenceError(
+1382 # None, f"field name mismatch,expected {a}, got {b}")
+1383 # unify(ta, tb)
+1384 case BoundType():
+1385 def do() -> None:
+1386 if not isinstance(b, BoundType):
+1387 if isinstance(b, TypeConstructorType) and isinstance(a.generic.body, TypeConstructorType):
+1388 assert len(a.args) == 1
+1389 unify(a.args[0], b.inner)
+1390 return
+1391
+1392 raise TypeInferenceError(
+1393 None, f"{b} is not a BoundType")
+1394 if len(a.args) != len(b.args):
+1395 raise TypeInferenceError(
+1396 None, f"expected {len(a.args)} arguments, got {len(b.args)}")
+1397 for ea, eb in zip(a.args, b.args):
+1398 unify(ea, eb)
+1399 unify(a.generic.body, b.generic.body)
+1400 do()
+1401 case ParametricType():
+1402 raise RuntimeError(
+1403 "ParametricType should not appear in match_template_args")
+1404 case _:
+1405 if not is_type_compatible_to(b, a):
+1406 raise TypeInferenceError(
+1407 None, f"expected {a}, got {b}")
+1408 return False
+1409 try:
+1410 if len(template) != len(args):
+1411 return TypeInferenceError(None, f"expected {len(template)} arguments, got {len(args)}")
+1412 for i in range(len(template)):
+1413 unify(template[i][1], args[i])
+1414 return mapping
+1415 except TypeInferenceError as e:
+1416 return e
+
1419def match_func_template_args(sig: FunctionSignature, args: FunctionTemplateResolvingArgs) -> Dict[GenericParameter, Type] | TypeInferenceError:
+1420 if len(sig.params) != len(args):
+1421 return TypeInferenceError(
+1422 None, f"expected {len(sig.params)} arguments, got {len(args)}")
+1423
+1424 template_args: List[Tuple[str, Type]] = []
+1425 for param in sig.params:
+1426 assert param.type is not None
+1427 template_args.append((param.name, param.type))
+1428 matching_args = [arg[1] for arg in args]
+1429 return match_template_args(template_args, matching_args)
+
1435class GlobalContext:
+1436 types: Dict[type, Type]
+1437 functions: Dict[Callable[..., Any], FunctionTemplate]
+1438
+1439 @staticmethod
+1440 def get() -> "GlobalContext":
+1441 global _global_context
+1442 if _global_context is None:
+1443 _global_context = GlobalContext()
+1444 return _global_context
+1445
+1446 def __init__(self) -> None:
+1447 assert _global_context is None, "GlobalContext should be a singleton"
+1448 self.types = {
+1449 type(None): UnitType(),
+1450 int: GenericIntType(),
+1451 float: GenericFloatType(),
+1452 bool: BoolType(),
+1453 }
+1454 self.functions = {}
+
1465def get_dsl_func(func: Callable[..., Any]) -> Optional[FunctionTemplate]:
+1466 func_ = GlobalContext.get().functions.get(func)
+1467 # print(func, GlobalContext.get().functions)
+1468 if not func_:
+1469 # check if __luisa_func__ is set
+1470 luisa_func = getattr(func, "__luisa_func__", None)
+1471 if luisa_func and isinstance(luisa_func, FunctionTemplate):
+1472 func_ = luisa_func
+1473 return func_
+
1480def is_type_compatible_to(ty: Type, target: Type) -> bool:
+1481 if ty == target or isinstance(ty, AnyType):
+1482 return True
+1483 if isinstance(target, FloatType):
+1484 return isinstance(ty, GenericFloatType)
+1485 if isinstance(target, IntType):
+1486 return isinstance(ty, GenericIntType)
+1487 return False
+
1490class FunctionInliner:
+1491 mapping: Dict[Ref | Value, Ref | Value]
+1492 ret: Value | Ref | None
+1493
+1494 def __init__(self, func: Function, args: List[Value | Ref], body: BasicBlock, span: Optional[Span] = None) -> None:
+1495 self.mapping = {}
+1496 self.ret = None
+1497 for param, arg in zip(func.params, args):
+1498 self.mapping[param] = arg
+1499 assert func.body
+1500 self.do_inline(func.body, body)
+1501
+1502 def do_inline(self, func_body: BasicBlock, body: BasicBlock) -> None:
+1503 for node in func_body.nodes:
+1504 assert node not in self.mapping
+1505
+1506 match node:
+1507 case Var():
+1508 assert node.type
+1509 assert node.semantic == ParameterSemantic.BYVAL
+1510 self.mapping[node] = Alloca(node.type, node.span)
+1511 case Load():
+1512 mapped_var = self.mapping[node.ref]
+1513 if isinstance(node.ref, Ref) and isinstance(mapped_var, Value):
+1514 self.mapping[node] = mapped_var
+1515 else:
+1516 assert isinstance(mapped_var, Ref)
+1517 self.mapping[node] = body.append(Load(mapped_var))
+1518 case Index():
+1519 base = self.mapping.get(node.base)
+1520 assert isinstance(base, Value)
+1521 index = self.mapping.get(node.index)
+1522 assert isinstance(index, Value)
+1523 assert node.type
+1524 self.mapping[node] = body.append(
+1525 Index(base, index, node.type, node.span))
+1526 case IndexRef():
+1527 base = self.mapping.get(node.base)
+1528 index = self.mapping.get(node.index)
+1529 assert isinstance(base, Ref)
+1530 assert isinstance(index, Value)
+1531 assert node.type
+1532 self.mapping[node] = body.append(IndexRef(
+1533 base, index, node.type, node.span))
+1534 case Member():
+1535 base = self.mapping.get(node.base)
+1536 assert isinstance(base, Value)
+1537 assert node.type
+1538 self.mapping[node] = body.append(Member(
+1539 base, node.field, node.type, node.span))
+1540 case MemberRef():
+1541 base = self.mapping.get(node.base)
+1542 assert isinstance(base, Ref)
+1543 assert node.type
+1544 self.mapping[node] = body.append(MemberRef(
+1545 base, node.field, node.type, node.span))
+1546 case Call() as call:
+1547 def do():
+1548 args: List[Ref | Value] = []
+1549 for arg in call.args:
+1550 mapped_arg = self.mapping.get(arg)
+1551 if mapped_arg is None:
+1552 raise InlineError(
+1553 node, "unable to inline call")
+1554 args.append(mapped_arg)
+1555 assert call.type
+1556 self.mapping[call] = body.append(
+1557 Call(call.op, args, call.type, node.span))
+1558 do()
+1559 case Intrinsic() as intrin:
+1560 def do():
+1561 args: List[Ref | Value] = []
+1562 for arg in intrin.args:
+1563 mapped_arg = self.mapping.get(arg)
+1564 if mapped_arg is None:
+1565 raise InlineError(
+1566 node, "unable to inline intrinsic")
+1567 args.append(mapped_arg)
+1568 assert intrin.type
+1569 self.mapping[intrin] = body.append(
+1570 Intrinsic(intrin.name, args, intrin.type, node.span))
+1571 do()
+1572 case IntrinsicRef() as intrin:
+1573 def do():
+1574 args: List[Ref | Value] = []
+1575 for arg in intrin.args:
+1576 mapped_arg = self.mapping.get(arg)
+1577 if mapped_arg is None:
+1578 raise InlineError(
+1579 node, "unable to inline intrinsic")
+1580 args.append(mapped_arg)
+1581 assert intrin.type
+1582 self.mapping[intrin] = body.append(
+1583 IntrinsicRef(intrin.name, args, intrin.type, node.span))
+1584 do()
+1585 case ReturnRef() | Return():
+1586 if self.ret is not None:
+1587 raise InlineError(node, "multiple return statement")
+1588 assert node.value is not None
+1589 mapped_value = self.mapping.get(node.value)
+1590 if mapped_value is None:
+1591 raise InlineError(node, "unable to inline return")
+1592 self.ret = mapped_value
+1593 case _:
+1594 raise ParsingError(node, f"invalid node {node} for inlining")
+1595
+1596 @staticmethod
+1597 def inline(func: Function, args: List[Value | Ref], body: BasicBlock, span: Optional[Span] = None) -> Value | Ref:
+1598 inliner = FunctionInliner(func, args, body, span)
+1599 assert inliner.ret
+1600 return inliner.ret
+
1494 def __init__(self, func: Function, args: List[Value | Ref], body: BasicBlock, span: Optional[Span] = None) -> None:
+1495 self.mapping = {}
+1496 self.ret = None
+1497 for param, arg in zip(func.params, args):
+1498 self.mapping[param] = arg
+1499 assert func.body
+1500 self.do_inline(func.body, body)
+
1502 def do_inline(self, func_body: BasicBlock, body: BasicBlock) -> None:
+1503 for node in func_body.nodes:
+1504 assert node not in self.mapping
+1505
+1506 match node:
+1507 case Var():
+1508 assert node.type
+1509 assert node.semantic == ParameterSemantic.BYVAL
+1510 self.mapping[node] = Alloca(node.type, node.span)
+1511 case Load():
+1512 mapped_var = self.mapping[node.ref]
+1513 if isinstance(node.ref, Ref) and isinstance(mapped_var, Value):
+1514 self.mapping[node] = mapped_var
+1515 else:
+1516 assert isinstance(mapped_var, Ref)
+1517 self.mapping[node] = body.append(Load(mapped_var))
+1518 case Index():
+1519 base = self.mapping.get(node.base)
+1520 assert isinstance(base, Value)
+1521 index = self.mapping.get(node.index)
+1522 assert isinstance(index, Value)
+1523 assert node.type
+1524 self.mapping[node] = body.append(
+1525 Index(base, index, node.type, node.span))
+1526 case IndexRef():
+1527 base = self.mapping.get(node.base)
+1528 index = self.mapping.get(node.index)
+1529 assert isinstance(base, Ref)
+1530 assert isinstance(index, Value)
+1531 assert node.type
+1532 self.mapping[node] = body.append(IndexRef(
+1533 base, index, node.type, node.span))
+1534 case Member():
+1535 base = self.mapping.get(node.base)
+1536 assert isinstance(base, Value)
+1537 assert node.type
+1538 self.mapping[node] = body.append(Member(
+1539 base, node.field, node.type, node.span))
+1540 case MemberRef():
+1541 base = self.mapping.get(node.base)
+1542 assert isinstance(base, Ref)
+1543 assert node.type
+1544 self.mapping[node] = body.append(MemberRef(
+1545 base, node.field, node.type, node.span))
+1546 case Call() as call:
+1547 def do():
+1548 args: List[Ref | Value] = []
+1549 for arg in call.args:
+1550 mapped_arg = self.mapping.get(arg)
+1551 if mapped_arg is None:
+1552 raise InlineError(
+1553 node, "unable to inline call")
+1554 args.append(mapped_arg)
+1555 assert call.type
+1556 self.mapping[call] = body.append(
+1557 Call(call.op, args, call.type, node.span))
+1558 do()
+1559 case Intrinsic() as intrin:
+1560 def do():
+1561 args: List[Ref | Value] = []
+1562 for arg in intrin.args:
+1563 mapped_arg = self.mapping.get(arg)
+1564 if mapped_arg is None:
+1565 raise InlineError(
+1566 node, "unable to inline intrinsic")
+1567 args.append(mapped_arg)
+1568 assert intrin.type
+1569 self.mapping[intrin] = body.append(
+1570 Intrinsic(intrin.name, args, intrin.type, node.span))
+1571 do()
+1572 case IntrinsicRef() as intrin:
+1573 def do():
+1574 args: List[Ref | Value] = []
+1575 for arg in intrin.args:
+1576 mapped_arg = self.mapping.get(arg)
+1577 if mapped_arg is None:
+1578 raise InlineError(
+1579 node, "unable to inline intrinsic")
+1580 args.append(mapped_arg)
+1581 assert intrin.type
+1582 self.mapping[intrin] = body.append(
+1583 IntrinsicRef(intrin.name, args, intrin.type, node.span))
+1584 do()
+1585 case ReturnRef() | Return():
+1586 if self.ret is not None:
+1587 raise InlineError(node, "multiple return statement")
+1588 assert node.value is not None
+1589 mapped_value = self.mapping.get(node.value)
+1590 if mapped_value is None:
+1591 raise InlineError(node, "unable to inline return")
+1592 self.ret = mapped_value
+1593 case _:
+1594 raise ParsingError(node, f"invalid node {node} for inlining")
+
1603def register_dsl_type_alias(target: type, alias: type):
+1604 """
+1605 Allow a type to be remapped to another type within DSL code.
+1606 Parameters:
+1607 target (type): The type to be remapped.
+1608 alias (type): The type to which the target type will be remapped.
+1609 Example:
+1610
+1611 For example,
+1612 ```python
+1613 @lc.struct
+1614 class Foo:
+1615 x: int
+1616 y: int
+1617
+1618 class SomeOtherFoo:
+1619 components: List[int]
+1620
+1621 register_dsl_type_alias(SomeOtherFoo, Foo)
+1622
+1623 @lc.func
+1624 def foo(f: SomeOtherFoo): # SomeOtherFoo is interpreted as Foo
+1625 ...
+1626
+1627 ```
+1628 """
+1629 ctx = GlobalContext.get()
+1630 alias_ty = get_dsl_type(alias)
+1631 assert alias_ty, f"alias type {alias} is not a DSL type"
+1632 ctx.types[target] = alias_ty
+
+@lc.struct
+class Foo:
+ x: int
+ y: int
+
+class SomeOtherFoo:
+ components: List[int]
+
+register_dsl_type_alias(SomeOtherFoo, Foo)
+
+@lc.func
+def foo(f: SomeOtherFoo): # SomeOtherFoo is interpreted as Foo
+ ...
+
+luisa_lang
+
+
+
+
+
+
+
+
+
+
+luisa_lang
+
+
+
+
+
+
+ 1import types
+ 2from luisa_lang.math_types import *
+ 3import luisa_lang.hir as hir
+ 4import typing
+ 5from typing import (
+ 6 Callable,
+ 7 Dict,
+ 8 List,
+ 9 Optional,
+ 10 Sequence,
+ 11 Set,
+ 12 Tuple,
+ 13 TypeAlias,
+ 14 TypeVar,
+ 15 Union,
+ 16 Generic,
+ 17 Literal,
+ 18 overload,
+ 19 Any,
+ 20)
+ 21from luisa_lang._builtin_decor import func, intrinsic, opaque, builtin_generic_type
+ 22from luisa_lang import parse
+ 23
+ 24T = TypeVar("T")
+ 25N = TypeVar("N")
+ 26
+ 27
+ 28@func
+ 29def dispatch_id() -> uint3:
+ 30 return intrinsic("dispatch_id", uint3)
+ 31
+ 32
+ 33@func
+ 34def thread_id() -> uint3:
+ 35 return intrinsic("thread_id", uint3)
+ 36
+ 37
+ 38@func
+ 39def block_id() -> uint3:
+ 40 return intrinsic("block_id", uint3)
+ 41
+ 42
+ 43def cast(target: type[T], value: Any) -> T:
+ 44 """
+ 45 Attempt to convert the value to the target type.
+ 46 """
+ 47 return intrinsic("cast", target, value)
+ 48
+ 49
+ 50def bitcast(target: type[T], value: Any) -> T:
+ 51 """
+ 52 Attempt to convert the value to the target type, preserving the bit representation.
+ 53 """
+ 54 return intrinsic("bitcast", target, value)
+ 55
+ 56
+ 57class ComptimeBlock:
+ 58 def __init__(self):
+ 59 pass
+ 60
+ 61 def __enter__(self):
+ 62 pass
+ 63
+ 64 def __exit__(self, exc_type, exc_val, exc_tb):
+ 65 pass
+ 66
+ 67 def __call__(self):
+ 68 pass
+ 69
+ 70
+ 71class _ComptimeBlockMarker:
+ 72 pass
+ 73
+ 74
+ 75F = TypeVar("F", bound=Callable[..., Any])
+ 76
+ 77
+ 78def instantiate(f: F, *args: List[type]) -> F:
+ 79 raise NotImplementedError(
+ 80 "instantiate should not be called in host-side Python code. ")
+ 81
+ 82
+ 83@overload
+ 84def comptime(a: _ComptimeBlockMarker) -> ComptimeBlock: ...
+ 85
+ 86
+ 87@overload
+ 88def comptime(src: str) -> Any: ...
+ 89
+ 90
+ 91@overload
+ 92def comptime(a: T) -> T: ...
+ 93
+ 94
+ 95def comptime(a):
+ 96 """
+ 97 Allowing mixing normal python object as compile-time value with DSL code.
+ 98 Usage:
+ 99 - `lc.comptime(e)` marks the expression `e` as a compile-time value.
+100 - `with lc.comptime() as block: ...` marks the block as a compile-time block.
+101 """
+102 if isinstance(a, _ComptimeBlockMarker):
+103 return ComptimeBlock()
+104 return a
+105
+106
+107@func
+108def trap() -> None:
+109 """
+110 Aborts the kernel execution
+111 """
+112 intrinsic("trap", types.NoneType)
+113
+114
+115def device_assert(cond: bool, msg: str = "") -> typing.NoReturn:
+116 """
+117 Assert that the condition is true at runtime.
+118 """
+119 raise NotImplementedError(
+120 "device_assert should not be called in host-side Python code. ")
+121
+122
+123def sizeof(t: type[T]) -> u64:
+124 raise NotImplementedError(
+125 "sizeof should not be called in host-side Python code. ")
+126
+127
+128@overload
+129def range(n: T) -> List[T]: ...
+130@overload
+131def range(start: T, end: T) -> List[T]: ...
+132@overload
+133def range(start: T, end: T, step: T) -> List[T]: ...
+134
+135
+136def range(*args):
+137 raise NotImplementedError(
+138 "range should not be called in host-side Python code. ")
+139
+140
+141parse._add_special_function("comptime", comptime)
+142parse._add_special_function("intrinsic", intrinsic)
+143parse._add_special_function("range", range)
+144parse._add_special_function('reveal_type', typing.reveal_type)
+145parse._add_special_function('cast', cast)
+146parse._add_special_function('bitcast', bitcast)
+147parse._add_special_function('device_assert', device_assert)
+148parse._add_special_function('sizeof', sizeof)
+149
+150
+151def static_assert(cond: Any, msg: str = ""):
+152 pass
+153
+154
+155def unroll(range_: Sequence[int]) -> Sequence[int]:
+156 return range_
+157
+158
+159@func
+160def address_of(a: T) -> u64:
+161 return intrinsic("address_of", u64, a)
+162
+163# class StaticEval:
+164#
+165
+166
+167def type_of_opt(value: Any) -> Optional[hir.Type]:
+168 if isinstance(value, hir.Type):
+169 return value
+170 if isinstance(value, type):
+171 return hir.GlobalContext.get().types[value]
+172 return hir.GlobalContext.get().types.get(type(value))
+173
+174
+175def typeof(value: Any) -> hir.Type:
+176 ty = type_of_opt(value)
+177 if ty is None:
+178 raise TypeError(f"Cannot determine type of {value}")
+179 return ty
+180
+181
+182# _t = hir.SymbolicType(hir.GenericParameter("_T", "luisa_lang.lang"))
+183# _n = hir.SymbolicConstant(hir.GenericParameter(
+184# "_N", "luisa_lang.lang")), typeof(u32)
+185
+186
+187def _make_array_type(params: List[hir.GenericParameter]) -> hir.Type:
+188 assert len(params) == 2
+189 elem_ty = hir.SymbolicType(params[0])
+190 size = hir.SymbolicConstant(params[1])
+191 return hir.ParametricType(params, hir.ArrayType(elem_ty, size))
+192
+193
+194def _instantiate_array_type(args: List[Any]) -> hir.Type:
+195 assert len(args) == 2, "Array should have 2 arguments"
+196 assert isinstance(
+197 args[1], hir.LiteralType), f"Array size should be a Literal but found {args[1]} of type {type(args[1])}"
+198 array_len = args[1].value
+199 assert isinstance(
+200 array_len, int), f"Array size should be an integer but found {array_len} of type {type(array_len)}"
+201 return hir.ArrayType(args[0], array_len)
+202
+203
+204@builtin_generic_type(
+205 _make_array_type,
+206 _instantiate_array_type
+207)
+208class Array(Generic[T, N]):
+209 def __init__(self) -> None:
+210 self = intrinsic("init.array", Array[T, N])
+211
+212 def __getitem__(self, index: int | u32 | i64 | u64) -> T:
+213 return intrinsic("array.ref", T, byref(self), index) # type: ignore
+214
+215 def __setitem__(self, index: int | u32 | i64 | u64, value: T) -> None:
+216 pass
+217
+218 def __len__(self) -> u64:
+219 return intrinsic("array.size", u64, self) # type: ignore
+220
+221
+222# def __buffer_ty():
+223# t = hir.GenericParameter("T", "luisa_lang.lang")
+224# return hir.ParametricType(
+225# [t], hir.OpaqueType("Buffer"), None
+226# )
+227
+228# @builtin_type(
+229# hir.ParametricType(
+230# [_t], [hir.TypeParameter(_t, bound=[])], hir.OpaqueType("Buffer")
+231# )
+232# )
+233
+234
+235@opaque("Buffer")
+236class Buffer(Generic[T]):
+237 def __getitem__(self, index: int | u32 | i64 | u64) -> T:
+238 return intrinsic("buffer.ref", T, self, index) # type: ignore
+239
+240 def __setitem__(self, index: int | u32 | i64 | u64, value: T) -> None:
+241 pass
+242
+243 def __len__(self) -> u64:
+244 return intrinsic("buffer.size", u64, self) # type: ignore
+245
+246
+247def _make_pointer_type(params: List[hir.GenericParameter]) -> hir.Type:
+248 assert len(params) == 1
+249 elem_ty = hir.SymbolicType(params[0])
+250 return hir.ParametricType(params, hir.PointerType(elem_ty))
+251
+252
+253def _inst_pointer_type(args: List[Any]) -> hir.Type:
+254 assert len(args) == 1
+255 return hir.PointerType(args[0])
+256
+257
+258@builtin_generic_type(
+259 _make_pointer_type,
+260 _inst_pointer_type
+261)
+262class Pointer(Generic[T]):
+263 def __init__(self, addr: u64) -> None:
+264 self = intrinsic("init.pointer", Pointer[T], addr)
+265
+266 def __getitem__(self, index: int | i32 | i64 | u32 | u64) -> T:
+267 return intrinsic("pointer.read", T, self, index) # type: ignore
+268
+269 def __setitem__(self, index: int | i32 | i64 | u32 | u64, value: T) -> None:
+270 pass
+271
+272 def read(self) -> T:
+273 return intrinsic("pointer.read", T, self) # type: ignore
+274
+275 def write(self, value: T) -> None:
+276 intrinsic("pointer.write", None, self, value) # type: ignore
+277
+278
+279__all__: List[str] = [
+280 # 'Pointer',
+281 'Buffer',
+282 'Array',
+283 'range',
+284 'comptime',
+285 'address_of',
+286 'unroll',
+287 'static_assert',
+288 'type_of_opt',
+289 'typeof',
+290 "dispatch_id",
+291 "thread_id",
+292 "block_id",
+293 "intrinsic",
+294 'cast',
+295 'bitcast',
+296 'device_assert',
+297 'trap',
+298 'sizeof',
+299]
+
238@opaque("Buffer")
+239class Buffer(Generic[T]):
+240 def __getitem__(self, index: int | u32 | i64 | u64) -> T:
+241 return intrinsic("buffer.ref", T, self, index) # type: ignore
+242
+243 def __setitem__(self, index: int | u32 | i64 | u64, value: T) -> None:
+244 pass
+245
+246 def __len__(self) -> u64:
+247 return intrinsic("buffer.size", u64, self) # type: ignore
+
207@builtin_generic_type(
+208 _make_array_type,
+209 _instantiate_array_type
+210)
+211class Array(Generic[T, N]):
+212 def __init__(self) -> None:
+213 self = intrinsic("init.array", Array[T, N])
+214
+215 def __getitem__(self, index: int | u32 | i64 | u64) -> T:
+216 return intrinsic("array.ref", T, byref(self), index) # type: ignore
+217
+218 def __setitem__(self, index: int | u32 | i64 | u64, value: T) -> None:
+219 pass
+220
+221 def __len__(self) -> u64:
+222 return intrinsic("array.size", u64, self) # type: ignore
+
98def comptime(a):
+ 99 """
+100 Allowing mixing normal python object as compile-time value with DSL code.
+101 Usage:
+102 - `lc.comptime(e)` marks the expression `e` as a compile-time value.
+103 - `with lc.comptime() as block: ...` marks the block as a compile-time block.
+104 """
+105 if isinstance(a, _ComptimeBlockMarker):
+106 return ComptimeBlock()
+107 return a
+
lc.comptime(e)
marks the expression e
as a compile-time value.
+ - with lc.comptime() as block: ...
marks the block as a compile-time block.46def cast(target: type[T], value: Any) -> T:
+47 """
+48 Attempt to convert the value to the target type.
+49 """
+50 return intrinsic("cast", target, value)
+
53def bitcast(target: type[T], value: Any) -> T:
+54 """
+55 Attempt to convert the value to the target type, preserving the bit representation.
+56 """
+57 return intrinsic("bitcast", target, value)
+
118def device_assert(cond: bool, msg: str = "") -> typing.NoReturn:
+119 """
+120 Assert that the condition is true at runtime.
+121 """
+122 raise NotImplementedError(
+123 "device_assert should not be called in host-side Python code. ")
+
110@func
+111def trap() -> None:
+112 """
+113 Aborts the kernel execution
+114 """
+115 intrinsic("trap", types.NoneType)
+
+luisa_lang
+
+
+
+
+
+
+ 1# fmt: off
+ 2import typing as tp
+ 3from luisa_lang._builtin_decor import intrinsic, func, builtin_type, byref
+ 4from luisa_lang.classinfo import register_class
+ 5import luisa_lang.hir as _hir
+ 6_ctx = _hir.GlobalContext.get()
+ 7i32 = int
+ 8f32 = float
+ 9@builtin_type(_hir.GenericIntType())
+ 10class IntLiteral:
+ 11 pass
+ 12@builtin_type(_hir.GenericFloatType())
+ 13class FloatLiteral:
+ 14 pass
+ 15FLOAT_TYPES: tp.Final[tp.List[str]] = ["f32", "f64", "float2", "double2", "float3", "double3", "float4", "double4"]
+ 16FloatType = tp.Union["f32", "f64", "float2", "double2", "float3", "double3", "float4", "double4"]
+ 17_F = tp.TypeVar("_F")
+ 18_F1 = tp.TypeVar("_F1", "f32", "f64", "float2", "double2", "float3", "double3", "float4", "double4")
+ 19
+ 20@func
+ 21def abs(x: _F1) -> _F1: return intrinsic('math.abs', _F1, x) # type: ignore
+ 22@func
+ 23def acos(x: _F1) -> _F1: return intrinsic('math.acos', _F1, x) # type: ignore
+ 24@func
+ 25def acosh(x: _F1) -> _F1: return intrinsic('math.acosh', _F1, x) # type: ignore
+ 26@func
+ 27def asin(x: _F1) -> _F1: return intrinsic('math.asin', _F1, x) # type: ignore
+ 28@func
+ 29def asinh(x: _F1) -> _F1: return intrinsic('math.asinh', _F1, x) # type: ignore
+ 30@func
+ 31def atan(x: _F1) -> _F1: return intrinsic('math.atan', _F1, x) # type: ignore
+ 32@func
+ 33def atanh(x: _F1) -> _F1: return intrinsic('math.atanh', _F1, x) # type: ignore
+ 34@func
+ 35def ceil(x: _F1) -> _F1: return intrinsic('math.ceil', _F1, x) # type: ignore
+ 36@func
+ 37def cos(x: _F1) -> _F1: return intrinsic('math.cos', _F1, x) # type: ignore
+ 38@func
+ 39def cosh(x: _F1) -> _F1: return intrinsic('math.cosh', _F1, x) # type: ignore
+ 40@func
+ 41def exp(x: _F1) -> _F1: return intrinsic('math.exp', _F1, x) # type: ignore
+ 42@func
+ 43def floor(x: _F1) -> _F1: return intrinsic('math.floor', _F1, x) # type: ignore
+ 44@func
+ 45def log(x: _F1) -> _F1: return intrinsic('math.log', _F1, x) # type: ignore
+ 46@func
+ 47def log10(x: _F1) -> _F1: return intrinsic('math.log10', _F1, x) # type: ignore
+ 48@func
+ 49def log2(x: _F1) -> _F1: return intrinsic('math.log2', _F1, x) # type: ignore
+ 50@func
+ 51def sin(x: _F1) -> _F1: return intrinsic('math.sin', _F1, x) # type: ignore
+ 52@func
+ 53def sinh(x: _F1) -> _F1: return intrinsic('math.sinh', _F1, x) # type: ignore
+ 54@func
+ 55def sqrt(x: _F1) -> _F1: return intrinsic('math.sqrt', _F1, x) # type: ignore
+ 56@func
+ 57def tan(x: _F1) -> _F1: return intrinsic('math.tan', _F1, x) # type: ignore
+ 58@func
+ 59def tanh(x: _F1) -> _F1: return intrinsic('math.tanh', _F1, x) # type: ignore
+ 60@func
+ 61def trunc(x: _F1) -> _F1: return intrinsic('math.trunc', _F1, x) # type: ignore
+ 62@func
+ 63def atan2(x: _F1, y: _F1) -> _F1: return intrinsic('math.atan2', _F1, x, y) # type: ignore
+ 64@func
+ 65def copysign(x: _F1, y: _F1) -> _F1: return intrinsic('math.copysign', _F1, x, y) # type: ignore
+ 66@builtin_type(_hir.FloatType(32))
+ 67class _f32:
+ 68 @func(inline='always')
+ 69 def __init__(self, _value: tp.Union['_f32', float]) -> None:
+ 70 self = intrinsic("init._f32", _f32, _value)
+ 71 @func(inline='always')
+ 72 def __add__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__add__._f32", _f32, self, _other)
+ 73 @func(inline='always')
+ 74 def __radd__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__radd__._f32", _f32, self, _other)
+ 75 @func(inline='always')
+ 76 def __iadd__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__iadd__._f32", _f32, byref(self), _other)
+ 77 @func(inline='always')
+ 78 def __sub__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__sub__._f32", _f32, self, _other)
+ 79 @func(inline='always')
+ 80 def __rsub__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__rsub__._f32", _f32, self, _other)
+ 81 @func(inline='always')
+ 82 def __isub__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__isub__._f32", _f32, byref(self), _other)
+ 83 @func(inline='always')
+ 84 def __mul__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__mul__._f32", _f32, self, _other)
+ 85 @func(inline='always')
+ 86 def __rmul__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__rmul__._f32", _f32, self, _other)
+ 87 @func(inline='always')
+ 88 def __imul__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__imul__._f32", _f32, byref(self), _other)
+ 89 @func(inline='always')
+ 90 def __mod__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__mod__._f32", _f32, self, _other)
+ 91 @func(inline='always')
+ 92 def __rmod__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__rmod__._f32", _f32, self, _other)
+ 93 @func(inline='always')
+ 94 def __imod__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__imod__._f32", _f32, byref(self), _other)
+ 95 @func(inline='always')
+ 96 def __lt__(self, _other: tp.Union['_f32', float]) -> 'bool': return intrinsic("cmp.__lt__._f32", bool, self, _other) # type: ignore
+ 97 @func(inline='always')
+ 98 def __le__(self, _other: tp.Union['_f32', float]) -> 'bool': return intrinsic("cmp.__le__._f32", bool, self, _other) # type: ignore
+ 99 @func(inline='always')
+ 100 def __gt__(self, _other: tp.Union['_f32', float]) -> 'bool': return intrinsic("cmp.__gt__._f32", bool, self, _other) # type: ignore
+ 101 @func(inline='always')
+ 102 def __ge__(self, _other: tp.Union['_f32', float]) -> 'bool': return intrinsic("cmp.__ge__._f32", bool, self, _other) # type: ignore
+ 103 @func(inline='always')
+ 104 def __eq__(self, _other: tp.Union['_f32', float]) -> 'bool': return intrinsic("cmp.__eq__._f32", bool, self, _other) # type: ignore
+ 105 @func(inline='always')
+ 106 def __ne__(self, _other: tp.Union['_f32', float]) -> 'bool': return intrinsic("cmp.__ne__._f32", bool, self, _other) # type: ignore
+ 107 @func(inline='always')
+ 108 def __truediv__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__truediv__._f32", _f32, self, _other)
+ 109 @func(inline='always')
+ 110 def __rtruediv__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__rtruediv__._f32", _f32, self, _other)
+ 111 @func(inline='always')
+ 112 def __itruediv__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__itruediv__._f32", _f32, byref(self), _other)
+ 113 @func(inline='always')
+ 114 def __pow__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__pow__._f32", _f32, self, _other)
+ 115 @func(inline='always')
+ 116 def __rpow__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__rpow__._f32", _f32, self, _other)
+ 117 @func(inline='always')
+ 118 def __ipow__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__ipow__._f32", _f32, byref(self), _other)
+ 119 @func(inline='always')
+ 120 def __floordiv__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__floordiv__._f32", _f32, self, _other)
+ 121 @func(inline='always')
+ 122 def __rfloordiv__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__rfloordiv__._f32", _f32, self, _other)
+ 123 @func(inline='always')
+ 124 def __neg__(self) -> '_f32': return intrinsic("unary.__neg__._f32", _f32, self)
+ 125 @func(inline='always')
+ 126 def __pos__(self) -> '_f32': return intrinsic("unary.__pos__._f32", _f32, self)
+ 127
+ 128@builtin_type(_hir.FloatType(64))
+ 129class f64:
+ 130 @func(inline='always')
+ 131 def __init__(self, _value: tp.Union['f64', float]) -> None:
+ 132 self = intrinsic("init.f64", f64, _value)
+ 133 @func(inline='always')
+ 134 def __add__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__add__.f64", f64, self, _other)
+ 135 @func(inline='always')
+ 136 def __radd__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__radd__.f64", f64, self, _other)
+ 137 @func(inline='always')
+ 138 def __iadd__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__iadd__.f64", f64, byref(self), _other)
+ 139 @func(inline='always')
+ 140 def __sub__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__sub__.f64", f64, self, _other)
+ 141 @func(inline='always')
+ 142 def __rsub__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__rsub__.f64", f64, self, _other)
+ 143 @func(inline='always')
+ 144 def __isub__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__isub__.f64", f64, byref(self), _other)
+ 145 @func(inline='always')
+ 146 def __mul__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__mul__.f64", f64, self, _other)
+ 147 @func(inline='always')
+ 148 def __rmul__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__rmul__.f64", f64, self, _other)
+ 149 @func(inline='always')
+ 150 def __imul__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__imul__.f64", f64, byref(self), _other)
+ 151 @func(inline='always')
+ 152 def __mod__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__mod__.f64", f64, self, _other)
+ 153 @func(inline='always')
+ 154 def __rmod__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__rmod__.f64", f64, self, _other)
+ 155 @func(inline='always')
+ 156 def __imod__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__imod__.f64", f64, byref(self), _other)
+ 157 @func(inline='always')
+ 158 def __lt__(self, _other: tp.Union['f64', float]) -> 'bool': return intrinsic("cmp.__lt__.f64", bool, self, _other) # type: ignore
+ 159 @func(inline='always')
+ 160 def __le__(self, _other: tp.Union['f64', float]) -> 'bool': return intrinsic("cmp.__le__.f64", bool, self, _other) # type: ignore
+ 161 @func(inline='always')
+ 162 def __gt__(self, _other: tp.Union['f64', float]) -> 'bool': return intrinsic("cmp.__gt__.f64", bool, self, _other) # type: ignore
+ 163 @func(inline='always')
+ 164 def __ge__(self, _other: tp.Union['f64', float]) -> 'bool': return intrinsic("cmp.__ge__.f64", bool, self, _other) # type: ignore
+ 165 @func(inline='always')
+ 166 def __eq__(self, _other: tp.Union['f64', float]) -> 'bool': return intrinsic("cmp.__eq__.f64", bool, self, _other) # type: ignore
+ 167 @func(inline='always')
+ 168 def __ne__(self, _other: tp.Union['f64', float]) -> 'bool': return intrinsic("cmp.__ne__.f64", bool, self, _other) # type: ignore
+ 169 @func(inline='always')
+ 170 def __truediv__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__truediv__.f64", f64, self, _other)
+ 171 @func(inline='always')
+ 172 def __rtruediv__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__rtruediv__.f64", f64, self, _other)
+ 173 @func(inline='always')
+ 174 def __itruediv__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__itruediv__.f64", f64, byref(self), _other)
+ 175 @func(inline='always')
+ 176 def __pow__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__pow__.f64", f64, self, _other)
+ 177 @func(inline='always')
+ 178 def __rpow__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__rpow__.f64", f64, self, _other)
+ 179 @func(inline='always')
+ 180 def __ipow__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__ipow__.f64", f64, byref(self), _other)
+ 181 @func(inline='always')
+ 182 def __floordiv__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__floordiv__.f64", f64, self, _other)
+ 183 @func(inline='always')
+ 184 def __rfloordiv__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__rfloordiv__.f64", f64, self, _other)
+ 185 @func(inline='always')
+ 186 def __neg__(self) -> 'f64': return intrinsic("unary.__neg__.f64", f64, self)
+ 187 @func(inline='always')
+ 188 def __pos__(self) -> 'f64': return intrinsic("unary.__pos__.f64", f64, self)
+ 189
+ 190@builtin_type(_hir.IntType(8, True))
+ 191class i8:
+ 192 @func(inline='always')
+ 193 def __init__(self, _value: tp.Union['i8', IntLiteral]) -> None:
+ 194 self = intrinsic("init.i8", i8, _value)
+ 195 @func(inline='always')
+ 196 def __add__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__add__.i8", i8, self, _other)
+ 197 @func(inline='always')
+ 198 def __radd__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__radd__.i8", i8, self, _other)
+ 199 @func(inline='always')
+ 200 def __iadd__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__iadd__.i8", i8, byref(self), _other)
+ 201 @func(inline='always')
+ 202 def __sub__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__sub__.i8", i8, self, _other)
+ 203 @func(inline='always')
+ 204 def __rsub__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__rsub__.i8", i8, self, _other)
+ 205 @func(inline='always')
+ 206 def __isub__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__isub__.i8", i8, byref(self), _other)
+ 207 @func(inline='always')
+ 208 def __mul__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__mul__.i8", i8, self, _other)
+ 209 @func(inline='always')
+ 210 def __rmul__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__rmul__.i8", i8, self, _other)
+ 211 @func(inline='always')
+ 212 def __imul__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__imul__.i8", i8, byref(self), _other)
+ 213 @func(inline='always')
+ 214 def __mod__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__mod__.i8", i8, self, _other)
+ 215 @func(inline='always')
+ 216 def __rmod__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__rmod__.i8", i8, self, _other)
+ 217 @func(inline='always')
+ 218 def __imod__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__imod__.i8", i8, byref(self), _other)
+ 219 @func(inline='always')
+ 220 def __lt__(self, _other: tp.Union['i8', IntLiteral]) -> 'bool': return intrinsic("cmp.__lt__.i8", bool, self, _other) # type: ignore
+ 221 @func(inline='always')
+ 222 def __le__(self, _other: tp.Union['i8', IntLiteral]) -> 'bool': return intrinsic("cmp.__le__.i8", bool, self, _other) # type: ignore
+ 223 @func(inline='always')
+ 224 def __gt__(self, _other: tp.Union['i8', IntLiteral]) -> 'bool': return intrinsic("cmp.__gt__.i8", bool, self, _other) # type: ignore
+ 225 @func(inline='always')
+ 226 def __ge__(self, _other: tp.Union['i8', IntLiteral]) -> 'bool': return intrinsic("cmp.__ge__.i8", bool, self, _other) # type: ignore
+ 227 @func(inline='always')
+ 228 def __eq__(self, _other: tp.Union['i8', IntLiteral]) -> 'bool': return intrinsic("cmp.__eq__.i8", bool, self, _other) # type: ignore
+ 229 @func(inline='always')
+ 230 def __ne__(self, _other: tp.Union['i8', IntLiteral]) -> 'bool': return intrinsic("cmp.__ne__.i8", bool, self, _other) # type: ignore
+ 231 @func(inline='always')
+ 232 def __floordiv__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__floordiv__.i8", i8, self, _other)
+ 233 @func(inline='always')
+ 234 def __rfloordiv__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__rfloordiv__.i8", i8, self, _other)
+ 235 @func(inline='always')
+ 236 def __ifloordiv__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__ifloordiv__.i8", i8, byref(self), _other)
+ 237 @func(inline='always')
+ 238 def __lshift__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__lshift__.i8", i8, self, _other)
+ 239 @func(inline='always')
+ 240 def __rlshift__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__rlshift__.i8", i8, self, _other)
+ 241 @func(inline='always')
+ 242 def __ilshift__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__ilshift__.i8", i8, byref(self), _other)
+ 243 @func(inline='always')
+ 244 def __rshift__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__rshift__.i8", i8, self, _other)
+ 245 @func(inline='always')
+ 246 def __rrshift__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__rrshift__.i8", i8, self, _other)
+ 247 @func(inline='always')
+ 248 def __irshift__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__irshift__.i8", i8, byref(self), _other)
+ 249 @func(inline='always')
+ 250 def __and__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__and__.i8", i8, self, _other)
+ 251 @func(inline='always')
+ 252 def __rand__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__rand__.i8", i8, self, _other)
+ 253 @func(inline='always')
+ 254 def __iand__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__iand__.i8", i8, byref(self), _other)
+ 255 @func(inline='always')
+ 256 def __or__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__or__.i8", i8, self, _other)
+ 257 @func(inline='always')
+ 258 def __ror__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__ror__.i8", i8, self, _other)
+ 259 @func(inline='always')
+ 260 def __ior__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__ior__.i8", i8, byref(self), _other)
+ 261 @func(inline='always')
+ 262 def __xor__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__xor__.i8", i8, self, _other)
+ 263 @func(inline='always')
+ 264 def __rxor__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__rxor__.i8", i8, self, _other)
+ 265 @func(inline='always')
+ 266 def __ixor__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__ixor__.i8", i8, byref(self), _other)
+ 267 @func(inline='always')
+ 268 def __neg__(self) -> 'i8': return intrinsic("unary.__neg__.i8", i8, self)
+ 269 @func(inline='always')
+ 270 def __pos__(self) -> 'i8': return intrinsic("unary.__pos__.i8", i8, self)
+ 271 @func(inline='always')
+ 272 def __invert__(self) -> 'i8': return intrinsic("unary.__invert__.i8", i8, self)
+ 273
+ 274@builtin_type(_hir.IntType(8, False))
+ 275class u8:
+ 276 @func(inline='always')
+ 277 def __init__(self, _value: tp.Union['u8', IntLiteral]) -> None:
+ 278 self = intrinsic("init.u8", u8, _value)
+ 279 @func(inline='always')
+ 280 def __add__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__add__.u8", u8, self, _other)
+ 281 @func(inline='always')
+ 282 def __radd__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__radd__.u8", u8, self, _other)
+ 283 @func(inline='always')
+ 284 def __iadd__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__iadd__.u8", u8, byref(self), _other)
+ 285 @func(inline='always')
+ 286 def __sub__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__sub__.u8", u8, self, _other)
+ 287 @func(inline='always')
+ 288 def __rsub__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__rsub__.u8", u8, self, _other)
+ 289 @func(inline='always')
+ 290 def __isub__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__isub__.u8", u8, byref(self), _other)
+ 291 @func(inline='always')
+ 292 def __mul__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__mul__.u8", u8, self, _other)
+ 293 @func(inline='always')
+ 294 def __rmul__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__rmul__.u8", u8, self, _other)
+ 295 @func(inline='always')
+ 296 def __imul__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__imul__.u8", u8, byref(self), _other)
+ 297 @func(inline='always')
+ 298 def __mod__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__mod__.u8", u8, self, _other)
+ 299 @func(inline='always')
+ 300 def __rmod__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__rmod__.u8", u8, self, _other)
+ 301 @func(inline='always')
+ 302 def __imod__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__imod__.u8", u8, byref(self), _other)
+ 303 @func(inline='always')
+ 304 def __lt__(self, _other: tp.Union['u8', IntLiteral]) -> 'bool': return intrinsic("cmp.__lt__.u8", bool, self, _other) # type: ignore
+ 305 @func(inline='always')
+ 306 def __le__(self, _other: tp.Union['u8', IntLiteral]) -> 'bool': return intrinsic("cmp.__le__.u8", bool, self, _other) # type: ignore
+ 307 @func(inline='always')
+ 308 def __gt__(self, _other: tp.Union['u8', IntLiteral]) -> 'bool': return intrinsic("cmp.__gt__.u8", bool, self, _other) # type: ignore
+ 309 @func(inline='always')
+ 310 def __ge__(self, _other: tp.Union['u8', IntLiteral]) -> 'bool': return intrinsic("cmp.__ge__.u8", bool, self, _other) # type: ignore
+ 311 @func(inline='always')
+ 312 def __eq__(self, _other: tp.Union['u8', IntLiteral]) -> 'bool': return intrinsic("cmp.__eq__.u8", bool, self, _other) # type: ignore
+ 313 @func(inline='always')
+ 314 def __ne__(self, _other: tp.Union['u8', IntLiteral]) -> 'bool': return intrinsic("cmp.__ne__.u8", bool, self, _other) # type: ignore
+ 315 @func(inline='always')
+ 316 def __floordiv__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__floordiv__.u8", u8, self, _other)
+ 317 @func(inline='always')
+ 318 def __rfloordiv__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__rfloordiv__.u8", u8, self, _other)
+ 319 @func(inline='always')
+ 320 def __ifloordiv__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__ifloordiv__.u8", u8, byref(self), _other)
+ 321 @func(inline='always')
+ 322 def __lshift__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__lshift__.u8", u8, self, _other)
+ 323 @func(inline='always')
+ 324 def __rlshift__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__rlshift__.u8", u8, self, _other)
+ 325 @func(inline='always')
+ 326 def __ilshift__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__ilshift__.u8", u8, byref(self), _other)
+ 327 @func(inline='always')
+ 328 def __rshift__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__rshift__.u8", u8, self, _other)
+ 329 @func(inline='always')
+ 330 def __rrshift__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__rrshift__.u8", u8, self, _other)
+ 331 @func(inline='always')
+ 332 def __irshift__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__irshift__.u8", u8, byref(self), _other)
+ 333 @func(inline='always')
+ 334 def __and__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__and__.u8", u8, self, _other)
+ 335 @func(inline='always')
+ 336 def __rand__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__rand__.u8", u8, self, _other)
+ 337 @func(inline='always')
+ 338 def __iand__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__iand__.u8", u8, byref(self), _other)
+ 339 @func(inline='always')
+ 340 def __or__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__or__.u8", u8, self, _other)
+ 341 @func(inline='always')
+ 342 def __ror__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__ror__.u8", u8, self, _other)
+ 343 @func(inline='always')
+ 344 def __ior__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__ior__.u8", u8, byref(self), _other)
+ 345 @func(inline='always')
+ 346 def __xor__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__xor__.u8", u8, self, _other)
+ 347 @func(inline='always')
+ 348 def __rxor__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__rxor__.u8", u8, self, _other)
+ 349 @func(inline='always')
+ 350 def __ixor__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__ixor__.u8", u8, byref(self), _other)
+ 351 @func(inline='always')
+ 352 def __neg__(self) -> 'u8': return intrinsic("unary.__neg__.u8", u8, self)
+ 353 @func(inline='always')
+ 354 def __pos__(self) -> 'u8': return intrinsic("unary.__pos__.u8", u8, self)
+ 355 @func(inline='always')
+ 356 def __invert__(self) -> 'u8': return intrinsic("unary.__invert__.u8", u8, self)
+ 357
+ 358@builtin_type(_hir.IntType(16, True))
+ 359class i16:
+ 360 @func(inline='always')
+ 361 def __init__(self, _value: tp.Union['i16', IntLiteral]) -> None:
+ 362 self = intrinsic("init.i16", i16, _value)
+ 363 @func(inline='always')
+ 364 def __add__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__add__.i16", i16, self, _other)
+ 365 @func(inline='always')
+ 366 def __radd__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__radd__.i16", i16, self, _other)
+ 367 @func(inline='always')
+ 368 def __iadd__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__iadd__.i16", i16, byref(self), _other)
+ 369 @func(inline='always')
+ 370 def __sub__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__sub__.i16", i16, self, _other)
+ 371 @func(inline='always')
+ 372 def __rsub__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__rsub__.i16", i16, self, _other)
+ 373 @func(inline='always')
+ 374 def __isub__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__isub__.i16", i16, byref(self), _other)
+ 375 @func(inline='always')
+ 376 def __mul__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__mul__.i16", i16, self, _other)
+ 377 @func(inline='always')
+ 378 def __rmul__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__rmul__.i16", i16, self, _other)
+ 379 @func(inline='always')
+ 380 def __imul__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__imul__.i16", i16, byref(self), _other)
+ 381 @func(inline='always')
+ 382 def __mod__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__mod__.i16", i16, self, _other)
+ 383 @func(inline='always')
+ 384 def __rmod__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__rmod__.i16", i16, self, _other)
+ 385 @func(inline='always')
+ 386 def __imod__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__imod__.i16", i16, byref(self), _other)
+ 387 @func(inline='always')
+ 388 def __lt__(self, _other: tp.Union['i16', IntLiteral]) -> 'bool': return intrinsic("cmp.__lt__.i16", bool, self, _other) # type: ignore
+ 389 @func(inline='always')
+ 390 def __le__(self, _other: tp.Union['i16', IntLiteral]) -> 'bool': return intrinsic("cmp.__le__.i16", bool, self, _other) # type: ignore
+ 391 @func(inline='always')
+ 392 def __gt__(self, _other: tp.Union['i16', IntLiteral]) -> 'bool': return intrinsic("cmp.__gt__.i16", bool, self, _other) # type: ignore
+ 393 @func(inline='always')
+ 394 def __ge__(self, _other: tp.Union['i16', IntLiteral]) -> 'bool': return intrinsic("cmp.__ge__.i16", bool, self, _other) # type: ignore
+ 395 @func(inline='always')
+ 396 def __eq__(self, _other: tp.Union['i16', IntLiteral]) -> 'bool': return intrinsic("cmp.__eq__.i16", bool, self, _other) # type: ignore
+ 397 @func(inline='always')
+ 398 def __ne__(self, _other: tp.Union['i16', IntLiteral]) -> 'bool': return intrinsic("cmp.__ne__.i16", bool, self, _other) # type: ignore
+ 399 @func(inline='always')
+ 400 def __floordiv__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__floordiv__.i16", i16, self, _other)
+ 401 @func(inline='always')
+ 402 def __rfloordiv__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__rfloordiv__.i16", i16, self, _other)
+ 403 @func(inline='always')
+ 404 def __ifloordiv__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__ifloordiv__.i16", i16, byref(self), _other)
+ 405 @func(inline='always')
+ 406 def __lshift__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__lshift__.i16", i16, self, _other)
+ 407 @func(inline='always')
+ 408 def __rlshift__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__rlshift__.i16", i16, self, _other)
+ 409 @func(inline='always')
+ 410 def __ilshift__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__ilshift__.i16", i16, byref(self), _other)
+ 411 @func(inline='always')
+ 412 def __rshift__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__rshift__.i16", i16, self, _other)
+ 413 @func(inline='always')
+ 414 def __rrshift__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__rrshift__.i16", i16, self, _other)
+ 415 @func(inline='always')
+ 416 def __irshift__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__irshift__.i16", i16, byref(self), _other)
+ 417 @func(inline='always')
+ 418 def __and__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__and__.i16", i16, self, _other)
+ 419 @func(inline='always')
+ 420 def __rand__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__rand__.i16", i16, self, _other)
+ 421 @func(inline='always')
+ 422 def __iand__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__iand__.i16", i16, byref(self), _other)
+ 423 @func(inline='always')
+ 424 def __or__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__or__.i16", i16, self, _other)
+ 425 @func(inline='always')
+ 426 def __ror__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__ror__.i16", i16, self, _other)
+ 427 @func(inline='always')
+ 428 def __ior__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__ior__.i16", i16, byref(self), _other)
+ 429 @func(inline='always')
+ 430 def __xor__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__xor__.i16", i16, self, _other)
+ 431 @func(inline='always')
+ 432 def __rxor__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__rxor__.i16", i16, self, _other)
+ 433 @func(inline='always')
+ 434 def __ixor__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__ixor__.i16", i16, byref(self), _other)
+ 435 @func(inline='always')
+ 436 def __neg__(self) -> 'i16': return intrinsic("unary.__neg__.i16", i16, self)
+ 437 @func(inline='always')
+ 438 def __pos__(self) -> 'i16': return intrinsic("unary.__pos__.i16", i16, self)
+ 439 @func(inline='always')
+ 440 def __invert__(self) -> 'i16': return intrinsic("unary.__invert__.i16", i16, self)
+ 441
+ 442@builtin_type(_hir.IntType(16, False))
+ 443class u16:
+ 444 @func(inline='always')
+ 445 def __init__(self, _value: tp.Union['u16', IntLiteral]) -> None:
+ 446 self = intrinsic("init.u16", u16, _value)
+ 447 @func(inline='always')
+ 448 def __add__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__add__.u16", u16, self, _other)
+ 449 @func(inline='always')
+ 450 def __radd__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__radd__.u16", u16, self, _other)
+ 451 @func(inline='always')
+ 452 def __iadd__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__iadd__.u16", u16, byref(self), _other)
+ 453 @func(inline='always')
+ 454 def __sub__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__sub__.u16", u16, self, _other)
+ 455 @func(inline='always')
+ 456 def __rsub__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__rsub__.u16", u16, self, _other)
+ 457 @func(inline='always')
+ 458 def __isub__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__isub__.u16", u16, byref(self), _other)
+ 459 @func(inline='always')
+ 460 def __mul__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__mul__.u16", u16, self, _other)
+ 461 @func(inline='always')
+ 462 def __rmul__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__rmul__.u16", u16, self, _other)
+ 463 @func(inline='always')
+ 464 def __imul__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__imul__.u16", u16, byref(self), _other)
+ 465 @func(inline='always')
+ 466 def __mod__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__mod__.u16", u16, self, _other)
+ 467 @func(inline='always')
+ 468 def __rmod__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__rmod__.u16", u16, self, _other)
+ 469 @func(inline='always')
+ 470 def __imod__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__imod__.u16", u16, byref(self), _other)
+ 471 @func(inline='always')
+ 472 def __lt__(self, _other: tp.Union['u16', IntLiteral]) -> 'bool': return intrinsic("cmp.__lt__.u16", bool, self, _other) # type: ignore
+ 473 @func(inline='always')
+ 474 def __le__(self, _other: tp.Union['u16', IntLiteral]) -> 'bool': return intrinsic("cmp.__le__.u16", bool, self, _other) # type: ignore
+ 475 @func(inline='always')
+ 476 def __gt__(self, _other: tp.Union['u16', IntLiteral]) -> 'bool': return intrinsic("cmp.__gt__.u16", bool, self, _other) # type: ignore
+ 477 @func(inline='always')
+ 478 def __ge__(self, _other: tp.Union['u16', IntLiteral]) -> 'bool': return intrinsic("cmp.__ge__.u16", bool, self, _other) # type: ignore
+ 479 @func(inline='always')
+ 480 def __eq__(self, _other: tp.Union['u16', IntLiteral]) -> 'bool': return intrinsic("cmp.__eq__.u16", bool, self, _other) # type: ignore
+ 481 @func(inline='always')
+ 482 def __ne__(self, _other: tp.Union['u16', IntLiteral]) -> 'bool': return intrinsic("cmp.__ne__.u16", bool, self, _other) # type: ignore
+ 483 @func(inline='always')
+ 484 def __floordiv__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__floordiv__.u16", u16, self, _other)
+ 485 @func(inline='always')
+ 486 def __rfloordiv__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__rfloordiv__.u16", u16, self, _other)
+ 487 @func(inline='always')
+ 488 def __ifloordiv__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__ifloordiv__.u16", u16, byref(self), _other)
+ 489 @func(inline='always')
+ 490 def __lshift__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__lshift__.u16", u16, self, _other)
+ 491 @func(inline='always')
+ 492 def __rlshift__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__rlshift__.u16", u16, self, _other)
+ 493 @func(inline='always')
+ 494 def __ilshift__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__ilshift__.u16", u16, byref(self), _other)
+ 495 @func(inline='always')
+ 496 def __rshift__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__rshift__.u16", u16, self, _other)
+ 497 @func(inline='always')
+ 498 def __rrshift__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__rrshift__.u16", u16, self, _other)
+ 499 @func(inline='always')
+ 500 def __irshift__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__irshift__.u16", u16, byref(self), _other)
+ 501 @func(inline='always')
+ 502 def __and__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__and__.u16", u16, self, _other)
+ 503 @func(inline='always')
+ 504 def __rand__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__rand__.u16", u16, self, _other)
+ 505 @func(inline='always')
+ 506 def __iand__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__iand__.u16", u16, byref(self), _other)
+ 507 @func(inline='always')
+ 508 def __or__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__or__.u16", u16, self, _other)
+ 509 @func(inline='always')
+ 510 def __ror__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__ror__.u16", u16, self, _other)
+ 511 @func(inline='always')
+ 512 def __ior__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__ior__.u16", u16, byref(self), _other)
+ 513 @func(inline='always')
+ 514 def __xor__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__xor__.u16", u16, self, _other)
+ 515 @func(inline='always')
+ 516 def __rxor__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__rxor__.u16", u16, self, _other)
+ 517 @func(inline='always')
+ 518 def __ixor__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__ixor__.u16", u16, byref(self), _other)
+ 519 @func(inline='always')
+ 520 def __neg__(self) -> 'u16': return intrinsic("unary.__neg__.u16", u16, self)
+ 521 @func(inline='always')
+ 522 def __pos__(self) -> 'u16': return intrinsic("unary.__pos__.u16", u16, self)
+ 523 @func(inline='always')
+ 524 def __invert__(self) -> 'u16': return intrinsic("unary.__invert__.u16", u16, self)
+ 525
+ 526@builtin_type(_hir.IntType(64, True))
+ 527class i64:
+ 528 @func(inline='always')
+ 529 def __init__(self, _value: tp.Union['i64', IntLiteral]) -> None:
+ 530 self = intrinsic("init.i64", i64, _value)
+ 531 @func(inline='always')
+ 532 def __add__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__add__.i64", i64, self, _other)
+ 533 @func(inline='always')
+ 534 def __radd__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__radd__.i64", i64, self, _other)
+ 535 @func(inline='always')
+ 536 def __iadd__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__iadd__.i64", i64, byref(self), _other)
+ 537 @func(inline='always')
+ 538 def __sub__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__sub__.i64", i64, self, _other)
+ 539 @func(inline='always')
+ 540 def __rsub__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__rsub__.i64", i64, self, _other)
+ 541 @func(inline='always')
+ 542 def __isub__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__isub__.i64", i64, byref(self), _other)
+ 543 @func(inline='always')
+ 544 def __mul__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__mul__.i64", i64, self, _other)
+ 545 @func(inline='always')
+ 546 def __rmul__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__rmul__.i64", i64, self, _other)
+ 547 @func(inline='always')
+ 548 def __imul__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__imul__.i64", i64, byref(self), _other)
+ 549 @func(inline='always')
+ 550 def __mod__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__mod__.i64", i64, self, _other)
+ 551 @func(inline='always')
+ 552 def __rmod__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__rmod__.i64", i64, self, _other)
+ 553 @func(inline='always')
+ 554 def __imod__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__imod__.i64", i64, byref(self), _other)
+ 555 @func(inline='always')
+ 556 def __lt__(self, _other: tp.Union['i64', IntLiteral]) -> 'bool': return intrinsic("cmp.__lt__.i64", bool, self, _other) # type: ignore
+ 557 @func(inline='always')
+ 558 def __le__(self, _other: tp.Union['i64', IntLiteral]) -> 'bool': return intrinsic("cmp.__le__.i64", bool, self, _other) # type: ignore
+ 559 @func(inline='always')
+ 560 def __gt__(self, _other: tp.Union['i64', IntLiteral]) -> 'bool': return intrinsic("cmp.__gt__.i64", bool, self, _other) # type: ignore
+ 561 @func(inline='always')
+ 562 def __ge__(self, _other: tp.Union['i64', IntLiteral]) -> 'bool': return intrinsic("cmp.__ge__.i64", bool, self, _other) # type: ignore
+ 563 @func(inline='always')
+ 564 def __eq__(self, _other: tp.Union['i64', IntLiteral]) -> 'bool': return intrinsic("cmp.__eq__.i64", bool, self, _other) # type: ignore
+ 565 @func(inline='always')
+ 566 def __ne__(self, _other: tp.Union['i64', IntLiteral]) -> 'bool': return intrinsic("cmp.__ne__.i64", bool, self, _other) # type: ignore
+ 567 @func(inline='always')
+ 568 def __floordiv__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__floordiv__.i64", i64, self, _other)
+ 569 @func(inline='always')
+ 570 def __rfloordiv__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__rfloordiv__.i64", i64, self, _other)
+ 571 @func(inline='always')
+ 572 def __ifloordiv__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__ifloordiv__.i64", i64, byref(self), _other)
+ 573 @func(inline='always')
+ 574 def __lshift__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__lshift__.i64", i64, self, _other)
+ 575 @func(inline='always')
+ 576 def __rlshift__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__rlshift__.i64", i64, self, _other)
+ 577 @func(inline='always')
+ 578 def __ilshift__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__ilshift__.i64", i64, byref(self), _other)
+ 579 @func(inline='always')
+ 580 def __rshift__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__rshift__.i64", i64, self, _other)
+ 581 @func(inline='always')
+ 582 def __rrshift__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__rrshift__.i64", i64, self, _other)
+ 583 @func(inline='always')
+ 584 def __irshift__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__irshift__.i64", i64, byref(self), _other)
+ 585 @func(inline='always')
+ 586 def __and__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__and__.i64", i64, self, _other)
+ 587 @func(inline='always')
+ 588 def __rand__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__rand__.i64", i64, self, _other)
+ 589 @func(inline='always')
+ 590 def __iand__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__iand__.i64", i64, byref(self), _other)
+ 591 @func(inline='always')
+ 592 def __or__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__or__.i64", i64, self, _other)
+ 593 @func(inline='always')
+ 594 def __ror__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__ror__.i64", i64, self, _other)
+ 595 @func(inline='always')
+ 596 def __ior__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__ior__.i64", i64, byref(self), _other)
+ 597 @func(inline='always')
+ 598 def __xor__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__xor__.i64", i64, self, _other)
+ 599 @func(inline='always')
+ 600 def __rxor__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__rxor__.i64", i64, self, _other)
+ 601 @func(inline='always')
+ 602 def __ixor__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__ixor__.i64", i64, byref(self), _other)
+ 603 @func(inline='always')
+ 604 def __neg__(self) -> 'i64': return intrinsic("unary.__neg__.i64", i64, self)
+ 605 @func(inline='always')
+ 606 def __pos__(self) -> 'i64': return intrinsic("unary.__pos__.i64", i64, self)
+ 607 @func(inline='always')
+ 608 def __invert__(self) -> 'i64': return intrinsic("unary.__invert__.i64", i64, self)
+ 609
+ 610@builtin_type(_hir.IntType(64, False))
+ 611class u64:
+ 612 @func(inline='always')
+ 613 def __init__(self, _value: tp.Union['u64', IntLiteral]) -> None:
+ 614 self = intrinsic("init.u64", u64, _value)
+ 615 @func(inline='always')
+ 616 def __add__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__add__.u64", u64, self, _other)
+ 617 @func(inline='always')
+ 618 def __radd__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__radd__.u64", u64, self, _other)
+ 619 @func(inline='always')
+ 620 def __iadd__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__iadd__.u64", u64, byref(self), _other)
+ 621 @func(inline='always')
+ 622 def __sub__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__sub__.u64", u64, self, _other)
+ 623 @func(inline='always')
+ 624 def __rsub__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__rsub__.u64", u64, self, _other)
+ 625 @func(inline='always')
+ 626 def __isub__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__isub__.u64", u64, byref(self), _other)
+ 627 @func(inline='always')
+ 628 def __mul__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__mul__.u64", u64, self, _other)
+ 629 @func(inline='always')
+ 630 def __rmul__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__rmul__.u64", u64, self, _other)
+ 631 @func(inline='always')
+ 632 def __imul__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__imul__.u64", u64, byref(self), _other)
+ 633 @func(inline='always')
+ 634 def __mod__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__mod__.u64", u64, self, _other)
+ 635 @func(inline='always')
+ 636 def __rmod__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__rmod__.u64", u64, self, _other)
+ 637 @func(inline='always')
+ 638 def __imod__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__imod__.u64", u64, byref(self), _other)
+ 639 @func(inline='always')
+ 640 def __lt__(self, _other: tp.Union['u64', IntLiteral]) -> 'bool': return intrinsic("cmp.__lt__.u64", bool, self, _other) # type: ignore
+ 641 @func(inline='always')
+ 642 def __le__(self, _other: tp.Union['u64', IntLiteral]) -> 'bool': return intrinsic("cmp.__le__.u64", bool, self, _other) # type: ignore
+ 643 @func(inline='always')
+ 644 def __gt__(self, _other: tp.Union['u64', IntLiteral]) -> 'bool': return intrinsic("cmp.__gt__.u64", bool, self, _other) # type: ignore
+ 645 @func(inline='always')
+ 646 def __ge__(self, _other: tp.Union['u64', IntLiteral]) -> 'bool': return intrinsic("cmp.__ge__.u64", bool, self, _other) # type: ignore
+ 647 @func(inline='always')
+ 648 def __eq__(self, _other: tp.Union['u64', IntLiteral]) -> 'bool': return intrinsic("cmp.__eq__.u64", bool, self, _other) # type: ignore
+ 649 @func(inline='always')
+ 650 def __ne__(self, _other: tp.Union['u64', IntLiteral]) -> 'bool': return intrinsic("cmp.__ne__.u64", bool, self, _other) # type: ignore
+ 651 @func(inline='always')
+ 652 def __floordiv__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__floordiv__.u64", u64, self, _other)
+ 653 @func(inline='always')
+ 654 def __rfloordiv__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__rfloordiv__.u64", u64, self, _other)
+ 655 @func(inline='always')
+ 656 def __ifloordiv__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__ifloordiv__.u64", u64, byref(self), _other)
+ 657 @func(inline='always')
+ 658 def __lshift__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__lshift__.u64", u64, self, _other)
+ 659 @func(inline='always')
+ 660 def __rlshift__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__rlshift__.u64", u64, self, _other)
+ 661 @func(inline='always')
+ 662 def __ilshift__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__ilshift__.u64", u64, byref(self), _other)
+ 663 @func(inline='always')
+ 664 def __rshift__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__rshift__.u64", u64, self, _other)
+ 665 @func(inline='always')
+ 666 def __rrshift__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__rrshift__.u64", u64, self, _other)
+ 667 @func(inline='always')
+ 668 def __irshift__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__irshift__.u64", u64, byref(self), _other)
+ 669 @func(inline='always')
+ 670 def __and__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__and__.u64", u64, self, _other)
+ 671 @func(inline='always')
+ 672 def __rand__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__rand__.u64", u64, self, _other)
+ 673 @func(inline='always')
+ 674 def __iand__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__iand__.u64", u64, byref(self), _other)
+ 675 @func(inline='always')
+ 676 def __or__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__or__.u64", u64, self, _other)
+ 677 @func(inline='always')
+ 678 def __ror__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__ror__.u64", u64, self, _other)
+ 679 @func(inline='always')
+ 680 def __ior__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__ior__.u64", u64, byref(self), _other)
+ 681 @func(inline='always')
+ 682 def __xor__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__xor__.u64", u64, self, _other)
+ 683 @func(inline='always')
+ 684 def __rxor__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__rxor__.u64", u64, self, _other)
+ 685 @func(inline='always')
+ 686 def __ixor__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__ixor__.u64", u64, byref(self), _other)
+ 687 @func(inline='always')
+ 688 def __neg__(self) -> 'u64': return intrinsic("unary.__neg__.u64", u64, self)
+ 689 @func(inline='always')
+ 690 def __pos__(self) -> 'u64': return intrinsic("unary.__pos__.u64", u64, self)
+ 691 @func(inline='always')
+ 692 def __invert__(self) -> 'u64': return intrinsic("unary.__invert__.u64", u64, self)
+ 693
+ 694@builtin_type(_hir.IntType(32, True))
+ 695class _i32:
+ 696 @func(inline='always')
+ 697 def __init__(self, _value: tp.Union['_i32', IntLiteral]) -> None:
+ 698 self = intrinsic("init._i32", _i32, _value)
+ 699 @func(inline='always')
+ 700 def __add__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__add__._i32", _i32, self, _other)
+ 701 @func(inline='always')
+ 702 def __radd__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__radd__._i32", _i32, self, _other)
+ 703 @func(inline='always')
+ 704 def __iadd__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__iadd__._i32", _i32, byref(self), _other)
+ 705 @func(inline='always')
+ 706 def __sub__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__sub__._i32", _i32, self, _other)
+ 707 @func(inline='always')
+ 708 def __rsub__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__rsub__._i32", _i32, self, _other)
+ 709 @func(inline='always')
+ 710 def __isub__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__isub__._i32", _i32, byref(self), _other)
+ 711 @func(inline='always')
+ 712 def __mul__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__mul__._i32", _i32, self, _other)
+ 713 @func(inline='always')
+ 714 def __rmul__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__rmul__._i32", _i32, self, _other)
+ 715 @func(inline='always')
+ 716 def __imul__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__imul__._i32", _i32, byref(self), _other)
+ 717 @func(inline='always')
+ 718 def __mod__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__mod__._i32", _i32, self, _other)
+ 719 @func(inline='always')
+ 720 def __rmod__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__rmod__._i32", _i32, self, _other)
+ 721 @func(inline='always')
+ 722 def __imod__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__imod__._i32", _i32, byref(self), _other)
+ 723 @func(inline='always')
+ 724 def __lt__(self, _other: tp.Union['_i32', IntLiteral]) -> 'bool': return intrinsic("cmp.__lt__._i32", bool, self, _other) # type: ignore
+ 725 @func(inline='always')
+ 726 def __le__(self, _other: tp.Union['_i32', IntLiteral]) -> 'bool': return intrinsic("cmp.__le__._i32", bool, self, _other) # type: ignore
+ 727 @func(inline='always')
+ 728 def __gt__(self, _other: tp.Union['_i32', IntLiteral]) -> 'bool': return intrinsic("cmp.__gt__._i32", bool, self, _other) # type: ignore
+ 729 @func(inline='always')
+ 730 def __ge__(self, _other: tp.Union['_i32', IntLiteral]) -> 'bool': return intrinsic("cmp.__ge__._i32", bool, self, _other) # type: ignore
+ 731 @func(inline='always')
+ 732 def __eq__(self, _other: tp.Union['_i32', IntLiteral]) -> 'bool': return intrinsic("cmp.__eq__._i32", bool, self, _other) # type: ignore
+ 733 @func(inline='always')
+ 734 def __ne__(self, _other: tp.Union['_i32', IntLiteral]) -> 'bool': return intrinsic("cmp.__ne__._i32", bool, self, _other) # type: ignore
+ 735 @func(inline='always')
+ 736 def __floordiv__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__floordiv__._i32", _i32, self, _other)
+ 737 @func(inline='always')
+ 738 def __rfloordiv__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__rfloordiv__._i32", _i32, self, _other)
+ 739 @func(inline='always')
+ 740 def __ifloordiv__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__ifloordiv__._i32", _i32, byref(self), _other)
+ 741 @func(inline='always')
+ 742 def __lshift__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__lshift__._i32", _i32, self, _other)
+ 743 @func(inline='always')
+ 744 def __rlshift__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__rlshift__._i32", _i32, self, _other)
+ 745 @func(inline='always')
+ 746 def __ilshift__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__ilshift__._i32", _i32, byref(self), _other)
+ 747 @func(inline='always')
+ 748 def __rshift__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__rshift__._i32", _i32, self, _other)
+ 749 @func(inline='always')
+ 750 def __rrshift__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__rrshift__._i32", _i32, self, _other)
+ 751 @func(inline='always')
+ 752 def __irshift__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__irshift__._i32", _i32, byref(self), _other)
+ 753 @func(inline='always')
+ 754 def __and__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__and__._i32", _i32, self, _other)
+ 755 @func(inline='always')
+ 756 def __rand__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__rand__._i32", _i32, self, _other)
+ 757 @func(inline='always')
+ 758 def __iand__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__iand__._i32", _i32, byref(self), _other)
+ 759 @func(inline='always')
+ 760 def __or__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__or__._i32", _i32, self, _other)
+ 761 @func(inline='always')
+ 762 def __ror__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__ror__._i32", _i32, self, _other)
+ 763 @func(inline='always')
+ 764 def __ior__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__ior__._i32", _i32, byref(self), _other)
+ 765 @func(inline='always')
+ 766 def __xor__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__xor__._i32", _i32, self, _other)
+ 767 @func(inline='always')
+ 768 def __rxor__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__rxor__._i32", _i32, self, _other)
+ 769 @func(inline='always')
+ 770 def __ixor__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__ixor__._i32", _i32, byref(self), _other)
+ 771 @func(inline='always')
+ 772 def __neg__(self) -> '_i32': return intrinsic("unary.__neg__._i32", _i32, self)
+ 773 @func(inline='always')
+ 774 def __pos__(self) -> '_i32': return intrinsic("unary.__pos__._i32", _i32, self)
+ 775 @func(inline='always')
+ 776 def __invert__(self) -> '_i32': return intrinsic("unary.__invert__._i32", _i32, self)
+ 777
+ 778@builtin_type(_hir.IntType(32, False))
+ 779class u32:
+ 780 @func(inline='always')
+ 781 def __init__(self, _value: tp.Union['u32', IntLiteral]) -> None:
+ 782 self = intrinsic("init.u32", u32, _value)
+ 783 @func(inline='always')
+ 784 def __add__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__add__.u32", u32, self, _other)
+ 785 @func(inline='always')
+ 786 def __radd__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__radd__.u32", u32, self, _other)
+ 787 @func(inline='always')
+ 788 def __iadd__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__iadd__.u32", u32, byref(self), _other)
+ 789 @func(inline='always')
+ 790 def __sub__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__sub__.u32", u32, self, _other)
+ 791 @func(inline='always')
+ 792 def __rsub__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__rsub__.u32", u32, self, _other)
+ 793 @func(inline='always')
+ 794 def __isub__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__isub__.u32", u32, byref(self), _other)
+ 795 @func(inline='always')
+ 796 def __mul__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__mul__.u32", u32, self, _other)
+ 797 @func(inline='always')
+ 798 def __rmul__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__rmul__.u32", u32, self, _other)
+ 799 @func(inline='always')
+ 800 def __imul__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__imul__.u32", u32, byref(self), _other)
+ 801 @func(inline='always')
+ 802 def __mod__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__mod__.u32", u32, self, _other)
+ 803 @func(inline='always')
+ 804 def __rmod__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__rmod__.u32", u32, self, _other)
+ 805 @func(inline='always')
+ 806 def __imod__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__imod__.u32", u32, byref(self), _other)
+ 807 @func(inline='always')
+ 808 def __lt__(self, _other: tp.Union['u32', IntLiteral]) -> 'bool': return intrinsic("cmp.__lt__.u32", bool, self, _other) # type: ignore
+ 809 @func(inline='always')
+ 810 def __le__(self, _other: tp.Union['u32', IntLiteral]) -> 'bool': return intrinsic("cmp.__le__.u32", bool, self, _other) # type: ignore
+ 811 @func(inline='always')
+ 812 def __gt__(self, _other: tp.Union['u32', IntLiteral]) -> 'bool': return intrinsic("cmp.__gt__.u32", bool, self, _other) # type: ignore
+ 813 @func(inline='always')
+ 814 def __ge__(self, _other: tp.Union['u32', IntLiteral]) -> 'bool': return intrinsic("cmp.__ge__.u32", bool, self, _other) # type: ignore
+ 815 @func(inline='always')
+ 816 def __eq__(self, _other: tp.Union['u32', IntLiteral]) -> 'bool': return intrinsic("cmp.__eq__.u32", bool, self, _other) # type: ignore
+ 817 @func(inline='always')
+ 818 def __ne__(self, _other: tp.Union['u32', IntLiteral]) -> 'bool': return intrinsic("cmp.__ne__.u32", bool, self, _other) # type: ignore
+ 819 @func(inline='always')
+ 820 def __floordiv__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__floordiv__.u32", u32, self, _other)
+ 821 @func(inline='always')
+ 822 def __rfloordiv__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__rfloordiv__.u32", u32, self, _other)
+ 823 @func(inline='always')
+ 824 def __ifloordiv__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__ifloordiv__.u32", u32, byref(self), _other)
+ 825 @func(inline='always')
+ 826 def __lshift__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__lshift__.u32", u32, self, _other)
+ 827 @func(inline='always')
+ 828 def __rlshift__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__rlshift__.u32", u32, self, _other)
+ 829 @func(inline='always')
+ 830 def __ilshift__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__ilshift__.u32", u32, byref(self), _other)
+ 831 @func(inline='always')
+ 832 def __rshift__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__rshift__.u32", u32, self, _other)
+ 833 @func(inline='always')
+ 834 def __rrshift__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__rrshift__.u32", u32, self, _other)
+ 835 @func(inline='always')
+ 836 def __irshift__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__irshift__.u32", u32, byref(self), _other)
+ 837 @func(inline='always')
+ 838 def __and__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__and__.u32", u32, self, _other)
+ 839 @func(inline='always')
+ 840 def __rand__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__rand__.u32", u32, self, _other)
+ 841 @func(inline='always')
+ 842 def __iand__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__iand__.u32", u32, byref(self), _other)
+ 843 @func(inline='always')
+ 844 def __or__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__or__.u32", u32, self, _other)
+ 845 @func(inline='always')
+ 846 def __ror__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__ror__.u32", u32, self, _other)
+ 847 @func(inline='always')
+ 848 def __ior__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__ior__.u32", u32, byref(self), _other)
+ 849 @func(inline='always')
+ 850 def __xor__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__xor__.u32", u32, self, _other)
+ 851 @func(inline='always')
+ 852 def __rxor__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__rxor__.u32", u32, self, _other)
+ 853 @func(inline='always')
+ 854 def __ixor__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__ixor__.u32", u32, byref(self), _other)
+ 855 @func(inline='always')
+ 856 def __neg__(self) -> 'u32': return intrinsic("unary.__neg__.u32", u32, self)
+ 857 @func(inline='always')
+ 858 def __pos__(self) -> 'u32': return intrinsic("unary.__pos__.u32", u32, self)
+ 859 @func(inline='always')
+ 860 def __invert__(self) -> 'u32': return intrinsic("unary.__invert__.u32", u32, self)
+ 861
+ 862_hir.register_dsl_type_alias(int, _i32)
+ 863_hir.register_dsl_type_alias(float, _f32)
+ 864@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[bool]), 2))
+ 865class bool2:
+ 866 x: bool
+ 867 y: bool
+ 868 def __init__(self, x: tp.Union['bool', bool] = False, y: tp.Union['bool', bool] = False) -> None: self = intrinsic("init.bool2", bool2, x, y)
+ 869 @func(inline='always')
+ 870 def __eq__(self, _other: tp.Union['bool2', bool, bool]) -> 'bool2': return intrinsic("cmp.__eq__.bool2", bool2, self, _other) # type: ignore
+ 871 @func(inline='always')
+ 872 def __ne__(self, _other: tp.Union['bool2', bool, bool]) -> 'bool2': return intrinsic("cmp.__ne__.bool2", bool2, self, _other) # type: ignore
+ 873 @func(inline='always')
+ 874 def __and__(self, _other: tp.Union['bool2', bool, bool]) -> 'bool2': return intrinsic("binop.__and__.bool2", bool2, self, _other)
+ 875 @func(inline='always')
+ 876 def __rand__(self, _other: tp.Union['bool2', bool, bool]) -> 'bool2': return intrinsic("binop.__rand__.bool2", bool2, self, _other)
+ 877 @func(inline='always')
+ 878 def __iand__(self, _other: tp.Union['bool2', bool, bool]) -> 'bool2': return intrinsic("binop.__iand__.bool2", bool2, byref(self), _other)
+ 879 @func(inline='always')
+ 880 def __or__(self, _other: tp.Union['bool2', bool, bool]) -> 'bool2': return intrinsic("binop.__or__.bool2", bool2, self, _other)
+ 881 @func(inline='always')
+ 882 def __ror__(self, _other: tp.Union['bool2', bool, bool]) -> 'bool2': return intrinsic("binop.__ror__.bool2", bool2, self, _other)
+ 883 @func(inline='always')
+ 884 def __ior__(self, _other: tp.Union['bool2', bool, bool]) -> 'bool2': return intrinsic("binop.__ior__.bool2", bool2, byref(self), _other)
+ 885 @func(inline='always')
+ 886 def __xor__(self, _other: tp.Union['bool2', bool, bool]) -> 'bool2': return intrinsic("binop.__xor__.bool2", bool2, self, _other)
+ 887 @func(inline='always')
+ 888 def __rxor__(self, _other: tp.Union['bool2', bool, bool]) -> 'bool2': return intrinsic("binop.__rxor__.bool2", bool2, self, _other)
+ 889 @func(inline='always')
+ 890 def __ixor__(self, _other: tp.Union['bool2', bool, bool]) -> 'bool2': return intrinsic("binop.__ixor__.bool2", bool2, byref(self), _other)
+ 891
+ 892@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[f32]), 2))
+ 893class float2:
+ 894 x: f32
+ 895 y: f32
+ 896 def __init__(self, x: tp.Union['f32', FloatLiteral] = FloatLiteral(), y: tp.Union['f32', FloatLiteral] = FloatLiteral()) -> None: self = intrinsic("init.float2", float2, x, y)
+ 897 @func(inline='always')
+ 898 def __add__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__add__.float2", float2, self, _other)
+ 899 @func(inline='always')
+ 900 def __radd__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__radd__.float2", float2, self, _other)
+ 901 @func(inline='always')
+ 902 def __iadd__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__iadd__.float2", float2, byref(self), _other)
+ 903 @func(inline='always')
+ 904 def __sub__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__sub__.float2", float2, self, _other)
+ 905 @func(inline='always')
+ 906 def __rsub__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__rsub__.float2", float2, self, _other)
+ 907 @func(inline='always')
+ 908 def __isub__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__isub__.float2", float2, byref(self), _other)
+ 909 @func(inline='always')
+ 910 def __mul__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__mul__.float2", float2, self, _other)
+ 911 @func(inline='always')
+ 912 def __rmul__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__rmul__.float2", float2, self, _other)
+ 913 @func(inline='always')
+ 914 def __imul__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__imul__.float2", float2, byref(self), _other)
+ 915 @func(inline='always')
+ 916 def __mod__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__mod__.float2", float2, self, _other)
+ 917 @func(inline='always')
+ 918 def __rmod__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__rmod__.float2", float2, self, _other)
+ 919 @func(inline='always')
+ 920 def __imod__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__imod__.float2", float2, byref(self), _other)
+ 921 @func(inline='always')
+ 922 def __lt__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'bool2': return intrinsic("cmp.__lt__.float2", bool2, self, _other) # type: ignore
+ 923 @func(inline='always')
+ 924 def __le__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'bool2': return intrinsic("cmp.__le__.float2", bool2, self, _other) # type: ignore
+ 925 @func(inline='always')
+ 926 def __gt__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'bool2': return intrinsic("cmp.__gt__.float2", bool2, self, _other) # type: ignore
+ 927 @func(inline='always')
+ 928 def __ge__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'bool2': return intrinsic("cmp.__ge__.float2", bool2, self, _other) # type: ignore
+ 929 @func(inline='always')
+ 930 def __eq__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'bool2': return intrinsic("cmp.__eq__.float2", bool2, self, _other) # type: ignore
+ 931 @func(inline='always')
+ 932 def __ne__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'bool2': return intrinsic("cmp.__ne__.float2", bool2, self, _other) # type: ignore
+ 933 @func(inline='always')
+ 934 def __truediv__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__truediv__.float2", float2, self, _other)
+ 935 @func(inline='always')
+ 936 def __rtruediv__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__rtruediv__.float2", float2, self, _other)
+ 937 @func(inline='always')
+ 938 def __itruediv__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__itruediv__.float2", float2, byref(self), _other)
+ 939 @func(inline='always')
+ 940 def __pow__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__pow__.float2", float2, self, _other)
+ 941 @func(inline='always')
+ 942 def __rpow__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__rpow__.float2", float2, self, _other)
+ 943 @func(inline='always')
+ 944 def __ipow__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__ipow__.float2", float2, byref(self), _other)
+ 945 @func(inline='always')
+ 946 def __floordiv__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__floordiv__.float2", float2, self, _other)
+ 947 @func(inline='always')
+ 948 def __rfloordiv__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__rfloordiv__.float2", float2, self, _other)
+ 949
+ 950@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[f64]), 2))
+ 951class double2:
+ 952 x: f64
+ 953 y: f64
+ 954 def __init__(self, x: tp.Union['f64', FloatLiteral] = FloatLiteral(), y: tp.Union['f64', FloatLiteral] = FloatLiteral()) -> None: self = intrinsic("init.double2", double2, x, y)
+ 955 @func(inline='always')
+ 956 def __add__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__add__.double2", double2, self, _other)
+ 957 @func(inline='always')
+ 958 def __radd__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__radd__.double2", double2, self, _other)
+ 959 @func(inline='always')
+ 960 def __iadd__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__iadd__.double2", double2, byref(self), _other)
+ 961 @func(inline='always')
+ 962 def __sub__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__sub__.double2", double2, self, _other)
+ 963 @func(inline='always')
+ 964 def __rsub__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__rsub__.double2", double2, self, _other)
+ 965 @func(inline='always')
+ 966 def __isub__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__isub__.double2", double2, byref(self), _other)
+ 967 @func(inline='always')
+ 968 def __mul__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__mul__.double2", double2, self, _other)
+ 969 @func(inline='always')
+ 970 def __rmul__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__rmul__.double2", double2, self, _other)
+ 971 @func(inline='always')
+ 972 def __imul__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__imul__.double2", double2, byref(self), _other)
+ 973 @func(inline='always')
+ 974 def __mod__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__mod__.double2", double2, self, _other)
+ 975 @func(inline='always')
+ 976 def __rmod__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__rmod__.double2", double2, self, _other)
+ 977 @func(inline='always')
+ 978 def __imod__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__imod__.double2", double2, byref(self), _other)
+ 979 @func(inline='always')
+ 980 def __lt__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'bool2': return intrinsic("cmp.__lt__.double2", bool2, self, _other) # type: ignore
+ 981 @func(inline='always')
+ 982 def __le__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'bool2': return intrinsic("cmp.__le__.double2", bool2, self, _other) # type: ignore
+ 983 @func(inline='always')
+ 984 def __gt__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'bool2': return intrinsic("cmp.__gt__.double2", bool2, self, _other) # type: ignore
+ 985 @func(inline='always')
+ 986 def __ge__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'bool2': return intrinsic("cmp.__ge__.double2", bool2, self, _other) # type: ignore
+ 987 @func(inline='always')
+ 988 def __eq__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'bool2': return intrinsic("cmp.__eq__.double2", bool2, self, _other) # type: ignore
+ 989 @func(inline='always')
+ 990 def __ne__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'bool2': return intrinsic("cmp.__ne__.double2", bool2, self, _other) # type: ignore
+ 991 @func(inline='always')
+ 992 def __truediv__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__truediv__.double2", double2, self, _other)
+ 993 @func(inline='always')
+ 994 def __rtruediv__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__rtruediv__.double2", double2, self, _other)
+ 995 @func(inline='always')
+ 996 def __itruediv__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__itruediv__.double2", double2, byref(self), _other)
+ 997 @func(inline='always')
+ 998 def __pow__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__pow__.double2", double2, self, _other)
+ 999 @func(inline='always')
+1000 def __rpow__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__rpow__.double2", double2, self, _other)
+1001 @func(inline='always')
+1002 def __ipow__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__ipow__.double2", double2, byref(self), _other)
+1003 @func(inline='always')
+1004 def __floordiv__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__floordiv__.double2", double2, self, _other)
+1005 @func(inline='always')
+1006 def __rfloordiv__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__rfloordiv__.double2", double2, self, _other)
+1007
+1008@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[i8]), 2))
+1009class byte2:
+1010 x: i8
+1011 y: i8
+1012 def __init__(self, x: tp.Union['i8', IntLiteral] = IntLiteral(), y: tp.Union['i8', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.byte2", byte2, x, y)
+1013 @func(inline='always')
+1014 def __add__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__add__.byte2", byte2, self, _other)
+1015 @func(inline='always')
+1016 def __radd__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__radd__.byte2", byte2, self, _other)
+1017 @func(inline='always')
+1018 def __iadd__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__iadd__.byte2", byte2, byref(self), _other)
+1019 @func(inline='always')
+1020 def __sub__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__sub__.byte2", byte2, self, _other)
+1021 @func(inline='always')
+1022 def __rsub__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__rsub__.byte2", byte2, self, _other)
+1023 @func(inline='always')
+1024 def __isub__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__isub__.byte2", byte2, byref(self), _other)
+1025 @func(inline='always')
+1026 def __mul__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__mul__.byte2", byte2, self, _other)
+1027 @func(inline='always')
+1028 def __rmul__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__rmul__.byte2", byte2, self, _other)
+1029 @func(inline='always')
+1030 def __imul__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__imul__.byte2", byte2, byref(self), _other)
+1031 @func(inline='always')
+1032 def __mod__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__mod__.byte2", byte2, self, _other)
+1033 @func(inline='always')
+1034 def __rmod__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__rmod__.byte2", byte2, self, _other)
+1035 @func(inline='always')
+1036 def __imod__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__imod__.byte2", byte2, byref(self), _other)
+1037 @func(inline='always')
+1038 def __lt__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'bool2': return intrinsic("cmp.__lt__.byte2", bool2, self, _other) # type: ignore
+1039 @func(inline='always')
+1040 def __le__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'bool2': return intrinsic("cmp.__le__.byte2", bool2, self, _other) # type: ignore
+1041 @func(inline='always')
+1042 def __gt__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'bool2': return intrinsic("cmp.__gt__.byte2", bool2, self, _other) # type: ignore
+1043 @func(inline='always')
+1044 def __ge__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'bool2': return intrinsic("cmp.__ge__.byte2", bool2, self, _other) # type: ignore
+1045 @func(inline='always')
+1046 def __eq__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'bool2': return intrinsic("cmp.__eq__.byte2", bool2, self, _other) # type: ignore
+1047 @func(inline='always')
+1048 def __ne__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'bool2': return intrinsic("cmp.__ne__.byte2", bool2, self, _other) # type: ignore
+1049 @func(inline='always')
+1050 def __floordiv__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__floordiv__.byte2", byte2, self, _other)
+1051 @func(inline='always')
+1052 def __rfloordiv__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__rfloordiv__.byte2", byte2, self, _other)
+1053 @func(inline='always')
+1054 def __ifloordiv__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__ifloordiv__.byte2", byte2, byref(self), _other)
+1055 @func(inline='always')
+1056 def __lshift__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__lshift__.byte2", byte2, self, _other)
+1057 @func(inline='always')
+1058 def __rlshift__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__rlshift__.byte2", byte2, self, _other)
+1059 @func(inline='always')
+1060 def __ilshift__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__ilshift__.byte2", byte2, byref(self), _other)
+1061 @func(inline='always')
+1062 def __rshift__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__rshift__.byte2", byte2, self, _other)
+1063 @func(inline='always')
+1064 def __rrshift__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__rrshift__.byte2", byte2, self, _other)
+1065 @func(inline='always')
+1066 def __irshift__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__irshift__.byte2", byte2, byref(self), _other)
+1067 @func(inline='always')
+1068 def __and__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__and__.byte2", byte2, self, _other)
+1069 @func(inline='always')
+1070 def __rand__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__rand__.byte2", byte2, self, _other)
+1071 @func(inline='always')
+1072 def __iand__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__iand__.byte2", byte2, byref(self), _other)
+1073 @func(inline='always')
+1074 def __or__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__or__.byte2", byte2, self, _other)
+1075 @func(inline='always')
+1076 def __ror__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__ror__.byte2", byte2, self, _other)
+1077 @func(inline='always')
+1078 def __ior__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__ior__.byte2", byte2, byref(self), _other)
+1079 @func(inline='always')
+1080 def __xor__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__xor__.byte2", byte2, self, _other)
+1081 @func(inline='always')
+1082 def __rxor__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__rxor__.byte2", byte2, self, _other)
+1083 @func(inline='always')
+1084 def __ixor__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__ixor__.byte2", byte2, byref(self), _other)
+1085
+1086@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[u8]), 2))
+1087class ubyte2:
+1088 x: u8
+1089 y: u8
+1090 def __init__(self, x: tp.Union['u8', IntLiteral] = IntLiteral(), y: tp.Union['u8', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.ubyte2", ubyte2, x, y)
+1091 @func(inline='always')
+1092 def __add__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__add__.ubyte2", ubyte2, self, _other)
+1093 @func(inline='always')
+1094 def __radd__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__radd__.ubyte2", ubyte2, self, _other)
+1095 @func(inline='always')
+1096 def __iadd__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__iadd__.ubyte2", ubyte2, byref(self), _other)
+1097 @func(inline='always')
+1098 def __sub__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__sub__.ubyte2", ubyte2, self, _other)
+1099 @func(inline='always')
+1100 def __rsub__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__rsub__.ubyte2", ubyte2, self, _other)
+1101 @func(inline='always')
+1102 def __isub__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__isub__.ubyte2", ubyte2, byref(self), _other)
+1103 @func(inline='always')
+1104 def __mul__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__mul__.ubyte2", ubyte2, self, _other)
+1105 @func(inline='always')
+1106 def __rmul__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__rmul__.ubyte2", ubyte2, self, _other)
+1107 @func(inline='always')
+1108 def __imul__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__imul__.ubyte2", ubyte2, byref(self), _other)
+1109 @func(inline='always')
+1110 def __mod__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__mod__.ubyte2", ubyte2, self, _other)
+1111 @func(inline='always')
+1112 def __rmod__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__rmod__.ubyte2", ubyte2, self, _other)
+1113 @func(inline='always')
+1114 def __imod__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__imod__.ubyte2", ubyte2, byref(self), _other)
+1115 @func(inline='always')
+1116 def __lt__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'bool2': return intrinsic("cmp.__lt__.ubyte2", bool2, self, _other) # type: ignore
+1117 @func(inline='always')
+1118 def __le__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'bool2': return intrinsic("cmp.__le__.ubyte2", bool2, self, _other) # type: ignore
+1119 @func(inline='always')
+1120 def __gt__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'bool2': return intrinsic("cmp.__gt__.ubyte2", bool2, self, _other) # type: ignore
+1121 @func(inline='always')
+1122 def __ge__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'bool2': return intrinsic("cmp.__ge__.ubyte2", bool2, self, _other) # type: ignore
+1123 @func(inline='always')
+1124 def __eq__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'bool2': return intrinsic("cmp.__eq__.ubyte2", bool2, self, _other) # type: ignore
+1125 @func(inline='always')
+1126 def __ne__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'bool2': return intrinsic("cmp.__ne__.ubyte2", bool2, self, _other) # type: ignore
+1127 @func(inline='always')
+1128 def __floordiv__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__floordiv__.ubyte2", ubyte2, self, _other)
+1129 @func(inline='always')
+1130 def __rfloordiv__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__rfloordiv__.ubyte2", ubyte2, self, _other)
+1131 @func(inline='always')
+1132 def __ifloordiv__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__ifloordiv__.ubyte2", ubyte2, byref(self), _other)
+1133 @func(inline='always')
+1134 def __lshift__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__lshift__.ubyte2", ubyte2, self, _other)
+1135 @func(inline='always')
+1136 def __rlshift__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__rlshift__.ubyte2", ubyte2, self, _other)
+1137 @func(inline='always')
+1138 def __ilshift__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__ilshift__.ubyte2", ubyte2, byref(self), _other)
+1139 @func(inline='always')
+1140 def __rshift__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__rshift__.ubyte2", ubyte2, self, _other)
+1141 @func(inline='always')
+1142 def __rrshift__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__rrshift__.ubyte2", ubyte2, self, _other)
+1143 @func(inline='always')
+1144 def __irshift__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__irshift__.ubyte2", ubyte2, byref(self), _other)
+1145 @func(inline='always')
+1146 def __and__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__and__.ubyte2", ubyte2, self, _other)
+1147 @func(inline='always')
+1148 def __rand__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__rand__.ubyte2", ubyte2, self, _other)
+1149 @func(inline='always')
+1150 def __iand__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__iand__.ubyte2", ubyte2, byref(self), _other)
+1151 @func(inline='always')
+1152 def __or__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__or__.ubyte2", ubyte2, self, _other)
+1153 @func(inline='always')
+1154 def __ror__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__ror__.ubyte2", ubyte2, self, _other)
+1155 @func(inline='always')
+1156 def __ior__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__ior__.ubyte2", ubyte2, byref(self), _other)
+1157 @func(inline='always')
+1158 def __xor__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__xor__.ubyte2", ubyte2, self, _other)
+1159 @func(inline='always')
+1160 def __rxor__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__rxor__.ubyte2", ubyte2, self, _other)
+1161 @func(inline='always')
+1162 def __ixor__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__ixor__.ubyte2", ubyte2, byref(self), _other)
+1163
+1164@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[i16]), 2))
+1165class short2:
+1166 x: i16
+1167 y: i16
+1168 def __init__(self, x: tp.Union['i16', IntLiteral] = IntLiteral(), y: tp.Union['i16', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.short2", short2, x, y)
+1169 @func(inline='always')
+1170 def __add__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__add__.short2", short2, self, _other)
+1171 @func(inline='always')
+1172 def __radd__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__radd__.short2", short2, self, _other)
+1173 @func(inline='always')
+1174 def __iadd__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__iadd__.short2", short2, byref(self), _other)
+1175 @func(inline='always')
+1176 def __sub__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__sub__.short2", short2, self, _other)
+1177 @func(inline='always')
+1178 def __rsub__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__rsub__.short2", short2, self, _other)
+1179 @func(inline='always')
+1180 def __isub__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__isub__.short2", short2, byref(self), _other)
+1181 @func(inline='always')
+1182 def __mul__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__mul__.short2", short2, self, _other)
+1183 @func(inline='always')
+1184 def __rmul__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__rmul__.short2", short2, self, _other)
+1185 @func(inline='always')
+1186 def __imul__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__imul__.short2", short2, byref(self), _other)
+1187 @func(inline='always')
+1188 def __mod__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__mod__.short2", short2, self, _other)
+1189 @func(inline='always')
+1190 def __rmod__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__rmod__.short2", short2, self, _other)
+1191 @func(inline='always')
+1192 def __imod__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__imod__.short2", short2, byref(self), _other)
+1193 @func(inline='always')
+1194 def __lt__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'bool2': return intrinsic("cmp.__lt__.short2", bool2, self, _other) # type: ignore
+1195 @func(inline='always')
+1196 def __le__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'bool2': return intrinsic("cmp.__le__.short2", bool2, self, _other) # type: ignore
+1197 @func(inline='always')
+1198 def __gt__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'bool2': return intrinsic("cmp.__gt__.short2", bool2, self, _other) # type: ignore
+1199 @func(inline='always')
+1200 def __ge__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'bool2': return intrinsic("cmp.__ge__.short2", bool2, self, _other) # type: ignore
+1201 @func(inline='always')
+1202 def __eq__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'bool2': return intrinsic("cmp.__eq__.short2", bool2, self, _other) # type: ignore
+1203 @func(inline='always')
+1204 def __ne__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'bool2': return intrinsic("cmp.__ne__.short2", bool2, self, _other) # type: ignore
+1205 @func(inline='always')
+1206 def __floordiv__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__floordiv__.short2", short2, self, _other)
+1207 @func(inline='always')
+1208 def __rfloordiv__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__rfloordiv__.short2", short2, self, _other)
+1209 @func(inline='always')
+1210 def __ifloordiv__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__ifloordiv__.short2", short2, byref(self), _other)
+1211 @func(inline='always')
+1212 def __lshift__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__lshift__.short2", short2, self, _other)
+1213 @func(inline='always')
+1214 def __rlshift__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__rlshift__.short2", short2, self, _other)
+1215 @func(inline='always')
+1216 def __ilshift__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__ilshift__.short2", short2, byref(self), _other)
+1217 @func(inline='always')
+1218 def __rshift__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__rshift__.short2", short2, self, _other)
+1219 @func(inline='always')
+1220 def __rrshift__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__rrshift__.short2", short2, self, _other)
+1221 @func(inline='always')
+1222 def __irshift__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__irshift__.short2", short2, byref(self), _other)
+1223 @func(inline='always')
+1224 def __and__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__and__.short2", short2, self, _other)
+1225 @func(inline='always')
+1226 def __rand__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__rand__.short2", short2, self, _other)
+1227 @func(inline='always')
+1228 def __iand__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__iand__.short2", short2, byref(self), _other)
+1229 @func(inline='always')
+1230 def __or__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__or__.short2", short2, self, _other)
+1231 @func(inline='always')
+1232 def __ror__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__ror__.short2", short2, self, _other)
+1233 @func(inline='always')
+1234 def __ior__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__ior__.short2", short2, byref(self), _other)
+1235 @func(inline='always')
+1236 def __xor__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__xor__.short2", short2, self, _other)
+1237 @func(inline='always')
+1238 def __rxor__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__rxor__.short2", short2, self, _other)
+1239 @func(inline='always')
+1240 def __ixor__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__ixor__.short2", short2, byref(self), _other)
+1241
+1242@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[u16]), 2))
+1243class ushort2:
+1244 x: u16
+1245 y: u16
+1246 def __init__(self, x: tp.Union['u16', IntLiteral] = IntLiteral(), y: tp.Union['u16', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.ushort2", ushort2, x, y)
+1247 @func(inline='always')
+1248 def __add__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__add__.ushort2", ushort2, self, _other)
+1249 @func(inline='always')
+1250 def __radd__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__radd__.ushort2", ushort2, self, _other)
+1251 @func(inline='always')
+1252 def __iadd__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__iadd__.ushort2", ushort2, byref(self), _other)
+1253 @func(inline='always')
+1254 def __sub__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__sub__.ushort2", ushort2, self, _other)
+1255 @func(inline='always')
+1256 def __rsub__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__rsub__.ushort2", ushort2, self, _other)
+1257 @func(inline='always')
+1258 def __isub__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__isub__.ushort2", ushort2, byref(self), _other)
+1259 @func(inline='always')
+1260 def __mul__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__mul__.ushort2", ushort2, self, _other)
+1261 @func(inline='always')
+1262 def __rmul__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__rmul__.ushort2", ushort2, self, _other)
+1263 @func(inline='always')
+1264 def __imul__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__imul__.ushort2", ushort2, byref(self), _other)
+1265 @func(inline='always')
+1266 def __mod__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__mod__.ushort2", ushort2, self, _other)
+1267 @func(inline='always')
+1268 def __rmod__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__rmod__.ushort2", ushort2, self, _other)
+1269 @func(inline='always')
+1270 def __imod__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__imod__.ushort2", ushort2, byref(self), _other)
+1271 @func(inline='always')
+1272 def __lt__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'bool2': return intrinsic("cmp.__lt__.ushort2", bool2, self, _other) # type: ignore
+1273 @func(inline='always')
+1274 def __le__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'bool2': return intrinsic("cmp.__le__.ushort2", bool2, self, _other) # type: ignore
+1275 @func(inline='always')
+1276 def __gt__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'bool2': return intrinsic("cmp.__gt__.ushort2", bool2, self, _other) # type: ignore
+1277 @func(inline='always')
+1278 def __ge__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'bool2': return intrinsic("cmp.__ge__.ushort2", bool2, self, _other) # type: ignore
+1279 @func(inline='always')
+1280 def __eq__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'bool2': return intrinsic("cmp.__eq__.ushort2", bool2, self, _other) # type: ignore
+1281 @func(inline='always')
+1282 def __ne__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'bool2': return intrinsic("cmp.__ne__.ushort2", bool2, self, _other) # type: ignore
+1283 @func(inline='always')
+1284 def __floordiv__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__floordiv__.ushort2", ushort2, self, _other)
+1285 @func(inline='always')
+1286 def __rfloordiv__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__rfloordiv__.ushort2", ushort2, self, _other)
+1287 @func(inline='always')
+1288 def __ifloordiv__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__ifloordiv__.ushort2", ushort2, byref(self), _other)
+1289 @func(inline='always')
+1290 def __lshift__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__lshift__.ushort2", ushort2, self, _other)
+1291 @func(inline='always')
+1292 def __rlshift__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__rlshift__.ushort2", ushort2, self, _other)
+1293 @func(inline='always')
+1294 def __ilshift__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__ilshift__.ushort2", ushort2, byref(self), _other)
+1295 @func(inline='always')
+1296 def __rshift__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__rshift__.ushort2", ushort2, self, _other)
+1297 @func(inline='always')
+1298 def __rrshift__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__rrshift__.ushort2", ushort2, self, _other)
+1299 @func(inline='always')
+1300 def __irshift__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__irshift__.ushort2", ushort2, byref(self), _other)
+1301 @func(inline='always')
+1302 def __and__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__and__.ushort2", ushort2, self, _other)
+1303 @func(inline='always')
+1304 def __rand__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__rand__.ushort2", ushort2, self, _other)
+1305 @func(inline='always')
+1306 def __iand__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__iand__.ushort2", ushort2, byref(self), _other)
+1307 @func(inline='always')
+1308 def __or__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__or__.ushort2", ushort2, self, _other)
+1309 @func(inline='always')
+1310 def __ror__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__ror__.ushort2", ushort2, self, _other)
+1311 @func(inline='always')
+1312 def __ior__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__ior__.ushort2", ushort2, byref(self), _other)
+1313 @func(inline='always')
+1314 def __xor__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__xor__.ushort2", ushort2, self, _other)
+1315 @func(inline='always')
+1316 def __rxor__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__rxor__.ushort2", ushort2, self, _other)
+1317 @func(inline='always')
+1318 def __ixor__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__ixor__.ushort2", ushort2, byref(self), _other)
+1319
+1320@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[i32]), 2))
+1321class int2:
+1322 x: i32
+1323 y: i32
+1324 def __init__(self, x: tp.Union['i32', IntLiteral] = IntLiteral(), y: tp.Union['i32', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.int2", int2, x, y)
+1325 @func(inline='always')
+1326 def __add__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__add__.int2", int2, self, _other)
+1327 @func(inline='always')
+1328 def __radd__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__radd__.int2", int2, self, _other)
+1329 @func(inline='always')
+1330 def __iadd__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__iadd__.int2", int2, byref(self), _other)
+1331 @func(inline='always')
+1332 def __sub__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__sub__.int2", int2, self, _other)
+1333 @func(inline='always')
+1334 def __rsub__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__rsub__.int2", int2, self, _other)
+1335 @func(inline='always')
+1336 def __isub__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__isub__.int2", int2, byref(self), _other)
+1337 @func(inline='always')
+1338 def __mul__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__mul__.int2", int2, self, _other)
+1339 @func(inline='always')
+1340 def __rmul__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__rmul__.int2", int2, self, _other)
+1341 @func(inline='always')
+1342 def __imul__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__imul__.int2", int2, byref(self), _other)
+1343 @func(inline='always')
+1344 def __mod__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__mod__.int2", int2, self, _other)
+1345 @func(inline='always')
+1346 def __rmod__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__rmod__.int2", int2, self, _other)
+1347 @func(inline='always')
+1348 def __imod__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__imod__.int2", int2, byref(self), _other)
+1349 @func(inline='always')
+1350 def __lt__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'bool2': return intrinsic("cmp.__lt__.int2", bool2, self, _other) # type: ignore
+1351 @func(inline='always')
+1352 def __le__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'bool2': return intrinsic("cmp.__le__.int2", bool2, self, _other) # type: ignore
+1353 @func(inline='always')
+1354 def __gt__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'bool2': return intrinsic("cmp.__gt__.int2", bool2, self, _other) # type: ignore
+1355 @func(inline='always')
+1356 def __ge__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'bool2': return intrinsic("cmp.__ge__.int2", bool2, self, _other) # type: ignore
+1357 @func(inline='always')
+1358 def __eq__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'bool2': return intrinsic("cmp.__eq__.int2", bool2, self, _other) # type: ignore
+1359 @func(inline='always')
+1360 def __ne__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'bool2': return intrinsic("cmp.__ne__.int2", bool2, self, _other) # type: ignore
+1361 @func(inline='always')
+1362 def __floordiv__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__floordiv__.int2", int2, self, _other)
+1363 @func(inline='always')
+1364 def __rfloordiv__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__rfloordiv__.int2", int2, self, _other)
+1365 @func(inline='always')
+1366 def __ifloordiv__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__ifloordiv__.int2", int2, byref(self), _other)
+1367 @func(inline='always')
+1368 def __lshift__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__lshift__.int2", int2, self, _other)
+1369 @func(inline='always')
+1370 def __rlshift__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__rlshift__.int2", int2, self, _other)
+1371 @func(inline='always')
+1372 def __ilshift__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__ilshift__.int2", int2, byref(self), _other)
+1373 @func(inline='always')
+1374 def __rshift__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__rshift__.int2", int2, self, _other)
+1375 @func(inline='always')
+1376 def __rrshift__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__rrshift__.int2", int2, self, _other)
+1377 @func(inline='always')
+1378 def __irshift__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__irshift__.int2", int2, byref(self), _other)
+1379 @func(inline='always')
+1380 def __and__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__and__.int2", int2, self, _other)
+1381 @func(inline='always')
+1382 def __rand__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__rand__.int2", int2, self, _other)
+1383 @func(inline='always')
+1384 def __iand__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__iand__.int2", int2, byref(self), _other)
+1385 @func(inline='always')
+1386 def __or__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__or__.int2", int2, self, _other)
+1387 @func(inline='always')
+1388 def __ror__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__ror__.int2", int2, self, _other)
+1389 @func(inline='always')
+1390 def __ior__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__ior__.int2", int2, byref(self), _other)
+1391 @func(inline='always')
+1392 def __xor__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__xor__.int2", int2, self, _other)
+1393 @func(inline='always')
+1394 def __rxor__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__rxor__.int2", int2, self, _other)
+1395 @func(inline='always')
+1396 def __ixor__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__ixor__.int2", int2, byref(self), _other)
+1397
+1398@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[u32]), 2))
+1399class uint2:
+1400 x: u32
+1401 y: u32
+1402 def __init__(self, x: tp.Union['u32', IntLiteral] = IntLiteral(), y: tp.Union['u32', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.uint2", uint2, x, y)
+1403 @func(inline='always')
+1404 def __add__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__add__.uint2", uint2, self, _other)
+1405 @func(inline='always')
+1406 def __radd__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__radd__.uint2", uint2, self, _other)
+1407 @func(inline='always')
+1408 def __iadd__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__iadd__.uint2", uint2, byref(self), _other)
+1409 @func(inline='always')
+1410 def __sub__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__sub__.uint2", uint2, self, _other)
+1411 @func(inline='always')
+1412 def __rsub__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__rsub__.uint2", uint2, self, _other)
+1413 @func(inline='always')
+1414 def __isub__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__isub__.uint2", uint2, byref(self), _other)
+1415 @func(inline='always')
+1416 def __mul__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__mul__.uint2", uint2, self, _other)
+1417 @func(inline='always')
+1418 def __rmul__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__rmul__.uint2", uint2, self, _other)
+1419 @func(inline='always')
+1420 def __imul__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__imul__.uint2", uint2, byref(self), _other)
+1421 @func(inline='always')
+1422 def __mod__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__mod__.uint2", uint2, self, _other)
+1423 @func(inline='always')
+1424 def __rmod__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__rmod__.uint2", uint2, self, _other)
+1425 @func(inline='always')
+1426 def __imod__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__imod__.uint2", uint2, byref(self), _other)
+1427 @func(inline='always')
+1428 def __lt__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'bool2': return intrinsic("cmp.__lt__.uint2", bool2, self, _other) # type: ignore
+1429 @func(inline='always')
+1430 def __le__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'bool2': return intrinsic("cmp.__le__.uint2", bool2, self, _other) # type: ignore
+1431 @func(inline='always')
+1432 def __gt__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'bool2': return intrinsic("cmp.__gt__.uint2", bool2, self, _other) # type: ignore
+1433 @func(inline='always')
+1434 def __ge__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'bool2': return intrinsic("cmp.__ge__.uint2", bool2, self, _other) # type: ignore
+1435 @func(inline='always')
+1436 def __eq__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'bool2': return intrinsic("cmp.__eq__.uint2", bool2, self, _other) # type: ignore
+1437 @func(inline='always')
+1438 def __ne__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'bool2': return intrinsic("cmp.__ne__.uint2", bool2, self, _other) # type: ignore
+1439 @func(inline='always')
+1440 def __floordiv__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__floordiv__.uint2", uint2, self, _other)
+1441 @func(inline='always')
+1442 def __rfloordiv__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__rfloordiv__.uint2", uint2, self, _other)
+1443 @func(inline='always')
+1444 def __ifloordiv__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__ifloordiv__.uint2", uint2, byref(self), _other)
+1445 @func(inline='always')
+1446 def __lshift__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__lshift__.uint2", uint2, self, _other)
+1447 @func(inline='always')
+1448 def __rlshift__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__rlshift__.uint2", uint2, self, _other)
+1449 @func(inline='always')
+1450 def __ilshift__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__ilshift__.uint2", uint2, byref(self), _other)
+1451 @func(inline='always')
+1452 def __rshift__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__rshift__.uint2", uint2, self, _other)
+1453 @func(inline='always')
+1454 def __rrshift__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__rrshift__.uint2", uint2, self, _other)
+1455 @func(inline='always')
+1456 def __irshift__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__irshift__.uint2", uint2, byref(self), _other)
+1457 @func(inline='always')
+1458 def __and__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__and__.uint2", uint2, self, _other)
+1459 @func(inline='always')
+1460 def __rand__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__rand__.uint2", uint2, self, _other)
+1461 @func(inline='always')
+1462 def __iand__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__iand__.uint2", uint2, byref(self), _other)
+1463 @func(inline='always')
+1464 def __or__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__or__.uint2", uint2, self, _other)
+1465 @func(inline='always')
+1466 def __ror__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__ror__.uint2", uint2, self, _other)
+1467 @func(inline='always')
+1468 def __ior__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__ior__.uint2", uint2, byref(self), _other)
+1469 @func(inline='always')
+1470 def __xor__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__xor__.uint2", uint2, self, _other)
+1471 @func(inline='always')
+1472 def __rxor__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__rxor__.uint2", uint2, self, _other)
+1473 @func(inline='always')
+1474 def __ixor__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__ixor__.uint2", uint2, byref(self), _other)
+1475
+1476@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[i64]), 2))
+1477class long2:
+1478 x: i64
+1479 y: i64
+1480 def __init__(self, x: tp.Union['i64', IntLiteral] = IntLiteral(), y: tp.Union['i64', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.long2", long2, x, y)
+1481 @func(inline='always')
+1482 def __add__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__add__.long2", long2, self, _other)
+1483 @func(inline='always')
+1484 def __radd__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__radd__.long2", long2, self, _other)
+1485 @func(inline='always')
+1486 def __iadd__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__iadd__.long2", long2, byref(self), _other)
+1487 @func(inline='always')
+1488 def __sub__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__sub__.long2", long2, self, _other)
+1489 @func(inline='always')
+1490 def __rsub__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__rsub__.long2", long2, self, _other)
+1491 @func(inline='always')
+1492 def __isub__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__isub__.long2", long2, byref(self), _other)
+1493 @func(inline='always')
+1494 def __mul__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__mul__.long2", long2, self, _other)
+1495 @func(inline='always')
+1496 def __rmul__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__rmul__.long2", long2, self, _other)
+1497 @func(inline='always')
+1498 def __imul__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__imul__.long2", long2, byref(self), _other)
+1499 @func(inline='always')
+1500 def __mod__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__mod__.long2", long2, self, _other)
+1501 @func(inline='always')
+1502 def __rmod__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__rmod__.long2", long2, self, _other)
+1503 @func(inline='always')
+1504 def __imod__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__imod__.long2", long2, byref(self), _other)
+1505 @func(inline='always')
+1506 def __lt__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'bool2': return intrinsic("cmp.__lt__.long2", bool2, self, _other) # type: ignore
+1507 @func(inline='always')
+1508 def __le__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'bool2': return intrinsic("cmp.__le__.long2", bool2, self, _other) # type: ignore
+1509 @func(inline='always')
+1510 def __gt__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'bool2': return intrinsic("cmp.__gt__.long2", bool2, self, _other) # type: ignore
+1511 @func(inline='always')
+1512 def __ge__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'bool2': return intrinsic("cmp.__ge__.long2", bool2, self, _other) # type: ignore
+1513 @func(inline='always')
+1514 def __eq__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'bool2': return intrinsic("cmp.__eq__.long2", bool2, self, _other) # type: ignore
+1515 @func(inline='always')
+1516 def __ne__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'bool2': return intrinsic("cmp.__ne__.long2", bool2, self, _other) # type: ignore
+1517 @func(inline='always')
+1518 def __floordiv__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__floordiv__.long2", long2, self, _other)
+1519 @func(inline='always')
+1520 def __rfloordiv__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__rfloordiv__.long2", long2, self, _other)
+1521 @func(inline='always')
+1522 def __ifloordiv__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__ifloordiv__.long2", long2, byref(self), _other)
+1523 @func(inline='always')
+1524 def __lshift__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__lshift__.long2", long2, self, _other)
+1525 @func(inline='always')
+1526 def __rlshift__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__rlshift__.long2", long2, self, _other)
+1527 @func(inline='always')
+1528 def __ilshift__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__ilshift__.long2", long2, byref(self), _other)
+1529 @func(inline='always')
+1530 def __rshift__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__rshift__.long2", long2, self, _other)
+1531 @func(inline='always')
+1532 def __rrshift__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__rrshift__.long2", long2, self, _other)
+1533 @func(inline='always')
+1534 def __irshift__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__irshift__.long2", long2, byref(self), _other)
+1535 @func(inline='always')
+1536 def __and__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__and__.long2", long2, self, _other)
+1537 @func(inline='always')
+1538 def __rand__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__rand__.long2", long2, self, _other)
+1539 @func(inline='always')
+1540 def __iand__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__iand__.long2", long2, byref(self), _other)
+1541 @func(inline='always')
+1542 def __or__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__or__.long2", long2, self, _other)
+1543 @func(inline='always')
+1544 def __ror__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__ror__.long2", long2, self, _other)
+1545 @func(inline='always')
+1546 def __ior__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__ior__.long2", long2, byref(self), _other)
+1547 @func(inline='always')
+1548 def __xor__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__xor__.long2", long2, self, _other)
+1549 @func(inline='always')
+1550 def __rxor__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__rxor__.long2", long2, self, _other)
+1551 @func(inline='always')
+1552 def __ixor__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__ixor__.long2", long2, byref(self), _other)
+1553
+1554@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[u64]), 2))
+1555class ulong2:
+1556 x: u64
+1557 y: u64
+1558 def __init__(self, x: tp.Union['u64', IntLiteral] = IntLiteral(), y: tp.Union['u64', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.ulong2", ulong2, x, y)
+1559 @func(inline='always')
+1560 def __add__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__add__.ulong2", ulong2, self, _other)
+1561 @func(inline='always')
+1562 def __radd__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__radd__.ulong2", ulong2, self, _other)
+1563 @func(inline='always')
+1564 def __iadd__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__iadd__.ulong2", ulong2, byref(self), _other)
+1565 @func(inline='always')
+1566 def __sub__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__sub__.ulong2", ulong2, self, _other)
+1567 @func(inline='always')
+1568 def __rsub__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__rsub__.ulong2", ulong2, self, _other)
+1569 @func(inline='always')
+1570 def __isub__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__isub__.ulong2", ulong2, byref(self), _other)
+1571 @func(inline='always')
+1572 def __mul__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__mul__.ulong2", ulong2, self, _other)
+1573 @func(inline='always')
+1574 def __rmul__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__rmul__.ulong2", ulong2, self, _other)
+1575 @func(inline='always')
+1576 def __imul__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__imul__.ulong2", ulong2, byref(self), _other)
+1577 @func(inline='always')
+1578 def __mod__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__mod__.ulong2", ulong2, self, _other)
+1579 @func(inline='always')
+1580 def __rmod__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__rmod__.ulong2", ulong2, self, _other)
+1581 @func(inline='always')
+1582 def __imod__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__imod__.ulong2", ulong2, byref(self), _other)
+1583 @func(inline='always')
+1584 def __lt__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'bool2': return intrinsic("cmp.__lt__.ulong2", bool2, self, _other) # type: ignore
+1585 @func(inline='always')
+1586 def __le__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'bool2': return intrinsic("cmp.__le__.ulong2", bool2, self, _other) # type: ignore
+1587 @func(inline='always')
+1588 def __gt__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'bool2': return intrinsic("cmp.__gt__.ulong2", bool2, self, _other) # type: ignore
+1589 @func(inline='always')
+1590 def __ge__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'bool2': return intrinsic("cmp.__ge__.ulong2", bool2, self, _other) # type: ignore
+1591 @func(inline='always')
+1592 def __eq__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'bool2': return intrinsic("cmp.__eq__.ulong2", bool2, self, _other) # type: ignore
+1593 @func(inline='always')
+1594 def __ne__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'bool2': return intrinsic("cmp.__ne__.ulong2", bool2, self, _other) # type: ignore
+1595 @func(inline='always')
+1596 def __floordiv__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__floordiv__.ulong2", ulong2, self, _other)
+1597 @func(inline='always')
+1598 def __rfloordiv__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__rfloordiv__.ulong2", ulong2, self, _other)
+1599 @func(inline='always')
+1600 def __ifloordiv__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__ifloordiv__.ulong2", ulong2, byref(self), _other)
+1601 @func(inline='always')
+1602 def __lshift__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__lshift__.ulong2", ulong2, self, _other)
+1603 @func(inline='always')
+1604 def __rlshift__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__rlshift__.ulong2", ulong2, self, _other)
+1605 @func(inline='always')
+1606 def __ilshift__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__ilshift__.ulong2", ulong2, byref(self), _other)
+1607 @func(inline='always')
+1608 def __rshift__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__rshift__.ulong2", ulong2, self, _other)
+1609 @func(inline='always')
+1610 def __rrshift__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__rrshift__.ulong2", ulong2, self, _other)
+1611 @func(inline='always')
+1612 def __irshift__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__irshift__.ulong2", ulong2, byref(self), _other)
+1613 @func(inline='always')
+1614 def __and__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__and__.ulong2", ulong2, self, _other)
+1615 @func(inline='always')
+1616 def __rand__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__rand__.ulong2", ulong2, self, _other)
+1617 @func(inline='always')
+1618 def __iand__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__iand__.ulong2", ulong2, byref(self), _other)
+1619 @func(inline='always')
+1620 def __or__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__or__.ulong2", ulong2, self, _other)
+1621 @func(inline='always')
+1622 def __ror__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__ror__.ulong2", ulong2, self, _other)
+1623 @func(inline='always')
+1624 def __ior__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__ior__.ulong2", ulong2, byref(self), _other)
+1625 @func(inline='always')
+1626 def __xor__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__xor__.ulong2", ulong2, self, _other)
+1627 @func(inline='always')
+1628 def __rxor__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__rxor__.ulong2", ulong2, self, _other)
+1629 @func(inline='always')
+1630 def __ixor__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__ixor__.ulong2", ulong2, byref(self), _other)
+1631
+1632@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[bool]), 3))
+1633class bool3:
+1634 x: bool
+1635 y: bool
+1636 z: bool
+1637 def __init__(self, x: tp.Union['bool', bool] = False, y: tp.Union['bool', bool] = False, z: tp.Union['bool', bool] = False) -> None: self = intrinsic("init.bool3", bool3, x, y, z)
+1638 @func(inline='always')
+1639 def __eq__(self, _other: tp.Union['bool3', bool, bool]) -> 'bool3': return intrinsic("cmp.__eq__.bool3", bool3, self, _other) # type: ignore
+1640 @func(inline='always')
+1641 def __ne__(self, _other: tp.Union['bool3', bool, bool]) -> 'bool3': return intrinsic("cmp.__ne__.bool3", bool3, self, _other) # type: ignore
+1642 @func(inline='always')
+1643 def __and__(self, _other: tp.Union['bool3', bool, bool]) -> 'bool3': return intrinsic("binop.__and__.bool3", bool3, self, _other)
+1644 @func(inline='always')
+1645 def __rand__(self, _other: tp.Union['bool3', bool, bool]) -> 'bool3': return intrinsic("binop.__rand__.bool3", bool3, self, _other)
+1646 @func(inline='always')
+1647 def __iand__(self, _other: tp.Union['bool3', bool, bool]) -> 'bool3': return intrinsic("binop.__iand__.bool3", bool3, byref(self), _other)
+1648 @func(inline='always')
+1649 def __or__(self, _other: tp.Union['bool3', bool, bool]) -> 'bool3': return intrinsic("binop.__or__.bool3", bool3, self, _other)
+1650 @func(inline='always')
+1651 def __ror__(self, _other: tp.Union['bool3', bool, bool]) -> 'bool3': return intrinsic("binop.__ror__.bool3", bool3, self, _other)
+1652 @func(inline='always')
+1653 def __ior__(self, _other: tp.Union['bool3', bool, bool]) -> 'bool3': return intrinsic("binop.__ior__.bool3", bool3, byref(self), _other)
+1654 @func(inline='always')
+1655 def __xor__(self, _other: tp.Union['bool3', bool, bool]) -> 'bool3': return intrinsic("binop.__xor__.bool3", bool3, self, _other)
+1656 @func(inline='always')
+1657 def __rxor__(self, _other: tp.Union['bool3', bool, bool]) -> 'bool3': return intrinsic("binop.__rxor__.bool3", bool3, self, _other)
+1658 @func(inline='always')
+1659 def __ixor__(self, _other: tp.Union['bool3', bool, bool]) -> 'bool3': return intrinsic("binop.__ixor__.bool3", bool3, byref(self), _other)
+1660
+1661@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[f32]), 3))
+1662class float3:
+1663 x: f32
+1664 y: f32
+1665 z: f32
+1666 def __init__(self, x: tp.Union['f32', FloatLiteral] = FloatLiteral(), y: tp.Union['f32', FloatLiteral] = FloatLiteral(), z: tp.Union['f32', FloatLiteral] = FloatLiteral()) -> None: self = intrinsic("init.float3", float3, x, y, z)
+1667 @func(inline='always')
+1668 def __add__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__add__.float3", float3, self, _other)
+1669 @func(inline='always')
+1670 def __radd__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__radd__.float3", float3, self, _other)
+1671 @func(inline='always')
+1672 def __iadd__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__iadd__.float3", float3, byref(self), _other)
+1673 @func(inline='always')
+1674 def __sub__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__sub__.float3", float3, self, _other)
+1675 @func(inline='always')
+1676 def __rsub__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__rsub__.float3", float3, self, _other)
+1677 @func(inline='always')
+1678 def __isub__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__isub__.float3", float3, byref(self), _other)
+1679 @func(inline='always')
+1680 def __mul__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__mul__.float3", float3, self, _other)
+1681 @func(inline='always')
+1682 def __rmul__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__rmul__.float3", float3, self, _other)
+1683 @func(inline='always')
+1684 def __imul__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__imul__.float3", float3, byref(self), _other)
+1685 @func(inline='always')
+1686 def __mod__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__mod__.float3", float3, self, _other)
+1687 @func(inline='always')
+1688 def __rmod__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__rmod__.float3", float3, self, _other)
+1689 @func(inline='always')
+1690 def __imod__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__imod__.float3", float3, byref(self), _other)
+1691 @func(inline='always')
+1692 def __lt__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'bool3': return intrinsic("cmp.__lt__.float3", bool3, self, _other) # type: ignore
+1693 @func(inline='always')
+1694 def __le__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'bool3': return intrinsic("cmp.__le__.float3", bool3, self, _other) # type: ignore
+1695 @func(inline='always')
+1696 def __gt__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'bool3': return intrinsic("cmp.__gt__.float3", bool3, self, _other) # type: ignore
+1697 @func(inline='always')
+1698 def __ge__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'bool3': return intrinsic("cmp.__ge__.float3", bool3, self, _other) # type: ignore
+1699 @func(inline='always')
+1700 def __eq__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'bool3': return intrinsic("cmp.__eq__.float3", bool3, self, _other) # type: ignore
+1701 @func(inline='always')
+1702 def __ne__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'bool3': return intrinsic("cmp.__ne__.float3", bool3, self, _other) # type: ignore
+1703 @func(inline='always')
+1704 def __truediv__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__truediv__.float3", float3, self, _other)
+1705 @func(inline='always')
+1706 def __rtruediv__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__rtruediv__.float3", float3, self, _other)
+1707 @func(inline='always')
+1708 def __itruediv__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__itruediv__.float3", float3, byref(self), _other)
+1709 @func(inline='always')
+1710 def __pow__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__pow__.float3", float3, self, _other)
+1711 @func(inline='always')
+1712 def __rpow__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__rpow__.float3", float3, self, _other)
+1713 @func(inline='always')
+1714 def __ipow__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__ipow__.float3", float3, byref(self), _other)
+1715 @func(inline='always')
+1716 def __floordiv__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__floordiv__.float3", float3, self, _other)
+1717 @func(inline='always')
+1718 def __rfloordiv__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__rfloordiv__.float3", float3, self, _other)
+1719
+1720@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[f64]), 3))
+1721class double3:
+1722 x: f64
+1723 y: f64
+1724 z: f64
+1725 def __init__(self, x: tp.Union['f64', FloatLiteral] = FloatLiteral(), y: tp.Union['f64', FloatLiteral] = FloatLiteral(), z: tp.Union['f64', FloatLiteral] = FloatLiteral()) -> None: self = intrinsic("init.double3", double3, x, y, z)
+1726 @func(inline='always')
+1727 def __add__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__add__.double3", double3, self, _other)
+1728 @func(inline='always')
+1729 def __radd__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__radd__.double3", double3, self, _other)
+1730 @func(inline='always')
+1731 def __iadd__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__iadd__.double3", double3, byref(self), _other)
+1732 @func(inline='always')
+1733 def __sub__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__sub__.double3", double3, self, _other)
+1734 @func(inline='always')
+1735 def __rsub__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__rsub__.double3", double3, self, _other)
+1736 @func(inline='always')
+1737 def __isub__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__isub__.double3", double3, byref(self), _other)
+1738 @func(inline='always')
+1739 def __mul__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__mul__.double3", double3, self, _other)
+1740 @func(inline='always')
+1741 def __rmul__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__rmul__.double3", double3, self, _other)
+1742 @func(inline='always')
+1743 def __imul__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__imul__.double3", double3, byref(self), _other)
+1744 @func(inline='always')
+1745 def __mod__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__mod__.double3", double3, self, _other)
+1746 @func(inline='always')
+1747 def __rmod__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__rmod__.double3", double3, self, _other)
+1748 @func(inline='always')
+1749 def __imod__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__imod__.double3", double3, byref(self), _other)
+1750 @func(inline='always')
+1751 def __lt__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'bool3': return intrinsic("cmp.__lt__.double3", bool3, self, _other) # type: ignore
+1752 @func(inline='always')
+1753 def __le__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'bool3': return intrinsic("cmp.__le__.double3", bool3, self, _other) # type: ignore
+1754 @func(inline='always')
+1755 def __gt__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'bool3': return intrinsic("cmp.__gt__.double3", bool3, self, _other) # type: ignore
+1756 @func(inline='always')
+1757 def __ge__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'bool3': return intrinsic("cmp.__ge__.double3", bool3, self, _other) # type: ignore
+1758 @func(inline='always')
+1759 def __eq__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'bool3': return intrinsic("cmp.__eq__.double3", bool3, self, _other) # type: ignore
+1760 @func(inline='always')
+1761 def __ne__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'bool3': return intrinsic("cmp.__ne__.double3", bool3, self, _other) # type: ignore
+1762 @func(inline='always')
+1763 def __truediv__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__truediv__.double3", double3, self, _other)
+1764 @func(inline='always')
+1765 def __rtruediv__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__rtruediv__.double3", double3, self, _other)
+1766 @func(inline='always')
+1767 def __itruediv__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__itruediv__.double3", double3, byref(self), _other)
+1768 @func(inline='always')
+1769 def __pow__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__pow__.double3", double3, self, _other)
+1770 @func(inline='always')
+1771 def __rpow__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__rpow__.double3", double3, self, _other)
+1772 @func(inline='always')
+1773 def __ipow__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__ipow__.double3", double3, byref(self), _other)
+1774 @func(inline='always')
+1775 def __floordiv__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__floordiv__.double3", double3, self, _other)
+1776 @func(inline='always')
+1777 def __rfloordiv__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__rfloordiv__.double3", double3, self, _other)
+1778
+1779@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[i8]), 3))
+1780class byte3:
+1781 x: i8
+1782 y: i8
+1783 z: i8
+1784 def __init__(self, x: tp.Union['i8', IntLiteral] = IntLiteral(), y: tp.Union['i8', IntLiteral] = IntLiteral(), z: tp.Union['i8', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.byte3", byte3, x, y, z)
+1785 @func(inline='always')
+1786 def __add__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__add__.byte3", byte3, self, _other)
+1787 @func(inline='always')
+1788 def __radd__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__radd__.byte3", byte3, self, _other)
+1789 @func(inline='always')
+1790 def __iadd__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__iadd__.byte3", byte3, byref(self), _other)
+1791 @func(inline='always')
+1792 def __sub__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__sub__.byte3", byte3, self, _other)
+1793 @func(inline='always')
+1794 def __rsub__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__rsub__.byte3", byte3, self, _other)
+1795 @func(inline='always')
+1796 def __isub__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__isub__.byte3", byte3, byref(self), _other)
+1797 @func(inline='always')
+1798 def __mul__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__mul__.byte3", byte3, self, _other)
+1799 @func(inline='always')
+1800 def __rmul__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__rmul__.byte3", byte3, self, _other)
+1801 @func(inline='always')
+1802 def __imul__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__imul__.byte3", byte3, byref(self), _other)
+1803 @func(inline='always')
+1804 def __mod__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__mod__.byte3", byte3, self, _other)
+1805 @func(inline='always')
+1806 def __rmod__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__rmod__.byte3", byte3, self, _other)
+1807 @func(inline='always')
+1808 def __imod__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__imod__.byte3", byte3, byref(self), _other)
+1809 @func(inline='always')
+1810 def __lt__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'bool3': return intrinsic("cmp.__lt__.byte3", bool3, self, _other) # type: ignore
+1811 @func(inline='always')
+1812 def __le__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'bool3': return intrinsic("cmp.__le__.byte3", bool3, self, _other) # type: ignore
+1813 @func(inline='always')
+1814 def __gt__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'bool3': return intrinsic("cmp.__gt__.byte3", bool3, self, _other) # type: ignore
+1815 @func(inline='always')
+1816 def __ge__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'bool3': return intrinsic("cmp.__ge__.byte3", bool3, self, _other) # type: ignore
+1817 @func(inline='always')
+1818 def __eq__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'bool3': return intrinsic("cmp.__eq__.byte3", bool3, self, _other) # type: ignore
+1819 @func(inline='always')
+1820 def __ne__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'bool3': return intrinsic("cmp.__ne__.byte3", bool3, self, _other) # type: ignore
+1821 @func(inline='always')
+1822 def __floordiv__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__floordiv__.byte3", byte3, self, _other)
+1823 @func(inline='always')
+1824 def __rfloordiv__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__rfloordiv__.byte3", byte3, self, _other)
+1825 @func(inline='always')
+1826 def __ifloordiv__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__ifloordiv__.byte3", byte3, byref(self), _other)
+1827 @func(inline='always')
+1828 def __lshift__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__lshift__.byte3", byte3, self, _other)
+1829 @func(inline='always')
+1830 def __rlshift__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__rlshift__.byte3", byte3, self, _other)
+1831 @func(inline='always')
+1832 def __ilshift__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__ilshift__.byte3", byte3, byref(self), _other)
+1833 @func(inline='always')
+1834 def __rshift__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__rshift__.byte3", byte3, self, _other)
+1835 @func(inline='always')
+1836 def __rrshift__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__rrshift__.byte3", byte3, self, _other)
+1837 @func(inline='always')
+1838 def __irshift__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__irshift__.byte3", byte3, byref(self), _other)
+1839 @func(inline='always')
+1840 def __and__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__and__.byte3", byte3, self, _other)
+1841 @func(inline='always')
+1842 def __rand__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__rand__.byte3", byte3, self, _other)
+1843 @func(inline='always')
+1844 def __iand__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__iand__.byte3", byte3, byref(self), _other)
+1845 @func(inline='always')
+1846 def __or__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__or__.byte3", byte3, self, _other)
+1847 @func(inline='always')
+1848 def __ror__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__ror__.byte3", byte3, self, _other)
+1849 @func(inline='always')
+1850 def __ior__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__ior__.byte3", byte3, byref(self), _other)
+1851 @func(inline='always')
+1852 def __xor__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__xor__.byte3", byte3, self, _other)
+1853 @func(inline='always')
+1854 def __rxor__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__rxor__.byte3", byte3, self, _other)
+1855 @func(inline='always')
+1856 def __ixor__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__ixor__.byte3", byte3, byref(self), _other)
+1857
+1858@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[u8]), 3))
+1859class ubyte3:
+1860 x: u8
+1861 y: u8
+1862 z: u8
+1863 def __init__(self, x: tp.Union['u8', IntLiteral] = IntLiteral(), y: tp.Union['u8', IntLiteral] = IntLiteral(), z: tp.Union['u8', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.ubyte3", ubyte3, x, y, z)
+1864 @func(inline='always')
+1865 def __add__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__add__.ubyte3", ubyte3, self, _other)
+1866 @func(inline='always')
+1867 def __radd__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__radd__.ubyte3", ubyte3, self, _other)
+1868 @func(inline='always')
+1869 def __iadd__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__iadd__.ubyte3", ubyte3, byref(self), _other)
+1870 @func(inline='always')
+1871 def __sub__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__sub__.ubyte3", ubyte3, self, _other)
+1872 @func(inline='always')
+1873 def __rsub__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__rsub__.ubyte3", ubyte3, self, _other)
+1874 @func(inline='always')
+1875 def __isub__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__isub__.ubyte3", ubyte3, byref(self), _other)
+1876 @func(inline='always')
+1877 def __mul__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__mul__.ubyte3", ubyte3, self, _other)
+1878 @func(inline='always')
+1879 def __rmul__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__rmul__.ubyte3", ubyte3, self, _other)
+1880 @func(inline='always')
+1881 def __imul__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__imul__.ubyte3", ubyte3, byref(self), _other)
+1882 @func(inline='always')
+1883 def __mod__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__mod__.ubyte3", ubyte3, self, _other)
+1884 @func(inline='always')
+1885 def __rmod__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__rmod__.ubyte3", ubyte3, self, _other)
+1886 @func(inline='always')
+1887 def __imod__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__imod__.ubyte3", ubyte3, byref(self), _other)
+1888 @func(inline='always')
+1889 def __lt__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'bool3': return intrinsic("cmp.__lt__.ubyte3", bool3, self, _other) # type: ignore
+1890 @func(inline='always')
+1891 def __le__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'bool3': return intrinsic("cmp.__le__.ubyte3", bool3, self, _other) # type: ignore
+1892 @func(inline='always')
+1893 def __gt__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'bool3': return intrinsic("cmp.__gt__.ubyte3", bool3, self, _other) # type: ignore
+1894 @func(inline='always')
+1895 def __ge__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'bool3': return intrinsic("cmp.__ge__.ubyte3", bool3, self, _other) # type: ignore
+1896 @func(inline='always')
+1897 def __eq__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'bool3': return intrinsic("cmp.__eq__.ubyte3", bool3, self, _other) # type: ignore
+1898 @func(inline='always')
+1899 def __ne__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'bool3': return intrinsic("cmp.__ne__.ubyte3", bool3, self, _other) # type: ignore
+1900 @func(inline='always')
+1901 def __floordiv__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__floordiv__.ubyte3", ubyte3, self, _other)
+1902 @func(inline='always')
+1903 def __rfloordiv__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__rfloordiv__.ubyte3", ubyte3, self, _other)
+1904 @func(inline='always')
+1905 def __ifloordiv__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__ifloordiv__.ubyte3", ubyte3, byref(self), _other)
+1906 @func(inline='always')
+1907 def __lshift__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__lshift__.ubyte3", ubyte3, self, _other)
+1908 @func(inline='always')
+1909 def __rlshift__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__rlshift__.ubyte3", ubyte3, self, _other)
+1910 @func(inline='always')
+1911 def __ilshift__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__ilshift__.ubyte3", ubyte3, byref(self), _other)
+1912 @func(inline='always')
+1913 def __rshift__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__rshift__.ubyte3", ubyte3, self, _other)
+1914 @func(inline='always')
+1915 def __rrshift__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__rrshift__.ubyte3", ubyte3, self, _other)
+1916 @func(inline='always')
+1917 def __irshift__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__irshift__.ubyte3", ubyte3, byref(self), _other)
+1918 @func(inline='always')
+1919 def __and__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__and__.ubyte3", ubyte3, self, _other)
+1920 @func(inline='always')
+1921 def __rand__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__rand__.ubyte3", ubyte3, self, _other)
+1922 @func(inline='always')
+1923 def __iand__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__iand__.ubyte3", ubyte3, byref(self), _other)
+1924 @func(inline='always')
+1925 def __or__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__or__.ubyte3", ubyte3, self, _other)
+1926 @func(inline='always')
+1927 def __ror__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__ror__.ubyte3", ubyte3, self, _other)
+1928 @func(inline='always')
+1929 def __ior__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__ior__.ubyte3", ubyte3, byref(self), _other)
+1930 @func(inline='always')
+1931 def __xor__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__xor__.ubyte3", ubyte3, self, _other)
+1932 @func(inline='always')
+1933 def __rxor__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__rxor__.ubyte3", ubyte3, self, _other)
+1934 @func(inline='always')
+1935 def __ixor__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__ixor__.ubyte3", ubyte3, byref(self), _other)
+1936
+1937@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[i16]), 3))
+1938class short3:
+1939 x: i16
+1940 y: i16
+1941 z: i16
+1942 def __init__(self, x: tp.Union['i16', IntLiteral] = IntLiteral(), y: tp.Union['i16', IntLiteral] = IntLiteral(), z: tp.Union['i16', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.short3", short3, x, y, z)
+1943 @func(inline='always')
+1944 def __add__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__add__.short3", short3, self, _other)
+1945 @func(inline='always')
+1946 def __radd__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__radd__.short3", short3, self, _other)
+1947 @func(inline='always')
+1948 def __iadd__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__iadd__.short3", short3, byref(self), _other)
+1949 @func(inline='always')
+1950 def __sub__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__sub__.short3", short3, self, _other)
+1951 @func(inline='always')
+1952 def __rsub__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__rsub__.short3", short3, self, _other)
+1953 @func(inline='always')
+1954 def __isub__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__isub__.short3", short3, byref(self), _other)
+1955 @func(inline='always')
+1956 def __mul__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__mul__.short3", short3, self, _other)
+1957 @func(inline='always')
+1958 def __rmul__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__rmul__.short3", short3, self, _other)
+1959 @func(inline='always')
+1960 def __imul__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__imul__.short3", short3, byref(self), _other)
+1961 @func(inline='always')
+1962 def __mod__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__mod__.short3", short3, self, _other)
+1963 @func(inline='always')
+1964 def __rmod__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__rmod__.short3", short3, self, _other)
+1965 @func(inline='always')
+1966 def __imod__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__imod__.short3", short3, byref(self), _other)
+1967 @func(inline='always')
+1968 def __lt__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'bool3': return intrinsic("cmp.__lt__.short3", bool3, self, _other) # type: ignore
+1969 @func(inline='always')
+1970 def __le__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'bool3': return intrinsic("cmp.__le__.short3", bool3, self, _other) # type: ignore
+1971 @func(inline='always')
+1972 def __gt__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'bool3': return intrinsic("cmp.__gt__.short3", bool3, self, _other) # type: ignore
+1973 @func(inline='always')
+1974 def __ge__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'bool3': return intrinsic("cmp.__ge__.short3", bool3, self, _other) # type: ignore
+1975 @func(inline='always')
+1976 def __eq__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'bool3': return intrinsic("cmp.__eq__.short3", bool3, self, _other) # type: ignore
+1977 @func(inline='always')
+1978 def __ne__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'bool3': return intrinsic("cmp.__ne__.short3", bool3, self, _other) # type: ignore
+1979 @func(inline='always')
+1980 def __floordiv__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__floordiv__.short3", short3, self, _other)
+1981 @func(inline='always')
+1982 def __rfloordiv__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__rfloordiv__.short3", short3, self, _other)
+1983 @func(inline='always')
+1984 def __ifloordiv__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__ifloordiv__.short3", short3, byref(self), _other)
+1985 @func(inline='always')
+1986 def __lshift__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__lshift__.short3", short3, self, _other)
+1987 @func(inline='always')
+1988 def __rlshift__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__rlshift__.short3", short3, self, _other)
+1989 @func(inline='always')
+1990 def __ilshift__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__ilshift__.short3", short3, byref(self), _other)
+1991 @func(inline='always')
+1992 def __rshift__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__rshift__.short3", short3, self, _other)
+1993 @func(inline='always')
+1994 def __rrshift__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__rrshift__.short3", short3, self, _other)
+1995 @func(inline='always')
+1996 def __irshift__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__irshift__.short3", short3, byref(self), _other)
+1997 @func(inline='always')
+1998 def __and__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__and__.short3", short3, self, _other)
+1999 @func(inline='always')
+2000 def __rand__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__rand__.short3", short3, self, _other)
+2001 @func(inline='always')
+2002 def __iand__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__iand__.short3", short3, byref(self), _other)
+2003 @func(inline='always')
+2004 def __or__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__or__.short3", short3, self, _other)
+2005 @func(inline='always')
+2006 def __ror__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__ror__.short3", short3, self, _other)
+2007 @func(inline='always')
+2008 def __ior__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__ior__.short3", short3, byref(self), _other)
+2009 @func(inline='always')
+2010 def __xor__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__xor__.short3", short3, self, _other)
+2011 @func(inline='always')
+2012 def __rxor__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__rxor__.short3", short3, self, _other)
+2013 @func(inline='always')
+2014 def __ixor__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__ixor__.short3", short3, byref(self), _other)
+2015
+2016@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[u16]), 3))
+2017class ushort3:
+2018 x: u16
+2019 y: u16
+2020 z: u16
+2021 def __init__(self, x: tp.Union['u16', IntLiteral] = IntLiteral(), y: tp.Union['u16', IntLiteral] = IntLiteral(), z: tp.Union['u16', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.ushort3", ushort3, x, y, z)
+2022 @func(inline='always')
+2023 def __add__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__add__.ushort3", ushort3, self, _other)
+2024 @func(inline='always')
+2025 def __radd__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__radd__.ushort3", ushort3, self, _other)
+2026 @func(inline='always')
+2027 def __iadd__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__iadd__.ushort3", ushort3, byref(self), _other)
+2028 @func(inline='always')
+2029 def __sub__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__sub__.ushort3", ushort3, self, _other)
+2030 @func(inline='always')
+2031 def __rsub__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__rsub__.ushort3", ushort3, self, _other)
+2032 @func(inline='always')
+2033 def __isub__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__isub__.ushort3", ushort3, byref(self), _other)
+2034 @func(inline='always')
+2035 def __mul__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__mul__.ushort3", ushort3, self, _other)
+2036 @func(inline='always')
+2037 def __rmul__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__rmul__.ushort3", ushort3, self, _other)
+2038 @func(inline='always')
+2039 def __imul__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__imul__.ushort3", ushort3, byref(self), _other)
+2040 @func(inline='always')
+2041 def __mod__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__mod__.ushort3", ushort3, self, _other)
+2042 @func(inline='always')
+2043 def __rmod__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__rmod__.ushort3", ushort3, self, _other)
+2044 @func(inline='always')
+2045 def __imod__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__imod__.ushort3", ushort3, byref(self), _other)
+2046 @func(inline='always')
+2047 def __lt__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'bool3': return intrinsic("cmp.__lt__.ushort3", bool3, self, _other) # type: ignore
+2048 @func(inline='always')
+2049 def __le__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'bool3': return intrinsic("cmp.__le__.ushort3", bool3, self, _other) # type: ignore
+2050 @func(inline='always')
+2051 def __gt__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'bool3': return intrinsic("cmp.__gt__.ushort3", bool3, self, _other) # type: ignore
+2052 @func(inline='always')
+2053 def __ge__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'bool3': return intrinsic("cmp.__ge__.ushort3", bool3, self, _other) # type: ignore
+2054 @func(inline='always')
+2055 def __eq__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'bool3': return intrinsic("cmp.__eq__.ushort3", bool3, self, _other) # type: ignore
+2056 @func(inline='always')
+2057 def __ne__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'bool3': return intrinsic("cmp.__ne__.ushort3", bool3, self, _other) # type: ignore
+2058 @func(inline='always')
+2059 def __floordiv__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__floordiv__.ushort3", ushort3, self, _other)
+2060 @func(inline='always')
+2061 def __rfloordiv__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__rfloordiv__.ushort3", ushort3, self, _other)
+2062 @func(inline='always')
+2063 def __ifloordiv__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__ifloordiv__.ushort3", ushort3, byref(self), _other)
+2064 @func(inline='always')
+2065 def __lshift__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__lshift__.ushort3", ushort3, self, _other)
+2066 @func(inline='always')
+2067 def __rlshift__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__rlshift__.ushort3", ushort3, self, _other)
+2068 @func(inline='always')
+2069 def __ilshift__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__ilshift__.ushort3", ushort3, byref(self), _other)
+2070 @func(inline='always')
+2071 def __rshift__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__rshift__.ushort3", ushort3, self, _other)
+2072 @func(inline='always')
+2073 def __rrshift__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__rrshift__.ushort3", ushort3, self, _other)
+2074 @func(inline='always')
+2075 def __irshift__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__irshift__.ushort3", ushort3, byref(self), _other)
+2076 @func(inline='always')
+2077 def __and__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__and__.ushort3", ushort3, self, _other)
+2078 @func(inline='always')
+2079 def __rand__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__rand__.ushort3", ushort3, self, _other)
+2080 @func(inline='always')
+2081 def __iand__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__iand__.ushort3", ushort3, byref(self), _other)
+2082 @func(inline='always')
+2083 def __or__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__or__.ushort3", ushort3, self, _other)
+2084 @func(inline='always')
+2085 def __ror__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__ror__.ushort3", ushort3, self, _other)
+2086 @func(inline='always')
+2087 def __ior__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__ior__.ushort3", ushort3, byref(self), _other)
+2088 @func(inline='always')
+2089 def __xor__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__xor__.ushort3", ushort3, self, _other)
+2090 @func(inline='always')
+2091 def __rxor__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__rxor__.ushort3", ushort3, self, _other)
+2092 @func(inline='always')
+2093 def __ixor__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__ixor__.ushort3", ushort3, byref(self), _other)
+2094
+2095@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[i32]), 3))
+2096class int3:
+2097 x: i32
+2098 y: i32
+2099 z: i32
+2100 def __init__(self, x: tp.Union['i32', IntLiteral] = IntLiteral(), y: tp.Union['i32', IntLiteral] = IntLiteral(), z: tp.Union['i32', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.int3", int3, x, y, z)
+2101 @func(inline='always')
+2102 def __add__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__add__.int3", int3, self, _other)
+2103 @func(inline='always')
+2104 def __radd__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__radd__.int3", int3, self, _other)
+2105 @func(inline='always')
+2106 def __iadd__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__iadd__.int3", int3, byref(self), _other)
+2107 @func(inline='always')
+2108 def __sub__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__sub__.int3", int3, self, _other)
+2109 @func(inline='always')
+2110 def __rsub__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__rsub__.int3", int3, self, _other)
+2111 @func(inline='always')
+2112 def __isub__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__isub__.int3", int3, byref(self), _other)
+2113 @func(inline='always')
+2114 def __mul__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__mul__.int3", int3, self, _other)
+2115 @func(inline='always')
+2116 def __rmul__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__rmul__.int3", int3, self, _other)
+2117 @func(inline='always')
+2118 def __imul__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__imul__.int3", int3, byref(self), _other)
+2119 @func(inline='always')
+2120 def __mod__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__mod__.int3", int3, self, _other)
+2121 @func(inline='always')
+2122 def __rmod__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__rmod__.int3", int3, self, _other)
+2123 @func(inline='always')
+2124 def __imod__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__imod__.int3", int3, byref(self), _other)
+2125 @func(inline='always')
+2126 def __lt__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'bool3': return intrinsic("cmp.__lt__.int3", bool3, self, _other) # type: ignore
+2127 @func(inline='always')
+2128 def __le__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'bool3': return intrinsic("cmp.__le__.int3", bool3, self, _other) # type: ignore
+2129 @func(inline='always')
+2130 def __gt__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'bool3': return intrinsic("cmp.__gt__.int3", bool3, self, _other) # type: ignore
+2131 @func(inline='always')
+2132 def __ge__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'bool3': return intrinsic("cmp.__ge__.int3", bool3, self, _other) # type: ignore
+2133 @func(inline='always')
+2134 def __eq__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'bool3': return intrinsic("cmp.__eq__.int3", bool3, self, _other) # type: ignore
+2135 @func(inline='always')
+2136 def __ne__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'bool3': return intrinsic("cmp.__ne__.int3", bool3, self, _other) # type: ignore
+2137 @func(inline='always')
+2138 def __floordiv__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__floordiv__.int3", int3, self, _other)
+2139 @func(inline='always')
+2140 def __rfloordiv__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__rfloordiv__.int3", int3, self, _other)
+2141 @func(inline='always')
+2142 def __ifloordiv__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__ifloordiv__.int3", int3, byref(self), _other)
+2143 @func(inline='always')
+2144 def __lshift__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__lshift__.int3", int3, self, _other)
+2145 @func(inline='always')
+2146 def __rlshift__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__rlshift__.int3", int3, self, _other)
+2147 @func(inline='always')
+2148 def __ilshift__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__ilshift__.int3", int3, byref(self), _other)
+2149 @func(inline='always')
+2150 def __rshift__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__rshift__.int3", int3, self, _other)
+2151 @func(inline='always')
+2152 def __rrshift__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__rrshift__.int3", int3, self, _other)
+2153 @func(inline='always')
+2154 def __irshift__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__irshift__.int3", int3, byref(self), _other)
+2155 @func(inline='always')
+2156 def __and__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__and__.int3", int3, self, _other)
+2157 @func(inline='always')
+2158 def __rand__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__rand__.int3", int3, self, _other)
+2159 @func(inline='always')
+2160 def __iand__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__iand__.int3", int3, byref(self), _other)
+2161 @func(inline='always')
+2162 def __or__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__or__.int3", int3, self, _other)
+2163 @func(inline='always')
+2164 def __ror__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__ror__.int3", int3, self, _other)
+2165 @func(inline='always')
+2166 def __ior__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__ior__.int3", int3, byref(self), _other)
+2167 @func(inline='always')
+2168 def __xor__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__xor__.int3", int3, self, _other)
+2169 @func(inline='always')
+2170 def __rxor__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__rxor__.int3", int3, self, _other)
+2171 @func(inline='always')
+2172 def __ixor__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__ixor__.int3", int3, byref(self), _other)
+2173
+2174@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[u32]), 3))
+2175class uint3:
+2176 x: u32
+2177 y: u32
+2178 z: u32
+2179 def __init__(self, x: tp.Union['u32', IntLiteral] = IntLiteral(), y: tp.Union['u32', IntLiteral] = IntLiteral(), z: tp.Union['u32', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.uint3", uint3, x, y, z)
+2180 @func(inline='always')
+2181 def __add__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__add__.uint3", uint3, self, _other)
+2182 @func(inline='always')
+2183 def __radd__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__radd__.uint3", uint3, self, _other)
+2184 @func(inline='always')
+2185 def __iadd__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__iadd__.uint3", uint3, byref(self), _other)
+2186 @func(inline='always')
+2187 def __sub__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__sub__.uint3", uint3, self, _other)
+2188 @func(inline='always')
+2189 def __rsub__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__rsub__.uint3", uint3, self, _other)
+2190 @func(inline='always')
+2191 def __isub__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__isub__.uint3", uint3, byref(self), _other)
+2192 @func(inline='always')
+2193 def __mul__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__mul__.uint3", uint3, self, _other)
+2194 @func(inline='always')
+2195 def __rmul__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__rmul__.uint3", uint3, self, _other)
+2196 @func(inline='always')
+2197 def __imul__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__imul__.uint3", uint3, byref(self), _other)
+2198 @func(inline='always')
+2199 def __mod__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__mod__.uint3", uint3, self, _other)
+2200 @func(inline='always')
+2201 def __rmod__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__rmod__.uint3", uint3, self, _other)
+2202 @func(inline='always')
+2203 def __imod__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__imod__.uint3", uint3, byref(self), _other)
+2204 @func(inline='always')
+2205 def __lt__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'bool3': return intrinsic("cmp.__lt__.uint3", bool3, self, _other) # type: ignore
+2206 @func(inline='always')
+2207 def __le__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'bool3': return intrinsic("cmp.__le__.uint3", bool3, self, _other) # type: ignore
+2208 @func(inline='always')
+2209 def __gt__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'bool3': return intrinsic("cmp.__gt__.uint3", bool3, self, _other) # type: ignore
+2210 @func(inline='always')
+2211 def __ge__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'bool3': return intrinsic("cmp.__ge__.uint3", bool3, self, _other) # type: ignore
+2212 @func(inline='always')
+2213 def __eq__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'bool3': return intrinsic("cmp.__eq__.uint3", bool3, self, _other) # type: ignore
+2214 @func(inline='always')
+2215 def __ne__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'bool3': return intrinsic("cmp.__ne__.uint3", bool3, self, _other) # type: ignore
+2216 @func(inline='always')
+2217 def __floordiv__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__floordiv__.uint3", uint3, self, _other)
+2218 @func(inline='always')
+2219 def __rfloordiv__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__rfloordiv__.uint3", uint3, self, _other)
+2220 @func(inline='always')
+2221 def __ifloordiv__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__ifloordiv__.uint3", uint3, byref(self), _other)
+2222 @func(inline='always')
+2223 def __lshift__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__lshift__.uint3", uint3, self, _other)
+2224 @func(inline='always')
+2225 def __rlshift__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__rlshift__.uint3", uint3, self, _other)
+2226 @func(inline='always')
+2227 def __ilshift__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__ilshift__.uint3", uint3, byref(self), _other)
+2228 @func(inline='always')
+2229 def __rshift__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__rshift__.uint3", uint3, self, _other)
+2230 @func(inline='always')
+2231 def __rrshift__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__rrshift__.uint3", uint3, self, _other)
+2232 @func(inline='always')
+2233 def __irshift__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__irshift__.uint3", uint3, byref(self), _other)
+2234 @func(inline='always')
+2235 def __and__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__and__.uint3", uint3, self, _other)
+2236 @func(inline='always')
+2237 def __rand__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__rand__.uint3", uint3, self, _other)
+2238 @func(inline='always')
+2239 def __iand__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__iand__.uint3", uint3, byref(self), _other)
+2240 @func(inline='always')
+2241 def __or__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__or__.uint3", uint3, self, _other)
+2242 @func(inline='always')
+2243 def __ror__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__ror__.uint3", uint3, self, _other)
+2244 @func(inline='always')
+2245 def __ior__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__ior__.uint3", uint3, byref(self), _other)
+2246 @func(inline='always')
+2247 def __xor__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__xor__.uint3", uint3, self, _other)
+2248 @func(inline='always')
+2249 def __rxor__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__rxor__.uint3", uint3, self, _other)
+2250 @func(inline='always')
+2251 def __ixor__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__ixor__.uint3", uint3, byref(self), _other)
+2252
+2253@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[i64]), 3))
+2254class long3:
+2255 x: i64
+2256 y: i64
+2257 z: i64
+2258 def __init__(self, x: tp.Union['i64', IntLiteral] = IntLiteral(), y: tp.Union['i64', IntLiteral] = IntLiteral(), z: tp.Union['i64', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.long3", long3, x, y, z)
+2259 @func(inline='always')
+2260 def __add__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__add__.long3", long3, self, _other)
+2261 @func(inline='always')
+2262 def __radd__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__radd__.long3", long3, self, _other)
+2263 @func(inline='always')
+2264 def __iadd__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__iadd__.long3", long3, byref(self), _other)
+2265 @func(inline='always')
+2266 def __sub__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__sub__.long3", long3, self, _other)
+2267 @func(inline='always')
+2268 def __rsub__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__rsub__.long3", long3, self, _other)
+2269 @func(inline='always')
+2270 def __isub__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__isub__.long3", long3, byref(self), _other)
+2271 @func(inline='always')
+2272 def __mul__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__mul__.long3", long3, self, _other)
+2273 @func(inline='always')
+2274 def __rmul__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__rmul__.long3", long3, self, _other)
+2275 @func(inline='always')
+2276 def __imul__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__imul__.long3", long3, byref(self), _other)
+2277 @func(inline='always')
+2278 def __mod__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__mod__.long3", long3, self, _other)
+2279 @func(inline='always')
+2280 def __rmod__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__rmod__.long3", long3, self, _other)
+2281 @func(inline='always')
+2282 def __imod__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__imod__.long3", long3, byref(self), _other)
+2283 @func(inline='always')
+2284 def __lt__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'bool3': return intrinsic("cmp.__lt__.long3", bool3, self, _other) # type: ignore
+2285 @func(inline='always')
+2286 def __le__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'bool3': return intrinsic("cmp.__le__.long3", bool3, self, _other) # type: ignore
+2287 @func(inline='always')
+2288 def __gt__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'bool3': return intrinsic("cmp.__gt__.long3", bool3, self, _other) # type: ignore
+2289 @func(inline='always')
+2290 def __ge__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'bool3': return intrinsic("cmp.__ge__.long3", bool3, self, _other) # type: ignore
+2291 @func(inline='always')
+2292 def __eq__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'bool3': return intrinsic("cmp.__eq__.long3", bool3, self, _other) # type: ignore
+2293 @func(inline='always')
+2294 def __ne__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'bool3': return intrinsic("cmp.__ne__.long3", bool3, self, _other) # type: ignore
+2295 @func(inline='always')
+2296 def __floordiv__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__floordiv__.long3", long3, self, _other)
+2297 @func(inline='always')
+2298 def __rfloordiv__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__rfloordiv__.long3", long3, self, _other)
+2299 @func(inline='always')
+2300 def __ifloordiv__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__ifloordiv__.long3", long3, byref(self), _other)
+2301 @func(inline='always')
+2302 def __lshift__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__lshift__.long3", long3, self, _other)
+2303 @func(inline='always')
+2304 def __rlshift__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__rlshift__.long3", long3, self, _other)
+2305 @func(inline='always')
+2306 def __ilshift__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__ilshift__.long3", long3, byref(self), _other)
+2307 @func(inline='always')
+2308 def __rshift__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__rshift__.long3", long3, self, _other)
+2309 @func(inline='always')
+2310 def __rrshift__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__rrshift__.long3", long3, self, _other)
+2311 @func(inline='always')
+2312 def __irshift__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__irshift__.long3", long3, byref(self), _other)
+2313 @func(inline='always')
+2314 def __and__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__and__.long3", long3, self, _other)
+2315 @func(inline='always')
+2316 def __rand__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__rand__.long3", long3, self, _other)
+2317 @func(inline='always')
+2318 def __iand__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__iand__.long3", long3, byref(self), _other)
+2319 @func(inline='always')
+2320 def __or__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__or__.long3", long3, self, _other)
+2321 @func(inline='always')
+2322 def __ror__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__ror__.long3", long3, self, _other)
+2323 @func(inline='always')
+2324 def __ior__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__ior__.long3", long3, byref(self), _other)
+2325 @func(inline='always')
+2326 def __xor__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__xor__.long3", long3, self, _other)
+2327 @func(inline='always')
+2328 def __rxor__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__rxor__.long3", long3, self, _other)
+2329 @func(inline='always')
+2330 def __ixor__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__ixor__.long3", long3, byref(self), _other)
+2331
+2332@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[u64]), 3))
+2333class ulong3:
+2334 x: u64
+2335 y: u64
+2336 z: u64
+2337 def __init__(self, x: tp.Union['u64', IntLiteral] = IntLiteral(), y: tp.Union['u64', IntLiteral] = IntLiteral(), z: tp.Union['u64', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.ulong3", ulong3, x, y, z)
+2338 @func(inline='always')
+2339 def __add__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__add__.ulong3", ulong3, self, _other)
+2340 @func(inline='always')
+2341 def __radd__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__radd__.ulong3", ulong3, self, _other)
+2342 @func(inline='always')
+2343 def __iadd__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__iadd__.ulong3", ulong3, byref(self), _other)
+2344 @func(inline='always')
+2345 def __sub__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__sub__.ulong3", ulong3, self, _other)
+2346 @func(inline='always')
+2347 def __rsub__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__rsub__.ulong3", ulong3, self, _other)
+2348 @func(inline='always')
+2349 def __isub__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__isub__.ulong3", ulong3, byref(self), _other)
+2350 @func(inline='always')
+2351 def __mul__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__mul__.ulong3", ulong3, self, _other)
+2352 @func(inline='always')
+2353 def __rmul__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__rmul__.ulong3", ulong3, self, _other)
+2354 @func(inline='always')
+2355 def __imul__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__imul__.ulong3", ulong3, byref(self), _other)
+2356 @func(inline='always')
+2357 def __mod__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__mod__.ulong3", ulong3, self, _other)
+2358 @func(inline='always')
+2359 def __rmod__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__rmod__.ulong3", ulong3, self, _other)
+2360 @func(inline='always')
+2361 def __imod__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__imod__.ulong3", ulong3, byref(self), _other)
+2362 @func(inline='always')
+2363 def __lt__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'bool3': return intrinsic("cmp.__lt__.ulong3", bool3, self, _other) # type: ignore
+2364 @func(inline='always')
+2365 def __le__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'bool3': return intrinsic("cmp.__le__.ulong3", bool3, self, _other) # type: ignore
+2366 @func(inline='always')
+2367 def __gt__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'bool3': return intrinsic("cmp.__gt__.ulong3", bool3, self, _other) # type: ignore
+2368 @func(inline='always')
+2369 def __ge__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'bool3': return intrinsic("cmp.__ge__.ulong3", bool3, self, _other) # type: ignore
+2370 @func(inline='always')
+2371 def __eq__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'bool3': return intrinsic("cmp.__eq__.ulong3", bool3, self, _other) # type: ignore
+2372 @func(inline='always')
+2373 def __ne__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'bool3': return intrinsic("cmp.__ne__.ulong3", bool3, self, _other) # type: ignore
+2374 @func(inline='always')
+2375 def __floordiv__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__floordiv__.ulong3", ulong3, self, _other)
+2376 @func(inline='always')
+2377 def __rfloordiv__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__rfloordiv__.ulong3", ulong3, self, _other)
+2378 @func(inline='always')
+2379 def __ifloordiv__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__ifloordiv__.ulong3", ulong3, byref(self), _other)
+2380 @func(inline='always')
+2381 def __lshift__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__lshift__.ulong3", ulong3, self, _other)
+2382 @func(inline='always')
+2383 def __rlshift__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__rlshift__.ulong3", ulong3, self, _other)
+2384 @func(inline='always')
+2385 def __ilshift__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__ilshift__.ulong3", ulong3, byref(self), _other)
+2386 @func(inline='always')
+2387 def __rshift__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__rshift__.ulong3", ulong3, self, _other)
+2388 @func(inline='always')
+2389 def __rrshift__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__rrshift__.ulong3", ulong3, self, _other)
+2390 @func(inline='always')
+2391 def __irshift__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__irshift__.ulong3", ulong3, byref(self), _other)
+2392 @func(inline='always')
+2393 def __and__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__and__.ulong3", ulong3, self, _other)
+2394 @func(inline='always')
+2395 def __rand__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__rand__.ulong3", ulong3, self, _other)
+2396 @func(inline='always')
+2397 def __iand__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__iand__.ulong3", ulong3, byref(self), _other)
+2398 @func(inline='always')
+2399 def __or__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__or__.ulong3", ulong3, self, _other)
+2400 @func(inline='always')
+2401 def __ror__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__ror__.ulong3", ulong3, self, _other)
+2402 @func(inline='always')
+2403 def __ior__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__ior__.ulong3", ulong3, byref(self), _other)
+2404 @func(inline='always')
+2405 def __xor__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__xor__.ulong3", ulong3, self, _other)
+2406 @func(inline='always')
+2407 def __rxor__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__rxor__.ulong3", ulong3, self, _other)
+2408 @func(inline='always')
+2409 def __ixor__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__ixor__.ulong3", ulong3, byref(self), _other)
+2410
+2411@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[bool]), 4))
+2412class bool4:
+2413 x: bool
+2414 y: bool
+2415 z: bool
+2416 w: bool
+2417 def __init__(self, x: tp.Union['bool', bool] = False, y: tp.Union['bool', bool] = False, z: tp.Union['bool', bool] = False, w: tp.Union['bool', bool] = False) -> None: self = intrinsic("init.bool4", bool4, x, y, z, w)
+2418 @func(inline='always')
+2419 def __eq__(self, _other: tp.Union['bool4', bool, bool]) -> 'bool4': return intrinsic("cmp.__eq__.bool4", bool4, self, _other) # type: ignore
+2420 @func(inline='always')
+2421 def __ne__(self, _other: tp.Union['bool4', bool, bool]) -> 'bool4': return intrinsic("cmp.__ne__.bool4", bool4, self, _other) # type: ignore
+2422 @func(inline='always')
+2423 def __and__(self, _other: tp.Union['bool4', bool, bool]) -> 'bool4': return intrinsic("binop.__and__.bool4", bool4, self, _other)
+2424 @func(inline='always')
+2425 def __rand__(self, _other: tp.Union['bool4', bool, bool]) -> 'bool4': return intrinsic("binop.__rand__.bool4", bool4, self, _other)
+2426 @func(inline='always')
+2427 def __iand__(self, _other: tp.Union['bool4', bool, bool]) -> 'bool4': return intrinsic("binop.__iand__.bool4", bool4, byref(self), _other)
+2428 @func(inline='always')
+2429 def __or__(self, _other: tp.Union['bool4', bool, bool]) -> 'bool4': return intrinsic("binop.__or__.bool4", bool4, self, _other)
+2430 @func(inline='always')
+2431 def __ror__(self, _other: tp.Union['bool4', bool, bool]) -> 'bool4': return intrinsic("binop.__ror__.bool4", bool4, self, _other)
+2432 @func(inline='always')
+2433 def __ior__(self, _other: tp.Union['bool4', bool, bool]) -> 'bool4': return intrinsic("binop.__ior__.bool4", bool4, byref(self), _other)
+2434 @func(inline='always')
+2435 def __xor__(self, _other: tp.Union['bool4', bool, bool]) -> 'bool4': return intrinsic("binop.__xor__.bool4", bool4, self, _other)
+2436 @func(inline='always')
+2437 def __rxor__(self, _other: tp.Union['bool4', bool, bool]) -> 'bool4': return intrinsic("binop.__rxor__.bool4", bool4, self, _other)
+2438 @func(inline='always')
+2439 def __ixor__(self, _other: tp.Union['bool4', bool, bool]) -> 'bool4': return intrinsic("binop.__ixor__.bool4", bool4, byref(self), _other)
+2440
+2441@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[f32]), 4))
+2442class float4:
+2443 x: f32
+2444 y: f32
+2445 z: f32
+2446 w: f32
+2447 def __init__(self, x: tp.Union['f32', FloatLiteral] = FloatLiteral(), y: tp.Union['f32', FloatLiteral] = FloatLiteral(), z: tp.Union['f32', FloatLiteral] = FloatLiteral(), w: tp.Union['f32', FloatLiteral] = FloatLiteral()) -> None: self = intrinsic("init.float4", float4, x, y, z, w)
+2448 @func(inline='always')
+2449 def __add__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__add__.float4", float4, self, _other)
+2450 @func(inline='always')
+2451 def __radd__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__radd__.float4", float4, self, _other)
+2452 @func(inline='always')
+2453 def __iadd__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__iadd__.float4", float4, byref(self), _other)
+2454 @func(inline='always')
+2455 def __sub__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__sub__.float4", float4, self, _other)
+2456 @func(inline='always')
+2457 def __rsub__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__rsub__.float4", float4, self, _other)
+2458 @func(inline='always')
+2459 def __isub__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__isub__.float4", float4, byref(self), _other)
+2460 @func(inline='always')
+2461 def __mul__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__mul__.float4", float4, self, _other)
+2462 @func(inline='always')
+2463 def __rmul__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__rmul__.float4", float4, self, _other)
+2464 @func(inline='always')
+2465 def __imul__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__imul__.float4", float4, byref(self), _other)
+2466 @func(inline='always')
+2467 def __mod__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__mod__.float4", float4, self, _other)
+2468 @func(inline='always')
+2469 def __rmod__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__rmod__.float4", float4, self, _other)
+2470 @func(inline='always')
+2471 def __imod__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__imod__.float4", float4, byref(self), _other)
+2472 @func(inline='always')
+2473 def __lt__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'bool4': return intrinsic("cmp.__lt__.float4", bool4, self, _other) # type: ignore
+2474 @func(inline='always')
+2475 def __le__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'bool4': return intrinsic("cmp.__le__.float4", bool4, self, _other) # type: ignore
+2476 @func(inline='always')
+2477 def __gt__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'bool4': return intrinsic("cmp.__gt__.float4", bool4, self, _other) # type: ignore
+2478 @func(inline='always')
+2479 def __ge__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'bool4': return intrinsic("cmp.__ge__.float4", bool4, self, _other) # type: ignore
+2480 @func(inline='always')
+2481 def __eq__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'bool4': return intrinsic("cmp.__eq__.float4", bool4, self, _other) # type: ignore
+2482 @func(inline='always')
+2483 def __ne__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'bool4': return intrinsic("cmp.__ne__.float4", bool4, self, _other) # type: ignore
+2484 @func(inline='always')
+2485 def __truediv__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__truediv__.float4", float4, self, _other)
+2486 @func(inline='always')
+2487 def __rtruediv__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__rtruediv__.float4", float4, self, _other)
+2488 @func(inline='always')
+2489 def __itruediv__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__itruediv__.float4", float4, byref(self), _other)
+2490 @func(inline='always')
+2491 def __pow__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__pow__.float4", float4, self, _other)
+2492 @func(inline='always')
+2493 def __rpow__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__rpow__.float4", float4, self, _other)
+2494 @func(inline='always')
+2495 def __ipow__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__ipow__.float4", float4, byref(self), _other)
+2496 @func(inline='always')
+2497 def __floordiv__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__floordiv__.float4", float4, self, _other)
+2498 @func(inline='always')
+2499 def __rfloordiv__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__rfloordiv__.float4", float4, self, _other)
+2500
+2501@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[f64]), 4))
+2502class double4:
+2503 x: f64
+2504 y: f64
+2505 z: f64
+2506 w: f64
+2507 def __init__(self, x: tp.Union['f64', FloatLiteral] = FloatLiteral(), y: tp.Union['f64', FloatLiteral] = FloatLiteral(), z: tp.Union['f64', FloatLiteral] = FloatLiteral(), w: tp.Union['f64', FloatLiteral] = FloatLiteral()) -> None: self = intrinsic("init.double4", double4, x, y, z, w)
+2508 @func(inline='always')
+2509 def __add__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__add__.double4", double4, self, _other)
+2510 @func(inline='always')
+2511 def __radd__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__radd__.double4", double4, self, _other)
+2512 @func(inline='always')
+2513 def __iadd__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__iadd__.double4", double4, byref(self), _other)
+2514 @func(inline='always')
+2515 def __sub__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__sub__.double4", double4, self, _other)
+2516 @func(inline='always')
+2517 def __rsub__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__rsub__.double4", double4, self, _other)
+2518 @func(inline='always')
+2519 def __isub__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__isub__.double4", double4, byref(self), _other)
+2520 @func(inline='always')
+2521 def __mul__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__mul__.double4", double4, self, _other)
+2522 @func(inline='always')
+2523 def __rmul__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__rmul__.double4", double4, self, _other)
+2524 @func(inline='always')
+2525 def __imul__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__imul__.double4", double4, byref(self), _other)
+2526 @func(inline='always')
+2527 def __mod__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__mod__.double4", double4, self, _other)
+2528 @func(inline='always')
+2529 def __rmod__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__rmod__.double4", double4, self, _other)
+2530 @func(inline='always')
+2531 def __imod__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__imod__.double4", double4, byref(self), _other)
+2532 @func(inline='always')
+2533 def __lt__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'bool4': return intrinsic("cmp.__lt__.double4", bool4, self, _other) # type: ignore
+2534 @func(inline='always')
+2535 def __le__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'bool4': return intrinsic("cmp.__le__.double4", bool4, self, _other) # type: ignore
+2536 @func(inline='always')
+2537 def __gt__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'bool4': return intrinsic("cmp.__gt__.double4", bool4, self, _other) # type: ignore
+2538 @func(inline='always')
+2539 def __ge__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'bool4': return intrinsic("cmp.__ge__.double4", bool4, self, _other) # type: ignore
+2540 @func(inline='always')
+2541 def __eq__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'bool4': return intrinsic("cmp.__eq__.double4", bool4, self, _other) # type: ignore
+2542 @func(inline='always')
+2543 def __ne__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'bool4': return intrinsic("cmp.__ne__.double4", bool4, self, _other) # type: ignore
+2544 @func(inline='always')
+2545 def __truediv__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__truediv__.double4", double4, self, _other)
+2546 @func(inline='always')
+2547 def __rtruediv__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__rtruediv__.double4", double4, self, _other)
+2548 @func(inline='always')
+2549 def __itruediv__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__itruediv__.double4", double4, byref(self), _other)
+2550 @func(inline='always')
+2551 def __pow__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__pow__.double4", double4, self, _other)
+2552 @func(inline='always')
+2553 def __rpow__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__rpow__.double4", double4, self, _other)
+2554 @func(inline='always')
+2555 def __ipow__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__ipow__.double4", double4, byref(self), _other)
+2556 @func(inline='always')
+2557 def __floordiv__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__floordiv__.double4", double4, self, _other)
+2558 @func(inline='always')
+2559 def __rfloordiv__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__rfloordiv__.double4", double4, self, _other)
+2560
+2561@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[i8]), 4))
+2562class byte4:
+2563 x: i8
+2564 y: i8
+2565 z: i8
+2566 w: i8
+2567 def __init__(self, x: tp.Union['i8', IntLiteral] = IntLiteral(), y: tp.Union['i8', IntLiteral] = IntLiteral(), z: tp.Union['i8', IntLiteral] = IntLiteral(), w: tp.Union['i8', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.byte4", byte4, x, y, z, w)
+2568 @func(inline='always')
+2569 def __add__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__add__.byte4", byte4, self, _other)
+2570 @func(inline='always')
+2571 def __radd__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__radd__.byte4", byte4, self, _other)
+2572 @func(inline='always')
+2573 def __iadd__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__iadd__.byte4", byte4, byref(self), _other)
+2574 @func(inline='always')
+2575 def __sub__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__sub__.byte4", byte4, self, _other)
+2576 @func(inline='always')
+2577 def __rsub__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__rsub__.byte4", byte4, self, _other)
+2578 @func(inline='always')
+2579 def __isub__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__isub__.byte4", byte4, byref(self), _other)
+2580 @func(inline='always')
+2581 def __mul__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__mul__.byte4", byte4, self, _other)
+2582 @func(inline='always')
+2583 def __rmul__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__rmul__.byte4", byte4, self, _other)
+2584 @func(inline='always')
+2585 def __imul__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__imul__.byte4", byte4, byref(self), _other)
+2586 @func(inline='always')
+2587 def __mod__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__mod__.byte4", byte4, self, _other)
+2588 @func(inline='always')
+2589 def __rmod__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__rmod__.byte4", byte4, self, _other)
+2590 @func(inline='always')
+2591 def __imod__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__imod__.byte4", byte4, byref(self), _other)
+2592 @func(inline='always')
+2593 def __lt__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'bool4': return intrinsic("cmp.__lt__.byte4", bool4, self, _other) # type: ignore
+2594 @func(inline='always')
+2595 def __le__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'bool4': return intrinsic("cmp.__le__.byte4", bool4, self, _other) # type: ignore
+2596 @func(inline='always')
+2597 def __gt__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'bool4': return intrinsic("cmp.__gt__.byte4", bool4, self, _other) # type: ignore
+2598 @func(inline='always')
+2599 def __ge__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'bool4': return intrinsic("cmp.__ge__.byte4", bool4, self, _other) # type: ignore
+2600 @func(inline='always')
+2601 def __eq__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'bool4': return intrinsic("cmp.__eq__.byte4", bool4, self, _other) # type: ignore
+2602 @func(inline='always')
+2603 def __ne__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'bool4': return intrinsic("cmp.__ne__.byte4", bool4, self, _other) # type: ignore
+2604 @func(inline='always')
+2605 def __floordiv__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__floordiv__.byte4", byte4, self, _other)
+2606 @func(inline='always')
+2607 def __rfloordiv__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__rfloordiv__.byte4", byte4, self, _other)
+2608 @func(inline='always')
+2609 def __ifloordiv__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__ifloordiv__.byte4", byte4, byref(self), _other)
+2610 @func(inline='always')
+2611 def __lshift__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__lshift__.byte4", byte4, self, _other)
+2612 @func(inline='always')
+2613 def __rlshift__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__rlshift__.byte4", byte4, self, _other)
+2614 @func(inline='always')
+2615 def __ilshift__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__ilshift__.byte4", byte4, byref(self), _other)
+2616 @func(inline='always')
+2617 def __rshift__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__rshift__.byte4", byte4, self, _other)
+2618 @func(inline='always')
+2619 def __rrshift__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__rrshift__.byte4", byte4, self, _other)
+2620 @func(inline='always')
+2621 def __irshift__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__irshift__.byte4", byte4, byref(self), _other)
+2622 @func(inline='always')
+2623 def __and__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__and__.byte4", byte4, self, _other)
+2624 @func(inline='always')
+2625 def __rand__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__rand__.byte4", byte4, self, _other)
+2626 @func(inline='always')
+2627 def __iand__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__iand__.byte4", byte4, byref(self), _other)
+2628 @func(inline='always')
+2629 def __or__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__or__.byte4", byte4, self, _other)
+2630 @func(inline='always')
+2631 def __ror__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__ror__.byte4", byte4, self, _other)
+2632 @func(inline='always')
+2633 def __ior__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__ior__.byte4", byte4, byref(self), _other)
+2634 @func(inline='always')
+2635 def __xor__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__xor__.byte4", byte4, self, _other)
+2636 @func(inline='always')
+2637 def __rxor__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__rxor__.byte4", byte4, self, _other)
+2638 @func(inline='always')
+2639 def __ixor__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__ixor__.byte4", byte4, byref(self), _other)
+2640
+2641@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[u8]), 4))
+2642class ubyte4:
+2643 x: u8
+2644 y: u8
+2645 z: u8
+2646 w: u8
+2647 def __init__(self, x: tp.Union['u8', IntLiteral] = IntLiteral(), y: tp.Union['u8', IntLiteral] = IntLiteral(), z: tp.Union['u8', IntLiteral] = IntLiteral(), w: tp.Union['u8', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.ubyte4", ubyte4, x, y, z, w)
+2648 @func(inline='always')
+2649 def __add__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__add__.ubyte4", ubyte4, self, _other)
+2650 @func(inline='always')
+2651 def __radd__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__radd__.ubyte4", ubyte4, self, _other)
+2652 @func(inline='always')
+2653 def __iadd__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__iadd__.ubyte4", ubyte4, byref(self), _other)
+2654 @func(inline='always')
+2655 def __sub__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__sub__.ubyte4", ubyte4, self, _other)
+2656 @func(inline='always')
+2657 def __rsub__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__rsub__.ubyte4", ubyte4, self, _other)
+2658 @func(inline='always')
+2659 def __isub__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__isub__.ubyte4", ubyte4, byref(self), _other)
+2660 @func(inline='always')
+2661 def __mul__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__mul__.ubyte4", ubyte4, self, _other)
+2662 @func(inline='always')
+2663 def __rmul__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__rmul__.ubyte4", ubyte4, self, _other)
+2664 @func(inline='always')
+2665 def __imul__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__imul__.ubyte4", ubyte4, byref(self), _other)
+2666 @func(inline='always')
+2667 def __mod__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__mod__.ubyte4", ubyte4, self, _other)
+2668 @func(inline='always')
+2669 def __rmod__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__rmod__.ubyte4", ubyte4, self, _other)
+2670 @func(inline='always')
+2671 def __imod__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__imod__.ubyte4", ubyte4, byref(self), _other)
+2672 @func(inline='always')
+2673 def __lt__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'bool4': return intrinsic("cmp.__lt__.ubyte4", bool4, self, _other) # type: ignore
+2674 @func(inline='always')
+2675 def __le__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'bool4': return intrinsic("cmp.__le__.ubyte4", bool4, self, _other) # type: ignore
+2676 @func(inline='always')
+2677 def __gt__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'bool4': return intrinsic("cmp.__gt__.ubyte4", bool4, self, _other) # type: ignore
+2678 @func(inline='always')
+2679 def __ge__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'bool4': return intrinsic("cmp.__ge__.ubyte4", bool4, self, _other) # type: ignore
+2680 @func(inline='always')
+2681 def __eq__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'bool4': return intrinsic("cmp.__eq__.ubyte4", bool4, self, _other) # type: ignore
+2682 @func(inline='always')
+2683 def __ne__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'bool4': return intrinsic("cmp.__ne__.ubyte4", bool4, self, _other) # type: ignore
+2684 @func(inline='always')
+2685 def __floordiv__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__floordiv__.ubyte4", ubyte4, self, _other)
+2686 @func(inline='always')
+2687 def __rfloordiv__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__rfloordiv__.ubyte4", ubyte4, self, _other)
+2688 @func(inline='always')
+2689 def __ifloordiv__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__ifloordiv__.ubyte4", ubyte4, byref(self), _other)
+2690 @func(inline='always')
+2691 def __lshift__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__lshift__.ubyte4", ubyte4, self, _other)
+2692 @func(inline='always')
+2693 def __rlshift__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__rlshift__.ubyte4", ubyte4, self, _other)
+2694 @func(inline='always')
+2695 def __ilshift__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__ilshift__.ubyte4", ubyte4, byref(self), _other)
+2696 @func(inline='always')
+2697 def __rshift__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__rshift__.ubyte4", ubyte4, self, _other)
+2698 @func(inline='always')
+2699 def __rrshift__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__rrshift__.ubyte4", ubyte4, self, _other)
+2700 @func(inline='always')
+2701 def __irshift__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__irshift__.ubyte4", ubyte4, byref(self), _other)
+2702 @func(inline='always')
+2703 def __and__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__and__.ubyte4", ubyte4, self, _other)
+2704 @func(inline='always')
+2705 def __rand__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__rand__.ubyte4", ubyte4, self, _other)
+2706 @func(inline='always')
+2707 def __iand__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__iand__.ubyte4", ubyte4, byref(self), _other)
+2708 @func(inline='always')
+2709 def __or__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__or__.ubyte4", ubyte4, self, _other)
+2710 @func(inline='always')
+2711 def __ror__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__ror__.ubyte4", ubyte4, self, _other)
+2712 @func(inline='always')
+2713 def __ior__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__ior__.ubyte4", ubyte4, byref(self), _other)
+2714 @func(inline='always')
+2715 def __xor__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__xor__.ubyte4", ubyte4, self, _other)
+2716 @func(inline='always')
+2717 def __rxor__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__rxor__.ubyte4", ubyte4, self, _other)
+2718 @func(inline='always')
+2719 def __ixor__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__ixor__.ubyte4", ubyte4, byref(self), _other)
+2720
+2721@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[i16]), 4))
+2722class short4:
+2723 x: i16
+2724 y: i16
+2725 z: i16
+2726 w: i16
+2727 def __init__(self, x: tp.Union['i16', IntLiteral] = IntLiteral(), y: tp.Union['i16', IntLiteral] = IntLiteral(), z: tp.Union['i16', IntLiteral] = IntLiteral(), w: tp.Union['i16', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.short4", short4, x, y, z, w)
+2728 @func(inline='always')
+2729 def __add__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__add__.short4", short4, self, _other)
+2730 @func(inline='always')
+2731 def __radd__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__radd__.short4", short4, self, _other)
+2732 @func(inline='always')
+2733 def __iadd__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__iadd__.short4", short4, byref(self), _other)
+2734 @func(inline='always')
+2735 def __sub__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__sub__.short4", short4, self, _other)
+2736 @func(inline='always')
+2737 def __rsub__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__rsub__.short4", short4, self, _other)
+2738 @func(inline='always')
+2739 def __isub__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__isub__.short4", short4, byref(self), _other)
+2740 @func(inline='always')
+2741 def __mul__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__mul__.short4", short4, self, _other)
+2742 @func(inline='always')
+2743 def __rmul__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__rmul__.short4", short4, self, _other)
+2744 @func(inline='always')
+2745 def __imul__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__imul__.short4", short4, byref(self), _other)
+2746 @func(inline='always')
+2747 def __mod__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__mod__.short4", short4, self, _other)
+2748 @func(inline='always')
+2749 def __rmod__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__rmod__.short4", short4, self, _other)
+2750 @func(inline='always')
+2751 def __imod__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__imod__.short4", short4, byref(self), _other)
+2752 @func(inline='always')
+2753 def __lt__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'bool4': return intrinsic("cmp.__lt__.short4", bool4, self, _other) # type: ignore
+2754 @func(inline='always')
+2755 def __le__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'bool4': return intrinsic("cmp.__le__.short4", bool4, self, _other) # type: ignore
+2756 @func(inline='always')
+2757 def __gt__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'bool4': return intrinsic("cmp.__gt__.short4", bool4, self, _other) # type: ignore
+2758 @func(inline='always')
+2759 def __ge__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'bool4': return intrinsic("cmp.__ge__.short4", bool4, self, _other) # type: ignore
+2760 @func(inline='always')
+2761 def __eq__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'bool4': return intrinsic("cmp.__eq__.short4", bool4, self, _other) # type: ignore
+2762 @func(inline='always')
+2763 def __ne__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'bool4': return intrinsic("cmp.__ne__.short4", bool4, self, _other) # type: ignore
+2764 @func(inline='always')
+2765 def __floordiv__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__floordiv__.short4", short4, self, _other)
+2766 @func(inline='always')
+2767 def __rfloordiv__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__rfloordiv__.short4", short4, self, _other)
+2768 @func(inline='always')
+2769 def __ifloordiv__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__ifloordiv__.short4", short4, byref(self), _other)
+2770 @func(inline='always')
+2771 def __lshift__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__lshift__.short4", short4, self, _other)
+2772 @func(inline='always')
+2773 def __rlshift__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__rlshift__.short4", short4, self, _other)
+2774 @func(inline='always')
+2775 def __ilshift__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__ilshift__.short4", short4, byref(self), _other)
+2776 @func(inline='always')
+2777 def __rshift__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__rshift__.short4", short4, self, _other)
+2778 @func(inline='always')
+2779 def __rrshift__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__rrshift__.short4", short4, self, _other)
+2780 @func(inline='always')
+2781 def __irshift__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__irshift__.short4", short4, byref(self), _other)
+2782 @func(inline='always')
+2783 def __and__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__and__.short4", short4, self, _other)
+2784 @func(inline='always')
+2785 def __rand__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__rand__.short4", short4, self, _other)
+2786 @func(inline='always')
+2787 def __iand__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__iand__.short4", short4, byref(self), _other)
+2788 @func(inline='always')
+2789 def __or__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__or__.short4", short4, self, _other)
+2790 @func(inline='always')
+2791 def __ror__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__ror__.short4", short4, self, _other)
+2792 @func(inline='always')
+2793 def __ior__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__ior__.short4", short4, byref(self), _other)
+2794 @func(inline='always')
+2795 def __xor__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__xor__.short4", short4, self, _other)
+2796 @func(inline='always')
+2797 def __rxor__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__rxor__.short4", short4, self, _other)
+2798 @func(inline='always')
+2799 def __ixor__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__ixor__.short4", short4, byref(self), _other)
+2800
+2801@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[u16]), 4))
+2802class ushort4:
+2803 x: u16
+2804 y: u16
+2805 z: u16
+2806 w: u16
+2807 def __init__(self, x: tp.Union['u16', IntLiteral] = IntLiteral(), y: tp.Union['u16', IntLiteral] = IntLiteral(), z: tp.Union['u16', IntLiteral] = IntLiteral(), w: tp.Union['u16', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.ushort4", ushort4, x, y, z, w)
+2808 @func(inline='always')
+2809 def __add__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__add__.ushort4", ushort4, self, _other)
+2810 @func(inline='always')
+2811 def __radd__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__radd__.ushort4", ushort4, self, _other)
+2812 @func(inline='always')
+2813 def __iadd__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__iadd__.ushort4", ushort4, byref(self), _other)
+2814 @func(inline='always')
+2815 def __sub__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__sub__.ushort4", ushort4, self, _other)
+2816 @func(inline='always')
+2817 def __rsub__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__rsub__.ushort4", ushort4, self, _other)
+2818 @func(inline='always')
+2819 def __isub__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__isub__.ushort4", ushort4, byref(self), _other)
+2820 @func(inline='always')
+2821 def __mul__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__mul__.ushort4", ushort4, self, _other)
+2822 @func(inline='always')
+2823 def __rmul__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__rmul__.ushort4", ushort4, self, _other)
+2824 @func(inline='always')
+2825 def __imul__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__imul__.ushort4", ushort4, byref(self), _other)
+2826 @func(inline='always')
+2827 def __mod__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__mod__.ushort4", ushort4, self, _other)
+2828 @func(inline='always')
+2829 def __rmod__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__rmod__.ushort4", ushort4, self, _other)
+2830 @func(inline='always')
+2831 def __imod__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__imod__.ushort4", ushort4, byref(self), _other)
+2832 @func(inline='always')
+2833 def __lt__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'bool4': return intrinsic("cmp.__lt__.ushort4", bool4, self, _other) # type: ignore
+2834 @func(inline='always')
+2835 def __le__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'bool4': return intrinsic("cmp.__le__.ushort4", bool4, self, _other) # type: ignore
+2836 @func(inline='always')
+2837 def __gt__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'bool4': return intrinsic("cmp.__gt__.ushort4", bool4, self, _other) # type: ignore
+2838 @func(inline='always')
+2839 def __ge__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'bool4': return intrinsic("cmp.__ge__.ushort4", bool4, self, _other) # type: ignore
+2840 @func(inline='always')
+2841 def __eq__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'bool4': return intrinsic("cmp.__eq__.ushort4", bool4, self, _other) # type: ignore
+2842 @func(inline='always')
+2843 def __ne__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'bool4': return intrinsic("cmp.__ne__.ushort4", bool4, self, _other) # type: ignore
+2844 @func(inline='always')
+2845 def __floordiv__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__floordiv__.ushort4", ushort4, self, _other)
+2846 @func(inline='always')
+2847 def __rfloordiv__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__rfloordiv__.ushort4", ushort4, self, _other)
+2848 @func(inline='always')
+2849 def __ifloordiv__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__ifloordiv__.ushort4", ushort4, byref(self), _other)
+2850 @func(inline='always')
+2851 def __lshift__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__lshift__.ushort4", ushort4, self, _other)
+2852 @func(inline='always')
+2853 def __rlshift__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__rlshift__.ushort4", ushort4, self, _other)
+2854 @func(inline='always')
+2855 def __ilshift__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__ilshift__.ushort4", ushort4, byref(self), _other)
+2856 @func(inline='always')
+2857 def __rshift__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__rshift__.ushort4", ushort4, self, _other)
+2858 @func(inline='always')
+2859 def __rrshift__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__rrshift__.ushort4", ushort4, self, _other)
+2860 @func(inline='always')
+2861 def __irshift__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__irshift__.ushort4", ushort4, byref(self), _other)
+2862 @func(inline='always')
+2863 def __and__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__and__.ushort4", ushort4, self, _other)
+2864 @func(inline='always')
+2865 def __rand__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__rand__.ushort4", ushort4, self, _other)
+2866 @func(inline='always')
+2867 def __iand__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__iand__.ushort4", ushort4, byref(self), _other)
+2868 @func(inline='always')
+2869 def __or__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__or__.ushort4", ushort4, self, _other)
+2870 @func(inline='always')
+2871 def __ror__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__ror__.ushort4", ushort4, self, _other)
+2872 @func(inline='always')
+2873 def __ior__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__ior__.ushort4", ushort4, byref(self), _other)
+2874 @func(inline='always')
+2875 def __xor__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__xor__.ushort4", ushort4, self, _other)
+2876 @func(inline='always')
+2877 def __rxor__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__rxor__.ushort4", ushort4, self, _other)
+2878 @func(inline='always')
+2879 def __ixor__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__ixor__.ushort4", ushort4, byref(self), _other)
+2880
+2881@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[i32]), 4))
+2882class int4:
+2883 x: i32
+2884 y: i32
+2885 z: i32
+2886 w: i32
+2887 def __init__(self, x: tp.Union['i32', IntLiteral] = IntLiteral(), y: tp.Union['i32', IntLiteral] = IntLiteral(), z: tp.Union['i32', IntLiteral] = IntLiteral(), w: tp.Union['i32', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.int4", int4, x, y, z, w)
+2888 @func(inline='always')
+2889 def __add__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__add__.int4", int4, self, _other)
+2890 @func(inline='always')
+2891 def __radd__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__radd__.int4", int4, self, _other)
+2892 @func(inline='always')
+2893 def __iadd__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__iadd__.int4", int4, byref(self), _other)
+2894 @func(inline='always')
+2895 def __sub__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__sub__.int4", int4, self, _other)
+2896 @func(inline='always')
+2897 def __rsub__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__rsub__.int4", int4, self, _other)
+2898 @func(inline='always')
+2899 def __isub__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__isub__.int4", int4, byref(self), _other)
+2900 @func(inline='always')
+2901 def __mul__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__mul__.int4", int4, self, _other)
+2902 @func(inline='always')
+2903 def __rmul__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__rmul__.int4", int4, self, _other)
+2904 @func(inline='always')
+2905 def __imul__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__imul__.int4", int4, byref(self), _other)
+2906 @func(inline='always')
+2907 def __mod__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__mod__.int4", int4, self, _other)
+2908 @func(inline='always')
+2909 def __rmod__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__rmod__.int4", int4, self, _other)
+2910 @func(inline='always')
+2911 def __imod__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__imod__.int4", int4, byref(self), _other)
+2912 @func(inline='always')
+2913 def __lt__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'bool4': return intrinsic("cmp.__lt__.int4", bool4, self, _other) # type: ignore
+2914 @func(inline='always')
+2915 def __le__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'bool4': return intrinsic("cmp.__le__.int4", bool4, self, _other) # type: ignore
+2916 @func(inline='always')
+2917 def __gt__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'bool4': return intrinsic("cmp.__gt__.int4", bool4, self, _other) # type: ignore
+2918 @func(inline='always')
+2919 def __ge__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'bool4': return intrinsic("cmp.__ge__.int4", bool4, self, _other) # type: ignore
+2920 @func(inline='always')
+2921 def __eq__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'bool4': return intrinsic("cmp.__eq__.int4", bool4, self, _other) # type: ignore
+2922 @func(inline='always')
+2923 def __ne__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'bool4': return intrinsic("cmp.__ne__.int4", bool4, self, _other) # type: ignore
+2924 @func(inline='always')
+2925 def __floordiv__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__floordiv__.int4", int4, self, _other)
+2926 @func(inline='always')
+2927 def __rfloordiv__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__rfloordiv__.int4", int4, self, _other)
+2928 @func(inline='always')
+2929 def __ifloordiv__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__ifloordiv__.int4", int4, byref(self), _other)
+2930 @func(inline='always')
+2931 def __lshift__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__lshift__.int4", int4, self, _other)
+2932 @func(inline='always')
+2933 def __rlshift__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__rlshift__.int4", int4, self, _other)
+2934 @func(inline='always')
+2935 def __ilshift__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__ilshift__.int4", int4, byref(self), _other)
+2936 @func(inline='always')
+2937 def __rshift__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__rshift__.int4", int4, self, _other)
+2938 @func(inline='always')
+2939 def __rrshift__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__rrshift__.int4", int4, self, _other)
+2940 @func(inline='always')
+2941 def __irshift__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__irshift__.int4", int4, byref(self), _other)
+2942 @func(inline='always')
+2943 def __and__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__and__.int4", int4, self, _other)
+2944 @func(inline='always')
+2945 def __rand__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__rand__.int4", int4, self, _other)
+2946 @func(inline='always')
+2947 def __iand__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__iand__.int4", int4, byref(self), _other)
+2948 @func(inline='always')
+2949 def __or__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__or__.int4", int4, self, _other)
+2950 @func(inline='always')
+2951 def __ror__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__ror__.int4", int4, self, _other)
+2952 @func(inline='always')
+2953 def __ior__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__ior__.int4", int4, byref(self), _other)
+2954 @func(inline='always')
+2955 def __xor__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__xor__.int4", int4, self, _other)
+2956 @func(inline='always')
+2957 def __rxor__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__rxor__.int4", int4, self, _other)
+2958 @func(inline='always')
+2959 def __ixor__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__ixor__.int4", int4, byref(self), _other)
+2960
+2961@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[u32]), 4))
+2962class uint4:
+2963 x: u32
+2964 y: u32
+2965 z: u32
+2966 w: u32
+2967 def __init__(self, x: tp.Union['u32', IntLiteral] = IntLiteral(), y: tp.Union['u32', IntLiteral] = IntLiteral(), z: tp.Union['u32', IntLiteral] = IntLiteral(), w: tp.Union['u32', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.uint4", uint4, x, y, z, w)
+2968 @func(inline='always')
+2969 def __add__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__add__.uint4", uint4, self, _other)
+2970 @func(inline='always')
+2971 def __radd__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__radd__.uint4", uint4, self, _other)
+2972 @func(inline='always')
+2973 def __iadd__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__iadd__.uint4", uint4, byref(self), _other)
+2974 @func(inline='always')
+2975 def __sub__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__sub__.uint4", uint4, self, _other)
+2976 @func(inline='always')
+2977 def __rsub__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__rsub__.uint4", uint4, self, _other)
+2978 @func(inline='always')
+2979 def __isub__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__isub__.uint4", uint4, byref(self), _other)
+2980 @func(inline='always')
+2981 def __mul__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__mul__.uint4", uint4, self, _other)
+2982 @func(inline='always')
+2983 def __rmul__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__rmul__.uint4", uint4, self, _other)
+2984 @func(inline='always')
+2985 def __imul__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__imul__.uint4", uint4, byref(self), _other)
+2986 @func(inline='always')
+2987 def __mod__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__mod__.uint4", uint4, self, _other)
+2988 @func(inline='always')
+2989 def __rmod__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__rmod__.uint4", uint4, self, _other)
+2990 @func(inline='always')
+2991 def __imod__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__imod__.uint4", uint4, byref(self), _other)
+2992 @func(inline='always')
+2993 def __lt__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'bool4': return intrinsic("cmp.__lt__.uint4", bool4, self, _other) # type: ignore
+2994 @func(inline='always')
+2995 def __le__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'bool4': return intrinsic("cmp.__le__.uint4", bool4, self, _other) # type: ignore
+2996 @func(inline='always')
+2997 def __gt__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'bool4': return intrinsic("cmp.__gt__.uint4", bool4, self, _other) # type: ignore
+2998 @func(inline='always')
+2999 def __ge__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'bool4': return intrinsic("cmp.__ge__.uint4", bool4, self, _other) # type: ignore
+3000 @func(inline='always')
+3001 def __eq__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'bool4': return intrinsic("cmp.__eq__.uint4", bool4, self, _other) # type: ignore
+3002 @func(inline='always')
+3003 def __ne__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'bool4': return intrinsic("cmp.__ne__.uint4", bool4, self, _other) # type: ignore
+3004 @func(inline='always')
+3005 def __floordiv__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__floordiv__.uint4", uint4, self, _other)
+3006 @func(inline='always')
+3007 def __rfloordiv__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__rfloordiv__.uint4", uint4, self, _other)
+3008 @func(inline='always')
+3009 def __ifloordiv__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__ifloordiv__.uint4", uint4, byref(self), _other)
+3010 @func(inline='always')
+3011 def __lshift__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__lshift__.uint4", uint4, self, _other)
+3012 @func(inline='always')
+3013 def __rlshift__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__rlshift__.uint4", uint4, self, _other)
+3014 @func(inline='always')
+3015 def __ilshift__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__ilshift__.uint4", uint4, byref(self), _other)
+3016 @func(inline='always')
+3017 def __rshift__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__rshift__.uint4", uint4, self, _other)
+3018 @func(inline='always')
+3019 def __rrshift__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__rrshift__.uint4", uint4, self, _other)
+3020 @func(inline='always')
+3021 def __irshift__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__irshift__.uint4", uint4, byref(self), _other)
+3022 @func(inline='always')
+3023 def __and__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__and__.uint4", uint4, self, _other)
+3024 @func(inline='always')
+3025 def __rand__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__rand__.uint4", uint4, self, _other)
+3026 @func(inline='always')
+3027 def __iand__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__iand__.uint4", uint4, byref(self), _other)
+3028 @func(inline='always')
+3029 def __or__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__or__.uint4", uint4, self, _other)
+3030 @func(inline='always')
+3031 def __ror__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__ror__.uint4", uint4, self, _other)
+3032 @func(inline='always')
+3033 def __ior__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__ior__.uint4", uint4, byref(self), _other)
+3034 @func(inline='always')
+3035 def __xor__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__xor__.uint4", uint4, self, _other)
+3036 @func(inline='always')
+3037 def __rxor__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__rxor__.uint4", uint4, self, _other)
+3038 @func(inline='always')
+3039 def __ixor__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__ixor__.uint4", uint4, byref(self), _other)
+3040
+3041@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[i64]), 4))
+3042class long4:
+3043 x: i64
+3044 y: i64
+3045 z: i64
+3046 w: i64
+3047 def __init__(self, x: tp.Union['i64', IntLiteral] = IntLiteral(), y: tp.Union['i64', IntLiteral] = IntLiteral(), z: tp.Union['i64', IntLiteral] = IntLiteral(), w: tp.Union['i64', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.long4", long4, x, y, z, w)
+3048 @func(inline='always')
+3049 def __add__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__add__.long4", long4, self, _other)
+3050 @func(inline='always')
+3051 def __radd__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__radd__.long4", long4, self, _other)
+3052 @func(inline='always')
+3053 def __iadd__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__iadd__.long4", long4, byref(self), _other)
+3054 @func(inline='always')
+3055 def __sub__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__sub__.long4", long4, self, _other)
+3056 @func(inline='always')
+3057 def __rsub__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__rsub__.long4", long4, self, _other)
+3058 @func(inline='always')
+3059 def __isub__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__isub__.long4", long4, byref(self), _other)
+3060 @func(inline='always')
+3061 def __mul__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__mul__.long4", long4, self, _other)
+3062 @func(inline='always')
+3063 def __rmul__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__rmul__.long4", long4, self, _other)
+3064 @func(inline='always')
+3065 def __imul__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__imul__.long4", long4, byref(self), _other)
+3066 @func(inline='always')
+3067 def __mod__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__mod__.long4", long4, self, _other)
+3068 @func(inline='always')
+3069 def __rmod__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__rmod__.long4", long4, self, _other)
+3070 @func(inline='always')
+3071 def __imod__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__imod__.long4", long4, byref(self), _other)
+3072 @func(inline='always')
+3073 def __lt__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'bool4': return intrinsic("cmp.__lt__.long4", bool4, self, _other) # type: ignore
+3074 @func(inline='always')
+3075 def __le__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'bool4': return intrinsic("cmp.__le__.long4", bool4, self, _other) # type: ignore
+3076 @func(inline='always')
+3077 def __gt__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'bool4': return intrinsic("cmp.__gt__.long4", bool4, self, _other) # type: ignore
+3078 @func(inline='always')
+3079 def __ge__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'bool4': return intrinsic("cmp.__ge__.long4", bool4, self, _other) # type: ignore
+3080 @func(inline='always')
+3081 def __eq__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'bool4': return intrinsic("cmp.__eq__.long4", bool4, self, _other) # type: ignore
+3082 @func(inline='always')
+3083 def __ne__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'bool4': return intrinsic("cmp.__ne__.long4", bool4, self, _other) # type: ignore
+3084 @func(inline='always')
+3085 def __floordiv__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__floordiv__.long4", long4, self, _other)
+3086 @func(inline='always')
+3087 def __rfloordiv__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__rfloordiv__.long4", long4, self, _other)
+3088 @func(inline='always')
+3089 def __ifloordiv__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__ifloordiv__.long4", long4, byref(self), _other)
+3090 @func(inline='always')
+3091 def __lshift__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__lshift__.long4", long4, self, _other)
+3092 @func(inline='always')
+3093 def __rlshift__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__rlshift__.long4", long4, self, _other)
+3094 @func(inline='always')
+3095 def __ilshift__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__ilshift__.long4", long4, byref(self), _other)
+3096 @func(inline='always')
+3097 def __rshift__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__rshift__.long4", long4, self, _other)
+3098 @func(inline='always')
+3099 def __rrshift__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__rrshift__.long4", long4, self, _other)
+3100 @func(inline='always')
+3101 def __irshift__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__irshift__.long4", long4, byref(self), _other)
+3102 @func(inline='always')
+3103 def __and__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__and__.long4", long4, self, _other)
+3104 @func(inline='always')
+3105 def __rand__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__rand__.long4", long4, self, _other)
+3106 @func(inline='always')
+3107 def __iand__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__iand__.long4", long4, byref(self), _other)
+3108 @func(inline='always')
+3109 def __or__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__or__.long4", long4, self, _other)
+3110 @func(inline='always')
+3111 def __ror__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__ror__.long4", long4, self, _other)
+3112 @func(inline='always')
+3113 def __ior__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__ior__.long4", long4, byref(self), _other)
+3114 @func(inline='always')
+3115 def __xor__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__xor__.long4", long4, self, _other)
+3116 @func(inline='always')
+3117 def __rxor__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__rxor__.long4", long4, self, _other)
+3118 @func(inline='always')
+3119 def __ixor__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__ixor__.long4", long4, byref(self), _other)
+3120
+3121@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[u64]), 4))
+3122class ulong4:
+3123 x: u64
+3124 y: u64
+3125 z: u64
+3126 w: u64
+3127 def __init__(self, x: tp.Union['u64', IntLiteral] = IntLiteral(), y: tp.Union['u64', IntLiteral] = IntLiteral(), z: tp.Union['u64', IntLiteral] = IntLiteral(), w: tp.Union['u64', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.ulong4", ulong4, x, y, z, w)
+3128 @func(inline='always')
+3129 def __add__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__add__.ulong4", ulong4, self, _other)
+3130 @func(inline='always')
+3131 def __radd__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__radd__.ulong4", ulong4, self, _other)
+3132 @func(inline='always')
+3133 def __iadd__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__iadd__.ulong4", ulong4, byref(self), _other)
+3134 @func(inline='always')
+3135 def __sub__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__sub__.ulong4", ulong4, self, _other)
+3136 @func(inline='always')
+3137 def __rsub__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__rsub__.ulong4", ulong4, self, _other)
+3138 @func(inline='always')
+3139 def __isub__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__isub__.ulong4", ulong4, byref(self), _other)
+3140 @func(inline='always')
+3141 def __mul__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__mul__.ulong4", ulong4, self, _other)
+3142 @func(inline='always')
+3143 def __rmul__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__rmul__.ulong4", ulong4, self, _other)
+3144 @func(inline='always')
+3145 def __imul__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__imul__.ulong4", ulong4, byref(self), _other)
+3146 @func(inline='always')
+3147 def __mod__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__mod__.ulong4", ulong4, self, _other)
+3148 @func(inline='always')
+3149 def __rmod__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__rmod__.ulong4", ulong4, self, _other)
+3150 @func(inline='always')
+3151 def __imod__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__imod__.ulong4", ulong4, byref(self), _other)
+3152 @func(inline='always')
+3153 def __lt__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'bool4': return intrinsic("cmp.__lt__.ulong4", bool4, self, _other) # type: ignore
+3154 @func(inline='always')
+3155 def __le__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'bool4': return intrinsic("cmp.__le__.ulong4", bool4, self, _other) # type: ignore
+3156 @func(inline='always')
+3157 def __gt__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'bool4': return intrinsic("cmp.__gt__.ulong4", bool4, self, _other) # type: ignore
+3158 @func(inline='always')
+3159 def __ge__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'bool4': return intrinsic("cmp.__ge__.ulong4", bool4, self, _other) # type: ignore
+3160 @func(inline='always')
+3161 def __eq__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'bool4': return intrinsic("cmp.__eq__.ulong4", bool4, self, _other) # type: ignore
+3162 @func(inline='always')
+3163 def __ne__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'bool4': return intrinsic("cmp.__ne__.ulong4", bool4, self, _other) # type: ignore
+3164 @func(inline='always')
+3165 def __floordiv__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__floordiv__.ulong4", ulong4, self, _other)
+3166 @func(inline='always')
+3167 def __rfloordiv__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__rfloordiv__.ulong4", ulong4, self, _other)
+3168 @func(inline='always')
+3169 def __ifloordiv__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__ifloordiv__.ulong4", ulong4, byref(self), _other)
+3170 @func(inline='always')
+3171 def __lshift__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__lshift__.ulong4", ulong4, self, _other)
+3172 @func(inline='always')
+3173 def __rlshift__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__rlshift__.ulong4", ulong4, self, _other)
+3174 @func(inline='always')
+3175 def __ilshift__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__ilshift__.ulong4", ulong4, byref(self), _other)
+3176 @func(inline='always')
+3177 def __rshift__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__rshift__.ulong4", ulong4, self, _other)
+3178 @func(inline='always')
+3179 def __rrshift__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__rrshift__.ulong4", ulong4, self, _other)
+3180 @func(inline='always')
+3181 def __irshift__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__irshift__.ulong4", ulong4, byref(self), _other)
+3182 @func(inline='always')
+3183 def __and__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__and__.ulong4", ulong4, self, _other)
+3184 @func(inline='always')
+3185 def __rand__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__rand__.ulong4", ulong4, self, _other)
+3186 @func(inline='always')
+3187 def __iand__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__iand__.ulong4", ulong4, byref(self), _other)
+3188 @func(inline='always')
+3189 def __or__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__or__.ulong4", ulong4, self, _other)
+3190 @func(inline='always')
+3191 def __ror__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__ror__.ulong4", ulong4, self, _other)
+3192 @func(inline='always')
+3193 def __ior__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__ior__.ulong4", ulong4, byref(self), _other)
+3194 @func(inline='always')
+3195 def __xor__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__xor__.ulong4", ulong4, self, _other)
+3196 @func(inline='always')
+3197 def __rxor__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__rxor__.ulong4", ulong4, self, _other)
+3198 @func(inline='always')
+3199 def __ixor__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__ixor__.ulong4", ulong4, byref(self), _other)
+3200
+3201__all__ = ['FLOAT_TYPES', 'FloatType', 'abs', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atanh', 'ceil', 'cos', 'cosh', 'exp', 'floor', 'log', 'log10', 'log2', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'trunc', 'atan2', 'copysign', '_f32', 'f64', 'i8', 'u8', 'i16', 'u16', 'i64', 'u64', '_i32', 'u32', 'bool2', 'float2', 'double2', 'byte2', 'ubyte2', 'short2', 'ushort2', 'int2', 'uint2', 'long2', 'ulong2', 'bool3', 'float3', 'double3', 'byte3', 'ubyte3', 'short3', 'ushort3', 'int3', 'uint3', 'long3', 'ulong3', 'bool4', 'float4', 'double4', 'byte4', 'ubyte4', 'short4', 'ushort4', 'int4', 'uint4', 'long4', 'ulong4', 'f32', 'i32']
+
67@builtin_type(_hir.FloatType(32))
+ 68class _f32:
+ 69 @func(inline='always')
+ 70 def __init__(self, _value: tp.Union['_f32', float]) -> None:
+ 71 self = intrinsic("init._f32", _f32, _value)
+ 72 @func(inline='always')
+ 73 def __add__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__add__._f32", _f32, self, _other)
+ 74 @func(inline='always')
+ 75 def __radd__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__radd__._f32", _f32, self, _other)
+ 76 @func(inline='always')
+ 77 def __iadd__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__iadd__._f32", _f32, byref(self), _other)
+ 78 @func(inline='always')
+ 79 def __sub__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__sub__._f32", _f32, self, _other)
+ 80 @func(inline='always')
+ 81 def __rsub__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__rsub__._f32", _f32, self, _other)
+ 82 @func(inline='always')
+ 83 def __isub__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__isub__._f32", _f32, byref(self), _other)
+ 84 @func(inline='always')
+ 85 def __mul__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__mul__._f32", _f32, self, _other)
+ 86 @func(inline='always')
+ 87 def __rmul__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__rmul__._f32", _f32, self, _other)
+ 88 @func(inline='always')
+ 89 def __imul__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__imul__._f32", _f32, byref(self), _other)
+ 90 @func(inline='always')
+ 91 def __mod__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__mod__._f32", _f32, self, _other)
+ 92 @func(inline='always')
+ 93 def __rmod__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__rmod__._f32", _f32, self, _other)
+ 94 @func(inline='always')
+ 95 def __imod__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__imod__._f32", _f32, byref(self), _other)
+ 96 @func(inline='always')
+ 97 def __lt__(self, _other: tp.Union['_f32', float]) -> 'bool': return intrinsic("cmp.__lt__._f32", bool, self, _other) # type: ignore
+ 98 @func(inline='always')
+ 99 def __le__(self, _other: tp.Union['_f32', float]) -> 'bool': return intrinsic("cmp.__le__._f32", bool, self, _other) # type: ignore
+100 @func(inline='always')
+101 def __gt__(self, _other: tp.Union['_f32', float]) -> 'bool': return intrinsic("cmp.__gt__._f32", bool, self, _other) # type: ignore
+102 @func(inline='always')
+103 def __ge__(self, _other: tp.Union['_f32', float]) -> 'bool': return intrinsic("cmp.__ge__._f32", bool, self, _other) # type: ignore
+104 @func(inline='always')
+105 def __eq__(self, _other: tp.Union['_f32', float]) -> 'bool': return intrinsic("cmp.__eq__._f32", bool, self, _other) # type: ignore
+106 @func(inline='always')
+107 def __ne__(self, _other: tp.Union['_f32', float]) -> 'bool': return intrinsic("cmp.__ne__._f32", bool, self, _other) # type: ignore
+108 @func(inline='always')
+109 def __truediv__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__truediv__._f32", _f32, self, _other)
+110 @func(inline='always')
+111 def __rtruediv__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__rtruediv__._f32", _f32, self, _other)
+112 @func(inline='always')
+113 def __itruediv__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__itruediv__._f32", _f32, byref(self), _other)
+114 @func(inline='always')
+115 def __pow__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__pow__._f32", _f32, self, _other)
+116 @func(inline='always')
+117 def __rpow__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__rpow__._f32", _f32, self, _other)
+118 @func(inline='always')
+119 def __ipow__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__ipow__._f32", _f32, byref(self), _other)
+120 @func(inline='always')
+121 def __floordiv__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__floordiv__._f32", _f32, self, _other)
+122 @func(inline='always')
+123 def __rfloordiv__(self, _other: tp.Union['_f32', float]) -> '_f32': return intrinsic("binop.__rfloordiv__._f32", _f32, self, _other)
+124 @func(inline='always')
+125 def __neg__(self) -> '_f32': return intrinsic("unary.__neg__._f32", _f32, self)
+126 @func(inline='always')
+127 def __pos__(self) -> '_f32': return intrinsic("unary.__pos__._f32", _f32, self)
+
129@builtin_type(_hir.FloatType(64))
+130class f64:
+131 @func(inline='always')
+132 def __init__(self, _value: tp.Union['f64', float]) -> None:
+133 self = intrinsic("init.f64", f64, _value)
+134 @func(inline='always')
+135 def __add__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__add__.f64", f64, self, _other)
+136 @func(inline='always')
+137 def __radd__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__radd__.f64", f64, self, _other)
+138 @func(inline='always')
+139 def __iadd__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__iadd__.f64", f64, byref(self), _other)
+140 @func(inline='always')
+141 def __sub__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__sub__.f64", f64, self, _other)
+142 @func(inline='always')
+143 def __rsub__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__rsub__.f64", f64, self, _other)
+144 @func(inline='always')
+145 def __isub__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__isub__.f64", f64, byref(self), _other)
+146 @func(inline='always')
+147 def __mul__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__mul__.f64", f64, self, _other)
+148 @func(inline='always')
+149 def __rmul__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__rmul__.f64", f64, self, _other)
+150 @func(inline='always')
+151 def __imul__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__imul__.f64", f64, byref(self), _other)
+152 @func(inline='always')
+153 def __mod__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__mod__.f64", f64, self, _other)
+154 @func(inline='always')
+155 def __rmod__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__rmod__.f64", f64, self, _other)
+156 @func(inline='always')
+157 def __imod__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__imod__.f64", f64, byref(self), _other)
+158 @func(inline='always')
+159 def __lt__(self, _other: tp.Union['f64', float]) -> 'bool': return intrinsic("cmp.__lt__.f64", bool, self, _other) # type: ignore
+160 @func(inline='always')
+161 def __le__(self, _other: tp.Union['f64', float]) -> 'bool': return intrinsic("cmp.__le__.f64", bool, self, _other) # type: ignore
+162 @func(inline='always')
+163 def __gt__(self, _other: tp.Union['f64', float]) -> 'bool': return intrinsic("cmp.__gt__.f64", bool, self, _other) # type: ignore
+164 @func(inline='always')
+165 def __ge__(self, _other: tp.Union['f64', float]) -> 'bool': return intrinsic("cmp.__ge__.f64", bool, self, _other) # type: ignore
+166 @func(inline='always')
+167 def __eq__(self, _other: tp.Union['f64', float]) -> 'bool': return intrinsic("cmp.__eq__.f64", bool, self, _other) # type: ignore
+168 @func(inline='always')
+169 def __ne__(self, _other: tp.Union['f64', float]) -> 'bool': return intrinsic("cmp.__ne__.f64", bool, self, _other) # type: ignore
+170 @func(inline='always')
+171 def __truediv__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__truediv__.f64", f64, self, _other)
+172 @func(inline='always')
+173 def __rtruediv__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__rtruediv__.f64", f64, self, _other)
+174 @func(inline='always')
+175 def __itruediv__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__itruediv__.f64", f64, byref(self), _other)
+176 @func(inline='always')
+177 def __pow__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__pow__.f64", f64, self, _other)
+178 @func(inline='always')
+179 def __rpow__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__rpow__.f64", f64, self, _other)
+180 @func(inline='always')
+181 def __ipow__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__ipow__.f64", f64, byref(self), _other)
+182 @func(inline='always')
+183 def __floordiv__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__floordiv__.f64", f64, self, _other)
+184 @func(inline='always')
+185 def __rfloordiv__(self, _other: tp.Union['f64', float]) -> 'f64': return intrinsic("binop.__rfloordiv__.f64", f64, self, _other)
+186 @func(inline='always')
+187 def __neg__(self) -> 'f64': return intrinsic("unary.__neg__.f64", f64, self)
+188 @func(inline='always')
+189 def __pos__(self) -> 'f64': return intrinsic("unary.__pos__.f64", f64, self)
+
191@builtin_type(_hir.IntType(8, True))
+192class i8:
+193 @func(inline='always')
+194 def __init__(self, _value: tp.Union['i8', IntLiteral]) -> None:
+195 self = intrinsic("init.i8", i8, _value)
+196 @func(inline='always')
+197 def __add__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__add__.i8", i8, self, _other)
+198 @func(inline='always')
+199 def __radd__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__radd__.i8", i8, self, _other)
+200 @func(inline='always')
+201 def __iadd__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__iadd__.i8", i8, byref(self), _other)
+202 @func(inline='always')
+203 def __sub__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__sub__.i8", i8, self, _other)
+204 @func(inline='always')
+205 def __rsub__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__rsub__.i8", i8, self, _other)
+206 @func(inline='always')
+207 def __isub__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__isub__.i8", i8, byref(self), _other)
+208 @func(inline='always')
+209 def __mul__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__mul__.i8", i8, self, _other)
+210 @func(inline='always')
+211 def __rmul__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__rmul__.i8", i8, self, _other)
+212 @func(inline='always')
+213 def __imul__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__imul__.i8", i8, byref(self), _other)
+214 @func(inline='always')
+215 def __mod__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__mod__.i8", i8, self, _other)
+216 @func(inline='always')
+217 def __rmod__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__rmod__.i8", i8, self, _other)
+218 @func(inline='always')
+219 def __imod__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__imod__.i8", i8, byref(self), _other)
+220 @func(inline='always')
+221 def __lt__(self, _other: tp.Union['i8', IntLiteral]) -> 'bool': return intrinsic("cmp.__lt__.i8", bool, self, _other) # type: ignore
+222 @func(inline='always')
+223 def __le__(self, _other: tp.Union['i8', IntLiteral]) -> 'bool': return intrinsic("cmp.__le__.i8", bool, self, _other) # type: ignore
+224 @func(inline='always')
+225 def __gt__(self, _other: tp.Union['i8', IntLiteral]) -> 'bool': return intrinsic("cmp.__gt__.i8", bool, self, _other) # type: ignore
+226 @func(inline='always')
+227 def __ge__(self, _other: tp.Union['i8', IntLiteral]) -> 'bool': return intrinsic("cmp.__ge__.i8", bool, self, _other) # type: ignore
+228 @func(inline='always')
+229 def __eq__(self, _other: tp.Union['i8', IntLiteral]) -> 'bool': return intrinsic("cmp.__eq__.i8", bool, self, _other) # type: ignore
+230 @func(inline='always')
+231 def __ne__(self, _other: tp.Union['i8', IntLiteral]) -> 'bool': return intrinsic("cmp.__ne__.i8", bool, self, _other) # type: ignore
+232 @func(inline='always')
+233 def __floordiv__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__floordiv__.i8", i8, self, _other)
+234 @func(inline='always')
+235 def __rfloordiv__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__rfloordiv__.i8", i8, self, _other)
+236 @func(inline='always')
+237 def __ifloordiv__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__ifloordiv__.i8", i8, byref(self), _other)
+238 @func(inline='always')
+239 def __lshift__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__lshift__.i8", i8, self, _other)
+240 @func(inline='always')
+241 def __rlshift__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__rlshift__.i8", i8, self, _other)
+242 @func(inline='always')
+243 def __ilshift__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__ilshift__.i8", i8, byref(self), _other)
+244 @func(inline='always')
+245 def __rshift__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__rshift__.i8", i8, self, _other)
+246 @func(inline='always')
+247 def __rrshift__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__rrshift__.i8", i8, self, _other)
+248 @func(inline='always')
+249 def __irshift__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__irshift__.i8", i8, byref(self), _other)
+250 @func(inline='always')
+251 def __and__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__and__.i8", i8, self, _other)
+252 @func(inline='always')
+253 def __rand__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__rand__.i8", i8, self, _other)
+254 @func(inline='always')
+255 def __iand__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__iand__.i8", i8, byref(self), _other)
+256 @func(inline='always')
+257 def __or__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__or__.i8", i8, self, _other)
+258 @func(inline='always')
+259 def __ror__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__ror__.i8", i8, self, _other)
+260 @func(inline='always')
+261 def __ior__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__ior__.i8", i8, byref(self), _other)
+262 @func(inline='always')
+263 def __xor__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__xor__.i8", i8, self, _other)
+264 @func(inline='always')
+265 def __rxor__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__rxor__.i8", i8, self, _other)
+266 @func(inline='always')
+267 def __ixor__(self, _other: tp.Union['i8', IntLiteral]) -> 'i8': return intrinsic("binop.__ixor__.i8", i8, byref(self), _other)
+268 @func(inline='always')
+269 def __neg__(self) -> 'i8': return intrinsic("unary.__neg__.i8", i8, self)
+270 @func(inline='always')
+271 def __pos__(self) -> 'i8': return intrinsic("unary.__pos__.i8", i8, self)
+272 @func(inline='always')
+273 def __invert__(self) -> 'i8': return intrinsic("unary.__invert__.i8", i8, self)
+
275@builtin_type(_hir.IntType(8, False))
+276class u8:
+277 @func(inline='always')
+278 def __init__(self, _value: tp.Union['u8', IntLiteral]) -> None:
+279 self = intrinsic("init.u8", u8, _value)
+280 @func(inline='always')
+281 def __add__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__add__.u8", u8, self, _other)
+282 @func(inline='always')
+283 def __radd__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__radd__.u8", u8, self, _other)
+284 @func(inline='always')
+285 def __iadd__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__iadd__.u8", u8, byref(self), _other)
+286 @func(inline='always')
+287 def __sub__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__sub__.u8", u8, self, _other)
+288 @func(inline='always')
+289 def __rsub__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__rsub__.u8", u8, self, _other)
+290 @func(inline='always')
+291 def __isub__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__isub__.u8", u8, byref(self), _other)
+292 @func(inline='always')
+293 def __mul__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__mul__.u8", u8, self, _other)
+294 @func(inline='always')
+295 def __rmul__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__rmul__.u8", u8, self, _other)
+296 @func(inline='always')
+297 def __imul__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__imul__.u8", u8, byref(self), _other)
+298 @func(inline='always')
+299 def __mod__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__mod__.u8", u8, self, _other)
+300 @func(inline='always')
+301 def __rmod__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__rmod__.u8", u8, self, _other)
+302 @func(inline='always')
+303 def __imod__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__imod__.u8", u8, byref(self), _other)
+304 @func(inline='always')
+305 def __lt__(self, _other: tp.Union['u8', IntLiteral]) -> 'bool': return intrinsic("cmp.__lt__.u8", bool, self, _other) # type: ignore
+306 @func(inline='always')
+307 def __le__(self, _other: tp.Union['u8', IntLiteral]) -> 'bool': return intrinsic("cmp.__le__.u8", bool, self, _other) # type: ignore
+308 @func(inline='always')
+309 def __gt__(self, _other: tp.Union['u8', IntLiteral]) -> 'bool': return intrinsic("cmp.__gt__.u8", bool, self, _other) # type: ignore
+310 @func(inline='always')
+311 def __ge__(self, _other: tp.Union['u8', IntLiteral]) -> 'bool': return intrinsic("cmp.__ge__.u8", bool, self, _other) # type: ignore
+312 @func(inline='always')
+313 def __eq__(self, _other: tp.Union['u8', IntLiteral]) -> 'bool': return intrinsic("cmp.__eq__.u8", bool, self, _other) # type: ignore
+314 @func(inline='always')
+315 def __ne__(self, _other: tp.Union['u8', IntLiteral]) -> 'bool': return intrinsic("cmp.__ne__.u8", bool, self, _other) # type: ignore
+316 @func(inline='always')
+317 def __floordiv__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__floordiv__.u8", u8, self, _other)
+318 @func(inline='always')
+319 def __rfloordiv__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__rfloordiv__.u8", u8, self, _other)
+320 @func(inline='always')
+321 def __ifloordiv__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__ifloordiv__.u8", u8, byref(self), _other)
+322 @func(inline='always')
+323 def __lshift__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__lshift__.u8", u8, self, _other)
+324 @func(inline='always')
+325 def __rlshift__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__rlshift__.u8", u8, self, _other)
+326 @func(inline='always')
+327 def __ilshift__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__ilshift__.u8", u8, byref(self), _other)
+328 @func(inline='always')
+329 def __rshift__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__rshift__.u8", u8, self, _other)
+330 @func(inline='always')
+331 def __rrshift__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__rrshift__.u8", u8, self, _other)
+332 @func(inline='always')
+333 def __irshift__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__irshift__.u8", u8, byref(self), _other)
+334 @func(inline='always')
+335 def __and__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__and__.u8", u8, self, _other)
+336 @func(inline='always')
+337 def __rand__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__rand__.u8", u8, self, _other)
+338 @func(inline='always')
+339 def __iand__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__iand__.u8", u8, byref(self), _other)
+340 @func(inline='always')
+341 def __or__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__or__.u8", u8, self, _other)
+342 @func(inline='always')
+343 def __ror__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__ror__.u8", u8, self, _other)
+344 @func(inline='always')
+345 def __ior__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__ior__.u8", u8, byref(self), _other)
+346 @func(inline='always')
+347 def __xor__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__xor__.u8", u8, self, _other)
+348 @func(inline='always')
+349 def __rxor__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__rxor__.u8", u8, self, _other)
+350 @func(inline='always')
+351 def __ixor__(self, _other: tp.Union['u8', IntLiteral]) -> 'u8': return intrinsic("binop.__ixor__.u8", u8, byref(self), _other)
+352 @func(inline='always')
+353 def __neg__(self) -> 'u8': return intrinsic("unary.__neg__.u8", u8, self)
+354 @func(inline='always')
+355 def __pos__(self) -> 'u8': return intrinsic("unary.__pos__.u8", u8, self)
+356 @func(inline='always')
+357 def __invert__(self) -> 'u8': return intrinsic("unary.__invert__.u8", u8, self)
+
359@builtin_type(_hir.IntType(16, True))
+360class i16:
+361 @func(inline='always')
+362 def __init__(self, _value: tp.Union['i16', IntLiteral]) -> None:
+363 self = intrinsic("init.i16", i16, _value)
+364 @func(inline='always')
+365 def __add__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__add__.i16", i16, self, _other)
+366 @func(inline='always')
+367 def __radd__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__radd__.i16", i16, self, _other)
+368 @func(inline='always')
+369 def __iadd__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__iadd__.i16", i16, byref(self), _other)
+370 @func(inline='always')
+371 def __sub__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__sub__.i16", i16, self, _other)
+372 @func(inline='always')
+373 def __rsub__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__rsub__.i16", i16, self, _other)
+374 @func(inline='always')
+375 def __isub__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__isub__.i16", i16, byref(self), _other)
+376 @func(inline='always')
+377 def __mul__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__mul__.i16", i16, self, _other)
+378 @func(inline='always')
+379 def __rmul__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__rmul__.i16", i16, self, _other)
+380 @func(inline='always')
+381 def __imul__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__imul__.i16", i16, byref(self), _other)
+382 @func(inline='always')
+383 def __mod__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__mod__.i16", i16, self, _other)
+384 @func(inline='always')
+385 def __rmod__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__rmod__.i16", i16, self, _other)
+386 @func(inline='always')
+387 def __imod__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__imod__.i16", i16, byref(self), _other)
+388 @func(inline='always')
+389 def __lt__(self, _other: tp.Union['i16', IntLiteral]) -> 'bool': return intrinsic("cmp.__lt__.i16", bool, self, _other) # type: ignore
+390 @func(inline='always')
+391 def __le__(self, _other: tp.Union['i16', IntLiteral]) -> 'bool': return intrinsic("cmp.__le__.i16", bool, self, _other) # type: ignore
+392 @func(inline='always')
+393 def __gt__(self, _other: tp.Union['i16', IntLiteral]) -> 'bool': return intrinsic("cmp.__gt__.i16", bool, self, _other) # type: ignore
+394 @func(inline='always')
+395 def __ge__(self, _other: tp.Union['i16', IntLiteral]) -> 'bool': return intrinsic("cmp.__ge__.i16", bool, self, _other) # type: ignore
+396 @func(inline='always')
+397 def __eq__(self, _other: tp.Union['i16', IntLiteral]) -> 'bool': return intrinsic("cmp.__eq__.i16", bool, self, _other) # type: ignore
+398 @func(inline='always')
+399 def __ne__(self, _other: tp.Union['i16', IntLiteral]) -> 'bool': return intrinsic("cmp.__ne__.i16", bool, self, _other) # type: ignore
+400 @func(inline='always')
+401 def __floordiv__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__floordiv__.i16", i16, self, _other)
+402 @func(inline='always')
+403 def __rfloordiv__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__rfloordiv__.i16", i16, self, _other)
+404 @func(inline='always')
+405 def __ifloordiv__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__ifloordiv__.i16", i16, byref(self), _other)
+406 @func(inline='always')
+407 def __lshift__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__lshift__.i16", i16, self, _other)
+408 @func(inline='always')
+409 def __rlshift__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__rlshift__.i16", i16, self, _other)
+410 @func(inline='always')
+411 def __ilshift__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__ilshift__.i16", i16, byref(self), _other)
+412 @func(inline='always')
+413 def __rshift__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__rshift__.i16", i16, self, _other)
+414 @func(inline='always')
+415 def __rrshift__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__rrshift__.i16", i16, self, _other)
+416 @func(inline='always')
+417 def __irshift__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__irshift__.i16", i16, byref(self), _other)
+418 @func(inline='always')
+419 def __and__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__and__.i16", i16, self, _other)
+420 @func(inline='always')
+421 def __rand__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__rand__.i16", i16, self, _other)
+422 @func(inline='always')
+423 def __iand__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__iand__.i16", i16, byref(self), _other)
+424 @func(inline='always')
+425 def __or__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__or__.i16", i16, self, _other)
+426 @func(inline='always')
+427 def __ror__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__ror__.i16", i16, self, _other)
+428 @func(inline='always')
+429 def __ior__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__ior__.i16", i16, byref(self), _other)
+430 @func(inline='always')
+431 def __xor__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__xor__.i16", i16, self, _other)
+432 @func(inline='always')
+433 def __rxor__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__rxor__.i16", i16, self, _other)
+434 @func(inline='always')
+435 def __ixor__(self, _other: tp.Union['i16', IntLiteral]) -> 'i16': return intrinsic("binop.__ixor__.i16", i16, byref(self), _other)
+436 @func(inline='always')
+437 def __neg__(self) -> 'i16': return intrinsic("unary.__neg__.i16", i16, self)
+438 @func(inline='always')
+439 def __pos__(self) -> 'i16': return intrinsic("unary.__pos__.i16", i16, self)
+440 @func(inline='always')
+441 def __invert__(self) -> 'i16': return intrinsic("unary.__invert__.i16", i16, self)
+
443@builtin_type(_hir.IntType(16, False))
+444class u16:
+445 @func(inline='always')
+446 def __init__(self, _value: tp.Union['u16', IntLiteral]) -> None:
+447 self = intrinsic("init.u16", u16, _value)
+448 @func(inline='always')
+449 def __add__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__add__.u16", u16, self, _other)
+450 @func(inline='always')
+451 def __radd__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__radd__.u16", u16, self, _other)
+452 @func(inline='always')
+453 def __iadd__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__iadd__.u16", u16, byref(self), _other)
+454 @func(inline='always')
+455 def __sub__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__sub__.u16", u16, self, _other)
+456 @func(inline='always')
+457 def __rsub__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__rsub__.u16", u16, self, _other)
+458 @func(inline='always')
+459 def __isub__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__isub__.u16", u16, byref(self), _other)
+460 @func(inline='always')
+461 def __mul__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__mul__.u16", u16, self, _other)
+462 @func(inline='always')
+463 def __rmul__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__rmul__.u16", u16, self, _other)
+464 @func(inline='always')
+465 def __imul__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__imul__.u16", u16, byref(self), _other)
+466 @func(inline='always')
+467 def __mod__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__mod__.u16", u16, self, _other)
+468 @func(inline='always')
+469 def __rmod__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__rmod__.u16", u16, self, _other)
+470 @func(inline='always')
+471 def __imod__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__imod__.u16", u16, byref(self), _other)
+472 @func(inline='always')
+473 def __lt__(self, _other: tp.Union['u16', IntLiteral]) -> 'bool': return intrinsic("cmp.__lt__.u16", bool, self, _other) # type: ignore
+474 @func(inline='always')
+475 def __le__(self, _other: tp.Union['u16', IntLiteral]) -> 'bool': return intrinsic("cmp.__le__.u16", bool, self, _other) # type: ignore
+476 @func(inline='always')
+477 def __gt__(self, _other: tp.Union['u16', IntLiteral]) -> 'bool': return intrinsic("cmp.__gt__.u16", bool, self, _other) # type: ignore
+478 @func(inline='always')
+479 def __ge__(self, _other: tp.Union['u16', IntLiteral]) -> 'bool': return intrinsic("cmp.__ge__.u16", bool, self, _other) # type: ignore
+480 @func(inline='always')
+481 def __eq__(self, _other: tp.Union['u16', IntLiteral]) -> 'bool': return intrinsic("cmp.__eq__.u16", bool, self, _other) # type: ignore
+482 @func(inline='always')
+483 def __ne__(self, _other: tp.Union['u16', IntLiteral]) -> 'bool': return intrinsic("cmp.__ne__.u16", bool, self, _other) # type: ignore
+484 @func(inline='always')
+485 def __floordiv__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__floordiv__.u16", u16, self, _other)
+486 @func(inline='always')
+487 def __rfloordiv__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__rfloordiv__.u16", u16, self, _other)
+488 @func(inline='always')
+489 def __ifloordiv__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__ifloordiv__.u16", u16, byref(self), _other)
+490 @func(inline='always')
+491 def __lshift__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__lshift__.u16", u16, self, _other)
+492 @func(inline='always')
+493 def __rlshift__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__rlshift__.u16", u16, self, _other)
+494 @func(inline='always')
+495 def __ilshift__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__ilshift__.u16", u16, byref(self), _other)
+496 @func(inline='always')
+497 def __rshift__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__rshift__.u16", u16, self, _other)
+498 @func(inline='always')
+499 def __rrshift__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__rrshift__.u16", u16, self, _other)
+500 @func(inline='always')
+501 def __irshift__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__irshift__.u16", u16, byref(self), _other)
+502 @func(inline='always')
+503 def __and__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__and__.u16", u16, self, _other)
+504 @func(inline='always')
+505 def __rand__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__rand__.u16", u16, self, _other)
+506 @func(inline='always')
+507 def __iand__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__iand__.u16", u16, byref(self), _other)
+508 @func(inline='always')
+509 def __or__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__or__.u16", u16, self, _other)
+510 @func(inline='always')
+511 def __ror__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__ror__.u16", u16, self, _other)
+512 @func(inline='always')
+513 def __ior__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__ior__.u16", u16, byref(self), _other)
+514 @func(inline='always')
+515 def __xor__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__xor__.u16", u16, self, _other)
+516 @func(inline='always')
+517 def __rxor__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__rxor__.u16", u16, self, _other)
+518 @func(inline='always')
+519 def __ixor__(self, _other: tp.Union['u16', IntLiteral]) -> 'u16': return intrinsic("binop.__ixor__.u16", u16, byref(self), _other)
+520 @func(inline='always')
+521 def __neg__(self) -> 'u16': return intrinsic("unary.__neg__.u16", u16, self)
+522 @func(inline='always')
+523 def __pos__(self) -> 'u16': return intrinsic("unary.__pos__.u16", u16, self)
+524 @func(inline='always')
+525 def __invert__(self) -> 'u16': return intrinsic("unary.__invert__.u16", u16, self)
+
527@builtin_type(_hir.IntType(64, True))
+528class i64:
+529 @func(inline='always')
+530 def __init__(self, _value: tp.Union['i64', IntLiteral]) -> None:
+531 self = intrinsic("init.i64", i64, _value)
+532 @func(inline='always')
+533 def __add__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__add__.i64", i64, self, _other)
+534 @func(inline='always')
+535 def __radd__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__radd__.i64", i64, self, _other)
+536 @func(inline='always')
+537 def __iadd__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__iadd__.i64", i64, byref(self), _other)
+538 @func(inline='always')
+539 def __sub__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__sub__.i64", i64, self, _other)
+540 @func(inline='always')
+541 def __rsub__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__rsub__.i64", i64, self, _other)
+542 @func(inline='always')
+543 def __isub__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__isub__.i64", i64, byref(self), _other)
+544 @func(inline='always')
+545 def __mul__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__mul__.i64", i64, self, _other)
+546 @func(inline='always')
+547 def __rmul__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__rmul__.i64", i64, self, _other)
+548 @func(inline='always')
+549 def __imul__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__imul__.i64", i64, byref(self), _other)
+550 @func(inline='always')
+551 def __mod__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__mod__.i64", i64, self, _other)
+552 @func(inline='always')
+553 def __rmod__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__rmod__.i64", i64, self, _other)
+554 @func(inline='always')
+555 def __imod__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__imod__.i64", i64, byref(self), _other)
+556 @func(inline='always')
+557 def __lt__(self, _other: tp.Union['i64', IntLiteral]) -> 'bool': return intrinsic("cmp.__lt__.i64", bool, self, _other) # type: ignore
+558 @func(inline='always')
+559 def __le__(self, _other: tp.Union['i64', IntLiteral]) -> 'bool': return intrinsic("cmp.__le__.i64", bool, self, _other) # type: ignore
+560 @func(inline='always')
+561 def __gt__(self, _other: tp.Union['i64', IntLiteral]) -> 'bool': return intrinsic("cmp.__gt__.i64", bool, self, _other) # type: ignore
+562 @func(inline='always')
+563 def __ge__(self, _other: tp.Union['i64', IntLiteral]) -> 'bool': return intrinsic("cmp.__ge__.i64", bool, self, _other) # type: ignore
+564 @func(inline='always')
+565 def __eq__(self, _other: tp.Union['i64', IntLiteral]) -> 'bool': return intrinsic("cmp.__eq__.i64", bool, self, _other) # type: ignore
+566 @func(inline='always')
+567 def __ne__(self, _other: tp.Union['i64', IntLiteral]) -> 'bool': return intrinsic("cmp.__ne__.i64", bool, self, _other) # type: ignore
+568 @func(inline='always')
+569 def __floordiv__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__floordiv__.i64", i64, self, _other)
+570 @func(inline='always')
+571 def __rfloordiv__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__rfloordiv__.i64", i64, self, _other)
+572 @func(inline='always')
+573 def __ifloordiv__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__ifloordiv__.i64", i64, byref(self), _other)
+574 @func(inline='always')
+575 def __lshift__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__lshift__.i64", i64, self, _other)
+576 @func(inline='always')
+577 def __rlshift__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__rlshift__.i64", i64, self, _other)
+578 @func(inline='always')
+579 def __ilshift__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__ilshift__.i64", i64, byref(self), _other)
+580 @func(inline='always')
+581 def __rshift__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__rshift__.i64", i64, self, _other)
+582 @func(inline='always')
+583 def __rrshift__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__rrshift__.i64", i64, self, _other)
+584 @func(inline='always')
+585 def __irshift__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__irshift__.i64", i64, byref(self), _other)
+586 @func(inline='always')
+587 def __and__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__and__.i64", i64, self, _other)
+588 @func(inline='always')
+589 def __rand__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__rand__.i64", i64, self, _other)
+590 @func(inline='always')
+591 def __iand__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__iand__.i64", i64, byref(self), _other)
+592 @func(inline='always')
+593 def __or__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__or__.i64", i64, self, _other)
+594 @func(inline='always')
+595 def __ror__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__ror__.i64", i64, self, _other)
+596 @func(inline='always')
+597 def __ior__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__ior__.i64", i64, byref(self), _other)
+598 @func(inline='always')
+599 def __xor__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__xor__.i64", i64, self, _other)
+600 @func(inline='always')
+601 def __rxor__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__rxor__.i64", i64, self, _other)
+602 @func(inline='always')
+603 def __ixor__(self, _other: tp.Union['i64', IntLiteral]) -> 'i64': return intrinsic("binop.__ixor__.i64", i64, byref(self), _other)
+604 @func(inline='always')
+605 def __neg__(self) -> 'i64': return intrinsic("unary.__neg__.i64", i64, self)
+606 @func(inline='always')
+607 def __pos__(self) -> 'i64': return intrinsic("unary.__pos__.i64", i64, self)
+608 @func(inline='always')
+609 def __invert__(self) -> 'i64': return intrinsic("unary.__invert__.i64", i64, self)
+
611@builtin_type(_hir.IntType(64, False))
+612class u64:
+613 @func(inline='always')
+614 def __init__(self, _value: tp.Union['u64', IntLiteral]) -> None:
+615 self = intrinsic("init.u64", u64, _value)
+616 @func(inline='always')
+617 def __add__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__add__.u64", u64, self, _other)
+618 @func(inline='always')
+619 def __radd__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__radd__.u64", u64, self, _other)
+620 @func(inline='always')
+621 def __iadd__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__iadd__.u64", u64, byref(self), _other)
+622 @func(inline='always')
+623 def __sub__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__sub__.u64", u64, self, _other)
+624 @func(inline='always')
+625 def __rsub__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__rsub__.u64", u64, self, _other)
+626 @func(inline='always')
+627 def __isub__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__isub__.u64", u64, byref(self), _other)
+628 @func(inline='always')
+629 def __mul__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__mul__.u64", u64, self, _other)
+630 @func(inline='always')
+631 def __rmul__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__rmul__.u64", u64, self, _other)
+632 @func(inline='always')
+633 def __imul__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__imul__.u64", u64, byref(self), _other)
+634 @func(inline='always')
+635 def __mod__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__mod__.u64", u64, self, _other)
+636 @func(inline='always')
+637 def __rmod__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__rmod__.u64", u64, self, _other)
+638 @func(inline='always')
+639 def __imod__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__imod__.u64", u64, byref(self), _other)
+640 @func(inline='always')
+641 def __lt__(self, _other: tp.Union['u64', IntLiteral]) -> 'bool': return intrinsic("cmp.__lt__.u64", bool, self, _other) # type: ignore
+642 @func(inline='always')
+643 def __le__(self, _other: tp.Union['u64', IntLiteral]) -> 'bool': return intrinsic("cmp.__le__.u64", bool, self, _other) # type: ignore
+644 @func(inline='always')
+645 def __gt__(self, _other: tp.Union['u64', IntLiteral]) -> 'bool': return intrinsic("cmp.__gt__.u64", bool, self, _other) # type: ignore
+646 @func(inline='always')
+647 def __ge__(self, _other: tp.Union['u64', IntLiteral]) -> 'bool': return intrinsic("cmp.__ge__.u64", bool, self, _other) # type: ignore
+648 @func(inline='always')
+649 def __eq__(self, _other: tp.Union['u64', IntLiteral]) -> 'bool': return intrinsic("cmp.__eq__.u64", bool, self, _other) # type: ignore
+650 @func(inline='always')
+651 def __ne__(self, _other: tp.Union['u64', IntLiteral]) -> 'bool': return intrinsic("cmp.__ne__.u64", bool, self, _other) # type: ignore
+652 @func(inline='always')
+653 def __floordiv__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__floordiv__.u64", u64, self, _other)
+654 @func(inline='always')
+655 def __rfloordiv__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__rfloordiv__.u64", u64, self, _other)
+656 @func(inline='always')
+657 def __ifloordiv__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__ifloordiv__.u64", u64, byref(self), _other)
+658 @func(inline='always')
+659 def __lshift__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__lshift__.u64", u64, self, _other)
+660 @func(inline='always')
+661 def __rlshift__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__rlshift__.u64", u64, self, _other)
+662 @func(inline='always')
+663 def __ilshift__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__ilshift__.u64", u64, byref(self), _other)
+664 @func(inline='always')
+665 def __rshift__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__rshift__.u64", u64, self, _other)
+666 @func(inline='always')
+667 def __rrshift__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__rrshift__.u64", u64, self, _other)
+668 @func(inline='always')
+669 def __irshift__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__irshift__.u64", u64, byref(self), _other)
+670 @func(inline='always')
+671 def __and__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__and__.u64", u64, self, _other)
+672 @func(inline='always')
+673 def __rand__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__rand__.u64", u64, self, _other)
+674 @func(inline='always')
+675 def __iand__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__iand__.u64", u64, byref(self), _other)
+676 @func(inline='always')
+677 def __or__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__or__.u64", u64, self, _other)
+678 @func(inline='always')
+679 def __ror__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__ror__.u64", u64, self, _other)
+680 @func(inline='always')
+681 def __ior__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__ior__.u64", u64, byref(self), _other)
+682 @func(inline='always')
+683 def __xor__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__xor__.u64", u64, self, _other)
+684 @func(inline='always')
+685 def __rxor__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__rxor__.u64", u64, self, _other)
+686 @func(inline='always')
+687 def __ixor__(self, _other: tp.Union['u64', IntLiteral]) -> 'u64': return intrinsic("binop.__ixor__.u64", u64, byref(self), _other)
+688 @func(inline='always')
+689 def __neg__(self) -> 'u64': return intrinsic("unary.__neg__.u64", u64, self)
+690 @func(inline='always')
+691 def __pos__(self) -> 'u64': return intrinsic("unary.__pos__.u64", u64, self)
+692 @func(inline='always')
+693 def __invert__(self) -> 'u64': return intrinsic("unary.__invert__.u64", u64, self)
+
695@builtin_type(_hir.IntType(32, True))
+696class _i32:
+697 @func(inline='always')
+698 def __init__(self, _value: tp.Union['_i32', IntLiteral]) -> None:
+699 self = intrinsic("init._i32", _i32, _value)
+700 @func(inline='always')
+701 def __add__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__add__._i32", _i32, self, _other)
+702 @func(inline='always')
+703 def __radd__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__radd__._i32", _i32, self, _other)
+704 @func(inline='always')
+705 def __iadd__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__iadd__._i32", _i32, byref(self), _other)
+706 @func(inline='always')
+707 def __sub__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__sub__._i32", _i32, self, _other)
+708 @func(inline='always')
+709 def __rsub__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__rsub__._i32", _i32, self, _other)
+710 @func(inline='always')
+711 def __isub__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__isub__._i32", _i32, byref(self), _other)
+712 @func(inline='always')
+713 def __mul__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__mul__._i32", _i32, self, _other)
+714 @func(inline='always')
+715 def __rmul__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__rmul__._i32", _i32, self, _other)
+716 @func(inline='always')
+717 def __imul__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__imul__._i32", _i32, byref(self), _other)
+718 @func(inline='always')
+719 def __mod__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__mod__._i32", _i32, self, _other)
+720 @func(inline='always')
+721 def __rmod__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__rmod__._i32", _i32, self, _other)
+722 @func(inline='always')
+723 def __imod__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__imod__._i32", _i32, byref(self), _other)
+724 @func(inline='always')
+725 def __lt__(self, _other: tp.Union['_i32', IntLiteral]) -> 'bool': return intrinsic("cmp.__lt__._i32", bool, self, _other) # type: ignore
+726 @func(inline='always')
+727 def __le__(self, _other: tp.Union['_i32', IntLiteral]) -> 'bool': return intrinsic("cmp.__le__._i32", bool, self, _other) # type: ignore
+728 @func(inline='always')
+729 def __gt__(self, _other: tp.Union['_i32', IntLiteral]) -> 'bool': return intrinsic("cmp.__gt__._i32", bool, self, _other) # type: ignore
+730 @func(inline='always')
+731 def __ge__(self, _other: tp.Union['_i32', IntLiteral]) -> 'bool': return intrinsic("cmp.__ge__._i32", bool, self, _other) # type: ignore
+732 @func(inline='always')
+733 def __eq__(self, _other: tp.Union['_i32', IntLiteral]) -> 'bool': return intrinsic("cmp.__eq__._i32", bool, self, _other) # type: ignore
+734 @func(inline='always')
+735 def __ne__(self, _other: tp.Union['_i32', IntLiteral]) -> 'bool': return intrinsic("cmp.__ne__._i32", bool, self, _other) # type: ignore
+736 @func(inline='always')
+737 def __floordiv__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__floordiv__._i32", _i32, self, _other)
+738 @func(inline='always')
+739 def __rfloordiv__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__rfloordiv__._i32", _i32, self, _other)
+740 @func(inline='always')
+741 def __ifloordiv__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__ifloordiv__._i32", _i32, byref(self), _other)
+742 @func(inline='always')
+743 def __lshift__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__lshift__._i32", _i32, self, _other)
+744 @func(inline='always')
+745 def __rlshift__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__rlshift__._i32", _i32, self, _other)
+746 @func(inline='always')
+747 def __ilshift__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__ilshift__._i32", _i32, byref(self), _other)
+748 @func(inline='always')
+749 def __rshift__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__rshift__._i32", _i32, self, _other)
+750 @func(inline='always')
+751 def __rrshift__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__rrshift__._i32", _i32, self, _other)
+752 @func(inline='always')
+753 def __irshift__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__irshift__._i32", _i32, byref(self), _other)
+754 @func(inline='always')
+755 def __and__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__and__._i32", _i32, self, _other)
+756 @func(inline='always')
+757 def __rand__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__rand__._i32", _i32, self, _other)
+758 @func(inline='always')
+759 def __iand__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__iand__._i32", _i32, byref(self), _other)
+760 @func(inline='always')
+761 def __or__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__or__._i32", _i32, self, _other)
+762 @func(inline='always')
+763 def __ror__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__ror__._i32", _i32, self, _other)
+764 @func(inline='always')
+765 def __ior__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__ior__._i32", _i32, byref(self), _other)
+766 @func(inline='always')
+767 def __xor__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__xor__._i32", _i32, self, _other)
+768 @func(inline='always')
+769 def __rxor__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__rxor__._i32", _i32, self, _other)
+770 @func(inline='always')
+771 def __ixor__(self, _other: tp.Union['_i32', IntLiteral]) -> '_i32': return intrinsic("binop.__ixor__._i32", _i32, byref(self), _other)
+772 @func(inline='always')
+773 def __neg__(self) -> '_i32': return intrinsic("unary.__neg__._i32", _i32, self)
+774 @func(inline='always')
+775 def __pos__(self) -> '_i32': return intrinsic("unary.__pos__._i32", _i32, self)
+776 @func(inline='always')
+777 def __invert__(self) -> '_i32': return intrinsic("unary.__invert__._i32", _i32, self)
+
779@builtin_type(_hir.IntType(32, False))
+780class u32:
+781 @func(inline='always')
+782 def __init__(self, _value: tp.Union['u32', IntLiteral]) -> None:
+783 self = intrinsic("init.u32", u32, _value)
+784 @func(inline='always')
+785 def __add__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__add__.u32", u32, self, _other)
+786 @func(inline='always')
+787 def __radd__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__radd__.u32", u32, self, _other)
+788 @func(inline='always')
+789 def __iadd__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__iadd__.u32", u32, byref(self), _other)
+790 @func(inline='always')
+791 def __sub__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__sub__.u32", u32, self, _other)
+792 @func(inline='always')
+793 def __rsub__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__rsub__.u32", u32, self, _other)
+794 @func(inline='always')
+795 def __isub__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__isub__.u32", u32, byref(self), _other)
+796 @func(inline='always')
+797 def __mul__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__mul__.u32", u32, self, _other)
+798 @func(inline='always')
+799 def __rmul__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__rmul__.u32", u32, self, _other)
+800 @func(inline='always')
+801 def __imul__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__imul__.u32", u32, byref(self), _other)
+802 @func(inline='always')
+803 def __mod__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__mod__.u32", u32, self, _other)
+804 @func(inline='always')
+805 def __rmod__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__rmod__.u32", u32, self, _other)
+806 @func(inline='always')
+807 def __imod__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__imod__.u32", u32, byref(self), _other)
+808 @func(inline='always')
+809 def __lt__(self, _other: tp.Union['u32', IntLiteral]) -> 'bool': return intrinsic("cmp.__lt__.u32", bool, self, _other) # type: ignore
+810 @func(inline='always')
+811 def __le__(self, _other: tp.Union['u32', IntLiteral]) -> 'bool': return intrinsic("cmp.__le__.u32", bool, self, _other) # type: ignore
+812 @func(inline='always')
+813 def __gt__(self, _other: tp.Union['u32', IntLiteral]) -> 'bool': return intrinsic("cmp.__gt__.u32", bool, self, _other) # type: ignore
+814 @func(inline='always')
+815 def __ge__(self, _other: tp.Union['u32', IntLiteral]) -> 'bool': return intrinsic("cmp.__ge__.u32", bool, self, _other) # type: ignore
+816 @func(inline='always')
+817 def __eq__(self, _other: tp.Union['u32', IntLiteral]) -> 'bool': return intrinsic("cmp.__eq__.u32", bool, self, _other) # type: ignore
+818 @func(inline='always')
+819 def __ne__(self, _other: tp.Union['u32', IntLiteral]) -> 'bool': return intrinsic("cmp.__ne__.u32", bool, self, _other) # type: ignore
+820 @func(inline='always')
+821 def __floordiv__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__floordiv__.u32", u32, self, _other)
+822 @func(inline='always')
+823 def __rfloordiv__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__rfloordiv__.u32", u32, self, _other)
+824 @func(inline='always')
+825 def __ifloordiv__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__ifloordiv__.u32", u32, byref(self), _other)
+826 @func(inline='always')
+827 def __lshift__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__lshift__.u32", u32, self, _other)
+828 @func(inline='always')
+829 def __rlshift__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__rlshift__.u32", u32, self, _other)
+830 @func(inline='always')
+831 def __ilshift__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__ilshift__.u32", u32, byref(self), _other)
+832 @func(inline='always')
+833 def __rshift__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__rshift__.u32", u32, self, _other)
+834 @func(inline='always')
+835 def __rrshift__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__rrshift__.u32", u32, self, _other)
+836 @func(inline='always')
+837 def __irshift__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__irshift__.u32", u32, byref(self), _other)
+838 @func(inline='always')
+839 def __and__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__and__.u32", u32, self, _other)
+840 @func(inline='always')
+841 def __rand__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__rand__.u32", u32, self, _other)
+842 @func(inline='always')
+843 def __iand__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__iand__.u32", u32, byref(self), _other)
+844 @func(inline='always')
+845 def __or__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__or__.u32", u32, self, _other)
+846 @func(inline='always')
+847 def __ror__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__ror__.u32", u32, self, _other)
+848 @func(inline='always')
+849 def __ior__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__ior__.u32", u32, byref(self), _other)
+850 @func(inline='always')
+851 def __xor__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__xor__.u32", u32, self, _other)
+852 @func(inline='always')
+853 def __rxor__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__rxor__.u32", u32, self, _other)
+854 @func(inline='always')
+855 def __ixor__(self, _other: tp.Union['u32', IntLiteral]) -> 'u32': return intrinsic("binop.__ixor__.u32", u32, byref(self), _other)
+856 @func(inline='always')
+857 def __neg__(self) -> 'u32': return intrinsic("unary.__neg__.u32", u32, self)
+858 @func(inline='always')
+859 def __pos__(self) -> 'u32': return intrinsic("unary.__pos__.u32", u32, self)
+860 @func(inline='always')
+861 def __invert__(self) -> 'u32': return intrinsic("unary.__invert__.u32", u32, self)
+
865@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[bool]), 2))
+866class bool2:
+867 x: bool
+868 y: bool
+869 def __init__(self, x: tp.Union['bool', bool] = False, y: tp.Union['bool', bool] = False) -> None: self = intrinsic("init.bool2", bool2, x, y)
+870 @func(inline='always')
+871 def __eq__(self, _other: tp.Union['bool2', bool, bool]) -> 'bool2': return intrinsic("cmp.__eq__.bool2", bool2, self, _other) # type: ignore
+872 @func(inline='always')
+873 def __ne__(self, _other: tp.Union['bool2', bool, bool]) -> 'bool2': return intrinsic("cmp.__ne__.bool2", bool2, self, _other) # type: ignore
+874 @func(inline='always')
+875 def __and__(self, _other: tp.Union['bool2', bool, bool]) -> 'bool2': return intrinsic("binop.__and__.bool2", bool2, self, _other)
+876 @func(inline='always')
+877 def __rand__(self, _other: tp.Union['bool2', bool, bool]) -> 'bool2': return intrinsic("binop.__rand__.bool2", bool2, self, _other)
+878 @func(inline='always')
+879 def __iand__(self, _other: tp.Union['bool2', bool, bool]) -> 'bool2': return intrinsic("binop.__iand__.bool2", bool2, byref(self), _other)
+880 @func(inline='always')
+881 def __or__(self, _other: tp.Union['bool2', bool, bool]) -> 'bool2': return intrinsic("binop.__or__.bool2", bool2, self, _other)
+882 @func(inline='always')
+883 def __ror__(self, _other: tp.Union['bool2', bool, bool]) -> 'bool2': return intrinsic("binop.__ror__.bool2", bool2, self, _other)
+884 @func(inline='always')
+885 def __ior__(self, _other: tp.Union['bool2', bool, bool]) -> 'bool2': return intrinsic("binop.__ior__.bool2", bool2, byref(self), _other)
+886 @func(inline='always')
+887 def __xor__(self, _other: tp.Union['bool2', bool, bool]) -> 'bool2': return intrinsic("binop.__xor__.bool2", bool2, self, _other)
+888 @func(inline='always')
+889 def __rxor__(self, _other: tp.Union['bool2', bool, bool]) -> 'bool2': return intrinsic("binop.__rxor__.bool2", bool2, self, _other)
+890 @func(inline='always')
+891 def __ixor__(self, _other: tp.Union['bool2', bool, bool]) -> 'bool2': return intrinsic("binop.__ixor__.bool2", bool2, byref(self), _other)
+
869 def __init__(self, x: tp.Union['bool', bool] = False, y: tp.Union['bool', bool] = False) -> None: self = intrinsic("init.bool2", bool2, x, y)
+
893@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[f32]), 2))
+894class float2:
+895 x: f32
+896 y: f32
+897 def __init__(self, x: tp.Union['f32', FloatLiteral] = FloatLiteral(), y: tp.Union['f32', FloatLiteral] = FloatLiteral()) -> None: self = intrinsic("init.float2", float2, x, y)
+898 @func(inline='always')
+899 def __add__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__add__.float2", float2, self, _other)
+900 @func(inline='always')
+901 def __radd__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__radd__.float2", float2, self, _other)
+902 @func(inline='always')
+903 def __iadd__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__iadd__.float2", float2, byref(self), _other)
+904 @func(inline='always')
+905 def __sub__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__sub__.float2", float2, self, _other)
+906 @func(inline='always')
+907 def __rsub__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__rsub__.float2", float2, self, _other)
+908 @func(inline='always')
+909 def __isub__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__isub__.float2", float2, byref(self), _other)
+910 @func(inline='always')
+911 def __mul__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__mul__.float2", float2, self, _other)
+912 @func(inline='always')
+913 def __rmul__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__rmul__.float2", float2, self, _other)
+914 @func(inline='always')
+915 def __imul__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__imul__.float2", float2, byref(self), _other)
+916 @func(inline='always')
+917 def __mod__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__mod__.float2", float2, self, _other)
+918 @func(inline='always')
+919 def __rmod__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__rmod__.float2", float2, self, _other)
+920 @func(inline='always')
+921 def __imod__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__imod__.float2", float2, byref(self), _other)
+922 @func(inline='always')
+923 def __lt__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'bool2': return intrinsic("cmp.__lt__.float2", bool2, self, _other) # type: ignore
+924 @func(inline='always')
+925 def __le__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'bool2': return intrinsic("cmp.__le__.float2", bool2, self, _other) # type: ignore
+926 @func(inline='always')
+927 def __gt__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'bool2': return intrinsic("cmp.__gt__.float2", bool2, self, _other) # type: ignore
+928 @func(inline='always')
+929 def __ge__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'bool2': return intrinsic("cmp.__ge__.float2", bool2, self, _other) # type: ignore
+930 @func(inline='always')
+931 def __eq__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'bool2': return intrinsic("cmp.__eq__.float2", bool2, self, _other) # type: ignore
+932 @func(inline='always')
+933 def __ne__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'bool2': return intrinsic("cmp.__ne__.float2", bool2, self, _other) # type: ignore
+934 @func(inline='always')
+935 def __truediv__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__truediv__.float2", float2, self, _other)
+936 @func(inline='always')
+937 def __rtruediv__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__rtruediv__.float2", float2, self, _other)
+938 @func(inline='always')
+939 def __itruediv__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__itruediv__.float2", float2, byref(self), _other)
+940 @func(inline='always')
+941 def __pow__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__pow__.float2", float2, self, _other)
+942 @func(inline='always')
+943 def __rpow__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__rpow__.float2", float2, self, _other)
+944 @func(inline='always')
+945 def __ipow__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__ipow__.float2", float2, byref(self), _other)
+946 @func(inline='always')
+947 def __floordiv__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__floordiv__.float2", float2, self, _other)
+948 @func(inline='always')
+949 def __rfloordiv__(self, _other: tp.Union['float2', f32, FloatLiteral]) -> 'float2': return intrinsic("binop.__rfloordiv__.float2", float2, self, _other)
+
897 def __init__(self, x: tp.Union['f32', FloatLiteral] = FloatLiteral(), y: tp.Union['f32', FloatLiteral] = FloatLiteral()) -> None: self = intrinsic("init.float2", float2, x, y)
+
951@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[f64]), 2))
+ 952class double2:
+ 953 x: f64
+ 954 y: f64
+ 955 def __init__(self, x: tp.Union['f64', FloatLiteral] = FloatLiteral(), y: tp.Union['f64', FloatLiteral] = FloatLiteral()) -> None: self = intrinsic("init.double2", double2, x, y)
+ 956 @func(inline='always')
+ 957 def __add__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__add__.double2", double2, self, _other)
+ 958 @func(inline='always')
+ 959 def __radd__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__radd__.double2", double2, self, _other)
+ 960 @func(inline='always')
+ 961 def __iadd__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__iadd__.double2", double2, byref(self), _other)
+ 962 @func(inline='always')
+ 963 def __sub__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__sub__.double2", double2, self, _other)
+ 964 @func(inline='always')
+ 965 def __rsub__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__rsub__.double2", double2, self, _other)
+ 966 @func(inline='always')
+ 967 def __isub__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__isub__.double2", double2, byref(self), _other)
+ 968 @func(inline='always')
+ 969 def __mul__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__mul__.double2", double2, self, _other)
+ 970 @func(inline='always')
+ 971 def __rmul__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__rmul__.double2", double2, self, _other)
+ 972 @func(inline='always')
+ 973 def __imul__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__imul__.double2", double2, byref(self), _other)
+ 974 @func(inline='always')
+ 975 def __mod__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__mod__.double2", double2, self, _other)
+ 976 @func(inline='always')
+ 977 def __rmod__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__rmod__.double2", double2, self, _other)
+ 978 @func(inline='always')
+ 979 def __imod__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__imod__.double2", double2, byref(self), _other)
+ 980 @func(inline='always')
+ 981 def __lt__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'bool2': return intrinsic("cmp.__lt__.double2", bool2, self, _other) # type: ignore
+ 982 @func(inline='always')
+ 983 def __le__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'bool2': return intrinsic("cmp.__le__.double2", bool2, self, _other) # type: ignore
+ 984 @func(inline='always')
+ 985 def __gt__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'bool2': return intrinsic("cmp.__gt__.double2", bool2, self, _other) # type: ignore
+ 986 @func(inline='always')
+ 987 def __ge__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'bool2': return intrinsic("cmp.__ge__.double2", bool2, self, _other) # type: ignore
+ 988 @func(inline='always')
+ 989 def __eq__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'bool2': return intrinsic("cmp.__eq__.double2", bool2, self, _other) # type: ignore
+ 990 @func(inline='always')
+ 991 def __ne__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'bool2': return intrinsic("cmp.__ne__.double2", bool2, self, _other) # type: ignore
+ 992 @func(inline='always')
+ 993 def __truediv__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__truediv__.double2", double2, self, _other)
+ 994 @func(inline='always')
+ 995 def __rtruediv__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__rtruediv__.double2", double2, self, _other)
+ 996 @func(inline='always')
+ 997 def __itruediv__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__itruediv__.double2", double2, byref(self), _other)
+ 998 @func(inline='always')
+ 999 def __pow__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__pow__.double2", double2, self, _other)
+1000 @func(inline='always')
+1001 def __rpow__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__rpow__.double2", double2, self, _other)
+1002 @func(inline='always')
+1003 def __ipow__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__ipow__.double2", double2, byref(self), _other)
+1004 @func(inline='always')
+1005 def __floordiv__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__floordiv__.double2", double2, self, _other)
+1006 @func(inline='always')
+1007 def __rfloordiv__(self, _other: tp.Union['double2', f64, FloatLiteral]) -> 'double2': return intrinsic("binop.__rfloordiv__.double2", double2, self, _other)
+
955 def __init__(self, x: tp.Union['f64', FloatLiteral] = FloatLiteral(), y: tp.Union['f64', FloatLiteral] = FloatLiteral()) -> None: self = intrinsic("init.double2", double2, x, y)
+
1009@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[i8]), 2))
+1010class byte2:
+1011 x: i8
+1012 y: i8
+1013 def __init__(self, x: tp.Union['i8', IntLiteral] = IntLiteral(), y: tp.Union['i8', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.byte2", byte2, x, y)
+1014 @func(inline='always')
+1015 def __add__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__add__.byte2", byte2, self, _other)
+1016 @func(inline='always')
+1017 def __radd__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__radd__.byte2", byte2, self, _other)
+1018 @func(inline='always')
+1019 def __iadd__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__iadd__.byte2", byte2, byref(self), _other)
+1020 @func(inline='always')
+1021 def __sub__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__sub__.byte2", byte2, self, _other)
+1022 @func(inline='always')
+1023 def __rsub__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__rsub__.byte2", byte2, self, _other)
+1024 @func(inline='always')
+1025 def __isub__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__isub__.byte2", byte2, byref(self), _other)
+1026 @func(inline='always')
+1027 def __mul__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__mul__.byte2", byte2, self, _other)
+1028 @func(inline='always')
+1029 def __rmul__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__rmul__.byte2", byte2, self, _other)
+1030 @func(inline='always')
+1031 def __imul__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__imul__.byte2", byte2, byref(self), _other)
+1032 @func(inline='always')
+1033 def __mod__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__mod__.byte2", byte2, self, _other)
+1034 @func(inline='always')
+1035 def __rmod__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__rmod__.byte2", byte2, self, _other)
+1036 @func(inline='always')
+1037 def __imod__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__imod__.byte2", byte2, byref(self), _other)
+1038 @func(inline='always')
+1039 def __lt__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'bool2': return intrinsic("cmp.__lt__.byte2", bool2, self, _other) # type: ignore
+1040 @func(inline='always')
+1041 def __le__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'bool2': return intrinsic("cmp.__le__.byte2", bool2, self, _other) # type: ignore
+1042 @func(inline='always')
+1043 def __gt__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'bool2': return intrinsic("cmp.__gt__.byte2", bool2, self, _other) # type: ignore
+1044 @func(inline='always')
+1045 def __ge__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'bool2': return intrinsic("cmp.__ge__.byte2", bool2, self, _other) # type: ignore
+1046 @func(inline='always')
+1047 def __eq__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'bool2': return intrinsic("cmp.__eq__.byte2", bool2, self, _other) # type: ignore
+1048 @func(inline='always')
+1049 def __ne__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'bool2': return intrinsic("cmp.__ne__.byte2", bool2, self, _other) # type: ignore
+1050 @func(inline='always')
+1051 def __floordiv__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__floordiv__.byte2", byte2, self, _other)
+1052 @func(inline='always')
+1053 def __rfloordiv__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__rfloordiv__.byte2", byte2, self, _other)
+1054 @func(inline='always')
+1055 def __ifloordiv__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__ifloordiv__.byte2", byte2, byref(self), _other)
+1056 @func(inline='always')
+1057 def __lshift__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__lshift__.byte2", byte2, self, _other)
+1058 @func(inline='always')
+1059 def __rlshift__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__rlshift__.byte2", byte2, self, _other)
+1060 @func(inline='always')
+1061 def __ilshift__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__ilshift__.byte2", byte2, byref(self), _other)
+1062 @func(inline='always')
+1063 def __rshift__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__rshift__.byte2", byte2, self, _other)
+1064 @func(inline='always')
+1065 def __rrshift__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__rrshift__.byte2", byte2, self, _other)
+1066 @func(inline='always')
+1067 def __irshift__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__irshift__.byte2", byte2, byref(self), _other)
+1068 @func(inline='always')
+1069 def __and__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__and__.byte2", byte2, self, _other)
+1070 @func(inline='always')
+1071 def __rand__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__rand__.byte2", byte2, self, _other)
+1072 @func(inline='always')
+1073 def __iand__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__iand__.byte2", byte2, byref(self), _other)
+1074 @func(inline='always')
+1075 def __or__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__or__.byte2", byte2, self, _other)
+1076 @func(inline='always')
+1077 def __ror__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__ror__.byte2", byte2, self, _other)
+1078 @func(inline='always')
+1079 def __ior__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__ior__.byte2", byte2, byref(self), _other)
+1080 @func(inline='always')
+1081 def __xor__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__xor__.byte2", byte2, self, _other)
+1082 @func(inline='always')
+1083 def __rxor__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__rxor__.byte2", byte2, self, _other)
+1084 @func(inline='always')
+1085 def __ixor__(self, _other: tp.Union['byte2', i8, IntLiteral]) -> 'byte2': return intrinsic("binop.__ixor__.byte2", byte2, byref(self), _other)
+
1013 def __init__(self, x: tp.Union['i8', IntLiteral] = IntLiteral(), y: tp.Union['i8', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.byte2", byte2, x, y)
+
1087@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[u8]), 2))
+1088class ubyte2:
+1089 x: u8
+1090 y: u8
+1091 def __init__(self, x: tp.Union['u8', IntLiteral] = IntLiteral(), y: tp.Union['u8', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.ubyte2", ubyte2, x, y)
+1092 @func(inline='always')
+1093 def __add__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__add__.ubyte2", ubyte2, self, _other)
+1094 @func(inline='always')
+1095 def __radd__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__radd__.ubyte2", ubyte2, self, _other)
+1096 @func(inline='always')
+1097 def __iadd__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__iadd__.ubyte2", ubyte2, byref(self), _other)
+1098 @func(inline='always')
+1099 def __sub__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__sub__.ubyte2", ubyte2, self, _other)
+1100 @func(inline='always')
+1101 def __rsub__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__rsub__.ubyte2", ubyte2, self, _other)
+1102 @func(inline='always')
+1103 def __isub__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__isub__.ubyte2", ubyte2, byref(self), _other)
+1104 @func(inline='always')
+1105 def __mul__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__mul__.ubyte2", ubyte2, self, _other)
+1106 @func(inline='always')
+1107 def __rmul__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__rmul__.ubyte2", ubyte2, self, _other)
+1108 @func(inline='always')
+1109 def __imul__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__imul__.ubyte2", ubyte2, byref(self), _other)
+1110 @func(inline='always')
+1111 def __mod__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__mod__.ubyte2", ubyte2, self, _other)
+1112 @func(inline='always')
+1113 def __rmod__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__rmod__.ubyte2", ubyte2, self, _other)
+1114 @func(inline='always')
+1115 def __imod__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__imod__.ubyte2", ubyte2, byref(self), _other)
+1116 @func(inline='always')
+1117 def __lt__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'bool2': return intrinsic("cmp.__lt__.ubyte2", bool2, self, _other) # type: ignore
+1118 @func(inline='always')
+1119 def __le__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'bool2': return intrinsic("cmp.__le__.ubyte2", bool2, self, _other) # type: ignore
+1120 @func(inline='always')
+1121 def __gt__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'bool2': return intrinsic("cmp.__gt__.ubyte2", bool2, self, _other) # type: ignore
+1122 @func(inline='always')
+1123 def __ge__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'bool2': return intrinsic("cmp.__ge__.ubyte2", bool2, self, _other) # type: ignore
+1124 @func(inline='always')
+1125 def __eq__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'bool2': return intrinsic("cmp.__eq__.ubyte2", bool2, self, _other) # type: ignore
+1126 @func(inline='always')
+1127 def __ne__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'bool2': return intrinsic("cmp.__ne__.ubyte2", bool2, self, _other) # type: ignore
+1128 @func(inline='always')
+1129 def __floordiv__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__floordiv__.ubyte2", ubyte2, self, _other)
+1130 @func(inline='always')
+1131 def __rfloordiv__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__rfloordiv__.ubyte2", ubyte2, self, _other)
+1132 @func(inline='always')
+1133 def __ifloordiv__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__ifloordiv__.ubyte2", ubyte2, byref(self), _other)
+1134 @func(inline='always')
+1135 def __lshift__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__lshift__.ubyte2", ubyte2, self, _other)
+1136 @func(inline='always')
+1137 def __rlshift__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__rlshift__.ubyte2", ubyte2, self, _other)
+1138 @func(inline='always')
+1139 def __ilshift__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__ilshift__.ubyte2", ubyte2, byref(self), _other)
+1140 @func(inline='always')
+1141 def __rshift__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__rshift__.ubyte2", ubyte2, self, _other)
+1142 @func(inline='always')
+1143 def __rrshift__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__rrshift__.ubyte2", ubyte2, self, _other)
+1144 @func(inline='always')
+1145 def __irshift__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__irshift__.ubyte2", ubyte2, byref(self), _other)
+1146 @func(inline='always')
+1147 def __and__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__and__.ubyte2", ubyte2, self, _other)
+1148 @func(inline='always')
+1149 def __rand__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__rand__.ubyte2", ubyte2, self, _other)
+1150 @func(inline='always')
+1151 def __iand__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__iand__.ubyte2", ubyte2, byref(self), _other)
+1152 @func(inline='always')
+1153 def __or__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__or__.ubyte2", ubyte2, self, _other)
+1154 @func(inline='always')
+1155 def __ror__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__ror__.ubyte2", ubyte2, self, _other)
+1156 @func(inline='always')
+1157 def __ior__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__ior__.ubyte2", ubyte2, byref(self), _other)
+1158 @func(inline='always')
+1159 def __xor__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__xor__.ubyte2", ubyte2, self, _other)
+1160 @func(inline='always')
+1161 def __rxor__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__rxor__.ubyte2", ubyte2, self, _other)
+1162 @func(inline='always')
+1163 def __ixor__(self, _other: tp.Union['ubyte2', u8, IntLiteral]) -> 'ubyte2': return intrinsic("binop.__ixor__.ubyte2", ubyte2, byref(self), _other)
+
1091 def __init__(self, x: tp.Union['u8', IntLiteral] = IntLiteral(), y: tp.Union['u8', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.ubyte2", ubyte2, x, y)
+
1165@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[i16]), 2))
+1166class short2:
+1167 x: i16
+1168 y: i16
+1169 def __init__(self, x: tp.Union['i16', IntLiteral] = IntLiteral(), y: tp.Union['i16', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.short2", short2, x, y)
+1170 @func(inline='always')
+1171 def __add__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__add__.short2", short2, self, _other)
+1172 @func(inline='always')
+1173 def __radd__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__radd__.short2", short2, self, _other)
+1174 @func(inline='always')
+1175 def __iadd__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__iadd__.short2", short2, byref(self), _other)
+1176 @func(inline='always')
+1177 def __sub__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__sub__.short2", short2, self, _other)
+1178 @func(inline='always')
+1179 def __rsub__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__rsub__.short2", short2, self, _other)
+1180 @func(inline='always')
+1181 def __isub__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__isub__.short2", short2, byref(self), _other)
+1182 @func(inline='always')
+1183 def __mul__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__mul__.short2", short2, self, _other)
+1184 @func(inline='always')
+1185 def __rmul__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__rmul__.short2", short2, self, _other)
+1186 @func(inline='always')
+1187 def __imul__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__imul__.short2", short2, byref(self), _other)
+1188 @func(inline='always')
+1189 def __mod__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__mod__.short2", short2, self, _other)
+1190 @func(inline='always')
+1191 def __rmod__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__rmod__.short2", short2, self, _other)
+1192 @func(inline='always')
+1193 def __imod__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__imod__.short2", short2, byref(self), _other)
+1194 @func(inline='always')
+1195 def __lt__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'bool2': return intrinsic("cmp.__lt__.short2", bool2, self, _other) # type: ignore
+1196 @func(inline='always')
+1197 def __le__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'bool2': return intrinsic("cmp.__le__.short2", bool2, self, _other) # type: ignore
+1198 @func(inline='always')
+1199 def __gt__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'bool2': return intrinsic("cmp.__gt__.short2", bool2, self, _other) # type: ignore
+1200 @func(inline='always')
+1201 def __ge__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'bool2': return intrinsic("cmp.__ge__.short2", bool2, self, _other) # type: ignore
+1202 @func(inline='always')
+1203 def __eq__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'bool2': return intrinsic("cmp.__eq__.short2", bool2, self, _other) # type: ignore
+1204 @func(inline='always')
+1205 def __ne__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'bool2': return intrinsic("cmp.__ne__.short2", bool2, self, _other) # type: ignore
+1206 @func(inline='always')
+1207 def __floordiv__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__floordiv__.short2", short2, self, _other)
+1208 @func(inline='always')
+1209 def __rfloordiv__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__rfloordiv__.short2", short2, self, _other)
+1210 @func(inline='always')
+1211 def __ifloordiv__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__ifloordiv__.short2", short2, byref(self), _other)
+1212 @func(inline='always')
+1213 def __lshift__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__lshift__.short2", short2, self, _other)
+1214 @func(inline='always')
+1215 def __rlshift__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__rlshift__.short2", short2, self, _other)
+1216 @func(inline='always')
+1217 def __ilshift__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__ilshift__.short2", short2, byref(self), _other)
+1218 @func(inline='always')
+1219 def __rshift__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__rshift__.short2", short2, self, _other)
+1220 @func(inline='always')
+1221 def __rrshift__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__rrshift__.short2", short2, self, _other)
+1222 @func(inline='always')
+1223 def __irshift__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__irshift__.short2", short2, byref(self), _other)
+1224 @func(inline='always')
+1225 def __and__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__and__.short2", short2, self, _other)
+1226 @func(inline='always')
+1227 def __rand__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__rand__.short2", short2, self, _other)
+1228 @func(inline='always')
+1229 def __iand__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__iand__.short2", short2, byref(self), _other)
+1230 @func(inline='always')
+1231 def __or__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__or__.short2", short2, self, _other)
+1232 @func(inline='always')
+1233 def __ror__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__ror__.short2", short2, self, _other)
+1234 @func(inline='always')
+1235 def __ior__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__ior__.short2", short2, byref(self), _other)
+1236 @func(inline='always')
+1237 def __xor__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__xor__.short2", short2, self, _other)
+1238 @func(inline='always')
+1239 def __rxor__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__rxor__.short2", short2, self, _other)
+1240 @func(inline='always')
+1241 def __ixor__(self, _other: tp.Union['short2', i16, IntLiteral]) -> 'short2': return intrinsic("binop.__ixor__.short2", short2, byref(self), _other)
+
1169 def __init__(self, x: tp.Union['i16', IntLiteral] = IntLiteral(), y: tp.Union['i16', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.short2", short2, x, y)
+
1243@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[u16]), 2))
+1244class ushort2:
+1245 x: u16
+1246 y: u16
+1247 def __init__(self, x: tp.Union['u16', IntLiteral] = IntLiteral(), y: tp.Union['u16', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.ushort2", ushort2, x, y)
+1248 @func(inline='always')
+1249 def __add__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__add__.ushort2", ushort2, self, _other)
+1250 @func(inline='always')
+1251 def __radd__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__radd__.ushort2", ushort2, self, _other)
+1252 @func(inline='always')
+1253 def __iadd__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__iadd__.ushort2", ushort2, byref(self), _other)
+1254 @func(inline='always')
+1255 def __sub__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__sub__.ushort2", ushort2, self, _other)
+1256 @func(inline='always')
+1257 def __rsub__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__rsub__.ushort2", ushort2, self, _other)
+1258 @func(inline='always')
+1259 def __isub__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__isub__.ushort2", ushort2, byref(self), _other)
+1260 @func(inline='always')
+1261 def __mul__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__mul__.ushort2", ushort2, self, _other)
+1262 @func(inline='always')
+1263 def __rmul__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__rmul__.ushort2", ushort2, self, _other)
+1264 @func(inline='always')
+1265 def __imul__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__imul__.ushort2", ushort2, byref(self), _other)
+1266 @func(inline='always')
+1267 def __mod__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__mod__.ushort2", ushort2, self, _other)
+1268 @func(inline='always')
+1269 def __rmod__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__rmod__.ushort2", ushort2, self, _other)
+1270 @func(inline='always')
+1271 def __imod__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__imod__.ushort2", ushort2, byref(self), _other)
+1272 @func(inline='always')
+1273 def __lt__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'bool2': return intrinsic("cmp.__lt__.ushort2", bool2, self, _other) # type: ignore
+1274 @func(inline='always')
+1275 def __le__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'bool2': return intrinsic("cmp.__le__.ushort2", bool2, self, _other) # type: ignore
+1276 @func(inline='always')
+1277 def __gt__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'bool2': return intrinsic("cmp.__gt__.ushort2", bool2, self, _other) # type: ignore
+1278 @func(inline='always')
+1279 def __ge__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'bool2': return intrinsic("cmp.__ge__.ushort2", bool2, self, _other) # type: ignore
+1280 @func(inline='always')
+1281 def __eq__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'bool2': return intrinsic("cmp.__eq__.ushort2", bool2, self, _other) # type: ignore
+1282 @func(inline='always')
+1283 def __ne__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'bool2': return intrinsic("cmp.__ne__.ushort2", bool2, self, _other) # type: ignore
+1284 @func(inline='always')
+1285 def __floordiv__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__floordiv__.ushort2", ushort2, self, _other)
+1286 @func(inline='always')
+1287 def __rfloordiv__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__rfloordiv__.ushort2", ushort2, self, _other)
+1288 @func(inline='always')
+1289 def __ifloordiv__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__ifloordiv__.ushort2", ushort2, byref(self), _other)
+1290 @func(inline='always')
+1291 def __lshift__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__lshift__.ushort2", ushort2, self, _other)
+1292 @func(inline='always')
+1293 def __rlshift__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__rlshift__.ushort2", ushort2, self, _other)
+1294 @func(inline='always')
+1295 def __ilshift__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__ilshift__.ushort2", ushort2, byref(self), _other)
+1296 @func(inline='always')
+1297 def __rshift__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__rshift__.ushort2", ushort2, self, _other)
+1298 @func(inline='always')
+1299 def __rrshift__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__rrshift__.ushort2", ushort2, self, _other)
+1300 @func(inline='always')
+1301 def __irshift__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__irshift__.ushort2", ushort2, byref(self), _other)
+1302 @func(inline='always')
+1303 def __and__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__and__.ushort2", ushort2, self, _other)
+1304 @func(inline='always')
+1305 def __rand__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__rand__.ushort2", ushort2, self, _other)
+1306 @func(inline='always')
+1307 def __iand__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__iand__.ushort2", ushort2, byref(self), _other)
+1308 @func(inline='always')
+1309 def __or__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__or__.ushort2", ushort2, self, _other)
+1310 @func(inline='always')
+1311 def __ror__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__ror__.ushort2", ushort2, self, _other)
+1312 @func(inline='always')
+1313 def __ior__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__ior__.ushort2", ushort2, byref(self), _other)
+1314 @func(inline='always')
+1315 def __xor__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__xor__.ushort2", ushort2, self, _other)
+1316 @func(inline='always')
+1317 def __rxor__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__rxor__.ushort2", ushort2, self, _other)
+1318 @func(inline='always')
+1319 def __ixor__(self, _other: tp.Union['ushort2', u16, IntLiteral]) -> 'ushort2': return intrinsic("binop.__ixor__.ushort2", ushort2, byref(self), _other)
+
1247 def __init__(self, x: tp.Union['u16', IntLiteral] = IntLiteral(), y: tp.Union['u16', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.ushort2", ushort2, x, y)
+
1321@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[i32]), 2))
+1322class int2:
+1323 x: i32
+1324 y: i32
+1325 def __init__(self, x: tp.Union['i32', IntLiteral] = IntLiteral(), y: tp.Union['i32', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.int2", int2, x, y)
+1326 @func(inline='always')
+1327 def __add__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__add__.int2", int2, self, _other)
+1328 @func(inline='always')
+1329 def __radd__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__radd__.int2", int2, self, _other)
+1330 @func(inline='always')
+1331 def __iadd__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__iadd__.int2", int2, byref(self), _other)
+1332 @func(inline='always')
+1333 def __sub__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__sub__.int2", int2, self, _other)
+1334 @func(inline='always')
+1335 def __rsub__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__rsub__.int2", int2, self, _other)
+1336 @func(inline='always')
+1337 def __isub__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__isub__.int2", int2, byref(self), _other)
+1338 @func(inline='always')
+1339 def __mul__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__mul__.int2", int2, self, _other)
+1340 @func(inline='always')
+1341 def __rmul__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__rmul__.int2", int2, self, _other)
+1342 @func(inline='always')
+1343 def __imul__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__imul__.int2", int2, byref(self), _other)
+1344 @func(inline='always')
+1345 def __mod__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__mod__.int2", int2, self, _other)
+1346 @func(inline='always')
+1347 def __rmod__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__rmod__.int2", int2, self, _other)
+1348 @func(inline='always')
+1349 def __imod__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__imod__.int2", int2, byref(self), _other)
+1350 @func(inline='always')
+1351 def __lt__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'bool2': return intrinsic("cmp.__lt__.int2", bool2, self, _other) # type: ignore
+1352 @func(inline='always')
+1353 def __le__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'bool2': return intrinsic("cmp.__le__.int2", bool2, self, _other) # type: ignore
+1354 @func(inline='always')
+1355 def __gt__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'bool2': return intrinsic("cmp.__gt__.int2", bool2, self, _other) # type: ignore
+1356 @func(inline='always')
+1357 def __ge__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'bool2': return intrinsic("cmp.__ge__.int2", bool2, self, _other) # type: ignore
+1358 @func(inline='always')
+1359 def __eq__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'bool2': return intrinsic("cmp.__eq__.int2", bool2, self, _other) # type: ignore
+1360 @func(inline='always')
+1361 def __ne__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'bool2': return intrinsic("cmp.__ne__.int2", bool2, self, _other) # type: ignore
+1362 @func(inline='always')
+1363 def __floordiv__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__floordiv__.int2", int2, self, _other)
+1364 @func(inline='always')
+1365 def __rfloordiv__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__rfloordiv__.int2", int2, self, _other)
+1366 @func(inline='always')
+1367 def __ifloordiv__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__ifloordiv__.int2", int2, byref(self), _other)
+1368 @func(inline='always')
+1369 def __lshift__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__lshift__.int2", int2, self, _other)
+1370 @func(inline='always')
+1371 def __rlshift__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__rlshift__.int2", int2, self, _other)
+1372 @func(inline='always')
+1373 def __ilshift__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__ilshift__.int2", int2, byref(self), _other)
+1374 @func(inline='always')
+1375 def __rshift__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__rshift__.int2", int2, self, _other)
+1376 @func(inline='always')
+1377 def __rrshift__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__rrshift__.int2", int2, self, _other)
+1378 @func(inline='always')
+1379 def __irshift__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__irshift__.int2", int2, byref(self), _other)
+1380 @func(inline='always')
+1381 def __and__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__and__.int2", int2, self, _other)
+1382 @func(inline='always')
+1383 def __rand__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__rand__.int2", int2, self, _other)
+1384 @func(inline='always')
+1385 def __iand__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__iand__.int2", int2, byref(self), _other)
+1386 @func(inline='always')
+1387 def __or__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__or__.int2", int2, self, _other)
+1388 @func(inline='always')
+1389 def __ror__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__ror__.int2", int2, self, _other)
+1390 @func(inline='always')
+1391 def __ior__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__ior__.int2", int2, byref(self), _other)
+1392 @func(inline='always')
+1393 def __xor__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__xor__.int2", int2, self, _other)
+1394 @func(inline='always')
+1395 def __rxor__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__rxor__.int2", int2, self, _other)
+1396 @func(inline='always')
+1397 def __ixor__(self, _other: tp.Union['int2', i32, IntLiteral]) -> 'int2': return intrinsic("binop.__ixor__.int2", int2, byref(self), _other)
+
1325 def __init__(self, x: tp.Union['i32', IntLiteral] = IntLiteral(), y: tp.Union['i32', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.int2", int2, x, y)
+
1399@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[u32]), 2))
+1400class uint2:
+1401 x: u32
+1402 y: u32
+1403 def __init__(self, x: tp.Union['u32', IntLiteral] = IntLiteral(), y: tp.Union['u32', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.uint2", uint2, x, y)
+1404 @func(inline='always')
+1405 def __add__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__add__.uint2", uint2, self, _other)
+1406 @func(inline='always')
+1407 def __radd__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__radd__.uint2", uint2, self, _other)
+1408 @func(inline='always')
+1409 def __iadd__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__iadd__.uint2", uint2, byref(self), _other)
+1410 @func(inline='always')
+1411 def __sub__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__sub__.uint2", uint2, self, _other)
+1412 @func(inline='always')
+1413 def __rsub__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__rsub__.uint2", uint2, self, _other)
+1414 @func(inline='always')
+1415 def __isub__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__isub__.uint2", uint2, byref(self), _other)
+1416 @func(inline='always')
+1417 def __mul__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__mul__.uint2", uint2, self, _other)
+1418 @func(inline='always')
+1419 def __rmul__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__rmul__.uint2", uint2, self, _other)
+1420 @func(inline='always')
+1421 def __imul__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__imul__.uint2", uint2, byref(self), _other)
+1422 @func(inline='always')
+1423 def __mod__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__mod__.uint2", uint2, self, _other)
+1424 @func(inline='always')
+1425 def __rmod__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__rmod__.uint2", uint2, self, _other)
+1426 @func(inline='always')
+1427 def __imod__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__imod__.uint2", uint2, byref(self), _other)
+1428 @func(inline='always')
+1429 def __lt__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'bool2': return intrinsic("cmp.__lt__.uint2", bool2, self, _other) # type: ignore
+1430 @func(inline='always')
+1431 def __le__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'bool2': return intrinsic("cmp.__le__.uint2", bool2, self, _other) # type: ignore
+1432 @func(inline='always')
+1433 def __gt__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'bool2': return intrinsic("cmp.__gt__.uint2", bool2, self, _other) # type: ignore
+1434 @func(inline='always')
+1435 def __ge__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'bool2': return intrinsic("cmp.__ge__.uint2", bool2, self, _other) # type: ignore
+1436 @func(inline='always')
+1437 def __eq__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'bool2': return intrinsic("cmp.__eq__.uint2", bool2, self, _other) # type: ignore
+1438 @func(inline='always')
+1439 def __ne__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'bool2': return intrinsic("cmp.__ne__.uint2", bool2, self, _other) # type: ignore
+1440 @func(inline='always')
+1441 def __floordiv__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__floordiv__.uint2", uint2, self, _other)
+1442 @func(inline='always')
+1443 def __rfloordiv__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__rfloordiv__.uint2", uint2, self, _other)
+1444 @func(inline='always')
+1445 def __ifloordiv__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__ifloordiv__.uint2", uint2, byref(self), _other)
+1446 @func(inline='always')
+1447 def __lshift__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__lshift__.uint2", uint2, self, _other)
+1448 @func(inline='always')
+1449 def __rlshift__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__rlshift__.uint2", uint2, self, _other)
+1450 @func(inline='always')
+1451 def __ilshift__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__ilshift__.uint2", uint2, byref(self), _other)
+1452 @func(inline='always')
+1453 def __rshift__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__rshift__.uint2", uint2, self, _other)
+1454 @func(inline='always')
+1455 def __rrshift__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__rrshift__.uint2", uint2, self, _other)
+1456 @func(inline='always')
+1457 def __irshift__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__irshift__.uint2", uint2, byref(self), _other)
+1458 @func(inline='always')
+1459 def __and__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__and__.uint2", uint2, self, _other)
+1460 @func(inline='always')
+1461 def __rand__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__rand__.uint2", uint2, self, _other)
+1462 @func(inline='always')
+1463 def __iand__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__iand__.uint2", uint2, byref(self), _other)
+1464 @func(inline='always')
+1465 def __or__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__or__.uint2", uint2, self, _other)
+1466 @func(inline='always')
+1467 def __ror__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__ror__.uint2", uint2, self, _other)
+1468 @func(inline='always')
+1469 def __ior__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__ior__.uint2", uint2, byref(self), _other)
+1470 @func(inline='always')
+1471 def __xor__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__xor__.uint2", uint2, self, _other)
+1472 @func(inline='always')
+1473 def __rxor__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__rxor__.uint2", uint2, self, _other)
+1474 @func(inline='always')
+1475 def __ixor__(self, _other: tp.Union['uint2', u32, IntLiteral]) -> 'uint2': return intrinsic("binop.__ixor__.uint2", uint2, byref(self), _other)
+
1403 def __init__(self, x: tp.Union['u32', IntLiteral] = IntLiteral(), y: tp.Union['u32', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.uint2", uint2, x, y)
+
1477@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[i64]), 2))
+1478class long2:
+1479 x: i64
+1480 y: i64
+1481 def __init__(self, x: tp.Union['i64', IntLiteral] = IntLiteral(), y: tp.Union['i64', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.long2", long2, x, y)
+1482 @func(inline='always')
+1483 def __add__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__add__.long2", long2, self, _other)
+1484 @func(inline='always')
+1485 def __radd__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__radd__.long2", long2, self, _other)
+1486 @func(inline='always')
+1487 def __iadd__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__iadd__.long2", long2, byref(self), _other)
+1488 @func(inline='always')
+1489 def __sub__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__sub__.long2", long2, self, _other)
+1490 @func(inline='always')
+1491 def __rsub__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__rsub__.long2", long2, self, _other)
+1492 @func(inline='always')
+1493 def __isub__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__isub__.long2", long2, byref(self), _other)
+1494 @func(inline='always')
+1495 def __mul__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__mul__.long2", long2, self, _other)
+1496 @func(inline='always')
+1497 def __rmul__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__rmul__.long2", long2, self, _other)
+1498 @func(inline='always')
+1499 def __imul__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__imul__.long2", long2, byref(self), _other)
+1500 @func(inline='always')
+1501 def __mod__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__mod__.long2", long2, self, _other)
+1502 @func(inline='always')
+1503 def __rmod__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__rmod__.long2", long2, self, _other)
+1504 @func(inline='always')
+1505 def __imod__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__imod__.long2", long2, byref(self), _other)
+1506 @func(inline='always')
+1507 def __lt__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'bool2': return intrinsic("cmp.__lt__.long2", bool2, self, _other) # type: ignore
+1508 @func(inline='always')
+1509 def __le__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'bool2': return intrinsic("cmp.__le__.long2", bool2, self, _other) # type: ignore
+1510 @func(inline='always')
+1511 def __gt__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'bool2': return intrinsic("cmp.__gt__.long2", bool2, self, _other) # type: ignore
+1512 @func(inline='always')
+1513 def __ge__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'bool2': return intrinsic("cmp.__ge__.long2", bool2, self, _other) # type: ignore
+1514 @func(inline='always')
+1515 def __eq__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'bool2': return intrinsic("cmp.__eq__.long2", bool2, self, _other) # type: ignore
+1516 @func(inline='always')
+1517 def __ne__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'bool2': return intrinsic("cmp.__ne__.long2", bool2, self, _other) # type: ignore
+1518 @func(inline='always')
+1519 def __floordiv__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__floordiv__.long2", long2, self, _other)
+1520 @func(inline='always')
+1521 def __rfloordiv__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__rfloordiv__.long2", long2, self, _other)
+1522 @func(inline='always')
+1523 def __ifloordiv__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__ifloordiv__.long2", long2, byref(self), _other)
+1524 @func(inline='always')
+1525 def __lshift__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__lshift__.long2", long2, self, _other)
+1526 @func(inline='always')
+1527 def __rlshift__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__rlshift__.long2", long2, self, _other)
+1528 @func(inline='always')
+1529 def __ilshift__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__ilshift__.long2", long2, byref(self), _other)
+1530 @func(inline='always')
+1531 def __rshift__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__rshift__.long2", long2, self, _other)
+1532 @func(inline='always')
+1533 def __rrshift__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__rrshift__.long2", long2, self, _other)
+1534 @func(inline='always')
+1535 def __irshift__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__irshift__.long2", long2, byref(self), _other)
+1536 @func(inline='always')
+1537 def __and__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__and__.long2", long2, self, _other)
+1538 @func(inline='always')
+1539 def __rand__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__rand__.long2", long2, self, _other)
+1540 @func(inline='always')
+1541 def __iand__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__iand__.long2", long2, byref(self), _other)
+1542 @func(inline='always')
+1543 def __or__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__or__.long2", long2, self, _other)
+1544 @func(inline='always')
+1545 def __ror__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__ror__.long2", long2, self, _other)
+1546 @func(inline='always')
+1547 def __ior__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__ior__.long2", long2, byref(self), _other)
+1548 @func(inline='always')
+1549 def __xor__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__xor__.long2", long2, self, _other)
+1550 @func(inline='always')
+1551 def __rxor__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__rxor__.long2", long2, self, _other)
+1552 @func(inline='always')
+1553 def __ixor__(self, _other: tp.Union['long2', i64, IntLiteral]) -> 'long2': return intrinsic("binop.__ixor__.long2", long2, byref(self), _other)
+
1481 def __init__(self, x: tp.Union['i64', IntLiteral] = IntLiteral(), y: tp.Union['i64', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.long2", long2, x, y)
+
1555@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[u64]), 2))
+1556class ulong2:
+1557 x: u64
+1558 y: u64
+1559 def __init__(self, x: tp.Union['u64', IntLiteral] = IntLiteral(), y: tp.Union['u64', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.ulong2", ulong2, x, y)
+1560 @func(inline='always')
+1561 def __add__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__add__.ulong2", ulong2, self, _other)
+1562 @func(inline='always')
+1563 def __radd__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__radd__.ulong2", ulong2, self, _other)
+1564 @func(inline='always')
+1565 def __iadd__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__iadd__.ulong2", ulong2, byref(self), _other)
+1566 @func(inline='always')
+1567 def __sub__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__sub__.ulong2", ulong2, self, _other)
+1568 @func(inline='always')
+1569 def __rsub__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__rsub__.ulong2", ulong2, self, _other)
+1570 @func(inline='always')
+1571 def __isub__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__isub__.ulong2", ulong2, byref(self), _other)
+1572 @func(inline='always')
+1573 def __mul__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__mul__.ulong2", ulong2, self, _other)
+1574 @func(inline='always')
+1575 def __rmul__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__rmul__.ulong2", ulong2, self, _other)
+1576 @func(inline='always')
+1577 def __imul__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__imul__.ulong2", ulong2, byref(self), _other)
+1578 @func(inline='always')
+1579 def __mod__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__mod__.ulong2", ulong2, self, _other)
+1580 @func(inline='always')
+1581 def __rmod__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__rmod__.ulong2", ulong2, self, _other)
+1582 @func(inline='always')
+1583 def __imod__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__imod__.ulong2", ulong2, byref(self), _other)
+1584 @func(inline='always')
+1585 def __lt__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'bool2': return intrinsic("cmp.__lt__.ulong2", bool2, self, _other) # type: ignore
+1586 @func(inline='always')
+1587 def __le__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'bool2': return intrinsic("cmp.__le__.ulong2", bool2, self, _other) # type: ignore
+1588 @func(inline='always')
+1589 def __gt__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'bool2': return intrinsic("cmp.__gt__.ulong2", bool2, self, _other) # type: ignore
+1590 @func(inline='always')
+1591 def __ge__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'bool2': return intrinsic("cmp.__ge__.ulong2", bool2, self, _other) # type: ignore
+1592 @func(inline='always')
+1593 def __eq__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'bool2': return intrinsic("cmp.__eq__.ulong2", bool2, self, _other) # type: ignore
+1594 @func(inline='always')
+1595 def __ne__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'bool2': return intrinsic("cmp.__ne__.ulong2", bool2, self, _other) # type: ignore
+1596 @func(inline='always')
+1597 def __floordiv__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__floordiv__.ulong2", ulong2, self, _other)
+1598 @func(inline='always')
+1599 def __rfloordiv__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__rfloordiv__.ulong2", ulong2, self, _other)
+1600 @func(inline='always')
+1601 def __ifloordiv__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__ifloordiv__.ulong2", ulong2, byref(self), _other)
+1602 @func(inline='always')
+1603 def __lshift__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__lshift__.ulong2", ulong2, self, _other)
+1604 @func(inline='always')
+1605 def __rlshift__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__rlshift__.ulong2", ulong2, self, _other)
+1606 @func(inline='always')
+1607 def __ilshift__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__ilshift__.ulong2", ulong2, byref(self), _other)
+1608 @func(inline='always')
+1609 def __rshift__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__rshift__.ulong2", ulong2, self, _other)
+1610 @func(inline='always')
+1611 def __rrshift__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__rrshift__.ulong2", ulong2, self, _other)
+1612 @func(inline='always')
+1613 def __irshift__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__irshift__.ulong2", ulong2, byref(self), _other)
+1614 @func(inline='always')
+1615 def __and__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__and__.ulong2", ulong2, self, _other)
+1616 @func(inline='always')
+1617 def __rand__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__rand__.ulong2", ulong2, self, _other)
+1618 @func(inline='always')
+1619 def __iand__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__iand__.ulong2", ulong2, byref(self), _other)
+1620 @func(inline='always')
+1621 def __or__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__or__.ulong2", ulong2, self, _other)
+1622 @func(inline='always')
+1623 def __ror__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__ror__.ulong2", ulong2, self, _other)
+1624 @func(inline='always')
+1625 def __ior__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__ior__.ulong2", ulong2, byref(self), _other)
+1626 @func(inline='always')
+1627 def __xor__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__xor__.ulong2", ulong2, self, _other)
+1628 @func(inline='always')
+1629 def __rxor__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__rxor__.ulong2", ulong2, self, _other)
+1630 @func(inline='always')
+1631 def __ixor__(self, _other: tp.Union['ulong2', u64, IntLiteral]) -> 'ulong2': return intrinsic("binop.__ixor__.ulong2", ulong2, byref(self), _other)
+
1559 def __init__(self, x: tp.Union['u64', IntLiteral] = IntLiteral(), y: tp.Union['u64', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.ulong2", ulong2, x, y)
+
1633@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[bool]), 3))
+1634class bool3:
+1635 x: bool
+1636 y: bool
+1637 z: bool
+1638 def __init__(self, x: tp.Union['bool', bool] = False, y: tp.Union['bool', bool] = False, z: tp.Union['bool', bool] = False) -> None: self = intrinsic("init.bool3", bool3, x, y, z)
+1639 @func(inline='always')
+1640 def __eq__(self, _other: tp.Union['bool3', bool, bool]) -> 'bool3': return intrinsic("cmp.__eq__.bool3", bool3, self, _other) # type: ignore
+1641 @func(inline='always')
+1642 def __ne__(self, _other: tp.Union['bool3', bool, bool]) -> 'bool3': return intrinsic("cmp.__ne__.bool3", bool3, self, _other) # type: ignore
+1643 @func(inline='always')
+1644 def __and__(self, _other: tp.Union['bool3', bool, bool]) -> 'bool3': return intrinsic("binop.__and__.bool3", bool3, self, _other)
+1645 @func(inline='always')
+1646 def __rand__(self, _other: tp.Union['bool3', bool, bool]) -> 'bool3': return intrinsic("binop.__rand__.bool3", bool3, self, _other)
+1647 @func(inline='always')
+1648 def __iand__(self, _other: tp.Union['bool3', bool, bool]) -> 'bool3': return intrinsic("binop.__iand__.bool3", bool3, byref(self), _other)
+1649 @func(inline='always')
+1650 def __or__(self, _other: tp.Union['bool3', bool, bool]) -> 'bool3': return intrinsic("binop.__or__.bool3", bool3, self, _other)
+1651 @func(inline='always')
+1652 def __ror__(self, _other: tp.Union['bool3', bool, bool]) -> 'bool3': return intrinsic("binop.__ror__.bool3", bool3, self, _other)
+1653 @func(inline='always')
+1654 def __ior__(self, _other: tp.Union['bool3', bool, bool]) -> 'bool3': return intrinsic("binop.__ior__.bool3", bool3, byref(self), _other)
+1655 @func(inline='always')
+1656 def __xor__(self, _other: tp.Union['bool3', bool, bool]) -> 'bool3': return intrinsic("binop.__xor__.bool3", bool3, self, _other)
+1657 @func(inline='always')
+1658 def __rxor__(self, _other: tp.Union['bool3', bool, bool]) -> 'bool3': return intrinsic("binop.__rxor__.bool3", bool3, self, _other)
+1659 @func(inline='always')
+1660 def __ixor__(self, _other: tp.Union['bool3', bool, bool]) -> 'bool3': return intrinsic("binop.__ixor__.bool3", bool3, byref(self), _other)
+
1638 def __init__(self, x: tp.Union['bool', bool] = False, y: tp.Union['bool', bool] = False, z: tp.Union['bool', bool] = False) -> None: self = intrinsic("init.bool3", bool3, x, y, z)
+
1662@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[f32]), 3))
+1663class float3:
+1664 x: f32
+1665 y: f32
+1666 z: f32
+1667 def __init__(self, x: tp.Union['f32', FloatLiteral] = FloatLiteral(), y: tp.Union['f32', FloatLiteral] = FloatLiteral(), z: tp.Union['f32', FloatLiteral] = FloatLiteral()) -> None: self = intrinsic("init.float3", float3, x, y, z)
+1668 @func(inline='always')
+1669 def __add__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__add__.float3", float3, self, _other)
+1670 @func(inline='always')
+1671 def __radd__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__radd__.float3", float3, self, _other)
+1672 @func(inline='always')
+1673 def __iadd__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__iadd__.float3", float3, byref(self), _other)
+1674 @func(inline='always')
+1675 def __sub__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__sub__.float3", float3, self, _other)
+1676 @func(inline='always')
+1677 def __rsub__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__rsub__.float3", float3, self, _other)
+1678 @func(inline='always')
+1679 def __isub__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__isub__.float3", float3, byref(self), _other)
+1680 @func(inline='always')
+1681 def __mul__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__mul__.float3", float3, self, _other)
+1682 @func(inline='always')
+1683 def __rmul__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__rmul__.float3", float3, self, _other)
+1684 @func(inline='always')
+1685 def __imul__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__imul__.float3", float3, byref(self), _other)
+1686 @func(inline='always')
+1687 def __mod__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__mod__.float3", float3, self, _other)
+1688 @func(inline='always')
+1689 def __rmod__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__rmod__.float3", float3, self, _other)
+1690 @func(inline='always')
+1691 def __imod__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__imod__.float3", float3, byref(self), _other)
+1692 @func(inline='always')
+1693 def __lt__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'bool3': return intrinsic("cmp.__lt__.float3", bool3, self, _other) # type: ignore
+1694 @func(inline='always')
+1695 def __le__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'bool3': return intrinsic("cmp.__le__.float3", bool3, self, _other) # type: ignore
+1696 @func(inline='always')
+1697 def __gt__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'bool3': return intrinsic("cmp.__gt__.float3", bool3, self, _other) # type: ignore
+1698 @func(inline='always')
+1699 def __ge__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'bool3': return intrinsic("cmp.__ge__.float3", bool3, self, _other) # type: ignore
+1700 @func(inline='always')
+1701 def __eq__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'bool3': return intrinsic("cmp.__eq__.float3", bool3, self, _other) # type: ignore
+1702 @func(inline='always')
+1703 def __ne__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'bool3': return intrinsic("cmp.__ne__.float3", bool3, self, _other) # type: ignore
+1704 @func(inline='always')
+1705 def __truediv__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__truediv__.float3", float3, self, _other)
+1706 @func(inline='always')
+1707 def __rtruediv__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__rtruediv__.float3", float3, self, _other)
+1708 @func(inline='always')
+1709 def __itruediv__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__itruediv__.float3", float3, byref(self), _other)
+1710 @func(inline='always')
+1711 def __pow__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__pow__.float3", float3, self, _other)
+1712 @func(inline='always')
+1713 def __rpow__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__rpow__.float3", float3, self, _other)
+1714 @func(inline='always')
+1715 def __ipow__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__ipow__.float3", float3, byref(self), _other)
+1716 @func(inline='always')
+1717 def __floordiv__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__floordiv__.float3", float3, self, _other)
+1718 @func(inline='always')
+1719 def __rfloordiv__(self, _other: tp.Union['float3', f32, FloatLiteral]) -> 'float3': return intrinsic("binop.__rfloordiv__.float3", float3, self, _other)
+
1667 def __init__(self, x: tp.Union['f32', FloatLiteral] = FloatLiteral(), y: tp.Union['f32', FloatLiteral] = FloatLiteral(), z: tp.Union['f32', FloatLiteral] = FloatLiteral()) -> None: self = intrinsic("init.float3", float3, x, y, z)
+
1721@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[f64]), 3))
+1722class double3:
+1723 x: f64
+1724 y: f64
+1725 z: f64
+1726 def __init__(self, x: tp.Union['f64', FloatLiteral] = FloatLiteral(), y: tp.Union['f64', FloatLiteral] = FloatLiteral(), z: tp.Union['f64', FloatLiteral] = FloatLiteral()) -> None: self = intrinsic("init.double3", double3, x, y, z)
+1727 @func(inline='always')
+1728 def __add__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__add__.double3", double3, self, _other)
+1729 @func(inline='always')
+1730 def __radd__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__radd__.double3", double3, self, _other)
+1731 @func(inline='always')
+1732 def __iadd__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__iadd__.double3", double3, byref(self), _other)
+1733 @func(inline='always')
+1734 def __sub__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__sub__.double3", double3, self, _other)
+1735 @func(inline='always')
+1736 def __rsub__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__rsub__.double3", double3, self, _other)
+1737 @func(inline='always')
+1738 def __isub__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__isub__.double3", double3, byref(self), _other)
+1739 @func(inline='always')
+1740 def __mul__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__mul__.double3", double3, self, _other)
+1741 @func(inline='always')
+1742 def __rmul__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__rmul__.double3", double3, self, _other)
+1743 @func(inline='always')
+1744 def __imul__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__imul__.double3", double3, byref(self), _other)
+1745 @func(inline='always')
+1746 def __mod__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__mod__.double3", double3, self, _other)
+1747 @func(inline='always')
+1748 def __rmod__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__rmod__.double3", double3, self, _other)
+1749 @func(inline='always')
+1750 def __imod__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__imod__.double3", double3, byref(self), _other)
+1751 @func(inline='always')
+1752 def __lt__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'bool3': return intrinsic("cmp.__lt__.double3", bool3, self, _other) # type: ignore
+1753 @func(inline='always')
+1754 def __le__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'bool3': return intrinsic("cmp.__le__.double3", bool3, self, _other) # type: ignore
+1755 @func(inline='always')
+1756 def __gt__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'bool3': return intrinsic("cmp.__gt__.double3", bool3, self, _other) # type: ignore
+1757 @func(inline='always')
+1758 def __ge__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'bool3': return intrinsic("cmp.__ge__.double3", bool3, self, _other) # type: ignore
+1759 @func(inline='always')
+1760 def __eq__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'bool3': return intrinsic("cmp.__eq__.double3", bool3, self, _other) # type: ignore
+1761 @func(inline='always')
+1762 def __ne__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'bool3': return intrinsic("cmp.__ne__.double3", bool3, self, _other) # type: ignore
+1763 @func(inline='always')
+1764 def __truediv__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__truediv__.double3", double3, self, _other)
+1765 @func(inline='always')
+1766 def __rtruediv__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__rtruediv__.double3", double3, self, _other)
+1767 @func(inline='always')
+1768 def __itruediv__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__itruediv__.double3", double3, byref(self), _other)
+1769 @func(inline='always')
+1770 def __pow__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__pow__.double3", double3, self, _other)
+1771 @func(inline='always')
+1772 def __rpow__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__rpow__.double3", double3, self, _other)
+1773 @func(inline='always')
+1774 def __ipow__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__ipow__.double3", double3, byref(self), _other)
+1775 @func(inline='always')
+1776 def __floordiv__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__floordiv__.double3", double3, self, _other)
+1777 @func(inline='always')
+1778 def __rfloordiv__(self, _other: tp.Union['double3', f64, FloatLiteral]) -> 'double3': return intrinsic("binop.__rfloordiv__.double3", double3, self, _other)
+
1726 def __init__(self, x: tp.Union['f64', FloatLiteral] = FloatLiteral(), y: tp.Union['f64', FloatLiteral] = FloatLiteral(), z: tp.Union['f64', FloatLiteral] = FloatLiteral()) -> None: self = intrinsic("init.double3", double3, x, y, z)
+
1780@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[i8]), 3))
+1781class byte3:
+1782 x: i8
+1783 y: i8
+1784 z: i8
+1785 def __init__(self, x: tp.Union['i8', IntLiteral] = IntLiteral(), y: tp.Union['i8', IntLiteral] = IntLiteral(), z: tp.Union['i8', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.byte3", byte3, x, y, z)
+1786 @func(inline='always')
+1787 def __add__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__add__.byte3", byte3, self, _other)
+1788 @func(inline='always')
+1789 def __radd__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__radd__.byte3", byte3, self, _other)
+1790 @func(inline='always')
+1791 def __iadd__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__iadd__.byte3", byte3, byref(self), _other)
+1792 @func(inline='always')
+1793 def __sub__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__sub__.byte3", byte3, self, _other)
+1794 @func(inline='always')
+1795 def __rsub__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__rsub__.byte3", byte3, self, _other)
+1796 @func(inline='always')
+1797 def __isub__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__isub__.byte3", byte3, byref(self), _other)
+1798 @func(inline='always')
+1799 def __mul__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__mul__.byte3", byte3, self, _other)
+1800 @func(inline='always')
+1801 def __rmul__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__rmul__.byte3", byte3, self, _other)
+1802 @func(inline='always')
+1803 def __imul__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__imul__.byte3", byte3, byref(self), _other)
+1804 @func(inline='always')
+1805 def __mod__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__mod__.byte3", byte3, self, _other)
+1806 @func(inline='always')
+1807 def __rmod__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__rmod__.byte3", byte3, self, _other)
+1808 @func(inline='always')
+1809 def __imod__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__imod__.byte3", byte3, byref(self), _other)
+1810 @func(inline='always')
+1811 def __lt__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'bool3': return intrinsic("cmp.__lt__.byte3", bool3, self, _other) # type: ignore
+1812 @func(inline='always')
+1813 def __le__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'bool3': return intrinsic("cmp.__le__.byte3", bool3, self, _other) # type: ignore
+1814 @func(inline='always')
+1815 def __gt__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'bool3': return intrinsic("cmp.__gt__.byte3", bool3, self, _other) # type: ignore
+1816 @func(inline='always')
+1817 def __ge__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'bool3': return intrinsic("cmp.__ge__.byte3", bool3, self, _other) # type: ignore
+1818 @func(inline='always')
+1819 def __eq__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'bool3': return intrinsic("cmp.__eq__.byte3", bool3, self, _other) # type: ignore
+1820 @func(inline='always')
+1821 def __ne__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'bool3': return intrinsic("cmp.__ne__.byte3", bool3, self, _other) # type: ignore
+1822 @func(inline='always')
+1823 def __floordiv__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__floordiv__.byte3", byte3, self, _other)
+1824 @func(inline='always')
+1825 def __rfloordiv__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__rfloordiv__.byte3", byte3, self, _other)
+1826 @func(inline='always')
+1827 def __ifloordiv__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__ifloordiv__.byte3", byte3, byref(self), _other)
+1828 @func(inline='always')
+1829 def __lshift__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__lshift__.byte3", byte3, self, _other)
+1830 @func(inline='always')
+1831 def __rlshift__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__rlshift__.byte3", byte3, self, _other)
+1832 @func(inline='always')
+1833 def __ilshift__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__ilshift__.byte3", byte3, byref(self), _other)
+1834 @func(inline='always')
+1835 def __rshift__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__rshift__.byte3", byte3, self, _other)
+1836 @func(inline='always')
+1837 def __rrshift__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__rrshift__.byte3", byte3, self, _other)
+1838 @func(inline='always')
+1839 def __irshift__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__irshift__.byte3", byte3, byref(self), _other)
+1840 @func(inline='always')
+1841 def __and__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__and__.byte3", byte3, self, _other)
+1842 @func(inline='always')
+1843 def __rand__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__rand__.byte3", byte3, self, _other)
+1844 @func(inline='always')
+1845 def __iand__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__iand__.byte3", byte3, byref(self), _other)
+1846 @func(inline='always')
+1847 def __or__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__or__.byte3", byte3, self, _other)
+1848 @func(inline='always')
+1849 def __ror__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__ror__.byte3", byte3, self, _other)
+1850 @func(inline='always')
+1851 def __ior__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__ior__.byte3", byte3, byref(self), _other)
+1852 @func(inline='always')
+1853 def __xor__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__xor__.byte3", byte3, self, _other)
+1854 @func(inline='always')
+1855 def __rxor__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__rxor__.byte3", byte3, self, _other)
+1856 @func(inline='always')
+1857 def __ixor__(self, _other: tp.Union['byte3', i8, IntLiteral]) -> 'byte3': return intrinsic("binop.__ixor__.byte3", byte3, byref(self), _other)
+
1785 def __init__(self, x: tp.Union['i8', IntLiteral] = IntLiteral(), y: tp.Union['i8', IntLiteral] = IntLiteral(), z: tp.Union['i8', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.byte3", byte3, x, y, z)
+
1859@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[u8]), 3))
+1860class ubyte3:
+1861 x: u8
+1862 y: u8
+1863 z: u8
+1864 def __init__(self, x: tp.Union['u8', IntLiteral] = IntLiteral(), y: tp.Union['u8', IntLiteral] = IntLiteral(), z: tp.Union['u8', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.ubyte3", ubyte3, x, y, z)
+1865 @func(inline='always')
+1866 def __add__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__add__.ubyte3", ubyte3, self, _other)
+1867 @func(inline='always')
+1868 def __radd__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__radd__.ubyte3", ubyte3, self, _other)
+1869 @func(inline='always')
+1870 def __iadd__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__iadd__.ubyte3", ubyte3, byref(self), _other)
+1871 @func(inline='always')
+1872 def __sub__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__sub__.ubyte3", ubyte3, self, _other)
+1873 @func(inline='always')
+1874 def __rsub__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__rsub__.ubyte3", ubyte3, self, _other)
+1875 @func(inline='always')
+1876 def __isub__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__isub__.ubyte3", ubyte3, byref(self), _other)
+1877 @func(inline='always')
+1878 def __mul__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__mul__.ubyte3", ubyte3, self, _other)
+1879 @func(inline='always')
+1880 def __rmul__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__rmul__.ubyte3", ubyte3, self, _other)
+1881 @func(inline='always')
+1882 def __imul__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__imul__.ubyte3", ubyte3, byref(self), _other)
+1883 @func(inline='always')
+1884 def __mod__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__mod__.ubyte3", ubyte3, self, _other)
+1885 @func(inline='always')
+1886 def __rmod__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__rmod__.ubyte3", ubyte3, self, _other)
+1887 @func(inline='always')
+1888 def __imod__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__imod__.ubyte3", ubyte3, byref(self), _other)
+1889 @func(inline='always')
+1890 def __lt__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'bool3': return intrinsic("cmp.__lt__.ubyte3", bool3, self, _other) # type: ignore
+1891 @func(inline='always')
+1892 def __le__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'bool3': return intrinsic("cmp.__le__.ubyte3", bool3, self, _other) # type: ignore
+1893 @func(inline='always')
+1894 def __gt__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'bool3': return intrinsic("cmp.__gt__.ubyte3", bool3, self, _other) # type: ignore
+1895 @func(inline='always')
+1896 def __ge__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'bool3': return intrinsic("cmp.__ge__.ubyte3", bool3, self, _other) # type: ignore
+1897 @func(inline='always')
+1898 def __eq__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'bool3': return intrinsic("cmp.__eq__.ubyte3", bool3, self, _other) # type: ignore
+1899 @func(inline='always')
+1900 def __ne__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'bool3': return intrinsic("cmp.__ne__.ubyte3", bool3, self, _other) # type: ignore
+1901 @func(inline='always')
+1902 def __floordiv__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__floordiv__.ubyte3", ubyte3, self, _other)
+1903 @func(inline='always')
+1904 def __rfloordiv__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__rfloordiv__.ubyte3", ubyte3, self, _other)
+1905 @func(inline='always')
+1906 def __ifloordiv__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__ifloordiv__.ubyte3", ubyte3, byref(self), _other)
+1907 @func(inline='always')
+1908 def __lshift__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__lshift__.ubyte3", ubyte3, self, _other)
+1909 @func(inline='always')
+1910 def __rlshift__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__rlshift__.ubyte3", ubyte3, self, _other)
+1911 @func(inline='always')
+1912 def __ilshift__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__ilshift__.ubyte3", ubyte3, byref(self), _other)
+1913 @func(inline='always')
+1914 def __rshift__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__rshift__.ubyte3", ubyte3, self, _other)
+1915 @func(inline='always')
+1916 def __rrshift__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__rrshift__.ubyte3", ubyte3, self, _other)
+1917 @func(inline='always')
+1918 def __irshift__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__irshift__.ubyte3", ubyte3, byref(self), _other)
+1919 @func(inline='always')
+1920 def __and__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__and__.ubyte3", ubyte3, self, _other)
+1921 @func(inline='always')
+1922 def __rand__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__rand__.ubyte3", ubyte3, self, _other)
+1923 @func(inline='always')
+1924 def __iand__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__iand__.ubyte3", ubyte3, byref(self), _other)
+1925 @func(inline='always')
+1926 def __or__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__or__.ubyte3", ubyte3, self, _other)
+1927 @func(inline='always')
+1928 def __ror__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__ror__.ubyte3", ubyte3, self, _other)
+1929 @func(inline='always')
+1930 def __ior__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__ior__.ubyte3", ubyte3, byref(self), _other)
+1931 @func(inline='always')
+1932 def __xor__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__xor__.ubyte3", ubyte3, self, _other)
+1933 @func(inline='always')
+1934 def __rxor__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__rxor__.ubyte3", ubyte3, self, _other)
+1935 @func(inline='always')
+1936 def __ixor__(self, _other: tp.Union['ubyte3', u8, IntLiteral]) -> 'ubyte3': return intrinsic("binop.__ixor__.ubyte3", ubyte3, byref(self), _other)
+
1864 def __init__(self, x: tp.Union['u8', IntLiteral] = IntLiteral(), y: tp.Union['u8', IntLiteral] = IntLiteral(), z: tp.Union['u8', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.ubyte3", ubyte3, x, y, z)
+
1938@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[i16]), 3))
+1939class short3:
+1940 x: i16
+1941 y: i16
+1942 z: i16
+1943 def __init__(self, x: tp.Union['i16', IntLiteral] = IntLiteral(), y: tp.Union['i16', IntLiteral] = IntLiteral(), z: tp.Union['i16', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.short3", short3, x, y, z)
+1944 @func(inline='always')
+1945 def __add__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__add__.short3", short3, self, _other)
+1946 @func(inline='always')
+1947 def __radd__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__radd__.short3", short3, self, _other)
+1948 @func(inline='always')
+1949 def __iadd__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__iadd__.short3", short3, byref(self), _other)
+1950 @func(inline='always')
+1951 def __sub__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__sub__.short3", short3, self, _other)
+1952 @func(inline='always')
+1953 def __rsub__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__rsub__.short3", short3, self, _other)
+1954 @func(inline='always')
+1955 def __isub__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__isub__.short3", short3, byref(self), _other)
+1956 @func(inline='always')
+1957 def __mul__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__mul__.short3", short3, self, _other)
+1958 @func(inline='always')
+1959 def __rmul__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__rmul__.short3", short3, self, _other)
+1960 @func(inline='always')
+1961 def __imul__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__imul__.short3", short3, byref(self), _other)
+1962 @func(inline='always')
+1963 def __mod__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__mod__.short3", short3, self, _other)
+1964 @func(inline='always')
+1965 def __rmod__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__rmod__.short3", short3, self, _other)
+1966 @func(inline='always')
+1967 def __imod__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__imod__.short3", short3, byref(self), _other)
+1968 @func(inline='always')
+1969 def __lt__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'bool3': return intrinsic("cmp.__lt__.short3", bool3, self, _other) # type: ignore
+1970 @func(inline='always')
+1971 def __le__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'bool3': return intrinsic("cmp.__le__.short3", bool3, self, _other) # type: ignore
+1972 @func(inline='always')
+1973 def __gt__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'bool3': return intrinsic("cmp.__gt__.short3", bool3, self, _other) # type: ignore
+1974 @func(inline='always')
+1975 def __ge__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'bool3': return intrinsic("cmp.__ge__.short3", bool3, self, _other) # type: ignore
+1976 @func(inline='always')
+1977 def __eq__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'bool3': return intrinsic("cmp.__eq__.short3", bool3, self, _other) # type: ignore
+1978 @func(inline='always')
+1979 def __ne__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'bool3': return intrinsic("cmp.__ne__.short3", bool3, self, _other) # type: ignore
+1980 @func(inline='always')
+1981 def __floordiv__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__floordiv__.short3", short3, self, _other)
+1982 @func(inline='always')
+1983 def __rfloordiv__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__rfloordiv__.short3", short3, self, _other)
+1984 @func(inline='always')
+1985 def __ifloordiv__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__ifloordiv__.short3", short3, byref(self), _other)
+1986 @func(inline='always')
+1987 def __lshift__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__lshift__.short3", short3, self, _other)
+1988 @func(inline='always')
+1989 def __rlshift__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__rlshift__.short3", short3, self, _other)
+1990 @func(inline='always')
+1991 def __ilshift__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__ilshift__.short3", short3, byref(self), _other)
+1992 @func(inline='always')
+1993 def __rshift__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__rshift__.short3", short3, self, _other)
+1994 @func(inline='always')
+1995 def __rrshift__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__rrshift__.short3", short3, self, _other)
+1996 @func(inline='always')
+1997 def __irshift__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__irshift__.short3", short3, byref(self), _other)
+1998 @func(inline='always')
+1999 def __and__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__and__.short3", short3, self, _other)
+2000 @func(inline='always')
+2001 def __rand__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__rand__.short3", short3, self, _other)
+2002 @func(inline='always')
+2003 def __iand__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__iand__.short3", short3, byref(self), _other)
+2004 @func(inline='always')
+2005 def __or__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__or__.short3", short3, self, _other)
+2006 @func(inline='always')
+2007 def __ror__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__ror__.short3", short3, self, _other)
+2008 @func(inline='always')
+2009 def __ior__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__ior__.short3", short3, byref(self), _other)
+2010 @func(inline='always')
+2011 def __xor__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__xor__.short3", short3, self, _other)
+2012 @func(inline='always')
+2013 def __rxor__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__rxor__.short3", short3, self, _other)
+2014 @func(inline='always')
+2015 def __ixor__(self, _other: tp.Union['short3', i16, IntLiteral]) -> 'short3': return intrinsic("binop.__ixor__.short3", short3, byref(self), _other)
+
1943 def __init__(self, x: tp.Union['i16', IntLiteral] = IntLiteral(), y: tp.Union['i16', IntLiteral] = IntLiteral(), z: tp.Union['i16', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.short3", short3, x, y, z)
+
2017@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[u16]), 3))
+2018class ushort3:
+2019 x: u16
+2020 y: u16
+2021 z: u16
+2022 def __init__(self, x: tp.Union['u16', IntLiteral] = IntLiteral(), y: tp.Union['u16', IntLiteral] = IntLiteral(), z: tp.Union['u16', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.ushort3", ushort3, x, y, z)
+2023 @func(inline='always')
+2024 def __add__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__add__.ushort3", ushort3, self, _other)
+2025 @func(inline='always')
+2026 def __radd__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__radd__.ushort3", ushort3, self, _other)
+2027 @func(inline='always')
+2028 def __iadd__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__iadd__.ushort3", ushort3, byref(self), _other)
+2029 @func(inline='always')
+2030 def __sub__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__sub__.ushort3", ushort3, self, _other)
+2031 @func(inline='always')
+2032 def __rsub__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__rsub__.ushort3", ushort3, self, _other)
+2033 @func(inline='always')
+2034 def __isub__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__isub__.ushort3", ushort3, byref(self), _other)
+2035 @func(inline='always')
+2036 def __mul__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__mul__.ushort3", ushort3, self, _other)
+2037 @func(inline='always')
+2038 def __rmul__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__rmul__.ushort3", ushort3, self, _other)
+2039 @func(inline='always')
+2040 def __imul__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__imul__.ushort3", ushort3, byref(self), _other)
+2041 @func(inline='always')
+2042 def __mod__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__mod__.ushort3", ushort3, self, _other)
+2043 @func(inline='always')
+2044 def __rmod__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__rmod__.ushort3", ushort3, self, _other)
+2045 @func(inline='always')
+2046 def __imod__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__imod__.ushort3", ushort3, byref(self), _other)
+2047 @func(inline='always')
+2048 def __lt__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'bool3': return intrinsic("cmp.__lt__.ushort3", bool3, self, _other) # type: ignore
+2049 @func(inline='always')
+2050 def __le__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'bool3': return intrinsic("cmp.__le__.ushort3", bool3, self, _other) # type: ignore
+2051 @func(inline='always')
+2052 def __gt__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'bool3': return intrinsic("cmp.__gt__.ushort3", bool3, self, _other) # type: ignore
+2053 @func(inline='always')
+2054 def __ge__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'bool3': return intrinsic("cmp.__ge__.ushort3", bool3, self, _other) # type: ignore
+2055 @func(inline='always')
+2056 def __eq__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'bool3': return intrinsic("cmp.__eq__.ushort3", bool3, self, _other) # type: ignore
+2057 @func(inline='always')
+2058 def __ne__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'bool3': return intrinsic("cmp.__ne__.ushort3", bool3, self, _other) # type: ignore
+2059 @func(inline='always')
+2060 def __floordiv__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__floordiv__.ushort3", ushort3, self, _other)
+2061 @func(inline='always')
+2062 def __rfloordiv__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__rfloordiv__.ushort3", ushort3, self, _other)
+2063 @func(inline='always')
+2064 def __ifloordiv__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__ifloordiv__.ushort3", ushort3, byref(self), _other)
+2065 @func(inline='always')
+2066 def __lshift__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__lshift__.ushort3", ushort3, self, _other)
+2067 @func(inline='always')
+2068 def __rlshift__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__rlshift__.ushort3", ushort3, self, _other)
+2069 @func(inline='always')
+2070 def __ilshift__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__ilshift__.ushort3", ushort3, byref(self), _other)
+2071 @func(inline='always')
+2072 def __rshift__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__rshift__.ushort3", ushort3, self, _other)
+2073 @func(inline='always')
+2074 def __rrshift__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__rrshift__.ushort3", ushort3, self, _other)
+2075 @func(inline='always')
+2076 def __irshift__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__irshift__.ushort3", ushort3, byref(self), _other)
+2077 @func(inline='always')
+2078 def __and__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__and__.ushort3", ushort3, self, _other)
+2079 @func(inline='always')
+2080 def __rand__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__rand__.ushort3", ushort3, self, _other)
+2081 @func(inline='always')
+2082 def __iand__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__iand__.ushort3", ushort3, byref(self), _other)
+2083 @func(inline='always')
+2084 def __or__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__or__.ushort3", ushort3, self, _other)
+2085 @func(inline='always')
+2086 def __ror__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__ror__.ushort3", ushort3, self, _other)
+2087 @func(inline='always')
+2088 def __ior__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__ior__.ushort3", ushort3, byref(self), _other)
+2089 @func(inline='always')
+2090 def __xor__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__xor__.ushort3", ushort3, self, _other)
+2091 @func(inline='always')
+2092 def __rxor__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__rxor__.ushort3", ushort3, self, _other)
+2093 @func(inline='always')
+2094 def __ixor__(self, _other: tp.Union['ushort3', u16, IntLiteral]) -> 'ushort3': return intrinsic("binop.__ixor__.ushort3", ushort3, byref(self), _other)
+
2022 def __init__(self, x: tp.Union['u16', IntLiteral] = IntLiteral(), y: tp.Union['u16', IntLiteral] = IntLiteral(), z: tp.Union['u16', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.ushort3", ushort3, x, y, z)
+
2096@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[i32]), 3))
+2097class int3:
+2098 x: i32
+2099 y: i32
+2100 z: i32
+2101 def __init__(self, x: tp.Union['i32', IntLiteral] = IntLiteral(), y: tp.Union['i32', IntLiteral] = IntLiteral(), z: tp.Union['i32', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.int3", int3, x, y, z)
+2102 @func(inline='always')
+2103 def __add__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__add__.int3", int3, self, _other)
+2104 @func(inline='always')
+2105 def __radd__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__radd__.int3", int3, self, _other)
+2106 @func(inline='always')
+2107 def __iadd__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__iadd__.int3", int3, byref(self), _other)
+2108 @func(inline='always')
+2109 def __sub__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__sub__.int3", int3, self, _other)
+2110 @func(inline='always')
+2111 def __rsub__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__rsub__.int3", int3, self, _other)
+2112 @func(inline='always')
+2113 def __isub__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__isub__.int3", int3, byref(self), _other)
+2114 @func(inline='always')
+2115 def __mul__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__mul__.int3", int3, self, _other)
+2116 @func(inline='always')
+2117 def __rmul__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__rmul__.int3", int3, self, _other)
+2118 @func(inline='always')
+2119 def __imul__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__imul__.int3", int3, byref(self), _other)
+2120 @func(inline='always')
+2121 def __mod__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__mod__.int3", int3, self, _other)
+2122 @func(inline='always')
+2123 def __rmod__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__rmod__.int3", int3, self, _other)
+2124 @func(inline='always')
+2125 def __imod__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__imod__.int3", int3, byref(self), _other)
+2126 @func(inline='always')
+2127 def __lt__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'bool3': return intrinsic("cmp.__lt__.int3", bool3, self, _other) # type: ignore
+2128 @func(inline='always')
+2129 def __le__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'bool3': return intrinsic("cmp.__le__.int3", bool3, self, _other) # type: ignore
+2130 @func(inline='always')
+2131 def __gt__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'bool3': return intrinsic("cmp.__gt__.int3", bool3, self, _other) # type: ignore
+2132 @func(inline='always')
+2133 def __ge__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'bool3': return intrinsic("cmp.__ge__.int3", bool3, self, _other) # type: ignore
+2134 @func(inline='always')
+2135 def __eq__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'bool3': return intrinsic("cmp.__eq__.int3", bool3, self, _other) # type: ignore
+2136 @func(inline='always')
+2137 def __ne__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'bool3': return intrinsic("cmp.__ne__.int3", bool3, self, _other) # type: ignore
+2138 @func(inline='always')
+2139 def __floordiv__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__floordiv__.int3", int3, self, _other)
+2140 @func(inline='always')
+2141 def __rfloordiv__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__rfloordiv__.int3", int3, self, _other)
+2142 @func(inline='always')
+2143 def __ifloordiv__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__ifloordiv__.int3", int3, byref(self), _other)
+2144 @func(inline='always')
+2145 def __lshift__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__lshift__.int3", int3, self, _other)
+2146 @func(inline='always')
+2147 def __rlshift__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__rlshift__.int3", int3, self, _other)
+2148 @func(inline='always')
+2149 def __ilshift__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__ilshift__.int3", int3, byref(self), _other)
+2150 @func(inline='always')
+2151 def __rshift__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__rshift__.int3", int3, self, _other)
+2152 @func(inline='always')
+2153 def __rrshift__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__rrshift__.int3", int3, self, _other)
+2154 @func(inline='always')
+2155 def __irshift__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__irshift__.int3", int3, byref(self), _other)
+2156 @func(inline='always')
+2157 def __and__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__and__.int3", int3, self, _other)
+2158 @func(inline='always')
+2159 def __rand__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__rand__.int3", int3, self, _other)
+2160 @func(inline='always')
+2161 def __iand__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__iand__.int3", int3, byref(self), _other)
+2162 @func(inline='always')
+2163 def __or__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__or__.int3", int3, self, _other)
+2164 @func(inline='always')
+2165 def __ror__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__ror__.int3", int3, self, _other)
+2166 @func(inline='always')
+2167 def __ior__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__ior__.int3", int3, byref(self), _other)
+2168 @func(inline='always')
+2169 def __xor__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__xor__.int3", int3, self, _other)
+2170 @func(inline='always')
+2171 def __rxor__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__rxor__.int3", int3, self, _other)
+2172 @func(inline='always')
+2173 def __ixor__(self, _other: tp.Union['int3', i32, IntLiteral]) -> 'int3': return intrinsic("binop.__ixor__.int3", int3, byref(self), _other)
+
2101 def __init__(self, x: tp.Union['i32', IntLiteral] = IntLiteral(), y: tp.Union['i32', IntLiteral] = IntLiteral(), z: tp.Union['i32', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.int3", int3, x, y, z)
+
2175@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[u32]), 3))
+2176class uint3:
+2177 x: u32
+2178 y: u32
+2179 z: u32
+2180 def __init__(self, x: tp.Union['u32', IntLiteral] = IntLiteral(), y: tp.Union['u32', IntLiteral] = IntLiteral(), z: tp.Union['u32', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.uint3", uint3, x, y, z)
+2181 @func(inline='always')
+2182 def __add__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__add__.uint3", uint3, self, _other)
+2183 @func(inline='always')
+2184 def __radd__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__radd__.uint3", uint3, self, _other)
+2185 @func(inline='always')
+2186 def __iadd__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__iadd__.uint3", uint3, byref(self), _other)
+2187 @func(inline='always')
+2188 def __sub__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__sub__.uint3", uint3, self, _other)
+2189 @func(inline='always')
+2190 def __rsub__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__rsub__.uint3", uint3, self, _other)
+2191 @func(inline='always')
+2192 def __isub__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__isub__.uint3", uint3, byref(self), _other)
+2193 @func(inline='always')
+2194 def __mul__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__mul__.uint3", uint3, self, _other)
+2195 @func(inline='always')
+2196 def __rmul__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__rmul__.uint3", uint3, self, _other)
+2197 @func(inline='always')
+2198 def __imul__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__imul__.uint3", uint3, byref(self), _other)
+2199 @func(inline='always')
+2200 def __mod__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__mod__.uint3", uint3, self, _other)
+2201 @func(inline='always')
+2202 def __rmod__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__rmod__.uint3", uint3, self, _other)
+2203 @func(inline='always')
+2204 def __imod__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__imod__.uint3", uint3, byref(self), _other)
+2205 @func(inline='always')
+2206 def __lt__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'bool3': return intrinsic("cmp.__lt__.uint3", bool3, self, _other) # type: ignore
+2207 @func(inline='always')
+2208 def __le__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'bool3': return intrinsic("cmp.__le__.uint3", bool3, self, _other) # type: ignore
+2209 @func(inline='always')
+2210 def __gt__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'bool3': return intrinsic("cmp.__gt__.uint3", bool3, self, _other) # type: ignore
+2211 @func(inline='always')
+2212 def __ge__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'bool3': return intrinsic("cmp.__ge__.uint3", bool3, self, _other) # type: ignore
+2213 @func(inline='always')
+2214 def __eq__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'bool3': return intrinsic("cmp.__eq__.uint3", bool3, self, _other) # type: ignore
+2215 @func(inline='always')
+2216 def __ne__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'bool3': return intrinsic("cmp.__ne__.uint3", bool3, self, _other) # type: ignore
+2217 @func(inline='always')
+2218 def __floordiv__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__floordiv__.uint3", uint3, self, _other)
+2219 @func(inline='always')
+2220 def __rfloordiv__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__rfloordiv__.uint3", uint3, self, _other)
+2221 @func(inline='always')
+2222 def __ifloordiv__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__ifloordiv__.uint3", uint3, byref(self), _other)
+2223 @func(inline='always')
+2224 def __lshift__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__lshift__.uint3", uint3, self, _other)
+2225 @func(inline='always')
+2226 def __rlshift__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__rlshift__.uint3", uint3, self, _other)
+2227 @func(inline='always')
+2228 def __ilshift__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__ilshift__.uint3", uint3, byref(self), _other)
+2229 @func(inline='always')
+2230 def __rshift__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__rshift__.uint3", uint3, self, _other)
+2231 @func(inline='always')
+2232 def __rrshift__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__rrshift__.uint3", uint3, self, _other)
+2233 @func(inline='always')
+2234 def __irshift__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__irshift__.uint3", uint3, byref(self), _other)
+2235 @func(inline='always')
+2236 def __and__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__and__.uint3", uint3, self, _other)
+2237 @func(inline='always')
+2238 def __rand__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__rand__.uint3", uint3, self, _other)
+2239 @func(inline='always')
+2240 def __iand__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__iand__.uint3", uint3, byref(self), _other)
+2241 @func(inline='always')
+2242 def __or__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__or__.uint3", uint3, self, _other)
+2243 @func(inline='always')
+2244 def __ror__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__ror__.uint3", uint3, self, _other)
+2245 @func(inline='always')
+2246 def __ior__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__ior__.uint3", uint3, byref(self), _other)
+2247 @func(inline='always')
+2248 def __xor__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__xor__.uint3", uint3, self, _other)
+2249 @func(inline='always')
+2250 def __rxor__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__rxor__.uint3", uint3, self, _other)
+2251 @func(inline='always')
+2252 def __ixor__(self, _other: tp.Union['uint3', u32, IntLiteral]) -> 'uint3': return intrinsic("binop.__ixor__.uint3", uint3, byref(self), _other)
+
2180 def __init__(self, x: tp.Union['u32', IntLiteral] = IntLiteral(), y: tp.Union['u32', IntLiteral] = IntLiteral(), z: tp.Union['u32', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.uint3", uint3, x, y, z)
+
2254@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[i64]), 3))
+2255class long3:
+2256 x: i64
+2257 y: i64
+2258 z: i64
+2259 def __init__(self, x: tp.Union['i64', IntLiteral] = IntLiteral(), y: tp.Union['i64', IntLiteral] = IntLiteral(), z: tp.Union['i64', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.long3", long3, x, y, z)
+2260 @func(inline='always')
+2261 def __add__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__add__.long3", long3, self, _other)
+2262 @func(inline='always')
+2263 def __radd__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__radd__.long3", long3, self, _other)
+2264 @func(inline='always')
+2265 def __iadd__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__iadd__.long3", long3, byref(self), _other)
+2266 @func(inline='always')
+2267 def __sub__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__sub__.long3", long3, self, _other)
+2268 @func(inline='always')
+2269 def __rsub__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__rsub__.long3", long3, self, _other)
+2270 @func(inline='always')
+2271 def __isub__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__isub__.long3", long3, byref(self), _other)
+2272 @func(inline='always')
+2273 def __mul__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__mul__.long3", long3, self, _other)
+2274 @func(inline='always')
+2275 def __rmul__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__rmul__.long3", long3, self, _other)
+2276 @func(inline='always')
+2277 def __imul__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__imul__.long3", long3, byref(self), _other)
+2278 @func(inline='always')
+2279 def __mod__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__mod__.long3", long3, self, _other)
+2280 @func(inline='always')
+2281 def __rmod__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__rmod__.long3", long3, self, _other)
+2282 @func(inline='always')
+2283 def __imod__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__imod__.long3", long3, byref(self), _other)
+2284 @func(inline='always')
+2285 def __lt__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'bool3': return intrinsic("cmp.__lt__.long3", bool3, self, _other) # type: ignore
+2286 @func(inline='always')
+2287 def __le__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'bool3': return intrinsic("cmp.__le__.long3", bool3, self, _other) # type: ignore
+2288 @func(inline='always')
+2289 def __gt__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'bool3': return intrinsic("cmp.__gt__.long3", bool3, self, _other) # type: ignore
+2290 @func(inline='always')
+2291 def __ge__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'bool3': return intrinsic("cmp.__ge__.long3", bool3, self, _other) # type: ignore
+2292 @func(inline='always')
+2293 def __eq__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'bool3': return intrinsic("cmp.__eq__.long3", bool3, self, _other) # type: ignore
+2294 @func(inline='always')
+2295 def __ne__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'bool3': return intrinsic("cmp.__ne__.long3", bool3, self, _other) # type: ignore
+2296 @func(inline='always')
+2297 def __floordiv__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__floordiv__.long3", long3, self, _other)
+2298 @func(inline='always')
+2299 def __rfloordiv__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__rfloordiv__.long3", long3, self, _other)
+2300 @func(inline='always')
+2301 def __ifloordiv__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__ifloordiv__.long3", long3, byref(self), _other)
+2302 @func(inline='always')
+2303 def __lshift__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__lshift__.long3", long3, self, _other)
+2304 @func(inline='always')
+2305 def __rlshift__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__rlshift__.long3", long3, self, _other)
+2306 @func(inline='always')
+2307 def __ilshift__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__ilshift__.long3", long3, byref(self), _other)
+2308 @func(inline='always')
+2309 def __rshift__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__rshift__.long3", long3, self, _other)
+2310 @func(inline='always')
+2311 def __rrshift__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__rrshift__.long3", long3, self, _other)
+2312 @func(inline='always')
+2313 def __irshift__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__irshift__.long3", long3, byref(self), _other)
+2314 @func(inline='always')
+2315 def __and__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__and__.long3", long3, self, _other)
+2316 @func(inline='always')
+2317 def __rand__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__rand__.long3", long3, self, _other)
+2318 @func(inline='always')
+2319 def __iand__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__iand__.long3", long3, byref(self), _other)
+2320 @func(inline='always')
+2321 def __or__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__or__.long3", long3, self, _other)
+2322 @func(inline='always')
+2323 def __ror__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__ror__.long3", long3, self, _other)
+2324 @func(inline='always')
+2325 def __ior__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__ior__.long3", long3, byref(self), _other)
+2326 @func(inline='always')
+2327 def __xor__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__xor__.long3", long3, self, _other)
+2328 @func(inline='always')
+2329 def __rxor__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__rxor__.long3", long3, self, _other)
+2330 @func(inline='always')
+2331 def __ixor__(self, _other: tp.Union['long3', i64, IntLiteral]) -> 'long3': return intrinsic("binop.__ixor__.long3", long3, byref(self), _other)
+
2259 def __init__(self, x: tp.Union['i64', IntLiteral] = IntLiteral(), y: tp.Union['i64', IntLiteral] = IntLiteral(), z: tp.Union['i64', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.long3", long3, x, y, z)
+
2333@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[u64]), 3))
+2334class ulong3:
+2335 x: u64
+2336 y: u64
+2337 z: u64
+2338 def __init__(self, x: tp.Union['u64', IntLiteral] = IntLiteral(), y: tp.Union['u64', IntLiteral] = IntLiteral(), z: tp.Union['u64', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.ulong3", ulong3, x, y, z)
+2339 @func(inline='always')
+2340 def __add__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__add__.ulong3", ulong3, self, _other)
+2341 @func(inline='always')
+2342 def __radd__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__radd__.ulong3", ulong3, self, _other)
+2343 @func(inline='always')
+2344 def __iadd__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__iadd__.ulong3", ulong3, byref(self), _other)
+2345 @func(inline='always')
+2346 def __sub__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__sub__.ulong3", ulong3, self, _other)
+2347 @func(inline='always')
+2348 def __rsub__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__rsub__.ulong3", ulong3, self, _other)
+2349 @func(inline='always')
+2350 def __isub__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__isub__.ulong3", ulong3, byref(self), _other)
+2351 @func(inline='always')
+2352 def __mul__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__mul__.ulong3", ulong3, self, _other)
+2353 @func(inline='always')
+2354 def __rmul__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__rmul__.ulong3", ulong3, self, _other)
+2355 @func(inline='always')
+2356 def __imul__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__imul__.ulong3", ulong3, byref(self), _other)
+2357 @func(inline='always')
+2358 def __mod__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__mod__.ulong3", ulong3, self, _other)
+2359 @func(inline='always')
+2360 def __rmod__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__rmod__.ulong3", ulong3, self, _other)
+2361 @func(inline='always')
+2362 def __imod__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__imod__.ulong3", ulong3, byref(self), _other)
+2363 @func(inline='always')
+2364 def __lt__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'bool3': return intrinsic("cmp.__lt__.ulong3", bool3, self, _other) # type: ignore
+2365 @func(inline='always')
+2366 def __le__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'bool3': return intrinsic("cmp.__le__.ulong3", bool3, self, _other) # type: ignore
+2367 @func(inline='always')
+2368 def __gt__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'bool3': return intrinsic("cmp.__gt__.ulong3", bool3, self, _other) # type: ignore
+2369 @func(inline='always')
+2370 def __ge__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'bool3': return intrinsic("cmp.__ge__.ulong3", bool3, self, _other) # type: ignore
+2371 @func(inline='always')
+2372 def __eq__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'bool3': return intrinsic("cmp.__eq__.ulong3", bool3, self, _other) # type: ignore
+2373 @func(inline='always')
+2374 def __ne__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'bool3': return intrinsic("cmp.__ne__.ulong3", bool3, self, _other) # type: ignore
+2375 @func(inline='always')
+2376 def __floordiv__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__floordiv__.ulong3", ulong3, self, _other)
+2377 @func(inline='always')
+2378 def __rfloordiv__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__rfloordiv__.ulong3", ulong3, self, _other)
+2379 @func(inline='always')
+2380 def __ifloordiv__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__ifloordiv__.ulong3", ulong3, byref(self), _other)
+2381 @func(inline='always')
+2382 def __lshift__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__lshift__.ulong3", ulong3, self, _other)
+2383 @func(inline='always')
+2384 def __rlshift__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__rlshift__.ulong3", ulong3, self, _other)
+2385 @func(inline='always')
+2386 def __ilshift__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__ilshift__.ulong3", ulong3, byref(self), _other)
+2387 @func(inline='always')
+2388 def __rshift__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__rshift__.ulong3", ulong3, self, _other)
+2389 @func(inline='always')
+2390 def __rrshift__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__rrshift__.ulong3", ulong3, self, _other)
+2391 @func(inline='always')
+2392 def __irshift__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__irshift__.ulong3", ulong3, byref(self), _other)
+2393 @func(inline='always')
+2394 def __and__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__and__.ulong3", ulong3, self, _other)
+2395 @func(inline='always')
+2396 def __rand__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__rand__.ulong3", ulong3, self, _other)
+2397 @func(inline='always')
+2398 def __iand__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__iand__.ulong3", ulong3, byref(self), _other)
+2399 @func(inline='always')
+2400 def __or__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__or__.ulong3", ulong3, self, _other)
+2401 @func(inline='always')
+2402 def __ror__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__ror__.ulong3", ulong3, self, _other)
+2403 @func(inline='always')
+2404 def __ior__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__ior__.ulong3", ulong3, byref(self), _other)
+2405 @func(inline='always')
+2406 def __xor__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__xor__.ulong3", ulong3, self, _other)
+2407 @func(inline='always')
+2408 def __rxor__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__rxor__.ulong3", ulong3, self, _other)
+2409 @func(inline='always')
+2410 def __ixor__(self, _other: tp.Union['ulong3', u64, IntLiteral]) -> 'ulong3': return intrinsic("binop.__ixor__.ulong3", ulong3, byref(self), _other)
+
2338 def __init__(self, x: tp.Union['u64', IntLiteral] = IntLiteral(), y: tp.Union['u64', IntLiteral] = IntLiteral(), z: tp.Union['u64', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.ulong3", ulong3, x, y, z)
+
2412@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[bool]), 4))
+2413class bool4:
+2414 x: bool
+2415 y: bool
+2416 z: bool
+2417 w: bool
+2418 def __init__(self, x: tp.Union['bool', bool] = False, y: tp.Union['bool', bool] = False, z: tp.Union['bool', bool] = False, w: tp.Union['bool', bool] = False) -> None: self = intrinsic("init.bool4", bool4, x, y, z, w)
+2419 @func(inline='always')
+2420 def __eq__(self, _other: tp.Union['bool4', bool, bool]) -> 'bool4': return intrinsic("cmp.__eq__.bool4", bool4, self, _other) # type: ignore
+2421 @func(inline='always')
+2422 def __ne__(self, _other: tp.Union['bool4', bool, bool]) -> 'bool4': return intrinsic("cmp.__ne__.bool4", bool4, self, _other) # type: ignore
+2423 @func(inline='always')
+2424 def __and__(self, _other: tp.Union['bool4', bool, bool]) -> 'bool4': return intrinsic("binop.__and__.bool4", bool4, self, _other)
+2425 @func(inline='always')
+2426 def __rand__(self, _other: tp.Union['bool4', bool, bool]) -> 'bool4': return intrinsic("binop.__rand__.bool4", bool4, self, _other)
+2427 @func(inline='always')
+2428 def __iand__(self, _other: tp.Union['bool4', bool, bool]) -> 'bool4': return intrinsic("binop.__iand__.bool4", bool4, byref(self), _other)
+2429 @func(inline='always')
+2430 def __or__(self, _other: tp.Union['bool4', bool, bool]) -> 'bool4': return intrinsic("binop.__or__.bool4", bool4, self, _other)
+2431 @func(inline='always')
+2432 def __ror__(self, _other: tp.Union['bool4', bool, bool]) -> 'bool4': return intrinsic("binop.__ror__.bool4", bool4, self, _other)
+2433 @func(inline='always')
+2434 def __ior__(self, _other: tp.Union['bool4', bool, bool]) -> 'bool4': return intrinsic("binop.__ior__.bool4", bool4, byref(self), _other)
+2435 @func(inline='always')
+2436 def __xor__(self, _other: tp.Union['bool4', bool, bool]) -> 'bool4': return intrinsic("binop.__xor__.bool4", bool4, self, _other)
+2437 @func(inline='always')
+2438 def __rxor__(self, _other: tp.Union['bool4', bool, bool]) -> 'bool4': return intrinsic("binop.__rxor__.bool4", bool4, self, _other)
+2439 @func(inline='always')
+2440 def __ixor__(self, _other: tp.Union['bool4', bool, bool]) -> 'bool4': return intrinsic("binop.__ixor__.bool4", bool4, byref(self), _other)
+
2418 def __init__(self, x: tp.Union['bool', bool] = False, y: tp.Union['bool', bool] = False, z: tp.Union['bool', bool] = False, w: tp.Union['bool', bool] = False) -> None: self = intrinsic("init.bool4", bool4, x, y, z, w)
+
2442@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[f32]), 4))
+2443class float4:
+2444 x: f32
+2445 y: f32
+2446 z: f32
+2447 w: f32
+2448 def __init__(self, x: tp.Union['f32', FloatLiteral] = FloatLiteral(), y: tp.Union['f32', FloatLiteral] = FloatLiteral(), z: tp.Union['f32', FloatLiteral] = FloatLiteral(), w: tp.Union['f32', FloatLiteral] = FloatLiteral()) -> None: self = intrinsic("init.float4", float4, x, y, z, w)
+2449 @func(inline='always')
+2450 def __add__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__add__.float4", float4, self, _other)
+2451 @func(inline='always')
+2452 def __radd__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__radd__.float4", float4, self, _other)
+2453 @func(inline='always')
+2454 def __iadd__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__iadd__.float4", float4, byref(self), _other)
+2455 @func(inline='always')
+2456 def __sub__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__sub__.float4", float4, self, _other)
+2457 @func(inline='always')
+2458 def __rsub__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__rsub__.float4", float4, self, _other)
+2459 @func(inline='always')
+2460 def __isub__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__isub__.float4", float4, byref(self), _other)
+2461 @func(inline='always')
+2462 def __mul__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__mul__.float4", float4, self, _other)
+2463 @func(inline='always')
+2464 def __rmul__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__rmul__.float4", float4, self, _other)
+2465 @func(inline='always')
+2466 def __imul__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__imul__.float4", float4, byref(self), _other)
+2467 @func(inline='always')
+2468 def __mod__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__mod__.float4", float4, self, _other)
+2469 @func(inline='always')
+2470 def __rmod__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__rmod__.float4", float4, self, _other)
+2471 @func(inline='always')
+2472 def __imod__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__imod__.float4", float4, byref(self), _other)
+2473 @func(inline='always')
+2474 def __lt__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'bool4': return intrinsic("cmp.__lt__.float4", bool4, self, _other) # type: ignore
+2475 @func(inline='always')
+2476 def __le__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'bool4': return intrinsic("cmp.__le__.float4", bool4, self, _other) # type: ignore
+2477 @func(inline='always')
+2478 def __gt__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'bool4': return intrinsic("cmp.__gt__.float4", bool4, self, _other) # type: ignore
+2479 @func(inline='always')
+2480 def __ge__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'bool4': return intrinsic("cmp.__ge__.float4", bool4, self, _other) # type: ignore
+2481 @func(inline='always')
+2482 def __eq__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'bool4': return intrinsic("cmp.__eq__.float4", bool4, self, _other) # type: ignore
+2483 @func(inline='always')
+2484 def __ne__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'bool4': return intrinsic("cmp.__ne__.float4", bool4, self, _other) # type: ignore
+2485 @func(inline='always')
+2486 def __truediv__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__truediv__.float4", float4, self, _other)
+2487 @func(inline='always')
+2488 def __rtruediv__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__rtruediv__.float4", float4, self, _other)
+2489 @func(inline='always')
+2490 def __itruediv__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__itruediv__.float4", float4, byref(self), _other)
+2491 @func(inline='always')
+2492 def __pow__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__pow__.float4", float4, self, _other)
+2493 @func(inline='always')
+2494 def __rpow__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__rpow__.float4", float4, self, _other)
+2495 @func(inline='always')
+2496 def __ipow__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__ipow__.float4", float4, byref(self), _other)
+2497 @func(inline='always')
+2498 def __floordiv__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__floordiv__.float4", float4, self, _other)
+2499 @func(inline='always')
+2500 def __rfloordiv__(self, _other: tp.Union['float4', f32, FloatLiteral]) -> 'float4': return intrinsic("binop.__rfloordiv__.float4", float4, self, _other)
+
2448 def __init__(self, x: tp.Union['f32', FloatLiteral] = FloatLiteral(), y: tp.Union['f32', FloatLiteral] = FloatLiteral(), z: tp.Union['f32', FloatLiteral] = FloatLiteral(), w: tp.Union['f32', FloatLiteral] = FloatLiteral()) -> None: self = intrinsic("init.float4", float4, x, y, z, w)
+
2502@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[f64]), 4))
+2503class double4:
+2504 x: f64
+2505 y: f64
+2506 z: f64
+2507 w: f64
+2508 def __init__(self, x: tp.Union['f64', FloatLiteral] = FloatLiteral(), y: tp.Union['f64', FloatLiteral] = FloatLiteral(), z: tp.Union['f64', FloatLiteral] = FloatLiteral(), w: tp.Union['f64', FloatLiteral] = FloatLiteral()) -> None: self = intrinsic("init.double4", double4, x, y, z, w)
+2509 @func(inline='always')
+2510 def __add__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__add__.double4", double4, self, _other)
+2511 @func(inline='always')
+2512 def __radd__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__radd__.double4", double4, self, _other)
+2513 @func(inline='always')
+2514 def __iadd__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__iadd__.double4", double4, byref(self), _other)
+2515 @func(inline='always')
+2516 def __sub__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__sub__.double4", double4, self, _other)
+2517 @func(inline='always')
+2518 def __rsub__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__rsub__.double4", double4, self, _other)
+2519 @func(inline='always')
+2520 def __isub__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__isub__.double4", double4, byref(self), _other)
+2521 @func(inline='always')
+2522 def __mul__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__mul__.double4", double4, self, _other)
+2523 @func(inline='always')
+2524 def __rmul__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__rmul__.double4", double4, self, _other)
+2525 @func(inline='always')
+2526 def __imul__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__imul__.double4", double4, byref(self), _other)
+2527 @func(inline='always')
+2528 def __mod__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__mod__.double4", double4, self, _other)
+2529 @func(inline='always')
+2530 def __rmod__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__rmod__.double4", double4, self, _other)
+2531 @func(inline='always')
+2532 def __imod__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__imod__.double4", double4, byref(self), _other)
+2533 @func(inline='always')
+2534 def __lt__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'bool4': return intrinsic("cmp.__lt__.double4", bool4, self, _other) # type: ignore
+2535 @func(inline='always')
+2536 def __le__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'bool4': return intrinsic("cmp.__le__.double4", bool4, self, _other) # type: ignore
+2537 @func(inline='always')
+2538 def __gt__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'bool4': return intrinsic("cmp.__gt__.double4", bool4, self, _other) # type: ignore
+2539 @func(inline='always')
+2540 def __ge__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'bool4': return intrinsic("cmp.__ge__.double4", bool4, self, _other) # type: ignore
+2541 @func(inline='always')
+2542 def __eq__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'bool4': return intrinsic("cmp.__eq__.double4", bool4, self, _other) # type: ignore
+2543 @func(inline='always')
+2544 def __ne__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'bool4': return intrinsic("cmp.__ne__.double4", bool4, self, _other) # type: ignore
+2545 @func(inline='always')
+2546 def __truediv__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__truediv__.double4", double4, self, _other)
+2547 @func(inline='always')
+2548 def __rtruediv__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__rtruediv__.double4", double4, self, _other)
+2549 @func(inline='always')
+2550 def __itruediv__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__itruediv__.double4", double4, byref(self), _other)
+2551 @func(inline='always')
+2552 def __pow__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__pow__.double4", double4, self, _other)
+2553 @func(inline='always')
+2554 def __rpow__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__rpow__.double4", double4, self, _other)
+2555 @func(inline='always')
+2556 def __ipow__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__ipow__.double4", double4, byref(self), _other)
+2557 @func(inline='always')
+2558 def __floordiv__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__floordiv__.double4", double4, self, _other)
+2559 @func(inline='always')
+2560 def __rfloordiv__(self, _other: tp.Union['double4', f64, FloatLiteral]) -> 'double4': return intrinsic("binop.__rfloordiv__.double4", double4, self, _other)
+
2508 def __init__(self, x: tp.Union['f64', FloatLiteral] = FloatLiteral(), y: tp.Union['f64', FloatLiteral] = FloatLiteral(), z: tp.Union['f64', FloatLiteral] = FloatLiteral(), w: tp.Union['f64', FloatLiteral] = FloatLiteral()) -> None: self = intrinsic("init.double4", double4, x, y, z, w)
+
2562@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[i8]), 4))
+2563class byte4:
+2564 x: i8
+2565 y: i8
+2566 z: i8
+2567 w: i8
+2568 def __init__(self, x: tp.Union['i8', IntLiteral] = IntLiteral(), y: tp.Union['i8', IntLiteral] = IntLiteral(), z: tp.Union['i8', IntLiteral] = IntLiteral(), w: tp.Union['i8', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.byte4", byte4, x, y, z, w)
+2569 @func(inline='always')
+2570 def __add__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__add__.byte4", byte4, self, _other)
+2571 @func(inline='always')
+2572 def __radd__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__radd__.byte4", byte4, self, _other)
+2573 @func(inline='always')
+2574 def __iadd__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__iadd__.byte4", byte4, byref(self), _other)
+2575 @func(inline='always')
+2576 def __sub__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__sub__.byte4", byte4, self, _other)
+2577 @func(inline='always')
+2578 def __rsub__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__rsub__.byte4", byte4, self, _other)
+2579 @func(inline='always')
+2580 def __isub__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__isub__.byte4", byte4, byref(self), _other)
+2581 @func(inline='always')
+2582 def __mul__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__mul__.byte4", byte4, self, _other)
+2583 @func(inline='always')
+2584 def __rmul__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__rmul__.byte4", byte4, self, _other)
+2585 @func(inline='always')
+2586 def __imul__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__imul__.byte4", byte4, byref(self), _other)
+2587 @func(inline='always')
+2588 def __mod__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__mod__.byte4", byte4, self, _other)
+2589 @func(inline='always')
+2590 def __rmod__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__rmod__.byte4", byte4, self, _other)
+2591 @func(inline='always')
+2592 def __imod__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__imod__.byte4", byte4, byref(self), _other)
+2593 @func(inline='always')
+2594 def __lt__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'bool4': return intrinsic("cmp.__lt__.byte4", bool4, self, _other) # type: ignore
+2595 @func(inline='always')
+2596 def __le__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'bool4': return intrinsic("cmp.__le__.byte4", bool4, self, _other) # type: ignore
+2597 @func(inline='always')
+2598 def __gt__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'bool4': return intrinsic("cmp.__gt__.byte4", bool4, self, _other) # type: ignore
+2599 @func(inline='always')
+2600 def __ge__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'bool4': return intrinsic("cmp.__ge__.byte4", bool4, self, _other) # type: ignore
+2601 @func(inline='always')
+2602 def __eq__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'bool4': return intrinsic("cmp.__eq__.byte4", bool4, self, _other) # type: ignore
+2603 @func(inline='always')
+2604 def __ne__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'bool4': return intrinsic("cmp.__ne__.byte4", bool4, self, _other) # type: ignore
+2605 @func(inline='always')
+2606 def __floordiv__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__floordiv__.byte4", byte4, self, _other)
+2607 @func(inline='always')
+2608 def __rfloordiv__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__rfloordiv__.byte4", byte4, self, _other)
+2609 @func(inline='always')
+2610 def __ifloordiv__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__ifloordiv__.byte4", byte4, byref(self), _other)
+2611 @func(inline='always')
+2612 def __lshift__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__lshift__.byte4", byte4, self, _other)
+2613 @func(inline='always')
+2614 def __rlshift__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__rlshift__.byte4", byte4, self, _other)
+2615 @func(inline='always')
+2616 def __ilshift__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__ilshift__.byte4", byte4, byref(self), _other)
+2617 @func(inline='always')
+2618 def __rshift__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__rshift__.byte4", byte4, self, _other)
+2619 @func(inline='always')
+2620 def __rrshift__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__rrshift__.byte4", byte4, self, _other)
+2621 @func(inline='always')
+2622 def __irshift__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__irshift__.byte4", byte4, byref(self), _other)
+2623 @func(inline='always')
+2624 def __and__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__and__.byte4", byte4, self, _other)
+2625 @func(inline='always')
+2626 def __rand__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__rand__.byte4", byte4, self, _other)
+2627 @func(inline='always')
+2628 def __iand__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__iand__.byte4", byte4, byref(self), _other)
+2629 @func(inline='always')
+2630 def __or__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__or__.byte4", byte4, self, _other)
+2631 @func(inline='always')
+2632 def __ror__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__ror__.byte4", byte4, self, _other)
+2633 @func(inline='always')
+2634 def __ior__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__ior__.byte4", byte4, byref(self), _other)
+2635 @func(inline='always')
+2636 def __xor__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__xor__.byte4", byte4, self, _other)
+2637 @func(inline='always')
+2638 def __rxor__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__rxor__.byte4", byte4, self, _other)
+2639 @func(inline='always')
+2640 def __ixor__(self, _other: tp.Union['byte4', i8, IntLiteral]) -> 'byte4': return intrinsic("binop.__ixor__.byte4", byte4, byref(self), _other)
+
2568 def __init__(self, x: tp.Union['i8', IntLiteral] = IntLiteral(), y: tp.Union['i8', IntLiteral] = IntLiteral(), z: tp.Union['i8', IntLiteral] = IntLiteral(), w: tp.Union['i8', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.byte4", byte4, x, y, z, w)
+
2642@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[u8]), 4))
+2643class ubyte4:
+2644 x: u8
+2645 y: u8
+2646 z: u8
+2647 w: u8
+2648 def __init__(self, x: tp.Union['u8', IntLiteral] = IntLiteral(), y: tp.Union['u8', IntLiteral] = IntLiteral(), z: tp.Union['u8', IntLiteral] = IntLiteral(), w: tp.Union['u8', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.ubyte4", ubyte4, x, y, z, w)
+2649 @func(inline='always')
+2650 def __add__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__add__.ubyte4", ubyte4, self, _other)
+2651 @func(inline='always')
+2652 def __radd__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__radd__.ubyte4", ubyte4, self, _other)
+2653 @func(inline='always')
+2654 def __iadd__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__iadd__.ubyte4", ubyte4, byref(self), _other)
+2655 @func(inline='always')
+2656 def __sub__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__sub__.ubyte4", ubyte4, self, _other)
+2657 @func(inline='always')
+2658 def __rsub__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__rsub__.ubyte4", ubyte4, self, _other)
+2659 @func(inline='always')
+2660 def __isub__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__isub__.ubyte4", ubyte4, byref(self), _other)
+2661 @func(inline='always')
+2662 def __mul__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__mul__.ubyte4", ubyte4, self, _other)
+2663 @func(inline='always')
+2664 def __rmul__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__rmul__.ubyte4", ubyte4, self, _other)
+2665 @func(inline='always')
+2666 def __imul__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__imul__.ubyte4", ubyte4, byref(self), _other)
+2667 @func(inline='always')
+2668 def __mod__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__mod__.ubyte4", ubyte4, self, _other)
+2669 @func(inline='always')
+2670 def __rmod__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__rmod__.ubyte4", ubyte4, self, _other)
+2671 @func(inline='always')
+2672 def __imod__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__imod__.ubyte4", ubyte4, byref(self), _other)
+2673 @func(inline='always')
+2674 def __lt__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'bool4': return intrinsic("cmp.__lt__.ubyte4", bool4, self, _other) # type: ignore
+2675 @func(inline='always')
+2676 def __le__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'bool4': return intrinsic("cmp.__le__.ubyte4", bool4, self, _other) # type: ignore
+2677 @func(inline='always')
+2678 def __gt__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'bool4': return intrinsic("cmp.__gt__.ubyte4", bool4, self, _other) # type: ignore
+2679 @func(inline='always')
+2680 def __ge__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'bool4': return intrinsic("cmp.__ge__.ubyte4", bool4, self, _other) # type: ignore
+2681 @func(inline='always')
+2682 def __eq__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'bool4': return intrinsic("cmp.__eq__.ubyte4", bool4, self, _other) # type: ignore
+2683 @func(inline='always')
+2684 def __ne__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'bool4': return intrinsic("cmp.__ne__.ubyte4", bool4, self, _other) # type: ignore
+2685 @func(inline='always')
+2686 def __floordiv__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__floordiv__.ubyte4", ubyte4, self, _other)
+2687 @func(inline='always')
+2688 def __rfloordiv__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__rfloordiv__.ubyte4", ubyte4, self, _other)
+2689 @func(inline='always')
+2690 def __ifloordiv__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__ifloordiv__.ubyte4", ubyte4, byref(self), _other)
+2691 @func(inline='always')
+2692 def __lshift__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__lshift__.ubyte4", ubyte4, self, _other)
+2693 @func(inline='always')
+2694 def __rlshift__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__rlshift__.ubyte4", ubyte4, self, _other)
+2695 @func(inline='always')
+2696 def __ilshift__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__ilshift__.ubyte4", ubyte4, byref(self), _other)
+2697 @func(inline='always')
+2698 def __rshift__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__rshift__.ubyte4", ubyte4, self, _other)
+2699 @func(inline='always')
+2700 def __rrshift__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__rrshift__.ubyte4", ubyte4, self, _other)
+2701 @func(inline='always')
+2702 def __irshift__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__irshift__.ubyte4", ubyte4, byref(self), _other)
+2703 @func(inline='always')
+2704 def __and__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__and__.ubyte4", ubyte4, self, _other)
+2705 @func(inline='always')
+2706 def __rand__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__rand__.ubyte4", ubyte4, self, _other)
+2707 @func(inline='always')
+2708 def __iand__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__iand__.ubyte4", ubyte4, byref(self), _other)
+2709 @func(inline='always')
+2710 def __or__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__or__.ubyte4", ubyte4, self, _other)
+2711 @func(inline='always')
+2712 def __ror__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__ror__.ubyte4", ubyte4, self, _other)
+2713 @func(inline='always')
+2714 def __ior__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__ior__.ubyte4", ubyte4, byref(self), _other)
+2715 @func(inline='always')
+2716 def __xor__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__xor__.ubyte4", ubyte4, self, _other)
+2717 @func(inline='always')
+2718 def __rxor__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__rxor__.ubyte4", ubyte4, self, _other)
+2719 @func(inline='always')
+2720 def __ixor__(self, _other: tp.Union['ubyte4', u8, IntLiteral]) -> 'ubyte4': return intrinsic("binop.__ixor__.ubyte4", ubyte4, byref(self), _other)
+
2648 def __init__(self, x: tp.Union['u8', IntLiteral] = IntLiteral(), y: tp.Union['u8', IntLiteral] = IntLiteral(), z: tp.Union['u8', IntLiteral] = IntLiteral(), w: tp.Union['u8', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.ubyte4", ubyte4, x, y, z, w)
+
2722@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[i16]), 4))
+2723class short4:
+2724 x: i16
+2725 y: i16
+2726 z: i16
+2727 w: i16
+2728 def __init__(self, x: tp.Union['i16', IntLiteral] = IntLiteral(), y: tp.Union['i16', IntLiteral] = IntLiteral(), z: tp.Union['i16', IntLiteral] = IntLiteral(), w: tp.Union['i16', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.short4", short4, x, y, z, w)
+2729 @func(inline='always')
+2730 def __add__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__add__.short4", short4, self, _other)
+2731 @func(inline='always')
+2732 def __radd__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__radd__.short4", short4, self, _other)
+2733 @func(inline='always')
+2734 def __iadd__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__iadd__.short4", short4, byref(self), _other)
+2735 @func(inline='always')
+2736 def __sub__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__sub__.short4", short4, self, _other)
+2737 @func(inline='always')
+2738 def __rsub__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__rsub__.short4", short4, self, _other)
+2739 @func(inline='always')
+2740 def __isub__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__isub__.short4", short4, byref(self), _other)
+2741 @func(inline='always')
+2742 def __mul__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__mul__.short4", short4, self, _other)
+2743 @func(inline='always')
+2744 def __rmul__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__rmul__.short4", short4, self, _other)
+2745 @func(inline='always')
+2746 def __imul__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__imul__.short4", short4, byref(self), _other)
+2747 @func(inline='always')
+2748 def __mod__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__mod__.short4", short4, self, _other)
+2749 @func(inline='always')
+2750 def __rmod__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__rmod__.short4", short4, self, _other)
+2751 @func(inline='always')
+2752 def __imod__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__imod__.short4", short4, byref(self), _other)
+2753 @func(inline='always')
+2754 def __lt__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'bool4': return intrinsic("cmp.__lt__.short4", bool4, self, _other) # type: ignore
+2755 @func(inline='always')
+2756 def __le__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'bool4': return intrinsic("cmp.__le__.short4", bool4, self, _other) # type: ignore
+2757 @func(inline='always')
+2758 def __gt__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'bool4': return intrinsic("cmp.__gt__.short4", bool4, self, _other) # type: ignore
+2759 @func(inline='always')
+2760 def __ge__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'bool4': return intrinsic("cmp.__ge__.short4", bool4, self, _other) # type: ignore
+2761 @func(inline='always')
+2762 def __eq__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'bool4': return intrinsic("cmp.__eq__.short4", bool4, self, _other) # type: ignore
+2763 @func(inline='always')
+2764 def __ne__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'bool4': return intrinsic("cmp.__ne__.short4", bool4, self, _other) # type: ignore
+2765 @func(inline='always')
+2766 def __floordiv__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__floordiv__.short4", short4, self, _other)
+2767 @func(inline='always')
+2768 def __rfloordiv__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__rfloordiv__.short4", short4, self, _other)
+2769 @func(inline='always')
+2770 def __ifloordiv__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__ifloordiv__.short4", short4, byref(self), _other)
+2771 @func(inline='always')
+2772 def __lshift__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__lshift__.short4", short4, self, _other)
+2773 @func(inline='always')
+2774 def __rlshift__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__rlshift__.short4", short4, self, _other)
+2775 @func(inline='always')
+2776 def __ilshift__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__ilshift__.short4", short4, byref(self), _other)
+2777 @func(inline='always')
+2778 def __rshift__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__rshift__.short4", short4, self, _other)
+2779 @func(inline='always')
+2780 def __rrshift__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__rrshift__.short4", short4, self, _other)
+2781 @func(inline='always')
+2782 def __irshift__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__irshift__.short4", short4, byref(self), _other)
+2783 @func(inline='always')
+2784 def __and__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__and__.short4", short4, self, _other)
+2785 @func(inline='always')
+2786 def __rand__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__rand__.short4", short4, self, _other)
+2787 @func(inline='always')
+2788 def __iand__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__iand__.short4", short4, byref(self), _other)
+2789 @func(inline='always')
+2790 def __or__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__or__.short4", short4, self, _other)
+2791 @func(inline='always')
+2792 def __ror__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__ror__.short4", short4, self, _other)
+2793 @func(inline='always')
+2794 def __ior__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__ior__.short4", short4, byref(self), _other)
+2795 @func(inline='always')
+2796 def __xor__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__xor__.short4", short4, self, _other)
+2797 @func(inline='always')
+2798 def __rxor__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__rxor__.short4", short4, self, _other)
+2799 @func(inline='always')
+2800 def __ixor__(self, _other: tp.Union['short4', i16, IntLiteral]) -> 'short4': return intrinsic("binop.__ixor__.short4", short4, byref(self), _other)
+
2728 def __init__(self, x: tp.Union['i16', IntLiteral] = IntLiteral(), y: tp.Union['i16', IntLiteral] = IntLiteral(), z: tp.Union['i16', IntLiteral] = IntLiteral(), w: tp.Union['i16', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.short4", short4, x, y, z, w)
+
2802@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[u16]), 4))
+2803class ushort4:
+2804 x: u16
+2805 y: u16
+2806 z: u16
+2807 w: u16
+2808 def __init__(self, x: tp.Union['u16', IntLiteral] = IntLiteral(), y: tp.Union['u16', IntLiteral] = IntLiteral(), z: tp.Union['u16', IntLiteral] = IntLiteral(), w: tp.Union['u16', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.ushort4", ushort4, x, y, z, w)
+2809 @func(inline='always')
+2810 def __add__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__add__.ushort4", ushort4, self, _other)
+2811 @func(inline='always')
+2812 def __radd__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__radd__.ushort4", ushort4, self, _other)
+2813 @func(inline='always')
+2814 def __iadd__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__iadd__.ushort4", ushort4, byref(self), _other)
+2815 @func(inline='always')
+2816 def __sub__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__sub__.ushort4", ushort4, self, _other)
+2817 @func(inline='always')
+2818 def __rsub__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__rsub__.ushort4", ushort4, self, _other)
+2819 @func(inline='always')
+2820 def __isub__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__isub__.ushort4", ushort4, byref(self), _other)
+2821 @func(inline='always')
+2822 def __mul__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__mul__.ushort4", ushort4, self, _other)
+2823 @func(inline='always')
+2824 def __rmul__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__rmul__.ushort4", ushort4, self, _other)
+2825 @func(inline='always')
+2826 def __imul__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__imul__.ushort4", ushort4, byref(self), _other)
+2827 @func(inline='always')
+2828 def __mod__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__mod__.ushort4", ushort4, self, _other)
+2829 @func(inline='always')
+2830 def __rmod__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__rmod__.ushort4", ushort4, self, _other)
+2831 @func(inline='always')
+2832 def __imod__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__imod__.ushort4", ushort4, byref(self), _other)
+2833 @func(inline='always')
+2834 def __lt__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'bool4': return intrinsic("cmp.__lt__.ushort4", bool4, self, _other) # type: ignore
+2835 @func(inline='always')
+2836 def __le__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'bool4': return intrinsic("cmp.__le__.ushort4", bool4, self, _other) # type: ignore
+2837 @func(inline='always')
+2838 def __gt__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'bool4': return intrinsic("cmp.__gt__.ushort4", bool4, self, _other) # type: ignore
+2839 @func(inline='always')
+2840 def __ge__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'bool4': return intrinsic("cmp.__ge__.ushort4", bool4, self, _other) # type: ignore
+2841 @func(inline='always')
+2842 def __eq__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'bool4': return intrinsic("cmp.__eq__.ushort4", bool4, self, _other) # type: ignore
+2843 @func(inline='always')
+2844 def __ne__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'bool4': return intrinsic("cmp.__ne__.ushort4", bool4, self, _other) # type: ignore
+2845 @func(inline='always')
+2846 def __floordiv__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__floordiv__.ushort4", ushort4, self, _other)
+2847 @func(inline='always')
+2848 def __rfloordiv__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__rfloordiv__.ushort4", ushort4, self, _other)
+2849 @func(inline='always')
+2850 def __ifloordiv__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__ifloordiv__.ushort4", ushort4, byref(self), _other)
+2851 @func(inline='always')
+2852 def __lshift__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__lshift__.ushort4", ushort4, self, _other)
+2853 @func(inline='always')
+2854 def __rlshift__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__rlshift__.ushort4", ushort4, self, _other)
+2855 @func(inline='always')
+2856 def __ilshift__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__ilshift__.ushort4", ushort4, byref(self), _other)
+2857 @func(inline='always')
+2858 def __rshift__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__rshift__.ushort4", ushort4, self, _other)
+2859 @func(inline='always')
+2860 def __rrshift__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__rrshift__.ushort4", ushort4, self, _other)
+2861 @func(inline='always')
+2862 def __irshift__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__irshift__.ushort4", ushort4, byref(self), _other)
+2863 @func(inline='always')
+2864 def __and__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__and__.ushort4", ushort4, self, _other)
+2865 @func(inline='always')
+2866 def __rand__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__rand__.ushort4", ushort4, self, _other)
+2867 @func(inline='always')
+2868 def __iand__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__iand__.ushort4", ushort4, byref(self), _other)
+2869 @func(inline='always')
+2870 def __or__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__or__.ushort4", ushort4, self, _other)
+2871 @func(inline='always')
+2872 def __ror__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__ror__.ushort4", ushort4, self, _other)
+2873 @func(inline='always')
+2874 def __ior__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__ior__.ushort4", ushort4, byref(self), _other)
+2875 @func(inline='always')
+2876 def __xor__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__xor__.ushort4", ushort4, self, _other)
+2877 @func(inline='always')
+2878 def __rxor__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__rxor__.ushort4", ushort4, self, _other)
+2879 @func(inline='always')
+2880 def __ixor__(self, _other: tp.Union['ushort4', u16, IntLiteral]) -> 'ushort4': return intrinsic("binop.__ixor__.ushort4", ushort4, byref(self), _other)
+
2808 def __init__(self, x: tp.Union['u16', IntLiteral] = IntLiteral(), y: tp.Union['u16', IntLiteral] = IntLiteral(), z: tp.Union['u16', IntLiteral] = IntLiteral(), w: tp.Union['u16', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.ushort4", ushort4, x, y, z, w)
+
2882@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[i32]), 4))
+2883class int4:
+2884 x: i32
+2885 y: i32
+2886 z: i32
+2887 w: i32
+2888 def __init__(self, x: tp.Union['i32', IntLiteral] = IntLiteral(), y: tp.Union['i32', IntLiteral] = IntLiteral(), z: tp.Union['i32', IntLiteral] = IntLiteral(), w: tp.Union['i32', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.int4", int4, x, y, z, w)
+2889 @func(inline='always')
+2890 def __add__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__add__.int4", int4, self, _other)
+2891 @func(inline='always')
+2892 def __radd__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__radd__.int4", int4, self, _other)
+2893 @func(inline='always')
+2894 def __iadd__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__iadd__.int4", int4, byref(self), _other)
+2895 @func(inline='always')
+2896 def __sub__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__sub__.int4", int4, self, _other)
+2897 @func(inline='always')
+2898 def __rsub__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__rsub__.int4", int4, self, _other)
+2899 @func(inline='always')
+2900 def __isub__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__isub__.int4", int4, byref(self), _other)
+2901 @func(inline='always')
+2902 def __mul__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__mul__.int4", int4, self, _other)
+2903 @func(inline='always')
+2904 def __rmul__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__rmul__.int4", int4, self, _other)
+2905 @func(inline='always')
+2906 def __imul__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__imul__.int4", int4, byref(self), _other)
+2907 @func(inline='always')
+2908 def __mod__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__mod__.int4", int4, self, _other)
+2909 @func(inline='always')
+2910 def __rmod__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__rmod__.int4", int4, self, _other)
+2911 @func(inline='always')
+2912 def __imod__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__imod__.int4", int4, byref(self), _other)
+2913 @func(inline='always')
+2914 def __lt__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'bool4': return intrinsic("cmp.__lt__.int4", bool4, self, _other) # type: ignore
+2915 @func(inline='always')
+2916 def __le__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'bool4': return intrinsic("cmp.__le__.int4", bool4, self, _other) # type: ignore
+2917 @func(inline='always')
+2918 def __gt__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'bool4': return intrinsic("cmp.__gt__.int4", bool4, self, _other) # type: ignore
+2919 @func(inline='always')
+2920 def __ge__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'bool4': return intrinsic("cmp.__ge__.int4", bool4, self, _other) # type: ignore
+2921 @func(inline='always')
+2922 def __eq__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'bool4': return intrinsic("cmp.__eq__.int4", bool4, self, _other) # type: ignore
+2923 @func(inline='always')
+2924 def __ne__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'bool4': return intrinsic("cmp.__ne__.int4", bool4, self, _other) # type: ignore
+2925 @func(inline='always')
+2926 def __floordiv__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__floordiv__.int4", int4, self, _other)
+2927 @func(inline='always')
+2928 def __rfloordiv__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__rfloordiv__.int4", int4, self, _other)
+2929 @func(inline='always')
+2930 def __ifloordiv__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__ifloordiv__.int4", int4, byref(self), _other)
+2931 @func(inline='always')
+2932 def __lshift__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__lshift__.int4", int4, self, _other)
+2933 @func(inline='always')
+2934 def __rlshift__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__rlshift__.int4", int4, self, _other)
+2935 @func(inline='always')
+2936 def __ilshift__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__ilshift__.int4", int4, byref(self), _other)
+2937 @func(inline='always')
+2938 def __rshift__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__rshift__.int4", int4, self, _other)
+2939 @func(inline='always')
+2940 def __rrshift__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__rrshift__.int4", int4, self, _other)
+2941 @func(inline='always')
+2942 def __irshift__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__irshift__.int4", int4, byref(self), _other)
+2943 @func(inline='always')
+2944 def __and__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__and__.int4", int4, self, _other)
+2945 @func(inline='always')
+2946 def __rand__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__rand__.int4", int4, self, _other)
+2947 @func(inline='always')
+2948 def __iand__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__iand__.int4", int4, byref(self), _other)
+2949 @func(inline='always')
+2950 def __or__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__or__.int4", int4, self, _other)
+2951 @func(inline='always')
+2952 def __ror__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__ror__.int4", int4, self, _other)
+2953 @func(inline='always')
+2954 def __ior__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__ior__.int4", int4, byref(self), _other)
+2955 @func(inline='always')
+2956 def __xor__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__xor__.int4", int4, self, _other)
+2957 @func(inline='always')
+2958 def __rxor__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__rxor__.int4", int4, self, _other)
+2959 @func(inline='always')
+2960 def __ixor__(self, _other: tp.Union['int4', i32, IntLiteral]) -> 'int4': return intrinsic("binop.__ixor__.int4", int4, byref(self), _other)
+
2888 def __init__(self, x: tp.Union['i32', IntLiteral] = IntLiteral(), y: tp.Union['i32', IntLiteral] = IntLiteral(), z: tp.Union['i32', IntLiteral] = IntLiteral(), w: tp.Union['i32', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.int4", int4, x, y, z, w)
+
2962@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[u32]), 4))
+2963class uint4:
+2964 x: u32
+2965 y: u32
+2966 z: u32
+2967 w: u32
+2968 def __init__(self, x: tp.Union['u32', IntLiteral] = IntLiteral(), y: tp.Union['u32', IntLiteral] = IntLiteral(), z: tp.Union['u32', IntLiteral] = IntLiteral(), w: tp.Union['u32', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.uint4", uint4, x, y, z, w)
+2969 @func(inline='always')
+2970 def __add__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__add__.uint4", uint4, self, _other)
+2971 @func(inline='always')
+2972 def __radd__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__radd__.uint4", uint4, self, _other)
+2973 @func(inline='always')
+2974 def __iadd__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__iadd__.uint4", uint4, byref(self), _other)
+2975 @func(inline='always')
+2976 def __sub__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__sub__.uint4", uint4, self, _other)
+2977 @func(inline='always')
+2978 def __rsub__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__rsub__.uint4", uint4, self, _other)
+2979 @func(inline='always')
+2980 def __isub__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__isub__.uint4", uint4, byref(self), _other)
+2981 @func(inline='always')
+2982 def __mul__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__mul__.uint4", uint4, self, _other)
+2983 @func(inline='always')
+2984 def __rmul__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__rmul__.uint4", uint4, self, _other)
+2985 @func(inline='always')
+2986 def __imul__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__imul__.uint4", uint4, byref(self), _other)
+2987 @func(inline='always')
+2988 def __mod__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__mod__.uint4", uint4, self, _other)
+2989 @func(inline='always')
+2990 def __rmod__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__rmod__.uint4", uint4, self, _other)
+2991 @func(inline='always')
+2992 def __imod__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__imod__.uint4", uint4, byref(self), _other)
+2993 @func(inline='always')
+2994 def __lt__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'bool4': return intrinsic("cmp.__lt__.uint4", bool4, self, _other) # type: ignore
+2995 @func(inline='always')
+2996 def __le__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'bool4': return intrinsic("cmp.__le__.uint4", bool4, self, _other) # type: ignore
+2997 @func(inline='always')
+2998 def __gt__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'bool4': return intrinsic("cmp.__gt__.uint4", bool4, self, _other) # type: ignore
+2999 @func(inline='always')
+3000 def __ge__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'bool4': return intrinsic("cmp.__ge__.uint4", bool4, self, _other) # type: ignore
+3001 @func(inline='always')
+3002 def __eq__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'bool4': return intrinsic("cmp.__eq__.uint4", bool4, self, _other) # type: ignore
+3003 @func(inline='always')
+3004 def __ne__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'bool4': return intrinsic("cmp.__ne__.uint4", bool4, self, _other) # type: ignore
+3005 @func(inline='always')
+3006 def __floordiv__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__floordiv__.uint4", uint4, self, _other)
+3007 @func(inline='always')
+3008 def __rfloordiv__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__rfloordiv__.uint4", uint4, self, _other)
+3009 @func(inline='always')
+3010 def __ifloordiv__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__ifloordiv__.uint4", uint4, byref(self), _other)
+3011 @func(inline='always')
+3012 def __lshift__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__lshift__.uint4", uint4, self, _other)
+3013 @func(inline='always')
+3014 def __rlshift__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__rlshift__.uint4", uint4, self, _other)
+3015 @func(inline='always')
+3016 def __ilshift__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__ilshift__.uint4", uint4, byref(self), _other)
+3017 @func(inline='always')
+3018 def __rshift__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__rshift__.uint4", uint4, self, _other)
+3019 @func(inline='always')
+3020 def __rrshift__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__rrshift__.uint4", uint4, self, _other)
+3021 @func(inline='always')
+3022 def __irshift__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__irshift__.uint4", uint4, byref(self), _other)
+3023 @func(inline='always')
+3024 def __and__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__and__.uint4", uint4, self, _other)
+3025 @func(inline='always')
+3026 def __rand__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__rand__.uint4", uint4, self, _other)
+3027 @func(inline='always')
+3028 def __iand__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__iand__.uint4", uint4, byref(self), _other)
+3029 @func(inline='always')
+3030 def __or__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__or__.uint4", uint4, self, _other)
+3031 @func(inline='always')
+3032 def __ror__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__ror__.uint4", uint4, self, _other)
+3033 @func(inline='always')
+3034 def __ior__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__ior__.uint4", uint4, byref(self), _other)
+3035 @func(inline='always')
+3036 def __xor__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__xor__.uint4", uint4, self, _other)
+3037 @func(inline='always')
+3038 def __rxor__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__rxor__.uint4", uint4, self, _other)
+3039 @func(inline='always')
+3040 def __ixor__(self, _other: tp.Union['uint4', u32, IntLiteral]) -> 'uint4': return intrinsic("binop.__ixor__.uint4", uint4, byref(self), _other)
+
2968 def __init__(self, x: tp.Union['u32', IntLiteral] = IntLiteral(), y: tp.Union['u32', IntLiteral] = IntLiteral(), z: tp.Union['u32', IntLiteral] = IntLiteral(), w: tp.Union['u32', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.uint4", uint4, x, y, z, w)
+
3042@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[i64]), 4))
+3043class long4:
+3044 x: i64
+3045 y: i64
+3046 z: i64
+3047 w: i64
+3048 def __init__(self, x: tp.Union['i64', IntLiteral] = IntLiteral(), y: tp.Union['i64', IntLiteral] = IntLiteral(), z: tp.Union['i64', IntLiteral] = IntLiteral(), w: tp.Union['i64', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.long4", long4, x, y, z, w)
+3049 @func(inline='always')
+3050 def __add__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__add__.long4", long4, self, _other)
+3051 @func(inline='always')
+3052 def __radd__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__radd__.long4", long4, self, _other)
+3053 @func(inline='always')
+3054 def __iadd__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__iadd__.long4", long4, byref(self), _other)
+3055 @func(inline='always')
+3056 def __sub__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__sub__.long4", long4, self, _other)
+3057 @func(inline='always')
+3058 def __rsub__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__rsub__.long4", long4, self, _other)
+3059 @func(inline='always')
+3060 def __isub__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__isub__.long4", long4, byref(self), _other)
+3061 @func(inline='always')
+3062 def __mul__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__mul__.long4", long4, self, _other)
+3063 @func(inline='always')
+3064 def __rmul__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__rmul__.long4", long4, self, _other)
+3065 @func(inline='always')
+3066 def __imul__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__imul__.long4", long4, byref(self), _other)
+3067 @func(inline='always')
+3068 def __mod__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__mod__.long4", long4, self, _other)
+3069 @func(inline='always')
+3070 def __rmod__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__rmod__.long4", long4, self, _other)
+3071 @func(inline='always')
+3072 def __imod__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__imod__.long4", long4, byref(self), _other)
+3073 @func(inline='always')
+3074 def __lt__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'bool4': return intrinsic("cmp.__lt__.long4", bool4, self, _other) # type: ignore
+3075 @func(inline='always')
+3076 def __le__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'bool4': return intrinsic("cmp.__le__.long4", bool4, self, _other) # type: ignore
+3077 @func(inline='always')
+3078 def __gt__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'bool4': return intrinsic("cmp.__gt__.long4", bool4, self, _other) # type: ignore
+3079 @func(inline='always')
+3080 def __ge__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'bool4': return intrinsic("cmp.__ge__.long4", bool4, self, _other) # type: ignore
+3081 @func(inline='always')
+3082 def __eq__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'bool4': return intrinsic("cmp.__eq__.long4", bool4, self, _other) # type: ignore
+3083 @func(inline='always')
+3084 def __ne__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'bool4': return intrinsic("cmp.__ne__.long4", bool4, self, _other) # type: ignore
+3085 @func(inline='always')
+3086 def __floordiv__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__floordiv__.long4", long4, self, _other)
+3087 @func(inline='always')
+3088 def __rfloordiv__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__rfloordiv__.long4", long4, self, _other)
+3089 @func(inline='always')
+3090 def __ifloordiv__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__ifloordiv__.long4", long4, byref(self), _other)
+3091 @func(inline='always')
+3092 def __lshift__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__lshift__.long4", long4, self, _other)
+3093 @func(inline='always')
+3094 def __rlshift__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__rlshift__.long4", long4, self, _other)
+3095 @func(inline='always')
+3096 def __ilshift__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__ilshift__.long4", long4, byref(self), _other)
+3097 @func(inline='always')
+3098 def __rshift__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__rshift__.long4", long4, self, _other)
+3099 @func(inline='always')
+3100 def __rrshift__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__rrshift__.long4", long4, self, _other)
+3101 @func(inline='always')
+3102 def __irshift__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__irshift__.long4", long4, byref(self), _other)
+3103 @func(inline='always')
+3104 def __and__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__and__.long4", long4, self, _other)
+3105 @func(inline='always')
+3106 def __rand__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__rand__.long4", long4, self, _other)
+3107 @func(inline='always')
+3108 def __iand__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__iand__.long4", long4, byref(self), _other)
+3109 @func(inline='always')
+3110 def __or__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__or__.long4", long4, self, _other)
+3111 @func(inline='always')
+3112 def __ror__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__ror__.long4", long4, self, _other)
+3113 @func(inline='always')
+3114 def __ior__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__ior__.long4", long4, byref(self), _other)
+3115 @func(inline='always')
+3116 def __xor__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__xor__.long4", long4, self, _other)
+3117 @func(inline='always')
+3118 def __rxor__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__rxor__.long4", long4, self, _other)
+3119 @func(inline='always')
+3120 def __ixor__(self, _other: tp.Union['long4', i64, IntLiteral]) -> 'long4': return intrinsic("binop.__ixor__.long4", long4, byref(self), _other)
+
3048 def __init__(self, x: tp.Union['i64', IntLiteral] = IntLiteral(), y: tp.Union['i64', IntLiteral] = IntLiteral(), z: tp.Union['i64', IntLiteral] = IntLiteral(), w: tp.Union['i64', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.long4", long4, x, y, z, w)
+
3122@builtin_type(_hir.VectorType(tp.cast(_hir.ScalarType, _ctx.types[u64]), 4))
+3123class ulong4:
+3124 x: u64
+3125 y: u64
+3126 z: u64
+3127 w: u64
+3128 def __init__(self, x: tp.Union['u64', IntLiteral] = IntLiteral(), y: tp.Union['u64', IntLiteral] = IntLiteral(), z: tp.Union['u64', IntLiteral] = IntLiteral(), w: tp.Union['u64', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.ulong4", ulong4, x, y, z, w)
+3129 @func(inline='always')
+3130 def __add__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__add__.ulong4", ulong4, self, _other)
+3131 @func(inline='always')
+3132 def __radd__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__radd__.ulong4", ulong4, self, _other)
+3133 @func(inline='always')
+3134 def __iadd__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__iadd__.ulong4", ulong4, byref(self), _other)
+3135 @func(inline='always')
+3136 def __sub__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__sub__.ulong4", ulong4, self, _other)
+3137 @func(inline='always')
+3138 def __rsub__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__rsub__.ulong4", ulong4, self, _other)
+3139 @func(inline='always')
+3140 def __isub__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__isub__.ulong4", ulong4, byref(self), _other)
+3141 @func(inline='always')
+3142 def __mul__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__mul__.ulong4", ulong4, self, _other)
+3143 @func(inline='always')
+3144 def __rmul__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__rmul__.ulong4", ulong4, self, _other)
+3145 @func(inline='always')
+3146 def __imul__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__imul__.ulong4", ulong4, byref(self), _other)
+3147 @func(inline='always')
+3148 def __mod__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__mod__.ulong4", ulong4, self, _other)
+3149 @func(inline='always')
+3150 def __rmod__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__rmod__.ulong4", ulong4, self, _other)
+3151 @func(inline='always')
+3152 def __imod__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__imod__.ulong4", ulong4, byref(self), _other)
+3153 @func(inline='always')
+3154 def __lt__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'bool4': return intrinsic("cmp.__lt__.ulong4", bool4, self, _other) # type: ignore
+3155 @func(inline='always')
+3156 def __le__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'bool4': return intrinsic("cmp.__le__.ulong4", bool4, self, _other) # type: ignore
+3157 @func(inline='always')
+3158 def __gt__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'bool4': return intrinsic("cmp.__gt__.ulong4", bool4, self, _other) # type: ignore
+3159 @func(inline='always')
+3160 def __ge__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'bool4': return intrinsic("cmp.__ge__.ulong4", bool4, self, _other) # type: ignore
+3161 @func(inline='always')
+3162 def __eq__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'bool4': return intrinsic("cmp.__eq__.ulong4", bool4, self, _other) # type: ignore
+3163 @func(inline='always')
+3164 def __ne__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'bool4': return intrinsic("cmp.__ne__.ulong4", bool4, self, _other) # type: ignore
+3165 @func(inline='always')
+3166 def __floordiv__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__floordiv__.ulong4", ulong4, self, _other)
+3167 @func(inline='always')
+3168 def __rfloordiv__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__rfloordiv__.ulong4", ulong4, self, _other)
+3169 @func(inline='always')
+3170 def __ifloordiv__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__ifloordiv__.ulong4", ulong4, byref(self), _other)
+3171 @func(inline='always')
+3172 def __lshift__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__lshift__.ulong4", ulong4, self, _other)
+3173 @func(inline='always')
+3174 def __rlshift__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__rlshift__.ulong4", ulong4, self, _other)
+3175 @func(inline='always')
+3176 def __ilshift__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__ilshift__.ulong4", ulong4, byref(self), _other)
+3177 @func(inline='always')
+3178 def __rshift__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__rshift__.ulong4", ulong4, self, _other)
+3179 @func(inline='always')
+3180 def __rrshift__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__rrshift__.ulong4", ulong4, self, _other)
+3181 @func(inline='always')
+3182 def __irshift__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__irshift__.ulong4", ulong4, byref(self), _other)
+3183 @func(inline='always')
+3184 def __and__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__and__.ulong4", ulong4, self, _other)
+3185 @func(inline='always')
+3186 def __rand__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__rand__.ulong4", ulong4, self, _other)
+3187 @func(inline='always')
+3188 def __iand__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__iand__.ulong4", ulong4, byref(self), _other)
+3189 @func(inline='always')
+3190 def __or__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__or__.ulong4", ulong4, self, _other)
+3191 @func(inline='always')
+3192 def __ror__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__ror__.ulong4", ulong4, self, _other)
+3193 @func(inline='always')
+3194 def __ior__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__ior__.ulong4", ulong4, byref(self), _other)
+3195 @func(inline='always')
+3196 def __xor__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__xor__.ulong4", ulong4, self, _other)
+3197 @func(inline='always')
+3198 def __rxor__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__rxor__.ulong4", ulong4, self, _other)
+3199 @func(inline='always')
+3200 def __ixor__(self, _other: tp.Union['ulong4', u64, IntLiteral]) -> 'ulong4': return intrinsic("binop.__ixor__.ulong4", ulong4, byref(self), _other)
+
3128 def __init__(self, x: tp.Union['u64', IntLiteral] = IntLiteral(), y: tp.Union['u64', IntLiteral] = IntLiteral(), z: tp.Union['u64', IntLiteral] = IntLiteral(), w: tp.Union['u64', IntLiteral] = IntLiteral()) -> None: self = intrinsic("init.ulong4", ulong4, x, y, z, w)
+
+luisa_lang
+
+
+
+
+
+
+ 1import ast
+ 2import os
+ 3from types import FunctionType, ModuleType
+ 4from typing import Any, Callable, Dict, List, Literal, Optional, Tuple, Union, overload
+ 5import typing
+ 6import luisa_lang
+ 7import luisa_lang.math_types
+ 8from luisa_lang.utils import get_typevar_constrains_and_bounds, unwrap
+ 9import luisa_lang.hir as hir
+ 10import sys
+ 11from copy import copy
+ 12from luisa_lang.utils import retrieve_ast_and_filename
+ 13from luisa_lang.hir import (
+ 14 Type,
+ 15 BoundType,
+ 16 ParametricType,
+ 17 Function,
+ 18 Var,
+ 19 get_dsl_func
+ 20)
+ 21from typing import NoReturn, cast, Set, reveal_type
+ 22from enum import Enum
+ 23import inspect
+ 24from luisa_lang.hir import get_dsl_type, ComptimeValue
+ 25import luisa_lang.classinfo as classinfo
+ 26
+ 27
+ 28def _implicit_typevar_name(v: str) -> str:
+ 29 return f"T#{v}"
+ 30
+ 31
+ 32def is_valid_comptime_value_in_dsl_code(value: Any) -> bool:
+ 33 if isinstance(value, (int, float, bool)):
+ 34 return True
+ 35 if isinstance(value, ModuleType):
+ 36 return True
+ 37 if get_dsl_type(type(value)) is not None:
+ 38 return True
+ 39 return False
+ 40
+ 41
+ 42ParsingMode = Literal['parse', 'instantiate']
+ 43
+ 44
+ 45def _make_type_parameteric_type() -> hir.ParametricType:
+ 46 t = hir.GenericParameter('T', '__builtins__.type')
+ 47 st = hir.SymbolicType(t)
+ 48
+ 49 def mono_func(args: List[hir.Type]) -> hir.Type:
+ 50 assert len(args) == 1
+ 51 return hir.TypeConstructorType(args[0])
+ 52 type_type = hir.ParametricType([t], hir.TypeConstructorType(st), mono_func)
+ 53 return type_type
+ 54
+ 55
+ 56TYPE_PARAMETERIC_TYPE: hir.ParametricType = _make_type_parameteric_type()
+ 57
+ 58
+ 59class TypeParser:
+ 60 ctx_name: str
+ 61 globalns: Dict[str, Any]
+ 62 self_type: Optional[Type]
+ 63 type_var_ns: Dict[typing.TypeVar, hir.Type]
+ 64 generic_params: List[hir.GenericParameter]
+ 65 generic_param_to_type_var: Dict[hir.GenericParameter, typing.TypeVar]
+ 66 implicit_type_params: Dict[str, hir.Type]
+ 67 mode: ParsingMode
+ 68
+ 69 def __init__(self, ctx_name: str, globalns: Dict[str, Any], type_var_ns: Dict[typing.TypeVar, hir.Type], self_type: Optional[Type], mode: ParsingMode) -> None:
+ 70 self.globalns = globalns
+ 71 self.self_type = self_type
+ 72 self.type_var_ns = type_var_ns
+ 73 self.ctx_name = ctx_name
+ 74 self.generic_params = []
+ 75 self.generic_param_to_type_var = {}
+ 76 self.mode = mode
+ 77
+ 78 def parse_type(self, ty: classinfo.VarType) -> Optional[hir.Type]:
+ 79 ty_or_bound = self.parse_type_ext(ty)
+ 80 if ty_or_bound is None:
+ 81 return None
+ 82 if isinstance(ty_or_bound, hir.TypeBound):
+ 83 raise RuntimeError("Expected a specific type but got generic type")
+ 84 return ty_or_bound
+ 85
+ 86 def parse_type_ext(self, ty: classinfo.VarType) -> Optional[Union[hir.Type, hir.TypeBound]]:
+ 87 match ty:
+ 88 case classinfo.GenericInstance():
+ 89 origin = ty.origin
+ 90 if origin is type:
+ 91 def handle_type_t():
+ 92 assert len(
+ 93 ty.args) == 1, "type[T] expects exactly one type argument"
+ 94 arg = self.parse_type(ty.args[0])
+ 95 assert arg is not None
+ 96 if self.mode == 'instantiate':
+ 97 return TYPE_PARAMETERIC_TYPE.instantiate([arg])
+ 98 return hir.BoundType(TYPE_PARAMETERIC_TYPE, [arg], None)
+ 99 return handle_type_t()
+ 100 ir_ty = self.parse_type(origin)
+ 101 if not ir_ty:
+ 102 raise RuntimeError(
+ 103 f"Type {origin} is not a valid DSL type")
+ 104 if not isinstance(ir_ty, hir.ParametricType):
+ 105 raise RuntimeError(
+ 106 f"Type {origin} is not a parametric type but is supplied with type arguments")
+ 107 if len(ir_ty.params) != len(ty.args):
+ 108 raise RuntimeError(
+ 109 f"Type {origin} expects {len(ir_ty.params)} type arguments, got {len(ty.args)}")
+ 110 type_args = [self.parse_type(arg) for arg in ty.args]
+ 111 if any(arg is None for arg in type_args):
+ 112 raise RuntimeError(
+ 113 "failed to parse type arguments")
+ 114 if self.mode == 'instantiate':
+ 115 instantiated = ir_ty.instantiate(type_args)
+ 116 else:
+ 117 instantiated = None
+ 118 return hir.BoundType(ir_ty, cast(List[hir.Type | hir.SymbolicConstant], type_args), instantiated)
+ 119 case classinfo.TypeVar():
+ 120 # print(f'{ty} @ {id(ty)} {ty.__name__} in {self.type_var_ns}? : {ty in self.type_var_ns}')
+ 121 if ty in self.type_var_ns:
+ 122 v = self.type_var_ns[ty]
+ 123 return v
+ 124 p = hir.GenericParameter(ty.__name__, self.ctx_name)
+ 125 pt = hir.SymbolicType(p)
+ 126 self.type_var_ns[ty] = pt
+ 127 self.generic_params.append(p)
+ 128 self.generic_param_to_type_var[p] = ty
+ 129 return pt
+ 130 case classinfo.UnionType():
+ 131 # raise RuntimeError("UnionType is not supported")
+ 132 variants = [self.parse_type(v) for v in ty.types]
+ 133 if any(v is None for v in variants):
+ 134 raise RuntimeError("failed to parse union type variants")
+ 135 return hir.UnionBound([hir.SubtypeBound(cast(hir.Type, v), True) for v in variants])
+ 136 case classinfo.SelfType():
+ 137 assert self.self_type is not None
+ 138 return self.self_type
+ 139 case classinfo.AnyType():
+ 140 return hir.AnyBound()
+ 141 case type():
+ 142 if ty is type:
+ 143 raise RuntimeError(
+ 144 f"type alone cannot be used as a dsl type hint. use type[T] instead")
+ 145 dsl_type = get_dsl_type(ty)
+ 146 assert dsl_type is not None, f"Type {ty} is not a valid DSL type"
+ 147 return dsl_type
+ 148 case classinfo.LiteralType():
+ 149 return hir.LiteralType(ty.value)
+ 150 case _:
+ 151 raise RuntimeError(f"Unsupported type {ty}")
+ 152
+ 153
+ 154def convert_func_signature(signature: classinfo.MethodType,
+ 155 ctx_name: str,
+ 156 props:hir.FuncProperties,
+ 157 globalns: Dict[str, Any],
+ 158 type_var_ns: Dict[typing.TypeVar, hir.Type],
+ 159 implicit_type_params: Dict[str, hir.Type],
+ 160 self_type: Optional[Type],
+ 161 mode: ParsingMode = 'parse'
+ 162 ) -> Tuple[hir.FunctionSignature, TypeParser]:
+ 163 """
+ 164 implicit_type_params: Tuple[List[Tuple[str,
+ 165 classinfo.VarType]], classinfo.VarType]
+ 166 """
+ 167 type_parser = TypeParser(ctx_name, globalns, type_var_ns, self_type, mode)
+ 168 type_parser.implicit_type_params = implicit_type_params
+ 169 params: List[Var] = []
+ 170 for arg in signature.args:
+ 171 param_type = type_parser.parse_type_ext(arg[1])
+ 172 semantic = hir.ParameterSemantic.BYVAL
+ 173 if arg[0] == "self":
+ 174 assert self_type is not None
+ 175 param_type = self_type
+ 176 semantic = hir.ParameterSemantic.BYREF
+ 177 if arg[0] in props.byref:
+ 178 semantic = hir.ParameterSemantic.BYREF
+ 179 if param_type is None:
+ 180 raise RuntimeError(
+ 181 f"Unable to parse type of parameter {arg[0]}: {arg[1]}")
+ 182 if isinstance(param_type, hir.Type):
+ 183 params.append(
+ 184 Var(arg[0], param_type, span=None, semantic=semantic))
+ 185 else:
+ 186 if mode == 'parse':
+ 187 gp = hir.GenericParameter(
+ 188 _implicit_typevar_name(arg[0]), ctx_name, bound=param_type)
+ 189 implicit_type_params[arg[0]] = hir.SymbolicType(gp)
+ 190 type_parser.generic_params.append(gp)
+ 191 else:
+ 192 assert not isinstance(
+ 193 implicit_type_params[arg[0]], hir.SymbolicType)
+ 194 params.append(
+ 195 Var(arg[0], implicit_type_params[arg[0]], span=None, semantic=semantic))
+ 196 return_type = type_parser.parse_type_ext(signature.return_type)
+ 197 assert return_type is not None, f"failed to parse return type {signature.return_type}"
+ 198 if isinstance(return_type, hir.AnyBound):
+ 199 return_type = None
+ 200 elif isinstance(return_type, hir.TypeBound):
+ 201 raise NotImplementedError()
+ 202
+ 203 return hir.FunctionSignature(type_parser.generic_params, params, return_type), type_parser
+ 204
+ 205
+ 206SPECIAL_FUNCTIONS_DICT: Dict[str, Callable[..., Any]] = {}
+ 207SPECIAL_FUNCTIONS: Set[Callable[..., Any]] = set()
+ 208
+ 209
+ 210def _add_special_function(name: str, f: Callable[..., Any]) -> None:
+ 211 SPECIAL_FUNCTIONS_DICT[name] = f
+ 212 SPECIAL_FUNCTIONS.add(f)
+ 213
+ 214
+ 215NewVarHint = Literal[False, 'dsl', 'comptime']
+ 216
+ 217
+ 218def _friendly_error_message_for_unrecognized_type(ty: Any) -> str:
+ 219 if ty is range:
+ 220 return 'expected builtin function range, use lc.range instead'
+ 221 return f"expected DSL type but got {ty}"
+ 222
+ 223
+ 224class FuncParser:
+ 225
+ 226 name: str
+ 227 func: object
+ 228 globalns: Dict[str, Any]
+ 229 self_type: Optional[Type]
+ 230 vars: Dict[str, hir.Var | ComptimeValue]
+ 231 func_def: ast.FunctionDef
+ 232 parsed_func: hir.Function
+ 233 type_var_ns: Dict[typing.TypeVar, hir.Type]
+ 234 bb_stack: List[hir.BasicBlock]
+ 235 type_parser: TypeParser
+ 236 break_and_continues: List[hir.Break | hir.Continue] | None
+ 237 returning_ref: bool
+ 238
+ 239 def __init__(self, name: str,
+ 240 func: object,
+ 241 signature: hir.FunctionSignature,
+ 242 globalns: Dict[str, Any],
+ 243 type_var_ns: Dict[typing.TypeVar, hir.Type],
+ 244 self_type: Optional[Type],
+ 245 return_ref: bool
+ 246 ) -> None:
+ 247 self.type_parser = TypeParser(
+ 248 name, globalns, type_var_ns, self_type, 'instantiate')
+ 249 self.name = name
+ 250 self.func = func
+ 251 self.signature = signature
+ 252 self.globalns = copy(globalns)
+ 253 self.returning_ref = return_ref
+ 254 obj_ast, _obj_file = retrieve_ast_and_filename(func)
+ 255 # print(ast.dump(obj_ast))
+ 256 assert isinstance(obj_ast, ast.Module), f"{obj_ast} is not a module"
+ 257 if not isinstance(obj_ast.body[0], ast.FunctionDef):
+ 258 raise RuntimeError("Function definition expected.")
+ 259 self.func_def = obj_ast.body[0]
+ 260 self.vars = {}
+ 261 self.parsed_func = hir.Function(
+ 262 name, [], None, self_type is not None, return_ref)
+ 263 self.type_var_ns = type_var_ns
+ 264 self.bb_stack = []
+ 265 self.break_and_continues = None
+ 266 self.parsed_func.params = signature.params
+ 267 for p in self.parsed_func.params:
+ 268 self.vars[p.name] = p
+ 269 self.parsed_func.return_type = signature.return_type
+ 270
+ 271 def cur_bb(self) -> hir.BasicBlock:
+ 272 return self.bb_stack[-1]
+ 273
+ 274 def parse_type(self, ty: classinfo.VarType) -> Optional[hir.Type]:
+ 275 t = self.type_parser.parse_type(ty)
+ 276 if t:
+ 277 if isinstance(t, hir.SymbolicType):
+ 278 raise RuntimeError(f"Type {t} is not resolved")
+ 279 return t
+ 280
+ 281 def convert_constexpr(self, comptime_val: ComptimeValue, span: Optional[hir.Span] = None) -> Optional[hir.Value]:
+ 282 value = comptime_val.value
+ 283 if isinstance(value, int):
+ 284 return hir.Constant(value, type=hir.GenericIntType())
+ 285 elif isinstance(value, float):
+ 286 return hir.Constant(value, type=hir.GenericFloatType())
+ 287 elif isinstance(value, bool):
+ 288 return hir.Constant(value, type=hir.BoolType())
+ 289 elif isinstance(value, FunctionType):
+ 290 dsl_func = get_dsl_func(value)
+ 291 if dsl_func is None:
+ 292 raise hir.ParsingError(
+ 293 span, f"expected DSL function but got {value}")
+ 294 if dsl_func.is_generic:
+ 295 return hir.FunctionValue(hir.FunctionType(dsl_func, None), span=span)
+ 296 else:
+ 297 resolved_f = dsl_func.resolve(None)
+ 298 assert not isinstance(
+ 299 resolved_f, hir.TemplateMatchingError)
+ 300 return hir.FunctionValue(hir.FunctionType(resolved_f, None), span=span)
+ 301 # return hir.FunctionValue(resolved_f, None, span)
+ 302 elif isinstance(value, type):
+ 303 dsl_type = get_dsl_type(value)
+ 304 if dsl_type is None:
+ 305 raise hir.ParsingError(
+ 306 span, _friendly_error_message_for_unrecognized_type(value))
+ 307
+ 308 return hir.TypeValue(dsl_type)
+ 309 return None
+ 310
+ 311 def parse_const(self, const: ast.Constant) -> hir.Value:
+ 312 span = hir.Span.from_ast(const)
+ 313 value = const.value
+ 314 if isinstance(value, (int, float, bool)):
+ 315 cst = hir.Constant(value, type=None, span=span)
+ 316 match value:
+ 317 case int():
+ 318 cst.type = hir.GenericIntType()
+ 319 case float():
+ 320 cst.type = hir.GenericFloatType()
+ 321 case bool():
+ 322 cst.type = hir.BoolType()
+ 323 return cst
+ 324 raise hir.ParsingError(
+ 325 const, f"unsupported constant type {type(value)}, wrap it in lc.comptime(...) if you intead to use it as a compile-time expression")
+ 326
+ 327 def convert_any_to_value(self, a: Any, span: hir.Span | None) -> hir.Value | ComptimeValue:
+ 328 if isinstance(a, typing.TypeVar):
+ 329 if a in self.type_var_ns:
+ 330 v = self.type_var_ns[a]
+ 331 if isinstance(v, hir.Type):
+ 332 return hir.TypeValue(v)
+ 333 return self.convert_any_to_value(v, span)
+ 334 if not isinstance(a, ComptimeValue):
+ 335 a = ComptimeValue(a, None)
+ 336 if a.value in SPECIAL_FUNCTIONS:
+ 337 return a
+ 338 if (converted := self.convert_constexpr(a, span)) is not None:
+ 339 return converted
+ 340 if is_valid_comptime_value_in_dsl_code(a.value):
+ 341 return a
+ 342 raise hir.ParsingError(
+ 343 span, f"unsupported constant type {type(a.value)}, wrap it in lc.comptime(...) if you intead to use it as a compile-time expression")
+ 344
+ 345 def parse_name(self, name: ast.Name, new_var_hint: NewVarHint) -> hir.Ref | hir.Value | ComptimeValue:
+ 346 span = hir.Span.from_ast(name)
+ 347 var = self.vars.get(name.id)
+ 348 # print(__builtins__)
+ 349 # print('range' in __builtins__)
+ 350 # assert hasattr(__builtins__, 'range')
+ 351 if var is not None:
+ 352 return var
+ 353 if new_var_hint == 'dsl':
+ 354 var = hir.Var(name.id, None, span)
+ 355 self.vars[name.id] = var
+ 356 return var
+ 357 else:
+ 358 # look up in global namespace
+ 359 if name.id in self.globalns:
+ 360 resolved = self.globalns[name.id]
+ 361 return self.convert_any_to_value(resolved, span)
+ 362 elif name.id in __builtins__: # type: ignore
+ 363 resolved = __builtins__[name.id] # type: ignore
+ 364 return self.convert_any_to_value(resolved, span)
+ 365 elif new_var_hint == 'comptime':
+ 366 self.globalns[name.id] = None
+ 367
+ 368 def update_fn(value: Any) -> None:
+ 369 self.globalns[name.id] = value
+ 370 return ComptimeValue(None, update_fn)
+ 371
+ 372 raise hir.ParsingError(name, f"unknown variable {name.id}")
+ 373
+ 374 def try_convert_comptime_value(self, value: ComptimeValue, span: hir.Span | None = None) -> hir.Value:
+ 375 if (cst := self.convert_constexpr(value)) is not None:
+ 376 return cst
+ 377 raise hir.ParsingError(
+ 378 span, f"unsupported constant type {type(value.value)}, wrap it in lc.comptime(...) if you intead to use it as a compile-time expression")
+ 379
+ 380 def get_index_type(self, span: Optional[hir.Span], base: hir.Type, index: hir.Value) -> Optional[hir.Type]:
+ 381 if isinstance(base, hir.TupleType):
+ 382 if isinstance(index, hir.Constant):
+ 383 if not isinstance(index.value, int):
+ 384 raise hir.ParsingError(
+ 385 span, f"expected integer index, got {type(index.value)}: {index.value}")
+ 386 if index.value < 0 or index.value >= len(base.elements):
+ 387 raise hir.ParsingError(
+ 388 span, f"index out of range: {index.value} not in [0, {len(base.elements)})")
+ 389 return base.elements[index.value]
+ 390 else:
+ 391 raise hir.ParsingError(
+ 392 span, f"dynamically indexed tuple is not supported")
+ 393 else:
+ 394 ty = base.member(hir.DynamicIndex())
+ 395 return ty
+ 396
+ 397 def parse_access_ref(self, expr: ast.Subscript | ast.Attribute) -> hir.Ref | hir.TypeValue | hir.FunctionValue | ComptimeValue:
+ 398 span = hir.Span.from_ast(expr)
+ 399 if isinstance(expr, ast.Subscript):
+ 400 value = self.parse_ref(expr.value)
+ 401 if isinstance(value, ComptimeValue):
+ 402 raise hir.ParsingError(
+ 403 expr, "attempt to access comptime value in DSL code; wrap it in lc.comptime(...) if you intead to use it as a compile-time expression")
+ 404 if isinstance(value, hir.TypeValue):
+ 405 type_args: List[hir.Type] = []
+ 406
+ 407 def parse_type_arg(expr: ast.expr) -> hir.Type:
+ 408 type_annotation = self.eval_expr(expr)
+ 409 type_hint = classinfo.parse_type_hint(type_annotation)
+ 410 ty = self.parse_type(type_hint)
+ 411 assert ty
+ 412 return ty
+ 413
+ 414 match expr.slice:
+ 415 case ast.Tuple():
+ 416 for e in expr.slice.elts:
+ 417 type_args.append(parse_type_arg(e))
+ 418 case _:
+ 419 type_args.append(parse_type_arg(expr.slice))
+ 420 # print(f"Type args: {type_args}")
+ 421 assert isinstance(value.type, hir.TypeConstructorType) and isinstance(
+ 422 value.type.inner, hir.ParametricType)
+ 423 return hir.TypeValue(
+ 424 hir.BoundType(value.type.inner, type_args, value.type.inner.instantiate(type_args)))
+ 425 index = self.parse_expr(expr.slice)
+ 426 assert isinstance(value, hir.Ref) and isinstance(index, hir.Value)
+ 427 index = self.convert_to_value(index, span)
+ 428 assert value.type
+ 429 index_ty = self.get_index_type(span, value.type, index)
+ 430 if index_ty is not None:
+ 431 return self.cur_bb().append(hir.IndexRef(value, index, type=index_ty, span=span))
+ 432 else:
+ 433 # check __getitem__
+ 434 if (method := value.type.method("__getitem__")) and method:
+ 435 try:
+ 436 ret = self.parse_call_impl_ref(
+ 437 span, method, [value, index])
+ 438 except hir.InlineError as e:
+ 439 raise hir.InlineError(
+ 440 expr, f"error during inlining of __getitem__, note that __getitem__ must be inlineable {e}") from e
+ 441 if isinstance(ret, hir.TemplateMatchingError):
+ 442 raise hir.TypeInferenceError(
+ 443 expr, f"error calling __getitem__: {ret.message}")
+ 444 return ret
+ 445 else:
+ 446 raise hir.TypeInferenceError(
+ 447 expr, f"indexing not supported for type {value.type}")
+ 448 elif isinstance(expr, ast.Attribute):
+ 449 def do(expr: ast.Attribute):
+ 450 value: hir.Ref | hir.Value | hir.ComptimeValue = self.parse_ref(
+ 451 expr.value)
+ 452 if isinstance(value, ComptimeValue):
+ 453 if isinstance(value.value, ModuleType):
+ 454 resolved = getattr(value.value, expr.attr)
+ 455 return ComptimeValue(resolved, None)
+ 456 value = self.try_convert_comptime_value(value, span)
+ 457 if isinstance(value, hir.Ref):
+ 458 attr_name = expr.attr
+ 459 assert value.type
+ 460 member_ty = value.type.member(attr_name)
+ 461 if not member_ty:
+ 462 raise hir.ParsingError(
+ 463 expr, f"member {attr_name} not found in type {value.type}")
+ 464 if isinstance(member_ty, hir.FunctionType):
+ 465 if not isinstance(value, hir.TypeValue):
+ 466 member_ty.bound_object = value
+ 467 return hir.FunctionValue(member_ty)
+ 468 return self.cur_bb().append(hir.MemberRef(value, attr_name, type=member_ty, span=span))
+ 469 elif isinstance(value, hir.TypeValue):
+ 470 member_ty = value.inner_type().member(expr.attr)
+ 471 if not member_ty:
+ 472 raise hir.ParsingError(
+ 473 expr, f"member {expr.attr} not found in type {value.inner_type()}")
+ 474 if isinstance(member_ty, hir.FunctionType):
+ 475 return hir.FunctionValue(member_ty)
+ 476 else:
+ 477 raise hir.ParsingError(
+ 478 expr, f"member {expr.attr} is not a function")
+ 479 elif isinstance(value, hir.FunctionValue):
+ 480 raise hir.ParsingError(
+ 481 expr, "function value has no attributes")
+ 482 else:
+ 483 raise hir.ParsingError(
+ 484 expr, f"unsupported value type {type(value)}")
+ 485 return do(expr)
+ 486 # print(type(expr), type(expr) is ast.Attribute)
+ 487 raise NotImplementedError() # unreachable
+ 488
+ 489 def parse_call_impl(self, span: hir.Span | None, f: hir.Function | hir.FunctionTemplate, args: List[hir.Value | hir.Ref], inline=False) -> hir.Value | hir.TemplateMatchingError:
+ 490 ret = self.parse_call_impl_ex(span, f, args, inline)
+ 491 if isinstance(ret, hir.Ref):
+ 492 raise hir.ParsingError(
+ 493 span, f"expected value but got reference")
+ 494 return ret
+ 495
+ 496 def parse_call_impl_ref(self, span: hir.Span | None, f: hir.Function | hir.FunctionTemplate, args: List[hir.Value | hir.Ref]) -> hir.Ref | hir.TemplateMatchingError:
+ 497 ret = self.parse_call_impl_ex(span, f, args, True, True)
+ 498 if isinstance(ret, hir.Value):
+ 499 raise hir.ParsingError(
+ 500 span, f"expected reference but got value")
+ 501 return ret
+ 502
+ 503 def parse_call_impl_ex(self, span: hir.Span | None, f: hir.Function | hir.FunctionTemplate, args: List[hir.Value | hir.Ref], inline=False, expect_ref=False) -> hir.Value | hir.Ref | hir.TemplateMatchingError:
+ 504 if expect_ref:
+ 505 if not inline:
+ 506 raise hir.ParsingError(
+ 507 span, "a function returning local reference must be inlined")
+ 508 if isinstance(f, hir.FunctionTemplate):
+ 509 if f.is_generic:
+ 510 template_resolve_args: hir.FunctionTemplateResolvingArgs = []
+ 511 template_params = f.params
+ 512 if len(template_params) != len(args):
+ 513 return hir.TemplateMatchingError(
+ 514 span,
+ 515 f"Expected {len(template_params)} arguments, got {len(args)}")
+ 516 for i, (param, arg) in enumerate(zip(template_params, args)):
+ 517 if arg.type is None:
+ 518 raise hir.TypeInferenceError(
+ 519 span, f"failed to infer type of argument {i}")
+ 520 template_resolve_args.append((param, arg.type))
+ 521 try:
+ 522 resolved_f = f.resolve(template_resolve_args)
+ 523 if isinstance(resolved_f, hir.TemplateMatchingError):
+ 524 return resolved_f
+ 525 except hir.TypeInferenceError as e:
+ 526 if e.span is None:
+ 527 e.span = span
+ 528 raise e from e
+ 529 else:
+ 530 resolved_f = f.resolve(None)
+ 531 assert not isinstance(resolved_f, hir.TemplateMatchingError)
+ 532 else:
+ 533 resolved_f = f
+ 534 if expect_ref and not resolved_f.returning_ref:
+ 535 raise hir.ParsingError(
+ 536 span, "expected a function returning local reference but got a function returning value")
+ 537 param_tys = []
+ 538 for p in resolved_f.params:
+ 539 assert p.type, f"Parameter {p.name} has no type"
+ 540 param_tys.append(p.type)
+ 541 if len(param_tys) != len(args):
+ 542 raise hir.TypeInferenceError(
+ 543 span,
+ 544 f"Expected {len(param_tys)} arguments, got {len(args)}"
+ 545 )
+ 546 for i, (param_ty, arg) in enumerate(zip(param_tys, args)):
+ 547 assert arg.type is not None
+ 548 if not hir.is_type_compatible_to(arg.type, param_ty):
+ 549 raise hir.TypeInferenceError(
+ 550 span,
+ 551 f"Argument {i} expected {param_ty}, got {arg.type}"
+ 552 )
+ 553 if resolved_f.params[i].semantic == hir.ParameterSemantic.BYREF:
+ 554 if isinstance(arg, hir.Value):
+ 555 tmp = self.cur_bb().append(hir.Alloca(arg.type, span))
+ 556 self.cur_bb().append(hir.Assign(tmp, arg, span))
+ 557 args[i] = tmp
+ 558 else:
+ 559 if isinstance(arg, hir.Ref):
+ 560 args[i] = self.cur_bb().append(hir.Load(arg))
+ 561 assert resolved_f.return_type
+ 562 if not inline:
+ 563 return self.cur_bb().append(hir.Call(resolved_f, args, type=resolved_f.return_type, span=span))
+ 564 else:
+ 565 return hir.FunctionInliner.inline(resolved_f, args, self.cur_bb(), span)
+ 566
+ 567 def handle_intrinsic(self, expr: ast.Call, is_ref: bool) -> hir.Value | hir.Ref:
+ 568 intrinsic_name = expr.args[0]
+ 569 if not isinstance(intrinsic_name, ast.Constant) or not isinstance(intrinsic_name.value, str):
+ 570 raise hir.ParsingError(
+ 571 expr, "intrinsic function expects a string literal as its first argument")
+ 572 args: List[hir.Ref | hir.Value | hir.ComptimeValue] = []
+ 573 for a in expr.args[1:]:
+ 574 if isinstance(a, ast.Call) and isinstance(a.func, ast.Name) and a.func.id == 'byref':
+ 575 r = self.parse_ref(a.args[0])
+ 576 if isinstance(r, hir.Ref):
+ 577 args.append(r)
+ 578 else:
+ 579 raise hir.ParsingError(
+ 580 a, "expected reference but got value")
+ 581 else:
+ 582 args.append(self.parse_expr(a))
+ 583 ret_type = args[0]
+ 584 if isinstance(ret_type, ComptimeValue):
+ 585 ret_type = self.try_convert_comptime_value(
+ 586 ret_type, hir.Span.from_ast(expr.args[0]))
+ 587 if not isinstance(ret_type, hir.TypeValue):
+ 588 raise hir.ParsingError(
+ 589 expr, f"intrinsic function expects a type as its second argument but found {ret_type}")
+ 590 if any([not isinstance(arg, (hir.Value, hir.Ref)) for arg in args[1:]]):
+ 591 raise hir.ParsingError(
+ 592 expr, "intrinsic function expects values/refs as its arguments")
+ 593 if is_ref:
+ 594 return self.cur_bb().append(
+ 595 hir.IntrinsicRef(intrinsic_name.value, cast(List[hir.Value | hir.Ref], args[1:]),
+ 596 ret_type.inner_type(), hir.Span.from_ast(expr)))
+ 597 else:
+ 598 return self.cur_bb().append(
+ 599 hir.Intrinsic(intrinsic_name.value, cast(List[hir.Value | hir.Ref], args[1:]),
+ 600 ret_type.inner_type(), hir.Span.from_ast(expr)))
+ 601
+ 602 def handle_special_functions(self, f: Callable[..., Any], expr: ast.Call) -> hir.Value | ComptimeValue:
+ 603 if f is SPECIAL_FUNCTIONS_DICT['intrinsic']:
+ 604 intrin_ret = self.handle_intrinsic(expr, False)
+ 605 assert isinstance(intrin_ret, hir.Value)
+ 606 return intrin_ret
+ 607 # elif f is SPECIAL_FUNCTIONS_DICT['sizeof']:
+ 608 # if len(expr.args) != 1:
+ 609 # raise hir.ParsingError(
+ 610 # expr, f"lc.sizeof function expects exactly one argument")
+ 611 # arg_ty = self.parse_expr(expr.args[0])
+ 612 # if isinstance(arg_ty, ComptimeValue):
+ 613 # arg_ty = self.try_convert_comptime_value(
+ 614 # arg_ty, hir.Span.from_ast(expr.args[0]))
+ 615 # if not isinstance(arg_ty, hir.TypeValue):
+ 616 # raise hir.ParsingError(
+ 617 # expr.args[0], f"expected type but got {arg_ty}")
+ 618 # return self.cur_bb().append(hir.Constant(arg_ty.inner_type().size(), type=hir.GlobalContext().get().types[''], span=hir.Span.from_ast(expr)))
+ 619 elif f is SPECIAL_FUNCTIONS_DICT['cast'] or f is SPECIAL_FUNCTIONS_DICT['bitcast']:
+ 620 def do() -> hir.Intrinsic:
+ 621 if len(expr.args) != 2:
+ 622 raise hir.ParsingError(
+ 623 expr, f"lc.cast function expects exactly two arguments")
+ 624
+ 625 target_ty = self.parse_expr(expr.args[0])
+ 626 value = self.parse_expr(expr.args[1])
+ 627 if isinstance(target_ty, ComptimeValue):
+ 628 target_ty = self.try_convert_comptime_value(
+ 629 target_ty, hir.Span.from_ast(expr.args[0]))
+ 630 if not isinstance(target_ty, hir.TypeValue):
+ 631 raise hir.ParsingError(
+ 632 expr.args[0], f"expected type but got {target_ty}")
+ 633 if isinstance(value, ComptimeValue):
+ 634 value = self.try_convert_comptime_value(
+ 635 value, hir.Span.from_ast(expr.args[1]))
+ 636 if f is SPECIAL_FUNCTIONS_DICT['cast']:
+ 637 intrinsic_name = "cast"
+ 638 else:
+ 639 intrinsic_name = "bitcast"
+ 640 return self.cur_bb().append(hir.Intrinsic(intrinsic_name, [value], target_ty.inner_type(), hir.Span.from_ast(expr)))
+ 641 return do()
+ 642 elif f is SPECIAL_FUNCTIONS_DICT['comptime']:
+ 643 if len(expr.args) != 1:
+ 644 raise hir.ParsingError(
+ 645 expr, f"when used in expressions, lc.comptime function expects exactly one argument")
+ 646 arg = expr.args[0]
+ 647 # print(ast.dump(arg))
+ 648 if isinstance(arg, ast.Constant) and isinstance(arg.value, str):
+ 649 evaled = self.eval_expr(arg.value)
+ 650 else:
+ 651 evaled = self.eval_expr(arg)
+ 652 # print(evaled)
+ 653 v = self.convert_any_to_value(evaled, hir.Span.from_ast(expr))
+ 654 return v
+ 655 elif f is reveal_type:
+ 656 if len(expr.args) != 1:
+ 657 raise hir.ParsingError(
+ 658 expr, f"lc.reveal_type expects exactly one argument")
+ 659 arg = expr.args[0]
+ 660 cur_bb = self.cur_bb()
+ 661 cur_bb_len = len(cur_bb.nodes)
+ 662 value = self.parse_expr(arg)
+ 663 assert cur_bb is self.cur_bb()
+ 664 del self.cur_bb().nodes[cur_bb_len:]
+ 665 unparsed_arg = ast.unparse(arg)
+ 666 if isinstance(value, ComptimeValue):
+ 667 print(
+ 668 f"Type of {unparsed_arg} is ComptimeValue({type(value.value)})")
+ 669 else:
+ 670 print(f"Type of {unparsed_arg} is {value.type}")
+ 671 return hir.Unit()
+ 672 elif f is SPECIAL_FUNCTIONS_DICT['range']:
+ 673 def handle_range() -> hir.Value | ComptimeValue:
+ 674 if 1 <= len(expr.args) <= 3:
+ 675 args = [self.parse_expr(arg) for arg in expr.args]
+ 676 is_all_comptime = all(
+ 677 isinstance(arg, ComptimeValue) for arg in args)
+ 678 if is_all_comptime:
+ 679 try:
+ 680 comptime_args = cast(List[hir.ComptimeValue], args)
+ 681 return hir.ComptimeValue(range(*[arg.value for arg in comptime_args]), None)
+ 682 except Exception as e:
+ 683 raise hir.ParsingError(
+ 684 expr, f"error evaluating range: {e}") from e
+ 685 else:
+ 686 for i, arg in enumerate(args):
+ 687 if isinstance(arg, ComptimeValue):
+ 688 args[i] = self.try_convert_comptime_value(
+ 689 arg, hir.Span.from_ast(expr.args[i]))
+ 690 converted_args = cast(List[hir.Value], args)
+ 691
+ 692 def make_int(i: int) -> hir.Value:
+ 693 return hir.Constant(i, type=hir.GenericIntType())
+ 694 # TODO: check type consistency
+ 695 if len(args) == 1:
+ 696 return hir.Range(make_int(0), converted_args[0], make_int(1))
+ 697 elif len(args) == 2:
+ 698 return hir.Range(converted_args[0], converted_args[1], make_int(1))
+ 699 elif len(args) == 3:
+ 700 return hir.Range(converted_args[0], converted_args[1], converted_args[2])
+ 701 else:
+ 702 raise RuntimeError(
+ 703 f"Unsupported number of arguments for range function: {len(args)}")
+ 704 else:
+ 705 raise hir.ParsingError(
+ 706 expr, f"range function expects 1 to 3 arguments")
+ 707 return handle_range()
+ 708 else:
+ 709 raise RuntimeError(f"Unsupported special function {f}")
+ 710
+ 711 def parse_call_ref(self, expr: ast.Call) -> hir.Ref:
+ 712 func: hir.Ref | ComptimeValue | hir.TypeValue | hir.Value = self.parse_ref(
+ 713 expr.func)
+ 714 if isinstance(func, ComptimeValue):
+ 715 if func.value is not SPECIAL_FUNCTIONS_DICT['intrinsic']:
+ 716 raise hir.ParsingError(
+ 717 expr, f"expected intrinsic function but got {func}")
+ 718 intrin_ref = self.handle_intrinsic(expr, True)
+ 719 assert isinstance(intrin_ref, hir.Ref)
+ 720 return intrin_ref
+ 721
+ 722 span = hir.Span.from_ast(expr)
+ 723 if not isinstance(func, hir.FunctionValue):
+ 724 raise hir.ParsingError(
+ 725 expr, f"expected function but got {func}")
+ 726 raise NotImplementedError()
+ 727
+ 728 def parse_call(self, expr: ast.Call) -> hir.Value | ComptimeValue:
+ 729 func: hir.Ref | ComptimeValue | hir.TypeValue | hir.Value = self.parse_ref(
+ 730 expr.func) # TODO: this should be a parse_ref
+ 731 span = hir.Span.from_ast(expr)
+ 732
+ 733 if isinstance(func, ComptimeValue):
+ 734 if func.value in SPECIAL_FUNCTIONS:
+ 735 return self.handle_special_functions(func.value, expr)
+ 736 func = self.try_convert_comptime_value(
+ 737 func, hir.Span.from_ast(expr))
+ 738
+ 739 def collect_args() -> List[hir.Value | hir.Ref]:
+ 740 args = [self.parse_expr(arg) for arg in expr.args]
+ 741 for i, arg in enumerate(args):
+ 742 if isinstance(arg, ComptimeValue):
+ 743 args[i] = self.try_convert_comptime_value(
+ 744 arg, hir.Span.from_ast(expr.args[i]))
+ 745 return cast(List[hir.Value | hir.Ref], args)
+ 746
+ 747 if isinstance(func.type, hir.TypeConstructorType):
+ 748 # TypeConstructorType is unique for each type
+ 749 # so if any value has this type, it must be referring to the same underlying type
+ 750 # even if it comes from a very complex expression, it's still fine
+ 751 cls = func.type.inner
+ 752 assert cls
+ 753 if isinstance(cls, hir.ParametricType):
+ 754 raise hir.ParsingError(
+ 755 span, f"please provide type arguments for {cls.body}")
+ 756
+ 757 init = cls.method("__init__")
+ 758 tmp = self.cur_bb().append(hir.Alloca(cls, span))
+ 759 if init is None:
+ 760 raise hir.ParsingError(
+ 761 span, f"__init__ method not found for type {cls}")
+ 762 call = self.parse_call_impl(
+ 763 span, init, [tmp]+collect_args())
+ 764 if isinstance(call, hir.TemplateMatchingError):
+ 765 raise hir.ParsingError(expr, call.message)
+ 766 assert isinstance(call, hir.Call)
+ 767 return self.cur_bb().append(hir.Load(tmp))
+ 768 assert func.type
+ 769 if isinstance(func.type, hir.FunctionType):
+ 770 func_like = func.type.func_like
+ 771 bound_object = func.type.bound_object
+ 772 if bound_object is not None:
+ 773 ret = self.parse_call_impl(
+ 774 span, func_like, cast(List[hir.Ref | hir.Value], [bound_object]) + collect_args())
+ 775 else:
+ 776 ret = self.parse_call_impl(
+ 777 span, func_like, collect_args())
+ 778 if isinstance(ret, hir.TemplateMatchingError):
+ 779 raise hir.ParsingError(expr, ret.message)
+ 780 return ret
+ 781 else:
+ 782 # check if __call__ is defined
+ 783 if (method := func.type.method("__call__")) and method:
+ 784 ret = self.parse_call_impl(
+ 785 span, method, cast(List[hir.Ref | hir.Value], [func]) + collect_args())
+ 786 if isinstance(ret, hir.TemplateMatchingError):
+ 787 raise hir.ParsingError(expr, ret.message)
+ 788 return ret
+ 789 else:
+ 790 raise hir.ParsingError(
+ 791 expr, f"function call not supported for type {func.type}")
+ 792
+ 793 def parse_binop(self, expr: ast.BinOp | ast.Compare) -> hir.Value:
+ 794 binop_to_op_str: Dict[type, str] = {
+ 795 ast.Add: "+",
+ 796 ast.Sub: "-",
+ 797 ast.Mult: "*",
+ 798 ast.Div: "/",
+ 799 ast.FloorDiv: "//",
+ 800 ast.Mod: "%",
+ 801 ast.Pow: "**",
+ 802 ast.LShift: "<<",
+ 803 ast.RShift: ">>",
+ 804 ast.BitAnd: '&',
+ 805 ast.BitOr: '|',
+ 806 ast.BitXor: '^',
+ 807 ast.Eq: "==",
+ 808 ast.NotEq: "!=",
+ 809 ast.Lt: "<",
+ 810 ast.LtE: "<=",
+ 811 ast.Gt: ">",
+ 812 ast.GtE: ">=",
+ 813
+ 814 }
+ 815 op: ast.AST
+ 816 if isinstance(expr, ast.Compare):
+ 817 if len(expr.ops) != 1:
+ 818 raise hir.ParsingError(
+ 819 expr, "only one comparison operator is allowed")
+ 820 op = expr.ops[0]
+ 821 left = expr.left
+ 822 right = expr.comparators[0]
+ 823 else:
+ 824 op = expr.op
+ 825 left = expr.left
+ 826 right = expr.right
+ 827 op_str = binop_to_op_str[type(op)]
+ 828 lhs = self.parse_expr(left)
+ 829 if isinstance(lhs, ComptimeValue):
+ 830 lhs = self.try_convert_comptime_value(lhs, hir.Span.from_ast(expr))
+ 831 if not lhs.type:
+ 832 raise hir.ParsingError(
+ 833 left, f"unable to infer type of left operand of binary operation {op_str}")
+ 834 rhs = self.parse_expr(right)
+ 835 if isinstance(rhs, ComptimeValue):
+ 836 rhs = self.try_convert_comptime_value(rhs, hir.Span.from_ast(expr))
+ 837 if not rhs.type:
+ 838 raise hir.ParsingError(
+ 839 right, f"unable to infer type of right operand of binary operation {op_str}")
+ 840 ops = BINOP_TO_METHOD_NAMES[type(op)]
+ 841
+ 842 def infer_binop(name: str, rname: str) -> hir.Value:
+ 843 assert lhs.type and rhs.type
+ 844 matching_errors = []
+ 845 try:
+ 846 if (method := lhs.type.method(name)) and method:
+ 847 ret = self.parse_call_impl(
+ 848 hir.Span.from_ast(expr), method, [lhs, rhs])
+ 849 if isinstance(ret, hir.TemplateMatchingError):
+ 850 matching_errors.append(ret)
+ 851 else:
+ 852 return ret
+ 853 if (method := rhs.type.method(rname)) and method:
+ 854 ret = self.parse_call_impl(
+ 855 hir.Span.from_ast(expr), method, [rhs, lhs])
+ 856 if isinstance(ret, hir.TemplateMatchingError):
+ 857 matching_errors.append(ret)
+ 858 else:
+ 859 return ret
+ 860 raise hir.ParsingError(
+ 861 expr, f"Operator {op_str} not defined for types {lhs.type} and {rhs.type}")
+ 862 except hir.TypeInferenceError as e:
+ 863 e.span = hir.Span.from_ast(expr)
+ 864 raise e from e
+ 865 return infer_binop(ops[0], ops[1])
+ 866
+ 867 def parse_ref(self, expr: ast.expr, new_var_hint: NewVarHint = False) -> hir.Ref | ComptimeValue | hir.TypeValue | hir.FunctionValue:
+ 868 match expr:
+ 869 case ast.Name():
+ 870 ret = self.parse_name(expr, new_var_hint)
+ 871 if isinstance(ret, (hir.Value)):
+ 872 if isinstance(ret.type, hir.TypeConstructorType):
+ 873 assert isinstance(ret, hir.TypeValue)
+ 874 return ret
+ 875 if isinstance(ret.type, hir.FunctionType):
+ 876 return hir.FunctionValue(ret.type, hir.Span.from_ast(expr))
+ 877 # raise hir.ParsingError(
+ 878 # expr, f"{type(ret)} cannot be used as reference")
+ 879 assert ret.type
+ 880 tmp = self.cur_bb().append(hir.Alloca(ret.type, hir.Span.from_ast(expr)))
+ 881 self.cur_bb().append(hir.Assign(tmp, ret))
+ 882 return tmp
+ 883 return ret
+ 884 case ast.Subscript() | ast.Attribute():
+ 885 return self.parse_access_ref(expr)
+ 886 case ast.Call() as call:
+ 887 return self.parse_call_ref(call)
+ 888 # if call.func is SPECIAL_FUNCTIONS_DICT['intrinsic']:
+ 889 # return self.handle_special_functions(
+ 890 # call.func, call)
+ 891 # return self.parse_call_impl_ref(hir.Span.from_ast(expr), self.parse_ref(call.func), [self.parse_expr(arg) for arg in call.args])
+ 892 case _:
+ 893 raise hir.ParsingError(
+ 894 expr, f"expression {ast.dump(expr)} cannot be parsed as reference")
+ 895
+ 896 def parse_multi_assignment(self,
+ 897 targets: List[ast.expr],
+ 898 anno_ty_fn: List[Optional[Callable[..., hir.Type | None]]],
+ 899 values: hir.Value | ComptimeValue) -> None:
+ 900 if isinstance(values, ComptimeValue):
+ 901 parsed_targets = [self.parse_ref(t, 'comptime') for t in targets]
+ 902 for i in range(len(parsed_targets)):
+ 903 if isinstance(parsed_targets[i], hir.TypeValue):
+ 904 raise hir.ParsingError(
+ 905 targets[i], "types cannot be reassigned")
+ 906
+ 907 def do_assign(target: hir.Ref | ComptimeValue, value: ComptimeValue, i: int) -> None:
+ 908 span = hir.Span.from_ast(targets[i])
+ 909 if isinstance(target, ComptimeValue):
+ 910 target.update(value.value)
+ 911 else:
+ 912 self.cur_bb().append(hir.Assign(target,
+ 913 self.try_convert_comptime_value(value, span)))
+ 914 if len(parsed_targets) > 1:
+ 915 if len(parsed_targets) != len(values.value):
+ 916 raise hir.ParsingError(
+ 917 targets[0], f"expected {len(parsed_targets)} values to unpack, got {len(values.value)}")
+ 918 for i, t in enumerate(parsed_targets):
+ 919 assert isinstance(t, (hir.Ref, ComptimeValue))
+ 920 do_assign(t, values.value[i],
+ 921 i)
+ 922 else:
+ 923 t = parsed_targets[0]
+ 924 assert isinstance(t, (hir.Ref, ComptimeValue))
+ 925 do_assign(t, values, 0)
+ 926 else:
+ 927 parsed_targets = [self.parse_ref(t, 'dsl') for t in targets]
+ 928 is_all_dsl = all(
+ 929 isinstance(t, hir.Ref) for t in parsed_targets)
+ 930 if not is_all_dsl:
+ 931 raise hir.ParsingError(
+ 932 targets[0], "DSL value cannot be assigned to comptime variables")
+ 933 assert values.type
+ 934 ref_targets = cast(List[hir.Ref], parsed_targets)
+ 935
+ 936 def do_unpack(length: int, extract_fn: Callable[[hir.Value, int, ast.expr], hir.Value]) -> None:
+ 937 def check(i: int, val_type: hir.Type) -> None:
+ 938 if len(anno_ty_fn) > 0 and (fn := anno_ty_fn[i]) is not None:
+ 939 ty = fn()
+ 940 if ty is None:
+ 941 raise hir.ParsingError(
+ 942 targets[i], f"unable to infer type of target")
+ 943 if ref_targets[i].type is None:
+ 944 ref_targets[i].type = ty
+ 945 tt = ref_targets[i].type
+ 946 if isinstance(val_type, hir.FunctionType) and val_type.bound_object is not None:
+ 947 raise hir.TypeInferenceError(
+ 948 targets[i], f"bounded method cannot be assigned to variable")
+ 949 if not tt:
+ 950 if val_type.is_concrete():
+ 951 ref_targets[i].type = val_type
+ 952 else:
+ 953 raise hir.TypeInferenceError(
+ 954 targets[i], f"unable to infer type of target, cannot assign with non-concrete type {val_type}")
+ 955 elif not hir.is_type_compatible_to(val_type, tt):
+ 956 raise hir.ParsingError(
+ 957 targets[i], f"expected type {tt}, got {val_type}")
+ 958
+ 959 if len(ref_targets) == 1:
+ 960 assert values.type
+ 961 check(0, values.type)
+ 962 if not isinstance(values.type, (hir.FunctionType, hir.TypeConstructorType)):
+ 963 self.cur_bb().append(hir.Assign(
+ 964 ref_targets[0], values))
+ 965 elif len(ref_targets) == length:
+ 966 for i, t in enumerate(ref_targets):
+ 967 e = extract_fn(values, i, targets[i])
+ 968 assert e.type
+ 969 check(i, e.type)
+ 970 if not isinstance(e.type, (hir.FunctionType, hir.TypeConstructorType)):
+ 971 self.cur_bb().append(hir.Assign(t, e))
+ 972 else:
+ 973 if len(ref_targets) > length:
+ 974 raise hir.ParsingError(
+ 975 targets[0], f"too few values to unpack: expected {len(ref_targets)} values, got {length}")
+ 976 else:
+ 977 raise hir.ParsingError(
+ 978 targets[0], f"too many values to unpack: expected {len(ref_targets)} values, got {length}")
+ 979 match values.type:
+ 980 case hir.VectorType() as vt:
+ 981 comps = 'xyzw'
+ 982 do_unpack(vt.count, lambda values, i, target: self.cur_bb().append(
+ 983 hir.Member(values, comps[i], type=vt.element, span=hir.Span.from_ast(target))))
+ 984 case hir.TupleType() as tt:
+ 985 do_unpack(len(tt.elements), lambda values, i, target: self.cur_bb().append(
+ 986 hir.Member(values, f'_{i}', type=tt.elements[i], span=hir.Span.from_ast(target)))
+ 987 )
+ 988 case hir.ArrayType() as at:
+ 989 assert isinstance(at.count, int)
+ 990 do_unpack(at.count, lambda values, i, target: self.cur_bb().append(
+ 991 hir.Index(values, hir.Constant(i, type=luisa_lang.typeof(luisa_lang.i32)), type=at.element, span=hir.Span.from_ast(target))))
+ 992 case hir.StructType() as st:
+ 993 do_unpack(len(st.fields), lambda values, i, target: self.cur_bb().append(
+ 994 hir.Member(values, st.fields[i][0], type=st.fields[i][1], span=hir.Span.from_ast(target)))
+ 995 )
+ 996 case _:
+ 997 if len(ref_targets) == 1:
+ 998 do_unpack(1, lambda values, i, target: exit(-1))
+ 999 else:
+1000 raise hir.ParsingError(
+1001 targets[0], f"unsupported type for unpacking: {values.type}")
+1002
+1003 def parse_unary(self, expr: ast.UnaryOp) -> hir.Value:
+1004 op = expr.op
+1005 if type(op) not in UNARY_OP_TO_METHOD_NAMES:
+1006 raise hir.ParsingError(
+1007 expr, f"unsupported unary operator {type(op)}")
+1008 op_str = UNARY_OP_TO_METHOD_NAMES[type(op)]
+1009 operand = self.parse_expr(expr.operand)
+1010 if isinstance(operand, ComptimeValue):
+1011 operand = self.try_convert_comptime_value(
+1012 operand, hir.Span.from_ast(expr))
+1013 if not operand.type:
+1014 raise hir.ParsingError(
+1015 expr.operand, f"unable to infer type of operand of unary operation {op_str}")
+1016 method_name = UNARY_OP_TO_METHOD_NAMES[type(op)]
+1017 if (method := operand.type.method(method_name)) and method:
+1018 ret = self.parse_call_impl(
+1019 hir.Span.from_ast(expr), method, [operand])
+1020 if isinstance(ret, hir.TemplateMatchingError):
+1021 raise hir.ParsingError(expr, ret.message)
+1022 return ret
+1023 else:
+1024 raise hir.ParsingError(
+1025 expr, f"operator {type(op)} not defined for type {operand.type}")
+1026
+1027 def parse_expr(self, expr: ast.expr) -> hir.Value | ComptimeValue:
+1028 match expr:
+1029 case ast.Constant():
+1030 return self.parse_const(expr)
+1031 case ast.Name():
+1032 ret = self.parse_name(expr, False)
+1033 if isinstance(ret, hir.Ref):
+1034 ret = self.convert_to_value(ret, hir.Span.from_ast(expr))
+1035 return ret
+1036 case ast.Subscript() | ast.Attribute():
+1037 return self.convert_to_value(self.parse_access_ref(expr), hir.Span.from_ast(expr))
+1038 case ast.BinOp() | ast.Compare():
+1039 return self.parse_binop(expr)
+1040 case ast.UnaryOp():
+1041 return self.parse_unary(expr)
+1042 case ast.Call():
+1043 return self.parse_call(expr)
+1044 case ast.Tuple():
+1045 elements = [self.parse_expr(e) for e in expr.elts]
+1046 is_all_comptime = all(
+1047 isinstance(e, ComptimeValue) for e in elements)
+1048 if is_all_comptime:
+1049 return hir.ComptimeValue(
+1050 tuple(e.value for e in cast(List[ComptimeValue], elements)), None)
+1051 else:
+1052 for i, e in enumerate(elements):
+1053 if isinstance(e, ComptimeValue):
+1054 elements[i] = self.try_convert_comptime_value(
+1055 e, hir.Span.from_ast(expr.elts[i]))
+1056 tt: hir.TupleType = hir.TupleType(
+1057 [unwrap(e.type) for e in cast(List[hir.Value], elements)])
+1058 return self.cur_bb().append(hir.AggregateInit(cast(List[hir.Value], elements), tt, span=hir.Span.from_ast(expr)))
+1059 case _:
+1060 raise RuntimeError(f"Unsupported expression: {ast.dump(expr)}")
+1061
+1062 def eval_expr(self, tree: str | ast.Expression | ast.expr): # -> Any:
+1063 if isinstance(tree, ast.expr):
+1064 tree = ast.Expression(tree)
+1065 # print(tree)
+1066 code_object = compile(tree, "<string>", "eval")
+1067 localns = {}
+1068 for name, v in self.vars.items():
+1069 if isinstance(v, ComptimeValue):
+1070 localns[name] = v.value
+1071 return eval(code_object, self.globalns, localns)
+1072
+1073 def convert_to_value(self, value: hir.Value | hir.Ref | ComptimeValue, span: Optional[hir.Span] = None) -> hir.Value:
+1074 if isinstance(value, ComptimeValue):
+1075 value = self.try_convert_comptime_value(value, span)
+1076 if isinstance(value, hir.Ref):
+1077 value = hir.Load(value)
+1078 self.cur_bb().append(value)
+1079 return value
+1080
+1081 def parse_stmt(self, stmt: ast.stmt) -> None:
+1082 span = hir.Span.from_ast(stmt)
+1083 match stmt:
+1084 case ast.If():
+1085 cond = self.parse_expr(stmt.test)
+1086 pred_bb = self.cur_bb()
+1087 self.bb_stack.pop()
+1088 if isinstance(cond, ComptimeValue):
+1089 if cond.value:
+1090 for s in stmt.body:
+1091 self.parse_stmt(s)
+1092 elif stmt.orelse:
+1093 for s in stmt.orelse:
+1094 self.parse_stmt(s)
+1095 else:
+1096 merge = hir.BasicBlock(span)
+1097 self.bb_stack.append(hir.BasicBlock(span))
+1098 for s in stmt.body:
+1099 self.parse_stmt(s)
+1100 body = self.bb_stack.pop()
+1101 if stmt.orelse:
+1102 self.bb_stack.append(hir.BasicBlock(span))
+1103 for s in stmt.orelse:
+1104 self.parse_stmt(s)
+1105 orelse = self.bb_stack.pop()
+1106 else:
+1107 orelse = None
+1108 pred_bb.append(hir.If(cond, body, orelse, merge, span))
+1109 self.bb_stack.append(merge)
+1110 case ast.While():
+1111 pred_bb = self.cur_bb()
+1112 self.bb_stack.pop()
+1113 prepare = hir.BasicBlock(span)
+1114 self.bb_stack.append(prepare)
+1115 cond = self.parse_expr(stmt.test)
+1116 self.bb_stack.pop()
+1117 if isinstance(cond, ComptimeValue):
+1118 raise hir.ParsingError(
+1119 stmt, "while loop condition must not be a comptime value")
+1120 body = hir.BasicBlock(span)
+1121 self.bb_stack.append(body)
+1122 old_break_and_continues = self.break_and_continues
+1123 self.break_and_continues = []
+1124 for s in stmt.body:
+1125 self.parse_stmt(s)
+1126 break_and_continues = self.break_and_continues
+1127 self.break_and_continues = old_break_and_continues
+1128 body = self.bb_stack.pop()
+1129 update = hir.BasicBlock(span)
+1130 merge = hir.BasicBlock(span)
+1131 loop_node = hir.Loop(prepare, cond, body, update, merge, span)
+1132 pred_bb.append(loop_node)
+1133 for bc in break_and_continues:
+1134 bc.target = loop_node
+1135 self.bb_stack.append(merge)
+1136 case ast.For():
+1137 iter_val = self.parse_expr(stmt.iter)
+1138 if not isinstance(iter_val, hir.Value) or not isinstance(iter_val, hir.Range):
+1139 raise hir.ParsingError(
+1140 stmt, f"for loop iterable must be a range object but found {iter_val}")
+1141 loop_range: hir.Range = iter_val
+1142 pred_bb = self.cur_bb()
+1143 self.bb_stack.pop()
+1144 loop_var = self.parse_ref(stmt.target, new_var_hint='dsl')
+1145 if not isinstance(loop_var, hir.Ref):
+1146 raise hir.ParsingError(
+1147 stmt, "for loop target must be a DSL variable")
+1148 if not loop_var.type:
+1149 loop_ty = loop_range.value_type()
+1150 if not isinstance(loop_ty, hir.GenericIntType):
+1151 loop_var.type = loop_ty
+1152 else:
+1153 loop_var.type = luisa_lang.typeof(luisa_lang.i32)
+1154 if not isinstance(loop_var.type, hir.IntType):
+1155 raise hir.ParsingError(
+1156 stmt, "for loop target must be an integer variable")
+1157
+1158 prepare = hir.BasicBlock(span)
+1159 self.bb_stack.append(prepare)
+1160 int_lt = loop_var.type.method("__lt__")
+1161 assert int_lt is not None
+1162 cmp_result = self.parse_call_impl(
+1163 span, int_lt, [loop_var, loop_range.stop])
+1164 assert isinstance(cmp_result, hir.Value)
+1165 assert cmp_result.type == hir.BoolType()
+1166 self.bb_stack.pop()
+1167 body = hir.BasicBlock(span)
+1168 self.bb_stack.append(body)
+1169 old_break_and_continues = self.break_and_continues
+1170 self.break_and_continues = []
+1171 for s in stmt.body:
+1172 self.parse_stmt(s)
+1173 body = self.bb_stack.pop()
+1174 break_and_continues = self.break_and_continues
+1175 self.break_and_continues = old_break_and_continues
+1176 update = hir.BasicBlock(span)
+1177 self.bb_stack.append(update)
+1178 inc = loop_range.step
+1179 int_add = loop_var.type.method("__add__")
+1180 assert int_add is not None
+1181 add = self.parse_call_impl(
+1182 span, int_add, [loop_var, inc])
+1183 assert isinstance(add, hir.Value)
+1184 self.cur_bb().append(hir.Assign(loop_var, add))
+1185 self.bb_stack.pop()
+1186 merge = hir.BasicBlock(span)
+1187 loop_node = hir.Loop(prepare, cmp_result,
+1188 body, update, merge, span)
+1189 pred_bb.append(loop_node)
+1190 for bc in break_and_continues:
+1191 bc.target = loop_node
+1192 self.bb_stack.append(merge)
+1193 case ast.Break():
+1194 if self.break_and_continues is None:
+1195 raise hir.ParsingError(
+1196 stmt, "break statement must be inside a loop")
+1197 self.cur_bb().append(hir.Break(None, span))
+1198 case ast.Continue():
+1199 if self.break_and_continues is None:
+1200 raise hir.ParsingError(
+1201 stmt, "continue statement must be inside a loop")
+1202 self.cur_bb().append(hir.Continue(None, span))
+1203 case ast.Return():
+1204 def check_return_type(ty: hir.Type) -> None:
+1205 assert self.parsed_func
+1206 if self.parsed_func.return_type is None:
+1207 self.parsed_func.return_type = ty
+1208 else:
+1209 if not hir.is_type_compatible_to(ty, self.parsed_func.return_type):
+1210 raise hir.ParsingError(
+1211 stmt, f"return type mismatch: expected {self.parsed_func.return_type}, got {ty}")
+1212 if self.returning_ref:
+1213 def do():
+1214 if not stmt.value:
+1215 raise hir.ParsingError(
+1216 stmt, "if a function is returning local references, the return value must be provided")
+1217 value = self.parse_ref(stmt.value)
+1218 if not isinstance(value, hir.Ref):
+1219 raise hir.ParsingError(
+1220 stmt, "invalid return target")
+1221 assert value.type
+1222 check_return_type(value.type)
+1223 self.cur_bb().append(hir.ReturnRef(value))
+1224 do()
+1225 else:
+1226 def do():
+1227 if stmt.value:
+1228 value = self.parse_expr(stmt.value)
+1229 value = self.convert_to_value(value, span)
+1230 assert value.type is not None
+1231 check_return_type(value.type)
+1232 self.cur_bb().append(hir.Return(value))
+1233 else:
+1234 check_return_type(hir.UnitType())
+1235 self.cur_bb().append(hir.Return(None))
+1236 do()
+1237 case ast.Assign():
+1238 assert len(stmt.targets) == 1
+1239 target = stmt.targets[0]
+1240 if isinstance(target, ast.Tuple):
+1241 self.parse_multi_assignment(
+1242 target.elts, [], self.parse_expr(stmt.value))
+1243 else:
+1244 self.parse_multi_assignment(
+1245 [target], [], self.parse_expr(stmt.value)
+1246 )
+1247 case ast.AugAssign():
+1248 method_name = AUG_ASSIGN_TO_METHOD_NAMES[type(stmt.op)]
+1249 var = self.parse_ref(stmt.target)
+1250 value = self.parse_expr(stmt.value)
+1251 if isinstance(var, ComptimeValue):
+1252 if not isinstance(value, ComptimeValue):
+1253 raise hir.ParsingError(
+1254 stmt, f"comptime value cannot be assigned with DSL value")
+1255 comptime_method = getattr(var.value, method_name, None)
+1256 if comptime_method is None:
+1257 raise hir.ParsingError(
+1258 stmt, f"comptime value of type {type(var.value)} does not support {method_name}")
+1259 var.update(comptime_method(value.value))
+1260 return None
+1261 value = self.convert_to_value(value, span)
+1262 assert value.type
+1263 assert var.type
+1264 method = var.type.method(method_name)
+1265 if not method:
+1266 raise hir.ParsingError(
+1267 stmt, f"operator {method_name} not defined for type {var.type}")
+1268 ret = self.parse_call_impl(
+1269 span, method, [var, value])
+1270 if isinstance(ret, hir.TemplateMatchingError):
+1271 raise hir.ParsingError(stmt, ret.message)
+1272
+1273 case ast.AnnAssign():
+1274 def parse_anno_ty() -> hir.Type:
+1275 type_annotation = self.eval_expr(stmt.annotation)
+1276 type_hint = classinfo.parse_type_hint(type_annotation)
+1277 ty = self.parse_type(type_hint)
+1278 assert ty
+1279 return ty
+1280
+1281 if stmt.value:
+1282 self.parse_multi_assignment(
+1283 [stmt.target], [parse_anno_ty], self.parse_expr(stmt.value))
+1284 else:
+1285 var = self.parse_ref(stmt.target, new_var_hint='dsl')
+1286 anno_ty = parse_anno_ty()
+1287 assert isinstance(var, hir.Var)
+1288 if not var.type:
+1289 var.type = anno_ty
+1290 else:
+1291 if not hir.is_type_compatible_to(var.type, anno_ty):
+1292 raise hir.ParsingError(
+1293 stmt, f"expected {anno_ty}, got {var.type}")
+1294 case ast.Expr():
+1295 # ignore comments
+1296 if isinstance(stmt.value, ast.Constant) and isinstance(stmt.value.value, str):
+1297 return
+1298 self.parse_expr(stmt.value)
+1299 case ast.Pass():
+1300 return
+1301 case _:
+1302 raise RuntimeError(f"Unsupported statement: {ast.dump(stmt)}")
+1303
+1304 def parse_body(self):
+1305 assert self.parsed_func is not None
+1306 body = self.func_def.body
+1307 entry = hir.BasicBlock(hir.Span.from_ast(self.func_def))
+1308 self.bb_stack.append(entry)
+1309 for stmt in body:
+1310 self.parse_stmt(stmt)
+1311 assert len(self.bb_stack) == 1
+1312 self.parsed_func.body = entry
+1313 self.parsed_func.locals = list(
+1314 [x for x in self.vars.values() if isinstance(x, hir.Var)])
+1315 if not self.parsed_func.return_type:
+1316 self.parsed_func.return_type = hir.UnitType()
+1317 self.parsed_func.complete = True
+1318 return self.parsed_func
+1319
+1320
+1321UNARY_OP_TO_METHOD_NAMES: Dict[type, str] = {
+1322 ast.UAdd: "__pos__",
+1323 ast.USub: "__neg__",
+1324 ast.Not: "__not__",
+1325 ast.Invert: "__invert__",
+1326}
+1327
+1328AUG_ASSIGN_TO_METHOD_NAMES: Dict[type, str] = {
+1329 ast.Add: "__iadd__",
+1330 ast.Sub: "__isub__",
+1331 ast.Mult: "__imul__",
+1332 ast.Div: "__idiv__",
+1333 ast.FloorDiv: "__ifloordiv__",
+1334 ast.Mod: "__imod__",
+1335 ast.Pow: "__ipow__",
+1336 ast.LShift: "__ilshift__",
+1337 ast.RShift: "__irshift__",
+1338 ast.BitAnd: "__iand__",
+1339 ast.BitOr: "__ior__",
+1340 ast.BitXor: "__ixor__",
+1341}
+1342
+1343BINOP_TO_METHOD_NAMES: Dict[type, List[str]] = {
+1344 ast.Add: ["__add__", "__radd__"],
+1345 ast.Sub: ["__sub__", "__rsub__"],
+1346 ast.Mult: ["__mul__", "__rmul__"],
+1347 ast.Div: ["__truediv__", "__rtruediv__"],
+1348 ast.FloorDiv: ["__floordiv__", "__rfloordiv__"],
+1349 ast.Mod: ["__mod__", "__rmod__"],
+1350 ast.Eq: ["__eq__", "__eq__"],
+1351 ast.NotEq: ["__ne__", "__ne__"],
+1352 ast.Lt: ["__lt__", "__gt__"],
+1353 ast.LtE: ["__le__", "__ge__"],
+1354 ast.Gt: ["__gt__", "__lt__"],
+1355 ast.GtE: ["__ge__", "__le__"],
+1356 ast.BitAnd: ["__and__", "__rand__"],
+1357 ast.BitOr: ["__or__", "__ror__"],
+1358 ast.BitXor: ["__xor__", "__rxor__"],
+1359 ast.LShift: ["__lshift__", "__rlshift__"],
+1360 ast.RShift: ["__rshift__", "__rrshift__"],
+1361 ast.Pow: ["__pow__", "__rpow__"],
+1362}
+1363
+1364__all__ = ["convert_func_signature", "FuncParser"]
+
155def convert_func_signature(signature: classinfo.MethodType,
+156 ctx_name: str,
+157 props:hir.FuncProperties,
+158 globalns: Dict[str, Any],
+159 type_var_ns: Dict[typing.TypeVar, hir.Type],
+160 implicit_type_params: Dict[str, hir.Type],
+161 self_type: Optional[Type],
+162 mode: ParsingMode = 'parse'
+163 ) -> Tuple[hir.FunctionSignature, TypeParser]:
+164 """
+165 implicit_type_params: Tuple[List[Tuple[str,
+166 classinfo.VarType]], classinfo.VarType]
+167 """
+168 type_parser = TypeParser(ctx_name, globalns, type_var_ns, self_type, mode)
+169 type_parser.implicit_type_params = implicit_type_params
+170 params: List[Var] = []
+171 for arg in signature.args:
+172 param_type = type_parser.parse_type_ext(arg[1])
+173 semantic = hir.ParameterSemantic.BYVAL
+174 if arg[0] == "self":
+175 assert self_type is not None
+176 param_type = self_type
+177 semantic = hir.ParameterSemantic.BYREF
+178 if arg[0] in props.byref:
+179 semantic = hir.ParameterSemantic.BYREF
+180 if param_type is None:
+181 raise RuntimeError(
+182 f"Unable to parse type of parameter {arg[0]}: {arg[1]}")
+183 if isinstance(param_type, hir.Type):
+184 params.append(
+185 Var(arg[0], param_type, span=None, semantic=semantic))
+186 else:
+187 if mode == 'parse':
+188 gp = hir.GenericParameter(
+189 _implicit_typevar_name(arg[0]), ctx_name, bound=param_type)
+190 implicit_type_params[arg[0]] = hir.SymbolicType(gp)
+191 type_parser.generic_params.append(gp)
+192 else:
+193 assert not isinstance(
+194 implicit_type_params[arg[0]], hir.SymbolicType)
+195 params.append(
+196 Var(arg[0], implicit_type_params[arg[0]], span=None, semantic=semantic))
+197 return_type = type_parser.parse_type_ext(signature.return_type)
+198 assert return_type is not None, f"failed to parse return type {signature.return_type}"
+199 if isinstance(return_type, hir.AnyBound):
+200 return_type = None
+201 elif isinstance(return_type, hir.TypeBound):
+202 raise NotImplementedError()
+203
+204 return hir.FunctionSignature(type_parser.generic_params, params, return_type), type_parser
+
225class FuncParser:
+ 226
+ 227 name: str
+ 228 func: object
+ 229 globalns: Dict[str, Any]
+ 230 self_type: Optional[Type]
+ 231 vars: Dict[str, hir.Var | ComptimeValue]
+ 232 func_def: ast.FunctionDef
+ 233 parsed_func: hir.Function
+ 234 type_var_ns: Dict[typing.TypeVar, hir.Type]
+ 235 bb_stack: List[hir.BasicBlock]
+ 236 type_parser: TypeParser
+ 237 break_and_continues: List[hir.Break | hir.Continue] | None
+ 238 returning_ref: bool
+ 239
+ 240 def __init__(self, name: str,
+ 241 func: object,
+ 242 signature: hir.FunctionSignature,
+ 243 globalns: Dict[str, Any],
+ 244 type_var_ns: Dict[typing.TypeVar, hir.Type],
+ 245 self_type: Optional[Type],
+ 246 return_ref: bool
+ 247 ) -> None:
+ 248 self.type_parser = TypeParser(
+ 249 name, globalns, type_var_ns, self_type, 'instantiate')
+ 250 self.name = name
+ 251 self.func = func
+ 252 self.signature = signature
+ 253 self.globalns = copy(globalns)
+ 254 self.returning_ref = return_ref
+ 255 obj_ast, _obj_file = retrieve_ast_and_filename(func)
+ 256 # print(ast.dump(obj_ast))
+ 257 assert isinstance(obj_ast, ast.Module), f"{obj_ast} is not a module"
+ 258 if not isinstance(obj_ast.body[0], ast.FunctionDef):
+ 259 raise RuntimeError("Function definition expected.")
+ 260 self.func_def = obj_ast.body[0]
+ 261 self.vars = {}
+ 262 self.parsed_func = hir.Function(
+ 263 name, [], None, self_type is not None, return_ref)
+ 264 self.type_var_ns = type_var_ns
+ 265 self.bb_stack = []
+ 266 self.break_and_continues = None
+ 267 self.parsed_func.params = signature.params
+ 268 for p in self.parsed_func.params:
+ 269 self.vars[p.name] = p
+ 270 self.parsed_func.return_type = signature.return_type
+ 271
+ 272 def cur_bb(self) -> hir.BasicBlock:
+ 273 return self.bb_stack[-1]
+ 274
+ 275 def parse_type(self, ty: classinfo.VarType) -> Optional[hir.Type]:
+ 276 t = self.type_parser.parse_type(ty)
+ 277 if t:
+ 278 if isinstance(t, hir.SymbolicType):
+ 279 raise RuntimeError(f"Type {t} is not resolved")
+ 280 return t
+ 281
+ 282 def convert_constexpr(self, comptime_val: ComptimeValue, span: Optional[hir.Span] = None) -> Optional[hir.Value]:
+ 283 value = comptime_val.value
+ 284 if isinstance(value, int):
+ 285 return hir.Constant(value, type=hir.GenericIntType())
+ 286 elif isinstance(value, float):
+ 287 return hir.Constant(value, type=hir.GenericFloatType())
+ 288 elif isinstance(value, bool):
+ 289 return hir.Constant(value, type=hir.BoolType())
+ 290 elif isinstance(value, FunctionType):
+ 291 dsl_func = get_dsl_func(value)
+ 292 if dsl_func is None:
+ 293 raise hir.ParsingError(
+ 294 span, f"expected DSL function but got {value}")
+ 295 if dsl_func.is_generic:
+ 296 return hir.FunctionValue(hir.FunctionType(dsl_func, None), span=span)
+ 297 else:
+ 298 resolved_f = dsl_func.resolve(None)
+ 299 assert not isinstance(
+ 300 resolved_f, hir.TemplateMatchingError)
+ 301 return hir.FunctionValue(hir.FunctionType(resolved_f, None), span=span)
+ 302 # return hir.FunctionValue(resolved_f, None, span)
+ 303 elif isinstance(value, type):
+ 304 dsl_type = get_dsl_type(value)
+ 305 if dsl_type is None:
+ 306 raise hir.ParsingError(
+ 307 span, _friendly_error_message_for_unrecognized_type(value))
+ 308
+ 309 return hir.TypeValue(dsl_type)
+ 310 return None
+ 311
+ 312 def parse_const(self, const: ast.Constant) -> hir.Value:
+ 313 span = hir.Span.from_ast(const)
+ 314 value = const.value
+ 315 if isinstance(value, (int, float, bool)):
+ 316 cst = hir.Constant(value, type=None, span=span)
+ 317 match value:
+ 318 case int():
+ 319 cst.type = hir.GenericIntType()
+ 320 case float():
+ 321 cst.type = hir.GenericFloatType()
+ 322 case bool():
+ 323 cst.type = hir.BoolType()
+ 324 return cst
+ 325 raise hir.ParsingError(
+ 326 const, f"unsupported constant type {type(value)}, wrap it in lc.comptime(...) if you intead to use it as a compile-time expression")
+ 327
+ 328 def convert_any_to_value(self, a: Any, span: hir.Span | None) -> hir.Value | ComptimeValue:
+ 329 if isinstance(a, typing.TypeVar):
+ 330 if a in self.type_var_ns:
+ 331 v = self.type_var_ns[a]
+ 332 if isinstance(v, hir.Type):
+ 333 return hir.TypeValue(v)
+ 334 return self.convert_any_to_value(v, span)
+ 335 if not isinstance(a, ComptimeValue):
+ 336 a = ComptimeValue(a, None)
+ 337 if a.value in SPECIAL_FUNCTIONS:
+ 338 return a
+ 339 if (converted := self.convert_constexpr(a, span)) is not None:
+ 340 return converted
+ 341 if is_valid_comptime_value_in_dsl_code(a.value):
+ 342 return a
+ 343 raise hir.ParsingError(
+ 344 span, f"unsupported constant type {type(a.value)}, wrap it in lc.comptime(...) if you intead to use it as a compile-time expression")
+ 345
+ 346 def parse_name(self, name: ast.Name, new_var_hint: NewVarHint) -> hir.Ref | hir.Value | ComptimeValue:
+ 347 span = hir.Span.from_ast(name)
+ 348 var = self.vars.get(name.id)
+ 349 # print(__builtins__)
+ 350 # print('range' in __builtins__)
+ 351 # assert hasattr(__builtins__, 'range')
+ 352 if var is not None:
+ 353 return var
+ 354 if new_var_hint == 'dsl':
+ 355 var = hir.Var(name.id, None, span)
+ 356 self.vars[name.id] = var
+ 357 return var
+ 358 else:
+ 359 # look up in global namespace
+ 360 if name.id in self.globalns:
+ 361 resolved = self.globalns[name.id]
+ 362 return self.convert_any_to_value(resolved, span)
+ 363 elif name.id in __builtins__: # type: ignore
+ 364 resolved = __builtins__[name.id] # type: ignore
+ 365 return self.convert_any_to_value(resolved, span)
+ 366 elif new_var_hint == 'comptime':
+ 367 self.globalns[name.id] = None
+ 368
+ 369 def update_fn(value: Any) -> None:
+ 370 self.globalns[name.id] = value
+ 371 return ComptimeValue(None, update_fn)
+ 372
+ 373 raise hir.ParsingError(name, f"unknown variable {name.id}")
+ 374
+ 375 def try_convert_comptime_value(self, value: ComptimeValue, span: hir.Span | None = None) -> hir.Value:
+ 376 if (cst := self.convert_constexpr(value)) is not None:
+ 377 return cst
+ 378 raise hir.ParsingError(
+ 379 span, f"unsupported constant type {type(value.value)}, wrap it in lc.comptime(...) if you intead to use it as a compile-time expression")
+ 380
+ 381 def get_index_type(self, span: Optional[hir.Span], base: hir.Type, index: hir.Value) -> Optional[hir.Type]:
+ 382 if isinstance(base, hir.TupleType):
+ 383 if isinstance(index, hir.Constant):
+ 384 if not isinstance(index.value, int):
+ 385 raise hir.ParsingError(
+ 386 span, f"expected integer index, got {type(index.value)}: {index.value}")
+ 387 if index.value < 0 or index.value >= len(base.elements):
+ 388 raise hir.ParsingError(
+ 389 span, f"index out of range: {index.value} not in [0, {len(base.elements)})")
+ 390 return base.elements[index.value]
+ 391 else:
+ 392 raise hir.ParsingError(
+ 393 span, f"dynamically indexed tuple is not supported")
+ 394 else:
+ 395 ty = base.member(hir.DynamicIndex())
+ 396 return ty
+ 397
+ 398 def parse_access_ref(self, expr: ast.Subscript | ast.Attribute) -> hir.Ref | hir.TypeValue | hir.FunctionValue | ComptimeValue:
+ 399 span = hir.Span.from_ast(expr)
+ 400 if isinstance(expr, ast.Subscript):
+ 401 value = self.parse_ref(expr.value)
+ 402 if isinstance(value, ComptimeValue):
+ 403 raise hir.ParsingError(
+ 404 expr, "attempt to access comptime value in DSL code; wrap it in lc.comptime(...) if you intead to use it as a compile-time expression")
+ 405 if isinstance(value, hir.TypeValue):
+ 406 type_args: List[hir.Type] = []
+ 407
+ 408 def parse_type_arg(expr: ast.expr) -> hir.Type:
+ 409 type_annotation = self.eval_expr(expr)
+ 410 type_hint = classinfo.parse_type_hint(type_annotation)
+ 411 ty = self.parse_type(type_hint)
+ 412 assert ty
+ 413 return ty
+ 414
+ 415 match expr.slice:
+ 416 case ast.Tuple():
+ 417 for e in expr.slice.elts:
+ 418 type_args.append(parse_type_arg(e))
+ 419 case _:
+ 420 type_args.append(parse_type_arg(expr.slice))
+ 421 # print(f"Type args: {type_args}")
+ 422 assert isinstance(value.type, hir.TypeConstructorType) and isinstance(
+ 423 value.type.inner, hir.ParametricType)
+ 424 return hir.TypeValue(
+ 425 hir.BoundType(value.type.inner, type_args, value.type.inner.instantiate(type_args)))
+ 426 index = self.parse_expr(expr.slice)
+ 427 assert isinstance(value, hir.Ref) and isinstance(index, hir.Value)
+ 428 index = self.convert_to_value(index, span)
+ 429 assert value.type
+ 430 index_ty = self.get_index_type(span, value.type, index)
+ 431 if index_ty is not None:
+ 432 return self.cur_bb().append(hir.IndexRef(value, index, type=index_ty, span=span))
+ 433 else:
+ 434 # check __getitem__
+ 435 if (method := value.type.method("__getitem__")) and method:
+ 436 try:
+ 437 ret = self.parse_call_impl_ref(
+ 438 span, method, [value, index])
+ 439 except hir.InlineError as e:
+ 440 raise hir.InlineError(
+ 441 expr, f"error during inlining of __getitem__, note that __getitem__ must be inlineable {e}") from e
+ 442 if isinstance(ret, hir.TemplateMatchingError):
+ 443 raise hir.TypeInferenceError(
+ 444 expr, f"error calling __getitem__: {ret.message}")
+ 445 return ret
+ 446 else:
+ 447 raise hir.TypeInferenceError(
+ 448 expr, f"indexing not supported for type {value.type}")
+ 449 elif isinstance(expr, ast.Attribute):
+ 450 def do(expr: ast.Attribute):
+ 451 value: hir.Ref | hir.Value | hir.ComptimeValue = self.parse_ref(
+ 452 expr.value)
+ 453 if isinstance(value, ComptimeValue):
+ 454 if isinstance(value.value, ModuleType):
+ 455 resolved = getattr(value.value, expr.attr)
+ 456 return ComptimeValue(resolved, None)
+ 457 value = self.try_convert_comptime_value(value, span)
+ 458 if isinstance(value, hir.Ref):
+ 459 attr_name = expr.attr
+ 460 assert value.type
+ 461 member_ty = value.type.member(attr_name)
+ 462 if not member_ty:
+ 463 raise hir.ParsingError(
+ 464 expr, f"member {attr_name} not found in type {value.type}")
+ 465 if isinstance(member_ty, hir.FunctionType):
+ 466 if not isinstance(value, hir.TypeValue):
+ 467 member_ty.bound_object = value
+ 468 return hir.FunctionValue(member_ty)
+ 469 return self.cur_bb().append(hir.MemberRef(value, attr_name, type=member_ty, span=span))
+ 470 elif isinstance(value, hir.TypeValue):
+ 471 member_ty = value.inner_type().member(expr.attr)
+ 472 if not member_ty:
+ 473 raise hir.ParsingError(
+ 474 expr, f"member {expr.attr} not found in type {value.inner_type()}")
+ 475 if isinstance(member_ty, hir.FunctionType):
+ 476 return hir.FunctionValue(member_ty)
+ 477 else:
+ 478 raise hir.ParsingError(
+ 479 expr, f"member {expr.attr} is not a function")
+ 480 elif isinstance(value, hir.FunctionValue):
+ 481 raise hir.ParsingError(
+ 482 expr, "function value has no attributes")
+ 483 else:
+ 484 raise hir.ParsingError(
+ 485 expr, f"unsupported value type {type(value)}")
+ 486 return do(expr)
+ 487 # print(type(expr), type(expr) is ast.Attribute)
+ 488 raise NotImplementedError() # unreachable
+ 489
+ 490 def parse_call_impl(self, span: hir.Span | None, f: hir.Function | hir.FunctionTemplate, args: List[hir.Value | hir.Ref], inline=False) -> hir.Value | hir.TemplateMatchingError:
+ 491 ret = self.parse_call_impl_ex(span, f, args, inline)
+ 492 if isinstance(ret, hir.Ref):
+ 493 raise hir.ParsingError(
+ 494 span, f"expected value but got reference")
+ 495 return ret
+ 496
+ 497 def parse_call_impl_ref(self, span: hir.Span | None, f: hir.Function | hir.FunctionTemplate, args: List[hir.Value | hir.Ref]) -> hir.Ref | hir.TemplateMatchingError:
+ 498 ret = self.parse_call_impl_ex(span, f, args, True, True)
+ 499 if isinstance(ret, hir.Value):
+ 500 raise hir.ParsingError(
+ 501 span, f"expected reference but got value")
+ 502 return ret
+ 503
+ 504 def parse_call_impl_ex(self, span: hir.Span | None, f: hir.Function | hir.FunctionTemplate, args: List[hir.Value | hir.Ref], inline=False, expect_ref=False) -> hir.Value | hir.Ref | hir.TemplateMatchingError:
+ 505 if expect_ref:
+ 506 if not inline:
+ 507 raise hir.ParsingError(
+ 508 span, "a function returning local reference must be inlined")
+ 509 if isinstance(f, hir.FunctionTemplate):
+ 510 if f.is_generic:
+ 511 template_resolve_args: hir.FunctionTemplateResolvingArgs = []
+ 512 template_params = f.params
+ 513 if len(template_params) != len(args):
+ 514 return hir.TemplateMatchingError(
+ 515 span,
+ 516 f"Expected {len(template_params)} arguments, got {len(args)}")
+ 517 for i, (param, arg) in enumerate(zip(template_params, args)):
+ 518 if arg.type is None:
+ 519 raise hir.TypeInferenceError(
+ 520 span, f"failed to infer type of argument {i}")
+ 521 template_resolve_args.append((param, arg.type))
+ 522 try:
+ 523 resolved_f = f.resolve(template_resolve_args)
+ 524 if isinstance(resolved_f, hir.TemplateMatchingError):
+ 525 return resolved_f
+ 526 except hir.TypeInferenceError as e:
+ 527 if e.span is None:
+ 528 e.span = span
+ 529 raise e from e
+ 530 else:
+ 531 resolved_f = f.resolve(None)
+ 532 assert not isinstance(resolved_f, hir.TemplateMatchingError)
+ 533 else:
+ 534 resolved_f = f
+ 535 if expect_ref and not resolved_f.returning_ref:
+ 536 raise hir.ParsingError(
+ 537 span, "expected a function returning local reference but got a function returning value")
+ 538 param_tys = []
+ 539 for p in resolved_f.params:
+ 540 assert p.type, f"Parameter {p.name} has no type"
+ 541 param_tys.append(p.type)
+ 542 if len(param_tys) != len(args):
+ 543 raise hir.TypeInferenceError(
+ 544 span,
+ 545 f"Expected {len(param_tys)} arguments, got {len(args)}"
+ 546 )
+ 547 for i, (param_ty, arg) in enumerate(zip(param_tys, args)):
+ 548 assert arg.type is not None
+ 549 if not hir.is_type_compatible_to(arg.type, param_ty):
+ 550 raise hir.TypeInferenceError(
+ 551 span,
+ 552 f"Argument {i} expected {param_ty}, got {arg.type}"
+ 553 )
+ 554 if resolved_f.params[i].semantic == hir.ParameterSemantic.BYREF:
+ 555 if isinstance(arg, hir.Value):
+ 556 tmp = self.cur_bb().append(hir.Alloca(arg.type, span))
+ 557 self.cur_bb().append(hir.Assign(tmp, arg, span))
+ 558 args[i] = tmp
+ 559 else:
+ 560 if isinstance(arg, hir.Ref):
+ 561 args[i] = self.cur_bb().append(hir.Load(arg))
+ 562 assert resolved_f.return_type
+ 563 if not inline:
+ 564 return self.cur_bb().append(hir.Call(resolved_f, args, type=resolved_f.return_type, span=span))
+ 565 else:
+ 566 return hir.FunctionInliner.inline(resolved_f, args, self.cur_bb(), span)
+ 567
+ 568 def handle_intrinsic(self, expr: ast.Call, is_ref: bool) -> hir.Value | hir.Ref:
+ 569 intrinsic_name = expr.args[0]
+ 570 if not isinstance(intrinsic_name, ast.Constant) or not isinstance(intrinsic_name.value, str):
+ 571 raise hir.ParsingError(
+ 572 expr, "intrinsic function expects a string literal as its first argument")
+ 573 args: List[hir.Ref | hir.Value | hir.ComptimeValue] = []
+ 574 for a in expr.args[1:]:
+ 575 if isinstance(a, ast.Call) and isinstance(a.func, ast.Name) and a.func.id == 'byref':
+ 576 r = self.parse_ref(a.args[0])
+ 577 if isinstance(r, hir.Ref):
+ 578 args.append(r)
+ 579 else:
+ 580 raise hir.ParsingError(
+ 581 a, "expected reference but got value")
+ 582 else:
+ 583 args.append(self.parse_expr(a))
+ 584 ret_type = args[0]
+ 585 if isinstance(ret_type, ComptimeValue):
+ 586 ret_type = self.try_convert_comptime_value(
+ 587 ret_type, hir.Span.from_ast(expr.args[0]))
+ 588 if not isinstance(ret_type, hir.TypeValue):
+ 589 raise hir.ParsingError(
+ 590 expr, f"intrinsic function expects a type as its second argument but found {ret_type}")
+ 591 if any([not isinstance(arg, (hir.Value, hir.Ref)) for arg in args[1:]]):
+ 592 raise hir.ParsingError(
+ 593 expr, "intrinsic function expects values/refs as its arguments")
+ 594 if is_ref:
+ 595 return self.cur_bb().append(
+ 596 hir.IntrinsicRef(intrinsic_name.value, cast(List[hir.Value | hir.Ref], args[1:]),
+ 597 ret_type.inner_type(), hir.Span.from_ast(expr)))
+ 598 else:
+ 599 return self.cur_bb().append(
+ 600 hir.Intrinsic(intrinsic_name.value, cast(List[hir.Value | hir.Ref], args[1:]),
+ 601 ret_type.inner_type(), hir.Span.from_ast(expr)))
+ 602
+ 603 def handle_special_functions(self, f: Callable[..., Any], expr: ast.Call) -> hir.Value | ComptimeValue:
+ 604 if f is SPECIAL_FUNCTIONS_DICT['intrinsic']:
+ 605 intrin_ret = self.handle_intrinsic(expr, False)
+ 606 assert isinstance(intrin_ret, hir.Value)
+ 607 return intrin_ret
+ 608 # elif f is SPECIAL_FUNCTIONS_DICT['sizeof']:
+ 609 # if len(expr.args) != 1:
+ 610 # raise hir.ParsingError(
+ 611 # expr, f"lc.sizeof function expects exactly one argument")
+ 612 # arg_ty = self.parse_expr(expr.args[0])
+ 613 # if isinstance(arg_ty, ComptimeValue):
+ 614 # arg_ty = self.try_convert_comptime_value(
+ 615 # arg_ty, hir.Span.from_ast(expr.args[0]))
+ 616 # if not isinstance(arg_ty, hir.TypeValue):
+ 617 # raise hir.ParsingError(
+ 618 # expr.args[0], f"expected type but got {arg_ty}")
+ 619 # return self.cur_bb().append(hir.Constant(arg_ty.inner_type().size(), type=hir.GlobalContext().get().types[''], span=hir.Span.from_ast(expr)))
+ 620 elif f is SPECIAL_FUNCTIONS_DICT['cast'] or f is SPECIAL_FUNCTIONS_DICT['bitcast']:
+ 621 def do() -> hir.Intrinsic:
+ 622 if len(expr.args) != 2:
+ 623 raise hir.ParsingError(
+ 624 expr, f"lc.cast function expects exactly two arguments")
+ 625
+ 626 target_ty = self.parse_expr(expr.args[0])
+ 627 value = self.parse_expr(expr.args[1])
+ 628 if isinstance(target_ty, ComptimeValue):
+ 629 target_ty = self.try_convert_comptime_value(
+ 630 target_ty, hir.Span.from_ast(expr.args[0]))
+ 631 if not isinstance(target_ty, hir.TypeValue):
+ 632 raise hir.ParsingError(
+ 633 expr.args[0], f"expected type but got {target_ty}")
+ 634 if isinstance(value, ComptimeValue):
+ 635 value = self.try_convert_comptime_value(
+ 636 value, hir.Span.from_ast(expr.args[1]))
+ 637 if f is SPECIAL_FUNCTIONS_DICT['cast']:
+ 638 intrinsic_name = "cast"
+ 639 else:
+ 640 intrinsic_name = "bitcast"
+ 641 return self.cur_bb().append(hir.Intrinsic(intrinsic_name, [value], target_ty.inner_type(), hir.Span.from_ast(expr)))
+ 642 return do()
+ 643 elif f is SPECIAL_FUNCTIONS_DICT['comptime']:
+ 644 if len(expr.args) != 1:
+ 645 raise hir.ParsingError(
+ 646 expr, f"when used in expressions, lc.comptime function expects exactly one argument")
+ 647 arg = expr.args[0]
+ 648 # print(ast.dump(arg))
+ 649 if isinstance(arg, ast.Constant) and isinstance(arg.value, str):
+ 650 evaled = self.eval_expr(arg.value)
+ 651 else:
+ 652 evaled = self.eval_expr(arg)
+ 653 # print(evaled)
+ 654 v = self.convert_any_to_value(evaled, hir.Span.from_ast(expr))
+ 655 return v
+ 656 elif f is reveal_type:
+ 657 if len(expr.args) != 1:
+ 658 raise hir.ParsingError(
+ 659 expr, f"lc.reveal_type expects exactly one argument")
+ 660 arg = expr.args[0]
+ 661 cur_bb = self.cur_bb()
+ 662 cur_bb_len = len(cur_bb.nodes)
+ 663 value = self.parse_expr(arg)
+ 664 assert cur_bb is self.cur_bb()
+ 665 del self.cur_bb().nodes[cur_bb_len:]
+ 666 unparsed_arg = ast.unparse(arg)
+ 667 if isinstance(value, ComptimeValue):
+ 668 print(
+ 669 f"Type of {unparsed_arg} is ComptimeValue({type(value.value)})")
+ 670 else:
+ 671 print(f"Type of {unparsed_arg} is {value.type}")
+ 672 return hir.Unit()
+ 673 elif f is SPECIAL_FUNCTIONS_DICT['range']:
+ 674 def handle_range() -> hir.Value | ComptimeValue:
+ 675 if 1 <= len(expr.args) <= 3:
+ 676 args = [self.parse_expr(arg) for arg in expr.args]
+ 677 is_all_comptime = all(
+ 678 isinstance(arg, ComptimeValue) for arg in args)
+ 679 if is_all_comptime:
+ 680 try:
+ 681 comptime_args = cast(List[hir.ComptimeValue], args)
+ 682 return hir.ComptimeValue(range(*[arg.value for arg in comptime_args]), None)
+ 683 except Exception as e:
+ 684 raise hir.ParsingError(
+ 685 expr, f"error evaluating range: {e}") from e
+ 686 else:
+ 687 for i, arg in enumerate(args):
+ 688 if isinstance(arg, ComptimeValue):
+ 689 args[i] = self.try_convert_comptime_value(
+ 690 arg, hir.Span.from_ast(expr.args[i]))
+ 691 converted_args = cast(List[hir.Value], args)
+ 692
+ 693 def make_int(i: int) -> hir.Value:
+ 694 return hir.Constant(i, type=hir.GenericIntType())
+ 695 # TODO: check type consistency
+ 696 if len(args) == 1:
+ 697 return hir.Range(make_int(0), converted_args[0], make_int(1))
+ 698 elif len(args) == 2:
+ 699 return hir.Range(converted_args[0], converted_args[1], make_int(1))
+ 700 elif len(args) == 3:
+ 701 return hir.Range(converted_args[0], converted_args[1], converted_args[2])
+ 702 else:
+ 703 raise RuntimeError(
+ 704 f"Unsupported number of arguments for range function: {len(args)}")
+ 705 else:
+ 706 raise hir.ParsingError(
+ 707 expr, f"range function expects 1 to 3 arguments")
+ 708 return handle_range()
+ 709 else:
+ 710 raise RuntimeError(f"Unsupported special function {f}")
+ 711
+ 712 def parse_call_ref(self, expr: ast.Call) -> hir.Ref:
+ 713 func: hir.Ref | ComptimeValue | hir.TypeValue | hir.Value = self.parse_ref(
+ 714 expr.func)
+ 715 if isinstance(func, ComptimeValue):
+ 716 if func.value is not SPECIAL_FUNCTIONS_DICT['intrinsic']:
+ 717 raise hir.ParsingError(
+ 718 expr, f"expected intrinsic function but got {func}")
+ 719 intrin_ref = self.handle_intrinsic(expr, True)
+ 720 assert isinstance(intrin_ref, hir.Ref)
+ 721 return intrin_ref
+ 722
+ 723 span = hir.Span.from_ast(expr)
+ 724 if not isinstance(func, hir.FunctionValue):
+ 725 raise hir.ParsingError(
+ 726 expr, f"expected function but got {func}")
+ 727 raise NotImplementedError()
+ 728
+ 729 def parse_call(self, expr: ast.Call) -> hir.Value | ComptimeValue:
+ 730 func: hir.Ref | ComptimeValue | hir.TypeValue | hir.Value = self.parse_ref(
+ 731 expr.func) # TODO: this should be a parse_ref
+ 732 span = hir.Span.from_ast(expr)
+ 733
+ 734 if isinstance(func, ComptimeValue):
+ 735 if func.value in SPECIAL_FUNCTIONS:
+ 736 return self.handle_special_functions(func.value, expr)
+ 737 func = self.try_convert_comptime_value(
+ 738 func, hir.Span.from_ast(expr))
+ 739
+ 740 def collect_args() -> List[hir.Value | hir.Ref]:
+ 741 args = [self.parse_expr(arg) for arg in expr.args]
+ 742 for i, arg in enumerate(args):
+ 743 if isinstance(arg, ComptimeValue):
+ 744 args[i] = self.try_convert_comptime_value(
+ 745 arg, hir.Span.from_ast(expr.args[i]))
+ 746 return cast(List[hir.Value | hir.Ref], args)
+ 747
+ 748 if isinstance(func.type, hir.TypeConstructorType):
+ 749 # TypeConstructorType is unique for each type
+ 750 # so if any value has this type, it must be referring to the same underlying type
+ 751 # even if it comes from a very complex expression, it's still fine
+ 752 cls = func.type.inner
+ 753 assert cls
+ 754 if isinstance(cls, hir.ParametricType):
+ 755 raise hir.ParsingError(
+ 756 span, f"please provide type arguments for {cls.body}")
+ 757
+ 758 init = cls.method("__init__")
+ 759 tmp = self.cur_bb().append(hir.Alloca(cls, span))
+ 760 if init is None:
+ 761 raise hir.ParsingError(
+ 762 span, f"__init__ method not found for type {cls}")
+ 763 call = self.parse_call_impl(
+ 764 span, init, [tmp]+collect_args())
+ 765 if isinstance(call, hir.TemplateMatchingError):
+ 766 raise hir.ParsingError(expr, call.message)
+ 767 assert isinstance(call, hir.Call)
+ 768 return self.cur_bb().append(hir.Load(tmp))
+ 769 assert func.type
+ 770 if isinstance(func.type, hir.FunctionType):
+ 771 func_like = func.type.func_like
+ 772 bound_object = func.type.bound_object
+ 773 if bound_object is not None:
+ 774 ret = self.parse_call_impl(
+ 775 span, func_like, cast(List[hir.Ref | hir.Value], [bound_object]) + collect_args())
+ 776 else:
+ 777 ret = self.parse_call_impl(
+ 778 span, func_like, collect_args())
+ 779 if isinstance(ret, hir.TemplateMatchingError):
+ 780 raise hir.ParsingError(expr, ret.message)
+ 781 return ret
+ 782 else:
+ 783 # check if __call__ is defined
+ 784 if (method := func.type.method("__call__")) and method:
+ 785 ret = self.parse_call_impl(
+ 786 span, method, cast(List[hir.Ref | hir.Value], [func]) + collect_args())
+ 787 if isinstance(ret, hir.TemplateMatchingError):
+ 788 raise hir.ParsingError(expr, ret.message)
+ 789 return ret
+ 790 else:
+ 791 raise hir.ParsingError(
+ 792 expr, f"function call not supported for type {func.type}")
+ 793
+ 794 def parse_binop(self, expr: ast.BinOp | ast.Compare) -> hir.Value:
+ 795 binop_to_op_str: Dict[type, str] = {
+ 796 ast.Add: "+",
+ 797 ast.Sub: "-",
+ 798 ast.Mult: "*",
+ 799 ast.Div: "/",
+ 800 ast.FloorDiv: "//",
+ 801 ast.Mod: "%",
+ 802 ast.Pow: "**",
+ 803 ast.LShift: "<<",
+ 804 ast.RShift: ">>",
+ 805 ast.BitAnd: '&',
+ 806 ast.BitOr: '|',
+ 807 ast.BitXor: '^',
+ 808 ast.Eq: "==",
+ 809 ast.NotEq: "!=",
+ 810 ast.Lt: "<",
+ 811 ast.LtE: "<=",
+ 812 ast.Gt: ">",
+ 813 ast.GtE: ">=",
+ 814
+ 815 }
+ 816 op: ast.AST
+ 817 if isinstance(expr, ast.Compare):
+ 818 if len(expr.ops) != 1:
+ 819 raise hir.ParsingError(
+ 820 expr, "only one comparison operator is allowed")
+ 821 op = expr.ops[0]
+ 822 left = expr.left
+ 823 right = expr.comparators[0]
+ 824 else:
+ 825 op = expr.op
+ 826 left = expr.left
+ 827 right = expr.right
+ 828 op_str = binop_to_op_str[type(op)]
+ 829 lhs = self.parse_expr(left)
+ 830 if isinstance(lhs, ComptimeValue):
+ 831 lhs = self.try_convert_comptime_value(lhs, hir.Span.from_ast(expr))
+ 832 if not lhs.type:
+ 833 raise hir.ParsingError(
+ 834 left, f"unable to infer type of left operand of binary operation {op_str}")
+ 835 rhs = self.parse_expr(right)
+ 836 if isinstance(rhs, ComptimeValue):
+ 837 rhs = self.try_convert_comptime_value(rhs, hir.Span.from_ast(expr))
+ 838 if not rhs.type:
+ 839 raise hir.ParsingError(
+ 840 right, f"unable to infer type of right operand of binary operation {op_str}")
+ 841 ops = BINOP_TO_METHOD_NAMES[type(op)]
+ 842
+ 843 def infer_binop(name: str, rname: str) -> hir.Value:
+ 844 assert lhs.type and rhs.type
+ 845 matching_errors = []
+ 846 try:
+ 847 if (method := lhs.type.method(name)) and method:
+ 848 ret = self.parse_call_impl(
+ 849 hir.Span.from_ast(expr), method, [lhs, rhs])
+ 850 if isinstance(ret, hir.TemplateMatchingError):
+ 851 matching_errors.append(ret)
+ 852 else:
+ 853 return ret
+ 854 if (method := rhs.type.method(rname)) and method:
+ 855 ret = self.parse_call_impl(
+ 856 hir.Span.from_ast(expr), method, [rhs, lhs])
+ 857 if isinstance(ret, hir.TemplateMatchingError):
+ 858 matching_errors.append(ret)
+ 859 else:
+ 860 return ret
+ 861 raise hir.ParsingError(
+ 862 expr, f"Operator {op_str} not defined for types {lhs.type} and {rhs.type}")
+ 863 except hir.TypeInferenceError as e:
+ 864 e.span = hir.Span.from_ast(expr)
+ 865 raise e from e
+ 866 return infer_binop(ops[0], ops[1])
+ 867
+ 868 def parse_ref(self, expr: ast.expr, new_var_hint: NewVarHint = False) -> hir.Ref | ComptimeValue | hir.TypeValue | hir.FunctionValue:
+ 869 match expr:
+ 870 case ast.Name():
+ 871 ret = self.parse_name(expr, new_var_hint)
+ 872 if isinstance(ret, (hir.Value)):
+ 873 if isinstance(ret.type, hir.TypeConstructorType):
+ 874 assert isinstance(ret, hir.TypeValue)
+ 875 return ret
+ 876 if isinstance(ret.type, hir.FunctionType):
+ 877 return hir.FunctionValue(ret.type, hir.Span.from_ast(expr))
+ 878 # raise hir.ParsingError(
+ 879 # expr, f"{type(ret)} cannot be used as reference")
+ 880 assert ret.type
+ 881 tmp = self.cur_bb().append(hir.Alloca(ret.type, hir.Span.from_ast(expr)))
+ 882 self.cur_bb().append(hir.Assign(tmp, ret))
+ 883 return tmp
+ 884 return ret
+ 885 case ast.Subscript() | ast.Attribute():
+ 886 return self.parse_access_ref(expr)
+ 887 case ast.Call() as call:
+ 888 return self.parse_call_ref(call)
+ 889 # if call.func is SPECIAL_FUNCTIONS_DICT['intrinsic']:
+ 890 # return self.handle_special_functions(
+ 891 # call.func, call)
+ 892 # return self.parse_call_impl_ref(hir.Span.from_ast(expr), self.parse_ref(call.func), [self.parse_expr(arg) for arg in call.args])
+ 893 case _:
+ 894 raise hir.ParsingError(
+ 895 expr, f"expression {ast.dump(expr)} cannot be parsed as reference")
+ 896
+ 897 def parse_multi_assignment(self,
+ 898 targets: List[ast.expr],
+ 899 anno_ty_fn: List[Optional[Callable[..., hir.Type | None]]],
+ 900 values: hir.Value | ComptimeValue) -> None:
+ 901 if isinstance(values, ComptimeValue):
+ 902 parsed_targets = [self.parse_ref(t, 'comptime') for t in targets]
+ 903 for i in range(len(parsed_targets)):
+ 904 if isinstance(parsed_targets[i], hir.TypeValue):
+ 905 raise hir.ParsingError(
+ 906 targets[i], "types cannot be reassigned")
+ 907
+ 908 def do_assign(target: hir.Ref | ComptimeValue, value: ComptimeValue, i: int) -> None:
+ 909 span = hir.Span.from_ast(targets[i])
+ 910 if isinstance(target, ComptimeValue):
+ 911 target.update(value.value)
+ 912 else:
+ 913 self.cur_bb().append(hir.Assign(target,
+ 914 self.try_convert_comptime_value(value, span)))
+ 915 if len(parsed_targets) > 1:
+ 916 if len(parsed_targets) != len(values.value):
+ 917 raise hir.ParsingError(
+ 918 targets[0], f"expected {len(parsed_targets)} values to unpack, got {len(values.value)}")
+ 919 for i, t in enumerate(parsed_targets):
+ 920 assert isinstance(t, (hir.Ref, ComptimeValue))
+ 921 do_assign(t, values.value[i],
+ 922 i)
+ 923 else:
+ 924 t = parsed_targets[0]
+ 925 assert isinstance(t, (hir.Ref, ComptimeValue))
+ 926 do_assign(t, values, 0)
+ 927 else:
+ 928 parsed_targets = [self.parse_ref(t, 'dsl') for t in targets]
+ 929 is_all_dsl = all(
+ 930 isinstance(t, hir.Ref) for t in parsed_targets)
+ 931 if not is_all_dsl:
+ 932 raise hir.ParsingError(
+ 933 targets[0], "DSL value cannot be assigned to comptime variables")
+ 934 assert values.type
+ 935 ref_targets = cast(List[hir.Ref], parsed_targets)
+ 936
+ 937 def do_unpack(length: int, extract_fn: Callable[[hir.Value, int, ast.expr], hir.Value]) -> None:
+ 938 def check(i: int, val_type: hir.Type) -> None:
+ 939 if len(anno_ty_fn) > 0 and (fn := anno_ty_fn[i]) is not None:
+ 940 ty = fn()
+ 941 if ty is None:
+ 942 raise hir.ParsingError(
+ 943 targets[i], f"unable to infer type of target")
+ 944 if ref_targets[i].type is None:
+ 945 ref_targets[i].type = ty
+ 946 tt = ref_targets[i].type
+ 947 if isinstance(val_type, hir.FunctionType) and val_type.bound_object is not None:
+ 948 raise hir.TypeInferenceError(
+ 949 targets[i], f"bounded method cannot be assigned to variable")
+ 950 if not tt:
+ 951 if val_type.is_concrete():
+ 952 ref_targets[i].type = val_type
+ 953 else:
+ 954 raise hir.TypeInferenceError(
+ 955 targets[i], f"unable to infer type of target, cannot assign with non-concrete type {val_type}")
+ 956 elif not hir.is_type_compatible_to(val_type, tt):
+ 957 raise hir.ParsingError(
+ 958 targets[i], f"expected type {tt}, got {val_type}")
+ 959
+ 960 if len(ref_targets) == 1:
+ 961 assert values.type
+ 962 check(0, values.type)
+ 963 if not isinstance(values.type, (hir.FunctionType, hir.TypeConstructorType)):
+ 964 self.cur_bb().append(hir.Assign(
+ 965 ref_targets[0], values))
+ 966 elif len(ref_targets) == length:
+ 967 for i, t in enumerate(ref_targets):
+ 968 e = extract_fn(values, i, targets[i])
+ 969 assert e.type
+ 970 check(i, e.type)
+ 971 if not isinstance(e.type, (hir.FunctionType, hir.TypeConstructorType)):
+ 972 self.cur_bb().append(hir.Assign(t, e))
+ 973 else:
+ 974 if len(ref_targets) > length:
+ 975 raise hir.ParsingError(
+ 976 targets[0], f"too few values to unpack: expected {len(ref_targets)} values, got {length}")
+ 977 else:
+ 978 raise hir.ParsingError(
+ 979 targets[0], f"too many values to unpack: expected {len(ref_targets)} values, got {length}")
+ 980 match values.type:
+ 981 case hir.VectorType() as vt:
+ 982 comps = 'xyzw'
+ 983 do_unpack(vt.count, lambda values, i, target: self.cur_bb().append(
+ 984 hir.Member(values, comps[i], type=vt.element, span=hir.Span.from_ast(target))))
+ 985 case hir.TupleType() as tt:
+ 986 do_unpack(len(tt.elements), lambda values, i, target: self.cur_bb().append(
+ 987 hir.Member(values, f'_{i}', type=tt.elements[i], span=hir.Span.from_ast(target)))
+ 988 )
+ 989 case hir.ArrayType() as at:
+ 990 assert isinstance(at.count, int)
+ 991 do_unpack(at.count, lambda values, i, target: self.cur_bb().append(
+ 992 hir.Index(values, hir.Constant(i, type=luisa_lang.typeof(luisa_lang.i32)), type=at.element, span=hir.Span.from_ast(target))))
+ 993 case hir.StructType() as st:
+ 994 do_unpack(len(st.fields), lambda values, i, target: self.cur_bb().append(
+ 995 hir.Member(values, st.fields[i][0], type=st.fields[i][1], span=hir.Span.from_ast(target)))
+ 996 )
+ 997 case _:
+ 998 if len(ref_targets) == 1:
+ 999 do_unpack(1, lambda values, i, target: exit(-1))
+1000 else:
+1001 raise hir.ParsingError(
+1002 targets[0], f"unsupported type for unpacking: {values.type}")
+1003
+1004 def parse_unary(self, expr: ast.UnaryOp) -> hir.Value:
+1005 op = expr.op
+1006 if type(op) not in UNARY_OP_TO_METHOD_NAMES:
+1007 raise hir.ParsingError(
+1008 expr, f"unsupported unary operator {type(op)}")
+1009 op_str = UNARY_OP_TO_METHOD_NAMES[type(op)]
+1010 operand = self.parse_expr(expr.operand)
+1011 if isinstance(operand, ComptimeValue):
+1012 operand = self.try_convert_comptime_value(
+1013 operand, hir.Span.from_ast(expr))
+1014 if not operand.type:
+1015 raise hir.ParsingError(
+1016 expr.operand, f"unable to infer type of operand of unary operation {op_str}")
+1017 method_name = UNARY_OP_TO_METHOD_NAMES[type(op)]
+1018 if (method := operand.type.method(method_name)) and method:
+1019 ret = self.parse_call_impl(
+1020 hir.Span.from_ast(expr), method, [operand])
+1021 if isinstance(ret, hir.TemplateMatchingError):
+1022 raise hir.ParsingError(expr, ret.message)
+1023 return ret
+1024 else:
+1025 raise hir.ParsingError(
+1026 expr, f"operator {type(op)} not defined for type {operand.type}")
+1027
+1028 def parse_expr(self, expr: ast.expr) -> hir.Value | ComptimeValue:
+1029 match expr:
+1030 case ast.Constant():
+1031 return self.parse_const(expr)
+1032 case ast.Name():
+1033 ret = self.parse_name(expr, False)
+1034 if isinstance(ret, hir.Ref):
+1035 ret = self.convert_to_value(ret, hir.Span.from_ast(expr))
+1036 return ret
+1037 case ast.Subscript() | ast.Attribute():
+1038 return self.convert_to_value(self.parse_access_ref(expr), hir.Span.from_ast(expr))
+1039 case ast.BinOp() | ast.Compare():
+1040 return self.parse_binop(expr)
+1041 case ast.UnaryOp():
+1042 return self.parse_unary(expr)
+1043 case ast.Call():
+1044 return self.parse_call(expr)
+1045 case ast.Tuple():
+1046 elements = [self.parse_expr(e) for e in expr.elts]
+1047 is_all_comptime = all(
+1048 isinstance(e, ComptimeValue) for e in elements)
+1049 if is_all_comptime:
+1050 return hir.ComptimeValue(
+1051 tuple(e.value for e in cast(List[ComptimeValue], elements)), None)
+1052 else:
+1053 for i, e in enumerate(elements):
+1054 if isinstance(e, ComptimeValue):
+1055 elements[i] = self.try_convert_comptime_value(
+1056 e, hir.Span.from_ast(expr.elts[i]))
+1057 tt: hir.TupleType = hir.TupleType(
+1058 [unwrap(e.type) for e in cast(List[hir.Value], elements)])
+1059 return self.cur_bb().append(hir.AggregateInit(cast(List[hir.Value], elements), tt, span=hir.Span.from_ast(expr)))
+1060 case _:
+1061 raise RuntimeError(f"Unsupported expression: {ast.dump(expr)}")
+1062
+1063 def eval_expr(self, tree: str | ast.Expression | ast.expr): # -> Any:
+1064 if isinstance(tree, ast.expr):
+1065 tree = ast.Expression(tree)
+1066 # print(tree)
+1067 code_object = compile(tree, "<string>", "eval")
+1068 localns = {}
+1069 for name, v in self.vars.items():
+1070 if isinstance(v, ComptimeValue):
+1071 localns[name] = v.value
+1072 return eval(code_object, self.globalns, localns)
+1073
+1074 def convert_to_value(self, value: hir.Value | hir.Ref | ComptimeValue, span: Optional[hir.Span] = None) -> hir.Value:
+1075 if isinstance(value, ComptimeValue):
+1076 value = self.try_convert_comptime_value(value, span)
+1077 if isinstance(value, hir.Ref):
+1078 value = hir.Load(value)
+1079 self.cur_bb().append(value)
+1080 return value
+1081
+1082 def parse_stmt(self, stmt: ast.stmt) -> None:
+1083 span = hir.Span.from_ast(stmt)
+1084 match stmt:
+1085 case ast.If():
+1086 cond = self.parse_expr(stmt.test)
+1087 pred_bb = self.cur_bb()
+1088 self.bb_stack.pop()
+1089 if isinstance(cond, ComptimeValue):
+1090 if cond.value:
+1091 for s in stmt.body:
+1092 self.parse_stmt(s)
+1093 elif stmt.orelse:
+1094 for s in stmt.orelse:
+1095 self.parse_stmt(s)
+1096 else:
+1097 merge = hir.BasicBlock(span)
+1098 self.bb_stack.append(hir.BasicBlock(span))
+1099 for s in stmt.body:
+1100 self.parse_stmt(s)
+1101 body = self.bb_stack.pop()
+1102 if stmt.orelse:
+1103 self.bb_stack.append(hir.BasicBlock(span))
+1104 for s in stmt.orelse:
+1105 self.parse_stmt(s)
+1106 orelse = self.bb_stack.pop()
+1107 else:
+1108 orelse = None
+1109 pred_bb.append(hir.If(cond, body, orelse, merge, span))
+1110 self.bb_stack.append(merge)
+1111 case ast.While():
+1112 pred_bb = self.cur_bb()
+1113 self.bb_stack.pop()
+1114 prepare = hir.BasicBlock(span)
+1115 self.bb_stack.append(prepare)
+1116 cond = self.parse_expr(stmt.test)
+1117 self.bb_stack.pop()
+1118 if isinstance(cond, ComptimeValue):
+1119 raise hir.ParsingError(
+1120 stmt, "while loop condition must not be a comptime value")
+1121 body = hir.BasicBlock(span)
+1122 self.bb_stack.append(body)
+1123 old_break_and_continues = self.break_and_continues
+1124 self.break_and_continues = []
+1125 for s in stmt.body:
+1126 self.parse_stmt(s)
+1127 break_and_continues = self.break_and_continues
+1128 self.break_and_continues = old_break_and_continues
+1129 body = self.bb_stack.pop()
+1130 update = hir.BasicBlock(span)
+1131 merge = hir.BasicBlock(span)
+1132 loop_node = hir.Loop(prepare, cond, body, update, merge, span)
+1133 pred_bb.append(loop_node)
+1134 for bc in break_and_continues:
+1135 bc.target = loop_node
+1136 self.bb_stack.append(merge)
+1137 case ast.For():
+1138 iter_val = self.parse_expr(stmt.iter)
+1139 if not isinstance(iter_val, hir.Value) or not isinstance(iter_val, hir.Range):
+1140 raise hir.ParsingError(
+1141 stmt, f"for loop iterable must be a range object but found {iter_val}")
+1142 loop_range: hir.Range = iter_val
+1143 pred_bb = self.cur_bb()
+1144 self.bb_stack.pop()
+1145 loop_var = self.parse_ref(stmt.target, new_var_hint='dsl')
+1146 if not isinstance(loop_var, hir.Ref):
+1147 raise hir.ParsingError(
+1148 stmt, "for loop target must be a DSL variable")
+1149 if not loop_var.type:
+1150 loop_ty = loop_range.value_type()
+1151 if not isinstance(loop_ty, hir.GenericIntType):
+1152 loop_var.type = loop_ty
+1153 else:
+1154 loop_var.type = luisa_lang.typeof(luisa_lang.i32)
+1155 if not isinstance(loop_var.type, hir.IntType):
+1156 raise hir.ParsingError(
+1157 stmt, "for loop target must be an integer variable")
+1158
+1159 prepare = hir.BasicBlock(span)
+1160 self.bb_stack.append(prepare)
+1161 int_lt = loop_var.type.method("__lt__")
+1162 assert int_lt is not None
+1163 cmp_result = self.parse_call_impl(
+1164 span, int_lt, [loop_var, loop_range.stop])
+1165 assert isinstance(cmp_result, hir.Value)
+1166 assert cmp_result.type == hir.BoolType()
+1167 self.bb_stack.pop()
+1168 body = hir.BasicBlock(span)
+1169 self.bb_stack.append(body)
+1170 old_break_and_continues = self.break_and_continues
+1171 self.break_and_continues = []
+1172 for s in stmt.body:
+1173 self.parse_stmt(s)
+1174 body = self.bb_stack.pop()
+1175 break_and_continues = self.break_and_continues
+1176 self.break_and_continues = old_break_and_continues
+1177 update = hir.BasicBlock(span)
+1178 self.bb_stack.append(update)
+1179 inc = loop_range.step
+1180 int_add = loop_var.type.method("__add__")
+1181 assert int_add is not None
+1182 add = self.parse_call_impl(
+1183 span, int_add, [loop_var, inc])
+1184 assert isinstance(add, hir.Value)
+1185 self.cur_bb().append(hir.Assign(loop_var, add))
+1186 self.bb_stack.pop()
+1187 merge = hir.BasicBlock(span)
+1188 loop_node = hir.Loop(prepare, cmp_result,
+1189 body, update, merge, span)
+1190 pred_bb.append(loop_node)
+1191 for bc in break_and_continues:
+1192 bc.target = loop_node
+1193 self.bb_stack.append(merge)
+1194 case ast.Break():
+1195 if self.break_and_continues is None:
+1196 raise hir.ParsingError(
+1197 stmt, "break statement must be inside a loop")
+1198 self.cur_bb().append(hir.Break(None, span))
+1199 case ast.Continue():
+1200 if self.break_and_continues is None:
+1201 raise hir.ParsingError(
+1202 stmt, "continue statement must be inside a loop")
+1203 self.cur_bb().append(hir.Continue(None, span))
+1204 case ast.Return():
+1205 def check_return_type(ty: hir.Type) -> None:
+1206 assert self.parsed_func
+1207 if self.parsed_func.return_type is None:
+1208 self.parsed_func.return_type = ty
+1209 else:
+1210 if not hir.is_type_compatible_to(ty, self.parsed_func.return_type):
+1211 raise hir.ParsingError(
+1212 stmt, f"return type mismatch: expected {self.parsed_func.return_type}, got {ty}")
+1213 if self.returning_ref:
+1214 def do():
+1215 if not stmt.value:
+1216 raise hir.ParsingError(
+1217 stmt, "if a function is returning local references, the return value must be provided")
+1218 value = self.parse_ref(stmt.value)
+1219 if not isinstance(value, hir.Ref):
+1220 raise hir.ParsingError(
+1221 stmt, "invalid return target")
+1222 assert value.type
+1223 check_return_type(value.type)
+1224 self.cur_bb().append(hir.ReturnRef(value))
+1225 do()
+1226 else:
+1227 def do():
+1228 if stmt.value:
+1229 value = self.parse_expr(stmt.value)
+1230 value = self.convert_to_value(value, span)
+1231 assert value.type is not None
+1232 check_return_type(value.type)
+1233 self.cur_bb().append(hir.Return(value))
+1234 else:
+1235 check_return_type(hir.UnitType())
+1236 self.cur_bb().append(hir.Return(None))
+1237 do()
+1238 case ast.Assign():
+1239 assert len(stmt.targets) == 1
+1240 target = stmt.targets[0]
+1241 if isinstance(target, ast.Tuple):
+1242 self.parse_multi_assignment(
+1243 target.elts, [], self.parse_expr(stmt.value))
+1244 else:
+1245 self.parse_multi_assignment(
+1246 [target], [], self.parse_expr(stmt.value)
+1247 )
+1248 case ast.AugAssign():
+1249 method_name = AUG_ASSIGN_TO_METHOD_NAMES[type(stmt.op)]
+1250 var = self.parse_ref(stmt.target)
+1251 value = self.parse_expr(stmt.value)
+1252 if isinstance(var, ComptimeValue):
+1253 if not isinstance(value, ComptimeValue):
+1254 raise hir.ParsingError(
+1255 stmt, f"comptime value cannot be assigned with DSL value")
+1256 comptime_method = getattr(var.value, method_name, None)
+1257 if comptime_method is None:
+1258 raise hir.ParsingError(
+1259 stmt, f"comptime value of type {type(var.value)} does not support {method_name}")
+1260 var.update(comptime_method(value.value))
+1261 return None
+1262 value = self.convert_to_value(value, span)
+1263 assert value.type
+1264 assert var.type
+1265 method = var.type.method(method_name)
+1266 if not method:
+1267 raise hir.ParsingError(
+1268 stmt, f"operator {method_name} not defined for type {var.type}")
+1269 ret = self.parse_call_impl(
+1270 span, method, [var, value])
+1271 if isinstance(ret, hir.TemplateMatchingError):
+1272 raise hir.ParsingError(stmt, ret.message)
+1273
+1274 case ast.AnnAssign():
+1275 def parse_anno_ty() -> hir.Type:
+1276 type_annotation = self.eval_expr(stmt.annotation)
+1277 type_hint = classinfo.parse_type_hint(type_annotation)
+1278 ty = self.parse_type(type_hint)
+1279 assert ty
+1280 return ty
+1281
+1282 if stmt.value:
+1283 self.parse_multi_assignment(
+1284 [stmt.target], [parse_anno_ty], self.parse_expr(stmt.value))
+1285 else:
+1286 var = self.parse_ref(stmt.target, new_var_hint='dsl')
+1287 anno_ty = parse_anno_ty()
+1288 assert isinstance(var, hir.Var)
+1289 if not var.type:
+1290 var.type = anno_ty
+1291 else:
+1292 if not hir.is_type_compatible_to(var.type, anno_ty):
+1293 raise hir.ParsingError(
+1294 stmt, f"expected {anno_ty}, got {var.type}")
+1295 case ast.Expr():
+1296 # ignore comments
+1297 if isinstance(stmt.value, ast.Constant) and isinstance(stmt.value.value, str):
+1298 return
+1299 self.parse_expr(stmt.value)
+1300 case ast.Pass():
+1301 return
+1302 case _:
+1303 raise RuntimeError(f"Unsupported statement: {ast.dump(stmt)}")
+1304
+1305 def parse_body(self):
+1306 assert self.parsed_func is not None
+1307 body = self.func_def.body
+1308 entry = hir.BasicBlock(hir.Span.from_ast(self.func_def))
+1309 self.bb_stack.append(entry)
+1310 for stmt in body:
+1311 self.parse_stmt(stmt)
+1312 assert len(self.bb_stack) == 1
+1313 self.parsed_func.body = entry
+1314 self.parsed_func.locals = list(
+1315 [x for x in self.vars.values() if isinstance(x, hir.Var)])
+1316 if not self.parsed_func.return_type:
+1317 self.parsed_func.return_type = hir.UnitType()
+1318 self.parsed_func.complete = True
+1319 return self.parsed_func
+
240 def __init__(self, name: str,
+241 func: object,
+242 signature: hir.FunctionSignature,
+243 globalns: Dict[str, Any],
+244 type_var_ns: Dict[typing.TypeVar, hir.Type],
+245 self_type: Optional[Type],
+246 return_ref: bool
+247 ) -> None:
+248 self.type_parser = TypeParser(
+249 name, globalns, type_var_ns, self_type, 'instantiate')
+250 self.name = name
+251 self.func = func
+252 self.signature = signature
+253 self.globalns = copy(globalns)
+254 self.returning_ref = return_ref
+255 obj_ast, _obj_file = retrieve_ast_and_filename(func)
+256 # print(ast.dump(obj_ast))
+257 assert isinstance(obj_ast, ast.Module), f"{obj_ast} is not a module"
+258 if not isinstance(obj_ast.body[0], ast.FunctionDef):
+259 raise RuntimeError("Function definition expected.")
+260 self.func_def = obj_ast.body[0]
+261 self.vars = {}
+262 self.parsed_func = hir.Function(
+263 name, [], None, self_type is not None, return_ref)
+264 self.type_var_ns = type_var_ns
+265 self.bb_stack = []
+266 self.break_and_continues = None
+267 self.parsed_func.params = signature.params
+268 for p in self.parsed_func.params:
+269 self.vars[p.name] = p
+270 self.parsed_func.return_type = signature.return_type
+
282 def convert_constexpr(self, comptime_val: ComptimeValue, span: Optional[hir.Span] = None) -> Optional[hir.Value]:
+283 value = comptime_val.value
+284 if isinstance(value, int):
+285 return hir.Constant(value, type=hir.GenericIntType())
+286 elif isinstance(value, float):
+287 return hir.Constant(value, type=hir.GenericFloatType())
+288 elif isinstance(value, bool):
+289 return hir.Constant(value, type=hir.BoolType())
+290 elif isinstance(value, FunctionType):
+291 dsl_func = get_dsl_func(value)
+292 if dsl_func is None:
+293 raise hir.ParsingError(
+294 span, f"expected DSL function but got {value}")
+295 if dsl_func.is_generic:
+296 return hir.FunctionValue(hir.FunctionType(dsl_func, None), span=span)
+297 else:
+298 resolved_f = dsl_func.resolve(None)
+299 assert not isinstance(
+300 resolved_f, hir.TemplateMatchingError)
+301 return hir.FunctionValue(hir.FunctionType(resolved_f, None), span=span)
+302 # return hir.FunctionValue(resolved_f, None, span)
+303 elif isinstance(value, type):
+304 dsl_type = get_dsl_type(value)
+305 if dsl_type is None:
+306 raise hir.ParsingError(
+307 span, _friendly_error_message_for_unrecognized_type(value))
+308
+309 return hir.TypeValue(dsl_type)
+310 return None
+
312 def parse_const(self, const: ast.Constant) -> hir.Value:
+313 span = hir.Span.from_ast(const)
+314 value = const.value
+315 if isinstance(value, (int, float, bool)):
+316 cst = hir.Constant(value, type=None, span=span)
+317 match value:
+318 case int():
+319 cst.type = hir.GenericIntType()
+320 case float():
+321 cst.type = hir.GenericFloatType()
+322 case bool():
+323 cst.type = hir.BoolType()
+324 return cst
+325 raise hir.ParsingError(
+326 const, f"unsupported constant type {type(value)}, wrap it in lc.comptime(...) if you intead to use it as a compile-time expression")
+
328 def convert_any_to_value(self, a: Any, span: hir.Span | None) -> hir.Value | ComptimeValue:
+329 if isinstance(a, typing.TypeVar):
+330 if a in self.type_var_ns:
+331 v = self.type_var_ns[a]
+332 if isinstance(v, hir.Type):
+333 return hir.TypeValue(v)
+334 return self.convert_any_to_value(v, span)
+335 if not isinstance(a, ComptimeValue):
+336 a = ComptimeValue(a, None)
+337 if a.value in SPECIAL_FUNCTIONS:
+338 return a
+339 if (converted := self.convert_constexpr(a, span)) is not None:
+340 return converted
+341 if is_valid_comptime_value_in_dsl_code(a.value):
+342 return a
+343 raise hir.ParsingError(
+344 span, f"unsupported constant type {type(a.value)}, wrap it in lc.comptime(...) if you intead to use it as a compile-time expression")
+
346 def parse_name(self, name: ast.Name, new_var_hint: NewVarHint) -> hir.Ref | hir.Value | ComptimeValue:
+347 span = hir.Span.from_ast(name)
+348 var = self.vars.get(name.id)
+349 # print(__builtins__)
+350 # print('range' in __builtins__)
+351 # assert hasattr(__builtins__, 'range')
+352 if var is not None:
+353 return var
+354 if new_var_hint == 'dsl':
+355 var = hir.Var(name.id, None, span)
+356 self.vars[name.id] = var
+357 return var
+358 else:
+359 # look up in global namespace
+360 if name.id in self.globalns:
+361 resolved = self.globalns[name.id]
+362 return self.convert_any_to_value(resolved, span)
+363 elif name.id in __builtins__: # type: ignore
+364 resolved = __builtins__[name.id] # type: ignore
+365 return self.convert_any_to_value(resolved, span)
+366 elif new_var_hint == 'comptime':
+367 self.globalns[name.id] = None
+368
+369 def update_fn(value: Any) -> None:
+370 self.globalns[name.id] = value
+371 return ComptimeValue(None, update_fn)
+372
+373 raise hir.ParsingError(name, f"unknown variable {name.id}")
+
375 def try_convert_comptime_value(self, value: ComptimeValue, span: hir.Span | None = None) -> hir.Value:
+376 if (cst := self.convert_constexpr(value)) is not None:
+377 return cst
+378 raise hir.ParsingError(
+379 span, f"unsupported constant type {type(value.value)}, wrap it in lc.comptime(...) if you intead to use it as a compile-time expression")
+
381 def get_index_type(self, span: Optional[hir.Span], base: hir.Type, index: hir.Value) -> Optional[hir.Type]:
+382 if isinstance(base, hir.TupleType):
+383 if isinstance(index, hir.Constant):
+384 if not isinstance(index.value, int):
+385 raise hir.ParsingError(
+386 span, f"expected integer index, got {type(index.value)}: {index.value}")
+387 if index.value < 0 or index.value >= len(base.elements):
+388 raise hir.ParsingError(
+389 span, f"index out of range: {index.value} not in [0, {len(base.elements)})")
+390 return base.elements[index.value]
+391 else:
+392 raise hir.ParsingError(
+393 span, f"dynamically indexed tuple is not supported")
+394 else:
+395 ty = base.member(hir.DynamicIndex())
+396 return ty
+
398 def parse_access_ref(self, expr: ast.Subscript | ast.Attribute) -> hir.Ref | hir.TypeValue | hir.FunctionValue | ComptimeValue:
+399 span = hir.Span.from_ast(expr)
+400 if isinstance(expr, ast.Subscript):
+401 value = self.parse_ref(expr.value)
+402 if isinstance(value, ComptimeValue):
+403 raise hir.ParsingError(
+404 expr, "attempt to access comptime value in DSL code; wrap it in lc.comptime(...) if you intead to use it as a compile-time expression")
+405 if isinstance(value, hir.TypeValue):
+406 type_args: List[hir.Type] = []
+407
+408 def parse_type_arg(expr: ast.expr) -> hir.Type:
+409 type_annotation = self.eval_expr(expr)
+410 type_hint = classinfo.parse_type_hint(type_annotation)
+411 ty = self.parse_type(type_hint)
+412 assert ty
+413 return ty
+414
+415 match expr.slice:
+416 case ast.Tuple():
+417 for e in expr.slice.elts:
+418 type_args.append(parse_type_arg(e))
+419 case _:
+420 type_args.append(parse_type_arg(expr.slice))
+421 # print(f"Type args: {type_args}")
+422 assert isinstance(value.type, hir.TypeConstructorType) and isinstance(
+423 value.type.inner, hir.ParametricType)
+424 return hir.TypeValue(
+425 hir.BoundType(value.type.inner, type_args, value.type.inner.instantiate(type_args)))
+426 index = self.parse_expr(expr.slice)
+427 assert isinstance(value, hir.Ref) and isinstance(index, hir.Value)
+428 index = self.convert_to_value(index, span)
+429 assert value.type
+430 index_ty = self.get_index_type(span, value.type, index)
+431 if index_ty is not None:
+432 return self.cur_bb().append(hir.IndexRef(value, index, type=index_ty, span=span))
+433 else:
+434 # check __getitem__
+435 if (method := value.type.method("__getitem__")) and method:
+436 try:
+437 ret = self.parse_call_impl_ref(
+438 span, method, [value, index])
+439 except hir.InlineError as e:
+440 raise hir.InlineError(
+441 expr, f"error during inlining of __getitem__, note that __getitem__ must be inlineable {e}") from e
+442 if isinstance(ret, hir.TemplateMatchingError):
+443 raise hir.TypeInferenceError(
+444 expr, f"error calling __getitem__: {ret.message}")
+445 return ret
+446 else:
+447 raise hir.TypeInferenceError(
+448 expr, f"indexing not supported for type {value.type}")
+449 elif isinstance(expr, ast.Attribute):
+450 def do(expr: ast.Attribute):
+451 value: hir.Ref | hir.Value | hir.ComptimeValue = self.parse_ref(
+452 expr.value)
+453 if isinstance(value, ComptimeValue):
+454 if isinstance(value.value, ModuleType):
+455 resolved = getattr(value.value, expr.attr)
+456 return ComptimeValue(resolved, None)
+457 value = self.try_convert_comptime_value(value, span)
+458 if isinstance(value, hir.Ref):
+459 attr_name = expr.attr
+460 assert value.type
+461 member_ty = value.type.member(attr_name)
+462 if not member_ty:
+463 raise hir.ParsingError(
+464 expr, f"member {attr_name} not found in type {value.type}")
+465 if isinstance(member_ty, hir.FunctionType):
+466 if not isinstance(value, hir.TypeValue):
+467 member_ty.bound_object = value
+468 return hir.FunctionValue(member_ty)
+469 return self.cur_bb().append(hir.MemberRef(value, attr_name, type=member_ty, span=span))
+470 elif isinstance(value, hir.TypeValue):
+471 member_ty = value.inner_type().member(expr.attr)
+472 if not member_ty:
+473 raise hir.ParsingError(
+474 expr, f"member {expr.attr} not found in type {value.inner_type()}")
+475 if isinstance(member_ty, hir.FunctionType):
+476 return hir.FunctionValue(member_ty)
+477 else:
+478 raise hir.ParsingError(
+479 expr, f"member {expr.attr} is not a function")
+480 elif isinstance(value, hir.FunctionValue):
+481 raise hir.ParsingError(
+482 expr, "function value has no attributes")
+483 else:
+484 raise hir.ParsingError(
+485 expr, f"unsupported value type {type(value)}")
+486 return do(expr)
+487 # print(type(expr), type(expr) is ast.Attribute)
+488 raise NotImplementedError() # unreachable
+
490 def parse_call_impl(self, span: hir.Span | None, f: hir.Function | hir.FunctionTemplate, args: List[hir.Value | hir.Ref], inline=False) -> hir.Value | hir.TemplateMatchingError:
+491 ret = self.parse_call_impl_ex(span, f, args, inline)
+492 if isinstance(ret, hir.Ref):
+493 raise hir.ParsingError(
+494 span, f"expected value but got reference")
+495 return ret
+
497 def parse_call_impl_ref(self, span: hir.Span | None, f: hir.Function | hir.FunctionTemplate, args: List[hir.Value | hir.Ref]) -> hir.Ref | hir.TemplateMatchingError:
+498 ret = self.parse_call_impl_ex(span, f, args, True, True)
+499 if isinstance(ret, hir.Value):
+500 raise hir.ParsingError(
+501 span, f"expected reference but got value")
+502 return ret
+
504 def parse_call_impl_ex(self, span: hir.Span | None, f: hir.Function | hir.FunctionTemplate, args: List[hir.Value | hir.Ref], inline=False, expect_ref=False) -> hir.Value | hir.Ref | hir.TemplateMatchingError:
+505 if expect_ref:
+506 if not inline:
+507 raise hir.ParsingError(
+508 span, "a function returning local reference must be inlined")
+509 if isinstance(f, hir.FunctionTemplate):
+510 if f.is_generic:
+511 template_resolve_args: hir.FunctionTemplateResolvingArgs = []
+512 template_params = f.params
+513 if len(template_params) != len(args):
+514 return hir.TemplateMatchingError(
+515 span,
+516 f"Expected {len(template_params)} arguments, got {len(args)}")
+517 for i, (param, arg) in enumerate(zip(template_params, args)):
+518 if arg.type is None:
+519 raise hir.TypeInferenceError(
+520 span, f"failed to infer type of argument {i}")
+521 template_resolve_args.append((param, arg.type))
+522 try:
+523 resolved_f = f.resolve(template_resolve_args)
+524 if isinstance(resolved_f, hir.TemplateMatchingError):
+525 return resolved_f
+526 except hir.TypeInferenceError as e:
+527 if e.span is None:
+528 e.span = span
+529 raise e from e
+530 else:
+531 resolved_f = f.resolve(None)
+532 assert not isinstance(resolved_f, hir.TemplateMatchingError)
+533 else:
+534 resolved_f = f
+535 if expect_ref and not resolved_f.returning_ref:
+536 raise hir.ParsingError(
+537 span, "expected a function returning local reference but got a function returning value")
+538 param_tys = []
+539 for p in resolved_f.params:
+540 assert p.type, f"Parameter {p.name} has no type"
+541 param_tys.append(p.type)
+542 if len(param_tys) != len(args):
+543 raise hir.TypeInferenceError(
+544 span,
+545 f"Expected {len(param_tys)} arguments, got {len(args)}"
+546 )
+547 for i, (param_ty, arg) in enumerate(zip(param_tys, args)):
+548 assert arg.type is not None
+549 if not hir.is_type_compatible_to(arg.type, param_ty):
+550 raise hir.TypeInferenceError(
+551 span,
+552 f"Argument {i} expected {param_ty}, got {arg.type}"
+553 )
+554 if resolved_f.params[i].semantic == hir.ParameterSemantic.BYREF:
+555 if isinstance(arg, hir.Value):
+556 tmp = self.cur_bb().append(hir.Alloca(arg.type, span))
+557 self.cur_bb().append(hir.Assign(tmp, arg, span))
+558 args[i] = tmp
+559 else:
+560 if isinstance(arg, hir.Ref):
+561 args[i] = self.cur_bb().append(hir.Load(arg))
+562 assert resolved_f.return_type
+563 if not inline:
+564 return self.cur_bb().append(hir.Call(resolved_f, args, type=resolved_f.return_type, span=span))
+565 else:
+566 return hir.FunctionInliner.inline(resolved_f, args, self.cur_bb(), span)
+
568 def handle_intrinsic(self, expr: ast.Call, is_ref: bool) -> hir.Value | hir.Ref:
+569 intrinsic_name = expr.args[0]
+570 if not isinstance(intrinsic_name, ast.Constant) or not isinstance(intrinsic_name.value, str):
+571 raise hir.ParsingError(
+572 expr, "intrinsic function expects a string literal as its first argument")
+573 args: List[hir.Ref | hir.Value | hir.ComptimeValue] = []
+574 for a in expr.args[1:]:
+575 if isinstance(a, ast.Call) and isinstance(a.func, ast.Name) and a.func.id == 'byref':
+576 r = self.parse_ref(a.args[0])
+577 if isinstance(r, hir.Ref):
+578 args.append(r)
+579 else:
+580 raise hir.ParsingError(
+581 a, "expected reference but got value")
+582 else:
+583 args.append(self.parse_expr(a))
+584 ret_type = args[0]
+585 if isinstance(ret_type, ComptimeValue):
+586 ret_type = self.try_convert_comptime_value(
+587 ret_type, hir.Span.from_ast(expr.args[0]))
+588 if not isinstance(ret_type, hir.TypeValue):
+589 raise hir.ParsingError(
+590 expr, f"intrinsic function expects a type as its second argument but found {ret_type}")
+591 if any([not isinstance(arg, (hir.Value, hir.Ref)) for arg in args[1:]]):
+592 raise hir.ParsingError(
+593 expr, "intrinsic function expects values/refs as its arguments")
+594 if is_ref:
+595 return self.cur_bb().append(
+596 hir.IntrinsicRef(intrinsic_name.value, cast(List[hir.Value | hir.Ref], args[1:]),
+597 ret_type.inner_type(), hir.Span.from_ast(expr)))
+598 else:
+599 return self.cur_bb().append(
+600 hir.Intrinsic(intrinsic_name.value, cast(List[hir.Value | hir.Ref], args[1:]),
+601 ret_type.inner_type(), hir.Span.from_ast(expr)))
+
603 def handle_special_functions(self, f: Callable[..., Any], expr: ast.Call) -> hir.Value | ComptimeValue:
+604 if f is SPECIAL_FUNCTIONS_DICT['intrinsic']:
+605 intrin_ret = self.handle_intrinsic(expr, False)
+606 assert isinstance(intrin_ret, hir.Value)
+607 return intrin_ret
+608 # elif f is SPECIAL_FUNCTIONS_DICT['sizeof']:
+609 # if len(expr.args) != 1:
+610 # raise hir.ParsingError(
+611 # expr, f"lc.sizeof function expects exactly one argument")
+612 # arg_ty = self.parse_expr(expr.args[0])
+613 # if isinstance(arg_ty, ComptimeValue):
+614 # arg_ty = self.try_convert_comptime_value(
+615 # arg_ty, hir.Span.from_ast(expr.args[0]))
+616 # if not isinstance(arg_ty, hir.TypeValue):
+617 # raise hir.ParsingError(
+618 # expr.args[0], f"expected type but got {arg_ty}")
+619 # return self.cur_bb().append(hir.Constant(arg_ty.inner_type().size(), type=hir.GlobalContext().get().types[''], span=hir.Span.from_ast(expr)))
+620 elif f is SPECIAL_FUNCTIONS_DICT['cast'] or f is SPECIAL_FUNCTIONS_DICT['bitcast']:
+621 def do() -> hir.Intrinsic:
+622 if len(expr.args) != 2:
+623 raise hir.ParsingError(
+624 expr, f"lc.cast function expects exactly two arguments")
+625
+626 target_ty = self.parse_expr(expr.args[0])
+627 value = self.parse_expr(expr.args[1])
+628 if isinstance(target_ty, ComptimeValue):
+629 target_ty = self.try_convert_comptime_value(
+630 target_ty, hir.Span.from_ast(expr.args[0]))
+631 if not isinstance(target_ty, hir.TypeValue):
+632 raise hir.ParsingError(
+633 expr.args[0], f"expected type but got {target_ty}")
+634 if isinstance(value, ComptimeValue):
+635 value = self.try_convert_comptime_value(
+636 value, hir.Span.from_ast(expr.args[1]))
+637 if f is SPECIAL_FUNCTIONS_DICT['cast']:
+638 intrinsic_name = "cast"
+639 else:
+640 intrinsic_name = "bitcast"
+641 return self.cur_bb().append(hir.Intrinsic(intrinsic_name, [value], target_ty.inner_type(), hir.Span.from_ast(expr)))
+642 return do()
+643 elif f is SPECIAL_FUNCTIONS_DICT['comptime']:
+644 if len(expr.args) != 1:
+645 raise hir.ParsingError(
+646 expr, f"when used in expressions, lc.comptime function expects exactly one argument")
+647 arg = expr.args[0]
+648 # print(ast.dump(arg))
+649 if isinstance(arg, ast.Constant) and isinstance(arg.value, str):
+650 evaled = self.eval_expr(arg.value)
+651 else:
+652 evaled = self.eval_expr(arg)
+653 # print(evaled)
+654 v = self.convert_any_to_value(evaled, hir.Span.from_ast(expr))
+655 return v
+656 elif f is reveal_type:
+657 if len(expr.args) != 1:
+658 raise hir.ParsingError(
+659 expr, f"lc.reveal_type expects exactly one argument")
+660 arg = expr.args[0]
+661 cur_bb = self.cur_bb()
+662 cur_bb_len = len(cur_bb.nodes)
+663 value = self.parse_expr(arg)
+664 assert cur_bb is self.cur_bb()
+665 del self.cur_bb().nodes[cur_bb_len:]
+666 unparsed_arg = ast.unparse(arg)
+667 if isinstance(value, ComptimeValue):
+668 print(
+669 f"Type of {unparsed_arg} is ComptimeValue({type(value.value)})")
+670 else:
+671 print(f"Type of {unparsed_arg} is {value.type}")
+672 return hir.Unit()
+673 elif f is SPECIAL_FUNCTIONS_DICT['range']:
+674 def handle_range() -> hir.Value | ComptimeValue:
+675 if 1 <= len(expr.args) <= 3:
+676 args = [self.parse_expr(arg) for arg in expr.args]
+677 is_all_comptime = all(
+678 isinstance(arg, ComptimeValue) for arg in args)
+679 if is_all_comptime:
+680 try:
+681 comptime_args = cast(List[hir.ComptimeValue], args)
+682 return hir.ComptimeValue(range(*[arg.value for arg in comptime_args]), None)
+683 except Exception as e:
+684 raise hir.ParsingError(
+685 expr, f"error evaluating range: {e}") from e
+686 else:
+687 for i, arg in enumerate(args):
+688 if isinstance(arg, ComptimeValue):
+689 args[i] = self.try_convert_comptime_value(
+690 arg, hir.Span.from_ast(expr.args[i]))
+691 converted_args = cast(List[hir.Value], args)
+692
+693 def make_int(i: int) -> hir.Value:
+694 return hir.Constant(i, type=hir.GenericIntType())
+695 # TODO: check type consistency
+696 if len(args) == 1:
+697 return hir.Range(make_int(0), converted_args[0], make_int(1))
+698 elif len(args) == 2:
+699 return hir.Range(converted_args[0], converted_args[1], make_int(1))
+700 elif len(args) == 3:
+701 return hir.Range(converted_args[0], converted_args[1], converted_args[2])
+702 else:
+703 raise RuntimeError(
+704 f"Unsupported number of arguments for range function: {len(args)}")
+705 else:
+706 raise hir.ParsingError(
+707 expr, f"range function expects 1 to 3 arguments")
+708 return handle_range()
+709 else:
+710 raise RuntimeError(f"Unsupported special function {f}")
+
712 def parse_call_ref(self, expr: ast.Call) -> hir.Ref:
+713 func: hir.Ref | ComptimeValue | hir.TypeValue | hir.Value = self.parse_ref(
+714 expr.func)
+715 if isinstance(func, ComptimeValue):
+716 if func.value is not SPECIAL_FUNCTIONS_DICT['intrinsic']:
+717 raise hir.ParsingError(
+718 expr, f"expected intrinsic function but got {func}")
+719 intrin_ref = self.handle_intrinsic(expr, True)
+720 assert isinstance(intrin_ref, hir.Ref)
+721 return intrin_ref
+722
+723 span = hir.Span.from_ast(expr)
+724 if not isinstance(func, hir.FunctionValue):
+725 raise hir.ParsingError(
+726 expr, f"expected function but got {func}")
+727 raise NotImplementedError()
+
729 def parse_call(self, expr: ast.Call) -> hir.Value | ComptimeValue:
+730 func: hir.Ref | ComptimeValue | hir.TypeValue | hir.Value = self.parse_ref(
+731 expr.func) # TODO: this should be a parse_ref
+732 span = hir.Span.from_ast(expr)
+733
+734 if isinstance(func, ComptimeValue):
+735 if func.value in SPECIAL_FUNCTIONS:
+736 return self.handle_special_functions(func.value, expr)
+737 func = self.try_convert_comptime_value(
+738 func, hir.Span.from_ast(expr))
+739
+740 def collect_args() -> List[hir.Value | hir.Ref]:
+741 args = [self.parse_expr(arg) for arg in expr.args]
+742 for i, arg in enumerate(args):
+743 if isinstance(arg, ComptimeValue):
+744 args[i] = self.try_convert_comptime_value(
+745 arg, hir.Span.from_ast(expr.args[i]))
+746 return cast(List[hir.Value | hir.Ref], args)
+747
+748 if isinstance(func.type, hir.TypeConstructorType):
+749 # TypeConstructorType is unique for each type
+750 # so if any value has this type, it must be referring to the same underlying type
+751 # even if it comes from a very complex expression, it's still fine
+752 cls = func.type.inner
+753 assert cls
+754 if isinstance(cls, hir.ParametricType):
+755 raise hir.ParsingError(
+756 span, f"please provide type arguments for {cls.body}")
+757
+758 init = cls.method("__init__")
+759 tmp = self.cur_bb().append(hir.Alloca(cls, span))
+760 if init is None:
+761 raise hir.ParsingError(
+762 span, f"__init__ method not found for type {cls}")
+763 call = self.parse_call_impl(
+764 span, init, [tmp]+collect_args())
+765 if isinstance(call, hir.TemplateMatchingError):
+766 raise hir.ParsingError(expr, call.message)
+767 assert isinstance(call, hir.Call)
+768 return self.cur_bb().append(hir.Load(tmp))
+769 assert func.type
+770 if isinstance(func.type, hir.FunctionType):
+771 func_like = func.type.func_like
+772 bound_object = func.type.bound_object
+773 if bound_object is not None:
+774 ret = self.parse_call_impl(
+775 span, func_like, cast(List[hir.Ref | hir.Value], [bound_object]) + collect_args())
+776 else:
+777 ret = self.parse_call_impl(
+778 span, func_like, collect_args())
+779 if isinstance(ret, hir.TemplateMatchingError):
+780 raise hir.ParsingError(expr, ret.message)
+781 return ret
+782 else:
+783 # check if __call__ is defined
+784 if (method := func.type.method("__call__")) and method:
+785 ret = self.parse_call_impl(
+786 span, method, cast(List[hir.Ref | hir.Value], [func]) + collect_args())
+787 if isinstance(ret, hir.TemplateMatchingError):
+788 raise hir.ParsingError(expr, ret.message)
+789 return ret
+790 else:
+791 raise hir.ParsingError(
+792 expr, f"function call not supported for type {func.type}")
+
794 def parse_binop(self, expr: ast.BinOp | ast.Compare) -> hir.Value:
+795 binop_to_op_str: Dict[type, str] = {
+796 ast.Add: "+",
+797 ast.Sub: "-",
+798 ast.Mult: "*",
+799 ast.Div: "/",
+800 ast.FloorDiv: "//",
+801 ast.Mod: "%",
+802 ast.Pow: "**",
+803 ast.LShift: "<<",
+804 ast.RShift: ">>",
+805 ast.BitAnd: '&',
+806 ast.BitOr: '|',
+807 ast.BitXor: '^',
+808 ast.Eq: "==",
+809 ast.NotEq: "!=",
+810 ast.Lt: "<",
+811 ast.LtE: "<=",
+812 ast.Gt: ">",
+813 ast.GtE: ">=",
+814
+815 }
+816 op: ast.AST
+817 if isinstance(expr, ast.Compare):
+818 if len(expr.ops) != 1:
+819 raise hir.ParsingError(
+820 expr, "only one comparison operator is allowed")
+821 op = expr.ops[0]
+822 left = expr.left
+823 right = expr.comparators[0]
+824 else:
+825 op = expr.op
+826 left = expr.left
+827 right = expr.right
+828 op_str = binop_to_op_str[type(op)]
+829 lhs = self.parse_expr(left)
+830 if isinstance(lhs, ComptimeValue):
+831 lhs = self.try_convert_comptime_value(lhs, hir.Span.from_ast(expr))
+832 if not lhs.type:
+833 raise hir.ParsingError(
+834 left, f"unable to infer type of left operand of binary operation {op_str}")
+835 rhs = self.parse_expr(right)
+836 if isinstance(rhs, ComptimeValue):
+837 rhs = self.try_convert_comptime_value(rhs, hir.Span.from_ast(expr))
+838 if not rhs.type:
+839 raise hir.ParsingError(
+840 right, f"unable to infer type of right operand of binary operation {op_str}")
+841 ops = BINOP_TO_METHOD_NAMES[type(op)]
+842
+843 def infer_binop(name: str, rname: str) -> hir.Value:
+844 assert lhs.type and rhs.type
+845 matching_errors = []
+846 try:
+847 if (method := lhs.type.method(name)) and method:
+848 ret = self.parse_call_impl(
+849 hir.Span.from_ast(expr), method, [lhs, rhs])
+850 if isinstance(ret, hir.TemplateMatchingError):
+851 matching_errors.append(ret)
+852 else:
+853 return ret
+854 if (method := rhs.type.method(rname)) and method:
+855 ret = self.parse_call_impl(
+856 hir.Span.from_ast(expr), method, [rhs, lhs])
+857 if isinstance(ret, hir.TemplateMatchingError):
+858 matching_errors.append(ret)
+859 else:
+860 return ret
+861 raise hir.ParsingError(
+862 expr, f"Operator {op_str} not defined for types {lhs.type} and {rhs.type}")
+863 except hir.TypeInferenceError as e:
+864 e.span = hir.Span.from_ast(expr)
+865 raise e from e
+866 return infer_binop(ops[0], ops[1])
+
868 def parse_ref(self, expr: ast.expr, new_var_hint: NewVarHint = False) -> hir.Ref | ComptimeValue | hir.TypeValue | hir.FunctionValue:
+869 match expr:
+870 case ast.Name():
+871 ret = self.parse_name(expr, new_var_hint)
+872 if isinstance(ret, (hir.Value)):
+873 if isinstance(ret.type, hir.TypeConstructorType):
+874 assert isinstance(ret, hir.TypeValue)
+875 return ret
+876 if isinstance(ret.type, hir.FunctionType):
+877 return hir.FunctionValue(ret.type, hir.Span.from_ast(expr))
+878 # raise hir.ParsingError(
+879 # expr, f"{type(ret)} cannot be used as reference")
+880 assert ret.type
+881 tmp = self.cur_bb().append(hir.Alloca(ret.type, hir.Span.from_ast(expr)))
+882 self.cur_bb().append(hir.Assign(tmp, ret))
+883 return tmp
+884 return ret
+885 case ast.Subscript() | ast.Attribute():
+886 return self.parse_access_ref(expr)
+887 case ast.Call() as call:
+888 return self.parse_call_ref(call)
+889 # if call.func is SPECIAL_FUNCTIONS_DICT['intrinsic']:
+890 # return self.handle_special_functions(
+891 # call.func, call)
+892 # return self.parse_call_impl_ref(hir.Span.from_ast(expr), self.parse_ref(call.func), [self.parse_expr(arg) for arg in call.args])
+893 case _:
+894 raise hir.ParsingError(
+895 expr, f"expression {ast.dump(expr)} cannot be parsed as reference")
+
897 def parse_multi_assignment(self,
+ 898 targets: List[ast.expr],
+ 899 anno_ty_fn: List[Optional[Callable[..., hir.Type | None]]],
+ 900 values: hir.Value | ComptimeValue) -> None:
+ 901 if isinstance(values, ComptimeValue):
+ 902 parsed_targets = [self.parse_ref(t, 'comptime') for t in targets]
+ 903 for i in range(len(parsed_targets)):
+ 904 if isinstance(parsed_targets[i], hir.TypeValue):
+ 905 raise hir.ParsingError(
+ 906 targets[i], "types cannot be reassigned")
+ 907
+ 908 def do_assign(target: hir.Ref | ComptimeValue, value: ComptimeValue, i: int) -> None:
+ 909 span = hir.Span.from_ast(targets[i])
+ 910 if isinstance(target, ComptimeValue):
+ 911 target.update(value.value)
+ 912 else:
+ 913 self.cur_bb().append(hir.Assign(target,
+ 914 self.try_convert_comptime_value(value, span)))
+ 915 if len(parsed_targets) > 1:
+ 916 if len(parsed_targets) != len(values.value):
+ 917 raise hir.ParsingError(
+ 918 targets[0], f"expected {len(parsed_targets)} values to unpack, got {len(values.value)}")
+ 919 for i, t in enumerate(parsed_targets):
+ 920 assert isinstance(t, (hir.Ref, ComptimeValue))
+ 921 do_assign(t, values.value[i],
+ 922 i)
+ 923 else:
+ 924 t = parsed_targets[0]
+ 925 assert isinstance(t, (hir.Ref, ComptimeValue))
+ 926 do_assign(t, values, 0)
+ 927 else:
+ 928 parsed_targets = [self.parse_ref(t, 'dsl') for t in targets]
+ 929 is_all_dsl = all(
+ 930 isinstance(t, hir.Ref) for t in parsed_targets)
+ 931 if not is_all_dsl:
+ 932 raise hir.ParsingError(
+ 933 targets[0], "DSL value cannot be assigned to comptime variables")
+ 934 assert values.type
+ 935 ref_targets = cast(List[hir.Ref], parsed_targets)
+ 936
+ 937 def do_unpack(length: int, extract_fn: Callable[[hir.Value, int, ast.expr], hir.Value]) -> None:
+ 938 def check(i: int, val_type: hir.Type) -> None:
+ 939 if len(anno_ty_fn) > 0 and (fn := anno_ty_fn[i]) is not None:
+ 940 ty = fn()
+ 941 if ty is None:
+ 942 raise hir.ParsingError(
+ 943 targets[i], f"unable to infer type of target")
+ 944 if ref_targets[i].type is None:
+ 945 ref_targets[i].type = ty
+ 946 tt = ref_targets[i].type
+ 947 if isinstance(val_type, hir.FunctionType) and val_type.bound_object is not None:
+ 948 raise hir.TypeInferenceError(
+ 949 targets[i], f"bounded method cannot be assigned to variable")
+ 950 if not tt:
+ 951 if val_type.is_concrete():
+ 952 ref_targets[i].type = val_type
+ 953 else:
+ 954 raise hir.TypeInferenceError(
+ 955 targets[i], f"unable to infer type of target, cannot assign with non-concrete type {val_type}")
+ 956 elif not hir.is_type_compatible_to(val_type, tt):
+ 957 raise hir.ParsingError(
+ 958 targets[i], f"expected type {tt}, got {val_type}")
+ 959
+ 960 if len(ref_targets) == 1:
+ 961 assert values.type
+ 962 check(0, values.type)
+ 963 if not isinstance(values.type, (hir.FunctionType, hir.TypeConstructorType)):
+ 964 self.cur_bb().append(hir.Assign(
+ 965 ref_targets[0], values))
+ 966 elif len(ref_targets) == length:
+ 967 for i, t in enumerate(ref_targets):
+ 968 e = extract_fn(values, i, targets[i])
+ 969 assert e.type
+ 970 check(i, e.type)
+ 971 if not isinstance(e.type, (hir.FunctionType, hir.TypeConstructorType)):
+ 972 self.cur_bb().append(hir.Assign(t, e))
+ 973 else:
+ 974 if len(ref_targets) > length:
+ 975 raise hir.ParsingError(
+ 976 targets[0], f"too few values to unpack: expected {len(ref_targets)} values, got {length}")
+ 977 else:
+ 978 raise hir.ParsingError(
+ 979 targets[0], f"too many values to unpack: expected {len(ref_targets)} values, got {length}")
+ 980 match values.type:
+ 981 case hir.VectorType() as vt:
+ 982 comps = 'xyzw'
+ 983 do_unpack(vt.count, lambda values, i, target: self.cur_bb().append(
+ 984 hir.Member(values, comps[i], type=vt.element, span=hir.Span.from_ast(target))))
+ 985 case hir.TupleType() as tt:
+ 986 do_unpack(len(tt.elements), lambda values, i, target: self.cur_bb().append(
+ 987 hir.Member(values, f'_{i}', type=tt.elements[i], span=hir.Span.from_ast(target)))
+ 988 )
+ 989 case hir.ArrayType() as at:
+ 990 assert isinstance(at.count, int)
+ 991 do_unpack(at.count, lambda values, i, target: self.cur_bb().append(
+ 992 hir.Index(values, hir.Constant(i, type=luisa_lang.typeof(luisa_lang.i32)), type=at.element, span=hir.Span.from_ast(target))))
+ 993 case hir.StructType() as st:
+ 994 do_unpack(len(st.fields), lambda values, i, target: self.cur_bb().append(
+ 995 hir.Member(values, st.fields[i][0], type=st.fields[i][1], span=hir.Span.from_ast(target)))
+ 996 )
+ 997 case _:
+ 998 if len(ref_targets) == 1:
+ 999 do_unpack(1, lambda values, i, target: exit(-1))
+1000 else:
+1001 raise hir.ParsingError(
+1002 targets[0], f"unsupported type for unpacking: {values.type}")
+
1004 def parse_unary(self, expr: ast.UnaryOp) -> hir.Value:
+1005 op = expr.op
+1006 if type(op) not in UNARY_OP_TO_METHOD_NAMES:
+1007 raise hir.ParsingError(
+1008 expr, f"unsupported unary operator {type(op)}")
+1009 op_str = UNARY_OP_TO_METHOD_NAMES[type(op)]
+1010 operand = self.parse_expr(expr.operand)
+1011 if isinstance(operand, ComptimeValue):
+1012 operand = self.try_convert_comptime_value(
+1013 operand, hir.Span.from_ast(expr))
+1014 if not operand.type:
+1015 raise hir.ParsingError(
+1016 expr.operand, f"unable to infer type of operand of unary operation {op_str}")
+1017 method_name = UNARY_OP_TO_METHOD_NAMES[type(op)]
+1018 if (method := operand.type.method(method_name)) and method:
+1019 ret = self.parse_call_impl(
+1020 hir.Span.from_ast(expr), method, [operand])
+1021 if isinstance(ret, hir.TemplateMatchingError):
+1022 raise hir.ParsingError(expr, ret.message)
+1023 return ret
+1024 else:
+1025 raise hir.ParsingError(
+1026 expr, f"operator {type(op)} not defined for type {operand.type}")
+
1028 def parse_expr(self, expr: ast.expr) -> hir.Value | ComptimeValue:
+1029 match expr:
+1030 case ast.Constant():
+1031 return self.parse_const(expr)
+1032 case ast.Name():
+1033 ret = self.parse_name(expr, False)
+1034 if isinstance(ret, hir.Ref):
+1035 ret = self.convert_to_value(ret, hir.Span.from_ast(expr))
+1036 return ret
+1037 case ast.Subscript() | ast.Attribute():
+1038 return self.convert_to_value(self.parse_access_ref(expr), hir.Span.from_ast(expr))
+1039 case ast.BinOp() | ast.Compare():
+1040 return self.parse_binop(expr)
+1041 case ast.UnaryOp():
+1042 return self.parse_unary(expr)
+1043 case ast.Call():
+1044 return self.parse_call(expr)
+1045 case ast.Tuple():
+1046 elements = [self.parse_expr(e) for e in expr.elts]
+1047 is_all_comptime = all(
+1048 isinstance(e, ComptimeValue) for e in elements)
+1049 if is_all_comptime:
+1050 return hir.ComptimeValue(
+1051 tuple(e.value for e in cast(List[ComptimeValue], elements)), None)
+1052 else:
+1053 for i, e in enumerate(elements):
+1054 if isinstance(e, ComptimeValue):
+1055 elements[i] = self.try_convert_comptime_value(
+1056 e, hir.Span.from_ast(expr.elts[i]))
+1057 tt: hir.TupleType = hir.TupleType(
+1058 [unwrap(e.type) for e in cast(List[hir.Value], elements)])
+1059 return self.cur_bb().append(hir.AggregateInit(cast(List[hir.Value], elements), tt, span=hir.Span.from_ast(expr)))
+1060 case _:
+1061 raise RuntimeError(f"Unsupported expression: {ast.dump(expr)}")
+
1063 def eval_expr(self, tree: str | ast.Expression | ast.expr): # -> Any:
+1064 if isinstance(tree, ast.expr):
+1065 tree = ast.Expression(tree)
+1066 # print(tree)
+1067 code_object = compile(tree, "<string>", "eval")
+1068 localns = {}
+1069 for name, v in self.vars.items():
+1070 if isinstance(v, ComptimeValue):
+1071 localns[name] = v.value
+1072 return eval(code_object, self.globalns, localns)
+
1074 def convert_to_value(self, value: hir.Value | hir.Ref | ComptimeValue, span: Optional[hir.Span] = None) -> hir.Value:
+1075 if isinstance(value, ComptimeValue):
+1076 value = self.try_convert_comptime_value(value, span)
+1077 if isinstance(value, hir.Ref):
+1078 value = hir.Load(value)
+1079 self.cur_bb().append(value)
+1080 return value
+
1082 def parse_stmt(self, stmt: ast.stmt) -> None:
+1083 span = hir.Span.from_ast(stmt)
+1084 match stmt:
+1085 case ast.If():
+1086 cond = self.parse_expr(stmt.test)
+1087 pred_bb = self.cur_bb()
+1088 self.bb_stack.pop()
+1089 if isinstance(cond, ComptimeValue):
+1090 if cond.value:
+1091 for s in stmt.body:
+1092 self.parse_stmt(s)
+1093 elif stmt.orelse:
+1094 for s in stmt.orelse:
+1095 self.parse_stmt(s)
+1096 else:
+1097 merge = hir.BasicBlock(span)
+1098 self.bb_stack.append(hir.BasicBlock(span))
+1099 for s in stmt.body:
+1100 self.parse_stmt(s)
+1101 body = self.bb_stack.pop()
+1102 if stmt.orelse:
+1103 self.bb_stack.append(hir.BasicBlock(span))
+1104 for s in stmt.orelse:
+1105 self.parse_stmt(s)
+1106 orelse = self.bb_stack.pop()
+1107 else:
+1108 orelse = None
+1109 pred_bb.append(hir.If(cond, body, orelse, merge, span))
+1110 self.bb_stack.append(merge)
+1111 case ast.While():
+1112 pred_bb = self.cur_bb()
+1113 self.bb_stack.pop()
+1114 prepare = hir.BasicBlock(span)
+1115 self.bb_stack.append(prepare)
+1116 cond = self.parse_expr(stmt.test)
+1117 self.bb_stack.pop()
+1118 if isinstance(cond, ComptimeValue):
+1119 raise hir.ParsingError(
+1120 stmt, "while loop condition must not be a comptime value")
+1121 body = hir.BasicBlock(span)
+1122 self.bb_stack.append(body)
+1123 old_break_and_continues = self.break_and_continues
+1124 self.break_and_continues = []
+1125 for s in stmt.body:
+1126 self.parse_stmt(s)
+1127 break_and_continues = self.break_and_continues
+1128 self.break_and_continues = old_break_and_continues
+1129 body = self.bb_stack.pop()
+1130 update = hir.BasicBlock(span)
+1131 merge = hir.BasicBlock(span)
+1132 loop_node = hir.Loop(prepare, cond, body, update, merge, span)
+1133 pred_bb.append(loop_node)
+1134 for bc in break_and_continues:
+1135 bc.target = loop_node
+1136 self.bb_stack.append(merge)
+1137 case ast.For():
+1138 iter_val = self.parse_expr(stmt.iter)
+1139 if not isinstance(iter_val, hir.Value) or not isinstance(iter_val, hir.Range):
+1140 raise hir.ParsingError(
+1141 stmt, f"for loop iterable must be a range object but found {iter_val}")
+1142 loop_range: hir.Range = iter_val
+1143 pred_bb = self.cur_bb()
+1144 self.bb_stack.pop()
+1145 loop_var = self.parse_ref(stmt.target, new_var_hint='dsl')
+1146 if not isinstance(loop_var, hir.Ref):
+1147 raise hir.ParsingError(
+1148 stmt, "for loop target must be a DSL variable")
+1149 if not loop_var.type:
+1150 loop_ty = loop_range.value_type()
+1151 if not isinstance(loop_ty, hir.GenericIntType):
+1152 loop_var.type = loop_ty
+1153 else:
+1154 loop_var.type = luisa_lang.typeof(luisa_lang.i32)
+1155 if not isinstance(loop_var.type, hir.IntType):
+1156 raise hir.ParsingError(
+1157 stmt, "for loop target must be an integer variable")
+1158
+1159 prepare = hir.BasicBlock(span)
+1160 self.bb_stack.append(prepare)
+1161 int_lt = loop_var.type.method("__lt__")
+1162 assert int_lt is not None
+1163 cmp_result = self.parse_call_impl(
+1164 span, int_lt, [loop_var, loop_range.stop])
+1165 assert isinstance(cmp_result, hir.Value)
+1166 assert cmp_result.type == hir.BoolType()
+1167 self.bb_stack.pop()
+1168 body = hir.BasicBlock(span)
+1169 self.bb_stack.append(body)
+1170 old_break_and_continues = self.break_and_continues
+1171 self.break_and_continues = []
+1172 for s in stmt.body:
+1173 self.parse_stmt(s)
+1174 body = self.bb_stack.pop()
+1175 break_and_continues = self.break_and_continues
+1176 self.break_and_continues = old_break_and_continues
+1177 update = hir.BasicBlock(span)
+1178 self.bb_stack.append(update)
+1179 inc = loop_range.step
+1180 int_add = loop_var.type.method("__add__")
+1181 assert int_add is not None
+1182 add = self.parse_call_impl(
+1183 span, int_add, [loop_var, inc])
+1184 assert isinstance(add, hir.Value)
+1185 self.cur_bb().append(hir.Assign(loop_var, add))
+1186 self.bb_stack.pop()
+1187 merge = hir.BasicBlock(span)
+1188 loop_node = hir.Loop(prepare, cmp_result,
+1189 body, update, merge, span)
+1190 pred_bb.append(loop_node)
+1191 for bc in break_and_continues:
+1192 bc.target = loop_node
+1193 self.bb_stack.append(merge)
+1194 case ast.Break():
+1195 if self.break_and_continues is None:
+1196 raise hir.ParsingError(
+1197 stmt, "break statement must be inside a loop")
+1198 self.cur_bb().append(hir.Break(None, span))
+1199 case ast.Continue():
+1200 if self.break_and_continues is None:
+1201 raise hir.ParsingError(
+1202 stmt, "continue statement must be inside a loop")
+1203 self.cur_bb().append(hir.Continue(None, span))
+1204 case ast.Return():
+1205 def check_return_type(ty: hir.Type) -> None:
+1206 assert self.parsed_func
+1207 if self.parsed_func.return_type is None:
+1208 self.parsed_func.return_type = ty
+1209 else:
+1210 if not hir.is_type_compatible_to(ty, self.parsed_func.return_type):
+1211 raise hir.ParsingError(
+1212 stmt, f"return type mismatch: expected {self.parsed_func.return_type}, got {ty}")
+1213 if self.returning_ref:
+1214 def do():
+1215 if not stmt.value:
+1216 raise hir.ParsingError(
+1217 stmt, "if a function is returning local references, the return value must be provided")
+1218 value = self.parse_ref(stmt.value)
+1219 if not isinstance(value, hir.Ref):
+1220 raise hir.ParsingError(
+1221 stmt, "invalid return target")
+1222 assert value.type
+1223 check_return_type(value.type)
+1224 self.cur_bb().append(hir.ReturnRef(value))
+1225 do()
+1226 else:
+1227 def do():
+1228 if stmt.value:
+1229 value = self.parse_expr(stmt.value)
+1230 value = self.convert_to_value(value, span)
+1231 assert value.type is not None
+1232 check_return_type(value.type)
+1233 self.cur_bb().append(hir.Return(value))
+1234 else:
+1235 check_return_type(hir.UnitType())
+1236 self.cur_bb().append(hir.Return(None))
+1237 do()
+1238 case ast.Assign():
+1239 assert len(stmt.targets) == 1
+1240 target = stmt.targets[0]
+1241 if isinstance(target, ast.Tuple):
+1242 self.parse_multi_assignment(
+1243 target.elts, [], self.parse_expr(stmt.value))
+1244 else:
+1245 self.parse_multi_assignment(
+1246 [target], [], self.parse_expr(stmt.value)
+1247 )
+1248 case ast.AugAssign():
+1249 method_name = AUG_ASSIGN_TO_METHOD_NAMES[type(stmt.op)]
+1250 var = self.parse_ref(stmt.target)
+1251 value = self.parse_expr(stmt.value)
+1252 if isinstance(var, ComptimeValue):
+1253 if not isinstance(value, ComptimeValue):
+1254 raise hir.ParsingError(
+1255 stmt, f"comptime value cannot be assigned with DSL value")
+1256 comptime_method = getattr(var.value, method_name, None)
+1257 if comptime_method is None:
+1258 raise hir.ParsingError(
+1259 stmt, f"comptime value of type {type(var.value)} does not support {method_name}")
+1260 var.update(comptime_method(value.value))
+1261 return None
+1262 value = self.convert_to_value(value, span)
+1263 assert value.type
+1264 assert var.type
+1265 method = var.type.method(method_name)
+1266 if not method:
+1267 raise hir.ParsingError(
+1268 stmt, f"operator {method_name} not defined for type {var.type}")
+1269 ret = self.parse_call_impl(
+1270 span, method, [var, value])
+1271 if isinstance(ret, hir.TemplateMatchingError):
+1272 raise hir.ParsingError(stmt, ret.message)
+1273
+1274 case ast.AnnAssign():
+1275 def parse_anno_ty() -> hir.Type:
+1276 type_annotation = self.eval_expr(stmt.annotation)
+1277 type_hint = classinfo.parse_type_hint(type_annotation)
+1278 ty = self.parse_type(type_hint)
+1279 assert ty
+1280 return ty
+1281
+1282 if stmt.value:
+1283 self.parse_multi_assignment(
+1284 [stmt.target], [parse_anno_ty], self.parse_expr(stmt.value))
+1285 else:
+1286 var = self.parse_ref(stmt.target, new_var_hint='dsl')
+1287 anno_ty = parse_anno_ty()
+1288 assert isinstance(var, hir.Var)
+1289 if not var.type:
+1290 var.type = anno_ty
+1291 else:
+1292 if not hir.is_type_compatible_to(var.type, anno_ty):
+1293 raise hir.ParsingError(
+1294 stmt, f"expected {anno_ty}, got {var.type}")
+1295 case ast.Expr():
+1296 # ignore comments
+1297 if isinstance(stmt.value, ast.Constant) and isinstance(stmt.value.value, str):
+1298 return
+1299 self.parse_expr(stmt.value)
+1300 case ast.Pass():
+1301 return
+1302 case _:
+1303 raise RuntimeError(f"Unsupported statement: {ast.dump(stmt)}")
+
1305 def parse_body(self):
+1306 assert self.parsed_func is not None
+1307 body = self.func_def.body
+1308 entry = hir.BasicBlock(hir.Span.from_ast(self.func_def))
+1309 self.bb_stack.append(entry)
+1310 for stmt in body:
+1311 self.parse_stmt(stmt)
+1312 assert len(self.bb_stack) == 1
+1313 self.parsed_func.body = entry
+1314 self.parsed_func.locals = list(
+1315 [x for x in self.vars.values() if isinstance(x, hir.Var)])
+1316 if not self.parsed_func.return_type:
+1317 self.parsed_func.return_type = hir.UnitType()
+1318 self.parsed_func.complete = True
+1319 return self.parsed_func
+
+luisa_lang
+
+
+
+
+
+
+ 1import ast
+ 2import textwrap
+ 3import types
+ 4from typing import Any, List, NoReturn, Optional, Tuple, TypeVar, overload
+ 5import sourceinspect
+ 6from hashlib import sha256
+ 7
+ 8T = TypeVar("T")
+ 9
+ 10
+ 11def unwrap(opt: Optional[T]) -> T:
+ 12 if opt is None:
+ 13 raise ValueError("unwrap None")
+ 14 return opt
+ 15
+ 16
+ 17def increment_lineno_and_col_offset(
+ 18 node: ast.AST, lineno: int, col_offset: int
+ 19) -> ast.AST:
+ 20 """
+ 21 Increment the line number and end line number of each node in the tree
+ 22 starting at *node* by *n*. This is useful to "move code" to a different
+ 23 location in a file.
+ 24 """
+ 25 for child in ast.walk(node):
+ 26 if "lineno" in child._attributes:
+ 27 setattr(child, "lineno", getattr(child, "lineno", 0) + lineno)
+ 28 if (
+ 29 "end_lineno" in child._attributes
+ 30 and (end_lineno := getattr(child, "end_lineno", 0)) is not None
+ 31 ):
+ 32 setattr(child, "end_lineno", end_lineno + lineno)
+ 33 if "col_offset" in child._attributes:
+ 34 setattr(child, "col_offset", getattr(
+ 35 child, "col_offset", 0) + col_offset)
+ 36 if (
+ 37 "end_col_offset" in child._attributes
+ 38 and (end_col_offset := getattr(child, "end_col_offset", 0)) is not None
+ 39 ):
+ 40 setattr(child, "end_col_offset", end_col_offset + col_offset)
+ 41 return node
+ 42
+ 43
+ 44def dedent_and_retrieve_indentation(lines: str) -> Tuple[str, int]:
+ 45 """
+ 46 Dedent the lines and return the indentation level of the first line.
+ 47 """
+ 48 if not lines:
+ 49 return "", 0
+ 50 return textwrap.dedent("".join(lines)), len(lines[0]) - len(lines[0].lstrip())
+ 51
+ 52
+ 53def retrieve_ast_and_filename(f: object) -> Tuple[ast.AST, str]:
+ 54 source_file = sourceinspect.getsourcefile(f)
+ 55 if source_file is None:
+ 56 source_file = "<unknown>"
+ 57 source_lines, lineno = sourceinspect.getsourcelines(f)
+ 58 src, indent = dedent_and_retrieve_indentation(source_lines)
+ 59 tree = increment_lineno_and_col_offset(
+ 60 ast.parse(src), lineno - 1, indent + 1)
+ 61 for child in ast.walk(tree):
+ 62 setattr(child, "source_file", source_file)
+ 63 return tree, source_file
+ 64
+ 65
+ 66def get_full_name(obj: Any) -> str:
+ 67 module = ""
+ 68 if hasattr(obj, "__module__"):
+ 69 module = obj.__module__
+ 70 return f"{module}.{obj.__qualname__}"
+ 71
+ 72
+ 73class Span:
+ 74 file: Optional[str]
+ 75 start: Tuple[int, int]
+ 76 end: Tuple[int, int]
+ 77
+ 78 def __init__(
+ 79 self, file: Optional[str], start: Tuple[int, int], end: Tuple[int, int]
+ 80 ) -> None:
+ 81 self.file = file
+ 82 self.start = start
+ 83 self.end = end
+ 84
+ 85 def __str__(self) -> str:
+ 86 if self.file is None:
+ 87 return f"{self.start[0]}:{self.start[1]}-{self.end[0]}:{self.end[1]}"
+ 88 return (
+ 89 f"{self.file}:{self.start[0]}:{self.start[1]}-{self.end[0]}:{self.end[1]}"
+ 90 )
+ 91
+ 92 @staticmethod
+ 93 def from_ast(ast: ast.AST) -> Optional["Span"]:
+ 94 if not hasattr(ast, "lineno"):
+ 95 return None
+ 96 if not hasattr(ast, "col_offset"):
+ 97 return None
+ 98 if not hasattr(ast, "end_lineno") or ast.end_lineno is None:
+ 99 return None
+100 if not hasattr(ast, "end_col_offset") or ast.end_col_offset is None:
+101 return None
+102 file = None
+103 if hasattr(ast, "source_file"):
+104 file = getattr(ast, "source_file")
+105 return Span(
+106 file=file,
+107 start=(getattr(ast, "lineno", 0), getattr(ast, "col_offset", 0)),
+108 end=(getattr(ast, "end_lineno", 0),
+109 getattr(ast, "end_col_offset", 0)),
+110 )
+111
+112
+113def print_yellow(message: str) -> None:
+114 print(f"\033[33m{message}\033[0m")
+115
+116
+117def print_red(message: str) -> None:
+118 print(f"\033[31m{message}\033[0m")
+119
+120
+121def show_warning(message: str, span: Optional[Span] = None) -> None:
+122 if span is not None:
+123 print_yellow(f"Warning: {span}: {message}")
+124 else:
+125 print_yellow(f"Warning: {message}")
+126
+127
+128def get_union_args(union: Any) -> List[type]:
+129 if hasattr(union, "__args__") or isinstance(union, types.UnionType):
+130 return list(union.__args__)
+131 return []
+132
+133
+134def get_typevar_constrains_and_bounds(t: TypeVar) -> Tuple[List[Any], Optional[Any]]:
+135 """
+136 Find the constraints and bounds of a TypeVar.
+137 Only one of the two can be present.
+138 """
+139 constraints = []
+140 bound = None
+141 if hasattr(t, "__constraints__"):
+142 constraints = list(t.__constraints__)
+143 if hasattr(t, "__bound__"):
+144 bound = t.__bound__
+145 return constraints, bound
+146
+147
+148def checked_cast(t: type[T], obj: Any) -> T:
+149 if not isinstance(obj, t):
+150 raise TypeError(f"expected {t}, got {type(obj)}")
+151 return obj
+152
+153
+154def unique_hash(s: str) -> str:
+155 return sha256(s.encode()).hexdigest().upper()[:8]
+156
+157
+158def round_to_align(s: int, a: int) -> int:
+159 return s + (a - s % a) % a
+
18def increment_lineno_and_col_offset(
+19 node: ast.AST, lineno: int, col_offset: int
+20) -> ast.AST:
+21 """
+22 Increment the line number and end line number of each node in the tree
+23 starting at *node* by *n*. This is useful to "move code" to a different
+24 location in a file.
+25 """
+26 for child in ast.walk(node):
+27 if "lineno" in child._attributes:
+28 setattr(child, "lineno", getattr(child, "lineno", 0) + lineno)
+29 if (
+30 "end_lineno" in child._attributes
+31 and (end_lineno := getattr(child, "end_lineno", 0)) is not None
+32 ):
+33 setattr(child, "end_lineno", end_lineno + lineno)
+34 if "col_offset" in child._attributes:
+35 setattr(child, "col_offset", getattr(
+36 child, "col_offset", 0) + col_offset)
+37 if (
+38 "end_col_offset" in child._attributes
+39 and (end_col_offset := getattr(child, "end_col_offset", 0)) is not None
+40 ):
+41 setattr(child, "end_col_offset", end_col_offset + col_offset)
+42 return node
+
45def dedent_and_retrieve_indentation(lines: str) -> Tuple[str, int]:
+46 """
+47 Dedent the lines and return the indentation level of the first line.
+48 """
+49 if not lines:
+50 return "", 0
+51 return textwrap.dedent("".join(lines)), len(lines[0]) - len(lines[0].lstrip())
+
54def retrieve_ast_and_filename(f: object) -> Tuple[ast.AST, str]:
+55 source_file = sourceinspect.getsourcefile(f)
+56 if source_file is None:
+57 source_file = "<unknown>"
+58 source_lines, lineno = sourceinspect.getsourcelines(f)
+59 src, indent = dedent_and_retrieve_indentation(source_lines)
+60 tree = increment_lineno_and_col_offset(
+61 ast.parse(src), lineno - 1, indent + 1)
+62 for child in ast.walk(tree):
+63 setattr(child, "source_file", source_file)
+64 return tree, source_file
+
74class Span:
+ 75 file: Optional[str]
+ 76 start: Tuple[int, int]
+ 77 end: Tuple[int, int]
+ 78
+ 79 def __init__(
+ 80 self, file: Optional[str], start: Tuple[int, int], end: Tuple[int, int]
+ 81 ) -> None:
+ 82 self.file = file
+ 83 self.start = start
+ 84 self.end = end
+ 85
+ 86 def __str__(self) -> str:
+ 87 if self.file is None:
+ 88 return f"{self.start[0]}:{self.start[1]}-{self.end[0]}:{self.end[1]}"
+ 89 return (
+ 90 f"{self.file}:{self.start[0]}:{self.start[1]}-{self.end[0]}:{self.end[1]}"
+ 91 )
+ 92
+ 93 @staticmethod
+ 94 def from_ast(ast: ast.AST) -> Optional["Span"]:
+ 95 if not hasattr(ast, "lineno"):
+ 96 return None
+ 97 if not hasattr(ast, "col_offset"):
+ 98 return None
+ 99 if not hasattr(ast, "end_lineno") or ast.end_lineno is None:
+100 return None
+101 if not hasattr(ast, "end_col_offset") or ast.end_col_offset is None:
+102 return None
+103 file = None
+104 if hasattr(ast, "source_file"):
+105 file = getattr(ast, "source_file")
+106 return Span(
+107 file=file,
+108 start=(getattr(ast, "lineno", 0), getattr(ast, "col_offset", 0)),
+109 end=(getattr(ast, "end_lineno", 0),
+110 getattr(ast, "end_col_offset", 0)),
+111 )
+
93 @staticmethod
+ 94 def from_ast(ast: ast.AST) -> Optional["Span"]:
+ 95 if not hasattr(ast, "lineno"):
+ 96 return None
+ 97 if not hasattr(ast, "col_offset"):
+ 98 return None
+ 99 if not hasattr(ast, "end_lineno") or ast.end_lineno is None:
+100 return None
+101 if not hasattr(ast, "end_col_offset") or ast.end_col_offset is None:
+102 return None
+103 file = None
+104 if hasattr(ast, "source_file"):
+105 file = getattr(ast, "source_file")
+106 return Span(
+107 file=file,
+108 start=(getattr(ast, "lineno", 0), getattr(ast, "col_offset", 0)),
+109 end=(getattr(ast, "end_lineno", 0),
+110 getattr(ast, "end_col_offset", 0)),
+111 )
+
135def get_typevar_constrains_and_bounds(t: TypeVar) -> Tuple[List[Any], Optional[Any]]:
+136 """
+137 Find the constraints and bounds of a TypeVar.
+138 Only one of the two can be present.
+139 """
+140 constraints = []
+141 bound = None
+142 if hasattr(t, "__constraints__"):
+143 constraints = list(t.__constraints__)
+144 if hasattr(t, "__bound__"):
+145 bound = t.__bound__
+146 return constraints, bound
+
Generates Rust API code for a given DSL module
\n"}, {"fullname": "luisa_lang.hir", "modulename": "luisa_lang.hir", "kind": "module", "doc": "\n"}, {"fullname": "luisa_lang.hir.PATH_PREFIX", "modulename": "luisa_lang.hir", "qualname": "PATH_PREFIX", "kind": "variable", "doc": "\n", "default_value": "'luisa_lang'"}, {"fullname": "luisa_lang.hir.FunctionTemplateResolvingArgs", "modulename": "luisa_lang.hir", "qualname": "FunctionTemplateResolvingArgs", "kind": "variable", "doc": "[Function parameter name, Type or Value].\nThe reason for using parameter name instead of GenericParameter is that python supports passing type[T] as a parameter,
\n", "default_value": "typing.List[typing.Tuple[str, typing.Union[ForwardRef('Type'), typing.Any]]]"}, {"fullname": "luisa_lang.hir.FunctionTemplateResolvingFunc", "modulename": "luisa_lang.hir", "qualname": "FunctionTemplateResolvingFunc", "kind": "variable", "doc": "\n", "default_value": "typing.Callable[[typing.List[typing.Tuple[str, typing.Union[ForwardRef('Type'), typing.Any]]]], typing.Union[ForwardRef('Function'), ForwardRef('TemplateMatchingError')]]"}, {"fullname": "luisa_lang.hir.FuncProperties", "modulename": "luisa_lang.hir", "qualname": "FuncProperties", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.hir.FuncProperties.inline", "modulename": "luisa_lang.hir", "qualname": "FuncProperties.inline", "kind": "variable", "doc": "\n", "annotation": ": Union[bool, Literal['never', 'always']]"}, {"fullname": "luisa_lang.hir.FuncProperties.export", "modulename": "luisa_lang.hir", "qualname": "FuncProperties.export", "kind": "variable", "doc": "\n", "annotation": ": bool"}, {"fullname": "luisa_lang.hir.FuncProperties.byref", "modulename": "luisa_lang.hir", "qualname": "FuncProperties.byref", "kind": "variable", "doc": "\n", "annotation": ": Set[str]"}, {"fullname": "luisa_lang.hir.FuncProperties.returning_ref", "modulename": "luisa_lang.hir", "qualname": "FuncProperties.returning_ref", "kind": "variable", "doc": "\n", "annotation": ": bool"}, {"fullname": "luisa_lang.hir.FunctionTemplate", "modulename": "luisa_lang.hir", "qualname": "FunctionTemplate", "kind": "class", "doc": "Contains a delegate that can be resolved to a function.\nThis is to support generic functions as well as meta-programming.\nSince each time the function is called in DSL, user meta-programming code in the function body\nwill be called, we need to keep the AST of the function.
\n"}, {"fullname": "luisa_lang.hir.FunctionTemplate.__init__", "modulename": "luisa_lang.hir", "qualname": "FunctionTemplate.__init__", "kind": "function", "doc": "\n", "signature": "(\tname: str,\tparams: List[str],\tparsing_func: Callable[[List[Tuple[str, Union[luisa_lang.hir.Type, Any]]]], Union[luisa_lang.hir.Function, luisa_lang.hir.TemplateMatchingError]],\tis_generic: bool)"}, {"fullname": "luisa_lang.hir.FunctionTemplate.parsing_func", "modulename": "luisa_lang.hir", "qualname": "FunctionTemplate.parsing_func", "kind": "variable", "doc": "\n", "annotation": ": Callable[[List[Tuple[str, Union[luisa_lang.hir.Type, Any]]]], Union[luisa_lang.hir.Function, luisa_lang.hir.TemplateMatchingError]]"}, {"fullname": "luisa_lang.hir.FunctionTemplate.is_generic", "modulename": "luisa_lang.hir", "qualname": "FunctionTemplate.is_generic", "kind": "variable", "doc": "\n", "annotation": ": bool"}, {"fullname": "luisa_lang.hir.FunctionTemplate.name", "modulename": "luisa_lang.hir", "qualname": "FunctionTemplate.name", "kind": "variable", "doc": "\n", "annotation": ": str"}, {"fullname": "luisa_lang.hir.FunctionTemplate.params", "modulename": "luisa_lang.hir", "qualname": "FunctionTemplate.params", "kind": "variable", "doc": "\n", "annotation": ": List[str]"}, {"fullname": "luisa_lang.hir.FunctionTemplate.props", "modulename": "luisa_lang.hir", "qualname": "FunctionTemplate.props", "kind": "variable", "doc": "Function parameters (NOT type parameters)
\n", "annotation": ": Optional[luisa_lang.hir.FuncProperties]"}, {"fullname": "luisa_lang.hir.FunctionTemplate.resolve", "modulename": "luisa_lang.hir", "qualname": "FunctionTemplate.resolve", "kind": "function", "doc": "\n", "signature": "(\tself,\targs: Optional[List[Tuple[str, Union[luisa_lang.hir.Type, Any]]]]) -> Union[luisa_lang.hir.Function, luisa_lang.hir.TemplateMatchingError]:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.FunctionTemplate.reset", "modulename": "luisa_lang.hir", "qualname": "FunctionTemplate.reset", "kind": "function", "doc": "\n", "signature": "(self) -> None:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.FunctionTemplate.inline_hint", "modulename": "luisa_lang.hir", "qualname": "FunctionTemplate.inline_hint", "kind": "function", "doc": "\n", "signature": "(self) -> Union[bool, Literal['never', 'always']]:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.DynamicIndex", "modulename": "luisa_lang.hir", "qualname": "DynamicIndex", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.hir.Type", "modulename": "luisa_lang.hir", "qualname": "Type", "kind": "class", "doc": "Helper class that provides a standard way to create an ABC using\ninheritance.
\n", "bases": "abc.ABC"}, {"fullname": "luisa_lang.hir.Type.methods", "modulename": "luisa_lang.hir", "qualname": "Type.methods", "kind": "variable", "doc": "\n", "annotation": ": Dict[str, Union[luisa_lang.hir.Function, luisa_lang.hir.FunctionTemplate]]"}, {"fullname": "luisa_lang.hir.Type.is_builtin", "modulename": "luisa_lang.hir", "qualname": "Type.is_builtin", "kind": "variable", "doc": "\n", "annotation": ": bool"}, {"fullname": "luisa_lang.hir.Type.size", "modulename": "luisa_lang.hir", "qualname": "Type.size", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.Type.align", "modulename": "luisa_lang.hir", "qualname": "Type.align", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.Type.member", "modulename": "luisa_lang.hir", "qualname": "Type.member", "kind": "function", "doc": "\n", "signature": "(self, field: Any) -> Optional[luisa_lang.hir.Type]:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.Type.method", "modulename": "luisa_lang.hir", "qualname": "Type.method", "kind": "function", "doc": "\n", "signature": "(\tself,\tname: str) -> Union[luisa_lang.hir.Function, luisa_lang.hir.FunctionTemplate, NoneType]:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.Type.is_concrete", "modulename": "luisa_lang.hir", "qualname": "Type.is_concrete", "kind": "function", "doc": "\n", "signature": "(self) -> bool:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.LiteralType", "modulename": "luisa_lang.hir", "qualname": "LiteralType", "kind": "class", "doc": "Helper class that provides a standard way to create an ABC using\ninheritance.
\n", "bases": "Type"}, {"fullname": "luisa_lang.hir.LiteralType.__init__", "modulename": "luisa_lang.hir", "qualname": "LiteralType.__init__", "kind": "function", "doc": "\n", "signature": "(value: Any)"}, {"fullname": "luisa_lang.hir.LiteralType.value", "modulename": "luisa_lang.hir", "qualname": "LiteralType.value", "kind": "variable", "doc": "\n", "annotation": ": Any"}, {"fullname": "luisa_lang.hir.LiteralType.size", "modulename": "luisa_lang.hir", "qualname": "LiteralType.size", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.LiteralType.align", "modulename": "luisa_lang.hir", "qualname": "LiteralType.align", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.LiteralType.is_concrete", "modulename": "luisa_lang.hir", "qualname": "LiteralType.is_concrete", "kind": "function", "doc": "\n", "signature": "(self) -> bool:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.AnyType", "modulename": "luisa_lang.hir", "qualname": "AnyType", "kind": "class", "doc": "Helper class that provides a standard way to create an ABC using\ninheritance.
\n", "bases": "Type"}, {"fullname": "luisa_lang.hir.AnyType.size", "modulename": "luisa_lang.hir", "qualname": "AnyType.size", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.AnyType.align", "modulename": "luisa_lang.hir", "qualname": "AnyType.align", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.UnitType", "modulename": "luisa_lang.hir", "qualname": "UnitType", "kind": "class", "doc": "Helper class that provides a standard way to create an ABC using\ninheritance.
\n", "bases": "Type"}, {"fullname": "luisa_lang.hir.UnitType.size", "modulename": "luisa_lang.hir", "qualname": "UnitType.size", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.UnitType.align", "modulename": "luisa_lang.hir", "qualname": "UnitType.align", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.ScalarType", "modulename": "luisa_lang.hir", "qualname": "ScalarType", "kind": "class", "doc": "Helper class that provides a standard way to create an ABC using\ninheritance.
\n", "bases": "Type"}, {"fullname": "luisa_lang.hir.BoolType", "modulename": "luisa_lang.hir", "qualname": "BoolType", "kind": "class", "doc": "Helper class that provides a standard way to create an ABC using\ninheritance.
\n", "bases": "ScalarType"}, {"fullname": "luisa_lang.hir.BoolType.size", "modulename": "luisa_lang.hir", "qualname": "BoolType.size", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.BoolType.align", "modulename": "luisa_lang.hir", "qualname": "BoolType.align", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.IntType", "modulename": "luisa_lang.hir", "qualname": "IntType", "kind": "class", "doc": "Helper class that provides a standard way to create an ABC using\ninheritance.
\n", "bases": "ScalarType"}, {"fullname": "luisa_lang.hir.IntType.__init__", "modulename": "luisa_lang.hir", "qualname": "IntType.__init__", "kind": "function", "doc": "\n", "signature": "(bits: int, signed: bool)"}, {"fullname": "luisa_lang.hir.IntType.bits", "modulename": "luisa_lang.hir", "qualname": "IntType.bits", "kind": "variable", "doc": "\n", "annotation": ": int"}, {"fullname": "luisa_lang.hir.IntType.signed", "modulename": "luisa_lang.hir", "qualname": "IntType.signed", "kind": "variable", "doc": "\n", "annotation": ": bool"}, {"fullname": "luisa_lang.hir.IntType.size", "modulename": "luisa_lang.hir", "qualname": "IntType.size", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.IntType.align", "modulename": "luisa_lang.hir", "qualname": "IntType.align", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.GenericFloatType", "modulename": "luisa_lang.hir", "qualname": "GenericFloatType", "kind": "class", "doc": "Helper class that provides a standard way to create an ABC using\ninheritance.
\n", "bases": "ScalarType"}, {"fullname": "luisa_lang.hir.GenericFloatType.size", "modulename": "luisa_lang.hir", "qualname": "GenericFloatType.size", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.GenericFloatType.align", "modulename": "luisa_lang.hir", "qualname": "GenericFloatType.align", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.GenericFloatType.is_concrete", "modulename": "luisa_lang.hir", "qualname": "GenericFloatType.is_concrete", "kind": "function", "doc": "\n", "signature": "(self) -> bool:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.GenericIntType", "modulename": "luisa_lang.hir", "qualname": "GenericIntType", "kind": "class", "doc": "Helper class that provides a standard way to create an ABC using\ninheritance.
\n", "bases": "ScalarType"}, {"fullname": "luisa_lang.hir.GenericIntType.size", "modulename": "luisa_lang.hir", "qualname": "GenericIntType.size", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.GenericIntType.align", "modulename": "luisa_lang.hir", "qualname": "GenericIntType.align", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.GenericIntType.is_concrete", "modulename": "luisa_lang.hir", "qualname": "GenericIntType.is_concrete", "kind": "function", "doc": "\n", "signature": "(self) -> bool:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.FloatType", "modulename": "luisa_lang.hir", "qualname": "FloatType", "kind": "class", "doc": "Helper class that provides a standard way to create an ABC using\ninheritance.
\n", "bases": "ScalarType"}, {"fullname": "luisa_lang.hir.FloatType.__init__", "modulename": "luisa_lang.hir", "qualname": "FloatType.__init__", "kind": "function", "doc": "\n", "signature": "(bits: int)"}, {"fullname": "luisa_lang.hir.FloatType.bits", "modulename": "luisa_lang.hir", "qualname": "FloatType.bits", "kind": "variable", "doc": "\n", "annotation": ": int"}, {"fullname": "luisa_lang.hir.FloatType.size", "modulename": "luisa_lang.hir", "qualname": "FloatType.size", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.FloatType.align", "modulename": "luisa_lang.hir", "qualname": "FloatType.align", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.VectorType", "modulename": "luisa_lang.hir", "qualname": "VectorType", "kind": "class", "doc": "Helper class that provides a standard way to create an ABC using\ninheritance.
\n", "bases": "Type"}, {"fullname": "luisa_lang.hir.VectorType.__init__", "modulename": "luisa_lang.hir", "qualname": "VectorType.__init__", "kind": "function", "doc": "\n", "signature": "(element: luisa_lang.hir.Type, count: int, align: int | None = None)"}, {"fullname": "luisa_lang.hir.VectorType.element", "modulename": "luisa_lang.hir", "qualname": "VectorType.element", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.Type"}, {"fullname": "luisa_lang.hir.VectorType.count", "modulename": "luisa_lang.hir", "qualname": "VectorType.count", "kind": "variable", "doc": "\n", "annotation": ": int"}, {"fullname": "luisa_lang.hir.VectorType.size", "modulename": "luisa_lang.hir", "qualname": "VectorType.size", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.VectorType.align", "modulename": "luisa_lang.hir", "qualname": "VectorType.align", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.VectorType.member", "modulename": "luisa_lang.hir", "qualname": "VectorType.member", "kind": "function", "doc": "\n", "signature": "(self, field: Any) -> Optional[luisa_lang.hir.Type]:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.ArrayType", "modulename": "luisa_lang.hir", "qualname": "ArrayType", "kind": "class", "doc": "Helper class that provides a standard way to create an ABC using\ninheritance.
\n", "bases": "Type"}, {"fullname": "luisa_lang.hir.ArrayType.__init__", "modulename": "luisa_lang.hir", "qualname": "ArrayType.__init__", "kind": "function", "doc": "\n", "signature": "(\telement: luisa_lang.hir.Type,\tcount: Union[int, luisa_lang.hir.SymbolicConstant])"}, {"fullname": "luisa_lang.hir.ArrayType.element", "modulename": "luisa_lang.hir", "qualname": "ArrayType.element", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.Type"}, {"fullname": "luisa_lang.hir.ArrayType.count", "modulename": "luisa_lang.hir", "qualname": "ArrayType.count", "kind": "variable", "doc": "\n", "annotation": ": Union[int, luisa_lang.hir.SymbolicConstant]"}, {"fullname": "luisa_lang.hir.ArrayType.size", "modulename": "luisa_lang.hir", "qualname": "ArrayType.size", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.ArrayType.align", "modulename": "luisa_lang.hir", "qualname": "ArrayType.align", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.PointerType", "modulename": "luisa_lang.hir", "qualname": "PointerType", "kind": "class", "doc": "Helper class that provides a standard way to create an ABC using\ninheritance.
\n", "bases": "Type"}, {"fullname": "luisa_lang.hir.PointerType.__init__", "modulename": "luisa_lang.hir", "qualname": "PointerType.__init__", "kind": "function", "doc": "\n", "signature": "(element: luisa_lang.hir.Type)"}, {"fullname": "luisa_lang.hir.PointerType.element", "modulename": "luisa_lang.hir", "qualname": "PointerType.element", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.Type"}, {"fullname": "luisa_lang.hir.PointerType.size", "modulename": "luisa_lang.hir", "qualname": "PointerType.size", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.PointerType.align", "modulename": "luisa_lang.hir", "qualname": "PointerType.align", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.TupleType", "modulename": "luisa_lang.hir", "qualname": "TupleType", "kind": "class", "doc": "Helper class that provides a standard way to create an ABC using\ninheritance.
\n", "bases": "Type"}, {"fullname": "luisa_lang.hir.TupleType.__init__", "modulename": "luisa_lang.hir", "qualname": "TupleType.__init__", "kind": "function", "doc": "\n", "signature": "(elements: List[luisa_lang.hir.Type])"}, {"fullname": "luisa_lang.hir.TupleType.elements", "modulename": "luisa_lang.hir", "qualname": "TupleType.elements", "kind": "variable", "doc": "\n", "annotation": ": List[luisa_lang.hir.Type]"}, {"fullname": "luisa_lang.hir.TupleType.size", "modulename": "luisa_lang.hir", "qualname": "TupleType.size", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.TupleType.align", "modulename": "luisa_lang.hir", "qualname": "TupleType.align", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.TupleType.member", "modulename": "luisa_lang.hir", "qualname": "TupleType.member", "kind": "function", "doc": "\n", "signature": "(self, field: Any) -> Optional[luisa_lang.hir.Type]:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.StructType", "modulename": "luisa_lang.hir", "qualname": "StructType", "kind": "class", "doc": "Helper class that provides a standard way to create an ABC using\ninheritance.
\n", "bases": "Type"}, {"fullname": "luisa_lang.hir.StructType.__init__", "modulename": "luisa_lang.hir", "qualname": "StructType.__init__", "kind": "function", "doc": "\n", "signature": "(\tname: str,\tdisplay_name: str,\tfields: List[Tuple[str, luisa_lang.hir.Type]])"}, {"fullname": "luisa_lang.hir.StructType.name", "modulename": "luisa_lang.hir", "qualname": "StructType.name", "kind": "variable", "doc": "\n", "annotation": ": str"}, {"fullname": "luisa_lang.hir.StructType.display_name", "modulename": "luisa_lang.hir", "qualname": "StructType.display_name", "kind": "variable", "doc": "\n", "annotation": ": str"}, {"fullname": "luisa_lang.hir.StructType.fields", "modulename": "luisa_lang.hir", "qualname": "StructType.fields", "kind": "variable", "doc": "\n", "annotation": ": List[Tuple[str, luisa_lang.hir.Type]]"}, {"fullname": "luisa_lang.hir.StructType.size", "modulename": "luisa_lang.hir", "qualname": "StructType.size", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.StructType.align", "modulename": "luisa_lang.hir", "qualname": "StructType.align", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.StructType.member", "modulename": "luisa_lang.hir", "qualname": "StructType.member", "kind": "function", "doc": "\n", "signature": "(self, field: Any) -> Optional[luisa_lang.hir.Type]:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.TypeBound", "modulename": "luisa_lang.hir", "qualname": "TypeBound", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.hir.TypeBound.satisfied_by", "modulename": "luisa_lang.hir", "qualname": "TypeBound.satisfied_by", "kind": "function", "doc": "\n", "signature": "(self, ty: luisa_lang.hir.Type) -> bool:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.AnyBound", "modulename": "luisa_lang.hir", "qualname": "AnyBound", "kind": "class", "doc": "\n", "bases": "TypeBound"}, {"fullname": "luisa_lang.hir.AnyBound.satisfied_by", "modulename": "luisa_lang.hir", "qualname": "AnyBound.satisfied_by", "kind": "function", "doc": "\n", "signature": "(self, ty: luisa_lang.hir.Type) -> bool:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.SubtypeBound", "modulename": "luisa_lang.hir", "qualname": "SubtypeBound", "kind": "class", "doc": "\n", "bases": "TypeBound"}, {"fullname": "luisa_lang.hir.SubtypeBound.__init__", "modulename": "luisa_lang.hir", "qualname": "SubtypeBound.__init__", "kind": "function", "doc": "\n", "signature": "(super_type: luisa_lang.hir.Type, exact_match: bool)"}, {"fullname": "luisa_lang.hir.SubtypeBound.super_type", "modulename": "luisa_lang.hir", "qualname": "SubtypeBound.super_type", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.Type"}, {"fullname": "luisa_lang.hir.SubtypeBound.exact_match", "modulename": "luisa_lang.hir", "qualname": "SubtypeBound.exact_match", "kind": "variable", "doc": "\n", "annotation": ": bool"}, {"fullname": "luisa_lang.hir.SubtypeBound.satisfied_by", "modulename": "luisa_lang.hir", "qualname": "SubtypeBound.satisfied_by", "kind": "function", "doc": "\n", "signature": "(self, ty: luisa_lang.hir.Type) -> bool:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.UnionBound", "modulename": "luisa_lang.hir", "qualname": "UnionBound", "kind": "class", "doc": "\n", "bases": "TypeBound"}, {"fullname": "luisa_lang.hir.UnionBound.__init__", "modulename": "luisa_lang.hir", "qualname": "UnionBound.__init__", "kind": "function", "doc": "\n", "signature": "(bounds: List[luisa_lang.hir.SubtypeBound])"}, {"fullname": "luisa_lang.hir.UnionBound.bounds", "modulename": "luisa_lang.hir", "qualname": "UnionBound.bounds", "kind": "variable", "doc": "\n", "annotation": ": List[luisa_lang.hir.SubtypeBound]"}, {"fullname": "luisa_lang.hir.UnionBound.satisfied_by", "modulename": "luisa_lang.hir", "qualname": "UnionBound.satisfied_by", "kind": "function", "doc": "\n", "signature": "(self, ty: luisa_lang.hir.Type) -> bool:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.GenericParameter", "modulename": "luisa_lang.hir", "qualname": "GenericParameter", "kind": "class", "doc": "A GenericParameter contains three parts:\n name@ctx_name: bound
\n"}, {"fullname": "luisa_lang.hir.GenericParameter.__init__", "modulename": "luisa_lang.hir", "qualname": "GenericParameter.__init__", "kind": "function", "doc": "\n", "signature": "(\tname: str,\tctx_name: str,\tbound: luisa_lang.hir.TypeBound | None = None)"}, {"fullname": "luisa_lang.hir.GenericParameter.name", "modulename": "luisa_lang.hir", "qualname": "GenericParameter.name", "kind": "variable", "doc": "name of the generic parameter in source code, e.g. 'T'
\n", "annotation": ": str"}, {"fullname": "luisa_lang.hir.GenericParameter.ctx_name", "modulename": "luisa_lang.hir", "qualname": "GenericParameter.ctx_name", "kind": "variable", "doc": "a string describing the context (where the generic parameter is defined), e.g. 'some_function'
\n", "annotation": ": str"}, {"fullname": "luisa_lang.hir.GenericParameter.bound", "modulename": "luisa_lang.hir", "qualname": "GenericParameter.bound", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.TypeBound | None"}, {"fullname": "luisa_lang.hir.OpaqueType", "modulename": "luisa_lang.hir", "qualname": "OpaqueType", "kind": "class", "doc": "Helper class that provides a standard way to create an ABC using\ninheritance.
\n", "bases": "Type"}, {"fullname": "luisa_lang.hir.OpaqueType.__init__", "modulename": "luisa_lang.hir", "qualname": "OpaqueType.__init__", "kind": "function", "doc": "\n", "signature": "(name: str, extra: Optional[List[Any]] = None)"}, {"fullname": "luisa_lang.hir.OpaqueType.name", "modulename": "luisa_lang.hir", "qualname": "OpaqueType.name", "kind": "variable", "doc": "\n", "annotation": ": str"}, {"fullname": "luisa_lang.hir.OpaqueType.extra_args", "modulename": "luisa_lang.hir", "qualname": "OpaqueType.extra_args", "kind": "variable", "doc": "\n", "annotation": ": List[Any]"}, {"fullname": "luisa_lang.hir.OpaqueType.size", "modulename": "luisa_lang.hir", "qualname": "OpaqueType.size", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.OpaqueType.align", "modulename": "luisa_lang.hir", "qualname": "OpaqueType.align", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.OpaqueType.is_concrete", "modulename": "luisa_lang.hir", "qualname": "OpaqueType.is_concrete", "kind": "function", "doc": "\n", "signature": "(self) -> bool:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.SymbolicType", "modulename": "luisa_lang.hir", "qualname": "SymbolicType", "kind": "class", "doc": "Helper class that provides a standard way to create an ABC using\ninheritance.
\n", "bases": "Type"}, {"fullname": "luisa_lang.hir.SymbolicType.__init__", "modulename": "luisa_lang.hir", "qualname": "SymbolicType.__init__", "kind": "function", "doc": "\n", "signature": "(param: luisa_lang.hir.GenericParameter)"}, {"fullname": "luisa_lang.hir.SymbolicType.param", "modulename": "luisa_lang.hir", "qualname": "SymbolicType.param", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.GenericParameter"}, {"fullname": "luisa_lang.hir.SymbolicType.size", "modulename": "luisa_lang.hir", "qualname": "SymbolicType.size", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.SymbolicType.align", "modulename": "luisa_lang.hir", "qualname": "SymbolicType.align", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.MonomorphizationFunc", "modulename": "luisa_lang.hir", "qualname": "MonomorphizationFunc", "kind": "variable", "doc": "\n", "default_value": "typing.Callable[[typing.List[luisa_lang.hir.Type]], luisa_lang.hir.Type]"}, {"fullname": "luisa_lang.hir.ParametricType", "modulename": "luisa_lang.hir", "qualname": "ParametricType", "kind": "class", "doc": "The definition of a parametric type, e.g. class Foo[T]: ...
\n", "bases": "Type"}, {"fullname": "luisa_lang.hir.ParametricType.__init__", "modulename": "luisa_lang.hir", "qualname": "ParametricType.__init__", "kind": "function", "doc": "\n", "signature": "(\tparams: List[luisa_lang.hir.GenericParameter],\tbody: luisa_lang.hir.Type,\tmonomorphification_func: Optional[Callable[[List[luisa_lang.hir.Type]], luisa_lang.hir.Type]] = None)"}, {"fullname": "luisa_lang.hir.ParametricType.params", "modulename": "luisa_lang.hir", "qualname": "ParametricType.params", "kind": "variable", "doc": "\n", "annotation": ": List[luisa_lang.hir.GenericParameter]"}, {"fullname": "luisa_lang.hir.ParametricType.body", "modulename": "luisa_lang.hir", "qualname": "ParametricType.body", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.Type"}, {"fullname": "luisa_lang.hir.ParametricType.monomorphification_cache", "modulename": "luisa_lang.hir", "qualname": "ParametricType.monomorphification_cache", "kind": "variable", "doc": "\n", "annotation": ": Dict[Tuple[Union[luisa_lang.hir.Type, Any], ...], luisa_lang.hir.Type]"}, {"fullname": "luisa_lang.hir.ParametricType.monomorphification_func", "modulename": "luisa_lang.hir", "qualname": "ParametricType.monomorphification_func", "kind": "variable", "doc": "\n", "annotation": ": Optional[Callable[[List[luisa_lang.hir.Type]], luisa_lang.hir.Type]]"}, {"fullname": "luisa_lang.hir.ParametricType.instantiate", "modulename": "luisa_lang.hir", "qualname": "ParametricType.instantiate", "kind": "function", "doc": "\n", "signature": "(self, args: List[Union[luisa_lang.hir.Type, Any]]) -> luisa_lang.hir.Type:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.ParametricType.size", "modulename": "luisa_lang.hir", "qualname": "ParametricType.size", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.ParametricType.align", "modulename": "luisa_lang.hir", "qualname": "ParametricType.align", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.BoundType", "modulename": "luisa_lang.hir", "qualname": "BoundType", "kind": "class", "doc": "An instance of a parametric type, e.g. Foo[int]
\n", "bases": "Type"}, {"fullname": "luisa_lang.hir.BoundType.__init__", "modulename": "luisa_lang.hir", "qualname": "BoundType.__init__", "kind": "function", "doc": "\n", "signature": "(\tgeneric: luisa_lang.hir.ParametricType,\targs: List[Union[luisa_lang.hir.Type, Any]],\tinstantiated: Optional[luisa_lang.hir.Type] = None)"}, {"fullname": "luisa_lang.hir.BoundType.generic", "modulename": "luisa_lang.hir", "qualname": "BoundType.generic", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.ParametricType"}, {"fullname": "luisa_lang.hir.BoundType.args", "modulename": "luisa_lang.hir", "qualname": "BoundType.args", "kind": "variable", "doc": "\n", "annotation": ": List[Union[luisa_lang.hir.Type, Any]]"}, {"fullname": "luisa_lang.hir.BoundType.instantiated", "modulename": "luisa_lang.hir", "qualname": "BoundType.instantiated", "kind": "variable", "doc": "\n", "annotation": ": Optional[luisa_lang.hir.Type]"}, {"fullname": "luisa_lang.hir.BoundType.size", "modulename": "luisa_lang.hir", "qualname": "BoundType.size", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.BoundType.align", "modulename": "luisa_lang.hir", "qualname": "BoundType.align", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.BoundType.member", "modulename": "luisa_lang.hir", "qualname": "BoundType.member", "kind": "function", "doc": "\n", "signature": "(self, field) -> Optional[luisa_lang.hir.Type]:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.BoundType.method", "modulename": "luisa_lang.hir", "qualname": "BoundType.method", "kind": "function", "doc": "\n", "signature": "(\tself,\tname) -> Union[luisa_lang.hir.Function, luisa_lang.hir.FunctionTemplate, NoneType]:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.TypeConstructorType", "modulename": "luisa_lang.hir", "qualname": "TypeConstructorType", "kind": "class", "doc": "Helper class that provides a standard way to create an ABC using\ninheritance.
\n", "bases": "Type"}, {"fullname": "luisa_lang.hir.TypeConstructorType.__init__", "modulename": "luisa_lang.hir", "qualname": "TypeConstructorType.__init__", "kind": "function", "doc": "\n", "signature": "(inner: luisa_lang.hir.Type)"}, {"fullname": "luisa_lang.hir.TypeConstructorType.inner", "modulename": "luisa_lang.hir", "qualname": "TypeConstructorType.inner", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.Type"}, {"fullname": "luisa_lang.hir.TypeConstructorType.size", "modulename": "luisa_lang.hir", "qualname": "TypeConstructorType.size", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.TypeConstructorType.align", "modulename": "luisa_lang.hir", "qualname": "TypeConstructorType.align", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.FunctionType", "modulename": "luisa_lang.hir", "qualname": "FunctionType", "kind": "class", "doc": "Helper class that provides a standard way to create an ABC using\ninheritance.
\n", "bases": "Type"}, {"fullname": "luisa_lang.hir.FunctionType.__init__", "modulename": "luisa_lang.hir", "qualname": "FunctionType.__init__", "kind": "function", "doc": "\n", "signature": "(\tfunc_like: Union[luisa_lang.hir.Function, luisa_lang.hir.FunctionTemplate],\tbound_object: Optional[luisa_lang.hir.Ref])"}, {"fullname": "luisa_lang.hir.FunctionType.func_like", "modulename": "luisa_lang.hir", "qualname": "FunctionType.func_like", "kind": "variable", "doc": "\n", "annotation": ": Union[luisa_lang.hir.Function, luisa_lang.hir.FunctionTemplate]"}, {"fullname": "luisa_lang.hir.FunctionType.bound_object", "modulename": "luisa_lang.hir", "qualname": "FunctionType.bound_object", "kind": "variable", "doc": "\n", "annotation": ": Optional[luisa_lang.hir.Ref]"}, {"fullname": "luisa_lang.hir.FunctionType.size", "modulename": "luisa_lang.hir", "qualname": "FunctionType.size", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.FunctionType.align", "modulename": "luisa_lang.hir", "qualname": "FunctionType.align", "kind": "function", "doc": "\n", "signature": "(self) -> int:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.Node", "modulename": "luisa_lang.hir", "qualname": "Node", "kind": "class", "doc": "Base class for all nodes in the HIR. A node could be a value, a reference, or a statement.\nNodes equality is based on their identity.
\n"}, {"fullname": "luisa_lang.hir.Node.__init__", "modulename": "luisa_lang.hir", "qualname": "Node.__init__", "kind": "function", "doc": "\n", "signature": "(span: Optional[luisa_lang.utils.Span] = None)"}, {"fullname": "luisa_lang.hir.Node.span", "modulename": "luisa_lang.hir", "qualname": "Node.span", "kind": "variable", "doc": "\n", "annotation": ": Optional[luisa_lang.utils.Span]"}, {"fullname": "luisa_lang.hir.BasicBlock", "modulename": "luisa_lang.hir", "qualname": "BasicBlock", "kind": "class", "doc": "Base class for all nodes in the HIR. A node could be a value, a reference, or a statement.\nNodes equality is based on their identity.
\n", "bases": "Node"}, {"fullname": "luisa_lang.hir.BasicBlock.__init__", "modulename": "luisa_lang.hir", "qualname": "BasicBlock.__init__", "kind": "function", "doc": "\n", "signature": "(span: Optional[luisa_lang.utils.Span] = None)"}, {"fullname": "luisa_lang.hir.BasicBlock.nodes", "modulename": "luisa_lang.hir", "qualname": "BasicBlock.nodes", "kind": "variable", "doc": "\n", "annotation": ": List[luisa_lang.hir.Node]"}, {"fullname": "luisa_lang.hir.BasicBlock.terminated", "modulename": "luisa_lang.hir", "qualname": "BasicBlock.terminated", "kind": "variable", "doc": "\n", "annotation": ": bool"}, {"fullname": "luisa_lang.hir.BasicBlock.span", "modulename": "luisa_lang.hir", "qualname": "BasicBlock.span", "kind": "variable", "doc": "\n"}, {"fullname": "luisa_lang.hir.BasicBlock.append", "modulename": "luisa_lang.hir", "qualname": "BasicBlock.append", "kind": "function", "doc": "\n", "signature": "(self, node: ~NodeT) -> ~NodeT:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.TypedNode", "modulename": "luisa_lang.hir", "qualname": "TypedNode", "kind": "class", "doc": "A node with a type, which can either be values or references.
\n", "bases": "Node"}, {"fullname": "luisa_lang.hir.TypedNode.__init__", "modulename": "luisa_lang.hir", "qualname": "TypedNode.__init__", "kind": "function", "doc": "\n", "signature": "(\ttype: Optional[luisa_lang.hir.Type] = None,\tspan: Optional[luisa_lang.utils.Span] = None)"}, {"fullname": "luisa_lang.hir.TypedNode.type", "modulename": "luisa_lang.hir", "qualname": "TypedNode.type", "kind": "variable", "doc": "\n", "annotation": ": Optional[luisa_lang.hir.Type]"}, {"fullname": "luisa_lang.hir.TypedNode.span", "modulename": "luisa_lang.hir", "qualname": "TypedNode.span", "kind": "variable", "doc": "\n"}, {"fullname": "luisa_lang.hir.Ref", "modulename": "luisa_lang.hir", "qualname": "Ref", "kind": "class", "doc": "A node with a type, which can either be values or references.
\n", "bases": "TypedNode"}, {"fullname": "luisa_lang.hir.LocalRef", "modulename": "luisa_lang.hir", "qualname": "LocalRef", "kind": "class", "doc": "A node with a type, which can either be values or references.
\n", "bases": "Ref"}, {"fullname": "luisa_lang.hir.LocalRef.__init__", "modulename": "luisa_lang.hir", "qualname": "LocalRef.__init__", "kind": "function", "doc": "\n", "signature": "(value: luisa_lang.hir.Value)"}, {"fullname": "luisa_lang.hir.LocalRef.value", "modulename": "luisa_lang.hir", "qualname": "LocalRef.value", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.Value"}, {"fullname": "luisa_lang.hir.LocalRef.span", "modulename": "luisa_lang.hir", "qualname": "LocalRef.span", "kind": "variable", "doc": "\n"}, {"fullname": "luisa_lang.hir.Value", "modulename": "luisa_lang.hir", "qualname": "Value", "kind": "class", "doc": "A node with a type, which can either be values or references.
\n", "bases": "TypedNode"}, {"fullname": "luisa_lang.hir.Unit", "modulename": "luisa_lang.hir", "qualname": "Unit", "kind": "class", "doc": "A node with a type, which can either be values or references.
\n", "bases": "Value"}, {"fullname": "luisa_lang.hir.SymbolicConstant", "modulename": "luisa_lang.hir", "qualname": "SymbolicConstant", "kind": "class", "doc": "A node with a type, which can either be values or references.
\n", "bases": "Value"}, {"fullname": "luisa_lang.hir.SymbolicConstant.__init__", "modulename": "luisa_lang.hir", "qualname": "SymbolicConstant.__init__", "kind": "function", "doc": "\n", "signature": "(\tgeneric: luisa_lang.hir.GenericParameter,\ttype: Optional[luisa_lang.hir.Type] = None,\tspan: Optional[luisa_lang.utils.Span] = None)"}, {"fullname": "luisa_lang.hir.SymbolicConstant.generic", "modulename": "luisa_lang.hir", "qualname": "SymbolicConstant.generic", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.GenericParameter"}, {"fullname": "luisa_lang.hir.ParameterSemantic", "modulename": "luisa_lang.hir", "qualname": "ParameterSemantic", "kind": "class", "doc": "\n", "bases": "enum.Enum"}, {"fullname": "luisa_lang.hir.ParameterSemantic.BYVAL", "modulename": "luisa_lang.hir", "qualname": "ParameterSemantic.BYVAL", "kind": "variable", "doc": "\n", "default_value": "<ParameterSemantic.BYVAL: 1>"}, {"fullname": "luisa_lang.hir.ParameterSemantic.BYREF", "modulename": "luisa_lang.hir", "qualname": "ParameterSemantic.BYREF", "kind": "variable", "doc": "\n", "default_value": "<ParameterSemantic.BYREF: 2>"}, {"fullname": "luisa_lang.hir.Var", "modulename": "luisa_lang.hir", "qualname": "Var", "kind": "class", "doc": "A node with a type, which can either be values or references.
\n", "bases": "Ref"}, {"fullname": "luisa_lang.hir.Var.__init__", "modulename": "luisa_lang.hir", "qualname": "Var.__init__", "kind": "function", "doc": "\n", "signature": "(\tname: str,\ttype: Optional[luisa_lang.hir.Type],\tspan: Optional[luisa_lang.utils.Span],\tsemantic=<ParameterSemantic.BYVAL: 1>)"}, {"fullname": "luisa_lang.hir.Var.name", "modulename": "luisa_lang.hir", "qualname": "Var.name", "kind": "variable", "doc": "\n", "annotation": ": str"}, {"fullname": "luisa_lang.hir.Var.semantic", "modulename": "luisa_lang.hir", "qualname": "Var.semantic", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.ParameterSemantic"}, {"fullname": "luisa_lang.hir.Var.type", "modulename": "luisa_lang.hir", "qualname": "Var.type", "kind": "variable", "doc": "\n"}, {"fullname": "luisa_lang.hir.Member", "modulename": "luisa_lang.hir", "qualname": "Member", "kind": "class", "doc": "A node with a type, which can either be values or references.
\n", "bases": "Value"}, {"fullname": "luisa_lang.hir.Member.__init__", "modulename": "luisa_lang.hir", "qualname": "Member.__init__", "kind": "function", "doc": "\n", "signature": "(\tbase: luisa_lang.hir.Value,\tfield: str,\ttype: luisa_lang.hir.Type,\tspan: Optional[luisa_lang.utils.Span])"}, {"fullname": "luisa_lang.hir.Member.base", "modulename": "luisa_lang.hir", "qualname": "Member.base", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.Value"}, {"fullname": "luisa_lang.hir.Member.field", "modulename": "luisa_lang.hir", "qualname": "Member.field", "kind": "variable", "doc": "\n", "annotation": ": str"}, {"fullname": "luisa_lang.hir.Index", "modulename": "luisa_lang.hir", "qualname": "Index", "kind": "class", "doc": "A node with a type, which can either be values or references.
\n", "bases": "Value"}, {"fullname": "luisa_lang.hir.Index.__init__", "modulename": "luisa_lang.hir", "qualname": "Index.__init__", "kind": "function", "doc": "\n", "signature": "(\tbase: luisa_lang.hir.Value,\tindex: luisa_lang.hir.Value,\ttype: luisa_lang.hir.Type,\tspan: Optional[luisa_lang.utils.Span])"}, {"fullname": "luisa_lang.hir.Index.base", "modulename": "luisa_lang.hir", "qualname": "Index.base", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.Value"}, {"fullname": "luisa_lang.hir.Index.index", "modulename": "luisa_lang.hir", "qualname": "Index.index", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.Value"}, {"fullname": "luisa_lang.hir.MemberRef", "modulename": "luisa_lang.hir", "qualname": "MemberRef", "kind": "class", "doc": "A node with a type, which can either be values or references.
\n", "bases": "Ref"}, {"fullname": "luisa_lang.hir.MemberRef.__init__", "modulename": "luisa_lang.hir", "qualname": "MemberRef.__init__", "kind": "function", "doc": "\n", "signature": "(\tbase: luisa_lang.hir.Ref,\tfield: str,\ttype: luisa_lang.hir.Type,\tspan: Optional[luisa_lang.utils.Span])"}, {"fullname": "luisa_lang.hir.MemberRef.base", "modulename": "luisa_lang.hir", "qualname": "MemberRef.base", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.Ref"}, {"fullname": "luisa_lang.hir.MemberRef.field", "modulename": "luisa_lang.hir", "qualname": "MemberRef.field", "kind": "variable", "doc": "\n", "annotation": ": str"}, {"fullname": "luisa_lang.hir.IndexRef", "modulename": "luisa_lang.hir", "qualname": "IndexRef", "kind": "class", "doc": "A node with a type, which can either be values or references.
\n", "bases": "Ref"}, {"fullname": "luisa_lang.hir.IndexRef.__init__", "modulename": "luisa_lang.hir", "qualname": "IndexRef.__init__", "kind": "function", "doc": "\n", "signature": "(\tbase: luisa_lang.hir.Ref,\tindex: luisa_lang.hir.Value,\ttype: luisa_lang.hir.Type,\tspan: Optional[luisa_lang.utils.Span])"}, {"fullname": "luisa_lang.hir.IndexRef.base", "modulename": "luisa_lang.hir", "qualname": "IndexRef.base", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.Ref"}, {"fullname": "luisa_lang.hir.IndexRef.index", "modulename": "luisa_lang.hir", "qualname": "IndexRef.index", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.Value"}, {"fullname": "luisa_lang.hir.Load", "modulename": "luisa_lang.hir", "qualname": "Load", "kind": "class", "doc": "A node with a type, which can either be values or references.
\n", "bases": "Value"}, {"fullname": "luisa_lang.hir.Load.__init__", "modulename": "luisa_lang.hir", "qualname": "Load.__init__", "kind": "function", "doc": "\n", "signature": "(ref: luisa_lang.hir.Ref)"}, {"fullname": "luisa_lang.hir.Load.ref", "modulename": "luisa_lang.hir", "qualname": "Load.ref", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.Ref"}, {"fullname": "luisa_lang.hir.Constant", "modulename": "luisa_lang.hir", "qualname": "Constant", "kind": "class", "doc": "A node with a type, which can either be values or references.
\n", "bases": "Value"}, {"fullname": "luisa_lang.hir.Constant.__init__", "modulename": "luisa_lang.hir", "qualname": "Constant.__init__", "kind": "function", "doc": "\n", "signature": "(\tvalue: Any,\ttype: luisa_lang.hir.Type | None = None,\tspan: Optional[luisa_lang.utils.Span] = None)"}, {"fullname": "luisa_lang.hir.Constant.value", "modulename": "luisa_lang.hir", "qualname": "Constant.value", "kind": "variable", "doc": "\n", "annotation": ": Any"}, {"fullname": "luisa_lang.hir.TypeValue", "modulename": "luisa_lang.hir", "qualname": "TypeValue", "kind": "class", "doc": "A node with a type, which can either be values or references.
\n", "bases": "Value"}, {"fullname": "luisa_lang.hir.TypeValue.__init__", "modulename": "luisa_lang.hir", "qualname": "TypeValue.__init__", "kind": "function", "doc": "\n", "signature": "(\tty: luisa_lang.hir.Type,\tspan: Optional[luisa_lang.utils.Span] = None)"}, {"fullname": "luisa_lang.hir.TypeValue.inner_type", "modulename": "luisa_lang.hir", "qualname": "TypeValue.inner_type", "kind": "function", "doc": "\n", "signature": "(self) -> luisa_lang.hir.Type:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.FunctionValue", "modulename": "luisa_lang.hir", "qualname": "FunctionValue", "kind": "class", "doc": "A node with a type, which can either be values or references.
\n", "bases": "Value"}, {"fullname": "luisa_lang.hir.FunctionValue.__init__", "modulename": "luisa_lang.hir", "qualname": "FunctionValue.__init__", "kind": "function", "doc": "\n", "signature": "(\tty: luisa_lang.hir.FunctionType,\tspan: Optional[luisa_lang.utils.Span] = None)"}, {"fullname": "luisa_lang.hir.Alloca", "modulename": "luisa_lang.hir", "qualname": "Alloca", "kind": "class", "doc": "A temporary variable
\n", "bases": "Ref"}, {"fullname": "luisa_lang.hir.Alloca.__init__", "modulename": "luisa_lang.hir", "qualname": "Alloca.__init__", "kind": "function", "doc": "\n", "signature": "(\tty: luisa_lang.hir.Type,\tspan: Optional[luisa_lang.utils.Span] = None)"}, {"fullname": "luisa_lang.hir.AggregateInit", "modulename": "luisa_lang.hir", "qualname": "AggregateInit", "kind": "class", "doc": "A node with a type, which can either be values or references.
\n", "bases": "Value"}, {"fullname": "luisa_lang.hir.AggregateInit.__init__", "modulename": "luisa_lang.hir", "qualname": "AggregateInit.__init__", "kind": "function", "doc": "\n", "signature": "(\targs: List[luisa_lang.hir.Value],\ttype: luisa_lang.hir.Type,\tspan: Optional[luisa_lang.utils.Span] = None)"}, {"fullname": "luisa_lang.hir.AggregateInit.args", "modulename": "luisa_lang.hir", "qualname": "AggregateInit.args", "kind": "variable", "doc": "\n", "annotation": ": List[luisa_lang.hir.Value]"}, {"fullname": "luisa_lang.hir.Intrinsic", "modulename": "luisa_lang.hir", "qualname": "Intrinsic", "kind": "class", "doc": "A node with a type, which can either be values or references.
\n", "bases": "Value"}, {"fullname": "luisa_lang.hir.Intrinsic.__init__", "modulename": "luisa_lang.hir", "qualname": "Intrinsic.__init__", "kind": "function", "doc": "\n", "signature": "(\tname: str,\targs: List[luisa_lang.hir.Value | luisa_lang.hir.Ref],\ttype: luisa_lang.hir.Type,\tspan: Optional[luisa_lang.utils.Span] = None)"}, {"fullname": "luisa_lang.hir.Intrinsic.name", "modulename": "luisa_lang.hir", "qualname": "Intrinsic.name", "kind": "variable", "doc": "\n", "annotation": ": str"}, {"fullname": "luisa_lang.hir.Intrinsic.args", "modulename": "luisa_lang.hir", "qualname": "Intrinsic.args", "kind": "variable", "doc": "\n", "annotation": ": List[luisa_lang.hir.Value | luisa_lang.hir.Ref]"}, {"fullname": "luisa_lang.hir.IntrinsicRef", "modulename": "luisa_lang.hir", "qualname": "IntrinsicRef", "kind": "class", "doc": "A node with a type, which can either be values or references.
\n", "bases": "Ref"}, {"fullname": "luisa_lang.hir.IntrinsicRef.__init__", "modulename": "luisa_lang.hir", "qualname": "IntrinsicRef.__init__", "kind": "function", "doc": "\n", "signature": "(\tname: str,\targs: List[luisa_lang.hir.Value | luisa_lang.hir.Ref],\ttype: luisa_lang.hir.Type,\tspan: Optional[luisa_lang.utils.Span] = None)"}, {"fullname": "luisa_lang.hir.IntrinsicRef.name", "modulename": "luisa_lang.hir", "qualname": "IntrinsicRef.name", "kind": "variable", "doc": "\n", "annotation": ": str"}, {"fullname": "luisa_lang.hir.IntrinsicRef.args", "modulename": "luisa_lang.hir", "qualname": "IntrinsicRef.args", "kind": "variable", "doc": "\n", "annotation": ": List[luisa_lang.hir.Value | luisa_lang.hir.Ref]"}, {"fullname": "luisa_lang.hir.Call", "modulename": "luisa_lang.hir", "qualname": "Call", "kind": "class", "doc": "A node with a type, which can either be values or references.
\n", "bases": "Value"}, {"fullname": "luisa_lang.hir.Call.__init__", "modulename": "luisa_lang.hir", "qualname": "Call.__init__", "kind": "function", "doc": "\n", "signature": "(\top: luisa_lang.hir.Function,\targs: List[luisa_lang.hir.Value | luisa_lang.hir.Ref],\ttype: luisa_lang.hir.Type,\tspan: Optional[luisa_lang.utils.Span] = None)"}, {"fullname": "luisa_lang.hir.Call.op", "modulename": "luisa_lang.hir", "qualname": "Call.op", "kind": "variable", "doc": "After type inference, op should be a Value.
\n", "annotation": ": luisa_lang.hir.Function"}, {"fullname": "luisa_lang.hir.Call.args", "modulename": "luisa_lang.hir", "qualname": "Call.args", "kind": "variable", "doc": "\n", "annotation": ": List[luisa_lang.hir.Value | luisa_lang.hir.Ref]"}, {"fullname": "luisa_lang.hir.TemplateMatchingError", "modulename": "luisa_lang.hir", "qualname": "TemplateMatchingError", "kind": "class", "doc": "Common base class for all non-exit exceptions.
\n", "bases": "builtins.Exception"}, {"fullname": "luisa_lang.hir.TemplateMatchingError.__init__", "modulename": "luisa_lang.hir", "qualname": "TemplateMatchingError.__init__", "kind": "function", "doc": "\n", "signature": "(\tnode: luisa_lang.hir.Node | luisa_lang.utils.Span | None,\tmessage: str)"}, {"fullname": "luisa_lang.hir.TemplateMatchingError.span", "modulename": "luisa_lang.hir", "qualname": "TemplateMatchingError.span", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.utils.Span | None"}, {"fullname": "luisa_lang.hir.TemplateMatchingError.message", "modulename": "luisa_lang.hir", "qualname": "TemplateMatchingError.message", "kind": "variable", "doc": "\n", "annotation": ": str"}, {"fullname": "luisa_lang.hir.SpannedError", "modulename": "luisa_lang.hir", "qualname": "SpannedError", "kind": "class", "doc": "Common base class for all non-exit exceptions.
\n", "bases": "builtins.Exception"}, {"fullname": "luisa_lang.hir.SpannedError.__init__", "modulename": "luisa_lang.hir", "qualname": "SpannedError.__init__", "kind": "function", "doc": "\n", "signature": "(\tnode: luisa_lang.hir.Node | luisa_lang.utils.Span | ast.AST | None,\tmessage: str)"}, {"fullname": "luisa_lang.hir.SpannedError.span", "modulename": "luisa_lang.hir", "qualname": "SpannedError.span", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.utils.Span | None"}, {"fullname": "luisa_lang.hir.SpannedError.message", "modulename": "luisa_lang.hir", "qualname": "SpannedError.message", "kind": "variable", "doc": "\n", "annotation": ": str"}, {"fullname": "luisa_lang.hir.ParsingError", "modulename": "luisa_lang.hir", "qualname": "ParsingError", "kind": "class", "doc": "Common base class for all non-exit exceptions.
\n", "bases": "SpannedError"}, {"fullname": "luisa_lang.hir.InlineError", "modulename": "luisa_lang.hir", "qualname": "InlineError", "kind": "class", "doc": "Common base class for all non-exit exceptions.
\n", "bases": "SpannedError"}, {"fullname": "luisa_lang.hir.TypeInferenceError", "modulename": "luisa_lang.hir", "qualname": "TypeInferenceError", "kind": "class", "doc": "Common base class for all non-exit exceptions.
\n", "bases": "SpannedError"}, {"fullname": "luisa_lang.hir.Assign", "modulename": "luisa_lang.hir", "qualname": "Assign", "kind": "class", "doc": "Base class for all nodes in the HIR. A node could be a value, a reference, or a statement.\nNodes equality is based on their identity.
\n", "bases": "Node"}, {"fullname": "luisa_lang.hir.Assign.__init__", "modulename": "luisa_lang.hir", "qualname": "Assign.__init__", "kind": "function", "doc": "\n", "signature": "(\tref: luisa_lang.hir.Ref,\tvalue: luisa_lang.hir.Value,\tspan: Optional[luisa_lang.utils.Span] = None)"}, {"fullname": "luisa_lang.hir.Assign.ref", "modulename": "luisa_lang.hir", "qualname": "Assign.ref", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.Ref"}, {"fullname": "luisa_lang.hir.Assign.value", "modulename": "luisa_lang.hir", "qualname": "Assign.value", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.Value"}, {"fullname": "luisa_lang.hir.Terminator", "modulename": "luisa_lang.hir", "qualname": "Terminator", "kind": "class", "doc": "Base class for all nodes in the HIR. A node could be a value, a reference, or a statement.\nNodes equality is based on their identity.
\n", "bases": "Node"}, {"fullname": "luisa_lang.hir.Loop", "modulename": "luisa_lang.hir", "qualname": "Loop", "kind": "class", "doc": "Base class for all nodes in the HIR. A node could be a value, a reference, or a statement.\nNodes equality is based on their identity.
\n", "bases": "Terminator"}, {"fullname": "luisa_lang.hir.Loop.__init__", "modulename": "luisa_lang.hir", "qualname": "Loop.__init__", "kind": "function", "doc": "\n", "signature": "(\tprepare: luisa_lang.hir.BasicBlock,\tcond: Optional[luisa_lang.hir.Value],\tbody: luisa_lang.hir.BasicBlock,\tupdate: Optional[luisa_lang.hir.BasicBlock],\tmerge: luisa_lang.hir.BasicBlock,\tspan: Optional[luisa_lang.utils.Span] = None)"}, {"fullname": "luisa_lang.hir.Loop.prepare", "modulename": "luisa_lang.hir", "qualname": "Loop.prepare", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.BasicBlock"}, {"fullname": "luisa_lang.hir.Loop.cond", "modulename": "luisa_lang.hir", "qualname": "Loop.cond", "kind": "variable", "doc": "\n", "annotation": ": Optional[luisa_lang.hir.Value]"}, {"fullname": "luisa_lang.hir.Loop.body", "modulename": "luisa_lang.hir", "qualname": "Loop.body", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.BasicBlock"}, {"fullname": "luisa_lang.hir.Loop.update", "modulename": "luisa_lang.hir", "qualname": "Loop.update", "kind": "variable", "doc": "\n", "annotation": ": Optional[luisa_lang.hir.BasicBlock]"}, {"fullname": "luisa_lang.hir.Loop.merge", "modulename": "luisa_lang.hir", "qualname": "Loop.merge", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.BasicBlock"}, {"fullname": "luisa_lang.hir.Break", "modulename": "luisa_lang.hir", "qualname": "Break", "kind": "class", "doc": "Base class for all nodes in the HIR. A node could be a value, a reference, or a statement.\nNodes equality is based on their identity.
\n", "bases": "Terminator"}, {"fullname": "luisa_lang.hir.Break.__init__", "modulename": "luisa_lang.hir", "qualname": "Break.__init__", "kind": "function", "doc": "\n", "signature": "(\ttarget: luisa_lang.hir.Loop | None,\tspan: Optional[luisa_lang.utils.Span] = None)"}, {"fullname": "luisa_lang.hir.Break.target", "modulename": "luisa_lang.hir", "qualname": "Break.target", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.Loop | None"}, {"fullname": "luisa_lang.hir.Continue", "modulename": "luisa_lang.hir", "qualname": "Continue", "kind": "class", "doc": "Base class for all nodes in the HIR. A node could be a value, a reference, or a statement.\nNodes equality is based on their identity.
\n", "bases": "Terminator"}, {"fullname": "luisa_lang.hir.Continue.__init__", "modulename": "luisa_lang.hir", "qualname": "Continue.__init__", "kind": "function", "doc": "\n", "signature": "(\ttarget: luisa_lang.hir.Loop | None,\tspan: Optional[luisa_lang.utils.Span] = None)"}, {"fullname": "luisa_lang.hir.Continue.target", "modulename": "luisa_lang.hir", "qualname": "Continue.target", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.Loop | None"}, {"fullname": "luisa_lang.hir.If", "modulename": "luisa_lang.hir", "qualname": "If", "kind": "class", "doc": "Base class for all nodes in the HIR. A node could be a value, a reference, or a statement.\nNodes equality is based on their identity.
\n", "bases": "Terminator"}, {"fullname": "luisa_lang.hir.If.__init__", "modulename": "luisa_lang.hir", "qualname": "If.__init__", "kind": "function", "doc": "\n", "signature": "(\tcond: luisa_lang.hir.Value,\tthen_body: luisa_lang.hir.BasicBlock,\telse_body: Optional[luisa_lang.hir.BasicBlock],\tmerge: luisa_lang.hir.BasicBlock,\tspan: Optional[luisa_lang.utils.Span] = None)"}, {"fullname": "luisa_lang.hir.If.cond", "modulename": "luisa_lang.hir", "qualname": "If.cond", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.Value"}, {"fullname": "luisa_lang.hir.If.then_body", "modulename": "luisa_lang.hir", "qualname": "If.then_body", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.BasicBlock"}, {"fullname": "luisa_lang.hir.If.else_body", "modulename": "luisa_lang.hir", "qualname": "If.else_body", "kind": "variable", "doc": "\n", "annotation": ": Optional[luisa_lang.hir.BasicBlock]"}, {"fullname": "luisa_lang.hir.If.merge", "modulename": "luisa_lang.hir", "qualname": "If.merge", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.BasicBlock"}, {"fullname": "luisa_lang.hir.Return", "modulename": "luisa_lang.hir", "qualname": "Return", "kind": "class", "doc": "Base class for all nodes in the HIR. A node could be a value, a reference, or a statement.\nNodes equality is based on their identity.
\n", "bases": "Terminator"}, {"fullname": "luisa_lang.hir.Return.__init__", "modulename": "luisa_lang.hir", "qualname": "Return.__init__", "kind": "function", "doc": "\n", "signature": "(\tvalue: Optional[luisa_lang.hir.Value],\tspan: Optional[luisa_lang.utils.Span] = None)"}, {"fullname": "luisa_lang.hir.Return.value", "modulename": "luisa_lang.hir", "qualname": "Return.value", "kind": "variable", "doc": "\n", "annotation": ": Optional[luisa_lang.hir.Value]"}, {"fullname": "luisa_lang.hir.ReturnRef", "modulename": "luisa_lang.hir", "qualname": "ReturnRef", "kind": "class", "doc": "Base class for all nodes in the HIR. A node could be a value, a reference, or a statement.\nNodes equality is based on their identity.
\n", "bases": "Terminator"}, {"fullname": "luisa_lang.hir.ReturnRef.__init__", "modulename": "luisa_lang.hir", "qualname": "ReturnRef.__init__", "kind": "function", "doc": "\n", "signature": "(\tvalue: luisa_lang.hir.Ref,\tspan: Optional[luisa_lang.utils.Span] = None)"}, {"fullname": "luisa_lang.hir.ReturnRef.value", "modulename": "luisa_lang.hir", "qualname": "ReturnRef.value", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.Ref"}, {"fullname": "luisa_lang.hir.Range", "modulename": "luisa_lang.hir", "qualname": "Range", "kind": "class", "doc": "A node with a type, which can either be values or references.
\n", "bases": "Value"}, {"fullname": "luisa_lang.hir.Range.__init__", "modulename": "luisa_lang.hir", "qualname": "Range.__init__", "kind": "function", "doc": "\n", "signature": "(\tstart: luisa_lang.hir.Value,\tstop: luisa_lang.hir.Value,\tstep: luisa_lang.hir.Value,\tspan: Optional[luisa_lang.utils.Span] = None)"}, {"fullname": "luisa_lang.hir.Range.start", "modulename": "luisa_lang.hir", "qualname": "Range.start", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.Value"}, {"fullname": "luisa_lang.hir.Range.step", "modulename": "luisa_lang.hir", "qualname": "Range.step", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.Value"}, {"fullname": "luisa_lang.hir.Range.stop", "modulename": "luisa_lang.hir", "qualname": "Range.stop", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.Value"}, {"fullname": "luisa_lang.hir.Range.value_type", "modulename": "luisa_lang.hir", "qualname": "Range.value_type", "kind": "function", "doc": "\n", "signature": "(self) -> luisa_lang.hir.Type:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.ComptimeValue", "modulename": "luisa_lang.hir", "qualname": "ComptimeValue", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.hir.ComptimeValue.__init__", "modulename": "luisa_lang.hir", "qualname": "ComptimeValue.__init__", "kind": "function", "doc": "\n", "signature": "(value: Any, update_func: Optional[Callable[[Any], NoneType]])"}, {"fullname": "luisa_lang.hir.ComptimeValue.value", "modulename": "luisa_lang.hir", "qualname": "ComptimeValue.value", "kind": "variable", "doc": "\n", "annotation": ": Any"}, {"fullname": "luisa_lang.hir.ComptimeValue.update_func", "modulename": "luisa_lang.hir", "qualname": "ComptimeValue.update_func", "kind": "variable", "doc": "\n", "annotation": ": Optional[Callable[[Any], NoneType]]"}, {"fullname": "luisa_lang.hir.ComptimeValue.update", "modulename": "luisa_lang.hir", "qualname": "ComptimeValue.update", "kind": "function", "doc": "\n", "signature": "(self, value: Any) -> None:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.FunctionSignature", "modulename": "luisa_lang.hir", "qualname": "FunctionSignature", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.hir.FunctionSignature.__init__", "modulename": "luisa_lang.hir", "qualname": "FunctionSignature.__init__", "kind": "function", "doc": "\n", "signature": "(\tgeneric_params: List[luisa_lang.hir.GenericParameter],\tparams: List[luisa_lang.hir.Var],\treturn_type: luisa_lang.hir.Type | None)"}, {"fullname": "luisa_lang.hir.FunctionSignature.params", "modulename": "luisa_lang.hir", "qualname": "FunctionSignature.params", "kind": "variable", "doc": "\n", "annotation": ": List[luisa_lang.hir.Var]"}, {"fullname": "luisa_lang.hir.FunctionSignature.return_type", "modulename": "luisa_lang.hir", "qualname": "FunctionSignature.return_type", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.Type | None"}, {"fullname": "luisa_lang.hir.FunctionSignature.generic_params", "modulename": "luisa_lang.hir", "qualname": "FunctionSignature.generic_params", "kind": "variable", "doc": "\n", "annotation": ": List[luisa_lang.hir.GenericParameter]"}, {"fullname": "luisa_lang.hir.Function", "modulename": "luisa_lang.hir", "qualname": "Function", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.hir.Function.__init__", "modulename": "luisa_lang.hir", "qualname": "Function.__init__", "kind": "function", "doc": "\n", "signature": "(\tname: str,\tparams: List[luisa_lang.hir.Var],\treturn_type: luisa_lang.hir.Type | None,\tis_method: bool,\treturning_ref: bool)"}, {"fullname": "luisa_lang.hir.Function.name", "modulename": "luisa_lang.hir", "qualname": "Function.name", "kind": "variable", "doc": "\n", "annotation": ": str"}, {"fullname": "luisa_lang.hir.Function.params", "modulename": "luisa_lang.hir", "qualname": "Function.params", "kind": "variable", "doc": "\n", "annotation": ": List[luisa_lang.hir.Var]"}, {"fullname": "luisa_lang.hir.Function.return_type", "modulename": "luisa_lang.hir", "qualname": "Function.return_type", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.Type | None"}, {"fullname": "luisa_lang.hir.Function.body", "modulename": "luisa_lang.hir", "qualname": "Function.body", "kind": "variable", "doc": "\n", "annotation": ": Optional[luisa_lang.hir.BasicBlock]"}, {"fullname": "luisa_lang.hir.Function.export", "modulename": "luisa_lang.hir", "qualname": "Function.export", "kind": "variable", "doc": "\n", "annotation": ": bool"}, {"fullname": "luisa_lang.hir.Function.locals", "modulename": "luisa_lang.hir", "qualname": "Function.locals", "kind": "variable", "doc": "\n", "annotation": ": List[luisa_lang.hir.Var]"}, {"fullname": "luisa_lang.hir.Function.complete", "modulename": "luisa_lang.hir", "qualname": "Function.complete", "kind": "variable", "doc": "\n", "annotation": ": bool"}, {"fullname": "luisa_lang.hir.Function.is_method", "modulename": "luisa_lang.hir", "qualname": "Function.is_method", "kind": "variable", "doc": "\n", "annotation": ": bool"}, {"fullname": "luisa_lang.hir.Function.returning_ref", "modulename": "luisa_lang.hir", "qualname": "Function.returning_ref", "kind": "variable", "doc": "\n", "annotation": ": bool"}, {"fullname": "luisa_lang.hir.Function.inline_hint", "modulename": "luisa_lang.hir", "qualname": "Function.inline_hint", "kind": "function", "doc": "\n", "signature": "(self) -> Union[bool, Literal['never', 'always']]:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.match_template_args", "modulename": "luisa_lang.hir", "qualname": "match_template_args", "kind": "function", "doc": "\n", "signature": "(\ttemplate: List[Tuple[str, luisa_lang.hir.Type]],\targs: List[luisa_lang.hir.Type]) -> Union[Dict[luisa_lang.hir.GenericParameter, luisa_lang.hir.Type], luisa_lang.hir.TypeInferenceError]:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.match_func_template_args", "modulename": "luisa_lang.hir", "qualname": "match_func_template_args", "kind": "function", "doc": "\n", "signature": "(\tsig: luisa_lang.hir.FunctionSignature,\targs: List[Tuple[str, Union[luisa_lang.hir.Type, Any]]]) -> Union[Dict[luisa_lang.hir.GenericParameter, luisa_lang.hir.Type], luisa_lang.hir.TypeInferenceError]:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.GlobalContext", "modulename": "luisa_lang.hir", "qualname": "GlobalContext", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.hir.GlobalContext.types", "modulename": "luisa_lang.hir", "qualname": "GlobalContext.types", "kind": "variable", "doc": "\n", "annotation": ": Dict[type, luisa_lang.hir.Type]"}, {"fullname": "luisa_lang.hir.GlobalContext.functions", "modulename": "luisa_lang.hir", "qualname": "GlobalContext.functions", "kind": "variable", "doc": "\n", "annotation": ": Dict[Callable[..., Any], luisa_lang.hir.FunctionTemplate]"}, {"fullname": "luisa_lang.hir.GlobalContext.get", "modulename": "luisa_lang.hir", "qualname": "GlobalContext.get", "kind": "function", "doc": "\n", "signature": "() -> luisa_lang.hir.GlobalContext:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.FuncMetadata", "modulename": "luisa_lang.hir", "qualname": "FuncMetadata", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.hir.StructMetadata", "modulename": "luisa_lang.hir", "qualname": "StructMetadata", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.hir.get_dsl_func", "modulename": "luisa_lang.hir", "qualname": "get_dsl_func", "kind": "function", "doc": "\n", "signature": "(func: Callable[..., Any]) -> Optional[luisa_lang.hir.FunctionTemplate]:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.get_dsl_type", "modulename": "luisa_lang.hir", "qualname": "get_dsl_type", "kind": "function", "doc": "\n", "signature": "(cls: type) -> Optional[luisa_lang.hir.Type]:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.is_type_compatible_to", "modulename": "luisa_lang.hir", "qualname": "is_type_compatible_to", "kind": "function", "doc": "\n", "signature": "(ty: luisa_lang.hir.Type, target: luisa_lang.hir.Type) -> bool:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.FunctionInliner", "modulename": "luisa_lang.hir", "qualname": "FunctionInliner", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.hir.FunctionInliner.__init__", "modulename": "luisa_lang.hir", "qualname": "FunctionInliner.__init__", "kind": "function", "doc": "\n", "signature": "(\tfunc: luisa_lang.hir.Function,\targs: List[luisa_lang.hir.Value | luisa_lang.hir.Ref],\tbody: luisa_lang.hir.BasicBlock,\tspan: Optional[luisa_lang.utils.Span] = None)"}, {"fullname": "luisa_lang.hir.FunctionInliner.mapping", "modulename": "luisa_lang.hir", "qualname": "FunctionInliner.mapping", "kind": "variable", "doc": "\n", "annotation": ": Dict[luisa_lang.hir.Ref | luisa_lang.hir.Value, luisa_lang.hir.Ref | luisa_lang.hir.Value]"}, {"fullname": "luisa_lang.hir.FunctionInliner.ret", "modulename": "luisa_lang.hir", "qualname": "FunctionInliner.ret", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.Value | luisa_lang.hir.Ref | None"}, {"fullname": "luisa_lang.hir.FunctionInliner.do_inline", "modulename": "luisa_lang.hir", "qualname": "FunctionInliner.do_inline", "kind": "function", "doc": "\n", "signature": "(\tself,\tfunc_body: luisa_lang.hir.BasicBlock,\tbody: luisa_lang.hir.BasicBlock) -> None:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.FunctionInliner.inline", "modulename": "luisa_lang.hir", "qualname": "FunctionInliner.inline", "kind": "function", "doc": "\n", "signature": "(\tfunc: luisa_lang.hir.Function,\targs: List[luisa_lang.hir.Value | luisa_lang.hir.Ref],\tbody: luisa_lang.hir.BasicBlock,\tspan: Optional[luisa_lang.utils.Span] = None) -> luisa_lang.hir.Value | luisa_lang.hir.Ref:", "funcdef": "def"}, {"fullname": "luisa_lang.hir.register_dsl_type_alias", "modulename": "luisa_lang.hir", "qualname": "register_dsl_type_alias", "kind": "function", "doc": "Allow a type to be remapped to another type within DSL code.\nParameters:\ntarget (type): The type to be remapped.\nalias (type): The type to which the target type will be remapped.\nExample:
\n\nFor example,
\n\n@lc.struct\nclass Foo:\n x: int\n y: int\n\nclass SomeOtherFoo:\n components: List[int]\n\nregister_dsl_type_alias(SomeOtherFoo, Foo)\n\n@lc.func\ndef foo(f: SomeOtherFoo): # SomeOtherFoo is interpreted as Foo\n ...\n
\nAbstract base class for generic types.
\n\nA generic type is typically declared by inheriting from\nthis class parameterized with one or more type variables.\nFor example, a generic mapping type might be defined as::
\n\nclass Mapping(Generic[KT, VT]):\n def __getitem__(self, key: KT) -> VT:\n ...\n # Etc.
\n\nThis class can then be used as follows::
\n\ndef lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:\n try:\n return mapping[key]\n except KeyError:\n return default
\n", "bases": "typing.Generic[~T]"}, {"fullname": "luisa_lang.lang_builtins.Array", "modulename": "luisa_lang.lang_builtins", "qualname": "Array", "kind": "class", "doc": "Abstract base class for generic types.
\n\nA generic type is typically declared by inheriting from\nthis class parameterized with one or more type variables.\nFor example, a generic mapping type might be defined as::
\n\nclass Mapping(Generic[KT, VT]):\n def __getitem__(self, key: KT) -> VT:\n ...\n # Etc.
\n\nThis class can then be used as follows::
\n\ndef lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:\n try:\n return mapping[key]\n except KeyError:\n return default
\n", "bases": "typing.Generic[~T, ~N]"}, {"fullname": "luisa_lang.lang_builtins.range", "modulename": "luisa_lang.lang_builtins", "qualname": "range", "kind": "function", "doc": "\n", "signature": "(*args):", "funcdef": "def"}, {"fullname": "luisa_lang.lang_builtins.comptime", "modulename": "luisa_lang.lang_builtins", "qualname": "comptime", "kind": "function", "doc": "Allowing mixing normal python object as compile-time value with DSL code.\nUsage:\n - lc.comptime(e)
marks the expression e
as a compile-time value.\n - with lc.comptime() as block: ...
marks the block as a compile-time block.
Attempt to convert the value to the target type.
\n", "signature": "(target: type[~T], value: Any) -> ~T:", "funcdef": "def"}, {"fullname": "luisa_lang.lang_builtins.bitcast", "modulename": "luisa_lang.lang_builtins", "qualname": "bitcast", "kind": "function", "doc": "Attempt to convert the value to the target type, preserving the bit representation.
\n", "signature": "(target: type[~T], value: Any) -> ~T:", "funcdef": "def"}, {"fullname": "luisa_lang.lang_builtins.device_assert", "modulename": "luisa_lang.lang_builtins", "qualname": "device_assert", "kind": "function", "doc": "Assert that the condition is true at runtime.
\n", "signature": "(cond: bool, msg: str = '') -> NoReturn:", "funcdef": "def"}, {"fullname": "luisa_lang.lang_builtins.trap", "modulename": "luisa_lang.lang_builtins", "qualname": "trap", "kind": "function", "doc": "Aborts the kernel execution
\n", "signature": "() -> None:", "funcdef": "def"}, {"fullname": "luisa_lang.lang_builtins.sizeof", "modulename": "luisa_lang.lang_builtins", "qualname": "sizeof", "kind": "function", "doc": "\n", "signature": "(t: type[~T]) -> luisa_lang.math_types.u64:", "funcdef": "def"}, {"fullname": "luisa_lang.math_types", "modulename": "luisa_lang.math_types", "kind": "module", "doc": "\n"}, {"fullname": "luisa_lang.math_types.FLOAT_TYPES", "modulename": "luisa_lang.math_types", "qualname": "FLOAT_TYPES", "kind": "variable", "doc": "\n", "annotation": ": Final[List[str]]", "default_value": "['f32', 'f64', 'float2', 'double2', 'float3', 'double3', 'float4', 'double4']"}, {"fullname": "luisa_lang.math_types.FloatType", "modulename": "luisa_lang.math_types", "qualname": "FloatType", "kind": "variable", "doc": "\n", "default_value": "typing.Union[ForwardRef('f32'), ForwardRef('f64'), ForwardRef('float2'), ForwardRef('double2'), ForwardRef('float3'), ForwardRef('double3'), ForwardRef('float4'), ForwardRef('double4')]"}, {"fullname": "luisa_lang.math_types.abs", "modulename": "luisa_lang.math_types", "qualname": "abs", "kind": "function", "doc": "\n", "signature": "(x: ~_F1) -> ~_F1:", "funcdef": "def"}, {"fullname": "luisa_lang.math_types.acos", "modulename": "luisa_lang.math_types", "qualname": "acos", "kind": "function", "doc": "\n", "signature": "(x: ~_F1) -> ~_F1:", "funcdef": "def"}, {"fullname": "luisa_lang.math_types.acosh", "modulename": "luisa_lang.math_types", "qualname": "acosh", "kind": "function", "doc": "\n", "signature": "(x: ~_F1) -> ~_F1:", "funcdef": "def"}, {"fullname": "luisa_lang.math_types.asin", "modulename": "luisa_lang.math_types", "qualname": "asin", "kind": "function", "doc": "\n", "signature": "(x: ~_F1) -> ~_F1:", "funcdef": "def"}, {"fullname": "luisa_lang.math_types.asinh", "modulename": "luisa_lang.math_types", "qualname": "asinh", "kind": "function", "doc": "\n", "signature": "(x: ~_F1) -> ~_F1:", "funcdef": "def"}, {"fullname": "luisa_lang.math_types.atan", "modulename": "luisa_lang.math_types", "qualname": "atan", "kind": "function", "doc": "\n", "signature": "(x: ~_F1) -> ~_F1:", "funcdef": "def"}, {"fullname": "luisa_lang.math_types.atanh", "modulename": "luisa_lang.math_types", "qualname": "atanh", "kind": "function", "doc": "\n", "signature": "(x: ~_F1) -> ~_F1:", "funcdef": "def"}, {"fullname": "luisa_lang.math_types.ceil", "modulename": "luisa_lang.math_types", "qualname": "ceil", "kind": "function", "doc": "\n", "signature": "(x: ~_F1) -> ~_F1:", "funcdef": "def"}, {"fullname": "luisa_lang.math_types.cos", "modulename": "luisa_lang.math_types", "qualname": "cos", "kind": "function", "doc": "\n", "signature": "(x: ~_F1) -> ~_F1:", "funcdef": "def"}, {"fullname": "luisa_lang.math_types.cosh", "modulename": "luisa_lang.math_types", "qualname": "cosh", "kind": "function", "doc": "\n", "signature": "(x: ~_F1) -> ~_F1:", "funcdef": "def"}, {"fullname": "luisa_lang.math_types.exp", "modulename": "luisa_lang.math_types", "qualname": "exp", "kind": "function", "doc": "\n", "signature": "(x: ~_F1) -> ~_F1:", "funcdef": "def"}, {"fullname": "luisa_lang.math_types.floor", "modulename": "luisa_lang.math_types", "qualname": "floor", "kind": "function", "doc": "\n", "signature": "(x: ~_F1) -> ~_F1:", "funcdef": "def"}, {"fullname": "luisa_lang.math_types.log", "modulename": "luisa_lang.math_types", "qualname": "log", "kind": "function", "doc": "\n", "signature": "(x: ~_F1) -> ~_F1:", "funcdef": "def"}, {"fullname": "luisa_lang.math_types.log10", "modulename": "luisa_lang.math_types", "qualname": "log10", "kind": "function", "doc": "\n", "signature": "(x: ~_F1) -> ~_F1:", "funcdef": "def"}, {"fullname": "luisa_lang.math_types.log2", "modulename": "luisa_lang.math_types", "qualname": "log2", "kind": "function", "doc": "\n", "signature": "(x: ~_F1) -> ~_F1:", "funcdef": "def"}, {"fullname": "luisa_lang.math_types.sin", "modulename": "luisa_lang.math_types", "qualname": "sin", "kind": "function", "doc": "\n", "signature": "(x: ~_F1) -> ~_F1:", "funcdef": "def"}, {"fullname": "luisa_lang.math_types.sinh", "modulename": "luisa_lang.math_types", "qualname": "sinh", "kind": "function", "doc": "\n", "signature": "(x: ~_F1) -> ~_F1:", "funcdef": "def"}, {"fullname": "luisa_lang.math_types.sqrt", "modulename": "luisa_lang.math_types", "qualname": "sqrt", "kind": "function", "doc": "\n", "signature": "(x: ~_F1) -> ~_F1:", "funcdef": "def"}, {"fullname": "luisa_lang.math_types.tan", "modulename": "luisa_lang.math_types", "qualname": "tan", "kind": "function", "doc": "\n", "signature": "(x: ~_F1) -> ~_F1:", "funcdef": "def"}, {"fullname": "luisa_lang.math_types.tanh", "modulename": "luisa_lang.math_types", "qualname": "tanh", "kind": "function", "doc": "\n", "signature": "(x: ~_F1) -> ~_F1:", "funcdef": "def"}, {"fullname": "luisa_lang.math_types.trunc", "modulename": "luisa_lang.math_types", "qualname": "trunc", "kind": "function", "doc": "\n", "signature": "(x: ~_F1) -> ~_F1:", "funcdef": "def"}, {"fullname": "luisa_lang.math_types.atan2", "modulename": "luisa_lang.math_types", "qualname": "atan2", "kind": "function", "doc": "\n", "signature": "(x: ~_F1, y: ~_F1) -> ~_F1:", "funcdef": "def"}, {"fullname": "luisa_lang.math_types.copysign", "modulename": "luisa_lang.math_types", "qualname": "copysign", "kind": "function", "doc": "\n", "signature": "(x: ~_F1, y: ~_F1) -> ~_F1:", "funcdef": "def"}, {"fullname": "luisa_lang.math_types.f64", "modulename": "luisa_lang.math_types", "qualname": "f64", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.f64.__init__", "modulename": "luisa_lang.math_types", "qualname": "f64.__init__", "kind": "function", "doc": "\n", "signature": "(_value: Union[luisa_lang.math_types.f64, float])"}, {"fullname": "luisa_lang.math_types.i8", "modulename": "luisa_lang.math_types", "qualname": "i8", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.i8.__init__", "modulename": "luisa_lang.math_types", "qualname": "i8.__init__", "kind": "function", "doc": "\n", "signature": "(\t_value: Union[luisa_lang.math_types.i8, luisa_lang.math_types.IntLiteral])"}, {"fullname": "luisa_lang.math_types.u8", "modulename": "luisa_lang.math_types", "qualname": "u8", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.u8.__init__", "modulename": "luisa_lang.math_types", "qualname": "u8.__init__", "kind": "function", "doc": "\n", "signature": "(\t_value: Union[luisa_lang.math_types.u8, luisa_lang.math_types.IntLiteral])"}, {"fullname": "luisa_lang.math_types.i16", "modulename": "luisa_lang.math_types", "qualname": "i16", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.i16.__init__", "modulename": "luisa_lang.math_types", "qualname": "i16.__init__", "kind": "function", "doc": "\n", "signature": "(\t_value: Union[luisa_lang.math_types.i16, luisa_lang.math_types.IntLiteral])"}, {"fullname": "luisa_lang.math_types.u16", "modulename": "luisa_lang.math_types", "qualname": "u16", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.u16.__init__", "modulename": "luisa_lang.math_types", "qualname": "u16.__init__", "kind": "function", "doc": "\n", "signature": "(\t_value: Union[luisa_lang.math_types.u16, luisa_lang.math_types.IntLiteral])"}, {"fullname": "luisa_lang.math_types.i64", "modulename": "luisa_lang.math_types", "qualname": "i64", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.i64.__init__", "modulename": "luisa_lang.math_types", "qualname": "i64.__init__", "kind": "function", "doc": "\n", "signature": "(\t_value: Union[luisa_lang.math_types.i64, luisa_lang.math_types.IntLiteral])"}, {"fullname": "luisa_lang.math_types.u64", "modulename": "luisa_lang.math_types", "qualname": "u64", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.u64.__init__", "modulename": "luisa_lang.math_types", "qualname": "u64.__init__", "kind": "function", "doc": "\n", "signature": "(\t_value: Union[luisa_lang.math_types.u64, luisa_lang.math_types.IntLiteral])"}, {"fullname": "luisa_lang.math_types.u32", "modulename": "luisa_lang.math_types", "qualname": "u32", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.u32.__init__", "modulename": "luisa_lang.math_types", "qualname": "u32.__init__", "kind": "function", "doc": "\n", "signature": "(\t_value: Union[luisa_lang.math_types.u32, luisa_lang.math_types.IntLiteral])"}, {"fullname": "luisa_lang.math_types.bool2", "modulename": "luisa_lang.math_types", "qualname": "bool2", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.bool2.__init__", "modulename": "luisa_lang.math_types", "qualname": "bool2.__init__", "kind": "function", "doc": "\n", "signature": "(x: bool = False, y: bool = False)"}, {"fullname": "luisa_lang.math_types.bool2.x", "modulename": "luisa_lang.math_types", "qualname": "bool2.x", "kind": "variable", "doc": "\n", "annotation": ": bool"}, {"fullname": "luisa_lang.math_types.bool2.y", "modulename": "luisa_lang.math_types", "qualname": "bool2.y", "kind": "variable", "doc": "\n", "annotation": ": bool"}, {"fullname": "luisa_lang.math_types.float2", "modulename": "luisa_lang.math_types", "qualname": "float2", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.float2.__init__", "modulename": "luisa_lang.math_types", "qualname": "float2.__init__", "kind": "function", "doc": "\n", "signature": "(\tx: Union[float, luisa_lang.math_types.FloatLiteral] = <luisa_lang.math_types.FloatLiteral object>,\ty: Union[float, luisa_lang.math_types.FloatLiteral] = <luisa_lang.math_types.FloatLiteral object>)"}, {"fullname": "luisa_lang.math_types.float2.x", "modulename": "luisa_lang.math_types", "qualname": "float2.x", "kind": "variable", "doc": "\n", "annotation": ": float"}, {"fullname": "luisa_lang.math_types.float2.y", "modulename": "luisa_lang.math_types", "qualname": "float2.y", "kind": "variable", "doc": "\n", "annotation": ": float"}, {"fullname": "luisa_lang.math_types.double2", "modulename": "luisa_lang.math_types", "qualname": "double2", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.double2.__init__", "modulename": "luisa_lang.math_types", "qualname": "double2.__init__", "kind": "function", "doc": "\n", "signature": "(\tx: Union[luisa_lang.math_types.f64, luisa_lang.math_types.FloatLiteral] = <luisa_lang.math_types.FloatLiteral object>,\ty: Union[luisa_lang.math_types.f64, luisa_lang.math_types.FloatLiteral] = <luisa_lang.math_types.FloatLiteral object>)"}, {"fullname": "luisa_lang.math_types.double2.x", "modulename": "luisa_lang.math_types", "qualname": "double2.x", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.f64"}, {"fullname": "luisa_lang.math_types.double2.y", "modulename": "luisa_lang.math_types", "qualname": "double2.y", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.f64"}, {"fullname": "luisa_lang.math_types.byte2", "modulename": "luisa_lang.math_types", "qualname": "byte2", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.byte2.__init__", "modulename": "luisa_lang.math_types", "qualname": "byte2.__init__", "kind": "function", "doc": "\n", "signature": "(\tx: Union[luisa_lang.math_types.i8, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\ty: Union[luisa_lang.math_types.i8, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>)"}, {"fullname": "luisa_lang.math_types.byte2.x", "modulename": "luisa_lang.math_types", "qualname": "byte2.x", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.i8"}, {"fullname": "luisa_lang.math_types.byte2.y", "modulename": "luisa_lang.math_types", "qualname": "byte2.y", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.i8"}, {"fullname": "luisa_lang.math_types.ubyte2", "modulename": "luisa_lang.math_types", "qualname": "ubyte2", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.ubyte2.__init__", "modulename": "luisa_lang.math_types", "qualname": "ubyte2.__init__", "kind": "function", "doc": "\n", "signature": "(\tx: Union[luisa_lang.math_types.u8, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\ty: Union[luisa_lang.math_types.u8, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>)"}, {"fullname": "luisa_lang.math_types.ubyte2.x", "modulename": "luisa_lang.math_types", "qualname": "ubyte2.x", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u8"}, {"fullname": "luisa_lang.math_types.ubyte2.y", "modulename": "luisa_lang.math_types", "qualname": "ubyte2.y", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u8"}, {"fullname": "luisa_lang.math_types.short2", "modulename": "luisa_lang.math_types", "qualname": "short2", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.short2.__init__", "modulename": "luisa_lang.math_types", "qualname": "short2.__init__", "kind": "function", "doc": "\n", "signature": "(\tx: Union[luisa_lang.math_types.i16, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\ty: Union[luisa_lang.math_types.i16, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>)"}, {"fullname": "luisa_lang.math_types.short2.x", "modulename": "luisa_lang.math_types", "qualname": "short2.x", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.i16"}, {"fullname": "luisa_lang.math_types.short2.y", "modulename": "luisa_lang.math_types", "qualname": "short2.y", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.i16"}, {"fullname": "luisa_lang.math_types.ushort2", "modulename": "luisa_lang.math_types", "qualname": "ushort2", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.ushort2.__init__", "modulename": "luisa_lang.math_types", "qualname": "ushort2.__init__", "kind": "function", "doc": "\n", "signature": "(\tx: Union[luisa_lang.math_types.u16, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\ty: Union[luisa_lang.math_types.u16, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>)"}, {"fullname": "luisa_lang.math_types.ushort2.x", "modulename": "luisa_lang.math_types", "qualname": "ushort2.x", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u16"}, {"fullname": "luisa_lang.math_types.ushort2.y", "modulename": "luisa_lang.math_types", "qualname": "ushort2.y", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u16"}, {"fullname": "luisa_lang.math_types.int2", "modulename": "luisa_lang.math_types", "qualname": "int2", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.int2.__init__", "modulename": "luisa_lang.math_types", "qualname": "int2.__init__", "kind": "function", "doc": "\n", "signature": "(\tx: Union[int, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\ty: Union[int, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>)"}, {"fullname": "luisa_lang.math_types.int2.x", "modulename": "luisa_lang.math_types", "qualname": "int2.x", "kind": "variable", "doc": "\n", "annotation": ": int"}, {"fullname": "luisa_lang.math_types.int2.y", "modulename": "luisa_lang.math_types", "qualname": "int2.y", "kind": "variable", "doc": "\n", "annotation": ": int"}, {"fullname": "luisa_lang.math_types.uint2", "modulename": "luisa_lang.math_types", "qualname": "uint2", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.uint2.__init__", "modulename": "luisa_lang.math_types", "qualname": "uint2.__init__", "kind": "function", "doc": "\n", "signature": "(\tx: Union[luisa_lang.math_types.u32, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\ty: Union[luisa_lang.math_types.u32, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>)"}, {"fullname": "luisa_lang.math_types.uint2.x", "modulename": "luisa_lang.math_types", "qualname": "uint2.x", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u32"}, {"fullname": "luisa_lang.math_types.uint2.y", "modulename": "luisa_lang.math_types", "qualname": "uint2.y", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u32"}, {"fullname": "luisa_lang.math_types.long2", "modulename": "luisa_lang.math_types", "qualname": "long2", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.long2.__init__", "modulename": "luisa_lang.math_types", "qualname": "long2.__init__", "kind": "function", "doc": "\n", "signature": "(\tx: Union[luisa_lang.math_types.i64, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\ty: Union[luisa_lang.math_types.i64, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>)"}, {"fullname": "luisa_lang.math_types.long2.x", "modulename": "luisa_lang.math_types", "qualname": "long2.x", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.i64"}, {"fullname": "luisa_lang.math_types.long2.y", "modulename": "luisa_lang.math_types", "qualname": "long2.y", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.i64"}, {"fullname": "luisa_lang.math_types.ulong2", "modulename": "luisa_lang.math_types", "qualname": "ulong2", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.ulong2.__init__", "modulename": "luisa_lang.math_types", "qualname": "ulong2.__init__", "kind": "function", "doc": "\n", "signature": "(\tx: Union[luisa_lang.math_types.u64, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\ty: Union[luisa_lang.math_types.u64, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>)"}, {"fullname": "luisa_lang.math_types.ulong2.x", "modulename": "luisa_lang.math_types", "qualname": "ulong2.x", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u64"}, {"fullname": "luisa_lang.math_types.ulong2.y", "modulename": "luisa_lang.math_types", "qualname": "ulong2.y", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u64"}, {"fullname": "luisa_lang.math_types.bool3", "modulename": "luisa_lang.math_types", "qualname": "bool3", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.bool3.__init__", "modulename": "luisa_lang.math_types", "qualname": "bool3.__init__", "kind": "function", "doc": "\n", "signature": "(x: bool = False, y: bool = False, z: bool = False)"}, {"fullname": "luisa_lang.math_types.bool3.x", "modulename": "luisa_lang.math_types", "qualname": "bool3.x", "kind": "variable", "doc": "\n", "annotation": ": bool"}, {"fullname": "luisa_lang.math_types.bool3.y", "modulename": "luisa_lang.math_types", "qualname": "bool3.y", "kind": "variable", "doc": "\n", "annotation": ": bool"}, {"fullname": "luisa_lang.math_types.bool3.z", "modulename": "luisa_lang.math_types", "qualname": "bool3.z", "kind": "variable", "doc": "\n", "annotation": ": bool"}, {"fullname": "luisa_lang.math_types.float3", "modulename": "luisa_lang.math_types", "qualname": "float3", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.float3.__init__", "modulename": "luisa_lang.math_types", "qualname": "float3.__init__", "kind": "function", "doc": "\n", "signature": "(\tx: Union[float, luisa_lang.math_types.FloatLiteral] = <luisa_lang.math_types.FloatLiteral object>,\ty: Union[float, luisa_lang.math_types.FloatLiteral] = <luisa_lang.math_types.FloatLiteral object>,\tz: Union[float, luisa_lang.math_types.FloatLiteral] = <luisa_lang.math_types.FloatLiteral object>)"}, {"fullname": "luisa_lang.math_types.float3.x", "modulename": "luisa_lang.math_types", "qualname": "float3.x", "kind": "variable", "doc": "\n", "annotation": ": float"}, {"fullname": "luisa_lang.math_types.float3.y", "modulename": "luisa_lang.math_types", "qualname": "float3.y", "kind": "variable", "doc": "\n", "annotation": ": float"}, {"fullname": "luisa_lang.math_types.float3.z", "modulename": "luisa_lang.math_types", "qualname": "float3.z", "kind": "variable", "doc": "\n", "annotation": ": float"}, {"fullname": "luisa_lang.math_types.double3", "modulename": "luisa_lang.math_types", "qualname": "double3", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.double3.__init__", "modulename": "luisa_lang.math_types", "qualname": "double3.__init__", "kind": "function", "doc": "\n", "signature": "(\tx: Union[luisa_lang.math_types.f64, luisa_lang.math_types.FloatLiteral] = <luisa_lang.math_types.FloatLiteral object>,\ty: Union[luisa_lang.math_types.f64, luisa_lang.math_types.FloatLiteral] = <luisa_lang.math_types.FloatLiteral object>,\tz: Union[luisa_lang.math_types.f64, luisa_lang.math_types.FloatLiteral] = <luisa_lang.math_types.FloatLiteral object>)"}, {"fullname": "luisa_lang.math_types.double3.x", "modulename": "luisa_lang.math_types", "qualname": "double3.x", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.f64"}, {"fullname": "luisa_lang.math_types.double3.y", "modulename": "luisa_lang.math_types", "qualname": "double3.y", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.f64"}, {"fullname": "luisa_lang.math_types.double3.z", "modulename": "luisa_lang.math_types", "qualname": "double3.z", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.f64"}, {"fullname": "luisa_lang.math_types.byte3", "modulename": "luisa_lang.math_types", "qualname": "byte3", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.byte3.__init__", "modulename": "luisa_lang.math_types", "qualname": "byte3.__init__", "kind": "function", "doc": "\n", "signature": "(\tx: Union[luisa_lang.math_types.i8, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\ty: Union[luisa_lang.math_types.i8, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\tz: Union[luisa_lang.math_types.i8, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>)"}, {"fullname": "luisa_lang.math_types.byte3.x", "modulename": "luisa_lang.math_types", "qualname": "byte3.x", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.i8"}, {"fullname": "luisa_lang.math_types.byte3.y", "modulename": "luisa_lang.math_types", "qualname": "byte3.y", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.i8"}, {"fullname": "luisa_lang.math_types.byte3.z", "modulename": "luisa_lang.math_types", "qualname": "byte3.z", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.i8"}, {"fullname": "luisa_lang.math_types.ubyte3", "modulename": "luisa_lang.math_types", "qualname": "ubyte3", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.ubyte3.__init__", "modulename": "luisa_lang.math_types", "qualname": "ubyte3.__init__", "kind": "function", "doc": "\n", "signature": "(\tx: Union[luisa_lang.math_types.u8, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\ty: Union[luisa_lang.math_types.u8, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\tz: Union[luisa_lang.math_types.u8, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>)"}, {"fullname": "luisa_lang.math_types.ubyte3.x", "modulename": "luisa_lang.math_types", "qualname": "ubyte3.x", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u8"}, {"fullname": "luisa_lang.math_types.ubyte3.y", "modulename": "luisa_lang.math_types", "qualname": "ubyte3.y", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u8"}, {"fullname": "luisa_lang.math_types.ubyte3.z", "modulename": "luisa_lang.math_types", "qualname": "ubyte3.z", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u8"}, {"fullname": "luisa_lang.math_types.short3", "modulename": "luisa_lang.math_types", "qualname": "short3", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.short3.__init__", "modulename": "luisa_lang.math_types", "qualname": "short3.__init__", "kind": "function", "doc": "\n", "signature": "(\tx: Union[luisa_lang.math_types.i16, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\ty: Union[luisa_lang.math_types.i16, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\tz: Union[luisa_lang.math_types.i16, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>)"}, {"fullname": "luisa_lang.math_types.short3.x", "modulename": "luisa_lang.math_types", "qualname": "short3.x", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.i16"}, {"fullname": "luisa_lang.math_types.short3.y", "modulename": "luisa_lang.math_types", "qualname": "short3.y", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.i16"}, {"fullname": "luisa_lang.math_types.short3.z", "modulename": "luisa_lang.math_types", "qualname": "short3.z", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.i16"}, {"fullname": "luisa_lang.math_types.ushort3", "modulename": "luisa_lang.math_types", "qualname": "ushort3", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.ushort3.__init__", "modulename": "luisa_lang.math_types", "qualname": "ushort3.__init__", "kind": "function", "doc": "\n", "signature": "(\tx: Union[luisa_lang.math_types.u16, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\ty: Union[luisa_lang.math_types.u16, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\tz: Union[luisa_lang.math_types.u16, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>)"}, {"fullname": "luisa_lang.math_types.ushort3.x", "modulename": "luisa_lang.math_types", "qualname": "ushort3.x", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u16"}, {"fullname": "luisa_lang.math_types.ushort3.y", "modulename": "luisa_lang.math_types", "qualname": "ushort3.y", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u16"}, {"fullname": "luisa_lang.math_types.ushort3.z", "modulename": "luisa_lang.math_types", "qualname": "ushort3.z", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u16"}, {"fullname": "luisa_lang.math_types.int3", "modulename": "luisa_lang.math_types", "qualname": "int3", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.int3.__init__", "modulename": "luisa_lang.math_types", "qualname": "int3.__init__", "kind": "function", "doc": "\n", "signature": "(\tx: Union[int, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\ty: Union[int, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\tz: Union[int, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>)"}, {"fullname": "luisa_lang.math_types.int3.x", "modulename": "luisa_lang.math_types", "qualname": "int3.x", "kind": "variable", "doc": "\n", "annotation": ": int"}, {"fullname": "luisa_lang.math_types.int3.y", "modulename": "luisa_lang.math_types", "qualname": "int3.y", "kind": "variable", "doc": "\n", "annotation": ": int"}, {"fullname": "luisa_lang.math_types.int3.z", "modulename": "luisa_lang.math_types", "qualname": "int3.z", "kind": "variable", "doc": "\n", "annotation": ": int"}, {"fullname": "luisa_lang.math_types.uint3", "modulename": "luisa_lang.math_types", "qualname": "uint3", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.uint3.__init__", "modulename": "luisa_lang.math_types", "qualname": "uint3.__init__", "kind": "function", "doc": "\n", "signature": "(\tx: Union[luisa_lang.math_types.u32, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\ty: Union[luisa_lang.math_types.u32, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\tz: Union[luisa_lang.math_types.u32, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>)"}, {"fullname": "luisa_lang.math_types.uint3.x", "modulename": "luisa_lang.math_types", "qualname": "uint3.x", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u32"}, {"fullname": "luisa_lang.math_types.uint3.y", "modulename": "luisa_lang.math_types", "qualname": "uint3.y", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u32"}, {"fullname": "luisa_lang.math_types.uint3.z", "modulename": "luisa_lang.math_types", "qualname": "uint3.z", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u32"}, {"fullname": "luisa_lang.math_types.long3", "modulename": "luisa_lang.math_types", "qualname": "long3", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.long3.__init__", "modulename": "luisa_lang.math_types", "qualname": "long3.__init__", "kind": "function", "doc": "\n", "signature": "(\tx: Union[luisa_lang.math_types.i64, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\ty: Union[luisa_lang.math_types.i64, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\tz: Union[luisa_lang.math_types.i64, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>)"}, {"fullname": "luisa_lang.math_types.long3.x", "modulename": "luisa_lang.math_types", "qualname": "long3.x", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.i64"}, {"fullname": "luisa_lang.math_types.long3.y", "modulename": "luisa_lang.math_types", "qualname": "long3.y", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.i64"}, {"fullname": "luisa_lang.math_types.long3.z", "modulename": "luisa_lang.math_types", "qualname": "long3.z", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.i64"}, {"fullname": "luisa_lang.math_types.ulong3", "modulename": "luisa_lang.math_types", "qualname": "ulong3", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.ulong3.__init__", "modulename": "luisa_lang.math_types", "qualname": "ulong3.__init__", "kind": "function", "doc": "\n", "signature": "(\tx: Union[luisa_lang.math_types.u64, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\ty: Union[luisa_lang.math_types.u64, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\tz: Union[luisa_lang.math_types.u64, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>)"}, {"fullname": "luisa_lang.math_types.ulong3.x", "modulename": "luisa_lang.math_types", "qualname": "ulong3.x", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u64"}, {"fullname": "luisa_lang.math_types.ulong3.y", "modulename": "luisa_lang.math_types", "qualname": "ulong3.y", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u64"}, {"fullname": "luisa_lang.math_types.ulong3.z", "modulename": "luisa_lang.math_types", "qualname": "ulong3.z", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u64"}, {"fullname": "luisa_lang.math_types.bool4", "modulename": "luisa_lang.math_types", "qualname": "bool4", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.bool4.__init__", "modulename": "luisa_lang.math_types", "qualname": "bool4.__init__", "kind": "function", "doc": "\n", "signature": "(x: bool = False, y: bool = False, z: bool = False, w: bool = False)"}, {"fullname": "luisa_lang.math_types.bool4.x", "modulename": "luisa_lang.math_types", "qualname": "bool4.x", "kind": "variable", "doc": "\n", "annotation": ": bool"}, {"fullname": "luisa_lang.math_types.bool4.y", "modulename": "luisa_lang.math_types", "qualname": "bool4.y", "kind": "variable", "doc": "\n", "annotation": ": bool"}, {"fullname": "luisa_lang.math_types.bool4.z", "modulename": "luisa_lang.math_types", "qualname": "bool4.z", "kind": "variable", "doc": "\n", "annotation": ": bool"}, {"fullname": "luisa_lang.math_types.bool4.w", "modulename": "luisa_lang.math_types", "qualname": "bool4.w", "kind": "variable", "doc": "\n", "annotation": ": bool"}, {"fullname": "luisa_lang.math_types.float4", "modulename": "luisa_lang.math_types", "qualname": "float4", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.float4.__init__", "modulename": "luisa_lang.math_types", "qualname": "float4.__init__", "kind": "function", "doc": "\n", "signature": "(\tx: Union[float, luisa_lang.math_types.FloatLiteral] = <luisa_lang.math_types.FloatLiteral object>,\ty: Union[float, luisa_lang.math_types.FloatLiteral] = <luisa_lang.math_types.FloatLiteral object>,\tz: Union[float, luisa_lang.math_types.FloatLiteral] = <luisa_lang.math_types.FloatLiteral object>,\tw: Union[float, luisa_lang.math_types.FloatLiteral] = <luisa_lang.math_types.FloatLiteral object>)"}, {"fullname": "luisa_lang.math_types.float4.x", "modulename": "luisa_lang.math_types", "qualname": "float4.x", "kind": "variable", "doc": "\n", "annotation": ": float"}, {"fullname": "luisa_lang.math_types.float4.y", "modulename": "luisa_lang.math_types", "qualname": "float4.y", "kind": "variable", "doc": "\n", "annotation": ": float"}, {"fullname": "luisa_lang.math_types.float4.z", "modulename": "luisa_lang.math_types", "qualname": "float4.z", "kind": "variable", "doc": "\n", "annotation": ": float"}, {"fullname": "luisa_lang.math_types.float4.w", "modulename": "luisa_lang.math_types", "qualname": "float4.w", "kind": "variable", "doc": "\n", "annotation": ": float"}, {"fullname": "luisa_lang.math_types.double4", "modulename": "luisa_lang.math_types", "qualname": "double4", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.double4.__init__", "modulename": "luisa_lang.math_types", "qualname": "double4.__init__", "kind": "function", "doc": "\n", "signature": "(\tx: Union[luisa_lang.math_types.f64, luisa_lang.math_types.FloatLiteral] = <luisa_lang.math_types.FloatLiteral object>,\ty: Union[luisa_lang.math_types.f64, luisa_lang.math_types.FloatLiteral] = <luisa_lang.math_types.FloatLiteral object>,\tz: Union[luisa_lang.math_types.f64, luisa_lang.math_types.FloatLiteral] = <luisa_lang.math_types.FloatLiteral object>,\tw: Union[luisa_lang.math_types.f64, luisa_lang.math_types.FloatLiteral] = <luisa_lang.math_types.FloatLiteral object>)"}, {"fullname": "luisa_lang.math_types.double4.x", "modulename": "luisa_lang.math_types", "qualname": "double4.x", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.f64"}, {"fullname": "luisa_lang.math_types.double4.y", "modulename": "luisa_lang.math_types", "qualname": "double4.y", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.f64"}, {"fullname": "luisa_lang.math_types.double4.z", "modulename": "luisa_lang.math_types", "qualname": "double4.z", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.f64"}, {"fullname": "luisa_lang.math_types.double4.w", "modulename": "luisa_lang.math_types", "qualname": "double4.w", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.f64"}, {"fullname": "luisa_lang.math_types.byte4", "modulename": "luisa_lang.math_types", "qualname": "byte4", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.byte4.__init__", "modulename": "luisa_lang.math_types", "qualname": "byte4.__init__", "kind": "function", "doc": "\n", "signature": "(\tx: Union[luisa_lang.math_types.i8, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\ty: Union[luisa_lang.math_types.i8, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\tz: Union[luisa_lang.math_types.i8, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\tw: Union[luisa_lang.math_types.i8, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>)"}, {"fullname": "luisa_lang.math_types.byte4.x", "modulename": "luisa_lang.math_types", "qualname": "byte4.x", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.i8"}, {"fullname": "luisa_lang.math_types.byte4.y", "modulename": "luisa_lang.math_types", "qualname": "byte4.y", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.i8"}, {"fullname": "luisa_lang.math_types.byte4.z", "modulename": "luisa_lang.math_types", "qualname": "byte4.z", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.i8"}, {"fullname": "luisa_lang.math_types.byte4.w", "modulename": "luisa_lang.math_types", "qualname": "byte4.w", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.i8"}, {"fullname": "luisa_lang.math_types.ubyte4", "modulename": "luisa_lang.math_types", "qualname": "ubyte4", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.ubyte4.__init__", "modulename": "luisa_lang.math_types", "qualname": "ubyte4.__init__", "kind": "function", "doc": "\n", "signature": "(\tx: Union[luisa_lang.math_types.u8, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\ty: Union[luisa_lang.math_types.u8, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\tz: Union[luisa_lang.math_types.u8, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\tw: Union[luisa_lang.math_types.u8, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>)"}, {"fullname": "luisa_lang.math_types.ubyte4.x", "modulename": "luisa_lang.math_types", "qualname": "ubyte4.x", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u8"}, {"fullname": "luisa_lang.math_types.ubyte4.y", "modulename": "luisa_lang.math_types", "qualname": "ubyte4.y", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u8"}, {"fullname": "luisa_lang.math_types.ubyte4.z", "modulename": "luisa_lang.math_types", "qualname": "ubyte4.z", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u8"}, {"fullname": "luisa_lang.math_types.ubyte4.w", "modulename": "luisa_lang.math_types", "qualname": "ubyte4.w", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u8"}, {"fullname": "luisa_lang.math_types.short4", "modulename": "luisa_lang.math_types", "qualname": "short4", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.short4.__init__", "modulename": "luisa_lang.math_types", "qualname": "short4.__init__", "kind": "function", "doc": "\n", "signature": "(\tx: Union[luisa_lang.math_types.i16, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\ty: Union[luisa_lang.math_types.i16, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\tz: Union[luisa_lang.math_types.i16, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\tw: Union[luisa_lang.math_types.i16, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>)"}, {"fullname": "luisa_lang.math_types.short4.x", "modulename": "luisa_lang.math_types", "qualname": "short4.x", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.i16"}, {"fullname": "luisa_lang.math_types.short4.y", "modulename": "luisa_lang.math_types", "qualname": "short4.y", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.i16"}, {"fullname": "luisa_lang.math_types.short4.z", "modulename": "luisa_lang.math_types", "qualname": "short4.z", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.i16"}, {"fullname": "luisa_lang.math_types.short4.w", "modulename": "luisa_lang.math_types", "qualname": "short4.w", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.i16"}, {"fullname": "luisa_lang.math_types.ushort4", "modulename": "luisa_lang.math_types", "qualname": "ushort4", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.ushort4.__init__", "modulename": "luisa_lang.math_types", "qualname": "ushort4.__init__", "kind": "function", "doc": "\n", "signature": "(\tx: Union[luisa_lang.math_types.u16, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\ty: Union[luisa_lang.math_types.u16, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\tz: Union[luisa_lang.math_types.u16, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\tw: Union[luisa_lang.math_types.u16, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>)"}, {"fullname": "luisa_lang.math_types.ushort4.x", "modulename": "luisa_lang.math_types", "qualname": "ushort4.x", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u16"}, {"fullname": "luisa_lang.math_types.ushort4.y", "modulename": "luisa_lang.math_types", "qualname": "ushort4.y", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u16"}, {"fullname": "luisa_lang.math_types.ushort4.z", "modulename": "luisa_lang.math_types", "qualname": "ushort4.z", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u16"}, {"fullname": "luisa_lang.math_types.ushort4.w", "modulename": "luisa_lang.math_types", "qualname": "ushort4.w", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u16"}, {"fullname": "luisa_lang.math_types.int4", "modulename": "luisa_lang.math_types", "qualname": "int4", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.int4.__init__", "modulename": "luisa_lang.math_types", "qualname": "int4.__init__", "kind": "function", "doc": "\n", "signature": "(\tx: Union[int, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\ty: Union[int, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\tz: Union[int, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\tw: Union[int, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>)"}, {"fullname": "luisa_lang.math_types.int4.x", "modulename": "luisa_lang.math_types", "qualname": "int4.x", "kind": "variable", "doc": "\n", "annotation": ": int"}, {"fullname": "luisa_lang.math_types.int4.y", "modulename": "luisa_lang.math_types", "qualname": "int4.y", "kind": "variable", "doc": "\n", "annotation": ": int"}, {"fullname": "luisa_lang.math_types.int4.z", "modulename": "luisa_lang.math_types", "qualname": "int4.z", "kind": "variable", "doc": "\n", "annotation": ": int"}, {"fullname": "luisa_lang.math_types.int4.w", "modulename": "luisa_lang.math_types", "qualname": "int4.w", "kind": "variable", "doc": "\n", "annotation": ": int"}, {"fullname": "luisa_lang.math_types.uint4", "modulename": "luisa_lang.math_types", "qualname": "uint4", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.uint4.__init__", "modulename": "luisa_lang.math_types", "qualname": "uint4.__init__", "kind": "function", "doc": "\n", "signature": "(\tx: Union[luisa_lang.math_types.u32, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\ty: Union[luisa_lang.math_types.u32, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\tz: Union[luisa_lang.math_types.u32, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\tw: Union[luisa_lang.math_types.u32, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>)"}, {"fullname": "luisa_lang.math_types.uint4.x", "modulename": "luisa_lang.math_types", "qualname": "uint4.x", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u32"}, {"fullname": "luisa_lang.math_types.uint4.y", "modulename": "luisa_lang.math_types", "qualname": "uint4.y", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u32"}, {"fullname": "luisa_lang.math_types.uint4.z", "modulename": "luisa_lang.math_types", "qualname": "uint4.z", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u32"}, {"fullname": "luisa_lang.math_types.uint4.w", "modulename": "luisa_lang.math_types", "qualname": "uint4.w", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u32"}, {"fullname": "luisa_lang.math_types.long4", "modulename": "luisa_lang.math_types", "qualname": "long4", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.long4.__init__", "modulename": "luisa_lang.math_types", "qualname": "long4.__init__", "kind": "function", "doc": "\n", "signature": "(\tx: Union[luisa_lang.math_types.i64, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\ty: Union[luisa_lang.math_types.i64, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\tz: Union[luisa_lang.math_types.i64, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\tw: Union[luisa_lang.math_types.i64, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>)"}, {"fullname": "luisa_lang.math_types.long4.x", "modulename": "luisa_lang.math_types", "qualname": "long4.x", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.i64"}, {"fullname": "luisa_lang.math_types.long4.y", "modulename": "luisa_lang.math_types", "qualname": "long4.y", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.i64"}, {"fullname": "luisa_lang.math_types.long4.z", "modulename": "luisa_lang.math_types", "qualname": "long4.z", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.i64"}, {"fullname": "luisa_lang.math_types.long4.w", "modulename": "luisa_lang.math_types", "qualname": "long4.w", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.i64"}, {"fullname": "luisa_lang.math_types.ulong4", "modulename": "luisa_lang.math_types", "qualname": "ulong4", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.math_types.ulong4.__init__", "modulename": "luisa_lang.math_types", "qualname": "ulong4.__init__", "kind": "function", "doc": "\n", "signature": "(\tx: Union[luisa_lang.math_types.u64, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\ty: Union[luisa_lang.math_types.u64, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\tz: Union[luisa_lang.math_types.u64, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>,\tw: Union[luisa_lang.math_types.u64, luisa_lang.math_types.IntLiteral] = <luisa_lang.math_types.IntLiteral object>)"}, {"fullname": "luisa_lang.math_types.ulong4.x", "modulename": "luisa_lang.math_types", "qualname": "ulong4.x", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u64"}, {"fullname": "luisa_lang.math_types.ulong4.y", "modulename": "luisa_lang.math_types", "qualname": "ulong4.y", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u64"}, {"fullname": "luisa_lang.math_types.ulong4.z", "modulename": "luisa_lang.math_types", "qualname": "ulong4.z", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u64"}, {"fullname": "luisa_lang.math_types.ulong4.w", "modulename": "luisa_lang.math_types", "qualname": "ulong4.w", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.math_types.u64"}, {"fullname": "luisa_lang.math_types.f32", "modulename": "luisa_lang.math_types", "qualname": "f32", "kind": "variable", "doc": "\n", "default_value": "<class 'float'>"}, {"fullname": "luisa_lang.math_types.i32", "modulename": "luisa_lang.math_types", "qualname": "i32", "kind": "variable", "doc": "\n", "default_value": "<class 'int'>"}, {"fullname": "luisa_lang.parse", "modulename": "luisa_lang.parse", "kind": "module", "doc": "\n"}, {"fullname": "luisa_lang.parse.convert_func_signature", "modulename": "luisa_lang.parse", "qualname": "convert_func_signature", "kind": "function", "doc": "implicit_type_params: Tuple[List[Tuple[str,\n classinfo.VarType]], classinfo.VarType]
\n", "signature": "(\tsignature: luisa_lang.classinfo.MethodType,\tctx_name: str,\tprops: luisa_lang.hir.FuncProperties,\tglobalns: Dict[str, Any],\ttype_var_ns: Dict[TypeVar, luisa_lang.hir.Type],\timplicit_type_params: Dict[str, luisa_lang.hir.Type],\tself_type: Optional[luisa_lang.hir.Type],\tmode: Literal['parse', 'instantiate'] = 'parse') -> Tuple[luisa_lang.hir.FunctionSignature, luisa_lang.parse.TypeParser]:", "funcdef": "def"}, {"fullname": "luisa_lang.parse.FuncParser", "modulename": "luisa_lang.parse", "qualname": "FuncParser", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.parse.FuncParser.__init__", "modulename": "luisa_lang.parse", "qualname": "FuncParser.__init__", "kind": "function", "doc": "\n", "signature": "(\tname: str,\tfunc: object,\tsignature: luisa_lang.hir.FunctionSignature,\tglobalns: Dict[str, Any],\ttype_var_ns: Dict[TypeVar, luisa_lang.hir.Type],\tself_type: Optional[luisa_lang.hir.Type],\treturn_ref: bool)"}, {"fullname": "luisa_lang.parse.FuncParser.name", "modulename": "luisa_lang.parse", "qualname": "FuncParser.name", "kind": "variable", "doc": "\n", "annotation": ": str"}, {"fullname": "luisa_lang.parse.FuncParser.func", "modulename": "luisa_lang.parse", "qualname": "FuncParser.func", "kind": "variable", "doc": "\n", "annotation": ": object"}, {"fullname": "luisa_lang.parse.FuncParser.globalns", "modulename": "luisa_lang.parse", "qualname": "FuncParser.globalns", "kind": "variable", "doc": "\n", "annotation": ": Dict[str, Any]"}, {"fullname": "luisa_lang.parse.FuncParser.self_type", "modulename": "luisa_lang.parse", "qualname": "FuncParser.self_type", "kind": "variable", "doc": "\n", "annotation": ": Optional[luisa_lang.hir.Type]"}, {"fullname": "luisa_lang.parse.FuncParser.vars", "modulename": "luisa_lang.parse", "qualname": "FuncParser.vars", "kind": "variable", "doc": "\n", "annotation": ": Dict[str, luisa_lang.hir.Var | luisa_lang.hir.ComptimeValue]"}, {"fullname": "luisa_lang.parse.FuncParser.func_def", "modulename": "luisa_lang.parse", "qualname": "FuncParser.func_def", "kind": "variable", "doc": "\n", "annotation": ": ast.FunctionDef"}, {"fullname": "luisa_lang.parse.FuncParser.parsed_func", "modulename": "luisa_lang.parse", "qualname": "FuncParser.parsed_func", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.hir.Function"}, {"fullname": "luisa_lang.parse.FuncParser.type_var_ns", "modulename": "luisa_lang.parse", "qualname": "FuncParser.type_var_ns", "kind": "variable", "doc": "\n", "annotation": ": Dict[TypeVar, luisa_lang.hir.Type]"}, {"fullname": "luisa_lang.parse.FuncParser.bb_stack", "modulename": "luisa_lang.parse", "qualname": "FuncParser.bb_stack", "kind": "variable", "doc": "\n", "annotation": ": List[luisa_lang.hir.BasicBlock]"}, {"fullname": "luisa_lang.parse.FuncParser.type_parser", "modulename": "luisa_lang.parse", "qualname": "FuncParser.type_parser", "kind": "variable", "doc": "\n", "annotation": ": luisa_lang.parse.TypeParser"}, {"fullname": "luisa_lang.parse.FuncParser.break_and_continues", "modulename": "luisa_lang.parse", "qualname": "FuncParser.break_and_continues", "kind": "variable", "doc": "\n", "annotation": ": Optional[List[luisa_lang.hir.Break | luisa_lang.hir.Continue]]"}, {"fullname": "luisa_lang.parse.FuncParser.returning_ref", "modulename": "luisa_lang.parse", "qualname": "FuncParser.returning_ref", "kind": "variable", "doc": "\n", "annotation": ": bool"}, {"fullname": "luisa_lang.parse.FuncParser.signature", "modulename": "luisa_lang.parse", "qualname": "FuncParser.signature", "kind": "variable", "doc": "\n"}, {"fullname": "luisa_lang.parse.FuncParser.cur_bb", "modulename": "luisa_lang.parse", "qualname": "FuncParser.cur_bb", "kind": "function", "doc": "\n", "signature": "(self) -> luisa_lang.hir.BasicBlock:", "funcdef": "def"}, {"fullname": "luisa_lang.parse.FuncParser.parse_type", "modulename": "luisa_lang.parse", "qualname": "FuncParser.parse_type", "kind": "function", "doc": "\n", "signature": "(\tself,\tty: Union[TypeVar, Type, luisa_lang.classinfo.GenericInstance, luisa_lang.classinfo.UnionType, luisa_lang.classinfo.SelfType, luisa_lang.classinfo.AnyType, luisa_lang.classinfo.LiteralType]) -> Optional[luisa_lang.hir.Type]:", "funcdef": "def"}, {"fullname": "luisa_lang.parse.FuncParser.convert_constexpr", "modulename": "luisa_lang.parse", "qualname": "FuncParser.convert_constexpr", "kind": "function", "doc": "\n", "signature": "(\tself,\tcomptime_val: luisa_lang.hir.ComptimeValue,\tspan: Optional[luisa_lang.utils.Span] = None) -> Optional[luisa_lang.hir.Value]:", "funcdef": "def"}, {"fullname": "luisa_lang.parse.FuncParser.parse_const", "modulename": "luisa_lang.parse", "qualname": "FuncParser.parse_const", "kind": "function", "doc": "\n", "signature": "(self, const: ast.Constant) -> luisa_lang.hir.Value:", "funcdef": "def"}, {"fullname": "luisa_lang.parse.FuncParser.convert_any_to_value", "modulename": "luisa_lang.parse", "qualname": "FuncParser.convert_any_to_value", "kind": "function", "doc": "\n", "signature": "(\tself,\ta: Any,\tspan: luisa_lang.utils.Span | None) -> luisa_lang.hir.Value | luisa_lang.hir.ComptimeValue:", "funcdef": "def"}, {"fullname": "luisa_lang.parse.FuncParser.parse_name", "modulename": "luisa_lang.parse", "qualname": "FuncParser.parse_name", "kind": "function", "doc": "\n", "signature": "(\tself,\tname: ast.Name,\tnew_var_hint: Literal[False, 'dsl', 'comptime']) -> luisa_lang.hir.Ref | luisa_lang.hir.Value | luisa_lang.hir.ComptimeValue:", "funcdef": "def"}, {"fullname": "luisa_lang.parse.FuncParser.try_convert_comptime_value", "modulename": "luisa_lang.parse", "qualname": "FuncParser.try_convert_comptime_value", "kind": "function", "doc": "\n", "signature": "(\tself,\tvalue: luisa_lang.hir.ComptimeValue,\tspan: luisa_lang.utils.Span | None = None) -> luisa_lang.hir.Value:", "funcdef": "def"}, {"fullname": "luisa_lang.parse.FuncParser.get_index_type", "modulename": "luisa_lang.parse", "qualname": "FuncParser.get_index_type", "kind": "function", "doc": "\n", "signature": "(\tself,\tspan: Optional[luisa_lang.utils.Span],\tbase: luisa_lang.hir.Type,\tindex: luisa_lang.hir.Value) -> Optional[luisa_lang.hir.Type]:", "funcdef": "def"}, {"fullname": "luisa_lang.parse.FuncParser.parse_access_ref", "modulename": "luisa_lang.parse", "qualname": "FuncParser.parse_access_ref", "kind": "function", "doc": "\n", "signature": "(\tself,\texpr: ast.Subscript | ast.Attribute) -> luisa_lang.hir.Ref | luisa_lang.hir.TypeValue | luisa_lang.hir.FunctionValue | luisa_lang.hir.ComptimeValue:", "funcdef": "def"}, {"fullname": "luisa_lang.parse.FuncParser.parse_call_impl", "modulename": "luisa_lang.parse", "qualname": "FuncParser.parse_call_impl", "kind": "function", "doc": "\n", "signature": "(\tself,\tspan: luisa_lang.utils.Span | None,\tf: luisa_lang.hir.Function | luisa_lang.hir.FunctionTemplate,\targs: List[luisa_lang.hir.Value | luisa_lang.hir.Ref],\tinline=False) -> luisa_lang.hir.Value | luisa_lang.hir.TemplateMatchingError:", "funcdef": "def"}, {"fullname": "luisa_lang.parse.FuncParser.parse_call_impl_ref", "modulename": "luisa_lang.parse", "qualname": "FuncParser.parse_call_impl_ref", "kind": "function", "doc": "\n", "signature": "(\tself,\tspan: luisa_lang.utils.Span | None,\tf: luisa_lang.hir.Function | luisa_lang.hir.FunctionTemplate,\targs: List[luisa_lang.hir.Value | luisa_lang.hir.Ref]) -> luisa_lang.hir.Ref | luisa_lang.hir.TemplateMatchingError:", "funcdef": "def"}, {"fullname": "luisa_lang.parse.FuncParser.parse_call_impl_ex", "modulename": "luisa_lang.parse", "qualname": "FuncParser.parse_call_impl_ex", "kind": "function", "doc": "\n", "signature": "(\tself,\tspan: luisa_lang.utils.Span | None,\tf: luisa_lang.hir.Function | luisa_lang.hir.FunctionTemplate,\targs: List[luisa_lang.hir.Value | luisa_lang.hir.Ref],\tinline=False,\texpect_ref=False) -> luisa_lang.hir.Value | luisa_lang.hir.Ref | luisa_lang.hir.TemplateMatchingError:", "funcdef": "def"}, {"fullname": "luisa_lang.parse.FuncParser.handle_intrinsic", "modulename": "luisa_lang.parse", "qualname": "FuncParser.handle_intrinsic", "kind": "function", "doc": "\n", "signature": "(\tself,\texpr: ast.Call,\tis_ref: bool) -> luisa_lang.hir.Value | luisa_lang.hir.Ref:", "funcdef": "def"}, {"fullname": "luisa_lang.parse.FuncParser.handle_special_functions", "modulename": "luisa_lang.parse", "qualname": "FuncParser.handle_special_functions", "kind": "function", "doc": "\n", "signature": "(\tself,\tf: Callable[..., Any],\texpr: ast.Call) -> luisa_lang.hir.Value | luisa_lang.hir.ComptimeValue:", "funcdef": "def"}, {"fullname": "luisa_lang.parse.FuncParser.parse_call_ref", "modulename": "luisa_lang.parse", "qualname": "FuncParser.parse_call_ref", "kind": "function", "doc": "\n", "signature": "(self, expr: ast.Call) -> luisa_lang.hir.Ref:", "funcdef": "def"}, {"fullname": "luisa_lang.parse.FuncParser.parse_call", "modulename": "luisa_lang.parse", "qualname": "FuncParser.parse_call", "kind": "function", "doc": "\n", "signature": "(\tself,\texpr: ast.Call) -> luisa_lang.hir.Value | luisa_lang.hir.ComptimeValue:", "funcdef": "def"}, {"fullname": "luisa_lang.parse.FuncParser.parse_binop", "modulename": "luisa_lang.parse", "qualname": "FuncParser.parse_binop", "kind": "function", "doc": "\n", "signature": "(self, expr: ast.BinOp | ast.Compare) -> luisa_lang.hir.Value:", "funcdef": "def"}, {"fullname": "luisa_lang.parse.FuncParser.parse_ref", "modulename": "luisa_lang.parse", "qualname": "FuncParser.parse_ref", "kind": "function", "doc": "\n", "signature": "(\tself,\texpr: ast.expr,\tnew_var_hint: Literal[False, 'dsl', 'comptime'] = False) -> luisa_lang.hir.Ref | luisa_lang.hir.ComptimeValue | luisa_lang.hir.TypeValue | luisa_lang.hir.FunctionValue:", "funcdef": "def"}, {"fullname": "luisa_lang.parse.FuncParser.parse_multi_assignment", "modulename": "luisa_lang.parse", "qualname": "FuncParser.parse_multi_assignment", "kind": "function", "doc": "\n", "signature": "(\tself,\ttargets: List[ast.expr],\tanno_ty_fn: List[Optional[Callable[..., luisa_lang.hir.Type | None]]],\tvalues: luisa_lang.hir.Value | luisa_lang.hir.ComptimeValue) -> None:", "funcdef": "def"}, {"fullname": "luisa_lang.parse.FuncParser.parse_unary", "modulename": "luisa_lang.parse", "qualname": "FuncParser.parse_unary", "kind": "function", "doc": "\n", "signature": "(self, expr: ast.UnaryOp) -> luisa_lang.hir.Value:", "funcdef": "def"}, {"fullname": "luisa_lang.parse.FuncParser.parse_expr", "modulename": "luisa_lang.parse", "qualname": "FuncParser.parse_expr", "kind": "function", "doc": "\n", "signature": "(\tself,\texpr: ast.expr) -> luisa_lang.hir.Value | luisa_lang.hir.ComptimeValue:", "funcdef": "def"}, {"fullname": "luisa_lang.parse.FuncParser.eval_expr", "modulename": "luisa_lang.parse", "qualname": "FuncParser.eval_expr", "kind": "function", "doc": "\n", "signature": "(self, tree: str | ast.Expression | ast.expr):", "funcdef": "def"}, {"fullname": "luisa_lang.parse.FuncParser.convert_to_value", "modulename": "luisa_lang.parse", "qualname": "FuncParser.convert_to_value", "kind": "function", "doc": "\n", "signature": "(\tself,\tvalue: luisa_lang.hir.Value | luisa_lang.hir.Ref | luisa_lang.hir.ComptimeValue,\tspan: Optional[luisa_lang.utils.Span] = None) -> luisa_lang.hir.Value:", "funcdef": "def"}, {"fullname": "luisa_lang.parse.FuncParser.parse_stmt", "modulename": "luisa_lang.parse", "qualname": "FuncParser.parse_stmt", "kind": "function", "doc": "\n", "signature": "(self, stmt: ast.stmt) -> None:", "funcdef": "def"}, {"fullname": "luisa_lang.parse.FuncParser.parse_body", "modulename": "luisa_lang.parse", "qualname": "FuncParser.parse_body", "kind": "function", "doc": "\n", "signature": "(self):", "funcdef": "def"}, {"fullname": "luisa_lang.utils", "modulename": "luisa_lang.utils", "kind": "module", "doc": "\n"}, {"fullname": "luisa_lang.utils.unwrap", "modulename": "luisa_lang.utils", "qualname": "unwrap", "kind": "function", "doc": "\n", "signature": "(opt: Optional[~T]) -> ~T:", "funcdef": "def"}, {"fullname": "luisa_lang.utils.increment_lineno_and_col_offset", "modulename": "luisa_lang.utils", "qualname": "increment_lineno_and_col_offset", "kind": "function", "doc": "Increment the line number and end line number of each node in the tree\nstarting at node by n. This is useful to \"move code\" to a different\nlocation in a file.
\n", "signature": "(node: ast.AST, lineno: int, col_offset: int) -> ast.AST:", "funcdef": "def"}, {"fullname": "luisa_lang.utils.dedent_and_retrieve_indentation", "modulename": "luisa_lang.utils", "qualname": "dedent_and_retrieve_indentation", "kind": "function", "doc": "Dedent the lines and return the indentation level of the first line.
\n", "signature": "(lines: str) -> Tuple[str, int]:", "funcdef": "def"}, {"fullname": "luisa_lang.utils.retrieve_ast_and_filename", "modulename": "luisa_lang.utils", "qualname": "retrieve_ast_and_filename", "kind": "function", "doc": "\n", "signature": "(f: object) -> Tuple[ast.AST, str]:", "funcdef": "def"}, {"fullname": "luisa_lang.utils.get_full_name", "modulename": "luisa_lang.utils", "qualname": "get_full_name", "kind": "function", "doc": "\n", "signature": "(obj: Any) -> str:", "funcdef": "def"}, {"fullname": "luisa_lang.utils.Span", "modulename": "luisa_lang.utils", "qualname": "Span", "kind": "class", "doc": "\n"}, {"fullname": "luisa_lang.utils.Span.__init__", "modulename": "luisa_lang.utils", "qualname": "Span.__init__", "kind": "function", "doc": "\n", "signature": "(file: Optional[str], start: Tuple[int, int], end: Tuple[int, int])"}, {"fullname": "luisa_lang.utils.Span.file", "modulename": "luisa_lang.utils", "qualname": "Span.file", "kind": "variable", "doc": "\n", "annotation": ": Optional[str]"}, {"fullname": "luisa_lang.utils.Span.start", "modulename": "luisa_lang.utils", "qualname": "Span.start", "kind": "variable", "doc": "\n", "annotation": ": Tuple[int, int]"}, {"fullname": "luisa_lang.utils.Span.end", "modulename": "luisa_lang.utils", "qualname": "Span.end", "kind": "variable", "doc": "\n", "annotation": ": Tuple[int, int]"}, {"fullname": "luisa_lang.utils.Span.from_ast", "modulename": "luisa_lang.utils", "qualname": "Span.from_ast", "kind": "function", "doc": "\n", "signature": "(ast: ast.AST) -> Optional[luisa_lang.utils.Span]:", "funcdef": "def"}, {"fullname": "luisa_lang.utils.print_yellow", "modulename": "luisa_lang.utils", "qualname": "print_yellow", "kind": "function", "doc": "\n", "signature": "(message: str) -> None:", "funcdef": "def"}, {"fullname": "luisa_lang.utils.print_red", "modulename": "luisa_lang.utils", "qualname": "print_red", "kind": "function", "doc": "\n", "signature": "(message: str) -> None:", "funcdef": "def"}, {"fullname": "luisa_lang.utils.show_warning", "modulename": "luisa_lang.utils", "qualname": "show_warning", "kind": "function", "doc": "\n", "signature": "(message: str, span: Optional[luisa_lang.utils.Span] = None) -> None:", "funcdef": "def"}, {"fullname": "luisa_lang.utils.get_union_args", "modulename": "luisa_lang.utils", "qualname": "get_union_args", "kind": "function", "doc": "\n", "signature": "(union: Any) -> List[type]:", "funcdef": "def"}, {"fullname": "luisa_lang.utils.get_typevar_constrains_and_bounds", "modulename": "luisa_lang.utils", "qualname": "get_typevar_constrains_and_bounds", "kind": "function", "doc": "Find the constraints and bounds of a TypeVar.\nOnly one of the two can be present.
\n", "signature": "(t: <class 'TypeVar'>) -> Tuple[List[Any], Optional[Any]]:", "funcdef": "def"}, {"fullname": "luisa_lang.utils.checked_cast", "modulename": "luisa_lang.utils", "qualname": "checked_cast", "kind": "function", "doc": "\n", "signature": "(t: type[~T], obj: Any) -> ~T:", "funcdef": "def"}, {"fullname": "luisa_lang.utils.unique_hash", "modulename": "luisa_lang.utils", "qualname": "unique_hash", "kind": "function", "doc": "\n", "signature": "(s: str) -> str:", "funcdef": "def"}, {"fullname": "luisa_lang.utils.round_to_align", "modulename": "luisa_lang.utils", "qualname": "round_to_align", "kind": "function", "doc": "\n", "signature": "(s: int, a: int) -> int:", "funcdef": "def"}]; + + // mirrored in build-search-index.js (part 1) + // Also split on html tags. this is a cheap heuristic, but good enough. + elasticlunr.tokenizer.setSeperator(/[\s\-.;&_'"=,()]+|<[^>]*>/); + + let searchIndex; + if (docs._isPrebuiltIndex) { + console.info("using precompiled search index"); + searchIndex = elasticlunr.Index.load(docs); + } else { + console.time("building search index"); + // mirrored in build-search-index.js (part 2) + searchIndex = elasticlunr(function () { + this.pipeline.remove(elasticlunr.stemmer); + this.pipeline.remove(elasticlunr.stopWordFilter); + this.addField("qualname"); + this.addField("fullname"); + this.addField("annotation"); + this.addField("default_value"); + this.addField("signature"); + this.addField("bases"); + this.addField("doc"); + this.setRef("fullname"); + }); + for (let doc of docs) { + searchIndex.addDoc(doc); + } + console.timeEnd("building search index"); + } + + return (term) => searchIndex.search(term, { + fields: { + qualname: {boost: 4}, + fullname: {boost: 2}, + annotation: {boost: 2}, + default_value: {boost: 2}, + signature: {boost: 2}, + bases: {boost: 2}, + doc: {boost: 1}, + }, + expand: true + }); +})(); \ No newline at end of file