mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 17:20:10 +01:00
intel/brw: Add brw_analysis.h
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33048>
This commit is contained in:
parent
bf48eae1f9
commit
e5369540ea
3 changed files with 98 additions and 87 deletions
96
src/intel/compiler/brw_analysis.h
Normal file
96
src/intel/compiler/brw_analysis.h
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* Copyright © 2010 Intel Corporation
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "brw_cfg.h"
|
||||
#include "brw_inst.h"
|
||||
#include "brw_ir_analysis.h"
|
||||
#include "brw_fs_live_variables.h"
|
||||
#include "brw_ir_performance.h"
|
||||
|
||||
struct fs_visitor;
|
||||
|
||||
namespace brw {
|
||||
/**
|
||||
* Register pressure analysis of a shader. Estimates how many registers
|
||||
* are live at any point of the program in GRF units.
|
||||
*/
|
||||
struct register_pressure {
|
||||
register_pressure(const fs_visitor *v);
|
||||
~register_pressure();
|
||||
|
||||
analysis_dependency_class
|
||||
dependency_class() const
|
||||
{
|
||||
return (DEPENDENCY_INSTRUCTION_IDENTITY |
|
||||
DEPENDENCY_INSTRUCTION_DATA_FLOW |
|
||||
DEPENDENCY_VARIABLES);
|
||||
}
|
||||
|
||||
bool
|
||||
validate(const fs_visitor *) const
|
||||
{
|
||||
/* FINISHME */
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned *regs_live_at_ip;
|
||||
};
|
||||
|
||||
class def_analysis {
|
||||
public:
|
||||
def_analysis(const fs_visitor *v);
|
||||
~def_analysis();
|
||||
|
||||
brw_inst *
|
||||
get(const brw_reg ®) const
|
||||
{
|
||||
return reg.file == VGRF && reg.nr < def_count ?
|
||||
def_insts[reg.nr] : NULL;
|
||||
}
|
||||
|
||||
bblock_t *
|
||||
get_block(const brw_reg ®) const
|
||||
{
|
||||
return reg.file == VGRF && reg.nr < def_count ?
|
||||
def_blocks[reg.nr] : NULL;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
get_use_count(const brw_reg ®) const
|
||||
{
|
||||
return reg.file == VGRF && reg.nr < def_count ?
|
||||
def_use_counts[reg.nr] : 0;
|
||||
}
|
||||
|
||||
unsigned count() const { return def_count; }
|
||||
unsigned ssa_count() const;
|
||||
|
||||
void print_stats(const fs_visitor *) const;
|
||||
|
||||
analysis_dependency_class
|
||||
dependency_class() const
|
||||
{
|
||||
return DEPENDENCY_INSTRUCTION_IDENTITY |
|
||||
DEPENDENCY_INSTRUCTION_DATA_FLOW |
|
||||
DEPENDENCY_VARIABLES |
|
||||
DEPENDENCY_BLOCKS;
|
||||
}
|
||||
|
||||
bool validate(const fs_visitor *) const;
|
||||
|
||||
private:
|
||||
void mark_invalid(int);
|
||||
bool fully_defines(const fs_visitor *v, brw_inst *);
|
||||
void update_for_reads(const idom_tree &idom, bblock_t *block, brw_inst *);
|
||||
void update_for_write(const fs_visitor *v, bblock_t *block, brw_inst *);
|
||||
|
||||
brw_inst **def_insts;
|
||||
bblock_t **def_blocks;
|
||||
uint32_t *def_use_counts;
|
||||
unsigned def_count;
|
||||
};
|
||||
}
|
||||
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "brw_analysis.h"
|
||||
#include "brw_cfg.h"
|
||||
#include "brw_compiler.h"
|
||||
#include "brw_inst.h"
|
||||
|
|
@ -35,95 +36,8 @@
|
|||
#include "brw_ir_performance.h"
|
||||
#include "compiler/nir/nir.h"
|
||||
|
||||
struct bblock_t;
|
||||
namespace {
|
||||
struct acp_entry;
|
||||
}
|
||||
|
||||
struct fs_visitor;
|
||||
|
||||
namespace brw {
|
||||
/**
|
||||
* Register pressure analysis of a shader. Estimates how many registers
|
||||
* are live at any point of the program in GRF units.
|
||||
*/
|
||||
struct register_pressure {
|
||||
register_pressure(const fs_visitor *v);
|
||||
~register_pressure();
|
||||
|
||||
analysis_dependency_class
|
||||
dependency_class() const
|
||||
{
|
||||
return (DEPENDENCY_INSTRUCTION_IDENTITY |
|
||||
DEPENDENCY_INSTRUCTION_DATA_FLOW |
|
||||
DEPENDENCY_VARIABLES);
|
||||
}
|
||||
|
||||
bool
|
||||
validate(const fs_visitor *) const
|
||||
{
|
||||
/* FINISHME */
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned *regs_live_at_ip;
|
||||
};
|
||||
|
||||
class def_analysis {
|
||||
public:
|
||||
def_analysis(const fs_visitor *v);
|
||||
~def_analysis();
|
||||
|
||||
brw_inst *
|
||||
get(const brw_reg ®) const
|
||||
{
|
||||
return reg.file == VGRF && reg.nr < def_count ?
|
||||
def_insts[reg.nr] : NULL;
|
||||
}
|
||||
|
||||
bblock_t *
|
||||
get_block(const brw_reg ®) const
|
||||
{
|
||||
return reg.file == VGRF && reg.nr < def_count ?
|
||||
def_blocks[reg.nr] : NULL;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
get_use_count(const brw_reg ®) const
|
||||
{
|
||||
return reg.file == VGRF && reg.nr < def_count ?
|
||||
def_use_counts[reg.nr] : 0;
|
||||
}
|
||||
|
||||
unsigned count() const { return def_count; }
|
||||
unsigned ssa_count() const;
|
||||
|
||||
void print_stats(const fs_visitor *) const;
|
||||
|
||||
analysis_dependency_class
|
||||
dependency_class() const
|
||||
{
|
||||
return DEPENDENCY_INSTRUCTION_IDENTITY |
|
||||
DEPENDENCY_INSTRUCTION_DATA_FLOW |
|
||||
DEPENDENCY_VARIABLES |
|
||||
DEPENDENCY_BLOCKS;
|
||||
}
|
||||
|
||||
bool validate(const fs_visitor *) const;
|
||||
|
||||
private:
|
||||
void mark_invalid(int);
|
||||
bool fully_defines(const fs_visitor *v, brw_inst *);
|
||||
void update_for_reads(const idom_tree &idom, bblock_t *block, brw_inst *);
|
||||
void update_for_write(const fs_visitor *v, bblock_t *block, brw_inst *);
|
||||
|
||||
brw_inst **def_insts;
|
||||
bblock_t **def_blocks;
|
||||
uint32_t *def_use_counts;
|
||||
unsigned def_count;
|
||||
};
|
||||
}
|
||||
|
||||
#define UBO_START ((1 << 16) - 4)
|
||||
|
||||
class brw_builder;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ intel_nir_files = files(
|
|||
)
|
||||
|
||||
libintel_compiler_brw_files = files(
|
||||
'brw_analysis.h',
|
||||
'brw_builder.cpp',
|
||||
'brw_builder.h',
|
||||
'brw_cfg.cpp',
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue