[Mesa-dev] [PATCH] R600/SI: Make sure M0 is always initialized when DS instructions are used

Tom Stellard tom at stellard.net
Fri Feb 7 13:54:09 PST 2014


On Fri, Feb 07, 2014 at 11:46:55AM +0900, Michel Dänzer wrote:
> On Don, 2014-02-06 at 09:40 -0800, Tom Stellard wrote:
> > From: Tom Stellard <thomas.stellard at amd.com>
> > 
> > DS instructions that access local memory can only uses addresses that
> > are less than or equal to the value of M0.  When M0 is uninitialized,
> > then we experience undefined behavior.
> 
> [...]
> 
> > @@ -488,10 +490,6 @@ bool SILowerControlFlowPass::runOnMachineFunction(MachineFunction &MF) {
> >  
> >          case AMDGPU::DS_READ_B32:
> >            NeedWQM = true;
> > -          // Fall through
> > -        case AMDGPU::DS_WRITE_B32:
> > -        case AMDGPU::DS_ADD_U32_RTN:
> > -          NeedM0 = true;
> >            break;
> >  
> >          case AMDGPU::V_INTERP_P1_F32:
> 
> It might make sense to set NeedWQM for all DS instructions as well. But
> if you do that, please also fix the test at the end of this function to
> only emit S_WQM_B64 for pixel shaders.
> 

Sure, I can do that.  Do we use LDS instructions at all for vertex or geometry
shaders?  If so I will add a test-case for that.

-Tom

> 
> Other than that, this fix looks good to me.
> 
> 
> -- 
> Earthling Michel Dänzer            |                  http://www.amd.com
> Libre software enthusiast          |                Mesa and X developer
> 


More information about the mesa-dev mailing list