2 Replies Latest reply on Feb 23, 2013 12:43 PM by realhet

    GCN: Not sure about ds_write and s_waitcnt

    realhet

      Hi!

       

      For the ds_read it is clear for me that I have to wait for lgkmcnt(0).

       

      But what about ds_write?

      Do I need an lgkmcnt(0) (as the SI ISA manual suggests for DS commands in general)?

      Or do I also need expcnt(0) as well, as it will fetch VRegs later?

       

      In my prog there are big rests between ds_ operations, so it seems like neither lgkmcnt(0) or expcnt(0) needed, but I wanna make 100% sure, I use them reliably.

      Please if anyone knows, tell me what counters are incremented when using a ds_write.

       

      Thanks!

        • Re: GCN: Not sure about ds_write and s_waitcnt
          drallan

          According to the manual, only ds_write to gds memory increments  the expcnt counter.

          The counter is used to prevent changing the output VGPR before the data is written.

          It's needed because export instructions (including ds_write to gds) are executed in 2 phases,

          the first phase requests the required internal buses and the second phase writes the data

          from the VGPR.

           

          This is not true of lds memory, although lgkm_cnt is used for lds writes I think its only to make

          sure the lds has received that data.

           

          I don't use expcnt for lds operations in my compiler and have not seen any problems with

          complex kernels using lots of lds. But now your question makes me wonder if I'm using it

          correctly for gds?