Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/parsers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -997,6 +997,33 @@ impl StructuredLogParser for ArtifactParser {
}
}

pub struct MemoizerArtifactsParser;
impl StructuredLogParser for MemoizerArtifactsParser {
fn name(&self) -> &'static str {
"memoizer_artifacts"
}
fn get_metadata<'e>(&self, e: &'e Envelope) -> Option<Metadata<'e>> {
e.memoizer_artifacts
.as_ref()
.map(|m| Metadata::MemoizerArtifacts(m))
}
fn parse<'e>(
&self,
lineno: usize,
_metadata: Metadata<'e>,
_rank: Option<u32>,
compile_id: &Option<CompileId>,
_payload: &str,
) -> anyhow::Result<ParserResults> {
payload_reformat_file_output(
"memoizer_artifacts.json",
lineno,
compile_id,
format_json_pretty,
)
}
}

fn render_sym_expr_trie(
expr: u64,
sym_expr_info_index: &SymExprInfoIndex,
Expand Down
8 changes: 8 additions & 0 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,12 @@ pub struct ArtifactMetadata {
pub encoding: String,
}

#[derive(Debug, Deserialize)]
pub struct MemoizerArtifactsMetadata {
pub aggregated: Option<bool>,
pub sub_key: Option<String>,
}

#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct CompilationMetricsMetadata {
// Other information like frame_key are already in envelope
Expand Down Expand Up @@ -699,6 +705,7 @@ pub enum Metadata<'e> {
AOTAutogradBackwardCompilationMetrics(&'e AOTAutogradBackwardCompilationMetricsMetadata),
BwdCompilationMetrics(&'e BwdCompilationMetricsMetadata),
Artifact(&'e ArtifactMetadata),
MemoizerArtifacts(&'e MemoizerArtifactsMetadata),
DumpFile(&'e DumpFileMetadata),
GuardAddedFast(&'e GuardAddedFastMetadata),
SymbolicShapePropagateRealTensor(&'e SymbolicShapePropagateRealTensorMetadata),
Expand Down Expand Up @@ -754,6 +761,7 @@ pub struct Envelope {
pub missing_fake_kernel: Option<FakeKernelMetadata>,
pub mismatched_fake_kernel: Option<FakeKernelMetadata>,
pub artifact: Option<ArtifactMetadata>,
pub memoizer_artifacts: Option<MemoizerArtifactsMetadata>,
pub describe_storage: Option<StorageDesc>,
pub describe_tensor: Option<TensorDesc>,
pub describe_source: Option<SourceDesc>,
Expand Down
Loading