AMDGPUModifierSyntax.rst 52 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499
  1. ======================================
  2. Syntax of AMDGPU Instruction Modifiers
  3. ======================================
  4. .. contents::
  5. :local:
  6. Conventions
  7. ===========
  8. The following notation is used throughout this document:
  9. =================== =============================================================
  10. Notation Description
  11. =================== =============================================================
  12. {0..N} Any integer value in the range from 0 to N (inclusive).
  13. <x> Syntax and meaning of *x* is explained elsewhere.
  14. =================== =============================================================
  15. .. _amdgpu_syn_modifiers:
  16. Modifiers
  17. =========
  18. DS Modifiers
  19. ------------
  20. .. _amdgpu_synid_ds_offset8:
  21. offset8
  22. ~~~~~~~
  23. Specifies an immediate unsigned 8-bit offset, in bytes. The default value is 0.
  24. Used with DS instructions which have 2 addresses.
  25. =================== =====================================================
  26. Syntax Description
  27. =================== =====================================================
  28. offset:{0..0xFF} Specifies an unsigned 8-bit offset as a positive
  29. :ref:`integer number <amdgpu_synid_integer_number>`.
  30. =================== =====================================================
  31. Examples:
  32. .. parsed-literal::
  33. offset:255
  34. offset:0xff
  35. .. _amdgpu_synid_ds_offset16:
  36. offset16
  37. ~~~~~~~~
  38. Specifies an immediate unsigned 16-bit offset, in bytes. The default value is 0.
  39. Used with DS instructions which have 1 address.
  40. ==================== ======================================================
  41. Syntax Description
  42. ==================== ======================================================
  43. offset:{0..0xFFFF} Specifies an unsigned 16-bit offset as a positive
  44. :ref:`integer number <amdgpu_synid_integer_number>`.
  45. ==================== ======================================================
  46. Examples:
  47. .. parsed-literal::
  48. offset:65535
  49. offset:0xffff
  50. .. _amdgpu_synid_sw_offset16:
  51. swizzle pattern
  52. ~~~~~~~~~~~~~~~
  53. This is a special modifier which may be used with *ds_swizzle_b32* instruction only.
  54. It specifies a swizzle pattern in numeric or symbolic form. The default value is 0.
  55. See AMD documentation for more information.
  56. ======================================================= ===========================================================
  57. Syntax Description
  58. ======================================================= ===========================================================
  59. offset:{0..0xFFFF} Specifies a 16-bit swizzle pattern.
  60. offset:swizzle(QUAD_PERM,{0..3},{0..3},{0..3},{0..3}) Specifies a quad permute mode pattern
  61. Each number is a lane *id*.
  62. offset:swizzle(BITMASK_PERM, "<mask>") Specifies a bitmask permute mode pattern.
  63. The pattern converts a 5-bit lane *id* to another
  64. lane *id* with which the lane interacts.
  65. *mask* is a 5 character sequence which
  66. specifies how to transform the bits of the
  67. lane *id*.
  68. The following characters are allowed:
  69. * "0" - set bit to 0.
  70. * "1" - set bit to 1.
  71. * "p" - preserve bit.
  72. * "i" - inverse bit.
  73. offset:swizzle(BROADCAST,{2..32},{0..N}) Specifies a broadcast mode.
  74. Broadcasts the value of any particular lane to
  75. all lanes in its group.
  76. The first numeric parameter is a group
  77. size and must be equal to 2, 4, 8, 16 or 32.
  78. The second numeric parameter is an index of the
  79. lane being broadcasted.
  80. The index must not exceed group size.
  81. offset:swizzle(SWAP,{1..16}) Specifies a swap mode.
  82. Swaps the neighboring groups of
  83. 1, 2, 4, 8 or 16 lanes.
  84. offset:swizzle(REVERSE,{2..32}) Specifies a reverse mode.
  85. Reverses the lanes for groups of 2, 4, 8, 16 or 32 lanes.
  86. ======================================================= ===========================================================
  87. Numeric parameters may be specified as either :ref:`integer numbers<amdgpu_synid_integer_number>` or
  88. :ref:`absolute expressions<amdgpu_synid_absolute_expression>`.
  89. Examples:
  90. .. parsed-literal::
  91. offset:255
  92. offset:0xffff
  93. offset:swizzle(QUAD_PERM, 0, 1, 2 ,3)
  94. offset:swizzle(BITMASK_PERM, "01pi0")
  95. offset:swizzle(BROADCAST, 2, 0)
  96. offset:swizzle(SWAP, 8)
  97. offset:swizzle(REVERSE, 30 + 2)
  98. .. _amdgpu_synid_gds:
  99. gds
  100. ~~~
  101. Specifies whether to use GDS or LDS memory (LDS is the default).
  102. ======================================== ================================================
  103. Syntax Description
  104. ======================================== ================================================
  105. gds Use GDS memory.
  106. ======================================== ================================================
  107. EXP Modifiers
  108. -------------
  109. .. _amdgpu_synid_done:
  110. done
  111. ~~~~
  112. Specifies if this is the last export from the shader to the target. By default,
  113. *exp* instruction does not finish an export sequence.
  114. ======================================== ================================================
  115. Syntax Description
  116. ======================================== ================================================
  117. done Indicates the last export operation.
  118. ======================================== ================================================
  119. .. _amdgpu_synid_compr:
  120. compr
  121. ~~~~~
  122. Indicates if the data are compressed (data are not compressed by default).
  123. ======================================== ================================================
  124. Syntax Description
  125. ======================================== ================================================
  126. compr Data are compressed.
  127. ======================================== ================================================
  128. .. _amdgpu_synid_vm:
  129. vm
  130. ~~
  131. Specifies valid mask flag state (off by default).
  132. ======================================== ================================================
  133. Syntax Description
  134. ======================================== ================================================
  135. vm Set valid mask flag.
  136. ======================================== ================================================
  137. FLAT Modifiers
  138. --------------
  139. .. _amdgpu_synid_flat_offset12:
  140. offset12
  141. ~~~~~~~~
  142. Specifies an immediate unsigned 12-bit offset, in bytes. The default value is 0.
  143. Cannot be used with *global/scratch* opcodes. GFX9 only.
  144. ================= ======================================================
  145. Syntax Description
  146. ================= ======================================================
  147. offset:{0..4095} Specifies a 12-bit unsigned offset as a positive
  148. :ref:`integer number <amdgpu_synid_integer_number>`.
  149. ================= ======================================================
  150. Examples:
  151. .. parsed-literal::
  152. offset:4095
  153. offset:0xff
  154. .. _amdgpu_synid_flat_offset13s:
  155. offset13s
  156. ~~~~~~~~~
  157. Specifies an immediate signed 13-bit offset, in bytes. The default value is 0.
  158. Can be used with *global/scratch* opcodes only. GFX9 only.
  159. ============================ =======================================================
  160. Syntax Description
  161. ============================ =======================================================
  162. offset:{-4096..4095} Specifies a 13-bit signed offset as an
  163. :ref:`integer number <amdgpu_synid_integer_number>`.
  164. ============================ =======================================================
  165. Examples:
  166. .. parsed-literal::
  167. offset:-4000
  168. offset:0x10
  169. .. _amdgpu_synid_flat_offset12s:
  170. offset12s
  171. ~~~~~~~~~
  172. Specifies an immediate signed 12-bit offset, in bytes. The default value is 0.
  173. Can be used with *global/scratch* opcodes only.
  174. GFX10 only.
  175. ============================ =======================================================
  176. Syntax Description
  177. ============================ =======================================================
  178. offset:{-2048..2047} Specifies a 12-bit signed offset as an
  179. :ref:`integer number <amdgpu_synid_integer_number>`.
  180. ============================ =======================================================
  181. Examples:
  182. .. parsed-literal::
  183. offset:-2000
  184. offset:0x10
  185. .. _amdgpu_synid_flat_offset11:
  186. offset11
  187. ~~~~~~~~
  188. Specifies an immediate unsigned 11-bit offset, in bytes. The default value is 0.
  189. Cannot be used with *global/scratch* opcodes.
  190. GFX10 only.
  191. ================= ======================================================
  192. Syntax Description
  193. ================= ======================================================
  194. offset:{0..2047} Specifies an 11-bit unsigned offset as a positive
  195. :ref:`integer number <amdgpu_synid_integer_number>`.
  196. ================= ======================================================
  197. Examples:
  198. .. parsed-literal::
  199. offset:2047
  200. offset:0xff
  201. dlc
  202. ~~~
  203. See a description :ref:`here<amdgpu_synid_dlc>`. GFX10 only.
  204. glc
  205. ~~~
  206. See a description :ref:`here<amdgpu_synid_glc>`.
  207. lds
  208. ~~~
  209. See a description :ref:`here<amdgpu_synid_lds>`. GFX10 only.
  210. slc
  211. ~~~
  212. See a description :ref:`here<amdgpu_synid_slc>`.
  213. tfe
  214. ~~~
  215. See a description :ref:`here<amdgpu_synid_tfe>`.
  216. nv
  217. ~~
  218. See a description :ref:`here<amdgpu_synid_nv>`.
  219. MIMG Modifiers
  220. --------------
  221. .. _amdgpu_synid_dmask:
  222. dmask
  223. ~~~~~
  224. Specifies which channels (image components) are used by the operation. By default, no channels
  225. are used.
  226. =============== =====================================================
  227. Syntax Description
  228. =============== =====================================================
  229. dmask:{0..15} Specifies image channels as a positive
  230. :ref:`integer number <amdgpu_synid_integer_number>`.
  231. Each bit corresponds to one of 4 image
  232. components (RGBA).
  233. If the specified bit value
  234. is 0, the component is not used, value 1 means
  235. that the component is used.
  236. =============== =====================================================
  237. This modifier has some limitations depending on instruction kind:
  238. =================================================== ========================
  239. Instruction Kind Valid dmask Values
  240. =================================================== ========================
  241. 32-bit atomic *cmpswap* 0x3
  242. 32-bit atomic instructions except for *cmpswap* 0x1
  243. 64-bit atomic *cmpswap* 0xF
  244. 64-bit atomic instructions except for *cmpswap* 0x3
  245. *gather4* 0x1, 0x2, 0x4, 0x8
  246. Other instructions any value
  247. =================================================== ========================
  248. Examples:
  249. .. parsed-literal::
  250. dmask:0xf
  251. dmask:0b1111
  252. dmask:3
  253. .. _amdgpu_synid_unorm:
  254. unorm
  255. ~~~~~
  256. Specifies whether the address is normalized or not (the address is normalized by default).
  257. ======================== ========================================
  258. Syntax Description
  259. ======================== ========================================
  260. unorm Force the address to be unnormalized.
  261. ======================== ========================================
  262. glc
  263. ~~~
  264. See a description :ref:`here<amdgpu_synid_glc>`.
  265. slc
  266. ~~~
  267. See a description :ref:`here<amdgpu_synid_slc>`.
  268. .. _amdgpu_synid_r128:
  269. r128
  270. ~~~~
  271. Specifies texture resource size. The default size is 256 bits.
  272. GFX7, GFX8 and GFX10 only.
  273. =================== ================================================
  274. Syntax Description
  275. =================== ================================================
  276. r128 Specifies 128 bits texture resource size.
  277. =================== ================================================
  278. .. WARNING:: Using this modifier should descrease *rsrc* operand size from 8 to 4 dwords, but assembler does not currently support this feature.
  279. tfe
  280. ~~~
  281. See a description :ref:`here<amdgpu_synid_tfe>`.
  282. .. _amdgpu_synid_lwe:
  283. lwe
  284. ~~~
  285. Specifies LOD warning status (LOD warning is disabled by default).
  286. ======================================== ================================================
  287. Syntax Description
  288. ======================================== ================================================
  289. lwe Enables LOD warning.
  290. ======================================== ================================================
  291. .. _amdgpu_synid_da:
  292. da
  293. ~~
  294. Specifies if an array index must be sent to TA. By default, array index is not sent.
  295. ======================================== ================================================
  296. Syntax Description
  297. ======================================== ================================================
  298. da Send an array-index to TA.
  299. ======================================== ================================================
  300. .. _amdgpu_synid_d16:
  301. d16
  302. ~~~
  303. Specifies data size: 16 or 32 bits (32 bits by default). Not supported by GFX7.
  304. ======================================== ================================================
  305. Syntax Description
  306. ======================================== ================================================
  307. d16 Enables 16-bits data mode.
  308. On loads, convert data in memory to 16-bit
  309. format before storing it in VGPRs.
  310. For stores, convert 16-bit data in VGPRs to
  311. 32 bits before going to memory.
  312. Note that GFX8.0 does not support data packing.
  313. Each 16-bit data element occupies 1 VGPR.
  314. GFX8.1, GFX9 and GFX10 support data packing.
  315. Each pair of 16-bit data elements
  316. occupies 1 VGPR.
  317. ======================================== ================================================
  318. .. _amdgpu_synid_a16:
  319. a16
  320. ~~~
  321. Specifies size of image address components: 16 or 32 bits (32 bits by default).
  322. GFX9 and GFX10 only.
  323. ======================================== ================================================
  324. Syntax Description
  325. ======================================== ================================================
  326. a16 Enables 16-bits image address components.
  327. ======================================== ================================================
  328. .. _amdgpu_synid_dim:
  329. dim
  330. ~~~
  331. Specifies surface dimension. This is a mandatory modifier. There is no default value.
  332. GFX10 only.
  333. =============================== =========================================================
  334. Syntax Description
  335. =============================== =========================================================
  336. dim:1D One-dimensional image.
  337. dim:2D Two-dimensional image.
  338. dim:3D Three-dimensional image.
  339. dim:CUBE Cubemap array.
  340. dim:1D_ARRAY One-dimensional image array.
  341. dim:2D_ARRAY Two-dimensional image array.
  342. dim:2D_MSAA Two-dimensional multi-sample auto-aliasing image.
  343. dim:2D_MSAA_ARRAY Two-dimensional multi-sample auto-aliasing image array.
  344. =============================== =========================================================
  345. The following table defines an alternative syntax which is supported
  346. for compatibility with SP3 assembler:
  347. =============================== =========================================================
  348. Syntax Description
  349. =============================== =========================================================
  350. dim:SQ_RSRC_IMG_1D One-dimensional image.
  351. dim:SQ_RSRC_IMG_2D Two-dimensional image.
  352. dim:SQ_RSRC_IMG_3D Three-dimensional image.
  353. dim:SQ_RSRC_IMG_CUBE Cubemap array.
  354. dim:SQ_RSRC_IMG_1D_ARRAY One-dimensional image array.
  355. dim:SQ_RSRC_IMG_2D_ARRAY Two-dimensional image array.
  356. dim:SQ_RSRC_IMG_2D_MSAA Two-dimensional multi-sample auto-aliasing image.
  357. dim:SQ_RSRC_IMG_2D_MSAA_ARRAY Two-dimensional multi-sample auto-aliasing image array.
  358. =============================== =========================================================
  359. dlc
  360. ~~~
  361. See a description :ref:`here<amdgpu_synid_dlc>`. GFX10 only.
  362. Miscellaneous Modifiers
  363. -----------------------
  364. .. _amdgpu_synid_dlc:
  365. dlc
  366. ~~~
  367. Controls device level cache policy for memory operations. Used for synchronization.
  368. When specified, forces operation to bypass device level cache making the operation device
  369. level coherent. By default, instructions use device level cache.
  370. GFX10 only.
  371. ======================================== ================================================
  372. Syntax Description
  373. ======================================== ================================================
  374. dlc Bypass device level cache.
  375. ======================================== ================================================
  376. .. _amdgpu_synid_glc:
  377. glc
  378. ~~~
  379. This modifier has different meaning for loads, stores, and atomic operations.
  380. The default value is off (0).
  381. See AMD documentation for details.
  382. ======================================== ================================================
  383. Syntax Description
  384. ======================================== ================================================
  385. glc Set glc bit to 1.
  386. ======================================== ================================================
  387. .. _amdgpu_synid_lds:
  388. lds
  389. ~~~
  390. Specifies where to store the result: VGPRs or LDS (VGPRs by default).
  391. ======================================== ===========================
  392. Syntax Description
  393. ======================================== ===========================
  394. lds Store result in LDS.
  395. ======================================== ===========================
  396. .. _amdgpu_synid_nv:
  397. nv
  398. ~~
  399. Specifies if instruction is operating on non-volatile memory. By default, memory is volatile.
  400. GFX9 only.
  401. ======================================== ================================================
  402. Syntax Description
  403. ======================================== ================================================
  404. nv Indicates that instruction operates on
  405. non-volatile memory.
  406. ======================================== ================================================
  407. .. _amdgpu_synid_slc:
  408. slc
  409. ~~~
  410. Specifies cache policy. The default value is off (0).
  411. See AMD documentation for details.
  412. ======================================== ================================================
  413. Syntax Description
  414. ======================================== ================================================
  415. slc Set slc bit to 1.
  416. ======================================== ================================================
  417. .. _amdgpu_synid_tfe:
  418. tfe
  419. ~~~
  420. Controls access to partially resident textures. The default value is off (0).
  421. See AMD documentation for details.
  422. ======================================== ================================================
  423. Syntax Description
  424. ======================================== ================================================
  425. tfe Set tfe bit to 1.
  426. ======================================== ================================================
  427. MUBUF/MTBUF Modifiers
  428. ---------------------
  429. .. _amdgpu_synid_idxen:
  430. idxen
  431. ~~~~~
  432. Specifies whether address components include an index. By default, no components are used.
  433. Can be used together with :ref:`offen<amdgpu_synid_offen>`.
  434. Cannot be used with :ref:`addr64<amdgpu_synid_addr64>`.
  435. ======================================== ================================================
  436. Syntax Description
  437. ======================================== ================================================
  438. idxen Address components include an index.
  439. ======================================== ================================================
  440. .. _amdgpu_synid_offen:
  441. offen
  442. ~~~~~
  443. Specifies whether address components include an offset. By default, no components are used.
  444. Can be used together with :ref:`idxen<amdgpu_synid_idxen>`.
  445. Cannot be used with :ref:`addr64<amdgpu_synid_addr64>`.
  446. ======================================== ================================================
  447. Syntax Description
  448. ======================================== ================================================
  449. offen Address components include an offset.
  450. ======================================== ================================================
  451. .. _amdgpu_synid_addr64:
  452. addr64
  453. ~~~~~~
  454. Specifies whether a 64-bit address is used. By default, no address is used.
  455. GFX7 only. Cannot be used with :ref:`offen<amdgpu_synid_offen>` and
  456. :ref:`idxen<amdgpu_synid_idxen>` modifiers.
  457. ======================================== ================================================
  458. Syntax Description
  459. ======================================== ================================================
  460. addr64 A 64-bit address is used.
  461. ======================================== ================================================
  462. .. _amdgpu_synid_buf_offset12:
  463. offset12
  464. ~~~~~~~~
  465. Specifies an immediate unsigned 12-bit offset, in bytes. The default value is 0.
  466. =============================== ======================================================
  467. Syntax Description
  468. =============================== ======================================================
  469. offset:{0..0xFFF} Specifies a 12-bit unsigned offset as a positive
  470. :ref:`integer number <amdgpu_synid_integer_number>`.
  471. =============================== ======================================================
  472. Examples:
  473. .. parsed-literal::
  474. offset:0
  475. offset:0x10
  476. glc
  477. ~~~
  478. See a description :ref:`here<amdgpu_synid_glc>`.
  479. slc
  480. ~~~
  481. See a description :ref:`here<amdgpu_synid_slc>`.
  482. lds
  483. ~~~
  484. See a description :ref:`here<amdgpu_synid_lds>`.
  485. dlc
  486. ~~~
  487. See a description :ref:`here<amdgpu_synid_dlc>`. GFX10 only.
  488. tfe
  489. ~~~
  490. See a description :ref:`here<amdgpu_synid_tfe>`.
  491. .. _amdgpu_synid_dfmt:
  492. dfmt
  493. ~~~~
  494. TBD
  495. .. _amdgpu_synid_nfmt:
  496. nfmt
  497. ~~~~
  498. TBD
  499. SMRD/SMEM Modifiers
  500. -------------------
  501. glc
  502. ~~~
  503. See a description :ref:`here<amdgpu_synid_glc>`.
  504. nv
  505. ~~
  506. See a description :ref:`here<amdgpu_synid_nv>`. GFX9 only.
  507. dlc
  508. ~~~
  509. See a description :ref:`here<amdgpu_synid_dlc>`. GFX10 only.
  510. VINTRP Modifiers
  511. ----------------
  512. .. _amdgpu_synid_high:
  513. high
  514. ~~~~
  515. Specifies which half of the LDS word to use. Low half of LDS word is used by default.
  516. GFX9 and GFX10 only.
  517. ======================================== ================================
  518. Syntax Description
  519. ======================================== ================================
  520. high Use high half of LDS word.
  521. ======================================== ================================
  522. DPP8 Modifiers
  523. --------------
  524. GFX10 only.
  525. .. _amdgpu_synid_dpp8_sel:
  526. dpp8_sel
  527. ~~~~~~~~
  528. Selects which lane to pull data from, within a group of 8 lanes. This is a mandatory modifier.
  529. There is no default value.
  530. GFX10 only.
  531. The *dpp8_sel* modifier must specify exactly 8 values, each ranging from 0 to 7.
  532. First value selects which lane to read from to supply data into lane 0.
  533. Second value controls value for lane 1 and so on.
  534. =============================================================== ===========================
  535. Syntax Description
  536. =============================================================== ===========================
  537. dpp8:[{0..7},{0..7},{0..7},{0..7},{0..7},{0..7},{0..7},{0..7}] Select lanes to read from.
  538. =============================================================== ===========================
  539. Examples:
  540. .. parsed-literal::
  541. dpp8:[7,6,5,4,3,2,1,0]
  542. dpp8:[0,1,0,1,0,1,0,1]
  543. .. _amdgpu_synid_fi8:
  544. fi
  545. ~~
  546. Controls interaction with inactive lanes for *dpp8* instructions. The default value is zero.
  547. Note. *Inactive* lanes are those whose :ref:`exec<amdgpu_synid_exec>` mask bit is zero.
  548. GFX10 only.
  549. ==================================== =====================================================
  550. Syntax Description
  551. ==================================== =====================================================
  552. fi:0 Fetch zero when accessing data from inactive lanes.
  553. fi:1 Fetch pre-exist values from inactive lanes.
  554. ==================================== =====================================================
  555. DPP/DPP16 Modifiers
  556. -------------------
  557. GFX8, GFX9 and GFX10 only.
  558. .. _amdgpu_synid_dpp_ctrl:
  559. dpp_ctrl
  560. ~~~~~~~~
  561. Specifies how data are shared between threads. This is a mandatory modifier.
  562. There is no default value.
  563. GFX8 and GFX9 only. Use :ref:`dpp16_ctrl<amdgpu_synid_dpp16_ctrl>` for GFX10.
  564. Note. The lanes of a wavefront are organized in four *rows* and four *banks*.
  565. ======================================== ================================================
  566. Syntax Description
  567. ======================================== ================================================
  568. quad_perm:[{0..3},{0..3},{0..3},{0..3}] Full permute of 4 threads.
  569. row_mirror Mirror threads within row.
  570. row_half_mirror Mirror threads within 1/2 row (8 threads).
  571. row_bcast:15 Broadcast 15th thread of each row to next row.
  572. row_bcast:31 Broadcast thread 31 to rows 2 and 3.
  573. wave_shl:1 Wavefront left shift by 1 thread.
  574. wave_rol:1 Wavefront left rotate by 1 thread.
  575. wave_shr:1 Wavefront right shift by 1 thread.
  576. wave_ror:1 Wavefront right rotate by 1 thread.
  577. row_shl:{1..15} Row shift left by 1-15 threads.
  578. row_shr:{1..15} Row shift right by 1-15 threads.
  579. row_ror:{1..15} Row rotate right by 1-15 threads.
  580. ======================================== ================================================
  581. Note: Numeric parameters may be specified as either
  582. :ref:`integer numbers<amdgpu_synid_integer_number>` or
  583. :ref:`absolute expressions<amdgpu_synid_absolute_expression>`.
  584. Examples:
  585. .. parsed-literal::
  586. quad_perm:[0, 1, 2, 3]
  587. row_shl:3
  588. .. _amdgpu_synid_dpp16_ctrl:
  589. dpp16_ctrl
  590. ~~~~~~~~~~
  591. Specifies how data are shared between threads. This is a mandatory modifier.
  592. There is no default value.
  593. GFX10 only. Use :ref:`dpp_ctrl<amdgpu_synid_dpp_ctrl>` for GFX8 and GFX9.
  594. Note. The lanes of a wavefront are organized in four *rows* and four *banks*.
  595. (There are only two rows in *wave32* mode.)
  596. ======================================== ====================================================
  597. Syntax Description
  598. ======================================== ====================================================
  599. quad_perm:[{0..3},{0..3},{0..3},{0..3}] Full permute of 4 threads.
  600. row_mirror Mirror threads within row.
  601. row_half_mirror Mirror threads within 1/2 row (8 threads).
  602. row_share:{0..15} Share the value from the specified lane with other
  603. lanes in the row.
  604. row_xmask:{0..15} Fetch from XOR(current lane id, specified lane id).
  605. row_shl:{1..15} Row shift left by 1-15 threads.
  606. row_shr:{1..15} Row shift right by 1-15 threads.
  607. row_ror:{1..15} Row rotate right by 1-15 threads.
  608. ======================================== ====================================================
  609. Note: Numeric parameters may be specified as either
  610. :ref:`integer numbers<amdgpu_synid_integer_number>` or
  611. :ref:`absolute expressions<amdgpu_synid_absolute_expression>`.
  612. Examples:
  613. .. parsed-literal::
  614. quad_perm:[0, 1, 2, 3]
  615. row_shl:3
  616. .. _amdgpu_synid_row_mask:
  617. row_mask
  618. ~~~~~~~~
  619. Controls which rows are enabled for data sharing. By default, all rows are enabled.
  620. Note. The lanes of a wavefront are organized in four *rows* and four *banks*.
  621. (There are only two rows in *wave32* mode.)
  622. ======================================== =====================================================
  623. Syntax Description
  624. ======================================== =====================================================
  625. row_mask:{0..15} Specifies a *row mask* as a positive
  626. :ref:`integer number <amdgpu_synid_integer_number>`.
  627. Each of 4 bits in the mask controls one
  628. row (0 - disabled, 1 - enabled).
  629. In *wave32* mode the values should be limited to
  630. {0..7}.
  631. ======================================== =====================================================
  632. Examples:
  633. .. parsed-literal::
  634. row_mask:0xf
  635. row_mask:0b1010
  636. row_mask:0b1111
  637. .. _amdgpu_synid_bank_mask:
  638. bank_mask
  639. ~~~~~~~~~
  640. Controls which banks are enabled for data sharing. By default, all banks are enabled.
  641. Note. The lanes of a wavefront are organized in four *rows* and four *banks*.
  642. (There are only two rows in *wave32* mode.)
  643. ======================================== =======================================================
  644. Syntax Description
  645. ======================================== =======================================================
  646. bank_mask:{0..15} Specifies a *bank mask* as a positive
  647. :ref:`integer number <amdgpu_synid_integer_number>`.
  648. Each of 4 bits in the mask controls one
  649. bank (0 - disabled, 1 - enabled).
  650. ======================================== =======================================================
  651. Examples:
  652. .. parsed-literal::
  653. bank_mask:0x3
  654. bank_mask:0b0011
  655. bank_mask:0b1111
  656. .. _amdgpu_synid_bound_ctrl:
  657. bound_ctrl
  658. ~~~~~~~~~~
  659. Controls data sharing when accessing an invalid lane. By default, data sharing with
  660. invalid lanes is disabled.
  661. ======================================== ================================================
  662. Syntax Description
  663. ======================================== ================================================
  664. bound_ctrl:0 Enables data sharing with invalid lanes.
  665. Accessing data from an invalid lane will
  666. return zero.
  667. ======================================== ================================================
  668. .. _amdgpu_synid_fi16:
  669. fi
  670. ~~
  671. Controls interaction with *inactive* lanes for *dpp16* instructions. The default value is zero.
  672. Note. *Inactive* lanes are those whose :ref:`exec<amdgpu_synid_exec>` mask bit is zero.
  673. GFX10 only.
  674. ======================================== ==================================================
  675. Syntax Description
  676. ======================================== ==================================================
  677. fi:0 Interaction with inactive lanes is controlled by
  678. :ref:`bound_ctrl<amdgpu_synid_bound_ctrl>`.
  679. fi:1 Fetch pre-exist values from inactive lanes.
  680. ======================================== ==================================================
  681. SDWA Modifiers
  682. --------------
  683. GFX8, GFX9 and GFX10 only.
  684. clamp
  685. ~~~~~
  686. See a description :ref:`here<amdgpu_synid_clamp>`.
  687. omod
  688. ~~~~
  689. See a description :ref:`here<amdgpu_synid_omod>`.
  690. GFX9 and GFX10 only.
  691. .. _amdgpu_synid_dst_sel:
  692. dst_sel
  693. ~~~~~~~
  694. Selects which bits in the destination are affected. By default, all bits are affected.
  695. ======================================== ================================================
  696. Syntax Description
  697. ======================================== ================================================
  698. dst_sel:DWORD Use bits 31:0.
  699. dst_sel:BYTE_0 Use bits 7:0.
  700. dst_sel:BYTE_1 Use bits 15:8.
  701. dst_sel:BYTE_2 Use bits 23:16.
  702. dst_sel:BYTE_3 Use bits 31:24.
  703. dst_sel:WORD_0 Use bits 15:0.
  704. dst_sel:WORD_1 Use bits 31:16.
  705. ======================================== ================================================
  706. .. _amdgpu_synid_dst_unused:
  707. dst_unused
  708. ~~~~~~~~~~
  709. Controls what to do with the bits in the destination which are not selected
  710. by :ref:`dst_sel<amdgpu_synid_dst_sel>`.
  711. By default, unused bits are preserved.
  712. ======================================== ================================================
  713. Syntax Description
  714. ======================================== ================================================
  715. dst_unused:UNUSED_PAD Pad with zeros.
  716. dst_unused:UNUSED_SEXT Sign-extend upper bits, zero lower bits.
  717. dst_unused:UNUSED_PRESERVE Preserve bits.
  718. ======================================== ================================================
  719. .. _amdgpu_synid_src0_sel:
  720. src0_sel
  721. ~~~~~~~~
  722. Controls which bits in the src0 are used. By default, all bits are used.
  723. ======================================== ================================================
  724. Syntax Description
  725. ======================================== ================================================
  726. src0_sel:DWORD Use bits 31:0.
  727. src0_sel:BYTE_0 Use bits 7:0.
  728. src0_sel:BYTE_1 Use bits 15:8.
  729. src0_sel:BYTE_2 Use bits 23:16.
  730. src0_sel:BYTE_3 Use bits 31:24.
  731. src0_sel:WORD_0 Use bits 15:0.
  732. src0_sel:WORD_1 Use bits 31:16.
  733. ======================================== ================================================
  734. .. _amdgpu_synid_src1_sel:
  735. src1_sel
  736. ~~~~~~~~
  737. Controls which bits in the src1 are used. By default, all bits are used.
  738. ======================================== ================================================
  739. Syntax Description
  740. ======================================== ================================================
  741. src1_sel:DWORD Use bits 31:0.
  742. src1_sel:BYTE_0 Use bits 7:0.
  743. src1_sel:BYTE_1 Use bits 15:8.
  744. src1_sel:BYTE_2 Use bits 23:16.
  745. src1_sel:BYTE_3 Use bits 31:24.
  746. src1_sel:WORD_0 Use bits 15:0.
  747. src1_sel:WORD_1 Use bits 31:16.
  748. ======================================== ================================================
  749. .. _amdgpu_synid_sdwa_operand_modifiers:
  750. SDWA Operand Modifiers
  751. ----------------------
  752. Operand modifiers are not used separately. They are applied to source operands.
  753. GFX8, GFX9 and GFX10 only.
  754. abs
  755. ~~~
  756. See a description :ref:`here<amdgpu_synid_abs>`.
  757. neg
  758. ~~~
  759. See a description :ref:`here<amdgpu_synid_neg>`.
  760. .. _amdgpu_synid_sext:
  761. sext
  762. ~~~~
  763. Sign-extends value of a (sub-dword) operand to fill all 32 bits.
  764. Has no effect for 32-bit operands.
  765. Valid for integer operands only.
  766. ======================================== ================================================
  767. Syntax Description
  768. ======================================== ================================================
  769. sext(<operand>) Sign-extend operand value.
  770. ======================================== ================================================
  771. Examples:
  772. .. parsed-literal::
  773. sext(v4)
  774. sext(v255)
  775. VOP3 Modifiers
  776. --------------
  777. .. _amdgpu_synid_vop3_op_sel:
  778. op_sel
  779. ~~~~~~
  780. Selects the low [15:0] or high [31:16] operand bits for source and destination operands.
  781. By default, low bits are used for all operands.
  782. The number of values specified with the op_sel modifier must match the number of instruction
  783. operands (both source and destination). First value controls src0, second value controls src1
  784. and so on, except that the last value controls destination.
  785. The value 0 selects the low bits, while 1 selects the high bits.
  786. Note. op_sel modifier affects 16-bit operands only. For 32-bit operands the value specified
  787. by op_sel must be 0.
  788. GFX9 and GFX10 only.
  789. ======================================== ============================================================
  790. Syntax Description
  791. ======================================== ============================================================
  792. op_sel:[{0..1},{0..1}] Select operand bits for instructions with 1 source operand.
  793. op_sel:[{0..1},{0..1},{0..1}] Select operand bits for instructions with 2 source operands.
  794. op_sel:[{0..1},{0..1},{0..1},{0..1}] Select operand bits for instructions with 3 source operands.
  795. ======================================== ============================================================
  796. Examples:
  797. .. parsed-literal::
  798. op_sel:[0,0]
  799. op_sel:[0,1]
  800. .. _amdgpu_synid_clamp:
  801. clamp
  802. ~~~~~
  803. Clamp meaning depends on instruction.
  804. For *v_cmp* instructions, clamp modifier indicates that the compare signals
  805. if a floating point exception occurs. By default, signaling is disabled.
  806. Not supported by GFX7.
  807. For integer operations, clamp modifier indicates that the result must be clamped
  808. to the largest and smallest representable value. By default, there is no clamping.
  809. Integer clamping is not supported by GFX7.
  810. For floating point operations, clamp modifier indicates that the result must be clamped
  811. to the range [0.0, 1.0]. By default, there is no clamping.
  812. Note. Clamp modifier is applied after :ref:`output modifiers<amdgpu_synid_omod>` (if any).
  813. ======================================== ================================================
  814. Syntax Description
  815. ======================================== ================================================
  816. clamp Enables clamping (or signaling).
  817. ======================================== ================================================
  818. .. _amdgpu_synid_omod:
  819. omod
  820. ~~~~
  821. Specifies if an output modifier must be applied to the result.
  822. By default, no output modifiers are applied.
  823. Note. Output modifiers are applied before :ref:`clamping<amdgpu_synid_clamp>` (if any).
  824. Output modifiers are valid for f32 and f64 floating point results only.
  825. They must not be used with f16.
  826. Note. *v_cvt_f16_f32* is an exception. This instruction produces f16 result
  827. but accepts output modifiers.
  828. ======================================== ================================================
  829. Syntax Description
  830. ======================================== ================================================
  831. mul:2 Multiply the result by 2.
  832. mul:4 Multiply the result by 4.
  833. div:2 Multiply the result by 0.5.
  834. ======================================== ================================================
  835. .. _amdgpu_synid_vop3_operand_modifiers:
  836. VOP3 Operand Modifiers
  837. ----------------------
  838. Operand modifiers are not used separately. They are applied to source operands.
  839. .. _amdgpu_synid_abs:
  840. abs
  841. ~~~
  842. Computes absolute value of its operand. Applied before :ref:`neg<amdgpu_synid_neg>` (if any).
  843. Valid for floating point operands only.
  844. ======================================== ================================================
  845. Syntax Description
  846. ======================================== ================================================
  847. abs(<operand>) Get absolute value of operand.
  848. \|<operand>| The same as above.
  849. ======================================== ================================================
  850. Examples:
  851. .. parsed-literal::
  852. abs(v36)
  853. \|v36|
  854. .. _amdgpu_synid_neg:
  855. neg
  856. ~~~
  857. Computes negative value of its operand. Applied after :ref:`abs<amdgpu_synid_abs>` (if any).
  858. Valid for floating point operands only.
  859. ======================================== ================================================
  860. Syntax Description
  861. ======================================== ================================================
  862. neg(<operand>) Get negative value of operand.
  863. -<operand> The same as above.
  864. ======================================== ================================================
  865. Examples:
  866. .. parsed-literal::
  867. neg(v[0])
  868. -v4
  869. VOP3P Modifiers
  870. ---------------
  871. This section describes modifiers of *regular* VOP3P instructions.
  872. *v_mad_mix_f32*, *v_mad_mixhi_f16* and *v_mad_mixlo_f16*
  873. instructions use these modifiers :ref:`in a special manner<amdgpu_synid_mad_mix>`.
  874. GFX9 and GFX10 only.
  875. .. _amdgpu_synid_op_sel:
  876. op_sel
  877. ~~~~~~
  878. Selects the low [15:0] or high [31:16] operand bits as input to the operation
  879. which results in the lower-half of the destination.
  880. By default, low bits are used for all operands.
  881. The number of values specified by the *op_sel* modifier must match the number of source
  882. operands. First value controls src0, second value controls src1 and so on.
  883. The value 0 selects the low bits, while 1 selects the high bits.
  884. ================================= =============================================================
  885. Syntax Description
  886. ================================= =============================================================
  887. op_sel:[{0..1}] Select operand bits for instructions with 1 source operand.
  888. op_sel:[{0..1},{0..1}] Select operand bits for instructions with 2 source operands.
  889. op_sel:[{0..1},{0..1},{0..1}] Select operand bits for instructions with 3 source operands.
  890. ================================= =============================================================
  891. Examples:
  892. .. parsed-literal::
  893. op_sel:[0,0]
  894. op_sel:[0,1,0]
  895. .. _amdgpu_synid_op_sel_hi:
  896. op_sel_hi
  897. ~~~~~~~~~
  898. Selects the low [15:0] or high [31:16] operand bits as input to the operation
  899. which results in the upper-half of the destination.
  900. By default, high bits are used for all operands.
  901. The number of values specified by the *op_sel_hi* modifier must match the number of source
  902. operands. First value controls src0, second value controls src1 and so on.
  903. The value 0 selects the low bits, while 1 selects the high bits.
  904. =================================== =============================================================
  905. Syntax Description
  906. =================================== =============================================================
  907. op_sel_hi:[{0..1}] Select operand bits for instructions with 1 source operand.
  908. op_sel_hi:[{0..1},{0..1}] Select operand bits for instructions with 2 source operands.
  909. op_sel_hi:[{0..1},{0..1},{0..1}] Select operand bits for instructions with 3 source operands.
  910. =================================== =============================================================
  911. Examples:
  912. .. parsed-literal::
  913. op_sel_hi:[0,0]
  914. op_sel_hi:[0,0,1]
  915. .. _amdgpu_synid_neg_lo:
  916. neg_lo
  917. ~~~~~~
  918. Specifies whether to change sign of operand values selected by
  919. :ref:`op_sel<amdgpu_synid_op_sel>`. These values are then used
  920. as input to the operation which results in the upper-half of the destination.
  921. The number of values specified by this modifier must match the number of source
  922. operands. First value controls src0, second value controls src1 and so on.
  923. The value 0 indicates that the corresponding operand value is used unmodified,
  924. the value 1 indicates that negative value of the operand must be used.
  925. By default, operand values are used unmodified.
  926. This modifier is valid for floating point operands only.
  927. ================================ ==================================================================
  928. Syntax Description
  929. ================================ ==================================================================
  930. neg_lo:[{0..1}] Select affected operands for instructions with 1 source operand.
  931. neg_lo:[{0..1},{0..1}] Select affected operands for instructions with 2 source operands.
  932. neg_lo:[{0..1},{0..1},{0..1}] Select affected operands for instructions with 3 source operands.
  933. ================================ ==================================================================
  934. Examples:
  935. .. parsed-literal::
  936. neg_lo:[0]
  937. neg_lo:[0,1]
  938. .. _amdgpu_synid_neg_hi:
  939. neg_hi
  940. ~~~~~~
  941. Specifies whether to change sign of operand values selected by
  942. :ref:`op_sel_hi<amdgpu_synid_op_sel_hi>`. These values are then used
  943. as input to the operation which results in the upper-half of the destination.
  944. The number of values specified by this modifier must match the number of source
  945. operands. First value controls src0, second value controls src1 and so on.
  946. The value 0 indicates that the corresponding operand value is used unmodified,
  947. the value 1 indicates that negative value of the operand must be used.
  948. By default, operand values are used unmodified.
  949. This modifier is valid for floating point operands only.
  950. =============================== ==================================================================
  951. Syntax Description
  952. =============================== ==================================================================
  953. neg_hi:[{0..1}] Select affected operands for instructions with 1 source operand.
  954. neg_hi:[{0..1},{0..1}] Select affected operands for instructions with 2 source operands.
  955. neg_hi:[{0..1},{0..1},{0..1}] Select affected operands for instructions with 3 source operands.
  956. =============================== ==================================================================
  957. Examples:
  958. .. parsed-literal::
  959. neg_hi:[1,0]
  960. neg_hi:[0,1,1]
  961. clamp
  962. ~~~~~
  963. See a description :ref:`here<amdgpu_synid_clamp>`.
  964. .. _amdgpu_synid_mad_mix:
  965. VOP3P V_MAD_MIX Modifiers
  966. -------------------------
  967. *v_mad_mix_f32*, *v_mad_mixhi_f16* and *v_mad_mixlo_f16* instructions
  968. use *op_sel* and *op_sel_hi* modifiers
  969. in a manner different from *regular* VOP3P instructions.
  970. See a description below.
  971. GFX9 and GFX10 only.
  972. .. _amdgpu_synid_mad_mix_op_sel:
  973. m_op_sel
  974. ~~~~~~~~
  975. This operand has meaning only for 16-bit source operands as indicated by
  976. :ref:`m_op_sel_hi<amdgpu_synid_mad_mix_op_sel_hi>`.
  977. It specifies to select either the low [15:0] or high [31:16] operand bits
  978. as input to the operation.
  979. The number of values specified by the *op_sel* modifier must match the number of source
  980. operands. First value controls src0, second value controls src1 and so on.
  981. The value 0 indicates the low bits, the value 1 indicates the high 16 bits.
  982. By default, low bits are used for all operands.
  983. =============================== ================================================
  984. Syntax Description
  985. =============================== ================================================
  986. op_sel:[{0..1},{0..1},{0..1}] Select location of each 16-bit source operand.
  987. =============================== ================================================
  988. Examples:
  989. .. parsed-literal::
  990. op_sel:[0,1]
  991. .. _amdgpu_synid_mad_mix_op_sel_hi:
  992. m_op_sel_hi
  993. ~~~~~~~~~~~
  994. Selects the size of source operands: either 32 bits or 16 bits.
  995. By default, 32 bits are used for all source operands.
  996. The number of values specified by the *op_sel_hi* modifier must match the number of source
  997. operands. First value controls src0, second value controls src1 and so on.
  998. The value 0 indicates 32 bits, the value 1 indicates 16 bits.
  999. The location of 16 bits in the operand may be specified by
  1000. :ref:`m_op_sel<amdgpu_synid_mad_mix_op_sel>`.
  1001. ======================================== ====================================
  1002. Syntax Description
  1003. ======================================== ====================================
  1004. op_sel_hi:[{0..1},{0..1},{0..1}] Select size of each source operand.
  1005. ======================================== ====================================
  1006. Examples:
  1007. .. parsed-literal::
  1008. op_sel_hi:[1,1,1]
  1009. abs
  1010. ~~~
  1011. See a description :ref:`here<amdgpu_synid_abs>`.
  1012. neg
  1013. ~~~
  1014. See a description :ref:`here<amdgpu_synid_neg>`.
  1015. clamp
  1016. ~~~~~
  1017. See a description :ref:`here<amdgpu_synid_clamp>`.