Commit Graph

141315 Commits

Author SHA1 Message Date
Mike Blumenkrantz 48add48209 zink: make batch_usage_unset take a batch state param
no functional changes

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11399>
2021-06-16 02:45:45 +00:00
Mike Blumenkrantz 50cfe0dbd1 zink: remove atomic from batch usage setting
this shouldn't be necessary since usage can only be set from the context thread
and only needs to be accessed atomically for the cmpxchg when unsetting

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11399>
2021-06-16 02:45:45 +00:00
Mike Blumenkrantz 559f534e11 zink: move batch usage functions to static inlines
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11399>
2021-06-16 02:45:45 +00:00
Mike Blumenkrantz b3f4e76c07 zink: optimize zink_tc_fence struct packing
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11400>
2021-06-16 01:28:12 +00:00
Mike Blumenkrantz 1c1b0f7c91 zink: reorder has_barriers flag in batch state struct
better struct packing

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11400>
2021-06-16 01:28:12 +00:00
Mike Blumenkrantz e1ba1b5b25 zink: split batch state work_count into separate vars
this has better struct packing

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11400>
2021-06-16 01:28:12 +00:00
Mike Blumenkrantz b85a6b9162 zink: remove zink_batch_state::descs_used
this is no longer used or needed

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11400>
2021-06-16 01:28:12 +00:00
Dave Airlie f93aec2d04 crocus: fixed some missing WM dirtys.
This fixes misrendering in ET: legacy.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11390>
2021-06-16 00:41:00 +00:00
Mike Blumenkrantz 4e3768914d zink: add ZINK_DESCRIPTORS env var to explicitly set a mode
currently this supports 3 modes, with the default being a hybrid between
caching and lazy

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
2021-06-15 20:15:58 -04:00
Mike Blumenkrantz 75c7619253 zink: unblock last_set cached descriptor reuse when safe to do so
if no changes at all have occurred to a given set since the last use,
and if the program hasn't changed, then there is no possiblility for
the set to have been invalidated, and so it can immediately be reused

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
2021-06-15 20:15:58 -04:00
Mike Blumenkrantz 7348a083ed zink: skip hash updates for descriptor types which aren't used
this is pointless and hurts drawoverhead perf

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
2021-06-15 20:15:58 -04:00
Mike Blumenkrantz d8c11ebe29 zink: add oob asserts for descriptor set ref setting
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
2021-06-15 20:15:58 -04:00
Mike Blumenkrantz cc2d54641c zink: enable templated descriptor updates in cache mode
this leverages the template infrastructure from the lazy manager for the
cached mode, alternatively generating a pseudo-template for updates
if real templates aren't available in order to retain 1.0 compatibility

Acked-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
2021-06-15 20:15:58 -04:00
Mike Blumenkrantz 4487825f0b zink: move samplerview descset refs to base objects
this further extends the lifetimes for sets

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
2021-06-15 20:15:58 -04:00
Mike Blumenkrantz ff692d042b zink: add funcs for descriptor_surface refs
this abstracts more code for the cache backend

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
2021-06-15 20:15:57 -04:00
Mike Blumenkrantz 2d99f10286 zink: move shader image descriptor set refs to underlying type
this was kinda useless since it meant that the set was invalidated any
time the shader image was unbound

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
2021-06-15 20:14:36 -04:00
Mike Blumenkrantz df5c97eea8 zink: update null sampler/image descriptor surface with is_buffer during hashing
this is the only time it might need to be used, so it can be updated naturally here

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
2021-06-15 20:14:36 -04:00
Mike Blumenkrantz b2f4b35d5d zink: add is_buffer flag to union zink_descriptor_surface
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
2021-06-15 20:14:36 -04:00
Mike Blumenkrantz fd9118a739 zink: run lazy batch descriptor functions in cache mode
Acked-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
2021-06-15 20:14:36 -04:00
Mike Blumenkrantz e00268894f zink: unify cached descriptor update code
this is all pretty much standardized now, so it can be combined into something
simpler

