Shader clean-up passes; a test that needs a card skips without one
- Clean-up passes over each translated module (VICTORY_SHADER_OPT bits: dead code, folding, reuse, branch facts, loads within a block, wave64 first-lane exchange), part of the shader cache key. About 43 % fewer host instructions over the pack; about 20 ms less GPU time per frame on the test machine. - translate: a census of the emitted code. - Checked with plain game runs of this tree on the test machine. Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
1 parent
7b0f736d0b
commit
16849898f3
10 files changed
+2495
-16
No files matched your search
@@ -7,9 +7,24 @@
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
pub mod census;
|
||||
pub mod opt;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||
pub(crate) struct Ty(u32);
|
||||
|
||||
/// What the lowering made an instruction for, where it says so (counted by
|
||||
/// [`census`], nothing else reads it).
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub(crate) enum Tag {
|
||||
/// The select that keeps a register's old value in lanes a guard masks.
|
||||
Guard,
|
||||
/// An index clamp the translation adds (the console has none).
|
||||
Clamp,
|
||||
/// The iteration counter and limit test the translation adds to a loop.
|
||||
Counter,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
enum TypeDef {
|
||||
Void,
|
||||
@@ -208,6 +223,8 @@ pub(crate) struct Module {
|
||||
blocks: Vec<Block>,
|
||||
mds: Vec<MdDef>,
|
||||
named: Vec<(String, Vec<Md>)>,
|
||||
/// See [`Tag`]: by instruction.
|
||||
tags: HashMap<u32, Tag>,
|
||||
}
|
||||
|
||||
impl Module {
|
||||
@@ -355,6 +372,16 @@ impl Module {
|
||||
g
|
||||
}
|
||||
|
||||
/// Notes what instruction `v` is for (see [`Tag`]); only when modules
|
||||
/// are counted.
|
||||
pub fn tag(&mut self, v: V, tag: Tag) {
|
||||
if let V::Inst(i) = v
|
||||
&& census::enabled()
|
||||
{
|
||||
self.tags.insert(i, tag);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_block(&mut self) -> usize {
|
||||
self.blocks.push(Block::default());
|
||||
self.blocks.len() - 1
|
||||
|
||||
Reference in new issue
Block a user