Skip to contentSkip to conversation

drm/i915: Don't waste our paultry cache on a context object

PATCH In review Ben Widawsky 3 participants 3 messages Sep 20, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: Don't waste our paultry cache on a context object

Context save and restore is by definition a slow process, however it is also an infrequent process. Don't try to optimize the save restore at the cost of any of our precious cache space. Contexts begin to get quite large on HSW and beyond.

At least for benchmarks people seem to care about, there is almost always only 1 context running, which means I don't expect this to do any harm. For benchmarks with many contexts, there could be performance degradation - but I have a sneaking suspicion the HW will do some fancy magic to speak up context save & restores anyway.

CC Chris Wilson <[email protected]>
CC Eero Tamminen <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem_context.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_gem_context.c +4 -7
index 26c3fcc..593be55 100644
@@ -153,13 +153,10 @@ create_hw_context(struct drm_device *dev,
 		return ERR_PTR(-ENOMEM);
 	}
 
-	if (INTEL_INFO(dev)->gen >= 7) {
-		ret = i915_gem_object_set_cache_level(ctx->obj,
-						      I915_CACHE_L3_LLC);
-		/* Failure shouldn't ever happen this early */
-		if (WARN_ON(ret))
-			goto err_out;
-	}
+	ret = i915_gem_object_set_cache_level(ctx->obj, I915_CACHE_NONE);
+	/* Failure shouldn't ever happen this early */
+	if (WARN_ON(ret))
+		goto err_out;
 
 	/* The ring associated with the context object is handled by the normal
 	 * object tracking code. We give an initial ring value simple to pass an
Signature · 1 line
1.8.4
#1 lore raw
Quoted 4 lines · Ben Widawsky

Context save and restore is by definition a slow process, however it is also an infrequent process. Don't try to optimize the save restore at the cost of any of our precious cache space. Contexts begin to get quite large on HSW and beyond.

Infrequent?

Quoted 5 lines

At least for benchmarks people seem to care about, there is almost always only 1 context running, which means I don't expect this to do any harm. For benchmarks with many contexts, there could be performance degradation - but I have a sneaking suspicion the HW will do some fancy magic to speak up context save & restores anyway.

There are at least 2 contexts in every benchmark QA cares about. It wasn't like making them L3 objects in the first place was motivated by benchmark results...

Anyway the idea was to see if QA still notice a difference... -Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#2 lore raw
Quoted 7 lines · Chris Wilson
Quoted 4 lines · Ben Widawsky

Context save and restore is by definition a slow process, however it is also an infrequent process. Don't try to optimize the save restore at the cost of any of our precious cache space. Contexts begin to get quite large on HSW and beyond.

Infrequent?

Relative to operations which use the cache.

Quoted 11 lines
Quoted 6 lines

At least for benchmarks people seem to care about, there is almost always only 1 context running, which means I don't expect this to do any harm. For benchmarks with many contexts, there could be performance degradation - but I have a sneaking suspicion the HW will do some fancy magic to speak up context save & restores anyway.

There are at least 2 contexts in every benchmark QA cares about. It wasn't like making them L3 objects in the first place was motivated by benchmark results...

No, I've no doubt it was motivated by benchmarks, but I think making it L3 (which I still have a hard time believe would do at all what it's intended to do) would only prove further that not wasting LLC space is a good thing. The theory follows that not wasting L3 space is also a good thing.

Quoted 3 lines

Anyway the idea was to see if QA still notice a difference... -Chris

I'll try to be an optimist for once.

Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center