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
CUDApp / backend / amd / gfx942 / vadd-gfx942.s
| 1 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | // vadd-gfx942.s: ORACLE input, never read by the producer. The first-party code object is written by |
| 3 | // backend/amd/gfx942/hsaco.om (seeded Omega) from the instruction table backend/amd/gfx942/vadd.isa. |
| 4 | // Only tests/amd/run.sh assembles this file, with llvm-mc-18 -triple=amdgcn-amd-amdhsa -mcpu=gfx942 |
| 5 | // -filetype=obj, into a relocatable object. No linker is installed on the Spark (no ld.lld), so the |
| 6 | // gate compares sections (.text bytes, the objdump listing, the kernel descriptor apart from its |
| 7 | // relocated entry offset, and the metadata note), not whole linked files. |
| 8 | // Copied from the ended t_bd34e75b lane's untracked backend/amd/gfx942/vadd-gfx942.s. The address |
| 9 | // path now computes full 64-bit addresses: the old gid<<2 in a single VGPR lost the high bits. |
| 10 | // Hardware NOT_RUN: no AMD GPU on this host. |
| 11 | // FP32 c[gid] = a[gid] + b[gid] for gid < count; 64 work-items per group (one wave64 on CDNA3). |
| 12 | // Kernarg layout (same as backend/amd/vadd-gfx1151.s): a @0, b @8, c @16 (global float pointers), |
| 13 | // count @24 (uint), 28 bytes. SGPR inputs: s[0:1] kernarg segment pointer, s2 workgroup id x. |
| 14 | // VGPR input: v0 work-item ids packed 10 bits each (x in bits 0..9). |
| 15 | .amdgcn_target "amdgcn-amd-amdhsa--gfx942" |
| 16 | .text |
| 17 | .globl vadd |
| 18 | .p2align 8 |
| 19 | .type vadd,@function |
| 20 | vadd: |
| 21 | s_load_dwordx4 s[4:7], s[0:1], 0x0 |
| 22 | s_load_dwordx2 s[8:9], s[0:1], 0x10 |
| 23 | s_load_dword s10, s[0:1], 0x18 |
| 24 | v_and_b32 v0, 0x3ff, v0 |
| 25 | s_lshl_b32 s11, s2, 6 |
| 26 | v_add_u32 v1, s11, v0 |
| 27 | s_waitcnt lgkmcnt(0) |
| 28 | v_cmp_gt_u32 vcc, s10, v1 |
| 29 | s_and_saveexec_b64 s[12:13], vcc |
| 30 | s_cbranch_execz .Lend |
| 31 | v_lshlrev_b32 v2, 2, v1 |
| 32 | v_lshrrev_b32 v3, 30, v1 |
| 33 | v_mov_b32 v5, s5 |
| 34 | v_add_co_u32 v6, vcc, s4, v2 |
| 35 | v_addc_co_u32 v7, vcc, v5, v3, vcc |
| 36 | global_load_dword v4, v[6:7], off |
| 37 | v_mov_b32 v5, s7 |
| 38 | v_add_co_u32 v6, vcc, s6, v2 |
| 39 | v_addc_co_u32 v7, vcc, v5, v3, vcc |
| 40 | global_load_dword v8, v[6:7], off |
| 41 | s_waitcnt vmcnt(0) |
| 42 | v_add_f32 v4, v4, v8 |
| 43 | v_mov_b32 v5, s9 |
| 44 | v_add_co_u32 v6, vcc, s8, v2 |
| 45 | v_addc_co_u32 v7, vcc, v5, v3, vcc |
| 46 | global_store_dword v[6:7], v4, off |
| 47 | .Lend: |
| 48 | s_endpgm |
| 49 | .Lvadd_end: |
| 50 | .size vadd, .Lvadd_end-vadd |
| 51 | |
| 52 | .rodata |
| 53 | .p2align 6 |
| 54 | .amdhsa_kernel vadd |
| 55 | .amdhsa_user_sgpr_kernarg_segment_ptr 1 |
| 56 | .amdhsa_system_sgpr_workgroup_id_x 1 |
| 57 | .amdhsa_system_vgpr_workitem_id 0 |
| 58 | .amdhsa_kernarg_size 28 |
| 59 | .amdhsa_next_free_vgpr 9 |
| 60 | .amdhsa_next_free_sgpr 14 |
| 61 | .amdhsa_accum_offset 12 |
| 62 | .amdhsa_float_denorm_mode_32 3 |
| 63 | .end_amdhsa_kernel |
| 64 | |
| 65 | .amdgpu_metadata |
| 66 | --- |
| 67 | amdhsa.version: [ 1, 2 ] |
| 68 | amdhsa.target: amdgcn-amd-amdhsa--gfx942 |
| 69 | amdhsa.kernels: |
| 70 | - .name: vadd |
| 71 | .symbol: vadd.kd |
| 72 | .kernarg_segment_size: 28 |
| 73 | .kernarg_segment_align: 8 |
| 74 | .group_segment_fixed_size: 0 |
| 75 | .private_segment_fixed_size: 0 |
| 76 | .wavefront_size: 64 |
| 77 | .sgpr_count: 20 |
| 78 | .vgpr_count: 9 |
| 79 | .agpr_count: 0 |
| 80 | .max_flat_workgroup_size: 64 |
| 81 | .args: |
| 82 | - { .name: a, .offset: 0, .size: 8, .value_kind: global_buffer, .address_space: global } |
| 83 | - { .name: b, .offset: 8, .size: 8, .value_kind: global_buffer, .address_space: global } |
| 84 | - { .name: c, .offset: 16, .size: 8, .value_kind: global_buffer, .address_space: global } |
| 85 | - { .name: count, .offset: 24, .size: 4, .value_kind: by_value } |
| 86 | ... |
| 87 | .end_amdgpu_metadata |