Lines Matching refs:cache
27 /* Index buffer min/max cache. We need to calculate the min/max for arbitrary
29 * be quite expensive, we cache. Conceptually, we just use a hash table mapping
34 * PANFROST_MINMAX_SIZE constant (so this is a tradeoff between cache hit/miss
35 * ratio and cache search speed). Note that keys are adjacent so we get cache
36 * line alignment benefits. Insertion is O(1) and in-order until the cache
44 panfrost_minmax_cache_get(struct panfrost_minmax_cache *cache, unsigned start, unsigned count,
50 if (!cache)
53 for (unsigned i = 0; i < cache->size; ++i) {
54 if (cache->keys[i] == ht_key) {
55 uint64_t hit = cache->values[i];
68 panfrost_minmax_cache_add(struct panfrost_minmax_cache *cache, unsigned start, unsigned count,
75 if (!cache)
78 if (cache->size == PANFROST_MINMAX_SIZE) {
79 index = cache->index++;
80 cache->index = cache->index % PANFROST_MINMAX_SIZE;
82 index = cache->size++;
85 cache->keys[index] = ht_key;
86 cache->values[index] = value;
95 panfrost_minmax_cache_invalidate(struct panfrost_minmax_cache *cache, struct pipe_transfer *transfer)
97 /* Ensure there is a cache to invalidate and a write */
98 if (!cache)
106 for (unsigned i = 0; i < cache->size; ++i) {
107 uint64_t key = cache->keys[i];
115 cache->keys[valid_count] = key;
116 cache->values[valid_count] = cache->values[i];
121 cache->size = valid_count;
122 cache->index = 0;