Skip to content

Commit

Permalink
Merge branch 'fixbishopcache' into 'master'
Browse files Browse the repository at this point in the history
Fix Bishop Cache Registration

See merge request StanfordLegion/legion!1576

(cherry picked from commit e91888a)

959541f bishop: another fix for handled cache clean-up when there is a race for...

Co-authored-by: Mike Bauer <[email protected]>
  • Loading branch information
elliottslaughter and rainmakereuab committed Dec 12, 2024
1 parent 0c01a36 commit f3360d2
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions language/src/bishop/codegen.t
Original file line number Diff line number Diff line change
Expand Up @@ -928,11 +928,24 @@ function codegen.map_task(rules, automata, state_id, signature, mapper_state_typ
c.bishop_logger_debug(
"[map_task] initialize instance cache for region %d", [idx - 1])
end
c.legion_map_task_output_chosen_instances_add([map_task_output_var],
[inst_var], 1)
if not[cache_success_var] then
-- Failed to cache which means something else beat us to the cache
-- Free up our allocation and get the new cached values
-- This should happen very rarely and only really at start-up
c.free([inst_var])
[inst_var] = c.bishop_instance_cache_get_cached_instances(
[instance_cache_var], [idx - 1], [region_var], [target.value])
-- This better have succeeded now
std.assert([inst_var] ~= [&c.legion_physical_instance_t](nil), "must hit in cache")
-- Probably don't need to acquire again but since this happens
-- rarely let's just do it to be safe
var success =
c.legion_mapper_runtime_acquire_instances([rt_var], [ctx_var],
[inst_var], 1)
std.assert(success, "instance acquire must succeed")
end
c.legion_map_task_output_chosen_instances_add([map_task_output_var],
[inst_var], 1)
end
end
end
Expand Down

0 comments on commit f3360d2

Please sign in to comment.