22 #include <unordered_map>
35 extern volatile std::sig_atomic_t
signal_;
42 uint8_t crossoverRate,
46 std::string kernelName,
47 const std::unordered_map<
size_t, std::vector<const DLTensor*>>& inputs,
48 std::unordered_map<
size_t, std::vector<DLTensor*>>& outputs,
50 std::vector<MappingOptions> startingPoints,
52 void run(
size_t numGenerations);
64 const std::vector<DLTensor*>& outputs,
65 const std::vector<const DLTensor*>& inputs,
67 size_t bestTimeSoFar);
96 size_t bestTime_ = std::numeric_limits<size_t>::max();
105 const std::unordered_map<size_t, std::vector<const DLTensor*>>
kInputs_;
106 std::unordered_map<size_t, std::vector<DLTensor*>>
outputs_;
const size_t kMaxPopulationSize
Definition: genetic_tuning_harness.h:87
const std::vector< MappingOptions > kStartingPoints_
Definition: genetic_tuning_harness.h:108
Definition: execution_engine.h:34
std::unique_ptr< GeneticSearch > tuner_
Definition: genetic_tuning_harness.h:101
const lang::TreeRef kTc_
Definition: genetic_tuning_harness.h:99
Definition: parameters.h:149
bool warmupOrPrune(tc::ExecutionEngine &executionEngine, const std::vector< DLTensor * > &outputs, const std::vector< const DLTensor * > &inputs, size_t handle, size_t bestTimeSoFar)
Helper function to get a kernel into benchmark-able state.
const std::unordered_map< size_t, std::vector< const DLTensor * > > kInputs_
Definition: genetic_tuning_harness.h:105
void run(size_t numGenerations)
MappingOptions bestMappingOption()
Definition: genetic_tuning_harness.h:77
TuningConfiguration configuration
Definition: genetic_tuning_harness.h:92
static constexpr int kReducedBenchmarkIterations
Definition: genetic_tuning_harness.h:84
std::mutex bestTimeMtx_
Definition: genetic_tuning_harness.h:95
std::atomic_size_t currentCompilationJob_
Definition: genetic_tuning_harness.h:102
void setupTuningParameters()
std::deque< std::atomic_bool > readyToEvaluate_
Definition: genetic_tuning_harness.h:103
const uint8_t kMutationRate
Definition: genetic_tuning_harness.h:89
Definition: genetic_tuning_harness.h:38
size_t bestTime_
Definition: genetic_tuning_harness.h:96
TuningConfiguration makeTuningConfiguration(const MappingOptions &options)
Definition: mapping_options.h:336
void runOneGeneration(size_t generation)
volatile std::sig_atomic_t killRequested_
static constexpr int kReducedWarmupIterations
Definition: genetic_tuning_harness.h:83
const std::string kKernelName_
Definition: genetic_tuning_harness.h:100
const MappingOptions kBaseMapping_
Definition: genetic_tuning_harness.h:107
const size_t kNumberElites
Definition: genetic_tuning_harness.h:90
void doCompile(tc::ExecutionEngine &engine)
Helper function to delegate compiling on the cpu to different threads.
Definition: parameters.h:188
void doGpuWork(size_t gpu, tc::ExecutionEngine &engine, Printer &printer)
Helper function to delegate running on the gpu to different threads.
std::unordered_map< size_t, std::vector< DLTensor * > > outputs_
Definition: genetic_tuning_harness.h:106
MappingOptions bestMappingOptions_
Definition: genetic_tuning_harness.h:97
GeneticTunerHarness(size_t n, uint8_t crossoverRate, uint8_t mutationRate, size_t numberElites, lang::TreeRef tc, std::string kernelName, const std::unordered_map< size_t, std::vector< const DLTensor * >> &inputs, std::unordered_map< size_t, std::vector< DLTensor * >> &outputs, MappingOptions baseMapping, std::vector< MappingOptions > startingPoints, const TuningParameterFixer &fixedParams)
std::atomic_size_t numEvaluations_
Definition: genetic_tuning_harness.h:104
const uint8_t kCrossOverRate
Definition: genetic_tuning_harness.h:88
std::shared_ptr< Tree > TreeRef
Definition: tree.h:44
Definition: parameters.h:225
volatile std::sig_atomic_t signal_
static constexpr int kEarlyPruneFactor
Definition: genetic_tuning_harness.h:85
std::vector< size_t > parseGpus()
tc::MappingOptions makeOptions(const CandidateConfiguration &conf)
Make options from conf.