Halide 22.0.0 Halide compiler and libraries

SearchSpaceOptions.h
Go to the documentation of this file.
1#ifndef SEARCH_SPACE_OPTIONS_H
2#define SEARCH_SPACE_OPTIONS_H
3
4#include <bitset>
5
6#include "ASLog.h"
7
8namespace Halide {
9namespace Internal {
10namespace Autoscheduler {
11
12 struct SearchSpaceOptions {
13 constexpr static size_t option_compute_root = 0;
14 constexpr static size_t option_compute_inline = 1;
15 constexpr static size_t option_compute_at_block = 2;
16 constexpr static size_t option_compute_at_thread = 3;
17
18 std::bitset<4> options;
19
20 explicit SearchSpaceOptions(const std::string &bit_str)
21 : options{bit_str} {
22 aslog(1) << "Search space options:\n";
23 aslog(1) << "Input string: " << bit_str << "\n";
24 aslog(1) << "Compute root: " << compute_root() << "\n";
25 aslog(1) << "Compute inline: " << compute_inline() << "\n";
26 aslog(1) << "Compute at block: " << compute_at_block() << "\n";
27 aslog(1) << "Compute at thread: " << compute_at_thread() << "\n";
28 }
29
30 bool compute_root() const {
31 return options.test(SearchSpaceOptions::option_compute_root) || compute_at_block() || compute_at_thread();
32 }
33
34 bool compute_root_only() const {
35 return options.count() == 1 && compute_root();
36 }
37
38 bool compute_inline() const {
39 return options.test(SearchSpaceOptions::option_compute_inline);
40 }
41
42 bool compute_inline_only() const {
43 return options.count() == 1 && compute_inline();
44 }
45
46 bool compute_at_block() const {
47 return options.test(SearchSpaceOptions::option_compute_at_block);
48 }
49
50 bool compute_at_block_only() const {
51 return options.count() == 1 && compute_at_block();
52 }
53
54 bool compute_at_thread() const {
55 return options.test(SearchSpaceOptions::option_compute_at_thread);
56 }
57
58 bool compute_at_thread_only() const {
59 return options.count() == 1 && compute_at_thread();
60 }
61};
62
63} // namespace Autoscheduler
64} // namespace Internal
65} // namespace Halide
66
67#endif // SEARCH_SPACE_OPTIONS_H
ASLog.h
Halide::Internal::aslog
Definition: ASLog.h:16
Halide
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
Definition: AbstractGenerator.h:19
Halide::LinkageType::Internal
@ Internal
Not visible externally, similar to 'static' linkage in C.
Halide::Internal::Autoscheduler::SearchSpaceOptions
Definition: SearchSpaceOptions.h:12
Halide::Internal::Autoscheduler::SearchSpaceOptions::options
std::bitset< 4 > options
Definition: SearchSpaceOptions.h:18
Halide::Internal::Autoscheduler::SearchSpaceOptions::SearchSpaceOptions
SearchSpaceOptions(const std::string &bit_str)
Definition: SearchSpaceOptions.h:20
Halide::Internal::Autoscheduler::SearchSpaceOptions::option_compute_at_thread
static constexpr size_t option_compute_at_thread
Definition: SearchSpaceOptions.h:16
Halide::Internal::Autoscheduler::SearchSpaceOptions::compute_inline_only
bool compute_inline_only() const
Definition: SearchSpaceOptions.h:42
Halide::Internal::Autoscheduler::SearchSpaceOptions::compute_at_thread_only
bool compute_at_thread_only() const
Definition: SearchSpaceOptions.h:58
Halide::Internal::Autoscheduler::SearchSpaceOptions::option_compute_root
static constexpr size_t option_compute_root
Definition: SearchSpaceOptions.h:13
Halide::Internal::Autoscheduler::SearchSpaceOptions::option_compute_at_block
static constexpr size_t option_compute_at_block
Definition: SearchSpaceOptions.h:15
Halide::Internal::Autoscheduler::SearchSpaceOptions::compute_at_block
bool compute_at_block() const
Definition: SearchSpaceOptions.h:46
Halide::Internal::Autoscheduler::SearchSpaceOptions::compute_at_block_only
bool compute_at_block_only() const
Definition: SearchSpaceOptions.h:50
Halide::Internal::Autoscheduler::SearchSpaceOptions::compute_root_only
bool compute_root_only() const
Definition: SearchSpaceOptions.h:34
Halide::Internal::Autoscheduler::SearchSpaceOptions::compute_root
bool compute_root() const
Definition: SearchSpaceOptions.h:30
Halide::Internal::Autoscheduler::SearchSpaceOptions::option_compute_inline
static constexpr size_t option_compute_inline
Definition: SearchSpaceOptions.h:14
Halide::Internal::Autoscheduler::SearchSpaceOptions::compute_inline
bool compute_inline() const
Definition: SearchSpaceOptions.h:38
Halide::Internal::Autoscheduler::SearchSpaceOptions::compute_at_thread
bool compute_at_thread() const
Definition: SearchSpaceOptions.h:54