tvm
Loading...
Searching...
No Matches
memory.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
24#ifndef TVM_TIRX_OP_MEMORY_H_
25#define TVM_TIRX_OP_MEMORY_H_
26
27#include <tvm/ir/op.h>
28#include <tvm/ir/prim/expr.h>
29
30namespace tvm {
31namespace tirx {
32
41
49
57
68
70 return reinterpret(Type(std::move(t)), Expr(std::move(value)), std::move(loc))
71 .as_or_throw<PrimExpr>();
72}
73
75inline Expr ConstHandle(int64_t value, Location loc = UnknownLoc()) {
76 return reinterpret(PtrType::VoidPtrType(), IntImm(PrimType::UInt(64), value, loc), loc);
77}
78
86
94
105
115
120
129
138
146
151
161
172
182
183} // namespace tirx
184} // namespace tvm
185
186#endif // TVM_TIRX_OP_MEMORY_H_
Managed reference to ExprNode.
Definition base_expr.h:359
Managed reference class to IntImmNode.
Definition expr.h:152
Non-nullable source-location metadata.
Definition location.h:91
Reference-counted handle to a canonical named operator.
Definition op.h:147
Typed reference/view over any Expr whose ExprNode::ty is PrimType.
Definition base_expr.h:447
Definition base_expr.h:161
static TVM_TIRX_DLL PrimType UInt(int bits, int lanes=1)
Construct an unsigned integer type with fixed lanes.
static TVM_TIRX_DLL PtrType VoidPtrType(ffi::String storage_scope="")
Construct an opaque pointer with void element type.
Managed reference to TypeNode.
Definition base_expr.h:80
Reference to the shared immutable unknown location.
Definition location.h:105
Canonical primitive operators and their registration.
TIR expressions.
TVM_TIRX_DLL const Op & tensor_data_ptr_op()
Project the physical pointer associated with a TensorVar definition.
TVM_TIRX_DLL const Op & isnullptr_op()
Test whether a pointer is null.
TVM_TIRX_DLL const Op & atomic_add_op()
atomic add instruction, corresponding e.g. to atomicAdd in CUDA.
TVM_TIRX_DLL const Op & ptr_byte_offset_op()
Cast a handle to a typed pointer after adding a byte offset.
TVM_TIRX_DLL const Op & static_handle_op()
Create a function local static handle that iniitalizes to nullptr.
TVM_TIRX_DLL const Op & reinterpret_op()
Reinterpret the bits of a value as an explicit primitive or pointer type.
TVM_TIRX_DLL const Op & assume_aligned_op()
Assume a tensor's base address has the given constant byte alignment.
TVM_TIRX_DLL const Op & handle_add_byte_offset_op()
Add a byte offset to an opaque pointer.
TVM_TIRX_DLL const Op & decl_tensor_op()
Declare a tensor view with exactly one TensorType in ty_args.
TVM_TIRX_DLL const Op & address_of_op()
Return the address of a tensor element or addressable variable.
TVM_TIRX_DLL const Op & masked_store_op()
Masked tensor store.
TVM_TIRX_DLL Expr reinterpret(Type target_ty, Expr value, Location loc=UnknownLoc())
perform reinterpret cast value to type.
TVM_TIRX_DLL const Op & undef_op()
Returns an initialized but arbitrary value.
Expr ConstHandle(int64_t value, Location loc=UnknownLoc())
Construct an opaque pointer from its integer payload.
Definition memory.h:75
TVM_TIRX_DLL const Op & alloc_tensor_op()
Allocate a tensor with exactly one TensorType in ty_args.
TVM_TIRX_DLL const Op & prefetch_op()
Prefetch a memory address.
TVM_TIRX_DLL const Op & masked_load_op()
Masked tensor load.
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition attr.h:23
#define TVM_TIRX_DLL
Definition base.h:83