Shaders: keep packed operands and results in fixed arrays #3813

Open
andrewpozdnakov7-jpg wants to merge 1 commit from upstream-pr/3813 into main
andrewpozdnakov7-jpg commented 2026-11-29 00:20:14 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-29T00:20:14Z.


Packed lowering knows it will read two or three operands per half and produce two halves. Keep those values in fixed arrays and read the operands in their existing order.

Across seven alternating Windows release comparisons, nine generated packed multiply, FMA and mixed shaders produced byte-identical DXIL and passed the Microsoft validator. The counting allocator measured three fewer allocations and 96 fewer requested bytes per packed instruction in all 63 comparisons. At 512 instructions, the mixed shader went from 16,968 to 15,432 allocations, with the same reallocation count.

The full translation time for mixed chains was 0.948× main at 128 instructions and 0.961× at 512. Pure multiply medians were 0.989–1.022× main. FMA medians were 0.945–0.974× with a wider spread across runs. The packed integer and FP16 controls on WARP, 33 lowerer tests, both strict Clippy configurations and the asset policy passed.

Please retain the Git author on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]> if folding the change into another commit.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:Marvisak/VIctory:issue:5545978560 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3813). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-29T00:20:14Z. --- Packed lowering knows it will read two or three operands per half and produce two halves. Keep those values in fixed arrays and read the operands in their existing order. Across seven alternating Windows release comparisons, nine generated packed multiply, FMA and mixed shaders produced byte-identical DXIL and passed the Microsoft validator. The counting allocator measured three fewer allocations and 96 fewer requested bytes per packed instruction in all 63 comparisons. At 512 instructions, the mixed shader went from 16,968 to 15,432 allocations, with the same reallocation count. The full translation time for mixed chains was 0.948× main at 128 instructions and 0.961× at 512. Pure multiply medians were 0.989–1.022× main. FMA medians were 0.945–0.974× with a wider spread across runs. The packed integer and FP16 controls on WARP, 33 lowerer tests, both strict Clippy configurations and the asset policy passed. Please retain the Git author on cherry-pick or rebase, or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>` if folding the change into another commit. AI-assisted with OpenAI Codex.
andrewpozdnakov7-jpg commented 2026-11-29 00:23:54 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-29T00:23:54Z.


Windows CI passed on 10474db, including both Clippy configurations and the workspace tests. The 512-instruction mixed fixture made 1,536 fewer allocations and requested 49,152 fewer bytes, with byte-identical, validator-accepted DXIL.

The next step is maintainer review. Please retain the Git author on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]> if folding the change into another commit.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7248084689 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3813#issuecomment-7248084689). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-29T00:23:54Z. --- [Windows CI](https://github.com/Marvisak/VIctory/actions/runs/46205889493/job/141168370691) passed on `10474db`, including both Clippy configurations and the workspace tests. The 512-instruction mixed fixture made 1,536 fewer allocations and requested 49,152 fewer bytes, with byte-identical, validator-accepted DXIL. The next step is maintainer review. Please retain the Git author on cherry-pick or rebase, or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>` if folding the change into another commit. AI-assisted with OpenAI Codex.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3813:upstream-pr/3813'
git switch 'upstream-pr/3813'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3813'
git switch 'upstream-pr/3813'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3813'
git switch 'upstream-pr/3813'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3813'
git switch 'main'
git merge --squash 'upstream-pr/3813'
git switch 'main'
git merge --ff-only 'upstream-pr/3813'
git switch 'main'
git merge 'upstream-pr/3813'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!3813
No description provided.