tvm
thread_bind.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_META_SCHEDULE_SCHEDULE_CUDA_THREAD_BIND_H_
20 #define TVM_META_SCHEDULE_SCHEDULE_CUDA_THREAD_BIND_H_
21 
23 
24 #include <algorithm>
25 #include <limits>
26 #include <utility>
27 
28 namespace tvm {
29 namespace meta_schedule {
30 
38 std::function<tir::ExprRV(int64_t)> MakeFactorSampler(tir::Schedule sch,
39  Array<Integer> thread_extents);
40 
51  int64_t max_threadblocks, int64_t max_threads_per_block,
52  std::function<tir::ExprRV(int64_t)> get_factor = nullptr);
53 
63  int64_t max_threadblocks, int64_t max_threads_per_block,
64  std::function<tir::ExprRV(int64_t max_extent)> get_factor = nullptr);
65 
66 } // namespace meta_schedule
67 } // namespace tvm
68 
69 #endif // TVM_META_SCHEDULE_SCHEDULE_CUDA_THREAD_BIND_H_
Reference to PrimExprNode.
Definition: expr.h:115
Array, container representing a contiguous sequence of ObjectRefs.
Definition: array.h:289
Managed reference to BlockRVNode.
Definition: schedule.h:62
Managed reference to LoopRVNode.
Definition: schedule.h:83
Managed reference to ScheduleNode.
Definition: schedule.h:877
std::function< tir::ExprRV(int64_t)> MakeFactorSampler(tir::Schedule sch, Array< Integer > thread_extents)
Given candidates of thread_extents, make a sampler that use sch->SampleCategorical to return a random...
void BindBlockThreadIdx(tir::Schedule sch, tir::BlockRV block, int64_t max_threadblocks, int64_t max_threads_per_block, std::function< tir::ExprRV(int64_t max_extent)> get_factor=nullptr)
Bind the given block if it is not bound to blockIdx or threadIdx.
Array< tir::LoopRV > BindSpatialLoop(tir::Schedule sch, tir::LoopRV loop, int64_t max_threadblocks, int64_t max_threads_per_block, std::function< tir::ExprRV(int64_t)> get_factor=nullptr)
Bind blockIdx.x and threadIdx.x to the given loop.
PrimExpr ExprRV
An expr random variable.
Definition: schedule.h:93
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36