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

Michel Dänzer michel at daenzer.net
Thu Feb 6 18:46:55 PST 2014


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.


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