docc 0.8.3 (0d44999b)
C++ API Reference
Loading...
Searching...
No Matches
instrumentation_info.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4#include <optional>
5#include <string>
6#include <string_view>
7#include <unordered_map>
8#include <vector>
9
10#include <nlohmann/json.hpp>
11
13#include "sdfg/exceptions.h"
15
16
17namespace sdfg {
18namespace codegen {
19
20enum InstrumentationEventType { CPU = 0, CUDA = 1, NONE = 2 };
21
31
34// Legacy name for OMP parallelism
35inline TargetType TargetType_CPU_PARALLEL{"CPU_PARALLEL"};
36
38private:
39 // General properties
40 size_t element_id_;
41 std::string element_desc_;
42 TargetType target_type_;
43 InstrumentationEventType event_type_;
44 analysis::LoopInfo loop_info_;
45 std::unordered_map<std::string, std::string> metrics_;
46 std::optional<ElementId> logical_region_id_;
47 std::optional<ElementId> source_loop_id_;
48 std::optional<nlohmann::json> expected_performance_;
49 std::optional<double> vector_distance_;
50 std::vector<InstrumentationMemberInfo> members_;
51 bool sampling_ = false;
52
53public:
55 size_t element_id,
56 std::string_view element_desc,
59 const analysis::LoopInfo& loop_info = {},
60 const std::unordered_map<std::string, std::string>& metrics = {}
61 );
62
63 size_t element_id() const;
64
65 const std::string& element_desc() const;
66
67 const TargetType& target_type() const;
68
70
72
73 const std::unordered_map<std::string, std::string>& metrics() const;
74
75 bool sampling() const;
76
78
79 std::optional<ElementId> logical_region_id() const;
80
81 void set_logical_region_id(std::optional<ElementId> logical_region_id);
82
83 std::optional<ElementId> source_loop_id() const;
84
85 void set_source_loop_id(std::optional<ElementId> source_loop_id);
86
87 const std::optional<nlohmann::json>& expected_performance() const;
88
89 void set_expected_performance(std::optional<nlohmann::json> expected_performance);
90
91 std::optional<double> vector_distance() const;
92
93 void set_vector_distance(std::optional<double> vector_distance);
94
95 const std::vector<InstrumentationMemberInfo>& members() const;
96
97 void set_members(std::vector<InstrumentationMemberInfo> members);
98};
99
100} // namespace codegen
101} // namespace sdfg
Definition exceptions.h:28
std::optional< double > vector_distance() const
void set_sampling(bool sampling)
void set_expected_performance(std::optional< nlohmann::json > expected_performance)
const std::string & element_desc() const
void set_source_loop_id(std::optional< ElementId > source_loop_id)
void set_vector_distance(std::optional< double > vector_distance)
InstrumentationInfo(size_t element_id, std::string_view element_desc, const TargetType &target_type, InstrumentationEventType event_type, const analysis::LoopInfo &loop_info={}, const std::unordered_map< std::string, std::string > &metrics={})
std::optional< ElementId > source_loop_id() const
void set_logical_region_id(std::optional< ElementId > logical_region_id)
const analysis::LoopInfo & loop_info() const
const std::unordered_map< std::string, std::string > & metrics() const
const std::vector< InstrumentationMemberInfo > & members() const
const std::optional< nlohmann::json > & expected_performance() const
std::optional< ElementId > logical_region_id() const
InstrumentationEventType event_type() const
void set_members(std::vector< InstrumentationMemberInfo > members)
const TargetType & target_type() const
static const std::string value()
Definition structured_loop.h:103
Definition argument_registry.h:10
TargetType TargetType_SEQUENTIAL
Definition instrumentation_info.h:33
TargetType TargetType_CPU_PARALLEL
Definition instrumentation_info.h:35
InstrumentationEventType
Definition instrumentation_info.h:20
@ CPU
Definition instrumentation_info.h:20
@ NONE
Definition instrumentation_info.h:20
@ CUDA
Definition instrumentation_info.h:20
StringEnum TargetType
Definition instrumentation_info.h:32
Definition analysis.h:7
size_t ElementId
Definition element.h:215
is_perfectly_nested: is the entire loop hierarchy with loop at the top perfectly nested on every leve...
Definition loop_analysis.h:38
Definition instrumentation_info.h:22
size_t start_line
Definition instrumentation_info.h:26
size_t end_line
Definition instrumentation_info.h:28
std::string function
Definition instrumentation_info.h:25
size_t start_column
Definition instrumentation_info.h:27
ElementId element_id
Definition instrumentation_info.h:23
size_t end_column
Definition instrumentation_info.h:29
std::string filename
Definition instrumentation_info.h:24