amd/addrlib: Use enum instead of sparse chars to identify dimensions
The enum values can be used directly as indices into arrays, simplifying
the code.
This significantly cuts down the number of CPU cycles spent inside
* Addr::V2::Gfx9Lib::HwlComputeDccAddrFromCoord:
+------------------------------------------------------------------------+
|+ +++ + x x xx|
| |_____AM____| |_A__||
+------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 5 14.89 15.44 15.14 15.156 0.
24704251
+ 5 8.26 9.96 9.37 9.282 0.
6262747
Difference at 95.0% confidence
-5.874 +/- 0.694294
-38.7569% +/- 4.58098%
(Student's t, pooled s = 0.476051)
* Addr::V2::CoordEq::solve:
+------------------------------------------------------------------------+
| + x |
| + + + + x x x x|
||__MA____| |______A__M____||
+------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 5 8.11 9.59 9.21 9.02 0.
55605755
+ 5 4.28 5.05 4.48 4.564 0.
32867917
Difference at 95.0% confidence
-4.456 +/- 0.666135
-49.4013% +/- 7.38509%
(Student's t, pooled s = 0.456744)
(The measured numbers are the percentages of samples inside the
respective function and its calles for
`perf record --call-graph=fp kitty -e false`, measured on a Lenovo
Thinkpad E595 (Picasso))
v2:
* Add missed 'coords[dim] |= bit << ord;' (Pierre-Eric Pelloux-Prayer)
* Put 'ADDR_ASSERT(dim < DIM_S);' where the code previous had
'ADDR_ASSERT_ALWAYS()' for the s/m dimensions.
* Use 1u for BitsValid (since it's 32-bit unsigned values).
* Use parens in 'BitsValid[dim] & (1u << ord)' for clarity.
Acked-by: Marek Olšák <marek.olsak@amd.com> # v1
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4523>