How would you implement a thread-safe caching mechanism for pre-computed model inference results? Implement a bounded LRU cache with TTL-free entries and single-flight computation: concurrent requests for the same missing key must share one model computation. The function receives requests grouped into execution rounds, where requests within a round run concurrently and rounds execute sequentially. Return results in input order and the number of model computations per key.
requests is a list of {key, result, round} objects, and capacity is a positive integer. Implement run_inference_requests(requests, capacity) returning {results: list, compute_counts: dict}.
def run_inference_requests(requests, capacity):