cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

realhet
Miniboss

GCN: Not sure about ds_write and s_waitcnt

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!

0 Likes
1 Solution
drallan
Challenger

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?

View solution in original post

0 Likes
2 Replies
drallan
Challenger

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?

0 Likes

Thx, I'm using only LDS so I'll wait lgkmcnt(0) only.

0 Likes