Skip to contentSkip to conversation

i965: Use up to 80 WM threads on GT2.

PATCH In review Eric Anholt 5 participants 7 messages Mar 28, 2011 – Mar 29, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i965: Use up to 80 WM threads on GT2.

---

Here's an idea for an SNB performance improvement from the specs. It says that on GT2 you should be able to use 80 threads if "WIZ Hashing Disable in GT_MODE register enabled". On my system (supposedly GT2), that bit (bit 6 of 0x20d0) is unset. In testing, with intel_reg_write 0x20d0 0x00400040 (it only successfully took once, I suspect due to FORCEWAKE, which also means that I can't necessarily trust that the bit was unset originally), I got only hangs from 3D.

 src/mesa/drivers/dri/i965/brw_context.c    |    6 +++++-
 src/mesa/drivers/dri/i965/gen6_wm_state.c  |    2 +-
 src/mesa/drivers/dri/intel/intel_chipset.h |   10 ++++++----
 3 files changed, 12 insertions(+), 6 deletions(-)
src/mesa/drivers/dri/i965/brw_context.c +5 -1
index 9483ec6..3555e44 100644
@@ -184,7 +184,11 @@ GLboolean brwCreateContext( int api,
    if (intel->gen >= 6) {
       brw->urb.size = 1024;
       brw->vs_max_threads = 60;
-      brw->wm_max_threads = 80;
+      if (IS_GT2(intel->intelScreen->deviceID)) {
+	 brw->wm_max_threads = 80;
+      } else {
+	 brw->wm_max_threads = 40;
+      }
    } else if (intel->gen == 5) {
       brw->urb.size = 1024;
       brw->vs_max_threads = 72;
src/mesa/drivers/dri/i965/gen6_wm_state.c +1 -1
index 78901ec..b91e1c1 100644
@@ -144,7 +144,7 @@ upload_wm_state(struct brw_context *brw)
    dw4 |= (brw->wm.prog_data->first_curbe_grf <<
 	   GEN6_WM_DISPATCH_START_GRF_SHIFT_0);
 
-   dw5 |= (40 - 1) << GEN6_WM_MAX_THREADS_SHIFT;
+   dw5 |= (brw->wm.max_threads - 1) << GEN6_WM_MAX_THREADS_SHIFT;
 
    /* CACHE_NEW_WM_PROG */
    if (brw->wm.prog_data->dispatch_width == 8)
src/mesa/drivers/dri/intel/intel_chipset.h +6 -4
index 4ff9140..f7dcf47 100644
@@ -125,12 +125,14 @@
 /* Compat macro for intel_decode.c */
 #define IS_IRONLAKE(devid)	IS_GEN5(devid)
 
-#define IS_GEN6(devid)		(devid == PCI_CHIP_SANDYBRIDGE_GT1 || \
-				 devid == PCI_CHIP_SANDYBRIDGE_GT2 || \
+#define IS_GT2(devid)		(devid == PCI_CHIP_SANDYBRIDGE_GT2 || \
 				 devid == PCI_CHIP_SANDYBRIDGE_GT2_PLUS	|| \
-				 devid == PCI_CHIP_SANDYBRIDGE_M_GT1 || \
 				 devid == PCI_CHIP_SANDYBRIDGE_M_GT2 || \
-				 devid == PCI_CHIP_SANDYBRIDGE_M_GT2_PLUS || \
+				 devid == PCI_CHIP_SANDYBRIDGE_M_GT2_PLUS)
+
+#define IS_GEN6(devid)		(IS_GT2(devid) || \
+				 devid == PCI_CHIP_SANDYBRIDGE_GT1 || \
+				 devid == PCI_CHIP_SANDYBRIDGE_M_GT1 || \
 				 devid == PCI_CHIP_SANDYBRIDGE_S)
 
 #define IS_GT1(devid)		(devid == PCI_CHIP_SANDYBRIDGE_GT1 || \
Signature · 1 line
1.7.4.1
#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 7 lines · Eric Anholt

Here's an idea for an SNB performance improvement from the specs. It says that on GT2 you should be able to use 80 threads if "WIZ Hashing Disable in GT_MODE register enabled". On my system (supposedly GT2), that bit (bit 6 of 0x20d0) is unset. In testing, with intel_reg_write 0x20d0 0x00400040 (it only successfully took once, I suspect due to FORCEWAKE, which also means that I can't necessarily trust that the bit was unset originally), I got only hangs from 3D.

