provide u64 broadcasting mechanism in base layer wavefront lane context, allows more flexible data sharing mechanism which does not depend on statics; reshape dasm building codepath for clicking into artifact cache

This commit is contained in:
Ryan Fleury
2025-09-22 16:21:30 -07:00
parent 8a1e6ab2e6
commit 4b1939bd6d
12 changed files with 444 additions and 146 deletions
+18 -2
View File
@@ -221,10 +221,26 @@ ac_tick(void)
lane_sync();
// rjf: compute val
void *val = reqs[idx].create(reqs[idx].key);
B32 retry = 0;
void *val = reqs[idx].create(reqs[idx].key, &retry);
// rjf: retry? -> resubmit request
if(retry && lane_idx() == 0)
{
MutexScope(ac_shared->req_mutex)
{
AC_RequestNode *n = push_array(ac_shared->req_arena, AC_RequestNode, 1);
SLLQueuePush(ac_shared->first_req, ac_shared->last_req, n);
ac_shared->req_count += 1;
MemoryCopyStruct(&n->v, &reqs[idx]);
n->v.key = str8_copy(ac_shared->req_arena, n->v.key);
}
ins_atomic_u32_eval_assign(&async_loop_again, 1);
}
// rjf: create function -> cache
AC_Cache *cache = 0;
if(!retry)
{
U64 cache_hash = u64_hash_from_str8(str8_struct(&reqs[idx].create));
U64 cache_slot_idx = cache_hash%ac_shared->cache_slots_count;
@@ -243,7 +259,7 @@ ac_tick(void)
}
// rjf: write value into cache
if(lane_idx() == 0)
if(!retry && lane_idx() == 0)
{
U64 hash = u64_hash_from_str8(reqs[idx].key);
U64 slot_idx = hash%cache->slots_count;
+1 -1
View File
@@ -7,7 +7,7 @@
////////////////////////////////
//~ rjf: Artifact Computation Function Types
typedef void *AC_CreateFunctionType(String8 key);
typedef void *AC_CreateFunctionType(String8 key, B32 *retry_out);
typedef void AC_DestroyFunctionType(void *artifact);
////////////////////////////////