tvm
feature.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 
31 #ifndef TVM_AUTO_SCHEDULER_FEATURE_H_
32 #define TVM_AUTO_SCHEDULER_FEATURE_H_
33 
36 
37 #include <string>
38 #include <vector>
39 
40 namespace tvm {
41 namespace auto_scheduler {
42 
50 void GetPerStoreFeature(const Stmt& stmt, int cache_line_size, int max_n_bufs,
51  std::vector<float>* ret);
52 
53 /*
54  * \brief Get the names of elements in the feature vector. Use this for debug and inspection.
55  * \param max_n_bufs The maximum number of extracted buffers for one statement
56  * \param ret The returned names.
57  */
58 void GetPerStoreFeatureName(int max_n_bufs, std::vector<std::string>* ret);
59 
69 void GetPerStoreFeaturesFromStates(const Array<State>& states, const SearchTask& task,
70  int skip_first_n_feature_extraction, int max_n_bufs,
71  std::vector<std::vector<float> >* features);
72 
82 void GetPerStoreFeaturesFromStates(const Array<State>& states, const std::vector<SearchTask>& tasks,
83  int skip_first_n_feature_extraction, int max_n_bufs,
84  std::vector<std::vector<float> >* features);
85 
96 void GetPerStoreFeaturesFromFile(const std::string& filename, int max_lines, int max_n_bufs,
97  std::vector<std::vector<float> >* features,
98  std::vector<float>* normalized_throughputs,
99  std::vector<int>* task_ids);
100 
112 void GetPerStoreFeaturesFromMeasurePairs(const Array<MeasureInput>& inputs,
113  const Array<MeasureResult>& results,
114  int skip_first_n_feature_extraction, int max_n_bufs,
115  std::vector<std::vector<float> >* features,
116  std::vector<float>* normalized_throughputs,
117  std::vector<int>* task_ids);
118 
119 } // namespace auto_scheduler
120 } // namespace tvm
121 
122 #endif // TVM_AUTO_SCHEDULER_FEATURE_H_
Performance counters for profiling via the PAPI library.
Definition: analyzer.h:36
void GetPerStoreFeature(const Stmt &stmt, int cache_line_size, int max_n_bufs, std::vector< float > *ret)
Get per-store feature from a TIR Stmt.
void GetPerStoreFeaturesFromFile(const std::string &filename, int max_lines, int max_n_bufs, std::vector< std::vector< float > > *features, std::vector< float > *normalized_throughputs, std::vector< int > *task_ids)
Get per-store features from a log file.
Distributed measurement infrastructure to measure the runtime costs of tensor programs. These functions are responsible for building the tvm module, uploading it to remote devices, recording the running time costs, and checking the correctness of the output.
void GetPerStoreFeaturesFromStates(const Array< State > &states, const SearchTask &task, int skip_first_n_feature_extraction, int max_n_bufs, std::vector< std::vector< float > > *features)
Get per-store feature from states of the same task.
The auto-scheduler&#39;s computational graph and related program analyses.
void GetPerStoreFeaturesFromMeasurePairs(const Array< MeasureInput > &inputs, const Array< MeasureResult > &results, int skip_first_n_feature_extraction, int max_n_bufs, std::vector< std::vector< float > > *features, std::vector< float > *normalized_throughputs, std::vector< int > *task_ids)
Get per-store features from measurement input/result pairs.
PrimExpr ret(PrimExpr value, Span span=Span())
Return the value.
void GetPerStoreFeatureName(int max_n_bufs, std::vector< std::string > *ret)