Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/gpu/amd/bench/barrier/seq.s # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / gpu / amd / bench / barrier / seq.s` 62 lines ยท 2366 bytes Raw Blame History 1 // gfx942 barrier encodings for the persistent-kernel micro-benchmark. 2 // Data, not a kernel. The Omega gate feeds this file to: 3 // llvm-mc-18 -triple=amdgcn -mcpu=gfx942 -show-encoding 4 // and requires the bytes to match seq.enc. 5 // 6 // Sequences are the GFX942 rows of the table "AMDHSA Memory Model Code Sequences 7 // GFX940, GFX941, GFX942" in LLVM AMDGPUUsage at llvmorg-20.1.0 8 // (llvm/docs/AMDGPUUsage.rst, section "Memory Model GFX942"). 9 // Release puts buffer_wbl2 first, then s_waitcnt, then the atomic. 10 // Acquire puts the atomic, then s_waitcnt vmcnt(0), then buffer_inv. 11 // 12 // The agent-release step 3 in that table is "buffer/global/flat_atomic sc1=1" 13 // with no sc0. CDNA3 ISA 9.1.10.2 says SC0=1 returns the previous value and 14 // SC1=0 is device scope. A sense-reversing barrier needs the ticket, so the 15 // ticket lines below set sc0 and are not the LLVM step-3 spelling. Both are 16 // assembled here. Do not copy the branch offsets at the bottom as a spin loop. 17 18 .text 19 20 // atomicrmw release, agent, global. LLVM steps 1, 2, 3. 21 buffer_wbl2 sc1 22 s_waitcnt vmcnt(0) lgkmcnt(0) 23 buffer_atomic_add v0, off, s[0:3], 0 sc1 24 25 // atomicrmw release, system, global. LLVM steps 1, 2, 3. 26 buffer_wbl2 sc0 sc1 27 s_waitcnt vmcnt(0) lgkmcnt(0) 28 buffer_atomic_add v0, off, s[0:3], 0 sc0 sc1 29 30 // atomicrmw acquire, agent, global. LLVM steps 1, 2, 3. 31 buffer_atomic_add v0, off, s[0:3], 0 32 s_waitcnt vmcnt(0) 33 buffer_inv sc1 34 35 // atomicrmw acquire, system, global. LLVM steps 1, 2, 3. 36 buffer_atomic_add v0, off, s[0:3], 0 sc1 37 s_waitcnt vmcnt(0) 38 buffer_inv sc0 sc1 39 40 // Ticket atomics. ISA SC0 returns the pre-op value. SC1=0 device, SC1=1 system. 41 // NT=1 is "no Allocate" in the last-level cache (MALL). NT=0 allocates. 42 buffer_atomic_add v0, off, s[0:3], 0 sc0 43 buffer_atomic_add v0, off, s[0:3], 0 sc0 nt 44 buffer_atomic_add v0, off, s[0:3], 0 sc0 sc1 45 buffer_atomic_add v0, off, s[0:3], 0 sc0 nt sc1 46 47 // CDNA3 ISA 8.2.5 S_MEMREALTIME. Fixed 100 MHz, not the core clock. 48 s_memrealtime s[0:1] 49 s_memrealtime s[2:3] 50 s_waitcnt lgkmcnt(0) 51 52 // 64-bit unsigned compare pieces (now in s[2:3], deadline in s[4:5]). 53 // Offsets below reach the two s_endpgm labels in THIS fragment only. 54 // A device spin branches back to s_memrealtime instead of the second s_endpgm. 55 s_cmp_lt_u32 s3, s5 56 s_cbranch_scc1 5 57 s_cmp_eq_u32 s3, s5 58 s_cbranch_scc0 2 59 s_cmp_lt_u32 s2, s4 60 s_cbranch_scc1 1 61 s_endpgm 62 s_endpgm