Acked-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
2021-06-15 20:14:35 -04:00
Mike Blumenkrantz 93021aa6c8 zink: move ubo range assert to update_descriptor_state()
Acked-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
2021-06-15 20:04:53 -04:00
Mike Blumenkrantz e5b0d21628 zink: remove sorting for dynamic ubo offset updating
if the offsets are assigned in the right order, they don't need to be
ordered later

Acked-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
2021-06-15 20:04:53 -04:00
Mike Blumenkrantz 0b54edad9b zink: modernize cached image descriptor updating
use the auto-updated descriptor info

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
2021-06-15 20:04:53 -04:00
Mike Blumenkrantz b9c0e99960 zink: modernize cached ssbo descriptor updating
use the already-updated bufferinfo structs

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
2021-06-15 20:04:53 -04:00
Mike Blumenkrantz 24b98a2925 zink: modernize cached ubo descriptor updating
use the already-updated bufferinfo structs

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
2021-06-15 20:04:53 -04:00
Mike Blumenkrantz c0e9896139 zink: modernize cached push ubo descriptor updating
use the already-updated bufferinfo structs

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
2021-06-15 20:04:53 -04:00
Mike Blumenkrantz d2f04604d6 zink: match lazy descriptor set layout in cache mode
now cached descriptors also use a push set for ubo0, also reusing the
ZINK_DESCRIPTOR_TYPES for this set for enum purposes

Acked-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
2021-06-15 20:04:52 -04:00
Mike Blumenkrantz ab7ea7acfa zink: split lazy sets based on descriptor type
this is now closer to the cached descriptor set layout, but with
the push set as the zero-indexed set (passed as ZINK_DESCRIPTOR_TYPES
for enum purposes)

Acked-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
2021-06-15 20:04:36 -04:00
Mike Blumenkrantz c4dd9cdabb zink: add a function for creating descriptor layouts for push sets
push sets contain a single ubo at index 0 per shader stage in the set

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
2021-06-15 20:03:58 -04:00
Ian Romanick daa2ccff7a v3d: ci: Add KHR-GLES31.core.shader_image_load_store.basic-glsl-earlyFragTests to flakes
Closes: #4934
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11386>
2021-06-15 21:37:17 +00:00
Yiwei Zhang ac27493824 venus: add debug info for experimental features during init
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11387>
2021-06-15 21:25:28 +00:00
Jason Ekstrand 7bf0c762c3 anv: Agressively no-op Flush/InvalidateMappedMemoryRanges
This has two steps.  First, for each range we look at the memory object
and see if it actually needs flushing before we start throwing CLFLUSH
instructions.  Second, we look at the whole list of types on device
initialization and decide whether or not we need CLFLUSH at all.  The
first part should speed up atom chips a bit since we're currently
CLFLUSHing everything even when we don't need to.  The second isn't
needed on most of today's parts because we base it on !has_llc but it is
needed for discrete parts.  It's also over-all cleaner.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Felix DeGrood <felix.j.degrood@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11364>
2021-06-15 21:00:37 +00:00
Emma Anholt 591a3c738d freedreno: Be more strict about QUERY_AVAILABLE to simplify the code.
ARB_oq doesn't just say "polling in a loop will make it complete
eventually", it says "querying will make it complete in finite time."

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11368>
2021-06-15 20:42:26 +00:00
Emma Anholt bfb83d1fe8 freedreno: Drop a bit of indirection around the batch cache flush path.
Checking the flag to call separate functions which then call the same
helper with the flag is a bit silly.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11368>
2021-06-15 20:42:26 +00:00
Emma Anholt 32bed95e0b freedreno: Make a bunch of the batch cache take ctx as the arg.
As we move the batch cache from screen to context, it cleans up the diff a
ton to separate this mechanical change out, and makes the API generally
more consistent (since you usually have to pass the ctx anyway).

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11368>
2021-06-15 20:42:26 +00:00
Emma Anholt a960b0e477 freedreno: Drop batch-cache orphan tracking.
Let's let valgrind/asan handle leak detection.  This means you can use the
flag even on non-DEBUG builds.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11368>
2021-06-15 20:42:26 +00:00
Alyssa Rosenzweig 0cec71d7ce pan/bi: Fuse abs into FCMP/FMIN/FMAX.v2f16
Needs to be aware of an encoding restriction here.

No shader-db changes.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11327>
2021-06-15 20:27:22 +00:00
Alyssa Rosenzweig 097c9092af pan/bi: Schedule FCMP.v2f16 with abs modifier
So many encoding restrictions, because Bifrost.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11327>
2021-06-15 20:27:22 +00:00
Alyssa Rosenzweig 0c4de24f15 pan/bi: Fuse fclamp_pos and fsat_signed
Mostly interesting now that we fuse clamps.

total instructions in shared programs: 149562 -> 148927 (-0.42%)
instructions in affected programs: 37195 -> 36560 (-1.71%)
helped: 233
HURT: 0
helped stats (abs) min: 1 max: 10 x̄: 2.73 x̃: 2
helped stats (rel) min: 0.22% max: 17.39% x̄: 2.19% x̃: 1.72%
95% mean confidence interval for instructions value: -2.97 -2.48
95% mean confidence interval for instructions %-change: -2.44% -1.94%
Instructions are helped.

total tuples in shared programs: 130487 -> 130122 (-0.28%)
tuples in affected programs: 25693 -> 25328 (-1.42%)
helped: 179
HURT: 12
helped stats (abs) min: 1 max: 10 x̄: 2.11 x̃: 2
helped stats (rel) min: 0.26% max: 25.00% x̄: 2.52% x̃: 1.70%
HURT stats (abs)   min: 1 max: 1 x̄: 1.00 x̃: 1
HURT stats (rel)   min: 0.61% max: 0.68% x̄: 0.65% x̃: 0.66%
95% mean confidence interval for tuples value: -2.15 -1.68
95% mean confidence interval for tuples %-change: -2.74% -1.91%
Tuples are helped.

total clauses in shared programs: 27827 -> 27761 (-0.24%)
clauses in affected programs: 1407 -> 1341 (-4.69%)
helped: 56
HURT: 0
helped stats (abs) min: 1 max: 4 x̄: 1.18 x̃: 1
helped stats (rel) min: 1.79% max: 14.29% x̄: 6.11% x̃: 5.26%
95% mean confidence interval for clauses value: -1.32 -1.03
95% mean confidence interval for clauses %-change: -7.00% -5.23%
Clauses are helped.

total quadwords in shared programs: 118563 -> 118248 (-0.27%)
quadwords in affected programs: 19859 -> 19544 (-1.59%)
helped: 144
HURT: 16
helped stats (abs) min: 1 max: 10 x̄: 2.30 x̃: 2
helped stats (rel) min: 0.29% max: 16.00% x̄: 2.65% x̃: 2.13%
HURT stats (abs)   min: 1 max: 1 x̄: 1.00 x̃: 1
HURT stats (rel)   min: 0.47% max: 2.00% x̄: 0.80% x̃: 0.76%
95% mean confidence interval for quadwords value: -2.27 -1.66
95% mean confidence interval for quadwords %-change: -2.67% -1.93%
Quadwords are helped.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11327>
2021-06-15 20:27:22 +00:00
Alyssa Rosenzweig 295e65bb50 pan/bi: Add back custom algebraic opts
Right now just do a trivial one to test the infrastructure. In the next
commit we'll use this for a more interesting optimization that's a bit
painful in BIR but trivial with nir_search.

total instructions in shared programs: 149566 -> 149562 (<.01%)
instructions in affected programs: 502 -> 498 (-0.80%)
helped: 3
HURT: 0
helped stats (abs) min: 1 max: 2 x̄: 1.33 x̃: 1
helped stats (rel) min: 0.38% max: 1.30% x̄: 0.97% x̃: 1.21%

total tuples in shared programs: 130957 -> 130487 (-0.36%)
tuples in affected programs: 54752 -> 54282 (-0.86%)
helped: 303
HURT: 2
helped stats (abs) min: 1 max: 29 x̄: 1.56 x̃: 1
helped stats (rel) min: 0.13% max: 7.14% x̄: 1.08% x̃: 0.92%
HURT stats (abs)   min: 1 max: 2 x̄: 1.50 x̃: 1
HURT stats (rel)   min: 1.89% max: 2.99% x̄: 2.44% x̃: 2.44%
95% mean confidence interval for tuples value: -1.79 -1.30
95% mean confidence interval for tuples %-change: -1.17% -0.95%
Tuples are helped.

total clauses in shared programs: 27877 -> 27827 (-0.18%)
clauses in affected programs: 1556 -> 1506 (-3.21%)
helped: 45
HURT: 0
helped stats (abs) min: 1 max: 2 x̄: 1.11 x̃: 1
helped stats (rel) min: 1.43% max: 9.52% x̄: 3.88% x̃: 3.57%
95% mean confidence interval for clauses value: -1.21 -1.02
95% mean confidence interval for clauses %-change: -4.38% -3.39%
Clauses are helped.

total quadwords in shared programs: 119058 -> 118563 (-0.42%)
quadwords in affected programs: 33777 -> 33282 (-1.47%)
helped: 250
HURT: 2
helped stats (abs) min: 1 max: 29 x̄: 1.99 x̃: 1
helped stats (rel) min: 0.23% max: 11.11% x̄: 1.67% x̃: 1.40%
HURT stats (abs)   min: 1 max: 1 x̄: 1.00 x̃: 1
HURT stats (rel)   min: 1.64% max: 2.00% x̄: 1.82% x̃: 1.82%
95% mean confidence interval for quadwords value: -2.27 -1.66
95% mean confidence interval for quadwords %-change: -1.80% -1.49%
Quadwords are helped.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11327>
2021-06-15 20:27:22 +00:00
Alyssa Rosenzweig 41070fedca pan/bi: Propagate fabs/neg/sat
Initial support for modifier propagation. Bifrost makes this
unreasonably hard.

total instructions in shared programs: 151604 -> 150761 (-0.56%)
instructions in affected programs: 48773 -> 47930 (-1.73%)
helped: 212
HURT: 0
helped stats (abs) min: 1 max: 28 x̄: 3.98 x̃: 1
helped stats (rel) min: 0.29% max: 12.70% x̄: 1.75% x̃: 1.26%
95% mean confidence interval for instructions value: -4.71 -3.25
95% mean confidence interval for instructions %-change: -1.97% -1.53%
Instructions are helped.

total tuples in shared programs: 131876 -> 131560 (-0.24%)
tuples in affected programs: 25393 -> 25077 (-1.24%)
helped: 104
HURT: 3
helped stats (abs) min: 1 max: 28 x̄: 3.08 x̃: 2
helped stats (rel) min: 0.34% max: 8.57% x̄: 1.55% x̃: 1.04%
HURT stats (abs)   min: 1 max: 2 x̄: 1.33 x̃: 1
HURT stats (rel)   min: 0.51% max: 2.86% x̄: 1.30% x̃: 0.53%
95% mean confidence interval for tuples value: -3.63 -2.28
95% mean confidence interval for tuples %-change: -1.73% -1.21%
Tuples are helped.

total clauses in shared programs: 28122 -> 28032 (-0.32%)
clauses in affected programs: 2720 -> 2630 (-3.31%)
helped: 58
HURT: 1
helped stats (abs) min: 1 max: 6 x̄: 1.57 x̃: 1
helped stats (rel) min: 0.88% max: 14.29% x̄: 4.06% x̃: 3.67%
HURT stats (abs)   min: 1 max: 1 x̄: 1.00 x̃: 1
HURT stats (rel)   min: 7.69% max: 7.69% x̄: 7.69% x̃: 7.69%
95% mean confidence interval for clauses value: -1.85 -1.20
95% mean confidence interval for clauses %-change: -4.60% -3.13%
Clauses are helped.

