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/CUDApp/blob/main/backend/amd/gfx942/gdnstate-gfx942.s # CUDApp CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `CUDApp / backend / amd / gfx942 / gdnstate-gfx942.s` 237 lines · 6394 bytes Raw Blame History 1 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 // LLVM18 independent encoding oracle only. 3 .amdgcn_target "amdgcn-amd-amdhsa--gfx942" 4 .text 5 .globl gdnstate 6 .p2align 8 7 .type gdnstate,@function 8 gdnstate: 9 s_load_dwordx4 s[4:7], s[0:1], 0 10 s_load_dwordx4 s[8:11], s[0:1], 16 11 s_load_dwordx4 s[12:15], s[0:1], 32 12 s_load_dwordx2 s[16:17], s[0:1], 48 13 s_waitcnt lgkmcnt(0) 14 s_sub_u32 s28, s2, 3 15 s_cbranch_scc0 .L99 16 s_sub_u32 s28, s3, 16 17 s_cbranch_scc0 .L99 18 s_mul_i32 s28, s3, 3 19 s_add_u32 s28, s28, s2 20 v_and_b32 v0, 0x3ff, v0 21 v_lshlrev_b32 v1, 2, v0 22 s_lshl_b32 s29, s28, 16 23 v_add_u32 v2, s29, v1 24 v_mov_b32 v3, 0 25 v_mov_b32 v4, v2 26 v_mov_b32 v5, 0 27 v_mov_b32 v27, s9 28 v_add_co_u32 v2, vcc, s8, v2 29 v_addc_co_u32 v3, vcc, v27, v3, vcc 30 v_mov_b32 v27, s11 31 v_add_co_u32 v4, vcc, s10, v4 32 v_addc_co_u32 v5, vcc, v27, v5, vcc 33 v_mov_b32 v30, v4 34 v_mov_b32 v31, v5 35 s_lshl_b32 s29, s3, 9 36 v_mov_b32 v6, s29 37 v_mov_b32 v7, 0 38 v_mov_b32 v8, v6 39 v_mov_b32 v9, 0 40 v_mov_b32 v27, s5 41 v_add_co_u32 v6, vcc, s4, v6 42 v_addc_co_u32 v7, vcc, v27, v7, vcc 43 v_add_co_u32 v6, vcc, 0x2000, v6 44 v_addc_co_u32 v7, vcc, 0, v7, vcc 45 v_mov_b32 v27, s5 46 v_add_co_u32 v8, vcc, s4, v8 47 v_addc_co_u32 v9, vcc, v27, v9, vcc 48 s_lshl_b32 s29, s28, 9 49 v_add_u32 v10, s29, v1 50 v_mov_b32 v11, 0 51 v_mov_b32 v12, v10 52 v_mov_b32 v13, 0 53 v_mov_b32 v27, s7 54 v_add_co_u32 v10, vcc, s6, v10 55 v_addc_co_u32 v11, vcc, v27, v11, vcc 56 v_mov_b32 v27, s13 57 v_add_co_u32 v12, vcc, s12, v12 58 v_addc_co_u32 v13, vcc, v27, v13, vcc 59 s_lshl_b32 s29, s28, 2 60 v_mov_b32 v14, s29 61 v_mov_b32 v15, 0 62 v_mov_b32 v27, s15 63 v_add_co_u32 v14, vcc, s14, v14 64 v_addc_co_u32 v15, vcc, v27, v15, vcc 65 global_load_dword v20, v[14:15], off 66 v_mov_b32 v14, s29 67 v_mov_b32 v15, 0 68 v_mov_b32 v27, s17 69 v_add_co_u32 v14, vcc, s16, v14 70 v_addc_co_u32 v15, vcc, v27, v15, vcc 71 global_load_dword v21, v[14:15], off 72 global_load_dword v18, v[10:11], off 73 global_load_dword v19, v[10:11], off offset:256 74 s_waitcnt vmcnt(0) 75 v_mov_b32 v22, 0 76 v_mov_b32 v23, 0 77 s_mov_b32 s18, 127 78 .L10: 79 global_load_dword v16, v[2:3], off 80 global_load_dword v17, v[2:3], off offset:256 81 global_load_dword v24, v[6:7], off 82 s_waitcnt vmcnt(0) 83 v_mul_f32 v16, v20, v16 84 v_mul_f32 v17, v20, v17 85 v_mul_f32 v26, v24, v16 86 v_add_f32 v22, v26, v22 87 v_mul_f32 v26, v24, v17 88 v_add_f32 v23, v26, v23 89 global_store_dword v[4:5], v16, off 90 global_store_dword v[4:5], v17, off offset:256 91 v_add_co_u32 v2, vcc, 0x200, v2 92 v_addc_co_u32 v3, vcc, 0, v3, vcc 93 v_add_co_u32 v4, vcc, 0x200, v4 94 v_addc_co_u32 v5, vcc, 0, v5, vcc 95 v_add_co_u32 v6, vcc, 4, v6 96 v_addc_co_u32 v7, vcc, 0, v7, vcc 97 s_sub_u32 s18, s18, 1 98 s_cbranch_scc0 .L10 99 s_waitcnt vmcnt(0) 100 v_sub_f32 v18, v18, v22 101 v_mul_f32 v18, v21, v18 102 v_sub_f32 v19, v19, v23 103 v_mul_f32 v19, v21, v19 104 v_mov_b32 v4, v30 105 v_mov_b32 v5, v31 106 v_mov_b32 v6, v8 107 v_mov_b32 v7, v9 108 v_add_co_u32 v6, vcc, 0x2000, v6 109 v_addc_co_u32 v7, vcc, 0, v7, vcc 110 v_mov_b32 v22, 0 111 v_mov_b32 v23, 0 112 s_mov_b32 s18, 127 113 .L20: 114 global_load_dword v16, v[4:5], off 115 global_load_dword v17, v[4:5], off offset:256 116 global_load_dword v24, v[6:7], off 117 global_load_dword v25, v[8:9], off 118 s_waitcnt vmcnt(0) 119 v_mul_f32 v26, v24, v18 120 v_add_f32 v16, v26, v16 121 v_mul_f32 v26, v24, v19 122 v_add_f32 v17, v26, v17 123 v_mul_f32 v26, v25, v16 124 v_add_f32 v22, v26, v22 125 v_mul_f32 v26, v25, v17 126 v_add_f32 v23, v26, v23 127 global_store_dword v[4:5], v16, off 128 global_store_dword v[4:5], v17, off offset:256 129 v_add_co_u32 v4, vcc, 0x200, v4 130 v_addc_co_u32 v5, vcc, 0, v5, vcc 131 v_add_co_u32 v6, vcc, 4, v6 132 v_addc_co_u32 v7, vcc, 0, v7, vcc 133 v_add_co_u32 v8, vcc, 4, v8 134 v_addc_co_u32 v9, vcc, 0, v9, vcc 135 s_sub_u32 s18, s18, 1 136 s_cbranch_scc0 .L20 137 // BF16_ROUND_CORE0 138 v_lshrrev_b32 v28, 16, v22 139 v_and_b32 v28, 1, v28 140 v_add_u32 v28, 0x7fff, v28 141 v_add_u32 v28, v22, v28 142 v_and_b32 v28, 0xffff0000, v28 143 v_and_b32 v29, 0x7fffffff, v22 144 v_mov_b32 v30, 0x7f800000 145 v_cmp_gt_u32 vcc, v29, v30 146 s_and_saveexec_b64 s[24:25], vcc 147 v_mov_b32 v28, 0x7fc00000 148 s_mov_b64 exec, s[24:25] 149 v_mov_b32 v22, v28 150 // END_BF16_ROUND_CORE0 151 global_store_dword v[12:13], v22, off 152 // BF16_ROUND_CORE1 153 v_lshrrev_b32 v28, 16, v23 154 v_and_b32 v28, 1, v28 155 v_add_u32 v28, 0x7fff, v28 156 v_add_u32 v28, v23, v28 157 v_and_b32 v28, 0xffff0000, v28 158 v_and_b32 v29, 0x7fffffff, v23 159 v_mov_b32 v30, 0x7f800000 160 v_cmp_gt_u32 vcc, v29, v30 161 s_and_saveexec_b64 s[24:25], vcc 162 v_mov_b32 v28, 0x7fc00000 163 s_mov_b64 exec, s[24:25] 164 v_mov_b32 v23, v28 165 // END_BF16_ROUND_CORE1 166 global_store_dword v[12:13], v23, off offset:256 167 .L99: 168 s_endpgm 169 .Lgdnstate_end: 170 .size gdnstate, .Lgdnstate_end-gdnstate 171 .rodata 172 .p2align 6 173 .amdhsa_kernel gdnstate 174 .amdhsa_user_sgpr_kernarg_segment_ptr 1 175 .amdhsa_system_sgpr_workgroup_id_x 1 176 .amdhsa_system_sgpr_workgroup_id_y 1 177 .amdhsa_system_vgpr_workitem_id 0 178 .amdhsa_kernarg_size 56 179 .amdhsa_next_free_vgpr 32 180 .amdhsa_next_free_sgpr 29 181 .amdhsa_accum_offset 32 182 .amdhsa_float_denorm_mode_32 3 183 .end_amdhsa_kernel 184 .amdgpu_metadata 185 --- 186 amdhsa.version: [ 1, 2 ] 187 amdhsa.target: amdgcn-amd-amdhsa--gfx942 188 amdhsa.kernels: 189 - .name: gdnstate 190 .symbol: gdnstate.kd 191 .kernarg_segment_size: 56 192 .kernarg_segment_align: 8 193 .group_segment_fixed_size: 0 194 .private_segment_fixed_size: 0 195 .wavefront_size: 64 196 .sgpr_count: 35 197 .vgpr_count: 32 198 .agpr_count: 0 199 .max_flat_workgroup_size: 64 200 .args: 201 - .name: qk 202 .offset: 0 203 .size: 8 204 .value_kind: global_buffer 205 .address_space: global 206 - .name: value 207 .offset: 8 208 .size: 8 209 .value_kind: global_buffer 210 .address_space: global 211 - .name: oldstate 212 .offset: 16 213 .size: 8 214 .value_kind: global_buffer 215 .address_space: global 216 - .name: newstate 217 .offset: 24 218 .size: 8 219 .value_kind: global_buffer 220 .address_space: global 221 - .name: output 222 .offset: 32 223 .size: 8 224 .value_kind: global_buffer 225 .address_space: global 226 - .name: decay 227 .offset: 40 228 .size: 8 229 .value_kind: global_buffer 230 .address_space: global 231 - .name: beta 232 .offset: 48 233 .size: 8 234 .value_kind: global_buffer 235 .address_space: global 236 ... 237 .end_amdgpu_metadata