tvm
Loading...
Searching...
No Matches
ir.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19#ifndef TVM_SCRIPT_IR_BUILDER_TIR_IR_H_
20#define TVM_SCRIPT_IR_BUILDER_TIR_IR_H_
21
22#include <tvm/ffi/container/tuple.h>
23#include <tvm/ffi/container/variant.h>
24#include <tvm/runtime/tensor.h>
26#include <tvm/tirx/exec_scope.h>
27#include <tvm/tirx/layout.h>
28#include <tvm/tirx/op.h>
31
32namespace tvm {
33namespace script {
34namespace ir_builder {
35namespace tirx {
36
37using tvm::ffi::Tuple;
38using tvm::ffi::Variant;
43using tvm::tirx::Var;
44
58BufferVar BufferDecl(ffi::Array<PrimExpr> shape, PrimType dtype, ffi::String buffer_name,
59 ffi::Optional<Expr> data, ffi::Optional<ffi::Array<PrimExpr>> strides,
60 ffi::Optional<PrimExpr> elem_offset, ffi::String storage_scope, int align,
61 int offset_factor, ffi::Optional<Layout> layout = std::nullopt,
62 ffi::Array<PrimExpr> allocated_addr = {});
63
68PrimFuncFrame PrimFunc(bool is_private, bool s_tir = false, bool persistent = false);
69
76Var Arg(ffi::String name, Var var);
77
84BufferVar Arg(ffi::String name, BufferVar buffer);
85
90void FuncName(ffi::String name);
91
96void FuncAttrs(ffi::Map<ffi::String, ffi::Any> attrs);
97
103Type FuncRet(Type ret_type);
104
118BufferVar MatchBuffer(ffi::ObjectRef param, ffi::Array<PrimExpr> shape,
119 PrimType dtype = PrimType::Float(32), ffi::Optional<Expr> data = std::nullopt,
120 ffi::Array<PrimExpr> strides = {}, PrimExpr elem_offset = PrimExpr(),
121 ffi::String storage_scope = "global", int align = -1, int offset_factor = 0,
122 ffi::Optional<Layout> layout = std::nullopt);
123
130SBlockFrame Block(ffi::String name, bool no_realize = false, ffi::String exec_scope = "");
131
133
144ffi::Array<tvm::tirx::Var> ScopeId(ffi::Optional<ffi::Array<PrimExpr>> extents, ffi::String parent,
145 ffi::String name, ffi::String cur,
146 PrimType dtype = PrimType::Int(32));
147
148ffi::Array<tvm::tirx::Var> ClusterId(ffi::Optional<ffi::Array<PrimExpr>> extents,
149 ffi::String parent, PrimType dtype = PrimType::Int(32));
150
151ffi::Array<tvm::tirx::Var> CtaId(ffi::Optional<ffi::Array<PrimExpr>> extents, ffi::String parent,
152 ffi::Optional<ffi::Array<PrimExpr>> preferred = std::nullopt,
153 PrimType dtype = PrimType::Int(32));
154
155ffi::Array<tvm::tirx::Var> CtaIdInPair(PrimType dtype = PrimType::Int(32));
156
157ffi::Array<tvm::tirx::Var> WarpgroupId(ffi::Optional<ffi::Array<PrimExpr>> extents,
158 ffi::String parent, PrimType dtype = PrimType::Int(32));
159
160ffi::Array<tvm::tirx::Var> WarpId(ffi::Optional<ffi::Array<PrimExpr>> extents, ffi::String parent,
161 PrimType dtype = PrimType::Int(32));
162
163ffi::Array<tvm::tirx::Var> ThreadId(ffi::Optional<ffi::Array<PrimExpr>> extents, ffi::String parent,
164 PrimType dtype = PrimType::Int(32));
165
171
176void Where(PrimExpr predicate);
177
182void Reads(ffi::Array<ffi::ObjectRef> buffer_slices);
183
188void Writes(ffi::Array<ffi::ObjectRef> buffer_slices);
189
194void BlockAttrs(ffi::Map<ffi::String, ffi::Any> attrs);
195
211ffi::Variant<BufferVar, AllocBufferFrame> SBlockAllocBuffer(
212 ffi::Array<PrimExpr> shape, PrimType dtype = PrimType::Float(32),
213 ffi::Optional<Expr> data = std::nullopt, ffi::Array<PrimExpr> strides = {},
214 PrimExpr elem_offset = PrimExpr(), ffi::String storage_scope = "", int align = -1,
215 int offset_factor = 0, ffi::Optional<Layout> layout = std::nullopt,
216 ffi::Array<PrimExpr> allocated_addr = {});
217
218namespace axis {
219
228
237
246
255
263ffi::Array<Var> Remap(ffi::String kinds, ffi::Array<PrimExpr> bindings,
264 PrimType dtype = PrimType::Int(32));
265
266} // namespace axis
267
279 ffi::Optional<ffi::Map<ffi::String, Any>> annotations = std::nullopt,
280 ffi::Optional<PrimExpr> step = std::nullopt,
281 ffi::Optional<PrimType> dtype = std::nullopt);
292 ffi::Optional<ffi::Map<ffi::String, Any>> annotations = std::nullopt,
293 ffi::Optional<PrimExpr> step = std::nullopt,
294 ffi::Optional<PrimType> dtype = std::nullopt);
305 ffi::Optional<ffi::Map<ffi::String, Any>> annotations = std::nullopt,
306 ffi::Optional<PrimExpr> step = std::nullopt,
307 ffi::Optional<PrimType> dtype = std::nullopt);
318 ffi::Optional<ffi::Map<ffi::String, Any>> annotations = std::nullopt,
319 ffi::Optional<PrimExpr> step = std::nullopt,
320 ffi::Optional<PrimType> dtype = std::nullopt);
330 ffi::Optional<ffi::Map<ffi::String, Any>> annotations = std::nullopt);
338ForFrame Grid(ffi::Array<Variant<PrimExpr, ffi::Tuple<PrimExpr, PrimExpr>>> extents,
339 ffi::Optional<PrimType> dtype = std::nullopt);
340
348AssertFrame Assert(PrimExpr condition, ffi::String error_kind,
349 ffi::Array<ffi::String> message_parts);
350
363Var Bind(Expr value, ffi::Optional<Type> type_annotation = std::nullopt,
364 ffi::Optional<Var> var = std::nullopt);
365
373AttrFrame Attr(ffi::Any node, ffi::String attr_key, PrimExpr value);
374
385
392
397void Return(Expr value);
398
402void Break();
403
407void Continue();
408
414IfFrame If(PrimExpr condition);
415
421
427
442DeclBufferFrame DeclBuffer(ffi::Array<PrimExpr> shape, PrimType dtype, ffi::String buffer_name,
443 ffi::Optional<Expr> data, ffi::Optional<ffi::Array<PrimExpr>> strides,
444 ffi::Optional<PrimExpr> elem_offset, ffi::String storage_scope,
445 int align, int offset_factor,
446 ffi::Optional<Layout> layout = std::nullopt,
447 ffi::Optional<PrimExpr> allocated_addr = std::nullopt);
448
457BufferVar AllocBuffer(ffi::Array<PrimExpr> shape, PrimType dtype = PrimType::Float(32),
458 ffi::String storage_scope = "global",
459 ffi::Optional<ffi::Map<ffi::String, ffi::Any>> annotations = std::nullopt);
460
468
475LaunchThreadFrame LaunchThread(ffi::String thread_tag, PrimExpr extent);
476
484ComposeOpFrame ComposeOp(ffi::Map<ffi::String, BufferVar> workspace,
485 ffi::Map<ffi::String, ffi::Any> config,
486 ffi::Optional<ffi::String> dispatch = std::nullopt);
487
494Var EnvThread(ffi::String thread_tag, PrimType dtype = PrimType::Int(32));
495
502void BufferStore(BufferVar buffer, PrimExpr value, ffi::Array<PrimExpr> indices);
503
508void Evaluate(Expr value);
509
520inline Var Handle(ffi::Optional<PrimType> dtype = std::nullopt,
521 ffi::String storage_scope = "global") {
522 Type type_annotation = dtype.has_value() ? Type(PointerType(dtype.value(), storage_scope))
523 : Type(PointerType::VoidPointerTy(storage_scope));
525}
526
528
529#define TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(FuncName, DType) \
530 inline PrimExpr FuncName(ffi::Optional<PrimExpr> expr = std::nullopt) { \
531 PrimType dtype = DType; \
532 return expr.has_value() ? tvm::cast(dtype, expr.value()) \
533 : tvm::tirx::Var("", dtype).as_or_throw<PrimExpr>(); \
534 }
535
536#define TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST_SIZES(DType, Code) \
537 TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(DType##8, (PrimType(DLDataType{Code, 8, 1}))); \
538 TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(DType##16, (PrimType(DLDataType{Code, 16, 1}))); \
539 TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(DType##32, (PrimType(DLDataType{Code, 32, 1}))); \
540 TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(DType##64, (PrimType(DLDataType{Code, 64, 1})));
541
546
547#define TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST_LANES(FuncName, Code, Size) \
548 TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(FuncName##x2, (PrimType(DLDataType{Code, Size, 2}))) \
549 TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(FuncName##x4, (PrimType(DLDataType{Code, Size, 4}))); \
550 TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(FuncName##x8, (PrimType(DLDataType{Code, Size, 8}))); \
551 TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(FuncName##x16, (PrimType(DLDataType{Code, Size, 16}))); \
552 TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(FuncName##x32, (PrimType(DLDataType{Code, Size, 32}))); \
553 TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(FuncName##x64, (PrimType(DLDataType{Code, Size, 64})));
554
555#define TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST_SIZES_LANES(DType, Code) \
556 TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST_LANES(DType##8, Code, 8); \
557 TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST_LANES(DType##16, Code, 16); \
558 TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST_LANES(DType##32, Code, 32); \
559 TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST_LANES(DType##64, Code, 64);
560
565
566#define TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST_LANES_FIXED_SIZE(DType, Code, Bits) \
567 TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(DType, (PrimType(DLDataType{Code, Bits, 1}))); \
568 TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(DType##x2, (PrimType(DLDataType{Code, Bits, 2}))); \
569 TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(DType##x4, (PrimType(DLDataType{Code, Bits, 4}))); \
570 TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(DType##x8, (PrimType(DLDataType{Code, Bits, 8}))); \
571 TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(DType##x16, (PrimType(DLDataType{Code, Bits, 16}))); \
572 TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(DType##x32, (PrimType(DLDataType{Code, Bits, 32}))); \
573 TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(DType##x64, (PrimType(DLDataType{Code, Bits, 64})));
574
583
586
588
591
592#undef TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST
593
594} // namespace tirx
595} // namespace ir_builder
596} // namespace script
597} // namespace tvm
598
599#endif // TVM_TIRX_SCRIPT_BUILDER_IR_H_
Managed reference to ExprNode.
Definition base_expr.h:335
Definition type.h:71
static PointerType VoidPointerTy(ffi::String storage_scope="")
Construct an opaque pointer with void element type.
Typed reference/view over any Expr whose ExprNode::ty is PrimType.
Definition base_expr.h:401
Definition base_expr.h:137
static PrimType Float(int bits, int lanes=1)
Construct a floating-point type with fixed lanes.
static PrimType Void()
Construct the void sentinel type, encoded as handle(0, 0).
static PrimType Int(int bits, int lanes=1)
Construct a signed integer type with fixed lanes.
static PrimType Bool(int lanes=1)
Construct a boolean type with fixed lanes.
Range container
Definition expr.h:610
Managed reference to TensorMapTypeNode.
Definition type.h:199
Managed reference to TypeNode.
Definition base_expr.h:77
Managed reference to VarNode.
Definition expr.h:372
RAII wrapper function to enter and exit a context object similar to python's with syntax.
Definition with_context.h:59
Managed Tensor. The array is backed by reference counted blocks.
Definition tensor.h:49
Managed reference to AssertFrameNode.
Definition frame.h:345
Managed reference to AttrFrameNode.
Definition frame.h:437
Managed reference to BlockInitFrameNode.
Definition frame.h:241
Managed reference to ElseFrameNode.
Definition frame.h:601
Managed reference to ForFrameNode.
Definition frame.h:298
Managed reference to IfFrameNode.
Definition frame.h:521
Managed reference to LaunchThreadFrameNode.
Definition frame.h:390
Managed reference to PrimFuncFrameNode.
Definition frame.h:126
Managed reference to SBlockFrameNode.
Definition frame.h:200
Managed reference to ThenFrameNode.
Definition frame.h:561
Managed reference to WhileFrameNode.
Definition frame.h:476
Checked zero-state view over an ordinary VarNode with BufferType.
Definition buffer.h:179
Definition exec_scope.h:228
Definition layout.h:136
Managed reference to TilePrimitiveCallNode.
Definition tile_primitive.h:239
Definition of layout.
Var Spatial(Range dom, PrimExpr binding, PrimType dtype=PrimType::Int(32))
The spatial block axis defining function.
Var Reduce(Range dom, PrimExpr binding, PrimType dtype=PrimType::Int(32))
The reduced block axis defining function.
Var Opaque(Range dom, PrimExpr binding, PrimType dtype=PrimType::Int(32))
The opaque block axis defining function.
Var Scan(Range dom, PrimExpr binding, PrimType dtype=PrimType::Int(32))
The scanning block axis defining function.
ffi::Array< Var > Remap(ffi::String kinds, ffi::Array< PrimExpr > bindings, PrimType dtype=PrimType::Int(32))
The block axis remapping function.
WhileFrame While(PrimExpr condition)
Create a while loop.
PrimExpr Float8E4M3(ffi::Optional< PrimExpr > expr=std::nullopt)
Definition ir.h:576
Var Bind(Expr value, ffi::Optional< Type > type_annotation=std::nullopt, ffi::Optional< Var > var=std::nullopt)
Create a Bind (variable binding).
BlockInitFrame Init()
The block initialization statement.
BufferVar AllocBuffer(ffi::Array< PrimExpr > shape, PrimType dtype=PrimType::Float(32), ffi::String storage_scope="global", ffi::Optional< ffi::Map< ffi::String, ffi::Any > > annotations=std::nullopt)
Statement-level buffer allocation (creates an AllocBuffer IR node).
Var EnvThread(ffi::String thread_tag, PrimType dtype=PrimType::Int(32))
Bind a var to thread env.
ffi::Array< tvm::tirx::Var > WarpId(ffi::Optional< ffi::Array< PrimExpr > > extents, ffi::String parent, PrimType dtype=PrimType::Int(32))
PrimExpr Float8E5M2(ffi::Optional< PrimExpr > expr=std::nullopt)
Definition ir.h:580
ElseFrame Else()
Create an else.
ComposeOpFrame ComposeOp(ffi::Map< ffi::String, BufferVar > workspace, ffi::Map< ffi::String, ffi::Any > config, ffi::Optional< ffi::String > dispatch=std::nullopt)
Compose TIRx op.
PrimExpr Float6E3M2FN(ffi::Optional< PrimExpr > expr=std::nullopt)
Definition ir.h:585
void Evaluate(Expr value)
Evaluate the input expression.
void BlockAttrs(ffi::Map< ffi::String, ffi::Any > attrs)
The block annotation statement.
PrimExpr Float8E5M2FNUZ(ffi::Optional< PrimExpr > expr=std::nullopt)
Definition ir.h:581
void Reads(ffi::Array< ffi::ObjectRef > buffer_slices)
The block buffer region reading statement.
ForFrame Vectorized(PrimExpr start, PrimExpr stop, ffi::Optional< ffi::Map< ffi::String, Any > > annotations=std::nullopt, ffi::Optional< PrimExpr > step=std::nullopt, ffi::Optional< PrimType > dtype=std::nullopt)
The vectorized For statement.
BufferVar BufferDecl(ffi::Array< PrimExpr > shape, PrimType dtype, ffi::String buffer_name, ffi::Optional< Expr > data, ffi::Optional< ffi::Array< PrimExpr > > strides, ffi::Optional< PrimExpr > elem_offset, ffi::String storage_scope, int align, int offset_factor, ffi::Optional< Layout > layout=std::nullopt, ffi::Array< PrimExpr > allocated_addr={})
The buffer declaration function.
void Continue()
Create a continue statement.
IfFrame If(PrimExpr condition)
Create an if statement.
Var TensorMap()
Definition ir.h:527
ffi::Array< tvm::tirx::Var > CtaIdInPair(PrimType dtype=PrimType::Int(32))
void Return(Expr value)
Create a return statement.
BufferVar MatchBuffer(ffi::ObjectRef param, ffi::Array< PrimExpr > shape, PrimType dtype=PrimType::Float(32), ffi::Optional< Expr > data=std::nullopt, ffi::Array< PrimExpr > strides={}, PrimExpr elem_offset=PrimExpr(), ffi::String storage_scope="global", int align=-1, int offset_factor=0, ffi::Optional< Layout > layout=std::nullopt)
The buffer match statement.
void BufferStore(BufferVar buffer, PrimExpr value, ffi::Array< PrimExpr > indices)
Store data in a buffer.
PrimExpr Float8E4M3FNUZ(ffi::Optional< PrimExpr > expr=std::nullopt)
Definition ir.h:579
void FuncName(ffi::String name)
The PrimFunc naming statement.
Var Handle(ffi::Optional< PrimType > dtype=std::nullopt, ffi::String storage_scope="global")
Create a TIR var that represents a pointer.
Definition ir.h:520
PrimExpr Float8E8M0FNU(ffi::Optional< PrimExpr > expr=std::nullopt)
Definition ir.h:582
PrimExpr Float6E2M3FN(ffi::Optional< PrimExpr > expr=std::nullopt)
Definition ir.h:584
void Break()
Create a break statement.
ffi::Array< tvm::tirx::Var > CtaId(ffi::Optional< ffi::Array< PrimExpr > > extents, ffi::String parent, ffi::Optional< ffi::Array< PrimExpr > > preferred=std::nullopt, PrimType dtype=PrimType::Int(32))
void FuncAttrs(ffi::Map< ffi::String, ffi::Any > attrs)
The PrimFunc annotation statement.
void TilePrimitiveCall(tvm::tirx::TilePrimitiveCall op_call)
ForFrame Grid(ffi::Array< Variant< PrimExpr, ffi::Tuple< PrimExpr, PrimExpr > > > extents, ffi::Optional< PrimType > dtype=std::nullopt)
The grid For statement.
AttrFrame DeviceEntry()
Mark the device-region entry within the enclosing PrimFunc body. Returns an AttrFrame keyed tirx....
AttrFrame Attr(ffi::Any node, ffi::String attr_key, PrimExpr value)
Create an attribute.
SBlockFrame Block(ffi::String name, bool no_realize=false, ffi::String exec_scope="")
The block declaration statement.
PrimExpr Float8E3M4(ffi::Optional< PrimExpr > expr=std::nullopt)
Definition ir.h:575
PrimExpr Void(ffi::Optional< PrimExpr > expr=std::nullopt)
Definition ir.h:590
void Where(PrimExpr predicate)
The block predicate statement.
ForFrame Serial(PrimExpr start, PrimExpr stop, ffi::Optional< ffi::Map< ffi::String, Any > > annotations=std::nullopt, ffi::Optional< PrimExpr > step=std::nullopt, ffi::Optional< PrimType > dtype=std::nullopt)
The serial For statement.
Var Arg(ffi::String name, Var var)
The PrimFunc variable arguments adding function.
ForFrame ThreadBinding(PrimExpr start, PrimExpr stop, ffi::String thread, ffi::Optional< ffi::Map< ffi::String, Any > > annotations=std::nullopt)
The thread-binding For statement.
PrimExpr Boolean(ffi::Optional< PrimExpr > expr=std::nullopt)
Definition ir.h:589
ForFrame Unroll(PrimExpr start, PrimExpr stop, ffi::Optional< ffi::Map< ffi::String, Any > > annotations=std::nullopt, ffi::Optional< PrimExpr > step=std::nullopt, ffi::Optional< PrimType > dtype=std::nullopt)
The unrolled For statement.
PrimExpr Float4E2M1FN(ffi::Optional< PrimExpr > expr=std::nullopt)
Definition ir.h:587
DeclBufferFrame DeclBuffer(ffi::Array< PrimExpr > shape, PrimType dtype, ffi::String buffer_name, ffi::Optional< Expr > data, ffi::Optional< ffi::Array< PrimExpr > > strides, ffi::Optional< PrimExpr > elem_offset, ffi::String storage_scope, int align, int offset_factor, ffi::Optional< Layout > layout=std::nullopt, ffi::Optional< PrimExpr > allocated_addr=std::nullopt)
The buffer declaration frame.
LaunchThreadFrame LaunchThread(Var var, PrimExpr extent)
Launch a thread.
ffi::Array< tvm::tirx::Var > ThreadId(ffi::Optional< ffi::Array< PrimExpr > > extents, ffi::String parent, PrimType dtype=PrimType::Int(32))
ffi::Array< tvm::tirx::Var > ScopeId(ffi::Optional< ffi::Array< PrimExpr > > extents, ffi::String parent, ffi::String name, ffi::String cur, PrimType dtype=PrimType::Int(32))
Define a scope id. Pass extents=std::nullopt to defer the extent; it is inferred at LowerTIRx from th...
AssertFrame Assert(PrimExpr condition, ffi::String error_kind, ffi::Array< ffi::String > message_parts)
The assertion statement.
ffi::Array< tvm::tirx::Var > ClusterId(ffi::Optional< ffi::Array< PrimExpr > > extents, ffi::String parent, PrimType dtype=PrimType::Int(32))
ffi::Array< tvm::tirx::Var > WarpgroupId(ffi::Optional< ffi::Array< PrimExpr > > extents, ffi::String parent, PrimType dtype=PrimType::Int(32))
ThenFrame Then()
Create a then.
ForFrame Parallel(PrimExpr start, PrimExpr stop, ffi::Optional< ffi::Map< ffi::String, Any > > annotations=std::nullopt, ffi::Optional< PrimExpr > step=std::nullopt, ffi::Optional< PrimType > dtype=std::nullopt)
The parallel For statement.
PrimExpr Float8E4M3B11FNUZ(ffi::Optional< PrimExpr > expr=std::nullopt)
Definition ir.h:577
ffi::Variant< BufferVar, AllocBufferFrame > SBlockAllocBuffer(ffi::Array< PrimExpr > shape, PrimType dtype=PrimType::Float(32), ffi::Optional< Expr > data=std::nullopt, ffi::Array< PrimExpr > strides={}, PrimExpr elem_offset=PrimExpr(), ffi::String storage_scope="", int align=-1, int offset_factor=0, ffi::Optional< Layout > layout=std::nullopt, ffi::Array< PrimExpr > allocated_addr={})
The buffer allocation function.
void Writes(ffi::Array< ffi::ObjectRef > buffer_slices)
The block buffer region writing statement.
PrimFuncFrame PrimFunc(bool is_private, bool s_tir=false, bool persistent=false)
The primitive function statement.
Type FuncRet(Type ret_type)
The PrimFunc return type statement.
PrimExpr Float8E4M3FN(ffi::Optional< PrimExpr > expr=std::nullopt)
Definition ir.h:578
tvm::Var Var
Definition var.h:38
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition analyzer.h:40
A device-independent managed Tensor abstraction.
TIRX tile primitive statements, operators, and reified lambda expressions.
Common operators defined for Expr.
#define TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST_SIZES_LANES(DType, Code)
Definition ir.h:555
#define TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(FuncName, DType)
Definition ir.h:529
#define TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST_SIZES(DType, Code)
Definition ir.h:536
#define TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST_LANES_FIXED_SIZE(DType, Code, Bits)
Definition ir.h:566