1/* 2 * Registers 3 * g0 -- header 4 * g1 -- constant 5 * g2 -- calculate X/Y offset 6 * g4-g12 payload for write message 7 */ 8define(`ORIG', `g2.0<2,2,1>UD') 9define(`ORIG_X', `g2.0<1>UD') 10define(`ORIG_Y', `g2.4<1>UD') 11define(`COLOR', `g1.0') 12define(`COLORUB', `COLOR<0,1,0>UB') 13define(`COLORUD', `COLOR<0,1,0>UD') 14define(`X', `g0.4<0,1,0>UD') 15define(`Y', `g0.24<0,1,0>UD') 16 17mov(4) COLOR<1>UB COLORUB {align1}; 18 19/* WRITE */ 20/* count thread group ID for X/Y offset */ 21mul(1) ORIG_X X 0x10UD {align1}; 22mov(1) ORIG_Y Y {align1}; 23mov(8) g4.0<1>UD g0.0<8,8,1>UD {align1}; 24mov(2) g4.0<1>UD ORIG {align1}; 25/* Normal mode: for block height 1 row and block width 16 bytes */ 26mov(1) g4.8<1>UD 0x0000000fUD {align1}; 27 28mov(16) g5.0<1>UD COLORUD {align1 compr}; 29 30/* 31 * write(0, 0, 10, 12) 32 * 10: media_block_write 33 * 12: data cache data port 1 34 */ 35send(16) 4 acc0<1>UW null write(0, 0, 10, 12) mlen 3 rlen 0 {align1}; 36 37/* EOT */ 38mov(8) g112.0<1>UD g0.0<8,8,1>UD {align1}; 39send(16) 112 null<1>UW null thread_spawner(0, 0, 1) mlen 1 rlen 0 {align1 EOT}; 40