Skip to contentSkip to conversation

libdrm_radeon: Optimize reloc writing to do less looping.

PATCH New Pauli Nieminen 1 participant 2 messages Mar 1, 2010 – Mar 2, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libdrm_radeon: Optimize reloc writing to do less looping.

Bit has table will be first checked from BO if we can quarentee this BO is not in this cs already. When bo is emited the reference to cs is removed with bit operations.

To quarentee that there is no other cs with same id number of CS that can have id is limited to number of bits in unsigned long.

This optimization decreases cs_write_reloc share of torcs profiling from 4.3% to 2.6%.

---
 radeon/radeon_bo_gem.c |    1 +
 radeon/radeon_bo_int.h |    2 +-
 radeon/radeon_cs_gem.c |  111 ++++++++++++++++++++++++++++++++++-------------
 3 files changed, 82 insertions(+), 32 deletions(-)
radeon/radeon_bo_gem.c +1 -0
index bc8058d..1b33bdb 100644
@@ -80,6 +80,7 @@ static struct radeon_bo *bo_open(struct radeon_bo_manager *bom,
     bo->base.domains = domains;
     bo->base.flags = flags;
     bo->base.ptr = NULL;
+    bo->base.referenced_in_cs = 0;
     bo->map_count = 0;
     if (handle) {
         struct drm_gem_open open_arg;
radeon/radeon_bo_int.h +1 -1
index 9589ead..d1df829 100644
@@ -17,7 +17,7 @@ struct radeon_bo_int {
     unsigned                    cref;
     struct radeon_bo_manager    *bom;
     uint32_t                    space_accounted;
-    uint32_t                    referenced_in_cs;
+    unsigned long               referenced_in_cs;
 };
 
 /* bo functions */
radeon/radeon_cs_gem.c +80 -31

165 lines not on this page · raw message

Signature · 10 lines
1.6.3.3


------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
--
#1 lore raw

PATCH 1/1 libdrm_radeon: Optimize reloc writing to do less looping.

Bit has table will be first checked from BO if we can quarentee this BO is not in this cs already. When bo is emited the reference to cs is removed with bit operations.

To quarentee that all cs ids are unique number of ids is limited to 32. If application uses more than 32 cs objects extra cs don't get benefits from bit hash function.

This optimization decreases cs_write_reloc share of torcs profiling from 4.3% to 2.6%.

V2:
* Fix data type for referenced_in_cs to be uint32_t
* Use gcc builtin_ctz to find the first zero bit.

---
 radeon/radeon_bo_gem.c |    1 +
 radeon/radeon_cs_gem.c |  118 +++++++++++++++++++++++++++++++++++-------------
 2 files changed, 88 insertions(+), 31 deletions(-)
radeon/radeon_bo_gem.c +1 -0
index bc8058d..1b33bdb 100644
@@ -80,6 +80,7 @@ static struct radeon_bo *bo_open(struct radeon_bo_manager *bom,
     bo->base.domains = domains;
     bo->base.flags = flags;
     bo->base.ptr = NULL;
+    bo->base.referenced_in_cs = 0;
     bo->map_count = 0;
     if (handle) {
         struct drm_gem_open open_arg;
radeon/radeon_cs_gem.c +87 -31

172 lines not on this page · raw message

Signature · 10 lines
1.6.3.3


------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
--