tvm
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>
30 #include <tvm/tirx/tirx_stmt.h>
31 
32 namespace tvm {
33 namespace script {
34 namespace ir_builder {
35 namespace tirx {
36 
37 using tvm::ffi::Tuple;
38 using tvm::ffi::Variant;
40 using tvm::tirx::Buffer;
42 using tvm::tirx::Layout;
43 using tvm::tirx::Var;
44 
60 Buffer BufferDecl(ffi::Array<PrimExpr> shape, PrimType dtype, ffi::String buffer_name,
61  ffi::Optional<Var> data, ffi::Optional<ffi::Array<PrimExpr>> strides,
62  ffi::Optional<PrimExpr> elem_offset, ffi::String storage_scope, int align,
63  int offset_factor, ffi::String buffer_type,
64  ffi::Optional<ffi::Array<IntImm>> axis_separators,
65  ffi::Optional<Layout> layout = std::nullopt,
66  ffi::Array<PrimExpr> allocated_addr = {});
67 
72 PrimFuncFrame PrimFunc(bool is_private, bool s_tir = false, bool persistent = false);
73 
80 Var Arg(ffi::String name, Var var);
81 
88 Buffer Arg(ffi::String name, Buffer buffer);
89 
94 void FuncName(ffi::String name);
95 
100 void FuncAttrs(ffi::Map<ffi::String, ffi::Any> attrs);
101 
107 Type FuncRet(Type ret_type);
108 
124 Buffer MatchBuffer(ffi::ObjectRef param, ffi::Array<PrimExpr> shape,
125  PrimType dtype = PrimType::Float(32), ffi::Optional<Var> data = std::nullopt,
126  ffi::Array<PrimExpr> strides = {}, PrimExpr elem_offset = PrimExpr(),
127  ffi::String storage_scope = "global", int align = -1, int offset_factor = 0,
128  ffi::String buffer_type = "default",
129  ffi::Optional<ffi::Array<IntImm>> axis_separators = std::nullopt,
130  ffi::Optional<Layout> layout = std::nullopt);
131 
138 SBlockFrame Block(ffi::String name, bool no_realize = false, ffi::String exec_scope = "");
139 
141 
142 ffi::Array<tvm::tirx::Var> KernelId(ffi::Array<PrimExpr> extents, ffi::String parent);
143 
144 ffi::Array<tvm::tirx::Var> CtaId(ffi::Array<PrimExpr> extents, ffi::String parent);
145 
146 ffi::Array<tvm::tirx::Var> CtaIdInPair();
147 
148 ffi::Array<tvm::tirx::Var> WarpId(ffi::Array<PrimExpr> extents, ffi::String parent);
149 
150 ffi::Array<tvm::tirx::Var> ThreadId(ffi::Array<PrimExpr> extents, ffi::String parent);
151 
157 
162 void Where(PrimExpr predicate);
163 
168 void Reads(ffi::Array<ffi::ObjectRef> buffer_slices);
169 
174 void Writes(ffi::Array<ffi::ObjectRef> buffer_slices);
175 
180 void BlockAttrs(ffi::Map<ffi::String, ffi::Any> attrs);
181 
199 ffi::Variant<Buffer, AllocBufferFrame> SBlockAllocBuffer(
200  ffi::Array<PrimExpr> shape, PrimType dtype = PrimType::Float(32),
201  ffi::Optional<Var> data = std::nullopt, ffi::Array<PrimExpr> strides = {},
202  PrimExpr elem_offset = PrimExpr(), ffi::String storage_scope = "", int align = -1,
203  int offset_factor = 0, ffi::String buffer_type = "default",
204  ffi::Optional<ffi::Array<IntImm>> axis_separators = std::nullopt,
205  ffi::Optional<Layout> layout = std::nullopt, ffi::Array<PrimExpr> allocated_addr = {});
206 
207 namespace axis {
208 
216 Var Spatial(Range dom, PrimExpr binding, PrimType dtype = PrimType::Int(32));
217 
225 Var Reduce(Range dom, PrimExpr binding, PrimType dtype = PrimType::Int(32));
226 
234 Var Scan(Range dom, PrimExpr binding, PrimType dtype = PrimType::Int(32));
235 
243 Var Opaque(Range dom, PrimExpr binding, PrimType dtype = PrimType::Int(32));
244 
252 ffi::Array<Var> Remap(ffi::String kinds, ffi::Array<PrimExpr> bindings,
253  PrimType dtype = PrimType::Int(32));
254 
255 } // namespace axis
256 
266  ffi::Optional<ffi::Map<ffi::String, Any>> annotations = std::nullopt,
267  ffi::Optional<PrimExpr> step = std::nullopt);
277  ffi::Optional<ffi::Map<ffi::String, Any>> annotations = std::nullopt,
278  ffi::Optional<PrimExpr> step = std::nullopt);
288  ffi::Optional<ffi::Map<ffi::String, Any>> annotations = std::nullopt,
289  ffi::Optional<PrimExpr> step = std::nullopt);
299  ffi::Optional<ffi::Map<ffi::String, Any>> annotations = std::nullopt,
300  ffi::Optional<PrimExpr> step = std::nullopt);
309 ForFrame ThreadBinding(PrimExpr start, PrimExpr stop, ffi::String thread,
310  ffi::Optional<ffi::Map<ffi::String, Any>> annotations = std::nullopt);
316 ForFrame Grid(ffi::Array<Variant<PrimExpr, ffi::Tuple<PrimExpr, PrimExpr>>> extents);
317 
325 AssertFrame Assert(PrimExpr condition, ffi::String error_kind,
326  ffi::Array<ffi::String> message_parts);
327 
340 Var Bind(Expr value, ffi::Optional<Type> type_annotation = std::nullopt,
341  ffi::Optional<Var> var = std::nullopt);
342 
350 AttrFrame Attr(ffi::Any node, ffi::String attr_key, PrimExpr value);
351 
362 
369 
373 void Break();
374 
378 void Continue();
379 
385 IfFrame If(PrimExpr condition);
386 
392 
398 
415 DeclBufferFrame DeclBuffer(ffi::Array<PrimExpr> shape, PrimType dtype, ffi::String buffer_name,
416  ffi::Optional<Var> data, ffi::Optional<ffi::Array<PrimExpr>> strides,
417  ffi::Optional<PrimExpr> elem_offset, ffi::String storage_scope,
418  int align, int offset_factor, ffi::String buffer_type,
419  ffi::Optional<ffi::Array<IntImm>> axis_separators,
420  ffi::Optional<Layout> layout = std::nullopt,
421  ffi::Optional<PrimExpr> allocated_addr = std::nullopt);
422 
431 Buffer AllocBuffer(ffi::Array<PrimExpr> shape, PrimType dtype = PrimType::Float(32),
432  ffi::String storage_scope = "global",
433  ffi::Optional<ffi::Map<ffi::String, ffi::Any>> annotations = std::nullopt);
434 
442 
449 LaunchThreadFrame LaunchThread(ffi::String thread_tag, PrimExpr extent);
450 
458 ComposeOpFrame ComposeOp(ffi::Map<ffi::String, Buffer> workspace,
459  ffi::Map<ffi::String, ffi::Any> config,
460  ffi::Optional<ffi::String> dispatch = std::nullopt);
461 
468 Var EnvThread(ffi::String thread_tag, PrimType dtype = PrimType::Int(32));
469 
478 void BufferStore(Buffer buffer, PrimExpr value, ffi::Array<PrimExpr> indices,
479  ffi::Optional<PrimExpr> predicate);
480 
485 void Evaluate(Expr value);
486 
497 inline Var Handle(ffi::Optional<PrimType> dtype = std::nullopt,
498  ffi::String storage_scope = "global") {
499  Type type_annotation = dtype.has_value() ? Type(PointerType(dtype.value(), storage_scope))
500  : Type(PointerType::VoidPointerTy(storage_scope));
501  return tvm::tirx::Var("", type_annotation);
502 }
503 
505 
506 #define TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(FuncName, DType) \
507  inline PrimExpr FuncName(ffi::Optional<PrimExpr> expr = std::nullopt) { \
508  PrimType dtype = DType; \
509  return expr.has_value() ? tvm::cast(dtype, expr.value()) \
510  : tvm::tirx::Var("", dtype).as_or_throw<PrimExpr>(); \
511  }
512 
513 #define TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST_SIZES(DType, Code) \
514  TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(DType##8, (PrimType(DLDataType{Code, 8, 1}))); \
515  TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(DType##16, (PrimType(DLDataType{Code, 16, 1}))); \
516  TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(DType##32, (PrimType(DLDataType{Code, 32, 1}))); \
517  TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(DType##64, (PrimType(DLDataType{Code, 64, 1})));
518 
523 
524 #define TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST_LANES(FuncName, Code, Size) \
525  TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(FuncName##x2, (PrimType(DLDataType{Code, Size, 2}))) \
526  TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(FuncName##x4, (PrimType(DLDataType{Code, Size, 4}))); \
527  TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(FuncName##x8, (PrimType(DLDataType{Code, Size, 8}))); \
528  TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(FuncName##x16, (PrimType(DLDataType{Code, Size, 16}))); \
529  TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(FuncName##x32, (PrimType(DLDataType{Code, Size, 32}))); \
530  TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(FuncName##x64, (PrimType(DLDataType{Code, Size, 64})));
531 
532 #define TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST_SIZES_LANES(DType, Code) \
533  TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST_LANES(DType##8, Code, 8); \
534  TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST_LANES(DType##16, Code, 16); \
535  TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST_LANES(DType##32, Code, 32); \
536  TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST_LANES(DType##64, Code, 64);
537 
542 
543 #define TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST_LANES_FIXED_SIZE(DType, Code, Bits) \
544  TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(DType, (PrimType(DLDataType{Code, Bits, 1}))); \
545  TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(DType##x2, (PrimType(DLDataType{Code, Bits, 2}))); \
546  TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(DType##x4, (PrimType(DLDataType{Code, Bits, 4}))); \
547  TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(DType##x8, (PrimType(DLDataType{Code, Bits, 8}))); \
548  TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(DType##x16, (PrimType(DLDataType{Code, Bits, 16}))); \
549  TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(DType##x32, (PrimType(DLDataType{Code, Bits, 32}))); \
550  TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(DType##x64, (PrimType(DLDataType{Code, Bits, 64})));
551 
560 
563 
565 
568 
569 #undef TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST
570 
571 } // namespace tirx
572 } // namespace ir_builder
573 } // namespace script
574 } // namespace tvm
575 
576 #endif // TVM_TIRX_SCRIPT_BUILDER_IR_H_
Managed reference to ExprNode.
Definition: base_expr.h:311
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:354
Definition: base_expr.h:113
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:484
Managed reference to TensorMapTypeNode.
Definition: type.h:199
Managed reference to TypeNode.
Definition: base_expr.h:77
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
Buffer is a symbolic n-darray structure. It is a composition of primitive symbolic types,...
Definition: buffer.h:187
Definition: exec_scope.h:228
Definition: layout.h:136
Managed reference to TilePrimitiveCallNode.
Definition: tirx_stmt.h:84
a named variable in TIR
Definition: var.h:68
Definition of layout.
constexpr const char * axis_separators
Marks the physical axis separators.
Definition: stmt.h:233
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.
ffi::Array< Var > Remap(ffi::String kinds, ffi::Array< PrimExpr > bindings, PrimType dtype=PrimType::Int(32))
The block axis remapping function.
Var Scan(Range dom, PrimExpr binding, PrimType dtype=PrimType::Int(32))
The scanning block axis defining function.
WhileFrame While(PrimExpr condition)
Create a while loop.
PrimExpr Float8E4M3(ffi::Optional< PrimExpr > expr=std::nullopt)
Definition: ir.h:553
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.
ComposeOpFrame ComposeOp(ffi::Map< ffi::String, Buffer > workspace, ffi::Map< ffi::String, ffi::Any > config, ffi::Optional< ffi::String > dispatch=std::nullopt)
Compose TIRx op.
Var EnvThread(ffi::String thread_tag, PrimType dtype=PrimType::Int(32))
Bind a var to thread env.
PrimExpr Float8E5M2(ffi::Optional< PrimExpr > expr=std::nullopt)
Definition: ir.h:557
ElseFrame Else()
Create an else.
ForFrame Serial(PrimExpr start, PrimExpr stop, ffi::Optional< ffi::Map< ffi::String, Any >> annotations=std::nullopt, ffi::Optional< PrimExpr > step=std::nullopt)
The serial For statement.
PrimExpr Float6E3M2FN(ffi::Optional< PrimExpr > expr=std::nullopt)
Definition: ir.h:562
void BufferStore(Buffer buffer, PrimExpr value, ffi::Array< PrimExpr > indices, ffi::Optional< PrimExpr > predicate)
Store data in a buffer.
ffi::Array< tvm::tirx::Var > KernelId(ffi::Array< PrimExpr > extents, ffi::String parent)
ForFrame Unroll(PrimExpr start, PrimExpr stop, ffi::Optional< ffi::Map< ffi::String, Any >> annotations=std::nullopt, ffi::Optional< PrimExpr > step=std::nullopt)
The unrolled For statement.
ForFrame Parallel(PrimExpr start, PrimExpr stop, ffi::Optional< ffi::Map< ffi::String, Any >> annotations=std::nullopt, ffi::Optional< PrimExpr > step=std::nullopt)
The parallel For statement.
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:558
void Reads(ffi::Array< ffi::ObjectRef > buffer_slices)
The block buffer region reading statement.
void Continue()
Create a continue statement.
IfFrame If(PrimExpr condition)
Create an if statement.
Var TensorMap()
Definition: ir.h:504
Buffer 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).
ForFrame Vectorized(PrimExpr start, PrimExpr stop, ffi::Optional< ffi::Map< ffi::String, Any >> annotations=std::nullopt, ffi::Optional< PrimExpr > step=std::nullopt)
The vectorized For statement.
Buffer MatchBuffer(ffi::ObjectRef param, ffi::Array< PrimExpr > shape, PrimType dtype=PrimType::Float(32), ffi::Optional< Var > data=std::nullopt, ffi::Array< PrimExpr > strides={}, PrimExpr elem_offset=PrimExpr(), ffi::String storage_scope="global", int align=-1, int offset_factor=0, ffi::String buffer_type="default", ffi::Optional< ffi::Array< IntImm >> axis_separators=std::nullopt, ffi::Optional< Layout > layout=std::nullopt)
The buffer match statement.
PrimExpr Float8E4M3FNUZ(ffi::Optional< PrimExpr > expr=std::nullopt)
Definition: ir.h:556
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:497
PrimExpr Float8E8M0FNU(ffi::Optional< PrimExpr > expr=std::nullopt)
Definition: ir.h:559
PrimExpr Float6E2M3FN(ffi::Optional< PrimExpr > expr=std::nullopt)
Definition: ir.h:561
void Break()
Create a break statement.
void FuncAttrs(ffi::Map< ffi::String, ffi::Any > attrs)
The PrimFunc annotation statement.
ffi::Array< tvm::tirx::Var > WarpId(ffi::Array< PrimExpr > extents, ffi::String parent)
void TilePrimitiveCall(tvm::tirx::TilePrimitiveCall op_call)
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.
ffi::Array< tvm::tirx::Var > CtaId(ffi::Array< PrimExpr > extents, ffi::String parent)
PrimExpr Float8E3M4(ffi::Optional< PrimExpr > expr=std::nullopt)
Definition: ir.h:552
PrimExpr Void(ffi::Optional< PrimExpr > expr=std::nullopt)
Definition: ir.h:567
DeclBufferFrame DeclBuffer(ffi::Array< PrimExpr > shape, PrimType dtype, ffi::String buffer_name, ffi::Optional< Var > data, ffi::Optional< ffi::Array< PrimExpr >> strides, ffi::Optional< PrimExpr > elem_offset, ffi::String storage_scope, int align, int offset_factor, ffi::String buffer_type, ffi::Optional< ffi::Array< IntImm >> axis_separators, ffi::Optional< Layout > layout=std::nullopt, ffi::Optional< PrimExpr > allocated_addr=std::nullopt)
The buffer declaration frame.
void Where(PrimExpr predicate)
The block predicate statement.
ForFrame ThreadBinding(PrimExpr start, PrimExpr stop, ffi::String thread, ffi::Optional< ffi::Map< ffi::String, Any >> annotations=std::nullopt)
The thread-binding For statement.
Var Arg(ffi::String name, Var var)
The PrimFunc variable arguments adding function.
PrimExpr Boolean(ffi::Optional< PrimExpr > expr=std::nullopt)
Definition: ir.h:566
PrimExpr Float4E2M1FN(ffi::Optional< PrimExpr > expr=std::nullopt)
Definition: ir.h:564
LaunchThreadFrame LaunchThread(Var var, PrimExpr extent)
Launch a thread.
ffi::Array< tvm::tirx::Var > CtaIdInPair()
ForFrame Grid(ffi::Array< Variant< PrimExpr, ffi::Tuple< PrimExpr, PrimExpr >>> extents)
The grid For statement.
AssertFrame Assert(PrimExpr condition, ffi::String error_kind, ffi::Array< ffi::String > message_parts)
The assertion statement.
ThenFrame Then()
Create a then.
ffi::Variant< Buffer, AllocBufferFrame > SBlockAllocBuffer(ffi::Array< PrimExpr > shape, PrimType dtype=PrimType::Float(32), ffi::Optional< Var > data=std::nullopt, ffi::Array< PrimExpr > strides={}, PrimExpr elem_offset=PrimExpr(), ffi::String storage_scope="", int align=-1, int offset_factor=0, ffi::String buffer_type="default", ffi::Optional< ffi::Array< IntImm >> axis_separators=std::nullopt, ffi::Optional< Layout > layout=std::nullopt, ffi::Array< PrimExpr > allocated_addr={})
The buffer allocation function.
PrimExpr Float8E4M3B11FNUZ(ffi::Optional< PrimExpr > expr=std::nullopt)
Definition: ir.h:554
Buffer BufferDecl(ffi::Array< PrimExpr > shape, PrimType dtype, ffi::String buffer_name, ffi::Optional< Var > data, ffi::Optional< ffi::Array< PrimExpr >> strides, ffi::Optional< PrimExpr > elem_offset, ffi::String storage_scope, int align, int offset_factor, ffi::String buffer_type, ffi::Optional< ffi::Array< IntImm >> axis_separators, ffi::Optional< Layout > layout=std::nullopt, ffi::Array< PrimExpr > allocated_addr={})
The buffer declaration function.
void Writes(ffi::Array< ffi::ObjectRef > buffer_slices)
The block buffer region writing statement.
ffi::Array< tvm::tirx::Var > ThreadId(ffi::Array< PrimExpr > extents, ffi::String parent)
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:555
PrimVar var(std::string name_hint, PrimType t=PrimType::Int(32))
Construct a new Var expression.
Tensor shape(const Tensor &src, PrimType dtype, const std::string name="T_shape", const std::string tag=kInjective)
Get the shape of input tensor.
Definition: transform.h:2010
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition: analyzer.h:40
A device-independent managed Tensor abstraction.
Common operators defined for Expr.
#define TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST_SIZES_LANES(DType, Code)
Definition: ir.h:532
#define TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST(FuncName, DType)
Definition: ir.h:506
#define TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST_SIZES(DType, Code)
Definition: ir.h:513
#define TVM_TIRX_IR_BUILDER_DEF_DTYPE_CAST_LANES_FIXED_SIZE(DType, Code, Bits)
Definition: ir.h:543