tvm
Loading...
Searching...
No Matches
builtin.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
33#ifndef TVM_TIR_BUILTIN_H_
34#define TVM_TIR_BUILTIN_H_
35
36#include <tvm/ir/op.h>
37#include <tvm/ir/prim/expr.h>
38
39namespace tvm {
40namespace tirx {
41
43namespace builtin {
60
68TVM_DLL const Op& filter();
69
79
90
99
113
122
126TVM_DLL const Op& isnan();
127
132
140TVM_DLL const Op& fma();
141
155
169
181
193
204
205// TODO(tvm-team) revisit the builtins below
206// some of them can simply become ops with special codegen attr.
211
228
237
243
249
258
267
277
287
295
304
315
327
348
362
373
386
392
410
425
444
454
459
496
502
515// Metal cooperative_tensor intrinsics (MetalPerformancePrimitives / Metal 4)
516
524
536
548
559
560// TODO(tvm-team) replace the usage of the vector operations by Shuffle.
565
570
575
579TVM_DLL const Op& dp4a();
580
589
594
599
612
620
631
644
653
660TVM_DLL const Op& undef();
661
666
671
684
697
710
715
723
731
739
748
757
782
787} // namespace builtin
788} // namespace tirx
789} // namespace tvm
790#endif // TVM_TIR_BUILTIN_H_
Managed reference class to OpNode.
Definition op.h:163
RAII wrapper function to enter and exit a context object similar to python's with syntax.
Definition with_context.h:59
Primitive operators(builtin intrinsics) and registry for them.
TIR expressions.
const Op & filter()
Thread-set filter predicate. Used as the condition of an IfThenElse to narrow the active thread set A...
const Op & texture2d_load()
Load from texture 2d memory.
const Op & thread_return()
Return from a GPU thread.
const Op & masked_load()
Masked buffer load.
const Op & tvm_warp_activemask()
const Op & tvm_call_cpacked_lowered()
Lowered version of call c-packed, the space of value and type codes are explicitly allocated.
const Op & tvm_call_trace_packed()
See pesudo code.
const Op & undef()
Returns an initialized but arbitrary value.
const Op & call_extern()
Call an extern C function with given name and signature from the types of args in the runtime environ...
const Op & dma_end_group()
End a group of DMA copies.
const Op & dma_start_group()
Start a group of DMA copies.
const Op & address_of()
Returns the address of an element in the buffer (see pseudocode below).
const Op & end_profile_intrinsic()
Profiling intrinsic.
const Op & tvm_call_cpacked()
See pesudo code.
const Op & assume()
Provide a true statement that can be used for simplifications.
const Op & tvm_access_ptr()
Get head access address with memory access pattern info.
const Op & call_spirv_pure_glsl450()
Call an SPIRV pure GLSL450 intrinsic.
const Op & cooperative_tensor_multiply_accumulate()
Multiply and accumulate two matrices using cooperative_tensor (MetalPerformancePrimitives matmul2d).
const Op & dma_wait()
Wait until the number of DMA groups in flight is less than or equal to some maximum.
const Op & tvm_global_barrier_kinit()
Initialize the global barrier. Call this at beginning of kernel that need global barrier.
const Op & tvm_warp_shuffle()
See pseudo code.
const Op & call_llvm_pure_intrin()
Call an LLVM pure intrinsic with a given intrinsic id and signature from the types of args in the run...
const Op & nd_mem_alloc_with_scope()
Create an Nd memory allocation with storage scope.
const Op & anylist_setitem_call_packed()
Set an item into any list by running packed function call.
const Op & masked_store()
Masked buffer store.
const Op & break_loop()
Loop break.
const Op & ignore_loop_partition()
Annotate a predicate not be considered as target condition of loop partition.
const Op & tvm_warp_shuffle_down()
const Op & selector()
Analysis-only active-thread selector.
const Op & call_llvm_intrin()
Call an LLVM intrinsic with a given intrinsic id and signature from the types of args in the runtime ...
const Op & prefetch()
same signature as llvm.prefetch
const Op & vectorhigh()
Get the high level half of the vector.
const Op & tvm_static_handle()
Create a function local static handle that iniitalizes to nullptr. can be used to cache function loca...
const Op & isnullptr()
See pesudo code.
const Op & anylist_getitem()
Get a item from any list and return it.
const Op & vectorcombine()
Concat two vectors.
const Op & cooperative_tensor_load()
Load data from device or threadgroup memory into a cooperative_tensor.
const Op & cooperative_tensor_fill()
Fill a cooperative_tensor with a given value.
const Op & tvm_thread_invariant()
Mark a condition to be thread invariant. This means the condition must be the same for all threads.
const Op & tvm_warp_shuffle_up()
const Op & buffer_offset()
Get the element offset of a buffer given logical indices.
const Op & start_profile_intrinsic()
Profiling intrinsic.
const Op & continue_loop()
Loop continue.
const Op & call_pure_extern()
Call an pure extern C function with given name and signature from the types of args in the runtime en...
const Op & tvm_stack_make_shape()
Allocate a shape tuple on stack, return the handle.
const Op & get_active_lane_mask()
Calculate a predicate mask given an upper bound (limit) and a current value (base).
const Op & tvm_warp_shuffle_xor()
const Op & q_multiply_shift()
Execute a multiplication between two Q-numbers x and y followed by a right shift s The default roundi...
const Op & tvm_struct_get()
See pesudo code.
const Op & isnan()
Check if value is nan.
const Op & tvm_struct_set()
See pesudo code.
const Op & dp4a()
Dot product of two int8x4 vectors and add an optional accumulator.
const Op & tvm_context_id()
Return a unique context id, used for hint of workspace separation. Different context id ganrantees no...
const Op & popcount()
Popcount.
const Op & tvm_tuple()
tvm_tuple is not an actual function and cannot codegen. It is used to represent tuple structure in va...
const Op & reinterpret()
Reinterpret the value using the target type.
const Op & anylist_setitem_call_cpacked()
Same as anylist_setitem_call_packed but use C calling convention.
const Op & tvm_call_trace_packed_lowered()
Lowered version of trace intrinsic, the space of value and type codes are explicitly allocated....
const Op & q_multiply_shift_per_axis()
const Op & cooperative_tensor_store()
Store data from a cooperative_tensor to device or threadgroup memory.
const Op & tvm_stack_alloca()
See pesudo code.
const Op & tvm_call_packed_lowered()
Lowered version of call packed, the space of value and type codes are explicitly allocated.
const Op & atomic_add()
atomic add instruction, corresponding e.g. to atomicAdd in CUDA
const Op & tvm_storage_sync()
See pseudo code.
const Op & ptr_byte_offset()
Cast a handle to a typed pointer after adding a byte offset.
const Op & tvm_call_packed()
See pesudo code.
const Op & dma_copy()
Initiate a non-blocking DMA copy from source to destination.
const Op & print_buffer()
Print the content of a buffer during runtime.
const Op & fma()
Fused multiply add.
const Op & handle_add_byte_offset()
See pesudo code.
TVMStructFieldKind
The kind of structure field info used in intrinsic.
Definition builtin.h:759
@ kDLTensorNDim
Definition builtin.h:765
@ kTVMFFIAnyUnionValue
Definition builtin.h:777
@ kTVMFFIAnyTypeIndex
Definition builtin.h:775
@ kDLTensorDeviceId
Definition builtin.h:770
@ kDLTensorKindBound_
Definition builtin.h:772
@ kDLTensorTypeLanes
Definition builtin.h:768
@ kTVMValueKindBound_
Definition builtin.h:778
@ kTVMValueContent
Definition builtin.h:774
@ kDLTensorStrides
Definition builtin.h:764
@ kDLTensorTypeCode
Definition builtin.h:766
@ kDLTensorAddr
Definition builtin.h:761
@ kDLTensorByteOffset
Definition builtin.h:769
@ kDLTensorShape
Definition builtin.h:763
@ kInt64ArrayElem
Definition builtin.h:780
@ kDLTensorDeviceType
Definition builtin.h:771
@ kTVMFFIAnyZeroPadding
Definition builtin.h:776
@ kDLTensorData
Definition builtin.h:762
@ kDLTensorTypeBits
Definition builtin.h:767
const Op & anylist_resetitem()
Reset and clear a item in any list.
const Op & tvm_kernel_replace_point()
Marker where a transform should replace generated kernel initialization.
const Op & buffer_data()
Project the physical pointer associated with a BufferVar definition.
const Op & tvm_throw_last_error()
See pesudo code.
const Op & large_uint_imm()
See pesudo code.
const Op & tvm_thread_allreduce()
See pesudo code.
const Op & texture2d_store()
Store to texture 2d memory.
const Op & vectorlow()
Get the low-level half of the vector.
const Op & lookup_param()
See pseudo code Type lookup_param(ffi::String param_name) { return __tvm_param__param_name; }.
const Op & tvm_stack_make_array()
Allocate a Tensor(DLTensor) on stack, return the handle.
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition analyzer.h:40