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 / compat / cuda / fixture / vadd_u32.ptx

43 lines · 1176 bytes Raw Blame History
1// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2// CUDApp#184 C0 fixture kernel. Hand-authored from the public PTX ISA (PROVENANCE class A);
3// this file is not compiler output. c[i] = a[i] + b[i] modulo 2^32 for i < n, nothing for i >= n.
4// Parameters: three global-space byte addresses (u64) and the element count (u32).
5.version 8.0
6.target sm_80
7.address_size 64
8
9.visible .entry vadd_u32(
10 .param .u64 vadd_u32_a,
11 .param .u64 vadd_u32_b,
12 .param .u64 vadd_u32_c,
13 .param .u32 vadd_u32_n
14)
15{
16 .reg .pred %p<2>;
17 .reg .b32 %r<8>;
18 .reg .b64 %rd<11>;
19
20 ld.param.u64 %rd1, [vadd_u32_a];
21 ld.param.u64 %rd2, [vadd_u32_b];
22 ld.param.u64 %rd3, [vadd_u32_c];
23 ld.param.u32 %r1, [vadd_u32_n];
24 mov.u32 %r2, %ctaid.x;
25 mov.u32 %r3, %ntid.x;
26 mov.u32 %r4, %tid.x;
27 mad.lo.u32 %r5, %r2, %r3, %r4;
28 setp.ge.u32 %p1, %r5, %r1;
29 @%p1 bra DONE;
30 cvta.to.global.u64 %rd4, %rd1;
31 cvta.to.global.u64 %rd5, %rd2;
32 cvta.to.global.u64 %rd6, %rd3;
33 mul.wide.u32 %rd7, %r5, 4;
34 add.s64 %rd8, %rd4, %rd7;
35 add.s64 %rd9, %rd5, %rd7;
36 add.s64 %rd10, %rd6, %rd7;
37 ld.global.u32 %r6, [%rd8];
38 ld.global.u32 %r7, [%rd9];
39 add.u32 %r6, %r6, %r7;
40 st.global.u32 [%rd10], %r6;
41DONE:
42 ret;
43}