interplane.Get Omega
Read in your language

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

branch main Branches Tags History

CUDApp / backend / amd / gfx942 / fsum16-gfx942.s

75 lines · 2249 bytes Raw Blame History
1// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2// Independent LLVM 18.1.3 oracle only: never input to hsaco.om or the executor.
3// fsum16: frozen left-to-right binary32 reduction of 16 inputs per row, g<n.
4// Kernarg x @0, o @8, n @16 (20 bytes); wave64, local size 64. Hardware NOT_RUN.
5.amdgcn_target "amdgcn-amd-amdhsa--gfx942"
6.text
7.globl fsum16
8.p2align 8
9.type fsum16,@function
10fsum16:
11 s_load_dwordx4 s[4:7], s[0:1], 0
12 s_load_dword s8, s[0:1], 16
13 v_and_b32 v0, 0x3ff, v0
14 s_lshl_b32 s9, s2, 6
15 v_add_u32 v1, s9, v0
16 s_waitcnt lgkmcnt(0)
17 v_cmp_gt_u32 vcc, s8, v1
18 s_and_saveexec_b64 s[10:11], vcc
19 s_cbranch_execz .Lend
20 v_lshlrev_b32 v2, 6, v1
21 v_lshrrev_b32 v3, 26, v1
22 v_mov_b32 v5, s5
23 v_add_co_u32 v6, vcc, s4, v2
24 v_addc_co_u32 v7, vcc, v5, v3, vcc
25 global_load_dword v4, v[6:7], off
26 s_waitcnt vmcnt(0)
27.irp offset,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60
28 global_load_dword v8, v[6:7], off offset:\offset
29 s_waitcnt vmcnt(0)
30 v_add_f32 v4, v4, v8
31.endr
32 v_lshlrev_b32 v2, 2, v1
33 v_lshrrev_b32 v3, 30, v1
34 v_mov_b32 v5, s7
35 v_add_co_u32 v6, vcc, s6, v2
36 v_addc_co_u32 v7, vcc, v5, v3, vcc
37 global_store_dword v[6:7], v4, off
38.Lend:
39 s_endpgm
40.Lfsum16_end:
41.size fsum16, .Lfsum16_end-fsum16
42.rodata
43.p2align 6
44.amdhsa_kernel fsum16
45 .amdhsa_user_sgpr_kernarg_segment_ptr 1
46 .amdhsa_system_sgpr_workgroup_id_x 1
47 .amdhsa_system_vgpr_workitem_id 0
48 .amdhsa_kernarg_size 20
49 .amdhsa_next_free_vgpr 9
50 .amdhsa_next_free_sgpr 12
51 .amdhsa_accum_offset 12
52 .amdhsa_float_denorm_mode_32 3
53.end_amdhsa_kernel
54.amdgpu_metadata
55---
56amdhsa.version: [ 1, 2 ]
57amdhsa.target: amdgcn-amd-amdhsa--gfx942
58amdhsa.kernels:
59 - .name: fsum16
60 .symbol: fsum16.kd
61 .kernarg_segment_size: 20
62 .kernarg_segment_align: 8
63 .group_segment_fixed_size: 0
64 .private_segment_fixed_size: 0
65 .wavefront_size: 64
66 .sgpr_count: 18
67 .vgpr_count: 9
68 .agpr_count: 0
69 .max_flat_workgroup_size: 64
70 .args:
71 - { .name: x, .offset: 0, .size: 8, .value_kind: global_buffer, .address_space: global }
72 - { .name: o, .offset: 8, .size: 8, .value_kind: global_buffer, .address_space: global }
73 - { .name: !str n, .offset: 16, .size: 4, .value_kind: by_value }
74...
75.end_amdgpu_metadata