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/sgemm-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 / sgemm-gfx942.s` 104 lines · 3092 bytes Raw Blame History 1 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 // Independent LLVM18 oracle, never producer/executor input. Hardware NOT_RUN. 3 // Row-major C[M,N] = A[M,K]*B[K,N]; increasing-k single-rounded fmac. 4 .amdgcn_target "amdgcn-amd-amdhsa--gfx942" 5 .text 6 .globl sgemm 7 .p2align 8 8 .type sgemm,@function 9 sgemm: 10 s_load_dwordx4 s[4:7], s[0:1], 0 11 s_load_dwordx2 s[8:9], s[0:1], 16 12 s_load_dwordx2 s[10:11], s[0:1], 24 13 s_load_dword s12, s[0:1], 32 14 v_and_b32 v0, 0x3ff, v0 15 s_waitcnt lgkmcnt(0) 16 s_sub_u32 s14, s3, s10 17 s_cbranch_scc0 .Lend 18 s_lshl_b32 s14, s2, 6 19 v_add_u32 v1, s14, v0 20 v_cmp_gt_u32 vcc, s11, v1 21 s_and_saveexec_b64 s[20:21], vcc 22 s_cbranch_execz .Lend 23 v_lshlrev_b32 v2, 2, v1 24 v_lshrrev_b32 v3, 30, v1 25 s_mul_i32 s14, s3, s12 26 s_mul_hi_u32 s15, s3, s12 27 s_lshl_b64 s[14:15], s[14:15], 2 28 s_add_u32 s14, s14, s4 29 s_addc_u32 s15, s15, s5 30 v_mov_b32 v8, s14 31 v_mov_b32 v9, s15 32 v_mov_b32 v7, s7 33 v_add_co_u32 v10, vcc, s6, v2 34 v_addc_co_u32 v11, vcc, v7, v3, vcc 35 s_mul_i32 s16, s3, s11 36 s_mul_hi_u32 s17, s3, s11 37 s_lshl_b64 s[16:17], s[16:17], 2 38 s_add_u32 s16, s16, s8 39 s_addc_u32 s17, s17, s9 40 v_mov_b32 v7, s17 41 v_add_co_u32 v12, vcc, s16, v2 42 v_addc_co_u32 v13, vcc, v7, v3, vcc 43 s_mov_b32 s18, s11 44 s_mov_b32 s19, 0 45 s_lshl_b64 s[18:19], s[18:19], 2 46 v_mov_b32 v7, s19 47 v_mov_b32 v4, 0 48 s_sub_u32 s13, s12, 1 49 s_cbranch_scc1 .Lstore 50 .Lloop: 51 global_load_dword v14, v[8:9], off 52 global_load_dword v6, v[10:11], off 53 s_waitcnt vmcnt(0) 54 v_fmac_f32 v4, v14, v6 55 v_add_co_u32 v8, vcc, 4, v8 56 v_addc_co_u32 v9, vcc, 0, v9, vcc 57 v_add_co_u32 v10, vcc, s18, v10 58 v_addc_co_u32 v11, vcc, v7, v11, vcc 59 s_sub_u32 s13, s13, 1 60 s_cbranch_scc0 .Lloop 61 .Lstore: 62 global_store_dword v[12:13], v4, off 63 .Lend: 64 s_endpgm 65 .Lsgemm_end: 66 .size sgemm, .Lsgemm_end-sgemm 67 .rodata 68 .p2align 6 69 .amdhsa_kernel sgemm 70 .amdhsa_user_sgpr_kernarg_segment_ptr 1 71 .amdhsa_system_sgpr_workgroup_id_x 1 72 .amdhsa_system_sgpr_workgroup_id_y 1 73 .amdhsa_system_vgpr_workitem_id 0 74 .amdhsa_kernarg_size 36 75 .amdhsa_next_free_vgpr 15 76 .amdhsa_next_free_sgpr 22 77 .amdhsa_accum_offset 16 78 .amdhsa_float_denorm_mode_32 3 79 .end_amdhsa_kernel 80 .amdgpu_metadata 81 --- 82 amdhsa.version: [ 1, 2 ] 83 amdhsa.target: amdgcn-amd-amdhsa--gfx942 84 amdhsa.kernels: 85 - .name: sgemm 86 .symbol: sgemm.kd 87 .kernarg_segment_size: 36 88 .kernarg_segment_align: 8 89 .group_segment_fixed_size: 0 90 .private_segment_fixed_size: 0 91 .wavefront_size: 64 92 .sgpr_count: 28 93 .vgpr_count: 15 94 .agpr_count: 0 95 .max_flat_workgroup_size: 64 96 .args: 97 - { .name: A, .offset: 0, .size: 8, .value_kind: global_buffer, .address_space: global } 98 - { .name: B, .offset: 8, .size: 8, .value_kind: global_buffer, .address_space: global } 99 - { .name: C, .offset: 16, .size: 8, .value_kind: global_buffer, .address_space: global } 100 - { .name: M, .offset: 24, .size: 4, .value_kind: by_value } 101 - { .name: !str N, .offset: 28, .size: 4, .value_kind: by_value } 102 - { .name: K, .offset: 32, .size: 4, .value_kind: by_value } 103 ... 104 .end_amdgpu_metadata