begin moving call stack computation / cache to artifact cache; fix incorrect broadcast val location

This commit is contained in:
Ryan Fleury
2025-09-24 15:04:45 -07:00
parent 0679b4b04c
commit 4b335103bc
8 changed files with 212 additions and 3 deletions
+9
View File
@@ -66,6 +66,7 @@ ac_artifact_from_key_(Access *access, String8 key, AC_ArtifactParams *params, U6
Stripe *stripe = stripe_from_slot_idx(&cache->stripes, slot_idx);
//- rjf: cache * key -> existing artifact
B32 artifact_is_stale = 0;
B32 got_artifact = 0;
B32 need_request = 0;
AC_Artifact artifact = {0};
@@ -78,6 +79,7 @@ ac_artifact_from_key_(Access *access, String8 key, AC_ArtifactParams *params, U6
if(ins_atomic_u64_eval(&n->completion_count) != 0 && (n->gen == params->gen || !params->wait_for_fresh))
{
got_artifact = 1;
artifact_is_stale = (n->gen == params->gen);
artifact = n->val;
access_touch(access, &n->access_pt, stripe->cv);
}
@@ -150,6 +152,7 @@ ac_artifact_from_key_(Access *access, String8 key, AC_ArtifactParams *params, U6
if(!got_artifact && ins_atomic_u64_eval(&node->completion_count) != 0 && ((node->gen == params->gen) || !params->wait_for_fresh || out_of_time))
{
got_artifact = 1;
artifact_is_stale = (node->gen == params->gen);
artifact = node->val;
access_touch(access, &node->access_pt, stripe->cv);
}
@@ -165,6 +168,12 @@ ac_artifact_from_key_(Access *access, String8 key, AC_ArtifactParams *params, U6
}
}
//- rjf: report staleness
if(params->stale_out)
{
params->stale_out[0] = artifact_is_stale;
}
return artifact;
}
+1
View File
@@ -27,6 +27,7 @@ struct AC_ArtifactParams
U64 slots_count;
U64 gen;
B32 wait_for_fresh;
B32 *stale_out;
};
////////////////////////////////