Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
probe_result.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <array>
4#include <cstdint>
5#include <optional>
6#include <span>
7#include <string>
8#include <string_view>
9#include <vector>
10
45
47inline constexpr std::string_view kSchema = "pulp.gpu-probe-result.v1";
49inline constexpr std::uint32_t kVersion = 1;
51inline constexpr std::uint32_t kMaxDimension = 4096;
53inline constexpr std::uint64_t kMaxWorkItems = 1'048'576;
55inline constexpr std::uint32_t kMaxNumericSamples = 4096;
57inline constexpr std::uint32_t kMaxArtifacts = 16;
59inline constexpr std::uint64_t kMaxArtifactBytes = 16 * 1024 * 1024;
61inline constexpr std::uint64_t kMaxTotalArtifactBytes = 64 * 1024 * 1024;
62
63inline constexpr std::array kRecipeIds{
64 std::string_view{"renderer3d.hardcoded-cube.v1"},
65 std::string_view{"gpu-compute.magnitude.v1"},
66 std::string_view{"gpu-audio.stft.v1"},
67 std::string_view{"threejs.multi-pass.v1"},
68};
69
77
85
90 std::optional<std::string> backend;
91 std::optional<std::string> name;
92 std::optional<std::string> vendor;
93 std::optional<std::string> architecture;
94 std::optional<std::string> device;
95};
96
98struct Dimensions {
99 std::uint32_t width = 0;
100 std::uint32_t height = 0;
101 std::uint64_t work_items = 0;
102};
103
105struct Tolerance {
106 double absolute = 0.0;
107 double relative = 0.0;
108};
109
117
120 std::string_view id;
121 std::string_view source_identity;
123 std::uint64_t seed = 0;
124 std::string_view clock;
125 std::string_view input_format;
126 std::string_view output_format;
127 std::string_view encoding;
130 std::span<const std::string_view> semantic_passes;
132 std::string_view positive_control;
133 std::string_view negative_mutation;
134};
135
138 std::uint32_t sequence = 0;
139 std::string name;
141 bool work_completed = false;
142 std::optional<double> expected;
143 std::optional<double> observed;
144 std::optional<double> absolute_error;
145 std::string code;
146};
147
149struct Artifact {
150 std::string name;
152 std::string mime;
153 std::uint64_t bytes = 0;
154 std::string sha256;
155};
156
159 std::string schema{kSchema};
160 std::uint32_t version = kVersion;
161 std::string gpu_evidence_id;
162 std::string recipe_id;
163 std::string source_digest;
164 std::string signature_digest;
166 std::uint64_t seed = 0;
167 std::string clock;
168 std::string input_format;
169 std::string output_format;
170 std::string encoding;
174 std::uint32_t numeric_sample_count = 0;
175 std::optional<std::string> mutation;
177 std::vector<PassResult> passes;
178 std::vector<Artifact> artifacts;
179 std::vector<std::string> recommendations;
180};
181
183std::string_view to_string(Verdict value);
184std::string_view to_string(AdapterPolicy value);
185std::string_view to_string(AdapterClass value);
186std::string_view to_string(IdentityStatus value);
187std::string_view to_string(ArtifactKind value);
188
190const RecipeDefinition* find_recipe(std::string_view id);
192bool is_recipe_callable(std::string_view id);
194std::span<const RecipeDefinition> recipes();
196std::string_view recipe_catalog_json();
204std::optional<std::string> recipe_discovery_json(
205 std::optional<std::string_view> recipe_id = std::nullopt,
206 std::optional<std::string_view> symptom = std::nullopt);
207
212bool validate(const ProbeResult& result, std::string* error = nullptr);
214std::string to_json(const ProbeResult& result, bool pretty = false);
216std::optional<ProbeResult> from_json(std::string_view json, std::string* error = nullptr);
218std::string render_human(const ProbeResult& result);
220int exit_code(const ProbeResult& result);
221
222} // namespace pulp::tooling::gpu_probe
Bounded recipe definitions, owned evidence, and native GPU probe runs.
Definition dpr_measurement.hpp:10
std::optional< ProbeResult > from_json(std::string_view json, std::string *error=nullptr)
Parse the exact closed v1 shape and validate it before returning a value.
constexpr std::string_view kSchema
Closed JSON schema identity for ProbeResult.
Definition probe_result.hpp:47
bool validate(const ProbeResult &result, std::string *error=nullptr)
Validate bounds, recipe identity, ordered pass aggregation, and artifacts.
constexpr std::uint32_t kMaxNumericSamples
Maximum number of numeric samples retained in one result.
Definition probe_result.hpp:55
std::string render_human(const ProbeResult &result)
Render an owning human-readable report; machine consumers use to_json().
AdapterClass
Adapter class proven by native identity, never inferred from backend alone.
Definition probe_result.hpp:80
@ hardware
Definition probe_result.hpp:80
@ unknown
Definition probe_result.hpp:80
@ software
Definition probe_result.hpp:80
@ null_adapter
Definition probe_result.hpp:80
bool is_recipe_callable(std::string_view id)
Return whether this build can execute the named registered recipe.
std::span< const RecipeDefinition > recipes()
Return a borrowed span over the immutable process-lifetime recipe registry.
std::string_view to_string(Verdict value)
Return the canonical lowercase schema spelling from static storage.
constexpr std::uint64_t kMaxWorkItems
Maximum unitless work-item count for a registered recipe.
Definition probe_result.hpp:53
AdapterPolicy
Minimum adapter class accepted by a recipe definition.
Definition probe_result.hpp:78
@ hardware_preferred
Definition probe_result.hpp:78
@ hardware_required
Definition probe_result.hpp:78
@ any_supported
Definition probe_result.hpp:78
Verdict
Four-state recipe outcome that never folds missing evidence into success.
Definition probe_result.hpp:71
@ pass
Work completed and every semantic oracle passed.
Definition probe_result.hpp:72
@ unavailable
Required execution capability or evidence was unavailable.
Definition probe_result.hpp:74
@ unverified
Evidence exists but is insufficient for a measured claim.
Definition probe_result.hpp:75
@ fail
Work completed and at least one measured oracle failed.
Definition probe_result.hpp:73
constexpr std::uint64_t kMaxTotalArtifactBytes
Maximum combined declared artifact size in bytes for one result.
Definition probe_result.hpp:61
IdentityStatus
Authenticity state for the optional native adapter identity fields.
Definition probe_result.hpp:82
@ unavailable
Definition probe_result.hpp:82
@ authentic
Definition probe_result.hpp:82
constexpr std::uint32_t kMaxDimension
Maximum width or height in pixels for a registered recipe.
Definition probe_result.hpp:51
const RecipeDefinition * find_recipe(std::string_view id)
Find a borrowed process-lifetime definition, or return null for an unknown ID.
constexpr std::uint32_t kVersion
Schema version serialized in ProbeResult::version.
Definition probe_result.hpp:49
int exit_code(const ProbeResult &result)
Map pass to 0, fail to 1, and unavailable or unverified to 2.
constexpr std::array kRecipeIds
Definition probe_result.hpp:63
constexpr std::uint64_t kMaxArtifactBytes
Maximum declared size in bytes for one artifact.
Definition probe_result.hpp:59
std::optional< std::string > recipe_discovery_json(std::optional< std::string_view > recipe_id=std::nullopt, std::optional< std::string_view > symptom=std::nullopt)
Project the canonical catalog as a discovery envelope for an optional filter.
std::string to_json(const DprMeasurementDisposition &result, bool pretty=false)
Serialize the cell receipt consumed by the strict Python adapter.
constexpr std::uint32_t kMaxArtifacts
Maximum number of artifacts retained in one result.
Definition probe_result.hpp:57
ArtifactKind
Machine-readable content kind for a declared artifact.
Definition probe_result.hpp:84
@ trace
Definition probe_result.hpp:84
@ json
Definition probe_result.hpp:84
@ image
Definition probe_result.hpp:84
@ numeric_samples
Definition probe_result.hpp:84
std::string_view recipe_catalog_json()
Return the configure-time embedded canonical catalog bytes.
Native adapter identity. Missing optionals represent absent evidence.
Definition probe_result.hpp:87
std::optional< std::string > vendor
Definition probe_result.hpp:92
std::optional< std::string > device
Definition probe_result.hpp:94
std::optional< std::string > backend
Definition probe_result.hpp:90
AdapterClass classification
Definition probe_result.hpp:89
std::optional< std::string > name
Definition probe_result.hpp:91
std::optional< std::string > architecture
Definition probe_result.hpp:93
IdentityStatus status
Definition probe_result.hpp:88
Bounded artifact descriptor; payload bytes are owned by ArtifactPayload.
Definition probe_result.hpp:149
std::string mime
Definition probe_result.hpp:152
std::uint64_t bytes
Definition probe_result.hpp:153
std::string sha256
Definition probe_result.hpp:154
ArtifactKind kind
Definition probe_result.hpp:151
std::string name
Definition probe_result.hpp:150
Recipe dimensions in pixels and unitless dispatched work items.
Definition probe_result.hpp:98
std::uint32_t height
Definition probe_result.hpp:100
std::uint64_t work_items
Definition probe_result.hpp:101
std::uint32_t width
Definition probe_result.hpp:99
One ordered semantic oracle result.
Definition probe_result.hpp:137
std::string code
Definition probe_result.hpp:145
std::string name
Definition probe_result.hpp:139
bool work_completed
Definition probe_result.hpp:141
std::optional< double > expected
Definition probe_result.hpp:142
std::optional< double > absolute_error
Definition probe_result.hpp:144
Verdict verdict
Definition probe_result.hpp:140
std::uint32_t sequence
Definition probe_result.hpp:138
std::optional< double > observed
Definition probe_result.hpp:143
Closed v1 metadata and verdict for one recipe execution.
Definition probe_result.hpp:158
std::string signature_digest
Definition probe_result.hpp:164
std::uint32_t version
Definition probe_result.hpp:160
AdapterPolicy adapter_policy
Definition probe_result.hpp:172
std::vector< Artifact > artifacts
Definition probe_result.hpp:178
std::string source_digest
Definition probe_result.hpp:163
Tolerance tolerance
Definition probe_result.hpp:171
std::string input_format
Definition probe_result.hpp:168
std::string recipe_id
Definition probe_result.hpp:162
std::uint32_t numeric_sample_count
Definition probe_result.hpp:174
std::vector< PassResult > passes
Definition probe_result.hpp:177
Dimensions dimensions
Definition probe_result.hpp:165
std::string schema
Definition probe_result.hpp:159
std::uint64_t seed
Definition probe_result.hpp:166
std::string gpu_evidence_id
Definition probe_result.hpp:161
AdapterIdentity adapter
Definition probe_result.hpp:173
Verdict verdict
Definition probe_result.hpp:176
std::string encoding
Definition probe_result.hpp:170
std::vector< std::string > recommendations
Definition probe_result.hpp:179
std::optional< std::string > mutation
Definition probe_result.hpp:175
std::string clock
Definition probe_result.hpp:167
std::string output_format
Definition probe_result.hpp:169
Per-recipe caps for owned samples and artifact bytes.
Definition probe_result.hpp:111
std::uint32_t max_numeric_samples
Definition probe_result.hpp:112
std::uint64_t max_artifact_bytes
Definition probe_result.hpp:114
std::uint32_t max_artifacts
Definition probe_result.hpp:113
std::uint64_t max_total_artifact_bytes
Definition probe_result.hpp:115
Borrowed process-lifetime definition of one deterministic recipe.
Definition probe_result.hpp:119
std::string_view positive_control
Definition probe_result.hpp:132
std::string_view id
Definition probe_result.hpp:120
RecipeBounds bounds
Definition probe_result.hpp:131
Dimensions dimensions
Definition probe_result.hpp:122
std::uint64_t seed
Definition probe_result.hpp:123
Tolerance tolerance
Definition probe_result.hpp:128
AdapterPolicy adapter_policy
Definition probe_result.hpp:129
std::string_view output_format
Definition probe_result.hpp:126
std::span< const std::string_view > semantic_passes
Definition probe_result.hpp:130
std::string_view encoding
Definition probe_result.hpp:127
std::string_view input_format
Definition probe_result.hpp:125
std::string_view clock
Definition probe_result.hpp:124
std::string_view source_identity
Definition probe_result.hpp:121
std::string_view negative_mutation
Definition probe_result.hpp:133
Absolute and relative error limits in the recipe's numeric sample units.
Definition probe_result.hpp:105
double absolute
Definition probe_result.hpp:106
double relative
Definition probe_result.hpp:107