Skip to content
Snippets Groups Projects

vkd3d-shader/hlsl: Interstage signature optimization, part 2.

Merged Francisco Casas requested to merge fcasas/vkd3d:eastward3 into master
2 unresolved threads

Merge request reports

Merge request pipeline #33662 skipped

Merge request pipeline skipped for 2a8c1b28

Approval is optional

Merged by Henri VerbeetHenri Verbeet 5 months ago (Oct 22, 2024 6:54pm UTC)

Merge details

  • Changes merged into with 2a8c1b28.
  • Deleted the source branch.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Francisco Casas added 25 commits

    added 25 commits

    • 5cd05c0c...c89e547e - 18 commits from branch wine:master
    • 32516a60 - vkd3d-shader/hlsl: Add mode field to register_allocator allocations.
    • 16c65237 - vkd3d-shader/hlsl: Use a register_allocator to allocate semantic registers.
    • fdd773d3 - vkd3d-shader/hlsl: Account for interpolation mode when allocating semantics.
    • 84a5e7b9 - vkd3d-shader/hlsl: Also pass field storage modifiers to output signature elems.
    • bc739894 - vkd3d-shader/hlsl: Optimize interstage signatures.
    • 5b33362d - vkd3d-shader/hlsl: Prioritize smaller writemasks when allocating signature elems.
    • 8c1b8325 - vkd3d-shader/hlsl: Sort signature elements by register id.

    Compare with previous version

  • Author Developer

    :arrow_up: This needed another rebase.

  • It needs yet another I'm afraid.

  • Francisco Casas added 39 commits

    added 39 commits

    • 8c1b8325...03ad04c8 - 32 commits from branch wine:master
    • ec7b6b44 - vkd3d-shader/hlsl: Add mode field to register_allocator allocations.
    • 481a2996 - vkd3d-shader/hlsl: Use a register_allocator to allocate semantic registers.
    • d9c226ee - vkd3d-shader/hlsl: Account for interpolation mode when allocating semantics.
    • e84a81e0 - vkd3d-shader/hlsl: Also pass field storage modifiers to output signature elems.
    • 573f32ff - vkd3d-shader/hlsl: Optimize interstage signatures.
    • 6706d0fc - vkd3d-shader/hlsl: Prioritize smaller writemasks when allocating signature elems.
    • 071bea5f - vkd3d-shader/hlsl: Sort signature elements by register id.

    Compare with previous version

  • Francisco Casas added 3 commits

    added 3 commits

    • 751c99cd - vkd3d-shader/hlsl: Optimize interstage signatures.
    • ea97a217 - vkd3d-shader/hlsl: Prioritize smaller writemasks when allocating signature elems.
    • 6af23673 - vkd3d-shader/hlsl: Sort signature elements by register id.

    Compare with previous version

  • Francisco Casas added 3 commits

    added 3 commits

    • 7790d9b4 - vkd3d-shader/hlsl: Optimize interstage signatures.
    • db8190a7 - vkd3d-shader/hlsl: Prioritize smaller writemasks when allocating signature elems.
    • 5a69e43f - vkd3d-shader/hlsl: Sort signature elements by register id.

    Compare with previous version

  • Author Developer

    For now I just enabled packing on the pixel shader output, vertex shader input, and geometry shader both input and output signatures, since this is the behavior I have observed.

    Patch constants for hull shaders don't seem to do this packing, and I don't know of compute shaders using signatures.

    By the way, it is worth reminding that we are not properly packing arrays yet.

    • If VS outputs are packed then surely tess inputs/outputs are packed too?

    • Author Developer

      That makes sense, you are right.

      Sorry, I had to study hull and domain shaders a bit to be able to write examples to test whether this optimization was applied or not, seems that the only exceptions are indeed ps output and vs input.

      Contrary to what I previously said, patch constant outputs are indeed packed, I just didn't realize because the test starts to fail because they use an array. Also patch constants have additional rules, for instance sv_insidetessfactor is allocated as a float[1] regardless of whether it is a single float (e.g. with domain("tri")).

      My hope was to introduce this change as an improvement to the incorrect pixel/vertex shader signatures we are producing to make Eastward work but now, since it would affect almost all other signatures, I am afraid I have to investigate how to properly allocate arrays (which means delaying the splitting of array semantics) as well and make it part of this MR, might take me a while.

      I will also add a hs and ds reflection test, even though we can't compile ds properly yet.

    • Please register or sign in to reply
  • Francisco Casas added 9 commits

    added 9 commits

    • 4fecf5ce - tests: Add signature reflection test with structs.
    • 739bf7a4 - vkd3d-shader/hlsl: Add mode field to register_allocator allocations.
    • d82e94e2 - vkd3d-shader/hlsl: Use a register_allocator to allocate semantic registers.
    • 130f85d1 - vkd3d-shader/hlsl: Also pass field storage modifiers to output signature elems.
    • 25f1479d - vkd3d-shader/hlsl: Allow accounting for interpolation mode when allocating semantics.
    • 762ae558 - vkd3d-shader/hlsl: Allow to force alignment on some semantic vars.
    • 32c8d2a0 - vkd3d-shader/hlsl: Allow prioritizing smaller writemasks when allocating signature elems.
    • b27eeba5 - vkd3d-shader/hlsl: Optimize interstage signatures.
    • 6c40097e - vkd3d-shader/hlsl: Sort signature elements by register id.

    Compare with previous version

  • Author Developer

    In the end I added the capacity of properly pack arrays by adding a hlsl_ir_var.force_align field. I also realized that this alignment is also forced for the first field of structs and naturally for the major vectors of matrices (except flat ones that have only 1 major vector). So there was no need to avoid splitting the semantic arrays.

    With this I feel confident enough to extend the packing to all other signatures (except vs input and ps output).

  • Elizabeth Figura approved this merge request

    approved this merge request

  • Francisco Casas added 25 commits

    added 25 commits

    • 6c40097e...8a3fe9cd - 16 commits from branch wine:master
    • 38133925 - tests: Add signature reflection test with structs.
    • bbab15e5 - vkd3d-shader/hlsl: Add mode field to register_allocator allocations.
    • f53be175 - vkd3d-shader/hlsl: Use a register_allocator to allocate semantic registers.
    • 6ad83fa4 - vkd3d-shader/hlsl: Also pass field storage modifiers to output signature elems.
    • 29eb5549 - vkd3d-shader/hlsl: Allow accounting for interpolation mode when allocating semantics.
    • fc867a2e - vkd3d-shader/hlsl: Allow to force alignment on some semantic vars.
    • 738a3b50 - vkd3d-shader/hlsl: Allow prioritizing smaller writemasks when allocating signature elems.
    • 509079d5 - vkd3d-shader/hlsl: Optimize interstage signatures.
    • f4fb3132 - vkd3d-shader/hlsl: Sort signature elements by register id.

    Compare with previous version

  • Author Developer

    :arrow_up: This needed another rebase.

  • Henri Verbeet approved this merge request

    approved this merge request

  • Henri Verbeet added 12 commits

    added 12 commits

    • f4fb3132...fb2b9744 - 3 commits from branch wine:master
    • d9b63118 - tests: Add signature reflection test with structs.
    • 9ce7b780 - vkd3d-shader/hlsl: Add mode field to register_allocator allocations.
    • 7180a967 - vkd3d-shader/hlsl: Use a register_allocator to allocate semantic registers.
    • b65f5fb0 - vkd3d-shader/hlsl: Also pass field storage modifiers to output signature elements.
    • 7fd6c29e - vkd3d-shader/hlsl: Allow accounting for interpolation mode when allocating semantics.
    • d562b03c - vkd3d-shader/hlsl: Allow to force alignment on some semantic vars.
    • 88dd0821 - vkd3d-shader/hlsl: Allow prioritizing smaller writemasks when allocating signature elements.
    • 51d05c18 - vkd3d-shader/hlsl: Optimize interstage signatures.
    • 2a8c1b28 - vkd3d-shader/hlsl: Sort signature elements by register id.

    Compare with previous version

Please register or sign in to reply
Loading