So, we're currently using too many threads in some cases? Could this be related to bug #35730? In that case the failure seems to be limited to SugarBay. I believe that's GT1, but I can never get the code names for these chips straight.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk2RCisACgkQX1gOwKyEAw8nRgCgnC1HMyfVwx5MLiaVF4mVzprQ oD4An2DMFJdXfYKOyvehR7x6qAQnYix6
=4m/t
-----END PGP SIGNATURE-----

#2 lore raw
Quoted 12 lines · Ian Romanick

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 7 lines · Eric Anholt

Here's an idea for an SNB performance improvement from the specs. It says that on GT2 you should be able to use 80 threads if "WIZ Hashing Disable in GT_MODE register enabled". On my system (supposedly GT2), that bit (bit 6 of 0x20d0) is unset. In testing, with intel_reg_write 0x20d0 0x00400040 (it only successfully took once, I suspect due to FORCEWAKE, which also means that I can't necessarily trust that the bit was unset originally), I got only hangs from 3D.

Quoted 4 lines

So, we're currently using too many threads in some cases? Could this be related to bug #35730? In that case the failure seems to be limited to SugarBay. I believe that's GT1, but I can never get the code names for these chips straight.

The system environment description section in bug #35730 already mention it's rev09 GT1

Thanks
--Shuang

Quoted 12 lines

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk2RCisACgkQX1gOwKyEAw8nRgCgnC1HMyfVwx5MLiaVF4mVzprQ oD4An2DMFJdXfYKOyvehR7x6qAQnYix6
=4m/t
-----END PGP SIGNATURE-----
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw
In reply to Ian Romanick
Quoted 13 lines · Ian Romanick

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 7 lines · Eric Anholt

Here's an idea for an SNB performance improvement from the specs. It says that on GT2 you should be able to use 80 threads if "WIZ Hashing Disable in GT_MODE register enabled". On my system (supposedly GT2), that bit (bit 6 of 0x20d0) is unset. In testing, with intel_reg_write 0x20d0 0x00400040 (it only successfully took once, I suspect due to FORCEWAKE, which also means that I can't necessarily trust that the bit was unset originally), I got only hangs from 3D.

Quoted 4 lines

So, we're currently using too many threads in some cases? Could this be related to bug #35730? In that case the failure seems to be limited to SugarBay. I believe that's GT1, but I can never get the code names for these chips straight.

Nope, note how instead of using that original wm_max_threads value, 40 is hardcoded in the place that should have been using it.

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw
Quoted 8 lines · Eric Anholt
Quoted 4 lines · Ian Romanick

So, we're currently using too many threads in some cases? Could this be related to bug #35730? In that case the failure seems to be limited to SugarBay. I believe that's GT1, but I can never get the code names for these chips straight.

Nope, note how instead of using that original wm_max_threads value, 40 is hardcoded in the place that should have been using it.

But for DevSmallGT (which *is* GT1 right?) max VS threads is only 24. -Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#5 lore raw
In reply to Eric Anholt
Quoted 4 lines · Eric Anholt

---
I suspect due to
FORCEWAKE, which also means that I can't necessarily trust that the bit was unset originally), I got only hangs from 3D.

If you want to get some more possibly garbage data, you can set forcewake from userspace, and hope the kernel doesn't unset it :).

intel_reg_write 0xa18c 1

# check for ack
intel_reg_read 0x130090

I've never tried it, but it might work at least for reading that first
bit. I'm currenty working around this with <[email protected]> and a hack in the kernel to do a get() and never do a put.

Ben

#6 lore raw
Quoted 9 lines · Ben Widawsky
Quoted 4 lines · Eric Anholt

---
I suspect due to
FORCEWAKE, which also means that I can't necessarily trust that the bit was unset originally), I got only hangs from 3D.

If you want to get some more possibly garbage data, you can set forcewake from userspace, and hope the kernel doesn't unset it :).

Quoted 7 lines

intel_reg_write 0xa18c 1

# check for ack
intel_reg_read 0x130090

I've never tried it, but it might work at least for reading that first
bit. I'm currenty working around this with <[email protected]> and a hack in the kernel to do a get() and never do a put.

I'm tempted by the idea of having a kernel interface for unpriveleged interfaces for reading these regs, which would allow for non-root gpu_top in addition to doing the forcewake. It'll suck to maintain a list of unpriveleged-OK regs, though.

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx