Alyssa Rosenzweig
9497d8025f
pan/bi: Test pack_sync
...
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
e0a5e5eb15
pan/bi: Test pack_tuple_bits
...
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
7898decbd3
pan/bi: Test pack_upper
...
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
e383af639a
pan/bi: Test pack_literal
...
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
80157fac68
pan/bi: Add packing unit test group
...
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
4379f7bad2
pan/bi: Pack multiple tuples per clause
...
Use all of the new helpers to pick formats and use them.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
9362a13982
pan/bi: Calculate pos for constant packing
...
We do not yet support multiple (format 12 quadword) constants per clause
but this is a step in the right direction.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
51f13185c8
pan/bi: Add pack_format helper
...
Packs a single quadword of a clause with a particular format and
parameters.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
0e9a05c004
pan/bi: Add subword 4 or 7 pack
...
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
1adb996acc
pan/bi: Add subword 5/6 pack
...
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
038bb8eabe
pan/bi: Add tuple/embedded constant pack
...
Used for the first 4 subwords.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
2258acf5ca
pan/bi: Add bi_pack_sync
...
The type/sync byte, also known as the tag.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
5f523c60fc
pan/bi: Add bi_pack_tuple_bits
...
More general than the top 3 bit special case. There's some serious
complication around 78-bit shifting but I digress.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
0812a5204b
pan/bi: Add bi_pack_upper
...
Top 3-bits, found e.g. in the tag.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
62696e5ff5
pan/bi: Add bi_pack_literal
...
Identifies formats.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
576a94b7b8
pan/bi: Move bi_packed_tuple to compiler.h
...
To be used for pack prototype.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
9496689f57
pan/bi: Add clause encodings as a table
...
We would rather not type out all of the packs by hand (that's error
prone), so declaratively specify the encodings as a table corresponding
to the bit patterns.
This is all formats, except for format 12 which just encodes constants.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
34a80e910e
pan/bi: Pack multiple tuples in-memory
...
There's still some silly clause-level packing required, but this way the
register slots are at least assigned correctly.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
fb8b80843c
pan/bi: Amend misleading comment
...
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
4b480444e1
pan/bi: Clarify tuple comment
...
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
47348db7e8
pan/bi: Use enum bifrost_message_type
...
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
ce2ef3dad6
pan/bi: Use canonical terminology for tuple
...
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
f74dda9377
pan/bi: Move bi_constants to bifrost.h
...
Although it's software-defined, this stems from architectural traits and
is useful in both the disasm and the compiler.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
ac2b8a56cd
pan/bi: Test read predicates
...
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
d0e88a2c2e
pan/bi: Test bi_must_message
...
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
e3436e784e
pan/bi: Test bi_must_last
...
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
7bd6ca934d
pan/bi: Unit test bi_can_{fma, add}
...
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
c05092d9a3
pan/bi: Add various read predicates
...
Correpsonding to source masks in the XML.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
ea402eae03
pan/bi: Emit branch and table bits in opcode table
...
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
674ec5dc3f
pan/bi: Label table instructions
...
Table instructions are a subset of those scheduled to the ADD unit. They
typically involve lookup tables. Table (TBL) instructions have
additional restrictions on their sources which the scheduler must
respect.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
56e35a4022
pan/bi: Add bi_must_message predicate
...
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
ab4234bdf0
pan/bi: Add bi_must_last predicate
...
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
eb217914f7
pan/bi: Pipe last flag into opcode tables
...
Only ADD unit for now.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
df4960499e
pan/bi: Annotate ISA.xml with 'last' parameter
...
If this instruction must be the last in the clause.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
31a7e49613
pan/bi: Add bi_can_{fma, add} predicates
...
Stubs due to some edge cases, for the scheduler.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
7434f31e09
pan/bi: Factor nir_function_impl out of the context
...
Unnecessary and complicates unit testing.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
114a0f9798
pan/bi: Stub out scheduler unit test
...
Someone who understands meson and gtest could do something much nicer,
but for now let's just stuff some assertions into debug builds of the
standalone compiler and call it a day...
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
81692b6d2c
pan/bi: Add "word equivalence" relation for index
...
Takes offset *but not swizzle* into account, so the scheduler can
predict whether indices will end up mapped to the same scalar register.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
ab6f05eabd
pan/bi: Move init_builder to common code
...
Needs to take a cursor to be applicable outside NIR->BIR of course.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
60c0df2c3b
pan/bi: Print multiple destinations if needed
...
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
a7cc458dc4
pan/bi: Add CUBEFACE pseudoinstruction
...
Abstracts over *CUBEFACE1/+CUBEFACE2, takes the sources of the former
and outputs two destinations.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig
44726101d1
pan/bi: Don't fill garbage
...
If an index is an SSA form and we haven't even written to it yet, there
is absolutely no value in filling it, it'd just be uninitialized garbage
that won't get used. Saves some fills in STK.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:43 +00:00
Alyssa Rosenzweig
ee7aaa27b8
pan/bi: Implement spilling at the clause-level
...
We use essentially the same logic, but we need to treat entire clauses
as large instructions, and spill on clause boundaries instead of
instruction boundaries. So factor out the code a bit, using the new
iterators, removing bi_unwrap_singleton.
A few specific fixes are needed to adapt. One is simple: rewriting
destinations needs to preserve clamps and such. The other is a much more
subtle bug. Consider the clause
{
ADD 0, ...
---unrelated code---
MUL 1, 0, ...
}
Suppose we spill 0. The naive spill code would generate an SSA temporary to
spill to and another SSA temporary to fill from, generating:
{
LOAD.tl 10
}
{
ADD 11, ...
---unrelated code---
MUL 1, 10, ...
}
{
STORE.tl 11
}
But this is wrong; the MUL now reads stale (and for SSA, likely
undefined/uninitialized) data. The simplest fix, employed here, is to
spill/fill within a clause simultaneously, which means the temporary
can't be SSA, generating correct code:
{
LOAD.tl r0
}
{
ADD r0, ...
---unrelated code---
MUL 1, r0, ...
}
{
STORE.tl r0
}
This is suboptimal, since the LOAD is still likely reading garbage that
is unused. But it is still correct, and the next commit will avoid
generating the load in this case.
To make the bug even more subtle, if ADD/MUL are within 2-3 instructions
of each other, the scheduler will optimize the load to a
temporary/passthrough, so the bug isn't noticed. It only happens if they
are 3+ instructions apart yet still in the same clause (<=16
instructions).
Special thanks to macc24 for reporting this bug and to Jason Ekstrand
for allowing me to rubberduck.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:43 +00:00
Alyssa Rosenzweig
c578ca7393
pan/bi: Add interference per clause
...
With new helpers.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:43 +00:00
Alyssa Rosenzweig
108e10f32a
pan/bi: Permit multiple destinations in RA
...
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:43 +00:00
Alyssa Rosenzweig
07b13647cb
pan/bi: Don't open code bi_foreach_dest
...
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:43 +00:00
Alyssa Rosenzweig
083a658ee8
pan/bi: Add destination iterator macro
...
Convenience.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:43 +00:00
Alyssa Rosenzweig
eca516ebdb
pan/bi: Add bi_foreach_instr_in_clause iterators
...
These are convenient for post-sched passes, in particular register
allocation. They work by noting the underlying linked list of
instructions in the block must be preserved by scheduling. It isn't
necessary iterate the clause structure directly, it can simply be used
to bound a iteration within the block by recalling clauses are strictly
contained in a single block.
<alyssa> I don't think I'm enough of a C ninja to write fancy iterator macros yet.
<zmike> sometimes those can get pretty mind-bendy
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:43 +00:00
Alyssa Rosenzweig
62239f68b7
pan/bi: Add bi_foreach_instr_in_tuple helper
...
Written in a funny way but easy to convince yourself of correctness by
considering cases.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:43 +00:00
Alyssa Rosenzweig
2f785ad9ac
pan/bi: Add bi_foreach_clause_in_block_rev
...
Trivial absense.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723 >
2021-01-29 16:55:43 +00:00