total quadwords in shared programs: 119778 -> 119509 (-0.22%)
quadwords in affected programs: 20698 -> 20429 (-1.30%)
helped: 95
HURT: 1
helped stats (abs) min: 1 max: 28 x̄: 2.85 x̃: 2
helped stats (rel) min: 0.38% max: 7.14% x̄: 1.50% x̃: 1.13%
HURT stats (abs)   min: 2 max: 2 x̄: 2.00 x̃: 2
HURT stats (rel)   min: 3.23% max: 3.23% x̄: 3.23% x̃: 3.23%
95% mean confidence interval for quadwords value: -3.49 -2.11
95% mean confidence interval for quadwords %-change: -1.71% -1.20%
Quadwords are helped.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11327>
2021-06-15 20:27:22 +00:00
Alyssa Rosenzweig e41d8ed007 pan/bi: Report tuples, not nops, in shader-db
More useful in practice, I find.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11327>
2021-06-15 20:27:22 +00:00
Alyssa Rosenzweig ecd9a3fed5 pan/bi: Handle fsat_signed and fclamp_pos
Translates to Mali-specific clamps.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11327>
2021-06-15 20:27:22 +00:00
Alyssa Rosenzweig 16bf1ae935 pan/bi: Track instruction size in opcode table
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11327>
2021-06-15 20:27:22 +00:00
Alyssa Rosenzweig 91a2804d8f pan/bi: Move typesize to common code
Useful for the opcode table.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11327>
2021-06-15 20:27:22 +00:00
Alyssa Rosenzweig 7db6d8d748 pan/bi: Move bi_word_node to common code
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11327>
2021-06-15 20:27:22 +00:00
Alyssa Rosenzweig 7ad9e1e5a5 pan/bi: Include modifier info in opcode table
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11327>
2021-06-15 20:27:22 +00:00
Ian Romanick 70c9726e06 util: Consider CPU affinity when detecting number of CPUs
A similar path can be used on at least FreeBSD using cpuset_getaffinity.
This is how Ninja determines the number of available CPUs on that
platform.  See the GetProcessorCount function in util.cc:

https://github.com/ninja-build/ninja/blob/master/src/util.cc

v2: Fix counting the number of available CPUs.  The CPU_COUNT API does
not work the way I thought it did. :face_palm: Noticed by Marek.

Reviewed-by: Adam Jackson <ajax@redhat.com> [v1]
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> [v1]
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11228>
2021-06-15 20:01:53 +00:00
Ian Romanick 59ca535576 util: Use maximum number of CPUs for determining cache topology
This prevents problems when some CPUs are offline.  In a four CPU
system, if CPUs 1 and 2 are offline, the cache topology code would
only examine CPUs 0 and 1... giving incorrect information.

The types are changed to int16_t so that the offset of num_L3_caches
does not change.  This triggered a STATIC_ASSERT failure:

STATIC_ASSERT(offsetof(struct util_cpu_caps_t, num_L3_caches) == 5 * sizeof(uint32_t));

I'm assuming there's some assembly code or something that depends on
this offset, and I don't feel like messing with it.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11228>
2021-06-15 20:01:53 +00:00
Ian Romanick c12b52b856 util: Set util_cpu_caps.num_cpu_mask_bits based on total CPUs in the system
In the current code, this prevents a very unlikely corner case.  More
importantly, it should prevent the next commit from breaking the
universe.

Imagine a system with 64 CPUs configured, but first 32 CPUs are offline.
_SC_NPROCESSORS_CONF will return 32.  All of the surrounding code will
interpret this as meaning CPUs 0 through 31, but all of those CPUs are
offline.  Nothing good can happen then.

The problem cases require systems with more than 32 CPUs because
util_cpu_caps.num_cpu_mask_bits is always rounded up to a multiple of
32.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11228>
2021-06-15 20:01:53 +00:00