system stringclasses 7 values | input stringlengths 10 94.5k | output stringlengths 14 55.5k |
|---|---|---|
You are a helpful coding assistant specialized in converting HIP source code to AMD device assembly. | #include <hip/hip_runtime.h>
#include <stdio.h>
// Size of array
#define N 1048576
// Kernel
__global__ void add_vectors(int *a, int *b, int *c)
{
int id = blockDim.x * blockIdx.x + threadIdx.x;
if(id < N) c[id] = a[id] + b[id];
}
// Main program
int main()
{
// Number of bytes to allocate for N integers
size_t bytes = N*sizeof(int);
// Allocate memory for arrays A, B, and C on host
int *A = (int*)malloc(bytes);
int *B = (int*)malloc(bytes);
int *C = (int*)malloc(bytes);
// Allocate memory for arrays d_A, d_B, and d_C on device
int *d_A, *d_B, *d_C;
hipMalloc(&d_A, bytes);
hipMalloc(&d_B, bytes);
hipMalloc(&d_C, bytes);
// Fill host arrays A and B
for(int i=0; i<N; i++)
{
A[i] = 1;
B[i] = 2;
}
// Copy data from host arrays A and B to device arrays d_A and d_B
hipMemcpy(d_A, A, bytes, hipMemcpyHostToDevice);
hipMemcpy(d_B, B, bytes, hipMemcpyHostToDevice);
// Set execution configuration parameters
// thr_per_blk: number of CUDA threads per grid block
// blk_in_grid: number of blocks in grid
int thr_per_blk = 256;
int blk_in_grid = ceil( float(N) / thr_per_blk );
// Launch kernel
add_vectors<<< blk_in_grid, thr_per_blk >>>(d_A, d_B, d_C);
// Copy data from device array d_C to host array C
hipMemcpy(C, d_C, bytes, hipMemcpyDeviceToHost);
// Verify results
for(int i=0; i<N; i++)
{
if(C[i] != 3)
{
printf("\nError: value of C[%d] = %d instead of 3\n\n", i, C[i]);
exit(-1);
}
}
// Free CPU memory
free(A);
free(B);
free(C);
// Free GPU memory
hipFree(d_A);
hipFree(d_B);
hipFree(d_C);
printf("\n---------------------------\n");
printf("__SUCCESS__\n");
printf("---------------------------\n");
printf("N = %d\n", N);
printf("Threads Per Block = %d\n", thr_per_blk);
printf("Blocks In Grid = %d\n", blk_in_grid);
printf("---------------------------\n\n");
return 0;
} | .text
.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
.protected _Z11add_vectorsPiS_S_
.globl _Z11add_vectorsPiS_S_
.p2align 8
.type _Z11add_vectorsPiS_S_,@function
_Z11add_vectorsPiS_S_:
s_load_b32 s2, s[0:1], 0x24
s_waitcnt lgkmcnt(0)
s_and_b32 s2, s2, 0xffff
s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
s_mov_b32 s2, exec_lo
v_cmpx_gt_i32_e32 0x100000, v1
s_cbranch_execz .LBB0_2
s_load_b128 s[4:7], s[0:1], 0x0
v_ashrrev_i32_e32 v2, 31, v1
s_load_b64 s[0:1], s[0:1], 0x10
s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
v_lshlrev_b64 v[0:1], 2, v[1:2]
s_waitcnt lgkmcnt(0)
v_add_co_u32 v2, vcc_lo, s4, v0
s_delay_alu instid0(VALU_DEP_2)
v_add_co_ci_u32_e32 v3, vcc_lo, s5, v1, vcc_lo
v_add_co_u32 v4, vcc_lo, s6, v0
v_add_co_ci_u32_e32 v5, vcc_lo, s7, v1, vcc_lo
v_add_co_u32 v0, vcc_lo, s0, v0
global_load_b32 v2, v[2:3], off
global_load_b32 v3, v[4:5], off
v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
s_waitcnt vmcnt(0)
v_add_nc_u32_e32 v2, v3, v2
global_store_b32 v[0:1], v2, off
.LBB0_2:
s_nop 0
s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
s_endpgm
.section .rodata,"a",@progbits
.p2align 6, 0x0
.amdhsa_kernel _Z11add_vectorsPiS_S_
.amdhsa_group_segment_fixed_size 0
.amdhsa_private_segment_fixed_size 0
.amdhsa_kernarg_size 280
.amdhsa_user_sgpr_count 15
.amdhsa_user_sgpr_dispatch_ptr 0
.amdhsa_user_sgpr_queue_ptr 0
.amdhsa_user_sgpr_kernarg_segment_ptr 1
.amdhsa_user_sgpr_dispatch_id 0
.amdhsa_user_sgpr_private_segment_size 0
.amdhsa_wavefront_size32 1
.amdhsa_uses_dynamic_stack 0
.amdhsa_enable_private_segment 0
.amdhsa_system_sgpr_workgroup_id_x 1
.amdhsa_system_sgpr_workgroup_id_y 0
.amdhsa_system_sgpr_workgroup_id_z 0
.amdhsa_system_sgpr_workgroup_info 0
.amdhsa_system_vgpr_workitem_id 0
.amdhsa_next_free_vgpr 6
.amdhsa_next_free_sgpr 16
.amdhsa_float_round_mode_32 0
.amdhsa_float_round_mode_16_64 0
.amdhsa_float_denorm_mode_32 3
.amdhsa_float_denorm_mode_16_64 3
.amdhsa_dx10_clamp 1
.amdhsa_ieee_mode 1
.amdhsa_fp16_overflow 0
.amdhsa_workgroup_processor_mode 1
.amdhsa_memory_ordered 1
.amdhsa_forward_progress 0
.amdhsa_shared_vgpr_count 0
.amdhsa_exception_fp_ieee_invalid_op 0
.amdhsa_exception_fp_denorm_src 0
.amdhsa_exception_fp_ieee_div_zero 0
.amdhsa_exception_fp_ieee_overflow 0
.amdhsa_exception_fp_ieee_underflow 0
.amdhsa_exception_fp_ieee_inexact 0
.amdhsa_exception_int_div_zero 0
.end_amdhsa_kernel
.text
.Lfunc_end0:
.size _Z11add_vectorsPiS_S_, .Lfunc_end0-_Z11add_vectorsPiS_S_
.section .AMDGPU.csdata,"",@progbits
.text
.p2alignl 7, 3214868480
.fill 96, 4, 3214868480
.type __hip_cuid_,@object
.section .bss,"aw",@nobits
.globl __hip_cuid_
__hip_cuid_:
.byte 0
.size __hip_cuid_, 1
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym __hip_cuid_
.amdgpu_metadata
---
amdhsa.kernels:
- .args:
- .address_space: global
.offset: 0
.size: 8
.value_kind: global_buffer
- .address_space: global
.offset: 8
.size: 8
.value_kind: global_buffer
- .address_space: global
.offset: 16
.size: 8
.value_kind: global_buffer
- .offset: 24
.size: 4
.value_kind: hidden_block_count_x
- .offset: 28
.size: 4
.value_kind: hidden_block_count_y
- .offset: 32
.size: 4
.value_kind: hidden_block_count_z
- .offset: 36
.size: 2
.value_kind: hidden_group_size_x
- .offset: 38
.size: 2
.value_kind: hidden_group_size_y
- .offset: 40
.size: 2
.value_kind: hidden_group_size_z
- .offset: 42
.size: 2
.value_kind: hidden_remainder_x
- .offset: 44
.size: 2
.value_kind: hidden_remainder_y
- .offset: 46
.size: 2
.value_kind: hidden_remainder_z
- .offset: 64
.size: 8
.value_kind: hidden_global_offset_x
- .offset: 72
.size: 8
.value_kind: hidden_global_offset_y
- .offset: 80
.size: 8
.value_kind: hidden_global_offset_z
- .offset: 88
.size: 2
.value_kind: hidden_grid_dims
.group_segment_fixed_size: 0
.kernarg_segment_align: 8
.kernarg_segment_size: 280
.language: OpenCL C
.language_version:
- 2
- 0
.max_flat_workgroup_size: 1024
.name: _Z11add_vectorsPiS_S_
.private_segment_fixed_size: 0
.sgpr_count: 18
.sgpr_spill_count: 0
.symbol: _Z11add_vectorsPiS_S_.kd
.uniform_work_group_size: 1
.uses_dynamic_stack: false
.vgpr_count: 6
.vgpr_spill_count: 0
.wavefront_size: 32
.workgroup_processor_mode: 1
amdhsa.target: amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
- 1
- 2
...
.end_amdgpu_metadata |
You are a helpful coding assistant specialized in converting HIP source code to AMD host assembly. | #include <hip/hip_runtime.h>
#include <stdio.h>
// Size of array
#define N 1048576
// Kernel
__global__ void add_vectors(int *a, int *b, int *c)
{
int id = blockDim.x * blockIdx.x + threadIdx.x;
if(id < N) c[id] = a[id] + b[id];
}
// Main program
int main()
{
// Number of bytes to allocate for N integers
size_t bytes = N*sizeof(int);
// Allocate memory for arrays A, B, and C on host
int *A = (int*)malloc(bytes);
int *B = (int*)malloc(bytes);
int *C = (int*)malloc(bytes);
// Allocate memory for arrays d_A, d_B, and d_C on device
int *d_A, *d_B, *d_C;
hipMalloc(&d_A, bytes);
hipMalloc(&d_B, bytes);
hipMalloc(&d_C, bytes);
// Fill host arrays A and B
for(int i=0; i<N; i++)
{
A[i] = 1;
B[i] = 2;
}
// Copy data from host arrays A and B to device arrays d_A and d_B
hipMemcpy(d_A, A, bytes, hipMemcpyHostToDevice);
hipMemcpy(d_B, B, bytes, hipMemcpyHostToDevice);
// Set execution configuration parameters
// thr_per_blk: number of CUDA threads per grid block
// blk_in_grid: number of blocks in grid
int thr_per_blk = 256;
int blk_in_grid = ceil( float(N) / thr_per_blk );
// Launch kernel
add_vectors<<< blk_in_grid, thr_per_blk >>>(d_A, d_B, d_C);
// Copy data from device array d_C to host array C
hipMemcpy(C, d_C, bytes, hipMemcpyDeviceToHost);
// Verify results
for(int i=0; i<N; i++)
{
if(C[i] != 3)
{
printf("\nError: value of C[%d] = %d instead of 3\n\n", i, C[i]);
exit(-1);
}
}
// Free CPU memory
free(A);
free(B);
free(C);
// Free GPU memory
hipFree(d_A);
hipFree(d_B);
hipFree(d_C);
printf("\n---------------------------\n");
printf("__SUCCESS__\n");
printf("---------------------------\n");
printf("N = %d\n", N);
printf("Threads Per Block = %d\n", thr_per_blk);
printf("Blocks In Grid = %d\n", blk_in_grid);
printf("---------------------------\n\n");
return 0;
} | .text
.file "vector_addition.hip"
.globl _Z26__device_stub__add_vectorsPiS_S_ # -- Begin function _Z26__device_stub__add_vectorsPiS_S_
.p2align 4, 0x90
.type _Z26__device_stub__add_vectorsPiS_S_,@function
_Z26__device_stub__add_vectorsPiS_S_: # @_Z26__device_stub__add_vectorsPiS_S_
.cfi_startproc
# %bb.0:
subq $104, %rsp
.cfi_def_cfa_offset 112
movq %rdi, 72(%rsp)
movq %rsi, 64(%rsp)
movq %rdx, 56(%rsp)
leaq 72(%rsp), %rax
movq %rax, 80(%rsp)
leaq 64(%rsp), %rax
movq %rax, 88(%rsp)
leaq 56(%rsp), %rax
movq %rax, 96(%rsp)
leaq 40(%rsp), %rdi
leaq 24(%rsp), %rsi
leaq 16(%rsp), %rdx
leaq 8(%rsp), %rcx
callq __hipPopCallConfiguration
movq 40(%rsp), %rsi
movl 48(%rsp), %edx
movq 24(%rsp), %rcx
movl 32(%rsp), %r8d
leaq 80(%rsp), %r9
movl $_Z11add_vectorsPiS_S_, %edi
pushq 8(%rsp)
.cfi_adjust_cfa_offset 8
pushq 24(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $120, %rsp
.cfi_adjust_cfa_offset -120
retq
.Lfunc_end0:
.size _Z26__device_stub__add_vectorsPiS_S_, .Lfunc_end0-_Z26__device_stub__add_vectorsPiS_S_
.cfi_endproc
# -- End function
.globl main # -- Begin function main
.p2align 4, 0x90
.type main,@function
main: # @main
.cfi_startproc
# %bb.0:
pushq %r15
.cfi_def_cfa_offset 16
pushq %r14
.cfi_def_cfa_offset 24
pushq %rbx
.cfi_def_cfa_offset 32
subq $128, %rsp
.cfi_def_cfa_offset 160
.cfi_offset %rbx, -32
.cfi_offset %r14, -24
.cfi_offset %r15, -16
movl $4194304, %edi # imm = 0x400000
callq malloc
movq %rax, %rbx
movl $4194304, %edi # imm = 0x400000
callq malloc
movq %rax, %r14
movl $4194304, %edi # imm = 0x400000
callq malloc
movq %rax, %r15
leaq 16(%rsp), %rdi
movl $4194304, %esi # imm = 0x400000
callq hipMalloc
leaq 8(%rsp), %rdi
movl $4194304, %esi # imm = 0x400000
callq hipMalloc
movq %rsp, %rdi
movl $4194304, %esi # imm = 0x400000
callq hipMalloc
xorl %eax, %eax
.p2align 4, 0x90
.LBB1_1: # =>This Inner Loop Header: Depth=1
movl $1, (%rbx,%rax,4)
movl $2, (%r14,%rax,4)
incq %rax
cmpq $1048576, %rax # imm = 0x100000
jne .LBB1_1
# %bb.2:
movq 16(%rsp), %rdi
movl $4194304, %edx # imm = 0x400000
movq %rbx, %rsi
movl $1, %ecx
callq hipMemcpy
movq 8(%rsp), %rdi
movl $4194304, %edx # imm = 0x400000
movq %r14, %rsi
movl $1, %ecx
callq hipMemcpy
movabsq $4294967552, %rdx # imm = 0x100000100
leaq 3840(%rdx), %rdi
movl $1, %esi
movl $1, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq __hipPushCallConfiguration
testl %eax, %eax
jne .LBB1_4
# %bb.3:
movq 16(%rsp), %rax
movq 8(%rsp), %rcx
movq (%rsp), %rdx
movq %rax, 88(%rsp)
movq %rcx, 80(%rsp)
movq %rdx, 72(%rsp)
leaq 88(%rsp), %rax
movq %rax, 96(%rsp)
leaq 80(%rsp), %rax
movq %rax, 104(%rsp)
leaq 72(%rsp), %rax
movq %rax, 112(%rsp)
leaq 56(%rsp), %rdi
leaq 40(%rsp), %rsi
leaq 32(%rsp), %rdx
leaq 24(%rsp), %rcx
callq __hipPopCallConfiguration
movq 56(%rsp), %rsi
movl 64(%rsp), %edx
movq 40(%rsp), %rcx
movl 48(%rsp), %r8d
leaq 96(%rsp), %r9
movl $_Z11add_vectorsPiS_S_, %edi
pushq 24(%rsp)
.cfi_adjust_cfa_offset 8
pushq 40(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $16, %rsp
.cfi_adjust_cfa_offset -16
.LBB1_4:
movq (%rsp), %rsi
movl $4194304, %edx # imm = 0x400000
movq %r15, %rdi
movl $2, %ecx
callq hipMemcpy
xorl %esi, %esi
.p2align 4, 0x90
.LBB1_5: # =>This Inner Loop Header: Depth=1
movl (%r15,%rsi,4), %edx
cmpl $3, %edx
jne .LBB1_8
# %bb.6: # in Loop: Header=BB1_5 Depth=1
incq %rsi
cmpq $1048576, %rsi # imm = 0x100000
jne .LBB1_5
# %bb.7:
movq %rbx, %rdi
callq free
movq %r14, %rdi
callq free
movq %r15, %rdi
callq free
movq 16(%rsp), %rdi
callq hipFree
movq 8(%rsp), %rdi
callq hipFree
movq (%rsp), %rdi
callq hipFree
movl $.Lstr, %edi
callq puts@PLT
movl $.Lstr.1, %edi
callq puts@PLT
movl $.Lstr.2, %edi
callq puts@PLT
movl $.L.str.4, %edi
movl $1048576, %esi # imm = 0x100000
xorl %eax, %eax
callq printf
movl $.L.str.5, %edi
movl $256, %esi # imm = 0x100
xorl %eax, %eax
callq printf
movl $.L.str.6, %edi
movl $4096, %esi # imm = 0x1000
xorl %eax, %eax
callq printf
movl $.Lstr.3, %edi
callq puts@PLT
xorl %eax, %eax
addq $128, %rsp
.cfi_def_cfa_offset 32
popq %rbx
.cfi_def_cfa_offset 24
popq %r14
.cfi_def_cfa_offset 16
popq %r15
.cfi_def_cfa_offset 8
retq
.LBB1_8:
.cfi_def_cfa_offset 160
movl $.L.str, %edi
# kill: def $esi killed $esi killed $rsi
xorl %eax, %eax
callq printf
movl $-1, %edi
callq exit
.Lfunc_end1:
.size main, .Lfunc_end1-main
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_ctor
.type __hip_module_ctor,@function
__hip_module_ctor: # @__hip_module_ctor
.cfi_startproc
# %bb.0:
subq $40, %rsp
.cfi_def_cfa_offset 48
cmpq $0, __hip_gpubin_handle(%rip)
jne .LBB2_2
# %bb.1:
movl $__hip_fatbin_wrapper, %edi
callq __hipRegisterFatBinary
movq %rax, __hip_gpubin_handle(%rip)
.LBB2_2:
movq __hip_gpubin_handle(%rip), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 16(%rsp)
movups %xmm0, (%rsp)
movl $_Z11add_vectorsPiS_S_, %esi
movl $.L__unnamed_1, %edx
movl $.L__unnamed_1, %ecx
movl $-1, %r8d
xorl %r9d, %r9d
callq __hipRegisterFunction
movl $__hip_module_dtor, %edi
addq $40, %rsp
.cfi_def_cfa_offset 8
jmp atexit # TAILCALL
.Lfunc_end2:
.size __hip_module_ctor, .Lfunc_end2-__hip_module_ctor
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_dtor
.type __hip_module_dtor,@function
__hip_module_dtor: # @__hip_module_dtor
.cfi_startproc
# %bb.0:
movq __hip_gpubin_handle(%rip), %rdi
testq %rdi, %rdi
je .LBB3_2
# %bb.1:
pushq %rax
.cfi_def_cfa_offset 16
callq __hipUnregisterFatBinary
movq $0, __hip_gpubin_handle(%rip)
addq $8, %rsp
.cfi_def_cfa_offset 8
.LBB3_2:
retq
.Lfunc_end3:
.size __hip_module_dtor, .Lfunc_end3-__hip_module_dtor
.cfi_endproc
# -- End function
.type _Z11add_vectorsPiS_S_,@object # @_Z11add_vectorsPiS_S_
.section .rodata,"a",@progbits
.globl _Z11add_vectorsPiS_S_
.p2align 3, 0x0
_Z11add_vectorsPiS_S_:
.quad _Z26__device_stub__add_vectorsPiS_S_
.size _Z11add_vectorsPiS_S_, 8
.type .L.str,@object # @.str
.section .rodata.str1.1,"aMS",@progbits,1
.L.str:
.asciz "\nError: value of C[%d] = %d instead of 3\n\n"
.size .L.str, 43
.type .L.str.4,@object # @.str.4
.L.str.4:
.asciz "N = %d\n"
.size .L.str.4, 24
.type .L.str.5,@object # @.str.5
.L.str.5:
.asciz "Threads Per Block = %d\n"
.size .L.str.5, 24
.type .L.str.6,@object # @.str.6
.L.str.6:
.asciz "Blocks In Grid = %d\n"
.size .L.str.6, 24
.type .L__unnamed_1,@object # @0
.L__unnamed_1:
.asciz "_Z11add_vectorsPiS_S_"
.size .L__unnamed_1, 22
.type __hip_fatbin_wrapper,@object # @__hip_fatbin_wrapper
.section .hipFatBinSegment,"a",@progbits
.p2align 3, 0x0
__hip_fatbin_wrapper:
.long 1212764230 # 0x48495046
.long 1 # 0x1
.quad __hip_fatbin
.quad 0
.size __hip_fatbin_wrapper, 24
.type __hip_gpubin_handle,@object # @__hip_gpubin_handle
.local __hip_gpubin_handle
.comm __hip_gpubin_handle,8,8
.section .init_array,"aw",@init_array
.p2align 3, 0x0
.quad __hip_module_ctor
.type __hip_cuid_,@object # @__hip_cuid_
.bss
.globl __hip_cuid_
__hip_cuid_:
.byte 0 # 0x0
.size __hip_cuid_, 1
.type .Lstr,@object # @str
.section .rodata.str1.1,"aMS",@progbits,1
.Lstr:
.asciz "\n---------------------------"
.size .Lstr, 29
.type .Lstr.1,@object # @str.1
.Lstr.1:
.asciz "__SUCCESS__"
.size .Lstr.1, 12
.type .Lstr.2,@object # @str.2
.Lstr.2:
.asciz "---------------------------"
.size .Lstr.2, 28
.type .Lstr.3,@object # @str.3
.Lstr.3:
.asciz "---------------------------\n"
.size .Lstr.3, 29
.section ".linker-options","e",@llvm_linker_options
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym _Z26__device_stub__add_vectorsPiS_S_
.addrsig_sym __hip_module_ctor
.addrsig_sym __hip_module_dtor
.addrsig_sym _Z11add_vectorsPiS_S_
.addrsig_sym __hip_fatbin
.addrsig_sym __hip_fatbin_wrapper
.addrsig_sym __hip_cuid_ |
You are a helpful coding assistant specialized in converting from CUDA device assembly to AMD device assembly. | code for sm_80
Function : _Z11add_vectorsPiS_S_
.headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)"
/*0000*/ MOV R1, c[0x0][0x28] ; /* 0x00000a0000017a02 */
/* 0x000fe40000000f00 */
/*0010*/ S2R R6, SR_CTAID.X ; /* 0x0000000000067919 */
/* 0x000e280000002500 */
/*0020*/ S2R R3, SR_TID.X ; /* 0x0000000000037919 */
/* 0x000e240000002100 */
/*0030*/ IMAD R6, R6, c[0x0][0x0], R3 ; /* 0x0000000006067a24 */
/* 0x001fca00078e0203 */
/*0040*/ ISETP.GT.AND P0, PT, R6, 0xfffff, PT ; /* 0x000fffff0600780c */
/* 0x000fda0003f04270 */
/*0050*/ @P0 EXIT ; /* 0x000000000000094d */
/* 0x000fea0003800000 */
/*0060*/ HFMA2.MMA R7, -RZ, RZ, 0, 2.384185791015625e-07 ; /* 0x00000004ff077435 */
/* 0x000fe200000001ff */
/*0070*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */
/* 0x000fd20000000a00 */
/*0080*/ IMAD.WIDE R4, R6, R7, c[0x0][0x168] ; /* 0x00005a0006047625 */
/* 0x000fc800078e0207 */
/*0090*/ IMAD.WIDE R2, R6.reuse, R7.reuse, c[0x0][0x160] ; /* 0x0000580006027625 */
/* 0x0c0fe400078e0207 */
/*00a0*/ LDG.E R4, [R4.64] ; /* 0x0000000404047981 */
/* 0x000ea8000c1e1900 */
/*00b0*/ LDG.E R3, [R2.64] ; /* 0x0000000402037981 */
/* 0x000ea2000c1e1900 */
/*00c0*/ IMAD.WIDE R6, R6, R7, c[0x0][0x170] ; /* 0x00005c0006067625 */
/* 0x000fe200078e0207 */
/*00d0*/ IADD3 R9, R4, R3, RZ ; /* 0x0000000304097210 */
/* 0x004fca0007ffe0ff */
/*00e0*/ STG.E [R6.64], R9 ; /* 0x0000000906007986 */
/* 0x000fe2000c101904 */
/*00f0*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*0100*/ BRA 0x100; /* 0xfffffff000007947 */
/* 0x000fc0000383ffff */
/*0110*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0120*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0130*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0140*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0150*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0160*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0170*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0180*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0190*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*01a0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*01b0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*01c0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*01d0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*01e0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*01f0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
.......... | .text
.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
.protected _Z11add_vectorsPiS_S_
.globl _Z11add_vectorsPiS_S_
.p2align 8
.type _Z11add_vectorsPiS_S_,@function
_Z11add_vectorsPiS_S_:
s_load_b32 s2, s[0:1], 0x24
s_waitcnt lgkmcnt(0)
s_and_b32 s2, s2, 0xffff
s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
s_mov_b32 s2, exec_lo
v_cmpx_gt_i32_e32 0x100000, v1
s_cbranch_execz .LBB0_2
s_load_b128 s[4:7], s[0:1], 0x0
v_ashrrev_i32_e32 v2, 31, v1
s_load_b64 s[0:1], s[0:1], 0x10
s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
v_lshlrev_b64 v[0:1], 2, v[1:2]
s_waitcnt lgkmcnt(0)
v_add_co_u32 v2, vcc_lo, s4, v0
s_delay_alu instid0(VALU_DEP_2)
v_add_co_ci_u32_e32 v3, vcc_lo, s5, v1, vcc_lo
v_add_co_u32 v4, vcc_lo, s6, v0
v_add_co_ci_u32_e32 v5, vcc_lo, s7, v1, vcc_lo
v_add_co_u32 v0, vcc_lo, s0, v0
global_load_b32 v2, v[2:3], off
global_load_b32 v3, v[4:5], off
v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
s_waitcnt vmcnt(0)
v_add_nc_u32_e32 v2, v3, v2
global_store_b32 v[0:1], v2, off
.LBB0_2:
s_nop 0
s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
s_endpgm
.section .rodata,"a",@progbits
.p2align 6, 0x0
.amdhsa_kernel _Z11add_vectorsPiS_S_
.amdhsa_group_segment_fixed_size 0
.amdhsa_private_segment_fixed_size 0
.amdhsa_kernarg_size 280
.amdhsa_user_sgpr_count 15
.amdhsa_user_sgpr_dispatch_ptr 0
.amdhsa_user_sgpr_queue_ptr 0
.amdhsa_user_sgpr_kernarg_segment_ptr 1
.amdhsa_user_sgpr_dispatch_id 0
.amdhsa_user_sgpr_private_segment_size 0
.amdhsa_wavefront_size32 1
.amdhsa_uses_dynamic_stack 0
.amdhsa_enable_private_segment 0
.amdhsa_system_sgpr_workgroup_id_x 1
.amdhsa_system_sgpr_workgroup_id_y 0
.amdhsa_system_sgpr_workgroup_id_z 0
.amdhsa_system_sgpr_workgroup_info 0
.amdhsa_system_vgpr_workitem_id 0
.amdhsa_next_free_vgpr 6
.amdhsa_next_free_sgpr 16
.amdhsa_float_round_mode_32 0
.amdhsa_float_round_mode_16_64 0
.amdhsa_float_denorm_mode_32 3
.amdhsa_float_denorm_mode_16_64 3
.amdhsa_dx10_clamp 1
.amdhsa_ieee_mode 1
.amdhsa_fp16_overflow 0
.amdhsa_workgroup_processor_mode 1
.amdhsa_memory_ordered 1
.amdhsa_forward_progress 0
.amdhsa_shared_vgpr_count 0
.amdhsa_exception_fp_ieee_invalid_op 0
.amdhsa_exception_fp_denorm_src 0
.amdhsa_exception_fp_ieee_div_zero 0
.amdhsa_exception_fp_ieee_overflow 0
.amdhsa_exception_fp_ieee_underflow 0
.amdhsa_exception_fp_ieee_inexact 0
.amdhsa_exception_int_div_zero 0
.end_amdhsa_kernel
.text
.Lfunc_end0:
.size _Z11add_vectorsPiS_S_, .Lfunc_end0-_Z11add_vectorsPiS_S_
.section .AMDGPU.csdata,"",@progbits
.text
.p2alignl 7, 3214868480
.fill 96, 4, 3214868480
.type __hip_cuid_,@object
.section .bss,"aw",@nobits
.globl __hip_cuid_
__hip_cuid_:
.byte 0
.size __hip_cuid_, 1
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym __hip_cuid_
.amdgpu_metadata
---
amdhsa.kernels:
- .args:
- .address_space: global
.offset: 0
.size: 8
.value_kind: global_buffer
- .address_space: global
.offset: 8
.size: 8
.value_kind: global_buffer
- .address_space: global
.offset: 16
.size: 8
.value_kind: global_buffer
- .offset: 24
.size: 4
.value_kind: hidden_block_count_x
- .offset: 28
.size: 4
.value_kind: hidden_block_count_y
- .offset: 32
.size: 4
.value_kind: hidden_block_count_z
- .offset: 36
.size: 2
.value_kind: hidden_group_size_x
- .offset: 38
.size: 2
.value_kind: hidden_group_size_y
- .offset: 40
.size: 2
.value_kind: hidden_group_size_z
- .offset: 42
.size: 2
.value_kind: hidden_remainder_x
- .offset: 44
.size: 2
.value_kind: hidden_remainder_y
- .offset: 46
.size: 2
.value_kind: hidden_remainder_z
- .offset: 64
.size: 8
.value_kind: hidden_global_offset_x
- .offset: 72
.size: 8
.value_kind: hidden_global_offset_y
- .offset: 80
.size: 8
.value_kind: hidden_global_offset_z
- .offset: 88
.size: 2
.value_kind: hidden_grid_dims
.group_segment_fixed_size: 0
.kernarg_segment_align: 8
.kernarg_segment_size: 280
.language: OpenCL C
.language_version:
- 2
- 0
.max_flat_workgroup_size: 1024
.name: _Z11add_vectorsPiS_S_
.private_segment_fixed_size: 0
.sgpr_count: 18
.sgpr_spill_count: 0
.symbol: _Z11add_vectorsPiS_S_.kd
.uniform_work_group_size: 1
.uses_dynamic_stack: false
.vgpr_count: 6
.vgpr_spill_count: 0
.wavefront_size: 32
.workgroup_processor_mode: 1
amdhsa.target: amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
- 1
- 2
...
.end_amdgpu_metadata |
You are a helpful coding assistant specialized in converting from CUDA host assembly to AMD host assembly. | .file "tmpxft_001107ef_00000000-6_vector_addition.cudafe1.cpp"
.text
#APP
#NO_APP
.type _ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2060:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaUnregisterFatBinary@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2060:
.size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
.globl _Z35__device_stub__Z11add_vectorsPiS_S_PiS_S_
.type _Z35__device_stub__Z11add_vectorsPiS_S_PiS_S_, @function
_Z35__device_stub__Z11add_vectorsPiS_S_PiS_S_:
.LFB2082:
.cfi_startproc
endbr64
subq $136, %rsp
.cfi_def_cfa_offset 144
movq %rdi, 24(%rsp)
movq %rsi, 16(%rsp)
movq %rdx, 8(%rsp)
movq %fs:40, %rax
movq %rax, 120(%rsp)
xorl %eax, %eax
leaq 24(%rsp), %rax
movq %rax, 96(%rsp)
leaq 16(%rsp), %rax
movq %rax, 104(%rsp)
leaq 8(%rsp), %rax
movq %rax, 112(%rsp)
movl $1, 48(%rsp)
movl $1, 52(%rsp)
movl $1, 56(%rsp)
movl $1, 60(%rsp)
movl $1, 64(%rsp)
movl $1, 68(%rsp)
leaq 40(%rsp), %rcx
leaq 32(%rsp), %rdx
leaq 60(%rsp), %rsi
leaq 48(%rsp), %rdi
call __cudaPopCallConfiguration@PLT
testl %eax, %eax
je .L7
.L3:
movq 120(%rsp), %rax
subq %fs:40, %rax
jne .L8
addq $136, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 8
ret
.L7:
.cfi_restore_state
pushq 40(%rsp)
.cfi_def_cfa_offset 152
pushq 40(%rsp)
.cfi_def_cfa_offset 160
leaq 112(%rsp), %r9
movq 76(%rsp), %rcx
movl 84(%rsp), %r8d
movq 64(%rsp), %rsi
movl 72(%rsp), %edx
leaq _Z11add_vectorsPiS_S_(%rip), %rdi
call cudaLaunchKernel@PLT
addq $16, %rsp
.cfi_def_cfa_offset 144
jmp .L3
.L8:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE2082:
.size _Z35__device_stub__Z11add_vectorsPiS_S_PiS_S_, .-_Z35__device_stub__Z11add_vectorsPiS_S_PiS_S_
.globl _Z11add_vectorsPiS_S_
.type _Z11add_vectorsPiS_S_, @function
_Z11add_vectorsPiS_S_:
.LFB2083:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
call _Z35__device_stub__Z11add_vectorsPiS_S_PiS_S_
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2083:
.size _Z11add_vectorsPiS_S_, .-_Z11add_vectorsPiS_S_
.section .rodata.str1.8,"aMS",@progbits,1
.align 8
.LC0:
.string "\nError: value of C[%d] = %d instead of 3\n\n"
.section .rodata.str1.1,"aMS",@progbits,1
.LC1:
.string "\n---------------------------\n"
.LC2:
.string "__SUCCESS__\n"
.LC3:
.string "---------------------------\n"
.LC4:
.string "N = %d\n"
.LC5:
.string "Threads Per Block = %d\n"
.LC6:
.string "Blocks In Grid = %d\n"
.LC7:
.string "---------------------------\n\n"
.text
.globl main
.type main, @function
main:
.LFB2057:
.cfi_startproc
endbr64
pushq %r12
.cfi_def_cfa_offset 16
.cfi_offset 12, -16
pushq %rbp
.cfi_def_cfa_offset 24
.cfi_offset 6, -24
pushq %rbx
.cfi_def_cfa_offset 32
.cfi_offset 3, -32
subq $64, %rsp
.cfi_def_cfa_offset 96
movq %fs:40, %rax
movq %rax, 56(%rsp)
xorl %eax, %eax
movl $4194304, %edi
call malloc@PLT
movq %rax, %rbp
movl $4194304, %edi
call malloc@PLT
movq %rax, %rbx
movl $4194304, %edi
call malloc@PLT
movq %rax, %r12
leaq 8(%rsp), %rdi
movl $4194304, %esi
call cudaMalloc@PLT
leaq 16(%rsp), %rdi
movl $4194304, %esi
call cudaMalloc@PLT
leaq 24(%rsp), %rdi
movl $4194304, %esi
call cudaMalloc@PLT
movl $0, %eax
.L12:
movl $1, 0(%rbp,%rax)
movl $2, (%rbx,%rax)
addq $4, %rax
cmpq $4194304, %rax
jne .L12
movl $1, %ecx
movl $4194304, %edx
movq %rbp, %rsi
movq 8(%rsp), %rdi
call cudaMemcpy@PLT
movl $1, %ecx
movl $4194304, %edx
movq %rbx, %rsi
movq 16(%rsp), %rdi
call cudaMemcpy@PLT
movl $256, 44(%rsp)
movl $1, 48(%rsp)
movl $4096, 32(%rsp)
movl $1, 36(%rsp)
movl $0, %r9d
movl $0, %r8d
movq 44(%rsp), %rdx
movl $1, %ecx
movq 32(%rsp), %rdi
movl $1, %esi
call __cudaPushCallConfiguration@PLT
testl %eax, %eax
je .L20
.L13:
movl $2, %ecx
movl $4194304, %edx
movq 24(%rsp), %rsi
movq %r12, %rdi
call cudaMemcpy@PLT
movl $0, %eax
.L15:
movl (%r12,%rax,4), %ecx
cmpl $3, %ecx
jne .L21
addq $1, %rax
cmpq $1048576, %rax
jne .L15
movq %rbp, %rdi
call free@PLT
movq %rbx, %rdi
call free@PLT
movq %r12, %rdi
call free@PLT
movq 8(%rsp), %rdi
call cudaFree@PLT
movq 16(%rsp), %rdi
call cudaFree@PLT
movq 24(%rsp), %rdi
call cudaFree@PLT
leaq .LC1(%rip), %rsi
movl $2, %edi
movl $0, %eax
call __printf_chk@PLT
leaq .LC2(%rip), %rsi
movl $2, %edi
movl $0, %eax
call __printf_chk@PLT
leaq .LC3(%rip), %rsi
movl $2, %edi
movl $0, %eax
call __printf_chk@PLT
movl $1048576, %edx
leaq .LC4(%rip), %rsi
movl $2, %edi
movl $0, %eax
call __printf_chk@PLT
movl $256, %edx
leaq .LC5(%rip), %rsi
movl $2, %edi
movl $0, %eax
call __printf_chk@PLT
movl $4096, %edx
leaq .LC6(%rip), %rsi
movl $2, %edi
movl $0, %eax
call __printf_chk@PLT
leaq .LC7(%rip), %rsi
movl $2, %edi
movl $0, %eax
call __printf_chk@PLT
movq 56(%rsp), %rax
subq %fs:40, %rax
jne .L22
movl $0, %eax
addq $64, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 32
popq %rbx
.cfi_def_cfa_offset 24
popq %rbp
.cfi_def_cfa_offset 16
popq %r12
.cfi_def_cfa_offset 8
ret
.L20:
.cfi_restore_state
movq 24(%rsp), %rdx
movq 16(%rsp), %rsi
movq 8(%rsp), %rdi
call _Z35__device_stub__Z11add_vectorsPiS_S_PiS_S_
jmp .L13
.L21:
movl %eax, %edx
leaq .LC0(%rip), %rsi
movl $2, %edi
movl $0, %eax
call __printf_chk@PLT
movl $-1, %edi
call exit@PLT
.L22:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE2057:
.size main, .-main
.section .rodata.str1.1
.LC8:
.string "_Z11add_vectorsPiS_S_"
.text
.type _ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2085:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
leaq _ZL15__fatDeviceText(%rip), %rdi
call __cudaRegisterFatBinary@PLT
movq %rax, %rdi
movq %rax, _ZL20__cudaFatCubinHandle(%rip)
pushq $0
.cfi_def_cfa_offset 24
pushq $0
.cfi_def_cfa_offset 32
pushq $0
.cfi_def_cfa_offset 40
pushq $0
.cfi_def_cfa_offset 48
movl $0, %r9d
movl $-1, %r8d
leaq .LC8(%rip), %rdx
movq %rdx, %rcx
leaq _Z11add_vectorsPiS_S_(%rip), %rsi
call __cudaRegisterFunction@PLT
addq $32, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaRegisterFatBinaryEnd@PLT
leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
call atexit@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2085:
.size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
.section .init_array,"aw"
.align 8
.quad _ZL24__sti____cudaRegisterAllv
.section .nvFatBinSegment,"aw"
.align 8
.type _ZL15__fatDeviceText, @object
.size _ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
.long 1180844977
.long 1
.quad fatbinData
.quad 0
.local _ZL20__cudaFatCubinHandle
.comm _ZL20__cudaFatCubinHandle,8,8
.ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
.section .note.GNU-stack,"",@progbits
.section .note.gnu.property,"a"
.align 8
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.string "GNU"
1:
.align 8
.long 0xc0000002
.long 3f - 2f
2:
.long 0x3
3:
.align 8
4: | .text
.file "vector_addition.hip"
.globl _Z26__device_stub__add_vectorsPiS_S_ # -- Begin function _Z26__device_stub__add_vectorsPiS_S_
.p2align 4, 0x90
.type _Z26__device_stub__add_vectorsPiS_S_,@function
_Z26__device_stub__add_vectorsPiS_S_: # @_Z26__device_stub__add_vectorsPiS_S_
.cfi_startproc
# %bb.0:
subq $104, %rsp
.cfi_def_cfa_offset 112
movq %rdi, 72(%rsp)
movq %rsi, 64(%rsp)
movq %rdx, 56(%rsp)
leaq 72(%rsp), %rax
movq %rax, 80(%rsp)
leaq 64(%rsp), %rax
movq %rax, 88(%rsp)
leaq 56(%rsp), %rax
movq %rax, 96(%rsp)
leaq 40(%rsp), %rdi
leaq 24(%rsp), %rsi
leaq 16(%rsp), %rdx
leaq 8(%rsp), %rcx
callq __hipPopCallConfiguration
movq 40(%rsp), %rsi
movl 48(%rsp), %edx
movq 24(%rsp), %rcx
movl 32(%rsp), %r8d
leaq 80(%rsp), %r9
movl $_Z11add_vectorsPiS_S_, %edi
pushq 8(%rsp)
.cfi_adjust_cfa_offset 8
pushq 24(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $120, %rsp
.cfi_adjust_cfa_offset -120
retq
.Lfunc_end0:
.size _Z26__device_stub__add_vectorsPiS_S_, .Lfunc_end0-_Z26__device_stub__add_vectorsPiS_S_
.cfi_endproc
# -- End function
.globl main # -- Begin function main
.p2align 4, 0x90
.type main,@function
main: # @main
.cfi_startproc
# %bb.0:
pushq %r15
.cfi_def_cfa_offset 16
pushq %r14
.cfi_def_cfa_offset 24
pushq %rbx
.cfi_def_cfa_offset 32
subq $128, %rsp
.cfi_def_cfa_offset 160
.cfi_offset %rbx, -32
.cfi_offset %r14, -24
.cfi_offset %r15, -16
movl $4194304, %edi # imm = 0x400000
callq malloc
movq %rax, %rbx
movl $4194304, %edi # imm = 0x400000
callq malloc
movq %rax, %r14
movl $4194304, %edi # imm = 0x400000
callq malloc
movq %rax, %r15
leaq 16(%rsp), %rdi
movl $4194304, %esi # imm = 0x400000
callq hipMalloc
leaq 8(%rsp), %rdi
movl $4194304, %esi # imm = 0x400000
callq hipMalloc
movq %rsp, %rdi
movl $4194304, %esi # imm = 0x400000
callq hipMalloc
xorl %eax, %eax
.p2align 4, 0x90
.LBB1_1: # =>This Inner Loop Header: Depth=1
movl $1, (%rbx,%rax,4)
movl $2, (%r14,%rax,4)
incq %rax
cmpq $1048576, %rax # imm = 0x100000
jne .LBB1_1
# %bb.2:
movq 16(%rsp), %rdi
movl $4194304, %edx # imm = 0x400000
movq %rbx, %rsi
movl $1, %ecx
callq hipMemcpy
movq 8(%rsp), %rdi
movl $4194304, %edx # imm = 0x400000
movq %r14, %rsi
movl $1, %ecx
callq hipMemcpy
movabsq $4294967552, %rdx # imm = 0x100000100
leaq 3840(%rdx), %rdi
movl $1, %esi
movl $1, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq __hipPushCallConfiguration
testl %eax, %eax
jne .LBB1_4
# %bb.3:
movq 16(%rsp), %rax
movq 8(%rsp), %rcx
movq (%rsp), %rdx
movq %rax, 88(%rsp)
movq %rcx, 80(%rsp)
movq %rdx, 72(%rsp)
leaq 88(%rsp), %rax
movq %rax, 96(%rsp)
leaq 80(%rsp), %rax
movq %rax, 104(%rsp)
leaq 72(%rsp), %rax
movq %rax, 112(%rsp)
leaq 56(%rsp), %rdi
leaq 40(%rsp), %rsi
leaq 32(%rsp), %rdx
leaq 24(%rsp), %rcx
callq __hipPopCallConfiguration
movq 56(%rsp), %rsi
movl 64(%rsp), %edx
movq 40(%rsp), %rcx
movl 48(%rsp), %r8d
leaq 96(%rsp), %r9
movl $_Z11add_vectorsPiS_S_, %edi
pushq 24(%rsp)
.cfi_adjust_cfa_offset 8
pushq 40(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $16, %rsp
.cfi_adjust_cfa_offset -16
.LBB1_4:
movq (%rsp), %rsi
movl $4194304, %edx # imm = 0x400000
movq %r15, %rdi
movl $2, %ecx
callq hipMemcpy
xorl %esi, %esi
.p2align 4, 0x90
.LBB1_5: # =>This Inner Loop Header: Depth=1
movl (%r15,%rsi,4), %edx
cmpl $3, %edx
jne .LBB1_8
# %bb.6: # in Loop: Header=BB1_5 Depth=1
incq %rsi
cmpq $1048576, %rsi # imm = 0x100000
jne .LBB1_5
# %bb.7:
movq %rbx, %rdi
callq free
movq %r14, %rdi
callq free
movq %r15, %rdi
callq free
movq 16(%rsp), %rdi
callq hipFree
movq 8(%rsp), %rdi
callq hipFree
movq (%rsp), %rdi
callq hipFree
movl $.Lstr, %edi
callq puts@PLT
movl $.Lstr.1, %edi
callq puts@PLT
movl $.Lstr.2, %edi
callq puts@PLT
movl $.L.str.4, %edi
movl $1048576, %esi # imm = 0x100000
xorl %eax, %eax
callq printf
movl $.L.str.5, %edi
movl $256, %esi # imm = 0x100
xorl %eax, %eax
callq printf
movl $.L.str.6, %edi
movl $4096, %esi # imm = 0x1000
xorl %eax, %eax
callq printf
movl $.Lstr.3, %edi
callq puts@PLT
xorl %eax, %eax
addq $128, %rsp
.cfi_def_cfa_offset 32
popq %rbx
.cfi_def_cfa_offset 24
popq %r14
.cfi_def_cfa_offset 16
popq %r15
.cfi_def_cfa_offset 8
retq
.LBB1_8:
.cfi_def_cfa_offset 160
movl $.L.str, %edi
# kill: def $esi killed $esi killed $rsi
xorl %eax, %eax
callq printf
movl $-1, %edi
callq exit
.Lfunc_end1:
.size main, .Lfunc_end1-main
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_ctor
.type __hip_module_ctor,@function
__hip_module_ctor: # @__hip_module_ctor
.cfi_startproc
# %bb.0:
subq $40, %rsp
.cfi_def_cfa_offset 48
cmpq $0, __hip_gpubin_handle(%rip)
jne .LBB2_2
# %bb.1:
movl $__hip_fatbin_wrapper, %edi
callq __hipRegisterFatBinary
movq %rax, __hip_gpubin_handle(%rip)
.LBB2_2:
movq __hip_gpubin_handle(%rip), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 16(%rsp)
movups %xmm0, (%rsp)
movl $_Z11add_vectorsPiS_S_, %esi
movl $.L__unnamed_1, %edx
movl $.L__unnamed_1, %ecx
movl $-1, %r8d
xorl %r9d, %r9d
callq __hipRegisterFunction
movl $__hip_module_dtor, %edi
addq $40, %rsp
.cfi_def_cfa_offset 8
jmp atexit # TAILCALL
.Lfunc_end2:
.size __hip_module_ctor, .Lfunc_end2-__hip_module_ctor
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_dtor
.type __hip_module_dtor,@function
__hip_module_dtor: # @__hip_module_dtor
.cfi_startproc
# %bb.0:
movq __hip_gpubin_handle(%rip), %rdi
testq %rdi, %rdi
je .LBB3_2
# %bb.1:
pushq %rax
.cfi_def_cfa_offset 16
callq __hipUnregisterFatBinary
movq $0, __hip_gpubin_handle(%rip)
addq $8, %rsp
.cfi_def_cfa_offset 8
.LBB3_2:
retq
.Lfunc_end3:
.size __hip_module_dtor, .Lfunc_end3-__hip_module_dtor
.cfi_endproc
# -- End function
.type _Z11add_vectorsPiS_S_,@object # @_Z11add_vectorsPiS_S_
.section .rodata,"a",@progbits
.globl _Z11add_vectorsPiS_S_
.p2align 3, 0x0
_Z11add_vectorsPiS_S_:
.quad _Z26__device_stub__add_vectorsPiS_S_
.size _Z11add_vectorsPiS_S_, 8
.type .L.str,@object # @.str
.section .rodata.str1.1,"aMS",@progbits,1
.L.str:
.asciz "\nError: value of C[%d] = %d instead of 3\n\n"
.size .L.str, 43
.type .L.str.4,@object # @.str.4
.L.str.4:
.asciz "N = %d\n"
.size .L.str.4, 24
.type .L.str.5,@object # @.str.5
.L.str.5:
.asciz "Threads Per Block = %d\n"
.size .L.str.5, 24
.type .L.str.6,@object # @.str.6
.L.str.6:
.asciz "Blocks In Grid = %d\n"
.size .L.str.6, 24
.type .L__unnamed_1,@object # @0
.L__unnamed_1:
.asciz "_Z11add_vectorsPiS_S_"
.size .L__unnamed_1, 22
.type __hip_fatbin_wrapper,@object # @__hip_fatbin_wrapper
.section .hipFatBinSegment,"a",@progbits
.p2align 3, 0x0
__hip_fatbin_wrapper:
.long 1212764230 # 0x48495046
.long 1 # 0x1
.quad __hip_fatbin
.quad 0
.size __hip_fatbin_wrapper, 24
.type __hip_gpubin_handle,@object # @__hip_gpubin_handle
.local __hip_gpubin_handle
.comm __hip_gpubin_handle,8,8
.section .init_array,"aw",@init_array
.p2align 3, 0x0
.quad __hip_module_ctor
.type __hip_cuid_,@object # @__hip_cuid_
.bss
.globl __hip_cuid_
__hip_cuid_:
.byte 0 # 0x0
.size __hip_cuid_, 1
.type .Lstr,@object # @str
.section .rodata.str1.1,"aMS",@progbits,1
.Lstr:
.asciz "\n---------------------------"
.size .Lstr, 29
.type .Lstr.1,@object # @str.1
.Lstr.1:
.asciz "__SUCCESS__"
.size .Lstr.1, 12
.type .Lstr.2,@object # @str.2
.Lstr.2:
.asciz "---------------------------"
.size .Lstr.2, 28
.type .Lstr.3,@object # @str.3
.Lstr.3:
.asciz "---------------------------\n"
.size .Lstr.3, 29
.section ".linker-options","e",@llvm_linker_options
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym _Z26__device_stub__add_vectorsPiS_S_
.addrsig_sym __hip_module_ctor
.addrsig_sym __hip_module_dtor
.addrsig_sym _Z11add_vectorsPiS_S_
.addrsig_sym __hip_fatbin
.addrsig_sym __hip_fatbin_wrapper
.addrsig_sym __hip_cuid_ |
You are a helpful coding assistant specialized in converting CUDA source code to CUDA device assembly. | #include <thrust/device_vector.h>
#include <thrust/transform.h>
#include <thrust/sequence.h>
#include <thrust/copy.h>
#include <thrust/fill.h>
#include <thrust/replace.h>
#include <thrust/functional.h>
#include <iostream>
#include <vector>
template <typename T>
std::vector<std::vector<T> > matrix_wise_plus(std::vector<std::vector<T> > mat, T nb)
{
unsigned int row_size, col_size;
col_size = mat.size();
row_size = mat[0].size();
thrust::device_vector<float> d_mat(row_size * col_size);
thrust::device_vector<float> d_result(row_size * col_size);
for (unsigned int i = 0; i < col_size; i += 1)
thrust::copy(mat[i].begin(), mat[i].end(), d_mat.begin() + (i * row_size));
thrust::fill(d_result.begin(), d_result.end(), nb);
thrust::transform(d_mat.begin(), d_mat.end(), d_result.begin(), d_result.begin(), thrust::plus<float>());
for (unsigned int i = 0; i < col_size; i += 1)
thrust::copy(d_result.begin() + (i * row_size), d_result.begin() + (i * row_size) + row_size, mat[i].begin());
return (mat);
}
int main(void)
{
std::vector< std::vector<float> > mat(3, std::vector< float >(3, 1.1));
for (int i = 0; i < 3; i++)
{
mat[1][i] = 4.4;
mat[2][i] = 7.7;
}
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
std::cout << mat[i][j] << " ";
std::cout << std::endl;
}
std::cout << std::endl;
mat = matrix_wise_plus(mat, 1.1f);
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
std::cout << mat[i][j] << " ";
std::cout << std::endl;
}
return (0);
}
// int main(void)
// {
// // allocate three device_vectors with 10 elements
// thrust::device_vector<float> X(10);
// thrust::device_vector<float> Y(10);
// thrust::device_vector<float> Z(10);
// // initialize X to 0,1,2,3, ....
// // thrust::sequence(X.begin(), X.end());
// for (float i = 0; i < 10; i++)
// X[i] = i;
// // // compute Y = -X
// // thrust::transform(X.begin(), X.end(), Y.begin(), thrust::negate<int>());
// // fill Z with twos
// thrust::fill(Z.begin(), Z.end(), 10);
// // // compute Y = X mod 2
// thrust::transform(X.begin(), X.end(), Z.begin(), Y.begin(), thrust::plus<int>());
// // // replace all the ones in Y with tens
// // thrust::replace(Y.begin(), Y.end(), 1, 10);
// // print Y
// // thrust::copy(Y.begin(), Y.end(), std::ostream_iterator<int>(std::cout, "\n"));
// Sf a;
// for (int i = 0; i < 10; i++)
// {
// a = Z[i];
// std::cout << a << std::endl;
// }
// return 0;
// }
// #include <thrust/device_vector.h>
// #include <thrust/transform.h>
// #include <thrust/sequence.h>
// #include <thrust/copy.h>
// #include <thrust/fill.h>
// #include <thrust/replace.h>
// #include <thrust/functional.h>
// #include <iostream>
// #include <vector>
// template <typename T>
// struct apx_functor
// {
// const T a;
// apx_functor(T _a) : a(_a) {}
// __host__ __device__
// T operator()(const T& x) const {
// return a + x;
// }
// };
// template <typename T>
// void apx_fast(T A, thrust::device_vector<T>& X, thrust::device_vector<T>& Y)
// {
// // Y <- A + X
// thrust::transform(X.begin(), X.end(), Y.begin(), Y.begin(), apx_functor(A));
// thrust::copy(Y.begin(), Y.end(), std::ostream_iterator<int>(std::cout, "\n"));
// }
// // square<T> computes the square of a number f(x) -> x*x
// template <typename T>
// struct square
// {
// __host__ __device__
// T operator()(const T& x) const {
// return x * x;
// }
// };
// int main(void)
// {
// // initialize host array
// std::vector<float> x;
// std::vector<float> y;
// for (int i = 0; i < 4; i++)
// x.push_back(float(i));
// // transfer to device
// thrust::device_vector<float> d_x(x.begin(), x.end());
// thrust::device_vector<float> d_y(x.begin(), x.end());
// apx_fast(float(5.), d_x, d_y);
// // setup arguments
// square<float> unary_op;
// thrust::plus<float> binary_op;
// float init = 0;
// // compute norm
// float norm = std::sqrt(thrust::transform_reduce(d_x.begin(), d_x.end(), unary_op, init, binary_op));
// std::cout << norm << std::endl;
// return 0;
// } | code for sm_80
Function : _ZN3cub17CUB_200700_800_NS6detail8for_each13static_kernelINS2_12policy_hub_t12policy_350_tElN6thrust20THRUST_200700_800_NS8cuda_cub11__transform18binary_transform_fINS7_6detail15normal_iteratorINS7_10device_ptrIfEEEESF_SF_NS9_14no_stencil_tagENS7_4plusIfEENS9_21always_true_predicateEEEEEvT0_T1_
.headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)"
/*0000*/ IMAD.MOV.U32 R1, RZ, RZ, c[0x0][0x28] ; /* 0x00000a00ff017624 */
/* 0x000fe400078e00ff */
/*0010*/ S2R R2, SR_CTAID.X ; /* 0x0000000000027919 */
/* 0x000e220000002500 */
/*0020*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */
/* 0x000fc60000000a00 */
/*0030*/ S2R R9, SR_TID.X ; /* 0x0000000000097919 */
/* 0x000e620000002100 */
/*0040*/ IMAD.WIDE.U32 R2, R2, 0x200, RZ ; /* 0x0000020002027825 */
/* 0x001fca00078e00ff */
/*0050*/ IADD3 R0, P1, R2.reuse, R9, RZ ; /* 0x0000000902007210 */
/* 0x042fe40007f3e0ff */
/*0060*/ IADD3 R8, P0, -R2, c[0x0][0x160], RZ ; /* 0x0000580002087a10 */
/* 0x000fc60007f1e1ff */
/*0070*/ IMAD.X R5, RZ, RZ, R3, P1 ; /* 0x000000ffff057224 */
/* 0x000fe200008e0603 */
/*0080*/ IADD3.X R3, ~R3, c[0x0][0x164], RZ, P0, !PT ; /* 0x0000590003037a10 */
/* 0x000fe200007fe5ff */
/*0090*/ IMAD.SHL.U32 R2, R0, 0x4, RZ ; /* 0x0000000400027824 */
/* 0x000fe200078e00ff */
/*00a0*/ ISETP.GT.U32.AND P0, PT, R8, 0x1ff, PT ; /* 0x000001ff0800780c */
/* 0x000fe40003f04070 */
/*00b0*/ SHF.L.U64.HI R0, R0, 0x2, R5 ; /* 0x0000000200007819 */
/* 0x000fe40000010205 */
/*00c0*/ ISETP.GT.AND.EX P0, PT, R3, RZ, PT, P0 ; /* 0x000000ff0300720c */
/* 0x000fe40003f04300 */
/*00d0*/ IADD3 R4, P1, R2.reuse, c[0x0][0x168], RZ ; /* 0x00005a0002047a10 */
/* 0x040fe40007f3e0ff */
/*00e0*/ IADD3 R6, P2, R2, c[0x0][0x170], RZ ; /* 0x00005c0002067a10 */
/* 0x000fc40007f5e0ff */
/*00f0*/ IADD3 R2, P3, R2, c[0x0][0x178], RZ ; /* 0x00005e0002027a10 */
/* 0x000fe40007f7e0ff */
/*0100*/ IADD3.X R5, R0.reuse, c[0x0][0x16c], RZ, P1, !PT ; /* 0x00005b0000057a10 */
/* 0x040fe40000ffe4ff */
/*0110*/ IADD3.X R7, R0.reuse, c[0x0][0x174], RZ, P2, !PT ; /* 0x00005d0000077a10 */
/* 0x040fe400017fe4ff */
/*0120*/ IADD3.X R3, R0, c[0x0][0x17c], RZ, P3, !PT ; /* 0x00005f0000037a10 */
/* 0x000fe20001ffe4ff */
/*0130*/ @P0 BRA 0x270 ; /* 0x0000013000000947 */
/* 0x000fea0003800000 */
/*0140*/ IADD3 R0, R9, 0x100, RZ ; /* 0x0000010009007810 */
/* 0x000fe20007ffe0ff */
/*0150*/ BSSY B0, 0x210 ; /* 0x000000b000007945 */
/* 0x000fe20003800000 */
/*0160*/ ISETP.GT.U32.AND P0, PT, R8, R9, PT ; /* 0x000000090800720c */
/* 0x000fe40003f04070 */
/*0170*/ SHF.R.S32.HI R9, RZ, 0x1f, R8 ; /* 0x0000001fff097819 */
/* 0x000fc40000011408 */
/*0180*/ ISETP.GT.U32.AND P1, PT, R8, R0, PT ; /* 0x000000000800720c */
/* 0x000fe40003f24070 */
/*0190*/ ISETP.GT.AND.EX P0, PT, R9.reuse, RZ, PT, P0 ; /* 0x000000ff0900720c */
/* 0x040fe40003f04300 */
/*01a0*/ ISETP.GT.AND.EX P1, PT, R9, RZ, PT, P1 ; /* 0x000000ff0900720c */
/* 0x000fd60003f24310 */
/*01b0*/ @!P0 BRA 0x200 ; /* 0x0000004000008947 */
/* 0x000fea0003800000 */
/*01c0*/ LDG.E R0, [R4.64] ; /* 0x0000000404007981 */
/* 0x000ea8000c1e1900 */
/*01d0*/ LDG.E R9, [R6.64] ; /* 0x0000000406097981 */
/* 0x000ea4000c1e1900 */
/*01e0*/ FADD R9, R0, R9 ; /* 0x0000000900097221 */
/* 0x004fca0000000000 */
/*01f0*/ STG.E [R2.64], R9 ; /* 0x0000000902007986 */
/* 0x0001e4000c101904 */
/*0200*/ BSYNC B0 ; /* 0x0000000000007941 */
/* 0x000fea0003800000 */
/*0210*/ @!P1 EXIT ; /* 0x000000000000994d */
/* 0x000fea0003800000 */
/*0220*/ LDG.E R6, [R6.64+0x400] ; /* 0x0004000406067981 */
/* 0x000ea8000c1e1900 */
/*0230*/ LDG.E R5, [R4.64+0x400] ; /* 0x0004000404057981 */
/* 0x000ea4000c1e1900 */
/*0240*/ FADD R9, R6, R5 ; /* 0x0000000506097221 */
/* 0x005fca0000000000 */
/*0250*/ STG.E [R2.64+0x400], R9 ; /* 0x0004000902007986 */
/* 0x000fe2000c101904 */
/*0260*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*0270*/ LDG.E R0, [R4.64] ; /* 0x0000000404007981 */
/* 0x000ea8000c1e1900 */
/*0280*/ LDG.E R9, [R6.64] ; /* 0x0000000406097981 */
/* 0x000ea4000c1e1900 */
/*0290*/ FADD R9, R0, R9 ; /* 0x0000000900097221 */
/* 0x004fca0000000000 */
/*02a0*/ STG.E [R2.64], R9 ; /* 0x0000000902007986 */
/* 0x000fe8000c101904 */
/*02b0*/ LDG.E R0, [R6.64+0x400] ; /* 0x0004000406007981 */
/* 0x000ea8000c1e1900 */
/*02c0*/ LDG.E R11, [R4.64+0x400] ; /* 0x00040004040b7981 */
/* 0x000ea4000c1e1900 */
/*02d0*/ FADD R11, R0, R11 ; /* 0x0000000b000b7221 */
/* 0x004fca0000000000 */
/*02e0*/ STG.E [R2.64+0x400], R11 ; /* 0x0004000b02007986 */
/* 0x000fe2000c101904 */
/*02f0*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*0300*/ BRA 0x300; /* 0xfffffff000007947 */
/* 0x000fc0000383ffff */
/*0310*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0320*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0330*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0340*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0350*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0360*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0370*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0380*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0390*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*03a0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*03b0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*03c0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*03d0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*03e0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*03f0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
..........
Function : _ZN3cub17CUB_200700_800_NS6detail8for_each13static_kernelINS2_12policy_hub_t12policy_350_tElN6thrust20THRUST_200700_800_NS8cuda_cub6__fill7functorINS7_6detail15normal_iteratorINS7_10device_ptrIfEEEEfEEEEvT0_T1_
.headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)"
/*0000*/ IMAD.MOV.U32 R1, RZ, RZ, c[0x0][0x28] ; /* 0x00000a00ff017624 */
/* 0x000fe400078e00ff */
/*0010*/ S2R R2, SR_CTAID.X ; /* 0x0000000000027919 */
/* 0x000e220000002500 */
/*0020*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */
/* 0x000fc60000000a00 */
/*0030*/ S2R R5, SR_TID.X ; /* 0x0000000000057919 */
/* 0x000e620000002100 */
/*0040*/ IMAD.WIDE.U32 R2, R2, 0x200, RZ ; /* 0x0000020002027825 */
/* 0x001fca00078e00ff */
/*0050*/ IADD3 R4, P1, -R2.reuse, c[0x0][0x160], RZ ; /* 0x0000580002047a10 */
/* 0x040fe40007f3e1ff */
/*0060*/ IADD3 R0, P2, R2, R5, RZ ; /* 0x0000000502007210 */
/* 0x002fe40007f5e0ff */
/*0070*/ ISETP.GT.U32.AND P0, PT, R4, 0x1ff, PT ; /* 0x000001ff0400780c */
/* 0x000fe40003f04070 */
/*0080*/ IADD3.X R6, ~R3, c[0x0][0x164], RZ, P1, !PT ; /* 0x0000590003067a10 */
/* 0x000fe20000ffe5ff */
/*0090*/ IMAD.X R3, RZ, RZ, R3, P2 ; /* 0x000000ffff037224 */
/* 0x000fe200010e0603 */
/*00a0*/ LEA R2, P1, R0, c[0x0][0x168], 0x2 ; /* 0x00005a0000027a11 */
/* 0x000fe400078210ff */
/*00b0*/ ISETP.GT.AND.EX P0, PT, R6, RZ, PT, P0 ; /* 0x000000ff0600720c */
/* 0x000fc40003f04300 */
/*00c0*/ LEA.HI.X R3, R0, c[0x0][0x16c], R3, 0x2, P1 ; /* 0x00005b0000037a11 */
/* 0x000fd600008f1403 */
/*00d0*/ @P0 BRA 0x1a0 ; /* 0x000000c000000947 */
/* 0x000fea0003800000 */
/*00e0*/ ISETP.GT.U32.AND P0, PT, R4, R5, PT ; /* 0x000000050400720c */
/* 0x000fe40003f04070 */
/*00f0*/ SHF.R.S32.HI R6, RZ, 0x1f, R4 ; /* 0x0000001fff067819 */
/* 0x000fe40000011404 */
/*0100*/ IADD3 R0, R5, 0x100, RZ ; /* 0x0000010005007810 */
/* 0x000fe40007ffe0ff */
/*0110*/ ISETP.GT.AND.EX P0, PT, R6, RZ, PT, P0 ; /* 0x000000ff0600720c */
/* 0x000fda0003f04300 */
/*0120*/ @P0 IMAD.MOV.U32 R7, RZ, RZ, c[0x0][0x170] ; /* 0x00005c00ff070624 */
/* 0x000fca00078e00ff */
/*0130*/ @P0 STG.E [R2.64], R7 ; /* 0x0000000702000986 */
/* 0x0001e2000c101904 */
/*0140*/ ISETP.GT.U32.AND P0, PT, R4, R0, PT ; /* 0x000000000400720c */
/* 0x000fc80003f04070 */
/*0150*/ ISETP.GT.AND.EX P0, PT, R6, RZ, PT, P0 ; /* 0x000000ff0600720c */
/* 0x000fda0003f04300 */
/*0160*/ @!P0 EXIT ; /* 0x000000000000894d */
/* 0x000fea0003800000 */
/*0170*/ IMAD.MOV.U32 R5, RZ, RZ, c[0x0][0x170] ; /* 0x00005c00ff057624 */
/* 0x001fca00078e00ff */
/*0180*/ STG.E [R2.64+0x400], R5 ; /* 0x0004000502007986 */
/* 0x000fe2000c101904 */
/*0190*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*01a0*/ IMAD.MOV.U32 R5, RZ, RZ, c[0x0][0x170] ; /* 0x00005c00ff057624 */
/* 0x000fca00078e00ff */
/*01b0*/ STG.E [R2.64], R5 ; /* 0x0000000502007986 */
/* 0x000fe8000c101904 */
/*01c0*/ STG.E [R2.64+0x400], R5 ; /* 0x0004000502007986 */
/* 0x000fe2000c101904 */
/*01d0*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*01e0*/ BRA 0x1e0; /* 0xfffffff000007947 */
/* 0x000fc0000383ffff */
/*01f0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0200*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0210*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0220*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0230*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0240*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0250*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0260*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0270*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
..........
Function : _ZN3cub17CUB_200700_800_NS6detail8for_each13static_kernelINS2_12policy_hub_t12policy_350_tEmN6thrust20THRUST_200700_800_NS8cuda_cub20__uninitialized_fill7functorINS7_10device_ptrIfEEfEEEEvT0_T1_
.headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)"
/*0000*/ IMAD.MOV.U32 R1, RZ, RZ, c[0x0][0x28] ; /* 0x00000a00ff017624 */
/* 0x000fe400078e00ff */
/*0010*/ S2R R2, SR_CTAID.X ; /* 0x0000000000027919 */
/* 0x000e220000002500 */
/*0020*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */
/* 0x000fc60000000a00 */
/*0030*/ S2R R5, SR_TID.X ; /* 0x0000000000057919 */
/* 0x000e620000002100 */
/*0040*/ IMAD.WIDE.U32 R2, R2, 0x200, RZ ; /* 0x0000020002027825 */
/* 0x001fca00078e00ff */
/*0050*/ IADD3 R4, P1, -R2.reuse, c[0x0][0x160], RZ ; /* 0x0000580002047a10 */
/* 0x040fe40007f3e1ff */
/*0060*/ IADD3 R0, P2, R2, R5, RZ ; /* 0x0000000502007210 */
/* 0x002fe40007f5e0ff */
/*0070*/ ISETP.GT.U32.AND P0, PT, R4, 0x1ff, PT ; /* 0x000001ff0400780c */
/* 0x000fe40003f04070 */
/*0080*/ IADD3.X R6, ~R3, c[0x0][0x164], RZ, P1, !PT ; /* 0x0000590003067a10 */
/* 0x000fe20000ffe5ff */
/*0090*/ IMAD.X R3, RZ, RZ, R3, P2 ; /* 0x000000ffff037224 */
/* 0x000fe200010e0603 */
/*00a0*/ LEA R2, P1, R0, c[0x0][0x168], 0x2 ; /* 0x00005a0000027a11 */
/* 0x000fe400078210ff */
/*00b0*/ ISETP.GT.U32.AND.EX P0, PT, R6, RZ, PT, P0 ; /* 0x000000ff0600720c */
/* 0x000fc40003f04100 */
/*00c0*/ LEA.HI.X R3, R0, c[0x0][0x16c], R3, 0x2, P1 ; /* 0x00005b0000037a11 */
/* 0x000fd600008f1403 */
/*00d0*/ @P0 BRA 0x1a0 ; /* 0x000000c000000947 */
/* 0x000fea0003800000 */
/*00e0*/ ISETP.GT.U32.AND P0, PT, R4, R5, PT ; /* 0x000000050400720c */
/* 0x000fe40003f04070 */
/*00f0*/ SHF.R.S32.HI R6, RZ, 0x1f, R4 ; /* 0x0000001fff067819 */
/* 0x000fe40000011404 */
/*0100*/ IADD3 R0, R5, 0x100, RZ ; /* 0x0000010005007810 */
/* 0x000fe40007ffe0ff */
/*0110*/ ISETP.GT.U32.AND.EX P0, PT, R6, RZ, PT, P0 ; /* 0x000000ff0600720c */
/* 0x000fda0003f04100 */
/*0120*/ @P0 IMAD.MOV.U32 R7, RZ, RZ, c[0x0][0x170] ; /* 0x00005c00ff070624 */
/* 0x000fca00078e00ff */
/*0130*/ @P0 STG.E [R2.64], R7 ; /* 0x0000000702000986 */
/* 0x0001e2000c101904 */
/*0140*/ ISETP.GT.U32.AND P0, PT, R4, R0, PT ; /* 0x000000000400720c */
/* 0x000fc80003f04070 */
/*0150*/ ISETP.GT.U32.AND.EX P0, PT, R6, RZ, PT, P0 ; /* 0x000000ff0600720c */
/* 0x000fda0003f04100 */
/*0160*/ @!P0 EXIT ; /* 0x000000000000894d */
/* 0x000fea0003800000 */
/*0170*/ IMAD.MOV.U32 R5, RZ, RZ, c[0x0][0x170] ; /* 0x00005c00ff057624 */
/* 0x001fca00078e00ff */
/*0180*/ STG.E [R2.64+0x400], R5 ; /* 0x0004000502007986 */
/* 0x000fe2000c101904 */
/*0190*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*01a0*/ IMAD.MOV.U32 R5, RZ, RZ, c[0x0][0x170] ; /* 0x00005c00ff057624 */
/* 0x000fca00078e00ff */
/*01b0*/ STG.E [R2.64], R5 ; /* 0x0000000502007986 */
/* 0x000fe8000c101904 */
/*01c0*/ STG.E [R2.64+0x400], R5 ; /* 0x0004000502007986 */
/* 0x000fe2000c101904 */
/*01d0*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*01e0*/ BRA 0x1e0; /* 0xfffffff000007947 */
/* 0x000fc0000383ffff */
/*01f0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0200*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0210*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0220*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0230*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0240*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0250*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0260*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0270*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
..........
Function : _ZN3cub17CUB_200700_800_NS11EmptyKernelIvEEvv
.headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)"
/*0000*/ MOV R1, c[0x0][0x28] ; /* 0x00000a0000017a02 */
/* 0x000fe40000000f00 */
/*0010*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*0020*/ BRA 0x20; /* 0xfffffff000007947 */
/* 0x000fc0000383ffff */
/*0030*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0040*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0050*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0060*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0070*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0080*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0090*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*00a0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*00b0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*00c0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*00d0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*00e0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*00f0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
.......... |
You are a helpful coding assistant specialized in converting CUDA source code to HIP/AMD source code. | #include <thrust/device_vector.h>
#include <thrust/transform.h>
#include <thrust/sequence.h>
#include <thrust/copy.h>
#include <thrust/fill.h>
#include <thrust/replace.h>
#include <thrust/functional.h>
#include <iostream>
#include <vector>
template <typename T>
std::vector<std::vector<T> > matrix_wise_plus(std::vector<std::vector<T> > mat, T nb)
{
unsigned int row_size, col_size;
col_size = mat.size();
row_size = mat[0].size();
thrust::device_vector<float> d_mat(row_size * col_size);
thrust::device_vector<float> d_result(row_size * col_size);
for (unsigned int i = 0; i < col_size; i += 1)
thrust::copy(mat[i].begin(), mat[i].end(), d_mat.begin() + (i * row_size));
thrust::fill(d_result.begin(), d_result.end(), nb);
thrust::transform(d_mat.begin(), d_mat.end(), d_result.begin(), d_result.begin(), thrust::plus<float>());
for (unsigned int i = 0; i < col_size; i += 1)
thrust::copy(d_result.begin() + (i * row_size), d_result.begin() + (i * row_size) + row_size, mat[i].begin());
return (mat);
}
int main(void)
{
std::vector< std::vector<float> > mat(3, std::vector< float >(3, 1.1));
for (int i = 0; i < 3; i++)
{
mat[1][i] = 4.4;
mat[2][i] = 7.7;
}
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
std::cout << mat[i][j] << " ";
std::cout << std::endl;
}
std::cout << std::endl;
mat = matrix_wise_plus(mat, 1.1f);
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
std::cout << mat[i][j] << " ";
std::cout << std::endl;
}
return (0);
}
// int main(void)
// {
// // allocate three device_vectors with 10 elements
// thrust::device_vector<float> X(10);
// thrust::device_vector<float> Y(10);
// thrust::device_vector<float> Z(10);
// // initialize X to 0,1,2,3, ....
// // thrust::sequence(X.begin(), X.end());
// for (float i = 0; i < 10; i++)
// X[i] = i;
// // // compute Y = -X
// // thrust::transform(X.begin(), X.end(), Y.begin(), thrust::negate<int>());
// // fill Z with twos
// thrust::fill(Z.begin(), Z.end(), 10);
// // // compute Y = X mod 2
// thrust::transform(X.begin(), X.end(), Z.begin(), Y.begin(), thrust::plus<int>());
// // // replace all the ones in Y with tens
// // thrust::replace(Y.begin(), Y.end(), 1, 10);
// // print Y
// // thrust::copy(Y.begin(), Y.end(), std::ostream_iterator<int>(std::cout, "\n"));
// Sf a;
// for (int i = 0; i < 10; i++)
// {
// a = Z[i];
// std::cout << a << std::endl;
// }
// return 0;
// }
// #include <thrust/device_vector.h>
// #include <thrust/transform.h>
// #include <thrust/sequence.h>
// #include <thrust/copy.h>
// #include <thrust/fill.h>
// #include <thrust/replace.h>
// #include <thrust/functional.h>
// #include <iostream>
// #include <vector>
// template <typename T>
// struct apx_functor
// {
// const T a;
// apx_functor(T _a) : a(_a) {}
// __host__ __device__
// T operator()(const T& x) const {
// return a + x;
// }
// };
// template <typename T>
// void apx_fast(T A, thrust::device_vector<T>& X, thrust::device_vector<T>& Y)
// {
// // Y <- A + X
// thrust::transform(X.begin(), X.end(), Y.begin(), Y.begin(), apx_functor(A));
// thrust::copy(Y.begin(), Y.end(), std::ostream_iterator<int>(std::cout, "\n"));
// }
// // square<T> computes the square of a number f(x) -> x*x
// template <typename T>
// struct square
// {
// __host__ __device__
// T operator()(const T& x) const {
// return x * x;
// }
// };
// int main(void)
// {
// // initialize host array
// std::vector<float> x;
// std::vector<float> y;
// for (int i = 0; i < 4; i++)
// x.push_back(float(i));
// // transfer to device
// thrust::device_vector<float> d_x(x.begin(), x.end());
// thrust::device_vector<float> d_y(x.begin(), x.end());
// apx_fast(float(5.), d_x, d_y);
// // setup arguments
// square<float> unary_op;
// thrust::plus<float> binary_op;
// float init = 0;
// // compute norm
// float norm = std::sqrt(thrust::transform_reduce(d_x.begin(), d_x.end(), unary_op, init, binary_op));
// std::cout << norm << std::endl;
// return 0;
// } | #include <hip/hip_runtime.h>
#include <thrust/device_vector.h>
#include <thrust/transform.h>
#include <thrust/sequence.h>
#include <thrust/copy.h>
#include <thrust/fill.h>
#include <thrust/replace.h>
#include <thrust/functional.h>
#include <iostream>
#include <vector>
template <typename T>
std::vector<std::vector<T> > matrix_wise_plus(std::vector<std::vector<T> > mat, T nb)
{
unsigned int row_size, col_size;
col_size = mat.size();
row_size = mat[0].size();
thrust::device_vector<float> d_mat(row_size * col_size);
thrust::device_vector<float> d_result(row_size * col_size);
for (unsigned int i = 0; i < col_size; i += 1)
thrust::copy(mat[i].begin(), mat[i].end(), d_mat.begin() + (i * row_size));
thrust::fill(d_result.begin(), d_result.end(), nb);
thrust::transform(d_mat.begin(), d_mat.end(), d_result.begin(), d_result.begin(), thrust::plus<float>());
for (unsigned int i = 0; i < col_size; i += 1)
thrust::copy(d_result.begin() + (i * row_size), d_result.begin() + (i * row_size) + row_size, mat[i].begin());
return (mat);
}
int main(void)
{
std::vector< std::vector<float> > mat(3, std::vector< float >(3, 1.1));
for (int i = 0; i < 3; i++)
{
mat[1][i] = 4.4;
mat[2][i] = 7.7;
}
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
std::cout << mat[i][j] << " ";
std::cout << std::endl;
}
std::cout << std::endl;
mat = matrix_wise_plus(mat, 1.1f);
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
std::cout << mat[i][j] << " ";
std::cout << std::endl;
}
return (0);
}
// int main(void)
// {
// // allocate three device_vectors with 10 elements
// thrust::device_vector<float> X(10);
// thrust::device_vector<float> Y(10);
// thrust::device_vector<float> Z(10);
// // initialize X to 0,1,2,3, ....
// // thrust::sequence(X.begin(), X.end());
// for (float i = 0; i < 10; i++)
// X[i] = i;
// // // compute Y = -X
// // thrust::transform(X.begin(), X.end(), Y.begin(), thrust::negate<int>());
// // fill Z with twos
// thrust::fill(Z.begin(), Z.end(), 10);
// // // compute Y = X mod 2
// thrust::transform(X.begin(), X.end(), Z.begin(), Y.begin(), thrust::plus<int>());
// // // replace all the ones in Y with tens
// // thrust::replace(Y.begin(), Y.end(), 1, 10);
// // print Y
// // thrust::copy(Y.begin(), Y.end(), std::ostream_iterator<int>(std::cout, "\n"));
// Sf a;
// for (int i = 0; i < 10; i++)
// {
// a = Z[i];
// std::cout << a << std::endl;
// }
// return 0;
// }
// #include <thrust/device_vector.h>
// #include <thrust/transform.h>
// #include <thrust/sequence.h>
// #include <thrust/copy.h>
// #include <thrust/fill.h>
// #include <thrust/replace.h>
// #include <thrust/functional.h>
// #include <iostream>
// #include <vector>
// template <typename T>
// struct apx_functor
// {
// const T a;
// apx_functor(T _a) : a(_a) {}
// __host__ __device__
// T operator()(const T& x) const {
// return a + x;
// }
// };
// template <typename T>
// void apx_fast(T A, thrust::device_vector<T>& X, thrust::device_vector<T>& Y)
// {
// // Y <- A + X
// thrust::transform(X.begin(), X.end(), Y.begin(), Y.begin(), apx_functor(A));
// thrust::copy(Y.begin(), Y.end(), std::ostream_iterator<int>(std::cout, "\n"));
// }
// // square<T> computes the square of a number f(x) -> x*x
// template <typename T>
// struct square
// {
// __host__ __device__
// T operator()(const T& x) const {
// return x * x;
// }
// };
// int main(void)
// {
// // initialize host array
// std::vector<float> x;
// std::vector<float> y;
// for (int i = 0; i < 4; i++)
// x.push_back(float(i));
// // transfer to device
// thrust::device_vector<float> d_x(x.begin(), x.end());
// thrust::device_vector<float> d_y(x.begin(), x.end());
// apx_fast(float(5.), d_x, d_y);
// // setup arguments
// square<float> unary_op;
// thrust::plus<float> binary_op;
// float init = 0;
// // compute norm
// float norm = std::sqrt(thrust::transform_reduce(d_x.begin(), d_x.end(), unary_op, init, binary_op));
// std::cout << norm << std::endl;
// return 0;
// } |
You are a helpful coding assistant specialized in converting HIP source code to AMD device assembly. | #include <hip/hip_runtime.h>
#include <thrust/device_vector.h>
#include <thrust/transform.h>
#include <thrust/sequence.h>
#include <thrust/copy.h>
#include <thrust/fill.h>
#include <thrust/replace.h>
#include <thrust/functional.h>
#include <iostream>
#include <vector>
template <typename T>
std::vector<std::vector<T> > matrix_wise_plus(std::vector<std::vector<T> > mat, T nb)
{
unsigned int row_size, col_size;
col_size = mat.size();
row_size = mat[0].size();
thrust::device_vector<float> d_mat(row_size * col_size);
thrust::device_vector<float> d_result(row_size * col_size);
for (unsigned int i = 0; i < col_size; i += 1)
thrust::copy(mat[i].begin(), mat[i].end(), d_mat.begin() + (i * row_size));
thrust::fill(d_result.begin(), d_result.end(), nb);
thrust::transform(d_mat.begin(), d_mat.end(), d_result.begin(), d_result.begin(), thrust::plus<float>());
for (unsigned int i = 0; i < col_size; i += 1)
thrust::copy(d_result.begin() + (i * row_size), d_result.begin() + (i * row_size) + row_size, mat[i].begin());
return (mat);
}
int main(void)
{
std::vector< std::vector<float> > mat(3, std::vector< float >(3, 1.1));
for (int i = 0; i < 3; i++)
{
mat[1][i] = 4.4;
mat[2][i] = 7.7;
}
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
std::cout << mat[i][j] << " ";
std::cout << std::endl;
}
std::cout << std::endl;
mat = matrix_wise_plus(mat, 1.1f);
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
std::cout << mat[i][j] << " ";
std::cout << std::endl;
}
return (0);
}
// int main(void)
// {
// // allocate three device_vectors with 10 elements
// thrust::device_vector<float> X(10);
// thrust::device_vector<float> Y(10);
// thrust::device_vector<float> Z(10);
// // initialize X to 0,1,2,3, ....
// // thrust::sequence(X.begin(), X.end());
// for (float i = 0; i < 10; i++)
// X[i] = i;
// // // compute Y = -X
// // thrust::transform(X.begin(), X.end(), Y.begin(), thrust::negate<int>());
// // fill Z with twos
// thrust::fill(Z.begin(), Z.end(), 10);
// // // compute Y = X mod 2
// thrust::transform(X.begin(), X.end(), Z.begin(), Y.begin(), thrust::plus<int>());
// // // replace all the ones in Y with tens
// // thrust::replace(Y.begin(), Y.end(), 1, 10);
// // print Y
// // thrust::copy(Y.begin(), Y.end(), std::ostream_iterator<int>(std::cout, "\n"));
// Sf a;
// for (int i = 0; i < 10; i++)
// {
// a = Z[i];
// std::cout << a << std::endl;
// }
// return 0;
// }
// #include <thrust/device_vector.h>
// #include <thrust/transform.h>
// #include <thrust/sequence.h>
// #include <thrust/copy.h>
// #include <thrust/fill.h>
// #include <thrust/replace.h>
// #include <thrust/functional.h>
// #include <iostream>
// #include <vector>
// template <typename T>
// struct apx_functor
// {
// const T a;
// apx_functor(T _a) : a(_a) {}
// __host__ __device__
// T operator()(const T& x) const {
// return a + x;
// }
// };
// template <typename T>
// void apx_fast(T A, thrust::device_vector<T>& X, thrust::device_vector<T>& Y)
// {
// // Y <- A + X
// thrust::transform(X.begin(), X.end(), Y.begin(), Y.begin(), apx_functor(A));
// thrust::copy(Y.begin(), Y.end(), std::ostream_iterator<int>(std::cout, "\n"));
// }
// // square<T> computes the square of a number f(x) -> x*x
// template <typename T>
// struct square
// {
// __host__ __device__
// T operator()(const T& x) const {
// return x * x;
// }
// };
// int main(void)
// {
// // initialize host array
// std::vector<float> x;
// std::vector<float> y;
// for (int i = 0; i < 4; i++)
// x.push_back(float(i));
// // transfer to device
// thrust::device_vector<float> d_x(x.begin(), x.end());
// thrust::device_vector<float> d_y(x.begin(), x.end());
// apx_fast(float(5.), d_x, d_y);
// // setup arguments
// square<float> unary_op;
// thrust::plus<float> binary_op;
// float init = 0;
// // compute norm
// float norm = std::sqrt(thrust::transform_reduce(d_x.begin(), d_x.end(), unary_op, init, binary_op));
// std::cout << norm << std::endl;
// return 0;
// } | .text
.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
.section .text._ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_,"axG",@progbits,_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_,comdat
.protected _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_
.globl _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_
.p2align 8
.type _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_,@function
_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_:
s_load_b128 s[4:7], s[0:1], 0x10
s_lshl_b32 s2, s15, 8
s_waitcnt lgkmcnt(0)
s_add_u32 s2, s2, s6
s_addc_u32 s3, 0, s7
s_sub_u32 s4, s4, s2
s_subb_u32 s5, s5, s3
s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_cmp_gt_u64_e64 s5, 0x100, s[4:5]
s_and_b32 s5, s5, exec_lo
s_cselect_b32 s4, s4, 0x100
s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
v_cmp_gt_u32_e32 vcc_lo, s4, v0
s_cmpk_eq_i32 s4, 0x100
s_cselect_b32 s4, -1, 0
s_or_b32 s4, s4, vcc_lo
s_delay_alu instid0(SALU_CYCLE_1)
s_and_saveexec_b32 s5, s4
s_cbranch_execz .LBB0_2
s_clause 0x1
s_load_b64 s[4:5], s[0:1], 0x0
s_load_b32 s6, s[0:1], 0x8
v_lshlrev_b32_e32 v0, 2, v0
s_lshl_b64 s[0:1], s[2:3], 2
s_waitcnt lgkmcnt(0)
s_add_u32 s0, s4, s0
s_addc_u32 s1, s5, s1
v_add_co_u32 v0, s0, s0, v0
s_delay_alu instid0(VALU_DEP_1)
v_add_co_ci_u32_e64 v1, null, s1, 0, s0
v_mov_b32_e32 v2, s6
flat_store_b32 v[0:1], v2
.LBB0_2:
s_endpgm
.section .rodata,"a",@progbits
.p2align 6, 0x0
.amdhsa_kernel _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_
.amdhsa_group_segment_fixed_size 0
.amdhsa_private_segment_fixed_size 0
.amdhsa_kernarg_size 32
.amdhsa_user_sgpr_count 15
.amdhsa_user_sgpr_dispatch_ptr 0
.amdhsa_user_sgpr_queue_ptr 0
.amdhsa_user_sgpr_kernarg_segment_ptr 1
.amdhsa_user_sgpr_dispatch_id 0
.amdhsa_user_sgpr_private_segment_size 0
.amdhsa_wavefront_size32 1
.amdhsa_uses_dynamic_stack 0
.amdhsa_enable_private_segment 0
.amdhsa_system_sgpr_workgroup_id_x 1
.amdhsa_system_sgpr_workgroup_id_y 0
.amdhsa_system_sgpr_workgroup_id_z 0
.amdhsa_system_sgpr_workgroup_info 0
.amdhsa_system_vgpr_workitem_id 0
.amdhsa_next_free_vgpr 3
.amdhsa_next_free_sgpr 16
.amdhsa_float_round_mode_32 0
.amdhsa_float_round_mode_16_64 0
.amdhsa_float_denorm_mode_32 3
.amdhsa_float_denorm_mode_16_64 3
.amdhsa_dx10_clamp 1
.amdhsa_ieee_mode 1
.amdhsa_fp16_overflow 0
.amdhsa_workgroup_processor_mode 1
.amdhsa_memory_ordered 1
.amdhsa_forward_progress 0
.amdhsa_shared_vgpr_count 0
.amdhsa_exception_fp_ieee_invalid_op 0
.amdhsa_exception_fp_denorm_src 0
.amdhsa_exception_fp_ieee_div_zero 0
.amdhsa_exception_fp_ieee_overflow 0
.amdhsa_exception_fp_ieee_underflow 0
.amdhsa_exception_fp_ieee_inexact 0
.amdhsa_exception_int_div_zero 0
.end_amdhsa_kernel
.section .text._ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_,"axG",@progbits,_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_,comdat
.Lfunc_end0:
.size _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_, .Lfunc_end0-_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_
.section .AMDGPU.csdata,"",@progbits
.section .text._ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrIfEEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESC_lfEET0_RNS0_16execution_policyIT_EESG_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSG_SL_SL_,"axG",@progbits,_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrIfEEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESC_lfEET0_RNS0_16execution_policyIT_EESG_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSG_SL_SL_,comdat
.protected _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrIfEEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESC_lfEET0_RNS0_16execution_policyIT_EESG_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSG_SL_SL_
.globl _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrIfEEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESC_lfEET0_RNS0_16execution_policyIT_EESG_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSG_SL_SL_
.p2align 8
.type _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrIfEEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESC_lfEET0_RNS0_16execution_policyIT_EESG_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSG_SL_SL_,@function
_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrIfEEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESC_lfEET0_RNS0_16execution_policyIT_EESG_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSG_SL_SL_:
s_load_b128 s[4:7], s[0:1], 0x18
s_lshl_b32 s2, s15, 8
s_waitcnt lgkmcnt(0)
s_add_u32 s2, s2, s6
s_addc_u32 s3, 0, s7
s_sub_u32 s4, s4, s2
s_subb_u32 s5, s5, s3
s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_cmp_gt_i64_e64 s5, 0x100, s[4:5]
s_and_b32 s5, s5, exec_lo
s_cselect_b32 s4, s4, 0x100
s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
v_cmp_gt_u32_e32 vcc_lo, s4, v0
s_cmpk_eq_i32 s4, 0x100
s_cselect_b32 s4, -1, 0
s_or_b32 s4, s4, vcc_lo
s_delay_alu instid0(SALU_CYCLE_1)
s_and_saveexec_b32 s5, s4
s_cbranch_execz .LBB1_2
s_clause 0x1
s_load_b64 s[4:5], s[0:1], 0x8
s_load_b32 s6, s[0:1], 0x10
v_lshlrev_b32_e32 v0, 2, v0
s_lshl_b64 s[0:1], s[2:3], 2
s_waitcnt lgkmcnt(0)
s_add_u32 s0, s4, s0
s_addc_u32 s1, s5, s1
v_add_co_u32 v0, s0, s0, v0
s_delay_alu instid0(VALU_DEP_1)
v_add_co_ci_u32_e64 v1, null, s1, 0, s0
v_mov_b32_e32 v2, s6
flat_store_b32 v[0:1], v2
.LBB1_2:
s_endpgm
.section .rodata,"a",@progbits
.p2align 6, 0x0
.amdhsa_kernel _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrIfEEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESC_lfEET0_RNS0_16execution_policyIT_EESG_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSG_SL_SL_
.amdhsa_group_segment_fixed_size 0
.amdhsa_private_segment_fixed_size 0
.amdhsa_kernarg_size 40
.amdhsa_user_sgpr_count 15
.amdhsa_user_sgpr_dispatch_ptr 0
.amdhsa_user_sgpr_queue_ptr 0
.amdhsa_user_sgpr_kernarg_segment_ptr 1
.amdhsa_user_sgpr_dispatch_id 0
.amdhsa_user_sgpr_private_segment_size 0
.amdhsa_wavefront_size32 1
.amdhsa_uses_dynamic_stack 0
.amdhsa_enable_private_segment 0
.amdhsa_system_sgpr_workgroup_id_x 1
.amdhsa_system_sgpr_workgroup_id_y 0
.amdhsa_system_sgpr_workgroup_id_z 0
.amdhsa_system_sgpr_workgroup_info 0
.amdhsa_system_vgpr_workitem_id 0
.amdhsa_next_free_vgpr 3
.amdhsa_next_free_sgpr 16
.amdhsa_float_round_mode_32 0
.amdhsa_float_round_mode_16_64 0
.amdhsa_float_denorm_mode_32 3
.amdhsa_float_denorm_mode_16_64 3
.amdhsa_dx10_clamp 1
.amdhsa_ieee_mode 1
.amdhsa_fp16_overflow 0
.amdhsa_workgroup_processor_mode 1
.amdhsa_memory_ordered 1
.amdhsa_forward_progress 0
.amdhsa_shared_vgpr_count 0
.amdhsa_exception_fp_ieee_invalid_op 0
.amdhsa_exception_fp_denorm_src 0
.amdhsa_exception_fp_ieee_div_zero 0
.amdhsa_exception_fp_ieee_overflow 0
.amdhsa_exception_fp_ieee_underflow 0
.amdhsa_exception_fp_ieee_inexact 0
.amdhsa_exception_int_div_zero 0
.end_amdhsa_kernel
.section .text._ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrIfEEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESC_lfEET0_RNS0_16execution_policyIT_EESG_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSG_SL_SL_,"axG",@progbits,_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrIfEEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESC_lfEET0_RNS0_16execution_policyIT_EESG_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSG_SL_SL_,comdat
.Lfunc_end1:
.size _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrIfEEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESC_lfEET0_RNS0_16execution_policyIT_EESG_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSG_SL_SL_, .Lfunc_end1-_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrIfEEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESC_lfEET0_RNS0_16execution_policyIT_EESG_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSG_SL_SL_
.section .AMDGPU.csdata,"",@progbits
.section .text._ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform18binary_transform_fINS_6detail15normal_iteratorINS_10device_ptrIfEEEES9_S9_NS3_14no_stencil_tagENS_4plusIfEENS3_21always_true_predicateEEElLj1EEEvT0_T1_SG_,"axG",@progbits,_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform18binary_transform_fINS_6detail15normal_iteratorINS_10device_ptrIfEEEES9_S9_NS3_14no_stencil_tagENS_4plusIfEENS3_21always_true_predicateEEElLj1EEEvT0_T1_SG_,comdat
.protected _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform18binary_transform_fINS_6detail15normal_iteratorINS_10device_ptrIfEEEES9_S9_NS3_14no_stencil_tagENS_4plusIfEENS3_21always_true_predicateEEElLj1EEEvT0_T1_SG_
.globl _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform18binary_transform_fINS_6detail15normal_iteratorINS_10device_ptrIfEEEES9_S9_NS3_14no_stencil_tagENS_4plusIfEENS3_21always_true_predicateEEElLj1EEEvT0_T1_SG_
.p2align 8
.type _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform18binary_transform_fINS_6detail15normal_iteratorINS_10device_ptrIfEEEES9_S9_NS3_14no_stencil_tagENS_4plusIfEENS3_21always_true_predicateEEElLj1EEEvT0_T1_SG_,@function
_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform18binary_transform_fINS_6detail15normal_iteratorINS_10device_ptrIfEEEES9_S9_NS3_14no_stencil_tagENS_4plusIfEENS3_21always_true_predicateEEElLj1EEEvT0_T1_SG_:
s_load_b128 s[4:7], s[0:1], 0x20
s_lshl_b32 s2, s15, 8
s_waitcnt lgkmcnt(0)
s_add_u32 s2, s2, s6
s_addc_u32 s3, 0, s7
s_sub_u32 s4, s4, s2
s_subb_u32 s5, s5, s3
s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_cmp_gt_i64_e64 s5, 0x100, s[4:5]
s_and_b32 s5, s5, exec_lo
s_cselect_b32 s4, s4, 0x100
s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
v_cmp_gt_u32_e32 vcc_lo, s4, v0
s_cmpk_eq_i32 s4, 0x100
s_cselect_b32 s4, -1, 0
s_or_b32 s4, s4, vcc_lo
s_delay_alu instid0(SALU_CYCLE_1)
s_and_saveexec_b32 s5, s4
s_cbranch_execz .LBB2_2
s_load_b128 s[4:7], s[0:1], 0x0
v_add_co_u32 v0, s2, s2, v0
s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
v_add_co_ci_u32_e64 v1, null, s3, 0, s2
s_load_b64 s[0:1], s[0:1], 0x10
v_lshlrev_b64 v[0:1], 2, v[0:1]
s_waitcnt lgkmcnt(0)
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
v_add_co_u32 v2, vcc_lo, s4, v0
v_add_co_ci_u32_e32 v3, vcc_lo, s5, v1, vcc_lo
v_add_co_u32 v4, vcc_lo, s6, v0
v_add_co_ci_u32_e32 v5, vcc_lo, s7, v1, vcc_lo
v_add_co_u32 v0, vcc_lo, s0, v0
flat_load_b32 v2, v[2:3]
flat_load_b32 v3, v[4:5]
v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
s_waitcnt vmcnt(0) lgkmcnt(0)
v_add_f32_e32 v2, v2, v3
flat_store_b32 v[0:1], v2
.LBB2_2:
s_endpgm
.section .rodata,"a",@progbits
.p2align 6, 0x0
.amdhsa_kernel _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform18binary_transform_fINS_6detail15normal_iteratorINS_10device_ptrIfEEEES9_S9_NS3_14no_stencil_tagENS_4plusIfEENS3_21always_true_predicateEEElLj1EEEvT0_T1_SG_
.amdhsa_group_segment_fixed_size 0
.amdhsa_private_segment_fixed_size 0
.amdhsa_kernarg_size 48
.amdhsa_user_sgpr_count 15
.amdhsa_user_sgpr_dispatch_ptr 0
.amdhsa_user_sgpr_queue_ptr 0
.amdhsa_user_sgpr_kernarg_segment_ptr 1
.amdhsa_user_sgpr_dispatch_id 0
.amdhsa_user_sgpr_private_segment_size 0
.amdhsa_wavefront_size32 1
.amdhsa_uses_dynamic_stack 0
.amdhsa_enable_private_segment 0
.amdhsa_system_sgpr_workgroup_id_x 1
.amdhsa_system_sgpr_workgroup_id_y 0
.amdhsa_system_sgpr_workgroup_id_z 0
.amdhsa_system_sgpr_workgroup_info 0
.amdhsa_system_vgpr_workitem_id 0
.amdhsa_next_free_vgpr 6
.amdhsa_next_free_sgpr 16
.amdhsa_float_round_mode_32 0
.amdhsa_float_round_mode_16_64 0
.amdhsa_float_denorm_mode_32 3
.amdhsa_float_denorm_mode_16_64 3
.amdhsa_dx10_clamp 1
.amdhsa_ieee_mode 1
.amdhsa_fp16_overflow 0
.amdhsa_workgroup_processor_mode 1
.amdhsa_memory_ordered 1
.amdhsa_forward_progress 0
.amdhsa_shared_vgpr_count 0
.amdhsa_exception_fp_ieee_invalid_op 0
.amdhsa_exception_fp_denorm_src 0
.amdhsa_exception_fp_ieee_div_zero 0
.amdhsa_exception_fp_ieee_overflow 0
.amdhsa_exception_fp_ieee_underflow 0
.amdhsa_exception_fp_ieee_inexact 0
.amdhsa_exception_int_div_zero 0
.end_amdhsa_kernel
.section .text._ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform18binary_transform_fINS_6detail15normal_iteratorINS_10device_ptrIfEEEES9_S9_NS3_14no_stencil_tagENS_4plusIfEENS3_21always_true_predicateEEElLj1EEEvT0_T1_SG_,"axG",@progbits,_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform18binary_transform_fINS_6detail15normal_iteratorINS_10device_ptrIfEEEES9_S9_NS3_14no_stencil_tagENS_4plusIfEENS3_21always_true_predicateEEElLj1EEEvT0_T1_SG_,comdat
.Lfunc_end2:
.size _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform18binary_transform_fINS_6detail15normal_iteratorINS_10device_ptrIfEEEES9_S9_NS3_14no_stencil_tagENS_4plusIfEENS3_21always_true_predicateEEElLj1EEEvT0_T1_SG_, .Lfunc_end2-_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform18binary_transform_fINS_6detail15normal_iteratorINS_10device_ptrIfEEEES9_S9_NS3_14no_stencil_tagENS_4plusIfEENS3_21always_true_predicateEEElLj1EEEvT0_T1_SG_
.section .AMDGPU.csdata,"",@progbits
.text
.p2alignl 7, 3214868480
.fill 96, 4, 3214868480
.type __hip_cuid_,@object
.section .bss,"aw",@nobits
.globl __hip_cuid_
__hip_cuid_:
.byte 0
.size __hip_cuid_, 1
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym __hip_cuid_
.amdgpu_metadata
---
amdhsa.kernels:
- .args:
- .offset: 0
.size: 16
.value_kind: by_value
- .offset: 16
.size: 8
.value_kind: by_value
- .offset: 24
.size: 8
.value_kind: by_value
.group_segment_fixed_size: 0
.kernarg_segment_align: 8
.kernarg_segment_size: 32
.language: OpenCL C
.language_version:
- 2
- 0
.max_flat_workgroup_size: 256
.name: _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_
.private_segment_fixed_size: 0
.sgpr_count: 18
.sgpr_spill_count: 0
.symbol: _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_.kd
.uniform_work_group_size: 1
.uses_dynamic_stack: false
.vgpr_count: 3
.vgpr_spill_count: 0
.wavefront_size: 32
.workgroup_processor_mode: 1
- .args:
- .offset: 0
.size: 24
.value_kind: by_value
- .offset: 24
.size: 8
.value_kind: by_value
- .offset: 32
.size: 8
.value_kind: by_value
.group_segment_fixed_size: 0
.kernarg_segment_align: 8
.kernarg_segment_size: 40
.language: OpenCL C
.language_version:
- 2
- 0
.max_flat_workgroup_size: 256
.name: _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrIfEEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESC_lfEET0_RNS0_16execution_policyIT_EESG_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSG_SL_SL_
.private_segment_fixed_size: 0
.sgpr_count: 18
.sgpr_spill_count: 0
.symbol: _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrIfEEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESC_lfEET0_RNS0_16execution_policyIT_EESG_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSG_SL_SL_.kd
.uniform_work_group_size: 1
.uses_dynamic_stack: false
.vgpr_count: 3
.vgpr_spill_count: 0
.wavefront_size: 32
.workgroup_processor_mode: 1
- .args:
- .offset: 0
.size: 32
.value_kind: by_value
- .offset: 32
.size: 8
.value_kind: by_value
- .offset: 40
.size: 8
.value_kind: by_value
.group_segment_fixed_size: 0
.kernarg_segment_align: 8
.kernarg_segment_size: 48
.language: OpenCL C
.language_version:
- 2
- 0
.max_flat_workgroup_size: 256
.name: _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform18binary_transform_fINS_6detail15normal_iteratorINS_10device_ptrIfEEEES9_S9_NS3_14no_stencil_tagENS_4plusIfEENS3_21always_true_predicateEEElLj1EEEvT0_T1_SG_
.private_segment_fixed_size: 0
.sgpr_count: 18
.sgpr_spill_count: 0
.symbol: _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform18binary_transform_fINS_6detail15normal_iteratorINS_10device_ptrIfEEEES9_S9_NS3_14no_stencil_tagENS_4plusIfEENS3_21always_true_predicateEEElLj1EEEvT0_T1_SG_.kd
.uniform_work_group_size: 1
.uses_dynamic_stack: false
.vgpr_count: 6
.vgpr_spill_count: 0
.wavefront_size: 32
.workgroup_processor_mode: 1
amdhsa.target: amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
- 1
- 2
...
.end_amdgpu_metadata |
You are a helpful coding assistant specialized in converting from CUDA device assembly to AMD device assembly. | code for sm_80
Function : _ZN3cub17CUB_200700_800_NS6detail8for_each13static_kernelINS2_12policy_hub_t12policy_350_tElN6thrust20THRUST_200700_800_NS8cuda_cub11__transform18binary_transform_fINS7_6detail15normal_iteratorINS7_10device_ptrIfEEEESF_SF_NS9_14no_stencil_tagENS7_4plusIfEENS9_21always_true_predicateEEEEEvT0_T1_
.headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)"
/*0000*/ IMAD.MOV.U32 R1, RZ, RZ, c[0x0][0x28] ; /* 0x00000a00ff017624 */
/* 0x000fe400078e00ff */
/*0010*/ S2R R2, SR_CTAID.X ; /* 0x0000000000027919 */
/* 0x000e220000002500 */
/*0020*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */
/* 0x000fc60000000a00 */
/*0030*/ S2R R9, SR_TID.X ; /* 0x0000000000097919 */
/* 0x000e620000002100 */
/*0040*/ IMAD.WIDE.U32 R2, R2, 0x200, RZ ; /* 0x0000020002027825 */
/* 0x001fca00078e00ff */
/*0050*/ IADD3 R0, P1, R2.reuse, R9, RZ ; /* 0x0000000902007210 */
/* 0x042fe40007f3e0ff */
/*0060*/ IADD3 R8, P0, -R2, c[0x0][0x160], RZ ; /* 0x0000580002087a10 */
/* 0x000fc60007f1e1ff */
/*0070*/ IMAD.X R5, RZ, RZ, R3, P1 ; /* 0x000000ffff057224 */
/* 0x000fe200008e0603 */
/*0080*/ IADD3.X R3, ~R3, c[0x0][0x164], RZ, P0, !PT ; /* 0x0000590003037a10 */
/* 0x000fe200007fe5ff */
/*0090*/ IMAD.SHL.U32 R2, R0, 0x4, RZ ; /* 0x0000000400027824 */
/* 0x000fe200078e00ff */
/*00a0*/ ISETP.GT.U32.AND P0, PT, R8, 0x1ff, PT ; /* 0x000001ff0800780c */
/* 0x000fe40003f04070 */
/*00b0*/ SHF.L.U64.HI R0, R0, 0x2, R5 ; /* 0x0000000200007819 */
/* 0x000fe40000010205 */
/*00c0*/ ISETP.GT.AND.EX P0, PT, R3, RZ, PT, P0 ; /* 0x000000ff0300720c */
/* 0x000fe40003f04300 */
/*00d0*/ IADD3 R4, P1, R2.reuse, c[0x0][0x168], RZ ; /* 0x00005a0002047a10 */
/* 0x040fe40007f3e0ff */
/*00e0*/ IADD3 R6, P2, R2, c[0x0][0x170], RZ ; /* 0x00005c0002067a10 */
/* 0x000fc40007f5e0ff */
/*00f0*/ IADD3 R2, P3, R2, c[0x0][0x178], RZ ; /* 0x00005e0002027a10 */
/* 0x000fe40007f7e0ff */
/*0100*/ IADD3.X R5, R0.reuse, c[0x0][0x16c], RZ, P1, !PT ; /* 0x00005b0000057a10 */
/* 0x040fe40000ffe4ff */
/*0110*/ IADD3.X R7, R0.reuse, c[0x0][0x174], RZ, P2, !PT ; /* 0x00005d0000077a10 */
/* 0x040fe400017fe4ff */
/*0120*/ IADD3.X R3, R0, c[0x0][0x17c], RZ, P3, !PT ; /* 0x00005f0000037a10 */
/* 0x000fe20001ffe4ff */
/*0130*/ @P0 BRA 0x270 ; /* 0x0000013000000947 */
/* 0x000fea0003800000 */
/*0140*/ IADD3 R0, R9, 0x100, RZ ; /* 0x0000010009007810 */
/* 0x000fe20007ffe0ff */
/*0150*/ BSSY B0, 0x210 ; /* 0x000000b000007945 */
/* 0x000fe20003800000 */
/*0160*/ ISETP.GT.U32.AND P0, PT, R8, R9, PT ; /* 0x000000090800720c */
/* 0x000fe40003f04070 */
/*0170*/ SHF.R.S32.HI R9, RZ, 0x1f, R8 ; /* 0x0000001fff097819 */
/* 0x000fc40000011408 */
/*0180*/ ISETP.GT.U32.AND P1, PT, R8, R0, PT ; /* 0x000000000800720c */
/* 0x000fe40003f24070 */
/*0190*/ ISETP.GT.AND.EX P0, PT, R9.reuse, RZ, PT, P0 ; /* 0x000000ff0900720c */
/* 0x040fe40003f04300 */
/*01a0*/ ISETP.GT.AND.EX P1, PT, R9, RZ, PT, P1 ; /* 0x000000ff0900720c */
/* 0x000fd60003f24310 */
/*01b0*/ @!P0 BRA 0x200 ; /* 0x0000004000008947 */
/* 0x000fea0003800000 */
/*01c0*/ LDG.E R0, [R4.64] ; /* 0x0000000404007981 */
/* 0x000ea8000c1e1900 */
/*01d0*/ LDG.E R9, [R6.64] ; /* 0x0000000406097981 */
/* 0x000ea4000c1e1900 */
/*01e0*/ FADD R9, R0, R9 ; /* 0x0000000900097221 */
/* 0x004fca0000000000 */
/*01f0*/ STG.E [R2.64], R9 ; /* 0x0000000902007986 */
/* 0x0001e4000c101904 */
/*0200*/ BSYNC B0 ; /* 0x0000000000007941 */
/* 0x000fea0003800000 */
/*0210*/ @!P1 EXIT ; /* 0x000000000000994d */
/* 0x000fea0003800000 */
/*0220*/ LDG.E R6, [R6.64+0x400] ; /* 0x0004000406067981 */
/* 0x000ea8000c1e1900 */
/*0230*/ LDG.E R5, [R4.64+0x400] ; /* 0x0004000404057981 */
/* 0x000ea4000c1e1900 */
/*0240*/ FADD R9, R6, R5 ; /* 0x0000000506097221 */
/* 0x005fca0000000000 */
/*0250*/ STG.E [R2.64+0x400], R9 ; /* 0x0004000902007986 */
/* 0x000fe2000c101904 */
/*0260*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*0270*/ LDG.E R0, [R4.64] ; /* 0x0000000404007981 */
/* 0x000ea8000c1e1900 */
/*0280*/ LDG.E R9, [R6.64] ; /* 0x0000000406097981 */
/* 0x000ea4000c1e1900 */
/*0290*/ FADD R9, R0, R9 ; /* 0x0000000900097221 */
/* 0x004fca0000000000 */
/*02a0*/ STG.E [R2.64], R9 ; /* 0x0000000902007986 */
/* 0x000fe8000c101904 */
/*02b0*/ LDG.E R0, [R6.64+0x400] ; /* 0x0004000406007981 */
/* 0x000ea8000c1e1900 */
/*02c0*/ LDG.E R11, [R4.64+0x400] ; /* 0x00040004040b7981 */
/* 0x000ea4000c1e1900 */
/*02d0*/ FADD R11, R0, R11 ; /* 0x0000000b000b7221 */
/* 0x004fca0000000000 */
/*02e0*/ STG.E [R2.64+0x400], R11 ; /* 0x0004000b02007986 */
/* 0x000fe2000c101904 */
/*02f0*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*0300*/ BRA 0x300; /* 0xfffffff000007947 */
/* 0x000fc0000383ffff */
/*0310*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0320*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0330*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0340*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0350*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0360*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0370*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0380*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0390*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*03a0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*03b0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*03c0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*03d0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*03e0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*03f0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
..........
Function : _ZN3cub17CUB_200700_800_NS6detail8for_each13static_kernelINS2_12policy_hub_t12policy_350_tElN6thrust20THRUST_200700_800_NS8cuda_cub6__fill7functorINS7_6detail15normal_iteratorINS7_10device_ptrIfEEEEfEEEEvT0_T1_
.headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)"
/*0000*/ IMAD.MOV.U32 R1, RZ, RZ, c[0x0][0x28] ; /* 0x00000a00ff017624 */
/* 0x000fe400078e00ff */
/*0010*/ S2R R2, SR_CTAID.X ; /* 0x0000000000027919 */
/* 0x000e220000002500 */
/*0020*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */
/* 0x000fc60000000a00 */
/*0030*/ S2R R5, SR_TID.X ; /* 0x0000000000057919 */
/* 0x000e620000002100 */
/*0040*/ IMAD.WIDE.U32 R2, R2, 0x200, RZ ; /* 0x0000020002027825 */
/* 0x001fca00078e00ff */
/*0050*/ IADD3 R4, P1, -R2.reuse, c[0x0][0x160], RZ ; /* 0x0000580002047a10 */
/* 0x040fe40007f3e1ff */
/*0060*/ IADD3 R0, P2, R2, R5, RZ ; /* 0x0000000502007210 */
/* 0x002fe40007f5e0ff */
/*0070*/ ISETP.GT.U32.AND P0, PT, R4, 0x1ff, PT ; /* 0x000001ff0400780c */
/* 0x000fe40003f04070 */
/*0080*/ IADD3.X R6, ~R3, c[0x0][0x164], RZ, P1, !PT ; /* 0x0000590003067a10 */
/* 0x000fe20000ffe5ff */
/*0090*/ IMAD.X R3, RZ, RZ, R3, P2 ; /* 0x000000ffff037224 */
/* 0x000fe200010e0603 */
/*00a0*/ LEA R2, P1, R0, c[0x0][0x168], 0x2 ; /* 0x00005a0000027a11 */
/* 0x000fe400078210ff */
/*00b0*/ ISETP.GT.AND.EX P0, PT, R6, RZ, PT, P0 ; /* 0x000000ff0600720c */
/* 0x000fc40003f04300 */
/*00c0*/ LEA.HI.X R3, R0, c[0x0][0x16c], R3, 0x2, P1 ; /* 0x00005b0000037a11 */
/* 0x000fd600008f1403 */
/*00d0*/ @P0 BRA 0x1a0 ; /* 0x000000c000000947 */
/* 0x000fea0003800000 */
/*00e0*/ ISETP.GT.U32.AND P0, PT, R4, R5, PT ; /* 0x000000050400720c */
/* 0x000fe40003f04070 */
/*00f0*/ SHF.R.S32.HI R6, RZ, 0x1f, R4 ; /* 0x0000001fff067819 */
/* 0x000fe40000011404 */
/*0100*/ IADD3 R0, R5, 0x100, RZ ; /* 0x0000010005007810 */
/* 0x000fe40007ffe0ff */
/*0110*/ ISETP.GT.AND.EX P0, PT, R6, RZ, PT, P0 ; /* 0x000000ff0600720c */
/* 0x000fda0003f04300 */
/*0120*/ @P0 IMAD.MOV.U32 R7, RZ, RZ, c[0x0][0x170] ; /* 0x00005c00ff070624 */
/* 0x000fca00078e00ff */
/*0130*/ @P0 STG.E [R2.64], R7 ; /* 0x0000000702000986 */
/* 0x0001e2000c101904 */
/*0140*/ ISETP.GT.U32.AND P0, PT, R4, R0, PT ; /* 0x000000000400720c */
/* 0x000fc80003f04070 */
/*0150*/ ISETP.GT.AND.EX P0, PT, R6, RZ, PT, P0 ; /* 0x000000ff0600720c */
/* 0x000fda0003f04300 */
/*0160*/ @!P0 EXIT ; /* 0x000000000000894d */
/* 0x000fea0003800000 */
/*0170*/ IMAD.MOV.U32 R5, RZ, RZ, c[0x0][0x170] ; /* 0x00005c00ff057624 */
/* 0x001fca00078e00ff */
/*0180*/ STG.E [R2.64+0x400], R5 ; /* 0x0004000502007986 */
/* 0x000fe2000c101904 */
/*0190*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*01a0*/ IMAD.MOV.U32 R5, RZ, RZ, c[0x0][0x170] ; /* 0x00005c00ff057624 */
/* 0x000fca00078e00ff */
/*01b0*/ STG.E [R2.64], R5 ; /* 0x0000000502007986 */
/* 0x000fe8000c101904 */
/*01c0*/ STG.E [R2.64+0x400], R5 ; /* 0x0004000502007986 */
/* 0x000fe2000c101904 */
/*01d0*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*01e0*/ BRA 0x1e0; /* 0xfffffff000007947 */
/* 0x000fc0000383ffff */
/*01f0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0200*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0210*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0220*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0230*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0240*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0250*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0260*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0270*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
..........
Function : _ZN3cub17CUB_200700_800_NS6detail8for_each13static_kernelINS2_12policy_hub_t12policy_350_tEmN6thrust20THRUST_200700_800_NS8cuda_cub20__uninitialized_fill7functorINS7_10device_ptrIfEEfEEEEvT0_T1_
.headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)"
/*0000*/ IMAD.MOV.U32 R1, RZ, RZ, c[0x0][0x28] ; /* 0x00000a00ff017624 */
/* 0x000fe400078e00ff */
/*0010*/ S2R R2, SR_CTAID.X ; /* 0x0000000000027919 */
/* 0x000e220000002500 */
/*0020*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */
/* 0x000fc60000000a00 */
/*0030*/ S2R R5, SR_TID.X ; /* 0x0000000000057919 */
/* 0x000e620000002100 */
/*0040*/ IMAD.WIDE.U32 R2, R2, 0x200, RZ ; /* 0x0000020002027825 */
/* 0x001fca00078e00ff */
/*0050*/ IADD3 R4, P1, -R2.reuse, c[0x0][0x160], RZ ; /* 0x0000580002047a10 */
/* 0x040fe40007f3e1ff */
/*0060*/ IADD3 R0, P2, R2, R5, RZ ; /* 0x0000000502007210 */
/* 0x002fe40007f5e0ff */
/*0070*/ ISETP.GT.U32.AND P0, PT, R4, 0x1ff, PT ; /* 0x000001ff0400780c */
/* 0x000fe40003f04070 */
/*0080*/ IADD3.X R6, ~R3, c[0x0][0x164], RZ, P1, !PT ; /* 0x0000590003067a10 */
/* 0x000fe20000ffe5ff */
/*0090*/ IMAD.X R3, RZ, RZ, R3, P2 ; /* 0x000000ffff037224 */
/* 0x000fe200010e0603 */
/*00a0*/ LEA R2, P1, R0, c[0x0][0x168], 0x2 ; /* 0x00005a0000027a11 */
/* 0x000fe400078210ff */
/*00b0*/ ISETP.GT.U32.AND.EX P0, PT, R6, RZ, PT, P0 ; /* 0x000000ff0600720c */
/* 0x000fc40003f04100 */
/*00c0*/ LEA.HI.X R3, R0, c[0x0][0x16c], R3, 0x2, P1 ; /* 0x00005b0000037a11 */
/* 0x000fd600008f1403 */
/*00d0*/ @P0 BRA 0x1a0 ; /* 0x000000c000000947 */
/* 0x000fea0003800000 */
/*00e0*/ ISETP.GT.U32.AND P0, PT, R4, R5, PT ; /* 0x000000050400720c */
/* 0x000fe40003f04070 */
/*00f0*/ SHF.R.S32.HI R6, RZ, 0x1f, R4 ; /* 0x0000001fff067819 */
/* 0x000fe40000011404 */
/*0100*/ IADD3 R0, R5, 0x100, RZ ; /* 0x0000010005007810 */
/* 0x000fe40007ffe0ff */
/*0110*/ ISETP.GT.U32.AND.EX P0, PT, R6, RZ, PT, P0 ; /* 0x000000ff0600720c */
/* 0x000fda0003f04100 */
/*0120*/ @P0 IMAD.MOV.U32 R7, RZ, RZ, c[0x0][0x170] ; /* 0x00005c00ff070624 */
/* 0x000fca00078e00ff */
/*0130*/ @P0 STG.E [R2.64], R7 ; /* 0x0000000702000986 */
/* 0x0001e2000c101904 */
/*0140*/ ISETP.GT.U32.AND P0, PT, R4, R0, PT ; /* 0x000000000400720c */
/* 0x000fc80003f04070 */
/*0150*/ ISETP.GT.U32.AND.EX P0, PT, R6, RZ, PT, P0 ; /* 0x000000ff0600720c */
/* 0x000fda0003f04100 */
/*0160*/ @!P0 EXIT ; /* 0x000000000000894d */
/* 0x000fea0003800000 */
/*0170*/ IMAD.MOV.U32 R5, RZ, RZ, c[0x0][0x170] ; /* 0x00005c00ff057624 */
/* 0x001fca00078e00ff */
/*0180*/ STG.E [R2.64+0x400], R5 ; /* 0x0004000502007986 */
/* 0x000fe2000c101904 */
/*0190*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*01a0*/ IMAD.MOV.U32 R5, RZ, RZ, c[0x0][0x170] ; /* 0x00005c00ff057624 */
/* 0x000fca00078e00ff */
/*01b0*/ STG.E [R2.64], R5 ; /* 0x0000000502007986 */
/* 0x000fe8000c101904 */
/*01c0*/ STG.E [R2.64+0x400], R5 ; /* 0x0004000502007986 */
/* 0x000fe2000c101904 */
/*01d0*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*01e0*/ BRA 0x1e0; /* 0xfffffff000007947 */
/* 0x000fc0000383ffff */
/*01f0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0200*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0210*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0220*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0230*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0240*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0250*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0260*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0270*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
..........
Function : _ZN3cub17CUB_200700_800_NS11EmptyKernelIvEEvv
.headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)"
/*0000*/ MOV R1, c[0x0][0x28] ; /* 0x00000a0000017a02 */
/* 0x000fe40000000f00 */
/*0010*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*0020*/ BRA 0x20; /* 0xfffffff000007947 */
/* 0x000fc0000383ffff */
/*0030*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0040*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0050*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0060*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0070*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0080*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0090*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*00a0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*00b0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*00c0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*00d0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*00e0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*00f0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
.......... | .text
.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
.section .text._ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_,"axG",@progbits,_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_,comdat
.protected _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_
.globl _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_
.p2align 8
.type _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_,@function
_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_:
s_load_b128 s[4:7], s[0:1], 0x10
s_lshl_b32 s2, s15, 8
s_waitcnt lgkmcnt(0)
s_add_u32 s2, s2, s6
s_addc_u32 s3, 0, s7
s_sub_u32 s4, s4, s2
s_subb_u32 s5, s5, s3
s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_cmp_gt_u64_e64 s5, 0x100, s[4:5]
s_and_b32 s5, s5, exec_lo
s_cselect_b32 s4, s4, 0x100
s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
v_cmp_gt_u32_e32 vcc_lo, s4, v0
s_cmpk_eq_i32 s4, 0x100
s_cselect_b32 s4, -1, 0
s_or_b32 s4, s4, vcc_lo
s_delay_alu instid0(SALU_CYCLE_1)
s_and_saveexec_b32 s5, s4
s_cbranch_execz .LBB0_2
s_clause 0x1
s_load_b64 s[4:5], s[0:1], 0x0
s_load_b32 s6, s[0:1], 0x8
v_lshlrev_b32_e32 v0, 2, v0
s_lshl_b64 s[0:1], s[2:3], 2
s_waitcnt lgkmcnt(0)
s_add_u32 s0, s4, s0
s_addc_u32 s1, s5, s1
v_add_co_u32 v0, s0, s0, v0
s_delay_alu instid0(VALU_DEP_1)
v_add_co_ci_u32_e64 v1, null, s1, 0, s0
v_mov_b32_e32 v2, s6
flat_store_b32 v[0:1], v2
.LBB0_2:
s_endpgm
.section .rodata,"a",@progbits
.p2align 6, 0x0
.amdhsa_kernel _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_
.amdhsa_group_segment_fixed_size 0
.amdhsa_private_segment_fixed_size 0
.amdhsa_kernarg_size 32
.amdhsa_user_sgpr_count 15
.amdhsa_user_sgpr_dispatch_ptr 0
.amdhsa_user_sgpr_queue_ptr 0
.amdhsa_user_sgpr_kernarg_segment_ptr 1
.amdhsa_user_sgpr_dispatch_id 0
.amdhsa_user_sgpr_private_segment_size 0
.amdhsa_wavefront_size32 1
.amdhsa_uses_dynamic_stack 0
.amdhsa_enable_private_segment 0
.amdhsa_system_sgpr_workgroup_id_x 1
.amdhsa_system_sgpr_workgroup_id_y 0
.amdhsa_system_sgpr_workgroup_id_z 0
.amdhsa_system_sgpr_workgroup_info 0
.amdhsa_system_vgpr_workitem_id 0
.amdhsa_next_free_vgpr 3
.amdhsa_next_free_sgpr 16
.amdhsa_float_round_mode_32 0
.amdhsa_float_round_mode_16_64 0
.amdhsa_float_denorm_mode_32 3
.amdhsa_float_denorm_mode_16_64 3
.amdhsa_dx10_clamp 1
.amdhsa_ieee_mode 1
.amdhsa_fp16_overflow 0
.amdhsa_workgroup_processor_mode 1
.amdhsa_memory_ordered 1
.amdhsa_forward_progress 0
.amdhsa_shared_vgpr_count 0
.amdhsa_exception_fp_ieee_invalid_op 0
.amdhsa_exception_fp_denorm_src 0
.amdhsa_exception_fp_ieee_div_zero 0
.amdhsa_exception_fp_ieee_overflow 0
.amdhsa_exception_fp_ieee_underflow 0
.amdhsa_exception_fp_ieee_inexact 0
.amdhsa_exception_int_div_zero 0
.end_amdhsa_kernel
.section .text._ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_,"axG",@progbits,_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_,comdat
.Lfunc_end0:
.size _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_, .Lfunc_end0-_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_
.section .AMDGPU.csdata,"",@progbits
.section .text._ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrIfEEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESC_lfEET0_RNS0_16execution_policyIT_EESG_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSG_SL_SL_,"axG",@progbits,_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrIfEEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESC_lfEET0_RNS0_16execution_policyIT_EESG_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSG_SL_SL_,comdat
.protected _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrIfEEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESC_lfEET0_RNS0_16execution_policyIT_EESG_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSG_SL_SL_
.globl _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrIfEEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESC_lfEET0_RNS0_16execution_policyIT_EESG_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSG_SL_SL_
.p2align 8
.type _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrIfEEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESC_lfEET0_RNS0_16execution_policyIT_EESG_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSG_SL_SL_,@function
_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrIfEEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESC_lfEET0_RNS0_16execution_policyIT_EESG_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSG_SL_SL_:
s_load_b128 s[4:7], s[0:1], 0x18
s_lshl_b32 s2, s15, 8
s_waitcnt lgkmcnt(0)
s_add_u32 s2, s2, s6
s_addc_u32 s3, 0, s7
s_sub_u32 s4, s4, s2
s_subb_u32 s5, s5, s3
s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_cmp_gt_i64_e64 s5, 0x100, s[4:5]
s_and_b32 s5, s5, exec_lo
s_cselect_b32 s4, s4, 0x100
s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
v_cmp_gt_u32_e32 vcc_lo, s4, v0
s_cmpk_eq_i32 s4, 0x100
s_cselect_b32 s4, -1, 0
s_or_b32 s4, s4, vcc_lo
s_delay_alu instid0(SALU_CYCLE_1)
s_and_saveexec_b32 s5, s4
s_cbranch_execz .LBB1_2
s_clause 0x1
s_load_b64 s[4:5], s[0:1], 0x8
s_load_b32 s6, s[0:1], 0x10
v_lshlrev_b32_e32 v0, 2, v0
s_lshl_b64 s[0:1], s[2:3], 2
s_waitcnt lgkmcnt(0)
s_add_u32 s0, s4, s0
s_addc_u32 s1, s5, s1
v_add_co_u32 v0, s0, s0, v0
s_delay_alu instid0(VALU_DEP_1)
v_add_co_ci_u32_e64 v1, null, s1, 0, s0
v_mov_b32_e32 v2, s6
flat_store_b32 v[0:1], v2
.LBB1_2:
s_endpgm
.section .rodata,"a",@progbits
.p2align 6, 0x0
.amdhsa_kernel _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrIfEEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESC_lfEET0_RNS0_16execution_policyIT_EESG_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSG_SL_SL_
.amdhsa_group_segment_fixed_size 0
.amdhsa_private_segment_fixed_size 0
.amdhsa_kernarg_size 40
.amdhsa_user_sgpr_count 15
.amdhsa_user_sgpr_dispatch_ptr 0
.amdhsa_user_sgpr_queue_ptr 0
.amdhsa_user_sgpr_kernarg_segment_ptr 1
.amdhsa_user_sgpr_dispatch_id 0
.amdhsa_user_sgpr_private_segment_size 0
.amdhsa_wavefront_size32 1
.amdhsa_uses_dynamic_stack 0
.amdhsa_enable_private_segment 0
.amdhsa_system_sgpr_workgroup_id_x 1
.amdhsa_system_sgpr_workgroup_id_y 0
.amdhsa_system_sgpr_workgroup_id_z 0
.amdhsa_system_sgpr_workgroup_info 0
.amdhsa_system_vgpr_workitem_id 0
.amdhsa_next_free_vgpr 3
.amdhsa_next_free_sgpr 16
.amdhsa_float_round_mode_32 0
.amdhsa_float_round_mode_16_64 0
.amdhsa_float_denorm_mode_32 3
.amdhsa_float_denorm_mode_16_64 3
.amdhsa_dx10_clamp 1
.amdhsa_ieee_mode 1
.amdhsa_fp16_overflow 0
.amdhsa_workgroup_processor_mode 1
.amdhsa_memory_ordered 1
.amdhsa_forward_progress 0
.amdhsa_shared_vgpr_count 0
.amdhsa_exception_fp_ieee_invalid_op 0
.amdhsa_exception_fp_denorm_src 0
.amdhsa_exception_fp_ieee_div_zero 0
.amdhsa_exception_fp_ieee_overflow 0
.amdhsa_exception_fp_ieee_underflow 0
.amdhsa_exception_fp_ieee_inexact 0
.amdhsa_exception_int_div_zero 0
.end_amdhsa_kernel
.section .text._ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrIfEEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESC_lfEET0_RNS0_16execution_policyIT_EESG_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSG_SL_SL_,"axG",@progbits,_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrIfEEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESC_lfEET0_RNS0_16execution_policyIT_EESG_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSG_SL_SL_,comdat
.Lfunc_end1:
.size _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrIfEEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESC_lfEET0_RNS0_16execution_policyIT_EESG_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSG_SL_SL_, .Lfunc_end1-_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrIfEEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESC_lfEET0_RNS0_16execution_policyIT_EESG_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSG_SL_SL_
.section .AMDGPU.csdata,"",@progbits
.section .text._ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform18binary_transform_fINS_6detail15normal_iteratorINS_10device_ptrIfEEEES9_S9_NS3_14no_stencil_tagENS_4plusIfEENS3_21always_true_predicateEEElLj1EEEvT0_T1_SG_,"axG",@progbits,_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform18binary_transform_fINS_6detail15normal_iteratorINS_10device_ptrIfEEEES9_S9_NS3_14no_stencil_tagENS_4plusIfEENS3_21always_true_predicateEEElLj1EEEvT0_T1_SG_,comdat
.protected _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform18binary_transform_fINS_6detail15normal_iteratorINS_10device_ptrIfEEEES9_S9_NS3_14no_stencil_tagENS_4plusIfEENS3_21always_true_predicateEEElLj1EEEvT0_T1_SG_
.globl _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform18binary_transform_fINS_6detail15normal_iteratorINS_10device_ptrIfEEEES9_S9_NS3_14no_stencil_tagENS_4plusIfEENS3_21always_true_predicateEEElLj1EEEvT0_T1_SG_
.p2align 8
.type _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform18binary_transform_fINS_6detail15normal_iteratorINS_10device_ptrIfEEEES9_S9_NS3_14no_stencil_tagENS_4plusIfEENS3_21always_true_predicateEEElLj1EEEvT0_T1_SG_,@function
_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform18binary_transform_fINS_6detail15normal_iteratorINS_10device_ptrIfEEEES9_S9_NS3_14no_stencil_tagENS_4plusIfEENS3_21always_true_predicateEEElLj1EEEvT0_T1_SG_:
s_load_b128 s[4:7], s[0:1], 0x20
s_lshl_b32 s2, s15, 8
s_waitcnt lgkmcnt(0)
s_add_u32 s2, s2, s6
s_addc_u32 s3, 0, s7
s_sub_u32 s4, s4, s2
s_subb_u32 s5, s5, s3
s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_cmp_gt_i64_e64 s5, 0x100, s[4:5]
s_and_b32 s5, s5, exec_lo
s_cselect_b32 s4, s4, 0x100
s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
v_cmp_gt_u32_e32 vcc_lo, s4, v0
s_cmpk_eq_i32 s4, 0x100
s_cselect_b32 s4, -1, 0
s_or_b32 s4, s4, vcc_lo
s_delay_alu instid0(SALU_CYCLE_1)
s_and_saveexec_b32 s5, s4
s_cbranch_execz .LBB2_2
s_load_b128 s[4:7], s[0:1], 0x0
v_add_co_u32 v0, s2, s2, v0
s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
v_add_co_ci_u32_e64 v1, null, s3, 0, s2
s_load_b64 s[0:1], s[0:1], 0x10
v_lshlrev_b64 v[0:1], 2, v[0:1]
s_waitcnt lgkmcnt(0)
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
v_add_co_u32 v2, vcc_lo, s4, v0
v_add_co_ci_u32_e32 v3, vcc_lo, s5, v1, vcc_lo
v_add_co_u32 v4, vcc_lo, s6, v0
v_add_co_ci_u32_e32 v5, vcc_lo, s7, v1, vcc_lo
v_add_co_u32 v0, vcc_lo, s0, v0
flat_load_b32 v2, v[2:3]
flat_load_b32 v3, v[4:5]
v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
s_waitcnt vmcnt(0) lgkmcnt(0)
v_add_f32_e32 v2, v2, v3
flat_store_b32 v[0:1], v2
.LBB2_2:
s_endpgm
.section .rodata,"a",@progbits
.p2align 6, 0x0
.amdhsa_kernel _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform18binary_transform_fINS_6detail15normal_iteratorINS_10device_ptrIfEEEES9_S9_NS3_14no_stencil_tagENS_4plusIfEENS3_21always_true_predicateEEElLj1EEEvT0_T1_SG_
.amdhsa_group_segment_fixed_size 0
.amdhsa_private_segment_fixed_size 0
.amdhsa_kernarg_size 48
.amdhsa_user_sgpr_count 15
.amdhsa_user_sgpr_dispatch_ptr 0
.amdhsa_user_sgpr_queue_ptr 0
.amdhsa_user_sgpr_kernarg_segment_ptr 1
.amdhsa_user_sgpr_dispatch_id 0
.amdhsa_user_sgpr_private_segment_size 0
.amdhsa_wavefront_size32 1
.amdhsa_uses_dynamic_stack 0
.amdhsa_enable_private_segment 0
.amdhsa_system_sgpr_workgroup_id_x 1
.amdhsa_system_sgpr_workgroup_id_y 0
.amdhsa_system_sgpr_workgroup_id_z 0
.amdhsa_system_sgpr_workgroup_info 0
.amdhsa_system_vgpr_workitem_id 0
.amdhsa_next_free_vgpr 6
.amdhsa_next_free_sgpr 16
.amdhsa_float_round_mode_32 0
.amdhsa_float_round_mode_16_64 0
.amdhsa_float_denorm_mode_32 3
.amdhsa_float_denorm_mode_16_64 3
.amdhsa_dx10_clamp 1
.amdhsa_ieee_mode 1
.amdhsa_fp16_overflow 0
.amdhsa_workgroup_processor_mode 1
.amdhsa_memory_ordered 1
.amdhsa_forward_progress 0
.amdhsa_shared_vgpr_count 0
.amdhsa_exception_fp_ieee_invalid_op 0
.amdhsa_exception_fp_denorm_src 0
.amdhsa_exception_fp_ieee_div_zero 0
.amdhsa_exception_fp_ieee_overflow 0
.amdhsa_exception_fp_ieee_underflow 0
.amdhsa_exception_fp_ieee_inexact 0
.amdhsa_exception_int_div_zero 0
.end_amdhsa_kernel
.section .text._ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform18binary_transform_fINS_6detail15normal_iteratorINS_10device_ptrIfEEEES9_S9_NS3_14no_stencil_tagENS_4plusIfEENS3_21always_true_predicateEEElLj1EEEvT0_T1_SG_,"axG",@progbits,_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform18binary_transform_fINS_6detail15normal_iteratorINS_10device_ptrIfEEEES9_S9_NS3_14no_stencil_tagENS_4plusIfEENS3_21always_true_predicateEEElLj1EEEvT0_T1_SG_,comdat
.Lfunc_end2:
.size _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform18binary_transform_fINS_6detail15normal_iteratorINS_10device_ptrIfEEEES9_S9_NS3_14no_stencil_tagENS_4plusIfEENS3_21always_true_predicateEEElLj1EEEvT0_T1_SG_, .Lfunc_end2-_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform18binary_transform_fINS_6detail15normal_iteratorINS_10device_ptrIfEEEES9_S9_NS3_14no_stencil_tagENS_4plusIfEENS3_21always_true_predicateEEElLj1EEEvT0_T1_SG_
.section .AMDGPU.csdata,"",@progbits
.text
.p2alignl 7, 3214868480
.fill 96, 4, 3214868480
.type __hip_cuid_,@object
.section .bss,"aw",@nobits
.globl __hip_cuid_
__hip_cuid_:
.byte 0
.size __hip_cuid_, 1
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym __hip_cuid_
.amdgpu_metadata
---
amdhsa.kernels:
- .args:
- .offset: 0
.size: 16
.value_kind: by_value
- .offset: 16
.size: 8
.value_kind: by_value
- .offset: 24
.size: 8
.value_kind: by_value
.group_segment_fixed_size: 0
.kernarg_segment_align: 8
.kernarg_segment_size: 32
.language: OpenCL C
.language_version:
- 2
- 0
.max_flat_workgroup_size: 256
.name: _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_
.private_segment_fixed_size: 0
.sgpr_count: 18
.sgpr_spill_count: 0
.symbol: _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_.kd
.uniform_work_group_size: 1
.uses_dynamic_stack: false
.vgpr_count: 3
.vgpr_spill_count: 0
.wavefront_size: 32
.workgroup_processor_mode: 1
- .args:
- .offset: 0
.size: 24
.value_kind: by_value
- .offset: 24
.size: 8
.value_kind: by_value
- .offset: 32
.size: 8
.value_kind: by_value
.group_segment_fixed_size: 0
.kernarg_segment_align: 8
.kernarg_segment_size: 40
.language: OpenCL C
.language_version:
- 2
- 0
.max_flat_workgroup_size: 256
.name: _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrIfEEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESC_lfEET0_RNS0_16execution_policyIT_EESG_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSG_SL_SL_
.private_segment_fixed_size: 0
.sgpr_count: 18
.sgpr_spill_count: 0
.symbol: _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrIfEEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESC_lfEET0_RNS0_16execution_policyIT_EESG_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSG_SL_SL_.kd
.uniform_work_group_size: 1
.uses_dynamic_stack: false
.vgpr_count: 3
.vgpr_spill_count: 0
.wavefront_size: 32
.workgroup_processor_mode: 1
- .args:
- .offset: 0
.size: 32
.value_kind: by_value
- .offset: 32
.size: 8
.value_kind: by_value
- .offset: 40
.size: 8
.value_kind: by_value
.group_segment_fixed_size: 0
.kernarg_segment_align: 8
.kernarg_segment_size: 48
.language: OpenCL C
.language_version:
- 2
- 0
.max_flat_workgroup_size: 256
.name: _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform18binary_transform_fINS_6detail15normal_iteratorINS_10device_ptrIfEEEES9_S9_NS3_14no_stencil_tagENS_4plusIfEENS3_21always_true_predicateEEElLj1EEEvT0_T1_SG_
.private_segment_fixed_size: 0
.sgpr_count: 18
.sgpr_spill_count: 0
.symbol: _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform18binary_transform_fINS_6detail15normal_iteratorINS_10device_ptrIfEEEES9_S9_NS3_14no_stencil_tagENS_4plusIfEENS3_21always_true_predicateEEElLj1EEEvT0_T1_SG_.kd
.uniform_work_group_size: 1
.uses_dynamic_stack: false
.vgpr_count: 6
.vgpr_spill_count: 0
.wavefront_size: 32
.workgroup_processor_mode: 1
amdhsa.target: amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
- 1
- 2
...
.end_amdgpu_metadata |
You are a helpful coding assistant specialized in converting CUDA source code to CUDA device assembly. | #include <stdio.h>
#include <cuda.h>
//-----------------------------------------------------------------------------
// TheKernel: basic kernel containing a print statement.
//-----------------------------------------------------------------------------
__global__ void TheKernel()
{
// The variable "threadIdx" is given to the programmer as part of the
// CUDA environment. It is a C-style struct, with three "dimensions."
// (The thread block can have up to three axes.) Most scientific
// applications need only the first ('x'), because it's not necessary to
// organize threads into two-dimensional bundles. For image processing,
// two dimensions are nice to have.
printf("This is kernel thread %2d saying hello world, from the GPU.\n",
threadIdx.x);
}
//-----------------------------------------------------------------------------
// main
//-----------------------------------------------------------------------------
int main()
{
printf("This is the C layer saying hello world, from the host.\n");
// Now add more than just one thread to the kernel
TheKernel<<<1, 32>>>();
// Device synchronization
cudaDeviceSynchronize();
// Announce that the kernel is complete
printf("Program exits.\n");
return 0;
} | code for sm_80
Function : _Z9TheKernelv
.headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)"
/*0000*/ IMAD.MOV.U32 R1, RZ, RZ, c[0x0][0x28] ; /* 0x00000a00ff017624 */
/* 0x000fc800078e00ff */
/*0010*/ S2R R8, SR_TID.X ; /* 0x0000000000087919 */
/* 0x000e220000002100 */
/*0020*/ IADD3 R1, R1, -0x8, RZ ; /* 0xfffffff801017810 */
/* 0x000fe20007ffe0ff */
/*0030*/ IMAD.MOV.U32 R4, RZ, RZ, c[0x4][0x8] ; /* 0x01000200ff047624 */
/* 0x000fe200078e00ff */
/*0040*/ MOV R0, 0x0 ; /* 0x0000000000007802 */
/* 0x000fe20000000f00 */
/*0050*/ IMAD.MOV.U32 R5, RZ, RZ, c[0x4][0xc] ; /* 0x01000300ff057624 */
/* 0x000fe200078e00ff */
/*0060*/ IADD3 R6, P0, R1, c[0x0][0x20], RZ ; /* 0x0000080001067a10 */
/* 0x000fe40007f1e0ff */
/*0070*/ LDC.64 R2, c[0x4][R0] ; /* 0x0100000000027b82 */
/* 0x0002a60000000a00 */
/*0080*/ IMAD.X R7, RZ, RZ, c[0x0][0x24], P0 ; /* 0x00000900ff077624 */
/* 0x000fe200000e06ff */
/*0090*/ STL [R1], R8 ; /* 0x0000000801007387 */
/* 0x0013e80000100800 */
/*00a0*/ LEPC R8 ; /* 0x000000000008734e */
/* 0x002fc60000000000 */
/*00b0*/ MOV R11, 0x120 ; /* 0x00000120000b7802 */
/* 0x000fe40000000f00 */
/*00c0*/ MOV R20, 0xa0 ; /* 0x000000a000147802 */
/* 0x000fc40000000f00 */
/*00d0*/ MOV R21, 0x0 ; /* 0x0000000000157802 */
/* 0x000fe40000000f00 */
/*00e0*/ MOV R0, 0x0 ; /* 0x0000000000007802 */
/* 0x000fe40000000f00 */
/*00f0*/ IADD3 R20, P0, P1, -R20, R11, R8 ; /* 0x0000000b14147210 */
/* 0x000fc8000791e108 */
/*0100*/ IADD3.X R21, ~R0, R21, R9, P0, P1 ; /* 0x0000001500157210 */
/* 0x000fc800007e2509 */
/*0110*/ CALL.ABS.NOINC R2 ; /* 0x0000000002007343 */
/* 0x004fea0003c00000 */
/*0120*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*0130*/ BRA 0x130; /* 0xfffffff000007947 */
/* 0x000fc0000383ffff */
/*0140*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0150*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0160*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0170*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0180*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0190*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*01a0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*01b0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*01c0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*01d0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*01e0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*01f0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
.......... |
You are a helpful coding assistant specialized in converting CUDA source code to CUDA host assembly. | #include <stdio.h>
#include <cuda.h>
//-----------------------------------------------------------------------------
// TheKernel: basic kernel containing a print statement.
//-----------------------------------------------------------------------------
__global__ void TheKernel()
{
// The variable "threadIdx" is given to the programmer as part of the
// CUDA environment. It is a C-style struct, with three "dimensions."
// (The thread block can have up to three axes.) Most scientific
// applications need only the first ('x'), because it's not necessary to
// organize threads into two-dimensional bundles. For image processing,
// two dimensions are nice to have.
printf("This is kernel thread %2d saying hello world, from the GPU.\n",
threadIdx.x);
}
//-----------------------------------------------------------------------------
// main
//-----------------------------------------------------------------------------
int main()
{
printf("This is the C layer saying hello world, from the host.\n");
// Now add more than just one thread to the kernel
TheKernel<<<1, 32>>>();
// Device synchronization
cudaDeviceSynchronize();
// Announce that the kernel is complete
printf("Program exits.\n");
return 0;
} | .file "tmpxft_0001fc03_00000000-6_program_id.cudafe1.cpp"
.text
#APP
#NO_APP
.type _ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2060:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaUnregisterFatBinary@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2060:
.size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
.globl _Z27__device_stub__Z9TheKernelvv
.type _Z27__device_stub__Z9TheKernelvv, @function
_Z27__device_stub__Z9TheKernelvv:
.LFB2082:
.cfi_startproc
endbr64
subq $88, %rsp
.cfi_def_cfa_offset 96
movq %fs:40, %rax
movq %rax, 72(%rsp)
xorl %eax, %eax
movl $1, 16(%rsp)
movl $1, 20(%rsp)
movl $1, 24(%rsp)
movl $1, 28(%rsp)
movl $1, 32(%rsp)
movl $1, 36(%rsp)
leaq 8(%rsp), %rcx
movq %rsp, %rdx
leaq 28(%rsp), %rsi
leaq 16(%rsp), %rdi
call __cudaPopCallConfiguration@PLT
testl %eax, %eax
je .L7
.L3:
movq 72(%rsp), %rax
subq %fs:40, %rax
jne .L8
addq $88, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 8
ret
.L7:
.cfi_restore_state
pushq 8(%rsp)
.cfi_def_cfa_offset 104
pushq 8(%rsp)
.cfi_def_cfa_offset 112
leaq 80(%rsp), %r9
movq 44(%rsp), %rcx
movl 52(%rsp), %r8d
movq 32(%rsp), %rsi
movl 40(%rsp), %edx
leaq _Z9TheKernelv(%rip), %rdi
call cudaLaunchKernel@PLT
addq $16, %rsp
.cfi_def_cfa_offset 96
jmp .L3
.L8:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE2082:
.size _Z27__device_stub__Z9TheKernelvv, .-_Z27__device_stub__Z9TheKernelvv
.globl _Z9TheKernelv
.type _Z9TheKernelv, @function
_Z9TheKernelv:
.LFB2083:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
call _Z27__device_stub__Z9TheKernelvv
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2083:
.size _Z9TheKernelv, .-_Z9TheKernelv
.section .rodata.str1.8,"aMS",@progbits,1
.align 8
.LC0:
.string "This is the C layer saying hello world, from the host.\n"
.section .rodata.str1.1,"aMS",@progbits,1
.LC1:
.string "Program exits.\n"
.text
.globl main
.type main, @function
main:
.LFB2057:
.cfi_startproc
endbr64
subq $40, %rsp
.cfi_def_cfa_offset 48
leaq .LC0(%rip), %rsi
movl $2, %edi
movl $0, %eax
call __printf_chk@PLT
movl $32, 20(%rsp)
movl $1, 24(%rsp)
movl $1, 8(%rsp)
movl $1, 12(%rsp)
movl $0, %r9d
movl $0, %r8d
movq 20(%rsp), %rdx
movl $1, %ecx
movq 8(%rsp), %rdi
movl $1, %esi
call __cudaPushCallConfiguration@PLT
testl %eax, %eax
je .L14
.L12:
call cudaDeviceSynchronize@PLT
leaq .LC1(%rip), %rsi
movl $2, %edi
movl $0, %eax
call __printf_chk@PLT
movl $0, %eax
addq $40, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 8
ret
.L14:
.cfi_restore_state
call _Z27__device_stub__Z9TheKernelvv
jmp .L12
.cfi_endproc
.LFE2057:
.size main, .-main
.section .rodata.str1.1
.LC2:
.string "_Z9TheKernelv"
.text
.type _ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2085:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
leaq _ZL15__fatDeviceText(%rip), %rdi
call __cudaRegisterFatBinary@PLT
movq %rax, %rdi
movq %rax, _ZL20__cudaFatCubinHandle(%rip)
pushq $0
.cfi_def_cfa_offset 24
pushq $0
.cfi_def_cfa_offset 32
pushq $0
.cfi_def_cfa_offset 40
pushq $0
.cfi_def_cfa_offset 48
movl $0, %r9d
movl $-1, %r8d
leaq .LC2(%rip), %rdx
movq %rdx, %rcx
leaq _Z9TheKernelv(%rip), %rsi
call __cudaRegisterFunction@PLT
addq $32, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaRegisterFatBinaryEnd@PLT
leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
call atexit@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2085:
.size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
.section .init_array,"aw"
.align 8
.quad _ZL24__sti____cudaRegisterAllv
.section .nvFatBinSegment,"aw"
.align 8
.type _ZL15__fatDeviceText, @object
.size _ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
.long 1180844977
.long 1
.quad fatbinData
.quad 0
.local _ZL20__cudaFatCubinHandle
.comm _ZL20__cudaFatCubinHandle,8,8
.ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
.section .note.GNU-stack,"",@progbits
.section .note.gnu.property,"a"
.align 8
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.string "GNU"
1:
.align 8
.long 0xc0000002
.long 3f - 2f
2:
.long 0x3
3:
.align 8
4: |
You are a helpful coding assistant specialized in converting CUDA source code to HIP/AMD source code. | #include <stdio.h>
#include <cuda.h>
//-----------------------------------------------------------------------------
// TheKernel: basic kernel containing a print statement.
//-----------------------------------------------------------------------------
__global__ void TheKernel()
{
// The variable "threadIdx" is given to the programmer as part of the
// CUDA environment. It is a C-style struct, with three "dimensions."
// (The thread block can have up to three axes.) Most scientific
// applications need only the first ('x'), because it's not necessary to
// organize threads into two-dimensional bundles. For image processing,
// two dimensions are nice to have.
printf("This is kernel thread %2d saying hello world, from the GPU.\n",
threadIdx.x);
}
//-----------------------------------------------------------------------------
// main
//-----------------------------------------------------------------------------
int main()
{
printf("This is the C layer saying hello world, from the host.\n");
// Now add more than just one thread to the kernel
TheKernel<<<1, 32>>>();
// Device synchronization
cudaDeviceSynchronize();
// Announce that the kernel is complete
printf("Program exits.\n");
return 0;
} | #include <stdio.h>
#include <hip/hip_runtime.h>
//-----------------------------------------------------------------------------
// TheKernel: basic kernel containing a print statement.
//-----------------------------------------------------------------------------
__global__ void TheKernel()
{
// The variable "threadIdx" is given to the programmer as part of the
// CUDA environment. It is a C-style struct, with three "dimensions."
// (The thread block can have up to three axes.) Most scientific
// applications need only the first ('x'), because it's not necessary to
// organize threads into two-dimensional bundles. For image processing,
// two dimensions are nice to have.
printf("This is kernel thread %2d saying hello world, from the GPU.\n",
threadIdx.x);
}
//-----------------------------------------------------------------------------
// main
//-----------------------------------------------------------------------------
int main()
{
printf("This is the C layer saying hello world, from the host.\n");
// Now add more than just one thread to the kernel
TheKernel<<<1, 32>>>();
// Device synchronization
hipDeviceSynchronize();
// Announce that the kernel is complete
printf("Program exits.\n");
return 0;
} |
You are a helpful coding assistant specialized in converting HIP source code to AMD host assembly. | #include <stdio.h>
#include <hip/hip_runtime.h>
//-----------------------------------------------------------------------------
// TheKernel: basic kernel containing a print statement.
//-----------------------------------------------------------------------------
__global__ void TheKernel()
{
// The variable "threadIdx" is given to the programmer as part of the
// CUDA environment. It is a C-style struct, with three "dimensions."
// (The thread block can have up to three axes.) Most scientific
// applications need only the first ('x'), because it's not necessary to
// organize threads into two-dimensional bundles. For image processing,
// two dimensions are nice to have.
printf("This is kernel thread %2d saying hello world, from the GPU.\n",
threadIdx.x);
}
//-----------------------------------------------------------------------------
// main
//-----------------------------------------------------------------------------
int main()
{
printf("This is the C layer saying hello world, from the host.\n");
// Now add more than just one thread to the kernel
TheKernel<<<1, 32>>>();
// Device synchronization
hipDeviceSynchronize();
// Announce that the kernel is complete
printf("Program exits.\n");
return 0;
} | .text
.file "program_id.hip"
.globl _Z24__device_stub__TheKernelv # -- Begin function _Z24__device_stub__TheKernelv
.p2align 4, 0x90
.type _Z24__device_stub__TheKernelv,@function
_Z24__device_stub__TheKernelv: # @_Z24__device_stub__TheKernelv
.cfi_startproc
# %bb.0:
subq $56, %rsp
.cfi_def_cfa_offset 64
leaq 32(%rsp), %rdi
leaq 16(%rsp), %rsi
leaq 8(%rsp), %rdx
movq %rsp, %rcx
callq __hipPopCallConfiguration
movq 32(%rsp), %rsi
movl 40(%rsp), %edx
movq 16(%rsp), %rcx
movl 24(%rsp), %r8d
leaq 48(%rsp), %r9
movl $_Z9TheKernelv, %edi
pushq (%rsp)
.cfi_adjust_cfa_offset 8
pushq 16(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $72, %rsp
.cfi_adjust_cfa_offset -72
retq
.Lfunc_end0:
.size _Z24__device_stub__TheKernelv, .Lfunc_end0-_Z24__device_stub__TheKernelv
.cfi_endproc
# -- End function
.globl main # -- Begin function main
.p2align 4, 0x90
.type main,@function
main: # @main
.cfi_startproc
# %bb.0:
subq $56, %rsp
.cfi_def_cfa_offset 64
movl $.Lstr, %edi
callq puts@PLT
movabsq $4294967297, %rdi # imm = 0x100000001
leaq 31(%rdi), %rdx
movl $1, %esi
movl $1, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq __hipPushCallConfiguration
testl %eax, %eax
jne .LBB1_2
# %bb.1:
leaq 32(%rsp), %rdi
leaq 16(%rsp), %rsi
leaq 8(%rsp), %rdx
movq %rsp, %rcx
callq __hipPopCallConfiguration
movq 32(%rsp), %rsi
movl 40(%rsp), %edx
movq 16(%rsp), %rcx
movl 24(%rsp), %r8d
leaq 48(%rsp), %r9
movl $_Z9TheKernelv, %edi
pushq (%rsp)
.cfi_adjust_cfa_offset 8
pushq 16(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $16, %rsp
.cfi_adjust_cfa_offset -16
.LBB1_2:
callq hipDeviceSynchronize
movl $.Lstr.1, %edi
callq puts@PLT
xorl %eax, %eax
addq $56, %rsp
.cfi_def_cfa_offset 8
retq
.Lfunc_end1:
.size main, .Lfunc_end1-main
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_ctor
.type __hip_module_ctor,@function
__hip_module_ctor: # @__hip_module_ctor
.cfi_startproc
# %bb.0:
subq $40, %rsp
.cfi_def_cfa_offset 48
cmpq $0, __hip_gpubin_handle(%rip)
jne .LBB2_2
# %bb.1:
movl $__hip_fatbin_wrapper, %edi
callq __hipRegisterFatBinary
movq %rax, __hip_gpubin_handle(%rip)
.LBB2_2:
movq __hip_gpubin_handle(%rip), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 16(%rsp)
movups %xmm0, (%rsp)
movl $_Z9TheKernelv, %esi
movl $.L__unnamed_1, %edx
movl $.L__unnamed_1, %ecx
movl $-1, %r8d
xorl %r9d, %r9d
callq __hipRegisterFunction
movl $__hip_module_dtor, %edi
addq $40, %rsp
.cfi_def_cfa_offset 8
jmp atexit # TAILCALL
.Lfunc_end2:
.size __hip_module_ctor, .Lfunc_end2-__hip_module_ctor
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_dtor
.type __hip_module_dtor,@function
__hip_module_dtor: # @__hip_module_dtor
.cfi_startproc
# %bb.0:
movq __hip_gpubin_handle(%rip), %rdi
testq %rdi, %rdi
je .LBB3_2
# %bb.1:
pushq %rax
.cfi_def_cfa_offset 16
callq __hipUnregisterFatBinary
movq $0, __hip_gpubin_handle(%rip)
addq $8, %rsp
.cfi_def_cfa_offset 8
.LBB3_2:
retq
.Lfunc_end3:
.size __hip_module_dtor, .Lfunc_end3-__hip_module_dtor
.cfi_endproc
# -- End function
.type _Z9TheKernelv,@object # @_Z9TheKernelv
.section .rodata,"a",@progbits
.globl _Z9TheKernelv
.p2align 3, 0x0
_Z9TheKernelv:
.quad _Z24__device_stub__TheKernelv
.size _Z9TheKernelv, 8
.type .L__unnamed_1,@object # @0
.section .rodata.str1.1,"aMS",@progbits,1
.L__unnamed_1:
.asciz "_Z9TheKernelv"
.size .L__unnamed_1, 14
.type __hip_fatbin_wrapper,@object # @__hip_fatbin_wrapper
.section .hipFatBinSegment,"a",@progbits
.p2align 3, 0x0
__hip_fatbin_wrapper:
.long 1212764230 # 0x48495046
.long 1 # 0x1
.quad __hip_fatbin
.quad 0
.size __hip_fatbin_wrapper, 24
.type __hip_gpubin_handle,@object # @__hip_gpubin_handle
.local __hip_gpubin_handle
.comm __hip_gpubin_handle,8,8
.section .init_array,"aw",@init_array
.p2align 3, 0x0
.quad __hip_module_ctor
.type __hip_cuid_,@object # @__hip_cuid_
.bss
.globl __hip_cuid_
__hip_cuid_:
.byte 0 # 0x0
.size __hip_cuid_, 1
.type .Lstr,@object # @str
.section .rodata.str1.1,"aMS",@progbits,1
.Lstr:
.asciz "This is the C layer saying hello world, from the host."
.size .Lstr, 55
.type .Lstr.1,@object # @str.1
.Lstr.1:
.asciz "Program exits."
.size .Lstr.1, 15
.section ".linker-options","e",@llvm_linker_options
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym _Z24__device_stub__TheKernelv
.addrsig_sym __hip_module_ctor
.addrsig_sym __hip_module_dtor
.addrsig_sym _Z9TheKernelv
.addrsig_sym __hip_fatbin
.addrsig_sym __hip_fatbin_wrapper
.addrsig_sym __hip_cuid_ |
You are a helpful coding assistant specialized in converting from CUDA host assembly to AMD host assembly. | .file "tmpxft_0001fc03_00000000-6_program_id.cudafe1.cpp"
.text
#APP
#NO_APP
.type _ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2060:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaUnregisterFatBinary@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2060:
.size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
.globl _Z27__device_stub__Z9TheKernelvv
.type _Z27__device_stub__Z9TheKernelvv, @function
_Z27__device_stub__Z9TheKernelvv:
.LFB2082:
.cfi_startproc
endbr64
subq $88, %rsp
.cfi_def_cfa_offset 96
movq %fs:40, %rax
movq %rax, 72(%rsp)
xorl %eax, %eax
movl $1, 16(%rsp)
movl $1, 20(%rsp)
movl $1, 24(%rsp)
movl $1, 28(%rsp)
movl $1, 32(%rsp)
movl $1, 36(%rsp)
leaq 8(%rsp), %rcx
movq %rsp, %rdx
leaq 28(%rsp), %rsi
leaq 16(%rsp), %rdi
call __cudaPopCallConfiguration@PLT
testl %eax, %eax
je .L7
.L3:
movq 72(%rsp), %rax
subq %fs:40, %rax
jne .L8
addq $88, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 8
ret
.L7:
.cfi_restore_state
pushq 8(%rsp)
.cfi_def_cfa_offset 104
pushq 8(%rsp)
.cfi_def_cfa_offset 112
leaq 80(%rsp), %r9
movq 44(%rsp), %rcx
movl 52(%rsp), %r8d
movq 32(%rsp), %rsi
movl 40(%rsp), %edx
leaq _Z9TheKernelv(%rip), %rdi
call cudaLaunchKernel@PLT
addq $16, %rsp
.cfi_def_cfa_offset 96
jmp .L3
.L8:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE2082:
.size _Z27__device_stub__Z9TheKernelvv, .-_Z27__device_stub__Z9TheKernelvv
.globl _Z9TheKernelv
.type _Z9TheKernelv, @function
_Z9TheKernelv:
.LFB2083:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
call _Z27__device_stub__Z9TheKernelvv
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2083:
.size _Z9TheKernelv, .-_Z9TheKernelv
.section .rodata.str1.8,"aMS",@progbits,1
.align 8
.LC0:
.string "This is the C layer saying hello world, from the host.\n"
.section .rodata.str1.1,"aMS",@progbits,1
.LC1:
.string "Program exits.\n"
.text
.globl main
.type main, @function
main:
.LFB2057:
.cfi_startproc
endbr64
subq $40, %rsp
.cfi_def_cfa_offset 48
leaq .LC0(%rip), %rsi
movl $2, %edi
movl $0, %eax
call __printf_chk@PLT
movl $32, 20(%rsp)
movl $1, 24(%rsp)
movl $1, 8(%rsp)
movl $1, 12(%rsp)
movl $0, %r9d
movl $0, %r8d
movq 20(%rsp), %rdx
movl $1, %ecx
movq 8(%rsp), %rdi
movl $1, %esi
call __cudaPushCallConfiguration@PLT
testl %eax, %eax
je .L14
.L12:
call cudaDeviceSynchronize@PLT
leaq .LC1(%rip), %rsi
movl $2, %edi
movl $0, %eax
call __printf_chk@PLT
movl $0, %eax
addq $40, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 8
ret
.L14:
.cfi_restore_state
call _Z27__device_stub__Z9TheKernelvv
jmp .L12
.cfi_endproc
.LFE2057:
.size main, .-main
.section .rodata.str1.1
.LC2:
.string "_Z9TheKernelv"
.text
.type _ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2085:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
leaq _ZL15__fatDeviceText(%rip), %rdi
call __cudaRegisterFatBinary@PLT
movq %rax, %rdi
movq %rax, _ZL20__cudaFatCubinHandle(%rip)
pushq $0
.cfi_def_cfa_offset 24
pushq $0
.cfi_def_cfa_offset 32
pushq $0
.cfi_def_cfa_offset 40
pushq $0
.cfi_def_cfa_offset 48
movl $0, %r9d
movl $-1, %r8d
leaq .LC2(%rip), %rdx
movq %rdx, %rcx
leaq _Z9TheKernelv(%rip), %rsi
call __cudaRegisterFunction@PLT
addq $32, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaRegisterFatBinaryEnd@PLT
leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
call atexit@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2085:
.size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
.section .init_array,"aw"
.align 8
.quad _ZL24__sti____cudaRegisterAllv
.section .nvFatBinSegment,"aw"
.align 8
.type _ZL15__fatDeviceText, @object
.size _ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
.long 1180844977
.long 1
.quad fatbinData
.quad 0
.local _ZL20__cudaFatCubinHandle
.comm _ZL20__cudaFatCubinHandle,8,8
.ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
.section .note.GNU-stack,"",@progbits
.section .note.gnu.property,"a"
.align 8
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.string "GNU"
1:
.align 8
.long 0xc0000002
.long 3f - 2f
2:
.long 0x3
3:
.align 8
4: | .text
.file "program_id.hip"
.globl _Z24__device_stub__TheKernelv # -- Begin function _Z24__device_stub__TheKernelv
.p2align 4, 0x90
.type _Z24__device_stub__TheKernelv,@function
_Z24__device_stub__TheKernelv: # @_Z24__device_stub__TheKernelv
.cfi_startproc
# %bb.0:
subq $56, %rsp
.cfi_def_cfa_offset 64
leaq 32(%rsp), %rdi
leaq 16(%rsp), %rsi
leaq 8(%rsp), %rdx
movq %rsp, %rcx
callq __hipPopCallConfiguration
movq 32(%rsp), %rsi
movl 40(%rsp), %edx
movq 16(%rsp), %rcx
movl 24(%rsp), %r8d
leaq 48(%rsp), %r9
movl $_Z9TheKernelv, %edi
pushq (%rsp)
.cfi_adjust_cfa_offset 8
pushq 16(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $72, %rsp
.cfi_adjust_cfa_offset -72
retq
.Lfunc_end0:
.size _Z24__device_stub__TheKernelv, .Lfunc_end0-_Z24__device_stub__TheKernelv
.cfi_endproc
# -- End function
.globl main # -- Begin function main
.p2align 4, 0x90
.type main,@function
main: # @main
.cfi_startproc
# %bb.0:
subq $56, %rsp
.cfi_def_cfa_offset 64
movl $.Lstr, %edi
callq puts@PLT
movabsq $4294967297, %rdi # imm = 0x100000001
leaq 31(%rdi), %rdx
movl $1, %esi
movl $1, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq __hipPushCallConfiguration
testl %eax, %eax
jne .LBB1_2
# %bb.1:
leaq 32(%rsp), %rdi
leaq 16(%rsp), %rsi
leaq 8(%rsp), %rdx
movq %rsp, %rcx
callq __hipPopCallConfiguration
movq 32(%rsp), %rsi
movl 40(%rsp), %edx
movq 16(%rsp), %rcx
movl 24(%rsp), %r8d
leaq 48(%rsp), %r9
movl $_Z9TheKernelv, %edi
pushq (%rsp)
.cfi_adjust_cfa_offset 8
pushq 16(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $16, %rsp
.cfi_adjust_cfa_offset -16
.LBB1_2:
callq hipDeviceSynchronize
movl $.Lstr.1, %edi
callq puts@PLT
xorl %eax, %eax
addq $56, %rsp
.cfi_def_cfa_offset 8
retq
.Lfunc_end1:
.size main, .Lfunc_end1-main
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_ctor
.type __hip_module_ctor,@function
__hip_module_ctor: # @__hip_module_ctor
.cfi_startproc
# %bb.0:
subq $40, %rsp
.cfi_def_cfa_offset 48
cmpq $0, __hip_gpubin_handle(%rip)
jne .LBB2_2
# %bb.1:
movl $__hip_fatbin_wrapper, %edi
callq __hipRegisterFatBinary
movq %rax, __hip_gpubin_handle(%rip)
.LBB2_2:
movq __hip_gpubin_handle(%rip), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 16(%rsp)
movups %xmm0, (%rsp)
movl $_Z9TheKernelv, %esi
movl $.L__unnamed_1, %edx
movl $.L__unnamed_1, %ecx
movl $-1, %r8d
xorl %r9d, %r9d
callq __hipRegisterFunction
movl $__hip_module_dtor, %edi
addq $40, %rsp
.cfi_def_cfa_offset 8
jmp atexit # TAILCALL
.Lfunc_end2:
.size __hip_module_ctor, .Lfunc_end2-__hip_module_ctor
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_dtor
.type __hip_module_dtor,@function
__hip_module_dtor: # @__hip_module_dtor
.cfi_startproc
# %bb.0:
movq __hip_gpubin_handle(%rip), %rdi
testq %rdi, %rdi
je .LBB3_2
# %bb.1:
pushq %rax
.cfi_def_cfa_offset 16
callq __hipUnregisterFatBinary
movq $0, __hip_gpubin_handle(%rip)
addq $8, %rsp
.cfi_def_cfa_offset 8
.LBB3_2:
retq
.Lfunc_end3:
.size __hip_module_dtor, .Lfunc_end3-__hip_module_dtor
.cfi_endproc
# -- End function
.type _Z9TheKernelv,@object # @_Z9TheKernelv
.section .rodata,"a",@progbits
.globl _Z9TheKernelv
.p2align 3, 0x0
_Z9TheKernelv:
.quad _Z24__device_stub__TheKernelv
.size _Z9TheKernelv, 8
.type .L__unnamed_1,@object # @0
.section .rodata.str1.1,"aMS",@progbits,1
.L__unnamed_1:
.asciz "_Z9TheKernelv"
.size .L__unnamed_1, 14
.type __hip_fatbin_wrapper,@object # @__hip_fatbin_wrapper
.section .hipFatBinSegment,"a",@progbits
.p2align 3, 0x0
__hip_fatbin_wrapper:
.long 1212764230 # 0x48495046
.long 1 # 0x1
.quad __hip_fatbin
.quad 0
.size __hip_fatbin_wrapper, 24
.type __hip_gpubin_handle,@object # @__hip_gpubin_handle
.local __hip_gpubin_handle
.comm __hip_gpubin_handle,8,8
.section .init_array,"aw",@init_array
.p2align 3, 0x0
.quad __hip_module_ctor
.type __hip_cuid_,@object # @__hip_cuid_
.bss
.globl __hip_cuid_
__hip_cuid_:
.byte 0 # 0x0
.size __hip_cuid_, 1
.type .Lstr,@object # @str
.section .rodata.str1.1,"aMS",@progbits,1
.Lstr:
.asciz "This is the C layer saying hello world, from the host."
.size .Lstr, 55
.type .Lstr.1,@object # @str.1
.Lstr.1:
.asciz "Program exits."
.size .Lstr.1, 15
.section ".linker-options","e",@llvm_linker_options
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym _Z24__device_stub__TheKernelv
.addrsig_sym __hip_module_ctor
.addrsig_sym __hip_module_dtor
.addrsig_sym _Z9TheKernelv
.addrsig_sym __hip_fatbin
.addrsig_sym __hip_fatbin_wrapper
.addrsig_sym __hip_cuid_ |
You are a helpful coding assistant specialized in converting CUDA source code to CUDA device assembly. | #include "includes.h"
__global__ void SigmoidBackKernel(float* Z, float* dZ, int size){
int id = blockIdx.x * blockDim.x + threadIdx.x;
if(id < size){
float t = Z[id];
dZ[id] = dZ[id] * t * (1-t) ;
}
} | code for sm_80
Function : _Z17SigmoidBackKernelPfS_i
.headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)"
/*0000*/ MOV R1, c[0x0][0x28] ; /* 0x00000a0000017a02 */
/* 0x000fe40000000f00 */
/*0010*/ S2R R4, SR_CTAID.X ; /* 0x0000000000047919 */
/* 0x000e280000002500 */
/*0020*/ S2R R3, SR_TID.X ; /* 0x0000000000037919 */
/* 0x000e240000002100 */
/*0030*/ IMAD R4, R4, c[0x0][0x0], R3 ; /* 0x0000000004047a24 */
/* 0x001fca00078e0203 */
/*0040*/ ISETP.GE.AND P0, PT, R4, c[0x0][0x170], PT ; /* 0x00005c0004007a0c */
/* 0x000fda0003f06270 */
/*0050*/ @P0 EXIT ; /* 0x000000000000094d */
/* 0x000fea0003800000 */
/*0060*/ HFMA2.MMA R5, -RZ, RZ, 0, 2.384185791015625e-07 ; /* 0x00000004ff057435 */
/* 0x000fe200000001ff */
/*0070*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */
/* 0x000fd20000000a00 */
/*0080*/ IMAD.WIDE R2, R4, R5, c[0x0][0x160] ; /* 0x0000580004027625 */
/* 0x000fc800078e0205 */
/*0090*/ IMAD.WIDE R4, R4, R5, c[0x0][0x168] ; /* 0x00005a0004047625 */
/* 0x000fe400078e0205 */
/*00a0*/ LDG.E R3, [R2.64] ; /* 0x0000000402037981 */
/* 0x000ea8000c1e1900 */
/*00b0*/ LDG.E R0, [R4.64] ; /* 0x0000000404007981 */
/* 0x000ee2000c1e1900 */
/*00c0*/ FADD R7, -R3, 1 ; /* 0x3f80000003077421 */
/* 0x004fe40000000100 */
/*00d0*/ FMUL R0, R0, R3 ; /* 0x0000000300007220 */
/* 0x008fc80000400000 */
/*00e0*/ FMUL R7, R0, R7 ; /* 0x0000000700077220 */
/* 0x000fca0000400000 */
/*00f0*/ STG.E [R4.64], R7 ; /* 0x0000000704007986 */
/* 0x000fe2000c101904 */
/*0100*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*0110*/ BRA 0x110; /* 0xfffffff000007947 */
/* 0x000fc0000383ffff */
/*0120*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0130*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0140*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0150*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0160*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0170*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0180*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0190*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*01a0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*01b0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*01c0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*01d0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*01e0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*01f0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
.......... |
You are a helpful coding assistant specialized in converting CUDA source code to CUDA host assembly. | #include "includes.h"
__global__ void SigmoidBackKernel(float* Z, float* dZ, int size){
int id = blockIdx.x * blockDim.x + threadIdx.x;
if(id < size){
float t = Z[id];
dZ[id] = dZ[id] * t * (1-t) ;
}
} | .file "tmpxft_0015c166_00000000-6_SigmoidBackKernel.cudafe1.cpp"
.text
#APP
#NO_APP
.type _ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2029:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaUnregisterFatBinary@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2029:
.size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
.globl _Z40__device_stub__Z17SigmoidBackKernelPfS_iPfS_i
.type _Z40__device_stub__Z17SigmoidBackKernelPfS_iPfS_i, @function
_Z40__device_stub__Z17SigmoidBackKernelPfS_iPfS_i:
.LFB2051:
.cfi_startproc
endbr64
subq $136, %rsp
.cfi_def_cfa_offset 144
movq %rdi, 24(%rsp)
movq %rsi, 16(%rsp)
movl %edx, 12(%rsp)
movq %fs:40, %rax
movq %rax, 120(%rsp)
xorl %eax, %eax
leaq 24(%rsp), %rax
movq %rax, 96(%rsp)
leaq 16(%rsp), %rax
movq %rax, 104(%rsp)
leaq 12(%rsp), %rax
movq %rax, 112(%rsp)
movl $1, 48(%rsp)
movl $1, 52(%rsp)
movl $1, 56(%rsp)
movl $1, 60(%rsp)
movl $1, 64(%rsp)
movl $1, 68(%rsp)
leaq 40(%rsp), %rcx
leaq 32(%rsp), %rdx
leaq 60(%rsp), %rsi
leaq 48(%rsp), %rdi
call __cudaPopCallConfiguration@PLT
testl %eax, %eax
je .L7
.L3:
movq 120(%rsp), %rax
subq %fs:40, %rax
jne .L8
addq $136, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 8
ret
.L7:
.cfi_restore_state
pushq 40(%rsp)
.cfi_def_cfa_offset 152
pushq 40(%rsp)
.cfi_def_cfa_offset 160
leaq 112(%rsp), %r9
movq 76(%rsp), %rcx
movl 84(%rsp), %r8d
movq 64(%rsp), %rsi
movl 72(%rsp), %edx
leaq _Z17SigmoidBackKernelPfS_i(%rip), %rdi
call cudaLaunchKernel@PLT
addq $16, %rsp
.cfi_def_cfa_offset 144
jmp .L3
.L8:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE2051:
.size _Z40__device_stub__Z17SigmoidBackKernelPfS_iPfS_i, .-_Z40__device_stub__Z17SigmoidBackKernelPfS_iPfS_i
.globl _Z17SigmoidBackKernelPfS_i
.type _Z17SigmoidBackKernelPfS_i, @function
_Z17SigmoidBackKernelPfS_i:
.LFB2052:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
call _Z40__device_stub__Z17SigmoidBackKernelPfS_iPfS_i
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2052:
.size _Z17SigmoidBackKernelPfS_i, .-_Z17SigmoidBackKernelPfS_i
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "_Z17SigmoidBackKernelPfS_i"
.text
.type _ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2054:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
leaq _ZL15__fatDeviceText(%rip), %rdi
call __cudaRegisterFatBinary@PLT
movq %rax, %rdi
movq %rax, _ZL20__cudaFatCubinHandle(%rip)
pushq $0
.cfi_def_cfa_offset 24
pushq $0
.cfi_def_cfa_offset 32
pushq $0
.cfi_def_cfa_offset 40
pushq $0
.cfi_def_cfa_offset 48
movl $0, %r9d
movl $-1, %r8d
leaq .LC0(%rip), %rdx
movq %rdx, %rcx
leaq _Z17SigmoidBackKernelPfS_i(%rip), %rsi
call __cudaRegisterFunction@PLT
addq $32, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaRegisterFatBinaryEnd@PLT
leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
call atexit@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2054:
.size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
.section .init_array,"aw"
.align 8
.quad _ZL24__sti____cudaRegisterAllv
.section .nvFatBinSegment,"aw"
.align 8
.type _ZL15__fatDeviceText, @object
.size _ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
.long 1180844977
.long 1
.quad fatbinData
.quad 0
.local _ZL20__cudaFatCubinHandle
.comm _ZL20__cudaFatCubinHandle,8,8
.ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
.section .note.GNU-stack,"",@progbits
.section .note.gnu.property,"a"
.align 8
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.string "GNU"
1:
.align 8
.long 0xc0000002
.long 3f - 2f
2:
.long 0x3
3:
.align 8
4: |
You are a helpful coding assistant specialized in converting CUDA source code to HIP/AMD source code. | #include "includes.h"
__global__ void SigmoidBackKernel(float* Z, float* dZ, int size){
int id = blockIdx.x * blockDim.x + threadIdx.x;
if(id < size){
float t = Z[id];
dZ[id] = dZ[id] * t * (1-t) ;
}
} | #include <hip/hip_runtime.h>
#include "includes.h"
__global__ void SigmoidBackKernel(float* Z, float* dZ, int size){
int id = blockIdx.x * blockDim.x + threadIdx.x;
if(id < size){
float t = Z[id];
dZ[id] = dZ[id] * t * (1-t) ;
}
} |
You are a helpful coding assistant specialized in converting HIP source code to AMD device assembly. | #include <hip/hip_runtime.h>
#include "includes.h"
__global__ void SigmoidBackKernel(float* Z, float* dZ, int size){
int id = blockIdx.x * blockDim.x + threadIdx.x;
if(id < size){
float t = Z[id];
dZ[id] = dZ[id] * t * (1-t) ;
}
} | .text
.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
.protected _Z17SigmoidBackKernelPfS_i
.globl _Z17SigmoidBackKernelPfS_i
.p2align 8
.type _Z17SigmoidBackKernelPfS_i,@function
_Z17SigmoidBackKernelPfS_i:
s_clause 0x1
s_load_b32 s2, s[0:1], 0x24
s_load_b32 s3, s[0:1], 0x10
s_waitcnt lgkmcnt(0)
s_and_b32 s2, s2, 0xffff
s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
s_mov_b32 s2, exec_lo
v_cmpx_gt_i32_e64 s3, v1
s_cbranch_execz .LBB0_2
s_load_b128 s[0:3], s[0:1], 0x0
v_ashrrev_i32_e32 v2, 31, v1
s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
v_lshlrev_b64 v[0:1], 2, v[1:2]
s_waitcnt lgkmcnt(0)
v_add_co_u32 v2, vcc_lo, s0, v0
s_delay_alu instid0(VALU_DEP_2)
v_add_co_ci_u32_e32 v3, vcc_lo, s1, v1, vcc_lo
v_add_co_u32 v0, vcc_lo, s2, v0
v_add_co_ci_u32_e32 v1, vcc_lo, s3, v1, vcc_lo
global_load_b32 v2, v[2:3], off
global_load_b32 v3, v[0:1], off
s_waitcnt vmcnt(0)
v_dual_mul_f32 v3, v2, v3 :: v_dual_sub_f32 v2, 1.0, v2
s_delay_alu instid0(VALU_DEP_1)
v_mul_f32_e32 v2, v2, v3
global_store_b32 v[0:1], v2, off
.LBB0_2:
s_nop 0
s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
s_endpgm
.section .rodata,"a",@progbits
.p2align 6, 0x0
.amdhsa_kernel _Z17SigmoidBackKernelPfS_i
.amdhsa_group_segment_fixed_size 0
.amdhsa_private_segment_fixed_size 0
.amdhsa_kernarg_size 280
.amdhsa_user_sgpr_count 15
.amdhsa_user_sgpr_dispatch_ptr 0
.amdhsa_user_sgpr_queue_ptr 0
.amdhsa_user_sgpr_kernarg_segment_ptr 1
.amdhsa_user_sgpr_dispatch_id 0
.amdhsa_user_sgpr_private_segment_size 0
.amdhsa_wavefront_size32 1
.amdhsa_uses_dynamic_stack 0
.amdhsa_enable_private_segment 0
.amdhsa_system_sgpr_workgroup_id_x 1
.amdhsa_system_sgpr_workgroup_id_y 0
.amdhsa_system_sgpr_workgroup_id_z 0
.amdhsa_system_sgpr_workgroup_info 0
.amdhsa_system_vgpr_workitem_id 0
.amdhsa_next_free_vgpr 4
.amdhsa_next_free_sgpr 16
.amdhsa_float_round_mode_32 0
.amdhsa_float_round_mode_16_64 0
.amdhsa_float_denorm_mode_32 3
.amdhsa_float_denorm_mode_16_64 3
.amdhsa_dx10_clamp 1
.amdhsa_ieee_mode 1
.amdhsa_fp16_overflow 0
.amdhsa_workgroup_processor_mode 1
.amdhsa_memory_ordered 1
.amdhsa_forward_progress 0
.amdhsa_shared_vgpr_count 0
.amdhsa_exception_fp_ieee_invalid_op 0
.amdhsa_exception_fp_denorm_src 0
.amdhsa_exception_fp_ieee_div_zero 0
.amdhsa_exception_fp_ieee_overflow 0
.amdhsa_exception_fp_ieee_underflow 0
.amdhsa_exception_fp_ieee_inexact 0
.amdhsa_exception_int_div_zero 0
.end_amdhsa_kernel
.text
.Lfunc_end0:
.size _Z17SigmoidBackKernelPfS_i, .Lfunc_end0-_Z17SigmoidBackKernelPfS_i
.section .AMDGPU.csdata,"",@progbits
.text
.p2alignl 7, 3214868480
.fill 96, 4, 3214868480
.type __hip_cuid_,@object
.section .bss,"aw",@nobits
.globl __hip_cuid_
__hip_cuid_:
.byte 0
.size __hip_cuid_, 1
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym __hip_cuid_
.amdgpu_metadata
---
amdhsa.kernels:
- .args:
- .address_space: global
.offset: 0
.size: 8
.value_kind: global_buffer
- .address_space: global
.offset: 8
.size: 8
.value_kind: global_buffer
- .offset: 16
.size: 4
.value_kind: by_value
- .offset: 24
.size: 4
.value_kind: hidden_block_count_x
- .offset: 28
.size: 4
.value_kind: hidden_block_count_y
- .offset: 32
.size: 4
.value_kind: hidden_block_count_z
- .offset: 36
.size: 2
.value_kind: hidden_group_size_x
- .offset: 38
.size: 2
.value_kind: hidden_group_size_y
- .offset: 40
.size: 2
.value_kind: hidden_group_size_z
- .offset: 42
.size: 2
.value_kind: hidden_remainder_x
- .offset: 44
.size: 2
.value_kind: hidden_remainder_y
- .offset: 46
.size: 2
.value_kind: hidden_remainder_z
- .offset: 64
.size: 8
.value_kind: hidden_global_offset_x
- .offset: 72
.size: 8
.value_kind: hidden_global_offset_y
- .offset: 80
.size: 8
.value_kind: hidden_global_offset_z
- .offset: 88
.size: 2
.value_kind: hidden_grid_dims
.group_segment_fixed_size: 0
.kernarg_segment_align: 8
.kernarg_segment_size: 280
.language: OpenCL C
.language_version:
- 2
- 0
.max_flat_workgroup_size: 1024
.name: _Z17SigmoidBackKernelPfS_i
.private_segment_fixed_size: 0
.sgpr_count: 18
.sgpr_spill_count: 0
.symbol: _Z17SigmoidBackKernelPfS_i.kd
.uniform_work_group_size: 1
.uses_dynamic_stack: false
.vgpr_count: 4
.vgpr_spill_count: 0
.wavefront_size: 32
.workgroup_processor_mode: 1
amdhsa.target: amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
- 1
- 2
...
.end_amdgpu_metadata |
You are a helpful coding assistant specialized in converting HIP source code to AMD host assembly. | #include <hip/hip_runtime.h>
#include "includes.h"
__global__ void SigmoidBackKernel(float* Z, float* dZ, int size){
int id = blockIdx.x * blockDim.x + threadIdx.x;
if(id < size){
float t = Z[id];
dZ[id] = dZ[id] * t * (1-t) ;
}
} | .text
.file "SigmoidBackKernel.hip"
.globl _Z32__device_stub__SigmoidBackKernelPfS_i # -- Begin function _Z32__device_stub__SigmoidBackKernelPfS_i
.p2align 4, 0x90
.type _Z32__device_stub__SigmoidBackKernelPfS_i,@function
_Z32__device_stub__SigmoidBackKernelPfS_i: # @_Z32__device_stub__SigmoidBackKernelPfS_i
.cfi_startproc
# %bb.0:
subq $104, %rsp
.cfi_def_cfa_offset 112
movq %rdi, 72(%rsp)
movq %rsi, 64(%rsp)
movl %edx, 12(%rsp)
leaq 72(%rsp), %rax
movq %rax, 80(%rsp)
leaq 64(%rsp), %rax
movq %rax, 88(%rsp)
leaq 12(%rsp), %rax
movq %rax, 96(%rsp)
leaq 48(%rsp), %rdi
leaq 32(%rsp), %rsi
leaq 24(%rsp), %rdx
leaq 16(%rsp), %rcx
callq __hipPopCallConfiguration
movq 48(%rsp), %rsi
movl 56(%rsp), %edx
movq 32(%rsp), %rcx
movl 40(%rsp), %r8d
leaq 80(%rsp), %r9
movl $_Z17SigmoidBackKernelPfS_i, %edi
pushq 16(%rsp)
.cfi_adjust_cfa_offset 8
pushq 32(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $120, %rsp
.cfi_adjust_cfa_offset -120
retq
.Lfunc_end0:
.size _Z32__device_stub__SigmoidBackKernelPfS_i, .Lfunc_end0-_Z32__device_stub__SigmoidBackKernelPfS_i
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_ctor
.type __hip_module_ctor,@function
__hip_module_ctor: # @__hip_module_ctor
.cfi_startproc
# %bb.0:
subq $40, %rsp
.cfi_def_cfa_offset 48
cmpq $0, __hip_gpubin_handle(%rip)
jne .LBB1_2
# %bb.1:
movl $__hip_fatbin_wrapper, %edi
callq __hipRegisterFatBinary
movq %rax, __hip_gpubin_handle(%rip)
.LBB1_2:
movq __hip_gpubin_handle(%rip), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 16(%rsp)
movups %xmm0, (%rsp)
movl $_Z17SigmoidBackKernelPfS_i, %esi
movl $.L__unnamed_1, %edx
movl $.L__unnamed_1, %ecx
movl $-1, %r8d
xorl %r9d, %r9d
callq __hipRegisterFunction
movl $__hip_module_dtor, %edi
addq $40, %rsp
.cfi_def_cfa_offset 8
jmp atexit # TAILCALL
.Lfunc_end1:
.size __hip_module_ctor, .Lfunc_end1-__hip_module_ctor
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_dtor
.type __hip_module_dtor,@function
__hip_module_dtor: # @__hip_module_dtor
.cfi_startproc
# %bb.0:
movq __hip_gpubin_handle(%rip), %rdi
testq %rdi, %rdi
je .LBB2_2
# %bb.1:
pushq %rax
.cfi_def_cfa_offset 16
callq __hipUnregisterFatBinary
movq $0, __hip_gpubin_handle(%rip)
addq $8, %rsp
.cfi_def_cfa_offset 8
.LBB2_2:
retq
.Lfunc_end2:
.size __hip_module_dtor, .Lfunc_end2-__hip_module_dtor
.cfi_endproc
# -- End function
.type _Z17SigmoidBackKernelPfS_i,@object # @_Z17SigmoidBackKernelPfS_i
.section .rodata,"a",@progbits
.globl _Z17SigmoidBackKernelPfS_i
.p2align 3, 0x0
_Z17SigmoidBackKernelPfS_i:
.quad _Z32__device_stub__SigmoidBackKernelPfS_i
.size _Z17SigmoidBackKernelPfS_i, 8
.type .L__unnamed_1,@object # @0
.section .rodata.str1.1,"aMS",@progbits,1
.L__unnamed_1:
.asciz "_Z17SigmoidBackKernelPfS_i"
.size .L__unnamed_1, 27
.type __hip_fatbin_wrapper,@object # @__hip_fatbin_wrapper
.section .hipFatBinSegment,"a",@progbits
.p2align 3, 0x0
__hip_fatbin_wrapper:
.long 1212764230 # 0x48495046
.long 1 # 0x1
.quad __hip_fatbin
.quad 0
.size __hip_fatbin_wrapper, 24
.type __hip_gpubin_handle,@object # @__hip_gpubin_handle
.local __hip_gpubin_handle
.comm __hip_gpubin_handle,8,8
.section .init_array,"aw",@init_array
.p2align 3, 0x0
.quad __hip_module_ctor
.type __hip_cuid_,@object # @__hip_cuid_
.bss
.globl __hip_cuid_
__hip_cuid_:
.byte 0 # 0x0
.size __hip_cuid_, 1
.section ".linker-options","e",@llvm_linker_options
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym _Z32__device_stub__SigmoidBackKernelPfS_i
.addrsig_sym __hip_module_ctor
.addrsig_sym __hip_module_dtor
.addrsig_sym _Z17SigmoidBackKernelPfS_i
.addrsig_sym __hip_fatbin
.addrsig_sym __hip_fatbin_wrapper
.addrsig_sym __hip_cuid_ |
You are a helpful coding assistant specialized in converting from CUDA device assembly to AMD device assembly. | code for sm_80
Function : _Z17SigmoidBackKernelPfS_i
.headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)"
/*0000*/ MOV R1, c[0x0][0x28] ; /* 0x00000a0000017a02 */
/* 0x000fe40000000f00 */
/*0010*/ S2R R4, SR_CTAID.X ; /* 0x0000000000047919 */
/* 0x000e280000002500 */
/*0020*/ S2R R3, SR_TID.X ; /* 0x0000000000037919 */
/* 0x000e240000002100 */
/*0030*/ IMAD R4, R4, c[0x0][0x0], R3 ; /* 0x0000000004047a24 */
/* 0x001fca00078e0203 */
/*0040*/ ISETP.GE.AND P0, PT, R4, c[0x0][0x170], PT ; /* 0x00005c0004007a0c */
/* 0x000fda0003f06270 */
/*0050*/ @P0 EXIT ; /* 0x000000000000094d */
/* 0x000fea0003800000 */
/*0060*/ HFMA2.MMA R5, -RZ, RZ, 0, 2.384185791015625e-07 ; /* 0x00000004ff057435 */
/* 0x000fe200000001ff */
/*0070*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */
/* 0x000fd20000000a00 */
/*0080*/ IMAD.WIDE R2, R4, R5, c[0x0][0x160] ; /* 0x0000580004027625 */
/* 0x000fc800078e0205 */
/*0090*/ IMAD.WIDE R4, R4, R5, c[0x0][0x168] ; /* 0x00005a0004047625 */
/* 0x000fe400078e0205 */
/*00a0*/ LDG.E R3, [R2.64] ; /* 0x0000000402037981 */
/* 0x000ea8000c1e1900 */
/*00b0*/ LDG.E R0, [R4.64] ; /* 0x0000000404007981 */
/* 0x000ee2000c1e1900 */
/*00c0*/ FADD R7, -R3, 1 ; /* 0x3f80000003077421 */
/* 0x004fe40000000100 */
/*00d0*/ FMUL R0, R0, R3 ; /* 0x0000000300007220 */
/* 0x008fc80000400000 */
/*00e0*/ FMUL R7, R0, R7 ; /* 0x0000000700077220 */
/* 0x000fca0000400000 */
/*00f0*/ STG.E [R4.64], R7 ; /* 0x0000000704007986 */
/* 0x000fe2000c101904 */
/*0100*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*0110*/ BRA 0x110; /* 0xfffffff000007947 */
/* 0x000fc0000383ffff */
/*0120*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0130*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0140*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0150*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0160*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0170*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0180*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0190*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*01a0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*01b0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*01c0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*01d0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*01e0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*01f0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
.......... | .text
.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
.protected _Z17SigmoidBackKernelPfS_i
.globl _Z17SigmoidBackKernelPfS_i
.p2align 8
.type _Z17SigmoidBackKernelPfS_i,@function
_Z17SigmoidBackKernelPfS_i:
s_clause 0x1
s_load_b32 s2, s[0:1], 0x24
s_load_b32 s3, s[0:1], 0x10
s_waitcnt lgkmcnt(0)
s_and_b32 s2, s2, 0xffff
s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
s_mov_b32 s2, exec_lo
v_cmpx_gt_i32_e64 s3, v1
s_cbranch_execz .LBB0_2
s_load_b128 s[0:3], s[0:1], 0x0
v_ashrrev_i32_e32 v2, 31, v1
s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
v_lshlrev_b64 v[0:1], 2, v[1:2]
s_waitcnt lgkmcnt(0)
v_add_co_u32 v2, vcc_lo, s0, v0
s_delay_alu instid0(VALU_DEP_2)
v_add_co_ci_u32_e32 v3, vcc_lo, s1, v1, vcc_lo
v_add_co_u32 v0, vcc_lo, s2, v0
v_add_co_ci_u32_e32 v1, vcc_lo, s3, v1, vcc_lo
global_load_b32 v2, v[2:3], off
global_load_b32 v3, v[0:1], off
s_waitcnt vmcnt(0)
v_dual_mul_f32 v3, v2, v3 :: v_dual_sub_f32 v2, 1.0, v2
s_delay_alu instid0(VALU_DEP_1)
v_mul_f32_e32 v2, v2, v3
global_store_b32 v[0:1], v2, off
.LBB0_2:
s_nop 0
s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
s_endpgm
.section .rodata,"a",@progbits
.p2align 6, 0x0
.amdhsa_kernel _Z17SigmoidBackKernelPfS_i
.amdhsa_group_segment_fixed_size 0
.amdhsa_private_segment_fixed_size 0
.amdhsa_kernarg_size 280
.amdhsa_user_sgpr_count 15
.amdhsa_user_sgpr_dispatch_ptr 0
.amdhsa_user_sgpr_queue_ptr 0
.amdhsa_user_sgpr_kernarg_segment_ptr 1
.amdhsa_user_sgpr_dispatch_id 0
.amdhsa_user_sgpr_private_segment_size 0
.amdhsa_wavefront_size32 1
.amdhsa_uses_dynamic_stack 0
.amdhsa_enable_private_segment 0
.amdhsa_system_sgpr_workgroup_id_x 1
.amdhsa_system_sgpr_workgroup_id_y 0
.amdhsa_system_sgpr_workgroup_id_z 0
.amdhsa_system_sgpr_workgroup_info 0
.amdhsa_system_vgpr_workitem_id 0
.amdhsa_next_free_vgpr 4
.amdhsa_next_free_sgpr 16
.amdhsa_float_round_mode_32 0
.amdhsa_float_round_mode_16_64 0
.amdhsa_float_denorm_mode_32 3
.amdhsa_float_denorm_mode_16_64 3
.amdhsa_dx10_clamp 1
.amdhsa_ieee_mode 1
.amdhsa_fp16_overflow 0
.amdhsa_workgroup_processor_mode 1
.amdhsa_memory_ordered 1
.amdhsa_forward_progress 0
.amdhsa_shared_vgpr_count 0
.amdhsa_exception_fp_ieee_invalid_op 0
.amdhsa_exception_fp_denorm_src 0
.amdhsa_exception_fp_ieee_div_zero 0
.amdhsa_exception_fp_ieee_overflow 0
.amdhsa_exception_fp_ieee_underflow 0
.amdhsa_exception_fp_ieee_inexact 0
.amdhsa_exception_int_div_zero 0
.end_amdhsa_kernel
.text
.Lfunc_end0:
.size _Z17SigmoidBackKernelPfS_i, .Lfunc_end0-_Z17SigmoidBackKernelPfS_i
.section .AMDGPU.csdata,"",@progbits
.text
.p2alignl 7, 3214868480
.fill 96, 4, 3214868480
.type __hip_cuid_,@object
.section .bss,"aw",@nobits
.globl __hip_cuid_
__hip_cuid_:
.byte 0
.size __hip_cuid_, 1
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym __hip_cuid_
.amdgpu_metadata
---
amdhsa.kernels:
- .args:
- .address_space: global
.offset: 0
.size: 8
.value_kind: global_buffer
- .address_space: global
.offset: 8
.size: 8
.value_kind: global_buffer
- .offset: 16
.size: 4
.value_kind: by_value
- .offset: 24
.size: 4
.value_kind: hidden_block_count_x
- .offset: 28
.size: 4
.value_kind: hidden_block_count_y
- .offset: 32
.size: 4
.value_kind: hidden_block_count_z
- .offset: 36
.size: 2
.value_kind: hidden_group_size_x
- .offset: 38
.size: 2
.value_kind: hidden_group_size_y
- .offset: 40
.size: 2
.value_kind: hidden_group_size_z
- .offset: 42
.size: 2
.value_kind: hidden_remainder_x
- .offset: 44
.size: 2
.value_kind: hidden_remainder_y
- .offset: 46
.size: 2
.value_kind: hidden_remainder_z
- .offset: 64
.size: 8
.value_kind: hidden_global_offset_x
- .offset: 72
.size: 8
.value_kind: hidden_global_offset_y
- .offset: 80
.size: 8
.value_kind: hidden_global_offset_z
- .offset: 88
.size: 2
.value_kind: hidden_grid_dims
.group_segment_fixed_size: 0
.kernarg_segment_align: 8
.kernarg_segment_size: 280
.language: OpenCL C
.language_version:
- 2
- 0
.max_flat_workgroup_size: 1024
.name: _Z17SigmoidBackKernelPfS_i
.private_segment_fixed_size: 0
.sgpr_count: 18
.sgpr_spill_count: 0
.symbol: _Z17SigmoidBackKernelPfS_i.kd
.uniform_work_group_size: 1
.uses_dynamic_stack: false
.vgpr_count: 4
.vgpr_spill_count: 0
.wavefront_size: 32
.workgroup_processor_mode: 1
amdhsa.target: amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
- 1
- 2
...
.end_amdgpu_metadata |
You are a helpful coding assistant specialized in converting from CUDA host assembly to AMD host assembly. | .file "tmpxft_0015c166_00000000-6_SigmoidBackKernel.cudafe1.cpp"
.text
#APP
#NO_APP
.type _ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2029:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaUnregisterFatBinary@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2029:
.size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
.globl _Z40__device_stub__Z17SigmoidBackKernelPfS_iPfS_i
.type _Z40__device_stub__Z17SigmoidBackKernelPfS_iPfS_i, @function
_Z40__device_stub__Z17SigmoidBackKernelPfS_iPfS_i:
.LFB2051:
.cfi_startproc
endbr64
subq $136, %rsp
.cfi_def_cfa_offset 144
movq %rdi, 24(%rsp)
movq %rsi, 16(%rsp)
movl %edx, 12(%rsp)
movq %fs:40, %rax
movq %rax, 120(%rsp)
xorl %eax, %eax
leaq 24(%rsp), %rax
movq %rax, 96(%rsp)
leaq 16(%rsp), %rax
movq %rax, 104(%rsp)
leaq 12(%rsp), %rax
movq %rax, 112(%rsp)
movl $1, 48(%rsp)
movl $1, 52(%rsp)
movl $1, 56(%rsp)
movl $1, 60(%rsp)
movl $1, 64(%rsp)
movl $1, 68(%rsp)
leaq 40(%rsp), %rcx
leaq 32(%rsp), %rdx
leaq 60(%rsp), %rsi
leaq 48(%rsp), %rdi
call __cudaPopCallConfiguration@PLT
testl %eax, %eax
je .L7
.L3:
movq 120(%rsp), %rax
subq %fs:40, %rax
jne .L8
addq $136, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 8
ret
.L7:
.cfi_restore_state
pushq 40(%rsp)
.cfi_def_cfa_offset 152
pushq 40(%rsp)
.cfi_def_cfa_offset 160
leaq 112(%rsp), %r9
movq 76(%rsp), %rcx
movl 84(%rsp), %r8d
movq 64(%rsp), %rsi
movl 72(%rsp), %edx
leaq _Z17SigmoidBackKernelPfS_i(%rip), %rdi
call cudaLaunchKernel@PLT
addq $16, %rsp
.cfi_def_cfa_offset 144
jmp .L3
.L8:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE2051:
.size _Z40__device_stub__Z17SigmoidBackKernelPfS_iPfS_i, .-_Z40__device_stub__Z17SigmoidBackKernelPfS_iPfS_i
.globl _Z17SigmoidBackKernelPfS_i
.type _Z17SigmoidBackKernelPfS_i, @function
_Z17SigmoidBackKernelPfS_i:
.LFB2052:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
call _Z40__device_stub__Z17SigmoidBackKernelPfS_iPfS_i
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2052:
.size _Z17SigmoidBackKernelPfS_i, .-_Z17SigmoidBackKernelPfS_i
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "_Z17SigmoidBackKernelPfS_i"
.text
.type _ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2054:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
leaq _ZL15__fatDeviceText(%rip), %rdi
call __cudaRegisterFatBinary@PLT
movq %rax, %rdi
movq %rax, _ZL20__cudaFatCubinHandle(%rip)
pushq $0
.cfi_def_cfa_offset 24
pushq $0
.cfi_def_cfa_offset 32
pushq $0
.cfi_def_cfa_offset 40
pushq $0
.cfi_def_cfa_offset 48
movl $0, %r9d
movl $-1, %r8d
leaq .LC0(%rip), %rdx
movq %rdx, %rcx
leaq _Z17SigmoidBackKernelPfS_i(%rip), %rsi
call __cudaRegisterFunction@PLT
addq $32, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaRegisterFatBinaryEnd@PLT
leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
call atexit@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2054:
.size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
.section .init_array,"aw"
.align 8
.quad _ZL24__sti____cudaRegisterAllv
.section .nvFatBinSegment,"aw"
.align 8
.type _ZL15__fatDeviceText, @object
.size _ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
.long 1180844977
.long 1
.quad fatbinData
.quad 0
.local _ZL20__cudaFatCubinHandle
.comm _ZL20__cudaFatCubinHandle,8,8
.ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
.section .note.GNU-stack,"",@progbits
.section .note.gnu.property,"a"
.align 8
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.string "GNU"
1:
.align 8
.long 0xc0000002
.long 3f - 2f
2:
.long 0x3
3:
.align 8
4: | .text
.file "SigmoidBackKernel.hip"
.globl _Z32__device_stub__SigmoidBackKernelPfS_i # -- Begin function _Z32__device_stub__SigmoidBackKernelPfS_i
.p2align 4, 0x90
.type _Z32__device_stub__SigmoidBackKernelPfS_i,@function
_Z32__device_stub__SigmoidBackKernelPfS_i: # @_Z32__device_stub__SigmoidBackKernelPfS_i
.cfi_startproc
# %bb.0:
subq $104, %rsp
.cfi_def_cfa_offset 112
movq %rdi, 72(%rsp)
movq %rsi, 64(%rsp)
movl %edx, 12(%rsp)
leaq 72(%rsp), %rax
movq %rax, 80(%rsp)
leaq 64(%rsp), %rax
movq %rax, 88(%rsp)
leaq 12(%rsp), %rax
movq %rax, 96(%rsp)
leaq 48(%rsp), %rdi
leaq 32(%rsp), %rsi
leaq 24(%rsp), %rdx
leaq 16(%rsp), %rcx
callq __hipPopCallConfiguration
movq 48(%rsp), %rsi
movl 56(%rsp), %edx
movq 32(%rsp), %rcx
movl 40(%rsp), %r8d
leaq 80(%rsp), %r9
movl $_Z17SigmoidBackKernelPfS_i, %edi
pushq 16(%rsp)
.cfi_adjust_cfa_offset 8
pushq 32(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $120, %rsp
.cfi_adjust_cfa_offset -120
retq
.Lfunc_end0:
.size _Z32__device_stub__SigmoidBackKernelPfS_i, .Lfunc_end0-_Z32__device_stub__SigmoidBackKernelPfS_i
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_ctor
.type __hip_module_ctor,@function
__hip_module_ctor: # @__hip_module_ctor
.cfi_startproc
# %bb.0:
subq $40, %rsp
.cfi_def_cfa_offset 48
cmpq $0, __hip_gpubin_handle(%rip)
jne .LBB1_2
# %bb.1:
movl $__hip_fatbin_wrapper, %edi
callq __hipRegisterFatBinary
movq %rax, __hip_gpubin_handle(%rip)
.LBB1_2:
movq __hip_gpubin_handle(%rip), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 16(%rsp)
movups %xmm0, (%rsp)
movl $_Z17SigmoidBackKernelPfS_i, %esi
movl $.L__unnamed_1, %edx
movl $.L__unnamed_1, %ecx
movl $-1, %r8d
xorl %r9d, %r9d
callq __hipRegisterFunction
movl $__hip_module_dtor, %edi
addq $40, %rsp
.cfi_def_cfa_offset 8
jmp atexit # TAILCALL
.Lfunc_end1:
.size __hip_module_ctor, .Lfunc_end1-__hip_module_ctor
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_dtor
.type __hip_module_dtor,@function
__hip_module_dtor: # @__hip_module_dtor
.cfi_startproc
# %bb.0:
movq __hip_gpubin_handle(%rip), %rdi
testq %rdi, %rdi
je .LBB2_2
# %bb.1:
pushq %rax
.cfi_def_cfa_offset 16
callq __hipUnregisterFatBinary
movq $0, __hip_gpubin_handle(%rip)
addq $8, %rsp
.cfi_def_cfa_offset 8
.LBB2_2:
retq
.Lfunc_end2:
.size __hip_module_dtor, .Lfunc_end2-__hip_module_dtor
.cfi_endproc
# -- End function
.type _Z17SigmoidBackKernelPfS_i,@object # @_Z17SigmoidBackKernelPfS_i
.section .rodata,"a",@progbits
.globl _Z17SigmoidBackKernelPfS_i
.p2align 3, 0x0
_Z17SigmoidBackKernelPfS_i:
.quad _Z32__device_stub__SigmoidBackKernelPfS_i
.size _Z17SigmoidBackKernelPfS_i, 8
.type .L__unnamed_1,@object # @0
.section .rodata.str1.1,"aMS",@progbits,1
.L__unnamed_1:
.asciz "_Z17SigmoidBackKernelPfS_i"
.size .L__unnamed_1, 27
.type __hip_fatbin_wrapper,@object # @__hip_fatbin_wrapper
.section .hipFatBinSegment,"a",@progbits
.p2align 3, 0x0
__hip_fatbin_wrapper:
.long 1212764230 # 0x48495046
.long 1 # 0x1
.quad __hip_fatbin
.quad 0
.size __hip_fatbin_wrapper, 24
.type __hip_gpubin_handle,@object # @__hip_gpubin_handle
.local __hip_gpubin_handle
.comm __hip_gpubin_handle,8,8
.section .init_array,"aw",@init_array
.p2align 3, 0x0
.quad __hip_module_ctor
.type __hip_cuid_,@object # @__hip_cuid_
.bss
.globl __hip_cuid_
__hip_cuid_:
.byte 0 # 0x0
.size __hip_cuid_, 1
.section ".linker-options","e",@llvm_linker_options
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym _Z32__device_stub__SigmoidBackKernelPfS_i
.addrsig_sym __hip_module_ctor
.addrsig_sym __hip_module_dtor
.addrsig_sym _Z17SigmoidBackKernelPfS_i
.addrsig_sym __hip_fatbin
.addrsig_sym __hip_fatbin_wrapper
.addrsig_sym __hip_cuid_ |
You are a helpful coding assistant specialized in converting CUDA source code to CUDA device assembly. | #include <iostream>
using namespace std;
#define L 1e-4
#define N_grid 16
#define dx (L/float(N_grid))
void test(float x)
{
float y = x - floor(x/L)*L;
cout << x << " " << y << endl;
}
int main()
{
cout << "L:" << L << endl;
test(-3*L);
test(-2*L);
test(-L);
test(-0.5*L);
test(0);
test(L/2.0);
test(L);
test(L*1.5);
test(3*L);
} | code for sm_80 |
You are a helpful coding assistant specialized in converting CUDA source code to CUDA host assembly. | #include <iostream>
using namespace std;
#define L 1e-4
#define N_grid 16
#define dx (L/float(N_grid))
void test(float x)
{
float y = x - floor(x/L)*L;
cout << x << " " << y << endl;
}
int main()
{
cout << "L:" << L << endl;
test(-3*L);
test(-2*L);
test(-L);
test(-0.5*L);
test(0);
test(L/2.0);
test(L);
test(L*1.5);
test(3*L);
} | .file "tmpxft_00033500_00000000-6_test_pbc.cudafe1.cpp"
.text
#APP
.globl _ZSt21ios_base_library_initv
#NO_APP
.type _ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3673:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaUnregisterFatBinary@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE3673:
.size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
.section .rodata.str1.1,"aMS",@progbits,1
.LC4:
.string " "
.text
.globl _Z4testf
.type _Z4testf, @function
_Z4testf:
.LFB3669:
.cfi_startproc
endbr64
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
pushq %rbx
.cfi_def_cfa_offset 24
.cfi_offset 3, -24
subq $24, %rsp
.cfi_def_cfa_offset 48
cvtss2sd %xmm0, %xmm0
movapd %xmm0, %xmm3
divsd .LC0(%rip), %xmm3
movapd %xmm3, %xmm1
movsd .LC5(%rip), %xmm4
movapd %xmm3, %xmm2
andpd %xmm4, %xmm2
movsd .LC1(%rip), %xmm5
ucomisd %xmm2, %xmm5
jbe .L4
cvttsd2siq %xmm3, %rax
pxor %xmm2, %xmm2
cvtsi2sdq %rax, %xmm2
movapd %xmm2, %xmm1
cmpnlesd %xmm3, %xmm1
movsd .LC3(%rip), %xmm5
andpd %xmm5, %xmm1
subsd %xmm1, %xmm2
andnpd %xmm3, %xmm4
movapd %xmm2, %xmm1
orpd %xmm4, %xmm1
.L4:
mulsd .LC0(%rip), %xmm1
movapd %xmm0, %xmm2
subsd %xmm1, %xmm2
pxor %xmm6, %xmm6
cvtsd2ss %xmm2, %xmm6
movss %xmm6, 12(%rsp)
leaq _ZSt4cout(%rip), %rdi
call _ZNSo9_M_insertIdEERSoT_@PLT
movq %rax, %rbx
movl $1, %edx
leaq .LC4(%rip), %rsi
movq %rax, %rdi
call _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT
pxor %xmm0, %xmm0
cvtss2sd 12(%rsp), %xmm0
movq %rbx, %rdi
call _ZNSo9_M_insertIdEERSoT_@PLT
movq %rax, %rbx
movq (%rax), %rax
movq -24(%rax), %rax
movq 240(%rbx,%rax), %rbp
testq %rbp, %rbp
je .L9
cmpb $0, 56(%rbp)
je .L6
movzbl 67(%rbp), %esi
.L7:
movsbl %sil, %esi
movq %rbx, %rdi
call _ZNSo3putEc@PLT
movq %rax, %rdi
call _ZNSo5flushEv@PLT
addq $24, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 24
popq %rbx
.cfi_def_cfa_offset 16
popq %rbp
.cfi_def_cfa_offset 8
ret
.L9:
.cfi_restore_state
call _ZSt16__throw_bad_castv@PLT
.L6:
movq %rbp, %rdi
call _ZNKSt5ctypeIcE13_M_widen_initEv@PLT
movq 0(%rbp), %rax
movl $10, %esi
movq %rbp, %rdi
call *48(%rax)
movl %eax, %esi
jmp .L7
.cfi_endproc
.LFE3669:
.size _Z4testf, .-_Z4testf
.section .rodata.str1.1
.LC6:
.string "L:"
.text
.globl main
.type main, @function
main:
.LFB3670:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
leaq .LC6(%rip), %rsi
leaq _ZSt4cout(%rip), %rdi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
movq %rax, %rdi
movsd .LC0(%rip), %xmm0
call _ZNSo9_M_insertIdEERSoT_@PLT
movq %rax, %rdi
call _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
movss .LC7(%rip), %xmm0
call _Z4testf
movss .LC8(%rip), %xmm0
call _Z4testf
movss .LC9(%rip), %xmm0
call _Z4testf
movss .LC10(%rip), %xmm0
call _Z4testf
pxor %xmm0, %xmm0
call _Z4testf
movss .LC12(%rip), %xmm0
call _Z4testf
movss .LC13(%rip), %xmm0
call _Z4testf
movss .LC14(%rip), %xmm0
call _Z4testf
movss .LC15(%rip), %xmm0
call _Z4testf
movl $0, %eax
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE3670:
.size main, .-main
.type _ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3696:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
leaq _ZL15__fatDeviceText(%rip), %rdi
call __cudaRegisterFatBinary@PLT
movq %rax, %rdi
movq %rax, _ZL20__cudaFatCubinHandle(%rip)
call __cudaRegisterFatBinaryEnd@PLT
leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
call atexit@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE3696:
.size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
.section .init_array,"aw"
.align 8
.quad _ZL24__sti____cudaRegisterAllv
.section .nvFatBinSegment,"aw"
.align 8
.type _ZL15__fatDeviceText, @object
.size _ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
.long 1180844977
.long 1
.quad fatbinData
.quad 0
.local _ZL20__cudaFatCubinHandle
.comm _ZL20__cudaFatCubinHandle,8,8
.section .rodata.cst8,"aM",@progbits,8
.align 8
.LC0:
.long -350469331
.long 1058682594
.align 8
.LC1:
.long 0
.long 1127219200
.align 8
.LC3:
.long 0
.long 1072693248
.align 8
.LC5:
.long -1
.long 2147483647
.section .rodata.cst4,"aM",@progbits,4
.align 4
.LC7:
.long -1180874414
.align 4
.LC8:
.long -1185827049
.align 4
.LC9:
.long -1194215657
.align 4
.LC10:
.long -1202604265
.align 4
.LC12:
.long 944879383
.align 4
.LC13:
.long 953267991
.align 4
.LC14:
.long 958220626
.align 4
.LC15:
.long 966609234
.ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
.section .note.GNU-stack,"",@progbits
.section .note.gnu.property,"a"
.align 8
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.string "GNU"
1:
.align 8
.long 0xc0000002
.long 3f - 2f
2:
.long 0x3
3:
.align 8
4: |
You are a helpful coding assistant specialized in converting CUDA source code to HIP/AMD source code. | #include <iostream>
using namespace std;
#define L 1e-4
#define N_grid 16
#define dx (L/float(N_grid))
void test(float x)
{
float y = x - floor(x/L)*L;
cout << x << " " << y << endl;
}
int main()
{
cout << "L:" << L << endl;
test(-3*L);
test(-2*L);
test(-L);
test(-0.5*L);
test(0);
test(L/2.0);
test(L);
test(L*1.5);
test(3*L);
} | #include <hip/hip_runtime.h>
#include <iostream>
using namespace std;
#define L 1e-4
#define N_grid 16
#define dx (L/float(N_grid))
void test(float x)
{
float y = x - floor(x/L)*L;
cout << x << " " << y << endl;
}
int main()
{
cout << "L:" << L << endl;
test(-3*L);
test(-2*L);
test(-L);
test(-0.5*L);
test(0);
test(L/2.0);
test(L);
test(L*1.5);
test(3*L);
} |
You are a helpful coding assistant specialized in converting HIP source code to AMD device assembly. | #include <hip/hip_runtime.h>
#include <iostream>
using namespace std;
#define L 1e-4
#define N_grid 16
#define dx (L/float(N_grid))
void test(float x)
{
float y = x - floor(x/L)*L;
cout << x << " " << y << endl;
}
int main()
{
cout << "L:" << L << endl;
test(-3*L);
test(-2*L);
test(-L);
test(-0.5*L);
test(0);
test(L/2.0);
test(L);
test(L*1.5);
test(3*L);
} | .text
.p2alignl 7, 3214868480
.fill 96, 4, 3214868480
.type __hip_cuid_,@object
.section .bss,"aw",@nobits
.globl __hip_cuid_
__hip_cuid_:
.byte 0
.size __hip_cuid_, 1
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym __hip_cuid_
.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
.amdgpu_metadata
---
amdhsa.kernels: []
amdhsa.target: amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
- 1
- 2
...
.end_amdgpu_metadata |
You are a helpful coding assistant specialized in converting HIP source code to AMD host assembly. | #include <hip/hip_runtime.h>
#include <iostream>
using namespace std;
#define L 1e-4
#define N_grid 16
#define dx (L/float(N_grid))
void test(float x)
{
float y = x - floor(x/L)*L;
cout << x << " " << y << endl;
}
int main()
{
cout << "L:" << L << endl;
test(-3*L);
test(-2*L);
test(-L);
test(-0.5*L);
test(0);
test(L/2.0);
test(L);
test(L*1.5);
test(3*L);
} | .text
.file "test_pbc.hip"
# Start of file scope inline assembly
.globl _ZSt21ios_base_library_initv
# End of file scope inline assembly
.section .rodata.cst8,"aM",@progbits,8
.p2align 3, 0x0 # -- Begin function _Z4testf
.LCPI0_0:
.quad 0x3f1a36e2eb1c432d # double 1.0E-4
.text
.globl _Z4testf
.p2align 4, 0x90
.type _Z4testf,@function
_Z4testf: # @_Z4testf
.cfi_startproc
# %bb.0:
pushq %r14
.cfi_def_cfa_offset 16
pushq %rbx
.cfi_def_cfa_offset 24
subq $24, %rsp
.cfi_def_cfa_offset 48
.cfi_offset %rbx, -24
.cfi_offset %r14, -16
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 16(%rsp) # 8-byte Spill
divsd .LCPI0_0(%rip), %xmm0
callq floor@PLT
mulsd .LCPI0_0(%rip), %xmm0
movsd 16(%rsp), %xmm2 # 8-byte Reload
# xmm2 = mem[0],zero
movapd %xmm2, %xmm1
subsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
movss %xmm0, 12(%rsp) # 4-byte Spill
movl $_ZSt4cout, %edi
movapd %xmm2, %xmm0
callq _ZNSo9_M_insertIdEERSoT_
movq %rax, %rbx
movl $.L.str, %esi
movl $1, %edx
movq %rax, %rdi
callq _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
movss 12(%rsp), %xmm0 # 4-byte Reload
# xmm0 = mem[0],zero,zero,zero
cvtss2sd %xmm0, %xmm0
movq %rbx, %rdi
callq _ZNSo9_M_insertIdEERSoT_
movq (%rax), %rcx
movq -24(%rcx), %rcx
movq 240(%rax,%rcx), %rbx
testq %rbx, %rbx
je .LBB0_5
# %bb.1: # %_ZSt13__check_facetISt5ctypeIcEERKT_PS3_.exit.i.i
cmpb $0, 56(%rbx)
je .LBB0_3
# %bb.2:
movzbl 67(%rbx), %ecx
jmp .LBB0_4
.LBB0_3:
movq %rbx, %rdi
movq %rax, %r14
callq _ZNKSt5ctypeIcE13_M_widen_initEv
movq (%rbx), %rax
movq %rbx, %rdi
movl $10, %esi
callq *48(%rax)
movl %eax, %ecx
movq %r14, %rax
.LBB0_4: # %_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_.exit
movsbl %cl, %esi
movq %rax, %rdi
callq _ZNSo3putEc
movq %rax, %rdi
addq $24, %rsp
.cfi_def_cfa_offset 24
popq %rbx
.cfi_def_cfa_offset 16
popq %r14
.cfi_def_cfa_offset 8
jmp _ZNSo5flushEv # TAILCALL
.LBB0_5:
.cfi_def_cfa_offset 48
callq _ZSt16__throw_bad_castv
.Lfunc_end0:
.size _Z4testf, .Lfunc_end0-_Z4testf
.cfi_endproc
# -- End function
.section .rodata.cst8,"aM",@progbits,8
.p2align 3, 0x0 # -- Begin function main
.LCPI1_0:
.quad 0x3f1a36e2eb1c432d # double 1.0E-4
.section .rodata.cst4,"aM",@progbits,4
.p2align 2, 0x0
.LCPI1_1:
.long 0xb99d4952 # float -3.00000014E-4
.LCPI1_2:
.long 0xb951b717 # float -1.99999995E-4
.LCPI1_3:
.long 0xb8d1b717 # float -9.99999974E-5
.LCPI1_4:
.long 0xb851b717 # float -4.99999987E-5
.LCPI1_5:
.long 0x3851b717 # float 4.99999987E-5
.LCPI1_6:
.long 0x38d1b717 # float 9.99999974E-5
.LCPI1_7:
.long 0x391d4952 # float 1.50000007E-4
.LCPI1_8:
.long 0x399d4952 # float 3.00000014E-4
.text
.globl main
.p2align 4, 0x90
.type main,@function
main: # @main
.cfi_startproc
# %bb.0:
pushq %r14
.cfi_def_cfa_offset 16
pushq %rbx
.cfi_def_cfa_offset 24
pushq %rax
.cfi_def_cfa_offset 32
.cfi_offset %rbx, -24
.cfi_offset %r14, -16
movl $_ZSt4cout, %edi
movl $.L.str.1, %esi
movl $2, %edx
callq _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
movsd .LCPI1_0(%rip), %xmm0 # xmm0 = mem[0],zero
movl $_ZSt4cout, %edi
callq _ZNSo9_M_insertIdEERSoT_
movq (%rax), %rcx
movq -24(%rcx), %rcx
movq 240(%rax,%rcx), %rbx
testq %rbx, %rbx
je .LBB1_5
# %bb.1: # %_ZSt13__check_facetISt5ctypeIcEERKT_PS3_.exit.i.i
cmpb $0, 56(%rbx)
je .LBB1_3
# %bb.2:
movzbl 67(%rbx), %ecx
jmp .LBB1_4
.LBB1_3:
movq %rbx, %rdi
movq %rax, %r14
callq _ZNKSt5ctypeIcE13_M_widen_initEv
movq (%rbx), %rax
movq %rbx, %rdi
movl $10, %esi
callq *48(%rax)
movl %eax, %ecx
movq %r14, %rax
.LBB1_4: # %_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_.exit
movsbl %cl, %esi
movq %rax, %rdi
callq _ZNSo3putEc
movq %rax, %rdi
callq _ZNSo5flushEv
movss .LCPI1_1(%rip), %xmm0 # xmm0 = mem[0],zero,zero,zero
callq _Z4testf
movss .LCPI1_2(%rip), %xmm0 # xmm0 = mem[0],zero,zero,zero
callq _Z4testf
movss .LCPI1_3(%rip), %xmm0 # xmm0 = mem[0],zero,zero,zero
callq _Z4testf
movss .LCPI1_4(%rip), %xmm0 # xmm0 = mem[0],zero,zero,zero
callq _Z4testf
xorps %xmm0, %xmm0
callq _Z4testf
movss .LCPI1_5(%rip), %xmm0 # xmm0 = mem[0],zero,zero,zero
callq _Z4testf
movss .LCPI1_6(%rip), %xmm0 # xmm0 = mem[0],zero,zero,zero
callq _Z4testf
movss .LCPI1_7(%rip), %xmm0 # xmm0 = mem[0],zero,zero,zero
callq _Z4testf
movss .LCPI1_8(%rip), %xmm0 # xmm0 = mem[0],zero,zero,zero
callq _Z4testf
xorl %eax, %eax
addq $8, %rsp
.cfi_def_cfa_offset 24
popq %rbx
.cfi_def_cfa_offset 16
popq %r14
.cfi_def_cfa_offset 8
retq
.LBB1_5:
.cfi_def_cfa_offset 32
callq _ZSt16__throw_bad_castv
.Lfunc_end1:
.size main, .Lfunc_end1-main
.cfi_endproc
# -- End function
.type .L.str,@object # @.str
.section .rodata.str1.1,"aMS",@progbits,1
.L.str:
.asciz " "
.size .L.str, 2
.type .L.str.1,@object # @.str.1
.L.str.1:
.asciz "L:"
.size .L.str.1, 3
.type __hip_cuid_,@object # @__hip_cuid_
.bss
.globl __hip_cuid_
__hip_cuid_:
.byte 0 # 0x0
.size __hip_cuid_, 1
.section ".linker-options","e",@llvm_linker_options
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym _ZSt4cout
.addrsig_sym __hip_cuid_ |
You are a helpful coding assistant specialized in converting from CUDA device assembly to AMD device assembly. | code for sm_80 | .text
.p2alignl 7, 3214868480
.fill 96, 4, 3214868480
.type __hip_cuid_,@object
.section .bss,"aw",@nobits
.globl __hip_cuid_
__hip_cuid_:
.byte 0
.size __hip_cuid_, 1
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym __hip_cuid_
.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
.amdgpu_metadata
---
amdhsa.kernels: []
amdhsa.target: amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
- 1
- 2
...
.end_amdgpu_metadata |
You are a helpful coding assistant specialized in converting from CUDA host assembly to AMD host assembly. | .file "tmpxft_00033500_00000000-6_test_pbc.cudafe1.cpp"
.text
#APP
.globl _ZSt21ios_base_library_initv
#NO_APP
.type _ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3673:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaUnregisterFatBinary@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE3673:
.size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
.section .rodata.str1.1,"aMS",@progbits,1
.LC4:
.string " "
.text
.globl _Z4testf
.type _Z4testf, @function
_Z4testf:
.LFB3669:
.cfi_startproc
endbr64
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
pushq %rbx
.cfi_def_cfa_offset 24
.cfi_offset 3, -24
subq $24, %rsp
.cfi_def_cfa_offset 48
cvtss2sd %xmm0, %xmm0
movapd %xmm0, %xmm3
divsd .LC0(%rip), %xmm3
movapd %xmm3, %xmm1
movsd .LC5(%rip), %xmm4
movapd %xmm3, %xmm2
andpd %xmm4, %xmm2
movsd .LC1(%rip), %xmm5
ucomisd %xmm2, %xmm5
jbe .L4
cvttsd2siq %xmm3, %rax
pxor %xmm2, %xmm2
cvtsi2sdq %rax, %xmm2
movapd %xmm2, %xmm1
cmpnlesd %xmm3, %xmm1
movsd .LC3(%rip), %xmm5
andpd %xmm5, %xmm1
subsd %xmm1, %xmm2
andnpd %xmm3, %xmm4
movapd %xmm2, %xmm1
orpd %xmm4, %xmm1
.L4:
mulsd .LC0(%rip), %xmm1
movapd %xmm0, %xmm2
subsd %xmm1, %xmm2
pxor %xmm6, %xmm6
cvtsd2ss %xmm2, %xmm6
movss %xmm6, 12(%rsp)
leaq _ZSt4cout(%rip), %rdi
call _ZNSo9_M_insertIdEERSoT_@PLT
movq %rax, %rbx
movl $1, %edx
leaq .LC4(%rip), %rsi
movq %rax, %rdi
call _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT
pxor %xmm0, %xmm0
cvtss2sd 12(%rsp), %xmm0
movq %rbx, %rdi
call _ZNSo9_M_insertIdEERSoT_@PLT
movq %rax, %rbx
movq (%rax), %rax
movq -24(%rax), %rax
movq 240(%rbx,%rax), %rbp
testq %rbp, %rbp
je .L9
cmpb $0, 56(%rbp)
je .L6
movzbl 67(%rbp), %esi
.L7:
movsbl %sil, %esi
movq %rbx, %rdi
call _ZNSo3putEc@PLT
movq %rax, %rdi
call _ZNSo5flushEv@PLT
addq $24, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 24
popq %rbx
.cfi_def_cfa_offset 16
popq %rbp
.cfi_def_cfa_offset 8
ret
.L9:
.cfi_restore_state
call _ZSt16__throw_bad_castv@PLT
.L6:
movq %rbp, %rdi
call _ZNKSt5ctypeIcE13_M_widen_initEv@PLT
movq 0(%rbp), %rax
movl $10, %esi
movq %rbp, %rdi
call *48(%rax)
movl %eax, %esi
jmp .L7
.cfi_endproc
.LFE3669:
.size _Z4testf, .-_Z4testf
.section .rodata.str1.1
.LC6:
.string "L:"
.text
.globl main
.type main, @function
main:
.LFB3670:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
leaq .LC6(%rip), %rsi
leaq _ZSt4cout(%rip), %rdi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
movq %rax, %rdi
movsd .LC0(%rip), %xmm0
call _ZNSo9_M_insertIdEERSoT_@PLT
movq %rax, %rdi
call _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
movss .LC7(%rip), %xmm0
call _Z4testf
movss .LC8(%rip), %xmm0
call _Z4testf
movss .LC9(%rip), %xmm0
call _Z4testf
movss .LC10(%rip), %xmm0
call _Z4testf
pxor %xmm0, %xmm0
call _Z4testf
movss .LC12(%rip), %xmm0
call _Z4testf
movss .LC13(%rip), %xmm0
call _Z4testf
movss .LC14(%rip), %xmm0
call _Z4testf
movss .LC15(%rip), %xmm0
call _Z4testf
movl $0, %eax
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE3670:
.size main, .-main
.type _ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3696:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
leaq _ZL15__fatDeviceText(%rip), %rdi
call __cudaRegisterFatBinary@PLT
movq %rax, %rdi
movq %rax, _ZL20__cudaFatCubinHandle(%rip)
call __cudaRegisterFatBinaryEnd@PLT
leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
call atexit@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE3696:
.size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
.section .init_array,"aw"
.align 8
.quad _ZL24__sti____cudaRegisterAllv
.section .nvFatBinSegment,"aw"
.align 8
.type _ZL15__fatDeviceText, @object
.size _ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
.long 1180844977
.long 1
.quad fatbinData
.quad 0
.local _ZL20__cudaFatCubinHandle
.comm _ZL20__cudaFatCubinHandle,8,8
.section .rodata.cst8,"aM",@progbits,8
.align 8
.LC0:
.long -350469331
.long 1058682594
.align 8
.LC1:
.long 0
.long 1127219200
.align 8
.LC3:
.long 0
.long 1072693248
.align 8
.LC5:
.long -1
.long 2147483647
.section .rodata.cst4,"aM",@progbits,4
.align 4
.LC7:
.long -1180874414
.align 4
.LC8:
.long -1185827049
.align 4
.LC9:
.long -1194215657
.align 4
.LC10:
.long -1202604265
.align 4
.LC12:
.long 944879383
.align 4
.LC13:
.long 953267991
.align 4
.LC14:
.long 958220626
.align 4
.LC15:
.long 966609234
.ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
.section .note.GNU-stack,"",@progbits
.section .note.gnu.property,"a"
.align 8
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.string "GNU"
1:
.align 8
.long 0xc0000002
.long 3f - 2f
2:
.long 0x3
3:
.align 8
4: | .text
.file "test_pbc.hip"
# Start of file scope inline assembly
.globl _ZSt21ios_base_library_initv
# End of file scope inline assembly
.section .rodata.cst8,"aM",@progbits,8
.p2align 3, 0x0 # -- Begin function _Z4testf
.LCPI0_0:
.quad 0x3f1a36e2eb1c432d # double 1.0E-4
.text
.globl _Z4testf
.p2align 4, 0x90
.type _Z4testf,@function
_Z4testf: # @_Z4testf
.cfi_startproc
# %bb.0:
pushq %r14
.cfi_def_cfa_offset 16
pushq %rbx
.cfi_def_cfa_offset 24
subq $24, %rsp
.cfi_def_cfa_offset 48
.cfi_offset %rbx, -24
.cfi_offset %r14, -16
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 16(%rsp) # 8-byte Spill
divsd .LCPI0_0(%rip), %xmm0
callq floor@PLT
mulsd .LCPI0_0(%rip), %xmm0
movsd 16(%rsp), %xmm2 # 8-byte Reload
# xmm2 = mem[0],zero
movapd %xmm2, %xmm1
subsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
movss %xmm0, 12(%rsp) # 4-byte Spill
movl $_ZSt4cout, %edi
movapd %xmm2, %xmm0
callq _ZNSo9_M_insertIdEERSoT_
movq %rax, %rbx
movl $.L.str, %esi
movl $1, %edx
movq %rax, %rdi
callq _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
movss 12(%rsp), %xmm0 # 4-byte Reload
# xmm0 = mem[0],zero,zero,zero
cvtss2sd %xmm0, %xmm0
movq %rbx, %rdi
callq _ZNSo9_M_insertIdEERSoT_
movq (%rax), %rcx
movq -24(%rcx), %rcx
movq 240(%rax,%rcx), %rbx
testq %rbx, %rbx
je .LBB0_5
# %bb.1: # %_ZSt13__check_facetISt5ctypeIcEERKT_PS3_.exit.i.i
cmpb $0, 56(%rbx)
je .LBB0_3
# %bb.2:
movzbl 67(%rbx), %ecx
jmp .LBB0_4
.LBB0_3:
movq %rbx, %rdi
movq %rax, %r14
callq _ZNKSt5ctypeIcE13_M_widen_initEv
movq (%rbx), %rax
movq %rbx, %rdi
movl $10, %esi
callq *48(%rax)
movl %eax, %ecx
movq %r14, %rax
.LBB0_4: # %_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_.exit
movsbl %cl, %esi
movq %rax, %rdi
callq _ZNSo3putEc
movq %rax, %rdi
addq $24, %rsp
.cfi_def_cfa_offset 24
popq %rbx
.cfi_def_cfa_offset 16
popq %r14
.cfi_def_cfa_offset 8
jmp _ZNSo5flushEv # TAILCALL
.LBB0_5:
.cfi_def_cfa_offset 48
callq _ZSt16__throw_bad_castv
.Lfunc_end0:
.size _Z4testf, .Lfunc_end0-_Z4testf
.cfi_endproc
# -- End function
.section .rodata.cst8,"aM",@progbits,8
.p2align 3, 0x0 # -- Begin function main
.LCPI1_0:
.quad 0x3f1a36e2eb1c432d # double 1.0E-4
.section .rodata.cst4,"aM",@progbits,4
.p2align 2, 0x0
.LCPI1_1:
.long 0xb99d4952 # float -3.00000014E-4
.LCPI1_2:
.long 0xb951b717 # float -1.99999995E-4
.LCPI1_3:
.long 0xb8d1b717 # float -9.99999974E-5
.LCPI1_4:
.long 0xb851b717 # float -4.99999987E-5
.LCPI1_5:
.long 0x3851b717 # float 4.99999987E-5
.LCPI1_6:
.long 0x38d1b717 # float 9.99999974E-5
.LCPI1_7:
.long 0x391d4952 # float 1.50000007E-4
.LCPI1_8:
.long 0x399d4952 # float 3.00000014E-4
.text
.globl main
.p2align 4, 0x90
.type main,@function
main: # @main
.cfi_startproc
# %bb.0:
pushq %r14
.cfi_def_cfa_offset 16
pushq %rbx
.cfi_def_cfa_offset 24
pushq %rax
.cfi_def_cfa_offset 32
.cfi_offset %rbx, -24
.cfi_offset %r14, -16
movl $_ZSt4cout, %edi
movl $.L.str.1, %esi
movl $2, %edx
callq _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
movsd .LCPI1_0(%rip), %xmm0 # xmm0 = mem[0],zero
movl $_ZSt4cout, %edi
callq _ZNSo9_M_insertIdEERSoT_
movq (%rax), %rcx
movq -24(%rcx), %rcx
movq 240(%rax,%rcx), %rbx
testq %rbx, %rbx
je .LBB1_5
# %bb.1: # %_ZSt13__check_facetISt5ctypeIcEERKT_PS3_.exit.i.i
cmpb $0, 56(%rbx)
je .LBB1_3
# %bb.2:
movzbl 67(%rbx), %ecx
jmp .LBB1_4
.LBB1_3:
movq %rbx, %rdi
movq %rax, %r14
callq _ZNKSt5ctypeIcE13_M_widen_initEv
movq (%rbx), %rax
movq %rbx, %rdi
movl $10, %esi
callq *48(%rax)
movl %eax, %ecx
movq %r14, %rax
.LBB1_4: # %_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_.exit
movsbl %cl, %esi
movq %rax, %rdi
callq _ZNSo3putEc
movq %rax, %rdi
callq _ZNSo5flushEv
movss .LCPI1_1(%rip), %xmm0 # xmm0 = mem[0],zero,zero,zero
callq _Z4testf
movss .LCPI1_2(%rip), %xmm0 # xmm0 = mem[0],zero,zero,zero
callq _Z4testf
movss .LCPI1_3(%rip), %xmm0 # xmm0 = mem[0],zero,zero,zero
callq _Z4testf
movss .LCPI1_4(%rip), %xmm0 # xmm0 = mem[0],zero,zero,zero
callq _Z4testf
xorps %xmm0, %xmm0
callq _Z4testf
movss .LCPI1_5(%rip), %xmm0 # xmm0 = mem[0],zero,zero,zero
callq _Z4testf
movss .LCPI1_6(%rip), %xmm0 # xmm0 = mem[0],zero,zero,zero
callq _Z4testf
movss .LCPI1_7(%rip), %xmm0 # xmm0 = mem[0],zero,zero,zero
callq _Z4testf
movss .LCPI1_8(%rip), %xmm0 # xmm0 = mem[0],zero,zero,zero
callq _Z4testf
xorl %eax, %eax
addq $8, %rsp
.cfi_def_cfa_offset 24
popq %rbx
.cfi_def_cfa_offset 16
popq %r14
.cfi_def_cfa_offset 8
retq
.LBB1_5:
.cfi_def_cfa_offset 32
callq _ZSt16__throw_bad_castv
.Lfunc_end1:
.size main, .Lfunc_end1-main
.cfi_endproc
# -- End function
.type .L.str,@object # @.str
.section .rodata.str1.1,"aMS",@progbits,1
.L.str:
.asciz " "
.size .L.str, 2
.type .L.str.1,@object # @.str.1
.L.str.1:
.asciz "L:"
.size .L.str.1, 3
.type __hip_cuid_,@object # @__hip_cuid_
.bss
.globl __hip_cuid_
__hip_cuid_:
.byte 0 # 0x0
.size __hip_cuid_, 1
.section ".linker-options","e",@llvm_linker_options
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym _ZSt4cout
.addrsig_sym __hip_cuid_ |
You are a helpful coding assistant specialized in converting CUDA source code to CUDA device assembly. | #include<stdio.h>
#include<stdlib.h>
#include<cuda.h>
__global__ void add(int *a, int *b, int *c)
{
int i= blockIdx.x*blockDim.x+threadIdx.x;
c[i]= a[i]+b[i];
}
int main()
{
// host pointers
int *a;
int *b;
int *c;
//device pointers
int *d_a;
int *d_b;
int *d_c;
a=(int *)malloc(10*sizeof(int));
b=(int *)malloc(10* sizeof(int));
c=(int *)malloc(10*sizeof(int));
int i=0;
for(i=0;i<10;i++)
{
a[i]=i;
b[i]=i+1;
}
cudaMalloc(&d_a, 10*sizeof(int));
cudaMalloc(&d_b, 10*sizeof(int));
cudaMalloc(&d_c, 10*sizeof(int));
cudaMemcpy(d_a,a,10*sizeof(int),cudaMemcpyHostToDevice);
cudaMemcpy(d_b,b,10*sizeof(int),cudaMemcpyHostToDevice);
add<<<1,10>>>(d_a,d_b,d_c);
cudaMemcpy(c,d_c,10*sizeof(int),cudaMemcpyDeviceToHost);
int j=0;
for(j=0;j<10;j++)
{
printf("%d\n",c[j] );
}
cudaFree(d_a);
cudaFree(d_b);
cudaFree(d_c);
return 0;
} | code for sm_80
Function : _Z3addPiS_S_
.headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)"
/*0000*/ MOV R1, c[0x0][0x28] ; /* 0x00000a0000017a02 */
/* 0x000fe40000000f00 */
/*0010*/ S2R R6, SR_CTAID.X ; /* 0x0000000000067919 */
/* 0x000e220000002500 */
/*0020*/ HFMA2.MMA R7, -RZ, RZ, 0, 2.384185791015625e-07 ; /* 0x00000004ff077435 */
/* 0x000fe200000001ff */
/*0030*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */
/* 0x000fe40000000a00 */
/*0040*/ S2R R3, SR_TID.X ; /* 0x0000000000037919 */
/* 0x000e240000002100 */
/*0050*/ IMAD R6, R6, c[0x0][0x0], R3 ; /* 0x0000000006067a24 */
/* 0x001fca00078e0203 */
/*0060*/ IMAD.WIDE R2, R6, R7, c[0x0][0x160] ; /* 0x0000580006027625 */
/* 0x000fc800078e0207 */
/*0070*/ IMAD.WIDE R4, R6.reuse, R7.reuse, c[0x0][0x168] ; /* 0x00005a0006047625 */
/* 0x0c0fe400078e0207 */
/*0080*/ LDG.E R2, [R2.64] ; /* 0x0000000402027981 */
/* 0x000ea8000c1e1900 */
/*0090*/ LDG.E R5, [R4.64] ; /* 0x0000000404057981 */
/* 0x000ea2000c1e1900 */
/*00a0*/ IMAD.WIDE R6, R6, R7, c[0x0][0x170] ; /* 0x00005c0006067625 */
/* 0x000fe200078e0207 */
/*00b0*/ IADD3 R9, R2, R5, RZ ; /* 0x0000000502097210 */
/* 0x004fca0007ffe0ff */
/*00c0*/ STG.E [R6.64], R9 ; /* 0x0000000906007986 */
/* 0x000fe2000c101904 */
/*00d0*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*00e0*/ BRA 0xe0; /* 0xfffffff000007947 */
/* 0x000fc0000383ffff */
/*00f0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0100*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0110*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0120*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0130*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0140*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0150*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0160*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0170*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
.......... |
You are a helpful coding assistant specialized in converting CUDA source code to CUDA host assembly. | #include<stdio.h>
#include<stdlib.h>
#include<cuda.h>
__global__ void add(int *a, int *b, int *c)
{
int i= blockIdx.x*blockDim.x+threadIdx.x;
c[i]= a[i]+b[i];
}
int main()
{
// host pointers
int *a;
int *b;
int *c;
//device pointers
int *d_a;
int *d_b;
int *d_c;
a=(int *)malloc(10*sizeof(int));
b=(int *)malloc(10* sizeof(int));
c=(int *)malloc(10*sizeof(int));
int i=0;
for(i=0;i<10;i++)
{
a[i]=i;
b[i]=i+1;
}
cudaMalloc(&d_a, 10*sizeof(int));
cudaMalloc(&d_b, 10*sizeof(int));
cudaMalloc(&d_c, 10*sizeof(int));
cudaMemcpy(d_a,a,10*sizeof(int),cudaMemcpyHostToDevice);
cudaMemcpy(d_b,b,10*sizeof(int),cudaMemcpyHostToDevice);
add<<<1,10>>>(d_a,d_b,d_c);
cudaMemcpy(c,d_c,10*sizeof(int),cudaMemcpyDeviceToHost);
int j=0;
for(j=0;j<10;j++)
{
printf("%d\n",c[j] );
}
cudaFree(d_a);
cudaFree(d_b);
cudaFree(d_c);
return 0;
} | .file "tmpxft_0005ae37_00000000-6_addarr.cudafe1.cpp"
.text
#APP
#NO_APP
.type _ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2060:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaUnregisterFatBinary@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2060:
.size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
.globl _Z26__device_stub__Z3addPiS_S_PiS_S_
.type _Z26__device_stub__Z3addPiS_S_PiS_S_, @function
_Z26__device_stub__Z3addPiS_S_PiS_S_:
.LFB2082:
.cfi_startproc
endbr64
subq $136, %rsp
.cfi_def_cfa_offset 144
movq %rdi, 24(%rsp)
movq %rsi, 16(%rsp)
movq %rdx, 8(%rsp)
movq %fs:40, %rax
movq %rax, 120(%rsp)
xorl %eax, %eax
leaq 24(%rsp), %rax
movq %rax, 96(%rsp)
leaq 16(%rsp), %rax
movq %rax, 104(%rsp)
leaq 8(%rsp), %rax
movq %rax, 112(%rsp)
movl $1, 48(%rsp)
movl $1, 52(%rsp)
movl $1, 56(%rsp)
movl $1, 60(%rsp)
movl $1, 64(%rsp)
movl $1, 68(%rsp)
leaq 40(%rsp), %rcx
leaq 32(%rsp), %rdx
leaq 60(%rsp), %rsi
leaq 48(%rsp), %rdi
call __cudaPopCallConfiguration@PLT
testl %eax, %eax
je .L7
.L3:
movq 120(%rsp), %rax
subq %fs:40, %rax
jne .L8
addq $136, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 8
ret
.L7:
.cfi_restore_state
pushq 40(%rsp)
.cfi_def_cfa_offset 152
pushq 40(%rsp)
.cfi_def_cfa_offset 160
leaq 112(%rsp), %r9
movq 76(%rsp), %rcx
movl 84(%rsp), %r8d
movq 64(%rsp), %rsi
movl 72(%rsp), %edx
leaq _Z3addPiS_S_(%rip), %rdi
call cudaLaunchKernel@PLT
addq $16, %rsp
.cfi_def_cfa_offset 144
jmp .L3
.L8:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE2082:
.size _Z26__device_stub__Z3addPiS_S_PiS_S_, .-_Z26__device_stub__Z3addPiS_S_PiS_S_
.globl _Z3addPiS_S_
.type _Z3addPiS_S_, @function
_Z3addPiS_S_:
.LFB2083:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
call _Z26__device_stub__Z3addPiS_S_PiS_S_
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2083:
.size _Z3addPiS_S_, .-_Z3addPiS_S_
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "%d\n"
.text
.globl main
.type main, @function
main:
.LFB2057:
.cfi_startproc
endbr64
pushq %r12
.cfi_def_cfa_offset 16
.cfi_offset 12, -16
pushq %rbp
.cfi_def_cfa_offset 24
.cfi_offset 6, -24
pushq %rbx
.cfi_def_cfa_offset 32
.cfi_offset 3, -32
subq $64, %rsp
.cfi_def_cfa_offset 96
movq %fs:40, %rax
movq %rax, 56(%rsp)
xorl %eax, %eax
movl $40, %edi
call malloc@PLT
movq %rax, %r12
movl $40, %edi
call malloc@PLT
movq %rax, %rbx
movl $40, %edi
call malloc@PLT
movq %rax, %rbp
movl $0, %eax
.L12:
movl %eax, (%r12,%rax,4)
leal 1(%rax), %edx
movl %edx, (%rbx,%rax,4)
addq $1, %rax
cmpq $10, %rax
jne .L12
leaq 8(%rsp), %rdi
movl $40, %esi
call cudaMalloc@PLT
leaq 16(%rsp), %rdi
movl $40, %esi
call cudaMalloc@PLT
leaq 24(%rsp), %rdi
movl $40, %esi
call cudaMalloc@PLT
movl $1, %ecx
movl $40, %edx
movq %r12, %rsi
movq 8(%rsp), %rdi
call cudaMemcpy@PLT
movl $1, %ecx
movl $40, %edx
movq %rbx, %rsi
movq 16(%rsp), %rdi
call cudaMemcpy@PLT
movl $10, 44(%rsp)
movl $1, 48(%rsp)
movl $1, 32(%rsp)
movl $1, 36(%rsp)
movl $0, %r9d
movl $0, %r8d
movq 44(%rsp), %rdx
movl $1, %ecx
movq 32(%rsp), %rdi
movl $1, %esi
call __cudaPushCallConfiguration@PLT
testl %eax, %eax
je .L19
.L13:
movl $2, %ecx
movl $40, %edx
movq 24(%rsp), %rsi
movq %rbp, %rdi
call cudaMemcpy@PLT
movq %rbp, %rbx
addq $40, %rbp
leaq .LC0(%rip), %r12
.L14:
movl (%rbx), %edx
movq %r12, %rsi
movl $2, %edi
movl $0, %eax
call __printf_chk@PLT
addq $4, %rbx
cmpq %rbp, %rbx
jne .L14
movq 8(%rsp), %rdi
call cudaFree@PLT
movq 16(%rsp), %rdi
call cudaFree@PLT
movq 24(%rsp), %rdi
call cudaFree@PLT
movq 56(%rsp), %rax
subq %fs:40, %rax
jne .L20
movl $0, %eax
addq $64, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 32
popq %rbx
.cfi_def_cfa_offset 24
popq %rbp
.cfi_def_cfa_offset 16
popq %r12
.cfi_def_cfa_offset 8
ret
.L19:
.cfi_restore_state
movq 24(%rsp), %rdx
movq 16(%rsp), %rsi
movq 8(%rsp), %rdi
call _Z26__device_stub__Z3addPiS_S_PiS_S_
jmp .L13
.L20:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE2057:
.size main, .-main
.section .rodata.str1.1
.LC1:
.string "_Z3addPiS_S_"
.text
.type _ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2085:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
leaq _ZL15__fatDeviceText(%rip), %rdi
call __cudaRegisterFatBinary@PLT
movq %rax, %rdi
movq %rax, _ZL20__cudaFatCubinHandle(%rip)
pushq $0
.cfi_def_cfa_offset 24
pushq $0
.cfi_def_cfa_offset 32
pushq $0
.cfi_def_cfa_offset 40
pushq $0
.cfi_def_cfa_offset 48
movl $0, %r9d
movl $-1, %r8d
leaq .LC1(%rip), %rdx
movq %rdx, %rcx
leaq _Z3addPiS_S_(%rip), %rsi
call __cudaRegisterFunction@PLT
addq $32, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaRegisterFatBinaryEnd@PLT
leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
call atexit@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2085:
.size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
.section .init_array,"aw"
.align 8
.quad _ZL24__sti____cudaRegisterAllv
.section .nvFatBinSegment,"aw"
.align 8
.type _ZL15__fatDeviceText, @object
.size _ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
.long 1180844977
.long 1
.quad fatbinData
.quad 0
.local _ZL20__cudaFatCubinHandle
.comm _ZL20__cudaFatCubinHandle,8,8
.ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
.section .note.GNU-stack,"",@progbits
.section .note.gnu.property,"a"
.align 8
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.string "GNU"
1:
.align 8
.long 0xc0000002
.long 3f - 2f
2:
.long 0x3
3:
.align 8
4: |
You are a helpful coding assistant specialized in converting CUDA source code to HIP/AMD source code. | #include<stdio.h>
#include<stdlib.h>
#include<cuda.h>
__global__ void add(int *a, int *b, int *c)
{
int i= blockIdx.x*blockDim.x+threadIdx.x;
c[i]= a[i]+b[i];
}
int main()
{
// host pointers
int *a;
int *b;
int *c;
//device pointers
int *d_a;
int *d_b;
int *d_c;
a=(int *)malloc(10*sizeof(int));
b=(int *)malloc(10* sizeof(int));
c=(int *)malloc(10*sizeof(int));
int i=0;
for(i=0;i<10;i++)
{
a[i]=i;
b[i]=i+1;
}
cudaMalloc(&d_a, 10*sizeof(int));
cudaMalloc(&d_b, 10*sizeof(int));
cudaMalloc(&d_c, 10*sizeof(int));
cudaMemcpy(d_a,a,10*sizeof(int),cudaMemcpyHostToDevice);
cudaMemcpy(d_b,b,10*sizeof(int),cudaMemcpyHostToDevice);
add<<<1,10>>>(d_a,d_b,d_c);
cudaMemcpy(c,d_c,10*sizeof(int),cudaMemcpyDeviceToHost);
int j=0;
for(j=0;j<10;j++)
{
printf("%d\n",c[j] );
}
cudaFree(d_a);
cudaFree(d_b);
cudaFree(d_c);
return 0;
} | #include<stdio.h>
#include<stdlib.h>
#include<hip/hip_runtime.h>
__global__ void add(int *a, int *b, int *c)
{
int i= blockIdx.x*blockDim.x+threadIdx.x;
c[i]= a[i]+b[i];
}
int main()
{
// host pointers
int *a;
int *b;
int *c;
//device pointers
int *d_a;
int *d_b;
int *d_c;
a=(int *)malloc(10*sizeof(int));
b=(int *)malloc(10* sizeof(int));
c=(int *)malloc(10*sizeof(int));
int i=0;
for(i=0;i<10;i++)
{
a[i]=i;
b[i]=i+1;
}
hipMalloc(&d_a, 10*sizeof(int));
hipMalloc(&d_b, 10*sizeof(int));
hipMalloc(&d_c, 10*sizeof(int));
hipMemcpy(d_a,a,10*sizeof(int),hipMemcpyHostToDevice);
hipMemcpy(d_b,b,10*sizeof(int),hipMemcpyHostToDevice);
add<<<1,10>>>(d_a,d_b,d_c);
hipMemcpy(c,d_c,10*sizeof(int),hipMemcpyDeviceToHost);
int j=0;
for(j=0;j<10;j++)
{
printf("%d\n",c[j] );
}
hipFree(d_a);
hipFree(d_b);
hipFree(d_c);
return 0;
} |
You are a helpful coding assistant specialized in converting HIP source code to AMD device assembly. | #include<stdio.h>
#include<stdlib.h>
#include<hip/hip_runtime.h>
__global__ void add(int *a, int *b, int *c)
{
int i= blockIdx.x*blockDim.x+threadIdx.x;
c[i]= a[i]+b[i];
}
int main()
{
// host pointers
int *a;
int *b;
int *c;
//device pointers
int *d_a;
int *d_b;
int *d_c;
a=(int *)malloc(10*sizeof(int));
b=(int *)malloc(10* sizeof(int));
c=(int *)malloc(10*sizeof(int));
int i=0;
for(i=0;i<10;i++)
{
a[i]=i;
b[i]=i+1;
}
hipMalloc(&d_a, 10*sizeof(int));
hipMalloc(&d_b, 10*sizeof(int));
hipMalloc(&d_c, 10*sizeof(int));
hipMemcpy(d_a,a,10*sizeof(int),hipMemcpyHostToDevice);
hipMemcpy(d_b,b,10*sizeof(int),hipMemcpyHostToDevice);
add<<<1,10>>>(d_a,d_b,d_c);
hipMemcpy(c,d_c,10*sizeof(int),hipMemcpyDeviceToHost);
int j=0;
for(j=0;j<10;j++)
{
printf("%d\n",c[j] );
}
hipFree(d_a);
hipFree(d_b);
hipFree(d_c);
return 0;
} | .text
.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
.protected _Z3addPiS_S_
.globl _Z3addPiS_S_
.p2align 8
.type _Z3addPiS_S_,@function
_Z3addPiS_S_:
s_clause 0x2
s_load_b32 s2, s[0:1], 0x24
s_load_b128 s[4:7], s[0:1], 0x0
s_load_b64 s[0:1], s[0:1], 0x10
s_waitcnt lgkmcnt(0)
s_and_b32 s2, s2, 0xffff
s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
v_ashrrev_i32_e32 v2, 31, v1
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_lshlrev_b64 v[0:1], 2, v[1:2]
v_add_co_u32 v2, vcc_lo, s4, v0
s_delay_alu instid0(VALU_DEP_2)
v_add_co_ci_u32_e32 v3, vcc_lo, s5, v1, vcc_lo
v_add_co_u32 v4, vcc_lo, s6, v0
v_add_co_ci_u32_e32 v5, vcc_lo, s7, v1, vcc_lo
v_add_co_u32 v0, vcc_lo, s0, v0
global_load_b32 v2, v[2:3], off
global_load_b32 v3, v[4:5], off
v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
s_waitcnt vmcnt(0)
v_add_nc_u32_e32 v2, v3, v2
global_store_b32 v[0:1], v2, off
s_nop 0
s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
s_endpgm
.section .rodata,"a",@progbits
.p2align 6, 0x0
.amdhsa_kernel _Z3addPiS_S_
.amdhsa_group_segment_fixed_size 0
.amdhsa_private_segment_fixed_size 0
.amdhsa_kernarg_size 280
.amdhsa_user_sgpr_count 15
.amdhsa_user_sgpr_dispatch_ptr 0
.amdhsa_user_sgpr_queue_ptr 0
.amdhsa_user_sgpr_kernarg_segment_ptr 1
.amdhsa_user_sgpr_dispatch_id 0
.amdhsa_user_sgpr_private_segment_size 0
.amdhsa_wavefront_size32 1
.amdhsa_uses_dynamic_stack 0
.amdhsa_enable_private_segment 0
.amdhsa_system_sgpr_workgroup_id_x 1
.amdhsa_system_sgpr_workgroup_id_y 0
.amdhsa_system_sgpr_workgroup_id_z 0
.amdhsa_system_sgpr_workgroup_info 0
.amdhsa_system_vgpr_workitem_id 0
.amdhsa_next_free_vgpr 6
.amdhsa_next_free_sgpr 16
.amdhsa_float_round_mode_32 0
.amdhsa_float_round_mode_16_64 0
.amdhsa_float_denorm_mode_32 3
.amdhsa_float_denorm_mode_16_64 3
.amdhsa_dx10_clamp 1
.amdhsa_ieee_mode 1
.amdhsa_fp16_overflow 0
.amdhsa_workgroup_processor_mode 1
.amdhsa_memory_ordered 1
.amdhsa_forward_progress 0
.amdhsa_shared_vgpr_count 0
.amdhsa_exception_fp_ieee_invalid_op 0
.amdhsa_exception_fp_denorm_src 0
.amdhsa_exception_fp_ieee_div_zero 0
.amdhsa_exception_fp_ieee_overflow 0
.amdhsa_exception_fp_ieee_underflow 0
.amdhsa_exception_fp_ieee_inexact 0
.amdhsa_exception_int_div_zero 0
.end_amdhsa_kernel
.text
.Lfunc_end0:
.size _Z3addPiS_S_, .Lfunc_end0-_Z3addPiS_S_
.section .AMDGPU.csdata,"",@progbits
.text
.p2alignl 7, 3214868480
.fill 96, 4, 3214868480
.type __hip_cuid_,@object
.section .bss,"aw",@nobits
.globl __hip_cuid_
__hip_cuid_:
.byte 0
.size __hip_cuid_, 1
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym __hip_cuid_
.amdgpu_metadata
---
amdhsa.kernels:
- .args:
- .address_space: global
.offset: 0
.size: 8
.value_kind: global_buffer
- .address_space: global
.offset: 8
.size: 8
.value_kind: global_buffer
- .address_space: global
.offset: 16
.size: 8
.value_kind: global_buffer
- .offset: 24
.size: 4
.value_kind: hidden_block_count_x
- .offset: 28
.size: 4
.value_kind: hidden_block_count_y
- .offset: 32
.size: 4
.value_kind: hidden_block_count_z
- .offset: 36
.size: 2
.value_kind: hidden_group_size_x
- .offset: 38
.size: 2
.value_kind: hidden_group_size_y
- .offset: 40
.size: 2
.value_kind: hidden_group_size_z
- .offset: 42
.size: 2
.value_kind: hidden_remainder_x
- .offset: 44
.size: 2
.value_kind: hidden_remainder_y
- .offset: 46
.size: 2
.value_kind: hidden_remainder_z
- .offset: 64
.size: 8
.value_kind: hidden_global_offset_x
- .offset: 72
.size: 8
.value_kind: hidden_global_offset_y
- .offset: 80
.size: 8
.value_kind: hidden_global_offset_z
- .offset: 88
.size: 2
.value_kind: hidden_grid_dims
.group_segment_fixed_size: 0
.kernarg_segment_align: 8
.kernarg_segment_size: 280
.language: OpenCL C
.language_version:
- 2
- 0
.max_flat_workgroup_size: 1024
.name: _Z3addPiS_S_
.private_segment_fixed_size: 0
.sgpr_count: 18
.sgpr_spill_count: 0
.symbol: _Z3addPiS_S_.kd
.uniform_work_group_size: 1
.uses_dynamic_stack: false
.vgpr_count: 6
.vgpr_spill_count: 0
.wavefront_size: 32
.workgroup_processor_mode: 1
amdhsa.target: amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
- 1
- 2
...
.end_amdgpu_metadata |
You are a helpful coding assistant specialized in converting HIP source code to AMD host assembly. | #include<stdio.h>
#include<stdlib.h>
#include<hip/hip_runtime.h>
__global__ void add(int *a, int *b, int *c)
{
int i= blockIdx.x*blockDim.x+threadIdx.x;
c[i]= a[i]+b[i];
}
int main()
{
// host pointers
int *a;
int *b;
int *c;
//device pointers
int *d_a;
int *d_b;
int *d_c;
a=(int *)malloc(10*sizeof(int));
b=(int *)malloc(10* sizeof(int));
c=(int *)malloc(10*sizeof(int));
int i=0;
for(i=0;i<10;i++)
{
a[i]=i;
b[i]=i+1;
}
hipMalloc(&d_a, 10*sizeof(int));
hipMalloc(&d_b, 10*sizeof(int));
hipMalloc(&d_c, 10*sizeof(int));
hipMemcpy(d_a,a,10*sizeof(int),hipMemcpyHostToDevice);
hipMemcpy(d_b,b,10*sizeof(int),hipMemcpyHostToDevice);
add<<<1,10>>>(d_a,d_b,d_c);
hipMemcpy(c,d_c,10*sizeof(int),hipMemcpyDeviceToHost);
int j=0;
for(j=0;j<10;j++)
{
printf("%d\n",c[j] );
}
hipFree(d_a);
hipFree(d_b);
hipFree(d_c);
return 0;
} | .text
.file "addarr.hip"
.globl _Z18__device_stub__addPiS_S_ # -- Begin function _Z18__device_stub__addPiS_S_
.p2align 4, 0x90
.type _Z18__device_stub__addPiS_S_,@function
_Z18__device_stub__addPiS_S_: # @_Z18__device_stub__addPiS_S_
.cfi_startproc
# %bb.0:
subq $104, %rsp
.cfi_def_cfa_offset 112
movq %rdi, 72(%rsp)
movq %rsi, 64(%rsp)
movq %rdx, 56(%rsp)
leaq 72(%rsp), %rax
movq %rax, 80(%rsp)
leaq 64(%rsp), %rax
movq %rax, 88(%rsp)
leaq 56(%rsp), %rax
movq %rax, 96(%rsp)
leaq 40(%rsp), %rdi
leaq 24(%rsp), %rsi
leaq 16(%rsp), %rdx
leaq 8(%rsp), %rcx
callq __hipPopCallConfiguration
movq 40(%rsp), %rsi
movl 48(%rsp), %edx
movq 24(%rsp), %rcx
movl 32(%rsp), %r8d
leaq 80(%rsp), %r9
movl $_Z3addPiS_S_, %edi
pushq 8(%rsp)
.cfi_adjust_cfa_offset 8
pushq 24(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $120, %rsp
.cfi_adjust_cfa_offset -120
retq
.Lfunc_end0:
.size _Z18__device_stub__addPiS_S_, .Lfunc_end0-_Z18__device_stub__addPiS_S_
.cfi_endproc
# -- End function
.globl main # -- Begin function main
.p2align 4, 0x90
.type main,@function
main: # @main
.cfi_startproc
# %bb.0:
pushq %r15
.cfi_def_cfa_offset 16
pushq %r14
.cfi_def_cfa_offset 24
pushq %rbx
.cfi_def_cfa_offset 32
subq $128, %rsp
.cfi_def_cfa_offset 160
.cfi_offset %rbx, -32
.cfi_offset %r14, -24
.cfi_offset %r15, -16
movl $40, %edi
callq malloc
movq %rax, %r15
movl $40, %edi
callq malloc
movq %rax, %r14
movl $40, %edi
callq malloc
movq %rax, %rbx
xorl %eax, %eax
.p2align 4, 0x90
.LBB1_1: # =>This Inner Loop Header: Depth=1
movl %eax, (%r15,%rax,4)
leaq 1(%rax), %rcx
movl %ecx, (%r14,%rax,4)
movq %rcx, %rax
cmpq $10, %rcx
jne .LBB1_1
# %bb.2:
leaq 16(%rsp), %rdi
movl $40, %esi
callq hipMalloc
leaq 8(%rsp), %rdi
movl $40, %esi
callq hipMalloc
movq %rsp, %rdi
movl $40, %esi
callq hipMalloc
movq 16(%rsp), %rdi
movl $40, %edx
movq %r15, %rsi
movl $1, %ecx
callq hipMemcpy
movq 8(%rsp), %rdi
movl $40, %edx
movq %r14, %rsi
movl $1, %ecx
callq hipMemcpy
movabsq $4294967297, %rdi # imm = 0x100000001
leaq 9(%rdi), %rdx
movl $1, %esi
movl $1, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq __hipPushCallConfiguration
testl %eax, %eax
jne .LBB1_4
# %bb.3:
movq 16(%rsp), %rax
movq 8(%rsp), %rcx
movq (%rsp), %rdx
movq %rax, 88(%rsp)
movq %rcx, 80(%rsp)
movq %rdx, 72(%rsp)
leaq 88(%rsp), %rax
movq %rax, 96(%rsp)
leaq 80(%rsp), %rax
movq %rax, 104(%rsp)
leaq 72(%rsp), %rax
movq %rax, 112(%rsp)
leaq 56(%rsp), %rdi
leaq 40(%rsp), %rsi
leaq 32(%rsp), %rdx
leaq 24(%rsp), %rcx
callq __hipPopCallConfiguration
movq 56(%rsp), %rsi
movl 64(%rsp), %edx
movq 40(%rsp), %rcx
movl 48(%rsp), %r8d
leaq 96(%rsp), %r9
movl $_Z3addPiS_S_, %edi
pushq 24(%rsp)
.cfi_adjust_cfa_offset 8
pushq 40(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $16, %rsp
.cfi_adjust_cfa_offset -16
.LBB1_4:
movq (%rsp), %rsi
movl $40, %edx
movq %rbx, %rdi
movl $2, %ecx
callq hipMemcpy
xorl %r14d, %r14d
.p2align 4, 0x90
.LBB1_5: # =>This Inner Loop Header: Depth=1
movl (%rbx,%r14,4), %esi
movl $.L.str, %edi
xorl %eax, %eax
callq printf
incq %r14
cmpq $10, %r14
jne .LBB1_5
# %bb.6:
movq 16(%rsp), %rdi
callq hipFree
movq 8(%rsp), %rdi
callq hipFree
movq (%rsp), %rdi
callq hipFree
xorl %eax, %eax
addq $128, %rsp
.cfi_def_cfa_offset 32
popq %rbx
.cfi_def_cfa_offset 24
popq %r14
.cfi_def_cfa_offset 16
popq %r15
.cfi_def_cfa_offset 8
retq
.Lfunc_end1:
.size main, .Lfunc_end1-main
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_ctor
.type __hip_module_ctor,@function
__hip_module_ctor: # @__hip_module_ctor
.cfi_startproc
# %bb.0:
subq $40, %rsp
.cfi_def_cfa_offset 48
cmpq $0, __hip_gpubin_handle(%rip)
jne .LBB2_2
# %bb.1:
movl $__hip_fatbin_wrapper, %edi
callq __hipRegisterFatBinary
movq %rax, __hip_gpubin_handle(%rip)
.LBB2_2:
movq __hip_gpubin_handle(%rip), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 16(%rsp)
movups %xmm0, (%rsp)
movl $_Z3addPiS_S_, %esi
movl $.L__unnamed_1, %edx
movl $.L__unnamed_1, %ecx
movl $-1, %r8d
xorl %r9d, %r9d
callq __hipRegisterFunction
movl $__hip_module_dtor, %edi
addq $40, %rsp
.cfi_def_cfa_offset 8
jmp atexit # TAILCALL
.Lfunc_end2:
.size __hip_module_ctor, .Lfunc_end2-__hip_module_ctor
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_dtor
.type __hip_module_dtor,@function
__hip_module_dtor: # @__hip_module_dtor
.cfi_startproc
# %bb.0:
movq __hip_gpubin_handle(%rip), %rdi
testq %rdi, %rdi
je .LBB3_2
# %bb.1:
pushq %rax
.cfi_def_cfa_offset 16
callq __hipUnregisterFatBinary
movq $0, __hip_gpubin_handle(%rip)
addq $8, %rsp
.cfi_def_cfa_offset 8
.LBB3_2:
retq
.Lfunc_end3:
.size __hip_module_dtor, .Lfunc_end3-__hip_module_dtor
.cfi_endproc
# -- End function
.type _Z3addPiS_S_,@object # @_Z3addPiS_S_
.section .rodata,"a",@progbits
.globl _Z3addPiS_S_
.p2align 3, 0x0
_Z3addPiS_S_:
.quad _Z18__device_stub__addPiS_S_
.size _Z3addPiS_S_, 8
.type .L.str,@object # @.str
.section .rodata.str1.1,"aMS",@progbits,1
.L.str:
.asciz "%d\n"
.size .L.str, 4
.type .L__unnamed_1,@object # @0
.L__unnamed_1:
.asciz "_Z3addPiS_S_"
.size .L__unnamed_1, 13
.type __hip_fatbin_wrapper,@object # @__hip_fatbin_wrapper
.section .hipFatBinSegment,"a",@progbits
.p2align 3, 0x0
__hip_fatbin_wrapper:
.long 1212764230 # 0x48495046
.long 1 # 0x1
.quad __hip_fatbin
.quad 0
.size __hip_fatbin_wrapper, 24
.type __hip_gpubin_handle,@object # @__hip_gpubin_handle
.local __hip_gpubin_handle
.comm __hip_gpubin_handle,8,8
.section .init_array,"aw",@init_array
.p2align 3, 0x0
.quad __hip_module_ctor
.type __hip_cuid_,@object # @__hip_cuid_
.bss
.globl __hip_cuid_
__hip_cuid_:
.byte 0 # 0x0
.size __hip_cuid_, 1
.section ".linker-options","e",@llvm_linker_options
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym _Z18__device_stub__addPiS_S_
.addrsig_sym __hip_module_ctor
.addrsig_sym __hip_module_dtor
.addrsig_sym _Z3addPiS_S_
.addrsig_sym __hip_fatbin
.addrsig_sym __hip_fatbin_wrapper
.addrsig_sym __hip_cuid_ |
You are a helpful coding assistant specialized in converting from CUDA device assembly to AMD device assembly. | code for sm_80
Function : _Z3addPiS_S_
.headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)"
/*0000*/ MOV R1, c[0x0][0x28] ; /* 0x00000a0000017a02 */
/* 0x000fe40000000f00 */
/*0010*/ S2R R6, SR_CTAID.X ; /* 0x0000000000067919 */
/* 0x000e220000002500 */
/*0020*/ HFMA2.MMA R7, -RZ, RZ, 0, 2.384185791015625e-07 ; /* 0x00000004ff077435 */
/* 0x000fe200000001ff */
/*0030*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */
/* 0x000fe40000000a00 */
/*0040*/ S2R R3, SR_TID.X ; /* 0x0000000000037919 */
/* 0x000e240000002100 */
/*0050*/ IMAD R6, R6, c[0x0][0x0], R3 ; /* 0x0000000006067a24 */
/* 0x001fca00078e0203 */
/*0060*/ IMAD.WIDE R2, R6, R7, c[0x0][0x160] ; /* 0x0000580006027625 */
/* 0x000fc800078e0207 */
/*0070*/ IMAD.WIDE R4, R6.reuse, R7.reuse, c[0x0][0x168] ; /* 0x00005a0006047625 */
/* 0x0c0fe400078e0207 */
/*0080*/ LDG.E R2, [R2.64] ; /* 0x0000000402027981 */
/* 0x000ea8000c1e1900 */
/*0090*/ LDG.E R5, [R4.64] ; /* 0x0000000404057981 */
/* 0x000ea2000c1e1900 */
/*00a0*/ IMAD.WIDE R6, R6, R7, c[0x0][0x170] ; /* 0x00005c0006067625 */
/* 0x000fe200078e0207 */
/*00b0*/ IADD3 R9, R2, R5, RZ ; /* 0x0000000502097210 */
/* 0x004fca0007ffe0ff */
/*00c0*/ STG.E [R6.64], R9 ; /* 0x0000000906007986 */
/* 0x000fe2000c101904 */
/*00d0*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*00e0*/ BRA 0xe0; /* 0xfffffff000007947 */
/* 0x000fc0000383ffff */
/*00f0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0100*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0110*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0120*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0130*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0140*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0150*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0160*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0170*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
.......... | .text
.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
.protected _Z3addPiS_S_
.globl _Z3addPiS_S_
.p2align 8
.type _Z3addPiS_S_,@function
_Z3addPiS_S_:
s_clause 0x2
s_load_b32 s2, s[0:1], 0x24
s_load_b128 s[4:7], s[0:1], 0x0
s_load_b64 s[0:1], s[0:1], 0x10
s_waitcnt lgkmcnt(0)
s_and_b32 s2, s2, 0xffff
s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
v_ashrrev_i32_e32 v2, 31, v1
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_lshlrev_b64 v[0:1], 2, v[1:2]
v_add_co_u32 v2, vcc_lo, s4, v0
s_delay_alu instid0(VALU_DEP_2)
v_add_co_ci_u32_e32 v3, vcc_lo, s5, v1, vcc_lo
v_add_co_u32 v4, vcc_lo, s6, v0
v_add_co_ci_u32_e32 v5, vcc_lo, s7, v1, vcc_lo
v_add_co_u32 v0, vcc_lo, s0, v0
global_load_b32 v2, v[2:3], off
global_load_b32 v3, v[4:5], off
v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
s_waitcnt vmcnt(0)
v_add_nc_u32_e32 v2, v3, v2
global_store_b32 v[0:1], v2, off
s_nop 0
s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
s_endpgm
.section .rodata,"a",@progbits
.p2align 6, 0x0
.amdhsa_kernel _Z3addPiS_S_
.amdhsa_group_segment_fixed_size 0
.amdhsa_private_segment_fixed_size 0
.amdhsa_kernarg_size 280
.amdhsa_user_sgpr_count 15
.amdhsa_user_sgpr_dispatch_ptr 0
.amdhsa_user_sgpr_queue_ptr 0
.amdhsa_user_sgpr_kernarg_segment_ptr 1
.amdhsa_user_sgpr_dispatch_id 0
.amdhsa_user_sgpr_private_segment_size 0
.amdhsa_wavefront_size32 1
.amdhsa_uses_dynamic_stack 0
.amdhsa_enable_private_segment 0
.amdhsa_system_sgpr_workgroup_id_x 1
.amdhsa_system_sgpr_workgroup_id_y 0
.amdhsa_system_sgpr_workgroup_id_z 0
.amdhsa_system_sgpr_workgroup_info 0
.amdhsa_system_vgpr_workitem_id 0
.amdhsa_next_free_vgpr 6
.amdhsa_next_free_sgpr 16
.amdhsa_float_round_mode_32 0
.amdhsa_float_round_mode_16_64 0
.amdhsa_float_denorm_mode_32 3
.amdhsa_float_denorm_mode_16_64 3
.amdhsa_dx10_clamp 1
.amdhsa_ieee_mode 1
.amdhsa_fp16_overflow 0
.amdhsa_workgroup_processor_mode 1
.amdhsa_memory_ordered 1
.amdhsa_forward_progress 0
.amdhsa_shared_vgpr_count 0
.amdhsa_exception_fp_ieee_invalid_op 0
.amdhsa_exception_fp_denorm_src 0
.amdhsa_exception_fp_ieee_div_zero 0
.amdhsa_exception_fp_ieee_overflow 0
.amdhsa_exception_fp_ieee_underflow 0
.amdhsa_exception_fp_ieee_inexact 0
.amdhsa_exception_int_div_zero 0
.end_amdhsa_kernel
.text
.Lfunc_end0:
.size _Z3addPiS_S_, .Lfunc_end0-_Z3addPiS_S_
.section .AMDGPU.csdata,"",@progbits
.text
.p2alignl 7, 3214868480
.fill 96, 4, 3214868480
.type __hip_cuid_,@object
.section .bss,"aw",@nobits
.globl __hip_cuid_
__hip_cuid_:
.byte 0
.size __hip_cuid_, 1
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym __hip_cuid_
.amdgpu_metadata
---
amdhsa.kernels:
- .args:
- .address_space: global
.offset: 0
.size: 8
.value_kind: global_buffer
- .address_space: global
.offset: 8
.size: 8
.value_kind: global_buffer
- .address_space: global
.offset: 16
.size: 8
.value_kind: global_buffer
- .offset: 24
.size: 4
.value_kind: hidden_block_count_x
- .offset: 28
.size: 4
.value_kind: hidden_block_count_y
- .offset: 32
.size: 4
.value_kind: hidden_block_count_z
- .offset: 36
.size: 2
.value_kind: hidden_group_size_x
- .offset: 38
.size: 2
.value_kind: hidden_group_size_y
- .offset: 40
.size: 2
.value_kind: hidden_group_size_z
- .offset: 42
.size: 2
.value_kind: hidden_remainder_x
- .offset: 44
.size: 2
.value_kind: hidden_remainder_y
- .offset: 46
.size: 2
.value_kind: hidden_remainder_z
- .offset: 64
.size: 8
.value_kind: hidden_global_offset_x
- .offset: 72
.size: 8
.value_kind: hidden_global_offset_y
- .offset: 80
.size: 8
.value_kind: hidden_global_offset_z
- .offset: 88
.size: 2
.value_kind: hidden_grid_dims
.group_segment_fixed_size: 0
.kernarg_segment_align: 8
.kernarg_segment_size: 280
.language: OpenCL C
.language_version:
- 2
- 0
.max_flat_workgroup_size: 1024
.name: _Z3addPiS_S_
.private_segment_fixed_size: 0
.sgpr_count: 18
.sgpr_spill_count: 0
.symbol: _Z3addPiS_S_.kd
.uniform_work_group_size: 1
.uses_dynamic_stack: false
.vgpr_count: 6
.vgpr_spill_count: 0
.wavefront_size: 32
.workgroup_processor_mode: 1
amdhsa.target: amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
- 1
- 2
...
.end_amdgpu_metadata |
You are a helpful coding assistant specialized in converting from CUDA host assembly to AMD host assembly. | .file "tmpxft_0005ae37_00000000-6_addarr.cudafe1.cpp"
.text
#APP
#NO_APP
.type _ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2060:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaUnregisterFatBinary@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2060:
.size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
.globl _Z26__device_stub__Z3addPiS_S_PiS_S_
.type _Z26__device_stub__Z3addPiS_S_PiS_S_, @function
_Z26__device_stub__Z3addPiS_S_PiS_S_:
.LFB2082:
.cfi_startproc
endbr64
subq $136, %rsp
.cfi_def_cfa_offset 144
movq %rdi, 24(%rsp)
movq %rsi, 16(%rsp)
movq %rdx, 8(%rsp)
movq %fs:40, %rax
movq %rax, 120(%rsp)
xorl %eax, %eax
leaq 24(%rsp), %rax
movq %rax, 96(%rsp)
leaq 16(%rsp), %rax
movq %rax, 104(%rsp)
leaq 8(%rsp), %rax
movq %rax, 112(%rsp)
movl $1, 48(%rsp)
movl $1, 52(%rsp)
movl $1, 56(%rsp)
movl $1, 60(%rsp)
movl $1, 64(%rsp)
movl $1, 68(%rsp)
leaq 40(%rsp), %rcx
leaq 32(%rsp), %rdx
leaq 60(%rsp), %rsi
leaq 48(%rsp), %rdi
call __cudaPopCallConfiguration@PLT
testl %eax, %eax
je .L7
.L3:
movq 120(%rsp), %rax
subq %fs:40, %rax
jne .L8
addq $136, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 8
ret
.L7:
.cfi_restore_state
pushq 40(%rsp)
.cfi_def_cfa_offset 152
pushq 40(%rsp)
.cfi_def_cfa_offset 160
leaq 112(%rsp), %r9
movq 76(%rsp), %rcx
movl 84(%rsp), %r8d
movq 64(%rsp), %rsi
movl 72(%rsp), %edx
leaq _Z3addPiS_S_(%rip), %rdi
call cudaLaunchKernel@PLT
addq $16, %rsp
.cfi_def_cfa_offset 144
jmp .L3
.L8:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE2082:
.size _Z26__device_stub__Z3addPiS_S_PiS_S_, .-_Z26__device_stub__Z3addPiS_S_PiS_S_
.globl _Z3addPiS_S_
.type _Z3addPiS_S_, @function
_Z3addPiS_S_:
.LFB2083:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
call _Z26__device_stub__Z3addPiS_S_PiS_S_
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2083:
.size _Z3addPiS_S_, .-_Z3addPiS_S_
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "%d\n"
.text
.globl main
.type main, @function
main:
.LFB2057:
.cfi_startproc
endbr64
pushq %r12
.cfi_def_cfa_offset 16
.cfi_offset 12, -16
pushq %rbp
.cfi_def_cfa_offset 24
.cfi_offset 6, -24
pushq %rbx
.cfi_def_cfa_offset 32
.cfi_offset 3, -32
subq $64, %rsp
.cfi_def_cfa_offset 96
movq %fs:40, %rax
movq %rax, 56(%rsp)
xorl %eax, %eax
movl $40, %edi
call malloc@PLT
movq %rax, %r12
movl $40, %edi
call malloc@PLT
movq %rax, %rbx
movl $40, %edi
call malloc@PLT
movq %rax, %rbp
movl $0, %eax
.L12:
movl %eax, (%r12,%rax,4)
leal 1(%rax), %edx
movl %edx, (%rbx,%rax,4)
addq $1, %rax
cmpq $10, %rax
jne .L12
leaq 8(%rsp), %rdi
movl $40, %esi
call cudaMalloc@PLT
leaq 16(%rsp), %rdi
movl $40, %esi
call cudaMalloc@PLT
leaq 24(%rsp), %rdi
movl $40, %esi
call cudaMalloc@PLT
movl $1, %ecx
movl $40, %edx
movq %r12, %rsi
movq 8(%rsp), %rdi
call cudaMemcpy@PLT
movl $1, %ecx
movl $40, %edx
movq %rbx, %rsi
movq 16(%rsp), %rdi
call cudaMemcpy@PLT
movl $10, 44(%rsp)
movl $1, 48(%rsp)
movl $1, 32(%rsp)
movl $1, 36(%rsp)
movl $0, %r9d
movl $0, %r8d
movq 44(%rsp), %rdx
movl $1, %ecx
movq 32(%rsp), %rdi
movl $1, %esi
call __cudaPushCallConfiguration@PLT
testl %eax, %eax
je .L19
.L13:
movl $2, %ecx
movl $40, %edx
movq 24(%rsp), %rsi
movq %rbp, %rdi
call cudaMemcpy@PLT
movq %rbp, %rbx
addq $40, %rbp
leaq .LC0(%rip), %r12
.L14:
movl (%rbx), %edx
movq %r12, %rsi
movl $2, %edi
movl $0, %eax
call __printf_chk@PLT
addq $4, %rbx
cmpq %rbp, %rbx
jne .L14
movq 8(%rsp), %rdi
call cudaFree@PLT
movq 16(%rsp), %rdi
call cudaFree@PLT
movq 24(%rsp), %rdi
call cudaFree@PLT
movq 56(%rsp), %rax
subq %fs:40, %rax
jne .L20
movl $0, %eax
addq $64, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 32
popq %rbx
.cfi_def_cfa_offset 24
popq %rbp
.cfi_def_cfa_offset 16
popq %r12
.cfi_def_cfa_offset 8
ret
.L19:
.cfi_restore_state
movq 24(%rsp), %rdx
movq 16(%rsp), %rsi
movq 8(%rsp), %rdi
call _Z26__device_stub__Z3addPiS_S_PiS_S_
jmp .L13
.L20:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE2057:
.size main, .-main
.section .rodata.str1.1
.LC1:
.string "_Z3addPiS_S_"
.text
.type _ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2085:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
leaq _ZL15__fatDeviceText(%rip), %rdi
call __cudaRegisterFatBinary@PLT
movq %rax, %rdi
movq %rax, _ZL20__cudaFatCubinHandle(%rip)
pushq $0
.cfi_def_cfa_offset 24
pushq $0
.cfi_def_cfa_offset 32
pushq $0
.cfi_def_cfa_offset 40
pushq $0
.cfi_def_cfa_offset 48
movl $0, %r9d
movl $-1, %r8d
leaq .LC1(%rip), %rdx
movq %rdx, %rcx
leaq _Z3addPiS_S_(%rip), %rsi
call __cudaRegisterFunction@PLT
addq $32, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaRegisterFatBinaryEnd@PLT
leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
call atexit@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2085:
.size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
.section .init_array,"aw"
.align 8
.quad _ZL24__sti____cudaRegisterAllv
.section .nvFatBinSegment,"aw"
.align 8
.type _ZL15__fatDeviceText, @object
.size _ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
.long 1180844977
.long 1
.quad fatbinData
.quad 0
.local _ZL20__cudaFatCubinHandle
.comm _ZL20__cudaFatCubinHandle,8,8
.ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
.section .note.GNU-stack,"",@progbits
.section .note.gnu.property,"a"
.align 8
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.string "GNU"
1:
.align 8
.long 0xc0000002
.long 3f - 2f
2:
.long 0x3
3:
.align 8
4: | .text
.file "addarr.hip"
.globl _Z18__device_stub__addPiS_S_ # -- Begin function _Z18__device_stub__addPiS_S_
.p2align 4, 0x90
.type _Z18__device_stub__addPiS_S_,@function
_Z18__device_stub__addPiS_S_: # @_Z18__device_stub__addPiS_S_
.cfi_startproc
# %bb.0:
subq $104, %rsp
.cfi_def_cfa_offset 112
movq %rdi, 72(%rsp)
movq %rsi, 64(%rsp)
movq %rdx, 56(%rsp)
leaq 72(%rsp), %rax
movq %rax, 80(%rsp)
leaq 64(%rsp), %rax
movq %rax, 88(%rsp)
leaq 56(%rsp), %rax
movq %rax, 96(%rsp)
leaq 40(%rsp), %rdi
leaq 24(%rsp), %rsi
leaq 16(%rsp), %rdx
leaq 8(%rsp), %rcx
callq __hipPopCallConfiguration
movq 40(%rsp), %rsi
movl 48(%rsp), %edx
movq 24(%rsp), %rcx
movl 32(%rsp), %r8d
leaq 80(%rsp), %r9
movl $_Z3addPiS_S_, %edi
pushq 8(%rsp)
.cfi_adjust_cfa_offset 8
pushq 24(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $120, %rsp
.cfi_adjust_cfa_offset -120
retq
.Lfunc_end0:
.size _Z18__device_stub__addPiS_S_, .Lfunc_end0-_Z18__device_stub__addPiS_S_
.cfi_endproc
# -- End function
.globl main # -- Begin function main
.p2align 4, 0x90
.type main,@function
main: # @main
.cfi_startproc
# %bb.0:
pushq %r15
.cfi_def_cfa_offset 16
pushq %r14
.cfi_def_cfa_offset 24
pushq %rbx
.cfi_def_cfa_offset 32
subq $128, %rsp
.cfi_def_cfa_offset 160
.cfi_offset %rbx, -32
.cfi_offset %r14, -24
.cfi_offset %r15, -16
movl $40, %edi
callq malloc
movq %rax, %r15
movl $40, %edi
callq malloc
movq %rax, %r14
movl $40, %edi
callq malloc
movq %rax, %rbx
xorl %eax, %eax
.p2align 4, 0x90
.LBB1_1: # =>This Inner Loop Header: Depth=1
movl %eax, (%r15,%rax,4)
leaq 1(%rax), %rcx
movl %ecx, (%r14,%rax,4)
movq %rcx, %rax
cmpq $10, %rcx
jne .LBB1_1
# %bb.2:
leaq 16(%rsp), %rdi
movl $40, %esi
callq hipMalloc
leaq 8(%rsp), %rdi
movl $40, %esi
callq hipMalloc
movq %rsp, %rdi
movl $40, %esi
callq hipMalloc
movq 16(%rsp), %rdi
movl $40, %edx
movq %r15, %rsi
movl $1, %ecx
callq hipMemcpy
movq 8(%rsp), %rdi
movl $40, %edx
movq %r14, %rsi
movl $1, %ecx
callq hipMemcpy
movabsq $4294967297, %rdi # imm = 0x100000001
leaq 9(%rdi), %rdx
movl $1, %esi
movl $1, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq __hipPushCallConfiguration
testl %eax, %eax
jne .LBB1_4
# %bb.3:
movq 16(%rsp), %rax
movq 8(%rsp), %rcx
movq (%rsp), %rdx
movq %rax, 88(%rsp)
movq %rcx, 80(%rsp)
movq %rdx, 72(%rsp)
leaq 88(%rsp), %rax
movq %rax, 96(%rsp)
leaq 80(%rsp), %rax
movq %rax, 104(%rsp)
leaq 72(%rsp), %rax
movq %rax, 112(%rsp)
leaq 56(%rsp), %rdi
leaq 40(%rsp), %rsi
leaq 32(%rsp), %rdx
leaq 24(%rsp), %rcx
callq __hipPopCallConfiguration
movq 56(%rsp), %rsi
movl 64(%rsp), %edx
movq 40(%rsp), %rcx
movl 48(%rsp), %r8d
leaq 96(%rsp), %r9
movl $_Z3addPiS_S_, %edi
pushq 24(%rsp)
.cfi_adjust_cfa_offset 8
pushq 40(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $16, %rsp
.cfi_adjust_cfa_offset -16
.LBB1_4:
movq (%rsp), %rsi
movl $40, %edx
movq %rbx, %rdi
movl $2, %ecx
callq hipMemcpy
xorl %r14d, %r14d
.p2align 4, 0x90
.LBB1_5: # =>This Inner Loop Header: Depth=1
movl (%rbx,%r14,4), %esi
movl $.L.str, %edi
xorl %eax, %eax
callq printf
incq %r14
cmpq $10, %r14
jne .LBB1_5
# %bb.6:
movq 16(%rsp), %rdi
callq hipFree
movq 8(%rsp), %rdi
callq hipFree
movq (%rsp), %rdi
callq hipFree
xorl %eax, %eax
addq $128, %rsp
.cfi_def_cfa_offset 32
popq %rbx
.cfi_def_cfa_offset 24
popq %r14
.cfi_def_cfa_offset 16
popq %r15
.cfi_def_cfa_offset 8
retq
.Lfunc_end1:
.size main, .Lfunc_end1-main
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_ctor
.type __hip_module_ctor,@function
__hip_module_ctor: # @__hip_module_ctor
.cfi_startproc
# %bb.0:
subq $40, %rsp
.cfi_def_cfa_offset 48
cmpq $0, __hip_gpubin_handle(%rip)
jne .LBB2_2
# %bb.1:
movl $__hip_fatbin_wrapper, %edi
callq __hipRegisterFatBinary
movq %rax, __hip_gpubin_handle(%rip)
.LBB2_2:
movq __hip_gpubin_handle(%rip), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 16(%rsp)
movups %xmm0, (%rsp)
movl $_Z3addPiS_S_, %esi
movl $.L__unnamed_1, %edx
movl $.L__unnamed_1, %ecx
movl $-1, %r8d
xorl %r9d, %r9d
callq __hipRegisterFunction
movl $__hip_module_dtor, %edi
addq $40, %rsp
.cfi_def_cfa_offset 8
jmp atexit # TAILCALL
.Lfunc_end2:
.size __hip_module_ctor, .Lfunc_end2-__hip_module_ctor
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_dtor
.type __hip_module_dtor,@function
__hip_module_dtor: # @__hip_module_dtor
.cfi_startproc
# %bb.0:
movq __hip_gpubin_handle(%rip), %rdi
testq %rdi, %rdi
je .LBB3_2
# %bb.1:
pushq %rax
.cfi_def_cfa_offset 16
callq __hipUnregisterFatBinary
movq $0, __hip_gpubin_handle(%rip)
addq $8, %rsp
.cfi_def_cfa_offset 8
.LBB3_2:
retq
.Lfunc_end3:
.size __hip_module_dtor, .Lfunc_end3-__hip_module_dtor
.cfi_endproc
# -- End function
.type _Z3addPiS_S_,@object # @_Z3addPiS_S_
.section .rodata,"a",@progbits
.globl _Z3addPiS_S_
.p2align 3, 0x0
_Z3addPiS_S_:
.quad _Z18__device_stub__addPiS_S_
.size _Z3addPiS_S_, 8
.type .L.str,@object # @.str
.section .rodata.str1.1,"aMS",@progbits,1
.L.str:
.asciz "%d\n"
.size .L.str, 4
.type .L__unnamed_1,@object # @0
.L__unnamed_1:
.asciz "_Z3addPiS_S_"
.size .L__unnamed_1, 13
.type __hip_fatbin_wrapper,@object # @__hip_fatbin_wrapper
.section .hipFatBinSegment,"a",@progbits
.p2align 3, 0x0
__hip_fatbin_wrapper:
.long 1212764230 # 0x48495046
.long 1 # 0x1
.quad __hip_fatbin
.quad 0
.size __hip_fatbin_wrapper, 24
.type __hip_gpubin_handle,@object # @__hip_gpubin_handle
.local __hip_gpubin_handle
.comm __hip_gpubin_handle,8,8
.section .init_array,"aw",@init_array
.p2align 3, 0x0
.quad __hip_module_ctor
.type __hip_cuid_,@object # @__hip_cuid_
.bss
.globl __hip_cuid_
__hip_cuid_:
.byte 0 # 0x0
.size __hip_cuid_, 1
.section ".linker-options","e",@llvm_linker_options
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym _Z18__device_stub__addPiS_S_
.addrsig_sym __hip_module_ctor
.addrsig_sym __hip_module_dtor
.addrsig_sym _Z3addPiS_S_
.addrsig_sym __hip_fatbin
.addrsig_sym __hip_fatbin_wrapper
.addrsig_sym __hip_cuid_ |
You are a helpful coding assistant specialized in converting CUDA source code to CUDA device assembly. | /**
* Copyright 1993-2012 NVIDIA Corporation. All rights reserved.
*
* Please refer to the NVIDIA end user license agreement (EULA) associated
* with this source code for terms and conditions that govern your use of
* this software. Any use, reproduction, disclosure, or distribution of
* this software and related documentation outside the terms of the EULA
* is strictly prohibited.
*/
#include <stdio.h>
const int N = 16;
// name executed by invoked by
// __device__ device device
// __global__ device host
// __host__ host host
// Every thread executes this kernel function simultaneously
// so called SIMT
__global__
void vector_add(int *a, int *b, int *res)
{
// blockIdx: block id
// blockDim: threads per block
// threadIdx: thread id
int i = blockIdx.x *blockDim.x + threadIdx.x;
res[i] = a[i] + b[i];
}
void init(int x[])
{
for(int i=0;i<N;i++){
x[i] = i;
}
}
int main()
{
int a[N];
int b[N];
int res[N];
init(a);
init(b);
int *ad, *bd, *resd;
int copy_size = N*sizeof(int);
cudaMalloc(&ad, copy_size);
cudaMalloc(&bd, copy_size);
cudaMalloc(&resd, copy_size);
cudaMemcpy(ad, a, copy_size, cudaMemcpyHostToDevice);
cudaMemcpy(bd, b, copy_size, cudaMemcpyHostToDevice);
// kernel_func<<<numBlock, numThread, Ns, S>>>()
// <<<numBlock, numThread, Ns, S>>>
// Ns, S optional
// Ns: the maximum dynamic memory size
// the kernel function is in the stream S
//vector_add<<<N, 1>>>(ad, bd, resd); // Totally 1xN=N threads, it works!
//vector_add<<<1, N>>>(ad, bd, resd); // Totally 1xN=N threads, it works!
//vector_add<<<1, (N-1)>>>(ad, bd, resd); // Totally (N-1) threads, so omits the last element...
vector_add<<<4, 4>>>(ad, bd, resd); // Totally 4x4=N(16) threads, it works!
cudaMemcpy(res, resd, copy_size, cudaMemcpyDeviceToHost);
cudaFree(ad);
cudaFree(bd);
cudaFree(resd);
for(int i=0;i<N;i++){
printf("%d ", res[i]);
}
return EXIT_SUCCESS;
} | code for sm_80
Function : _Z10vector_addPiS_S_
.headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)"
/*0000*/ MOV R1, c[0x0][0x28] ; /* 0x00000a0000017a02 */
/* 0x000fe40000000f00 */
/*0010*/ S2R R6, SR_CTAID.X ; /* 0x0000000000067919 */
/* 0x000e220000002500 */
/*0020*/ HFMA2.MMA R7, -RZ, RZ, 0, 2.384185791015625e-07 ; /* 0x00000004ff077435 */
/* 0x000fe200000001ff */
/*0030*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */
/* 0x000fe40000000a00 */
/*0040*/ S2R R3, SR_TID.X ; /* 0x0000000000037919 */
/* 0x000e240000002100 */
/*0050*/ IMAD R6, R6, c[0x0][0x0], R3 ; /* 0x0000000006067a24 */
/* 0x001fca00078e0203 */
/*0060*/ IMAD.WIDE R2, R6, R7, c[0x0][0x160] ; /* 0x0000580006027625 */
/* 0x000fc800078e0207 */
/*0070*/ IMAD.WIDE R4, R6.reuse, R7.reuse, c[0x0][0x168] ; /* 0x00005a0006047625 */
/* 0x0c0fe400078e0207 */
/*0080*/ LDG.E R2, [R2.64] ; /* 0x0000000402027981 */
/* 0x000ea8000c1e1900 */
/*0090*/ LDG.E R5, [R4.64] ; /* 0x0000000404057981 */
/* 0x000ea2000c1e1900 */
/*00a0*/ IMAD.WIDE R6, R6, R7, c[0x0][0x170] ; /* 0x00005c0006067625 */
/* 0x000fe200078e0207 */
/*00b0*/ IADD3 R9, R2, R5, RZ ; /* 0x0000000502097210 */
/* 0x004fca0007ffe0ff */
/*00c0*/ STG.E [R6.64], R9 ; /* 0x0000000906007986 */
/* 0x000fe2000c101904 */
/*00d0*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*00e0*/ BRA 0xe0; /* 0xfffffff000007947 */
/* 0x000fc0000383ffff */
/*00f0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0100*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0110*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0120*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0130*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0140*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0150*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0160*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0170*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
.......... |
You are a helpful coding assistant specialized in converting CUDA source code to CUDA host assembly. | /**
* Copyright 1993-2012 NVIDIA Corporation. All rights reserved.
*
* Please refer to the NVIDIA end user license agreement (EULA) associated
* with this source code for terms and conditions that govern your use of
* this software. Any use, reproduction, disclosure, or distribution of
* this software and related documentation outside the terms of the EULA
* is strictly prohibited.
*/
#include <stdio.h>
const int N = 16;
// name executed by invoked by
// __device__ device device
// __global__ device host
// __host__ host host
// Every thread executes this kernel function simultaneously
// so called SIMT
__global__
void vector_add(int *a, int *b, int *res)
{
// blockIdx: block id
// blockDim: threads per block
// threadIdx: thread id
int i = blockIdx.x *blockDim.x + threadIdx.x;
res[i] = a[i] + b[i];
}
void init(int x[])
{
for(int i=0;i<N;i++){
x[i] = i;
}
}
int main()
{
int a[N];
int b[N];
int res[N];
init(a);
init(b);
int *ad, *bd, *resd;
int copy_size = N*sizeof(int);
cudaMalloc(&ad, copy_size);
cudaMalloc(&bd, copy_size);
cudaMalloc(&resd, copy_size);
cudaMemcpy(ad, a, copy_size, cudaMemcpyHostToDevice);
cudaMemcpy(bd, b, copy_size, cudaMemcpyHostToDevice);
// kernel_func<<<numBlock, numThread, Ns, S>>>()
// <<<numBlock, numThread, Ns, S>>>
// Ns, S optional
// Ns: the maximum dynamic memory size
// the kernel function is in the stream S
//vector_add<<<N, 1>>>(ad, bd, resd); // Totally 1xN=N threads, it works!
//vector_add<<<1, N>>>(ad, bd, resd); // Totally 1xN=N threads, it works!
//vector_add<<<1, (N-1)>>>(ad, bd, resd); // Totally (N-1) threads, so omits the last element...
vector_add<<<4, 4>>>(ad, bd, resd); // Totally 4x4=N(16) threads, it works!
cudaMemcpy(res, resd, copy_size, cudaMemcpyDeviceToHost);
cudaFree(ad);
cudaFree(bd);
cudaFree(resd);
for(int i=0;i<N;i++){
printf("%d ", res[i]);
}
return EXIT_SUCCESS;
} | .file "tmpxft_000858f7_00000000-6_vec_add.cudafe1.cpp"
.text
#APP
#NO_APP
.type _ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2061:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaUnregisterFatBinary@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2061:
.size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
.globl _Z4initPi
.type _Z4initPi, @function
_Z4initPi:
.LFB2057:
.cfi_startproc
endbr64
movl $0, %eax
.L4:
movl %eax, (%rdi,%rax,4)
addq $1, %rax
cmpq $16, %rax
jne .L4
ret
.cfi_endproc
.LFE2057:
.size _Z4initPi, .-_Z4initPi
.globl _Z34__device_stub__Z10vector_addPiS_S_PiS_S_
.type _Z34__device_stub__Z10vector_addPiS_S_PiS_S_, @function
_Z34__device_stub__Z10vector_addPiS_S_PiS_S_:
.LFB2083:
.cfi_startproc
endbr64
subq $136, %rsp
.cfi_def_cfa_offset 144
movq %rdi, 24(%rsp)
movq %rsi, 16(%rsp)
movq %rdx, 8(%rsp)
movq %fs:40, %rax
movq %rax, 120(%rsp)
xorl %eax, %eax
leaq 24(%rsp), %rax
movq %rax, 96(%rsp)
leaq 16(%rsp), %rax
movq %rax, 104(%rsp)
leaq 8(%rsp), %rax
movq %rax, 112(%rsp)
movl $1, 48(%rsp)
movl $1, 52(%rsp)
movl $1, 56(%rsp)
movl $1, 60(%rsp)
movl $1, 64(%rsp)
movl $1, 68(%rsp)
leaq 40(%rsp), %rcx
leaq 32(%rsp), %rdx
leaq 60(%rsp), %rsi
leaq 48(%rsp), %rdi
call __cudaPopCallConfiguration@PLT
testl %eax, %eax
je .L10
.L6:
movq 120(%rsp), %rax
subq %fs:40, %rax
jne .L11
addq $136, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 8
ret
.L10:
.cfi_restore_state
pushq 40(%rsp)
.cfi_def_cfa_offset 152
pushq 40(%rsp)
.cfi_def_cfa_offset 160
leaq 112(%rsp), %r9
movq 76(%rsp), %rcx
movl 84(%rsp), %r8d
movq 64(%rsp), %rsi
movl 72(%rsp), %edx
leaq _Z10vector_addPiS_S_(%rip), %rdi
call cudaLaunchKernel@PLT
addq $16, %rsp
.cfi_def_cfa_offset 144
jmp .L6
.L11:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE2083:
.size _Z34__device_stub__Z10vector_addPiS_S_PiS_S_, .-_Z34__device_stub__Z10vector_addPiS_S_PiS_S_
.globl _Z10vector_addPiS_S_
.type _Z10vector_addPiS_S_, @function
_Z10vector_addPiS_S_:
.LFB2084:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
call _Z34__device_stub__Z10vector_addPiS_S_PiS_S_
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2084:
.size _Z10vector_addPiS_S_, .-_Z10vector_addPiS_S_
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "%d "
.text
.globl main
.type main, @function
main:
.LFB2058:
.cfi_startproc
endbr64
pushq %r12
.cfi_def_cfa_offset 16
.cfi_offset 12, -16
pushq %rbp
.cfi_def_cfa_offset 24
.cfi_offset 6, -24
pushq %rbx
.cfi_def_cfa_offset 32
.cfi_offset 3, -32
subq $256, %rsp
.cfi_def_cfa_offset 288
movq %fs:40, %rax
movq %rax, 248(%rsp)
xorl %eax, %eax
leaq 48(%rsp), %rbp
movq %rbp, %rdi
call _Z4initPi
leaq 112(%rsp), %rbx
movq %rbx, %rdi
call _Z4initPi
movq %rsp, %rdi
movl $64, %esi
call cudaMalloc@PLT
leaq 8(%rsp), %rdi
movl $64, %esi
call cudaMalloc@PLT
leaq 16(%rsp), %rdi
movl $64, %esi
call cudaMalloc@PLT
movl $1, %ecx
movl $64, %edx
movq %rbp, %rsi
movq (%rsp), %rdi
call cudaMemcpy@PLT
movl $1, %ecx
movl $64, %edx
movq %rbx, %rsi
movq 8(%rsp), %rdi
call cudaMemcpy@PLT
movl $4, 36(%rsp)
movl $1, 40(%rsp)
movl $1, 44(%rsp)
movl $4, 24(%rsp)
movl $1, 28(%rsp)
movl $1, 32(%rsp)
movl $0, %r9d
movl $0, %r8d
movq 36(%rsp), %rdx
movl $1, %ecx
movq 24(%rsp), %rdi
movl $1, %esi
call __cudaPushCallConfiguration@PLT
testl %eax, %eax
je .L20
.L15:
leaq 176(%rsp), %rbx
movl $2, %ecx
movl $64, %edx
movq 16(%rsp), %rsi
movq %rbx, %rdi
call cudaMemcpy@PLT
movq (%rsp), %rdi
call cudaFree@PLT
movq 8(%rsp), %rdi
call cudaFree@PLT
movq 16(%rsp), %rdi
call cudaFree@PLT
leaq 240(%rsp), %r12
leaq .LC0(%rip), %rbp
.L16:
movl (%rbx), %edx
movq %rbp, %rsi
movl $2, %edi
movl $0, %eax
call __printf_chk@PLT
addq $4, %rbx
cmpq %r12, %rbx
jne .L16
movq 248(%rsp), %rax
subq %fs:40, %rax
jne .L21
movl $0, %eax
addq $256, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 32
popq %rbx
.cfi_def_cfa_offset 24
popq %rbp
.cfi_def_cfa_offset 16
popq %r12
.cfi_def_cfa_offset 8
ret
.L20:
.cfi_restore_state
movq 16(%rsp), %rdx
movq 8(%rsp), %rsi
movq (%rsp), %rdi
call _Z34__device_stub__Z10vector_addPiS_S_PiS_S_
jmp .L15
.L21:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE2058:
.size main, .-main
.section .rodata.str1.1
.LC1:
.string "_Z10vector_addPiS_S_"
.text
.type _ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2086:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
leaq _ZL15__fatDeviceText(%rip), %rdi
call __cudaRegisterFatBinary@PLT
movq %rax, %rdi
movq %rax, _ZL20__cudaFatCubinHandle(%rip)
pushq $0
.cfi_def_cfa_offset 24
pushq $0
.cfi_def_cfa_offset 32
pushq $0
.cfi_def_cfa_offset 40
pushq $0
.cfi_def_cfa_offset 48
movl $0, %r9d
movl $-1, %r8d
leaq .LC1(%rip), %rdx
movq %rdx, %rcx
leaq _Z10vector_addPiS_S_(%rip), %rsi
call __cudaRegisterFunction@PLT
addq $32, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaRegisterFatBinaryEnd@PLT
leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
call atexit@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2086:
.size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
.section .init_array,"aw"
.align 8
.quad _ZL24__sti____cudaRegisterAllv
.section .nvFatBinSegment,"aw"
.align 8
.type _ZL15__fatDeviceText, @object
.size _ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
.long 1180844977
.long 1
.quad fatbinData
.quad 0
.local _ZL20__cudaFatCubinHandle
.comm _ZL20__cudaFatCubinHandle,8,8
.ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
.section .note.GNU-stack,"",@progbits
.section .note.gnu.property,"a"
.align 8
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.string "GNU"
1:
.align 8
.long 0xc0000002
.long 3f - 2f
2:
.long 0x3
3:
.align 8
4: |
You are a helpful coding assistant specialized in converting CUDA source code to HIP/AMD source code. | /**
* Copyright 1993-2012 NVIDIA Corporation. All rights reserved.
*
* Please refer to the NVIDIA end user license agreement (EULA) associated
* with this source code for terms and conditions that govern your use of
* this software. Any use, reproduction, disclosure, or distribution of
* this software and related documentation outside the terms of the EULA
* is strictly prohibited.
*/
#include <stdio.h>
const int N = 16;
// name executed by invoked by
// __device__ device device
// __global__ device host
// __host__ host host
// Every thread executes this kernel function simultaneously
// so called SIMT
__global__
void vector_add(int *a, int *b, int *res)
{
// blockIdx: block id
// blockDim: threads per block
// threadIdx: thread id
int i = blockIdx.x *blockDim.x + threadIdx.x;
res[i] = a[i] + b[i];
}
void init(int x[])
{
for(int i=0;i<N;i++){
x[i] = i;
}
}
int main()
{
int a[N];
int b[N];
int res[N];
init(a);
init(b);
int *ad, *bd, *resd;
int copy_size = N*sizeof(int);
cudaMalloc(&ad, copy_size);
cudaMalloc(&bd, copy_size);
cudaMalloc(&resd, copy_size);
cudaMemcpy(ad, a, copy_size, cudaMemcpyHostToDevice);
cudaMemcpy(bd, b, copy_size, cudaMemcpyHostToDevice);
// kernel_func<<<numBlock, numThread, Ns, S>>>()
// <<<numBlock, numThread, Ns, S>>>
// Ns, S optional
// Ns: the maximum dynamic memory size
// the kernel function is in the stream S
//vector_add<<<N, 1>>>(ad, bd, resd); // Totally 1xN=N threads, it works!
//vector_add<<<1, N>>>(ad, bd, resd); // Totally 1xN=N threads, it works!
//vector_add<<<1, (N-1)>>>(ad, bd, resd); // Totally (N-1) threads, so omits the last element...
vector_add<<<4, 4>>>(ad, bd, resd); // Totally 4x4=N(16) threads, it works!
cudaMemcpy(res, resd, copy_size, cudaMemcpyDeviceToHost);
cudaFree(ad);
cudaFree(bd);
cudaFree(resd);
for(int i=0;i<N;i++){
printf("%d ", res[i]);
}
return EXIT_SUCCESS;
} | /**
* Copyright 1993-2012 NVIDIA Corporation. All rights reserved.
*
* Please refer to the NVIDIA end user license agreement (EULA) associated
* with this source code for terms and conditions that govern your use of
* this software. Any use, reproduction, disclosure, or distribution of
* this software and related documentation outside the terms of the EULA
* is strictly prohibited.
*/
#include <hip/hip_runtime.h>
#include <stdio.h>
const int N = 16;
// name executed by invoked by
// __device__ device device
// __global__ device host
// __host__ host host
// Every thread executes this kernel function simultaneously
// so called SIMT
__global__
void vector_add(int *a, int *b, int *res)
{
// blockIdx: block id
// blockDim: threads per block
// threadIdx: thread id
int i = blockIdx.x *blockDim.x + threadIdx.x;
res[i] = a[i] + b[i];
}
void init(int x[])
{
for(int i=0;i<N;i++){
x[i] = i;
}
}
int main()
{
int a[N];
int b[N];
int res[N];
init(a);
init(b);
int *ad, *bd, *resd;
int copy_size = N*sizeof(int);
hipMalloc(&ad, copy_size);
hipMalloc(&bd, copy_size);
hipMalloc(&resd, copy_size);
hipMemcpy(ad, a, copy_size, hipMemcpyHostToDevice);
hipMemcpy(bd, b, copy_size, hipMemcpyHostToDevice);
// kernel_func<<<numBlock, numThread, Ns, S>>>()
// <<<numBlock, numThread, Ns, S>>>
// Ns, S optional
// Ns: the maximum dynamic memory size
// the kernel function is in the stream S
//vector_add<<<N, 1>>>(ad, bd, resd); // Totally 1xN=N threads, it works!
//vector_add<<<1, N>>>(ad, bd, resd); // Totally 1xN=N threads, it works!
//vector_add<<<1, (N-1)>>>(ad, bd, resd); // Totally (N-1) threads, so omits the last element...
vector_add<<<4, 4>>>(ad, bd, resd); // Totally 4x4=N(16) threads, it works!
hipMemcpy(res, resd, copy_size, hipMemcpyDeviceToHost);
hipFree(ad);
hipFree(bd);
hipFree(resd);
for(int i=0;i<N;i++){
printf("%d ", res[i]);
}
return EXIT_SUCCESS;
} |
You are a helpful coding assistant specialized in converting HIP source code to AMD device assembly. | /**
* Copyright 1993-2012 NVIDIA Corporation. All rights reserved.
*
* Please refer to the NVIDIA end user license agreement (EULA) associated
* with this source code for terms and conditions that govern your use of
* this software. Any use, reproduction, disclosure, or distribution of
* this software and related documentation outside the terms of the EULA
* is strictly prohibited.
*/
#include <hip/hip_runtime.h>
#include <stdio.h>
const int N = 16;
// name executed by invoked by
// __device__ device device
// __global__ device host
// __host__ host host
// Every thread executes this kernel function simultaneously
// so called SIMT
__global__
void vector_add(int *a, int *b, int *res)
{
// blockIdx: block id
// blockDim: threads per block
// threadIdx: thread id
int i = blockIdx.x *blockDim.x + threadIdx.x;
res[i] = a[i] + b[i];
}
void init(int x[])
{
for(int i=0;i<N;i++){
x[i] = i;
}
}
int main()
{
int a[N];
int b[N];
int res[N];
init(a);
init(b);
int *ad, *bd, *resd;
int copy_size = N*sizeof(int);
hipMalloc(&ad, copy_size);
hipMalloc(&bd, copy_size);
hipMalloc(&resd, copy_size);
hipMemcpy(ad, a, copy_size, hipMemcpyHostToDevice);
hipMemcpy(bd, b, copy_size, hipMemcpyHostToDevice);
// kernel_func<<<numBlock, numThread, Ns, S>>>()
// <<<numBlock, numThread, Ns, S>>>
// Ns, S optional
// Ns: the maximum dynamic memory size
// the kernel function is in the stream S
//vector_add<<<N, 1>>>(ad, bd, resd); // Totally 1xN=N threads, it works!
//vector_add<<<1, N>>>(ad, bd, resd); // Totally 1xN=N threads, it works!
//vector_add<<<1, (N-1)>>>(ad, bd, resd); // Totally (N-1) threads, so omits the last element...
vector_add<<<4, 4>>>(ad, bd, resd); // Totally 4x4=N(16) threads, it works!
hipMemcpy(res, resd, copy_size, hipMemcpyDeviceToHost);
hipFree(ad);
hipFree(bd);
hipFree(resd);
for(int i=0;i<N;i++){
printf("%d ", res[i]);
}
return EXIT_SUCCESS;
} | .text
.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
.protected _Z10vector_addPiS_S_
.globl _Z10vector_addPiS_S_
.p2align 8
.type _Z10vector_addPiS_S_,@function
_Z10vector_addPiS_S_:
s_clause 0x2
s_load_b32 s2, s[0:1], 0x24
s_load_b128 s[4:7], s[0:1], 0x0
s_load_b64 s[0:1], s[0:1], 0x10
s_waitcnt lgkmcnt(0)
s_and_b32 s2, s2, 0xffff
s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
v_ashrrev_i32_e32 v2, 31, v1
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_lshlrev_b64 v[0:1], 2, v[1:2]
v_add_co_u32 v2, vcc_lo, s4, v0
s_delay_alu instid0(VALU_DEP_2)
v_add_co_ci_u32_e32 v3, vcc_lo, s5, v1, vcc_lo
v_add_co_u32 v4, vcc_lo, s6, v0
v_add_co_ci_u32_e32 v5, vcc_lo, s7, v1, vcc_lo
v_add_co_u32 v0, vcc_lo, s0, v0
global_load_b32 v2, v[2:3], off
global_load_b32 v3, v[4:5], off
v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
s_waitcnt vmcnt(0)
v_add_nc_u32_e32 v2, v3, v2
global_store_b32 v[0:1], v2, off
s_nop 0
s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
s_endpgm
.section .rodata,"a",@progbits
.p2align 6, 0x0
.amdhsa_kernel _Z10vector_addPiS_S_
.amdhsa_group_segment_fixed_size 0
.amdhsa_private_segment_fixed_size 0
.amdhsa_kernarg_size 280
.amdhsa_user_sgpr_count 15
.amdhsa_user_sgpr_dispatch_ptr 0
.amdhsa_user_sgpr_queue_ptr 0
.amdhsa_user_sgpr_kernarg_segment_ptr 1
.amdhsa_user_sgpr_dispatch_id 0
.amdhsa_user_sgpr_private_segment_size 0
.amdhsa_wavefront_size32 1
.amdhsa_uses_dynamic_stack 0
.amdhsa_enable_private_segment 0
.amdhsa_system_sgpr_workgroup_id_x 1
.amdhsa_system_sgpr_workgroup_id_y 0
.amdhsa_system_sgpr_workgroup_id_z 0
.amdhsa_system_sgpr_workgroup_info 0
.amdhsa_system_vgpr_workitem_id 0
.amdhsa_next_free_vgpr 6
.amdhsa_next_free_sgpr 16
.amdhsa_float_round_mode_32 0
.amdhsa_float_round_mode_16_64 0
.amdhsa_float_denorm_mode_32 3
.amdhsa_float_denorm_mode_16_64 3
.amdhsa_dx10_clamp 1
.amdhsa_ieee_mode 1
.amdhsa_fp16_overflow 0
.amdhsa_workgroup_processor_mode 1
.amdhsa_memory_ordered 1
.amdhsa_forward_progress 0
.amdhsa_shared_vgpr_count 0
.amdhsa_exception_fp_ieee_invalid_op 0
.amdhsa_exception_fp_denorm_src 0
.amdhsa_exception_fp_ieee_div_zero 0
.amdhsa_exception_fp_ieee_overflow 0
.amdhsa_exception_fp_ieee_underflow 0
.amdhsa_exception_fp_ieee_inexact 0
.amdhsa_exception_int_div_zero 0
.end_amdhsa_kernel
.text
.Lfunc_end0:
.size _Z10vector_addPiS_S_, .Lfunc_end0-_Z10vector_addPiS_S_
.section .AMDGPU.csdata,"",@progbits
.text
.p2alignl 7, 3214868480
.fill 96, 4, 3214868480
.type __hip_cuid_,@object
.section .bss,"aw",@nobits
.globl __hip_cuid_
__hip_cuid_:
.byte 0
.size __hip_cuid_, 1
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym __hip_cuid_
.amdgpu_metadata
---
amdhsa.kernels:
- .args:
- .address_space: global
.offset: 0
.size: 8
.value_kind: global_buffer
- .address_space: global
.offset: 8
.size: 8
.value_kind: global_buffer
- .address_space: global
.offset: 16
.size: 8
.value_kind: global_buffer
- .offset: 24
.size: 4
.value_kind: hidden_block_count_x
- .offset: 28
.size: 4
.value_kind: hidden_block_count_y
- .offset: 32
.size: 4
.value_kind: hidden_block_count_z
- .offset: 36
.size: 2
.value_kind: hidden_group_size_x
- .offset: 38
.size: 2
.value_kind: hidden_group_size_y
- .offset: 40
.size: 2
.value_kind: hidden_group_size_z
- .offset: 42
.size: 2
.value_kind: hidden_remainder_x
- .offset: 44
.size: 2
.value_kind: hidden_remainder_y
- .offset: 46
.size: 2
.value_kind: hidden_remainder_z
- .offset: 64
.size: 8
.value_kind: hidden_global_offset_x
- .offset: 72
.size: 8
.value_kind: hidden_global_offset_y
- .offset: 80
.size: 8
.value_kind: hidden_global_offset_z
- .offset: 88
.size: 2
.value_kind: hidden_grid_dims
.group_segment_fixed_size: 0
.kernarg_segment_align: 8
.kernarg_segment_size: 280
.language: OpenCL C
.language_version:
- 2
- 0
.max_flat_workgroup_size: 1024
.name: _Z10vector_addPiS_S_
.private_segment_fixed_size: 0
.sgpr_count: 18
.sgpr_spill_count: 0
.symbol: _Z10vector_addPiS_S_.kd
.uniform_work_group_size: 1
.uses_dynamic_stack: false
.vgpr_count: 6
.vgpr_spill_count: 0
.wavefront_size: 32
.workgroup_processor_mode: 1
amdhsa.target: amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
- 1
- 2
...
.end_amdgpu_metadata |
You are a helpful coding assistant specialized in converting HIP source code to AMD host assembly. | /**
* Copyright 1993-2012 NVIDIA Corporation. All rights reserved.
*
* Please refer to the NVIDIA end user license agreement (EULA) associated
* with this source code for terms and conditions that govern your use of
* this software. Any use, reproduction, disclosure, or distribution of
* this software and related documentation outside the terms of the EULA
* is strictly prohibited.
*/
#include <hip/hip_runtime.h>
#include <stdio.h>
const int N = 16;
// name executed by invoked by
// __device__ device device
// __global__ device host
// __host__ host host
// Every thread executes this kernel function simultaneously
// so called SIMT
__global__
void vector_add(int *a, int *b, int *res)
{
// blockIdx: block id
// blockDim: threads per block
// threadIdx: thread id
int i = blockIdx.x *blockDim.x + threadIdx.x;
res[i] = a[i] + b[i];
}
void init(int x[])
{
for(int i=0;i<N;i++){
x[i] = i;
}
}
int main()
{
int a[N];
int b[N];
int res[N];
init(a);
init(b);
int *ad, *bd, *resd;
int copy_size = N*sizeof(int);
hipMalloc(&ad, copy_size);
hipMalloc(&bd, copy_size);
hipMalloc(&resd, copy_size);
hipMemcpy(ad, a, copy_size, hipMemcpyHostToDevice);
hipMemcpy(bd, b, copy_size, hipMemcpyHostToDevice);
// kernel_func<<<numBlock, numThread, Ns, S>>>()
// <<<numBlock, numThread, Ns, S>>>
// Ns, S optional
// Ns: the maximum dynamic memory size
// the kernel function is in the stream S
//vector_add<<<N, 1>>>(ad, bd, resd); // Totally 1xN=N threads, it works!
//vector_add<<<1, N>>>(ad, bd, resd); // Totally 1xN=N threads, it works!
//vector_add<<<1, (N-1)>>>(ad, bd, resd); // Totally (N-1) threads, so omits the last element...
vector_add<<<4, 4>>>(ad, bd, resd); // Totally 4x4=N(16) threads, it works!
hipMemcpy(res, resd, copy_size, hipMemcpyDeviceToHost);
hipFree(ad);
hipFree(bd);
hipFree(resd);
for(int i=0;i<N;i++){
printf("%d ", res[i]);
}
return EXIT_SUCCESS;
} | .text
.file "vec_add.hip"
.globl _Z25__device_stub__vector_addPiS_S_ # -- Begin function _Z25__device_stub__vector_addPiS_S_
.p2align 4, 0x90
.type _Z25__device_stub__vector_addPiS_S_,@function
_Z25__device_stub__vector_addPiS_S_: # @_Z25__device_stub__vector_addPiS_S_
.cfi_startproc
# %bb.0:
subq $104, %rsp
.cfi_def_cfa_offset 112
movq %rdi, 72(%rsp)
movq %rsi, 64(%rsp)
movq %rdx, 56(%rsp)
leaq 72(%rsp), %rax
movq %rax, 80(%rsp)
leaq 64(%rsp), %rax
movq %rax, 88(%rsp)
leaq 56(%rsp), %rax
movq %rax, 96(%rsp)
leaq 40(%rsp), %rdi
leaq 24(%rsp), %rsi
leaq 16(%rsp), %rdx
leaq 8(%rsp), %rcx
callq __hipPopCallConfiguration
movq 40(%rsp), %rsi
movl 48(%rsp), %edx
movq 24(%rsp), %rcx
movl 32(%rsp), %r8d
leaq 80(%rsp), %r9
movl $_Z10vector_addPiS_S_, %edi
pushq 8(%rsp)
.cfi_adjust_cfa_offset 8
pushq 24(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $120, %rsp
.cfi_adjust_cfa_offset -120
retq
.Lfunc_end0:
.size _Z25__device_stub__vector_addPiS_S_, .Lfunc_end0-_Z25__device_stub__vector_addPiS_S_
.cfi_endproc
# -- End function
.globl _Z4initPi # -- Begin function _Z4initPi
.p2align 4, 0x90
.type _Z4initPi,@function
_Z4initPi: # @_Z4initPi
.cfi_startproc
# %bb.0:
xorl %eax, %eax
.p2align 4, 0x90
.LBB1_1: # =>This Inner Loop Header: Depth=1
movl %eax, (%rdi,%rax,4)
incq %rax
cmpq $16, %rax
jne .LBB1_1
# %bb.2:
retq
.Lfunc_end1:
.size _Z4initPi, .Lfunc_end1-_Z4initPi
.cfi_endproc
# -- End function
.globl main # -- Begin function main
.p2align 4, 0x90
.type main,@function
main: # @main
.cfi_startproc
# %bb.0:
pushq %rbx
.cfi_def_cfa_offset 16
subq $288, %rsp # imm = 0x120
.cfi_def_cfa_offset 304
.cfi_offset %rbx, -16
xorl %eax, %eax
.p2align 4, 0x90
.LBB2_1: # =>This Inner Loop Header: Depth=1
movl %eax, 224(%rsp,%rax,4)
incq %rax
cmpq $16, %rax
jne .LBB2_1
# %bb.2: # %_Z4initPi.exit.preheader
xorl %eax, %eax
.p2align 4, 0x90
.LBB2_3: # %_Z4initPi.exit
# =>This Inner Loop Header: Depth=1
movl %eax, 160(%rsp,%rax,4)
incq %rax
cmpq $16, %rax
jne .LBB2_3
# %bb.4: # %_Z4initPi.exit14
leaq 16(%rsp), %rdi
movl $64, %esi
callq hipMalloc
leaq 8(%rsp), %rdi
movl $64, %esi
callq hipMalloc
movq %rsp, %rdi
movl $64, %esi
callq hipMalloc
movq 16(%rsp), %rdi
leaq 224(%rsp), %rsi
movl $64, %edx
movl $1, %ecx
callq hipMemcpy
movq 8(%rsp), %rdi
leaq 160(%rsp), %rsi
movl $64, %edx
movl $1, %ecx
callq hipMemcpy
movabsq $4294967300, %rdi # imm = 0x100000004
movl $1, %esi
movq %rdi, %rdx
movl $1, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq __hipPushCallConfiguration
testl %eax, %eax
jne .LBB2_6
# %bb.5:
movq 16(%rsp), %rax
movq 8(%rsp), %rcx
movq (%rsp), %rdx
movq %rax, 88(%rsp)
movq %rcx, 80(%rsp)
movq %rdx, 72(%rsp)
leaq 88(%rsp), %rax
movq %rax, 96(%rsp)
leaq 80(%rsp), %rax
movq %rax, 104(%rsp)
leaq 72(%rsp), %rax
movq %rax, 112(%rsp)
leaq 56(%rsp), %rdi
leaq 40(%rsp), %rsi
leaq 32(%rsp), %rdx
leaq 24(%rsp), %rcx
callq __hipPopCallConfiguration
movq 56(%rsp), %rsi
movl 64(%rsp), %edx
movq 40(%rsp), %rcx
movl 48(%rsp), %r8d
leaq 96(%rsp), %r9
movl $_Z10vector_addPiS_S_, %edi
pushq 24(%rsp)
.cfi_adjust_cfa_offset 8
pushq 40(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $16, %rsp
.cfi_adjust_cfa_offset -16
.LBB2_6:
movq (%rsp), %rsi
leaq 96(%rsp), %rdi
movl $64, %edx
movl $2, %ecx
callq hipMemcpy
movq 16(%rsp), %rdi
callq hipFree
movq 8(%rsp), %rdi
callq hipFree
movq (%rsp), %rdi
callq hipFree
xorl %ebx, %ebx
.p2align 4, 0x90
.LBB2_7: # =>This Inner Loop Header: Depth=1
movl 96(%rsp,%rbx,4), %esi
movl $.L.str, %edi
xorl %eax, %eax
callq printf
incq %rbx
cmpq $16, %rbx
jne .LBB2_7
# %bb.8:
xorl %eax, %eax
addq $288, %rsp # imm = 0x120
.cfi_def_cfa_offset 16
popq %rbx
.cfi_def_cfa_offset 8
retq
.Lfunc_end2:
.size main, .Lfunc_end2-main
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_ctor
.type __hip_module_ctor,@function
__hip_module_ctor: # @__hip_module_ctor
.cfi_startproc
# %bb.0:
subq $40, %rsp
.cfi_def_cfa_offset 48
cmpq $0, __hip_gpubin_handle(%rip)
jne .LBB3_2
# %bb.1:
movl $__hip_fatbin_wrapper, %edi
callq __hipRegisterFatBinary
movq %rax, __hip_gpubin_handle(%rip)
.LBB3_2:
movq __hip_gpubin_handle(%rip), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 16(%rsp)
movups %xmm0, (%rsp)
movl $_Z10vector_addPiS_S_, %esi
movl $.L__unnamed_1, %edx
movl $.L__unnamed_1, %ecx
movl $-1, %r8d
xorl %r9d, %r9d
callq __hipRegisterFunction
movl $__hip_module_dtor, %edi
addq $40, %rsp
.cfi_def_cfa_offset 8
jmp atexit # TAILCALL
.Lfunc_end3:
.size __hip_module_ctor, .Lfunc_end3-__hip_module_ctor
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_dtor
.type __hip_module_dtor,@function
__hip_module_dtor: # @__hip_module_dtor
.cfi_startproc
# %bb.0:
movq __hip_gpubin_handle(%rip), %rdi
testq %rdi, %rdi
je .LBB4_2
# %bb.1:
pushq %rax
.cfi_def_cfa_offset 16
callq __hipUnregisterFatBinary
movq $0, __hip_gpubin_handle(%rip)
addq $8, %rsp
.cfi_def_cfa_offset 8
.LBB4_2:
retq
.Lfunc_end4:
.size __hip_module_dtor, .Lfunc_end4-__hip_module_dtor
.cfi_endproc
# -- End function
.type _Z10vector_addPiS_S_,@object # @_Z10vector_addPiS_S_
.section .rodata,"a",@progbits
.globl _Z10vector_addPiS_S_
.p2align 3, 0x0
_Z10vector_addPiS_S_:
.quad _Z25__device_stub__vector_addPiS_S_
.size _Z10vector_addPiS_S_, 8
.type .L.str,@object # @.str
.section .rodata.str1.1,"aMS",@progbits,1
.L.str:
.asciz "%d "
.size .L.str, 4
.type .L__unnamed_1,@object # @0
.L__unnamed_1:
.asciz "_Z10vector_addPiS_S_"
.size .L__unnamed_1, 21
.type __hip_fatbin_wrapper,@object # @__hip_fatbin_wrapper
.section .hipFatBinSegment,"a",@progbits
.p2align 3, 0x0
__hip_fatbin_wrapper:
.long 1212764230 # 0x48495046
.long 1 # 0x1
.quad __hip_fatbin
.quad 0
.size __hip_fatbin_wrapper, 24
.type __hip_gpubin_handle,@object # @__hip_gpubin_handle
.local __hip_gpubin_handle
.comm __hip_gpubin_handle,8,8
.section .init_array,"aw",@init_array
.p2align 3, 0x0
.quad __hip_module_ctor
.type __hip_cuid_,@object # @__hip_cuid_
.bss
.globl __hip_cuid_
__hip_cuid_:
.byte 0 # 0x0
.size __hip_cuid_, 1
.section ".linker-options","e",@llvm_linker_options
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym _Z25__device_stub__vector_addPiS_S_
.addrsig_sym __hip_module_ctor
.addrsig_sym __hip_module_dtor
.addrsig_sym _Z10vector_addPiS_S_
.addrsig_sym __hip_fatbin
.addrsig_sym __hip_fatbin_wrapper
.addrsig_sym __hip_cuid_ |
You are a helpful coding assistant specialized in converting from CUDA device assembly to AMD device assembly. | code for sm_80
Function : _Z10vector_addPiS_S_
.headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)"
/*0000*/ MOV R1, c[0x0][0x28] ; /* 0x00000a0000017a02 */
/* 0x000fe40000000f00 */
/*0010*/ S2R R6, SR_CTAID.X ; /* 0x0000000000067919 */
/* 0x000e220000002500 */
/*0020*/ HFMA2.MMA R7, -RZ, RZ, 0, 2.384185791015625e-07 ; /* 0x00000004ff077435 */
/* 0x000fe200000001ff */
/*0030*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */
/* 0x000fe40000000a00 */
/*0040*/ S2R R3, SR_TID.X ; /* 0x0000000000037919 */
/* 0x000e240000002100 */
/*0050*/ IMAD R6, R6, c[0x0][0x0], R3 ; /* 0x0000000006067a24 */
/* 0x001fca00078e0203 */
/*0060*/ IMAD.WIDE R2, R6, R7, c[0x0][0x160] ; /* 0x0000580006027625 */
/* 0x000fc800078e0207 */
/*0070*/ IMAD.WIDE R4, R6.reuse, R7.reuse, c[0x0][0x168] ; /* 0x00005a0006047625 */
/* 0x0c0fe400078e0207 */
/*0080*/ LDG.E R2, [R2.64] ; /* 0x0000000402027981 */
/* 0x000ea8000c1e1900 */
/*0090*/ LDG.E R5, [R4.64] ; /* 0x0000000404057981 */
/* 0x000ea2000c1e1900 */
/*00a0*/ IMAD.WIDE R6, R6, R7, c[0x0][0x170] ; /* 0x00005c0006067625 */
/* 0x000fe200078e0207 */
/*00b0*/ IADD3 R9, R2, R5, RZ ; /* 0x0000000502097210 */
/* 0x004fca0007ffe0ff */
/*00c0*/ STG.E [R6.64], R9 ; /* 0x0000000906007986 */
/* 0x000fe2000c101904 */
/*00d0*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*00e0*/ BRA 0xe0; /* 0xfffffff000007947 */
/* 0x000fc0000383ffff */
/*00f0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0100*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0110*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0120*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0130*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0140*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0150*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0160*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0170*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
.......... | .text
.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
.protected _Z10vector_addPiS_S_
.globl _Z10vector_addPiS_S_
.p2align 8
.type _Z10vector_addPiS_S_,@function
_Z10vector_addPiS_S_:
s_clause 0x2
s_load_b32 s2, s[0:1], 0x24
s_load_b128 s[4:7], s[0:1], 0x0
s_load_b64 s[0:1], s[0:1], 0x10
s_waitcnt lgkmcnt(0)
s_and_b32 s2, s2, 0xffff
s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
v_ashrrev_i32_e32 v2, 31, v1
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_lshlrev_b64 v[0:1], 2, v[1:2]
v_add_co_u32 v2, vcc_lo, s4, v0
s_delay_alu instid0(VALU_DEP_2)
v_add_co_ci_u32_e32 v3, vcc_lo, s5, v1, vcc_lo
v_add_co_u32 v4, vcc_lo, s6, v0
v_add_co_ci_u32_e32 v5, vcc_lo, s7, v1, vcc_lo
v_add_co_u32 v0, vcc_lo, s0, v0
global_load_b32 v2, v[2:3], off
global_load_b32 v3, v[4:5], off
v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
s_waitcnt vmcnt(0)
v_add_nc_u32_e32 v2, v3, v2
global_store_b32 v[0:1], v2, off
s_nop 0
s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
s_endpgm
.section .rodata,"a",@progbits
.p2align 6, 0x0
.amdhsa_kernel _Z10vector_addPiS_S_
.amdhsa_group_segment_fixed_size 0
.amdhsa_private_segment_fixed_size 0
.amdhsa_kernarg_size 280
.amdhsa_user_sgpr_count 15
.amdhsa_user_sgpr_dispatch_ptr 0
.amdhsa_user_sgpr_queue_ptr 0
.amdhsa_user_sgpr_kernarg_segment_ptr 1
.amdhsa_user_sgpr_dispatch_id 0
.amdhsa_user_sgpr_private_segment_size 0
.amdhsa_wavefront_size32 1
.amdhsa_uses_dynamic_stack 0
.amdhsa_enable_private_segment 0
.amdhsa_system_sgpr_workgroup_id_x 1
.amdhsa_system_sgpr_workgroup_id_y 0
.amdhsa_system_sgpr_workgroup_id_z 0
.amdhsa_system_sgpr_workgroup_info 0
.amdhsa_system_vgpr_workitem_id 0
.amdhsa_next_free_vgpr 6
.amdhsa_next_free_sgpr 16
.amdhsa_float_round_mode_32 0
.amdhsa_float_round_mode_16_64 0
.amdhsa_float_denorm_mode_32 3
.amdhsa_float_denorm_mode_16_64 3
.amdhsa_dx10_clamp 1
.amdhsa_ieee_mode 1
.amdhsa_fp16_overflow 0
.amdhsa_workgroup_processor_mode 1
.amdhsa_memory_ordered 1
.amdhsa_forward_progress 0
.amdhsa_shared_vgpr_count 0
.amdhsa_exception_fp_ieee_invalid_op 0
.amdhsa_exception_fp_denorm_src 0
.amdhsa_exception_fp_ieee_div_zero 0
.amdhsa_exception_fp_ieee_overflow 0
.amdhsa_exception_fp_ieee_underflow 0
.amdhsa_exception_fp_ieee_inexact 0
.amdhsa_exception_int_div_zero 0
.end_amdhsa_kernel
.text
.Lfunc_end0:
.size _Z10vector_addPiS_S_, .Lfunc_end0-_Z10vector_addPiS_S_
.section .AMDGPU.csdata,"",@progbits
.text
.p2alignl 7, 3214868480
.fill 96, 4, 3214868480
.type __hip_cuid_,@object
.section .bss,"aw",@nobits
.globl __hip_cuid_
__hip_cuid_:
.byte 0
.size __hip_cuid_, 1
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym __hip_cuid_
.amdgpu_metadata
---
amdhsa.kernels:
- .args:
- .address_space: global
.offset: 0
.size: 8
.value_kind: global_buffer
- .address_space: global
.offset: 8
.size: 8
.value_kind: global_buffer
- .address_space: global
.offset: 16
.size: 8
.value_kind: global_buffer
- .offset: 24
.size: 4
.value_kind: hidden_block_count_x
- .offset: 28
.size: 4
.value_kind: hidden_block_count_y
- .offset: 32
.size: 4
.value_kind: hidden_block_count_z
- .offset: 36
.size: 2
.value_kind: hidden_group_size_x
- .offset: 38
.size: 2
.value_kind: hidden_group_size_y
- .offset: 40
.size: 2
.value_kind: hidden_group_size_z
- .offset: 42
.size: 2
.value_kind: hidden_remainder_x
- .offset: 44
.size: 2
.value_kind: hidden_remainder_y
- .offset: 46
.size: 2
.value_kind: hidden_remainder_z
- .offset: 64
.size: 8
.value_kind: hidden_global_offset_x
- .offset: 72
.size: 8
.value_kind: hidden_global_offset_y
- .offset: 80
.size: 8
.value_kind: hidden_global_offset_z
- .offset: 88
.size: 2
.value_kind: hidden_grid_dims
.group_segment_fixed_size: 0
.kernarg_segment_align: 8
.kernarg_segment_size: 280
.language: OpenCL C
.language_version:
- 2
- 0
.max_flat_workgroup_size: 1024
.name: _Z10vector_addPiS_S_
.private_segment_fixed_size: 0
.sgpr_count: 18
.sgpr_spill_count: 0
.symbol: _Z10vector_addPiS_S_.kd
.uniform_work_group_size: 1
.uses_dynamic_stack: false
.vgpr_count: 6
.vgpr_spill_count: 0
.wavefront_size: 32
.workgroup_processor_mode: 1
amdhsa.target: amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
- 1
- 2
...
.end_amdgpu_metadata |
You are a helpful coding assistant specialized in converting from CUDA host assembly to AMD host assembly. | .file "tmpxft_000858f7_00000000-6_vec_add.cudafe1.cpp"
.text
#APP
#NO_APP
.type _ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2061:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaUnregisterFatBinary@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2061:
.size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
.globl _Z4initPi
.type _Z4initPi, @function
_Z4initPi:
.LFB2057:
.cfi_startproc
endbr64
movl $0, %eax
.L4:
movl %eax, (%rdi,%rax,4)
addq $1, %rax
cmpq $16, %rax
jne .L4
ret
.cfi_endproc
.LFE2057:
.size _Z4initPi, .-_Z4initPi
.globl _Z34__device_stub__Z10vector_addPiS_S_PiS_S_
.type _Z34__device_stub__Z10vector_addPiS_S_PiS_S_, @function
_Z34__device_stub__Z10vector_addPiS_S_PiS_S_:
.LFB2083:
.cfi_startproc
endbr64
subq $136, %rsp
.cfi_def_cfa_offset 144
movq %rdi, 24(%rsp)
movq %rsi, 16(%rsp)
movq %rdx, 8(%rsp)
movq %fs:40, %rax
movq %rax, 120(%rsp)
xorl %eax, %eax
leaq 24(%rsp), %rax
movq %rax, 96(%rsp)
leaq 16(%rsp), %rax
movq %rax, 104(%rsp)
leaq 8(%rsp), %rax
movq %rax, 112(%rsp)
movl $1, 48(%rsp)
movl $1, 52(%rsp)
movl $1, 56(%rsp)
movl $1, 60(%rsp)
movl $1, 64(%rsp)
movl $1, 68(%rsp)
leaq 40(%rsp), %rcx
leaq 32(%rsp), %rdx
leaq 60(%rsp), %rsi
leaq 48(%rsp), %rdi
call __cudaPopCallConfiguration@PLT
testl %eax, %eax
je .L10
.L6:
movq 120(%rsp), %rax
subq %fs:40, %rax
jne .L11
addq $136, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 8
ret
.L10:
.cfi_restore_state
pushq 40(%rsp)
.cfi_def_cfa_offset 152
pushq 40(%rsp)
.cfi_def_cfa_offset 160
leaq 112(%rsp), %r9
movq 76(%rsp), %rcx
movl 84(%rsp), %r8d
movq 64(%rsp), %rsi
movl 72(%rsp), %edx
leaq _Z10vector_addPiS_S_(%rip), %rdi
call cudaLaunchKernel@PLT
addq $16, %rsp
.cfi_def_cfa_offset 144
jmp .L6
.L11:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE2083:
.size _Z34__device_stub__Z10vector_addPiS_S_PiS_S_, .-_Z34__device_stub__Z10vector_addPiS_S_PiS_S_
.globl _Z10vector_addPiS_S_
.type _Z10vector_addPiS_S_, @function
_Z10vector_addPiS_S_:
.LFB2084:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
call _Z34__device_stub__Z10vector_addPiS_S_PiS_S_
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2084:
.size _Z10vector_addPiS_S_, .-_Z10vector_addPiS_S_
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "%d "
.text
.globl main
.type main, @function
main:
.LFB2058:
.cfi_startproc
endbr64
pushq %r12
.cfi_def_cfa_offset 16
.cfi_offset 12, -16
pushq %rbp
.cfi_def_cfa_offset 24
.cfi_offset 6, -24
pushq %rbx
.cfi_def_cfa_offset 32
.cfi_offset 3, -32
subq $256, %rsp
.cfi_def_cfa_offset 288
movq %fs:40, %rax
movq %rax, 248(%rsp)
xorl %eax, %eax
leaq 48(%rsp), %rbp
movq %rbp, %rdi
call _Z4initPi
leaq 112(%rsp), %rbx
movq %rbx, %rdi
call _Z4initPi
movq %rsp, %rdi
movl $64, %esi
call cudaMalloc@PLT
leaq 8(%rsp), %rdi
movl $64, %esi
call cudaMalloc@PLT
leaq 16(%rsp), %rdi
movl $64, %esi
call cudaMalloc@PLT
movl $1, %ecx
movl $64, %edx
movq %rbp, %rsi
movq (%rsp), %rdi
call cudaMemcpy@PLT
movl $1, %ecx
movl $64, %edx
movq %rbx, %rsi
movq 8(%rsp), %rdi
call cudaMemcpy@PLT
movl $4, 36(%rsp)
movl $1, 40(%rsp)
movl $1, 44(%rsp)
movl $4, 24(%rsp)
movl $1, 28(%rsp)
movl $1, 32(%rsp)
movl $0, %r9d
movl $0, %r8d
movq 36(%rsp), %rdx
movl $1, %ecx
movq 24(%rsp), %rdi
movl $1, %esi
call __cudaPushCallConfiguration@PLT
testl %eax, %eax
je .L20
.L15:
leaq 176(%rsp), %rbx
movl $2, %ecx
movl $64, %edx
movq 16(%rsp), %rsi
movq %rbx, %rdi
call cudaMemcpy@PLT
movq (%rsp), %rdi
call cudaFree@PLT
movq 8(%rsp), %rdi
call cudaFree@PLT
movq 16(%rsp), %rdi
call cudaFree@PLT
leaq 240(%rsp), %r12
leaq .LC0(%rip), %rbp
.L16:
movl (%rbx), %edx
movq %rbp, %rsi
movl $2, %edi
movl $0, %eax
call __printf_chk@PLT
addq $4, %rbx
cmpq %r12, %rbx
jne .L16
movq 248(%rsp), %rax
subq %fs:40, %rax
jne .L21
movl $0, %eax
addq $256, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 32
popq %rbx
.cfi_def_cfa_offset 24
popq %rbp
.cfi_def_cfa_offset 16
popq %r12
.cfi_def_cfa_offset 8
ret
.L20:
.cfi_restore_state
movq 16(%rsp), %rdx
movq 8(%rsp), %rsi
movq (%rsp), %rdi
call _Z34__device_stub__Z10vector_addPiS_S_PiS_S_
jmp .L15
.L21:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE2058:
.size main, .-main
.section .rodata.str1.1
.LC1:
.string "_Z10vector_addPiS_S_"
.text
.type _ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2086:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
leaq _ZL15__fatDeviceText(%rip), %rdi
call __cudaRegisterFatBinary@PLT
movq %rax, %rdi
movq %rax, _ZL20__cudaFatCubinHandle(%rip)
pushq $0
.cfi_def_cfa_offset 24
pushq $0
.cfi_def_cfa_offset 32
pushq $0
.cfi_def_cfa_offset 40
pushq $0
.cfi_def_cfa_offset 48
movl $0, %r9d
movl $-1, %r8d
leaq .LC1(%rip), %rdx
movq %rdx, %rcx
leaq _Z10vector_addPiS_S_(%rip), %rsi
call __cudaRegisterFunction@PLT
addq $32, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaRegisterFatBinaryEnd@PLT
leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
call atexit@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2086:
.size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
.section .init_array,"aw"
.align 8
.quad _ZL24__sti____cudaRegisterAllv
.section .nvFatBinSegment,"aw"
.align 8
.type _ZL15__fatDeviceText, @object
.size _ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
.long 1180844977
.long 1
.quad fatbinData
.quad 0
.local _ZL20__cudaFatCubinHandle
.comm _ZL20__cudaFatCubinHandle,8,8
.ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
.section .note.GNU-stack,"",@progbits
.section .note.gnu.property,"a"
.align 8
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.string "GNU"
1:
.align 8
.long 0xc0000002
.long 3f - 2f
2:
.long 0x3
3:
.align 8
4: | .text
.file "vec_add.hip"
.globl _Z25__device_stub__vector_addPiS_S_ # -- Begin function _Z25__device_stub__vector_addPiS_S_
.p2align 4, 0x90
.type _Z25__device_stub__vector_addPiS_S_,@function
_Z25__device_stub__vector_addPiS_S_: # @_Z25__device_stub__vector_addPiS_S_
.cfi_startproc
# %bb.0:
subq $104, %rsp
.cfi_def_cfa_offset 112
movq %rdi, 72(%rsp)
movq %rsi, 64(%rsp)
movq %rdx, 56(%rsp)
leaq 72(%rsp), %rax
movq %rax, 80(%rsp)
leaq 64(%rsp), %rax
movq %rax, 88(%rsp)
leaq 56(%rsp), %rax
movq %rax, 96(%rsp)
leaq 40(%rsp), %rdi
leaq 24(%rsp), %rsi
leaq 16(%rsp), %rdx
leaq 8(%rsp), %rcx
callq __hipPopCallConfiguration
movq 40(%rsp), %rsi
movl 48(%rsp), %edx
movq 24(%rsp), %rcx
movl 32(%rsp), %r8d
leaq 80(%rsp), %r9
movl $_Z10vector_addPiS_S_, %edi
pushq 8(%rsp)
.cfi_adjust_cfa_offset 8
pushq 24(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $120, %rsp
.cfi_adjust_cfa_offset -120
retq
.Lfunc_end0:
.size _Z25__device_stub__vector_addPiS_S_, .Lfunc_end0-_Z25__device_stub__vector_addPiS_S_
.cfi_endproc
# -- End function
.globl _Z4initPi # -- Begin function _Z4initPi
.p2align 4, 0x90
.type _Z4initPi,@function
_Z4initPi: # @_Z4initPi
.cfi_startproc
# %bb.0:
xorl %eax, %eax
.p2align 4, 0x90
.LBB1_1: # =>This Inner Loop Header: Depth=1
movl %eax, (%rdi,%rax,4)
incq %rax
cmpq $16, %rax
jne .LBB1_1
# %bb.2:
retq
.Lfunc_end1:
.size _Z4initPi, .Lfunc_end1-_Z4initPi
.cfi_endproc
# -- End function
.globl main # -- Begin function main
.p2align 4, 0x90
.type main,@function
main: # @main
.cfi_startproc
# %bb.0:
pushq %rbx
.cfi_def_cfa_offset 16
subq $288, %rsp # imm = 0x120
.cfi_def_cfa_offset 304
.cfi_offset %rbx, -16
xorl %eax, %eax
.p2align 4, 0x90
.LBB2_1: # =>This Inner Loop Header: Depth=1
movl %eax, 224(%rsp,%rax,4)
incq %rax
cmpq $16, %rax
jne .LBB2_1
# %bb.2: # %_Z4initPi.exit.preheader
xorl %eax, %eax
.p2align 4, 0x90
.LBB2_3: # %_Z4initPi.exit
# =>This Inner Loop Header: Depth=1
movl %eax, 160(%rsp,%rax,4)
incq %rax
cmpq $16, %rax
jne .LBB2_3
# %bb.4: # %_Z4initPi.exit14
leaq 16(%rsp), %rdi
movl $64, %esi
callq hipMalloc
leaq 8(%rsp), %rdi
movl $64, %esi
callq hipMalloc
movq %rsp, %rdi
movl $64, %esi
callq hipMalloc
movq 16(%rsp), %rdi
leaq 224(%rsp), %rsi
movl $64, %edx
movl $1, %ecx
callq hipMemcpy
movq 8(%rsp), %rdi
leaq 160(%rsp), %rsi
movl $64, %edx
movl $1, %ecx
callq hipMemcpy
movabsq $4294967300, %rdi # imm = 0x100000004
movl $1, %esi
movq %rdi, %rdx
movl $1, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq __hipPushCallConfiguration
testl %eax, %eax
jne .LBB2_6
# %bb.5:
movq 16(%rsp), %rax
movq 8(%rsp), %rcx
movq (%rsp), %rdx
movq %rax, 88(%rsp)
movq %rcx, 80(%rsp)
movq %rdx, 72(%rsp)
leaq 88(%rsp), %rax
movq %rax, 96(%rsp)
leaq 80(%rsp), %rax
movq %rax, 104(%rsp)
leaq 72(%rsp), %rax
movq %rax, 112(%rsp)
leaq 56(%rsp), %rdi
leaq 40(%rsp), %rsi
leaq 32(%rsp), %rdx
leaq 24(%rsp), %rcx
callq __hipPopCallConfiguration
movq 56(%rsp), %rsi
movl 64(%rsp), %edx
movq 40(%rsp), %rcx
movl 48(%rsp), %r8d
leaq 96(%rsp), %r9
movl $_Z10vector_addPiS_S_, %edi
pushq 24(%rsp)
.cfi_adjust_cfa_offset 8
pushq 40(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $16, %rsp
.cfi_adjust_cfa_offset -16
.LBB2_6:
movq (%rsp), %rsi
leaq 96(%rsp), %rdi
movl $64, %edx
movl $2, %ecx
callq hipMemcpy
movq 16(%rsp), %rdi
callq hipFree
movq 8(%rsp), %rdi
callq hipFree
movq (%rsp), %rdi
callq hipFree
xorl %ebx, %ebx
.p2align 4, 0x90
.LBB2_7: # =>This Inner Loop Header: Depth=1
movl 96(%rsp,%rbx,4), %esi
movl $.L.str, %edi
xorl %eax, %eax
callq printf
incq %rbx
cmpq $16, %rbx
jne .LBB2_7
# %bb.8:
xorl %eax, %eax
addq $288, %rsp # imm = 0x120
.cfi_def_cfa_offset 16
popq %rbx
.cfi_def_cfa_offset 8
retq
.Lfunc_end2:
.size main, .Lfunc_end2-main
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_ctor
.type __hip_module_ctor,@function
__hip_module_ctor: # @__hip_module_ctor
.cfi_startproc
# %bb.0:
subq $40, %rsp
.cfi_def_cfa_offset 48
cmpq $0, __hip_gpubin_handle(%rip)
jne .LBB3_2
# %bb.1:
movl $__hip_fatbin_wrapper, %edi
callq __hipRegisterFatBinary
movq %rax, __hip_gpubin_handle(%rip)
.LBB3_2:
movq __hip_gpubin_handle(%rip), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 16(%rsp)
movups %xmm0, (%rsp)
movl $_Z10vector_addPiS_S_, %esi
movl $.L__unnamed_1, %edx
movl $.L__unnamed_1, %ecx
movl $-1, %r8d
xorl %r9d, %r9d
callq __hipRegisterFunction
movl $__hip_module_dtor, %edi
addq $40, %rsp
.cfi_def_cfa_offset 8
jmp atexit # TAILCALL
.Lfunc_end3:
.size __hip_module_ctor, .Lfunc_end3-__hip_module_ctor
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_dtor
.type __hip_module_dtor,@function
__hip_module_dtor: # @__hip_module_dtor
.cfi_startproc
# %bb.0:
movq __hip_gpubin_handle(%rip), %rdi
testq %rdi, %rdi
je .LBB4_2
# %bb.1:
pushq %rax
.cfi_def_cfa_offset 16
callq __hipUnregisterFatBinary
movq $0, __hip_gpubin_handle(%rip)
addq $8, %rsp
.cfi_def_cfa_offset 8
.LBB4_2:
retq
.Lfunc_end4:
.size __hip_module_dtor, .Lfunc_end4-__hip_module_dtor
.cfi_endproc
# -- End function
.type _Z10vector_addPiS_S_,@object # @_Z10vector_addPiS_S_
.section .rodata,"a",@progbits
.globl _Z10vector_addPiS_S_
.p2align 3, 0x0
_Z10vector_addPiS_S_:
.quad _Z25__device_stub__vector_addPiS_S_
.size _Z10vector_addPiS_S_, 8
.type .L.str,@object # @.str
.section .rodata.str1.1,"aMS",@progbits,1
.L.str:
.asciz "%d "
.size .L.str, 4
.type .L__unnamed_1,@object # @0
.L__unnamed_1:
.asciz "_Z10vector_addPiS_S_"
.size .L__unnamed_1, 21
.type __hip_fatbin_wrapper,@object # @__hip_fatbin_wrapper
.section .hipFatBinSegment,"a",@progbits
.p2align 3, 0x0
__hip_fatbin_wrapper:
.long 1212764230 # 0x48495046
.long 1 # 0x1
.quad __hip_fatbin
.quad 0
.size __hip_fatbin_wrapper, 24
.type __hip_gpubin_handle,@object # @__hip_gpubin_handle
.local __hip_gpubin_handle
.comm __hip_gpubin_handle,8,8
.section .init_array,"aw",@init_array
.p2align 3, 0x0
.quad __hip_module_ctor
.type __hip_cuid_,@object # @__hip_cuid_
.bss
.globl __hip_cuid_
__hip_cuid_:
.byte 0 # 0x0
.size __hip_cuid_, 1
.section ".linker-options","e",@llvm_linker_options
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym _Z25__device_stub__vector_addPiS_S_
.addrsig_sym __hip_module_ctor
.addrsig_sym __hip_module_dtor
.addrsig_sym _Z10vector_addPiS_S_
.addrsig_sym __hip_fatbin
.addrsig_sym __hip_fatbin_wrapper
.addrsig_sym __hip_cuid_ |
You are a helpful coding assistant specialized in converting CUDA source code to CUDA device assembly. | #include <iostream>
#include <chrono>
__global__ void polynomial_expansion (float* poly,int degree,int n,float* array)
{
int INX=blockIdx.x*blockDim.x+threadIdx.x;
if(INX<n)
{
float val=0.0;
float exp=1.0;
for(int x=0;x<=degree;++x)
{
val+=exp*poly[x];
exp*=array[INX];
}
array[INX]=val;
}
}
int main(int argc, char* argv[])
{
if(argc<3)
{
std::cerr<<"usage: "<<argv[0]<<" n degree"<<std::endl;
return -1;
}
int n=atoi(argv[1]);
int degree=atoi(argv[2]);
int nbiter=1;
float* array=new float[n];
float* poly=new float[degree+1];
for(int i=0;i<n;++i)
{
array[i]=1.;
}
for(int i=0;i<degree+1;++i)
{
poly[i]=1.;
}
float *DArr,*PArr;
//start calculating time
std::chrono::time_point<std::chrono::system_clock> start_time,end_time;
start_time = std::chrono::system_clock::now();
cudaMalloc(&DArr,n*sizeof(float));
cudaMalloc(&PArr,(degree+1)*sizeof(float));
cudaMemcpy(DArr,array,n*sizeof(float),cudaMemcpyHostToDevice);
cudaMemcpy(PArr,poly,(degree+1)*sizeof(float),cudaMemcpyHostToDevice);
polynomial_expansion<<<(n+255)/256, 256>>>(PArr,degree,n,DArr);
cudaMemcpy(array,DArr,n*sizeof(float),cudaMemcpyDeviceToHost);
cudaFree(DArr);
cudaFree(PArr);
cudaDeviceSynchronize();
{
bool correct=true;
int ind;
for(int i=0;i<n;++i)
{
if(fabs(array[i]-(degree+1))>0.01)
{
correct=false;
ind=i;
}
}
if(!correct)
std::cerr<<"Result is incorrect. In particular array["<<ind<<"] should be "<<degree+1<<" not "<< array[ind]<<std::endl;
}
// calculate and print time
end_time=std::chrono::system_clock::now();
std::chrono::duration<double> elapsed_time=(end_time-start_time)/nbiter;
std::cout<<n<<" "<<degree<<" "<<elapsed_time.count()<<std::endl;
// free arrays
delete[] array;
delete[] poly;
return 0;
} | code for sm_80
Function : _Z20polynomial_expansionPfiiS_
.headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)"
/*0000*/ MOV R1, c[0x0][0x28] ; /* 0x00000a0000017a02 */
/* 0x000fe40000000f00 */
/*0010*/ S2R R3, SR_CTAID.X ; /* 0x0000000000037919 */
/* 0x000e280000002500 */
/*0020*/ S2R R0, SR_TID.X ; /* 0x0000000000007919 */
/* 0x000e240000002100 */
/*0030*/ IMAD R3, R3, c[0x0][0x0], R0 ; /* 0x0000000003037a24 */
/* 0x001fca00078e0200 */
/*0040*/ ISETP.GE.AND P0, PT, R3, c[0x0][0x16c], PT ; /* 0x00005b0003007a0c */
/* 0x000fda0003f06270 */
/*0050*/ @P0 EXIT ; /* 0x000000000000094d */
/* 0x000fea0003800000 */
/*0060*/ ISETP.LE.AND P0, PT, RZ, c[0x0][0x168], PT ; /* 0x00005a00ff007a0c */
/* 0x000fe20003f03270 */
/*0070*/ HFMA2.MMA R8, -RZ, RZ, 0, 2.384185791015625e-07 ; /* 0x00000004ff087435 */
/* 0x000fe200000001ff */
/*0080*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */
/* 0x000fd20000000a00 */
/*0090*/ IMAD.WIDE R2, R3, R8, c[0x0][0x170] ; /* 0x00005c0003027625 */
/* 0x000fe400078e0208 */
/*00a0*/ @!P0 BRA 0xa30 ; /* 0x0000098000008947 */
/* 0x000fea0003800000 */
/*00b0*/ MOV R9, c[0x0][0x168] ; /* 0x00005a0000097a02 */
/* 0x000fe20000000f00 */
/*00c0*/ LDG.E R0, [R2.64] ; /* 0x0000000402007981 */
/* 0x000162000c1e1900 */
/*00d0*/ MOV R7, RZ ; /* 0x000000ff00077202 */
/* 0x000fe40000000f00 */
/*00e0*/ ISETP.GE.U32.AND P0, PT, R9.reuse, 0x3, PT ; /* 0x000000030900780c */
/* 0x040fe40003f06070 */
/*00f0*/ IADD3 R9, R9, 0x1, RZ ; /* 0x0000000109097810 */
/* 0x000fe40007ffe0ff */
/*0100*/ MOV R6, 0x3f800000 ; /* 0x3f80000000067802 */
/* 0x000fc40000000f00 */
/*0110*/ MOV R11, RZ ; /* 0x000000ff000b7202 */
/* 0x000fe40000000f00 */
/*0120*/ LOP3.LUT R9, R9, 0x3, RZ, 0xc0, !PT ; /* 0x0000000309097812 */
/* 0x000fca00078ec0ff */
/*0130*/ @!P0 BRA 0x8d0 ; /* 0x0000079000008947 */
/* 0x000fea0003800000 */
/*0140*/ IADD3 R10, -R9, c[0x0][0x168], RZ ; /* 0x00005a00090a7a10 */
/* 0x001fe20007ffe1ff */
/*0150*/ HFMA2.MMA R7, -RZ, RZ, 0, 0 ; /* 0x00000000ff077435 */
/* 0x000fe200000001ff */
/*0160*/ MOV R6, 0x3f800000 ; /* 0x3f80000000067802 */
/* 0x000fe20000000f00 */
/*0170*/ HFMA2.MMA R11, -RZ, RZ, 0, 0 ; /* 0x00000000ff0b7435 */
/* 0x000fe200000001ff */
/*0180*/ ISETP.GT.AND P0, PT, R10, -0x1, PT ; /* 0xffffffff0a00780c */
/* 0x000fe40003f04270 */
/*0190*/ MOV R4, c[0x0][0x160] ; /* 0x0000580000047a02 */
/* 0x000fe40000000f00 */
/*01a0*/ MOV R5, c[0x0][0x164] ; /* 0x0000590000057a02 */
/* 0x000fd20000000f00 */
/*01b0*/ @!P0 BRA 0x790 ; /* 0x000005d000008947 */
/* 0x000fea0003800000 */
/*01c0*/ IADD3 R12, R10, 0x1, RZ ; /* 0x000000010a0c7810 */
/* 0x000fe40007ffe0ff */
/*01d0*/ PLOP3.LUT P0, PT, PT, PT, PT, 0x80, 0x0 ; /* 0x000000000000781c */
/* 0x000fe40003f0f070 */
/*01e0*/ ISETP.GT.AND P1, PT, R12, 0xc, PT ; /* 0x0000000c0c00780c */
/* 0x000fda0003f24270 */
/*01f0*/ @!P1 BRA 0x570 ; /* 0x0000037000009947 */
/* 0x000fea0003800000 */
/*0200*/ PLOP3.LUT P0, PT, PT, PT, PT, 0x8, 0x0 ; /* 0x000000000000781c */
/* 0x000fe40003f0e170 */
/*0210*/ LDG.E R25, [R4.64] ; /* 0x0000000404197981 */
/* 0x000ea8000c1e1900 */
/*0220*/ LDG.E R26, [R4.64+0x4] ; /* 0x00000404041a7981 */
/* 0x000ee8000c1e1900 */
/*0230*/ LDG.E R24, [R4.64+0x8] ; /* 0x0000080404187981 */
/* 0x000f28000c1e1900 */
/*0240*/ LDG.E R23, [R4.64+0xc] ; /* 0x00000c0404177981 */
/* 0x000128000c1e1900 */
/*0250*/ LDG.E R22, [R4.64+0x10] ; /* 0x0000100404167981 */
/* 0x000128000c1e1900 */
/*0260*/ LDG.E R21, [R4.64+0x14] ; /* 0x0000140404157981 */
/* 0x000128000c1e1900 */
/*0270*/ LDG.E R20, [R4.64+0x18] ; /* 0x0000180404147981 */
/* 0x000128000c1e1900 */
/*0280*/ LDG.E R19, [R4.64+0x1c] ; /* 0x00001c0404137981 */
/* 0x000128000c1e1900 */
/*0290*/ LDG.E R18, [R4.64+0x20] ; /* 0x0000200404127981 */
/* 0x000128000c1e1900 */
/*02a0*/ LDG.E R17, [R4.64+0x24] ; /* 0x0000240404117981 */
/* 0x000128000c1e1900 */
/*02b0*/ LDG.E R16, [R4.64+0x28] ; /* 0x0000280404107981 */
/* 0x000128000c1e1900 */
/*02c0*/ LDG.E R15, [R4.64+0x2c] ; /* 0x00002c04040f7981 */
/* 0x000128000c1e1900 */
/*02d0*/ LDG.E R14, [R4.64+0x30] ; /* 0x00003004040e7981 */
/* 0x000128000c1e1900 */
/*02e0*/ LDG.E R13, [R4.64+0x34] ; /* 0x00003404040d7981 */
/* 0x000128000c1e1900 */
/*02f0*/ LDG.E R12, [R4.64+0x38] ; /* 0x00003804040c7981 */
/* 0x000122000c1e1900 */
/*0300*/ FMUL R27, R0, R6 ; /* 0x00000006001b7220 */
/* 0x020fc40000400000 */
/*0310*/ FFMA R25, R25, R6, R7 ; /* 0x0000000619197223 */
/* 0x004fe40000000007 */
/*0320*/ LDG.E R7, [R4.64+0x3c] ; /* 0x00003c0404077981 */
/* 0x0000a2000c1e1900 */
/*0330*/ IADD3 R10, R10, -0x10, RZ ; /* 0xfffffff00a0a7810 */
/* 0x000fe20007ffe0ff */
/*0340*/ FFMA R25, R26, R27.reuse, R25 ; /* 0x0000001b1a197223 */
/* 0x088fe20000000019 */
/*0350*/ IADD3 R11, R11, 0x10, RZ ; /* 0x000000100b0b7810 */
/* 0x000fe20007ffe0ff */
/*0360*/ FMUL R27, R0, R27 ; /* 0x0000001b001b7220 */
/* 0x000fe20000400000 */
/*0370*/ ISETP.GT.AND P1, PT, R10, 0xb, PT ; /* 0x0000000b0a00780c */
/* 0x000fc60003f24270 */
/*0380*/ FFMA R24, R27, R24, R25 ; /* 0x000000181b187223 */
/* 0x010fe40000000019 */
/*0390*/ FMUL R27, R0, R27 ; /* 0x0000001b001b7220 */
/* 0x000fe20000400000 */
/*03a0*/ IADD3 R4, P2, R4, 0x40, RZ ; /* 0x0000004004047810 */
/* 0x001fc60007f5e0ff */
/*03b0*/ FFMA R23, R27, R23, R24 ; /* 0x000000171b177223 */
/* 0x000fe20000000018 */
/*03c0*/ IADD3.X R5, RZ, R5, RZ, P2, !PT ; /* 0x00000005ff057210 */
/* 0x000fe200017fe4ff */
/*03d0*/ FMUL R27, R0, R27 ; /* 0x0000001b001b7220 */
/* 0x000fc80000400000 */
/*03e0*/ FFMA R22, R27, R22, R23 ; /* 0x000000161b167223 */
/* 0x000fe40000000017 */
/*03f0*/ FMUL R27, R0, R27 ; /* 0x0000001b001b7220 */
/* 0x000fc80000400000 */
/*0400*/ FFMA R21, R21, R27.reuse, R22 ; /* 0x0000001b15157223 */
/* 0x080fe40000000016 */
/*0410*/ FMUL R27, R0, R27 ; /* 0x0000001b001b7220 */
/* 0x000fc80000400000 */
/*0420*/ FFMA R20, R27, R20, R21 ; /* 0x000000141b147223 */
/* 0x000fe40000000015 */
/*0430*/ FMUL R27, R0, R27 ; /* 0x0000001b001b7220 */
/* 0x000fc80000400000 */
/*0440*/ FFMA R19, R27, R19, R20 ; /* 0x000000131b137223 */
/* 0x000fe40000000014 */
/*0450*/ FMUL R27, R0, R27 ; /* 0x0000001b001b7220 */
/* 0x000fc80000400000 */
/*0460*/ FFMA R18, R27, R18, R19 ; /* 0x000000121b127223 */
/* 0x000fe40000000013 */
/*0470*/ FMUL R27, R0, R27 ; /* 0x0000001b001b7220 */
/* 0x000fc80000400000 */
/*0480*/ FFMA R17, R17, R27.reuse, R18 ; /* 0x0000001b11117223 */
/* 0x080fe40000000012 */
/*0490*/ FMUL R27, R0, R27 ; /* 0x0000001b001b7220 */
/* 0x000fc80000400000 */
/*04a0*/ FFMA R16, R27, R16, R17 ; /* 0x000000101b107223 */
/* 0x000fe40000000011 */
/*04b0*/ FMUL R27, R0, R27 ; /* 0x0000001b001b7220 */
/* 0x000fc80000400000 */
/*04c0*/ FFMA R15, R27, R15, R16 ; /* 0x0000000f1b0f7223 */
/* 0x000fe40000000010 */
/*04d0*/ FMUL R27, R0, R27 ; /* 0x0000001b001b7220 */
/* 0x000fc80000400000 */
/*04e0*/ FFMA R14, R27, R14, R15 ; /* 0x0000000e1b0e7223 */
/* 0x000fe4000000000f */
/*04f0*/ FMUL R27, R0, R27 ; /* 0x0000001b001b7220 */
/* 0x000fc80000400000 */
/*0500*/ FFMA R13, R13, R27.reuse, R14 ; /* 0x0000001b0d0d7223 */
/* 0x080fe4000000000e */
/*0510*/ FMUL R27, R0, R27 ; /* 0x0000001b001b7220 */
/* 0x000fc80000400000 */
/*0520*/ FFMA R12, R27, R12, R13 ; /* 0x0000000c1b0c7223 */
/* 0x000fe4000000000d */
/*0530*/ FMUL R27, R0, R27 ; /* 0x0000001b001b7220 */
/* 0x000fc80000400000 */
/*0540*/ FMUL R6, R0, R27 ; /* 0x0000001b00067220 */
/* 0x000fe40000400000 */
/*0550*/ FFMA R7, R27, R7, R12 ; /* 0x000000071b077223 */
/* 0x004fe2000000000c */
/*0560*/ @P1 BRA 0x210 ; /* 0xfffffca000001947 */
/* 0x000fea000383ffff */
/*0570*/ IADD3 R12, R10, 0x1, RZ ; /* 0x000000010a0c7810 */
/* 0x000fc80007ffe0ff */
/*0580*/ ISETP.GT.AND P1, PT, R12, 0x4, PT ; /* 0x000000040c00780c */
/* 0x000fda0003f24270 */
/*0590*/ @!P1 BRA 0x770 ; /* 0x000001d000009947 */
/* 0x000fea0003800000 */
/*05a0*/ LDG.E R14, [R4.64] ; /* 0x00000004040e7981 */
/* 0x0000a8000c1e1900 */
/*05b0*/ LDG.E R15, [R4.64+0x4] ; /* 0x00000404040f7981 */
/* 0x0000e8000c1e1900 */
/*05c0*/ LDG.E R16, [R4.64+0x8] ; /* 0x0000080404107981 */
/* 0x000128000c1e1900 */
/*05d0*/ LDG.E R17, [R4.64+0xc] ; /* 0x00000c0404117981 */
/* 0x000128000c1e1900 */
/*05e0*/ LDG.E R18, [R4.64+0x10] ; /* 0x0000100404127981 */
/* 0x000128000c1e1900 */
/*05f0*/ LDG.E R19, [R4.64+0x14] ; /* 0x0000140404137981 */
/* 0x000128000c1e1900 */
/*0600*/ LDG.E R12, [R4.64+0x18] ; /* 0x00001804040c7981 */
/* 0x000128000c1e1900 */
/*0610*/ LDG.E R13, [R4.64+0x1c] ; /* 0x00001c04040d7981 */
/* 0x000122000c1e1900 */
/*0620*/ PLOP3.LUT P0, PT, PT, PT, PT, 0x8, 0x0 ; /* 0x000000000000781c */
/* 0x000fc40003f0e170 */
/*0630*/ IADD3 R11, R11, 0x8, RZ ; /* 0x000000080b0b7810 */
/* 0x000fe40007ffe0ff */
/*0640*/ IADD3 R10, R10, -0x8, RZ ; /* 0xfffffff80a0a7810 */
/* 0x000fe40007ffe0ff */
/*0650*/ IADD3 R4, P1, R4, 0x20, RZ ; /* 0x0000002004047810 */
/* 0x001fc80007f3e0ff */
/*0660*/ IADD3.X R5, RZ, R5, RZ, P1, !PT ; /* 0x00000005ff057210 */
/* 0x000fe20000ffe4ff */
/*0670*/ FFMA R14, R6, R14, R7 ; /* 0x0000000e060e7223 */
/* 0x004fe40000000007 */
/*0680*/ FMUL R7, R0, R6 ; /* 0x0000000600077220 */
/* 0x020fc80000400000 */
/*0690*/ FFMA R14, R15, R7.reuse, R14 ; /* 0x000000070f0e7223 */
/* 0x088fe4000000000e */
/*06a0*/ FMUL R7, R0, R7 ; /* 0x0000000700077220 */
/* 0x000fc80000400000 */
/*06b0*/ FFMA R14, R7, R16, R14 ; /* 0x00000010070e7223 */
/* 0x010fe4000000000e */
/*06c0*/ FMUL R7, R0, R7 ; /* 0x0000000700077220 */
/* 0x000fc80000400000 */
/*06d0*/ FFMA R14, R7, R17, R14 ; /* 0x00000011070e7223 */
/* 0x000fe4000000000e */
/*06e0*/ FMUL R7, R0, R7 ; /* 0x0000000700077220 */
/* 0x000fc80000400000 */
/*06f0*/ FFMA R14, R7, R18, R14 ; /* 0x00000012070e7223 */
/* 0x000fe4000000000e */
/*0700*/ FMUL R7, R0, R7 ; /* 0x0000000700077220 */
/* 0x000fc80000400000 */
/*0710*/ FFMA R19, R19, R7.reuse, R14 ; /* 0x0000000713137223 */
/* 0x080fe4000000000e */
/*0720*/ FMUL R7, R0, R7 ; /* 0x0000000700077220 */
/* 0x000fc80000400000 */
/*0730*/ FFMA R12, R7, R12, R19 ; /* 0x0000000c070c7223 */
/* 0x000fe40000000013 */
/*0740*/ FMUL R15, R0, R7 ; /* 0x00000007000f7220 */
/* 0x000fc80000400000 */
/*0750*/ FFMA R7, R15, R13, R12 ; /* 0x0000000d0f077223 */
/* 0x000fe4000000000c */
/*0760*/ FMUL R6, R0, R15 ; /* 0x0000000f00067220 */
/* 0x000fe40000400000 */
/*0770*/ ISETP.NE.OR P0, PT, R10, -0x1, P0 ; /* 0xffffffff0a00780c */
/* 0x000fda0000705670 */
/*0780*/ @!P0 BRA 0x8d0 ; /* 0x0000014000008947 */
/* 0x000fea0003800000 */
/*0790*/ LDG.E R12, [R4.64] ; /* 0x00000004040c7981 */
/* 0x000ea8000c1e1900 */
/*07a0*/ LDG.E R13, [R4.64+0x4] ; /* 0x00000404040d7981 */
/* 0x000ee8000c1e1900 */
/*07b0*/ LDG.E R15, [R4.64+0x8] ; /* 0x00000804040f7981 */
/* 0x000f28000c1e1900 */
/*07c0*/ LDG.E R17, [R4.64+0xc] ; /* 0x00000c0404117981 */
/* 0x000122000c1e1900 */
/*07d0*/ IADD3 R10, R10, -0x4, RZ ; /* 0xfffffffc0a0a7810 */
/* 0x000fc40007ffe0ff */
/*07e0*/ IADD3 R11, R11, 0x4, RZ ; /* 0x000000040b0b7810 */
/* 0x000fe40007ffe0ff */
/*07f0*/ ISETP.NE.AND P0, PT, R10, -0x1, PT ; /* 0xffffffff0a00780c */
/* 0x000fe20003f05270 */
/*0800*/ FFMA R12, R12, R6.reuse, R7 ; /* 0x000000060c0c7223 */
/* 0x084fe40000000007 */
/*0810*/ FMUL R7, R0, R6 ; /* 0x0000000600077220 */
/* 0x020fc80000400000 */
/*0820*/ FFMA R12, R13, R7.reuse, R12 ; /* 0x000000070d0c7223 */
/* 0x088fe2000000000c */
/*0830*/ IADD3 R13, P1, R4, 0x10, RZ ; /* 0x00000010040d7810 */
/* 0x000fe20007f3e0ff */
/*0840*/ FMUL R7, R0, R7 ; /* 0x0000000700077220 */
/* 0x000fc60000400000 */
/*0850*/ IADD3.X R14, RZ, R5, RZ, P1, !PT ; /* 0x00000005ff0e7210 */
/* 0x000fe20000ffe4ff */
/*0860*/ FFMA R12, R15, R7, R12 ; /* 0x000000070f0c7223 */
/* 0x010fe2000000000c */
/*0870*/ MOV R4, R13 ; /* 0x0000000d00047202 */
/* 0x001fe20000000f00 */
/*0880*/ FMUL R15, R0, R7 ; /* 0x00000007000f7220 */
/* 0x000fe20000400000 */
/*0890*/ MOV R5, R14 ; /* 0x0000000e00057202 */
/* 0x000fc60000000f00 */
/*08a0*/ FFMA R7, R17, R15.reuse, R12 ; /* 0x0000000f11077223 */
/* 0x080fe4000000000c */
/*08b0*/ FMUL R6, R0, R15 ; /* 0x0000000f00067220 */
/* 0x000fe20000400000 */
/*08c0*/ @P0 BRA 0x790 ; /* 0xfffffec000000947 */
/* 0x000fea000383ffff */
/*08d0*/ ISETP.NE.AND P0, PT, R9, RZ, PT ; /* 0x000000ff0900720c */
/* 0x001fda0003f05270 */
/*08e0*/ @!P0 BRA 0xa40 ; /* 0x0000015000008947 */
/* 0x000fea0003800000 */
/*08f0*/ IMAD.WIDE R4, R11, R8, c[0x0][0x160] ; /* 0x000058000b047625 */
/* 0x000fca00078e0208 */
/*0900*/ LDG.E R8, [R4.64] ; /* 0x0000000404087981 */
/* 0x000ea2000c1e1900 */
/*0910*/ IADD3 R9, R9, -0x1, RZ ; /* 0xffffffff09097810 */
/* 0x000fe40007ffe0ff */
/*0920*/ IADD3 R10, P1, R4, 0x4, RZ ; /* 0x00000004040a7810 */
/* 0x000fe40007f3e0ff */
/*0930*/ ISETP.NE.AND P0, PT, R9, RZ, PT ; /* 0x000000ff0900720c */
/* 0x000fe40003f05270 */
/*0940*/ IADD3.X R12, RZ, R5, RZ, P1, !PT ; /* 0x00000005ff0c7210 */
/* 0x000fe20000ffe4ff */
/*0950*/ FFMA R7, R8, R6, R7 ; /* 0x0000000608077223 */
/* 0x004fd40000000007 */
/*0960*/ @!P0 BRA 0xa40 ; /* 0x000000d000008947 */
/* 0x000fea0003800000 */
/*0970*/ FMUL R11, R0, R6 ; /* 0x00000006000b7220 */
/* 0x020fe40000400000 */
/*0980*/ MOV R4, R10 ; /* 0x0000000a00047202 */
/* 0x000fe40000000f00 */
/*0990*/ MOV R5, R12 ; /* 0x0000000c00057202 */
/* 0x000fca0000000f00 */
/*09a0*/ LDG.E R4, [R4.64] ; /* 0x0000000404047981 */
/* 0x000ea2000c1e1900 */
/*09b0*/ IADD3 R9, R9, -0x1, RZ ; /* 0xffffffff09097810 */
/* 0x000fe40007ffe0ff */
/*09c0*/ IADD3 R10, P1, R10, 0x4, RZ ; /* 0x000000040a0a7810 */
/* 0x000fe40007f3e0ff */
/*09d0*/ ISETP.NE.AND P0, PT, R9, RZ, PT ; /* 0x000000ff0900720c */
/* 0x000fe40003f05270 */
/*09e0*/ IADD3.X R12, RZ, R12, RZ, P1, !PT ; /* 0x0000000cff0c7210 */
/* 0x000fe20000ffe4ff */
/*09f0*/ FFMA R7, R4, R11.reuse, R7 ; /* 0x0000000b04077223 */
/* 0x084fe40000000007 */
/*0a00*/ FMUL R11, R0, R11 ; /* 0x0000000b000b7220 */
/* 0x000fd00000400000 */
/*0a10*/ @P0 BRA 0x980 ; /* 0xffffff6000000947 */
/* 0x000fea000383ffff */
/*0a20*/ BRA 0xa40 ; /* 0x0000001000007947 */
/* 0x000fea0003800000 */
/*0a30*/ MOV R7, RZ ; /* 0x000000ff00077202 */
/* 0x000fca0000000f00 */
/*0a40*/ STG.E [R2.64], R7 ; /* 0x0000000702007986 */
/* 0x000fe2000c101904 */
/*0a50*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*0a60*/ BRA 0xa60; /* 0xfffffff000007947 */
/* 0x000fc0000383ffff */
/*0a70*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0a80*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0a90*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0aa0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0ab0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0ac0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0ad0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0ae0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0af0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
.......... |
You are a helpful coding assistant specialized in converting CUDA source code to CUDA host assembly. | #include <iostream>
#include <chrono>
__global__ void polynomial_expansion (float* poly,int degree,int n,float* array)
{
int INX=blockIdx.x*blockDim.x+threadIdx.x;
if(INX<n)
{
float val=0.0;
float exp=1.0;
for(int x=0;x<=degree;++x)
{
val+=exp*poly[x];
exp*=array[INX];
}
array[INX]=val;
}
}
int main(int argc, char* argv[])
{
if(argc<3)
{
std::cerr<<"usage: "<<argv[0]<<" n degree"<<std::endl;
return -1;
}
int n=atoi(argv[1]);
int degree=atoi(argv[2]);
int nbiter=1;
float* array=new float[n];
float* poly=new float[degree+1];
for(int i=0;i<n;++i)
{
array[i]=1.;
}
for(int i=0;i<degree+1;++i)
{
poly[i]=1.;
}
float *DArr,*PArr;
//start calculating time
std::chrono::time_point<std::chrono::system_clock> start_time,end_time;
start_time = std::chrono::system_clock::now();
cudaMalloc(&DArr,n*sizeof(float));
cudaMalloc(&PArr,(degree+1)*sizeof(float));
cudaMemcpy(DArr,array,n*sizeof(float),cudaMemcpyHostToDevice);
cudaMemcpy(PArr,poly,(degree+1)*sizeof(float),cudaMemcpyHostToDevice);
polynomial_expansion<<<(n+255)/256, 256>>>(PArr,degree,n,DArr);
cudaMemcpy(array,DArr,n*sizeof(float),cudaMemcpyDeviceToHost);
cudaFree(DArr);
cudaFree(PArr);
cudaDeviceSynchronize();
{
bool correct=true;
int ind;
for(int i=0;i<n;++i)
{
if(fabs(array[i]-(degree+1))>0.01)
{
correct=false;
ind=i;
}
}
if(!correct)
std::cerr<<"Result is incorrect. In particular array["<<ind<<"] should be "<<degree+1<<" not "<< array[ind]<<std::endl;
}
// calculate and print time
end_time=std::chrono::system_clock::now();
std::chrono::duration<double> elapsed_time=(end_time-start_time)/nbiter;
std::cout<<n<<" "<<degree<<" "<<elapsed_time.count()<<std::endl;
// free arrays
delete[] array;
delete[] poly;
return 0;
} | .file "tmpxft_00085235_00000000-6_polynomial_gpu.cudafe1.cpp"
.text
#APP
.globl _ZSt21ios_base_library_initv
#NO_APP
.type _ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3779:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaUnregisterFatBinary@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE3779:
.size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
.globl _Z44__device_stub__Z20polynomial_expansionPfiiS_PfiiS_
.type _Z44__device_stub__Z20polynomial_expansionPfiiS_PfiiS_, @function
_Z44__device_stub__Z20polynomial_expansionPfiiS_PfiiS_:
.LFB3801:
.cfi_startproc
endbr64
subq $152, %rsp
.cfi_def_cfa_offset 160
movq %rdi, 24(%rsp)
movl %esi, 20(%rsp)
movl %edx, 16(%rsp)
movq %rcx, 8(%rsp)
movq %fs:40, %rax
movq %rax, 136(%rsp)
xorl %eax, %eax
leaq 24(%rsp), %rax
movq %rax, 96(%rsp)
leaq 20(%rsp), %rax
movq %rax, 104(%rsp)
leaq 16(%rsp), %rax
movq %rax, 112(%rsp)
leaq 8(%rsp), %rax
movq %rax, 120(%rsp)
movl $1, 48(%rsp)
movl $1, 52(%rsp)
movl $1, 56(%rsp)
movl $1, 60(%rsp)
movl $1, 64(%rsp)
movl $1, 68(%rsp)
leaq 40(%rsp), %rcx
leaq 32(%rsp), %rdx
leaq 60(%rsp), %rsi
leaq 48(%rsp), %rdi
call __cudaPopCallConfiguration@PLT
testl %eax, %eax
je .L7
.L3:
movq 136(%rsp), %rax
subq %fs:40, %rax
jne .L8
addq $152, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 8
ret
.L7:
.cfi_restore_state
pushq 40(%rsp)
.cfi_def_cfa_offset 168
pushq 40(%rsp)
.cfi_def_cfa_offset 176
leaq 112(%rsp), %r9
movq 76(%rsp), %rcx
movl 84(%rsp), %r8d
movq 64(%rsp), %rsi
movl 72(%rsp), %edx
leaq _Z20polynomial_expansionPfiiS_(%rip), %rdi
call cudaLaunchKernel@PLT
addq $16, %rsp
.cfi_def_cfa_offset 160
jmp .L3
.L8:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE3801:
.size _Z44__device_stub__Z20polynomial_expansionPfiiS_PfiiS_, .-_Z44__device_stub__Z20polynomial_expansionPfiiS_PfiiS_
.globl _Z20polynomial_expansionPfiiS_
.type _Z20polynomial_expansionPfiiS_, @function
_Z20polynomial_expansionPfiiS_:
.LFB3802:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
call _Z44__device_stub__Z20polynomial_expansionPfiiS_PfiiS_
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE3802:
.size _Z20polynomial_expansionPfiiS_, .-_Z20polynomial_expansionPfiiS_
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "usage: "
.LC1:
.string " n degree"
.section .rodata.str1.8,"aMS",@progbits,1
.align 8
.LC5:
.string "Result is incorrect. In particular array["
.section .rodata.str1.1
.LC6:
.string "] should be "
.LC7:
.string " not "
.LC9:
.string " "
.text
.globl main
.type main, @function
main:
.LFB3768:
.cfi_startproc
endbr64
pushq %r15
.cfi_def_cfa_offset 16
.cfi_offset 15, -16
pushq %r14
.cfi_def_cfa_offset 24
.cfi_offset 14, -24
pushq %r13
.cfi_def_cfa_offset 32
.cfi_offset 13, -32
pushq %r12
.cfi_def_cfa_offset 40
.cfi_offset 12, -40
pushq %rbp
.cfi_def_cfa_offset 48
.cfi_offset 6, -48
pushq %rbx
.cfi_def_cfa_offset 56
.cfi_offset 3, -56
subq $88, %rsp
.cfi_def_cfa_offset 144
movq %rsi, %rbp
movq %fs:40, %rax
movq %rax, 72(%rsp)
xorl %eax, %eax
cmpl $2, %edi
jle .L36
movq 8(%rsi), %rdi
movl $10, %edx
movl $0, %esi
call __isoc23_strtol@PLT
movq %rax, %r12
movl %eax, 16(%rsp)
movq 16(%rbp), %rdi
movl $10, %edx
movl $0, %esi
call __isoc23_strtol@PLT
movq %rax, %r15
movq %rax, 24(%rsp)
movl %eax, 12(%rsp)
movslq %r12d, %r13
movabsq $2305843009213693950, %rax
cmpq %r13, %rax
jb .L14
salq $2, %r13
movq %r13, %rdi
call _Znam@PLT
movq %rax, %rbp
movl %r15d, %eax
addl $1, %eax
movl %eax, 20(%rsp)
movslq %eax, %r14
movabsq $2305843009213693950, %rax
cmpq %r14, %rax
jb .L37
salq $2, %r14
movq %r14, %rdi
call _Znam@PLT
movq %rax, %r15
testl %r12d, %r12d
jle .L19
movq %rbp, %rax
leal -1(%r12), %edx
leaq 4(%rbp,%rdx,4), %rdx
movss .LC2(%rip), %xmm0
.L21:
movss %xmm0, (%rax)
addq $4, %rax
cmpq %rdx, %rax
jne .L21
.L19:
movq 24(%rsp), %rcx
testl %ecx, %ecx
js .L22
movq %r15, %rax
movl %ecx, %edx
leaq 4(%r15,%rdx,4), %rdx
movss .LC2(%rip), %xmm0
.L23:
movss %xmm0, (%rax)
addq $4, %rax
cmpq %rdx, %rax
jne .L23
.L22:
call _ZNSt6chrono3_V212system_clock3nowEv@PLT
movq %rax, 24(%rsp)
leaq 32(%rsp), %rdi
movq %r13, %rsi
call cudaMalloc@PLT
leaq 40(%rsp), %rdi
movq %r14, %rsi
call cudaMalloc@PLT
movl $1, %ecx
movq %r13, %rdx
movq %rbp, %rsi
movq 32(%rsp), %rdi
call cudaMemcpy@PLT
movl $1, %ecx
movq %r14, %rdx
movq %r15, %rsi
movq 40(%rsp), %rdi
call cudaMemcpy@PLT
movl $256, 60(%rsp)
movl $1, 64(%rsp)
leal 510(%r12), %eax
movl %r12d, %edx
addl $255, %edx
cmovns %edx, %eax
sarl $8, %eax
movl %eax, 48(%rsp)
movl $1, 52(%rsp)
movl $0, %r9d
movl $0, %r8d
movq 60(%rsp), %rdx
movl $1, %ecx
movq 48(%rsp), %rdi
movl $1, %esi
call __cudaPushCallConfiguration@PLT
testl %eax, %eax
je .L38
.L24:
movl $2, %ecx
movq %r13, %rdx
movq 32(%rsp), %rsi
movq %rbp, %rdi
call cudaMemcpy@PLT
movq 32(%rsp), %rdi
call cudaFree@PLT
movq 40(%rsp), %rdi
call cudaFree@PLT
call cudaDeviceSynchronize@PLT
testl %r12d, %r12d
jle .L25
leal -1(%r12), %edi
movl $0, %eax
movl $1, %edx
pxor %xmm3, %xmm3
cvtsi2ssl 20(%rsp), %xmm3
movss .LC3(%rip), %xmm2
movsd .LC4(%rip), %xmm1
movl $0, %esi
jmp .L28
.L36:
leaq .LC0(%rip), %rsi
leaq _ZSt4cerr(%rip), %rdi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
movq %rax, %rdi
movq 0(%rbp), %rsi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
movq %rax, %rdi
leaq .LC1(%rip), %rsi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
movq %rax, %rdi
call _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
movl $-1, %eax
jmp .L11
.L14:
movq 72(%rsp), %rax
subq %fs:40, %rax
je .L17
call __stack_chk_fail@PLT
.L17:
call __cxa_throw_bad_array_new_length@PLT
.L37:
movq 72(%rsp), %rax
subq %fs:40, %rax
je .L20
call __stack_chk_fail@PLT
.L20:
call __cxa_throw_bad_array_new_length@PLT
.L38:
movq 32(%rsp), %rcx
movl 16(%rsp), %edx
movl 12(%rsp), %esi
movq 40(%rsp), %rdi
call _Z44__device_stub__Z20polynomial_expansionPfiiS_PfiiS_
jmp .L24
.L30:
movq %rcx, %rax
.L28:
movss 0(%rbp,%rax,4), %xmm0
subss %xmm3, %xmm0
andps %xmm2, %xmm0
cvtss2sd %xmm0, %xmm0
comisd %xmm1, %xmm0
cmova %eax, %ebx
cmova %esi, %edx
leaq 1(%rax), %rcx
cmpq %rax, %rdi
jne .L30
testb %dl, %dl
je .L39
.L25:
call _ZNSt6chrono3_V212system_clock3nowEv@PLT
movq 24(%rsp), %rbx
subq %rbx, %rax
pxor %xmm0, %xmm0
cvtsi2sdq %rax, %xmm0
divsd .LC8(%rip), %xmm0
movq %xmm0, %rbx
movl 16(%rsp), %esi
leaq _ZSt4cout(%rip), %rdi
call _ZNSolsEi@PLT
movq %rax, %rdi
leaq .LC9(%rip), %r12
movq %r12, %rsi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
movq %rax, %rdi
movl 12(%rsp), %esi
call _ZNSolsEi@PLT
movq %rax, %rdi
movq %r12, %rsi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
movq %rax, %rdi
movq %rbx, %xmm0
call _ZNSo9_M_insertIdEERSoT_@PLT
movq %rax, %rdi
call _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
movq %rbp, %rdi
call _ZdaPv@PLT
movq %r15, %rdi
call _ZdaPv@PLT
movl $0, %eax
.L11:
movq 72(%rsp), %rdx
subq %fs:40, %rdx
jne .L40
addq $88, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 56
popq %rbx
.cfi_def_cfa_offset 48
popq %rbp
.cfi_def_cfa_offset 40
popq %r12
.cfi_def_cfa_offset 32
popq %r13
.cfi_def_cfa_offset 24
popq %r14
.cfi_def_cfa_offset 16
popq %r15
.cfi_def_cfa_offset 8
ret
.L39:
.cfi_restore_state
leaq .LC5(%rip), %rsi
leaq _ZSt4cerr(%rip), %rdi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
movq %rax, %rdi
movl %ebx, %esi
call _ZNSolsEi@PLT
movq %rax, %rdi
leaq .LC6(%rip), %rsi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
movq %rax, %rdi
movl 20(%rsp), %esi
call _ZNSolsEi@PLT
movq %rax, %rdi
leaq .LC7(%rip), %rsi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
movq %rax, %rdi
movslq %ebx, %rbx
pxor %xmm0, %xmm0
cvtss2sd 0(%rbp,%rbx,4), %xmm0
call _ZNSo9_M_insertIdEERSoT_@PLT
movq %rax, %rdi
call _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
jmp .L25
.L40:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE3768:
.size main, .-main
.section .rodata.str1.8
.align 8
.LC10:
.string "_Z20polynomial_expansionPfiiS_"
.text
.type _ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3804:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
leaq _ZL15__fatDeviceText(%rip), %rdi
call __cudaRegisterFatBinary@PLT
movq %rax, %rdi
movq %rax, _ZL20__cudaFatCubinHandle(%rip)
pushq $0
.cfi_def_cfa_offset 24
pushq $0
.cfi_def_cfa_offset 32
pushq $0
.cfi_def_cfa_offset 40
pushq $0
.cfi_def_cfa_offset 48
movl $0, %r9d
movl $-1, %r8d
leaq .LC10(%rip), %rdx
movq %rdx, %rcx
leaq _Z20polynomial_expansionPfiiS_(%rip), %rsi
call __cudaRegisterFunction@PLT
addq $32, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaRegisterFatBinaryEnd@PLT
leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
call atexit@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE3804:
.size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
.section .init_array,"aw"
.align 8
.quad _ZL24__sti____cudaRegisterAllv
.section .nvFatBinSegment,"aw"
.align 8
.type _ZL15__fatDeviceText, @object
.size _ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
.long 1180844977
.long 1
.quad fatbinData
.quad 0
.local _ZL20__cudaFatCubinHandle
.comm _ZL20__cudaFatCubinHandle,8,8
.section .rodata.cst4,"aM",@progbits,4
.align 4
.LC2:
.long 1065353216
.section .rodata.cst16,"aM",@progbits,16
.align 16
.LC3:
.long 2147483647
.long 0
.long 0
.long 0
.section .rodata.cst8,"aM",@progbits,8
.align 8
.LC4:
.long 1202590843
.long 1065646817
.align 8
.LC8:
.long 0
.long 1104006501
.ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
.section .note.GNU-stack,"",@progbits
.section .note.gnu.property,"a"
.align 8
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.string "GNU"
1:
.align 8
.long 0xc0000002
.long 3f - 2f
2:
.long 0x3
3:
.align 8
4: |
You are a helpful coding assistant specialized in converting CUDA source code to HIP/AMD source code. | #include <iostream>
#include <chrono>
__global__ void polynomial_expansion (float* poly,int degree,int n,float* array)
{
int INX=blockIdx.x*blockDim.x+threadIdx.x;
if(INX<n)
{
float val=0.0;
float exp=1.0;
for(int x=0;x<=degree;++x)
{
val+=exp*poly[x];
exp*=array[INX];
}
array[INX]=val;
}
}
int main(int argc, char* argv[])
{
if(argc<3)
{
std::cerr<<"usage: "<<argv[0]<<" n degree"<<std::endl;
return -1;
}
int n=atoi(argv[1]);
int degree=atoi(argv[2]);
int nbiter=1;
float* array=new float[n];
float* poly=new float[degree+1];
for(int i=0;i<n;++i)
{
array[i]=1.;
}
for(int i=0;i<degree+1;++i)
{
poly[i]=1.;
}
float *DArr,*PArr;
//start calculating time
std::chrono::time_point<std::chrono::system_clock> start_time,end_time;
start_time = std::chrono::system_clock::now();
cudaMalloc(&DArr,n*sizeof(float));
cudaMalloc(&PArr,(degree+1)*sizeof(float));
cudaMemcpy(DArr,array,n*sizeof(float),cudaMemcpyHostToDevice);
cudaMemcpy(PArr,poly,(degree+1)*sizeof(float),cudaMemcpyHostToDevice);
polynomial_expansion<<<(n+255)/256, 256>>>(PArr,degree,n,DArr);
cudaMemcpy(array,DArr,n*sizeof(float),cudaMemcpyDeviceToHost);
cudaFree(DArr);
cudaFree(PArr);
cudaDeviceSynchronize();
{
bool correct=true;
int ind;
for(int i=0;i<n;++i)
{
if(fabs(array[i]-(degree+1))>0.01)
{
correct=false;
ind=i;
}
}
if(!correct)
std::cerr<<"Result is incorrect. In particular array["<<ind<<"] should be "<<degree+1<<" not "<< array[ind]<<std::endl;
}
// calculate and print time
end_time=std::chrono::system_clock::now();
std::chrono::duration<double> elapsed_time=(end_time-start_time)/nbiter;
std::cout<<n<<" "<<degree<<" "<<elapsed_time.count()<<std::endl;
// free arrays
delete[] array;
delete[] poly;
return 0;
} | #include <hip/hip_runtime.h>
#include <iostream>
#include <chrono>
__global__ void polynomial_expansion (float* poly,int degree,int n,float* array)
{
int INX=blockIdx.x*blockDim.x+threadIdx.x;
if(INX<n)
{
float val=0.0;
float exp=1.0;
for(int x=0;x<=degree;++x)
{
val+=exp*poly[x];
exp*=array[INX];
}
array[INX]=val;
}
}
int main(int argc, char* argv[])
{
if(argc<3)
{
std::cerr<<"usage: "<<argv[0]<<" n degree"<<std::endl;
return -1;
}
int n=atoi(argv[1]);
int degree=atoi(argv[2]);
int nbiter=1;
float* array=new float[n];
float* poly=new float[degree+1];
for(int i=0;i<n;++i)
{
array[i]=1.;
}
for(int i=0;i<degree+1;++i)
{
poly[i]=1.;
}
float *DArr,*PArr;
//start calculating time
std::chrono::time_point<std::chrono::system_clock> start_time,end_time;
start_time = std::chrono::system_clock::now();
hipMalloc(&DArr,n*sizeof(float));
hipMalloc(&PArr,(degree+1)*sizeof(float));
hipMemcpy(DArr,array,n*sizeof(float),hipMemcpyHostToDevice);
hipMemcpy(PArr,poly,(degree+1)*sizeof(float),hipMemcpyHostToDevice);
polynomial_expansion<<<(n+255)/256, 256>>>(PArr,degree,n,DArr);
hipMemcpy(array,DArr,n*sizeof(float),hipMemcpyDeviceToHost);
hipFree(DArr);
hipFree(PArr);
hipDeviceSynchronize();
{
bool correct=true;
int ind;
for(int i=0;i<n;++i)
{
if(fabs(array[i]-(degree+1))>0.01)
{
correct=false;
ind=i;
}
}
if(!correct)
std::cerr<<"Result is incorrect. In particular array["<<ind<<"] should be "<<degree+1<<" not "<< array[ind]<<std::endl;
}
// calculate and print time
end_time=std::chrono::system_clock::now();
std::chrono::duration<double> elapsed_time=(end_time-start_time)/nbiter;
std::cout<<n<<" "<<degree<<" "<<elapsed_time.count()<<std::endl;
// free arrays
delete[] array;
delete[] poly;
return 0;
} |
You are a helpful coding assistant specialized in converting HIP source code to AMD device assembly. | #include <hip/hip_runtime.h>
#include <iostream>
#include <chrono>
__global__ void polynomial_expansion (float* poly,int degree,int n,float* array)
{
int INX=blockIdx.x*blockDim.x+threadIdx.x;
if(INX<n)
{
float val=0.0;
float exp=1.0;
for(int x=0;x<=degree;++x)
{
val+=exp*poly[x];
exp*=array[INX];
}
array[INX]=val;
}
}
int main(int argc, char* argv[])
{
if(argc<3)
{
std::cerr<<"usage: "<<argv[0]<<" n degree"<<std::endl;
return -1;
}
int n=atoi(argv[1]);
int degree=atoi(argv[2]);
int nbiter=1;
float* array=new float[n];
float* poly=new float[degree+1];
for(int i=0;i<n;++i)
{
array[i]=1.;
}
for(int i=0;i<degree+1;++i)
{
poly[i]=1.;
}
float *DArr,*PArr;
//start calculating time
std::chrono::time_point<std::chrono::system_clock> start_time,end_time;
start_time = std::chrono::system_clock::now();
hipMalloc(&DArr,n*sizeof(float));
hipMalloc(&PArr,(degree+1)*sizeof(float));
hipMemcpy(DArr,array,n*sizeof(float),hipMemcpyHostToDevice);
hipMemcpy(PArr,poly,(degree+1)*sizeof(float),hipMemcpyHostToDevice);
polynomial_expansion<<<(n+255)/256, 256>>>(PArr,degree,n,DArr);
hipMemcpy(array,DArr,n*sizeof(float),hipMemcpyDeviceToHost);
hipFree(DArr);
hipFree(PArr);
hipDeviceSynchronize();
{
bool correct=true;
int ind;
for(int i=0;i<n;++i)
{
if(fabs(array[i]-(degree+1))>0.01)
{
correct=false;
ind=i;
}
}
if(!correct)
std::cerr<<"Result is incorrect. In particular array["<<ind<<"] should be "<<degree+1<<" not "<< array[ind]<<std::endl;
}
// calculate and print time
end_time=std::chrono::system_clock::now();
std::chrono::duration<double> elapsed_time=(end_time-start_time)/nbiter;
std::cout<<n<<" "<<degree<<" "<<elapsed_time.count()<<std::endl;
// free arrays
delete[] array;
delete[] poly;
return 0;
} | .text
.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
.protected _Z20polynomial_expansionPfiiS_
.globl _Z20polynomial_expansionPfiiS_
.p2align 8
.type _Z20polynomial_expansionPfiiS_,@function
_Z20polynomial_expansionPfiiS_:
s_clause 0x1
s_load_b32 s2, s[0:1], 0x24
s_load_b32 s3, s[0:1], 0xc
s_waitcnt lgkmcnt(0)
s_and_b32 s2, s2, 0xffff
s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
s_mov_b32 s2, exec_lo
v_cmpx_gt_i32_e64 s3, v1
s_cbranch_execz .LBB0_5
s_clause 0x1
s_load_b32 s4, s[0:1], 0x8
s_load_b64 s[2:3], s[0:1], 0x10
v_mov_b32_e32 v0, 0
v_ashrrev_i32_e32 v2, 31, v1
s_waitcnt lgkmcnt(0)
s_cmp_lt_i32 s4, 0
s_cbranch_scc1 .LBB0_4
s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_2)
v_lshlrev_b64 v[3:4], 2, v[1:2]
s_load_b64 s[0:1], s[0:1], 0x0
v_mov_b32_e32 v0, 0
s_add_i32 s4, s4, 1
v_add_co_u32 v3, vcc_lo, s2, v3
s_delay_alu instid0(VALU_DEP_3)
v_add_co_ci_u32_e32 v4, vcc_lo, s3, v4, vcc_lo
global_load_b32 v3, v[3:4], off
v_mov_b32_e32 v4, 1.0
.LBB0_3:
s_waitcnt lgkmcnt(0)
s_load_b32 s5, s[0:1], 0x0
s_add_i32 s4, s4, -1
s_add_u32 s0, s0, 4
s_addc_u32 s1, s1, 0
s_cmp_eq_u32 s4, 0
s_waitcnt lgkmcnt(0)
v_fmac_f32_e32 v0, s5, v4
s_waitcnt vmcnt(0)
v_mul_f32_e32 v4, v4, v3
s_cbranch_scc0 .LBB0_3
.LBB0_4:
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_lshlrev_b64 v[1:2], 2, v[1:2]
v_add_co_u32 v1, vcc_lo, s2, v1
s_delay_alu instid0(VALU_DEP_2)
v_add_co_ci_u32_e32 v2, vcc_lo, s3, v2, vcc_lo
global_store_b32 v[1:2], v0, off
.LBB0_5:
s_nop 0
s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
s_endpgm
.section .rodata,"a",@progbits
.p2align 6, 0x0
.amdhsa_kernel _Z20polynomial_expansionPfiiS_
.amdhsa_group_segment_fixed_size 0
.amdhsa_private_segment_fixed_size 0
.amdhsa_kernarg_size 280
.amdhsa_user_sgpr_count 15
.amdhsa_user_sgpr_dispatch_ptr 0
.amdhsa_user_sgpr_queue_ptr 0
.amdhsa_user_sgpr_kernarg_segment_ptr 1
.amdhsa_user_sgpr_dispatch_id 0
.amdhsa_user_sgpr_private_segment_size 0
.amdhsa_wavefront_size32 1
.amdhsa_uses_dynamic_stack 0
.amdhsa_enable_private_segment 0
.amdhsa_system_sgpr_workgroup_id_x 1
.amdhsa_system_sgpr_workgroup_id_y 0
.amdhsa_system_sgpr_workgroup_id_z 0
.amdhsa_system_sgpr_workgroup_info 0
.amdhsa_system_vgpr_workitem_id 0
.amdhsa_next_free_vgpr 5
.amdhsa_next_free_sgpr 16
.amdhsa_float_round_mode_32 0
.amdhsa_float_round_mode_16_64 0
.amdhsa_float_denorm_mode_32 3
.amdhsa_float_denorm_mode_16_64 3
.amdhsa_dx10_clamp 1
.amdhsa_ieee_mode 1
.amdhsa_fp16_overflow 0
.amdhsa_workgroup_processor_mode 1
.amdhsa_memory_ordered 1
.amdhsa_forward_progress 0
.amdhsa_shared_vgpr_count 0
.amdhsa_exception_fp_ieee_invalid_op 0
.amdhsa_exception_fp_denorm_src 0
.amdhsa_exception_fp_ieee_div_zero 0
.amdhsa_exception_fp_ieee_overflow 0
.amdhsa_exception_fp_ieee_underflow 0
.amdhsa_exception_fp_ieee_inexact 0
.amdhsa_exception_int_div_zero 0
.end_amdhsa_kernel
.text
.Lfunc_end0:
.size _Z20polynomial_expansionPfiiS_, .Lfunc_end0-_Z20polynomial_expansionPfiiS_
.section .AMDGPU.csdata,"",@progbits
.text
.p2alignl 7, 3214868480
.fill 96, 4, 3214868480
.type __hip_cuid_,@object
.section .bss,"aw",@nobits
.globl __hip_cuid_
__hip_cuid_:
.byte 0
.size __hip_cuid_, 1
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym __hip_cuid_
.amdgpu_metadata
---
amdhsa.kernels:
- .args:
- .address_space: global
.offset: 0
.size: 8
.value_kind: global_buffer
- .offset: 8
.size: 4
.value_kind: by_value
- .offset: 12
.size: 4
.value_kind: by_value
- .address_space: global
.offset: 16
.size: 8
.value_kind: global_buffer
- .offset: 24
.size: 4
.value_kind: hidden_block_count_x
- .offset: 28
.size: 4
.value_kind: hidden_block_count_y
- .offset: 32
.size: 4
.value_kind: hidden_block_count_z
- .offset: 36
.size: 2
.value_kind: hidden_group_size_x
- .offset: 38
.size: 2
.value_kind: hidden_group_size_y
- .offset: 40
.size: 2
.value_kind: hidden_group_size_z
- .offset: 42
.size: 2
.value_kind: hidden_remainder_x
- .offset: 44
.size: 2
.value_kind: hidden_remainder_y
- .offset: 46
.size: 2
.value_kind: hidden_remainder_z
- .offset: 64
.size: 8
.value_kind: hidden_global_offset_x
- .offset: 72
.size: 8
.value_kind: hidden_global_offset_y
- .offset: 80
.size: 8
.value_kind: hidden_global_offset_z
- .offset: 88
.size: 2
.value_kind: hidden_grid_dims
.group_segment_fixed_size: 0
.kernarg_segment_align: 8
.kernarg_segment_size: 280
.language: OpenCL C
.language_version:
- 2
- 0
.max_flat_workgroup_size: 1024
.name: _Z20polynomial_expansionPfiiS_
.private_segment_fixed_size: 0
.sgpr_count: 18
.sgpr_spill_count: 0
.symbol: _Z20polynomial_expansionPfiiS_.kd
.uniform_work_group_size: 1
.uses_dynamic_stack: false
.vgpr_count: 5
.vgpr_spill_count: 0
.wavefront_size: 32
.workgroup_processor_mode: 1
amdhsa.target: amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
- 1
- 2
...
.end_amdgpu_metadata |
You are a helpful coding assistant specialized in converting HIP source code to AMD host assembly. | #include <hip/hip_runtime.h>
#include <iostream>
#include <chrono>
__global__ void polynomial_expansion (float* poly,int degree,int n,float* array)
{
int INX=blockIdx.x*blockDim.x+threadIdx.x;
if(INX<n)
{
float val=0.0;
float exp=1.0;
for(int x=0;x<=degree;++x)
{
val+=exp*poly[x];
exp*=array[INX];
}
array[INX]=val;
}
}
int main(int argc, char* argv[])
{
if(argc<3)
{
std::cerr<<"usage: "<<argv[0]<<" n degree"<<std::endl;
return -1;
}
int n=atoi(argv[1]);
int degree=atoi(argv[2]);
int nbiter=1;
float* array=new float[n];
float* poly=new float[degree+1];
for(int i=0;i<n;++i)
{
array[i]=1.;
}
for(int i=0;i<degree+1;++i)
{
poly[i]=1.;
}
float *DArr,*PArr;
//start calculating time
std::chrono::time_point<std::chrono::system_clock> start_time,end_time;
start_time = std::chrono::system_clock::now();
hipMalloc(&DArr,n*sizeof(float));
hipMalloc(&PArr,(degree+1)*sizeof(float));
hipMemcpy(DArr,array,n*sizeof(float),hipMemcpyHostToDevice);
hipMemcpy(PArr,poly,(degree+1)*sizeof(float),hipMemcpyHostToDevice);
polynomial_expansion<<<(n+255)/256, 256>>>(PArr,degree,n,DArr);
hipMemcpy(array,DArr,n*sizeof(float),hipMemcpyDeviceToHost);
hipFree(DArr);
hipFree(PArr);
hipDeviceSynchronize();
{
bool correct=true;
int ind;
for(int i=0;i<n;++i)
{
if(fabs(array[i]-(degree+1))>0.01)
{
correct=false;
ind=i;
}
}
if(!correct)
std::cerr<<"Result is incorrect. In particular array["<<ind<<"] should be "<<degree+1<<" not "<< array[ind]<<std::endl;
}
// calculate and print time
end_time=std::chrono::system_clock::now();
std::chrono::duration<double> elapsed_time=(end_time-start_time)/nbiter;
std::cout<<n<<" "<<degree<<" "<<elapsed_time.count()<<std::endl;
// free arrays
delete[] array;
delete[] poly;
return 0;
} | .text
.file "polynomial_gpu.hip"
# Start of file scope inline assembly
.globl _ZSt21ios_base_library_initv
# End of file scope inline assembly
.globl _Z35__device_stub__polynomial_expansionPfiiS_ # -- Begin function _Z35__device_stub__polynomial_expansionPfiiS_
.p2align 4, 0x90
.type _Z35__device_stub__polynomial_expansionPfiiS_,@function
_Z35__device_stub__polynomial_expansionPfiiS_: # @_Z35__device_stub__polynomial_expansionPfiiS_
.cfi_startproc
# %bb.0:
subq $120, %rsp
.cfi_def_cfa_offset 128
movq %rdi, 72(%rsp)
movl %esi, 12(%rsp)
movl %edx, 8(%rsp)
movq %rcx, 64(%rsp)
leaq 72(%rsp), %rax
movq %rax, 80(%rsp)
leaq 12(%rsp), %rax
movq %rax, 88(%rsp)
leaq 8(%rsp), %rax
movq %rax, 96(%rsp)
leaq 64(%rsp), %rax
movq %rax, 104(%rsp)
leaq 48(%rsp), %rdi
leaq 32(%rsp), %rsi
leaq 24(%rsp), %rdx
leaq 16(%rsp), %rcx
callq __hipPopCallConfiguration
movq 48(%rsp), %rsi
movl 56(%rsp), %edx
movq 32(%rsp), %rcx
movl 40(%rsp), %r8d
leaq 80(%rsp), %r9
movl $_Z20polynomial_expansionPfiiS_, %edi
pushq 16(%rsp)
.cfi_adjust_cfa_offset 8
pushq 32(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $136, %rsp
.cfi_adjust_cfa_offset -136
retq
.Lfunc_end0:
.size _Z35__device_stub__polynomial_expansionPfiiS_, .Lfunc_end0-_Z35__device_stub__polynomial_expansionPfiiS_
.cfi_endproc
# -- End function
.section .rodata.cst16,"aM",@progbits,16
.p2align 4, 0x0 # -- Begin function main
.LCPI1_0:
.long 0x7fffffff # float NaN
.long 0x7fffffff # float NaN
.long 0x7fffffff # float NaN
.long 0x7fffffff # float NaN
.section .rodata.cst8,"aM",@progbits,8
.p2align 3, 0x0
.LCPI1_1:
.quad 0x3f847ae147ae147b # double 0.01
.LCPI1_2:
.quad 0x41cdcd6500000000 # double 1.0E+9
.text
.globl main
.p2align 4, 0x90
.type main,@function
main: # @main
.cfi_startproc
# %bb.0:
pushq %rbp
.cfi_def_cfa_offset 16
pushq %r15
.cfi_def_cfa_offset 24
pushq %r14
.cfi_def_cfa_offset 32
pushq %r13
.cfi_def_cfa_offset 40
pushq %r12
.cfi_def_cfa_offset 48
pushq %rbx
.cfi_def_cfa_offset 56
subq $152, %rsp
.cfi_def_cfa_offset 208
.cfi_offset %rbx, -56
.cfi_offset %r12, -48
.cfi_offset %r13, -40
.cfi_offset %r14, -32
.cfi_offset %r15, -24
.cfi_offset %rbp, -16
movq %rsi, %rbx
cmpl $2, %edi
jg .LBB1_9
# %bb.1:
movl $_ZSt4cerr, %edi
movl $.L.str, %esi
movl $7, %edx
callq _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
movq (%rbx), %rbx
testq %rbx, %rbx
je .LBB1_2
# %bb.3:
movq %rbx, %rdi
callq strlen
movl $_ZSt4cerr, %edi
movq %rbx, %rsi
movq %rax, %rdx
callq _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
jmp .LBB1_4
.LBB1_9:
movq 8(%rbx), %rdi
xorl %esi, %esi
movl $10, %edx
callq __isoc23_strtol
movq %rax, %r14
movq 16(%rbx), %rdi
xorl %esi, %esi
movl $10, %edx
callq __isoc23_strtol
movq %rax, %r13
movq %r14, 32(%rsp) # 8-byte Spill
movslq %r14d, %r15
leaq (,%r15,4), %rbp
testl %r15d, %r15d
movq $-1, %r14
movq %rbp, %rdi
cmovsq %r14, %rdi
callq _Znam
movq %rax, %rbx
movslq %r13d, %rax
movq %r13, %r12
cmpl $-1, %r13d
leaq 4(,%rax,4), %r13
cmovgeq %r13, %r14
movq %r14, %rdi
callq _Znam
movq %rax, %r14
testl %r15d, %r15d
jle .LBB1_12
# %bb.10: # %.lr.ph.preheader
movl 32(%rsp), %eax # 4-byte Reload
xorl %ecx, %ecx
.p2align 4, 0x90
.LBB1_11: # %.lr.ph
# =>This Inner Loop Header: Depth=1
movl $1065353216, (%rbx,%rcx,4) # imm = 0x3F800000
incq %rcx
cmpq %rcx, %rax
jne .LBB1_11
.LBB1_12: # %.preheader
movq %r12, %r15
testl %r15d, %r15d
js .LBB1_15
# %bb.13: # %.lr.ph78.preheader
movl %r15d, %eax
incl %eax
xorl %ecx, %ecx
.p2align 4, 0x90
.LBB1_14: # %.lr.ph78
# =>This Inner Loop Header: Depth=1
movl $1065353216, (%r14,%rcx,4) # imm = 0x3F800000
incq %rcx
cmpq %rcx, %rax
jne .LBB1_14
.LBB1_15: # %._crit_edge
callq _ZNSt6chrono3_V212system_clock3nowEv
movq %rax, 8(%rsp) # 8-byte Spill
movq %rsp, %rdi
movq %rbp, %rsi
callq hipMalloc
leaq 16(%rsp), %rdi
movq %r13, %rsi
callq hipMalloc
movq (%rsp), %rdi
movq %rbx, %rsi
movq %rbp, %rdx
movl $1, %ecx
callq hipMemcpy
movq 16(%rsp), %rdi
movq %r14, %rsi
movq %r13, %rdx
movl $1, %ecx
callq hipMemcpy
movq 32(%rsp), %r12 # 8-byte Reload
leal 255(%r12), %eax
leal 510(%r12), %edi
testl %eax, %eax
cmovnsl %eax, %edi
sarl $8, %edi
movabsq $4294967296, %rdx # imm = 0x100000000
orq %rdx, %rdi
orq $256, %rdx # imm = 0x100
movl $1, %esi
movl $1, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq __hipPushCallConfiguration
testl %eax, %eax
jne .LBB1_17
# %bb.16:
movq 16(%rsp), %rax
movq (%rsp), %rcx
movq %rax, 104(%rsp)
movl %r15d, 28(%rsp)
movl %r12d, 24(%rsp)
movq %rcx, 96(%rsp)
leaq 104(%rsp), %rax
movq %rax, 112(%rsp)
leaq 28(%rsp), %rax
movq %rax, 120(%rsp)
leaq 24(%rsp), %rax
movq %rax, 128(%rsp)
leaq 96(%rsp), %rax
movq %rax, 136(%rsp)
leaq 80(%rsp), %rdi
leaq 64(%rsp), %rsi
leaq 56(%rsp), %rdx
leaq 48(%rsp), %rcx
callq __hipPopCallConfiguration
movq 80(%rsp), %rsi
movl 88(%rsp), %edx
movq 64(%rsp), %rcx
movl 72(%rsp), %r8d
leaq 112(%rsp), %r9
movl $_Z20polynomial_expansionPfiiS_, %edi
pushq 48(%rsp)
.cfi_adjust_cfa_offset 8
pushq 64(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $16, %rsp
.cfi_adjust_cfa_offset -16
.LBB1_17:
movq %r15, 40(%rsp) # 8-byte Spill
incl %r15d
movq (%rsp), %rsi
movq %rbx, %rdi
movq %rbp, %rdx
movl $2, %ecx
callq hipMemcpy
movq (%rsp), %rdi
callq hipFree
movq 16(%rsp), %rdi
callq hipFree
callq hipDeviceSynchronize
xorl %eax, %eax
testl %r12d, %r12d
jle .LBB1_18
# %bb.24: # %.lr.ph83
cvtsi2ss %r15d, %xmm0
movl %r12d, %ecx
movb $1, %dl
movaps .LCPI1_0(%rip), %xmm1 # xmm1 = [NaN,NaN,NaN,NaN]
movsd .LCPI1_1(%rip), %xmm2 # xmm2 = mem[0],zero
xorl %esi, %esi
# implicit-def: $ebp
.p2align 4, 0x90
.LBB1_25: # =>This Inner Loop Header: Depth=1
movss (%rbx,%rsi,4), %xmm3 # xmm3 = mem[0],zero,zero,zero
subss %xmm0, %xmm3
andps %xmm1, %xmm3
cvtss2sd %xmm3, %xmm3
ucomisd %xmm2, %xmm3
movzbl %dl, %edx
cmoval %eax, %edx
cmoval %esi, %ebp
incq %rsi
cmpq %rsi, %rcx
jne .LBB1_25
# %bb.19: # %._crit_edge84.loopexit
testb $1, %dl
sete %al
testb %al, %al
jne .LBB1_21
jmp .LBB1_28
.LBB1_2:
movq _ZSt4cerr(%rip), %rax
movq -24(%rax), %rax
leaq _ZSt4cerr(%rax), %rdi
movl _ZSt4cerr+32(%rax), %esi
orl $1, %esi
callq _ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
.LBB1_4: # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
movl $_ZSt4cerr, %edi
movl $.L.str.1, %esi
movl $9, %edx
callq _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
movq _ZSt4cerr(%rip), %rax
movq -24(%rax), %rax
movq _ZSt4cerr+240(%rax), %rbx
testq %rbx, %rbx
je .LBB1_34
# %bb.5: # %_ZSt13__check_facetISt5ctypeIcEERKT_PS3_.exit.i.i
cmpb $0, 56(%rbx)
je .LBB1_7
# %bb.6:
movzbl 67(%rbx), %eax
jmp .LBB1_8
.LBB1_18:
# implicit-def: $ebp
testb %al, %al
je .LBB1_28
.LBB1_21:
movl $_ZSt4cerr, %edi
movl $.L.str.2, %esi
movl $41, %edx
callq _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
movl $_ZSt4cerr, %edi
movl %ebp, %esi
callq _ZNSolsEi
movq %rax, %r13
movl $.L.str.3, %esi
movl $12, %edx
movq %rax, %rdi
callq _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
movq %r13, %rdi
movl %r15d, %esi
callq _ZNSolsEi
movq %rax, %r13
movl $.L.str.4, %esi
movl $5, %edx
movq %rax, %rdi
callq _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
movslq %ebp, %rax
movss (%rbx,%rax,4), %xmm0 # xmm0 = mem[0],zero,zero,zero
cvtss2sd %xmm0, %xmm0
movq %r13, %rdi
callq _ZNSo9_M_insertIdEERSoT_
movq (%rax), %rcx
movq -24(%rcx), %rcx
movq 240(%rax,%rcx), %r13
testq %r13, %r13
je .LBB1_34
# %bb.22: # %_ZSt13__check_facetISt5ctypeIcEERKT_PS3_.exit.i.i58
cmpb $0, 56(%r13)
je .LBB1_26
# %bb.23:
movzbl 67(%r13), %ecx
jmp .LBB1_27
.LBB1_7:
movq %rbx, %rdi
callq _ZNKSt5ctypeIcE13_M_widen_initEv
movq (%rbx), %rax
movq %rbx, %rdi
movl $10, %esi
callq *48(%rax)
.LBB1_8: # %_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_.exit
movsbl %al, %esi
movl $_ZSt4cerr, %edi
callq _ZNSo3putEc
movq %rax, %rdi
callq _ZNSo5flushEv
movl $-1, %eax
jmp .LBB1_33
.LBB1_26:
movq %r13, %rdi
movq %rax, %rbp
callq _ZNKSt5ctypeIcE13_M_widen_initEv
movq (%r13), %rax
movq %r13, %rdi
movl $10, %esi
callq *48(%rax)
movl %eax, %ecx
movq %rbp, %rax
.LBB1_27: # %_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_.exit61
movsbl %cl, %esi
movq %rax, %rdi
callq _ZNSo3putEc
movq %rax, %rdi
callq _ZNSo5flushEv
.LBB1_28:
callq _ZNSt6chrono3_V212system_clock3nowEv
subq 8(%rsp), %rax # 8-byte Folded Reload
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
divsd .LCPI1_2(%rip), %xmm0
movsd %xmm0, 8(%rsp) # 8-byte Spill
movl $_ZSt4cout, %edi
movl %r12d, %esi
callq _ZNSolsEi
movq %rax, %r12
movl $.L.str.5, %esi
movl $1, %edx
movq %rax, %rdi
callq _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
movq %r12, %rdi
movq 40(%rsp), %rsi # 8-byte Reload
# kill: def $esi killed $esi killed $rsi
callq _ZNSolsEi
movq %rax, %r15
movl $.L.str.5, %esi
movl $1, %edx
movq %rax, %rdi
callq _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
movq %r15, %rdi
movsd 8(%rsp), %xmm0 # 8-byte Reload
# xmm0 = mem[0],zero
callq _ZNSo9_M_insertIdEERSoT_
movq (%rax), %rcx
movq -24(%rcx), %rcx
movq 240(%rax,%rcx), %r15
testq %r15, %r15
je .LBB1_34
# %bb.29: # %_ZSt13__check_facetISt5ctypeIcEERKT_PS3_.exit.i.i63
cmpb $0, 56(%r15)
je .LBB1_31
# %bb.30:
movzbl 67(%r15), %ecx
jmp .LBB1_32
.LBB1_31:
movq %r15, %rdi
movq %rax, %r12
callq _ZNKSt5ctypeIcE13_M_widen_initEv
movq (%r15), %rax
movq %r15, %rdi
movl $10, %esi
callq *48(%rax)
movl %eax, %ecx
movq %r12, %rax
.LBB1_32: # %_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_.exit66
movsbl %cl, %esi
movq %rax, %rdi
callq _ZNSo3putEc
movq %rax, %rdi
callq _ZNSo5flushEv
movq %rbx, %rdi
callq _ZdaPv
movq %r14, %rdi
callq _ZdaPv
xorl %eax, %eax
.LBB1_33:
addq $152, %rsp
.cfi_def_cfa_offset 56
popq %rbx
.cfi_def_cfa_offset 48
popq %r12
.cfi_def_cfa_offset 40
popq %r13
.cfi_def_cfa_offset 32
popq %r14
.cfi_def_cfa_offset 24
popq %r15
.cfi_def_cfa_offset 16
popq %rbp
.cfi_def_cfa_offset 8
retq
.LBB1_34:
.cfi_def_cfa_offset 208
callq _ZSt16__throw_bad_castv
.Lfunc_end1:
.size main, .Lfunc_end1-main
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_ctor
.type __hip_module_ctor,@function
__hip_module_ctor: # @__hip_module_ctor
.cfi_startproc
# %bb.0:
subq $40, %rsp
.cfi_def_cfa_offset 48
cmpq $0, __hip_gpubin_handle(%rip)
jne .LBB2_2
# %bb.1:
movl $__hip_fatbin_wrapper, %edi
callq __hipRegisterFatBinary
movq %rax, __hip_gpubin_handle(%rip)
.LBB2_2:
movq __hip_gpubin_handle(%rip), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 16(%rsp)
movups %xmm0, (%rsp)
movl $_Z20polynomial_expansionPfiiS_, %esi
movl $.L__unnamed_1, %edx
movl $.L__unnamed_1, %ecx
movl $-1, %r8d
xorl %r9d, %r9d
callq __hipRegisterFunction
movl $__hip_module_dtor, %edi
addq $40, %rsp
.cfi_def_cfa_offset 8
jmp atexit # TAILCALL
.Lfunc_end2:
.size __hip_module_ctor, .Lfunc_end2-__hip_module_ctor
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_dtor
.type __hip_module_dtor,@function
__hip_module_dtor: # @__hip_module_dtor
.cfi_startproc
# %bb.0:
movq __hip_gpubin_handle(%rip), %rdi
testq %rdi, %rdi
je .LBB3_2
# %bb.1:
pushq %rax
.cfi_def_cfa_offset 16
callq __hipUnregisterFatBinary
movq $0, __hip_gpubin_handle(%rip)
addq $8, %rsp
.cfi_def_cfa_offset 8
.LBB3_2:
retq
.Lfunc_end3:
.size __hip_module_dtor, .Lfunc_end3-__hip_module_dtor
.cfi_endproc
# -- End function
.type _Z20polynomial_expansionPfiiS_,@object # @_Z20polynomial_expansionPfiiS_
.section .rodata,"a",@progbits
.globl _Z20polynomial_expansionPfiiS_
.p2align 3, 0x0
_Z20polynomial_expansionPfiiS_:
.quad _Z35__device_stub__polynomial_expansionPfiiS_
.size _Z20polynomial_expansionPfiiS_, 8
.type .L.str,@object # @.str
.section .rodata.str1.1,"aMS",@progbits,1
.L.str:
.asciz "usage: "
.size .L.str, 8
.type .L.str.1,@object # @.str.1
.L.str.1:
.asciz " n degree"
.size .L.str.1, 10
.type .L.str.2,@object # @.str.2
.L.str.2:
.asciz "Result is incorrect. In particular array["
.size .L.str.2, 42
.type .L.str.3,@object # @.str.3
.L.str.3:
.asciz "] should be "
.size .L.str.3, 13
.type .L.str.4,@object # @.str.4
.L.str.4:
.asciz " not "
.size .L.str.4, 6
.type .L.str.5,@object # @.str.5
.L.str.5:
.asciz " "
.size .L.str.5, 2
.type .L__unnamed_1,@object # @0
.L__unnamed_1:
.asciz "_Z20polynomial_expansionPfiiS_"
.size .L__unnamed_1, 31
.type __hip_fatbin_wrapper,@object # @__hip_fatbin_wrapper
.section .hipFatBinSegment,"a",@progbits
.p2align 3, 0x0
__hip_fatbin_wrapper:
.long 1212764230 # 0x48495046
.long 1 # 0x1
.quad __hip_fatbin
.quad 0
.size __hip_fatbin_wrapper, 24
.type __hip_gpubin_handle,@object # @__hip_gpubin_handle
.local __hip_gpubin_handle
.comm __hip_gpubin_handle,8,8
.section .init_array,"aw",@init_array
.p2align 3, 0x0
.quad __hip_module_ctor
.type __hip_cuid_,@object # @__hip_cuid_
.bss
.globl __hip_cuid_
__hip_cuid_:
.byte 0 # 0x0
.size __hip_cuid_, 1
.section ".linker-options","e",@llvm_linker_options
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym _Z35__device_stub__polynomial_expansionPfiiS_
.addrsig_sym __gxx_personality_v0
.addrsig_sym __hip_module_ctor
.addrsig_sym __hip_module_dtor
.addrsig_sym _Z20polynomial_expansionPfiiS_
.addrsig_sym _ZSt4cerr
.addrsig_sym _ZSt4cout
.addrsig_sym __hip_fatbin
.addrsig_sym __hip_fatbin_wrapper
.addrsig_sym __hip_cuid_ |
You are a helpful coding assistant specialized in converting from CUDA device assembly to AMD device assembly. | code for sm_80
Function : _Z20polynomial_expansionPfiiS_
.headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)"
/*0000*/ MOV R1, c[0x0][0x28] ; /* 0x00000a0000017a02 */
/* 0x000fe40000000f00 */
/*0010*/ S2R R3, SR_CTAID.X ; /* 0x0000000000037919 */
/* 0x000e280000002500 */
/*0020*/ S2R R0, SR_TID.X ; /* 0x0000000000007919 */
/* 0x000e240000002100 */
/*0030*/ IMAD R3, R3, c[0x0][0x0], R0 ; /* 0x0000000003037a24 */
/* 0x001fca00078e0200 */
/*0040*/ ISETP.GE.AND P0, PT, R3, c[0x0][0x16c], PT ; /* 0x00005b0003007a0c */
/* 0x000fda0003f06270 */
/*0050*/ @P0 EXIT ; /* 0x000000000000094d */
/* 0x000fea0003800000 */
/*0060*/ ISETP.LE.AND P0, PT, RZ, c[0x0][0x168], PT ; /* 0x00005a00ff007a0c */
/* 0x000fe20003f03270 */
/*0070*/ HFMA2.MMA R8, -RZ, RZ, 0, 2.384185791015625e-07 ; /* 0x00000004ff087435 */
/* 0x000fe200000001ff */
/*0080*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */
/* 0x000fd20000000a00 */
/*0090*/ IMAD.WIDE R2, R3, R8, c[0x0][0x170] ; /* 0x00005c0003027625 */
/* 0x000fe400078e0208 */
/*00a0*/ @!P0 BRA 0xa30 ; /* 0x0000098000008947 */
/* 0x000fea0003800000 */
/*00b0*/ MOV R9, c[0x0][0x168] ; /* 0x00005a0000097a02 */
/* 0x000fe20000000f00 */
/*00c0*/ LDG.E R0, [R2.64] ; /* 0x0000000402007981 */
/* 0x000162000c1e1900 */
/*00d0*/ MOV R7, RZ ; /* 0x000000ff00077202 */
/* 0x000fe40000000f00 */
/*00e0*/ ISETP.GE.U32.AND P0, PT, R9.reuse, 0x3, PT ; /* 0x000000030900780c */
/* 0x040fe40003f06070 */
/*00f0*/ IADD3 R9, R9, 0x1, RZ ; /* 0x0000000109097810 */
/* 0x000fe40007ffe0ff */
/*0100*/ MOV R6, 0x3f800000 ; /* 0x3f80000000067802 */
/* 0x000fc40000000f00 */
/*0110*/ MOV R11, RZ ; /* 0x000000ff000b7202 */
/* 0x000fe40000000f00 */
/*0120*/ LOP3.LUT R9, R9, 0x3, RZ, 0xc0, !PT ; /* 0x0000000309097812 */
/* 0x000fca00078ec0ff */
/*0130*/ @!P0 BRA 0x8d0 ; /* 0x0000079000008947 */
/* 0x000fea0003800000 */
/*0140*/ IADD3 R10, -R9, c[0x0][0x168], RZ ; /* 0x00005a00090a7a10 */
/* 0x001fe20007ffe1ff */
/*0150*/ HFMA2.MMA R7, -RZ, RZ, 0, 0 ; /* 0x00000000ff077435 */
/* 0x000fe200000001ff */
/*0160*/ MOV R6, 0x3f800000 ; /* 0x3f80000000067802 */
/* 0x000fe20000000f00 */
/*0170*/ HFMA2.MMA R11, -RZ, RZ, 0, 0 ; /* 0x00000000ff0b7435 */
/* 0x000fe200000001ff */
/*0180*/ ISETP.GT.AND P0, PT, R10, -0x1, PT ; /* 0xffffffff0a00780c */
/* 0x000fe40003f04270 */
/*0190*/ MOV R4, c[0x0][0x160] ; /* 0x0000580000047a02 */
/* 0x000fe40000000f00 */
/*01a0*/ MOV R5, c[0x0][0x164] ; /* 0x0000590000057a02 */
/* 0x000fd20000000f00 */
/*01b0*/ @!P0 BRA 0x790 ; /* 0x000005d000008947 */
/* 0x000fea0003800000 */
/*01c0*/ IADD3 R12, R10, 0x1, RZ ; /* 0x000000010a0c7810 */
/* 0x000fe40007ffe0ff */
/*01d0*/ PLOP3.LUT P0, PT, PT, PT, PT, 0x80, 0x0 ; /* 0x000000000000781c */
/* 0x000fe40003f0f070 */
/*01e0*/ ISETP.GT.AND P1, PT, R12, 0xc, PT ; /* 0x0000000c0c00780c */
/* 0x000fda0003f24270 */
/*01f0*/ @!P1 BRA 0x570 ; /* 0x0000037000009947 */
/* 0x000fea0003800000 */
/*0200*/ PLOP3.LUT P0, PT, PT, PT, PT, 0x8, 0x0 ; /* 0x000000000000781c */
/* 0x000fe40003f0e170 */
/*0210*/ LDG.E R25, [R4.64] ; /* 0x0000000404197981 */
/* 0x000ea8000c1e1900 */
/*0220*/ LDG.E R26, [R4.64+0x4] ; /* 0x00000404041a7981 */
/* 0x000ee8000c1e1900 */
/*0230*/ LDG.E R24, [R4.64+0x8] ; /* 0x0000080404187981 */
/* 0x000f28000c1e1900 */
/*0240*/ LDG.E R23, [R4.64+0xc] ; /* 0x00000c0404177981 */
/* 0x000128000c1e1900 */
/*0250*/ LDG.E R22, [R4.64+0x10] ; /* 0x0000100404167981 */
/* 0x000128000c1e1900 */
/*0260*/ LDG.E R21, [R4.64+0x14] ; /* 0x0000140404157981 */
/* 0x000128000c1e1900 */
/*0270*/ LDG.E R20, [R4.64+0x18] ; /* 0x0000180404147981 */
/* 0x000128000c1e1900 */
/*0280*/ LDG.E R19, [R4.64+0x1c] ; /* 0x00001c0404137981 */
/* 0x000128000c1e1900 */
/*0290*/ LDG.E R18, [R4.64+0x20] ; /* 0x0000200404127981 */
/* 0x000128000c1e1900 */
/*02a0*/ LDG.E R17, [R4.64+0x24] ; /* 0x0000240404117981 */
/* 0x000128000c1e1900 */
/*02b0*/ LDG.E R16, [R4.64+0x28] ; /* 0x0000280404107981 */
/* 0x000128000c1e1900 */
/*02c0*/ LDG.E R15, [R4.64+0x2c] ; /* 0x00002c04040f7981 */
/* 0x000128000c1e1900 */
/*02d0*/ LDG.E R14, [R4.64+0x30] ; /* 0x00003004040e7981 */
/* 0x000128000c1e1900 */
/*02e0*/ LDG.E R13, [R4.64+0x34] ; /* 0x00003404040d7981 */
/* 0x000128000c1e1900 */
/*02f0*/ LDG.E R12, [R4.64+0x38] ; /* 0x00003804040c7981 */
/* 0x000122000c1e1900 */
/*0300*/ FMUL R27, R0, R6 ; /* 0x00000006001b7220 */
/* 0x020fc40000400000 */
/*0310*/ FFMA R25, R25, R6, R7 ; /* 0x0000000619197223 */
/* 0x004fe40000000007 */
/*0320*/ LDG.E R7, [R4.64+0x3c] ; /* 0x00003c0404077981 */
/* 0x0000a2000c1e1900 */
/*0330*/ IADD3 R10, R10, -0x10, RZ ; /* 0xfffffff00a0a7810 */
/* 0x000fe20007ffe0ff */
/*0340*/ FFMA R25, R26, R27.reuse, R25 ; /* 0x0000001b1a197223 */
/* 0x088fe20000000019 */
/*0350*/ IADD3 R11, R11, 0x10, RZ ; /* 0x000000100b0b7810 */
/* 0x000fe20007ffe0ff */
/*0360*/ FMUL R27, R0, R27 ; /* 0x0000001b001b7220 */
/* 0x000fe20000400000 */
/*0370*/ ISETP.GT.AND P1, PT, R10, 0xb, PT ; /* 0x0000000b0a00780c */
/* 0x000fc60003f24270 */
/*0380*/ FFMA R24, R27, R24, R25 ; /* 0x000000181b187223 */
/* 0x010fe40000000019 */
/*0390*/ FMUL R27, R0, R27 ; /* 0x0000001b001b7220 */
/* 0x000fe20000400000 */
/*03a0*/ IADD3 R4, P2, R4, 0x40, RZ ; /* 0x0000004004047810 */
/* 0x001fc60007f5e0ff */
/*03b0*/ FFMA R23, R27, R23, R24 ; /* 0x000000171b177223 */
/* 0x000fe20000000018 */
/*03c0*/ IADD3.X R5, RZ, R5, RZ, P2, !PT ; /* 0x00000005ff057210 */
/* 0x000fe200017fe4ff */
/*03d0*/ FMUL R27, R0, R27 ; /* 0x0000001b001b7220 */
/* 0x000fc80000400000 */
/*03e0*/ FFMA R22, R27, R22, R23 ; /* 0x000000161b167223 */
/* 0x000fe40000000017 */
/*03f0*/ FMUL R27, R0, R27 ; /* 0x0000001b001b7220 */
/* 0x000fc80000400000 */
/*0400*/ FFMA R21, R21, R27.reuse, R22 ; /* 0x0000001b15157223 */
/* 0x080fe40000000016 */
/*0410*/ FMUL R27, R0, R27 ; /* 0x0000001b001b7220 */
/* 0x000fc80000400000 */
/*0420*/ FFMA R20, R27, R20, R21 ; /* 0x000000141b147223 */
/* 0x000fe40000000015 */
/*0430*/ FMUL R27, R0, R27 ; /* 0x0000001b001b7220 */
/* 0x000fc80000400000 */
/*0440*/ FFMA R19, R27, R19, R20 ; /* 0x000000131b137223 */
/* 0x000fe40000000014 */
/*0450*/ FMUL R27, R0, R27 ; /* 0x0000001b001b7220 */
/* 0x000fc80000400000 */
/*0460*/ FFMA R18, R27, R18, R19 ; /* 0x000000121b127223 */
/* 0x000fe40000000013 */
/*0470*/ FMUL R27, R0, R27 ; /* 0x0000001b001b7220 */
/* 0x000fc80000400000 */
/*0480*/ FFMA R17, R17, R27.reuse, R18 ; /* 0x0000001b11117223 */
/* 0x080fe40000000012 */
/*0490*/ FMUL R27, R0, R27 ; /* 0x0000001b001b7220 */
/* 0x000fc80000400000 */
/*04a0*/ FFMA R16, R27, R16, R17 ; /* 0x000000101b107223 */
/* 0x000fe40000000011 */
/*04b0*/ FMUL R27, R0, R27 ; /* 0x0000001b001b7220 */
/* 0x000fc80000400000 */
/*04c0*/ FFMA R15, R27, R15, R16 ; /* 0x0000000f1b0f7223 */
/* 0x000fe40000000010 */
/*04d0*/ FMUL R27, R0, R27 ; /* 0x0000001b001b7220 */
/* 0x000fc80000400000 */
/*04e0*/ FFMA R14, R27, R14, R15 ; /* 0x0000000e1b0e7223 */
/* 0x000fe4000000000f */
/*04f0*/ FMUL R27, R0, R27 ; /* 0x0000001b001b7220 */
/* 0x000fc80000400000 */
/*0500*/ FFMA R13, R13, R27.reuse, R14 ; /* 0x0000001b0d0d7223 */
/* 0x080fe4000000000e */
/*0510*/ FMUL R27, R0, R27 ; /* 0x0000001b001b7220 */
/* 0x000fc80000400000 */
/*0520*/ FFMA R12, R27, R12, R13 ; /* 0x0000000c1b0c7223 */
/* 0x000fe4000000000d */
/*0530*/ FMUL R27, R0, R27 ; /* 0x0000001b001b7220 */
/* 0x000fc80000400000 */
/*0540*/ FMUL R6, R0, R27 ; /* 0x0000001b00067220 */
/* 0x000fe40000400000 */
/*0550*/ FFMA R7, R27, R7, R12 ; /* 0x000000071b077223 */
/* 0x004fe2000000000c */
/*0560*/ @P1 BRA 0x210 ; /* 0xfffffca000001947 */
/* 0x000fea000383ffff */
/*0570*/ IADD3 R12, R10, 0x1, RZ ; /* 0x000000010a0c7810 */
/* 0x000fc80007ffe0ff */
/*0580*/ ISETP.GT.AND P1, PT, R12, 0x4, PT ; /* 0x000000040c00780c */
/* 0x000fda0003f24270 */
/*0590*/ @!P1 BRA 0x770 ; /* 0x000001d000009947 */
/* 0x000fea0003800000 */
/*05a0*/ LDG.E R14, [R4.64] ; /* 0x00000004040e7981 */
/* 0x0000a8000c1e1900 */
/*05b0*/ LDG.E R15, [R4.64+0x4] ; /* 0x00000404040f7981 */
/* 0x0000e8000c1e1900 */
/*05c0*/ LDG.E R16, [R4.64+0x8] ; /* 0x0000080404107981 */
/* 0x000128000c1e1900 */
/*05d0*/ LDG.E R17, [R4.64+0xc] ; /* 0x00000c0404117981 */
/* 0x000128000c1e1900 */
/*05e0*/ LDG.E R18, [R4.64+0x10] ; /* 0x0000100404127981 */
/* 0x000128000c1e1900 */
/*05f0*/ LDG.E R19, [R4.64+0x14] ; /* 0x0000140404137981 */
/* 0x000128000c1e1900 */
/*0600*/ LDG.E R12, [R4.64+0x18] ; /* 0x00001804040c7981 */
/* 0x000128000c1e1900 */
/*0610*/ LDG.E R13, [R4.64+0x1c] ; /* 0x00001c04040d7981 */
/* 0x000122000c1e1900 */
/*0620*/ PLOP3.LUT P0, PT, PT, PT, PT, 0x8, 0x0 ; /* 0x000000000000781c */
/* 0x000fc40003f0e170 */
/*0630*/ IADD3 R11, R11, 0x8, RZ ; /* 0x000000080b0b7810 */
/* 0x000fe40007ffe0ff */
/*0640*/ IADD3 R10, R10, -0x8, RZ ; /* 0xfffffff80a0a7810 */
/* 0x000fe40007ffe0ff */
/*0650*/ IADD3 R4, P1, R4, 0x20, RZ ; /* 0x0000002004047810 */
/* 0x001fc80007f3e0ff */
/*0660*/ IADD3.X R5, RZ, R5, RZ, P1, !PT ; /* 0x00000005ff057210 */
/* 0x000fe20000ffe4ff */
/*0670*/ FFMA R14, R6, R14, R7 ; /* 0x0000000e060e7223 */
/* 0x004fe40000000007 */
/*0680*/ FMUL R7, R0, R6 ; /* 0x0000000600077220 */
/* 0x020fc80000400000 */
/*0690*/ FFMA R14, R15, R7.reuse, R14 ; /* 0x000000070f0e7223 */
/* 0x088fe4000000000e */
/*06a0*/ FMUL R7, R0, R7 ; /* 0x0000000700077220 */
/* 0x000fc80000400000 */
/*06b0*/ FFMA R14, R7, R16, R14 ; /* 0x00000010070e7223 */
/* 0x010fe4000000000e */
/*06c0*/ FMUL R7, R0, R7 ; /* 0x0000000700077220 */
/* 0x000fc80000400000 */
/*06d0*/ FFMA R14, R7, R17, R14 ; /* 0x00000011070e7223 */
/* 0x000fe4000000000e */
/*06e0*/ FMUL R7, R0, R7 ; /* 0x0000000700077220 */
/* 0x000fc80000400000 */
/*06f0*/ FFMA R14, R7, R18, R14 ; /* 0x00000012070e7223 */
/* 0x000fe4000000000e */
/*0700*/ FMUL R7, R0, R7 ; /* 0x0000000700077220 */
/* 0x000fc80000400000 */
/*0710*/ FFMA R19, R19, R7.reuse, R14 ; /* 0x0000000713137223 */
/* 0x080fe4000000000e */
/*0720*/ FMUL R7, R0, R7 ; /* 0x0000000700077220 */
/* 0x000fc80000400000 */
/*0730*/ FFMA R12, R7, R12, R19 ; /* 0x0000000c070c7223 */
/* 0x000fe40000000013 */
/*0740*/ FMUL R15, R0, R7 ; /* 0x00000007000f7220 */
/* 0x000fc80000400000 */
/*0750*/ FFMA R7, R15, R13, R12 ; /* 0x0000000d0f077223 */
/* 0x000fe4000000000c */
/*0760*/ FMUL R6, R0, R15 ; /* 0x0000000f00067220 */
/* 0x000fe40000400000 */
/*0770*/ ISETP.NE.OR P0, PT, R10, -0x1, P0 ; /* 0xffffffff0a00780c */
/* 0x000fda0000705670 */
/*0780*/ @!P0 BRA 0x8d0 ; /* 0x0000014000008947 */
/* 0x000fea0003800000 */
/*0790*/ LDG.E R12, [R4.64] ; /* 0x00000004040c7981 */
/* 0x000ea8000c1e1900 */
/*07a0*/ LDG.E R13, [R4.64+0x4] ; /* 0x00000404040d7981 */
/* 0x000ee8000c1e1900 */
/*07b0*/ LDG.E R15, [R4.64+0x8] ; /* 0x00000804040f7981 */
/* 0x000f28000c1e1900 */
/*07c0*/ LDG.E R17, [R4.64+0xc] ; /* 0x00000c0404117981 */
/* 0x000122000c1e1900 */
/*07d0*/ IADD3 R10, R10, -0x4, RZ ; /* 0xfffffffc0a0a7810 */
/* 0x000fc40007ffe0ff */
/*07e0*/ IADD3 R11, R11, 0x4, RZ ; /* 0x000000040b0b7810 */
/* 0x000fe40007ffe0ff */
/*07f0*/ ISETP.NE.AND P0, PT, R10, -0x1, PT ; /* 0xffffffff0a00780c */
/* 0x000fe20003f05270 */
/*0800*/ FFMA R12, R12, R6.reuse, R7 ; /* 0x000000060c0c7223 */
/* 0x084fe40000000007 */
/*0810*/ FMUL R7, R0, R6 ; /* 0x0000000600077220 */
/* 0x020fc80000400000 */
/*0820*/ FFMA R12, R13, R7.reuse, R12 ; /* 0x000000070d0c7223 */
/* 0x088fe2000000000c */
/*0830*/ IADD3 R13, P1, R4, 0x10, RZ ; /* 0x00000010040d7810 */
/* 0x000fe20007f3e0ff */
/*0840*/ FMUL R7, R0, R7 ; /* 0x0000000700077220 */
/* 0x000fc60000400000 */
/*0850*/ IADD3.X R14, RZ, R5, RZ, P1, !PT ; /* 0x00000005ff0e7210 */
/* 0x000fe20000ffe4ff */
/*0860*/ FFMA R12, R15, R7, R12 ; /* 0x000000070f0c7223 */
/* 0x010fe2000000000c */
/*0870*/ MOV R4, R13 ; /* 0x0000000d00047202 */
/* 0x001fe20000000f00 */
/*0880*/ FMUL R15, R0, R7 ; /* 0x00000007000f7220 */
/* 0x000fe20000400000 */
/*0890*/ MOV R5, R14 ; /* 0x0000000e00057202 */
/* 0x000fc60000000f00 */
/*08a0*/ FFMA R7, R17, R15.reuse, R12 ; /* 0x0000000f11077223 */
/* 0x080fe4000000000c */
/*08b0*/ FMUL R6, R0, R15 ; /* 0x0000000f00067220 */
/* 0x000fe20000400000 */
/*08c0*/ @P0 BRA 0x790 ; /* 0xfffffec000000947 */
/* 0x000fea000383ffff */
/*08d0*/ ISETP.NE.AND P0, PT, R9, RZ, PT ; /* 0x000000ff0900720c */
/* 0x001fda0003f05270 */
/*08e0*/ @!P0 BRA 0xa40 ; /* 0x0000015000008947 */
/* 0x000fea0003800000 */
/*08f0*/ IMAD.WIDE R4, R11, R8, c[0x0][0x160] ; /* 0x000058000b047625 */
/* 0x000fca00078e0208 */
/*0900*/ LDG.E R8, [R4.64] ; /* 0x0000000404087981 */
/* 0x000ea2000c1e1900 */
/*0910*/ IADD3 R9, R9, -0x1, RZ ; /* 0xffffffff09097810 */
/* 0x000fe40007ffe0ff */
/*0920*/ IADD3 R10, P1, R4, 0x4, RZ ; /* 0x00000004040a7810 */
/* 0x000fe40007f3e0ff */
/*0930*/ ISETP.NE.AND P0, PT, R9, RZ, PT ; /* 0x000000ff0900720c */
/* 0x000fe40003f05270 */
/*0940*/ IADD3.X R12, RZ, R5, RZ, P1, !PT ; /* 0x00000005ff0c7210 */
/* 0x000fe20000ffe4ff */
/*0950*/ FFMA R7, R8, R6, R7 ; /* 0x0000000608077223 */
/* 0x004fd40000000007 */
/*0960*/ @!P0 BRA 0xa40 ; /* 0x000000d000008947 */
/* 0x000fea0003800000 */
/*0970*/ FMUL R11, R0, R6 ; /* 0x00000006000b7220 */
/* 0x020fe40000400000 */
/*0980*/ MOV R4, R10 ; /* 0x0000000a00047202 */
/* 0x000fe40000000f00 */
/*0990*/ MOV R5, R12 ; /* 0x0000000c00057202 */
/* 0x000fca0000000f00 */
/*09a0*/ LDG.E R4, [R4.64] ; /* 0x0000000404047981 */
/* 0x000ea2000c1e1900 */
/*09b0*/ IADD3 R9, R9, -0x1, RZ ; /* 0xffffffff09097810 */
/* 0x000fe40007ffe0ff */
/*09c0*/ IADD3 R10, P1, R10, 0x4, RZ ; /* 0x000000040a0a7810 */
/* 0x000fe40007f3e0ff */
/*09d0*/ ISETP.NE.AND P0, PT, R9, RZ, PT ; /* 0x000000ff0900720c */
/* 0x000fe40003f05270 */
/*09e0*/ IADD3.X R12, RZ, R12, RZ, P1, !PT ; /* 0x0000000cff0c7210 */
/* 0x000fe20000ffe4ff */
/*09f0*/ FFMA R7, R4, R11.reuse, R7 ; /* 0x0000000b04077223 */
/* 0x084fe40000000007 */
/*0a00*/ FMUL R11, R0, R11 ; /* 0x0000000b000b7220 */
/* 0x000fd00000400000 */
/*0a10*/ @P0 BRA 0x980 ; /* 0xffffff6000000947 */
/* 0x000fea000383ffff */
/*0a20*/ BRA 0xa40 ; /* 0x0000001000007947 */
/* 0x000fea0003800000 */
/*0a30*/ MOV R7, RZ ; /* 0x000000ff00077202 */
/* 0x000fca0000000f00 */
/*0a40*/ STG.E [R2.64], R7 ; /* 0x0000000702007986 */
/* 0x000fe2000c101904 */
/*0a50*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*0a60*/ BRA 0xa60; /* 0xfffffff000007947 */
/* 0x000fc0000383ffff */
/*0a70*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0a80*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0a90*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0aa0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0ab0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0ac0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0ad0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0ae0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0af0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
.......... | .text
.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
.protected _Z20polynomial_expansionPfiiS_
.globl _Z20polynomial_expansionPfiiS_
.p2align 8
.type _Z20polynomial_expansionPfiiS_,@function
_Z20polynomial_expansionPfiiS_:
s_clause 0x1
s_load_b32 s2, s[0:1], 0x24
s_load_b32 s3, s[0:1], 0xc
s_waitcnt lgkmcnt(0)
s_and_b32 s2, s2, 0xffff
s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
s_mov_b32 s2, exec_lo
v_cmpx_gt_i32_e64 s3, v1
s_cbranch_execz .LBB0_5
s_clause 0x1
s_load_b32 s4, s[0:1], 0x8
s_load_b64 s[2:3], s[0:1], 0x10
v_mov_b32_e32 v0, 0
v_ashrrev_i32_e32 v2, 31, v1
s_waitcnt lgkmcnt(0)
s_cmp_lt_i32 s4, 0
s_cbranch_scc1 .LBB0_4
s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_2)
v_lshlrev_b64 v[3:4], 2, v[1:2]
s_load_b64 s[0:1], s[0:1], 0x0
v_mov_b32_e32 v0, 0
s_add_i32 s4, s4, 1
v_add_co_u32 v3, vcc_lo, s2, v3
s_delay_alu instid0(VALU_DEP_3)
v_add_co_ci_u32_e32 v4, vcc_lo, s3, v4, vcc_lo
global_load_b32 v3, v[3:4], off
v_mov_b32_e32 v4, 1.0
.LBB0_3:
s_waitcnt lgkmcnt(0)
s_load_b32 s5, s[0:1], 0x0
s_add_i32 s4, s4, -1
s_add_u32 s0, s0, 4
s_addc_u32 s1, s1, 0
s_cmp_eq_u32 s4, 0
s_waitcnt lgkmcnt(0)
v_fmac_f32_e32 v0, s5, v4
s_waitcnt vmcnt(0)
v_mul_f32_e32 v4, v4, v3
s_cbranch_scc0 .LBB0_3
.LBB0_4:
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_lshlrev_b64 v[1:2], 2, v[1:2]
v_add_co_u32 v1, vcc_lo, s2, v1
s_delay_alu instid0(VALU_DEP_2)
v_add_co_ci_u32_e32 v2, vcc_lo, s3, v2, vcc_lo
global_store_b32 v[1:2], v0, off
.LBB0_5:
s_nop 0
s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
s_endpgm
.section .rodata,"a",@progbits
.p2align 6, 0x0
.amdhsa_kernel _Z20polynomial_expansionPfiiS_
.amdhsa_group_segment_fixed_size 0
.amdhsa_private_segment_fixed_size 0
.amdhsa_kernarg_size 280
.amdhsa_user_sgpr_count 15
.amdhsa_user_sgpr_dispatch_ptr 0
.amdhsa_user_sgpr_queue_ptr 0
.amdhsa_user_sgpr_kernarg_segment_ptr 1
.amdhsa_user_sgpr_dispatch_id 0
.amdhsa_user_sgpr_private_segment_size 0
.amdhsa_wavefront_size32 1
.amdhsa_uses_dynamic_stack 0
.amdhsa_enable_private_segment 0
.amdhsa_system_sgpr_workgroup_id_x 1
.amdhsa_system_sgpr_workgroup_id_y 0
.amdhsa_system_sgpr_workgroup_id_z 0
.amdhsa_system_sgpr_workgroup_info 0
.amdhsa_system_vgpr_workitem_id 0
.amdhsa_next_free_vgpr 5
.amdhsa_next_free_sgpr 16
.amdhsa_float_round_mode_32 0
.amdhsa_float_round_mode_16_64 0
.amdhsa_float_denorm_mode_32 3
.amdhsa_float_denorm_mode_16_64 3
.amdhsa_dx10_clamp 1
.amdhsa_ieee_mode 1
.amdhsa_fp16_overflow 0
.amdhsa_workgroup_processor_mode 1
.amdhsa_memory_ordered 1
.amdhsa_forward_progress 0
.amdhsa_shared_vgpr_count 0
.amdhsa_exception_fp_ieee_invalid_op 0
.amdhsa_exception_fp_denorm_src 0
.amdhsa_exception_fp_ieee_div_zero 0
.amdhsa_exception_fp_ieee_overflow 0
.amdhsa_exception_fp_ieee_underflow 0
.amdhsa_exception_fp_ieee_inexact 0
.amdhsa_exception_int_div_zero 0
.end_amdhsa_kernel
.text
.Lfunc_end0:
.size _Z20polynomial_expansionPfiiS_, .Lfunc_end0-_Z20polynomial_expansionPfiiS_
.section .AMDGPU.csdata,"",@progbits
.text
.p2alignl 7, 3214868480
.fill 96, 4, 3214868480
.type __hip_cuid_,@object
.section .bss,"aw",@nobits
.globl __hip_cuid_
__hip_cuid_:
.byte 0
.size __hip_cuid_, 1
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym __hip_cuid_
.amdgpu_metadata
---
amdhsa.kernels:
- .args:
- .address_space: global
.offset: 0
.size: 8
.value_kind: global_buffer
- .offset: 8
.size: 4
.value_kind: by_value
- .offset: 12
.size: 4
.value_kind: by_value
- .address_space: global
.offset: 16
.size: 8
.value_kind: global_buffer
- .offset: 24
.size: 4
.value_kind: hidden_block_count_x
- .offset: 28
.size: 4
.value_kind: hidden_block_count_y
- .offset: 32
.size: 4
.value_kind: hidden_block_count_z
- .offset: 36
.size: 2
.value_kind: hidden_group_size_x
- .offset: 38
.size: 2
.value_kind: hidden_group_size_y
- .offset: 40
.size: 2
.value_kind: hidden_group_size_z
- .offset: 42
.size: 2
.value_kind: hidden_remainder_x
- .offset: 44
.size: 2
.value_kind: hidden_remainder_y
- .offset: 46
.size: 2
.value_kind: hidden_remainder_z
- .offset: 64
.size: 8
.value_kind: hidden_global_offset_x
- .offset: 72
.size: 8
.value_kind: hidden_global_offset_y
- .offset: 80
.size: 8
.value_kind: hidden_global_offset_z
- .offset: 88
.size: 2
.value_kind: hidden_grid_dims
.group_segment_fixed_size: 0
.kernarg_segment_align: 8
.kernarg_segment_size: 280
.language: OpenCL C
.language_version:
- 2
- 0
.max_flat_workgroup_size: 1024
.name: _Z20polynomial_expansionPfiiS_
.private_segment_fixed_size: 0
.sgpr_count: 18
.sgpr_spill_count: 0
.symbol: _Z20polynomial_expansionPfiiS_.kd
.uniform_work_group_size: 1
.uses_dynamic_stack: false
.vgpr_count: 5
.vgpr_spill_count: 0
.wavefront_size: 32
.workgroup_processor_mode: 1
amdhsa.target: amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
- 1
- 2
...
.end_amdgpu_metadata |
You are a helpful coding assistant specialized in converting from CUDA host assembly to AMD host assembly. | .file "tmpxft_00085235_00000000-6_polynomial_gpu.cudafe1.cpp"
.text
#APP
.globl _ZSt21ios_base_library_initv
#NO_APP
.type _ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3779:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaUnregisterFatBinary@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE3779:
.size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
.globl _Z44__device_stub__Z20polynomial_expansionPfiiS_PfiiS_
.type _Z44__device_stub__Z20polynomial_expansionPfiiS_PfiiS_, @function
_Z44__device_stub__Z20polynomial_expansionPfiiS_PfiiS_:
.LFB3801:
.cfi_startproc
endbr64
subq $152, %rsp
.cfi_def_cfa_offset 160
movq %rdi, 24(%rsp)
movl %esi, 20(%rsp)
movl %edx, 16(%rsp)
movq %rcx, 8(%rsp)
movq %fs:40, %rax
movq %rax, 136(%rsp)
xorl %eax, %eax
leaq 24(%rsp), %rax
movq %rax, 96(%rsp)
leaq 20(%rsp), %rax
movq %rax, 104(%rsp)
leaq 16(%rsp), %rax
movq %rax, 112(%rsp)
leaq 8(%rsp), %rax
movq %rax, 120(%rsp)
movl $1, 48(%rsp)
movl $1, 52(%rsp)
movl $1, 56(%rsp)
movl $1, 60(%rsp)
movl $1, 64(%rsp)
movl $1, 68(%rsp)
leaq 40(%rsp), %rcx
leaq 32(%rsp), %rdx
leaq 60(%rsp), %rsi
leaq 48(%rsp), %rdi
call __cudaPopCallConfiguration@PLT
testl %eax, %eax
je .L7
.L3:
movq 136(%rsp), %rax
subq %fs:40, %rax
jne .L8
addq $152, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 8
ret
.L7:
.cfi_restore_state
pushq 40(%rsp)
.cfi_def_cfa_offset 168
pushq 40(%rsp)
.cfi_def_cfa_offset 176
leaq 112(%rsp), %r9
movq 76(%rsp), %rcx
movl 84(%rsp), %r8d
movq 64(%rsp), %rsi
movl 72(%rsp), %edx
leaq _Z20polynomial_expansionPfiiS_(%rip), %rdi
call cudaLaunchKernel@PLT
addq $16, %rsp
.cfi_def_cfa_offset 160
jmp .L3
.L8:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE3801:
.size _Z44__device_stub__Z20polynomial_expansionPfiiS_PfiiS_, .-_Z44__device_stub__Z20polynomial_expansionPfiiS_PfiiS_
.globl _Z20polynomial_expansionPfiiS_
.type _Z20polynomial_expansionPfiiS_, @function
_Z20polynomial_expansionPfiiS_:
.LFB3802:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
call _Z44__device_stub__Z20polynomial_expansionPfiiS_PfiiS_
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE3802:
.size _Z20polynomial_expansionPfiiS_, .-_Z20polynomial_expansionPfiiS_
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "usage: "
.LC1:
.string " n degree"
.section .rodata.str1.8,"aMS",@progbits,1
.align 8
.LC5:
.string "Result is incorrect. In particular array["
.section .rodata.str1.1
.LC6:
.string "] should be "
.LC7:
.string " not "
.LC9:
.string " "
.text
.globl main
.type main, @function
main:
.LFB3768:
.cfi_startproc
endbr64
pushq %r15
.cfi_def_cfa_offset 16
.cfi_offset 15, -16
pushq %r14
.cfi_def_cfa_offset 24
.cfi_offset 14, -24
pushq %r13
.cfi_def_cfa_offset 32
.cfi_offset 13, -32
pushq %r12
.cfi_def_cfa_offset 40
.cfi_offset 12, -40
pushq %rbp
.cfi_def_cfa_offset 48
.cfi_offset 6, -48
pushq %rbx
.cfi_def_cfa_offset 56
.cfi_offset 3, -56
subq $88, %rsp
.cfi_def_cfa_offset 144
movq %rsi, %rbp
movq %fs:40, %rax
movq %rax, 72(%rsp)
xorl %eax, %eax
cmpl $2, %edi
jle .L36
movq 8(%rsi), %rdi
movl $10, %edx
movl $0, %esi
call __isoc23_strtol@PLT
movq %rax, %r12
movl %eax, 16(%rsp)
movq 16(%rbp), %rdi
movl $10, %edx
movl $0, %esi
call __isoc23_strtol@PLT
movq %rax, %r15
movq %rax, 24(%rsp)
movl %eax, 12(%rsp)
movslq %r12d, %r13
movabsq $2305843009213693950, %rax
cmpq %r13, %rax
jb .L14
salq $2, %r13
movq %r13, %rdi
call _Znam@PLT
movq %rax, %rbp
movl %r15d, %eax
addl $1, %eax
movl %eax, 20(%rsp)
movslq %eax, %r14
movabsq $2305843009213693950, %rax
cmpq %r14, %rax
jb .L37
salq $2, %r14
movq %r14, %rdi
call _Znam@PLT
movq %rax, %r15
testl %r12d, %r12d
jle .L19
movq %rbp, %rax
leal -1(%r12), %edx
leaq 4(%rbp,%rdx,4), %rdx
movss .LC2(%rip), %xmm0
.L21:
movss %xmm0, (%rax)
addq $4, %rax
cmpq %rdx, %rax
jne .L21
.L19:
movq 24(%rsp), %rcx
testl %ecx, %ecx
js .L22
movq %r15, %rax
movl %ecx, %edx
leaq 4(%r15,%rdx,4), %rdx
movss .LC2(%rip), %xmm0
.L23:
movss %xmm0, (%rax)
addq $4, %rax
cmpq %rdx, %rax
jne .L23
.L22:
call _ZNSt6chrono3_V212system_clock3nowEv@PLT
movq %rax, 24(%rsp)
leaq 32(%rsp), %rdi
movq %r13, %rsi
call cudaMalloc@PLT
leaq 40(%rsp), %rdi
movq %r14, %rsi
call cudaMalloc@PLT
movl $1, %ecx
movq %r13, %rdx
movq %rbp, %rsi
movq 32(%rsp), %rdi
call cudaMemcpy@PLT
movl $1, %ecx
movq %r14, %rdx
movq %r15, %rsi
movq 40(%rsp), %rdi
call cudaMemcpy@PLT
movl $256, 60(%rsp)
movl $1, 64(%rsp)
leal 510(%r12), %eax
movl %r12d, %edx
addl $255, %edx
cmovns %edx, %eax
sarl $8, %eax
movl %eax, 48(%rsp)
movl $1, 52(%rsp)
movl $0, %r9d
movl $0, %r8d
movq 60(%rsp), %rdx
movl $1, %ecx
movq 48(%rsp), %rdi
movl $1, %esi
call __cudaPushCallConfiguration@PLT
testl %eax, %eax
je .L38
.L24:
movl $2, %ecx
movq %r13, %rdx
movq 32(%rsp), %rsi
movq %rbp, %rdi
call cudaMemcpy@PLT
movq 32(%rsp), %rdi
call cudaFree@PLT
movq 40(%rsp), %rdi
call cudaFree@PLT
call cudaDeviceSynchronize@PLT
testl %r12d, %r12d
jle .L25
leal -1(%r12), %edi
movl $0, %eax
movl $1, %edx
pxor %xmm3, %xmm3
cvtsi2ssl 20(%rsp), %xmm3
movss .LC3(%rip), %xmm2
movsd .LC4(%rip), %xmm1
movl $0, %esi
jmp .L28
.L36:
leaq .LC0(%rip), %rsi
leaq _ZSt4cerr(%rip), %rdi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
movq %rax, %rdi
movq 0(%rbp), %rsi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
movq %rax, %rdi
leaq .LC1(%rip), %rsi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
movq %rax, %rdi
call _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
movl $-1, %eax
jmp .L11
.L14:
movq 72(%rsp), %rax
subq %fs:40, %rax
je .L17
call __stack_chk_fail@PLT
.L17:
call __cxa_throw_bad_array_new_length@PLT
.L37:
movq 72(%rsp), %rax
subq %fs:40, %rax
je .L20
call __stack_chk_fail@PLT
.L20:
call __cxa_throw_bad_array_new_length@PLT
.L38:
movq 32(%rsp), %rcx
movl 16(%rsp), %edx
movl 12(%rsp), %esi
movq 40(%rsp), %rdi
call _Z44__device_stub__Z20polynomial_expansionPfiiS_PfiiS_
jmp .L24
.L30:
movq %rcx, %rax
.L28:
movss 0(%rbp,%rax,4), %xmm0
subss %xmm3, %xmm0
andps %xmm2, %xmm0
cvtss2sd %xmm0, %xmm0
comisd %xmm1, %xmm0
cmova %eax, %ebx
cmova %esi, %edx
leaq 1(%rax), %rcx
cmpq %rax, %rdi
jne .L30
testb %dl, %dl
je .L39
.L25:
call _ZNSt6chrono3_V212system_clock3nowEv@PLT
movq 24(%rsp), %rbx
subq %rbx, %rax
pxor %xmm0, %xmm0
cvtsi2sdq %rax, %xmm0
divsd .LC8(%rip), %xmm0
movq %xmm0, %rbx
movl 16(%rsp), %esi
leaq _ZSt4cout(%rip), %rdi
call _ZNSolsEi@PLT
movq %rax, %rdi
leaq .LC9(%rip), %r12
movq %r12, %rsi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
movq %rax, %rdi
movl 12(%rsp), %esi
call _ZNSolsEi@PLT
movq %rax, %rdi
movq %r12, %rsi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
movq %rax, %rdi
movq %rbx, %xmm0
call _ZNSo9_M_insertIdEERSoT_@PLT
movq %rax, %rdi
call _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
movq %rbp, %rdi
call _ZdaPv@PLT
movq %r15, %rdi
call _ZdaPv@PLT
movl $0, %eax
.L11:
movq 72(%rsp), %rdx
subq %fs:40, %rdx
jne .L40
addq $88, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 56
popq %rbx
.cfi_def_cfa_offset 48
popq %rbp
.cfi_def_cfa_offset 40
popq %r12
.cfi_def_cfa_offset 32
popq %r13
.cfi_def_cfa_offset 24
popq %r14
.cfi_def_cfa_offset 16
popq %r15
.cfi_def_cfa_offset 8
ret
.L39:
.cfi_restore_state
leaq .LC5(%rip), %rsi
leaq _ZSt4cerr(%rip), %rdi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
movq %rax, %rdi
movl %ebx, %esi
call _ZNSolsEi@PLT
movq %rax, %rdi
leaq .LC6(%rip), %rsi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
movq %rax, %rdi
movl 20(%rsp), %esi
call _ZNSolsEi@PLT
movq %rax, %rdi
leaq .LC7(%rip), %rsi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
movq %rax, %rdi
movslq %ebx, %rbx
pxor %xmm0, %xmm0
cvtss2sd 0(%rbp,%rbx,4), %xmm0
call _ZNSo9_M_insertIdEERSoT_@PLT
movq %rax, %rdi
call _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
jmp .L25
.L40:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE3768:
.size main, .-main
.section .rodata.str1.8
.align 8
.LC10:
.string "_Z20polynomial_expansionPfiiS_"
.text
.type _ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3804:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
leaq _ZL15__fatDeviceText(%rip), %rdi
call __cudaRegisterFatBinary@PLT
movq %rax, %rdi
movq %rax, _ZL20__cudaFatCubinHandle(%rip)
pushq $0
.cfi_def_cfa_offset 24
pushq $0
.cfi_def_cfa_offset 32
pushq $0
.cfi_def_cfa_offset 40
pushq $0
.cfi_def_cfa_offset 48
movl $0, %r9d
movl $-1, %r8d
leaq .LC10(%rip), %rdx
movq %rdx, %rcx
leaq _Z20polynomial_expansionPfiiS_(%rip), %rsi
call __cudaRegisterFunction@PLT
addq $32, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaRegisterFatBinaryEnd@PLT
leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
call atexit@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE3804:
.size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
.section .init_array,"aw"
.align 8
.quad _ZL24__sti____cudaRegisterAllv
.section .nvFatBinSegment,"aw"
.align 8
.type _ZL15__fatDeviceText, @object
.size _ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
.long 1180844977
.long 1
.quad fatbinData
.quad 0
.local _ZL20__cudaFatCubinHandle
.comm _ZL20__cudaFatCubinHandle,8,8
.section .rodata.cst4,"aM",@progbits,4
.align 4
.LC2:
.long 1065353216
.section .rodata.cst16,"aM",@progbits,16
.align 16
.LC3:
.long 2147483647
.long 0
.long 0
.long 0
.section .rodata.cst8,"aM",@progbits,8
.align 8
.LC4:
.long 1202590843
.long 1065646817
.align 8
.LC8:
.long 0
.long 1104006501
.ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
.section .note.GNU-stack,"",@progbits
.section .note.gnu.property,"a"
.align 8
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.string "GNU"
1:
.align 8
.long 0xc0000002
.long 3f - 2f
2:
.long 0x3
3:
.align 8
4: | .text
.file "polynomial_gpu.hip"
# Start of file scope inline assembly
.globl _ZSt21ios_base_library_initv
# End of file scope inline assembly
.globl _Z35__device_stub__polynomial_expansionPfiiS_ # -- Begin function _Z35__device_stub__polynomial_expansionPfiiS_
.p2align 4, 0x90
.type _Z35__device_stub__polynomial_expansionPfiiS_,@function
_Z35__device_stub__polynomial_expansionPfiiS_: # @_Z35__device_stub__polynomial_expansionPfiiS_
.cfi_startproc
# %bb.0:
subq $120, %rsp
.cfi_def_cfa_offset 128
movq %rdi, 72(%rsp)
movl %esi, 12(%rsp)
movl %edx, 8(%rsp)
movq %rcx, 64(%rsp)
leaq 72(%rsp), %rax
movq %rax, 80(%rsp)
leaq 12(%rsp), %rax
movq %rax, 88(%rsp)
leaq 8(%rsp), %rax
movq %rax, 96(%rsp)
leaq 64(%rsp), %rax
movq %rax, 104(%rsp)
leaq 48(%rsp), %rdi
leaq 32(%rsp), %rsi
leaq 24(%rsp), %rdx
leaq 16(%rsp), %rcx
callq __hipPopCallConfiguration
movq 48(%rsp), %rsi
movl 56(%rsp), %edx
movq 32(%rsp), %rcx
movl 40(%rsp), %r8d
leaq 80(%rsp), %r9
movl $_Z20polynomial_expansionPfiiS_, %edi
pushq 16(%rsp)
.cfi_adjust_cfa_offset 8
pushq 32(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $136, %rsp
.cfi_adjust_cfa_offset -136
retq
.Lfunc_end0:
.size _Z35__device_stub__polynomial_expansionPfiiS_, .Lfunc_end0-_Z35__device_stub__polynomial_expansionPfiiS_
.cfi_endproc
# -- End function
.section .rodata.cst16,"aM",@progbits,16
.p2align 4, 0x0 # -- Begin function main
.LCPI1_0:
.long 0x7fffffff # float NaN
.long 0x7fffffff # float NaN
.long 0x7fffffff # float NaN
.long 0x7fffffff # float NaN
.section .rodata.cst8,"aM",@progbits,8
.p2align 3, 0x0
.LCPI1_1:
.quad 0x3f847ae147ae147b # double 0.01
.LCPI1_2:
.quad 0x41cdcd6500000000 # double 1.0E+9
.text
.globl main
.p2align 4, 0x90
.type main,@function
main: # @main
.cfi_startproc
# %bb.0:
pushq %rbp
.cfi_def_cfa_offset 16
pushq %r15
.cfi_def_cfa_offset 24
pushq %r14
.cfi_def_cfa_offset 32
pushq %r13
.cfi_def_cfa_offset 40
pushq %r12
.cfi_def_cfa_offset 48
pushq %rbx
.cfi_def_cfa_offset 56
subq $152, %rsp
.cfi_def_cfa_offset 208
.cfi_offset %rbx, -56
.cfi_offset %r12, -48
.cfi_offset %r13, -40
.cfi_offset %r14, -32
.cfi_offset %r15, -24
.cfi_offset %rbp, -16
movq %rsi, %rbx
cmpl $2, %edi
jg .LBB1_9
# %bb.1:
movl $_ZSt4cerr, %edi
movl $.L.str, %esi
movl $7, %edx
callq _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
movq (%rbx), %rbx
testq %rbx, %rbx
je .LBB1_2
# %bb.3:
movq %rbx, %rdi
callq strlen
movl $_ZSt4cerr, %edi
movq %rbx, %rsi
movq %rax, %rdx
callq _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
jmp .LBB1_4
.LBB1_9:
movq 8(%rbx), %rdi
xorl %esi, %esi
movl $10, %edx
callq __isoc23_strtol
movq %rax, %r14
movq 16(%rbx), %rdi
xorl %esi, %esi
movl $10, %edx
callq __isoc23_strtol
movq %rax, %r13
movq %r14, 32(%rsp) # 8-byte Spill
movslq %r14d, %r15
leaq (,%r15,4), %rbp
testl %r15d, %r15d
movq $-1, %r14
movq %rbp, %rdi
cmovsq %r14, %rdi
callq _Znam
movq %rax, %rbx
movslq %r13d, %rax
movq %r13, %r12
cmpl $-1, %r13d
leaq 4(,%rax,4), %r13
cmovgeq %r13, %r14
movq %r14, %rdi
callq _Znam
movq %rax, %r14
testl %r15d, %r15d
jle .LBB1_12
# %bb.10: # %.lr.ph.preheader
movl 32(%rsp), %eax # 4-byte Reload
xorl %ecx, %ecx
.p2align 4, 0x90
.LBB1_11: # %.lr.ph
# =>This Inner Loop Header: Depth=1
movl $1065353216, (%rbx,%rcx,4) # imm = 0x3F800000
incq %rcx
cmpq %rcx, %rax
jne .LBB1_11
.LBB1_12: # %.preheader
movq %r12, %r15
testl %r15d, %r15d
js .LBB1_15
# %bb.13: # %.lr.ph78.preheader
movl %r15d, %eax
incl %eax
xorl %ecx, %ecx
.p2align 4, 0x90
.LBB1_14: # %.lr.ph78
# =>This Inner Loop Header: Depth=1
movl $1065353216, (%r14,%rcx,4) # imm = 0x3F800000
incq %rcx
cmpq %rcx, %rax
jne .LBB1_14
.LBB1_15: # %._crit_edge
callq _ZNSt6chrono3_V212system_clock3nowEv
movq %rax, 8(%rsp) # 8-byte Spill
movq %rsp, %rdi
movq %rbp, %rsi
callq hipMalloc
leaq 16(%rsp), %rdi
movq %r13, %rsi
callq hipMalloc
movq (%rsp), %rdi
movq %rbx, %rsi
movq %rbp, %rdx
movl $1, %ecx
callq hipMemcpy
movq 16(%rsp), %rdi
movq %r14, %rsi
movq %r13, %rdx
movl $1, %ecx
callq hipMemcpy
movq 32(%rsp), %r12 # 8-byte Reload
leal 255(%r12), %eax
leal 510(%r12), %edi
testl %eax, %eax
cmovnsl %eax, %edi
sarl $8, %edi
movabsq $4294967296, %rdx # imm = 0x100000000
orq %rdx, %rdi
orq $256, %rdx # imm = 0x100
movl $1, %esi
movl $1, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq __hipPushCallConfiguration
testl %eax, %eax
jne .LBB1_17
# %bb.16:
movq 16(%rsp), %rax
movq (%rsp), %rcx
movq %rax, 104(%rsp)
movl %r15d, 28(%rsp)
movl %r12d, 24(%rsp)
movq %rcx, 96(%rsp)
leaq 104(%rsp), %rax
movq %rax, 112(%rsp)
leaq 28(%rsp), %rax
movq %rax, 120(%rsp)
leaq 24(%rsp), %rax
movq %rax, 128(%rsp)
leaq 96(%rsp), %rax
movq %rax, 136(%rsp)
leaq 80(%rsp), %rdi
leaq 64(%rsp), %rsi
leaq 56(%rsp), %rdx
leaq 48(%rsp), %rcx
callq __hipPopCallConfiguration
movq 80(%rsp), %rsi
movl 88(%rsp), %edx
movq 64(%rsp), %rcx
movl 72(%rsp), %r8d
leaq 112(%rsp), %r9
movl $_Z20polynomial_expansionPfiiS_, %edi
pushq 48(%rsp)
.cfi_adjust_cfa_offset 8
pushq 64(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $16, %rsp
.cfi_adjust_cfa_offset -16
.LBB1_17:
movq %r15, 40(%rsp) # 8-byte Spill
incl %r15d
movq (%rsp), %rsi
movq %rbx, %rdi
movq %rbp, %rdx
movl $2, %ecx
callq hipMemcpy
movq (%rsp), %rdi
callq hipFree
movq 16(%rsp), %rdi
callq hipFree
callq hipDeviceSynchronize
xorl %eax, %eax
testl %r12d, %r12d
jle .LBB1_18
# %bb.24: # %.lr.ph83
cvtsi2ss %r15d, %xmm0
movl %r12d, %ecx
movb $1, %dl
movaps .LCPI1_0(%rip), %xmm1 # xmm1 = [NaN,NaN,NaN,NaN]
movsd .LCPI1_1(%rip), %xmm2 # xmm2 = mem[0],zero
xorl %esi, %esi
# implicit-def: $ebp
.p2align 4, 0x90
.LBB1_25: # =>This Inner Loop Header: Depth=1
movss (%rbx,%rsi,4), %xmm3 # xmm3 = mem[0],zero,zero,zero
subss %xmm0, %xmm3
andps %xmm1, %xmm3
cvtss2sd %xmm3, %xmm3
ucomisd %xmm2, %xmm3
movzbl %dl, %edx
cmoval %eax, %edx
cmoval %esi, %ebp
incq %rsi
cmpq %rsi, %rcx
jne .LBB1_25
# %bb.19: # %._crit_edge84.loopexit
testb $1, %dl
sete %al
testb %al, %al
jne .LBB1_21
jmp .LBB1_28
.LBB1_2:
movq _ZSt4cerr(%rip), %rax
movq -24(%rax), %rax
leaq _ZSt4cerr(%rax), %rdi
movl _ZSt4cerr+32(%rax), %esi
orl $1, %esi
callq _ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
.LBB1_4: # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
movl $_ZSt4cerr, %edi
movl $.L.str.1, %esi
movl $9, %edx
callq _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
movq _ZSt4cerr(%rip), %rax
movq -24(%rax), %rax
movq _ZSt4cerr+240(%rax), %rbx
testq %rbx, %rbx
je .LBB1_34
# %bb.5: # %_ZSt13__check_facetISt5ctypeIcEERKT_PS3_.exit.i.i
cmpb $0, 56(%rbx)
je .LBB1_7
# %bb.6:
movzbl 67(%rbx), %eax
jmp .LBB1_8
.LBB1_18:
# implicit-def: $ebp
testb %al, %al
je .LBB1_28
.LBB1_21:
movl $_ZSt4cerr, %edi
movl $.L.str.2, %esi
movl $41, %edx
callq _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
movl $_ZSt4cerr, %edi
movl %ebp, %esi
callq _ZNSolsEi
movq %rax, %r13
movl $.L.str.3, %esi
movl $12, %edx
movq %rax, %rdi
callq _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
movq %r13, %rdi
movl %r15d, %esi
callq _ZNSolsEi
movq %rax, %r13
movl $.L.str.4, %esi
movl $5, %edx
movq %rax, %rdi
callq _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
movslq %ebp, %rax
movss (%rbx,%rax,4), %xmm0 # xmm0 = mem[0],zero,zero,zero
cvtss2sd %xmm0, %xmm0
movq %r13, %rdi
callq _ZNSo9_M_insertIdEERSoT_
movq (%rax), %rcx
movq -24(%rcx), %rcx
movq 240(%rax,%rcx), %r13
testq %r13, %r13
je .LBB1_34
# %bb.22: # %_ZSt13__check_facetISt5ctypeIcEERKT_PS3_.exit.i.i58
cmpb $0, 56(%r13)
je .LBB1_26
# %bb.23:
movzbl 67(%r13), %ecx
jmp .LBB1_27
.LBB1_7:
movq %rbx, %rdi
callq _ZNKSt5ctypeIcE13_M_widen_initEv
movq (%rbx), %rax
movq %rbx, %rdi
movl $10, %esi
callq *48(%rax)
.LBB1_8: # %_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_.exit
movsbl %al, %esi
movl $_ZSt4cerr, %edi
callq _ZNSo3putEc
movq %rax, %rdi
callq _ZNSo5flushEv
movl $-1, %eax
jmp .LBB1_33
.LBB1_26:
movq %r13, %rdi
movq %rax, %rbp
callq _ZNKSt5ctypeIcE13_M_widen_initEv
movq (%r13), %rax
movq %r13, %rdi
movl $10, %esi
callq *48(%rax)
movl %eax, %ecx
movq %rbp, %rax
.LBB1_27: # %_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_.exit61
movsbl %cl, %esi
movq %rax, %rdi
callq _ZNSo3putEc
movq %rax, %rdi
callq _ZNSo5flushEv
.LBB1_28:
callq _ZNSt6chrono3_V212system_clock3nowEv
subq 8(%rsp), %rax # 8-byte Folded Reload
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
divsd .LCPI1_2(%rip), %xmm0
movsd %xmm0, 8(%rsp) # 8-byte Spill
movl $_ZSt4cout, %edi
movl %r12d, %esi
callq _ZNSolsEi
movq %rax, %r12
movl $.L.str.5, %esi
movl $1, %edx
movq %rax, %rdi
callq _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
movq %r12, %rdi
movq 40(%rsp), %rsi # 8-byte Reload
# kill: def $esi killed $esi killed $rsi
callq _ZNSolsEi
movq %rax, %r15
movl $.L.str.5, %esi
movl $1, %edx
movq %rax, %rdi
callq _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
movq %r15, %rdi
movsd 8(%rsp), %xmm0 # 8-byte Reload
# xmm0 = mem[0],zero
callq _ZNSo9_M_insertIdEERSoT_
movq (%rax), %rcx
movq -24(%rcx), %rcx
movq 240(%rax,%rcx), %r15
testq %r15, %r15
je .LBB1_34
# %bb.29: # %_ZSt13__check_facetISt5ctypeIcEERKT_PS3_.exit.i.i63
cmpb $0, 56(%r15)
je .LBB1_31
# %bb.30:
movzbl 67(%r15), %ecx
jmp .LBB1_32
.LBB1_31:
movq %r15, %rdi
movq %rax, %r12
callq _ZNKSt5ctypeIcE13_M_widen_initEv
movq (%r15), %rax
movq %r15, %rdi
movl $10, %esi
callq *48(%rax)
movl %eax, %ecx
movq %r12, %rax
.LBB1_32: # %_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_.exit66
movsbl %cl, %esi
movq %rax, %rdi
callq _ZNSo3putEc
movq %rax, %rdi
callq _ZNSo5flushEv
movq %rbx, %rdi
callq _ZdaPv
movq %r14, %rdi
callq _ZdaPv
xorl %eax, %eax
.LBB1_33:
addq $152, %rsp
.cfi_def_cfa_offset 56
popq %rbx
.cfi_def_cfa_offset 48
popq %r12
.cfi_def_cfa_offset 40
popq %r13
.cfi_def_cfa_offset 32
popq %r14
.cfi_def_cfa_offset 24
popq %r15
.cfi_def_cfa_offset 16
popq %rbp
.cfi_def_cfa_offset 8
retq
.LBB1_34:
.cfi_def_cfa_offset 208
callq _ZSt16__throw_bad_castv
.Lfunc_end1:
.size main, .Lfunc_end1-main
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_ctor
.type __hip_module_ctor,@function
__hip_module_ctor: # @__hip_module_ctor
.cfi_startproc
# %bb.0:
subq $40, %rsp
.cfi_def_cfa_offset 48
cmpq $0, __hip_gpubin_handle(%rip)
jne .LBB2_2
# %bb.1:
movl $__hip_fatbin_wrapper, %edi
callq __hipRegisterFatBinary
movq %rax, __hip_gpubin_handle(%rip)
.LBB2_2:
movq __hip_gpubin_handle(%rip), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 16(%rsp)
movups %xmm0, (%rsp)
movl $_Z20polynomial_expansionPfiiS_, %esi
movl $.L__unnamed_1, %edx
movl $.L__unnamed_1, %ecx
movl $-1, %r8d
xorl %r9d, %r9d
callq __hipRegisterFunction
movl $__hip_module_dtor, %edi
addq $40, %rsp
.cfi_def_cfa_offset 8
jmp atexit # TAILCALL
.Lfunc_end2:
.size __hip_module_ctor, .Lfunc_end2-__hip_module_ctor
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_dtor
.type __hip_module_dtor,@function
__hip_module_dtor: # @__hip_module_dtor
.cfi_startproc
# %bb.0:
movq __hip_gpubin_handle(%rip), %rdi
testq %rdi, %rdi
je .LBB3_2
# %bb.1:
pushq %rax
.cfi_def_cfa_offset 16
callq __hipUnregisterFatBinary
movq $0, __hip_gpubin_handle(%rip)
addq $8, %rsp
.cfi_def_cfa_offset 8
.LBB3_2:
retq
.Lfunc_end3:
.size __hip_module_dtor, .Lfunc_end3-__hip_module_dtor
.cfi_endproc
# -- End function
.type _Z20polynomial_expansionPfiiS_,@object # @_Z20polynomial_expansionPfiiS_
.section .rodata,"a",@progbits
.globl _Z20polynomial_expansionPfiiS_
.p2align 3, 0x0
_Z20polynomial_expansionPfiiS_:
.quad _Z35__device_stub__polynomial_expansionPfiiS_
.size _Z20polynomial_expansionPfiiS_, 8
.type .L.str,@object # @.str
.section .rodata.str1.1,"aMS",@progbits,1
.L.str:
.asciz "usage: "
.size .L.str, 8
.type .L.str.1,@object # @.str.1
.L.str.1:
.asciz " n degree"
.size .L.str.1, 10
.type .L.str.2,@object # @.str.2
.L.str.2:
.asciz "Result is incorrect. In particular array["
.size .L.str.2, 42
.type .L.str.3,@object # @.str.3
.L.str.3:
.asciz "] should be "
.size .L.str.3, 13
.type .L.str.4,@object # @.str.4
.L.str.4:
.asciz " not "
.size .L.str.4, 6
.type .L.str.5,@object # @.str.5
.L.str.5:
.asciz " "
.size .L.str.5, 2
.type .L__unnamed_1,@object # @0
.L__unnamed_1:
.asciz "_Z20polynomial_expansionPfiiS_"
.size .L__unnamed_1, 31
.type __hip_fatbin_wrapper,@object # @__hip_fatbin_wrapper
.section .hipFatBinSegment,"a",@progbits
.p2align 3, 0x0
__hip_fatbin_wrapper:
.long 1212764230 # 0x48495046
.long 1 # 0x1
.quad __hip_fatbin
.quad 0
.size __hip_fatbin_wrapper, 24
.type __hip_gpubin_handle,@object # @__hip_gpubin_handle
.local __hip_gpubin_handle
.comm __hip_gpubin_handle,8,8
.section .init_array,"aw",@init_array
.p2align 3, 0x0
.quad __hip_module_ctor
.type __hip_cuid_,@object # @__hip_cuid_
.bss
.globl __hip_cuid_
__hip_cuid_:
.byte 0 # 0x0
.size __hip_cuid_, 1
.section ".linker-options","e",@llvm_linker_options
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym _Z35__device_stub__polynomial_expansionPfiiS_
.addrsig_sym __gxx_personality_v0
.addrsig_sym __hip_module_ctor
.addrsig_sym __hip_module_dtor
.addrsig_sym _Z20polynomial_expansionPfiiS_
.addrsig_sym _ZSt4cerr
.addrsig_sym _ZSt4cout
.addrsig_sym __hip_fatbin
.addrsig_sym __hip_fatbin_wrapper
.addrsig_sym __hip_cuid_ |
You are a helpful coding assistant specialized in converting CUDA source code to CUDA device assembly. | #include <time.h>
#include <cuda.h>
#include <stdio.h>
#define STOP 0
#define START 1
#define BLOCK_X 16
#define BLOCK_Y 16
extern "C" void chrono (int kind, float *time);
__global__ void kconvol (float *gpu_a, float *gpu_b, int pitch, int n) {
int ig, jg, lg, il, jl, ll;
__shared__ float la[(BLOCK_X+2)*(BLOCK_Y+2)];
__shared__ float lb[(BLOCK_X+2)*(BLOCK_Y+2)];
// A thread now has two sets of coordinates :
// (ig, jg) in the global array
// (il, jl) in the local array (shared) of size (BLOCK_X+2)*(BLOCK_Y+2)
ig = blockDim.x*blockIdx.x+threadIdx.x;
jg = blockDim.y*blockIdx.y+threadIdx.y;
lg = ig+jg*pitch;
// UP TO YOU : write below the indices il and jl
il = threadIdx.x+1;
jl = threadIdx.y+1;
ll = il+jl*(BLOCK_X+2);
// What does the following line correspond to ?
la[ll] = gpu_a[lg];
if ((il == 1) && (ig > 0)) // What does the following line correespond to ?
la[ll-1] = gpu_a[lg-1];
if ((jl == 1) && (jg > 0))
la[ll-BLOCK_X-2] = gpu_a[lg-pitch];
if ((il == BLOCK_X) && (ig < n-1)) // UP TO YOU The following line is missing. Find out what was intended
la[ll-BLOCK_X-2]= gpu_a[lg+pitch];
if ((jl == BLOCK_Y) && (jg < n-1)) // UP TO YOU Find out the missing offset of local array below
la[ll+BLOCK_X+2] = gpu_a[lg+pitch];
__syncthreads ();
if ((ig >= n) || (jg >= n)) return;
if ((ig == 0) || (jg == 0) || (ig == n-1) || (jg == n-1)) {
lb[ll] = la[ll];
}
else
/* UP TO YOU : fill up below the missing indices */
lb[ll]=(1.f/5.f)*( +la[ll-BLOCK_X-2]+ \
la[ll-1] +la[ll] +la[ll+1]+ \
+la[ll+BLOCK_X+2]);
if((ig<n) &&(ig>0))
gpu_b[lg] = lb[ll];
}
extern "C" void gpu_convol (float *a, float *b, int n) {
float *gpu_a;
float *gpu_b;
cudaError_t err;
size_t pitch;
float time;
err = cudaMallocPitch (&gpu_a, &pitch, n*sizeof(float), n);
if (err != 0) {
printf ("Error allocating gpu_a: %s\n", cudaGetErrorString (err));
exit (1);
}
err = cudaMallocPitch (&gpu_b, &pitch, n*sizeof(float), n);
if (err != 0) {
printf ("Error allocating gpu_b: %s\n", cudaGetErrorString (err));
exit (1);
}
dim3 block (BLOCK_X, BLOCK_Y);
dim3 grid;
grid.x = (n-1)/BLOCK_X+1;
grid.y = (n-1)/BLOCK_Y+1;
cudaMemcpy2D (gpu_a, pitch, a, n*sizeof(float), n*sizeof(float), n, cudaMemcpyHostToDevice);
chrono (START, &time);
kconvol <<<grid, block>>> (gpu_a, gpu_b, pitch/sizeof(float), n);
err=cudaThreadSynchronize ();
chrono (STOP, &time);
printf ("Convolution took %f sec. on GPU\n", time);
cudaMemcpy2D (b, n*sizeof(float), gpu_b, pitch, n*sizeof(float), n, cudaMemcpyDeviceToHost);
if (err != 0) {
printf ("%s\n", cudaGetErrorString (err));
exit (1);
}
cudaFree (gpu_a);
cudaFree (gpu_b);
} | code for sm_80
Function : _Z7kconvolPfS_ii
.headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)"
/*0000*/ IMAD.MOV.U32 R1, RZ, RZ, c[0x0][0x28] ; /* 0x00000a00ff017624 */
/* 0x000fe400078e00ff */
/*0010*/ S2R R9, SR_CTAID.Y ; /* 0x0000000000097919 */
/* 0x000e220000002600 */
/*0020*/ ULDC UR4, c[0x0][0x174] ; /* 0x00005d0000047ab9 */
/* 0x000fe20000000800 */
/*0030*/ IMAD.MOV.U32 R7, RZ, RZ, 0x4 ; /* 0x00000004ff077424 */
/* 0x000fe200078e00ff */
/*0040*/ UIADD3 UR4, UR4, -0x1, URZ ; /* 0xffffffff04047890 */
/* 0x000fe2000fffe03f */
/*0050*/ S2R R14, SR_TID.Y ; /* 0x00000000000e7919 */
/* 0x000e220000002200 */
/*0060*/ ULDC.64 UR6, c[0x0][0x118] ; /* 0x0000460000067ab9 */
/* 0x000fc60000000a00 */
/*0070*/ S2R R8, SR_CTAID.X ; /* 0x0000000000087919 */
/* 0x000e680000002500 */
/*0080*/ S2R R15, SR_TID.X ; /* 0x00000000000f7919 */
/* 0x000e620000002100 */
/*0090*/ IMAD R9, R9, c[0x0][0x4], R14 ; /* 0x0000010009097a24 */
/* 0x001fca00078e020e */
/*00a0*/ ISETP.GE.AND P0, PT, R9.reuse, 0x1, PT ; /* 0x000000010900780c */
/* 0x040fe40003f06270 */
/*00b0*/ ISETP.GE.AND P2, PT, R9.reuse, UR4, PT ; /* 0x0000000409007c0c */
/* 0x040fe2000bf46270 */
/*00c0*/ IMAD R8, R8, c[0x0][0x0], R15 ; /* 0x0000000008087a24 */
/* 0x002fe200078e020f */
/*00d0*/ ISETP.NE.OR P0, PT, R14.reuse, RZ, !P0 ; /* 0x000000ff0e00720c */
/* 0x040fe40004705670 */
/*00e0*/ ISETP.NE.OR P2, PT, R14, 0xf, P2 ; /* 0x0000000f0e00780c */
/* 0x000fe20001745670 */
/*00f0*/ IMAD R0, R9, c[0x0][0x170], R8 ; /* 0x00005c0009007a24 */
/* 0x000fe200078e0208 */
/*0100*/ ISETP.GE.AND P3, PT, R8.reuse, 0x1, PT ; /* 0x000000010800780c */
/* 0x040fe40003f66270 */
/*0110*/ ISETP.GE.AND P1, PT, R8, UR4, PT ; /* 0x0000000408007c0c */
/* 0x000fe2000bf26270 */
/*0120*/ IMAD.WIDE R2, R0, R7, c[0x0][0x160] ; /* 0x0000580000027625 */
/* 0x000fe200078e0207 */
/*0130*/ ISETP.NE.OR P4, PT, R15, RZ, !P3 ; /* 0x000000ff0f00720c */
/* 0x000fc40005f85670 */
/*0140*/ ISETP.NE.OR P1, PT, R15, 0xf, P1 ; /* 0x0000000f0f00780c */
/* 0x000fe40000f25670 */
/*0150*/ LDG.E R11, [R2.64] ; /* 0x00000006020b7981 */
/* 0x000ea2000c1e1900 */
/*0160*/ @!P0 IADD3 R4, R0, -c[0x0][0x170], RZ ; /* 0x80005c0000048a10 */
/* 0x000fca0007ffe0ff */
/*0170*/ @!P0 IMAD.WIDE R4, R4, R7, c[0x0][0x160] ; /* 0x0000580004048625 */
/* 0x000fc600078e0207 */
/*0180*/ @!P4 LDG.E R12, [R2.64+-0x4] ; /* 0xfffffc06020cc981 */
/* 0x000ee2000c1e1900 */
/*0190*/ IMAD.WIDE R6, R7, c[0x0][0x170], R2 ; /* 0x00005c0007067a25 */
/* 0x000fc600078e0202 */
/*01a0*/ @!P0 LDG.E R4, [R4.64] ; /* 0x0000000604048981 */
/* 0x000f28000c1e1900 */
/*01b0*/ @!P2 LDG.E R17, [R6.64] ; /* 0x000000060611a981 */
/* 0x000f68000c1e1900 */
/*01c0*/ @!P1 LDG.E R13, [R6.64] ; /* 0x00000006060d9981 */
/* 0x000f62000c1e1900 */
/*01d0*/ IADD3 R10, R14.reuse, 0x1, RZ ; /* 0x000000010e0a7810 */
/* 0x040fe20007ffe0ff */
/*01e0*/ IMAD R16, R14, 0x12, R15 ; /* 0x000000120e107824 */
/* 0x000fc800078e020f */
/*01f0*/ IMAD R10, R10, 0x12, R15 ; /* 0x000000120a0a7824 */
/* 0x000fe400078e020f */
/*0200*/ @!P4 IMAD R15, R14, 0x48, RZ ; /* 0x000000480e0fc824 */
/* 0x000fc600078e02ff */
/*0210*/ IADD3 R10, R10, -0x12, RZ ; /* 0xffffffee0a0a7810 */
/* 0x000fe40007ffe0ff */
/*0220*/ ISETP.GE.AND P5, PT, R8, c[0x0][0x174], PT ; /* 0x00005d0008007a0c */
/* 0x000fc80003fa6270 */
/*0230*/ ISETP.GE.OR P5, PT, R9, c[0x0][0x174], P5 ; /* 0x00005d0009007a0c */
/* 0x000fe20002fa6670 */
/*0240*/ STS [R16.X4+0x4c], R11 ; /* 0x00004c0b10007388 */
/* 0x0041e80000004800 */
/*0250*/ @!P4 STS [R15+0x48], R12 ; /* 0x0000480c0f00c388 */
/* 0x0081e80000000800 */
/*0260*/ @!P0 STS [R10.X4+0x4], R4 ; /* 0x000004040a008388 */
/* 0x0101e80000004800 */
/*0270*/ @!P2 STS [R10.X4+0x94], R17 ; /* 0x000094110a00a388 */
/* 0x0201e80000004800 */
/*0280*/ @!P1 STS [R10.X4+0x4], R13 ; /* 0x0000040d0a009388 */
/* 0x0001e80000004800 */
/*0290*/ BAR.SYNC.DEFER_BLOCKING 0x0 ; /* 0x0000000000007b1d */
/* 0x000fec0000010000 */
/*02a0*/ @P5 EXIT ; /* 0x000000000000594d */
/* 0x000fea0003800000 */
/*02b0*/ ISETP.NE.AND P0, PT, R9, RZ, PT ; /* 0x000000ff0900720c */
/* 0x001fe20003f05270 */
/*02c0*/ BSSY B0, 0x3f0 ; /* 0x0000012000007945 */
/* 0x000fe20003800000 */
/*02d0*/ SHF.R.S32.HI R11, RZ, 0x1f, R0 ; /* 0x0000001fff0b7819 */
/* 0x000fc40000011400 */
/*02e0*/ ISETP.EQ.OR P0, PT, R8, RZ, !P0 ; /* 0x000000ff0800720c */
/* 0x000fc80004702670 */
/*02f0*/ ISETP.EQ.OR P0, PT, R8, UR4, P0 ; /* 0x0000000408007c0c */
/* 0x000fc80008702670 */
/*0300*/ ISETP.EQ.OR P0, PT, R9, UR4, P0 ; /* 0x0000000409007c0c */
/* 0x000fda0008702670 */
/*0310*/ @P0 BRA 0x3d0 ; /* 0x000000b000000947 */
/* 0x000fea0003800000 */
/*0320*/ LDS R2, [R10.X4+0x48] ; /* 0x000048000a027984 */
/* 0x000fe80000004800 */
/*0330*/ LDS R3, [R10.X4+0x4] ; /* 0x000004000a037984 */
/* 0x000e280000004800 */
/*0340*/ LDS R5, [R10.X4+0x4c] ; /* 0x00004c000a057984 */
/* 0x000e680000004800 */
/*0350*/ LDS R7, [R10.X4+0x50] ; /* 0x000050000a077984 */
/* 0x000ea80000004800 */
/*0360*/ LDS R9, [R10.X4+0x94] ; /* 0x000094000a097984 */
/* 0x000ee20000004800 */
/*0370*/ FADD R2, R2, R3 ; /* 0x0000000302027221 */
/* 0x001fc80000000000 */
/*0380*/ FADD R2, R2, R5 ; /* 0x0000000502027221 */
/* 0x002fc80000000000 */
/*0390*/ FADD R2, R2, R7 ; /* 0x0000000702027221 */
/* 0x004fc80000000000 */
/*03a0*/ FADD R2, R2, R9 ; /* 0x0000000902027221 */
/* 0x008fc80000000000 */
/*03b0*/ FMUL R5, R2, 0.20000000298023223877 ; /* 0x3e4ccccd02057820 */
/* 0x000fe20000400000 */
/*03c0*/ BRA 0x3e0 ; /* 0x0000001000007947 */
/* 0x000fea0003800000 */
/*03d0*/ LDS R5, [R10.X4+0x4c] ; /* 0x00004c000a057984 */
/* 0x0000640000004800 */
/*03e0*/ BSYNC B0 ; /* 0x0000000000007941 */
/* 0x000fea0003800000 */
/*03f0*/ STS [R10.X4+0x55c], R5 ; /* 0x00055c050a007388 */
/* 0x0023e20000004800 */
/*0400*/ @!P3 EXIT ; /* 0x000000000000b94d */
/* 0x000fea0003800000 */
/*0410*/ LEA R2, P0, R0, c[0x0][0x168], 0x2 ; /* 0x00005a0000027a11 */
/* 0x000fc800078010ff */
/*0420*/ LEA.HI.X R3, R0, c[0x0][0x16c], R11, 0x2, P0 ; /* 0x00005b0000037a11 */
/* 0x000fca00000f140b */
/*0430*/ STG.E [R2.64], R5 ; /* 0x0000000502007986 */
/* 0x000fe2000c101906 */
/*0440*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*0450*/ BRA 0x450; /* 0xfffffff000007947 */
/* 0x000fc0000383ffff */
/*0460*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0470*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0480*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0490*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*04a0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*04b0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*04c0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*04d0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*04e0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*04f0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
.......... |
You are a helpful coding assistant specialized in converting CUDA source code to CUDA host assembly. | #include <time.h>
#include <cuda.h>
#include <stdio.h>
#define STOP 0
#define START 1
#define BLOCK_X 16
#define BLOCK_Y 16
extern "C" void chrono (int kind, float *time);
__global__ void kconvol (float *gpu_a, float *gpu_b, int pitch, int n) {
int ig, jg, lg, il, jl, ll;
__shared__ float la[(BLOCK_X+2)*(BLOCK_Y+2)];
__shared__ float lb[(BLOCK_X+2)*(BLOCK_Y+2)];
// A thread now has two sets of coordinates :
// (ig, jg) in the global array
// (il, jl) in the local array (shared) of size (BLOCK_X+2)*(BLOCK_Y+2)
ig = blockDim.x*blockIdx.x+threadIdx.x;
jg = blockDim.y*blockIdx.y+threadIdx.y;
lg = ig+jg*pitch;
// UP TO YOU : write below the indices il and jl
il = threadIdx.x+1;
jl = threadIdx.y+1;
ll = il+jl*(BLOCK_X+2);
// What does the following line correspond to ?
la[ll] = gpu_a[lg];
if ((il == 1) && (ig > 0)) // What does the following line correespond to ?
la[ll-1] = gpu_a[lg-1];
if ((jl == 1) && (jg > 0))
la[ll-BLOCK_X-2] = gpu_a[lg-pitch];
if ((il == BLOCK_X) && (ig < n-1)) // UP TO YOU The following line is missing. Find out what was intended
la[ll-BLOCK_X-2]= gpu_a[lg+pitch];
if ((jl == BLOCK_Y) && (jg < n-1)) // UP TO YOU Find out the missing offset of local array below
la[ll+BLOCK_X+2] = gpu_a[lg+pitch];
__syncthreads ();
if ((ig >= n) || (jg >= n)) return;
if ((ig == 0) || (jg == 0) || (ig == n-1) || (jg == n-1)) {
lb[ll] = la[ll];
}
else
/* UP TO YOU : fill up below the missing indices */
lb[ll]=(1.f/5.f)*( +la[ll-BLOCK_X-2]+ \
la[ll-1] +la[ll] +la[ll+1]+ \
+la[ll+BLOCK_X+2]);
if((ig<n) &&(ig>0))
gpu_b[lg] = lb[ll];
}
extern "C" void gpu_convol (float *a, float *b, int n) {
float *gpu_a;
float *gpu_b;
cudaError_t err;
size_t pitch;
float time;
err = cudaMallocPitch (&gpu_a, &pitch, n*sizeof(float), n);
if (err != 0) {
printf ("Error allocating gpu_a: %s\n", cudaGetErrorString (err));
exit (1);
}
err = cudaMallocPitch (&gpu_b, &pitch, n*sizeof(float), n);
if (err != 0) {
printf ("Error allocating gpu_b: %s\n", cudaGetErrorString (err));
exit (1);
}
dim3 block (BLOCK_X, BLOCK_Y);
dim3 grid;
grid.x = (n-1)/BLOCK_X+1;
grid.y = (n-1)/BLOCK_Y+1;
cudaMemcpy2D (gpu_a, pitch, a, n*sizeof(float), n*sizeof(float), n, cudaMemcpyHostToDevice);
chrono (START, &time);
kconvol <<<grid, block>>> (gpu_a, gpu_b, pitch/sizeof(float), n);
err=cudaThreadSynchronize ();
chrono (STOP, &time);
printf ("Convolution took %f sec. on GPU\n", time);
cudaMemcpy2D (b, n*sizeof(float), gpu_b, pitch, n*sizeof(float), n, cudaMemcpyDeviceToHost);
if (err != 0) {
printf ("%s\n", cudaGetErrorString (err));
exit (1);
}
cudaFree (gpu_a);
cudaFree (gpu_b);
} | .file "tmpxft_001a4401_00000000-6_convol.cudafe1.cpp"
.text
#APP
#NO_APP
.type _ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2060:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaUnregisterFatBinary@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2060:
.size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
.globl _Z30__device_stub__Z7kconvolPfS_iiPfS_ii
.type _Z30__device_stub__Z7kconvolPfS_iiPfS_ii, @function
_Z30__device_stub__Z7kconvolPfS_iiPfS_ii:
.LFB2082:
.cfi_startproc
endbr64
subq $152, %rsp
.cfi_def_cfa_offset 160
movq %rdi, 24(%rsp)
movq %rsi, 16(%rsp)
movl %edx, 12(%rsp)
movl %ecx, 8(%rsp)
movq %fs:40, %rax
movq %rax, 136(%rsp)
xorl %eax, %eax
leaq 24(%rsp), %rax
movq %rax, 96(%rsp)
leaq 16(%rsp), %rax
movq %rax, 104(%rsp)
leaq 12(%rsp), %rax
movq %rax, 112(%rsp)
leaq 8(%rsp), %rax
movq %rax, 120(%rsp)
movl $1, 48(%rsp)
movl $1, 52(%rsp)
movl $1, 56(%rsp)
movl $1, 60(%rsp)
movl $1, 64(%rsp)
movl $1, 68(%rsp)
leaq 40(%rsp), %rcx
leaq 32(%rsp), %rdx
leaq 60(%rsp), %rsi
leaq 48(%rsp), %rdi
call __cudaPopCallConfiguration@PLT
testl %eax, %eax
je .L7
.L3:
movq 136(%rsp), %rax
subq %fs:40, %rax
jne .L8
addq $152, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 8
ret
.L7:
.cfi_restore_state
pushq 40(%rsp)
.cfi_def_cfa_offset 168
pushq 40(%rsp)
.cfi_def_cfa_offset 176
leaq 112(%rsp), %r9
movq 76(%rsp), %rcx
movl 84(%rsp), %r8d
movq 64(%rsp), %rsi
movl 72(%rsp), %edx
leaq _Z7kconvolPfS_ii(%rip), %rdi
call cudaLaunchKernel@PLT
addq $16, %rsp
.cfi_def_cfa_offset 160
jmp .L3
.L8:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE2082:
.size _Z30__device_stub__Z7kconvolPfS_iiPfS_ii, .-_Z30__device_stub__Z7kconvolPfS_iiPfS_ii
.globl _Z7kconvolPfS_ii
.type _Z7kconvolPfS_ii, @function
_Z7kconvolPfS_ii:
.LFB2083:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
call _Z30__device_stub__Z7kconvolPfS_iiPfS_ii
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2083:
.size _Z7kconvolPfS_ii, .-_Z7kconvolPfS_ii
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "Error allocating gpu_a: %s\n"
.LC1:
.string "Error allocating gpu_b: %s\n"
.section .rodata.str1.8,"aMS",@progbits,1
.align 8
.LC2:
.string "Convolution took %f sec. on GPU\n"
.section .rodata.str1.1
.LC3:
.string "%s\n"
.text
.globl gpu_convol
.type gpu_convol, @function
gpu_convol:
.LFB2057:
.cfi_startproc
endbr64
pushq %r14
.cfi_def_cfa_offset 16
.cfi_offset 14, -16
pushq %r13
.cfi_def_cfa_offset 24
.cfi_offset 13, -24
pushq %r12
.cfi_def_cfa_offset 32
.cfi_offset 12, -32
pushq %rbp
.cfi_def_cfa_offset 40
.cfi_offset 6, -40
pushq %rbx
.cfi_def_cfa_offset 48
.cfi_offset 3, -48
subq $64, %rsp
.cfi_def_cfa_offset 112
movq %rdi, %r14
movq %rsi, %r13
movl %edx, %ebx
movq %fs:40, %rax
movq %rax, 56(%rsp)
xorl %eax, %eax
movslq %edx, %r12
leaq 0(,%r12,4), %rbp
leaq 24(%rsp), %rsi
leaq 8(%rsp), %rdi
movq %r12, %rcx
movq %rbp, %rdx
call cudaMallocPitch@PLT
testl %eax, %eax
jne .L18
leaq 24(%rsp), %rsi
leaq 16(%rsp), %rdi
movq %r12, %rcx
movq %rbp, %rdx
call cudaMallocPitch@PLT
testl %eax, %eax
jne .L19
movl $16, 32(%rsp)
movl $16, 36(%rsp)
movl $1, 40(%rsp)
movl $1, 52(%rsp)
leal 14(%rbx), %eax
movl %ebx, %edx
subl $1, %edx
cmovns %edx, %eax
sarl $4, %eax
addl $1, %eax
movl %eax, 44(%rsp)
movl %eax, 48(%rsp)
subq $8, %rsp
.cfi_def_cfa_offset 120
pushq $1
.cfi_def_cfa_offset 128
movq %r12, %r9
movq %rbp, %r8
movq %rbp, %rcx
movq %r14, %rdx
movq 40(%rsp), %rsi
movq 24(%rsp), %rdi
call cudaMemcpy2D@PLT
addq $16, %rsp
.cfi_def_cfa_offset 112
leaq 4(%rsp), %rsi
movl $1, %edi
call chrono@PLT
movl 40(%rsp), %ecx
movl $0, %r9d
movl $0, %r8d
movq 32(%rsp), %rdx
movq 44(%rsp), %rdi
movl 52(%rsp), %esi
call __cudaPushCallConfiguration@PLT
testl %eax, %eax
je .L20
.L14:
call cudaThreadSynchronize@PLT
movl %eax, %ebx
leaq 4(%rsp), %rsi
movl $0, %edi
call chrono@PLT
pxor %xmm0, %xmm0
cvtss2sd 4(%rsp), %xmm0
leaq .LC2(%rip), %rsi
movl $2, %edi
movl $1, %eax
call __printf_chk@PLT
subq $8, %rsp
.cfi_def_cfa_offset 120
pushq $2
.cfi_def_cfa_offset 128
movq %r12, %r9
movq %rbp, %r8
movq 40(%rsp), %rcx
movq 32(%rsp), %rdx
movq %rbp, %rsi
movq %r13, %rdi
call cudaMemcpy2D@PLT
addq $16, %rsp
.cfi_def_cfa_offset 112
testl %ebx, %ebx
jne .L21
movq 8(%rsp), %rdi
call cudaFree@PLT
movq 16(%rsp), %rdi
call cudaFree@PLT
movq 56(%rsp), %rax
subq %fs:40, %rax
jne .L22
addq $64, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 48
popq %rbx
.cfi_def_cfa_offset 40
popq %rbp
.cfi_def_cfa_offset 32
popq %r12
.cfi_def_cfa_offset 24
popq %r13
.cfi_def_cfa_offset 16
popq %r14
.cfi_def_cfa_offset 8
ret
.L18:
.cfi_restore_state
movl %eax, %edi
call cudaGetErrorString@PLT
movq %rax, %rdx
leaq .LC0(%rip), %rsi
movl $2, %edi
movl $0, %eax
call __printf_chk@PLT
movl $1, %edi
call exit@PLT
.L19:
movl %eax, %edi
call cudaGetErrorString@PLT
movq %rax, %rdx
leaq .LC1(%rip), %rsi
movl $2, %edi
movl $0, %eax
call __printf_chk@PLT
movl $1, %edi
call exit@PLT
.L20:
movq 24(%rsp), %rdx
shrq $2, %rdx
movl %ebx, %ecx
movq 16(%rsp), %rsi
movq 8(%rsp), %rdi
call _Z30__device_stub__Z7kconvolPfS_iiPfS_ii
jmp .L14
.L21:
movl %ebx, %edi
call cudaGetErrorString@PLT
movq %rax, %rdx
leaq .LC3(%rip), %rsi
movl $2, %edi
movl $0, %eax
call __printf_chk@PLT
movl $1, %edi
call exit@PLT
.L22:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE2057:
.size gpu_convol, .-gpu_convol
.section .rodata.str1.1
.LC4:
.string "_Z7kconvolPfS_ii"
.text
.type _ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2085:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
leaq _ZL15__fatDeviceText(%rip), %rdi
call __cudaRegisterFatBinary@PLT
movq %rax, %rdi
movq %rax, _ZL20__cudaFatCubinHandle(%rip)
pushq $0
.cfi_def_cfa_offset 24
pushq $0
.cfi_def_cfa_offset 32
pushq $0
.cfi_def_cfa_offset 40
pushq $0
.cfi_def_cfa_offset 48
movl $0, %r9d
movl $-1, %r8d
leaq .LC4(%rip), %rdx
movq %rdx, %rcx
leaq _Z7kconvolPfS_ii(%rip), %rsi
call __cudaRegisterFunction@PLT
addq $32, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaRegisterFatBinaryEnd@PLT
leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
call atexit@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2085:
.size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
.section .init_array,"aw"
.align 8
.quad _ZL24__sti____cudaRegisterAllv
.section .nvFatBinSegment,"aw"
.align 8
.type _ZL15__fatDeviceText, @object
.size _ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
.long 1180844977
.long 1
.quad fatbinData
.quad 0
.local _ZL20__cudaFatCubinHandle
.comm _ZL20__cudaFatCubinHandle,8,8
.ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
.section .note.GNU-stack,"",@progbits
.section .note.gnu.property,"a"
.align 8
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.string "GNU"
1:
.align 8
.long 0xc0000002
.long 3f - 2f
2:
.long 0x3
3:
.align 8
4: |
You are a helpful coding assistant specialized in converting CUDA source code to HIP/AMD source code. | #include <time.h>
#include <cuda.h>
#include <stdio.h>
#define STOP 0
#define START 1
#define BLOCK_X 16
#define BLOCK_Y 16
extern "C" void chrono (int kind, float *time);
__global__ void kconvol (float *gpu_a, float *gpu_b, int pitch, int n) {
int ig, jg, lg, il, jl, ll;
__shared__ float la[(BLOCK_X+2)*(BLOCK_Y+2)];
__shared__ float lb[(BLOCK_X+2)*(BLOCK_Y+2)];
// A thread now has two sets of coordinates :
// (ig, jg) in the global array
// (il, jl) in the local array (shared) of size (BLOCK_X+2)*(BLOCK_Y+2)
ig = blockDim.x*blockIdx.x+threadIdx.x;
jg = blockDim.y*blockIdx.y+threadIdx.y;
lg = ig+jg*pitch;
// UP TO YOU : write below the indices il and jl
il = threadIdx.x+1;
jl = threadIdx.y+1;
ll = il+jl*(BLOCK_X+2);
// What does the following line correspond to ?
la[ll] = gpu_a[lg];
if ((il == 1) && (ig > 0)) // What does the following line correespond to ?
la[ll-1] = gpu_a[lg-1];
if ((jl == 1) && (jg > 0))
la[ll-BLOCK_X-2] = gpu_a[lg-pitch];
if ((il == BLOCK_X) && (ig < n-1)) // UP TO YOU The following line is missing. Find out what was intended
la[ll-BLOCK_X-2]= gpu_a[lg+pitch];
if ((jl == BLOCK_Y) && (jg < n-1)) // UP TO YOU Find out the missing offset of local array below
la[ll+BLOCK_X+2] = gpu_a[lg+pitch];
__syncthreads ();
if ((ig >= n) || (jg >= n)) return;
if ((ig == 0) || (jg == 0) || (ig == n-1) || (jg == n-1)) {
lb[ll] = la[ll];
}
else
/* UP TO YOU : fill up below the missing indices */
lb[ll]=(1.f/5.f)*( +la[ll-BLOCK_X-2]+ \
la[ll-1] +la[ll] +la[ll+1]+ \
+la[ll+BLOCK_X+2]);
if((ig<n) &&(ig>0))
gpu_b[lg] = lb[ll];
}
extern "C" void gpu_convol (float *a, float *b, int n) {
float *gpu_a;
float *gpu_b;
cudaError_t err;
size_t pitch;
float time;
err = cudaMallocPitch (&gpu_a, &pitch, n*sizeof(float), n);
if (err != 0) {
printf ("Error allocating gpu_a: %s\n", cudaGetErrorString (err));
exit (1);
}
err = cudaMallocPitch (&gpu_b, &pitch, n*sizeof(float), n);
if (err != 0) {
printf ("Error allocating gpu_b: %s\n", cudaGetErrorString (err));
exit (1);
}
dim3 block (BLOCK_X, BLOCK_Y);
dim3 grid;
grid.x = (n-1)/BLOCK_X+1;
grid.y = (n-1)/BLOCK_Y+1;
cudaMemcpy2D (gpu_a, pitch, a, n*sizeof(float), n*sizeof(float), n, cudaMemcpyHostToDevice);
chrono (START, &time);
kconvol <<<grid, block>>> (gpu_a, gpu_b, pitch/sizeof(float), n);
err=cudaThreadSynchronize ();
chrono (STOP, &time);
printf ("Convolution took %f sec. on GPU\n", time);
cudaMemcpy2D (b, n*sizeof(float), gpu_b, pitch, n*sizeof(float), n, cudaMemcpyDeviceToHost);
if (err != 0) {
printf ("%s\n", cudaGetErrorString (err));
exit (1);
}
cudaFree (gpu_a);
cudaFree (gpu_b);
} | #include <time.h>
#include <hip/hip_runtime.h>
#include <stdio.h>
#define STOP 0
#define START 1
#define BLOCK_X 16
#define BLOCK_Y 16
extern "C" void chrono (int kind, float *time);
__global__ void kconvol (float *gpu_a, float *gpu_b, int pitch, int n) {
int ig, jg, lg, il, jl, ll;
__shared__ float la[(BLOCK_X+2)*(BLOCK_Y+2)];
__shared__ float lb[(BLOCK_X+2)*(BLOCK_Y+2)];
// A thread now has two sets of coordinates :
// (ig, jg) in the global array
// (il, jl) in the local array (shared) of size (BLOCK_X+2)*(BLOCK_Y+2)
ig = blockDim.x*blockIdx.x+threadIdx.x;
jg = blockDim.y*blockIdx.y+threadIdx.y;
lg = ig+jg*pitch;
// UP TO YOU : write below the indices il and jl
il = threadIdx.x+1;
jl = threadIdx.y+1;
ll = il+jl*(BLOCK_X+2);
// What does the following line correspond to ?
la[ll] = gpu_a[lg];
if ((il == 1) && (ig > 0)) // What does the following line correespond to ?
la[ll-1] = gpu_a[lg-1];
if ((jl == 1) && (jg > 0))
la[ll-BLOCK_X-2] = gpu_a[lg-pitch];
if ((il == BLOCK_X) && (ig < n-1)) // UP TO YOU The following line is missing. Find out what was intended
la[ll-BLOCK_X-2]= gpu_a[lg+pitch];
if ((jl == BLOCK_Y) && (jg < n-1)) // UP TO YOU Find out the missing offset of local array below
la[ll+BLOCK_X+2] = gpu_a[lg+pitch];
__syncthreads ();
if ((ig >= n) || (jg >= n)) return;
if ((ig == 0) || (jg == 0) || (ig == n-1) || (jg == n-1)) {
lb[ll] = la[ll];
}
else
/* UP TO YOU : fill up below the missing indices */
lb[ll]=(1.f/5.f)*( +la[ll-BLOCK_X-2]+ \
la[ll-1] +la[ll] +la[ll+1]+ \
+la[ll+BLOCK_X+2]);
if((ig<n) &&(ig>0))
gpu_b[lg] = lb[ll];
}
extern "C" void gpu_convol (float *a, float *b, int n) {
float *gpu_a;
float *gpu_b;
hipError_t err;
size_t pitch;
float time;
err = hipMallocPitch (&gpu_a, &pitch, n*sizeof(float), n);
if (err != 0) {
printf ("Error allocating gpu_a: %s\n", hipGetErrorString (err));
exit (1);
}
err = hipMallocPitch (&gpu_b, &pitch, n*sizeof(float), n);
if (err != 0) {
printf ("Error allocating gpu_b: %s\n", hipGetErrorString (err));
exit (1);
}
dim3 block (BLOCK_X, BLOCK_Y);
dim3 grid;
grid.x = (n-1)/BLOCK_X+1;
grid.y = (n-1)/BLOCK_Y+1;
hipMemcpy2D (gpu_a, pitch, a, n*sizeof(float), n*sizeof(float), n, hipMemcpyHostToDevice);
chrono (START, &time);
kconvol <<<grid, block>>> (gpu_a, gpu_b, pitch/sizeof(float), n);
err=hipDeviceSynchronize ();
chrono (STOP, &time);
printf ("Convolution took %f sec. on GPU\n", time);
hipMemcpy2D (b, n*sizeof(float), gpu_b, pitch, n*sizeof(float), n, hipMemcpyDeviceToHost);
if (err != 0) {
printf ("%s\n", hipGetErrorString (err));
exit (1);
}
hipFree (gpu_a);
hipFree (gpu_b);
} |
You are a helpful coding assistant specialized in converting HIP source code to AMD device assembly. | #include <time.h>
#include <hip/hip_runtime.h>
#include <stdio.h>
#define STOP 0
#define START 1
#define BLOCK_X 16
#define BLOCK_Y 16
extern "C" void chrono (int kind, float *time);
__global__ void kconvol (float *gpu_a, float *gpu_b, int pitch, int n) {
int ig, jg, lg, il, jl, ll;
__shared__ float la[(BLOCK_X+2)*(BLOCK_Y+2)];
__shared__ float lb[(BLOCK_X+2)*(BLOCK_Y+2)];
// A thread now has two sets of coordinates :
// (ig, jg) in the global array
// (il, jl) in the local array (shared) of size (BLOCK_X+2)*(BLOCK_Y+2)
ig = blockDim.x*blockIdx.x+threadIdx.x;
jg = blockDim.y*blockIdx.y+threadIdx.y;
lg = ig+jg*pitch;
// UP TO YOU : write below the indices il and jl
il = threadIdx.x+1;
jl = threadIdx.y+1;
ll = il+jl*(BLOCK_X+2);
// What does the following line correspond to ?
la[ll] = gpu_a[lg];
if ((il == 1) && (ig > 0)) // What does the following line correespond to ?
la[ll-1] = gpu_a[lg-1];
if ((jl == 1) && (jg > 0))
la[ll-BLOCK_X-2] = gpu_a[lg-pitch];
if ((il == BLOCK_X) && (ig < n-1)) // UP TO YOU The following line is missing. Find out what was intended
la[ll-BLOCK_X-2]= gpu_a[lg+pitch];
if ((jl == BLOCK_Y) && (jg < n-1)) // UP TO YOU Find out the missing offset of local array below
la[ll+BLOCK_X+2] = gpu_a[lg+pitch];
__syncthreads ();
if ((ig >= n) || (jg >= n)) return;
if ((ig == 0) || (jg == 0) || (ig == n-1) || (jg == n-1)) {
lb[ll] = la[ll];
}
else
/* UP TO YOU : fill up below the missing indices */
lb[ll]=(1.f/5.f)*( +la[ll-BLOCK_X-2]+ \
la[ll-1] +la[ll] +la[ll+1]+ \
+la[ll+BLOCK_X+2]);
if((ig<n) &&(ig>0))
gpu_b[lg] = lb[ll];
}
extern "C" void gpu_convol (float *a, float *b, int n) {
float *gpu_a;
float *gpu_b;
hipError_t err;
size_t pitch;
float time;
err = hipMallocPitch (&gpu_a, &pitch, n*sizeof(float), n);
if (err != 0) {
printf ("Error allocating gpu_a: %s\n", hipGetErrorString (err));
exit (1);
}
err = hipMallocPitch (&gpu_b, &pitch, n*sizeof(float), n);
if (err != 0) {
printf ("Error allocating gpu_b: %s\n", hipGetErrorString (err));
exit (1);
}
dim3 block (BLOCK_X, BLOCK_Y);
dim3 grid;
grid.x = (n-1)/BLOCK_X+1;
grid.y = (n-1)/BLOCK_Y+1;
hipMemcpy2D (gpu_a, pitch, a, n*sizeof(float), n*sizeof(float), n, hipMemcpyHostToDevice);
chrono (START, &time);
kconvol <<<grid, block>>> (gpu_a, gpu_b, pitch/sizeof(float), n);
err=hipDeviceSynchronize ();
chrono (STOP, &time);
printf ("Convolution took %f sec. on GPU\n", time);
hipMemcpy2D (b, n*sizeof(float), gpu_b, pitch, n*sizeof(float), n, hipMemcpyDeviceToHost);
if (err != 0) {
printf ("%s\n", hipGetErrorString (err));
exit (1);
}
hipFree (gpu_a);
hipFree (gpu_b);
} | .text
.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
.protected _Z7kconvolPfS_ii
.globl _Z7kconvolPfS_ii
.p2align 8
.type _Z7kconvolPfS_ii,@function
_Z7kconvolPfS_ii:
s_clause 0x1
s_load_b32 s2, s[0:1], 0x24
s_load_b32 s6, s[0:1], 0x10
v_and_b32_e32 v2, 0x3ff, v0
v_bfe_u32 v6, v0, 10, 10
s_load_b64 s[4:5], s[0:1], 0x0
s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
v_add_nc_u32_e32 v12, 1, v2
v_add_nc_u32_e32 v11, 1, v6
s_delay_alu instid0(VALU_DEP_1)
v_mul_u32_u24_e32 v10, 18, v11
s_waitcnt lgkmcnt(0)
s_and_b32 s3, s2, 0xffff
s_lshr_b32 s2, s2, 16
v_mad_u64_u32 v[3:4], null, s14, s3, v[2:3]
v_mad_u64_u32 v[4:5], null, s15, s2, v[6:7]
v_mad_u32_u24 v5, v11, 18, v12
v_cmp_eq_u32_e64 s2, 0, v2
s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_4)
v_lshlrev_b32_e32 v9, 2, v5
v_mad_u64_u32 v[0:1], null, v4, s6, v[3:4]
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_ashrrev_i32_e32 v1, 31, v0
v_lshlrev_b64 v[7:8], 2, v[0:1]
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
v_add_co_u32 v7, vcc_lo, s4, v7
v_add_co_ci_u32_e32 v8, vcc_lo, s5, v8, vcc_lo
v_cmp_lt_i32_e32 vcc_lo, 0, v3
global_load_b32 v13, v[7:8], off
s_and_b32 s3, s2, vcc_lo
s_waitcnt vmcnt(0)
ds_store_b32 v9, v13
s_and_saveexec_b32 s2, s3
s_cbranch_execz .LBB0_2
global_load_b32 v7, v[7:8], off offset:-4
v_add_lshl_u32 v8, v10, v2, 2
s_waitcnt vmcnt(0)
ds_store_b32 v8, v7
.LBB0_2:
s_or_b32 exec_lo, exec_lo, s2
v_cmp_eq_u32_e64 s2, 0, v6
v_cmp_lt_i32_e64 s3, 0, v4
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
s_and_b32 s2, s2, s3
s_and_saveexec_b32 s3, s2
s_cbranch_execz .LBB0_4
v_subrev_nc_u32_e32 v6, s6, v0
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_ashrrev_i32_e32 v7, 31, v6
v_lshlrev_b64 v[6:7], 2, v[6:7]
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_add_co_u32 v6, s2, s4, v6
v_add_co_ci_u32_e64 v7, s2, s5, v7, s2
global_load_b32 v6, v[6:7], off
v_lshl_add_u32 v7, v5, 2, 0xffffffb8
s_waitcnt vmcnt(0)
ds_store_b32 v7, v6
.LBB0_4:
s_or_b32 exec_lo, exec_lo, s3
s_load_b32 s8, s[0:1], 0x14
v_cmp_eq_u32_e64 s2, 16, v12
s_waitcnt lgkmcnt(0)
s_add_i32 s7, s8, -1
s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_cmp_gt_i32_e64 s3, s7, v3
s_and_b32 s2, s2, s3
s_delay_alu instid0(SALU_CYCLE_1)
s_and_saveexec_b32 s3, s2
s_cbranch_execz .LBB0_6
v_add_nc_u32_e32 v6, s6, v0
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_ashrrev_i32_e32 v7, 31, v6
v_lshlrev_b64 v[6:7], 2, v[6:7]
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_add_co_u32 v6, s2, s4, v6
v_add_co_ci_u32_e64 v7, s2, s5, v7, s2
global_load_b32 v6, v[6:7], off
v_lshl_add_u32 v7, v5, 2, 0xffffffb8
s_waitcnt vmcnt(0)
ds_store_b32 v7, v6
.LBB0_6:
s_or_b32 exec_lo, exec_lo, s3
v_cmp_eq_u32_e64 s2, 16, v11
v_cmp_gt_i32_e64 s3, s7, v4
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
s_and_b32 s2, s2, s3
s_and_saveexec_b32 s3, s2
s_cbranch_execz .LBB0_8
v_add_nc_u32_e32 v6, s6, v0
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_ashrrev_i32_e32 v7, 31, v6
v_lshlrev_b64 v[6:7], 2, v[6:7]
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_add_co_u32 v6, s2, s4, v6
v_add_co_ci_u32_e64 v7, s2, s5, v7, s2
global_load_b32 v6, v[6:7], off
v_lshlrev_b32_e32 v7, 2, v5
s_waitcnt vmcnt(0)
ds_store_b32 v7, v6 offset:72
.LBB0_8:
s_or_b32 exec_lo, exec_lo, s3
v_max_i32_e32 v6, v3, v4
s_waitcnt lgkmcnt(0)
s_barrier
buffer_gl0_inv
s_mov_b32 s3, exec_lo
v_cmpx_gt_i32_e64 s8, v6
s_cbranch_execz .LBB0_17
v_cmp_eq_u32_e64 s2, 0, v3
v_cmp_eq_u32_e64 s3, 0, v4
s_mov_b32 s6, -1
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
s_or_b32 s4, s2, s3
s_xor_b32 s2, s4, -1
s_delay_alu instid0(SALU_CYCLE_1)
s_and_saveexec_b32 s5, s2
s_cbranch_execz .LBB0_13
v_cmp_ne_u32_e64 s2, s7, v3
v_cmp_ne_u32_e64 s3, s7, v4
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
s_and_b32 s3, s2, s3
s_and_saveexec_b32 s2, s3
s_cbranch_execz .LBB0_12
v_lshlrev_b32_e32 v3, 2, v5
v_add_lshl_u32 v2, v10, v2, 2
s_xor_b32 s6, exec_lo, -1
s_delay_alu instid0(VALU_DEP_2)
v_add_nc_u32_e32 v4, 0xffffffb8, v3
ds_load_b32 v6, v2
ds_load_b32 v4, v4
ds_load_b32 v7, v9
ds_load_2addr_b32 v[2:3], v3 offset0:1 offset1:18
s_waitcnt lgkmcnt(2)
v_add_f32_e32 v4, v4, v6
s_waitcnt lgkmcnt(1)
s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
v_add_f32_e32 v4, v4, v7
s_waitcnt lgkmcnt(0)
v_add_f32_e32 v2, v4, v2
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_add_f32_e32 v2, v2, v3
v_mul_f32_e32 v6, 0x3e4ccccd, v2
.LBB0_12:
s_or_b32 exec_lo, exec_lo, s2
s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
s_and_not1_b32 s2, s4, exec_lo
s_and_b32 s3, s6, exec_lo
s_or_b32 s4, s2, s3
.LBB0_13:
s_or_b32 exec_lo, exec_lo, s5
s_and_saveexec_b32 s2, s4
s_cbranch_execz .LBB0_15
ds_load_b32 v6, v9
.LBB0_15:
s_or_b32 exec_lo, exec_lo, s2
v_lshlrev_b32_e32 v2, 2, v5
s_waitcnt lgkmcnt(0)
ds_store_b32 v2, v6 offset:1296
s_and_b32 exec_lo, exec_lo, vcc_lo
s_cbranch_execz .LBB0_17
s_load_b64 s[0:1], s[0:1], 0x8
ds_load_b32 v2, v2 offset:1296
v_lshlrev_b64 v[0:1], 2, v[0:1]
s_waitcnt lgkmcnt(0)
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
v_add_co_u32 v0, vcc_lo, s0, v0
v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
global_store_b32 v[0:1], v2, off
.LBB0_17:
s_nop 0
s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
s_endpgm
.section .rodata,"a",@progbits
.p2align 6, 0x0
.amdhsa_kernel _Z7kconvolPfS_ii
.amdhsa_group_segment_fixed_size 2592
.amdhsa_private_segment_fixed_size 0
.amdhsa_kernarg_size 280
.amdhsa_user_sgpr_count 14
.amdhsa_user_sgpr_dispatch_ptr 0
.amdhsa_user_sgpr_queue_ptr 0
.amdhsa_user_sgpr_kernarg_segment_ptr 1
.amdhsa_user_sgpr_dispatch_id 0
.amdhsa_user_sgpr_private_segment_size 0
.amdhsa_wavefront_size32 1
.amdhsa_uses_dynamic_stack 0
.amdhsa_enable_private_segment 0
.amdhsa_system_sgpr_workgroup_id_x 1
.amdhsa_system_sgpr_workgroup_id_y 1
.amdhsa_system_sgpr_workgroup_id_z 0
.amdhsa_system_sgpr_workgroup_info 0
.amdhsa_system_vgpr_workitem_id 1
.amdhsa_next_free_vgpr 14
.amdhsa_next_free_sgpr 16
.amdhsa_float_round_mode_32 0
.amdhsa_float_round_mode_16_64 0
.amdhsa_float_denorm_mode_32 3
.amdhsa_float_denorm_mode_16_64 3
.amdhsa_dx10_clamp 1
.amdhsa_ieee_mode 1
.amdhsa_fp16_overflow 0
.amdhsa_workgroup_processor_mode 1
.amdhsa_memory_ordered 1
.amdhsa_forward_progress 0
.amdhsa_shared_vgpr_count 0
.amdhsa_exception_fp_ieee_invalid_op 0
.amdhsa_exception_fp_denorm_src 0
.amdhsa_exception_fp_ieee_div_zero 0
.amdhsa_exception_fp_ieee_overflow 0
.amdhsa_exception_fp_ieee_underflow 0
.amdhsa_exception_fp_ieee_inexact 0
.amdhsa_exception_int_div_zero 0
.end_amdhsa_kernel
.text
.Lfunc_end0:
.size _Z7kconvolPfS_ii, .Lfunc_end0-_Z7kconvolPfS_ii
.section .AMDGPU.csdata,"",@progbits
.text
.p2alignl 7, 3214868480
.fill 96, 4, 3214868480
.type __hip_cuid_,@object
.section .bss,"aw",@nobits
.globl __hip_cuid_
__hip_cuid_:
.byte 0
.size __hip_cuid_, 1
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym __hip_cuid_
.amdgpu_metadata
---
amdhsa.kernels:
- .args:
- .address_space: global
.offset: 0
.size: 8
.value_kind: global_buffer
- .address_space: global
.offset: 8
.size: 8
.value_kind: global_buffer
- .offset: 16
.size: 4
.value_kind: by_value
- .offset: 20
.size: 4
.value_kind: by_value
- .offset: 24
.size: 4
.value_kind: hidden_block_count_x
- .offset: 28
.size: 4
.value_kind: hidden_block_count_y
- .offset: 32
.size: 4
.value_kind: hidden_block_count_z
- .offset: 36
.size: 2
.value_kind: hidden_group_size_x
- .offset: 38
.size: 2
.value_kind: hidden_group_size_y
- .offset: 40
.size: 2
.value_kind: hidden_group_size_z
- .offset: 42
.size: 2
.value_kind: hidden_remainder_x
- .offset: 44
.size: 2
.value_kind: hidden_remainder_y
- .offset: 46
.size: 2
.value_kind: hidden_remainder_z
- .offset: 64
.size: 8
.value_kind: hidden_global_offset_x
- .offset: 72
.size: 8
.value_kind: hidden_global_offset_y
- .offset: 80
.size: 8
.value_kind: hidden_global_offset_z
- .offset: 88
.size: 2
.value_kind: hidden_grid_dims
.group_segment_fixed_size: 2592
.kernarg_segment_align: 8
.kernarg_segment_size: 280
.language: OpenCL C
.language_version:
- 2
- 0
.max_flat_workgroup_size: 1024
.name: _Z7kconvolPfS_ii
.private_segment_fixed_size: 0
.sgpr_count: 18
.sgpr_spill_count: 0
.symbol: _Z7kconvolPfS_ii.kd
.uniform_work_group_size: 1
.uses_dynamic_stack: false
.vgpr_count: 14
.vgpr_spill_count: 0
.wavefront_size: 32
.workgroup_processor_mode: 1
amdhsa.target: amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
- 1
- 2
...
.end_amdgpu_metadata |
You are a helpful coding assistant specialized in converting HIP source code to AMD host assembly. | #include <time.h>
#include <hip/hip_runtime.h>
#include <stdio.h>
#define STOP 0
#define START 1
#define BLOCK_X 16
#define BLOCK_Y 16
extern "C" void chrono (int kind, float *time);
__global__ void kconvol (float *gpu_a, float *gpu_b, int pitch, int n) {
int ig, jg, lg, il, jl, ll;
__shared__ float la[(BLOCK_X+2)*(BLOCK_Y+2)];
__shared__ float lb[(BLOCK_X+2)*(BLOCK_Y+2)];
// A thread now has two sets of coordinates :
// (ig, jg) in the global array
// (il, jl) in the local array (shared) of size (BLOCK_X+2)*(BLOCK_Y+2)
ig = blockDim.x*blockIdx.x+threadIdx.x;
jg = blockDim.y*blockIdx.y+threadIdx.y;
lg = ig+jg*pitch;
// UP TO YOU : write below the indices il and jl
il = threadIdx.x+1;
jl = threadIdx.y+1;
ll = il+jl*(BLOCK_X+2);
// What does the following line correspond to ?
la[ll] = gpu_a[lg];
if ((il == 1) && (ig > 0)) // What does the following line correespond to ?
la[ll-1] = gpu_a[lg-1];
if ((jl == 1) && (jg > 0))
la[ll-BLOCK_X-2] = gpu_a[lg-pitch];
if ((il == BLOCK_X) && (ig < n-1)) // UP TO YOU The following line is missing. Find out what was intended
la[ll-BLOCK_X-2]= gpu_a[lg+pitch];
if ((jl == BLOCK_Y) && (jg < n-1)) // UP TO YOU Find out the missing offset of local array below
la[ll+BLOCK_X+2] = gpu_a[lg+pitch];
__syncthreads ();
if ((ig >= n) || (jg >= n)) return;
if ((ig == 0) || (jg == 0) || (ig == n-1) || (jg == n-1)) {
lb[ll] = la[ll];
}
else
/* UP TO YOU : fill up below the missing indices */
lb[ll]=(1.f/5.f)*( +la[ll-BLOCK_X-2]+ \
la[ll-1] +la[ll] +la[ll+1]+ \
+la[ll+BLOCK_X+2]);
if((ig<n) &&(ig>0))
gpu_b[lg] = lb[ll];
}
extern "C" void gpu_convol (float *a, float *b, int n) {
float *gpu_a;
float *gpu_b;
hipError_t err;
size_t pitch;
float time;
err = hipMallocPitch (&gpu_a, &pitch, n*sizeof(float), n);
if (err != 0) {
printf ("Error allocating gpu_a: %s\n", hipGetErrorString (err));
exit (1);
}
err = hipMallocPitch (&gpu_b, &pitch, n*sizeof(float), n);
if (err != 0) {
printf ("Error allocating gpu_b: %s\n", hipGetErrorString (err));
exit (1);
}
dim3 block (BLOCK_X, BLOCK_Y);
dim3 grid;
grid.x = (n-1)/BLOCK_X+1;
grid.y = (n-1)/BLOCK_Y+1;
hipMemcpy2D (gpu_a, pitch, a, n*sizeof(float), n*sizeof(float), n, hipMemcpyHostToDevice);
chrono (START, &time);
kconvol <<<grid, block>>> (gpu_a, gpu_b, pitch/sizeof(float), n);
err=hipDeviceSynchronize ();
chrono (STOP, &time);
printf ("Convolution took %f sec. on GPU\n", time);
hipMemcpy2D (b, n*sizeof(float), gpu_b, pitch, n*sizeof(float), n, hipMemcpyDeviceToHost);
if (err != 0) {
printf ("%s\n", hipGetErrorString (err));
exit (1);
}
hipFree (gpu_a);
hipFree (gpu_b);
} | .text
.file "convol.hip"
.globl _Z22__device_stub__kconvolPfS_ii # -- Begin function _Z22__device_stub__kconvolPfS_ii
.p2align 4, 0x90
.type _Z22__device_stub__kconvolPfS_ii,@function
_Z22__device_stub__kconvolPfS_ii: # @_Z22__device_stub__kconvolPfS_ii
.cfi_startproc
# %bb.0:
subq $120, %rsp
.cfi_def_cfa_offset 128
movq %rdi, 72(%rsp)
movq %rsi, 64(%rsp)
movl %edx, 12(%rsp)
movl %ecx, 8(%rsp)
leaq 72(%rsp), %rax
movq %rax, 80(%rsp)
leaq 64(%rsp), %rax
movq %rax, 88(%rsp)
leaq 12(%rsp), %rax
movq %rax, 96(%rsp)
leaq 8(%rsp), %rax
movq %rax, 104(%rsp)
leaq 48(%rsp), %rdi
leaq 32(%rsp), %rsi
leaq 24(%rsp), %rdx
leaq 16(%rsp), %rcx
callq __hipPopCallConfiguration
movq 48(%rsp), %rsi
movl 56(%rsp), %edx
movq 32(%rsp), %rcx
movl 40(%rsp), %r8d
leaq 80(%rsp), %r9
movl $_Z7kconvolPfS_ii, %edi
pushq 16(%rsp)
.cfi_adjust_cfa_offset 8
pushq 32(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $136, %rsp
.cfi_adjust_cfa_offset -136
retq
.Lfunc_end0:
.size _Z22__device_stub__kconvolPfS_ii, .Lfunc_end0-_Z22__device_stub__kconvolPfS_ii
.cfi_endproc
# -- End function
.globl gpu_convol # -- Begin function gpu_convol
.p2align 4, 0x90
.type gpu_convol,@function
gpu_convol: # @gpu_convol
.cfi_startproc
# %bb.0:
pushq %rbp
.cfi_def_cfa_offset 16
pushq %r15
.cfi_def_cfa_offset 24
pushq %r14
.cfi_def_cfa_offset 32
pushq %r13
.cfi_def_cfa_offset 40
pushq %r12
.cfi_def_cfa_offset 48
pushq %rbx
.cfi_def_cfa_offset 56
subq $168, %rsp
.cfi_def_cfa_offset 224
.cfi_offset %rbx, -56
.cfi_offset %r12, -48
.cfi_offset %r13, -40
.cfi_offset %r14, -32
.cfi_offset %r15, -24
.cfi_offset %rbp, -16
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %r12
movslq %edx, %rbx
leaq (,%rbx,4), %r14
leaq 48(%rsp), %rdi
leaq 32(%rsp), %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq hipMallocPitch
testl %eax, %eax
jne .LBB1_1
# %bb.3:
leaq 40(%rsp), %rdi
leaq 32(%rsp), %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq hipMallocPitch
testl %eax, %eax
jne .LBB1_4
# %bb.5:
leal -1(%rbx), %eax
leal 14(%rbx), %ecx
testl %eax, %eax
cmovnsl %eax, %ecx
sarl $4, %ecx
incl %ecx
movq %rcx, %r13
shlq $32, %r13
orq %rcx, %r13
movq 48(%rsp), %rdi
movq 32(%rsp), %rsi
movl $1, (%rsp)
movq %r12, %rdx
movq %r14, %rcx
movq %r14, %r8
movq %rbx, %r9
callq hipMemcpy2D
leaq 28(%rsp), %rsi
movl $1, %edi
callq chrono
movabsq $68719476752, %rdx # imm = 0x1000000010
movq %r13, %rdi
movl $1, %esi
movl $1, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq __hipPushCallConfiguration
testl %eax, %eax
jne .LBB1_7
# %bb.6:
movq 48(%rsp), %rax
movq 40(%rsp), %rcx
movq 32(%rsp), %rdx
shrq $2, %rdx
movq %rax, 120(%rsp)
movq %rcx, 112(%rsp)
movl %edx, 60(%rsp)
movl %ebp, 56(%rsp)
leaq 120(%rsp), %rax
movq %rax, 128(%rsp)
leaq 112(%rsp), %rax
movq %rax, 136(%rsp)
leaq 60(%rsp), %rax
movq %rax, 144(%rsp)
leaq 56(%rsp), %rax
movq %rax, 152(%rsp)
leaq 96(%rsp), %rdi
leaq 80(%rsp), %rsi
leaq 72(%rsp), %rdx
leaq 64(%rsp), %rcx
callq __hipPopCallConfiguration
movq 72(%rsp), %rax
movq 64(%rsp), %rdi
movq 96(%rsp), %rsi
movl 104(%rsp), %edx
movq 80(%rsp), %rcx
movl 88(%rsp), %r8d
movq %rdi, 8(%rsp)
movq %rax, (%rsp)
leaq 128(%rsp), %r9
movl $_Z7kconvolPfS_ii, %edi
callq hipLaunchKernel
.LBB1_7:
callq hipDeviceSynchronize
movl %eax, %ebp
leaq 28(%rsp), %rsi
xorl %edi, %edi
callq chrono
movss 28(%rsp), %xmm0 # xmm0 = mem[0],zero,zero,zero
cvtss2sd %xmm0, %xmm0
movl $.L.str.2, %edi
movb $1, %al
callq printf
movq 40(%rsp), %rdx
movq 32(%rsp), %rcx
movl $2, (%rsp)
movq %r15, %rdi
movq %r14, %rsi
movq %r14, %r8
movq %rbx, %r9
callq hipMemcpy2D
testl %ebp, %ebp
jne .LBB1_9
# %bb.8:
movq 48(%rsp), %rdi
callq hipFree
movq 40(%rsp), %rdi
callq hipFree
addq $168, %rsp
.cfi_def_cfa_offset 56
popq %rbx
.cfi_def_cfa_offset 48
popq %r12
.cfi_def_cfa_offset 40
popq %r13
.cfi_def_cfa_offset 32
popq %r14
.cfi_def_cfa_offset 24
popq %r15
.cfi_def_cfa_offset 16
popq %rbp
.cfi_def_cfa_offset 8
retq
.LBB1_1:
.cfi_def_cfa_offset 224
movl %eax, %edi
callq hipGetErrorString
movl $.L.str, %edi
jmp .LBB1_2
.LBB1_4:
movl %eax, %edi
callq hipGetErrorString
movl $.L.str.1, %edi
.LBB1_2:
movq %rax, %rsi
xorl %eax, %eax
callq printf
movl $1, %edi
callq exit
.LBB1_9:
movl %ebp, %edi
callq hipGetErrorString
movq %rax, %rdi
callq puts@PLT
movl $1, %edi
callq exit
.Lfunc_end1:
.size gpu_convol, .Lfunc_end1-gpu_convol
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_ctor
.type __hip_module_ctor,@function
__hip_module_ctor: # @__hip_module_ctor
.cfi_startproc
# %bb.0:
subq $40, %rsp
.cfi_def_cfa_offset 48
cmpq $0, __hip_gpubin_handle(%rip)
jne .LBB2_2
# %bb.1:
movl $__hip_fatbin_wrapper, %edi
callq __hipRegisterFatBinary
movq %rax, __hip_gpubin_handle(%rip)
.LBB2_2:
movq __hip_gpubin_handle(%rip), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 16(%rsp)
movups %xmm0, (%rsp)
movl $_Z7kconvolPfS_ii, %esi
movl $.L__unnamed_1, %edx
movl $.L__unnamed_1, %ecx
movl $-1, %r8d
xorl %r9d, %r9d
callq __hipRegisterFunction
movl $__hip_module_dtor, %edi
addq $40, %rsp
.cfi_def_cfa_offset 8
jmp atexit # TAILCALL
.Lfunc_end2:
.size __hip_module_ctor, .Lfunc_end2-__hip_module_ctor
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_dtor
.type __hip_module_dtor,@function
__hip_module_dtor: # @__hip_module_dtor
.cfi_startproc
# %bb.0:
movq __hip_gpubin_handle(%rip), %rdi
testq %rdi, %rdi
je .LBB3_2
# %bb.1:
pushq %rax
.cfi_def_cfa_offset 16
callq __hipUnregisterFatBinary
movq $0, __hip_gpubin_handle(%rip)
addq $8, %rsp
.cfi_def_cfa_offset 8
.LBB3_2:
retq
.Lfunc_end3:
.size __hip_module_dtor, .Lfunc_end3-__hip_module_dtor
.cfi_endproc
# -- End function
.type _Z7kconvolPfS_ii,@object # @_Z7kconvolPfS_ii
.section .rodata,"a",@progbits
.globl _Z7kconvolPfS_ii
.p2align 3, 0x0
_Z7kconvolPfS_ii:
.quad _Z22__device_stub__kconvolPfS_ii
.size _Z7kconvolPfS_ii, 8
.type .L.str,@object # @.str
.section .rodata.str1.1,"aMS",@progbits,1
.L.str:
.asciz "Error allocating gpu_a: %s\n"
.size .L.str, 28
.type .L.str.1,@object # @.str.1
.L.str.1:
.asciz "Error allocating gpu_b: %s\n"
.size .L.str.1, 28
.type .L.str.2,@object # @.str.2
.L.str.2:
.asciz "Convolution took %f sec. on GPU\n"
.size .L.str.2, 34
.type .L__unnamed_1,@object # @0
.L__unnamed_1:
.asciz "_Z7kconvolPfS_ii"
.size .L__unnamed_1, 17
.type __hip_fatbin_wrapper,@object # @__hip_fatbin_wrapper
.section .hipFatBinSegment,"a",@progbits
.p2align 3, 0x0
__hip_fatbin_wrapper:
.long 1212764230 # 0x48495046
.long 1 # 0x1
.quad __hip_fatbin
.quad 0
.size __hip_fatbin_wrapper, 24
.type __hip_gpubin_handle,@object # @__hip_gpubin_handle
.local __hip_gpubin_handle
.comm __hip_gpubin_handle,8,8
.section .init_array,"aw",@init_array
.p2align 3, 0x0
.quad __hip_module_ctor
.type __hip_cuid_,@object # @__hip_cuid_
.bss
.globl __hip_cuid_
__hip_cuid_:
.byte 0 # 0x0
.size __hip_cuid_, 1
.section ".linker-options","e",@llvm_linker_options
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym _Z22__device_stub__kconvolPfS_ii
.addrsig_sym __hip_module_ctor
.addrsig_sym __hip_module_dtor
.addrsig_sym _Z7kconvolPfS_ii
.addrsig_sym __hip_fatbin
.addrsig_sym __hip_fatbin_wrapper
.addrsig_sym __hip_cuid_ |
You are a helpful coding assistant specialized in converting from CUDA device assembly to AMD device assembly. | code for sm_80
Function : _Z7kconvolPfS_ii
.headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)"
/*0000*/ IMAD.MOV.U32 R1, RZ, RZ, c[0x0][0x28] ; /* 0x00000a00ff017624 */
/* 0x000fe400078e00ff */
/*0010*/ S2R R9, SR_CTAID.Y ; /* 0x0000000000097919 */
/* 0x000e220000002600 */
/*0020*/ ULDC UR4, c[0x0][0x174] ; /* 0x00005d0000047ab9 */
/* 0x000fe20000000800 */
/*0030*/ IMAD.MOV.U32 R7, RZ, RZ, 0x4 ; /* 0x00000004ff077424 */
/* 0x000fe200078e00ff */
/*0040*/ UIADD3 UR4, UR4, -0x1, URZ ; /* 0xffffffff04047890 */
/* 0x000fe2000fffe03f */
/*0050*/ S2R R14, SR_TID.Y ; /* 0x00000000000e7919 */
/* 0x000e220000002200 */
/*0060*/ ULDC.64 UR6, c[0x0][0x118] ; /* 0x0000460000067ab9 */
/* 0x000fc60000000a00 */
/*0070*/ S2R R8, SR_CTAID.X ; /* 0x0000000000087919 */
/* 0x000e680000002500 */
/*0080*/ S2R R15, SR_TID.X ; /* 0x00000000000f7919 */
/* 0x000e620000002100 */
/*0090*/ IMAD R9, R9, c[0x0][0x4], R14 ; /* 0x0000010009097a24 */
/* 0x001fca00078e020e */
/*00a0*/ ISETP.GE.AND P0, PT, R9.reuse, 0x1, PT ; /* 0x000000010900780c */
/* 0x040fe40003f06270 */
/*00b0*/ ISETP.GE.AND P2, PT, R9.reuse, UR4, PT ; /* 0x0000000409007c0c */
/* 0x040fe2000bf46270 */
/*00c0*/ IMAD R8, R8, c[0x0][0x0], R15 ; /* 0x0000000008087a24 */
/* 0x002fe200078e020f */
/*00d0*/ ISETP.NE.OR P0, PT, R14.reuse, RZ, !P0 ; /* 0x000000ff0e00720c */
/* 0x040fe40004705670 */
/*00e0*/ ISETP.NE.OR P2, PT, R14, 0xf, P2 ; /* 0x0000000f0e00780c */
/* 0x000fe20001745670 */
/*00f0*/ IMAD R0, R9, c[0x0][0x170], R8 ; /* 0x00005c0009007a24 */
/* 0x000fe200078e0208 */
/*0100*/ ISETP.GE.AND P3, PT, R8.reuse, 0x1, PT ; /* 0x000000010800780c */
/* 0x040fe40003f66270 */
/*0110*/ ISETP.GE.AND P1, PT, R8, UR4, PT ; /* 0x0000000408007c0c */
/* 0x000fe2000bf26270 */
/*0120*/ IMAD.WIDE R2, R0, R7, c[0x0][0x160] ; /* 0x0000580000027625 */
/* 0x000fe200078e0207 */
/*0130*/ ISETP.NE.OR P4, PT, R15, RZ, !P3 ; /* 0x000000ff0f00720c */
/* 0x000fc40005f85670 */
/*0140*/ ISETP.NE.OR P1, PT, R15, 0xf, P1 ; /* 0x0000000f0f00780c */
/* 0x000fe40000f25670 */
/*0150*/ LDG.E R11, [R2.64] ; /* 0x00000006020b7981 */
/* 0x000ea2000c1e1900 */
/*0160*/ @!P0 IADD3 R4, R0, -c[0x0][0x170], RZ ; /* 0x80005c0000048a10 */
/* 0x000fca0007ffe0ff */
/*0170*/ @!P0 IMAD.WIDE R4, R4, R7, c[0x0][0x160] ; /* 0x0000580004048625 */
/* 0x000fc600078e0207 */
/*0180*/ @!P4 LDG.E R12, [R2.64+-0x4] ; /* 0xfffffc06020cc981 */
/* 0x000ee2000c1e1900 */
/*0190*/ IMAD.WIDE R6, R7, c[0x0][0x170], R2 ; /* 0x00005c0007067a25 */
/* 0x000fc600078e0202 */
/*01a0*/ @!P0 LDG.E R4, [R4.64] ; /* 0x0000000604048981 */
/* 0x000f28000c1e1900 */
/*01b0*/ @!P2 LDG.E R17, [R6.64] ; /* 0x000000060611a981 */
/* 0x000f68000c1e1900 */
/*01c0*/ @!P1 LDG.E R13, [R6.64] ; /* 0x00000006060d9981 */
/* 0x000f62000c1e1900 */
/*01d0*/ IADD3 R10, R14.reuse, 0x1, RZ ; /* 0x000000010e0a7810 */
/* 0x040fe20007ffe0ff */
/*01e0*/ IMAD R16, R14, 0x12, R15 ; /* 0x000000120e107824 */
/* 0x000fc800078e020f */
/*01f0*/ IMAD R10, R10, 0x12, R15 ; /* 0x000000120a0a7824 */
/* 0x000fe400078e020f */
/*0200*/ @!P4 IMAD R15, R14, 0x48, RZ ; /* 0x000000480e0fc824 */
/* 0x000fc600078e02ff */
/*0210*/ IADD3 R10, R10, -0x12, RZ ; /* 0xffffffee0a0a7810 */
/* 0x000fe40007ffe0ff */
/*0220*/ ISETP.GE.AND P5, PT, R8, c[0x0][0x174], PT ; /* 0x00005d0008007a0c */
/* 0x000fc80003fa6270 */
/*0230*/ ISETP.GE.OR P5, PT, R9, c[0x0][0x174], P5 ; /* 0x00005d0009007a0c */
/* 0x000fe20002fa6670 */
/*0240*/ STS [R16.X4+0x4c], R11 ; /* 0x00004c0b10007388 */
/* 0x0041e80000004800 */
/*0250*/ @!P4 STS [R15+0x48], R12 ; /* 0x0000480c0f00c388 */
/* 0x0081e80000000800 */
/*0260*/ @!P0 STS [R10.X4+0x4], R4 ; /* 0x000004040a008388 */
/* 0x0101e80000004800 */
/*0270*/ @!P2 STS [R10.X4+0x94], R17 ; /* 0x000094110a00a388 */
/* 0x0201e80000004800 */
/*0280*/ @!P1 STS [R10.X4+0x4], R13 ; /* 0x0000040d0a009388 */
/* 0x0001e80000004800 */
/*0290*/ BAR.SYNC.DEFER_BLOCKING 0x0 ; /* 0x0000000000007b1d */
/* 0x000fec0000010000 */
/*02a0*/ @P5 EXIT ; /* 0x000000000000594d */
/* 0x000fea0003800000 */
/*02b0*/ ISETP.NE.AND P0, PT, R9, RZ, PT ; /* 0x000000ff0900720c */
/* 0x001fe20003f05270 */
/*02c0*/ BSSY B0, 0x3f0 ; /* 0x0000012000007945 */
/* 0x000fe20003800000 */
/*02d0*/ SHF.R.S32.HI R11, RZ, 0x1f, R0 ; /* 0x0000001fff0b7819 */
/* 0x000fc40000011400 */
/*02e0*/ ISETP.EQ.OR P0, PT, R8, RZ, !P0 ; /* 0x000000ff0800720c */
/* 0x000fc80004702670 */
/*02f0*/ ISETP.EQ.OR P0, PT, R8, UR4, P0 ; /* 0x0000000408007c0c */
/* 0x000fc80008702670 */
/*0300*/ ISETP.EQ.OR P0, PT, R9, UR4, P0 ; /* 0x0000000409007c0c */
/* 0x000fda0008702670 */
/*0310*/ @P0 BRA 0x3d0 ; /* 0x000000b000000947 */
/* 0x000fea0003800000 */
/*0320*/ LDS R2, [R10.X4+0x48] ; /* 0x000048000a027984 */
/* 0x000fe80000004800 */
/*0330*/ LDS R3, [R10.X4+0x4] ; /* 0x000004000a037984 */
/* 0x000e280000004800 */
/*0340*/ LDS R5, [R10.X4+0x4c] ; /* 0x00004c000a057984 */
/* 0x000e680000004800 */
/*0350*/ LDS R7, [R10.X4+0x50] ; /* 0x000050000a077984 */
/* 0x000ea80000004800 */
/*0360*/ LDS R9, [R10.X4+0x94] ; /* 0x000094000a097984 */
/* 0x000ee20000004800 */
/*0370*/ FADD R2, R2, R3 ; /* 0x0000000302027221 */
/* 0x001fc80000000000 */
/*0380*/ FADD R2, R2, R5 ; /* 0x0000000502027221 */
/* 0x002fc80000000000 */
/*0390*/ FADD R2, R2, R7 ; /* 0x0000000702027221 */
/* 0x004fc80000000000 */
/*03a0*/ FADD R2, R2, R9 ; /* 0x0000000902027221 */
/* 0x008fc80000000000 */
/*03b0*/ FMUL R5, R2, 0.20000000298023223877 ; /* 0x3e4ccccd02057820 */
/* 0x000fe20000400000 */
/*03c0*/ BRA 0x3e0 ; /* 0x0000001000007947 */
/* 0x000fea0003800000 */
/*03d0*/ LDS R5, [R10.X4+0x4c] ; /* 0x00004c000a057984 */
/* 0x0000640000004800 */
/*03e0*/ BSYNC B0 ; /* 0x0000000000007941 */
/* 0x000fea0003800000 */
/*03f0*/ STS [R10.X4+0x55c], R5 ; /* 0x00055c050a007388 */
/* 0x0023e20000004800 */
/*0400*/ @!P3 EXIT ; /* 0x000000000000b94d */
/* 0x000fea0003800000 */
/*0410*/ LEA R2, P0, R0, c[0x0][0x168], 0x2 ; /* 0x00005a0000027a11 */
/* 0x000fc800078010ff */
/*0420*/ LEA.HI.X R3, R0, c[0x0][0x16c], R11, 0x2, P0 ; /* 0x00005b0000037a11 */
/* 0x000fca00000f140b */
/*0430*/ STG.E [R2.64], R5 ; /* 0x0000000502007986 */
/* 0x000fe2000c101906 */
/*0440*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*0450*/ BRA 0x450; /* 0xfffffff000007947 */
/* 0x000fc0000383ffff */
/*0460*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0470*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0480*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0490*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*04a0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*04b0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*04c0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*04d0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*04e0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*04f0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
.......... | .text
.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
.protected _Z7kconvolPfS_ii
.globl _Z7kconvolPfS_ii
.p2align 8
.type _Z7kconvolPfS_ii,@function
_Z7kconvolPfS_ii:
s_clause 0x1
s_load_b32 s2, s[0:1], 0x24
s_load_b32 s6, s[0:1], 0x10
v_and_b32_e32 v2, 0x3ff, v0
v_bfe_u32 v6, v0, 10, 10
s_load_b64 s[4:5], s[0:1], 0x0
s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
v_add_nc_u32_e32 v12, 1, v2
v_add_nc_u32_e32 v11, 1, v6
s_delay_alu instid0(VALU_DEP_1)
v_mul_u32_u24_e32 v10, 18, v11
s_waitcnt lgkmcnt(0)
s_and_b32 s3, s2, 0xffff
s_lshr_b32 s2, s2, 16
v_mad_u64_u32 v[3:4], null, s14, s3, v[2:3]
v_mad_u64_u32 v[4:5], null, s15, s2, v[6:7]
v_mad_u32_u24 v5, v11, 18, v12
v_cmp_eq_u32_e64 s2, 0, v2
s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_4)
v_lshlrev_b32_e32 v9, 2, v5
v_mad_u64_u32 v[0:1], null, v4, s6, v[3:4]
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_ashrrev_i32_e32 v1, 31, v0
v_lshlrev_b64 v[7:8], 2, v[0:1]
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
v_add_co_u32 v7, vcc_lo, s4, v7
v_add_co_ci_u32_e32 v8, vcc_lo, s5, v8, vcc_lo
v_cmp_lt_i32_e32 vcc_lo, 0, v3
global_load_b32 v13, v[7:8], off
s_and_b32 s3, s2, vcc_lo
s_waitcnt vmcnt(0)
ds_store_b32 v9, v13
s_and_saveexec_b32 s2, s3
s_cbranch_execz .LBB0_2
global_load_b32 v7, v[7:8], off offset:-4
v_add_lshl_u32 v8, v10, v2, 2
s_waitcnt vmcnt(0)
ds_store_b32 v8, v7
.LBB0_2:
s_or_b32 exec_lo, exec_lo, s2
v_cmp_eq_u32_e64 s2, 0, v6
v_cmp_lt_i32_e64 s3, 0, v4
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
s_and_b32 s2, s2, s3
s_and_saveexec_b32 s3, s2
s_cbranch_execz .LBB0_4
v_subrev_nc_u32_e32 v6, s6, v0
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_ashrrev_i32_e32 v7, 31, v6
v_lshlrev_b64 v[6:7], 2, v[6:7]
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_add_co_u32 v6, s2, s4, v6
v_add_co_ci_u32_e64 v7, s2, s5, v7, s2
global_load_b32 v6, v[6:7], off
v_lshl_add_u32 v7, v5, 2, 0xffffffb8
s_waitcnt vmcnt(0)
ds_store_b32 v7, v6
.LBB0_4:
s_or_b32 exec_lo, exec_lo, s3
s_load_b32 s8, s[0:1], 0x14
v_cmp_eq_u32_e64 s2, 16, v12
s_waitcnt lgkmcnt(0)
s_add_i32 s7, s8, -1
s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_cmp_gt_i32_e64 s3, s7, v3
s_and_b32 s2, s2, s3
s_delay_alu instid0(SALU_CYCLE_1)
s_and_saveexec_b32 s3, s2
s_cbranch_execz .LBB0_6
v_add_nc_u32_e32 v6, s6, v0
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_ashrrev_i32_e32 v7, 31, v6
v_lshlrev_b64 v[6:7], 2, v[6:7]
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_add_co_u32 v6, s2, s4, v6
v_add_co_ci_u32_e64 v7, s2, s5, v7, s2
global_load_b32 v6, v[6:7], off
v_lshl_add_u32 v7, v5, 2, 0xffffffb8
s_waitcnt vmcnt(0)
ds_store_b32 v7, v6
.LBB0_6:
s_or_b32 exec_lo, exec_lo, s3
v_cmp_eq_u32_e64 s2, 16, v11
v_cmp_gt_i32_e64 s3, s7, v4
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
s_and_b32 s2, s2, s3
s_and_saveexec_b32 s3, s2
s_cbranch_execz .LBB0_8
v_add_nc_u32_e32 v6, s6, v0
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_ashrrev_i32_e32 v7, 31, v6
v_lshlrev_b64 v[6:7], 2, v[6:7]
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_add_co_u32 v6, s2, s4, v6
v_add_co_ci_u32_e64 v7, s2, s5, v7, s2
global_load_b32 v6, v[6:7], off
v_lshlrev_b32_e32 v7, 2, v5
s_waitcnt vmcnt(0)
ds_store_b32 v7, v6 offset:72
.LBB0_8:
s_or_b32 exec_lo, exec_lo, s3
v_max_i32_e32 v6, v3, v4
s_waitcnt lgkmcnt(0)
s_barrier
buffer_gl0_inv
s_mov_b32 s3, exec_lo
v_cmpx_gt_i32_e64 s8, v6
s_cbranch_execz .LBB0_17
v_cmp_eq_u32_e64 s2, 0, v3
v_cmp_eq_u32_e64 s3, 0, v4
s_mov_b32 s6, -1
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
s_or_b32 s4, s2, s3
s_xor_b32 s2, s4, -1
s_delay_alu instid0(SALU_CYCLE_1)
s_and_saveexec_b32 s5, s2
s_cbranch_execz .LBB0_13
v_cmp_ne_u32_e64 s2, s7, v3
v_cmp_ne_u32_e64 s3, s7, v4
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
s_and_b32 s3, s2, s3
s_and_saveexec_b32 s2, s3
s_cbranch_execz .LBB0_12
v_lshlrev_b32_e32 v3, 2, v5
v_add_lshl_u32 v2, v10, v2, 2
s_xor_b32 s6, exec_lo, -1
s_delay_alu instid0(VALU_DEP_2)
v_add_nc_u32_e32 v4, 0xffffffb8, v3
ds_load_b32 v6, v2
ds_load_b32 v4, v4
ds_load_b32 v7, v9
ds_load_2addr_b32 v[2:3], v3 offset0:1 offset1:18
s_waitcnt lgkmcnt(2)
v_add_f32_e32 v4, v4, v6
s_waitcnt lgkmcnt(1)
s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
v_add_f32_e32 v4, v4, v7
s_waitcnt lgkmcnt(0)
v_add_f32_e32 v2, v4, v2
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_add_f32_e32 v2, v2, v3
v_mul_f32_e32 v6, 0x3e4ccccd, v2
.LBB0_12:
s_or_b32 exec_lo, exec_lo, s2
s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
s_and_not1_b32 s2, s4, exec_lo
s_and_b32 s3, s6, exec_lo
s_or_b32 s4, s2, s3
.LBB0_13:
s_or_b32 exec_lo, exec_lo, s5
s_and_saveexec_b32 s2, s4
s_cbranch_execz .LBB0_15
ds_load_b32 v6, v9
.LBB0_15:
s_or_b32 exec_lo, exec_lo, s2
v_lshlrev_b32_e32 v2, 2, v5
s_waitcnt lgkmcnt(0)
ds_store_b32 v2, v6 offset:1296
s_and_b32 exec_lo, exec_lo, vcc_lo
s_cbranch_execz .LBB0_17
s_load_b64 s[0:1], s[0:1], 0x8
ds_load_b32 v2, v2 offset:1296
v_lshlrev_b64 v[0:1], 2, v[0:1]
s_waitcnt lgkmcnt(0)
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
v_add_co_u32 v0, vcc_lo, s0, v0
v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
global_store_b32 v[0:1], v2, off
.LBB0_17:
s_nop 0
s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
s_endpgm
.section .rodata,"a",@progbits
.p2align 6, 0x0
.amdhsa_kernel _Z7kconvolPfS_ii
.amdhsa_group_segment_fixed_size 2592
.amdhsa_private_segment_fixed_size 0
.amdhsa_kernarg_size 280
.amdhsa_user_sgpr_count 14
.amdhsa_user_sgpr_dispatch_ptr 0
.amdhsa_user_sgpr_queue_ptr 0
.amdhsa_user_sgpr_kernarg_segment_ptr 1
.amdhsa_user_sgpr_dispatch_id 0
.amdhsa_user_sgpr_private_segment_size 0
.amdhsa_wavefront_size32 1
.amdhsa_uses_dynamic_stack 0
.amdhsa_enable_private_segment 0
.amdhsa_system_sgpr_workgroup_id_x 1
.amdhsa_system_sgpr_workgroup_id_y 1
.amdhsa_system_sgpr_workgroup_id_z 0
.amdhsa_system_sgpr_workgroup_info 0
.amdhsa_system_vgpr_workitem_id 1
.amdhsa_next_free_vgpr 14
.amdhsa_next_free_sgpr 16
.amdhsa_float_round_mode_32 0
.amdhsa_float_round_mode_16_64 0
.amdhsa_float_denorm_mode_32 3
.amdhsa_float_denorm_mode_16_64 3
.amdhsa_dx10_clamp 1
.amdhsa_ieee_mode 1
.amdhsa_fp16_overflow 0
.amdhsa_workgroup_processor_mode 1
.amdhsa_memory_ordered 1
.amdhsa_forward_progress 0
.amdhsa_shared_vgpr_count 0
.amdhsa_exception_fp_ieee_invalid_op 0
.amdhsa_exception_fp_denorm_src 0
.amdhsa_exception_fp_ieee_div_zero 0
.amdhsa_exception_fp_ieee_overflow 0
.amdhsa_exception_fp_ieee_underflow 0
.amdhsa_exception_fp_ieee_inexact 0
.amdhsa_exception_int_div_zero 0
.end_amdhsa_kernel
.text
.Lfunc_end0:
.size _Z7kconvolPfS_ii, .Lfunc_end0-_Z7kconvolPfS_ii
.section .AMDGPU.csdata,"",@progbits
.text
.p2alignl 7, 3214868480
.fill 96, 4, 3214868480
.type __hip_cuid_,@object
.section .bss,"aw",@nobits
.globl __hip_cuid_
__hip_cuid_:
.byte 0
.size __hip_cuid_, 1
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym __hip_cuid_
.amdgpu_metadata
---
amdhsa.kernels:
- .args:
- .address_space: global
.offset: 0
.size: 8
.value_kind: global_buffer
- .address_space: global
.offset: 8
.size: 8
.value_kind: global_buffer
- .offset: 16
.size: 4
.value_kind: by_value
- .offset: 20
.size: 4
.value_kind: by_value
- .offset: 24
.size: 4
.value_kind: hidden_block_count_x
- .offset: 28
.size: 4
.value_kind: hidden_block_count_y
- .offset: 32
.size: 4
.value_kind: hidden_block_count_z
- .offset: 36
.size: 2
.value_kind: hidden_group_size_x
- .offset: 38
.size: 2
.value_kind: hidden_group_size_y
- .offset: 40
.size: 2
.value_kind: hidden_group_size_z
- .offset: 42
.size: 2
.value_kind: hidden_remainder_x
- .offset: 44
.size: 2
.value_kind: hidden_remainder_y
- .offset: 46
.size: 2
.value_kind: hidden_remainder_z
- .offset: 64
.size: 8
.value_kind: hidden_global_offset_x
- .offset: 72
.size: 8
.value_kind: hidden_global_offset_y
- .offset: 80
.size: 8
.value_kind: hidden_global_offset_z
- .offset: 88
.size: 2
.value_kind: hidden_grid_dims
.group_segment_fixed_size: 2592
.kernarg_segment_align: 8
.kernarg_segment_size: 280
.language: OpenCL C
.language_version:
- 2
- 0
.max_flat_workgroup_size: 1024
.name: _Z7kconvolPfS_ii
.private_segment_fixed_size: 0
.sgpr_count: 18
.sgpr_spill_count: 0
.symbol: _Z7kconvolPfS_ii.kd
.uniform_work_group_size: 1
.uses_dynamic_stack: false
.vgpr_count: 14
.vgpr_spill_count: 0
.wavefront_size: 32
.workgroup_processor_mode: 1
amdhsa.target: amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
- 1
- 2
...
.end_amdgpu_metadata |
You are a helpful coding assistant specialized in converting from CUDA host assembly to AMD host assembly. | .file "tmpxft_001a4401_00000000-6_convol.cudafe1.cpp"
.text
#APP
#NO_APP
.type _ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2060:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaUnregisterFatBinary@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2060:
.size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
.globl _Z30__device_stub__Z7kconvolPfS_iiPfS_ii
.type _Z30__device_stub__Z7kconvolPfS_iiPfS_ii, @function
_Z30__device_stub__Z7kconvolPfS_iiPfS_ii:
.LFB2082:
.cfi_startproc
endbr64
subq $152, %rsp
.cfi_def_cfa_offset 160
movq %rdi, 24(%rsp)
movq %rsi, 16(%rsp)
movl %edx, 12(%rsp)
movl %ecx, 8(%rsp)
movq %fs:40, %rax
movq %rax, 136(%rsp)
xorl %eax, %eax
leaq 24(%rsp), %rax
movq %rax, 96(%rsp)
leaq 16(%rsp), %rax
movq %rax, 104(%rsp)
leaq 12(%rsp), %rax
movq %rax, 112(%rsp)
leaq 8(%rsp), %rax
movq %rax, 120(%rsp)
movl $1, 48(%rsp)
movl $1, 52(%rsp)
movl $1, 56(%rsp)
movl $1, 60(%rsp)
movl $1, 64(%rsp)
movl $1, 68(%rsp)
leaq 40(%rsp), %rcx
leaq 32(%rsp), %rdx
leaq 60(%rsp), %rsi
leaq 48(%rsp), %rdi
call __cudaPopCallConfiguration@PLT
testl %eax, %eax
je .L7
.L3:
movq 136(%rsp), %rax
subq %fs:40, %rax
jne .L8
addq $152, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 8
ret
.L7:
.cfi_restore_state
pushq 40(%rsp)
.cfi_def_cfa_offset 168
pushq 40(%rsp)
.cfi_def_cfa_offset 176
leaq 112(%rsp), %r9
movq 76(%rsp), %rcx
movl 84(%rsp), %r8d
movq 64(%rsp), %rsi
movl 72(%rsp), %edx
leaq _Z7kconvolPfS_ii(%rip), %rdi
call cudaLaunchKernel@PLT
addq $16, %rsp
.cfi_def_cfa_offset 160
jmp .L3
.L8:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE2082:
.size _Z30__device_stub__Z7kconvolPfS_iiPfS_ii, .-_Z30__device_stub__Z7kconvolPfS_iiPfS_ii
.globl _Z7kconvolPfS_ii
.type _Z7kconvolPfS_ii, @function
_Z7kconvolPfS_ii:
.LFB2083:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
call _Z30__device_stub__Z7kconvolPfS_iiPfS_ii
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2083:
.size _Z7kconvolPfS_ii, .-_Z7kconvolPfS_ii
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "Error allocating gpu_a: %s\n"
.LC1:
.string "Error allocating gpu_b: %s\n"
.section .rodata.str1.8,"aMS",@progbits,1
.align 8
.LC2:
.string "Convolution took %f sec. on GPU\n"
.section .rodata.str1.1
.LC3:
.string "%s\n"
.text
.globl gpu_convol
.type gpu_convol, @function
gpu_convol:
.LFB2057:
.cfi_startproc
endbr64
pushq %r14
.cfi_def_cfa_offset 16
.cfi_offset 14, -16
pushq %r13
.cfi_def_cfa_offset 24
.cfi_offset 13, -24
pushq %r12
.cfi_def_cfa_offset 32
.cfi_offset 12, -32
pushq %rbp
.cfi_def_cfa_offset 40
.cfi_offset 6, -40
pushq %rbx
.cfi_def_cfa_offset 48
.cfi_offset 3, -48
subq $64, %rsp
.cfi_def_cfa_offset 112
movq %rdi, %r14
movq %rsi, %r13
movl %edx, %ebx
movq %fs:40, %rax
movq %rax, 56(%rsp)
xorl %eax, %eax
movslq %edx, %r12
leaq 0(,%r12,4), %rbp
leaq 24(%rsp), %rsi
leaq 8(%rsp), %rdi
movq %r12, %rcx
movq %rbp, %rdx
call cudaMallocPitch@PLT
testl %eax, %eax
jne .L18
leaq 24(%rsp), %rsi
leaq 16(%rsp), %rdi
movq %r12, %rcx
movq %rbp, %rdx
call cudaMallocPitch@PLT
testl %eax, %eax
jne .L19
movl $16, 32(%rsp)
movl $16, 36(%rsp)
movl $1, 40(%rsp)
movl $1, 52(%rsp)
leal 14(%rbx), %eax
movl %ebx, %edx
subl $1, %edx
cmovns %edx, %eax
sarl $4, %eax
addl $1, %eax
movl %eax, 44(%rsp)
movl %eax, 48(%rsp)
subq $8, %rsp
.cfi_def_cfa_offset 120
pushq $1
.cfi_def_cfa_offset 128
movq %r12, %r9
movq %rbp, %r8
movq %rbp, %rcx
movq %r14, %rdx
movq 40(%rsp), %rsi
movq 24(%rsp), %rdi
call cudaMemcpy2D@PLT
addq $16, %rsp
.cfi_def_cfa_offset 112
leaq 4(%rsp), %rsi
movl $1, %edi
call chrono@PLT
movl 40(%rsp), %ecx
movl $0, %r9d
movl $0, %r8d
movq 32(%rsp), %rdx
movq 44(%rsp), %rdi
movl 52(%rsp), %esi
call __cudaPushCallConfiguration@PLT
testl %eax, %eax
je .L20
.L14:
call cudaThreadSynchronize@PLT
movl %eax, %ebx
leaq 4(%rsp), %rsi
movl $0, %edi
call chrono@PLT
pxor %xmm0, %xmm0
cvtss2sd 4(%rsp), %xmm0
leaq .LC2(%rip), %rsi
movl $2, %edi
movl $1, %eax
call __printf_chk@PLT
subq $8, %rsp
.cfi_def_cfa_offset 120
pushq $2
.cfi_def_cfa_offset 128
movq %r12, %r9
movq %rbp, %r8
movq 40(%rsp), %rcx
movq 32(%rsp), %rdx
movq %rbp, %rsi
movq %r13, %rdi
call cudaMemcpy2D@PLT
addq $16, %rsp
.cfi_def_cfa_offset 112
testl %ebx, %ebx
jne .L21
movq 8(%rsp), %rdi
call cudaFree@PLT
movq 16(%rsp), %rdi
call cudaFree@PLT
movq 56(%rsp), %rax
subq %fs:40, %rax
jne .L22
addq $64, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 48
popq %rbx
.cfi_def_cfa_offset 40
popq %rbp
.cfi_def_cfa_offset 32
popq %r12
.cfi_def_cfa_offset 24
popq %r13
.cfi_def_cfa_offset 16
popq %r14
.cfi_def_cfa_offset 8
ret
.L18:
.cfi_restore_state
movl %eax, %edi
call cudaGetErrorString@PLT
movq %rax, %rdx
leaq .LC0(%rip), %rsi
movl $2, %edi
movl $0, %eax
call __printf_chk@PLT
movl $1, %edi
call exit@PLT
.L19:
movl %eax, %edi
call cudaGetErrorString@PLT
movq %rax, %rdx
leaq .LC1(%rip), %rsi
movl $2, %edi
movl $0, %eax
call __printf_chk@PLT
movl $1, %edi
call exit@PLT
.L20:
movq 24(%rsp), %rdx
shrq $2, %rdx
movl %ebx, %ecx
movq 16(%rsp), %rsi
movq 8(%rsp), %rdi
call _Z30__device_stub__Z7kconvolPfS_iiPfS_ii
jmp .L14
.L21:
movl %ebx, %edi
call cudaGetErrorString@PLT
movq %rax, %rdx
leaq .LC3(%rip), %rsi
movl $2, %edi
movl $0, %eax
call __printf_chk@PLT
movl $1, %edi
call exit@PLT
.L22:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE2057:
.size gpu_convol, .-gpu_convol
.section .rodata.str1.1
.LC4:
.string "_Z7kconvolPfS_ii"
.text
.type _ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2085:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
leaq _ZL15__fatDeviceText(%rip), %rdi
call __cudaRegisterFatBinary@PLT
movq %rax, %rdi
movq %rax, _ZL20__cudaFatCubinHandle(%rip)
pushq $0
.cfi_def_cfa_offset 24
pushq $0
.cfi_def_cfa_offset 32
pushq $0
.cfi_def_cfa_offset 40
pushq $0
.cfi_def_cfa_offset 48
movl $0, %r9d
movl $-1, %r8d
leaq .LC4(%rip), %rdx
movq %rdx, %rcx
leaq _Z7kconvolPfS_ii(%rip), %rsi
call __cudaRegisterFunction@PLT
addq $32, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaRegisterFatBinaryEnd@PLT
leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
call atexit@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2085:
.size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
.section .init_array,"aw"
.align 8
.quad _ZL24__sti____cudaRegisterAllv
.section .nvFatBinSegment,"aw"
.align 8
.type _ZL15__fatDeviceText, @object
.size _ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
.long 1180844977
.long 1
.quad fatbinData
.quad 0
.local _ZL20__cudaFatCubinHandle
.comm _ZL20__cudaFatCubinHandle,8,8
.ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
.section .note.GNU-stack,"",@progbits
.section .note.gnu.property,"a"
.align 8
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.string "GNU"
1:
.align 8
.long 0xc0000002
.long 3f - 2f
2:
.long 0x3
3:
.align 8
4: | .text
.file "convol.hip"
.globl _Z22__device_stub__kconvolPfS_ii # -- Begin function _Z22__device_stub__kconvolPfS_ii
.p2align 4, 0x90
.type _Z22__device_stub__kconvolPfS_ii,@function
_Z22__device_stub__kconvolPfS_ii: # @_Z22__device_stub__kconvolPfS_ii
.cfi_startproc
# %bb.0:
subq $120, %rsp
.cfi_def_cfa_offset 128
movq %rdi, 72(%rsp)
movq %rsi, 64(%rsp)
movl %edx, 12(%rsp)
movl %ecx, 8(%rsp)
leaq 72(%rsp), %rax
movq %rax, 80(%rsp)
leaq 64(%rsp), %rax
movq %rax, 88(%rsp)
leaq 12(%rsp), %rax
movq %rax, 96(%rsp)
leaq 8(%rsp), %rax
movq %rax, 104(%rsp)
leaq 48(%rsp), %rdi
leaq 32(%rsp), %rsi
leaq 24(%rsp), %rdx
leaq 16(%rsp), %rcx
callq __hipPopCallConfiguration
movq 48(%rsp), %rsi
movl 56(%rsp), %edx
movq 32(%rsp), %rcx
movl 40(%rsp), %r8d
leaq 80(%rsp), %r9
movl $_Z7kconvolPfS_ii, %edi
pushq 16(%rsp)
.cfi_adjust_cfa_offset 8
pushq 32(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $136, %rsp
.cfi_adjust_cfa_offset -136
retq
.Lfunc_end0:
.size _Z22__device_stub__kconvolPfS_ii, .Lfunc_end0-_Z22__device_stub__kconvolPfS_ii
.cfi_endproc
# -- End function
.globl gpu_convol # -- Begin function gpu_convol
.p2align 4, 0x90
.type gpu_convol,@function
gpu_convol: # @gpu_convol
.cfi_startproc
# %bb.0:
pushq %rbp
.cfi_def_cfa_offset 16
pushq %r15
.cfi_def_cfa_offset 24
pushq %r14
.cfi_def_cfa_offset 32
pushq %r13
.cfi_def_cfa_offset 40
pushq %r12
.cfi_def_cfa_offset 48
pushq %rbx
.cfi_def_cfa_offset 56
subq $168, %rsp
.cfi_def_cfa_offset 224
.cfi_offset %rbx, -56
.cfi_offset %r12, -48
.cfi_offset %r13, -40
.cfi_offset %r14, -32
.cfi_offset %r15, -24
.cfi_offset %rbp, -16
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %r12
movslq %edx, %rbx
leaq (,%rbx,4), %r14
leaq 48(%rsp), %rdi
leaq 32(%rsp), %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq hipMallocPitch
testl %eax, %eax
jne .LBB1_1
# %bb.3:
leaq 40(%rsp), %rdi
leaq 32(%rsp), %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq hipMallocPitch
testl %eax, %eax
jne .LBB1_4
# %bb.5:
leal -1(%rbx), %eax
leal 14(%rbx), %ecx
testl %eax, %eax
cmovnsl %eax, %ecx
sarl $4, %ecx
incl %ecx
movq %rcx, %r13
shlq $32, %r13
orq %rcx, %r13
movq 48(%rsp), %rdi
movq 32(%rsp), %rsi
movl $1, (%rsp)
movq %r12, %rdx
movq %r14, %rcx
movq %r14, %r8
movq %rbx, %r9
callq hipMemcpy2D
leaq 28(%rsp), %rsi
movl $1, %edi
callq chrono
movabsq $68719476752, %rdx # imm = 0x1000000010
movq %r13, %rdi
movl $1, %esi
movl $1, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq __hipPushCallConfiguration
testl %eax, %eax
jne .LBB1_7
# %bb.6:
movq 48(%rsp), %rax
movq 40(%rsp), %rcx
movq 32(%rsp), %rdx
shrq $2, %rdx
movq %rax, 120(%rsp)
movq %rcx, 112(%rsp)
movl %edx, 60(%rsp)
movl %ebp, 56(%rsp)
leaq 120(%rsp), %rax
movq %rax, 128(%rsp)
leaq 112(%rsp), %rax
movq %rax, 136(%rsp)
leaq 60(%rsp), %rax
movq %rax, 144(%rsp)
leaq 56(%rsp), %rax
movq %rax, 152(%rsp)
leaq 96(%rsp), %rdi
leaq 80(%rsp), %rsi
leaq 72(%rsp), %rdx
leaq 64(%rsp), %rcx
callq __hipPopCallConfiguration
movq 72(%rsp), %rax
movq 64(%rsp), %rdi
movq 96(%rsp), %rsi
movl 104(%rsp), %edx
movq 80(%rsp), %rcx
movl 88(%rsp), %r8d
movq %rdi, 8(%rsp)
movq %rax, (%rsp)
leaq 128(%rsp), %r9
movl $_Z7kconvolPfS_ii, %edi
callq hipLaunchKernel
.LBB1_7:
callq hipDeviceSynchronize
movl %eax, %ebp
leaq 28(%rsp), %rsi
xorl %edi, %edi
callq chrono
movss 28(%rsp), %xmm0 # xmm0 = mem[0],zero,zero,zero
cvtss2sd %xmm0, %xmm0
movl $.L.str.2, %edi
movb $1, %al
callq printf
movq 40(%rsp), %rdx
movq 32(%rsp), %rcx
movl $2, (%rsp)
movq %r15, %rdi
movq %r14, %rsi
movq %r14, %r8
movq %rbx, %r9
callq hipMemcpy2D
testl %ebp, %ebp
jne .LBB1_9
# %bb.8:
movq 48(%rsp), %rdi
callq hipFree
movq 40(%rsp), %rdi
callq hipFree
addq $168, %rsp
.cfi_def_cfa_offset 56
popq %rbx
.cfi_def_cfa_offset 48
popq %r12
.cfi_def_cfa_offset 40
popq %r13
.cfi_def_cfa_offset 32
popq %r14
.cfi_def_cfa_offset 24
popq %r15
.cfi_def_cfa_offset 16
popq %rbp
.cfi_def_cfa_offset 8
retq
.LBB1_1:
.cfi_def_cfa_offset 224
movl %eax, %edi
callq hipGetErrorString
movl $.L.str, %edi
jmp .LBB1_2
.LBB1_4:
movl %eax, %edi
callq hipGetErrorString
movl $.L.str.1, %edi
.LBB1_2:
movq %rax, %rsi
xorl %eax, %eax
callq printf
movl $1, %edi
callq exit
.LBB1_9:
movl %ebp, %edi
callq hipGetErrorString
movq %rax, %rdi
callq puts@PLT
movl $1, %edi
callq exit
.Lfunc_end1:
.size gpu_convol, .Lfunc_end1-gpu_convol
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_ctor
.type __hip_module_ctor,@function
__hip_module_ctor: # @__hip_module_ctor
.cfi_startproc
# %bb.0:
subq $40, %rsp
.cfi_def_cfa_offset 48
cmpq $0, __hip_gpubin_handle(%rip)
jne .LBB2_2
# %bb.1:
movl $__hip_fatbin_wrapper, %edi
callq __hipRegisterFatBinary
movq %rax, __hip_gpubin_handle(%rip)
.LBB2_2:
movq __hip_gpubin_handle(%rip), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 16(%rsp)
movups %xmm0, (%rsp)
movl $_Z7kconvolPfS_ii, %esi
movl $.L__unnamed_1, %edx
movl $.L__unnamed_1, %ecx
movl $-1, %r8d
xorl %r9d, %r9d
callq __hipRegisterFunction
movl $__hip_module_dtor, %edi
addq $40, %rsp
.cfi_def_cfa_offset 8
jmp atexit # TAILCALL
.Lfunc_end2:
.size __hip_module_ctor, .Lfunc_end2-__hip_module_ctor
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_dtor
.type __hip_module_dtor,@function
__hip_module_dtor: # @__hip_module_dtor
.cfi_startproc
# %bb.0:
movq __hip_gpubin_handle(%rip), %rdi
testq %rdi, %rdi
je .LBB3_2
# %bb.1:
pushq %rax
.cfi_def_cfa_offset 16
callq __hipUnregisterFatBinary
movq $0, __hip_gpubin_handle(%rip)
addq $8, %rsp
.cfi_def_cfa_offset 8
.LBB3_2:
retq
.Lfunc_end3:
.size __hip_module_dtor, .Lfunc_end3-__hip_module_dtor
.cfi_endproc
# -- End function
.type _Z7kconvolPfS_ii,@object # @_Z7kconvolPfS_ii
.section .rodata,"a",@progbits
.globl _Z7kconvolPfS_ii
.p2align 3, 0x0
_Z7kconvolPfS_ii:
.quad _Z22__device_stub__kconvolPfS_ii
.size _Z7kconvolPfS_ii, 8
.type .L.str,@object # @.str
.section .rodata.str1.1,"aMS",@progbits,1
.L.str:
.asciz "Error allocating gpu_a: %s\n"
.size .L.str, 28
.type .L.str.1,@object # @.str.1
.L.str.1:
.asciz "Error allocating gpu_b: %s\n"
.size .L.str.1, 28
.type .L.str.2,@object # @.str.2
.L.str.2:
.asciz "Convolution took %f sec. on GPU\n"
.size .L.str.2, 34
.type .L__unnamed_1,@object # @0
.L__unnamed_1:
.asciz "_Z7kconvolPfS_ii"
.size .L__unnamed_1, 17
.type __hip_fatbin_wrapper,@object # @__hip_fatbin_wrapper
.section .hipFatBinSegment,"a",@progbits
.p2align 3, 0x0
__hip_fatbin_wrapper:
.long 1212764230 # 0x48495046
.long 1 # 0x1
.quad __hip_fatbin
.quad 0
.size __hip_fatbin_wrapper, 24
.type __hip_gpubin_handle,@object # @__hip_gpubin_handle
.local __hip_gpubin_handle
.comm __hip_gpubin_handle,8,8
.section .init_array,"aw",@init_array
.p2align 3, 0x0
.quad __hip_module_ctor
.type __hip_cuid_,@object # @__hip_cuid_
.bss
.globl __hip_cuid_
__hip_cuid_:
.byte 0 # 0x0
.size __hip_cuid_, 1
.section ".linker-options","e",@llvm_linker_options
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym _Z22__device_stub__kconvolPfS_ii
.addrsig_sym __hip_module_ctor
.addrsig_sym __hip_module_dtor
.addrsig_sym _Z7kconvolPfS_ii
.addrsig_sym __hip_fatbin
.addrsig_sym __hip_fatbin_wrapper
.addrsig_sym __hip_cuid_ |
You are a helpful coding assistant specialized in converting CUDA source code to CUDA device assembly. | /*
CPP_CONTEST=2017
CPP_PROBLEM=I
CPP_LANG=CUDA
CPP_PROCESSES_PER_NODE=saturno 1
*/
/* RECORD
Francisco Muñoz García
September 20, 2017
in CESGA
time 1520
speed-up 9.80
*/
#include <stdlib.h>
__device__ int count(int ld,int n,char *a,char *b) //Each CUDA thread do this work and is called from kernel so we change to __device__
{
int i,j;
int value=0;
for(i=0;i < n;i++)
for(j=0;j < n;j++)
if(a[i*ld+j]==b[i*n+j])
value++;
return value;
}
/*
We create one thread for each element in matrix sizexsize. Each element compare its matrix and save the results in a matrix. For that reason
each thread has an associated element in the matrix.
*/
__global__ void mask(char* a, char* b, int* temp, int n, int m) {
int i = blockIdx.x*blockDim.x + threadIdx.x;
int j = blockIdx.y*blockDim.y + threadIdx.y;
int size = n-m;
if((i<size) && (j<size)) {
temp[i*size+j]=count(n,m,&a[i*n+j],b);
}
}
int sec(int n,char *a,int m,char *b)
{
int i, j;
int maximum=0,value;
int size = n-m;
int nbytes_a = sizeof(char)*n*n;
int nbytes_b = sizeof(char)*m*m;
int nBytes_temp = sizeof(int)*size*size;
int* temp =(int*) malloc(sizeof(int)*size*size);
int* temp_d;
char* a_d;
char* b_d;
int bl_dim1 = 4;
int bl_dim2 = 8;
dim3 block(bl_dim1,bl_dim2);
//we need n-m threads
int gsx = size / bl_dim1;
if(size%bl_dim1) gsx++;
int gsy = size / bl_dim2;
if(size%bl_dim2) gsy++;
dim3 grid(gsx, gsy);
//We reserve memory for GPU
cudaMalloc((void **) &temp_d, nBytes_temp);
cudaMalloc((void**) &a_d, nbytes_a);
cudaMalloc((void**) &b_d, nbytes_b);
//Transfers here
cudaMemset(temp_d, 0, nBytes_temp*sizeof(char)); //All the values should stat with zeros because each thread add values from that initial zero.
cudaMemcpy(a_d, a, nbytes_a, cudaMemcpyHostToDevice);
cudaMemcpy(b_d, b, nbytes_b, cudaMemcpyHostToDevice);
//call the kernel
mask<<<grid, block>>>(a_d, b_d, temp_d, n,m );
//We transfer the results to RAM
cudaMemcpy(temp, temp_d, nBytes_temp, cudaMemcpyDeviceToHost);
cudaFree((void**)temp_d);
cudaFree((void**)a_d);
cudaFree((void**)b_d);
//Once we have the results for each comparition we only have to know which is the best. We do this in sequencial mode.
maximum = temp[0];
for(int i=1; i<size*size;i++) {
if(temp[i]>maximum)
maximum=temp[i];
}
free(temp);
return maximum;
} | code for sm_80
Function : _Z4maskPcS_Piii
.headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)"
/*0000*/ IMAD.MOV.U32 R1, RZ, RZ, c[0x0][0x28] ; /* 0x00000a00ff017624 */
/* 0x000fe400078e00ff */
/*0010*/ S2R R0, SR_CTAID.Y ; /* 0x0000000000007919 */
/* 0x000e220000002600 */
/*0020*/ ULDC.64 UR4, c[0x0][0x178] ; /* 0x00005e0000047ab9 */
/* 0x000fe40000000a00 */
/*0030*/ UIADD3 UR5, UR4, -UR5, URZ ; /* 0x8000000504057290 */
/* 0x000fe2000fffe03f */
/*0040*/ S2R R3, SR_TID.Y ; /* 0x0000000000037919 */
/* 0x000e280000002200 */
/*0050*/ S2R R7, SR_CTAID.X ; /* 0x0000000000077919 */
/* 0x000e680000002500 */
/*0060*/ S2R R2, SR_TID.X ; /* 0x0000000000027919 */
/* 0x000e620000002100 */
/*0070*/ IMAD R0, R0, c[0x0][0x4], R3 ; /* 0x0000010000007a24 */
/* 0x001fca00078e0203 */
/*0080*/ ISETP.GE.AND P0, PT, R0, UR5, PT ; /* 0x0000000500007c0c */
/* 0x000fe2000bf06270 */
/*0090*/ IMAD R7, R7, c[0x0][0x0], R2 ; /* 0x0000000007077a24 */
/* 0x002fca00078e0202 */
/*00a0*/ ISETP.GE.OR P0, PT, R7, UR5, P0 ; /* 0x0000000507007c0c */
/* 0x000fda0008706670 */
/*00b0*/ @P0 EXIT ; /* 0x000000000000094d */
/* 0x000fea0003800000 */
/*00c0*/ IMAD.MOV.U32 R9, RZ, RZ, c[0x0][0x17c] ; /* 0x00005f00ff097624 */
/* 0x000fe200078e00ff */
/*00d0*/ ULDC.64 UR6, c[0x0][0x118] ; /* 0x0000460000067ab9 */
/* 0x000fe20000000a00 */
/*00e0*/ IMAD.MOV.U32 R16, RZ, RZ, RZ ; /* 0x000000ffff107224 */
/* 0x000fc600078e00ff */
/*00f0*/ ISETP.GE.AND P0, PT, R9, 0x1, PT ; /* 0x000000010900780c */
/* 0x000fda0003f06270 */
/*0100*/ @!P0 BRA 0xf90 ; /* 0x00000e8000008947 */
/* 0x000fea0003800000 */
/*0110*/ IMAD R6, R7, c[0x0][0x178], R0 ; /* 0x00005e0007067a24 */
/* 0x000fe200078e0200 */
/*0120*/ IADD3 R2, R9.reuse, -0x1, RZ ; /* 0xffffffff09027810 */
/* 0x040fe20007ffe0ff */
/*0130*/ IMAD.MOV.U32 R16, RZ, RZ, RZ ; /* 0x000000ffff107224 */
/* 0x000fe200078e00ff */
/*0140*/ LOP3.LUT R9, R9, 0x3, RZ, 0xc0, !PT ; /* 0x0000000309097812 */
/* 0x000fe200078ec0ff */
/*0150*/ IMAD.MOV.U32 R20, RZ, RZ, RZ ; /* 0x000000ffff147224 */
/* 0x000fe200078e00ff */
/*0160*/ IADD3 R8, P0, R6, c[0x0][0x160], RZ ; /* 0x0000580006087a10 */
/* 0x000fe40007f1e0ff */
/*0170*/ SHF.R.S32.HI R10, RZ, 0x1f, R6 ; /* 0x0000001fff0a7819 */
/* 0x000fe40000011406 */
/*0180*/ ISETP.GE.U32.AND P1, PT, R2, 0x3, PT ; /* 0x000000030200780c */
/* 0x000fe40003f26070 */
/*0190*/ IADD3 R11, -R9, c[0x0][0x17c], RZ ; /* 0x00005f00090b7a10 */
/* 0x000fc40007ffe1ff */
/*01a0*/ IADD3.X R12, R10, c[0x0][0x164], RZ, P0, !PT ; /* 0x000059000a0c7a10 */
/* 0x000fe400007fe4ff */
/*01b0*/ IMAD R13, R20.reuse, c[0x0][0x178], RZ ; /* 0x00005e00140d7a24 */
/* 0x040fe200078e02ff */
/*01c0*/ UMOV UR4, URZ ; /* 0x0000003f00047c82 */
/* 0x000fe20008000000 */
/*01d0*/ IMAD R14, R20.reuse, c[0x0][0x17c], RZ ; /* 0x00005f00140e7a24 */
/* 0x040fe200078e02ff */
/*01e0*/ IADD3 R20, R20, 0x1, RZ ; /* 0x0000000114147810 */
/* 0x000fc80007ffe0ff */
/*01f0*/ ISETP.GE.AND P2, PT, R20, c[0x0][0x17c], PT ; /* 0x00005f0014007a0c */
/* 0x000fe20003f46270 */
/*0200*/ @!P1 BRA 0xda0 ; /* 0x00000b9000009947 */
/* 0x000fea0003800000 */
/*0210*/ ISETP.GT.AND P0, PT, R11, RZ, PT ; /* 0x000000ff0b00720c */
/* 0x000fe20003f04270 */
/*0220*/ UMOV UR4, URZ ; /* 0x0000003f00047c82 */
/* 0x000fe20008000000 */
/*0230*/ IADD3 R2, P3, R13.reuse, R8, RZ ; /* 0x000000080d027210 */
/* 0x040fe20007f7e0ff */
/*0240*/ ULDC.64 UR8, c[0x0][0x168] ; /* 0x00005a0000087ab9 */
/* 0x000fe20000000a00 */
/*0250*/ SHF.R.S32.HI R21, RZ, 0x1f, R14 ; /* 0x0000001fff157819 */
/* 0x000fe2000001140e */
/*0260*/ IMAD.MOV.U32 R15, RZ, RZ, R11 ; /* 0x000000ffff0f7224 */
/* 0x000fe200078e000b */
/*0270*/ LEA.HI.X.SX32 R3, R13, R12, 0x1, P3 ; /* 0x0000000c0d037211 */
/* 0x000fce00018f0eff */
/*0280*/ @!P0 BRA 0xbc0 ; /* 0x0000093000008947 */
/* 0x000fea0003800000 */
/*0290*/ ISETP.GT.AND P3, PT, R15, 0xc, PT ; /* 0x0000000c0f00780c */
/* 0x000fe40003f64270 */
/*02a0*/ PLOP3.LUT P0, PT, PT, PT, PT, 0x80, 0x0 ; /* 0x000000000000781c */
/* 0x000fd60003f0f070 */
/*02b0*/ @!P3 BRA 0x870 ; /* 0x000005b00000b947 */
/* 0x000fea0003800000 */
/*02c0*/ PLOP3.LUT P0, PT, PT, PT, PT, 0x8, 0x0 ; /* 0x000000000000781c */
/* 0x000fe40003f0e170 */
/*02d0*/ IADD3 R4, P3, R14, UR8, RZ ; /* 0x000000080e047c10 */
/* 0x000fe2000ff7e0ff */
/*02e0*/ LDG.E.U8 R18, [R2.64] ; /* 0x0000000602127981 */
/* 0x000ea6000c1e1100 */
/*02f0*/ IADD3.X R5, R21, UR9, RZ, P3, !PT ; /* 0x0000000915057c10 */
/* 0x000fe20009ffe4ff */
/*0300*/ LDG.E.U8 R22, [R2.64+0x1] ; /* 0x0000010602167981 */
/* 0x000ee8000c1e1100 */
/*0310*/ LDG.E.U8 R17, [R4.64] ; /* 0x0000000604117981 */
/* 0x000ea8000c1e1100 */
/*0320*/ LDG.E.U8 R19, [R4.64+0x1] ; /* 0x0000010604137981 */
/* 0x000ee8000c1e1100 */
/*0330*/ LDG.E.U8 R25, [R2.64+0x2] ; /* 0x0000020602197981 */
/* 0x000f28000c1e1100 */
/*0340*/ LDG.E.U8 R24, [R4.64+0x2] ; /* 0x0000020604187981 */
/* 0x000f28000c1e1100 */
/*0350*/ LDG.E.U8 R23, [R4.64+0x4] ; /* 0x0000040604177981 */
/* 0x000f68000c1e1100 */
/*0360*/ LDG.E.U8 R28, [R4.64+0xf] ; /* 0x00000f06041c7981 */
/* 0x000162000c1e1100 */
/*0370*/ ISETP.NE.AND P3, PT, R18, R17, PT ; /* 0x000000111200720c */
/* 0x004fc60003f65270 */
/*0380*/ LDG.E.U8 R18, [R2.64+0x3] ; /* 0x0000030602127981 */
/* 0x000ea8000c1e1100 */
/*0390*/ LDG.E.U8 R17, [R4.64+0x3] ; /* 0x0000030604117981 */
/* 0x000ea2000c1e1100 */
/*03a0*/ ISETP.NE.AND P4, PT, R22, R19, PT ; /* 0x000000131600720c */
/* 0x008fc60003f85270 */
/*03b0*/ LDG.E.U8 R22, [R2.64+0x4] ; /* 0x0000040602167981 */
/* 0x000f62000c1e1100 */
/*03c0*/ IADD3 R19, R16, 0x1, RZ ; /* 0x0000000110137810 */
/* 0x000fe20007ffe0ff */
/*03d0*/ @P3 IMAD.MOV R19, RZ, RZ, R16 ; /* 0x000000ffff133224 */
/* 0x000fe200078e0210 */
/*03e0*/ ISETP.NE.AND P3, PT, R25, R24, PT ; /* 0x000000181900720c */
/* 0x010fe20003f65270 */
/*03f0*/ LDG.E.U8 R16, [R2.64+0x6] ; /* 0x0000060602107981 */
/* 0x000ee6000c1e1100 */
/*0400*/ IADD3 R26, R19, 0x1, RZ ; /* 0x00000001131a7810 */
/* 0x000fe20007ffe0ff */
/*0410*/ LDG.E.U8 R25, [R2.64+0x5] ; /* 0x0000050602197981 */
/* 0x000f24000c1e1100 */
/*0420*/ @P4 IMAD.MOV R26, RZ, RZ, R19 ; /* 0x000000ffff1a4224 */
/* 0x000fc400078e0213 */
/*0430*/ LDG.E.U8 R24, [R4.64+0x5] ; /* 0x0000050604187981 */
/* 0x000f28000c1e1100 */
/*0440*/ LDG.E.U8 R19, [R4.64+0x6] ; /* 0x0000060604137981 */
/* 0x000ee2000c1e1100 */
/*0450*/ IADD3 R27, R26, 0x1, RZ ; /* 0x000000011a1b7810 */
/* 0x000fe20007ffe0ff */
/*0460*/ @P3 IMAD.MOV R27, RZ, RZ, R26 ; /* 0x000000ffff1b3224 */
/* 0x000fca00078e021a */
/*0470*/ IADD3 R26, R27, 0x1, RZ ; /* 0x000000011b1a7810 */
/* 0x000fe40007ffe0ff */
/*0480*/ ISETP.NE.AND P4, PT, R18, R17, PT ; /* 0x000000111200720c */
/* 0x004fe40003f85270 */
/*0490*/ LDG.E.U8 R17, [R2.64+0x7] ; /* 0x0000070602117981 */
/* 0x000ea2000c1e1100 */
/*04a0*/ ISETP.NE.AND P3, PT, R22, R23, PT ; /* 0x000000171600720c */
/* 0x020fc60003f65270 */
/*04b0*/ LDG.E.U8 R18, [R4.64+0x7] ; /* 0x0000070604127981 */
/* 0x000ea8000c1e1100 */
/*04c0*/ LDG.E.U8 R22, [R2.64+0x8] ; /* 0x0000080602167981 */
/* 0x000f66000c1e1100 */
/*04d0*/ @P4 IMAD.MOV R26, RZ, RZ, R27 ; /* 0x000000ffff1a4224 */
/* 0x000fe200078e021b */
/*04e0*/ LDG.E.U8 R23, [R4.64+0x8] ; /* 0x0000080604177981 */
/* 0x000f62000c1e1100 */
/*04f0*/ ISETP.NE.AND P4, PT, R25, R24, PT ; /* 0x000000181900720c */
/* 0x010fc60003f85270 */
/*0500*/ LDG.E.U8 R27, [R2.64+0xf] ; /* 0x00000f06021b7981 */
/* 0x000f22000c1e1100 */
/*0510*/ IADD3 R24, R26, 0x1, RZ ; /* 0x000000011a187810 */
/* 0x000fe20007ffe0ff */
/*0520*/ @P3 IMAD.MOV R24, RZ, RZ, R26 ; /* 0x000000ffff183224 */
/* 0x000fe200078e021a */
/*0530*/ ISETP.NE.AND P3, PT, R16, R19, PT ; /* 0x000000131000720c */
/* 0x008fe20003f65270 */
/*0540*/ LDG.E.U8 R26, [R2.64+0x9] ; /* 0x00000906021a7981 */
/* 0x000ee8000c1e1100 */
/*0550*/ LDG.E.U8 R19, [R4.64+0x9] ; /* 0x0000090604137981 */
/* 0x000ee2000c1e1100 */
/*0560*/ IADD3 R16, R24, 0x1, RZ ; /* 0x0000000118107810 */
/* 0x000fe20007ffe0ff */
/*0570*/ @P4 IMAD.MOV R16, RZ, RZ, R24 ; /* 0x000000ffff104224 */
/* 0x000fc400078e0218 */
/*0580*/ LDG.E.U8 R25, [R4.64+0xa] ; /* 0x00000a0604197981 */
/* 0x000f28000c1e1100 */
/*0590*/ LDG.E.U8 R24, [R2.64+0xa] ; /* 0x00000a0602187981 */
/* 0x000f22000c1e1100 */
/*05a0*/ ISETP.NE.AND P4, PT, R17, R18, PT ; /* 0x000000121100720c */
/* 0x004fe40003f85270 */
/*05b0*/ IADD3 R18, R16, 0x1, RZ ; /* 0x0000000110127810 */
/* 0x000fe20007ffe0ff */
/*05c0*/ @P3 IMAD.MOV R18, RZ, RZ, R16 ; /* 0x000000ffff123224 */
/* 0x000fe200078e0210 */
/*05d0*/ LDG.E.U8 R17, [R2.64+0xb] ; /* 0x00000b0602117981 */
/* 0x000ea2000c1e1100 */
/*05e0*/ ISETP.NE.AND P3, PT, R22, R23, PT ; /* 0x000000171600720c */
/* 0x020fc60003f65270 */
/*05f0*/ LDG.E.U8 R16, [R4.64+0xb] ; /* 0x00000b0604107981 */
/* 0x000ea2000c1e1100 */
/*0600*/ IADD3 R22, R18, 0x1, RZ ; /* 0x0000000112167810 */
/* 0x000fc80007ffe0ff */
/*0610*/ @P4 IMAD.MOV R22, RZ, RZ, R18 ; /* 0x000000ffff164224 */
/* 0x000fe200078e0212 */
/*0620*/ LDG.E.U8 R23, [R4.64+0xd] ; /* 0x00000d0604177981 */
/* 0x000f68000c1e1100 */
/*0630*/ LDG.E.U8 R18, [R2.64+0xc] ; /* 0x00000c0602127981 */
/* 0x000f62000c1e1100 */
/*0640*/ ISETP.NE.AND P4, PT, R26, R19, PT ; /* 0x000000131a00720c */
/* 0x008fc60003f85270 */
/*0650*/ LDG.E.U8 R19, [R4.64+0xc] ; /* 0x00000c0604137981 */
/* 0x000f62000c1e1100 */
/*0660*/ IADD3 R26, R22, 0x1, RZ ; /* 0x00000001161a7810 */
/* 0x000fe20007ffe0ff */
/*0670*/ @P3 IMAD.MOV R26, RZ, RZ, R22 ; /* 0x000000ffff1a3224 */
/* 0x000fe400078e0216 */
/*0680*/ LDG.E.U8 R22, [R2.64+0xd] ; /* 0x00000d0602167981 */
/* 0x000ee2000c1e1100 */
/*0690*/ ISETP.NE.AND P3, PT, R24, R25, PT ; /* 0x000000191800720c */
/* 0x010fe40003f65270 */
/*06a0*/ IADD3 R24, R26, 0x1, RZ ; /* 0x000000011a187810 */
/* 0x000fe20007ffe0ff */
/*06b0*/ LDG.E.U8 R25, [R2.64+0xe] ; /* 0x00000e0602197981 */
/* 0x000f24000c1e1100 */
/*06c0*/ @P4 IMAD.MOV R24, RZ, RZ, R26 ; /* 0x000000ffff184224 */
/* 0x000fc400078e021a */
/*06d0*/ LDG.E.U8 R26, [R4.64+0xe] ; /* 0x00000e06041a7981 */
/* 0x000f22000c1e1100 */
/*06e0*/ IADD3 R15, R15, -0x10, RZ ; /* 0xfffffff00f0f7810 */
/* 0x000fe20007ffe0ff */
/*06f0*/ UIADD3 UR8, UP0, UR8, 0x10, URZ ; /* 0x0000001008087890 */
/* 0x000fe4000ff1e03f */
/*0700*/ UIADD3 UR4, UR4, 0x10, URZ ; /* 0x0000001004047890 */
/* 0x000fe4000fffe03f */
/*0710*/ UIADD3.X UR9, URZ, UR9, URZ, UP0, !UPT ; /* 0x000000093f097290 */
/* 0x000fe200087fe43f */
/*0720*/ ISETP.NE.AND P4, PT, R17, R16, PT ; /* 0x000000101100720c */
/* 0x004fe40003f85270 */
/*0730*/ IADD3 R16, R24, 0x1, RZ ; /* 0x0000000118107810 */
/* 0x000fe20007ffe0ff */
/*0740*/ @P3 IMAD.MOV R16, RZ, RZ, R24 ; /* 0x000000ffff103224 */
/* 0x000fca00078e0218 */
/*0750*/ IADD3 R17, R16, 0x1, RZ ; /* 0x0000000110117810 */
/* 0x000fe40007ffe0ff */
/*0760*/ ISETP.NE.AND P3, PT, R18, R19, PT ; /* 0x000000131200720c */
/* 0x020fc60003f65270 */
/*0770*/ @P4 IMAD.MOV R17, RZ, RZ, R16 ; /* 0x000000ffff114224 */
/* 0x000fe200078e0210 */
/*0780*/ ISETP.NE.AND P4, PT, R22, R23, PT ; /* 0x000000171600720c */
/* 0x008fc80003f85270 */
/*0790*/ IADD3 R16, R17, 0x1, RZ ; /* 0x0000000111107810 */
/* 0x000fca0007ffe0ff */
/*07a0*/ @P3 IMAD.MOV R16, RZ, RZ, R17 ; /* 0x000000ffff103224 */
/* 0x000fe200078e0211 */
/*07b0*/ ISETP.NE.AND P5, PT, R25, R26, PT ; /* 0x0000001a1900720c */
/* 0x010fc80003fa5270 */
/*07c0*/ IADD3 R4, R16, 0x1, RZ ; /* 0x0000000110047810 */
/* 0x001fe20007ffe0ff */
/*07d0*/ @P4 IMAD.MOV R4, RZ, RZ, R16 ; /* 0x000000ffff044224 */
/* 0x000fe200078e0210 */
/*07e0*/ ISETP.GT.AND P4, PT, R15, 0xc, PT ; /* 0x0000000c0f00780c */
/* 0x000fe40003f84270 */
/*07f0*/ ISETP.NE.AND P3, PT, R27, R28, PT ; /* 0x0000001c1b00720c */
/* 0x000fe40003f65270 */
/*0800*/ IADD3 R5, R4, 0x1, RZ ; /* 0x0000000104057810 */
/* 0x000fc60007ffe0ff */
/*0810*/ @P5 IMAD.MOV R5, RZ, RZ, R4 ; /* 0x000000ffff055224 */
/* 0x000fe200078e0204 */
/*0820*/ IADD3 R2, P5, R2, 0x10, RZ ; /* 0x0000001002027810 */
/* 0x000fc80007fbe0ff */
/*0830*/ IADD3 R16, R5, 0x1, RZ ; /* 0x0000000105107810 */
/* 0x000fe20007ffe0ff */
/*0840*/ IMAD.X R3, RZ, RZ, R3, P5 ; /* 0x000000ffff037224 */
/* 0x000fe400028e0603 */
/*0850*/ @P3 IMAD.MOV R16, RZ, RZ, R5 ; /* 0x000000ffff103224 */
/* 0x000fe200078e0205 */
/*0860*/ @P4 BRA 0x2d0 ; /* 0xfffffa6000004947 */
/* 0x000fea000383ffff */
/*0870*/ ISETP.GT.AND P3, PT, R15, 0x4, PT ; /* 0x000000040f00780c */
/* 0x000fda0003f64270 */
/*0880*/ @!P3 BRA 0xba0 ; /* 0x000003100000b947 */
/* 0x000fea0003800000 */
/*0890*/ IADD3 R4, P0, R14, UR8, RZ ; /* 0x000000080e047c10 */
/* 0x000fe2000ff1e0ff */
/*08a0*/ LDG.E.U8 R22, [R2.64] ; /* 0x0000000602167981 */
/* 0x000ea6000c1e1100 */
/*08b0*/ IADD3.X R5, R21, UR9, RZ, P0, !PT ; /* 0x0000000915057c10 */
/* 0x000fe200087fe4ff */
/*08c0*/ LDG.E.U8 R24, [R2.64+0x1] ; /* 0x0000010602187981 */
/* 0x000ee8000c1e1100 */
/*08d0*/ LDG.E.U8 R19, [R4.64] ; /* 0x0000000604137981 */
/* 0x000ea8000c1e1100 */
/*08e0*/ LDG.E.U8 R23, [R4.64+0x1] ; /* 0x0000010604177981 */
/* 0x000ee8000c1e1100 */
/*08f0*/ LDG.E.U8 R26, [R2.64+0x2] ; /* 0x00000206021a7981 */
/* 0x000f28000c1e1100 */
/*0900*/ LDG.E.U8 R25, [R4.64+0x2] ; /* 0x0000020604197981 */
/* 0x000f28000c1e1100 */
/*0910*/ LDG.E.U8 R17, [R2.64+0x3] ; /* 0x0000030602117981 */
/* 0x000f68000c1e1100 */
/*0920*/ LDG.E.U8 R18, [R4.64+0x3] ; /* 0x0000030604127981 */
/* 0x000f62000c1e1100 */
/*0930*/ IADD3 R27, R16, 0x1, RZ ; /* 0x00000001101b7810 */
/* 0x000fc40007ffe0ff */
/*0940*/ ISETP.NE.AND P0, PT, R22, R19, PT ; /* 0x000000131600720c */
/* 0x004fe40003f05270 */
/*0950*/ LDG.E.U8 R19, [R2.64+0x4] ; /* 0x0000040602137981 */
/* 0x000ea8000c1e1100 */
/*0960*/ LDG.E.U8 R22, [R4.64+0x4] ; /* 0x0000040604167981 */
/* 0x0000a2000c1e1100 */
/*0970*/ ISETP.NE.AND P3, PT, R24, R23, PT ; /* 0x000000171800720c */
/* 0x008fc60003f65270 */
/*0980*/ LDG.E.U8 R24, [R2.64+0x5] ; /* 0x0000050602187981 */
/* 0x000ee2000c1e1100 */
/*0990*/ ISETP.NE.AND P4, PT, R26, R25, PT ; /* 0x000000191a00720c */
/* 0x010fc60003f85270 */
/*09a0*/ LDG.E.U8 R25, [R4.64+0x5] ; /* 0x0000050604197981 */
/* 0x0000e2000c1e1100 */
/*09b0*/ @P0 IMAD.MOV R27, RZ, RZ, R16 ; /* 0x000000ffff1b0224 */
/* 0x000fc600078e0210 */
/*09c0*/ LDG.E.U8 R23, [R4.64+0x6] ; /* 0x0000060604177981 */
/* 0x000128000c1e1100 */
/*09d0*/ LDG.E.U8 R16, [R2.64+0x6] ; /* 0x0000060602107981 */
/* 0x000f22000c1e1100 */
/*09e0*/ IADD3 R28, R27, 0x1, RZ ; /* 0x000000011b1c7810 */
/* 0x000fe20007ffe0ff */
/*09f0*/ @P3 IMAD.MOV R28, RZ, RZ, R27 ; /* 0x000000ffff1c3224 */
/* 0x000fe400078e021b */
/*0a00*/ LDG.E.U8 R26, [R4.64+0x7] ; /* 0x00000706041a7981 */
/* 0x000128000c1e1100 */
/*0a10*/ LDG.E.U8 R27, [R2.64+0x7] ; /* 0x00000706021b7981 */
/* 0x000f22000c1e1100 */
/*0a20*/ ISETP.NE.AND P0, PT, R17, R18, PT ; /* 0x000000121100720c */
/* 0x020fc40003f05270 */
/*0a30*/ IADD3 R17, R28, 0x1, RZ ; /* 0x000000011c117810 */
/* 0x000fe20007ffe0ff */
/*0a40*/ @P4 IMAD.MOV R17, RZ, RZ, R28 ; /* 0x000000ffff114224 */
/* 0x000fca00078e021c */
/*0a50*/ IADD3 R4, R17, 0x1, RZ ; /* 0x0000000111047810 */
/* 0x001fca0007ffe0ff */
/*0a60*/ @P0 IMAD.MOV R4, RZ, RZ, R17 ; /* 0x000000ffff040224 */
/* 0x000fca00078e0211 */
/*0a70*/ IADD3 R5, R4, 0x1, RZ ; /* 0x0000000104057810 */
/* 0x000fe20007ffe0ff */
/*0a80*/ UIADD3 UR8, UP0, UR8, 0x8, URZ ; /* 0x0000000808087890 */
/* 0x000fe2000ff1e03f */
/*0a90*/ IADD3 R15, R15, -0x8, RZ ; /* 0xfffffff80f0f7810 */
/* 0x000fe20007ffe0ff */
/*0aa0*/ UIADD3 UR4, UR4, 0x8, URZ ; /* 0x0000000804047890 */
/* 0x000fe4000fffe03f */
/*0ab0*/ UIADD3.X UR9, URZ, UR9, URZ, UP0, !UPT ; /* 0x000000093f097290 */
/* 0x000fe200087fe43f */
/*0ac0*/ ISETP.NE.AND P3, PT, R19, R22, PT ; /* 0x000000161300720c */
/* 0x004fe40003f65270 */
/*0ad0*/ ISETP.NE.AND P0, PT, R24, R25, PT ; /* 0x000000191800720c */
/* 0x008fd60003f05270 */
/*0ae0*/ @P3 IMAD.MOV R5, RZ, RZ, R4 ; /* 0x000000ffff053224 */
/* 0x000fe200078e0204 */
/*0af0*/ ISETP.NE.AND P3, PT, R16, R23, PT ; /* 0x000000171000720c */
/* 0x010fc80003f65270 */
/*0b00*/ IADD3 R4, R5, 0x1, RZ ; /* 0x0000000105047810 */
/* 0x000fe20007ffe0ff */
/*0b10*/ @P0 IMAD.MOV R4, RZ, RZ, R5 ; /* 0x000000ffff040224 */
/* 0x000fe200078e0205 */
/*0b20*/ ISETP.NE.AND P4, PT, R27, R26, PT ; /* 0x0000001a1b00720c */
/* 0x000fc80003f85270 */
/*0b30*/ IADD3 R5, R4, 0x1, RZ ; /* 0x0000000104057810 */
/* 0x000fc60007ffe0ff */
/*0b40*/ @P3 IMAD.MOV R5, RZ, RZ, R4 ; /* 0x000000ffff053224 */
/* 0x000fe200078e0204 */
/*0b50*/ IADD3 R2, P3, R2, 0x8, RZ ; /* 0x0000000802027810 */
/* 0x000fe40007f7e0ff */
/*0b60*/ PLOP3.LUT P0, PT, PT, PT, PT, 0x8, 0x0 ; /* 0x000000000000781c */
/* 0x000fe40003f0e170 */
/*0b70*/ IADD3 R16, R5, 0x1, RZ ; /* 0x0000000105107810 */
/* 0x000fe20007ffe0ff */
/*0b80*/ IMAD.X R3, RZ, RZ, R3, P3 ; /* 0x000000ffff037224 */
/* 0x000fe400018e0603 */
/*0b90*/ @P4 IMAD.MOV R16, RZ, RZ, R5 ; /* 0x000000ffff104224 */
/* 0x000fe400078e0205 */
/*0ba0*/ ISETP.NE.OR P0, PT, R15, RZ, P0 ; /* 0x000000ff0f00720c */
/* 0x000fda0000705670 */
/*0bb0*/ @!P0 BRA 0xda0 ; /* 0x000001e000008947 */
/* 0x000fea0003800000 */
/*0bc0*/ IADD3 R4, P0, R14, UR8, RZ ; /* 0x000000080e047c10 */
/* 0x000fe2000ff1e0ff */
/*0bd0*/ LDG.E.U8 R18, [R2.64] ; /* 0x0000000602127981 */
/* 0x0000a6000c1e1100 */
/*0be0*/ IADD3.X R5, R21, UR9, RZ, P0, !PT ; /* 0x0000000915057c10 */
/* 0x000fe200087fe4ff */
/*0bf0*/ LDG.E.U8 R22, [R2.64+0x1] ; /* 0x0000010602167981 */
/* 0x0000e8000c1e1100 */
/*0c00*/ LDG.E.U8 R17, [R4.64] ; /* 0x0000000604117981 */
/* 0x000ea8000c1e1100 */
/*0c10*/ LDG.E.U8 R19, [R4.64+0x1] ; /* 0x0000010604137981 */
/* 0x000ee8000c1e1100 */
/*0c20*/ LDG.E.U8 R24, [R2.64+0x2] ; /* 0x0000020602187981 */
/* 0x000128000c1e1100 */
/*0c30*/ LDG.E.U8 R23, [R4.64+0x2] ; /* 0x0000020604177981 */
/* 0x000f28000c1e1100 */
/*0c40*/ LDG.E.U8 R25, [R4.64+0x3] ; /* 0x0000030604197981 */
/* 0x000f68000c1e1100 */
/*0c50*/ LDG.E.U8 R26, [R2.64+0x3] ; /* 0x00000306021a7981 */
/* 0x000162000c1e1100 */
/*0c60*/ IADD3 R15, R15, -0x4, RZ ; /* 0xfffffffc0f0f7810 */
/* 0x000fe20007ffe0ff */
/*0c70*/ UIADD3 UR8, UP0, UR8, 0x4, URZ ; /* 0x0000000408087890 */
/* 0x000fc4000ff1e03f */
/*0c80*/ UIADD3 UR4, UR4, 0x4, URZ ; /* 0x0000000404047890 */
/* 0x000fe4000fffe03f */
/*0c90*/ UIADD3.X UR9, URZ, UR9, URZ, UP0, !UPT ; /* 0x000000093f097290 */
/* 0x000fe200087fe43f */
/*0ca0*/ IADD3 R2, P4, R2, 0x4, RZ ; /* 0x0000000402027810 */
/* 0x001fca0007f9e0ff */
/*0cb0*/ IMAD.X R3, RZ, RZ, R3, P4 ; /* 0x000000ffff037224 */
/* 0x000fe200020e0603 */
/*0cc0*/ ISETP.NE.AND P0, PT, R18, R17, PT ; /* 0x000000111200720c */
/* 0x004fe40003f05270 */
/*0cd0*/ ISETP.NE.AND P3, PT, R22, R19, PT ; /* 0x000000131600720c */
/* 0x008fe40003f65270 */
/*0ce0*/ IADD3 R17, R16, 0x1, RZ ; /* 0x0000000110117810 */
/* 0x000fd20007ffe0ff */
/*0cf0*/ @P0 IMAD.MOV R17, RZ, RZ, R16 ; /* 0x000000ffff110224 */
/* 0x000fe200078e0210 */
/*0d00*/ ISETP.NE.AND P0, PT, R24, R23, PT ; /* 0x000000171800720c */
/* 0x010fc80003f05270 */
/*0d10*/ IADD3 R16, R17, 0x1, RZ ; /* 0x0000000111107810 */
/* 0x000fe20007ffe0ff */
/*0d20*/ @P3 IMAD.MOV R16, RZ, RZ, R17 ; /* 0x000000ffff103224 */
/* 0x000fe200078e0211 */
/*0d30*/ ISETP.NE.AND P3, PT, R26, R25, PT ; /* 0x000000191a00720c */
/* 0x020fc80003f65270 */
/*0d40*/ IADD3 R17, R16, 0x1, RZ ; /* 0x0000000110117810 */
/* 0x000fc60007ffe0ff */
/*0d50*/ @P0 IMAD.MOV R17, RZ, RZ, R16 ; /* 0x000000ffff110224 */
/* 0x000fe200078e0210 */
/*0d60*/ ISETP.NE.AND P0, PT, R15, RZ, PT ; /* 0x000000ff0f00720c */
/* 0x000fc80003f05270 */
/*0d70*/ IADD3 R16, R17, 0x1, RZ ; /* 0x0000000111107810 */
/* 0x000fe20007ffe0ff */
/*0d80*/ @P3 IMAD.MOV R16, RZ, RZ, R17 ; /* 0x000000ffff103224 */
/* 0x000fd000078e0211 */
/*0d90*/ @P0 BRA 0xbc0 ; /* 0xfffffe2000000947 */
/* 0x000fea000383ffff */
/*0da0*/ ISETP.NE.AND P0, PT, R9, RZ, PT ; /* 0x000000ff0900720c */
/* 0x000fda0003f05270 */
/*0db0*/ @!P0 BRA 0xf80 ; /* 0x000001c000008947 */
/* 0x000fea0003800000 */
/*0dc0*/ IADD3 R5, R13, UR4, RZ ; /* 0x000000040d057c10 */
/* 0x000fe4000fffe0ff */
/*0dd0*/ IADD3 R14, R14, UR4, RZ ; /* 0x000000040e0e7c10 */
/* 0x000fe4000fffe0ff */
/*0de0*/ SHF.R.S32.HI R3, RZ, 0x1f, R5 ; /* 0x0000001fff037819 */
/* 0x000fe40000011405 */
/*0df0*/ IADD3 R4, P0, P3, R5, c[0x0][0x160], R6 ; /* 0x0000580005047a10 */
/* 0x000fe40007b1e006 */
/*0e00*/ IADD3 R2, P4, R14, c[0x0][0x168], RZ ; /* 0x00005a000e027a10 */
/* 0x000fe40007f9e0ff */
/*0e10*/ IADD3.X R5, R3, c[0x0][0x164], R10, P0, P3 ; /* 0x0000590003057a10 */
/* 0x000fc400007e640a */
/*0e20*/ LEA.HI.X.SX32 R3, R14, c[0x0][0x16c], 0x1, P4 ; /* 0x00005b000e037a11 */
/* 0x000fc600020f0eff */
/*0e30*/ LDG.E.U8 R14, [R4.64] ; /* 0x00000006040e7981 */
/* 0x000ea8000c1e1100 */
/*0e40*/ LDG.E.U8 R13, [R2.64] ; /* 0x00000006020d7981 */
/* 0x000ea2000c1e1100 */
/*0e50*/ ISETP.NE.AND P3, PT, R9, 0x1, PT ; /* 0x000000010900780c */
/* 0x000fe40003f65270 */
/*0e60*/ ISETP.NE.AND P0, PT, R14, R13, PT ; /* 0x0000000d0e00720c */
/* 0x004fe40003f05270 */
/*0e70*/ IADD3 R13, R16, 0x1, RZ ; /* 0x00000001100d7810 */
/* 0x000fd60007ffe0ff */
/*0e80*/ @P0 IMAD.MOV R13, RZ, RZ, R16 ; /* 0x000000ffff0d0224 */
/* 0x000fc800078e0210 */
/*0e90*/ IMAD.MOV.U32 R16, RZ, RZ, R13 ; /* 0x000000ffff107224 */
/* 0x000fe200078e000d */
/*0ea0*/ @!P3 BRA 0xf80 ; /* 0x000000d00000b947 */
/* 0x000fea0003800000 */
/*0eb0*/ ISETP.NE.AND P3, PT, R9, 0x2, PT ; /* 0x000000020900780c */
/* 0x000fe20003f65270 */
/*0ec0*/ LDG.E.U8 R13, [R2.64+0x1] ; /* 0x00000106020d7981 */
/* 0x000ea8000c1e1100 */
/*0ed0*/ LDG.E.U8 R14, [R4.64+0x1] ; /* 0x00000106040e7981 */
/* 0x000eb0000c1e1100 */
/*0ee0*/ @P3 LDG.E.U8 R15, [R2.64+0x2] ; /* 0x00000206020f3981 */
/* 0x000ee8000c1e1100 */
/*0ef0*/ @P3 LDG.E.U8 R18, [R4.64+0x2] ; /* 0x0000020604123981 */
/* 0x000ee2000c1e1100 */
/*0f00*/ ISETP.NE.AND P0, PT, R14, R13, PT ; /* 0x0000000d0e00720c */
/* 0x004fc40003f05270 */
/*0f10*/ IADD3 R13, R16, 0x1, RZ ; /* 0x00000001100d7810 */
/* 0x000fe40007ffe0ff */
/*0f20*/ ISETP.NE.AND P4, PT, R18, R15, P3 ; /* 0x0000000f1200720c */
/* 0x008fd20001f85270 */
/*0f30*/ @P0 IMAD.MOV R13, RZ, RZ, R16 ; /* 0x000000ffff0d0224 */
/* 0x000fc800078e0210 */
/*0f40*/ IMAD.MOV.U32 R16, RZ, RZ, R13 ; /* 0x000000ffff107224 */
/* 0x000fca00078e000d */
/*0f50*/ @P3 IADD3 R13, R16, 0x1, RZ ; /* 0x00000001100d3810 */
/* 0x000fe20007ffe0ff */
/*0f60*/ @P4 IMAD.MOV R13, RZ, RZ, R16 ; /* 0x000000ffff0d4224 */
/* 0x000fc800078e0210 */
/*0f70*/ @P3 IMAD.MOV.U32 R16, RZ, RZ, R13 ; /* 0x000000ffff103224 */
/* 0x000fe400078e000d */
/*0f80*/ @!P2 BRA 0x1b0 ; /* 0xfffff2200000a947 */
/* 0x000fea000383ffff */
/*0f90*/ IMAD.MOV.U32 R3, RZ, RZ, 0x4 ; /* 0x00000004ff037424 */
/* 0x000fe400078e00ff */
/*0fa0*/ IMAD R2, R7, UR5, R0 ; /* 0x0000000507027c24 */
/* 0x000fc8000f8e0200 */
/*0fb0*/ IMAD.WIDE R2, R2, R3, c[0x0][0x170] ; /* 0x00005c0002027625 */
/* 0x000fca00078e0203 */
/*0fc0*/ STG.E [R2.64], R16 ; /* 0x0000001002007986 */
/* 0x000fe2000c101906 */
/*0fd0*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*0fe0*/ BRA 0xfe0; /* 0xfffffff000007947 */
/* 0x000fc0000383ffff */
/*0ff0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*1000*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*1010*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*1020*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*1030*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*1040*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*1050*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*1060*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*1070*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
.......... |
You are a helpful coding assistant specialized in converting CUDA source code to CUDA host assembly. | /*
CPP_CONTEST=2017
CPP_PROBLEM=I
CPP_LANG=CUDA
CPP_PROCESSES_PER_NODE=saturno 1
*/
/* RECORD
Francisco Muñoz García
September 20, 2017
in CESGA
time 1520
speed-up 9.80
*/
#include <stdlib.h>
__device__ int count(int ld,int n,char *a,char *b) //Each CUDA thread do this work and is called from kernel so we change to __device__
{
int i,j;
int value=0;
for(i=0;i < n;i++)
for(j=0;j < n;j++)
if(a[i*ld+j]==b[i*n+j])
value++;
return value;
}
/*
We create one thread for each element in matrix sizexsize. Each element compare its matrix and save the results in a matrix. For that reason
each thread has an associated element in the matrix.
*/
__global__ void mask(char* a, char* b, int* temp, int n, int m) {
int i = blockIdx.x*blockDim.x + threadIdx.x;
int j = blockIdx.y*blockDim.y + threadIdx.y;
int size = n-m;
if((i<size) && (j<size)) {
temp[i*size+j]=count(n,m,&a[i*n+j],b);
}
}
int sec(int n,char *a,int m,char *b)
{
int i, j;
int maximum=0,value;
int size = n-m;
int nbytes_a = sizeof(char)*n*n;
int nbytes_b = sizeof(char)*m*m;
int nBytes_temp = sizeof(int)*size*size;
int* temp =(int*) malloc(sizeof(int)*size*size);
int* temp_d;
char* a_d;
char* b_d;
int bl_dim1 = 4;
int bl_dim2 = 8;
dim3 block(bl_dim1,bl_dim2);
//we need n-m threads
int gsx = size / bl_dim1;
if(size%bl_dim1) gsx++;
int gsy = size / bl_dim2;
if(size%bl_dim2) gsy++;
dim3 grid(gsx, gsy);
//We reserve memory for GPU
cudaMalloc((void **) &temp_d, nBytes_temp);
cudaMalloc((void**) &a_d, nbytes_a);
cudaMalloc((void**) &b_d, nbytes_b);
//Transfers here
cudaMemset(temp_d, 0, nBytes_temp*sizeof(char)); //All the values should stat with zeros because each thread add values from that initial zero.
cudaMemcpy(a_d, a, nbytes_a, cudaMemcpyHostToDevice);
cudaMemcpy(b_d, b, nbytes_b, cudaMemcpyHostToDevice);
//call the kernel
mask<<<grid, block>>>(a_d, b_d, temp_d, n,m );
//We transfer the results to RAM
cudaMemcpy(temp, temp_d, nBytes_temp, cudaMemcpyDeviceToHost);
cudaFree((void**)temp_d);
cudaFree((void**)a_d);
cudaFree((void**)b_d);
//Once we have the results for each comparition we only have to know which is the best. We do this in sequencial mode.
maximum = temp[0];
for(int i=1; i<size*size;i++) {
if(temp[i]>maximum)
maximum=temp[i];
}
free(temp);
return maximum;
} | .file "tmpxft_0017f5cf_00000000-6_2017Final-G-CUDA-FranciscoMunoz170920.cudafe1.cpp"
.text
#APP
#NO_APP
.type _ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2031:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaUnregisterFatBinary@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2031:
.size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
.globl _Z5countiiPcS_
.type _Z5countiiPcS_, @function
_Z5countiiPcS_:
.LFB2027:
.cfi_startproc
endbr64
pushq %rax
.cfi_def_cfa_offset 16
popq %rax
.cfi_def_cfa_offset 8
subq $24, %rsp
.cfi_def_cfa_offset 32
movl $1, 12(%rsp)
movl 12(%rsp), %edi
call exit@PLT
.cfi_endproc
.LFE2027:
.size _Z5countiiPcS_, .-_Z5countiiPcS_
.globl _Z29__device_stub__Z4maskPcS_PiiiPcS_Piii
.type _Z29__device_stub__Z4maskPcS_PiiiPcS_Piii, @function
_Z29__device_stub__Z4maskPcS_PiiiPcS_Piii:
.LFB2053:
.cfi_startproc
endbr64
subq $152, %rsp
.cfi_def_cfa_offset 160
movq %rdi, 24(%rsp)
movq %rsi, 16(%rsp)
movq %rdx, 8(%rsp)
movl %ecx, 4(%rsp)
movl %r8d, (%rsp)
movq %fs:40, %rax
movq %rax, 136(%rsp)
xorl %eax, %eax
leaq 24(%rsp), %rax
movq %rax, 96(%rsp)
leaq 16(%rsp), %rax
movq %rax, 104(%rsp)
leaq 8(%rsp), %rax
movq %rax, 112(%rsp)
leaq 4(%rsp), %rax
movq %rax, 120(%rsp)
movq %rsp, %rax
movq %rax, 128(%rsp)
movl $1, 48(%rsp)
movl $1, 52(%rsp)
movl $1, 56(%rsp)
movl $1, 60(%rsp)
movl $1, 64(%rsp)
movl $1, 68(%rsp)
leaq 40(%rsp), %rcx
leaq 32(%rsp), %rdx
leaq 60(%rsp), %rsi
leaq 48(%rsp), %rdi
call __cudaPopCallConfiguration@PLT
testl %eax, %eax
je .L9
.L5:
movq 136(%rsp), %rax
subq %fs:40, %rax
jne .L10
addq $152, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 8
ret
.L9:
.cfi_restore_state
pushq 40(%rsp)
.cfi_def_cfa_offset 168
pushq 40(%rsp)
.cfi_def_cfa_offset 176
leaq 112(%rsp), %r9
movq 76(%rsp), %rcx
movl 84(%rsp), %r8d
movq 64(%rsp), %rsi
movl 72(%rsp), %edx
leaq _Z4maskPcS_Piii(%rip), %rdi
call cudaLaunchKernel@PLT
addq $16, %rsp
.cfi_def_cfa_offset 160
jmp .L5
.L10:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE2053:
.size _Z29__device_stub__Z4maskPcS_PiiiPcS_Piii, .-_Z29__device_stub__Z4maskPcS_PiiiPcS_Piii
.globl _Z4maskPcS_Piii
.type _Z4maskPcS_Piii, @function
_Z4maskPcS_Piii:
.LFB2054:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
call _Z29__device_stub__Z4maskPcS_PiiiPcS_Piii
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2054:
.size _Z4maskPcS_Piii, .-_Z4maskPcS_Piii
.globl _Z3seciPciS_
.type _Z3seciPciS_, @function
_Z3seciPciS_:
.LFB2028:
.cfi_startproc
endbr64
pushq %r15
.cfi_def_cfa_offset 16
.cfi_offset 15, -16
pushq %r14
.cfi_def_cfa_offset 24
.cfi_offset 14, -24
pushq %r13
.cfi_def_cfa_offset 32
.cfi_offset 13, -32
pushq %r12
.cfi_def_cfa_offset 40
.cfi_offset 12, -40
pushq %rbp
.cfi_def_cfa_offset 48
.cfi_offset 6, -48
pushq %rbx
.cfi_def_cfa_offset 56
.cfi_offset 3, -56
subq $104, %rsp
.cfi_def_cfa_offset 160
movl %edi, %r12d
movq %rsi, 16(%rsp)
movl %edx, %r13d
movq %rcx, 24(%rsp)
movq %fs:40, %rax
movq %rax, 88(%rsp)
xorl %eax, %eax
movl %edi, %ebx
subl %edx, %ebx
movl %edi, %r15d
imull %edi, %r15d
movl %edx, %eax
imull %edx, %eax
movl %eax, 8(%rsp)
movslq %ebx, %rdi
movl %ebx, %edx
imull %ebx, %edx
leal 0(,%rdx,4), %r14d
imulq %rdi, %rdi
salq $2, %rdi
call malloc@PLT
movq %rax, %rbp
movl $4, 64(%rsp)
movl $8, 68(%rsp)
movl $1, 72(%rsp)
leal 3(%rbx), %edx
testl %ebx, %ebx
cmovns %ebx, %edx
sarl $2, %edx
movl %ebx, %edi
andl $3, %edi
cmpl $1, %edi
sbbl $-1, %edx
leal 7(%rbx), %eax
testl %ebx, %ebx
cmovns %ebx, %eax
sarl $3, %eax
movl %ebx, %ecx
andl $7, %ecx
cmpl $1, %ecx
sbbl $-1, %eax
movl %edx, 76(%rsp)
movl %eax, 80(%rsp)
movl $1, 84(%rsp)
movslq %r14d, %r14
leaq 40(%rsp), %rdi
movq %r14, %rsi
call cudaMalloc@PLT
movslq %r15d, %r15
leaq 48(%rsp), %rdi
movq %r15, %rsi
call cudaMalloc@PLT
movslq 8(%rsp), %rax
leaq 56(%rsp), %rdi
movq %rax, 8(%rsp)
movq %rax, %rsi
call cudaMalloc@PLT
movq %r14, %rdx
movl $0, %esi
movq 40(%rsp), %rdi
call cudaMemset@PLT
movl $1, %ecx
movq %r15, %rdx
movq 16(%rsp), %rsi
movq 48(%rsp), %rdi
call cudaMemcpy@PLT
movl $1, %ecx
movq 8(%rsp), %rdx
movq 24(%rsp), %rsi
movq 56(%rsp), %rdi
call cudaMemcpy@PLT
movl 72(%rsp), %ecx
movl $0, %r9d
movl $0, %r8d
movq 64(%rsp), %rdx
movq 76(%rsp), %rdi
movl 84(%rsp), %esi
call __cudaPushCallConfiguration@PLT
testl %eax, %eax
je .L22
.L16:
movl $2, %ecx
movq %r14, %rdx
movq 40(%rsp), %rsi
movq %rbp, %rdi
call cudaMemcpy@PLT
movq 40(%rsp), %rdi
call cudaFree@PLT
movq 48(%rsp), %rdi
call cudaFree@PLT
movq 56(%rsp), %rdi
call cudaFree@PLT
movl 0(%rbp), %r12d
imull %ebx, %ebx
cmpl $1, %ebx
jle .L17
leaq 4(%rbp), %rax
leal -2(%rbx), %edx
leaq 8(%rbp,%rdx,4), %rcx
.L18:
movl (%rax), %edx
cmpl %edx, %r12d
cmovl %edx, %r12d
addq $4, %rax
cmpq %rcx, %rax
jne .L18
.L17:
movq %rbp, %rdi
call free@PLT
movq 88(%rsp), %rax
subq %fs:40, %rax
jne .L23
movl %r12d, %eax
addq $104, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 56
popq %rbx
.cfi_def_cfa_offset 48
popq %rbp
.cfi_def_cfa_offset 40
popq %r12
.cfi_def_cfa_offset 32
popq %r13
.cfi_def_cfa_offset 24
popq %r14
.cfi_def_cfa_offset 16
popq %r15
.cfi_def_cfa_offset 8
ret
.L22:
.cfi_restore_state
movl %r13d, %r8d
movl %r12d, %ecx
movq 40(%rsp), %rdx
movq 56(%rsp), %rsi
movq 48(%rsp), %rdi
call _Z29__device_stub__Z4maskPcS_PiiiPcS_Piii
jmp .L16
.L23:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE2028:
.size _Z3seciPciS_, .-_Z3seciPciS_
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "_Z4maskPcS_Piii"
.text
.type _ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2056:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
leaq _ZL15__fatDeviceText(%rip), %rdi
call __cudaRegisterFatBinary@PLT
movq %rax, %rdi
movq %rax, _ZL20__cudaFatCubinHandle(%rip)
pushq $0
.cfi_def_cfa_offset 24
pushq $0
.cfi_def_cfa_offset 32
pushq $0
.cfi_def_cfa_offset 40
pushq $0
.cfi_def_cfa_offset 48
movl $0, %r9d
movl $-1, %r8d
leaq .LC0(%rip), %rdx
movq %rdx, %rcx
leaq _Z4maskPcS_Piii(%rip), %rsi
call __cudaRegisterFunction@PLT
addq $32, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaRegisterFatBinaryEnd@PLT
leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
call atexit@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2056:
.size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
.section .init_array,"aw"
.align 8
.quad _ZL24__sti____cudaRegisterAllv
.section .nvFatBinSegment,"aw"
.align 8
.type _ZL15__fatDeviceText, @object
.size _ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
.long 1180844977
.long 1
.quad fatbinData
.quad 0
.local _ZL20__cudaFatCubinHandle
.comm _ZL20__cudaFatCubinHandle,8,8
.ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
.section .note.GNU-stack,"",@progbits
.section .note.gnu.property,"a"
.align 8
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.string "GNU"
1:
.align 8
.long 0xc0000002
.long 3f - 2f
2:
.long 0x3
3:
.align 8
4: |
You are a helpful coding assistant specialized in converting CUDA source code to HIP/AMD source code. | /*
CPP_CONTEST=2017
CPP_PROBLEM=I
CPP_LANG=CUDA
CPP_PROCESSES_PER_NODE=saturno 1
*/
/* RECORD
Francisco Muñoz García
September 20, 2017
in CESGA
time 1520
speed-up 9.80
*/
#include <stdlib.h>
__device__ int count(int ld,int n,char *a,char *b) //Each CUDA thread do this work and is called from kernel so we change to __device__
{
int i,j;
int value=0;
for(i=0;i < n;i++)
for(j=0;j < n;j++)
if(a[i*ld+j]==b[i*n+j])
value++;
return value;
}
/*
We create one thread for each element in matrix sizexsize. Each element compare its matrix and save the results in a matrix. For that reason
each thread has an associated element in the matrix.
*/
__global__ void mask(char* a, char* b, int* temp, int n, int m) {
int i = blockIdx.x*blockDim.x + threadIdx.x;
int j = blockIdx.y*blockDim.y + threadIdx.y;
int size = n-m;
if((i<size) && (j<size)) {
temp[i*size+j]=count(n,m,&a[i*n+j],b);
}
}
int sec(int n,char *a,int m,char *b)
{
int i, j;
int maximum=0,value;
int size = n-m;
int nbytes_a = sizeof(char)*n*n;
int nbytes_b = sizeof(char)*m*m;
int nBytes_temp = sizeof(int)*size*size;
int* temp =(int*) malloc(sizeof(int)*size*size);
int* temp_d;
char* a_d;
char* b_d;
int bl_dim1 = 4;
int bl_dim2 = 8;
dim3 block(bl_dim1,bl_dim2);
//we need n-m threads
int gsx = size / bl_dim1;
if(size%bl_dim1) gsx++;
int gsy = size / bl_dim2;
if(size%bl_dim2) gsy++;
dim3 grid(gsx, gsy);
//We reserve memory for GPU
cudaMalloc((void **) &temp_d, nBytes_temp);
cudaMalloc((void**) &a_d, nbytes_a);
cudaMalloc((void**) &b_d, nbytes_b);
//Transfers here
cudaMemset(temp_d, 0, nBytes_temp*sizeof(char)); //All the values should stat with zeros because each thread add values from that initial zero.
cudaMemcpy(a_d, a, nbytes_a, cudaMemcpyHostToDevice);
cudaMemcpy(b_d, b, nbytes_b, cudaMemcpyHostToDevice);
//call the kernel
mask<<<grid, block>>>(a_d, b_d, temp_d, n,m );
//We transfer the results to RAM
cudaMemcpy(temp, temp_d, nBytes_temp, cudaMemcpyDeviceToHost);
cudaFree((void**)temp_d);
cudaFree((void**)a_d);
cudaFree((void**)b_d);
//Once we have the results for each comparition we only have to know which is the best. We do this in sequencial mode.
maximum = temp[0];
for(int i=1; i<size*size;i++) {
if(temp[i]>maximum)
maximum=temp[i];
}
free(temp);
return maximum;
} | /*
CPP_CONTEST=2017
CPP_PROBLEM=I
CPP_LANG=CUDA
CPP_PROCESSES_PER_NODE=saturno 1
*/
/* RECORD
Francisco Muñoz García
September 20, 2017
in CESGA
time 1520
speed-up 9.80
*/
#include <hip/hip_runtime.h>
#include <stdlib.h>
__device__ int count(int ld,int n,char *a,char *b) //Each CUDA thread do this work and is called from kernel so we change to __device__
{
int i,j;
int value=0;
for(i=0;i < n;i++)
for(j=0;j < n;j++)
if(a[i*ld+j]==b[i*n+j])
value++;
return value;
}
/*
We create one thread for each element in matrix sizexsize. Each element compare its matrix and save the results in a matrix. For that reason
each thread has an associated element in the matrix.
*/
__global__ void mask(char* a, char* b, int* temp, int n, int m) {
int i = blockIdx.x*blockDim.x + threadIdx.x;
int j = blockIdx.y*blockDim.y + threadIdx.y;
int size = n-m;
if((i<size) && (j<size)) {
temp[i*size+j]=count(n,m,&a[i*n+j],b);
}
}
int sec(int n,char *a,int m,char *b)
{
int i, j;
int maximum=0,value;
int size = n-m;
int nbytes_a = sizeof(char)*n*n;
int nbytes_b = sizeof(char)*m*m;
int nBytes_temp = sizeof(int)*size*size;
int* temp =(int*) malloc(sizeof(int)*size*size);
int* temp_d;
char* a_d;
char* b_d;
int bl_dim1 = 4;
int bl_dim2 = 8;
dim3 block(bl_dim1,bl_dim2);
//we need n-m threads
int gsx = size / bl_dim1;
if(size%bl_dim1) gsx++;
int gsy = size / bl_dim2;
if(size%bl_dim2) gsy++;
dim3 grid(gsx, gsy);
//We reserve memory for GPU
hipMalloc((void **) &temp_d, nBytes_temp);
hipMalloc((void**) &a_d, nbytes_a);
hipMalloc((void**) &b_d, nbytes_b);
//Transfers here
hipMemset(temp_d, 0, nBytes_temp*sizeof(char)); //All the values should stat with zeros because each thread add values from that initial zero.
hipMemcpy(a_d, a, nbytes_a, hipMemcpyHostToDevice);
hipMemcpy(b_d, b, nbytes_b, hipMemcpyHostToDevice);
//call the kernel
mask<<<grid, block>>>(a_d, b_d, temp_d, n,m );
//We transfer the results to RAM
hipMemcpy(temp, temp_d, nBytes_temp, hipMemcpyDeviceToHost);
hipFree((void**)temp_d);
hipFree((void**)a_d);
hipFree((void**)b_d);
//Once we have the results for each comparition we only have to know which is the best. We do this in sequencial mode.
maximum = temp[0];
for(int i=1; i<size*size;i++) {
if(temp[i]>maximum)
maximum=temp[i];
}
free(temp);
return maximum;
} |
You are a helpful coding assistant specialized in converting HIP source code to AMD device assembly. | /*
CPP_CONTEST=2017
CPP_PROBLEM=I
CPP_LANG=CUDA
CPP_PROCESSES_PER_NODE=saturno 1
*/
/* RECORD
Francisco Muñoz García
September 20, 2017
in CESGA
time 1520
speed-up 9.80
*/
#include <hip/hip_runtime.h>
#include <stdlib.h>
__device__ int count(int ld,int n,char *a,char *b) //Each CUDA thread do this work and is called from kernel so we change to __device__
{
int i,j;
int value=0;
for(i=0;i < n;i++)
for(j=0;j < n;j++)
if(a[i*ld+j]==b[i*n+j])
value++;
return value;
}
/*
We create one thread for each element in matrix sizexsize. Each element compare its matrix and save the results in a matrix. For that reason
each thread has an associated element in the matrix.
*/
__global__ void mask(char* a, char* b, int* temp, int n, int m) {
int i = blockIdx.x*blockDim.x + threadIdx.x;
int j = blockIdx.y*blockDim.y + threadIdx.y;
int size = n-m;
if((i<size) && (j<size)) {
temp[i*size+j]=count(n,m,&a[i*n+j],b);
}
}
int sec(int n,char *a,int m,char *b)
{
int i, j;
int maximum=0,value;
int size = n-m;
int nbytes_a = sizeof(char)*n*n;
int nbytes_b = sizeof(char)*m*m;
int nBytes_temp = sizeof(int)*size*size;
int* temp =(int*) malloc(sizeof(int)*size*size);
int* temp_d;
char* a_d;
char* b_d;
int bl_dim1 = 4;
int bl_dim2 = 8;
dim3 block(bl_dim1,bl_dim2);
//we need n-m threads
int gsx = size / bl_dim1;
if(size%bl_dim1) gsx++;
int gsy = size / bl_dim2;
if(size%bl_dim2) gsy++;
dim3 grid(gsx, gsy);
//We reserve memory for GPU
hipMalloc((void **) &temp_d, nBytes_temp);
hipMalloc((void**) &a_d, nbytes_a);
hipMalloc((void**) &b_d, nbytes_b);
//Transfers here
hipMemset(temp_d, 0, nBytes_temp*sizeof(char)); //All the values should stat with zeros because each thread add values from that initial zero.
hipMemcpy(a_d, a, nbytes_a, hipMemcpyHostToDevice);
hipMemcpy(b_d, b, nbytes_b, hipMemcpyHostToDevice);
//call the kernel
mask<<<grid, block>>>(a_d, b_d, temp_d, n,m );
//We transfer the results to RAM
hipMemcpy(temp, temp_d, nBytes_temp, hipMemcpyDeviceToHost);
hipFree((void**)temp_d);
hipFree((void**)a_d);
hipFree((void**)b_d);
//Once we have the results for each comparition we only have to know which is the best. We do this in sequencial mode.
maximum = temp[0];
for(int i=1; i<size*size;i++) {
if(temp[i]>maximum)
maximum=temp[i];
}
free(temp);
return maximum;
} | .text
.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
.protected _Z4maskPcS_Piii
.globl _Z4maskPcS_Piii
.p2align 8
.type _Z4maskPcS_Piii,@function
_Z4maskPcS_Piii:
s_clause 0x1
s_load_b32 s4, s[0:1], 0x2c
s_load_b64 s[2:3], s[0:1], 0x18
v_and_b32_e32 v2, 0x3ff, v0
v_bfe_u32 v3, v0, 10, 10
s_waitcnt lgkmcnt(0)
s_and_b32 s5, s4, 0xffff
s_lshr_b32 s4, s4, 16
s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
v_mad_u64_u32 v[0:1], null, s14, s5, v[2:3]
v_mad_u64_u32 v[1:2], null, s15, s4, v[3:4]
s_sub_i32 s8, s2, s3
s_mov_b32 s4, exec_lo
v_max_i32_e32 v2, v0, v1
s_delay_alu instid0(VALU_DEP_1)
v_cmpx_gt_i32_e64 s8, v2
s_cbranch_execz .LBB0_8
s_cmp_lt_i32 s3, 1
s_cbranch_scc1 .LBB0_6
s_load_b128 s[4:7], s[0:1], 0x0
v_mad_u64_u32 v[3:4], null, v0, s2, v[1:2]
v_dual_mov_b32 v2, 0 :: v_dual_mov_b32 v5, 0
s_mov_b32 s9, 0
s_mov_b32 s10, s3
s_ashr_i32 s11, s2, 31
s_mov_b32 s12, 0
s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_2)
v_ashrrev_i32_e32 v4, 31, v3
s_waitcnt lgkmcnt(0)
v_add_co_u32 v3, vcc_lo, s4, v3
v_add_co_ci_u32_e32 v4, vcc_lo, s5, v4, vcc_lo
.p2align 6
.LBB0_3:
s_add_u32 s13, s6, s9
s_addc_u32 s14, s7, 0
s_mov_b64 s[4:5], 0
.LBB0_4:
s_delay_alu instid0(SALU_CYCLE_1)
v_add_co_u32 v6, vcc_lo, v3, s4
v_add_co_ci_u32_e32 v7, vcc_lo, s5, v4, vcc_lo
s_add_u32 s16, s13, s4
s_addc_u32 s17, s14, s5
global_load_u8 v8, v5, s[16:17]
global_load_u8 v6, v[6:7], off
s_add_u32 s4, s4, 1
s_addc_u32 s5, s5, 0
s_cmp_lg_u32 s10, s4
s_waitcnt vmcnt(0)
v_cmp_eq_u16_e32 vcc_lo, v6, v8
v_add_co_ci_u32_e32 v2, vcc_lo, 0, v2, vcc_lo
s_cbranch_scc1 .LBB0_4
v_add_co_u32 v3, vcc_lo, v3, s2
v_add_co_ci_u32_e32 v4, vcc_lo, s11, v4, vcc_lo
s_add_i32 s12, s12, 1
s_add_i32 s9, s9, s3
s_cmp_lg_u32 s12, s3
s_cbranch_scc1 .LBB0_3
s_branch .LBB0_7
.LBB0_6:
v_mov_b32_e32 v2, 0
.LBB0_7:
s_load_b64 s[0:1], s[0:1], 0x10
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_mad_u64_u32 v[3:4], null, v0, s8, v[1:2]
v_ashrrev_i32_e32 v4, 31, v3
s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
v_lshlrev_b64 v[0:1], 2, v[3:4]
s_waitcnt lgkmcnt(0)
v_add_co_u32 v0, vcc_lo, s0, v0
s_delay_alu instid0(VALU_DEP_2)
v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
global_store_b32 v[0:1], v2, off
.LBB0_8:
s_nop 0
s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
s_endpgm
.section .rodata,"a",@progbits
.p2align 6, 0x0
.amdhsa_kernel _Z4maskPcS_Piii
.amdhsa_group_segment_fixed_size 0
.amdhsa_private_segment_fixed_size 0
.amdhsa_kernarg_size 288
.amdhsa_user_sgpr_count 14
.amdhsa_user_sgpr_dispatch_ptr 0
.amdhsa_user_sgpr_queue_ptr 0
.amdhsa_user_sgpr_kernarg_segment_ptr 1
.amdhsa_user_sgpr_dispatch_id 0
.amdhsa_user_sgpr_private_segment_size 0
.amdhsa_wavefront_size32 1
.amdhsa_uses_dynamic_stack 0
.amdhsa_enable_private_segment 0
.amdhsa_system_sgpr_workgroup_id_x 1
.amdhsa_system_sgpr_workgroup_id_y 1
.amdhsa_system_sgpr_workgroup_id_z 0
.amdhsa_system_sgpr_workgroup_info 0
.amdhsa_system_vgpr_workitem_id 1
.amdhsa_next_free_vgpr 9
.amdhsa_next_free_sgpr 18
.amdhsa_float_round_mode_32 0
.amdhsa_float_round_mode_16_64 0
.amdhsa_float_denorm_mode_32 3
.amdhsa_float_denorm_mode_16_64 3
.amdhsa_dx10_clamp 1
.amdhsa_ieee_mode 1
.amdhsa_fp16_overflow 0
.amdhsa_workgroup_processor_mode 1
.amdhsa_memory_ordered 1
.amdhsa_forward_progress 0
.amdhsa_shared_vgpr_count 0
.amdhsa_exception_fp_ieee_invalid_op 0
.amdhsa_exception_fp_denorm_src 0
.amdhsa_exception_fp_ieee_div_zero 0
.amdhsa_exception_fp_ieee_overflow 0
.amdhsa_exception_fp_ieee_underflow 0
.amdhsa_exception_fp_ieee_inexact 0
.amdhsa_exception_int_div_zero 0
.end_amdhsa_kernel
.text
.Lfunc_end0:
.size _Z4maskPcS_Piii, .Lfunc_end0-_Z4maskPcS_Piii
.section .AMDGPU.csdata,"",@progbits
.text
.p2alignl 7, 3214868480
.fill 96, 4, 3214868480
.type __hip_cuid_,@object
.section .bss,"aw",@nobits
.globl __hip_cuid_
__hip_cuid_:
.byte 0
.size __hip_cuid_, 1
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym __hip_cuid_
.amdgpu_metadata
---
amdhsa.kernels:
- .args:
- .address_space: global
.offset: 0
.size: 8
.value_kind: global_buffer
- .address_space: global
.offset: 8
.size: 8
.value_kind: global_buffer
- .address_space: global
.offset: 16
.size: 8
.value_kind: global_buffer
- .offset: 24
.size: 4
.value_kind: by_value
- .offset: 28
.size: 4
.value_kind: by_value
- .offset: 32
.size: 4
.value_kind: hidden_block_count_x
- .offset: 36
.size: 4
.value_kind: hidden_block_count_y
- .offset: 40
.size: 4
.value_kind: hidden_block_count_z
- .offset: 44
.size: 2
.value_kind: hidden_group_size_x
- .offset: 46
.size: 2
.value_kind: hidden_group_size_y
- .offset: 48
.size: 2
.value_kind: hidden_group_size_z
- .offset: 50
.size: 2
.value_kind: hidden_remainder_x
- .offset: 52
.size: 2
.value_kind: hidden_remainder_y
- .offset: 54
.size: 2
.value_kind: hidden_remainder_z
- .offset: 72
.size: 8
.value_kind: hidden_global_offset_x
- .offset: 80
.size: 8
.value_kind: hidden_global_offset_y
- .offset: 88
.size: 8
.value_kind: hidden_global_offset_z
- .offset: 96
.size: 2
.value_kind: hidden_grid_dims
.group_segment_fixed_size: 0
.kernarg_segment_align: 8
.kernarg_segment_size: 288
.language: OpenCL C
.language_version:
- 2
- 0
.max_flat_workgroup_size: 1024
.name: _Z4maskPcS_Piii
.private_segment_fixed_size: 0
.sgpr_count: 20
.sgpr_spill_count: 0
.symbol: _Z4maskPcS_Piii.kd
.uniform_work_group_size: 1
.uses_dynamic_stack: false
.vgpr_count: 9
.vgpr_spill_count: 0
.wavefront_size: 32
.workgroup_processor_mode: 1
amdhsa.target: amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
- 1
- 2
...
.end_amdgpu_metadata |
You are a helpful coding assistant specialized in converting HIP source code to AMD host assembly. | /*
CPP_CONTEST=2017
CPP_PROBLEM=I
CPP_LANG=CUDA
CPP_PROCESSES_PER_NODE=saturno 1
*/
/* RECORD
Francisco Muñoz García
September 20, 2017
in CESGA
time 1520
speed-up 9.80
*/
#include <hip/hip_runtime.h>
#include <stdlib.h>
__device__ int count(int ld,int n,char *a,char *b) //Each CUDA thread do this work and is called from kernel so we change to __device__
{
int i,j;
int value=0;
for(i=0;i < n;i++)
for(j=0;j < n;j++)
if(a[i*ld+j]==b[i*n+j])
value++;
return value;
}
/*
We create one thread for each element in matrix sizexsize. Each element compare its matrix and save the results in a matrix. For that reason
each thread has an associated element in the matrix.
*/
__global__ void mask(char* a, char* b, int* temp, int n, int m) {
int i = blockIdx.x*blockDim.x + threadIdx.x;
int j = blockIdx.y*blockDim.y + threadIdx.y;
int size = n-m;
if((i<size) && (j<size)) {
temp[i*size+j]=count(n,m,&a[i*n+j],b);
}
}
int sec(int n,char *a,int m,char *b)
{
int i, j;
int maximum=0,value;
int size = n-m;
int nbytes_a = sizeof(char)*n*n;
int nbytes_b = sizeof(char)*m*m;
int nBytes_temp = sizeof(int)*size*size;
int* temp =(int*) malloc(sizeof(int)*size*size);
int* temp_d;
char* a_d;
char* b_d;
int bl_dim1 = 4;
int bl_dim2 = 8;
dim3 block(bl_dim1,bl_dim2);
//we need n-m threads
int gsx = size / bl_dim1;
if(size%bl_dim1) gsx++;
int gsy = size / bl_dim2;
if(size%bl_dim2) gsy++;
dim3 grid(gsx, gsy);
//We reserve memory for GPU
hipMalloc((void **) &temp_d, nBytes_temp);
hipMalloc((void**) &a_d, nbytes_a);
hipMalloc((void**) &b_d, nbytes_b);
//Transfers here
hipMemset(temp_d, 0, nBytes_temp*sizeof(char)); //All the values should stat with zeros because each thread add values from that initial zero.
hipMemcpy(a_d, a, nbytes_a, hipMemcpyHostToDevice);
hipMemcpy(b_d, b, nbytes_b, hipMemcpyHostToDevice);
//call the kernel
mask<<<grid, block>>>(a_d, b_d, temp_d, n,m );
//We transfer the results to RAM
hipMemcpy(temp, temp_d, nBytes_temp, hipMemcpyDeviceToHost);
hipFree((void**)temp_d);
hipFree((void**)a_d);
hipFree((void**)b_d);
//Once we have the results for each comparition we only have to know which is the best. We do this in sequencial mode.
maximum = temp[0];
for(int i=1; i<size*size;i++) {
if(temp[i]>maximum)
maximum=temp[i];
}
free(temp);
return maximum;
} | .text
.file "2017Final-G-CUDA-FranciscoMunoz170920.hip"
.globl _Z19__device_stub__maskPcS_Piii # -- Begin function _Z19__device_stub__maskPcS_Piii
.p2align 4, 0x90
.type _Z19__device_stub__maskPcS_Piii,@function
_Z19__device_stub__maskPcS_Piii: # @_Z19__device_stub__maskPcS_Piii
.cfi_startproc
# %bb.0:
subq $120, %rsp
.cfi_def_cfa_offset 128
movq %rdi, 72(%rsp)
movq %rsi, 64(%rsp)
movq %rdx, 56(%rsp)
movl %ecx, 4(%rsp)
movl %r8d, (%rsp)
leaq 72(%rsp), %rax
movq %rax, 80(%rsp)
leaq 64(%rsp), %rax
movq %rax, 88(%rsp)
leaq 56(%rsp), %rax
movq %rax, 96(%rsp)
leaq 4(%rsp), %rax
movq %rax, 104(%rsp)
movq %rsp, %rax
movq %rax, 112(%rsp)
leaq 40(%rsp), %rdi
leaq 24(%rsp), %rsi
leaq 16(%rsp), %rdx
leaq 8(%rsp), %rcx
callq __hipPopCallConfiguration
movq 40(%rsp), %rsi
movl 48(%rsp), %edx
movq 24(%rsp), %rcx
movl 32(%rsp), %r8d
leaq 80(%rsp), %r9
movl $_Z4maskPcS_Piii, %edi
pushq 8(%rsp)
.cfi_adjust_cfa_offset 8
pushq 24(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $136, %rsp
.cfi_adjust_cfa_offset -136
retq
.Lfunc_end0:
.size _Z19__device_stub__maskPcS_Piii, .Lfunc_end0-_Z19__device_stub__maskPcS_Piii
.cfi_endproc
# -- End function
.globl _Z3seciPciS_ # -- Begin function _Z3seciPciS_
.p2align 4, 0x90
.type _Z3seciPciS_,@function
_Z3seciPciS_: # @_Z3seciPciS_
.cfi_startproc
# %bb.0:
pushq %rbp
.cfi_def_cfa_offset 16
pushq %r15
.cfi_def_cfa_offset 24
pushq %r14
.cfi_def_cfa_offset 32
pushq %r13
.cfi_def_cfa_offset 40
pushq %r12
.cfi_def_cfa_offset 48
pushq %rbx
.cfi_def_cfa_offset 56
subq $168, %rsp
.cfi_def_cfa_offset 224
.cfi_offset %rbx, -56
.cfi_offset %r12, -48
.cfi_offset %r13, -40
.cfi_offset %r14, -32
.cfi_offset %r15, -24
.cfi_offset %rbp, -16
movq %rcx, 48(%rsp) # 8-byte Spill
movq %rsi, 40(%rsp) # 8-byte Spill
movl %edi, %r14d
subl %edx, %r14d
movl %edi, 24(%rsp) # 4-byte Spill
movl %edi, %r13d
imull %edi, %r13d
movl %edx, 28(%rsp) # 4-byte Spill
movl %edx, %ebp
imull %edx, %ebp
movslq %r14d, %rbx
movq %rbx, %r15
imulq %rbx, %r15
shlq $2, %r15
movq %r15, %rdi
callq malloc
leal 3(%rbx), %ecx
leal 7(%rbx), %r12d
testl %ebx, %ebx
cmovnsl %r14d, %ecx
cmovnsl %r14d, %r12d
sarl $2, %ecx
movl %ebx, %edx
andl $3, %edx
cmpl $1, %edx
sbbl $-1, %ecx
sarl $3, %r12d
andl $7, %ebx
cmpl $1, %ebx
sbbl $-1, %r12d
movq %rax, %rbx
shlq $32, %r12
orq %rcx, %r12
movslq %r15d, %r15
movq %rsp, %rdi
movq %r15, %rsi
callq hipMalloc
movslq %r13d, %r13
leaq 16(%rsp), %rdi
movq %r13, %rsi
callq hipMalloc
movslq %ebp, %rbp
leaq 8(%rsp), %rdi
movq %rbp, %rsi
callq hipMalloc
movq (%rsp), %rdi
xorl %esi, %esi
movq %r15, %rdx
callq hipMemset
movq 16(%rsp), %rdi
movq 40(%rsp), %rsi # 8-byte Reload
movq %r13, %rdx
movl $1, %ecx
callq hipMemcpy
movq 8(%rsp), %rdi
movq 48(%rsp), %rsi # 8-byte Reload
movq %rbp, %rdx
movl $1, %ecx
callq hipMemcpy
movabsq $34359738372, %rdx # imm = 0x800000004
movq %r12, %rdi
movl $1, %esi
movl $1, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq __hipPushCallConfiguration
testl %eax, %eax
jne .LBB1_2
# %bb.1:
movq 16(%rsp), %rax
movq 8(%rsp), %rcx
movq (%rsp), %rdx
movq %rax, 120(%rsp)
movq %rcx, 112(%rsp)
movq %rdx, 104(%rsp)
movl 24(%rsp), %eax # 4-byte Reload
movl %eax, 36(%rsp)
movl 28(%rsp), %eax # 4-byte Reload
movl %eax, 32(%rsp)
leaq 120(%rsp), %rax
movq %rax, 128(%rsp)
leaq 112(%rsp), %rax
movq %rax, 136(%rsp)
leaq 104(%rsp), %rax
movq %rax, 144(%rsp)
leaq 36(%rsp), %rax
movq %rax, 152(%rsp)
leaq 32(%rsp), %rax
movq %rax, 160(%rsp)
leaq 88(%rsp), %rdi
leaq 72(%rsp), %rsi
leaq 64(%rsp), %rdx
leaq 56(%rsp), %rcx
callq __hipPopCallConfiguration
movq 88(%rsp), %rsi
movl 96(%rsp), %edx
movq 72(%rsp), %rcx
movl 80(%rsp), %r8d
leaq 128(%rsp), %r9
movl $_Z4maskPcS_Piii, %edi
pushq 56(%rsp)
.cfi_adjust_cfa_offset 8
pushq 72(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $16, %rsp
.cfi_adjust_cfa_offset -16
.LBB1_2:
movq (%rsp), %rsi
movq %rbx, %rdi
movq %r15, %rdx
movl $2, %ecx
callq hipMemcpy
movq (%rsp), %rdi
callq hipFree
movq 16(%rsp), %rdi
callq hipFree
movq 8(%rsp), %rdi
callq hipFree
movl (%rbx), %ebp
imull %r14d, %r14d
cmpl $2, %r14d
jb .LBB1_5
# %bb.3: # %.lr.ph.preheader
movl %r14d, %eax
movl $1, %ecx
.p2align 4, 0x90
.LBB1_4: # %.lr.ph
# =>This Inner Loop Header: Depth=1
movl (%rbx,%rcx,4), %edx
cmpl %ebp, %edx
cmovgl %edx, %ebp
incq %rcx
cmpq %rcx, %rax
jne .LBB1_4
.LBB1_5: # %._crit_edge
movq %rbx, %rdi
callq free
movl %ebp, %eax
addq $168, %rsp
.cfi_def_cfa_offset 56
popq %rbx
.cfi_def_cfa_offset 48
popq %r12
.cfi_def_cfa_offset 40
popq %r13
.cfi_def_cfa_offset 32
popq %r14
.cfi_def_cfa_offset 24
popq %r15
.cfi_def_cfa_offset 16
popq %rbp
.cfi_def_cfa_offset 8
retq
.Lfunc_end1:
.size _Z3seciPciS_, .Lfunc_end1-_Z3seciPciS_
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_ctor
.type __hip_module_ctor,@function
__hip_module_ctor: # @__hip_module_ctor
.cfi_startproc
# %bb.0:
subq $40, %rsp
.cfi_def_cfa_offset 48
cmpq $0, __hip_gpubin_handle(%rip)
jne .LBB2_2
# %bb.1:
movl $__hip_fatbin_wrapper, %edi
callq __hipRegisterFatBinary
movq %rax, __hip_gpubin_handle(%rip)
.LBB2_2:
movq __hip_gpubin_handle(%rip), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 16(%rsp)
movups %xmm0, (%rsp)
movl $_Z4maskPcS_Piii, %esi
movl $.L__unnamed_1, %edx
movl $.L__unnamed_1, %ecx
movl $-1, %r8d
xorl %r9d, %r9d
callq __hipRegisterFunction
movl $__hip_module_dtor, %edi
addq $40, %rsp
.cfi_def_cfa_offset 8
jmp atexit # TAILCALL
.Lfunc_end2:
.size __hip_module_ctor, .Lfunc_end2-__hip_module_ctor
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_dtor
.type __hip_module_dtor,@function
__hip_module_dtor: # @__hip_module_dtor
.cfi_startproc
# %bb.0:
movq __hip_gpubin_handle(%rip), %rdi
testq %rdi, %rdi
je .LBB3_2
# %bb.1:
pushq %rax
.cfi_def_cfa_offset 16
callq __hipUnregisterFatBinary
movq $0, __hip_gpubin_handle(%rip)
addq $8, %rsp
.cfi_def_cfa_offset 8
.LBB3_2:
retq
.Lfunc_end3:
.size __hip_module_dtor, .Lfunc_end3-__hip_module_dtor
.cfi_endproc
# -- End function
.type _Z4maskPcS_Piii,@object # @_Z4maskPcS_Piii
.section .rodata,"a",@progbits
.globl _Z4maskPcS_Piii
.p2align 3, 0x0
_Z4maskPcS_Piii:
.quad _Z19__device_stub__maskPcS_Piii
.size _Z4maskPcS_Piii, 8
.type .L__unnamed_1,@object # @0
.section .rodata.str1.1,"aMS",@progbits,1
.L__unnamed_1:
.asciz "_Z4maskPcS_Piii"
.size .L__unnamed_1, 16
.type __hip_fatbin_wrapper,@object # @__hip_fatbin_wrapper
.section .hipFatBinSegment,"a",@progbits
.p2align 3, 0x0
__hip_fatbin_wrapper:
.long 1212764230 # 0x48495046
.long 1 # 0x1
.quad __hip_fatbin
.quad 0
.size __hip_fatbin_wrapper, 24
.type __hip_gpubin_handle,@object # @__hip_gpubin_handle
.local __hip_gpubin_handle
.comm __hip_gpubin_handle,8,8
.section .init_array,"aw",@init_array
.p2align 3, 0x0
.quad __hip_module_ctor
.type __hip_cuid_,@object # @__hip_cuid_
.bss
.globl __hip_cuid_
__hip_cuid_:
.byte 0 # 0x0
.size __hip_cuid_, 1
.section ".linker-options","e",@llvm_linker_options
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym _Z19__device_stub__maskPcS_Piii
.addrsig_sym __hip_module_ctor
.addrsig_sym __hip_module_dtor
.addrsig_sym _Z4maskPcS_Piii
.addrsig_sym __hip_fatbin
.addrsig_sym __hip_fatbin_wrapper
.addrsig_sym __hip_cuid_ |
You are a helpful coding assistant specialized in converting from CUDA device assembly to AMD device assembly. | code for sm_80
Function : _Z4maskPcS_Piii
.headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)"
/*0000*/ IMAD.MOV.U32 R1, RZ, RZ, c[0x0][0x28] ; /* 0x00000a00ff017624 */
/* 0x000fe400078e00ff */
/*0010*/ S2R R0, SR_CTAID.Y ; /* 0x0000000000007919 */
/* 0x000e220000002600 */
/*0020*/ ULDC.64 UR4, c[0x0][0x178] ; /* 0x00005e0000047ab9 */
/* 0x000fe40000000a00 */
/*0030*/ UIADD3 UR5, UR4, -UR5, URZ ; /* 0x8000000504057290 */
/* 0x000fe2000fffe03f */
/*0040*/ S2R R3, SR_TID.Y ; /* 0x0000000000037919 */
/* 0x000e280000002200 */
/*0050*/ S2R R7, SR_CTAID.X ; /* 0x0000000000077919 */
/* 0x000e680000002500 */
/*0060*/ S2R R2, SR_TID.X ; /* 0x0000000000027919 */
/* 0x000e620000002100 */
/*0070*/ IMAD R0, R0, c[0x0][0x4], R3 ; /* 0x0000010000007a24 */
/* 0x001fca00078e0203 */
/*0080*/ ISETP.GE.AND P0, PT, R0, UR5, PT ; /* 0x0000000500007c0c */
/* 0x000fe2000bf06270 */
/*0090*/ IMAD R7, R7, c[0x0][0x0], R2 ; /* 0x0000000007077a24 */
/* 0x002fca00078e0202 */
/*00a0*/ ISETP.GE.OR P0, PT, R7, UR5, P0 ; /* 0x0000000507007c0c */
/* 0x000fda0008706670 */
/*00b0*/ @P0 EXIT ; /* 0x000000000000094d */
/* 0x000fea0003800000 */
/*00c0*/ IMAD.MOV.U32 R9, RZ, RZ, c[0x0][0x17c] ; /* 0x00005f00ff097624 */
/* 0x000fe200078e00ff */
/*00d0*/ ULDC.64 UR6, c[0x0][0x118] ; /* 0x0000460000067ab9 */
/* 0x000fe20000000a00 */
/*00e0*/ IMAD.MOV.U32 R16, RZ, RZ, RZ ; /* 0x000000ffff107224 */
/* 0x000fc600078e00ff */
/*00f0*/ ISETP.GE.AND P0, PT, R9, 0x1, PT ; /* 0x000000010900780c */
/* 0x000fda0003f06270 */
/*0100*/ @!P0 BRA 0xf90 ; /* 0x00000e8000008947 */
/* 0x000fea0003800000 */
/*0110*/ IMAD R6, R7, c[0x0][0x178], R0 ; /* 0x00005e0007067a24 */
/* 0x000fe200078e0200 */
/*0120*/ IADD3 R2, R9.reuse, -0x1, RZ ; /* 0xffffffff09027810 */
/* 0x040fe20007ffe0ff */
/*0130*/ IMAD.MOV.U32 R16, RZ, RZ, RZ ; /* 0x000000ffff107224 */
/* 0x000fe200078e00ff */
/*0140*/ LOP3.LUT R9, R9, 0x3, RZ, 0xc0, !PT ; /* 0x0000000309097812 */
/* 0x000fe200078ec0ff */
/*0150*/ IMAD.MOV.U32 R20, RZ, RZ, RZ ; /* 0x000000ffff147224 */
/* 0x000fe200078e00ff */
/*0160*/ IADD3 R8, P0, R6, c[0x0][0x160], RZ ; /* 0x0000580006087a10 */
/* 0x000fe40007f1e0ff */
/*0170*/ SHF.R.S32.HI R10, RZ, 0x1f, R6 ; /* 0x0000001fff0a7819 */
/* 0x000fe40000011406 */
/*0180*/ ISETP.GE.U32.AND P1, PT, R2, 0x3, PT ; /* 0x000000030200780c */
/* 0x000fe40003f26070 */
/*0190*/ IADD3 R11, -R9, c[0x0][0x17c], RZ ; /* 0x00005f00090b7a10 */
/* 0x000fc40007ffe1ff */
/*01a0*/ IADD3.X R12, R10, c[0x0][0x164], RZ, P0, !PT ; /* 0x000059000a0c7a10 */
/* 0x000fe400007fe4ff */
/*01b0*/ IMAD R13, R20.reuse, c[0x0][0x178], RZ ; /* 0x00005e00140d7a24 */
/* 0x040fe200078e02ff */
/*01c0*/ UMOV UR4, URZ ; /* 0x0000003f00047c82 */
/* 0x000fe20008000000 */
/*01d0*/ IMAD R14, R20.reuse, c[0x0][0x17c], RZ ; /* 0x00005f00140e7a24 */
/* 0x040fe200078e02ff */
/*01e0*/ IADD3 R20, R20, 0x1, RZ ; /* 0x0000000114147810 */
/* 0x000fc80007ffe0ff */
/*01f0*/ ISETP.GE.AND P2, PT, R20, c[0x0][0x17c], PT ; /* 0x00005f0014007a0c */
/* 0x000fe20003f46270 */
/*0200*/ @!P1 BRA 0xda0 ; /* 0x00000b9000009947 */
/* 0x000fea0003800000 */
/*0210*/ ISETP.GT.AND P0, PT, R11, RZ, PT ; /* 0x000000ff0b00720c */
/* 0x000fe20003f04270 */
/*0220*/ UMOV UR4, URZ ; /* 0x0000003f00047c82 */
/* 0x000fe20008000000 */
/*0230*/ IADD3 R2, P3, R13.reuse, R8, RZ ; /* 0x000000080d027210 */
/* 0x040fe20007f7e0ff */
/*0240*/ ULDC.64 UR8, c[0x0][0x168] ; /* 0x00005a0000087ab9 */
/* 0x000fe20000000a00 */
/*0250*/ SHF.R.S32.HI R21, RZ, 0x1f, R14 ; /* 0x0000001fff157819 */
/* 0x000fe2000001140e */
/*0260*/ IMAD.MOV.U32 R15, RZ, RZ, R11 ; /* 0x000000ffff0f7224 */
/* 0x000fe200078e000b */
/*0270*/ LEA.HI.X.SX32 R3, R13, R12, 0x1, P3 ; /* 0x0000000c0d037211 */
/* 0x000fce00018f0eff */
/*0280*/ @!P0 BRA 0xbc0 ; /* 0x0000093000008947 */
/* 0x000fea0003800000 */
/*0290*/ ISETP.GT.AND P3, PT, R15, 0xc, PT ; /* 0x0000000c0f00780c */
/* 0x000fe40003f64270 */
/*02a0*/ PLOP3.LUT P0, PT, PT, PT, PT, 0x80, 0x0 ; /* 0x000000000000781c */
/* 0x000fd60003f0f070 */
/*02b0*/ @!P3 BRA 0x870 ; /* 0x000005b00000b947 */
/* 0x000fea0003800000 */
/*02c0*/ PLOP3.LUT P0, PT, PT, PT, PT, 0x8, 0x0 ; /* 0x000000000000781c */
/* 0x000fe40003f0e170 */
/*02d0*/ IADD3 R4, P3, R14, UR8, RZ ; /* 0x000000080e047c10 */
/* 0x000fe2000ff7e0ff */
/*02e0*/ LDG.E.U8 R18, [R2.64] ; /* 0x0000000602127981 */
/* 0x000ea6000c1e1100 */
/*02f0*/ IADD3.X R5, R21, UR9, RZ, P3, !PT ; /* 0x0000000915057c10 */
/* 0x000fe20009ffe4ff */
/*0300*/ LDG.E.U8 R22, [R2.64+0x1] ; /* 0x0000010602167981 */
/* 0x000ee8000c1e1100 */
/*0310*/ LDG.E.U8 R17, [R4.64] ; /* 0x0000000604117981 */
/* 0x000ea8000c1e1100 */
/*0320*/ LDG.E.U8 R19, [R4.64+0x1] ; /* 0x0000010604137981 */
/* 0x000ee8000c1e1100 */
/*0330*/ LDG.E.U8 R25, [R2.64+0x2] ; /* 0x0000020602197981 */
/* 0x000f28000c1e1100 */
/*0340*/ LDG.E.U8 R24, [R4.64+0x2] ; /* 0x0000020604187981 */
/* 0x000f28000c1e1100 */
/*0350*/ LDG.E.U8 R23, [R4.64+0x4] ; /* 0x0000040604177981 */
/* 0x000f68000c1e1100 */
/*0360*/ LDG.E.U8 R28, [R4.64+0xf] ; /* 0x00000f06041c7981 */
/* 0x000162000c1e1100 */
/*0370*/ ISETP.NE.AND P3, PT, R18, R17, PT ; /* 0x000000111200720c */
/* 0x004fc60003f65270 */
/*0380*/ LDG.E.U8 R18, [R2.64+0x3] ; /* 0x0000030602127981 */
/* 0x000ea8000c1e1100 */
/*0390*/ LDG.E.U8 R17, [R4.64+0x3] ; /* 0x0000030604117981 */
/* 0x000ea2000c1e1100 */
/*03a0*/ ISETP.NE.AND P4, PT, R22, R19, PT ; /* 0x000000131600720c */
/* 0x008fc60003f85270 */
/*03b0*/ LDG.E.U8 R22, [R2.64+0x4] ; /* 0x0000040602167981 */
/* 0x000f62000c1e1100 */
/*03c0*/ IADD3 R19, R16, 0x1, RZ ; /* 0x0000000110137810 */
/* 0x000fe20007ffe0ff */
/*03d0*/ @P3 IMAD.MOV R19, RZ, RZ, R16 ; /* 0x000000ffff133224 */
/* 0x000fe200078e0210 */
/*03e0*/ ISETP.NE.AND P3, PT, R25, R24, PT ; /* 0x000000181900720c */
/* 0x010fe20003f65270 */
/*03f0*/ LDG.E.U8 R16, [R2.64+0x6] ; /* 0x0000060602107981 */
/* 0x000ee6000c1e1100 */
/*0400*/ IADD3 R26, R19, 0x1, RZ ; /* 0x00000001131a7810 */
/* 0x000fe20007ffe0ff */
/*0410*/ LDG.E.U8 R25, [R2.64+0x5] ; /* 0x0000050602197981 */
/* 0x000f24000c1e1100 */
/*0420*/ @P4 IMAD.MOV R26, RZ, RZ, R19 ; /* 0x000000ffff1a4224 */
/* 0x000fc400078e0213 */
/*0430*/ LDG.E.U8 R24, [R4.64+0x5] ; /* 0x0000050604187981 */
/* 0x000f28000c1e1100 */
/*0440*/ LDG.E.U8 R19, [R4.64+0x6] ; /* 0x0000060604137981 */
/* 0x000ee2000c1e1100 */
/*0450*/ IADD3 R27, R26, 0x1, RZ ; /* 0x000000011a1b7810 */
/* 0x000fe20007ffe0ff */
/*0460*/ @P3 IMAD.MOV R27, RZ, RZ, R26 ; /* 0x000000ffff1b3224 */
/* 0x000fca00078e021a */
/*0470*/ IADD3 R26, R27, 0x1, RZ ; /* 0x000000011b1a7810 */
/* 0x000fe40007ffe0ff */
/*0480*/ ISETP.NE.AND P4, PT, R18, R17, PT ; /* 0x000000111200720c */
/* 0x004fe40003f85270 */
/*0490*/ LDG.E.U8 R17, [R2.64+0x7] ; /* 0x0000070602117981 */
/* 0x000ea2000c1e1100 */
/*04a0*/ ISETP.NE.AND P3, PT, R22, R23, PT ; /* 0x000000171600720c */
/* 0x020fc60003f65270 */
/*04b0*/ LDG.E.U8 R18, [R4.64+0x7] ; /* 0x0000070604127981 */
/* 0x000ea8000c1e1100 */
/*04c0*/ LDG.E.U8 R22, [R2.64+0x8] ; /* 0x0000080602167981 */
/* 0x000f66000c1e1100 */
/*04d0*/ @P4 IMAD.MOV R26, RZ, RZ, R27 ; /* 0x000000ffff1a4224 */
/* 0x000fe200078e021b */
/*04e0*/ LDG.E.U8 R23, [R4.64+0x8] ; /* 0x0000080604177981 */
/* 0x000f62000c1e1100 */
/*04f0*/ ISETP.NE.AND P4, PT, R25, R24, PT ; /* 0x000000181900720c */
/* 0x010fc60003f85270 */
/*0500*/ LDG.E.U8 R27, [R2.64+0xf] ; /* 0x00000f06021b7981 */
/* 0x000f22000c1e1100 */
/*0510*/ IADD3 R24, R26, 0x1, RZ ; /* 0x000000011a187810 */
/* 0x000fe20007ffe0ff */
/*0520*/ @P3 IMAD.MOV R24, RZ, RZ, R26 ; /* 0x000000ffff183224 */
/* 0x000fe200078e021a */
/*0530*/ ISETP.NE.AND P3, PT, R16, R19, PT ; /* 0x000000131000720c */
/* 0x008fe20003f65270 */
/*0540*/ LDG.E.U8 R26, [R2.64+0x9] ; /* 0x00000906021a7981 */
/* 0x000ee8000c1e1100 */
/*0550*/ LDG.E.U8 R19, [R4.64+0x9] ; /* 0x0000090604137981 */
/* 0x000ee2000c1e1100 */
/*0560*/ IADD3 R16, R24, 0x1, RZ ; /* 0x0000000118107810 */
/* 0x000fe20007ffe0ff */
/*0570*/ @P4 IMAD.MOV R16, RZ, RZ, R24 ; /* 0x000000ffff104224 */
/* 0x000fc400078e0218 */
/*0580*/ LDG.E.U8 R25, [R4.64+0xa] ; /* 0x00000a0604197981 */
/* 0x000f28000c1e1100 */
/*0590*/ LDG.E.U8 R24, [R2.64+0xa] ; /* 0x00000a0602187981 */
/* 0x000f22000c1e1100 */
/*05a0*/ ISETP.NE.AND P4, PT, R17, R18, PT ; /* 0x000000121100720c */
/* 0x004fe40003f85270 */
/*05b0*/ IADD3 R18, R16, 0x1, RZ ; /* 0x0000000110127810 */
/* 0x000fe20007ffe0ff */
/*05c0*/ @P3 IMAD.MOV R18, RZ, RZ, R16 ; /* 0x000000ffff123224 */
/* 0x000fe200078e0210 */
/*05d0*/ LDG.E.U8 R17, [R2.64+0xb] ; /* 0x00000b0602117981 */
/* 0x000ea2000c1e1100 */
/*05e0*/ ISETP.NE.AND P3, PT, R22, R23, PT ; /* 0x000000171600720c */
/* 0x020fc60003f65270 */
/*05f0*/ LDG.E.U8 R16, [R4.64+0xb] ; /* 0x00000b0604107981 */
/* 0x000ea2000c1e1100 */
/*0600*/ IADD3 R22, R18, 0x1, RZ ; /* 0x0000000112167810 */
/* 0x000fc80007ffe0ff */
/*0610*/ @P4 IMAD.MOV R22, RZ, RZ, R18 ; /* 0x000000ffff164224 */
/* 0x000fe200078e0212 */
/*0620*/ LDG.E.U8 R23, [R4.64+0xd] ; /* 0x00000d0604177981 */
/* 0x000f68000c1e1100 */
/*0630*/ LDG.E.U8 R18, [R2.64+0xc] ; /* 0x00000c0602127981 */
/* 0x000f62000c1e1100 */
/*0640*/ ISETP.NE.AND P4, PT, R26, R19, PT ; /* 0x000000131a00720c */
/* 0x008fc60003f85270 */
/*0650*/ LDG.E.U8 R19, [R4.64+0xc] ; /* 0x00000c0604137981 */
/* 0x000f62000c1e1100 */
/*0660*/ IADD3 R26, R22, 0x1, RZ ; /* 0x00000001161a7810 */
/* 0x000fe20007ffe0ff */
/*0670*/ @P3 IMAD.MOV R26, RZ, RZ, R22 ; /* 0x000000ffff1a3224 */
/* 0x000fe400078e0216 */
/*0680*/ LDG.E.U8 R22, [R2.64+0xd] ; /* 0x00000d0602167981 */
/* 0x000ee2000c1e1100 */
/*0690*/ ISETP.NE.AND P3, PT, R24, R25, PT ; /* 0x000000191800720c */
/* 0x010fe40003f65270 */
/*06a0*/ IADD3 R24, R26, 0x1, RZ ; /* 0x000000011a187810 */
/* 0x000fe20007ffe0ff */
/*06b0*/ LDG.E.U8 R25, [R2.64+0xe] ; /* 0x00000e0602197981 */
/* 0x000f24000c1e1100 */
/*06c0*/ @P4 IMAD.MOV R24, RZ, RZ, R26 ; /* 0x000000ffff184224 */
/* 0x000fc400078e021a */
/*06d0*/ LDG.E.U8 R26, [R4.64+0xe] ; /* 0x00000e06041a7981 */
/* 0x000f22000c1e1100 */
/*06e0*/ IADD3 R15, R15, -0x10, RZ ; /* 0xfffffff00f0f7810 */
/* 0x000fe20007ffe0ff */
/*06f0*/ UIADD3 UR8, UP0, UR8, 0x10, URZ ; /* 0x0000001008087890 */
/* 0x000fe4000ff1e03f */
/*0700*/ UIADD3 UR4, UR4, 0x10, URZ ; /* 0x0000001004047890 */
/* 0x000fe4000fffe03f */
/*0710*/ UIADD3.X UR9, URZ, UR9, URZ, UP0, !UPT ; /* 0x000000093f097290 */
/* 0x000fe200087fe43f */
/*0720*/ ISETP.NE.AND P4, PT, R17, R16, PT ; /* 0x000000101100720c */
/* 0x004fe40003f85270 */
/*0730*/ IADD3 R16, R24, 0x1, RZ ; /* 0x0000000118107810 */
/* 0x000fe20007ffe0ff */
/*0740*/ @P3 IMAD.MOV R16, RZ, RZ, R24 ; /* 0x000000ffff103224 */
/* 0x000fca00078e0218 */
/*0750*/ IADD3 R17, R16, 0x1, RZ ; /* 0x0000000110117810 */
/* 0x000fe40007ffe0ff */
/*0760*/ ISETP.NE.AND P3, PT, R18, R19, PT ; /* 0x000000131200720c */
/* 0x020fc60003f65270 */
/*0770*/ @P4 IMAD.MOV R17, RZ, RZ, R16 ; /* 0x000000ffff114224 */
/* 0x000fe200078e0210 */
/*0780*/ ISETP.NE.AND P4, PT, R22, R23, PT ; /* 0x000000171600720c */
/* 0x008fc80003f85270 */
/*0790*/ IADD3 R16, R17, 0x1, RZ ; /* 0x0000000111107810 */
/* 0x000fca0007ffe0ff */
/*07a0*/ @P3 IMAD.MOV R16, RZ, RZ, R17 ; /* 0x000000ffff103224 */
/* 0x000fe200078e0211 */
/*07b0*/ ISETP.NE.AND P5, PT, R25, R26, PT ; /* 0x0000001a1900720c */
/* 0x010fc80003fa5270 */
/*07c0*/ IADD3 R4, R16, 0x1, RZ ; /* 0x0000000110047810 */
/* 0x001fe20007ffe0ff */
/*07d0*/ @P4 IMAD.MOV R4, RZ, RZ, R16 ; /* 0x000000ffff044224 */
/* 0x000fe200078e0210 */
/*07e0*/ ISETP.GT.AND P4, PT, R15, 0xc, PT ; /* 0x0000000c0f00780c */
/* 0x000fe40003f84270 */
/*07f0*/ ISETP.NE.AND P3, PT, R27, R28, PT ; /* 0x0000001c1b00720c */
/* 0x000fe40003f65270 */
/*0800*/ IADD3 R5, R4, 0x1, RZ ; /* 0x0000000104057810 */
/* 0x000fc60007ffe0ff */
/*0810*/ @P5 IMAD.MOV R5, RZ, RZ, R4 ; /* 0x000000ffff055224 */
/* 0x000fe200078e0204 */
/*0820*/ IADD3 R2, P5, R2, 0x10, RZ ; /* 0x0000001002027810 */
/* 0x000fc80007fbe0ff */
/*0830*/ IADD3 R16, R5, 0x1, RZ ; /* 0x0000000105107810 */
/* 0x000fe20007ffe0ff */
/*0840*/ IMAD.X R3, RZ, RZ, R3, P5 ; /* 0x000000ffff037224 */
/* 0x000fe400028e0603 */
/*0850*/ @P3 IMAD.MOV R16, RZ, RZ, R5 ; /* 0x000000ffff103224 */
/* 0x000fe200078e0205 */
/*0860*/ @P4 BRA 0x2d0 ; /* 0xfffffa6000004947 */
/* 0x000fea000383ffff */
/*0870*/ ISETP.GT.AND P3, PT, R15, 0x4, PT ; /* 0x000000040f00780c */
/* 0x000fda0003f64270 */
/*0880*/ @!P3 BRA 0xba0 ; /* 0x000003100000b947 */
/* 0x000fea0003800000 */
/*0890*/ IADD3 R4, P0, R14, UR8, RZ ; /* 0x000000080e047c10 */
/* 0x000fe2000ff1e0ff */
/*08a0*/ LDG.E.U8 R22, [R2.64] ; /* 0x0000000602167981 */
/* 0x000ea6000c1e1100 */
/*08b0*/ IADD3.X R5, R21, UR9, RZ, P0, !PT ; /* 0x0000000915057c10 */
/* 0x000fe200087fe4ff */
/*08c0*/ LDG.E.U8 R24, [R2.64+0x1] ; /* 0x0000010602187981 */
/* 0x000ee8000c1e1100 */
/*08d0*/ LDG.E.U8 R19, [R4.64] ; /* 0x0000000604137981 */
/* 0x000ea8000c1e1100 */
/*08e0*/ LDG.E.U8 R23, [R4.64+0x1] ; /* 0x0000010604177981 */
/* 0x000ee8000c1e1100 */
/*08f0*/ LDG.E.U8 R26, [R2.64+0x2] ; /* 0x00000206021a7981 */
/* 0x000f28000c1e1100 */
/*0900*/ LDG.E.U8 R25, [R4.64+0x2] ; /* 0x0000020604197981 */
/* 0x000f28000c1e1100 */
/*0910*/ LDG.E.U8 R17, [R2.64+0x3] ; /* 0x0000030602117981 */
/* 0x000f68000c1e1100 */
/*0920*/ LDG.E.U8 R18, [R4.64+0x3] ; /* 0x0000030604127981 */
/* 0x000f62000c1e1100 */
/*0930*/ IADD3 R27, R16, 0x1, RZ ; /* 0x00000001101b7810 */
/* 0x000fc40007ffe0ff */
/*0940*/ ISETP.NE.AND P0, PT, R22, R19, PT ; /* 0x000000131600720c */
/* 0x004fe40003f05270 */
/*0950*/ LDG.E.U8 R19, [R2.64+0x4] ; /* 0x0000040602137981 */
/* 0x000ea8000c1e1100 */
/*0960*/ LDG.E.U8 R22, [R4.64+0x4] ; /* 0x0000040604167981 */
/* 0x0000a2000c1e1100 */
/*0970*/ ISETP.NE.AND P3, PT, R24, R23, PT ; /* 0x000000171800720c */
/* 0x008fc60003f65270 */
/*0980*/ LDG.E.U8 R24, [R2.64+0x5] ; /* 0x0000050602187981 */
/* 0x000ee2000c1e1100 */
/*0990*/ ISETP.NE.AND P4, PT, R26, R25, PT ; /* 0x000000191a00720c */
/* 0x010fc60003f85270 */
/*09a0*/ LDG.E.U8 R25, [R4.64+0x5] ; /* 0x0000050604197981 */
/* 0x0000e2000c1e1100 */
/*09b0*/ @P0 IMAD.MOV R27, RZ, RZ, R16 ; /* 0x000000ffff1b0224 */
/* 0x000fc600078e0210 */
/*09c0*/ LDG.E.U8 R23, [R4.64+0x6] ; /* 0x0000060604177981 */
/* 0x000128000c1e1100 */
/*09d0*/ LDG.E.U8 R16, [R2.64+0x6] ; /* 0x0000060602107981 */
/* 0x000f22000c1e1100 */
/*09e0*/ IADD3 R28, R27, 0x1, RZ ; /* 0x000000011b1c7810 */
/* 0x000fe20007ffe0ff */
/*09f0*/ @P3 IMAD.MOV R28, RZ, RZ, R27 ; /* 0x000000ffff1c3224 */
/* 0x000fe400078e021b */
/*0a00*/ LDG.E.U8 R26, [R4.64+0x7] ; /* 0x00000706041a7981 */
/* 0x000128000c1e1100 */
/*0a10*/ LDG.E.U8 R27, [R2.64+0x7] ; /* 0x00000706021b7981 */
/* 0x000f22000c1e1100 */
/*0a20*/ ISETP.NE.AND P0, PT, R17, R18, PT ; /* 0x000000121100720c */
/* 0x020fc40003f05270 */
/*0a30*/ IADD3 R17, R28, 0x1, RZ ; /* 0x000000011c117810 */
/* 0x000fe20007ffe0ff */
/*0a40*/ @P4 IMAD.MOV R17, RZ, RZ, R28 ; /* 0x000000ffff114224 */
/* 0x000fca00078e021c */
/*0a50*/ IADD3 R4, R17, 0x1, RZ ; /* 0x0000000111047810 */
/* 0x001fca0007ffe0ff */
/*0a60*/ @P0 IMAD.MOV R4, RZ, RZ, R17 ; /* 0x000000ffff040224 */
/* 0x000fca00078e0211 */
/*0a70*/ IADD3 R5, R4, 0x1, RZ ; /* 0x0000000104057810 */
/* 0x000fe20007ffe0ff */
/*0a80*/ UIADD3 UR8, UP0, UR8, 0x8, URZ ; /* 0x0000000808087890 */
/* 0x000fe2000ff1e03f */
/*0a90*/ IADD3 R15, R15, -0x8, RZ ; /* 0xfffffff80f0f7810 */
/* 0x000fe20007ffe0ff */
/*0aa0*/ UIADD3 UR4, UR4, 0x8, URZ ; /* 0x0000000804047890 */
/* 0x000fe4000fffe03f */
/*0ab0*/ UIADD3.X UR9, URZ, UR9, URZ, UP0, !UPT ; /* 0x000000093f097290 */
/* 0x000fe200087fe43f */
/*0ac0*/ ISETP.NE.AND P3, PT, R19, R22, PT ; /* 0x000000161300720c */
/* 0x004fe40003f65270 */
/*0ad0*/ ISETP.NE.AND P0, PT, R24, R25, PT ; /* 0x000000191800720c */
/* 0x008fd60003f05270 */
/*0ae0*/ @P3 IMAD.MOV R5, RZ, RZ, R4 ; /* 0x000000ffff053224 */
/* 0x000fe200078e0204 */
/*0af0*/ ISETP.NE.AND P3, PT, R16, R23, PT ; /* 0x000000171000720c */
/* 0x010fc80003f65270 */
/*0b00*/ IADD3 R4, R5, 0x1, RZ ; /* 0x0000000105047810 */
/* 0x000fe20007ffe0ff */
/*0b10*/ @P0 IMAD.MOV R4, RZ, RZ, R5 ; /* 0x000000ffff040224 */
/* 0x000fe200078e0205 */
/*0b20*/ ISETP.NE.AND P4, PT, R27, R26, PT ; /* 0x0000001a1b00720c */
/* 0x000fc80003f85270 */
/*0b30*/ IADD3 R5, R4, 0x1, RZ ; /* 0x0000000104057810 */
/* 0x000fc60007ffe0ff */
/*0b40*/ @P3 IMAD.MOV R5, RZ, RZ, R4 ; /* 0x000000ffff053224 */
/* 0x000fe200078e0204 */
/*0b50*/ IADD3 R2, P3, R2, 0x8, RZ ; /* 0x0000000802027810 */
/* 0x000fe40007f7e0ff */
/*0b60*/ PLOP3.LUT P0, PT, PT, PT, PT, 0x8, 0x0 ; /* 0x000000000000781c */
/* 0x000fe40003f0e170 */
/*0b70*/ IADD3 R16, R5, 0x1, RZ ; /* 0x0000000105107810 */
/* 0x000fe20007ffe0ff */
/*0b80*/ IMAD.X R3, RZ, RZ, R3, P3 ; /* 0x000000ffff037224 */
/* 0x000fe400018e0603 */
/*0b90*/ @P4 IMAD.MOV R16, RZ, RZ, R5 ; /* 0x000000ffff104224 */
/* 0x000fe400078e0205 */
/*0ba0*/ ISETP.NE.OR P0, PT, R15, RZ, P0 ; /* 0x000000ff0f00720c */
/* 0x000fda0000705670 */
/*0bb0*/ @!P0 BRA 0xda0 ; /* 0x000001e000008947 */
/* 0x000fea0003800000 */
/*0bc0*/ IADD3 R4, P0, R14, UR8, RZ ; /* 0x000000080e047c10 */
/* 0x000fe2000ff1e0ff */
/*0bd0*/ LDG.E.U8 R18, [R2.64] ; /* 0x0000000602127981 */
/* 0x0000a6000c1e1100 */
/*0be0*/ IADD3.X R5, R21, UR9, RZ, P0, !PT ; /* 0x0000000915057c10 */
/* 0x000fe200087fe4ff */
/*0bf0*/ LDG.E.U8 R22, [R2.64+0x1] ; /* 0x0000010602167981 */
/* 0x0000e8000c1e1100 */
/*0c00*/ LDG.E.U8 R17, [R4.64] ; /* 0x0000000604117981 */
/* 0x000ea8000c1e1100 */
/*0c10*/ LDG.E.U8 R19, [R4.64+0x1] ; /* 0x0000010604137981 */
/* 0x000ee8000c1e1100 */
/*0c20*/ LDG.E.U8 R24, [R2.64+0x2] ; /* 0x0000020602187981 */
/* 0x000128000c1e1100 */
/*0c30*/ LDG.E.U8 R23, [R4.64+0x2] ; /* 0x0000020604177981 */
/* 0x000f28000c1e1100 */
/*0c40*/ LDG.E.U8 R25, [R4.64+0x3] ; /* 0x0000030604197981 */
/* 0x000f68000c1e1100 */
/*0c50*/ LDG.E.U8 R26, [R2.64+0x3] ; /* 0x00000306021a7981 */
/* 0x000162000c1e1100 */
/*0c60*/ IADD3 R15, R15, -0x4, RZ ; /* 0xfffffffc0f0f7810 */
/* 0x000fe20007ffe0ff */
/*0c70*/ UIADD3 UR8, UP0, UR8, 0x4, URZ ; /* 0x0000000408087890 */
/* 0x000fc4000ff1e03f */
/*0c80*/ UIADD3 UR4, UR4, 0x4, URZ ; /* 0x0000000404047890 */
/* 0x000fe4000fffe03f */
/*0c90*/ UIADD3.X UR9, URZ, UR9, URZ, UP0, !UPT ; /* 0x000000093f097290 */
/* 0x000fe200087fe43f */
/*0ca0*/ IADD3 R2, P4, R2, 0x4, RZ ; /* 0x0000000402027810 */
/* 0x001fca0007f9e0ff */
/*0cb0*/ IMAD.X R3, RZ, RZ, R3, P4 ; /* 0x000000ffff037224 */
/* 0x000fe200020e0603 */
/*0cc0*/ ISETP.NE.AND P0, PT, R18, R17, PT ; /* 0x000000111200720c */
/* 0x004fe40003f05270 */
/*0cd0*/ ISETP.NE.AND P3, PT, R22, R19, PT ; /* 0x000000131600720c */
/* 0x008fe40003f65270 */
/*0ce0*/ IADD3 R17, R16, 0x1, RZ ; /* 0x0000000110117810 */
/* 0x000fd20007ffe0ff */
/*0cf0*/ @P0 IMAD.MOV R17, RZ, RZ, R16 ; /* 0x000000ffff110224 */
/* 0x000fe200078e0210 */
/*0d00*/ ISETP.NE.AND P0, PT, R24, R23, PT ; /* 0x000000171800720c */
/* 0x010fc80003f05270 */
/*0d10*/ IADD3 R16, R17, 0x1, RZ ; /* 0x0000000111107810 */
/* 0x000fe20007ffe0ff */
/*0d20*/ @P3 IMAD.MOV R16, RZ, RZ, R17 ; /* 0x000000ffff103224 */
/* 0x000fe200078e0211 */
/*0d30*/ ISETP.NE.AND P3, PT, R26, R25, PT ; /* 0x000000191a00720c */
/* 0x020fc80003f65270 */
/*0d40*/ IADD3 R17, R16, 0x1, RZ ; /* 0x0000000110117810 */
/* 0x000fc60007ffe0ff */
/*0d50*/ @P0 IMAD.MOV R17, RZ, RZ, R16 ; /* 0x000000ffff110224 */
/* 0x000fe200078e0210 */
/*0d60*/ ISETP.NE.AND P0, PT, R15, RZ, PT ; /* 0x000000ff0f00720c */
/* 0x000fc80003f05270 */
/*0d70*/ IADD3 R16, R17, 0x1, RZ ; /* 0x0000000111107810 */
/* 0x000fe20007ffe0ff */
/*0d80*/ @P3 IMAD.MOV R16, RZ, RZ, R17 ; /* 0x000000ffff103224 */
/* 0x000fd000078e0211 */
/*0d90*/ @P0 BRA 0xbc0 ; /* 0xfffffe2000000947 */
/* 0x000fea000383ffff */
/*0da0*/ ISETP.NE.AND P0, PT, R9, RZ, PT ; /* 0x000000ff0900720c */
/* 0x000fda0003f05270 */
/*0db0*/ @!P0 BRA 0xf80 ; /* 0x000001c000008947 */
/* 0x000fea0003800000 */
/*0dc0*/ IADD3 R5, R13, UR4, RZ ; /* 0x000000040d057c10 */
/* 0x000fe4000fffe0ff */
/*0dd0*/ IADD3 R14, R14, UR4, RZ ; /* 0x000000040e0e7c10 */
/* 0x000fe4000fffe0ff */
/*0de0*/ SHF.R.S32.HI R3, RZ, 0x1f, R5 ; /* 0x0000001fff037819 */
/* 0x000fe40000011405 */
/*0df0*/ IADD3 R4, P0, P3, R5, c[0x0][0x160], R6 ; /* 0x0000580005047a10 */
/* 0x000fe40007b1e006 */
/*0e00*/ IADD3 R2, P4, R14, c[0x0][0x168], RZ ; /* 0x00005a000e027a10 */
/* 0x000fe40007f9e0ff */
/*0e10*/ IADD3.X R5, R3, c[0x0][0x164], R10, P0, P3 ; /* 0x0000590003057a10 */
/* 0x000fc400007e640a */
/*0e20*/ LEA.HI.X.SX32 R3, R14, c[0x0][0x16c], 0x1, P4 ; /* 0x00005b000e037a11 */
/* 0x000fc600020f0eff */
/*0e30*/ LDG.E.U8 R14, [R4.64] ; /* 0x00000006040e7981 */
/* 0x000ea8000c1e1100 */
/*0e40*/ LDG.E.U8 R13, [R2.64] ; /* 0x00000006020d7981 */
/* 0x000ea2000c1e1100 */
/*0e50*/ ISETP.NE.AND P3, PT, R9, 0x1, PT ; /* 0x000000010900780c */
/* 0x000fe40003f65270 */
/*0e60*/ ISETP.NE.AND P0, PT, R14, R13, PT ; /* 0x0000000d0e00720c */
/* 0x004fe40003f05270 */
/*0e70*/ IADD3 R13, R16, 0x1, RZ ; /* 0x00000001100d7810 */
/* 0x000fd60007ffe0ff */
/*0e80*/ @P0 IMAD.MOV R13, RZ, RZ, R16 ; /* 0x000000ffff0d0224 */
/* 0x000fc800078e0210 */
/*0e90*/ IMAD.MOV.U32 R16, RZ, RZ, R13 ; /* 0x000000ffff107224 */
/* 0x000fe200078e000d */
/*0ea0*/ @!P3 BRA 0xf80 ; /* 0x000000d00000b947 */
/* 0x000fea0003800000 */
/*0eb0*/ ISETP.NE.AND P3, PT, R9, 0x2, PT ; /* 0x000000020900780c */
/* 0x000fe20003f65270 */
/*0ec0*/ LDG.E.U8 R13, [R2.64+0x1] ; /* 0x00000106020d7981 */
/* 0x000ea8000c1e1100 */
/*0ed0*/ LDG.E.U8 R14, [R4.64+0x1] ; /* 0x00000106040e7981 */
/* 0x000eb0000c1e1100 */
/*0ee0*/ @P3 LDG.E.U8 R15, [R2.64+0x2] ; /* 0x00000206020f3981 */
/* 0x000ee8000c1e1100 */
/*0ef0*/ @P3 LDG.E.U8 R18, [R4.64+0x2] ; /* 0x0000020604123981 */
/* 0x000ee2000c1e1100 */
/*0f00*/ ISETP.NE.AND P0, PT, R14, R13, PT ; /* 0x0000000d0e00720c */
/* 0x004fc40003f05270 */
/*0f10*/ IADD3 R13, R16, 0x1, RZ ; /* 0x00000001100d7810 */
/* 0x000fe40007ffe0ff */
/*0f20*/ ISETP.NE.AND P4, PT, R18, R15, P3 ; /* 0x0000000f1200720c */
/* 0x008fd20001f85270 */
/*0f30*/ @P0 IMAD.MOV R13, RZ, RZ, R16 ; /* 0x000000ffff0d0224 */
/* 0x000fc800078e0210 */
/*0f40*/ IMAD.MOV.U32 R16, RZ, RZ, R13 ; /* 0x000000ffff107224 */
/* 0x000fca00078e000d */
/*0f50*/ @P3 IADD3 R13, R16, 0x1, RZ ; /* 0x00000001100d3810 */
/* 0x000fe20007ffe0ff */
/*0f60*/ @P4 IMAD.MOV R13, RZ, RZ, R16 ; /* 0x000000ffff0d4224 */
/* 0x000fc800078e0210 */
/*0f70*/ @P3 IMAD.MOV.U32 R16, RZ, RZ, R13 ; /* 0x000000ffff103224 */
/* 0x000fe400078e000d */
/*0f80*/ @!P2 BRA 0x1b0 ; /* 0xfffff2200000a947 */
/* 0x000fea000383ffff */
/*0f90*/ IMAD.MOV.U32 R3, RZ, RZ, 0x4 ; /* 0x00000004ff037424 */
/* 0x000fe400078e00ff */
/*0fa0*/ IMAD R2, R7, UR5, R0 ; /* 0x0000000507027c24 */
/* 0x000fc8000f8e0200 */
/*0fb0*/ IMAD.WIDE R2, R2, R3, c[0x0][0x170] ; /* 0x00005c0002027625 */
/* 0x000fca00078e0203 */
/*0fc0*/ STG.E [R2.64], R16 ; /* 0x0000001002007986 */
/* 0x000fe2000c101906 */
/*0fd0*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*0fe0*/ BRA 0xfe0; /* 0xfffffff000007947 */
/* 0x000fc0000383ffff */
/*0ff0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*1000*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*1010*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*1020*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*1030*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*1040*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*1050*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*1060*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*1070*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
.......... | .text
.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
.protected _Z4maskPcS_Piii
.globl _Z4maskPcS_Piii
.p2align 8
.type _Z4maskPcS_Piii,@function
_Z4maskPcS_Piii:
s_clause 0x1
s_load_b32 s4, s[0:1], 0x2c
s_load_b64 s[2:3], s[0:1], 0x18
v_and_b32_e32 v2, 0x3ff, v0
v_bfe_u32 v3, v0, 10, 10
s_waitcnt lgkmcnt(0)
s_and_b32 s5, s4, 0xffff
s_lshr_b32 s4, s4, 16
s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
v_mad_u64_u32 v[0:1], null, s14, s5, v[2:3]
v_mad_u64_u32 v[1:2], null, s15, s4, v[3:4]
s_sub_i32 s8, s2, s3
s_mov_b32 s4, exec_lo
v_max_i32_e32 v2, v0, v1
s_delay_alu instid0(VALU_DEP_1)
v_cmpx_gt_i32_e64 s8, v2
s_cbranch_execz .LBB0_8
s_cmp_lt_i32 s3, 1
s_cbranch_scc1 .LBB0_6
s_load_b128 s[4:7], s[0:1], 0x0
v_mad_u64_u32 v[3:4], null, v0, s2, v[1:2]
v_dual_mov_b32 v2, 0 :: v_dual_mov_b32 v5, 0
s_mov_b32 s9, 0
s_mov_b32 s10, s3
s_ashr_i32 s11, s2, 31
s_mov_b32 s12, 0
s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_2)
v_ashrrev_i32_e32 v4, 31, v3
s_waitcnt lgkmcnt(0)
v_add_co_u32 v3, vcc_lo, s4, v3
v_add_co_ci_u32_e32 v4, vcc_lo, s5, v4, vcc_lo
.p2align 6
.LBB0_3:
s_add_u32 s13, s6, s9
s_addc_u32 s14, s7, 0
s_mov_b64 s[4:5], 0
.LBB0_4:
s_delay_alu instid0(SALU_CYCLE_1)
v_add_co_u32 v6, vcc_lo, v3, s4
v_add_co_ci_u32_e32 v7, vcc_lo, s5, v4, vcc_lo
s_add_u32 s16, s13, s4
s_addc_u32 s17, s14, s5
global_load_u8 v8, v5, s[16:17]
global_load_u8 v6, v[6:7], off
s_add_u32 s4, s4, 1
s_addc_u32 s5, s5, 0
s_cmp_lg_u32 s10, s4
s_waitcnt vmcnt(0)
v_cmp_eq_u16_e32 vcc_lo, v6, v8
v_add_co_ci_u32_e32 v2, vcc_lo, 0, v2, vcc_lo
s_cbranch_scc1 .LBB0_4
v_add_co_u32 v3, vcc_lo, v3, s2
v_add_co_ci_u32_e32 v4, vcc_lo, s11, v4, vcc_lo
s_add_i32 s12, s12, 1
s_add_i32 s9, s9, s3
s_cmp_lg_u32 s12, s3
s_cbranch_scc1 .LBB0_3
s_branch .LBB0_7
.LBB0_6:
v_mov_b32_e32 v2, 0
.LBB0_7:
s_load_b64 s[0:1], s[0:1], 0x10
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_mad_u64_u32 v[3:4], null, v0, s8, v[1:2]
v_ashrrev_i32_e32 v4, 31, v3
s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
v_lshlrev_b64 v[0:1], 2, v[3:4]
s_waitcnt lgkmcnt(0)
v_add_co_u32 v0, vcc_lo, s0, v0
s_delay_alu instid0(VALU_DEP_2)
v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
global_store_b32 v[0:1], v2, off
.LBB0_8:
s_nop 0
s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
s_endpgm
.section .rodata,"a",@progbits
.p2align 6, 0x0
.amdhsa_kernel _Z4maskPcS_Piii
.amdhsa_group_segment_fixed_size 0
.amdhsa_private_segment_fixed_size 0
.amdhsa_kernarg_size 288
.amdhsa_user_sgpr_count 14
.amdhsa_user_sgpr_dispatch_ptr 0
.amdhsa_user_sgpr_queue_ptr 0
.amdhsa_user_sgpr_kernarg_segment_ptr 1
.amdhsa_user_sgpr_dispatch_id 0
.amdhsa_user_sgpr_private_segment_size 0
.amdhsa_wavefront_size32 1
.amdhsa_uses_dynamic_stack 0
.amdhsa_enable_private_segment 0
.amdhsa_system_sgpr_workgroup_id_x 1
.amdhsa_system_sgpr_workgroup_id_y 1
.amdhsa_system_sgpr_workgroup_id_z 0
.amdhsa_system_sgpr_workgroup_info 0
.amdhsa_system_vgpr_workitem_id 1
.amdhsa_next_free_vgpr 9
.amdhsa_next_free_sgpr 18
.amdhsa_float_round_mode_32 0
.amdhsa_float_round_mode_16_64 0
.amdhsa_float_denorm_mode_32 3
.amdhsa_float_denorm_mode_16_64 3
.amdhsa_dx10_clamp 1
.amdhsa_ieee_mode 1
.amdhsa_fp16_overflow 0
.amdhsa_workgroup_processor_mode 1
.amdhsa_memory_ordered 1
.amdhsa_forward_progress 0
.amdhsa_shared_vgpr_count 0
.amdhsa_exception_fp_ieee_invalid_op 0
.amdhsa_exception_fp_denorm_src 0
.amdhsa_exception_fp_ieee_div_zero 0
.amdhsa_exception_fp_ieee_overflow 0
.amdhsa_exception_fp_ieee_underflow 0
.amdhsa_exception_fp_ieee_inexact 0
.amdhsa_exception_int_div_zero 0
.end_amdhsa_kernel
.text
.Lfunc_end0:
.size _Z4maskPcS_Piii, .Lfunc_end0-_Z4maskPcS_Piii
.section .AMDGPU.csdata,"",@progbits
.text
.p2alignl 7, 3214868480
.fill 96, 4, 3214868480
.type __hip_cuid_,@object
.section .bss,"aw",@nobits
.globl __hip_cuid_
__hip_cuid_:
.byte 0
.size __hip_cuid_, 1
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym __hip_cuid_
.amdgpu_metadata
---
amdhsa.kernels:
- .args:
- .address_space: global
.offset: 0
.size: 8
.value_kind: global_buffer
- .address_space: global
.offset: 8
.size: 8
.value_kind: global_buffer
- .address_space: global
.offset: 16
.size: 8
.value_kind: global_buffer
- .offset: 24
.size: 4
.value_kind: by_value
- .offset: 28
.size: 4
.value_kind: by_value
- .offset: 32
.size: 4
.value_kind: hidden_block_count_x
- .offset: 36
.size: 4
.value_kind: hidden_block_count_y
- .offset: 40
.size: 4
.value_kind: hidden_block_count_z
- .offset: 44
.size: 2
.value_kind: hidden_group_size_x
- .offset: 46
.size: 2
.value_kind: hidden_group_size_y
- .offset: 48
.size: 2
.value_kind: hidden_group_size_z
- .offset: 50
.size: 2
.value_kind: hidden_remainder_x
- .offset: 52
.size: 2
.value_kind: hidden_remainder_y
- .offset: 54
.size: 2
.value_kind: hidden_remainder_z
- .offset: 72
.size: 8
.value_kind: hidden_global_offset_x
- .offset: 80
.size: 8
.value_kind: hidden_global_offset_y
- .offset: 88
.size: 8
.value_kind: hidden_global_offset_z
- .offset: 96
.size: 2
.value_kind: hidden_grid_dims
.group_segment_fixed_size: 0
.kernarg_segment_align: 8
.kernarg_segment_size: 288
.language: OpenCL C
.language_version:
- 2
- 0
.max_flat_workgroup_size: 1024
.name: _Z4maskPcS_Piii
.private_segment_fixed_size: 0
.sgpr_count: 20
.sgpr_spill_count: 0
.symbol: _Z4maskPcS_Piii.kd
.uniform_work_group_size: 1
.uses_dynamic_stack: false
.vgpr_count: 9
.vgpr_spill_count: 0
.wavefront_size: 32
.workgroup_processor_mode: 1
amdhsa.target: amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
- 1
- 2
...
.end_amdgpu_metadata |
You are a helpful coding assistant specialized in converting from CUDA host assembly to AMD host assembly. | .file "tmpxft_0017f5cf_00000000-6_2017Final-G-CUDA-FranciscoMunoz170920.cudafe1.cpp"
.text
#APP
#NO_APP
.type _ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2031:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaUnregisterFatBinary@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2031:
.size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
.globl _Z5countiiPcS_
.type _Z5countiiPcS_, @function
_Z5countiiPcS_:
.LFB2027:
.cfi_startproc
endbr64
pushq %rax
.cfi_def_cfa_offset 16
popq %rax
.cfi_def_cfa_offset 8
subq $24, %rsp
.cfi_def_cfa_offset 32
movl $1, 12(%rsp)
movl 12(%rsp), %edi
call exit@PLT
.cfi_endproc
.LFE2027:
.size _Z5countiiPcS_, .-_Z5countiiPcS_
.globl _Z29__device_stub__Z4maskPcS_PiiiPcS_Piii
.type _Z29__device_stub__Z4maskPcS_PiiiPcS_Piii, @function
_Z29__device_stub__Z4maskPcS_PiiiPcS_Piii:
.LFB2053:
.cfi_startproc
endbr64
subq $152, %rsp
.cfi_def_cfa_offset 160
movq %rdi, 24(%rsp)
movq %rsi, 16(%rsp)
movq %rdx, 8(%rsp)
movl %ecx, 4(%rsp)
movl %r8d, (%rsp)
movq %fs:40, %rax
movq %rax, 136(%rsp)
xorl %eax, %eax
leaq 24(%rsp), %rax
movq %rax, 96(%rsp)
leaq 16(%rsp), %rax
movq %rax, 104(%rsp)
leaq 8(%rsp), %rax
movq %rax, 112(%rsp)
leaq 4(%rsp), %rax
movq %rax, 120(%rsp)
movq %rsp, %rax
movq %rax, 128(%rsp)
movl $1, 48(%rsp)
movl $1, 52(%rsp)
movl $1, 56(%rsp)
movl $1, 60(%rsp)
movl $1, 64(%rsp)
movl $1, 68(%rsp)
leaq 40(%rsp), %rcx
leaq 32(%rsp), %rdx
leaq 60(%rsp), %rsi
leaq 48(%rsp), %rdi
call __cudaPopCallConfiguration@PLT
testl %eax, %eax
je .L9
.L5:
movq 136(%rsp), %rax
subq %fs:40, %rax
jne .L10
addq $152, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 8
ret
.L9:
.cfi_restore_state
pushq 40(%rsp)
.cfi_def_cfa_offset 168
pushq 40(%rsp)
.cfi_def_cfa_offset 176
leaq 112(%rsp), %r9
movq 76(%rsp), %rcx
movl 84(%rsp), %r8d
movq 64(%rsp), %rsi
movl 72(%rsp), %edx
leaq _Z4maskPcS_Piii(%rip), %rdi
call cudaLaunchKernel@PLT
addq $16, %rsp
.cfi_def_cfa_offset 160
jmp .L5
.L10:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE2053:
.size _Z29__device_stub__Z4maskPcS_PiiiPcS_Piii, .-_Z29__device_stub__Z4maskPcS_PiiiPcS_Piii
.globl _Z4maskPcS_Piii
.type _Z4maskPcS_Piii, @function
_Z4maskPcS_Piii:
.LFB2054:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
call _Z29__device_stub__Z4maskPcS_PiiiPcS_Piii
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2054:
.size _Z4maskPcS_Piii, .-_Z4maskPcS_Piii
.globl _Z3seciPciS_
.type _Z3seciPciS_, @function
_Z3seciPciS_:
.LFB2028:
.cfi_startproc
endbr64
pushq %r15
.cfi_def_cfa_offset 16
.cfi_offset 15, -16
pushq %r14
.cfi_def_cfa_offset 24
.cfi_offset 14, -24
pushq %r13
.cfi_def_cfa_offset 32
.cfi_offset 13, -32
pushq %r12
.cfi_def_cfa_offset 40
.cfi_offset 12, -40
pushq %rbp
.cfi_def_cfa_offset 48
.cfi_offset 6, -48
pushq %rbx
.cfi_def_cfa_offset 56
.cfi_offset 3, -56
subq $104, %rsp
.cfi_def_cfa_offset 160
movl %edi, %r12d
movq %rsi, 16(%rsp)
movl %edx, %r13d
movq %rcx, 24(%rsp)
movq %fs:40, %rax
movq %rax, 88(%rsp)
xorl %eax, %eax
movl %edi, %ebx
subl %edx, %ebx
movl %edi, %r15d
imull %edi, %r15d
movl %edx, %eax
imull %edx, %eax
movl %eax, 8(%rsp)
movslq %ebx, %rdi
movl %ebx, %edx
imull %ebx, %edx
leal 0(,%rdx,4), %r14d
imulq %rdi, %rdi
salq $2, %rdi
call malloc@PLT
movq %rax, %rbp
movl $4, 64(%rsp)
movl $8, 68(%rsp)
movl $1, 72(%rsp)
leal 3(%rbx), %edx
testl %ebx, %ebx
cmovns %ebx, %edx
sarl $2, %edx
movl %ebx, %edi
andl $3, %edi
cmpl $1, %edi
sbbl $-1, %edx
leal 7(%rbx), %eax
testl %ebx, %ebx
cmovns %ebx, %eax
sarl $3, %eax
movl %ebx, %ecx
andl $7, %ecx
cmpl $1, %ecx
sbbl $-1, %eax
movl %edx, 76(%rsp)
movl %eax, 80(%rsp)
movl $1, 84(%rsp)
movslq %r14d, %r14
leaq 40(%rsp), %rdi
movq %r14, %rsi
call cudaMalloc@PLT
movslq %r15d, %r15
leaq 48(%rsp), %rdi
movq %r15, %rsi
call cudaMalloc@PLT
movslq 8(%rsp), %rax
leaq 56(%rsp), %rdi
movq %rax, 8(%rsp)
movq %rax, %rsi
call cudaMalloc@PLT
movq %r14, %rdx
movl $0, %esi
movq 40(%rsp), %rdi
call cudaMemset@PLT
movl $1, %ecx
movq %r15, %rdx
movq 16(%rsp), %rsi
movq 48(%rsp), %rdi
call cudaMemcpy@PLT
movl $1, %ecx
movq 8(%rsp), %rdx
movq 24(%rsp), %rsi
movq 56(%rsp), %rdi
call cudaMemcpy@PLT
movl 72(%rsp), %ecx
movl $0, %r9d
movl $0, %r8d
movq 64(%rsp), %rdx
movq 76(%rsp), %rdi
movl 84(%rsp), %esi
call __cudaPushCallConfiguration@PLT
testl %eax, %eax
je .L22
.L16:
movl $2, %ecx
movq %r14, %rdx
movq 40(%rsp), %rsi
movq %rbp, %rdi
call cudaMemcpy@PLT
movq 40(%rsp), %rdi
call cudaFree@PLT
movq 48(%rsp), %rdi
call cudaFree@PLT
movq 56(%rsp), %rdi
call cudaFree@PLT
movl 0(%rbp), %r12d
imull %ebx, %ebx
cmpl $1, %ebx
jle .L17
leaq 4(%rbp), %rax
leal -2(%rbx), %edx
leaq 8(%rbp,%rdx,4), %rcx
.L18:
movl (%rax), %edx
cmpl %edx, %r12d
cmovl %edx, %r12d
addq $4, %rax
cmpq %rcx, %rax
jne .L18
.L17:
movq %rbp, %rdi
call free@PLT
movq 88(%rsp), %rax
subq %fs:40, %rax
jne .L23
movl %r12d, %eax
addq $104, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 56
popq %rbx
.cfi_def_cfa_offset 48
popq %rbp
.cfi_def_cfa_offset 40
popq %r12
.cfi_def_cfa_offset 32
popq %r13
.cfi_def_cfa_offset 24
popq %r14
.cfi_def_cfa_offset 16
popq %r15
.cfi_def_cfa_offset 8
ret
.L22:
.cfi_restore_state
movl %r13d, %r8d
movl %r12d, %ecx
movq 40(%rsp), %rdx
movq 56(%rsp), %rsi
movq 48(%rsp), %rdi
call _Z29__device_stub__Z4maskPcS_PiiiPcS_Piii
jmp .L16
.L23:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE2028:
.size _Z3seciPciS_, .-_Z3seciPciS_
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "_Z4maskPcS_Piii"
.text
.type _ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2056:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
leaq _ZL15__fatDeviceText(%rip), %rdi
call __cudaRegisterFatBinary@PLT
movq %rax, %rdi
movq %rax, _ZL20__cudaFatCubinHandle(%rip)
pushq $0
.cfi_def_cfa_offset 24
pushq $0
.cfi_def_cfa_offset 32
pushq $0
.cfi_def_cfa_offset 40
pushq $0
.cfi_def_cfa_offset 48
movl $0, %r9d
movl $-1, %r8d
leaq .LC0(%rip), %rdx
movq %rdx, %rcx
leaq _Z4maskPcS_Piii(%rip), %rsi
call __cudaRegisterFunction@PLT
addq $32, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaRegisterFatBinaryEnd@PLT
leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
call atexit@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2056:
.size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
.section .init_array,"aw"
.align 8
.quad _ZL24__sti____cudaRegisterAllv
.section .nvFatBinSegment,"aw"
.align 8
.type _ZL15__fatDeviceText, @object
.size _ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
.long 1180844977
.long 1
.quad fatbinData
.quad 0
.local _ZL20__cudaFatCubinHandle
.comm _ZL20__cudaFatCubinHandle,8,8
.ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
.section .note.GNU-stack,"",@progbits
.section .note.gnu.property,"a"
.align 8
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.string "GNU"
1:
.align 8
.long 0xc0000002
.long 3f - 2f
2:
.long 0x3
3:
.align 8
4: | .text
.file "2017Final-G-CUDA-FranciscoMunoz170920.hip"
.globl _Z19__device_stub__maskPcS_Piii # -- Begin function _Z19__device_stub__maskPcS_Piii
.p2align 4, 0x90
.type _Z19__device_stub__maskPcS_Piii,@function
_Z19__device_stub__maskPcS_Piii: # @_Z19__device_stub__maskPcS_Piii
.cfi_startproc
# %bb.0:
subq $120, %rsp
.cfi_def_cfa_offset 128
movq %rdi, 72(%rsp)
movq %rsi, 64(%rsp)
movq %rdx, 56(%rsp)
movl %ecx, 4(%rsp)
movl %r8d, (%rsp)
leaq 72(%rsp), %rax
movq %rax, 80(%rsp)
leaq 64(%rsp), %rax
movq %rax, 88(%rsp)
leaq 56(%rsp), %rax
movq %rax, 96(%rsp)
leaq 4(%rsp), %rax
movq %rax, 104(%rsp)
movq %rsp, %rax
movq %rax, 112(%rsp)
leaq 40(%rsp), %rdi
leaq 24(%rsp), %rsi
leaq 16(%rsp), %rdx
leaq 8(%rsp), %rcx
callq __hipPopCallConfiguration
movq 40(%rsp), %rsi
movl 48(%rsp), %edx
movq 24(%rsp), %rcx
movl 32(%rsp), %r8d
leaq 80(%rsp), %r9
movl $_Z4maskPcS_Piii, %edi
pushq 8(%rsp)
.cfi_adjust_cfa_offset 8
pushq 24(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $136, %rsp
.cfi_adjust_cfa_offset -136
retq
.Lfunc_end0:
.size _Z19__device_stub__maskPcS_Piii, .Lfunc_end0-_Z19__device_stub__maskPcS_Piii
.cfi_endproc
# -- End function
.globl _Z3seciPciS_ # -- Begin function _Z3seciPciS_
.p2align 4, 0x90
.type _Z3seciPciS_,@function
_Z3seciPciS_: # @_Z3seciPciS_
.cfi_startproc
# %bb.0:
pushq %rbp
.cfi_def_cfa_offset 16
pushq %r15
.cfi_def_cfa_offset 24
pushq %r14
.cfi_def_cfa_offset 32
pushq %r13
.cfi_def_cfa_offset 40
pushq %r12
.cfi_def_cfa_offset 48
pushq %rbx
.cfi_def_cfa_offset 56
subq $168, %rsp
.cfi_def_cfa_offset 224
.cfi_offset %rbx, -56
.cfi_offset %r12, -48
.cfi_offset %r13, -40
.cfi_offset %r14, -32
.cfi_offset %r15, -24
.cfi_offset %rbp, -16
movq %rcx, 48(%rsp) # 8-byte Spill
movq %rsi, 40(%rsp) # 8-byte Spill
movl %edi, %r14d
subl %edx, %r14d
movl %edi, 24(%rsp) # 4-byte Spill
movl %edi, %r13d
imull %edi, %r13d
movl %edx, 28(%rsp) # 4-byte Spill
movl %edx, %ebp
imull %edx, %ebp
movslq %r14d, %rbx
movq %rbx, %r15
imulq %rbx, %r15
shlq $2, %r15
movq %r15, %rdi
callq malloc
leal 3(%rbx), %ecx
leal 7(%rbx), %r12d
testl %ebx, %ebx
cmovnsl %r14d, %ecx
cmovnsl %r14d, %r12d
sarl $2, %ecx
movl %ebx, %edx
andl $3, %edx
cmpl $1, %edx
sbbl $-1, %ecx
sarl $3, %r12d
andl $7, %ebx
cmpl $1, %ebx
sbbl $-1, %r12d
movq %rax, %rbx
shlq $32, %r12
orq %rcx, %r12
movslq %r15d, %r15
movq %rsp, %rdi
movq %r15, %rsi
callq hipMalloc
movslq %r13d, %r13
leaq 16(%rsp), %rdi
movq %r13, %rsi
callq hipMalloc
movslq %ebp, %rbp
leaq 8(%rsp), %rdi
movq %rbp, %rsi
callq hipMalloc
movq (%rsp), %rdi
xorl %esi, %esi
movq %r15, %rdx
callq hipMemset
movq 16(%rsp), %rdi
movq 40(%rsp), %rsi # 8-byte Reload
movq %r13, %rdx
movl $1, %ecx
callq hipMemcpy
movq 8(%rsp), %rdi
movq 48(%rsp), %rsi # 8-byte Reload
movq %rbp, %rdx
movl $1, %ecx
callq hipMemcpy
movabsq $34359738372, %rdx # imm = 0x800000004
movq %r12, %rdi
movl $1, %esi
movl $1, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq __hipPushCallConfiguration
testl %eax, %eax
jne .LBB1_2
# %bb.1:
movq 16(%rsp), %rax
movq 8(%rsp), %rcx
movq (%rsp), %rdx
movq %rax, 120(%rsp)
movq %rcx, 112(%rsp)
movq %rdx, 104(%rsp)
movl 24(%rsp), %eax # 4-byte Reload
movl %eax, 36(%rsp)
movl 28(%rsp), %eax # 4-byte Reload
movl %eax, 32(%rsp)
leaq 120(%rsp), %rax
movq %rax, 128(%rsp)
leaq 112(%rsp), %rax
movq %rax, 136(%rsp)
leaq 104(%rsp), %rax
movq %rax, 144(%rsp)
leaq 36(%rsp), %rax
movq %rax, 152(%rsp)
leaq 32(%rsp), %rax
movq %rax, 160(%rsp)
leaq 88(%rsp), %rdi
leaq 72(%rsp), %rsi
leaq 64(%rsp), %rdx
leaq 56(%rsp), %rcx
callq __hipPopCallConfiguration
movq 88(%rsp), %rsi
movl 96(%rsp), %edx
movq 72(%rsp), %rcx
movl 80(%rsp), %r8d
leaq 128(%rsp), %r9
movl $_Z4maskPcS_Piii, %edi
pushq 56(%rsp)
.cfi_adjust_cfa_offset 8
pushq 72(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $16, %rsp
.cfi_adjust_cfa_offset -16
.LBB1_2:
movq (%rsp), %rsi
movq %rbx, %rdi
movq %r15, %rdx
movl $2, %ecx
callq hipMemcpy
movq (%rsp), %rdi
callq hipFree
movq 16(%rsp), %rdi
callq hipFree
movq 8(%rsp), %rdi
callq hipFree
movl (%rbx), %ebp
imull %r14d, %r14d
cmpl $2, %r14d
jb .LBB1_5
# %bb.3: # %.lr.ph.preheader
movl %r14d, %eax
movl $1, %ecx
.p2align 4, 0x90
.LBB1_4: # %.lr.ph
# =>This Inner Loop Header: Depth=1
movl (%rbx,%rcx,4), %edx
cmpl %ebp, %edx
cmovgl %edx, %ebp
incq %rcx
cmpq %rcx, %rax
jne .LBB1_4
.LBB1_5: # %._crit_edge
movq %rbx, %rdi
callq free
movl %ebp, %eax
addq $168, %rsp
.cfi_def_cfa_offset 56
popq %rbx
.cfi_def_cfa_offset 48
popq %r12
.cfi_def_cfa_offset 40
popq %r13
.cfi_def_cfa_offset 32
popq %r14
.cfi_def_cfa_offset 24
popq %r15
.cfi_def_cfa_offset 16
popq %rbp
.cfi_def_cfa_offset 8
retq
.Lfunc_end1:
.size _Z3seciPciS_, .Lfunc_end1-_Z3seciPciS_
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_ctor
.type __hip_module_ctor,@function
__hip_module_ctor: # @__hip_module_ctor
.cfi_startproc
# %bb.0:
subq $40, %rsp
.cfi_def_cfa_offset 48
cmpq $0, __hip_gpubin_handle(%rip)
jne .LBB2_2
# %bb.1:
movl $__hip_fatbin_wrapper, %edi
callq __hipRegisterFatBinary
movq %rax, __hip_gpubin_handle(%rip)
.LBB2_2:
movq __hip_gpubin_handle(%rip), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 16(%rsp)
movups %xmm0, (%rsp)
movl $_Z4maskPcS_Piii, %esi
movl $.L__unnamed_1, %edx
movl $.L__unnamed_1, %ecx
movl $-1, %r8d
xorl %r9d, %r9d
callq __hipRegisterFunction
movl $__hip_module_dtor, %edi
addq $40, %rsp
.cfi_def_cfa_offset 8
jmp atexit # TAILCALL
.Lfunc_end2:
.size __hip_module_ctor, .Lfunc_end2-__hip_module_ctor
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_dtor
.type __hip_module_dtor,@function
__hip_module_dtor: # @__hip_module_dtor
.cfi_startproc
# %bb.0:
movq __hip_gpubin_handle(%rip), %rdi
testq %rdi, %rdi
je .LBB3_2
# %bb.1:
pushq %rax
.cfi_def_cfa_offset 16
callq __hipUnregisterFatBinary
movq $0, __hip_gpubin_handle(%rip)
addq $8, %rsp
.cfi_def_cfa_offset 8
.LBB3_2:
retq
.Lfunc_end3:
.size __hip_module_dtor, .Lfunc_end3-__hip_module_dtor
.cfi_endproc
# -- End function
.type _Z4maskPcS_Piii,@object # @_Z4maskPcS_Piii
.section .rodata,"a",@progbits
.globl _Z4maskPcS_Piii
.p2align 3, 0x0
_Z4maskPcS_Piii:
.quad _Z19__device_stub__maskPcS_Piii
.size _Z4maskPcS_Piii, 8
.type .L__unnamed_1,@object # @0
.section .rodata.str1.1,"aMS",@progbits,1
.L__unnamed_1:
.asciz "_Z4maskPcS_Piii"
.size .L__unnamed_1, 16
.type __hip_fatbin_wrapper,@object # @__hip_fatbin_wrapper
.section .hipFatBinSegment,"a",@progbits
.p2align 3, 0x0
__hip_fatbin_wrapper:
.long 1212764230 # 0x48495046
.long 1 # 0x1
.quad __hip_fatbin
.quad 0
.size __hip_fatbin_wrapper, 24
.type __hip_gpubin_handle,@object # @__hip_gpubin_handle
.local __hip_gpubin_handle
.comm __hip_gpubin_handle,8,8
.section .init_array,"aw",@init_array
.p2align 3, 0x0
.quad __hip_module_ctor
.type __hip_cuid_,@object # @__hip_cuid_
.bss
.globl __hip_cuid_
__hip_cuid_:
.byte 0 # 0x0
.size __hip_cuid_, 1
.section ".linker-options","e",@llvm_linker_options
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym _Z19__device_stub__maskPcS_Piii
.addrsig_sym __hip_module_ctor
.addrsig_sym __hip_module_dtor
.addrsig_sym _Z4maskPcS_Piii
.addrsig_sym __hip_fatbin
.addrsig_sym __hip_fatbin_wrapper
.addrsig_sym __hip_cuid_ |
You are a helpful coding assistant specialized in converting CUDA source code to CUDA device assembly. | #include "includes.h"
__global__ void kernel_log_full_device(int *x, int *out, unsigned int size, int epsilon) {
unsigned int idx = blockDim.x * blockIdx.x + threadIdx.x;
unsigned int stride = blockDim.x * gridDim.x;
for (unsigned int i = idx; i < size; i += stride) {
out[i] = (int) log((float) x[i] + epsilon);
}
} | code for sm_80
Function : _Z22kernel_log_full_devicePiS_ji
.headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)"
/*0000*/ MOV R1, c[0x0][0x28] ; /* 0x00000a0000017a02 */
/* 0x000fe40000000f00 */
/*0010*/ S2R R2, SR_CTAID.X ; /* 0x0000000000027919 */
/* 0x000e280000002500 */
/*0020*/ S2R R3, SR_TID.X ; /* 0x0000000000037919 */
/* 0x000e240000002100 */
/*0030*/ IMAD R2, R2, c[0x0][0x0], R3 ; /* 0x0000000002027a24 */
/* 0x001fca00078e0203 */
/*0040*/ ISETP.GE.U32.AND P0, PT, R2, c[0x0][0x170], PT ; /* 0x00005c0002007a0c */
/* 0x000fda0003f06070 */
/*0050*/ @P0 EXIT ; /* 0x000000000000094d */
/* 0x000fea0003800000 */
/*0060*/ I2F R0, c[0x0][0x174] ; /* 0x00005d0000007b06 */
/* 0x000e220000201400 */
/*0070*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */
/* 0x000fca0000000a00 */
/*0080*/ HFMA2.MMA R5, -RZ, RZ, 0, 2.384185791015625e-07 ; /* 0x00000004ff057435 */
/* 0x001fd400000001ff */
/*0090*/ IMAD.WIDE.U32 R4, R2, R5, c[0x0][0x160] ; /* 0x0000580002047625 */
/* 0x000fcc00078e0005 */
/*00a0*/ LDG.E R4, [R4.64] ; /* 0x0000000404047981 */
/* 0x000ea2000c1e1900 */
/*00b0*/ MOV R8, 0x3e055027 ; /* 0x3e05502700087802 */
/* 0x000fe20000000f00 */
/*00c0*/ I2F R3, R4 ; /* 0x0000000400037306 */
/* 0x004e640000201400 */
/*00d0*/ FADD R3, R0, R3 ; /* 0x0000000300037221 */
/* 0x003fca0000000000 */
/*00e0*/ FSETP.GEU.AND P0, PT, R3, 1.175494350822287508e-38, PT ; /* 0x008000000300780b */
/* 0x000fc80003f0e000 */
/*00f0*/ FSEL R4, RZ, -23, P0 ; /* 0xc1b80000ff047808 */
/* 0x000fd20000000000 */
/*0100*/ @!P0 FMUL R3, R3, 8388608 ; /* 0x4b00000003038820 */
/* 0x000fca0000400000 */
/*0110*/ IADD3 R6, R3.reuse, -0x3f2aaaab, RZ ; /* 0xc0d5555503067810 */
/* 0x040fe40007ffe0ff */
/*0120*/ ISETP.GE.U32.AND P1, PT, R3.reuse, 0x7f800000, PT ; /* 0x7f8000000300780c */
/* 0x040fe40003f26070 */
/*0130*/ LOP3.LUT R6, R6, 0xff800000, RZ, 0xc0, !PT ; /* 0xff80000006067812 */
/* 0x000fe400078ec0ff */
/*0140*/ FSETP.NEU.AND P0, PT, R3.reuse, RZ, PT ; /* 0x000000ff0300720b */
/* 0x040fe40003f0d000 */
/*0150*/ IADD3 R7, R3, -R6, RZ ; /* 0x8000000603077210 */
/* 0x000fe20007ffe0ff */
/*0160*/ I2F R5, R6 ; /* 0x0000000600057306 */
/* 0x000e280000201400 */
/*0170*/ FADD R7, R7, -1 ; /* 0xbf80000007077421 */
/* 0x000fc80000000000 */
/*0180*/ FFMA R8, R7, -R8, 0.14084610342979431152 ; /* 0x3e1039f607087423 */
/* 0x000fc80000000808 */
/*0190*/ FFMA R8, R7, R8, -0.12148627638816833496 ; /* 0xbdf8cdcc07087423 */
/* 0x000fc80000000008 */
/*01a0*/ FFMA R8, R7, R8, 0.13980610668659210205 ; /* 0x3e0f295507087423 */
/* 0x000fe40000000008 */
/*01b0*/ FFMA R4, R5, 1.1920928955078125e-07, R4 ; /* 0x3400000005047823 */
/* 0x001fe40000000004 */
/*01c0*/ FFMA R8, R7, R8, -0.16684235632419586182 ; /* 0xbe2ad8b907087423 */
/* 0x000fc80000000008 */
/*01d0*/ FFMA R8, R7, R8, 0.20012299716472625732 ; /* 0x3e4ced0b07087423 */
/* 0x000fc80000000008 */
/*01e0*/ FFMA R8, R7, R8, -0.24999669194221496582 ; /* 0xbe7fff2207087423 */
/* 0x000fc80000000008 */
/*01f0*/ FFMA R8, R7, R8, 0.33333182334899902344 ; /* 0x3eaaaa7807087423 */
/* 0x000fc80000000008 */
/*0200*/ FFMA R8, R7, R8, -0.5 ; /* 0xbf00000007087423 */
/* 0x000fc80000000008 */
/*0210*/ FMUL R8, R7, R8 ; /* 0x0000000807087220 */
/* 0x000fc80000400000 */
/*0220*/ FFMA R7, R7, R8, R7 ; /* 0x0000000807077223 */
/* 0x000fe20000000007 */
/*0230*/ @P1 MOV R8, 0x7f800000 ; /* 0x7f80000000081802 */
/* 0x000fc60000000f00 */
/*0240*/ FFMA R4, R4, 0.69314718246459960938, R7 ; /* 0x3f31721804047823 */
/* 0x000fe20000000007 */
/*0250*/ MOV R7, c[0x0][0x0] ; /* 0x0000000000077a02 */
/* 0x000fe20000000f00 */
/*0260*/ @P1 FFMA R4, R3, R8, +INF ; /* 0x7f80000003041423 */
/* 0x000fca0000000008 */
/*0270*/ FSEL R3, R4, -INF , P0 ; /* 0xff80000004037808 */
/* 0x000fe40000000000 */
/*0280*/ LEA R4, P0, R2, c[0x0][0x168], 0x2 ; /* 0x00005a0002047a11 */
/* 0x000fc800078010ff */
/*0290*/ F2I.TRUNC.NTZ R3, R3 ; /* 0x0000000300037305 */
/* 0x000e22000020f100 */
/*02a0*/ LEA.HI.X R5, R2, c[0x0][0x16c], RZ, 0x2, P0 ; /* 0x00005b0002057a11 */
/* 0x000fe200000f14ff */
/*02b0*/ IMAD R2, R7, c[0x0][0xc], R2 ; /* 0x0000030007027a24 */
/* 0x000fca00078e0202 */
/*02c0*/ ISETP.GE.U32.AND P0, PT, R2, c[0x0][0x170], PT ; /* 0x00005c0002007a0c */
/* 0x000fe20003f06070 */
/*02d0*/ STG.E [R4.64], R3 ; /* 0x0000000304007986 */
/* 0x0011d8000c101904 */
/*02e0*/ @!P0 BRA 0x80 ; /* 0xfffffd9000008947 */
/* 0x000fea000383ffff */
/*02f0*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*0300*/ BRA 0x300; /* 0xfffffff000007947 */
/* 0x000fc0000383ffff */
/*0310*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0320*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0330*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0340*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0350*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0360*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0370*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0380*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0390*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*03a0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*03b0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*03c0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*03d0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*03e0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*03f0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
.......... |
You are a helpful coding assistant specialized in converting CUDA source code to CUDA host assembly. | #include "includes.h"
__global__ void kernel_log_full_device(int *x, int *out, unsigned int size, int epsilon) {
unsigned int idx = blockDim.x * blockIdx.x + threadIdx.x;
unsigned int stride = blockDim.x * gridDim.x;
for (unsigned int i = idx; i < size; i += stride) {
out[i] = (int) log((float) x[i] + epsilon);
}
} | .file "tmpxft_0015782b_00000000-6_kernel_log_full_device.cudafe1.cpp"
.text
#APP
#NO_APP
.type _ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3493:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaUnregisterFatBinary@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE3493:
.size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
.globl _Z46__device_stub__Z22kernel_log_full_devicePiS_jiPiS_ji
.type _Z46__device_stub__Z22kernel_log_full_devicePiS_jiPiS_ji, @function
_Z46__device_stub__Z22kernel_log_full_devicePiS_jiPiS_ji:
.LFB3515:
.cfi_startproc
endbr64
subq $152, %rsp
.cfi_def_cfa_offset 160
movq %rdi, 24(%rsp)
movq %rsi, 16(%rsp)
movl %edx, 12(%rsp)
movl %ecx, 8(%rsp)
movq %fs:40, %rax
movq %rax, 136(%rsp)
xorl %eax, %eax
leaq 24(%rsp), %rax
movq %rax, 96(%rsp)
leaq 16(%rsp), %rax
movq %rax, 104(%rsp)
leaq 12(%rsp), %rax
movq %rax, 112(%rsp)
leaq 8(%rsp), %rax
movq %rax, 120(%rsp)
movl $1, 48(%rsp)
movl $1, 52(%rsp)
movl $1, 56(%rsp)
movl $1, 60(%rsp)
movl $1, 64(%rsp)
movl $1, 68(%rsp)
leaq 40(%rsp), %rcx
leaq 32(%rsp), %rdx
leaq 60(%rsp), %rsi
leaq 48(%rsp), %rdi
call __cudaPopCallConfiguration@PLT
testl %eax, %eax
je .L7
.L3:
movq 136(%rsp), %rax
subq %fs:40, %rax
jne .L8
addq $152, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 8
ret
.L7:
.cfi_restore_state
pushq 40(%rsp)
.cfi_def_cfa_offset 168
pushq 40(%rsp)
.cfi_def_cfa_offset 176
leaq 112(%rsp), %r9
movq 76(%rsp), %rcx
movl 84(%rsp), %r8d
movq 64(%rsp), %rsi
movl 72(%rsp), %edx
leaq _Z22kernel_log_full_devicePiS_ji(%rip), %rdi
call cudaLaunchKernel@PLT
addq $16, %rsp
.cfi_def_cfa_offset 160
jmp .L3
.L8:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE3515:
.size _Z46__device_stub__Z22kernel_log_full_devicePiS_jiPiS_ji, .-_Z46__device_stub__Z22kernel_log_full_devicePiS_jiPiS_ji
.globl _Z22kernel_log_full_devicePiS_ji
.type _Z22kernel_log_full_devicePiS_ji, @function
_Z22kernel_log_full_devicePiS_ji:
.LFB3516:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
call _Z46__device_stub__Z22kernel_log_full_devicePiS_jiPiS_ji
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE3516:
.size _Z22kernel_log_full_devicePiS_ji, .-_Z22kernel_log_full_devicePiS_ji
.section .rodata.str1.8,"aMS",@progbits,1
.align 8
.LC0:
.string "_Z22kernel_log_full_devicePiS_ji"
.text
.type _ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3518:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
leaq _ZL15__fatDeviceText(%rip), %rdi
call __cudaRegisterFatBinary@PLT
movq %rax, %rdi
movq %rax, _ZL20__cudaFatCubinHandle(%rip)
pushq $0
.cfi_def_cfa_offset 24
pushq $0
.cfi_def_cfa_offset 32
pushq $0
.cfi_def_cfa_offset 40
pushq $0
.cfi_def_cfa_offset 48
movl $0, %r9d
movl $-1, %r8d
leaq .LC0(%rip), %rdx
movq %rdx, %rcx
leaq _Z22kernel_log_full_devicePiS_ji(%rip), %rsi
call __cudaRegisterFunction@PLT
addq $32, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaRegisterFatBinaryEnd@PLT
leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
call atexit@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE3518:
.size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
.section .init_array,"aw"
.align 8
.quad _ZL24__sti____cudaRegisterAllv
.section .nvFatBinSegment,"aw"
.align 8
.type _ZL15__fatDeviceText, @object
.size _ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
.long 1180844977
.long 1
.quad fatbinData
.quad 0
.local _ZL20__cudaFatCubinHandle
.comm _ZL20__cudaFatCubinHandle,8,8
.ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
.section .note.GNU-stack,"",@progbits
.section .note.gnu.property,"a"
.align 8
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.string "GNU"
1:
.align 8
.long 0xc0000002
.long 3f - 2f
2:
.long 0x3
3:
.align 8
4: |
You are a helpful coding assistant specialized in converting CUDA source code to HIP/AMD source code. | #include "includes.h"
__global__ void kernel_log_full_device(int *x, int *out, unsigned int size, int epsilon) {
unsigned int idx = blockDim.x * blockIdx.x + threadIdx.x;
unsigned int stride = blockDim.x * gridDim.x;
for (unsigned int i = idx; i < size; i += stride) {
out[i] = (int) log((float) x[i] + epsilon);
}
} | #include <hip/hip_runtime.h>
#include "includes.h"
__global__ void kernel_log_full_device(int *x, int *out, unsigned int size, int epsilon) {
unsigned int idx = blockDim.x * blockIdx.x + threadIdx.x;
unsigned int stride = blockDim.x * gridDim.x;
for (unsigned int i = idx; i < size; i += stride) {
out[i] = (int) log((float) x[i] + epsilon);
}
} |
You are a helpful coding assistant specialized in converting HIP source code to AMD device assembly. | #include <hip/hip_runtime.h>
#include "includes.h"
__global__ void kernel_log_full_device(int *x, int *out, unsigned int size, int epsilon) {
unsigned int idx = blockDim.x * blockIdx.x + threadIdx.x;
unsigned int stride = blockDim.x * gridDim.x;
for (unsigned int i = idx; i < size; i += stride) {
out[i] = (int) log((float) x[i] + epsilon);
}
} | .text
.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
.protected _Z22kernel_log_full_devicePiS_ji
.globl _Z22kernel_log_full_devicePiS_ji
.p2align 8
.type _Z22kernel_log_full_devicePiS_ji,@function
_Z22kernel_log_full_devicePiS_ji:
s_clause 0x1
s_load_b32 s4, s[0:1], 0x24
s_load_b32 s8, s[0:1], 0x10
s_add_u32 s2, s0, 24
s_addc_u32 s3, s1, 0
s_waitcnt lgkmcnt(0)
s_and_b32 s9, s4, 0xffff
s_mov_b32 s4, exec_lo
v_mad_u64_u32 v[1:2], null, s15, s9, v[0:1]
s_delay_alu instid0(VALU_DEP_1)
v_cmpx_gt_u32_e64 s8, v1
s_cbranch_execz .LBB0_3
s_load_b32 s10, s[0:1], 0x14
s_load_b32 s2, s[2:3], 0x0
s_load_b128 s[4:7], s[0:1], 0x0
v_mov_b32_e32 v2, 0
s_waitcnt lgkmcnt(0)
v_cvt_f32_i32_e32 v0, s10
s_mul_i32 s1, s2, s9
s_mov_b32 s2, 0
s_set_inst_prefetch_distance 0x1
.p2align 6
.LBB0_2:
v_lshlrev_b64 v[3:4], 2, v[1:2]
v_add_nc_u32_e32 v1, s1, v1
s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
v_add_co_u32 v5, vcc_lo, s4, v3
v_add_co_ci_u32_e32 v6, vcc_lo, s5, v4, vcc_lo
v_add_co_u32 v3, s0, s6, v3
s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
v_add_co_ci_u32_e64 v4, s0, s7, v4, s0
global_load_b32 v5, v[5:6], off
s_waitcnt vmcnt(0)
v_cvt_f32_i32_e32 v5, v5
v_add_f32_e32 v5, v0, v5
s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
v_cmp_gt_f32_e32 vcc_lo, 0x800000, v5
v_cndmask_b32_e64 v6, 1.0, 0x4f800000, vcc_lo
v_mul_f32_e32 v5, v5, v6
s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
v_log_f32_e32 v5, v5
s_waitcnt_depctr 0xfff
v_mul_f32_e32 v6, 0x3f317217, v5
v_fma_f32 v7, v5, 0x3f317217, -v6
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_fmac_f32_e32 v7, 0x3377d1cf, v5
v_add_f32_e32 v6, v6, v7
v_cndmask_b32_e64 v7, 0, 0x41b17218, vcc_lo
v_cmp_gt_f32_e64 vcc_lo, 0x7f800000, |v5|
s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_2)
v_cndmask_b32_e32 v5, v5, v6, vcc_lo
v_cmp_le_u32_e32 vcc_lo, s8, v1
v_sub_f32_e32 v5, v5, v7
s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_1)
s_or_b32 s2, vcc_lo, s2
v_cvt_i32_f32_e32 v5, v5
global_store_b32 v[3:4], v5, off
s_and_not1_b32 exec_lo, exec_lo, s2
s_cbranch_execnz .LBB0_2
.LBB0_3:
s_set_inst_prefetch_distance 0x2
s_nop 0
s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
s_endpgm
.section .rodata,"a",@progbits
.p2align 6, 0x0
.amdhsa_kernel _Z22kernel_log_full_devicePiS_ji
.amdhsa_group_segment_fixed_size 0
.amdhsa_private_segment_fixed_size 0
.amdhsa_kernarg_size 280
.amdhsa_user_sgpr_count 15
.amdhsa_user_sgpr_dispatch_ptr 0
.amdhsa_user_sgpr_queue_ptr 0
.amdhsa_user_sgpr_kernarg_segment_ptr 1
.amdhsa_user_sgpr_dispatch_id 0
.amdhsa_user_sgpr_private_segment_size 0
.amdhsa_wavefront_size32 1
.amdhsa_uses_dynamic_stack 0
.amdhsa_enable_private_segment 0
.amdhsa_system_sgpr_workgroup_id_x 1
.amdhsa_system_sgpr_workgroup_id_y 0
.amdhsa_system_sgpr_workgroup_id_z 0
.amdhsa_system_sgpr_workgroup_info 0
.amdhsa_system_vgpr_workitem_id 0
.amdhsa_next_free_vgpr 8
.amdhsa_next_free_sgpr 16
.amdhsa_float_round_mode_32 0
.amdhsa_float_round_mode_16_64 0
.amdhsa_float_denorm_mode_32 3
.amdhsa_float_denorm_mode_16_64 3
.amdhsa_dx10_clamp 1
.amdhsa_ieee_mode 1
.amdhsa_fp16_overflow 0
.amdhsa_workgroup_processor_mode 1
.amdhsa_memory_ordered 1
.amdhsa_forward_progress 0
.amdhsa_shared_vgpr_count 0
.amdhsa_exception_fp_ieee_invalid_op 0
.amdhsa_exception_fp_denorm_src 0
.amdhsa_exception_fp_ieee_div_zero 0
.amdhsa_exception_fp_ieee_overflow 0
.amdhsa_exception_fp_ieee_underflow 0
.amdhsa_exception_fp_ieee_inexact 0
.amdhsa_exception_int_div_zero 0
.end_amdhsa_kernel
.text
.Lfunc_end0:
.size _Z22kernel_log_full_devicePiS_ji, .Lfunc_end0-_Z22kernel_log_full_devicePiS_ji
.section .AMDGPU.csdata,"",@progbits
.text
.p2alignl 7, 3214868480
.fill 96, 4, 3214868480
.type __hip_cuid_,@object
.section .bss,"aw",@nobits
.globl __hip_cuid_
__hip_cuid_:
.byte 0
.size __hip_cuid_, 1
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym __hip_cuid_
.amdgpu_metadata
---
amdhsa.kernels:
- .args:
- .address_space: global
.offset: 0
.size: 8
.value_kind: global_buffer
- .address_space: global
.offset: 8
.size: 8
.value_kind: global_buffer
- .offset: 16
.size: 4
.value_kind: by_value
- .offset: 20
.size: 4
.value_kind: by_value
- .offset: 24
.size: 4
.value_kind: hidden_block_count_x
- .offset: 28
.size: 4
.value_kind: hidden_block_count_y
- .offset: 32
.size: 4
.value_kind: hidden_block_count_z
- .offset: 36
.size: 2
.value_kind: hidden_group_size_x
- .offset: 38
.size: 2
.value_kind: hidden_group_size_y
- .offset: 40
.size: 2
.value_kind: hidden_group_size_z
- .offset: 42
.size: 2
.value_kind: hidden_remainder_x
- .offset: 44
.size: 2
.value_kind: hidden_remainder_y
- .offset: 46
.size: 2
.value_kind: hidden_remainder_z
- .offset: 64
.size: 8
.value_kind: hidden_global_offset_x
- .offset: 72
.size: 8
.value_kind: hidden_global_offset_y
- .offset: 80
.size: 8
.value_kind: hidden_global_offset_z
- .offset: 88
.size: 2
.value_kind: hidden_grid_dims
.group_segment_fixed_size: 0
.kernarg_segment_align: 8
.kernarg_segment_size: 280
.language: OpenCL C
.language_version:
- 2
- 0
.max_flat_workgroup_size: 1024
.name: _Z22kernel_log_full_devicePiS_ji
.private_segment_fixed_size: 0
.sgpr_count: 18
.sgpr_spill_count: 0
.symbol: _Z22kernel_log_full_devicePiS_ji.kd
.uniform_work_group_size: 1
.uses_dynamic_stack: false
.vgpr_count: 8
.vgpr_spill_count: 0
.wavefront_size: 32
.workgroup_processor_mode: 1
amdhsa.target: amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
- 1
- 2
...
.end_amdgpu_metadata |
You are a helpful coding assistant specialized in converting HIP source code to AMD host assembly. | #include <hip/hip_runtime.h>
#include "includes.h"
__global__ void kernel_log_full_device(int *x, int *out, unsigned int size, int epsilon) {
unsigned int idx = blockDim.x * blockIdx.x + threadIdx.x;
unsigned int stride = blockDim.x * gridDim.x;
for (unsigned int i = idx; i < size; i += stride) {
out[i] = (int) log((float) x[i] + epsilon);
}
} | .text
.file "kernel_log_full_device.hip"
.globl _Z37__device_stub__kernel_log_full_devicePiS_ji # -- Begin function _Z37__device_stub__kernel_log_full_devicePiS_ji
.p2align 4, 0x90
.type _Z37__device_stub__kernel_log_full_devicePiS_ji,@function
_Z37__device_stub__kernel_log_full_devicePiS_ji: # @_Z37__device_stub__kernel_log_full_devicePiS_ji
.cfi_startproc
# %bb.0:
subq $120, %rsp
.cfi_def_cfa_offset 128
movq %rdi, 72(%rsp)
movq %rsi, 64(%rsp)
movl %edx, 12(%rsp)
movl %ecx, 8(%rsp)
leaq 72(%rsp), %rax
movq %rax, 80(%rsp)
leaq 64(%rsp), %rax
movq %rax, 88(%rsp)
leaq 12(%rsp), %rax
movq %rax, 96(%rsp)
leaq 8(%rsp), %rax
movq %rax, 104(%rsp)
leaq 48(%rsp), %rdi
leaq 32(%rsp), %rsi
leaq 24(%rsp), %rdx
leaq 16(%rsp), %rcx
callq __hipPopCallConfiguration
movq 48(%rsp), %rsi
movl 56(%rsp), %edx
movq 32(%rsp), %rcx
movl 40(%rsp), %r8d
leaq 80(%rsp), %r9
movl $_Z22kernel_log_full_devicePiS_ji, %edi
pushq 16(%rsp)
.cfi_adjust_cfa_offset 8
pushq 32(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $136, %rsp
.cfi_adjust_cfa_offset -136
retq
.Lfunc_end0:
.size _Z37__device_stub__kernel_log_full_devicePiS_ji, .Lfunc_end0-_Z37__device_stub__kernel_log_full_devicePiS_ji
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_ctor
.type __hip_module_ctor,@function
__hip_module_ctor: # @__hip_module_ctor
.cfi_startproc
# %bb.0:
subq $40, %rsp
.cfi_def_cfa_offset 48
cmpq $0, __hip_gpubin_handle(%rip)
jne .LBB1_2
# %bb.1:
movl $__hip_fatbin_wrapper, %edi
callq __hipRegisterFatBinary
movq %rax, __hip_gpubin_handle(%rip)
.LBB1_2:
movq __hip_gpubin_handle(%rip), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 16(%rsp)
movups %xmm0, (%rsp)
movl $_Z22kernel_log_full_devicePiS_ji, %esi
movl $.L__unnamed_1, %edx
movl $.L__unnamed_1, %ecx
movl $-1, %r8d
xorl %r9d, %r9d
callq __hipRegisterFunction
movl $__hip_module_dtor, %edi
addq $40, %rsp
.cfi_def_cfa_offset 8
jmp atexit # TAILCALL
.Lfunc_end1:
.size __hip_module_ctor, .Lfunc_end1-__hip_module_ctor
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_dtor
.type __hip_module_dtor,@function
__hip_module_dtor: # @__hip_module_dtor
.cfi_startproc
# %bb.0:
movq __hip_gpubin_handle(%rip), %rdi
testq %rdi, %rdi
je .LBB2_2
# %bb.1:
pushq %rax
.cfi_def_cfa_offset 16
callq __hipUnregisterFatBinary
movq $0, __hip_gpubin_handle(%rip)
addq $8, %rsp
.cfi_def_cfa_offset 8
.LBB2_2:
retq
.Lfunc_end2:
.size __hip_module_dtor, .Lfunc_end2-__hip_module_dtor
.cfi_endproc
# -- End function
.type _Z22kernel_log_full_devicePiS_ji,@object # @_Z22kernel_log_full_devicePiS_ji
.section .rodata,"a",@progbits
.globl _Z22kernel_log_full_devicePiS_ji
.p2align 3, 0x0
_Z22kernel_log_full_devicePiS_ji:
.quad _Z37__device_stub__kernel_log_full_devicePiS_ji
.size _Z22kernel_log_full_devicePiS_ji, 8
.type .L__unnamed_1,@object # @0
.section .rodata.str1.1,"aMS",@progbits,1
.L__unnamed_1:
.asciz "_Z22kernel_log_full_devicePiS_ji"
.size .L__unnamed_1, 33
.type __hip_fatbin_wrapper,@object # @__hip_fatbin_wrapper
.section .hipFatBinSegment,"a",@progbits
.p2align 3, 0x0
__hip_fatbin_wrapper:
.long 1212764230 # 0x48495046
.long 1 # 0x1
.quad __hip_fatbin
.quad 0
.size __hip_fatbin_wrapper, 24
.type __hip_gpubin_handle,@object # @__hip_gpubin_handle
.local __hip_gpubin_handle
.comm __hip_gpubin_handle,8,8
.section .init_array,"aw",@init_array
.p2align 3, 0x0
.quad __hip_module_ctor
.type __hip_cuid_,@object # @__hip_cuid_
.bss
.globl __hip_cuid_
__hip_cuid_:
.byte 0 # 0x0
.size __hip_cuid_, 1
.section ".linker-options","e",@llvm_linker_options
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym _Z37__device_stub__kernel_log_full_devicePiS_ji
.addrsig_sym __hip_module_ctor
.addrsig_sym __hip_module_dtor
.addrsig_sym _Z22kernel_log_full_devicePiS_ji
.addrsig_sym __hip_fatbin
.addrsig_sym __hip_fatbin_wrapper
.addrsig_sym __hip_cuid_ |
You are a helpful coding assistant specialized in converting from CUDA device assembly to AMD device assembly. | code for sm_80
Function : _Z22kernel_log_full_devicePiS_ji
.headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)"
/*0000*/ MOV R1, c[0x0][0x28] ; /* 0x00000a0000017a02 */
/* 0x000fe40000000f00 */
/*0010*/ S2R R2, SR_CTAID.X ; /* 0x0000000000027919 */
/* 0x000e280000002500 */
/*0020*/ S2R R3, SR_TID.X ; /* 0x0000000000037919 */
/* 0x000e240000002100 */
/*0030*/ IMAD R2, R2, c[0x0][0x0], R3 ; /* 0x0000000002027a24 */
/* 0x001fca00078e0203 */
/*0040*/ ISETP.GE.U32.AND P0, PT, R2, c[0x0][0x170], PT ; /* 0x00005c0002007a0c */
/* 0x000fda0003f06070 */
/*0050*/ @P0 EXIT ; /* 0x000000000000094d */
/* 0x000fea0003800000 */
/*0060*/ I2F R0, c[0x0][0x174] ; /* 0x00005d0000007b06 */
/* 0x000e220000201400 */
/*0070*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */
/* 0x000fca0000000a00 */
/*0080*/ HFMA2.MMA R5, -RZ, RZ, 0, 2.384185791015625e-07 ; /* 0x00000004ff057435 */
/* 0x001fd400000001ff */
/*0090*/ IMAD.WIDE.U32 R4, R2, R5, c[0x0][0x160] ; /* 0x0000580002047625 */
/* 0x000fcc00078e0005 */
/*00a0*/ LDG.E R4, [R4.64] ; /* 0x0000000404047981 */
/* 0x000ea2000c1e1900 */
/*00b0*/ MOV R8, 0x3e055027 ; /* 0x3e05502700087802 */
/* 0x000fe20000000f00 */
/*00c0*/ I2F R3, R4 ; /* 0x0000000400037306 */
/* 0x004e640000201400 */
/*00d0*/ FADD R3, R0, R3 ; /* 0x0000000300037221 */
/* 0x003fca0000000000 */
/*00e0*/ FSETP.GEU.AND P0, PT, R3, 1.175494350822287508e-38, PT ; /* 0x008000000300780b */
/* 0x000fc80003f0e000 */
/*00f0*/ FSEL R4, RZ, -23, P0 ; /* 0xc1b80000ff047808 */
/* 0x000fd20000000000 */
/*0100*/ @!P0 FMUL R3, R3, 8388608 ; /* 0x4b00000003038820 */
/* 0x000fca0000400000 */
/*0110*/ IADD3 R6, R3.reuse, -0x3f2aaaab, RZ ; /* 0xc0d5555503067810 */
/* 0x040fe40007ffe0ff */
/*0120*/ ISETP.GE.U32.AND P1, PT, R3.reuse, 0x7f800000, PT ; /* 0x7f8000000300780c */
/* 0x040fe40003f26070 */
/*0130*/ LOP3.LUT R6, R6, 0xff800000, RZ, 0xc0, !PT ; /* 0xff80000006067812 */
/* 0x000fe400078ec0ff */
/*0140*/ FSETP.NEU.AND P0, PT, R3.reuse, RZ, PT ; /* 0x000000ff0300720b */
/* 0x040fe40003f0d000 */
/*0150*/ IADD3 R7, R3, -R6, RZ ; /* 0x8000000603077210 */
/* 0x000fe20007ffe0ff */
/*0160*/ I2F R5, R6 ; /* 0x0000000600057306 */
/* 0x000e280000201400 */
/*0170*/ FADD R7, R7, -1 ; /* 0xbf80000007077421 */
/* 0x000fc80000000000 */
/*0180*/ FFMA R8, R7, -R8, 0.14084610342979431152 ; /* 0x3e1039f607087423 */
/* 0x000fc80000000808 */
/*0190*/ FFMA R8, R7, R8, -0.12148627638816833496 ; /* 0xbdf8cdcc07087423 */
/* 0x000fc80000000008 */
/*01a0*/ FFMA R8, R7, R8, 0.13980610668659210205 ; /* 0x3e0f295507087423 */
/* 0x000fe40000000008 */
/*01b0*/ FFMA R4, R5, 1.1920928955078125e-07, R4 ; /* 0x3400000005047823 */
/* 0x001fe40000000004 */
/*01c0*/ FFMA R8, R7, R8, -0.16684235632419586182 ; /* 0xbe2ad8b907087423 */
/* 0x000fc80000000008 */
/*01d0*/ FFMA R8, R7, R8, 0.20012299716472625732 ; /* 0x3e4ced0b07087423 */
/* 0x000fc80000000008 */
/*01e0*/ FFMA R8, R7, R8, -0.24999669194221496582 ; /* 0xbe7fff2207087423 */
/* 0x000fc80000000008 */
/*01f0*/ FFMA R8, R7, R8, 0.33333182334899902344 ; /* 0x3eaaaa7807087423 */
/* 0x000fc80000000008 */
/*0200*/ FFMA R8, R7, R8, -0.5 ; /* 0xbf00000007087423 */
/* 0x000fc80000000008 */
/*0210*/ FMUL R8, R7, R8 ; /* 0x0000000807087220 */
/* 0x000fc80000400000 */
/*0220*/ FFMA R7, R7, R8, R7 ; /* 0x0000000807077223 */
/* 0x000fe20000000007 */
/*0230*/ @P1 MOV R8, 0x7f800000 ; /* 0x7f80000000081802 */
/* 0x000fc60000000f00 */
/*0240*/ FFMA R4, R4, 0.69314718246459960938, R7 ; /* 0x3f31721804047823 */
/* 0x000fe20000000007 */
/*0250*/ MOV R7, c[0x0][0x0] ; /* 0x0000000000077a02 */
/* 0x000fe20000000f00 */
/*0260*/ @P1 FFMA R4, R3, R8, +INF ; /* 0x7f80000003041423 */
/* 0x000fca0000000008 */
/*0270*/ FSEL R3, R4, -INF , P0 ; /* 0xff80000004037808 */
/* 0x000fe40000000000 */
/*0280*/ LEA R4, P0, R2, c[0x0][0x168], 0x2 ; /* 0x00005a0002047a11 */
/* 0x000fc800078010ff */
/*0290*/ F2I.TRUNC.NTZ R3, R3 ; /* 0x0000000300037305 */
/* 0x000e22000020f100 */
/*02a0*/ LEA.HI.X R5, R2, c[0x0][0x16c], RZ, 0x2, P0 ; /* 0x00005b0002057a11 */
/* 0x000fe200000f14ff */
/*02b0*/ IMAD R2, R7, c[0x0][0xc], R2 ; /* 0x0000030007027a24 */
/* 0x000fca00078e0202 */
/*02c0*/ ISETP.GE.U32.AND P0, PT, R2, c[0x0][0x170], PT ; /* 0x00005c0002007a0c */
/* 0x000fe20003f06070 */
/*02d0*/ STG.E [R4.64], R3 ; /* 0x0000000304007986 */
/* 0x0011d8000c101904 */
/*02e0*/ @!P0 BRA 0x80 ; /* 0xfffffd9000008947 */
/* 0x000fea000383ffff */
/*02f0*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*0300*/ BRA 0x300; /* 0xfffffff000007947 */
/* 0x000fc0000383ffff */
/*0310*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0320*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0330*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0340*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0350*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0360*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0370*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0380*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0390*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*03a0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*03b0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*03c0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*03d0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*03e0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*03f0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
.......... | .text
.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
.protected _Z22kernel_log_full_devicePiS_ji
.globl _Z22kernel_log_full_devicePiS_ji
.p2align 8
.type _Z22kernel_log_full_devicePiS_ji,@function
_Z22kernel_log_full_devicePiS_ji:
s_clause 0x1
s_load_b32 s4, s[0:1], 0x24
s_load_b32 s8, s[0:1], 0x10
s_add_u32 s2, s0, 24
s_addc_u32 s3, s1, 0
s_waitcnt lgkmcnt(0)
s_and_b32 s9, s4, 0xffff
s_mov_b32 s4, exec_lo
v_mad_u64_u32 v[1:2], null, s15, s9, v[0:1]
s_delay_alu instid0(VALU_DEP_1)
v_cmpx_gt_u32_e64 s8, v1
s_cbranch_execz .LBB0_3
s_load_b32 s10, s[0:1], 0x14
s_load_b32 s2, s[2:3], 0x0
s_load_b128 s[4:7], s[0:1], 0x0
v_mov_b32_e32 v2, 0
s_waitcnt lgkmcnt(0)
v_cvt_f32_i32_e32 v0, s10
s_mul_i32 s1, s2, s9
s_mov_b32 s2, 0
s_set_inst_prefetch_distance 0x1
.p2align 6
.LBB0_2:
v_lshlrev_b64 v[3:4], 2, v[1:2]
v_add_nc_u32_e32 v1, s1, v1
s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
v_add_co_u32 v5, vcc_lo, s4, v3
v_add_co_ci_u32_e32 v6, vcc_lo, s5, v4, vcc_lo
v_add_co_u32 v3, s0, s6, v3
s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
v_add_co_ci_u32_e64 v4, s0, s7, v4, s0
global_load_b32 v5, v[5:6], off
s_waitcnt vmcnt(0)
v_cvt_f32_i32_e32 v5, v5
v_add_f32_e32 v5, v0, v5
s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
v_cmp_gt_f32_e32 vcc_lo, 0x800000, v5
v_cndmask_b32_e64 v6, 1.0, 0x4f800000, vcc_lo
v_mul_f32_e32 v5, v5, v6
s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
v_log_f32_e32 v5, v5
s_waitcnt_depctr 0xfff
v_mul_f32_e32 v6, 0x3f317217, v5
v_fma_f32 v7, v5, 0x3f317217, -v6
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_fmac_f32_e32 v7, 0x3377d1cf, v5
v_add_f32_e32 v6, v6, v7
v_cndmask_b32_e64 v7, 0, 0x41b17218, vcc_lo
v_cmp_gt_f32_e64 vcc_lo, 0x7f800000, |v5|
s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_2)
v_cndmask_b32_e32 v5, v5, v6, vcc_lo
v_cmp_le_u32_e32 vcc_lo, s8, v1
v_sub_f32_e32 v5, v5, v7
s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_1)
s_or_b32 s2, vcc_lo, s2
v_cvt_i32_f32_e32 v5, v5
global_store_b32 v[3:4], v5, off
s_and_not1_b32 exec_lo, exec_lo, s2
s_cbranch_execnz .LBB0_2
.LBB0_3:
s_set_inst_prefetch_distance 0x2
s_nop 0
s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
s_endpgm
.section .rodata,"a",@progbits
.p2align 6, 0x0
.amdhsa_kernel _Z22kernel_log_full_devicePiS_ji
.amdhsa_group_segment_fixed_size 0
.amdhsa_private_segment_fixed_size 0
.amdhsa_kernarg_size 280
.amdhsa_user_sgpr_count 15
.amdhsa_user_sgpr_dispatch_ptr 0
.amdhsa_user_sgpr_queue_ptr 0
.amdhsa_user_sgpr_kernarg_segment_ptr 1
.amdhsa_user_sgpr_dispatch_id 0
.amdhsa_user_sgpr_private_segment_size 0
.amdhsa_wavefront_size32 1
.amdhsa_uses_dynamic_stack 0
.amdhsa_enable_private_segment 0
.amdhsa_system_sgpr_workgroup_id_x 1
.amdhsa_system_sgpr_workgroup_id_y 0
.amdhsa_system_sgpr_workgroup_id_z 0
.amdhsa_system_sgpr_workgroup_info 0
.amdhsa_system_vgpr_workitem_id 0
.amdhsa_next_free_vgpr 8
.amdhsa_next_free_sgpr 16
.amdhsa_float_round_mode_32 0
.amdhsa_float_round_mode_16_64 0
.amdhsa_float_denorm_mode_32 3
.amdhsa_float_denorm_mode_16_64 3
.amdhsa_dx10_clamp 1
.amdhsa_ieee_mode 1
.amdhsa_fp16_overflow 0
.amdhsa_workgroup_processor_mode 1
.amdhsa_memory_ordered 1
.amdhsa_forward_progress 0
.amdhsa_shared_vgpr_count 0
.amdhsa_exception_fp_ieee_invalid_op 0
.amdhsa_exception_fp_denorm_src 0
.amdhsa_exception_fp_ieee_div_zero 0
.amdhsa_exception_fp_ieee_overflow 0
.amdhsa_exception_fp_ieee_underflow 0
.amdhsa_exception_fp_ieee_inexact 0
.amdhsa_exception_int_div_zero 0
.end_amdhsa_kernel
.text
.Lfunc_end0:
.size _Z22kernel_log_full_devicePiS_ji, .Lfunc_end0-_Z22kernel_log_full_devicePiS_ji
.section .AMDGPU.csdata,"",@progbits
.text
.p2alignl 7, 3214868480
.fill 96, 4, 3214868480
.type __hip_cuid_,@object
.section .bss,"aw",@nobits
.globl __hip_cuid_
__hip_cuid_:
.byte 0
.size __hip_cuid_, 1
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym __hip_cuid_
.amdgpu_metadata
---
amdhsa.kernels:
- .args:
- .address_space: global
.offset: 0
.size: 8
.value_kind: global_buffer
- .address_space: global
.offset: 8
.size: 8
.value_kind: global_buffer
- .offset: 16
.size: 4
.value_kind: by_value
- .offset: 20
.size: 4
.value_kind: by_value
- .offset: 24
.size: 4
.value_kind: hidden_block_count_x
- .offset: 28
.size: 4
.value_kind: hidden_block_count_y
- .offset: 32
.size: 4
.value_kind: hidden_block_count_z
- .offset: 36
.size: 2
.value_kind: hidden_group_size_x
- .offset: 38
.size: 2
.value_kind: hidden_group_size_y
- .offset: 40
.size: 2
.value_kind: hidden_group_size_z
- .offset: 42
.size: 2
.value_kind: hidden_remainder_x
- .offset: 44
.size: 2
.value_kind: hidden_remainder_y
- .offset: 46
.size: 2
.value_kind: hidden_remainder_z
- .offset: 64
.size: 8
.value_kind: hidden_global_offset_x
- .offset: 72
.size: 8
.value_kind: hidden_global_offset_y
- .offset: 80
.size: 8
.value_kind: hidden_global_offset_z
- .offset: 88
.size: 2
.value_kind: hidden_grid_dims
.group_segment_fixed_size: 0
.kernarg_segment_align: 8
.kernarg_segment_size: 280
.language: OpenCL C
.language_version:
- 2
- 0
.max_flat_workgroup_size: 1024
.name: _Z22kernel_log_full_devicePiS_ji
.private_segment_fixed_size: 0
.sgpr_count: 18
.sgpr_spill_count: 0
.symbol: _Z22kernel_log_full_devicePiS_ji.kd
.uniform_work_group_size: 1
.uses_dynamic_stack: false
.vgpr_count: 8
.vgpr_spill_count: 0
.wavefront_size: 32
.workgroup_processor_mode: 1
amdhsa.target: amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
- 1
- 2
...
.end_amdgpu_metadata |
You are a helpful coding assistant specialized in converting from CUDA host assembly to AMD host assembly. | .file "tmpxft_0015782b_00000000-6_kernel_log_full_device.cudafe1.cpp"
.text
#APP
#NO_APP
.type _ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3493:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaUnregisterFatBinary@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE3493:
.size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
.globl _Z46__device_stub__Z22kernel_log_full_devicePiS_jiPiS_ji
.type _Z46__device_stub__Z22kernel_log_full_devicePiS_jiPiS_ji, @function
_Z46__device_stub__Z22kernel_log_full_devicePiS_jiPiS_ji:
.LFB3515:
.cfi_startproc
endbr64
subq $152, %rsp
.cfi_def_cfa_offset 160
movq %rdi, 24(%rsp)
movq %rsi, 16(%rsp)
movl %edx, 12(%rsp)
movl %ecx, 8(%rsp)
movq %fs:40, %rax
movq %rax, 136(%rsp)
xorl %eax, %eax
leaq 24(%rsp), %rax
movq %rax, 96(%rsp)
leaq 16(%rsp), %rax
movq %rax, 104(%rsp)
leaq 12(%rsp), %rax
movq %rax, 112(%rsp)
leaq 8(%rsp), %rax
movq %rax, 120(%rsp)
movl $1, 48(%rsp)
movl $1, 52(%rsp)
movl $1, 56(%rsp)
movl $1, 60(%rsp)
movl $1, 64(%rsp)
movl $1, 68(%rsp)
leaq 40(%rsp), %rcx
leaq 32(%rsp), %rdx
leaq 60(%rsp), %rsi
leaq 48(%rsp), %rdi
call __cudaPopCallConfiguration@PLT
testl %eax, %eax
je .L7
.L3:
movq 136(%rsp), %rax
subq %fs:40, %rax
jne .L8
addq $152, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 8
ret
.L7:
.cfi_restore_state
pushq 40(%rsp)
.cfi_def_cfa_offset 168
pushq 40(%rsp)
.cfi_def_cfa_offset 176
leaq 112(%rsp), %r9
movq 76(%rsp), %rcx
movl 84(%rsp), %r8d
movq 64(%rsp), %rsi
movl 72(%rsp), %edx
leaq _Z22kernel_log_full_devicePiS_ji(%rip), %rdi
call cudaLaunchKernel@PLT
addq $16, %rsp
.cfi_def_cfa_offset 160
jmp .L3
.L8:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE3515:
.size _Z46__device_stub__Z22kernel_log_full_devicePiS_jiPiS_ji, .-_Z46__device_stub__Z22kernel_log_full_devicePiS_jiPiS_ji
.globl _Z22kernel_log_full_devicePiS_ji
.type _Z22kernel_log_full_devicePiS_ji, @function
_Z22kernel_log_full_devicePiS_ji:
.LFB3516:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
call _Z46__device_stub__Z22kernel_log_full_devicePiS_jiPiS_ji
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE3516:
.size _Z22kernel_log_full_devicePiS_ji, .-_Z22kernel_log_full_devicePiS_ji
.section .rodata.str1.8,"aMS",@progbits,1
.align 8
.LC0:
.string "_Z22kernel_log_full_devicePiS_ji"
.text
.type _ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3518:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
leaq _ZL15__fatDeviceText(%rip), %rdi
call __cudaRegisterFatBinary@PLT
movq %rax, %rdi
movq %rax, _ZL20__cudaFatCubinHandle(%rip)
pushq $0
.cfi_def_cfa_offset 24
pushq $0
.cfi_def_cfa_offset 32
pushq $0
.cfi_def_cfa_offset 40
pushq $0
.cfi_def_cfa_offset 48
movl $0, %r9d
movl $-1, %r8d
leaq .LC0(%rip), %rdx
movq %rdx, %rcx
leaq _Z22kernel_log_full_devicePiS_ji(%rip), %rsi
call __cudaRegisterFunction@PLT
addq $32, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaRegisterFatBinaryEnd@PLT
leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
call atexit@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE3518:
.size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
.section .init_array,"aw"
.align 8
.quad _ZL24__sti____cudaRegisterAllv
.section .nvFatBinSegment,"aw"
.align 8
.type _ZL15__fatDeviceText, @object
.size _ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
.long 1180844977
.long 1
.quad fatbinData
.quad 0
.local _ZL20__cudaFatCubinHandle
.comm _ZL20__cudaFatCubinHandle,8,8
.ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
.section .note.GNU-stack,"",@progbits
.section .note.gnu.property,"a"
.align 8
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.string "GNU"
1:
.align 8
.long 0xc0000002
.long 3f - 2f
2:
.long 0x3
3:
.align 8
4: | .text
.file "kernel_log_full_device.hip"
.globl _Z37__device_stub__kernel_log_full_devicePiS_ji # -- Begin function _Z37__device_stub__kernel_log_full_devicePiS_ji
.p2align 4, 0x90
.type _Z37__device_stub__kernel_log_full_devicePiS_ji,@function
_Z37__device_stub__kernel_log_full_devicePiS_ji: # @_Z37__device_stub__kernel_log_full_devicePiS_ji
.cfi_startproc
# %bb.0:
subq $120, %rsp
.cfi_def_cfa_offset 128
movq %rdi, 72(%rsp)
movq %rsi, 64(%rsp)
movl %edx, 12(%rsp)
movl %ecx, 8(%rsp)
leaq 72(%rsp), %rax
movq %rax, 80(%rsp)
leaq 64(%rsp), %rax
movq %rax, 88(%rsp)
leaq 12(%rsp), %rax
movq %rax, 96(%rsp)
leaq 8(%rsp), %rax
movq %rax, 104(%rsp)
leaq 48(%rsp), %rdi
leaq 32(%rsp), %rsi
leaq 24(%rsp), %rdx
leaq 16(%rsp), %rcx
callq __hipPopCallConfiguration
movq 48(%rsp), %rsi
movl 56(%rsp), %edx
movq 32(%rsp), %rcx
movl 40(%rsp), %r8d
leaq 80(%rsp), %r9
movl $_Z22kernel_log_full_devicePiS_ji, %edi
pushq 16(%rsp)
.cfi_adjust_cfa_offset 8
pushq 32(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $136, %rsp
.cfi_adjust_cfa_offset -136
retq
.Lfunc_end0:
.size _Z37__device_stub__kernel_log_full_devicePiS_ji, .Lfunc_end0-_Z37__device_stub__kernel_log_full_devicePiS_ji
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_ctor
.type __hip_module_ctor,@function
__hip_module_ctor: # @__hip_module_ctor
.cfi_startproc
# %bb.0:
subq $40, %rsp
.cfi_def_cfa_offset 48
cmpq $0, __hip_gpubin_handle(%rip)
jne .LBB1_2
# %bb.1:
movl $__hip_fatbin_wrapper, %edi
callq __hipRegisterFatBinary
movq %rax, __hip_gpubin_handle(%rip)
.LBB1_2:
movq __hip_gpubin_handle(%rip), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 16(%rsp)
movups %xmm0, (%rsp)
movl $_Z22kernel_log_full_devicePiS_ji, %esi
movl $.L__unnamed_1, %edx
movl $.L__unnamed_1, %ecx
movl $-1, %r8d
xorl %r9d, %r9d
callq __hipRegisterFunction
movl $__hip_module_dtor, %edi
addq $40, %rsp
.cfi_def_cfa_offset 8
jmp atexit # TAILCALL
.Lfunc_end1:
.size __hip_module_ctor, .Lfunc_end1-__hip_module_ctor
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_dtor
.type __hip_module_dtor,@function
__hip_module_dtor: # @__hip_module_dtor
.cfi_startproc
# %bb.0:
movq __hip_gpubin_handle(%rip), %rdi
testq %rdi, %rdi
je .LBB2_2
# %bb.1:
pushq %rax
.cfi_def_cfa_offset 16
callq __hipUnregisterFatBinary
movq $0, __hip_gpubin_handle(%rip)
addq $8, %rsp
.cfi_def_cfa_offset 8
.LBB2_2:
retq
.Lfunc_end2:
.size __hip_module_dtor, .Lfunc_end2-__hip_module_dtor
.cfi_endproc
# -- End function
.type _Z22kernel_log_full_devicePiS_ji,@object # @_Z22kernel_log_full_devicePiS_ji
.section .rodata,"a",@progbits
.globl _Z22kernel_log_full_devicePiS_ji
.p2align 3, 0x0
_Z22kernel_log_full_devicePiS_ji:
.quad _Z37__device_stub__kernel_log_full_devicePiS_ji
.size _Z22kernel_log_full_devicePiS_ji, 8
.type .L__unnamed_1,@object # @0
.section .rodata.str1.1,"aMS",@progbits,1
.L__unnamed_1:
.asciz "_Z22kernel_log_full_devicePiS_ji"
.size .L__unnamed_1, 33
.type __hip_fatbin_wrapper,@object # @__hip_fatbin_wrapper
.section .hipFatBinSegment,"a",@progbits
.p2align 3, 0x0
__hip_fatbin_wrapper:
.long 1212764230 # 0x48495046
.long 1 # 0x1
.quad __hip_fatbin
.quad 0
.size __hip_fatbin_wrapper, 24
.type __hip_gpubin_handle,@object # @__hip_gpubin_handle
.local __hip_gpubin_handle
.comm __hip_gpubin_handle,8,8
.section .init_array,"aw",@init_array
.p2align 3, 0x0
.quad __hip_module_ctor
.type __hip_cuid_,@object # @__hip_cuid_
.bss
.globl __hip_cuid_
__hip_cuid_:
.byte 0 # 0x0
.size __hip_cuid_, 1
.section ".linker-options","e",@llvm_linker_options
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym _Z37__device_stub__kernel_log_full_devicePiS_ji
.addrsig_sym __hip_module_ctor
.addrsig_sym __hip_module_dtor
.addrsig_sym _Z22kernel_log_full_devicePiS_ji
.addrsig_sym __hip_fatbin
.addrsig_sym __hip_fatbin_wrapper
.addrsig_sym __hip_cuid_ |
You are a helpful coding assistant specialized in converting CUDA source code to CUDA device assembly. | #include "includes.h"
__global__ void dot(float *a, float *b, float *c)
{
__shared__ float cache[threadsPerBlock];
int cacheIndex = threadIdx.x;
float temp = 0.0;
for (int tid = threadIdx.x + blockIdx.x*blockDim.x; tid<N; tid += blockDim.x*gridDim.x)
{
temp += a[tid]*b[tid];
}
cache[cacheIndex] = temp;
__syncthreads();
// reduction
for (int i = blockDim.x/2; i>0; i /= 2)
{
if (cacheIndex < i) cache[cacheIndex] += cache[cacheIndex + i];
__syncthreads();
}
if (threadIdx.x == 0) c[blockIdx.x] = cache[0];
} | code for sm_80
Function : _Z3dotPfS_S_
.headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)"
/*0000*/ MOV R1, c[0x0][0x28] ; /* 0x00000a0000017a02 */
/* 0x000fe40000000f00 */
/*0010*/ S2R R7, SR_CTAID.X ; /* 0x0000000000077919 */
/* 0x000e220000002500 */
/*0020*/ ULDC.64 UR6, c[0x0][0x118] ; /* 0x0000460000067ab9 */
/* 0x000fe20000000a00 */
/*0030*/ BSSY B0, 0x150 ; /* 0x0000011000007945 */
/* 0x000fe20003800000 */
/*0040*/ HFMA2.MMA R6, -RZ, RZ, 0, 0 ; /* 0x00000000ff067435 */
/* 0x000fe200000001ff */
/*0050*/ S2R R8, SR_TID.X ; /* 0x0000000000087919 */
/* 0x000e240000002100 */
/*0060*/ IMAD R0, R7, c[0x0][0x0], R8 ; /* 0x0000000007007a24 */
/* 0x001fca00078e0208 */
/*0070*/ ISETP.GT.AND P0, PT, R0, 0x13, PT ; /* 0x000000130000780c */
/* 0x000fda0003f04270 */
/*0080*/ @P0 BRA 0x140 ; /* 0x000000b000000947 */
/* 0x000fea0003800000 */
/*0090*/ IMAD.MOV.U32 R6, RZ, RZ, RZ ; /* 0x000000ffff067224 */
/* 0x000fe400078e00ff */
/*00a0*/ MOV R5, 0x4 ; /* 0x0000000400057802 */
/* 0x000fca0000000f00 */
/*00b0*/ IMAD.WIDE R2, R0, R5, c[0x0][0x160] ; /* 0x0000580000027625 */
/* 0x000fc800078e0205 */
/*00c0*/ IMAD.WIDE R4, R0, R5, c[0x0][0x168] ; /* 0x00005a0000047625 */
/* 0x000fe400078e0205 */
/*00d0*/ LDG.E R2, [R2.64] ; /* 0x0000000602027981 */
/* 0x000ea8000c1e1900 */
/*00e0*/ LDG.E R5, [R4.64] ; /* 0x0000000604057981 */
/* 0x000ea2000c1e1900 */
/*00f0*/ IMAD.MOV.U32 R9, RZ, RZ, c[0x0][0x0] ; /* 0x00000000ff097624 */
/* 0x000fc800078e00ff */
/*0100*/ IMAD R0, R9, c[0x0][0xc], R0 ; /* 0x0000030009007a24 */
/* 0x000fca00078e0200 */
/*0110*/ ISETP.GE.AND P0, PT, R0, 0x14, PT ; /* 0x000000140000780c */
/* 0x000fe20003f06270 */
/*0120*/ FFMA R6, R5, R2, R6 ; /* 0x0000000205067223 */
/* 0x004fd80000000006 */
/*0130*/ @!P0 BRA 0xa0 ; /* 0xffffff6000008947 */
/* 0x000fea000383ffff */
/*0140*/ BSYNC B0 ; /* 0x0000000000007941 */
/* 0x000fea0003800000 */
/*0150*/ ULDC UR4, c[0x0][0x0] ; /* 0x0000000000047ab9 */
/* 0x000fe20000000800 */
/*0160*/ STS [R8.X4], R6 ; /* 0x0000000608007388 */
/* 0x0001e20000004800 */
/*0170*/ USHF.R.U32.HI UR4, URZ, 0x1, UR4 ; /* 0x000000013f047899 */
/* 0x000fc60008011604 */
/*0180*/ BAR.SYNC.DEFER_BLOCKING 0x0 ; /* 0x0000000000007b1d */
/* 0x000fe20000010000 */
/*0190*/ ISETP.NE.AND P0, PT, R8, RZ, PT ; /* 0x000000ff0800720c */
/* 0x000fe40003f05270 */
/*01a0*/ ISETP.NE.AND P1, PT, RZ, UR4, PT ; /* 0x00000004ff007c0c */
/* 0x000fda000bf25270 */
/*01b0*/ @!P1 BRA 0x280 ; /* 0x000000c000009947 */
/* 0x000fea0003800000 */
/*01c0*/ SHF.L.U32 R0, R8, 0x2, RZ ; /* 0x0000000208007819 */
/* 0x001fe200000006ff */
/*01d0*/ IMAD.U32 R3, RZ, RZ, UR4 ; /* 0x00000004ff037e24 */
/* 0x000fca000f8e00ff */
/*01e0*/ ISETP.GE.AND P1, PT, R8, R3, PT ; /* 0x000000030800720c */
/* 0x000fda0003f26270 */
/*01f0*/ @!P1 LEA R2, R3, R0, 0x2 ; /* 0x0000000003029211 */
/* 0x000fe200078e10ff */
/*0200*/ @!P1 LDS R4, [R8.X4] ; /* 0x0000000008049984 */
/* 0x000fe20000004800 */
/*0210*/ SHF.R.U32.HI R3, RZ, 0x1, R3 ; /* 0x00000001ff037819 */
/* 0x000fc60000011603 */
/*0220*/ @!P1 LDS R5, [R2] ; /* 0x0000000002059984 */
/* 0x000e240000000800 */
/*0230*/ @!P1 FADD R4, R4, R5 ; /* 0x0000000504049221 */
/* 0x001fca0000000000 */
/*0240*/ @!P1 STS [R8.X4], R4 ; /* 0x0000000408009388 */
/* 0x0001e80000004800 */
/*0250*/ BAR.SYNC.DEFER_BLOCKING 0x0 ; /* 0x0000000000007b1d */
/* 0x000fe20000010000 */
/*0260*/ ISETP.NE.AND P1, PT, R3, RZ, PT ; /* 0x000000ff0300720c */
/* 0x000fda0003f25270 */
/*0270*/ @P1 BRA 0x1e0 ; /* 0xffffff6000001947 */
/* 0x001fea000383ffff */
/*0280*/ @P0 EXIT ; /* 0x000000000000094d */
/* 0x001fea0003800000 */
/*0290*/ LDS R5, [RZ] ; /* 0x00000000ff057984 */
/* 0x000e220000000800 */
/*02a0*/ IMAD.MOV.U32 R2, RZ, RZ, 0x4 ; /* 0x00000004ff027424 */
/* 0x000fc800078e00ff */
/*02b0*/ IMAD.WIDE.U32 R2, R7, R2, c[0x0][0x170] ; /* 0x00005c0007027625 */
/* 0x000fca00078e0002 */
/*02c0*/ STG.E [R2.64], R5 ; /* 0x0000000502007986 */
/* 0x001fe2000c101906 */
/*02d0*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*02e0*/ BRA 0x2e0; /* 0xfffffff000007947 */
/* 0x000fc0000383ffff */
/*02f0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0300*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0310*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0320*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0330*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0340*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0350*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0360*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0370*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
.......... |
You are a helpful coding assistant specialized in converting CUDA source code to CUDA host assembly. | #include "includes.h"
__global__ void dot(float *a, float *b, float *c)
{
__shared__ float cache[threadsPerBlock];
int cacheIndex = threadIdx.x;
float temp = 0.0;
for (int tid = threadIdx.x + blockIdx.x*blockDim.x; tid<N; tid += blockDim.x*gridDim.x)
{
temp += a[tid]*b[tid];
}
cache[cacheIndex] = temp;
__syncthreads();
// reduction
for (int i = blockDim.x/2; i>0; i /= 2)
{
if (cacheIndex < i) cache[cacheIndex] += cache[cacheIndex + i];
__syncthreads();
}
if (threadIdx.x == 0) c[blockIdx.x] = cache[0];
} | .file "tmpxft_0013a672_00000000-6_dot.cudafe1.cpp"
.text
#APP
#NO_APP
.type _ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2029:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaUnregisterFatBinary@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2029:
.size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
.globl _Z26__device_stub__Z3dotPfS_S_PfS_S_
.type _Z26__device_stub__Z3dotPfS_S_PfS_S_, @function
_Z26__device_stub__Z3dotPfS_S_PfS_S_:
.LFB2051:
.cfi_startproc
endbr64
subq $136, %rsp
.cfi_def_cfa_offset 144
movq %rdi, 24(%rsp)
movq %rsi, 16(%rsp)
movq %rdx, 8(%rsp)
movq %fs:40, %rax
movq %rax, 120(%rsp)
xorl %eax, %eax
leaq 24(%rsp), %rax
movq %rax, 96(%rsp)
leaq 16(%rsp), %rax
movq %rax, 104(%rsp)
leaq 8(%rsp), %rax
movq %rax, 112(%rsp)
movl $1, 48(%rsp)
movl $1, 52(%rsp)
movl $1, 56(%rsp)
movl $1, 60(%rsp)
movl $1, 64(%rsp)
movl $1, 68(%rsp)
leaq 40(%rsp), %rcx
leaq 32(%rsp), %rdx
leaq 60(%rsp), %rsi
leaq 48(%rsp), %rdi
call __cudaPopCallConfiguration@PLT
testl %eax, %eax
je .L7
.L3:
movq 120(%rsp), %rax
subq %fs:40, %rax
jne .L8
addq $136, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 8
ret
.L7:
.cfi_restore_state
pushq 40(%rsp)
.cfi_def_cfa_offset 152
pushq 40(%rsp)
.cfi_def_cfa_offset 160
leaq 112(%rsp), %r9
movq 76(%rsp), %rcx
movl 84(%rsp), %r8d
movq 64(%rsp), %rsi
movl 72(%rsp), %edx
leaq _Z3dotPfS_S_(%rip), %rdi
call cudaLaunchKernel@PLT
addq $16, %rsp
.cfi_def_cfa_offset 144
jmp .L3
.L8:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE2051:
.size _Z26__device_stub__Z3dotPfS_S_PfS_S_, .-_Z26__device_stub__Z3dotPfS_S_PfS_S_
.globl _Z3dotPfS_S_
.type _Z3dotPfS_S_, @function
_Z3dotPfS_S_:
.LFB2052:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
call _Z26__device_stub__Z3dotPfS_S_PfS_S_
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2052:
.size _Z3dotPfS_S_, .-_Z3dotPfS_S_
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "_Z3dotPfS_S_"
.text
.type _ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2054:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
leaq _ZL15__fatDeviceText(%rip), %rdi
call __cudaRegisterFatBinary@PLT
movq %rax, %rdi
movq %rax, _ZL20__cudaFatCubinHandle(%rip)
pushq $0
.cfi_def_cfa_offset 24
pushq $0
.cfi_def_cfa_offset 32
pushq $0
.cfi_def_cfa_offset 40
pushq $0
.cfi_def_cfa_offset 48
movl $0, %r9d
movl $-1, %r8d
leaq .LC0(%rip), %rdx
movq %rdx, %rcx
leaq _Z3dotPfS_S_(%rip), %rsi
call __cudaRegisterFunction@PLT
addq $32, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaRegisterFatBinaryEnd@PLT
leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
call atexit@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2054:
.size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
.section .init_array,"aw"
.align 8
.quad _ZL24__sti____cudaRegisterAllv
.section .nvFatBinSegment,"aw"
.align 8
.type _ZL15__fatDeviceText, @object
.size _ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
.long 1180844977
.long 1
.quad fatbinData
.quad 0
.local _ZL20__cudaFatCubinHandle
.comm _ZL20__cudaFatCubinHandle,8,8
.ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
.section .note.GNU-stack,"",@progbits
.section .note.gnu.property,"a"
.align 8
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.string "GNU"
1:
.align 8
.long 0xc0000002
.long 3f - 2f
2:
.long 0x3
3:
.align 8
4: |
You are a helpful coding assistant specialized in converting CUDA source code to HIP/AMD source code. | #include "includes.h"
__global__ void dot(float *a, float *b, float *c)
{
__shared__ float cache[threadsPerBlock];
int cacheIndex = threadIdx.x;
float temp = 0.0;
for (int tid = threadIdx.x + blockIdx.x*blockDim.x; tid<N; tid += blockDim.x*gridDim.x)
{
temp += a[tid]*b[tid];
}
cache[cacheIndex] = temp;
__syncthreads();
// reduction
for (int i = blockDim.x/2; i>0; i /= 2)
{
if (cacheIndex < i) cache[cacheIndex] += cache[cacheIndex + i];
__syncthreads();
}
if (threadIdx.x == 0) c[blockIdx.x] = cache[0];
} | #include <hip/hip_runtime.h>
#include "includes.h"
__global__ void dot(float *a, float *b, float *c)
{
__shared__ float cache[threadsPerBlock];
int cacheIndex = threadIdx.x;
float temp = 0.0;
for (int tid = threadIdx.x + blockIdx.x*blockDim.x; tid<N; tid += blockDim.x*gridDim.x)
{
temp += a[tid]*b[tid];
}
cache[cacheIndex] = temp;
__syncthreads();
// reduction
for (int i = blockDim.x/2; i>0; i /= 2)
{
if (cacheIndex < i) cache[cacheIndex] += cache[cacheIndex + i];
__syncthreads();
}
if (threadIdx.x == 0) c[blockIdx.x] = cache[0];
} |
You are a helpful coding assistant specialized in converting HIP source code to AMD device assembly. | #include <hip/hip_runtime.h>
#include "includes.h"
__global__ void dot(float *a, float *b, float *c)
{
__shared__ float cache[threadsPerBlock];
int cacheIndex = threadIdx.x;
float temp = 0.0;
for (int tid = threadIdx.x + blockIdx.x*blockDim.x; tid<N; tid += blockDim.x*gridDim.x)
{
temp += a[tid]*b[tid];
}
cache[cacheIndex] = temp;
__syncthreads();
// reduction
for (int i = blockDim.x/2; i>0; i /= 2)
{
if (cacheIndex < i) cache[cacheIndex] += cache[cacheIndex + i];
__syncthreads();
}
if (threadIdx.x == 0) c[blockIdx.x] = cache[0];
} | .text
.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
.protected _Z3dotPfS_S_
.globl _Z3dotPfS_S_
.p2align 8
.type _Z3dotPfS_S_,@function
_Z3dotPfS_S_:
s_load_b32 s3, s[0:1], 0x24
s_add_u32 s4, s0, 24
s_mov_b32 s2, s15
s_addc_u32 s5, s1, 0
v_mov_b32_e32 v3, 0
s_mov_b32 s8, exec_lo
s_waitcnt lgkmcnt(0)
s_and_b32 s3, s3, 0xffff
s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_mad_u64_u32 v[1:2], null, s2, s3, v[0:1]
v_cmpx_gt_i32_e32 20, v1
s_cbranch_execz .LBB0_4
s_load_b32 s10, s[4:5], 0x0
s_load_b128 s[4:7], s[0:1], 0x0
v_mov_b32_e32 v3, 0
s_mov_b32 s9, 0
s_waitcnt lgkmcnt(0)
s_mul_i32 s10, s10, s3
.p2align 6
.LBB0_2:
v_ashrrev_i32_e32 v2, 31, v1
s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
v_lshlrev_b64 v[4:5], 2, v[1:2]
v_add_nc_u32_e32 v1, s10, v1
v_add_co_u32 v6, vcc_lo, s4, v4
s_delay_alu instid0(VALU_DEP_3)
v_add_co_ci_u32_e32 v7, vcc_lo, s5, v5, vcc_lo
v_add_co_u32 v4, vcc_lo, s6, v4
v_add_co_ci_u32_e32 v5, vcc_lo, s7, v5, vcc_lo
v_cmp_lt_i32_e32 vcc_lo, 19, v1
global_load_b32 v2, v[6:7], off
global_load_b32 v4, v[4:5], off
s_or_b32 s9, vcc_lo, s9
s_waitcnt vmcnt(0)
v_fmac_f32_e32 v3, v2, v4
s_and_not1_b32 exec_lo, exec_lo, s9
s_cbranch_execnz .LBB0_2
s_or_b32 exec_lo, exec_lo, s9
.LBB0_4:
s_delay_alu instid0(SALU_CYCLE_1)
s_or_b32 exec_lo, exec_lo, s8
v_lshlrev_b32_e32 v1, 2, v0
s_cmp_lt_u32 s3, 2
ds_store_b32 v1, v3
s_waitcnt lgkmcnt(0)
s_barrier
s_branch .LBB0_6
.p2align 6
.LBB0_5:
s_or_b32 exec_lo, exec_lo, s5
s_waitcnt lgkmcnt(0)
s_barrier
s_cmp_lt_u32 s3, 4
s_mov_b32 s3, s4
.LBB0_6:
buffer_gl0_inv
s_cbranch_scc1 .LBB0_9
s_lshr_b32 s4, s3, 1
s_mov_b32 s5, exec_lo
v_cmpx_gt_u32_e64 s4, v0
s_cbranch_execz .LBB0_5
v_add_lshl_u32 v2, s4, v0, 2
ds_load_b32 v2, v2
ds_load_b32 v3, v1
s_waitcnt lgkmcnt(0)
v_add_f32_e32 v2, v2, v3
ds_store_b32 v1, v2
s_branch .LBB0_5
.LBB0_9:
s_mov_b32 s3, 0
s_mov_b32 s4, exec_lo
v_cmpx_eq_u32_e32 0, v0
s_cbranch_execz .LBB0_11
v_mov_b32_e32 v0, 0
s_load_b64 s[0:1], s[0:1], 0x10
s_lshl_b64 s[2:3], s[2:3], 2
ds_load_b32 v1, v0
s_waitcnt lgkmcnt(0)
s_add_u32 s0, s0, s2
s_addc_u32 s1, s1, s3
global_store_b32 v0, v1, s[0:1]
.LBB0_11:
s_nop 0
s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
s_endpgm
.section .rodata,"a",@progbits
.p2align 6, 0x0
.amdhsa_kernel _Z3dotPfS_S_
.amdhsa_group_segment_fixed_size 1024
.amdhsa_private_segment_fixed_size 0
.amdhsa_kernarg_size 280
.amdhsa_user_sgpr_count 15
.amdhsa_user_sgpr_dispatch_ptr 0
.amdhsa_user_sgpr_queue_ptr 0
.amdhsa_user_sgpr_kernarg_segment_ptr 1
.amdhsa_user_sgpr_dispatch_id 0
.amdhsa_user_sgpr_private_segment_size 0
.amdhsa_wavefront_size32 1
.amdhsa_uses_dynamic_stack 0
.amdhsa_enable_private_segment 0
.amdhsa_system_sgpr_workgroup_id_x 1
.amdhsa_system_sgpr_workgroup_id_y 0
.amdhsa_system_sgpr_workgroup_id_z 0
.amdhsa_system_sgpr_workgroup_info 0
.amdhsa_system_vgpr_workitem_id 0
.amdhsa_next_free_vgpr 8
.amdhsa_next_free_sgpr 16
.amdhsa_float_round_mode_32 0
.amdhsa_float_round_mode_16_64 0
.amdhsa_float_denorm_mode_32 3
.amdhsa_float_denorm_mode_16_64 3
.amdhsa_dx10_clamp 1
.amdhsa_ieee_mode 1
.amdhsa_fp16_overflow 0
.amdhsa_workgroup_processor_mode 1
.amdhsa_memory_ordered 1
.amdhsa_forward_progress 0
.amdhsa_shared_vgpr_count 0
.amdhsa_exception_fp_ieee_invalid_op 0
.amdhsa_exception_fp_denorm_src 0
.amdhsa_exception_fp_ieee_div_zero 0
.amdhsa_exception_fp_ieee_overflow 0
.amdhsa_exception_fp_ieee_underflow 0
.amdhsa_exception_fp_ieee_inexact 0
.amdhsa_exception_int_div_zero 0
.end_amdhsa_kernel
.text
.Lfunc_end0:
.size _Z3dotPfS_S_, .Lfunc_end0-_Z3dotPfS_S_
.section .AMDGPU.csdata,"",@progbits
.text
.p2alignl 7, 3214868480
.fill 96, 4, 3214868480
.type __hip_cuid_,@object
.section .bss,"aw",@nobits
.globl __hip_cuid_
__hip_cuid_:
.byte 0
.size __hip_cuid_, 1
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym __hip_cuid_
.amdgpu_metadata
---
amdhsa.kernels:
- .args:
- .address_space: global
.offset: 0
.size: 8
.value_kind: global_buffer
- .address_space: global
.offset: 8
.size: 8
.value_kind: global_buffer
- .address_space: global
.offset: 16
.size: 8
.value_kind: global_buffer
- .offset: 24
.size: 4
.value_kind: hidden_block_count_x
- .offset: 28
.size: 4
.value_kind: hidden_block_count_y
- .offset: 32
.size: 4
.value_kind: hidden_block_count_z
- .offset: 36
.size: 2
.value_kind: hidden_group_size_x
- .offset: 38
.size: 2
.value_kind: hidden_group_size_y
- .offset: 40
.size: 2
.value_kind: hidden_group_size_z
- .offset: 42
.size: 2
.value_kind: hidden_remainder_x
- .offset: 44
.size: 2
.value_kind: hidden_remainder_y
- .offset: 46
.size: 2
.value_kind: hidden_remainder_z
- .offset: 64
.size: 8
.value_kind: hidden_global_offset_x
- .offset: 72
.size: 8
.value_kind: hidden_global_offset_y
- .offset: 80
.size: 8
.value_kind: hidden_global_offset_z
- .offset: 88
.size: 2
.value_kind: hidden_grid_dims
.group_segment_fixed_size: 1024
.kernarg_segment_align: 8
.kernarg_segment_size: 280
.language: OpenCL C
.language_version:
- 2
- 0
.max_flat_workgroup_size: 1024
.name: _Z3dotPfS_S_
.private_segment_fixed_size: 0
.sgpr_count: 18
.sgpr_spill_count: 0
.symbol: _Z3dotPfS_S_.kd
.uniform_work_group_size: 1
.uses_dynamic_stack: false
.vgpr_count: 8
.vgpr_spill_count: 0
.wavefront_size: 32
.workgroup_processor_mode: 1
amdhsa.target: amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
- 1
- 2
...
.end_amdgpu_metadata |
You are a helpful coding assistant specialized in converting HIP source code to AMD host assembly. | #include <hip/hip_runtime.h>
#include "includes.h"
__global__ void dot(float *a, float *b, float *c)
{
__shared__ float cache[threadsPerBlock];
int cacheIndex = threadIdx.x;
float temp = 0.0;
for (int tid = threadIdx.x + blockIdx.x*blockDim.x; tid<N; tid += blockDim.x*gridDim.x)
{
temp += a[tid]*b[tid];
}
cache[cacheIndex] = temp;
__syncthreads();
// reduction
for (int i = blockDim.x/2; i>0; i /= 2)
{
if (cacheIndex < i) cache[cacheIndex] += cache[cacheIndex + i];
__syncthreads();
}
if (threadIdx.x == 0) c[blockIdx.x] = cache[0];
} | .text
.file "dot.hip"
.globl _Z18__device_stub__dotPfS_S_ # -- Begin function _Z18__device_stub__dotPfS_S_
.p2align 4, 0x90
.type _Z18__device_stub__dotPfS_S_,@function
_Z18__device_stub__dotPfS_S_: # @_Z18__device_stub__dotPfS_S_
.cfi_startproc
# %bb.0:
subq $104, %rsp
.cfi_def_cfa_offset 112
movq %rdi, 72(%rsp)
movq %rsi, 64(%rsp)
movq %rdx, 56(%rsp)
leaq 72(%rsp), %rax
movq %rax, 80(%rsp)
leaq 64(%rsp), %rax
movq %rax, 88(%rsp)
leaq 56(%rsp), %rax
movq %rax, 96(%rsp)
leaq 40(%rsp), %rdi
leaq 24(%rsp), %rsi
leaq 16(%rsp), %rdx
leaq 8(%rsp), %rcx
callq __hipPopCallConfiguration
movq 40(%rsp), %rsi
movl 48(%rsp), %edx
movq 24(%rsp), %rcx
movl 32(%rsp), %r8d
leaq 80(%rsp), %r9
movl $_Z3dotPfS_S_, %edi
pushq 8(%rsp)
.cfi_adjust_cfa_offset 8
pushq 24(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $120, %rsp
.cfi_adjust_cfa_offset -120
retq
.Lfunc_end0:
.size _Z18__device_stub__dotPfS_S_, .Lfunc_end0-_Z18__device_stub__dotPfS_S_
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_ctor
.type __hip_module_ctor,@function
__hip_module_ctor: # @__hip_module_ctor
.cfi_startproc
# %bb.0:
subq $40, %rsp
.cfi_def_cfa_offset 48
cmpq $0, __hip_gpubin_handle(%rip)
jne .LBB1_2
# %bb.1:
movl $__hip_fatbin_wrapper, %edi
callq __hipRegisterFatBinary
movq %rax, __hip_gpubin_handle(%rip)
.LBB1_2:
movq __hip_gpubin_handle(%rip), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 16(%rsp)
movups %xmm0, (%rsp)
movl $_Z3dotPfS_S_, %esi
movl $.L__unnamed_1, %edx
movl $.L__unnamed_1, %ecx
movl $-1, %r8d
xorl %r9d, %r9d
callq __hipRegisterFunction
movl $__hip_module_dtor, %edi
addq $40, %rsp
.cfi_def_cfa_offset 8
jmp atexit # TAILCALL
.Lfunc_end1:
.size __hip_module_ctor, .Lfunc_end1-__hip_module_ctor
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_dtor
.type __hip_module_dtor,@function
__hip_module_dtor: # @__hip_module_dtor
.cfi_startproc
# %bb.0:
movq __hip_gpubin_handle(%rip), %rdi
testq %rdi, %rdi
je .LBB2_2
# %bb.1:
pushq %rax
.cfi_def_cfa_offset 16
callq __hipUnregisterFatBinary
movq $0, __hip_gpubin_handle(%rip)
addq $8, %rsp
.cfi_def_cfa_offset 8
.LBB2_2:
retq
.Lfunc_end2:
.size __hip_module_dtor, .Lfunc_end2-__hip_module_dtor
.cfi_endproc
# -- End function
.type _Z3dotPfS_S_,@object # @_Z3dotPfS_S_
.section .rodata,"a",@progbits
.globl _Z3dotPfS_S_
.p2align 3, 0x0
_Z3dotPfS_S_:
.quad _Z18__device_stub__dotPfS_S_
.size _Z3dotPfS_S_, 8
.type .L__unnamed_1,@object # @0
.section .rodata.str1.1,"aMS",@progbits,1
.L__unnamed_1:
.asciz "_Z3dotPfS_S_"
.size .L__unnamed_1, 13
.type __hip_fatbin_wrapper,@object # @__hip_fatbin_wrapper
.section .hipFatBinSegment,"a",@progbits
.p2align 3, 0x0
__hip_fatbin_wrapper:
.long 1212764230 # 0x48495046
.long 1 # 0x1
.quad __hip_fatbin
.quad 0
.size __hip_fatbin_wrapper, 24
.type __hip_gpubin_handle,@object # @__hip_gpubin_handle
.local __hip_gpubin_handle
.comm __hip_gpubin_handle,8,8
.section .init_array,"aw",@init_array
.p2align 3, 0x0
.quad __hip_module_ctor
.type __hip_cuid_,@object # @__hip_cuid_
.bss
.globl __hip_cuid_
__hip_cuid_:
.byte 0 # 0x0
.size __hip_cuid_, 1
.section ".linker-options","e",@llvm_linker_options
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym _Z18__device_stub__dotPfS_S_
.addrsig_sym __hip_module_ctor
.addrsig_sym __hip_module_dtor
.addrsig_sym _Z3dotPfS_S_
.addrsig_sym __hip_fatbin
.addrsig_sym __hip_fatbin_wrapper
.addrsig_sym __hip_cuid_ |
You are a helpful coding assistant specialized in converting from CUDA device assembly to AMD device assembly. | code for sm_80
Function : _Z3dotPfS_S_
.headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)"
/*0000*/ MOV R1, c[0x0][0x28] ; /* 0x00000a0000017a02 */
/* 0x000fe40000000f00 */
/*0010*/ S2R R7, SR_CTAID.X ; /* 0x0000000000077919 */
/* 0x000e220000002500 */
/*0020*/ ULDC.64 UR6, c[0x0][0x118] ; /* 0x0000460000067ab9 */
/* 0x000fe20000000a00 */
/*0030*/ BSSY B0, 0x150 ; /* 0x0000011000007945 */
/* 0x000fe20003800000 */
/*0040*/ HFMA2.MMA R6, -RZ, RZ, 0, 0 ; /* 0x00000000ff067435 */
/* 0x000fe200000001ff */
/*0050*/ S2R R8, SR_TID.X ; /* 0x0000000000087919 */
/* 0x000e240000002100 */
/*0060*/ IMAD R0, R7, c[0x0][0x0], R8 ; /* 0x0000000007007a24 */
/* 0x001fca00078e0208 */
/*0070*/ ISETP.GT.AND P0, PT, R0, 0x13, PT ; /* 0x000000130000780c */
/* 0x000fda0003f04270 */
/*0080*/ @P0 BRA 0x140 ; /* 0x000000b000000947 */
/* 0x000fea0003800000 */
/*0090*/ IMAD.MOV.U32 R6, RZ, RZ, RZ ; /* 0x000000ffff067224 */
/* 0x000fe400078e00ff */
/*00a0*/ MOV R5, 0x4 ; /* 0x0000000400057802 */
/* 0x000fca0000000f00 */
/*00b0*/ IMAD.WIDE R2, R0, R5, c[0x0][0x160] ; /* 0x0000580000027625 */
/* 0x000fc800078e0205 */
/*00c0*/ IMAD.WIDE R4, R0, R5, c[0x0][0x168] ; /* 0x00005a0000047625 */
/* 0x000fe400078e0205 */
/*00d0*/ LDG.E R2, [R2.64] ; /* 0x0000000602027981 */
/* 0x000ea8000c1e1900 */
/*00e0*/ LDG.E R5, [R4.64] ; /* 0x0000000604057981 */
/* 0x000ea2000c1e1900 */
/*00f0*/ IMAD.MOV.U32 R9, RZ, RZ, c[0x0][0x0] ; /* 0x00000000ff097624 */
/* 0x000fc800078e00ff */
/*0100*/ IMAD R0, R9, c[0x0][0xc], R0 ; /* 0x0000030009007a24 */
/* 0x000fca00078e0200 */
/*0110*/ ISETP.GE.AND P0, PT, R0, 0x14, PT ; /* 0x000000140000780c */
/* 0x000fe20003f06270 */
/*0120*/ FFMA R6, R5, R2, R6 ; /* 0x0000000205067223 */
/* 0x004fd80000000006 */
/*0130*/ @!P0 BRA 0xa0 ; /* 0xffffff6000008947 */
/* 0x000fea000383ffff */
/*0140*/ BSYNC B0 ; /* 0x0000000000007941 */
/* 0x000fea0003800000 */
/*0150*/ ULDC UR4, c[0x0][0x0] ; /* 0x0000000000047ab9 */
/* 0x000fe20000000800 */
/*0160*/ STS [R8.X4], R6 ; /* 0x0000000608007388 */
/* 0x0001e20000004800 */
/*0170*/ USHF.R.U32.HI UR4, URZ, 0x1, UR4 ; /* 0x000000013f047899 */
/* 0x000fc60008011604 */
/*0180*/ BAR.SYNC.DEFER_BLOCKING 0x0 ; /* 0x0000000000007b1d */
/* 0x000fe20000010000 */
/*0190*/ ISETP.NE.AND P0, PT, R8, RZ, PT ; /* 0x000000ff0800720c */
/* 0x000fe40003f05270 */
/*01a0*/ ISETP.NE.AND P1, PT, RZ, UR4, PT ; /* 0x00000004ff007c0c */
/* 0x000fda000bf25270 */
/*01b0*/ @!P1 BRA 0x280 ; /* 0x000000c000009947 */
/* 0x000fea0003800000 */
/*01c0*/ SHF.L.U32 R0, R8, 0x2, RZ ; /* 0x0000000208007819 */
/* 0x001fe200000006ff */
/*01d0*/ IMAD.U32 R3, RZ, RZ, UR4 ; /* 0x00000004ff037e24 */
/* 0x000fca000f8e00ff */
/*01e0*/ ISETP.GE.AND P1, PT, R8, R3, PT ; /* 0x000000030800720c */
/* 0x000fda0003f26270 */
/*01f0*/ @!P1 LEA R2, R3, R0, 0x2 ; /* 0x0000000003029211 */
/* 0x000fe200078e10ff */
/*0200*/ @!P1 LDS R4, [R8.X4] ; /* 0x0000000008049984 */
/* 0x000fe20000004800 */
/*0210*/ SHF.R.U32.HI R3, RZ, 0x1, R3 ; /* 0x00000001ff037819 */
/* 0x000fc60000011603 */
/*0220*/ @!P1 LDS R5, [R2] ; /* 0x0000000002059984 */
/* 0x000e240000000800 */
/*0230*/ @!P1 FADD R4, R4, R5 ; /* 0x0000000504049221 */
/* 0x001fca0000000000 */
/*0240*/ @!P1 STS [R8.X4], R4 ; /* 0x0000000408009388 */
/* 0x0001e80000004800 */
/*0250*/ BAR.SYNC.DEFER_BLOCKING 0x0 ; /* 0x0000000000007b1d */
/* 0x000fe20000010000 */
/*0260*/ ISETP.NE.AND P1, PT, R3, RZ, PT ; /* 0x000000ff0300720c */
/* 0x000fda0003f25270 */
/*0270*/ @P1 BRA 0x1e0 ; /* 0xffffff6000001947 */
/* 0x001fea000383ffff */
/*0280*/ @P0 EXIT ; /* 0x000000000000094d */
/* 0x001fea0003800000 */
/*0290*/ LDS R5, [RZ] ; /* 0x00000000ff057984 */
/* 0x000e220000000800 */
/*02a0*/ IMAD.MOV.U32 R2, RZ, RZ, 0x4 ; /* 0x00000004ff027424 */
/* 0x000fc800078e00ff */
/*02b0*/ IMAD.WIDE.U32 R2, R7, R2, c[0x0][0x170] ; /* 0x00005c0007027625 */
/* 0x000fca00078e0002 */
/*02c0*/ STG.E [R2.64], R5 ; /* 0x0000000502007986 */
/* 0x001fe2000c101906 */
/*02d0*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*02e0*/ BRA 0x2e0; /* 0xfffffff000007947 */
/* 0x000fc0000383ffff */
/*02f0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0300*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0310*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0320*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0330*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0340*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0350*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0360*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0370*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
.......... | .text
.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
.protected _Z3dotPfS_S_
.globl _Z3dotPfS_S_
.p2align 8
.type _Z3dotPfS_S_,@function
_Z3dotPfS_S_:
s_load_b32 s3, s[0:1], 0x24
s_add_u32 s4, s0, 24
s_mov_b32 s2, s15
s_addc_u32 s5, s1, 0
v_mov_b32_e32 v3, 0
s_mov_b32 s8, exec_lo
s_waitcnt lgkmcnt(0)
s_and_b32 s3, s3, 0xffff
s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_mad_u64_u32 v[1:2], null, s2, s3, v[0:1]
v_cmpx_gt_i32_e32 20, v1
s_cbranch_execz .LBB0_4
s_load_b32 s10, s[4:5], 0x0
s_load_b128 s[4:7], s[0:1], 0x0
v_mov_b32_e32 v3, 0
s_mov_b32 s9, 0
s_waitcnt lgkmcnt(0)
s_mul_i32 s10, s10, s3
.p2align 6
.LBB0_2:
v_ashrrev_i32_e32 v2, 31, v1
s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
v_lshlrev_b64 v[4:5], 2, v[1:2]
v_add_nc_u32_e32 v1, s10, v1
v_add_co_u32 v6, vcc_lo, s4, v4
s_delay_alu instid0(VALU_DEP_3)
v_add_co_ci_u32_e32 v7, vcc_lo, s5, v5, vcc_lo
v_add_co_u32 v4, vcc_lo, s6, v4
v_add_co_ci_u32_e32 v5, vcc_lo, s7, v5, vcc_lo
v_cmp_lt_i32_e32 vcc_lo, 19, v1
global_load_b32 v2, v[6:7], off
global_load_b32 v4, v[4:5], off
s_or_b32 s9, vcc_lo, s9
s_waitcnt vmcnt(0)
v_fmac_f32_e32 v3, v2, v4
s_and_not1_b32 exec_lo, exec_lo, s9
s_cbranch_execnz .LBB0_2
s_or_b32 exec_lo, exec_lo, s9
.LBB0_4:
s_delay_alu instid0(SALU_CYCLE_1)
s_or_b32 exec_lo, exec_lo, s8
v_lshlrev_b32_e32 v1, 2, v0
s_cmp_lt_u32 s3, 2
ds_store_b32 v1, v3
s_waitcnt lgkmcnt(0)
s_barrier
s_branch .LBB0_6
.p2align 6
.LBB0_5:
s_or_b32 exec_lo, exec_lo, s5
s_waitcnt lgkmcnt(0)
s_barrier
s_cmp_lt_u32 s3, 4
s_mov_b32 s3, s4
.LBB0_6:
buffer_gl0_inv
s_cbranch_scc1 .LBB0_9
s_lshr_b32 s4, s3, 1
s_mov_b32 s5, exec_lo
v_cmpx_gt_u32_e64 s4, v0
s_cbranch_execz .LBB0_5
v_add_lshl_u32 v2, s4, v0, 2
ds_load_b32 v2, v2
ds_load_b32 v3, v1
s_waitcnt lgkmcnt(0)
v_add_f32_e32 v2, v2, v3
ds_store_b32 v1, v2
s_branch .LBB0_5
.LBB0_9:
s_mov_b32 s3, 0
s_mov_b32 s4, exec_lo
v_cmpx_eq_u32_e32 0, v0
s_cbranch_execz .LBB0_11
v_mov_b32_e32 v0, 0
s_load_b64 s[0:1], s[0:1], 0x10
s_lshl_b64 s[2:3], s[2:3], 2
ds_load_b32 v1, v0
s_waitcnt lgkmcnt(0)
s_add_u32 s0, s0, s2
s_addc_u32 s1, s1, s3
global_store_b32 v0, v1, s[0:1]
.LBB0_11:
s_nop 0
s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
s_endpgm
.section .rodata,"a",@progbits
.p2align 6, 0x0
.amdhsa_kernel _Z3dotPfS_S_
.amdhsa_group_segment_fixed_size 1024
.amdhsa_private_segment_fixed_size 0
.amdhsa_kernarg_size 280
.amdhsa_user_sgpr_count 15
.amdhsa_user_sgpr_dispatch_ptr 0
.amdhsa_user_sgpr_queue_ptr 0
.amdhsa_user_sgpr_kernarg_segment_ptr 1
.amdhsa_user_sgpr_dispatch_id 0
.amdhsa_user_sgpr_private_segment_size 0
.amdhsa_wavefront_size32 1
.amdhsa_uses_dynamic_stack 0
.amdhsa_enable_private_segment 0
.amdhsa_system_sgpr_workgroup_id_x 1
.amdhsa_system_sgpr_workgroup_id_y 0
.amdhsa_system_sgpr_workgroup_id_z 0
.amdhsa_system_sgpr_workgroup_info 0
.amdhsa_system_vgpr_workitem_id 0
.amdhsa_next_free_vgpr 8
.amdhsa_next_free_sgpr 16
.amdhsa_float_round_mode_32 0
.amdhsa_float_round_mode_16_64 0
.amdhsa_float_denorm_mode_32 3
.amdhsa_float_denorm_mode_16_64 3
.amdhsa_dx10_clamp 1
.amdhsa_ieee_mode 1
.amdhsa_fp16_overflow 0
.amdhsa_workgroup_processor_mode 1
.amdhsa_memory_ordered 1
.amdhsa_forward_progress 0
.amdhsa_shared_vgpr_count 0
.amdhsa_exception_fp_ieee_invalid_op 0
.amdhsa_exception_fp_denorm_src 0
.amdhsa_exception_fp_ieee_div_zero 0
.amdhsa_exception_fp_ieee_overflow 0
.amdhsa_exception_fp_ieee_underflow 0
.amdhsa_exception_fp_ieee_inexact 0
.amdhsa_exception_int_div_zero 0
.end_amdhsa_kernel
.text
.Lfunc_end0:
.size _Z3dotPfS_S_, .Lfunc_end0-_Z3dotPfS_S_
.section .AMDGPU.csdata,"",@progbits
.text
.p2alignl 7, 3214868480
.fill 96, 4, 3214868480
.type __hip_cuid_,@object
.section .bss,"aw",@nobits
.globl __hip_cuid_
__hip_cuid_:
.byte 0
.size __hip_cuid_, 1
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym __hip_cuid_
.amdgpu_metadata
---
amdhsa.kernels:
- .args:
- .address_space: global
.offset: 0
.size: 8
.value_kind: global_buffer
- .address_space: global
.offset: 8
.size: 8
.value_kind: global_buffer
- .address_space: global
.offset: 16
.size: 8
.value_kind: global_buffer
- .offset: 24
.size: 4
.value_kind: hidden_block_count_x
- .offset: 28
.size: 4
.value_kind: hidden_block_count_y
- .offset: 32
.size: 4
.value_kind: hidden_block_count_z
- .offset: 36
.size: 2
.value_kind: hidden_group_size_x
- .offset: 38
.size: 2
.value_kind: hidden_group_size_y
- .offset: 40
.size: 2
.value_kind: hidden_group_size_z
- .offset: 42
.size: 2
.value_kind: hidden_remainder_x
- .offset: 44
.size: 2
.value_kind: hidden_remainder_y
- .offset: 46
.size: 2
.value_kind: hidden_remainder_z
- .offset: 64
.size: 8
.value_kind: hidden_global_offset_x
- .offset: 72
.size: 8
.value_kind: hidden_global_offset_y
- .offset: 80
.size: 8
.value_kind: hidden_global_offset_z
- .offset: 88
.size: 2
.value_kind: hidden_grid_dims
.group_segment_fixed_size: 1024
.kernarg_segment_align: 8
.kernarg_segment_size: 280
.language: OpenCL C
.language_version:
- 2
- 0
.max_flat_workgroup_size: 1024
.name: _Z3dotPfS_S_
.private_segment_fixed_size: 0
.sgpr_count: 18
.sgpr_spill_count: 0
.symbol: _Z3dotPfS_S_.kd
.uniform_work_group_size: 1
.uses_dynamic_stack: false
.vgpr_count: 8
.vgpr_spill_count: 0
.wavefront_size: 32
.workgroup_processor_mode: 1
amdhsa.target: amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
- 1
- 2
...
.end_amdgpu_metadata |
You are a helpful coding assistant specialized in converting from CUDA host assembly to AMD host assembly. | .file "tmpxft_0013a672_00000000-6_dot.cudafe1.cpp"
.text
#APP
#NO_APP
.type _ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2029:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaUnregisterFatBinary@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2029:
.size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
.globl _Z26__device_stub__Z3dotPfS_S_PfS_S_
.type _Z26__device_stub__Z3dotPfS_S_PfS_S_, @function
_Z26__device_stub__Z3dotPfS_S_PfS_S_:
.LFB2051:
.cfi_startproc
endbr64
subq $136, %rsp
.cfi_def_cfa_offset 144
movq %rdi, 24(%rsp)
movq %rsi, 16(%rsp)
movq %rdx, 8(%rsp)
movq %fs:40, %rax
movq %rax, 120(%rsp)
xorl %eax, %eax
leaq 24(%rsp), %rax
movq %rax, 96(%rsp)
leaq 16(%rsp), %rax
movq %rax, 104(%rsp)
leaq 8(%rsp), %rax
movq %rax, 112(%rsp)
movl $1, 48(%rsp)
movl $1, 52(%rsp)
movl $1, 56(%rsp)
movl $1, 60(%rsp)
movl $1, 64(%rsp)
movl $1, 68(%rsp)
leaq 40(%rsp), %rcx
leaq 32(%rsp), %rdx
leaq 60(%rsp), %rsi
leaq 48(%rsp), %rdi
call __cudaPopCallConfiguration@PLT
testl %eax, %eax
je .L7
.L3:
movq 120(%rsp), %rax
subq %fs:40, %rax
jne .L8
addq $136, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 8
ret
.L7:
.cfi_restore_state
pushq 40(%rsp)
.cfi_def_cfa_offset 152
pushq 40(%rsp)
.cfi_def_cfa_offset 160
leaq 112(%rsp), %r9
movq 76(%rsp), %rcx
movl 84(%rsp), %r8d
movq 64(%rsp), %rsi
movl 72(%rsp), %edx
leaq _Z3dotPfS_S_(%rip), %rdi
call cudaLaunchKernel@PLT
addq $16, %rsp
.cfi_def_cfa_offset 144
jmp .L3
.L8:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE2051:
.size _Z26__device_stub__Z3dotPfS_S_PfS_S_, .-_Z26__device_stub__Z3dotPfS_S_PfS_S_
.globl _Z3dotPfS_S_
.type _Z3dotPfS_S_, @function
_Z3dotPfS_S_:
.LFB2052:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
call _Z26__device_stub__Z3dotPfS_S_PfS_S_
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2052:
.size _Z3dotPfS_S_, .-_Z3dotPfS_S_
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "_Z3dotPfS_S_"
.text
.type _ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2054:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
leaq _ZL15__fatDeviceText(%rip), %rdi
call __cudaRegisterFatBinary@PLT
movq %rax, %rdi
movq %rax, _ZL20__cudaFatCubinHandle(%rip)
pushq $0
.cfi_def_cfa_offset 24
pushq $0
.cfi_def_cfa_offset 32
pushq $0
.cfi_def_cfa_offset 40
pushq $0
.cfi_def_cfa_offset 48
movl $0, %r9d
movl $-1, %r8d
leaq .LC0(%rip), %rdx
movq %rdx, %rcx
leaq _Z3dotPfS_S_(%rip), %rsi
call __cudaRegisterFunction@PLT
addq $32, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaRegisterFatBinaryEnd@PLT
leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
call atexit@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2054:
.size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
.section .init_array,"aw"
.align 8
.quad _ZL24__sti____cudaRegisterAllv
.section .nvFatBinSegment,"aw"
.align 8
.type _ZL15__fatDeviceText, @object
.size _ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
.long 1180844977
.long 1
.quad fatbinData
.quad 0
.local _ZL20__cudaFatCubinHandle
.comm _ZL20__cudaFatCubinHandle,8,8
.ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
.section .note.GNU-stack,"",@progbits
.section .note.gnu.property,"a"
.align 8
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.string "GNU"
1:
.align 8
.long 0xc0000002
.long 3f - 2f
2:
.long 0x3
3:
.align 8
4: | .text
.file "dot.hip"
.globl _Z18__device_stub__dotPfS_S_ # -- Begin function _Z18__device_stub__dotPfS_S_
.p2align 4, 0x90
.type _Z18__device_stub__dotPfS_S_,@function
_Z18__device_stub__dotPfS_S_: # @_Z18__device_stub__dotPfS_S_
.cfi_startproc
# %bb.0:
subq $104, %rsp
.cfi_def_cfa_offset 112
movq %rdi, 72(%rsp)
movq %rsi, 64(%rsp)
movq %rdx, 56(%rsp)
leaq 72(%rsp), %rax
movq %rax, 80(%rsp)
leaq 64(%rsp), %rax
movq %rax, 88(%rsp)
leaq 56(%rsp), %rax
movq %rax, 96(%rsp)
leaq 40(%rsp), %rdi
leaq 24(%rsp), %rsi
leaq 16(%rsp), %rdx
leaq 8(%rsp), %rcx
callq __hipPopCallConfiguration
movq 40(%rsp), %rsi
movl 48(%rsp), %edx
movq 24(%rsp), %rcx
movl 32(%rsp), %r8d
leaq 80(%rsp), %r9
movl $_Z3dotPfS_S_, %edi
pushq 8(%rsp)
.cfi_adjust_cfa_offset 8
pushq 24(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $120, %rsp
.cfi_adjust_cfa_offset -120
retq
.Lfunc_end0:
.size _Z18__device_stub__dotPfS_S_, .Lfunc_end0-_Z18__device_stub__dotPfS_S_
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_ctor
.type __hip_module_ctor,@function
__hip_module_ctor: # @__hip_module_ctor
.cfi_startproc
# %bb.0:
subq $40, %rsp
.cfi_def_cfa_offset 48
cmpq $0, __hip_gpubin_handle(%rip)
jne .LBB1_2
# %bb.1:
movl $__hip_fatbin_wrapper, %edi
callq __hipRegisterFatBinary
movq %rax, __hip_gpubin_handle(%rip)
.LBB1_2:
movq __hip_gpubin_handle(%rip), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 16(%rsp)
movups %xmm0, (%rsp)
movl $_Z3dotPfS_S_, %esi
movl $.L__unnamed_1, %edx
movl $.L__unnamed_1, %ecx
movl $-1, %r8d
xorl %r9d, %r9d
callq __hipRegisterFunction
movl $__hip_module_dtor, %edi
addq $40, %rsp
.cfi_def_cfa_offset 8
jmp atexit # TAILCALL
.Lfunc_end1:
.size __hip_module_ctor, .Lfunc_end1-__hip_module_ctor
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_dtor
.type __hip_module_dtor,@function
__hip_module_dtor: # @__hip_module_dtor
.cfi_startproc
# %bb.0:
movq __hip_gpubin_handle(%rip), %rdi
testq %rdi, %rdi
je .LBB2_2
# %bb.1:
pushq %rax
.cfi_def_cfa_offset 16
callq __hipUnregisterFatBinary
movq $0, __hip_gpubin_handle(%rip)
addq $8, %rsp
.cfi_def_cfa_offset 8
.LBB2_2:
retq
.Lfunc_end2:
.size __hip_module_dtor, .Lfunc_end2-__hip_module_dtor
.cfi_endproc
# -- End function
.type _Z3dotPfS_S_,@object # @_Z3dotPfS_S_
.section .rodata,"a",@progbits
.globl _Z3dotPfS_S_
.p2align 3, 0x0
_Z3dotPfS_S_:
.quad _Z18__device_stub__dotPfS_S_
.size _Z3dotPfS_S_, 8
.type .L__unnamed_1,@object # @0
.section .rodata.str1.1,"aMS",@progbits,1
.L__unnamed_1:
.asciz "_Z3dotPfS_S_"
.size .L__unnamed_1, 13
.type __hip_fatbin_wrapper,@object # @__hip_fatbin_wrapper
.section .hipFatBinSegment,"a",@progbits
.p2align 3, 0x0
__hip_fatbin_wrapper:
.long 1212764230 # 0x48495046
.long 1 # 0x1
.quad __hip_fatbin
.quad 0
.size __hip_fatbin_wrapper, 24
.type __hip_gpubin_handle,@object # @__hip_gpubin_handle
.local __hip_gpubin_handle
.comm __hip_gpubin_handle,8,8
.section .init_array,"aw",@init_array
.p2align 3, 0x0
.quad __hip_module_ctor
.type __hip_cuid_,@object # @__hip_cuid_
.bss
.globl __hip_cuid_
__hip_cuid_:
.byte 0 # 0x0
.size __hip_cuid_, 1
.section ".linker-options","e",@llvm_linker_options
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym _Z18__device_stub__dotPfS_S_
.addrsig_sym __hip_module_ctor
.addrsig_sym __hip_module_dtor
.addrsig_sym _Z3dotPfS_S_
.addrsig_sym __hip_fatbin
.addrsig_sym __hip_fatbin_wrapper
.addrsig_sym __hip_cuid_ |
You are a helpful coding assistant specialized in converting CUDA source code to CUDA device assembly. | #include <stdlib.h>
#include <stdio.h>
__global__ void avg_kernel(double *heights,
int nx, int ny,
double Radius,
double *output){
int i,j, ind;
int ix, iy;
int ixmin, ixmax, iymin, iymax;
double h;
int N;
double ave;
i = blockIdx.x * blockDim.x + threadIdx.x;
j = blockIdx.y * blockDim.y + threadIdx.y;
// check the array boundaries
if (i >= nx || j >= ny) return;
ind = j * nx + i; // location in the array
h = heights[ind];
output [ind] = 0;
ixmin = max( i - int(Radius) , 0);
ixmax = min( i + int(Radius), nx-1);
iymin = max( j - int(Radius) , 0);
iymax = min( j + int(Radius), ny-1);
N=0;
ave = 0;
for(ix = ixmin; ix <= ixmax; ix++){
for(iy = iymin; iy <= iymax; iy++){
if ((ix-i)*(ix-i) + (iy-j)*(iy-j) <= Radius*Radius ){
N++;
ave = ave + heights[iy*nx+ix];
}
}
}
if (N > 0) output [ind] = ave/N;
return;
}
#define BLOCK_SIZE 16
extern "C"{
void avg_cuda(double *heights,
int nx,
int ny,
double r,
double *output){
dim3 nThreads(BLOCK_SIZE,BLOCK_SIZE);
dim3 nBlocks ( (nx-1)/BLOCK_SIZE + 1, (ny-1)/BLOCK_SIZE + 1);
double *d_heights;
double *d_output;
// allocate memory on GPU
cudaMalloc((void**) &d_heights, nx*ny * sizeof(double));
cudaMalloc((void**) &d_output, nx*ny * sizeof(double));
// copy input array:
cudaMemcpy(d_heights, heights, nx*ny*sizeof(double),cudaMemcpyHostToDevice);
// execute Kernel
avg_kernel<<<nBlocks,nThreads>>>(d_heights, nx, ny, r, d_output);
// copy output array back to the CPU
cudaMemcpy(output, d_output, nx*ny*sizeof(double),cudaMemcpyDeviceToHost);
// free the memory
cudaFree(d_heights);
cudaFree(d_output);
}
} | code for sm_80
Function : _Z10avg_kernelPdiidS_
.headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)"
/*0000*/ IMAD.MOV.U32 R1, RZ, RZ, c[0x0][0x28] ; /* 0x00000a00ff017624 */
/* 0x000fe400078e00ff */
/*0010*/ S2R R0, SR_CTAID.Y ; /* 0x0000000000007919 */
/* 0x000e280000002600 */
/*0020*/ S2R R5, SR_TID.Y ; /* 0x0000000000057919 */
/* 0x000e280000002200 */
/*0030*/ S2R R3, SR_CTAID.X ; /* 0x0000000000037919 */
/* 0x000e680000002500 */
/*0040*/ S2R R2, SR_TID.X ; /* 0x0000000000027919 */
/* 0x000e620000002100 */
/*0050*/ IMAD R0, R0, c[0x0][0x4], R5 ; /* 0x0000010000007a24 */
/* 0x001fca00078e0205 */
/*0060*/ ISETP.GE.AND P0, PT, R0, c[0x0][0x16c], PT ; /* 0x00005b0000007a0c */
/* 0x000fe20003f06270 */
/*0070*/ IMAD R3, R3, c[0x0][0x0], R2 ; /* 0x0000000003037a24 */
/* 0x002fca00078e0202 */
/*0080*/ ISETP.GE.OR P0, PT, R3, c[0x0][0x168], P0 ; /* 0x00005a0003007a0c */
/* 0x000fda0000706670 */
/*0090*/ @P0 EXIT ; /* 0x000000000000094d */
/* 0x000fea0003800000 */
/*00a0*/ F2I.F64.TRUNC R20, c[0x0][0x170] ; /* 0x00005c0000147b11 */
/* 0x000e22000030d100 */
/*00b0*/ IMAD.MOV.U32 R13, RZ, RZ, 0x8 ; /* 0x00000008ff0d7424 */
/* 0x000fe200078e00ff */
/*00c0*/ ULDC.64 UR6, c[0x0][0x118] ; /* 0x0000460000067ab9 */
/* 0x000fe20000000a00 */
/*00d0*/ IMAD R12, R0, c[0x0][0x168], R3 ; /* 0x00005a00000c7a24 */
/* 0x000fe200078e0203 */
/*00e0*/ BSSY B2, 0xa10 ; /* 0x0000092000027945 */
/* 0x000fe20003800000 */
/*00f0*/ IMAD.MOV.U32 R8, RZ, RZ, c[0x0][0x168] ; /* 0x00005a00ff087624 */
/* 0x000fe200078e00ff */
/*0100*/ CS2R R14, SRZ ; /* 0x00000000000e7805 */
/* 0x000fe2000001ff00 */
/*0110*/ IMAD.WIDE R12, R12, R13, c[0x0][0x178] ; /* 0x00005e000c0c7625 */
/* 0x000fc600078e020d */
/*0120*/ IADD3 R5, R8, -0x1, RZ ; /* 0xffffffff08057810 */
/* 0x000fe40007ffe0ff */
/*0130*/ STG.E.64 [R12.64], RZ ; /* 0x000000ff0c007986 */
/* 0x0003e2000c101b06 */
/*0140*/ IMAD.IADD R2, R3.reuse, 0x1, R20.reuse ; /* 0x0000000103027824 */
/* 0x141fe400078e0214 */
/*0150*/ IMAD.IADD R4, R3, 0x1, -R20 ; /* 0x0000000103047824 */
/* 0x000fc600078e0a14 */
/*0160*/ IMNMX R2, R2, R5, PT ; /* 0x0000000502027217 */
/* 0x000fe20003800200 */
/*0170*/ IMAD.IADD R5, R0, 0x1, -R20 ; /* 0x0000000100057824 */
/* 0x000fe200078e0a14 */
/*0180*/ IMNMX R6, RZ, R4, !PT ; /* 0x00000004ff067217 */
/* 0x000fe20007800200 */
/*0190*/ IMAD.MOV.U32 R4, RZ, RZ, RZ ; /* 0x000000ffff047224 */
/* 0x000fc600078e00ff */
/*01a0*/ ISETP.GT.AND P0, PT, R6, R2, PT ; /* 0x000000020600720c */
/* 0x000fe40003f04270 */
/*01b0*/ IMNMX R5, RZ, R5, !PT ; /* 0x00000005ff057217 */
/* 0x000fd60007800200 */
/*01c0*/ @P0 BRA 0xa00 ; /* 0x0000083000000947 */
/* 0x000fea0003800000 */
/*01d0*/ IMAD.IADD R20, R0, 0x1, R20 ; /* 0x0000000100147824 */
/* 0x002fe200078e0214 */
/*01e0*/ ULDC UR4, c[0x0][0x16c] ; /* 0x00005b0000047ab9 */
/* 0x000fe20000000800 */
/*01f0*/ LOP3.LUT R7, RZ, R5.reuse, RZ, 0x33, !PT ; /* 0x00000005ff077212 */
/* 0x080fe200078e33ff */
/*0200*/ UIADD3 UR5, -UR4, URZ, URZ ; /* 0x0000003f04057290 */
/* 0x000fe2000fffe13f */
/*0210*/ IADD3 R9, R5.reuse, 0x1, RZ ; /* 0x0000000105097810 */
/* 0x040fe20007ffe0ff */
/*0220*/ IMAD.MOV.U32 R16, RZ, RZ, c[0x0][0x170] ; /* 0x00005c00ff107624 */
/* 0x000fe200078e00ff */
/*0230*/ LOP3.LUT R4, RZ, R20, RZ, 0x33, !PT ; /* 0x00000014ff047212 */
/* 0x000fe200078e33ff */
/*0240*/ IMAD.MOV.U32 R17, RZ, RZ, c[0x0][0x174] ; /* 0x00005d00ff117624 */
/* 0x000fe200078e00ff */
/*0250*/ IADD3 R11, R5.reuse, 0x2, RZ ; /* 0x00000002050b7810 */
/* 0x040fe20007ffe0ff */
/*0260*/ UIADD3 UR4, UR4, -0x1, URZ ; /* 0xffffffff04047890 */
/* 0x000fe2000fffe03f */
/*0270*/ IMNMX R18, R4, UR5, !PT ; /* 0x0000000504127c17 */
/* 0x000fe2000f800200 */
/*0280*/ IMAD.IADD R10, R5, 0x1, -R0.reuse ; /* 0x00000001050a7824 */
/* 0x100fe200078e0a00 */
/*0290*/ CS2R R14, SRZ ; /* 0x00000000000e7805 */
/* 0x000fe2000001ff00 */
/*02a0*/ IMAD.IADD R22, R9, 0x1, -R0 ; /* 0x0000000109167824 */
/* 0x000fe200078e0a00 */
/*02b0*/ IADD3 R24, RZ, -R5, -R18.reuse ; /* 0x80000005ff187210 */
/* 0x100fe20007ffe812 */
/*02c0*/ IMAD.IADD R4, R7, 0x1, -R18 ; /* 0x0000000107047824 */
/* 0x000fe200078e0a12 */
/*02d0*/ DMUL R16, R16, c[0x0][0x170] ; /* 0x00005c0010107a28 */
/* 0x000e220000000000 */
/*02e0*/ IMAD R7, R5.reuse, R8, c[0x0][0x168] ; /* 0x00005a0005077624 */
/* 0x040fe200078e0208 */
/*02f0*/ IADD3 R8, R5, 0x3, RZ ; /* 0x0000000305087810 */
/* 0x000fe20007ffe0ff */
/*0300*/ IMAD.IADD R23, R11, 0x1, -R0 ; /* 0x000000010b177824 */
/* 0x000fe200078e0a00 */
/*0310*/ ISETP.GE.U32.AND P0, PT, R4, 0x3, PT ; /* 0x000000030400780c */
/* 0x000fe20003f06070 */
/*0320*/ HFMA2.MMA R4, -RZ, RZ, 0, 0 ; /* 0x00000000ff047435 */
/* 0x000fe200000001ff */
/*0330*/ IMAD R10, R10, R10, RZ ; /* 0x0000000a0a0a7224 */
/* 0x000fe200078e02ff */
/*0340*/ IADD3 R21, R7, c[0x0][0x168], RZ ; /* 0x00005a0007157a10 */
/* 0x000fe20007ffe0ff */
/*0350*/ IMAD R22, R22, R22, RZ ; /* 0x0000001616167224 */
/* 0x000fe200078e02ff */
/*0360*/ IMNMX R20, R20, UR4, PT ; /* 0x0000000414147c17 */
/* 0x000fe2000b800200 */
/*0370*/ IMAD R23, R23, R23, RZ ; /* 0x0000001717177224 */
/* 0x000fe200078e02ff */
/*0380*/ LOP3.LUT R24, R24, 0x3, RZ, 0xc0, !PT ; /* 0x0000000318187812 */
/* 0x001fc400078ec0ff */
/*0390*/ ISETP.GT.AND P1, PT, R5, R20, PT ; /* 0x000000140500720c */
/* 0x000fe20003f24270 */
/*03a0*/ BSSY B1, 0x9d0 ; /* 0x0000062000017945 */
/* 0x000fd80003800000 */
/*03b0*/ @P1 BRA 0x9c0 ; /* 0x0000060000001947 */
/* 0x003fea0003800000 */
/*03c0*/ ISETP.NE.AND P1, PT, R24, RZ, PT ; /* 0x000000ff1800720c */
/* 0x000fe20003f25270 */
/*03d0*/ IMAD.IADD R25, R6, 0x1, -R3 ; /* 0x0000000106197824 */
/* 0x000fe200078e0a03 */
/*03e0*/ BSSY B0, 0x6d0 ; /* 0x000002e000007945 */
/* 0x000fe20003800000 */
/*03f0*/ IMAD.MOV.U32 R27, RZ, RZ, R5 ; /* 0x000000ffff1b7224 */
/* 0x000fe400078e0005 */
/*0400*/ IMAD R25, R25, R25, RZ ; /* 0x0000001919197224 */
/* 0x000fd000078e02ff */
/*0410*/ @!P1 BRA 0x6c0 ; /* 0x000002a000009947 */
/* 0x000fea0003800000 */
/*0420*/ IMAD.IADD R18, R10, 0x1, R25 ; /* 0x000000010a127824 */
/* 0x000fe200078e0219 */
/*0430*/ BSSY B3, 0x4f0 ; /* 0x000000b000037945 */
/* 0x000fe20003800000 */
/*0440*/ ISETP.NE.AND P2, PT, R24, 0x1, PT ; /* 0x000000011800780c */
/* 0x000fc80003f45270 */
/*0450*/ I2F.F64 R18, R18 ; /* 0x0000001200127312 */
/* 0x000e240000201c00 */
/*0460*/ DSETP.GE.AND P1, PT, R16, R18, PT ; /* 0x000000121000722a */
/* 0x001e1c0003f26000 */
/*0470*/ @!P1 BRA 0x4e0 ; /* 0x0000006000009947 */
/* 0x001fea0003800000 */
/*0480*/ IMAD.MOV.U32 R19, RZ, RZ, 0x8 ; /* 0x00000008ff137424 */
/* 0x000fe400078e00ff */
/*0490*/ IMAD R18, R5, c[0x0][0x168], R6 ; /* 0x00005a0005127a24 */
/* 0x000fc800078e0206 */
/*04a0*/ IMAD.WIDE R18, R18, R19, c[0x0][0x160] ; /* 0x0000580012127625 */
/* 0x000fcc00078e0213 */
/*04b0*/ LDG.E.64 R18, [R18.64] ; /* 0x0000000612127981 */
/* 0x000ea2000c1e1b00 */
/*04c0*/ IADD3 R4, R4, 0x1, RZ ; /* 0x0000000104047810 */
/* 0x000fe20007ffe0ff */
/*04d0*/ DADD R14, R14, R18 ; /* 0x000000000e0e7229 */
/* 0x00404c0000000012 */
/*04e0*/ BSYNC B3 ; /* 0x0000000000037941 */
/* 0x000fea0003800000 */
/*04f0*/ IMAD.MOV.U32 R27, RZ, RZ, R9 ; /* 0x000000ffff1b7224 */
/* 0x000fe200078e0009 */
/*0500*/ @!P2 BRA 0x6c0 ; /* 0x000001b00000a947 */
/* 0x000fea0003800000 */
/*0510*/ IMAD.IADD R18, R22, 0x1, R25 ; /* 0x0000000116127824 */
/* 0x001fe200078e0219 */
/*0520*/ BSSY B3, 0x5e0 ; /* 0x000000b000037945 */
/* 0x000fe20003800000 */
/*0530*/ ISETP.NE.AND P2, PT, R24, 0x2, PT ; /* 0x000000021800780c */
/* 0x000fc80003f45270 */
/*0540*/ I2F.F64 R18, R18 ; /* 0x0000001200127312 */
/* 0x000e240000201c00 */
/*0550*/ DSETP.GE.AND P1, PT, R16, R18, PT ; /* 0x000000121000722a */
/* 0x001e1c0003f26000 */
/*0560*/ @!P1 BRA 0x5d0 ; /* 0x0000006000009947 */
/* 0x001fea0003800000 */
/*0570*/ IMAD.IADD R18, R7, 0x1, R6 ; /* 0x0000000107127824 */
/* 0x000fe400078e0206 */
/*0580*/ IMAD.MOV.U32 R19, RZ, RZ, 0x8 ; /* 0x00000008ff137424 */
/* 0x000fc800078e00ff */
/*0590*/ IMAD.WIDE R18, R18, R19, c[0x0][0x160] ; /* 0x0000580012127625 */
/* 0x000fcc00078e0213 */
/*05a0*/ LDG.E.64 R18, [R18.64] ; /* 0x0000000612127981 */
/* 0x000ea2000c1e1b00 */
/*05b0*/ IADD3 R4, R4, 0x1, RZ ; /* 0x0000000104047810 */
/* 0x000fe20007ffe0ff */
/*05c0*/ DADD R14, R14, R18 ; /* 0x000000000e0e7229 */
/* 0x00604c0000000012 */
/*05d0*/ BSYNC B3 ; /* 0x0000000000037941 */
/* 0x000fea0003800000 */
/*05e0*/ MOV R27, R11 ; /* 0x0000000b001b7202 */
/* 0x000fe20000000f00 */
/*05f0*/ @!P2 BRA 0x6c0 ; /* 0x000000c00000a947 */
/* 0x000fea0003800000 */
/*0600*/ IMAD.IADD R18, R23, 0x1, R25 ; /* 0x0000000117127824 */
/* 0x001fe400078e0219 */
/*0610*/ IMAD.MOV.U32 R27, RZ, RZ, R8 ; /* 0x000000ffff1b7224 */
/* 0x000fc800078e0008 */
/*0620*/ I2F.F64 R18, R18 ; /* 0x0000001200127312 */
/* 0x000e240000201c00 */
/*0630*/ DSETP.GE.AND P1, PT, R16, R18, PT ; /* 0x000000121000722a */
/* 0x001e1c0003f26000 */
/*0640*/ @!P1 BRA 0x6c0 ; /* 0x0000007000009947 */
/* 0x001fea0003800000 */
/*0650*/ IMAD.IADD R18, R21, 0x1, R6 ; /* 0x0000000115127824 */
/* 0x000fe400078e0206 */
/*0660*/ IMAD.MOV.U32 R19, RZ, RZ, 0x8 ; /* 0x00000008ff137424 */
/* 0x000fc800078e00ff */
/*0670*/ IMAD.WIDE R18, R18, R19, c[0x0][0x160] ; /* 0x0000580012127625 */
/* 0x000fcc00078e0213 */
/*0680*/ LDG.E.64 R18, [R18.64] ; /* 0x0000000612127981 */
/* 0x000ea2000c1e1b00 */
/*0690*/ IADD3 R4, R4, 0x1, RZ ; /* 0x0000000104047810 */
/* 0x000fe20007ffe0ff */
/*06a0*/ IMAD.MOV.U32 R27, RZ, RZ, R8 ; /* 0x000000ffff1b7224 */
/* 0x000fe200078e0008 */
/*06b0*/ DADD R14, R14, R18 ; /* 0x000000000e0e7229 */
/* 0x00604c0000000012 */
/*06c0*/ BSYNC B0 ; /* 0x0000000000007941 */
/* 0x000fea0003800000 */
/*06d0*/ @!P0 BRA 0x9c0 ; /* 0x000002e000008947 */
/* 0x000fea0003800000 */
/*06e0*/ IMAD.IADD R18, R27, 0x1, -R0 ; /* 0x000000011b127824 */
/* 0x001fc800078e0a00 */
/*06f0*/ IMAD R26, R18, R18, R25 ; /* 0x00000012121a7224 */
/* 0x000fc800078e0219 */
/*0700*/ I2F.F64 R18, R26 ; /* 0x0000001a00127312 */
/* 0x000e240000201c00 */
/*0710*/ DSETP.GE.AND P3, PT, R16, R18, PT ; /* 0x000000121000722a */
/* 0x001e1c0003f66000 */
/*0720*/ @P3 IMAD.MOV.U32 R29, RZ, RZ, 0x8 ; /* 0x00000008ff1d3424 */
/* 0x001fe400078e00ff */
/*0730*/ @P3 IMAD R28, R27, c[0x0][0x168], R6 ; /* 0x00005a001b1c3a24 */
/* 0x000fc800078e0206 */
/*0740*/ @P3 IMAD.WIDE R28, R28, R29, c[0x0][0x160] ; /* 0x000058001c1c3625 */
/* 0x000fca00078e021d */
/*0750*/ @P3 LDG.E.64 R18, [R28.64] ; /* 0x000000061c123981 */
/* 0x0000a4000c1e1b00 */
/*0760*/ IADD3 R29, R27, 0x1, RZ ; /* 0x000000011b1d7810 */
/* 0x001fe20007ffe0ff */
/*0770*/ @P3 DADD R14, R14, R18 ; /* 0x000000000e0e3229 */
/* 0x0061c80000000012 */
/*0780*/ IMAD.IADD R18, R29, 0x1, -R0 ; /* 0x000000011d127824 */
/* 0x001fc800078e0a00 */
/*0790*/ IMAD R26, R18, R18, R25 ; /* 0x00000012121a7224 */
/* 0x000fc800078e0219 */
/*07a0*/ I2F.F64 R18, R26 ; /* 0x0000001a00127312 */
/* 0x000e240000201c00 */
/*07b0*/ DSETP.GE.AND P4, PT, R16, R18, PT ; /* 0x000000121000722a */
/* 0x001e1c0003f86000 */
/*07c0*/ @P4 IMAD R18, R29, c[0x0][0x168], R6 ; /* 0x00005a001d124a24 */
/* 0x001fe400078e0206 */
/*07d0*/ @P4 IMAD.MOV.U32 R19, RZ, RZ, 0x8 ; /* 0x00000008ff134424 */
/* 0x000fc800078e00ff */
/*07e0*/ @P4 IMAD.WIDE R28, R18, R19, c[0x0][0x160] ; /* 0x00005800121c4625 */
/* 0x000fca00078e0213 */
/*07f0*/ @P4 LDG.E.64 R18, [R28.64] ; /* 0x000000061c124981 */
/* 0x0000a4000c1e1b00 */
/*0800*/ IADD3 R29, R27, 0x2, RZ ; /* 0x000000021b1d7810 */
/* 0x001fe20007ffe0ff */
/*0810*/ @P4 DADD R14, R14, R18 ; /* 0x000000000e0e4229 */
/* 0x0041c80000000012 */
/*0820*/ IMAD.IADD R18, R29, 0x1, -R0 ; /* 0x000000011d127824 */
/* 0x001fc800078e0a00 */
/*0830*/ IMAD R26, R18, R18, R25 ; /* 0x00000012121a7224 */
/* 0x000fc800078e0219 */
/*0840*/ I2F.F64 R18, R26 ; /* 0x0000001a00127312 */
/* 0x000e240000201c00 */
/*0850*/ DSETP.GE.AND P2, PT, R16, R18, PT ; /* 0x000000121000722a */
/* 0x001e1c0003f46000 */
/*0860*/ @P2 MOV R19, 0x8 ; /* 0x0000000800132802 */
/* 0x001fe20000000f00 */
/*0870*/ @P2 IMAD R18, R29, c[0x0][0x168], R6 ; /* 0x00005a001d122a24 */
/* 0x000fc800078e0206 */
/*0880*/ @P2 IMAD.WIDE R28, R18, R19, c[0x0][0x160] ; /* 0x00005800121c2625 */
/* 0x000fca00078e0213 */
/*0890*/ @P2 LDG.E.64 R18, [R28.64] ; /* 0x000000061c122981 */
/* 0x0000a4000c1e1b00 */
/*08a0*/ IADD3 R29, R27, 0x3, RZ ; /* 0x000000031b1d7810 */
/* 0x001fe20007ffe0ff */
/*08b0*/ @P2 DADD R14, R14, R18 ; /* 0x000000000e0e2229 */
/* 0x0041c80000000012 */
/*08c0*/ IMAD.IADD R18, R29, 0x1, -R0 ; /* 0x000000011d127824 */
/* 0x001fc800078e0a00 */
/*08d0*/ IMAD R26, R18, R18, R25 ; /* 0x00000012121a7224 */
/* 0x000fc800078e0219 */
/*08e0*/ I2F.F64 R18, R26 ; /* 0x0000001a00127312 */
/* 0x000e240000201c00 */
/*08f0*/ DSETP.GE.AND P1, PT, R16, R18, PT ; /* 0x000000121000722a */
/* 0x001e1c0003f26000 */
/*0900*/ @P1 IMAD.MOV.U32 R19, RZ, RZ, 0x8 ; /* 0x00000008ff131424 */
/* 0x001fe400078e00ff */
/*0910*/ @P1 IMAD R18, R29, c[0x0][0x168], R6 ; /* 0x00005a001d121a24 */
/* 0x000fc800078e0206 */
/*0920*/ @P1 IMAD.WIDE R18, R18, R19, c[0x0][0x160] ; /* 0x0000580012121625 */
/* 0x000fcc00078e0213 */
/*0930*/ @P1 LDG.E.64 R18, [R18.64] ; /* 0x0000000612121981 */
/* 0x000ea2000c1e1b00 */
/*0940*/ @P3 IADD3 R4, R4, 0x1, RZ ; /* 0x0000000104043810 */
/* 0x000fe40007ffe0ff */
/*0950*/ ISETP.GE.AND P3, PT, R29, R20, PT ; /* 0x000000141d00720c */
/* 0x000fe40003f66270 */
/*0960*/ @P4 IADD3 R4, R4, 0x1, RZ ; /* 0x0000000104044810 */
/* 0x000fe40007ffe0ff */
/*0970*/ IADD3 R27, R27, 0x4, RZ ; /* 0x000000041b1b7810 */
/* 0x000fe40007ffe0ff */
/*0980*/ @P2 IADD3 R4, R4, 0x1, RZ ; /* 0x0000000104042810 */
/* 0x000fc80007ffe0ff */
/*0990*/ @P1 IADD3 R4, R4, 0x1, RZ ; /* 0x0000000104041810 */
/* 0x000fe20007ffe0ff */
/*09a0*/ @P1 DADD R14, R14, R18 ; /* 0x000000000e0e1229 */
/* 0x0040640000000012 */
/*09b0*/ @!P3 BRA 0x6e0 ; /* 0xfffffd200000b947 */
/* 0x000fea000383ffff */
/*09c0*/ BSYNC B1 ; /* 0x0000000000017941 */
/* 0x000fea0003800000 */
/*09d0*/ ISETP.GE.AND P1, PT, R6.reuse, R2, PT ; /* 0x000000020600720c */
/* 0x040fe40003f26270 */
/*09e0*/ IADD3 R6, R6, 0x1, RZ ; /* 0x0000000106067810 */
/* 0x000fd60007ffe0ff */
/*09f0*/ @!P1 BRA 0x390 ; /* 0xfffff99000009947 */
/* 0x000fea000383ffff */
/*0a00*/ BSYNC B2 ; /* 0x0000000000027941 */
/* 0x002fea0003800000 */
/*0a10*/ ISETP.GE.AND P0, PT, R4, 0x1, PT ; /* 0x000000010400780c */
/* 0x000fda0003f06270 */
/*0a20*/ @!P0 EXIT ; /* 0x000000000000894d */
/* 0x000fea0003800000 */
/*0a30*/ I2F.F64 R6, R4 ; /* 0x0000000400067312 */
/* 0x000e620000201c00 */
/*0a40*/ IMAD.MOV.U32 R2, RZ, RZ, 0x1 ; /* 0x00000001ff027424 */
/* 0x000fe200078e00ff */
/*0a50*/ FSETP.GEU.AND P1, PT, |R15|, 6.5827683646048100446e-37, PT ; /* 0x036000000f00780b */
/* 0x000fe20003f2e200 */
/*0a60*/ BSSY B0, 0xba0 ; /* 0x0000013000007945 */
/* 0x000fea0003800000 */
/*0a70*/ MUFU.RCP64H R3, R7 ; /* 0x0000000700037308 */
/* 0x002e640000001800 */
/*0a80*/ DFMA R8, -R6, R2, 1 ; /* 0x3ff000000608742b */
/* 0x002e4c0000000102 */
/*0a90*/ DFMA R8, R8, R8, R8 ; /* 0x000000080808722b */
/* 0x002e4c0000000008 */
/*0aa0*/ DFMA R8, R2, R8, R2 ; /* 0x000000080208722b */
/* 0x002e4c0000000002 */
/*0ab0*/ DFMA R2, -R6, R8, 1 ; /* 0x3ff000000602742b */
/* 0x002e4c0000000108 */
/*0ac0*/ DFMA R2, R8, R2, R8 ; /* 0x000000020802722b */
/* 0x002e4c0000000008 */
/*0ad0*/ DMUL R8, R2, R14 ; /* 0x0000000e02087228 */
/* 0x002e4c0000000000 */
/*0ae0*/ DFMA R10, -R6, R8, R14 ; /* 0x00000008060a722b */
/* 0x002e4c000000010e */
/*0af0*/ DFMA R2, R2, R10, R8 ; /* 0x0000000a0202722b */
/* 0x002e540000000008 */
/*0b00*/ FFMA R0, RZ, R7, R3 ; /* 0x00000007ff007223 */
/* 0x002fca0000000003 */
/*0b10*/ FSETP.GT.AND P0, PT, |R0|, 1.469367938527859385e-39, PT ; /* 0x001000000000780b */
/* 0x000fda0003f04200 */
/*0b20*/ @P0 BRA P1, 0xb90 ; /* 0x0000006000000947 */
/* 0x000fea0000800000 */
/*0b30*/ IMAD.MOV.U32 R4, RZ, RZ, R14 ; /* 0x000000ffff047224 */
/* 0x000fe200078e000e */
/*0b40*/ MOV R0, 0xb70 ; /* 0x00000b7000007802 */
/* 0x000fe20000000f00 */
/*0b50*/ IMAD.MOV.U32 R5, RZ, RZ, R15 ; /* 0x000000ffff057224 */
/* 0x000fe400078e000f */
/*0b60*/ CALL.REL.NOINC 0xbc0 ; /* 0x0000005000007944 */
/* 0x001fea0003c00000 */
/*0b70*/ IMAD.MOV.U32 R2, RZ, RZ, R10 ; /* 0x000000ffff027224 */
/* 0x000fe400078e000a */
/*0b80*/ IMAD.MOV.U32 R3, RZ, RZ, R11 ; /* 0x000000ffff037224 */
/* 0x000fe400078e000b */
/*0b90*/ BSYNC B0 ; /* 0x0000000000007941 */
/* 0x000fea0003800000 */
/*0ba0*/ STG.E.64 [R12.64], R2 ; /* 0x000000020c007986 */
/* 0x000fe2000c101b06 */
/*0bb0*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*0bc0*/ FSETP.GEU.AND P0, PT, |R7|.reuse, 1.469367938527859385e-39, PT ; /* 0x001000000700780b */
/* 0x040fe20003f0e200 */
/*0bd0*/ IMAD.MOV.U32 R11, RZ, RZ, 0x1ca00000 ; /* 0x1ca00000ff0b7424 */
/* 0x000fe200078e00ff */
/*0be0*/ LOP3.LUT R2, R7, 0x800fffff, RZ, 0xc0, !PT ; /* 0x800fffff07027812 */
/* 0x000fe200078ec0ff */
/*0bf0*/ IMAD.MOV.U32 R16, RZ, RZ, 0x1 ; /* 0x00000001ff107424 */
/* 0x000fe200078e00ff */
/*0c00*/ FSETP.GEU.AND P2, PT, |R5|.reuse, 1.469367938527859385e-39, PT ; /* 0x001000000500780b */
/* 0x040fe20003f4e200 */
/*0c10*/ BSSY B1, 0x1160 ; /* 0x0000054000017945 */
/* 0x000fe20003800000 */
/*0c20*/ LOP3.LUT R3, R2, 0x3ff00000, RZ, 0xfc, !PT ; /* 0x3ff0000002037812 */
/* 0x000fe200078efcff */
/*0c30*/ IMAD.MOV.U32 R2, RZ, RZ, R6 ; /* 0x000000ffff027224 */
/* 0x000fe200078e0006 */
/*0c40*/ LOP3.LUT R10, R5, 0x7ff00000, RZ, 0xc0, !PT ; /* 0x7ff00000050a7812 */
/* 0x000fc400078ec0ff */
/*0c50*/ LOP3.LUT R15, R7, 0x7ff00000, RZ, 0xc0, !PT ; /* 0x7ff00000070f7812 */
/* 0x000fe400078ec0ff */
/*0c60*/ MOV R8, R4 ; /* 0x0000000400087202 */
/* 0x000fe20000000f00 */
/*0c70*/ @!P0 DMUL R2, R6, 8.98846567431157953865e+307 ; /* 0x7fe0000006028828 */
/* 0x000e220000000000 */
/*0c80*/ ISETP.GE.U32.AND P1, PT, R10, R15, PT ; /* 0x0000000f0a00720c */
/* 0x000fc60003f26070 */
/*0c90*/ @!P2 LOP3.LUT R9, R7, 0x7ff00000, RZ, 0xc0, !PT ; /* 0x7ff000000709a812 */
/* 0x000fe200078ec0ff */
/*0ca0*/ @!P2 IMAD.MOV.U32 R20, RZ, RZ, RZ ; /* 0x000000ffff14a224 */
/* 0x000fe200078e00ff */
/*0cb0*/ MUFU.RCP64H R17, R3 ; /* 0x0000000300117308 */
/* 0x001e240000001800 */
/*0cc0*/ @!P2 ISETP.GE.U32.AND P3, PT, R10, R9, PT ; /* 0x000000090a00a20c */
/* 0x000fe40003f66070 */
/*0cd0*/ SEL R9, R11.reuse, 0x63400000, !P1 ; /* 0x634000000b097807 */
/* 0x040fe40004800000 */
/*0ce0*/ @!P2 SEL R21, R11, 0x63400000, !P3 ; /* 0x634000000b15a807 */
/* 0x000fe40005800000 */
/*0cf0*/ LOP3.LUT R9, R9, 0x800fffff, R5, 0xf8, !PT ; /* 0x800fffff09097812 */
/* 0x000fc400078ef805 */
/*0d00*/ @!P2 LOP3.LUT R21, R21, 0x80000000, R5, 0xf8, !PT ; /* 0x800000001515a812 */
/* 0x000fc800078ef805 */
/*0d10*/ @!P2 LOP3.LUT R21, R21, 0x100000, RZ, 0xfc, !PT ; /* 0x001000001515a812 */
/* 0x000fe200078efcff */
/*0d20*/ DFMA R18, R16, -R2, 1 ; /* 0x3ff000001012742b */
/* 0x001e0a0000000802 */
/*0d30*/ @!P2 DFMA R8, R8, 2, -R20 ; /* 0x400000000808a82b */
/* 0x000fc80000000814 */
/*0d40*/ DFMA R18, R18, R18, R18 ; /* 0x000000121212722b */
/* 0x001e0c0000000012 */
/*0d50*/ DFMA R18, R16, R18, R16 ; /* 0x000000121012722b */
/* 0x0010640000000010 */
/*0d60*/ IMAD.MOV.U32 R16, RZ, RZ, R10 ; /* 0x000000ffff107224 */
/* 0x001fe200078e000a */
/*0d70*/ @!P2 LOP3.LUT R16, R9, 0x7ff00000, RZ, 0xc0, !PT ; /* 0x7ff000000910a812 */
/* 0x000fe200078ec0ff */
/*0d80*/ IMAD.MOV.U32 R17, RZ, RZ, R15 ; /* 0x000000ffff117224 */
/* 0x000fe200078e000f */
/*0d90*/ @!P0 LOP3.LUT R17, R3, 0x7ff00000, RZ, 0xc0, !PT ; /* 0x7ff0000003118812 */
/* 0x000fe200078ec0ff */
/*0da0*/ DFMA R20, R18, -R2, 1 ; /* 0x3ff000001214742b */
/* 0x002e060000000802 */
/*0db0*/ IADD3 R22, R17, -0x1, RZ ; /* 0xffffffff11167810 */
/* 0x000fc60007ffe0ff */
/*0dc0*/ DFMA R18, R18, R20, R18 ; /* 0x000000141212722b */
/* 0x0010640000000012 */
/*0dd0*/ IADD3 R20, R16, -0x1, RZ ; /* 0xffffffff10147810 */
/* 0x001fc80007ffe0ff */
/*0de0*/ ISETP.GT.U32.AND P0, PT, R20, 0x7feffffe, PT ; /* 0x7feffffe1400780c */
/* 0x000fe20003f04070 */
/*0df0*/ DMUL R14, R18, R8 ; /* 0x00000008120e7228 */
/* 0x002e060000000000 */
/*0e00*/ ISETP.GT.U32.OR P0, PT, R22, 0x7feffffe, P0 ; /* 0x7feffffe1600780c */
/* 0x000fc60000704470 */
/*0e10*/ DFMA R20, R14, -R2, R8 ; /* 0x800000020e14722b */
/* 0x001e0c0000000008 */
/*0e20*/ DFMA R14, R18, R20, R14 ; /* 0x00000014120e722b */
/* 0x001048000000000e */
/*0e30*/ @P0 BRA 0x1000 ; /* 0x000001c000000947 */
/* 0x000fea0003800000 */
/*0e40*/ LOP3.LUT R5, R7, 0x7ff00000, RZ, 0xc0, !PT ; /* 0x7ff0000007057812 */
/* 0x003fc800078ec0ff */
/*0e50*/ ISETP.GE.U32.AND P0, PT, R10.reuse, R5, PT ; /* 0x000000050a00720c */
/* 0x040fe20003f06070 */
/*0e60*/ IMAD.IADD R4, R10, 0x1, -R5 ; /* 0x000000010a047824 */
/* 0x000fc600078e0a05 */
/*0e70*/ SEL R11, R11, 0x63400000, !P0 ; /* 0x634000000b0b7807 */
/* 0x000fe40004000000 */
/*0e80*/ IMNMX R4, R4, -0x46a00000, !PT ; /* 0xb960000004047817 */
/* 0x000fc80007800200 */
/*0e90*/ IMNMX R4, R4, 0x46a00000, PT ; /* 0x46a0000004047817 */
/* 0x000fca0003800200 */
/*0ea0*/ IMAD.IADD R16, R4, 0x1, -R11 ; /* 0x0000000104107824 */
/* 0x000fe400078e0a0b */
/*0eb0*/ IMAD.MOV.U32 R4, RZ, RZ, RZ ; /* 0x000000ffff047224 */
/* 0x000fc600078e00ff */
/*0ec0*/ IADD3 R5, R16, 0x7fe00000, RZ ; /* 0x7fe0000010057810 */
/* 0x000fcc0007ffe0ff */
/*0ed0*/ DMUL R10, R14, R4 ; /* 0x000000040e0a7228 */
/* 0x000e140000000000 */
/*0ee0*/ FSETP.GTU.AND P0, PT, |R11|, 1.469367938527859385e-39, PT ; /* 0x001000000b00780b */
/* 0x001fda0003f0c200 */
/*0ef0*/ @P0 BRA 0x1150 ; /* 0x0000025000000947 */
/* 0x000fea0003800000 */
/*0f00*/ DFMA R2, R14, -R2, R8 ; /* 0x800000020e02722b */
/* 0x000e220000000008 */
/*0f10*/ IMAD.MOV.U32 R4, RZ, RZ, RZ ; /* 0x000000ffff047224 */
/* 0x000fd200078e00ff */
/*0f20*/ FSETP.NEU.AND P0, PT, R3.reuse, RZ, PT ; /* 0x000000ff0300720b */
/* 0x041fe40003f0d000 */
/*0f30*/ LOP3.LUT R7, R3, 0x80000000, R7, 0x48, !PT ; /* 0x8000000003077812 */
/* 0x000fc800078e4807 */
/*0f40*/ LOP3.LUT R5, R7, R5, RZ, 0xfc, !PT ; /* 0x0000000507057212 */
/* 0x000fce00078efcff */
/*0f50*/ @!P0 BRA 0x1150 ; /* 0x000001f000008947 */
/* 0x000fea0003800000 */
/*0f60*/ IMAD.MOV R3, RZ, RZ, -R16 ; /* 0x000000ffff037224 */
/* 0x000fe200078e0a10 */
/*0f70*/ DMUL.RP R4, R14, R4 ; /* 0x000000040e047228 */
/* 0x000e220000008000 */
/*0f80*/ IMAD.MOV.U32 R2, RZ, RZ, RZ ; /* 0x000000ffff027224 */
/* 0x000fcc00078e00ff */
/*0f90*/ DFMA R2, R10, -R2, R14 ; /* 0x800000020a02722b */
/* 0x000e46000000000e */
/*0fa0*/ LOP3.LUT R7, R5, R7, RZ, 0x3c, !PT ; /* 0x0000000705077212 */
/* 0x001fc600078e3cff */
/*0fb0*/ IADD3 R2, -R16, -0x43300000, RZ ; /* 0xbcd0000010027810 */
/* 0x002fc80007ffe1ff */
/*0fc0*/ FSETP.NEU.AND P0, PT, |R3|, R2, PT ; /* 0x000000020300720b */
/* 0x000fc80003f0d200 */
/*0fd0*/ FSEL R10, R4, R10, !P0 ; /* 0x0000000a040a7208 */
/* 0x000fe40004000000 */
/*0fe0*/ FSEL R11, R7, R11, !P0 ; /* 0x0000000b070b7208 */
/* 0x000fe20004000000 */
/*0ff0*/ BRA 0x1150 ; /* 0x0000015000007947 */
/* 0x000fea0003800000 */
/*1000*/ DSETP.NAN.AND P0, PT, R4, R4, PT ; /* 0x000000040400722a */
/* 0x003e1c0003f08000 */
/*1010*/ @P0 BRA 0x1130 ; /* 0x0000011000000947 */
/* 0x001fea0003800000 */
/*1020*/ DSETP.NAN.AND P0, PT, R6, R6, PT ; /* 0x000000060600722a */
/* 0x000e1c0003f08000 */
/*1030*/ @P0 BRA 0x1100 ; /* 0x000000c000000947 */
/* 0x001fea0003800000 */
/*1040*/ ISETP.NE.AND P0, PT, R16, R17, PT ; /* 0x000000111000720c */
/* 0x000fe20003f05270 */
/*1050*/ IMAD.MOV.U32 R11, RZ, RZ, -0x80000 ; /* 0xfff80000ff0b7424 */
/* 0x000fe200078e00ff */
/*1060*/ MOV R10, 0x0 ; /* 0x00000000000a7802 */
/* 0x000fd60000000f00 */
/*1070*/ @!P0 BRA 0x1150 ; /* 0x000000d000008947 */
/* 0x000fea0003800000 */
/*1080*/ ISETP.NE.AND P0, PT, R16, 0x7ff00000, PT ; /* 0x7ff000001000780c */
/* 0x000fe40003f05270 */
/*1090*/ LOP3.LUT R11, R5, 0x80000000, R7, 0x48, !PT ; /* 0x80000000050b7812 */
/* 0x000fe400078e4807 */
/*10a0*/ ISETP.EQ.OR P0, PT, R17, RZ, !P0 ; /* 0x000000ff1100720c */
/* 0x000fda0004702670 */
/*10b0*/ @P0 LOP3.LUT R2, R11, 0x7ff00000, RZ, 0xfc, !PT ; /* 0x7ff000000b020812 */
/* 0x000fe200078efcff */
/*10c0*/ @!P0 IMAD.MOV.U32 R10, RZ, RZ, RZ ; /* 0x000000ffff0a8224 */
/* 0x000fe400078e00ff */
/*10d0*/ @P0 IMAD.MOV.U32 R10, RZ, RZ, RZ ; /* 0x000000ffff0a0224 */
/* 0x000fe400078e00ff */
/*10e0*/ @P0 IMAD.MOV.U32 R11, RZ, RZ, R2 ; /* 0x000000ffff0b0224 */
/* 0x000fe200078e0002 */
/*10f0*/ BRA 0x1150 ; /* 0x0000005000007947 */
/* 0x000fea0003800000 */
/*1100*/ LOP3.LUT R11, R7, 0x80000, RZ, 0xfc, !PT ; /* 0x00080000070b7812 */
/* 0x000fe200078efcff */
/*1110*/ IMAD.MOV.U32 R10, RZ, RZ, R6 ; /* 0x000000ffff0a7224 */
/* 0x000fe200078e0006 */
/*1120*/ BRA 0x1150 ; /* 0x0000002000007947 */
/* 0x000fea0003800000 */
/*1130*/ LOP3.LUT R11, R5, 0x80000, RZ, 0xfc, !PT ; /* 0x00080000050b7812 */
/* 0x000fe200078efcff */
/*1140*/ IMAD.MOV.U32 R10, RZ, RZ, R4 ; /* 0x000000ffff0a7224 */
/* 0x000fe400078e0004 */
/*1150*/ BSYNC B1 ; /* 0x0000000000017941 */
/* 0x000fea0003800000 */
/*1160*/ IMAD.MOV.U32 R2, RZ, RZ, R0 ; /* 0x000000ffff027224 */
/* 0x000fe400078e0000 */
/*1170*/ IMAD.MOV.U32 R3, RZ, RZ, 0x0 ; /* 0x00000000ff037424 */
/* 0x000fc800078e00ff */
/*1180*/ RET.REL.NODEC R2 0x0 ; /* 0xffffee7002007950 */
/* 0x000fea0003c3ffff */
/*1190*/ BRA 0x1190; /* 0xfffffff000007947 */
/* 0x000fc0000383ffff */
/*11a0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*11b0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*11c0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*11d0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*11e0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*11f0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*1200*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*1210*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*1220*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*1230*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*1240*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*1250*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*1260*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*1270*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
.......... |
You are a helpful coding assistant specialized in converting CUDA source code to CUDA host assembly. | #include <stdlib.h>
#include <stdio.h>
__global__ void avg_kernel(double *heights,
int nx, int ny,
double Radius,
double *output){
int i,j, ind;
int ix, iy;
int ixmin, ixmax, iymin, iymax;
double h;
int N;
double ave;
i = blockIdx.x * blockDim.x + threadIdx.x;
j = blockIdx.y * blockDim.y + threadIdx.y;
// check the array boundaries
if (i >= nx || j >= ny) return;
ind = j * nx + i; // location in the array
h = heights[ind];
output [ind] = 0;
ixmin = max( i - int(Radius) , 0);
ixmax = min( i + int(Radius), nx-1);
iymin = max( j - int(Radius) , 0);
iymax = min( j + int(Radius), ny-1);
N=0;
ave = 0;
for(ix = ixmin; ix <= ixmax; ix++){
for(iy = iymin; iy <= iymax; iy++){
if ((ix-i)*(ix-i) + (iy-j)*(iy-j) <= Radius*Radius ){
N++;
ave = ave + heights[iy*nx+ix];
}
}
}
if (N > 0) output [ind] = ave/N;
return;
}
#define BLOCK_SIZE 16
extern "C"{
void avg_cuda(double *heights,
int nx,
int ny,
double r,
double *output){
dim3 nThreads(BLOCK_SIZE,BLOCK_SIZE);
dim3 nBlocks ( (nx-1)/BLOCK_SIZE + 1, (ny-1)/BLOCK_SIZE + 1);
double *d_heights;
double *d_output;
// allocate memory on GPU
cudaMalloc((void**) &d_heights, nx*ny * sizeof(double));
cudaMalloc((void**) &d_output, nx*ny * sizeof(double));
// copy input array:
cudaMemcpy(d_heights, heights, nx*ny*sizeof(double),cudaMemcpyHostToDevice);
// execute Kernel
avg_kernel<<<nBlocks,nThreads>>>(d_heights, nx, ny, r, d_output);
// copy output array back to the CPU
cudaMemcpy(output, d_output, nx*ny*sizeof(double),cudaMemcpyDeviceToHost);
// free the memory
cudaFree(d_heights);
cudaFree(d_output);
}
} | .file "tmpxft_00114533_00000000-6_avg.cudafe1.cpp"
.text
#APP
#NO_APP
.type _ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2060:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaUnregisterFatBinary@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2060:
.size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
.globl _Z35__device_stub__Z10avg_kernelPdiidS_PdiidS_
.type _Z35__device_stub__Z10avg_kernelPdiidS_PdiidS_, @function
_Z35__device_stub__Z10avg_kernelPdiidS_PdiidS_:
.LFB2082:
.cfi_startproc
endbr64
subq $152, %rsp
.cfi_def_cfa_offset 160
movq %rdi, 24(%rsp)
movl %esi, 20(%rsp)
movl %edx, 16(%rsp)
movsd %xmm0, 8(%rsp)
movq %rcx, (%rsp)
movq %fs:40, %rax
movq %rax, 136(%rsp)
xorl %eax, %eax
leaq 24(%rsp), %rax
movq %rax, 96(%rsp)
leaq 20(%rsp), %rax
movq %rax, 104(%rsp)
leaq 16(%rsp), %rax
movq %rax, 112(%rsp)
leaq 8(%rsp), %rax
movq %rax, 120(%rsp)
movq %rsp, %rax
movq %rax, 128(%rsp)
movl $1, 48(%rsp)
movl $1, 52(%rsp)
movl $1, 56(%rsp)
movl $1, 60(%rsp)
movl $1, 64(%rsp)
movl $1, 68(%rsp)
leaq 40(%rsp), %rcx
leaq 32(%rsp), %rdx
leaq 60(%rsp), %rsi
leaq 48(%rsp), %rdi
call __cudaPopCallConfiguration@PLT
testl %eax, %eax
je .L7
.L3:
movq 136(%rsp), %rax
subq %fs:40, %rax
jne .L8
addq $152, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 8
ret
.L7:
.cfi_restore_state
pushq 40(%rsp)
.cfi_def_cfa_offset 168
pushq 40(%rsp)
.cfi_def_cfa_offset 176
leaq 112(%rsp), %r9
movq 76(%rsp), %rcx
movl 84(%rsp), %r8d
movq 64(%rsp), %rsi
movl 72(%rsp), %edx
leaq _Z10avg_kernelPdiidS_(%rip), %rdi
call cudaLaunchKernel@PLT
addq $16, %rsp
.cfi_def_cfa_offset 160
jmp .L3
.L8:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE2082:
.size _Z35__device_stub__Z10avg_kernelPdiidS_PdiidS_, .-_Z35__device_stub__Z10avg_kernelPdiidS_PdiidS_
.globl _Z10avg_kernelPdiidS_
.type _Z10avg_kernelPdiidS_, @function
_Z10avg_kernelPdiidS_:
.LFB2083:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
call _Z35__device_stub__Z10avg_kernelPdiidS_PdiidS_
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2083:
.size _Z10avg_kernelPdiidS_, .-_Z10avg_kernelPdiidS_
.globl avg_cuda
.type avg_cuda, @function
avg_cuda:
.LFB2057:
.cfi_startproc
endbr64
pushq %r14
.cfi_def_cfa_offset 16
.cfi_offset 14, -16
pushq %r13
.cfi_def_cfa_offset 24
.cfi_offset 13, -24
pushq %r12
.cfi_def_cfa_offset 32
.cfi_offset 12, -32
pushq %rbp
.cfi_def_cfa_offset 40
.cfi_offset 6, -40
pushq %rbx
.cfi_def_cfa_offset 48
.cfi_offset 3, -48
subq $64, %rsp
.cfi_def_cfa_offset 112
movq %rdi, %r14
movl %esi, %ebp
movl %edx, %r12d
movsd %xmm0, 8(%rsp)
movq %rcx, %r13
movq %fs:40, %rax
movq %rax, 56(%rsp)
xorl %eax, %eax
movl $16, 32(%rsp)
movl $16, 36(%rsp)
movl $1, 40(%rsp)
leal 14(%rsi), %eax
movl %esi, %edx
subl $1, %edx
cmovns %edx, %eax
sarl $4, %eax
addl $1, %eax
movl %eax, 44(%rsp)
leal 14(%r12), %eax
movl %r12d, %edx
subl $1, %edx
cmovns %edx, %eax
sarl $4, %eax
addl $1, %eax
movl %eax, 48(%rsp)
movl $1, 52(%rsp)
movl %r12d, %ebx
imull %esi, %ebx
movslq %ebx, %rbx
salq $3, %rbx
leaq 16(%rsp), %rdi
movq %rbx, %rsi
call cudaMalloc@PLT
leaq 24(%rsp), %rdi
movq %rbx, %rsi
call cudaMalloc@PLT
movl $1, %ecx
movq %rbx, %rdx
movq %r14, %rsi
movq 16(%rsp), %rdi
call cudaMemcpy@PLT
movl 40(%rsp), %ecx
movl $0, %r9d
movl $0, %r8d
movq 32(%rsp), %rdx
movq 44(%rsp), %rdi
movl 52(%rsp), %esi
call __cudaPushCallConfiguration@PLT
testl %eax, %eax
je .L15
.L12:
movl $2, %ecx
movq %rbx, %rdx
movq 24(%rsp), %rsi
movq %r13, %rdi
call cudaMemcpy@PLT
movq 16(%rsp), %rdi
call cudaFree@PLT
movq 24(%rsp), %rdi
call cudaFree@PLT
movq 56(%rsp), %rax
subq %fs:40, %rax
jne .L16
addq $64, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 48
popq %rbx
.cfi_def_cfa_offset 40
popq %rbp
.cfi_def_cfa_offset 32
popq %r12
.cfi_def_cfa_offset 24
popq %r13
.cfi_def_cfa_offset 16
popq %r14
.cfi_def_cfa_offset 8
ret
.L15:
.cfi_restore_state
movq 24(%rsp), %rcx
movsd 8(%rsp), %xmm0
movl %r12d, %edx
movl %ebp, %esi
movq 16(%rsp), %rdi
call _Z35__device_stub__Z10avg_kernelPdiidS_PdiidS_
jmp .L12
.L16:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE2057:
.size avg_cuda, .-avg_cuda
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "_Z10avg_kernelPdiidS_"
.text
.type _ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2085:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
leaq _ZL15__fatDeviceText(%rip), %rdi
call __cudaRegisterFatBinary@PLT
movq %rax, %rdi
movq %rax, _ZL20__cudaFatCubinHandle(%rip)
pushq $0
.cfi_def_cfa_offset 24
pushq $0
.cfi_def_cfa_offset 32
pushq $0
.cfi_def_cfa_offset 40
pushq $0
.cfi_def_cfa_offset 48
movl $0, %r9d
movl $-1, %r8d
leaq .LC0(%rip), %rdx
movq %rdx, %rcx
leaq _Z10avg_kernelPdiidS_(%rip), %rsi
call __cudaRegisterFunction@PLT
addq $32, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaRegisterFatBinaryEnd@PLT
leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
call atexit@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2085:
.size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
.section .init_array,"aw"
.align 8
.quad _ZL24__sti____cudaRegisterAllv
.section .nvFatBinSegment,"aw"
.align 8
.type _ZL15__fatDeviceText, @object
.size _ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
.long 1180844977
.long 1
.quad fatbinData
.quad 0
.local _ZL20__cudaFatCubinHandle
.comm _ZL20__cudaFatCubinHandle,8,8
.ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
.section .note.GNU-stack,"",@progbits
.section .note.gnu.property,"a"
.align 8
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.string "GNU"
1:
.align 8
.long 0xc0000002
.long 3f - 2f
2:
.long 0x3
3:
.align 8
4: |
You are a helpful coding assistant specialized in converting CUDA source code to HIP/AMD source code. | #include <stdlib.h>
#include <stdio.h>
__global__ void avg_kernel(double *heights,
int nx, int ny,
double Radius,
double *output){
int i,j, ind;
int ix, iy;
int ixmin, ixmax, iymin, iymax;
double h;
int N;
double ave;
i = blockIdx.x * blockDim.x + threadIdx.x;
j = blockIdx.y * blockDim.y + threadIdx.y;
// check the array boundaries
if (i >= nx || j >= ny) return;
ind = j * nx + i; // location in the array
h = heights[ind];
output [ind] = 0;
ixmin = max( i - int(Radius) , 0);
ixmax = min( i + int(Radius), nx-1);
iymin = max( j - int(Radius) , 0);
iymax = min( j + int(Radius), ny-1);
N=0;
ave = 0;
for(ix = ixmin; ix <= ixmax; ix++){
for(iy = iymin; iy <= iymax; iy++){
if ((ix-i)*(ix-i) + (iy-j)*(iy-j) <= Radius*Radius ){
N++;
ave = ave + heights[iy*nx+ix];
}
}
}
if (N > 0) output [ind] = ave/N;
return;
}
#define BLOCK_SIZE 16
extern "C"{
void avg_cuda(double *heights,
int nx,
int ny,
double r,
double *output){
dim3 nThreads(BLOCK_SIZE,BLOCK_SIZE);
dim3 nBlocks ( (nx-1)/BLOCK_SIZE + 1, (ny-1)/BLOCK_SIZE + 1);
double *d_heights;
double *d_output;
// allocate memory on GPU
cudaMalloc((void**) &d_heights, nx*ny * sizeof(double));
cudaMalloc((void**) &d_output, nx*ny * sizeof(double));
// copy input array:
cudaMemcpy(d_heights, heights, nx*ny*sizeof(double),cudaMemcpyHostToDevice);
// execute Kernel
avg_kernel<<<nBlocks,nThreads>>>(d_heights, nx, ny, r, d_output);
// copy output array back to the CPU
cudaMemcpy(output, d_output, nx*ny*sizeof(double),cudaMemcpyDeviceToHost);
// free the memory
cudaFree(d_heights);
cudaFree(d_output);
}
} | #include <hip/hip_runtime.h>
#include <stdlib.h>
#include <stdio.h>
__global__ void avg_kernel(double *heights,
int nx, int ny,
double Radius,
double *output){
int i,j, ind;
int ix, iy;
int ixmin, ixmax, iymin, iymax;
double h;
int N;
double ave;
i = blockIdx.x * blockDim.x + threadIdx.x;
j = blockIdx.y * blockDim.y + threadIdx.y;
// check the array boundaries
if (i >= nx || j >= ny) return;
ind = j * nx + i; // location in the array
h = heights[ind];
output [ind] = 0;
ixmin = max( i - int(Radius) , 0);
ixmax = min( i + int(Radius), nx-1);
iymin = max( j - int(Radius) , 0);
iymax = min( j + int(Radius), ny-1);
N=0;
ave = 0;
for(ix = ixmin; ix <= ixmax; ix++){
for(iy = iymin; iy <= iymax; iy++){
if ((ix-i)*(ix-i) + (iy-j)*(iy-j) <= Radius*Radius ){
N++;
ave = ave + heights[iy*nx+ix];
}
}
}
if (N > 0) output [ind] = ave/N;
return;
}
#define BLOCK_SIZE 16
extern "C"{
void avg_cuda(double *heights,
int nx,
int ny,
double r,
double *output){
dim3 nThreads(BLOCK_SIZE,BLOCK_SIZE);
dim3 nBlocks ( (nx-1)/BLOCK_SIZE + 1, (ny-1)/BLOCK_SIZE + 1);
double *d_heights;
double *d_output;
// allocate memory on GPU
hipMalloc((void**) &d_heights, nx*ny * sizeof(double));
hipMalloc((void**) &d_output, nx*ny * sizeof(double));
// copy input array:
hipMemcpy(d_heights, heights, nx*ny*sizeof(double),hipMemcpyHostToDevice);
// execute Kernel
avg_kernel<<<nBlocks,nThreads>>>(d_heights, nx, ny, r, d_output);
// copy output array back to the CPU
hipMemcpy(output, d_output, nx*ny*sizeof(double),hipMemcpyDeviceToHost);
// free the memory
hipFree(d_heights);
hipFree(d_output);
}
} |
You are a helpful coding assistant specialized in converting HIP source code to AMD device assembly. | #include <hip/hip_runtime.h>
#include <stdlib.h>
#include <stdio.h>
__global__ void avg_kernel(double *heights,
int nx, int ny,
double Radius,
double *output){
int i,j, ind;
int ix, iy;
int ixmin, ixmax, iymin, iymax;
double h;
int N;
double ave;
i = blockIdx.x * blockDim.x + threadIdx.x;
j = blockIdx.y * blockDim.y + threadIdx.y;
// check the array boundaries
if (i >= nx || j >= ny) return;
ind = j * nx + i; // location in the array
h = heights[ind];
output [ind] = 0;
ixmin = max( i - int(Radius) , 0);
ixmax = min( i + int(Radius), nx-1);
iymin = max( j - int(Radius) , 0);
iymax = min( j + int(Radius), ny-1);
N=0;
ave = 0;
for(ix = ixmin; ix <= ixmax; ix++){
for(iy = iymin; iy <= iymax; iy++){
if ((ix-i)*(ix-i) + (iy-j)*(iy-j) <= Radius*Radius ){
N++;
ave = ave + heights[iy*nx+ix];
}
}
}
if (N > 0) output [ind] = ave/N;
return;
}
#define BLOCK_SIZE 16
extern "C"{
void avg_cuda(double *heights,
int nx,
int ny,
double r,
double *output){
dim3 nThreads(BLOCK_SIZE,BLOCK_SIZE);
dim3 nBlocks ( (nx-1)/BLOCK_SIZE + 1, (ny-1)/BLOCK_SIZE + 1);
double *d_heights;
double *d_output;
// allocate memory on GPU
hipMalloc((void**) &d_heights, nx*ny * sizeof(double));
hipMalloc((void**) &d_output, nx*ny * sizeof(double));
// copy input array:
hipMemcpy(d_heights, heights, nx*ny*sizeof(double),hipMemcpyHostToDevice);
// execute Kernel
avg_kernel<<<nBlocks,nThreads>>>(d_heights, nx, ny, r, d_output);
// copy output array back to the CPU
hipMemcpy(output, d_output, nx*ny*sizeof(double),hipMemcpyDeviceToHost);
// free the memory
hipFree(d_heights);
hipFree(d_output);
}
} | .text
.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
.protected _Z10avg_kernelPdiidS_
.globl _Z10avg_kernelPdiidS_
.p2align 8
.type _Z10avg_kernelPdiidS_,@function
_Z10avg_kernelPdiidS_:
s_clause 0x1
s_load_b32 s2, s[0:1], 0x2c
s_load_b64 s[8:9], s[0:1], 0x8
v_and_b32_e32 v2, 0x3ff, v0
v_bfe_u32 v3, v0, 10, 10
s_waitcnt lgkmcnt(0)
s_and_b32 s3, s2, 0xffff
s_lshr_b32 s2, s2, 16
s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
v_mad_u64_u32 v[0:1], null, s14, s3, v[2:3]
v_mad_u64_u32 v[12:13], null, s15, s2, v[3:4]
v_cmp_gt_i32_e32 vcc_lo, s8, v0
s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
v_cmp_gt_i32_e64 s2, s9, v12
s_and_b32 s2, vcc_lo, s2
s_delay_alu instid0(SALU_CYCLE_1)
s_and_saveexec_b32 s3, s2
s_cbranch_execz .LBB0_13
s_load_b128 s[4:7], s[0:1], 0x10
v_mad_u64_u32 v[1:2], null, v12, s8, v[0:1]
s_add_i32 s2, s8, -1
v_mov_b32_e32 v5, 0
s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
v_ashrrev_i32_e32 v2, 31, v1
v_mov_b32_e32 v6, v5
s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_2)
v_lshlrev_b64 v[1:2], 3, v[1:2]
s_waitcnt lgkmcnt(0)
v_cvt_i32_f64_e32 v10, s[4:5]
v_add_co_u32 v1, vcc_lo, s6, v1
s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_2) | instid1(VALU_DEP_3)
v_add_co_ci_u32_e32 v2, vcc_lo, s7, v2, vcc_lo
s_mov_b32 s7, 0
s_mov_b32 s6, exec_lo
v_sub_nc_u32_e32 v3, v0, v10
v_add_nc_u32_e32 v4, v0, v10
s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
v_max_i32_e32 v7, 0, v3
v_min_i32_e32 v13, s2, v4
v_mov_b32_e32 v3, 0
v_mov_b32_e32 v4, 0
global_store_b64 v[1:2], v[5:6], off
v_cmpx_le_i32_e64 v7, v13
s_cbranch_execz .LBB0_11
v_mul_f64 v[8:9], s[4:5], s[4:5]
s_load_b64 s[2:3], s[0:1], 0x0
v_sub_nc_u32_e32 v3, v12, v10
v_dual_mov_b32 v5, 0 :: v_dual_add_nc_u32 v4, v12, v10
s_add_i32 s0, s9, -1
v_sub_nc_u32_e32 v16, 0, v12
s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
v_max_i32_e32 v14, 0, v3
v_min_i32_e32 v15, s0, v4
v_mov_b32_e32 v3, 0
v_mov_b32_e32 v4, 0
s_delay_alu instid0(VALU_DEP_3)
v_cmp_le_i32_e32 vcc_lo, v14, v15
v_mad_u64_u32 v[10:11], null, s8, v14, v[7:8]
s_set_inst_prefetch_distance 0x1
s_branch .LBB0_5
.p2align 6
.LBB0_3:
s_or_b32 exec_lo, exec_lo, s4
.LBB0_4:
s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
s_or_b32 exec_lo, exec_lo, s1
v_add_nc_u32_e32 v6, 1, v7
v_cmp_ge_i32_e64 s0, v7, v13
v_dual_mov_b32 v7, v6 :: v_dual_add_nc_u32 v10, 1, v10
s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(SALU_CYCLE_1)
s_or_b32 s7, s0, s7
s_and_not1_b32 exec_lo, exec_lo, s7
s_cbranch_execz .LBB0_10
.LBB0_5:
s_and_saveexec_b32 s1, vcc_lo
s_cbranch_execz .LBB0_4
v_sub_nc_u32_e32 v6, v7, v0
s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_3)
v_mov_b32_e32 v11, v10
v_mov_b32_e32 v17, v14
s_mov_b32 s4, 0
v_mul_lo_u32 v6, v6, v6
s_branch .LBB0_8
.p2align 6
.LBB0_7:
s_or_b32 exec_lo, exec_lo, s5
v_add_nc_u32_e32 v12, 1, v17
v_cmp_ge_i32_e64 s0, v17, v15
v_add_nc_u32_e32 v11, s8, v11
s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
v_mov_b32_e32 v17, v12
s_or_b32 s4, s0, s4
s_delay_alu instid0(SALU_CYCLE_1)
s_and_not1_b32 exec_lo, exec_lo, s4
s_cbranch_execz .LBB0_3
.LBB0_8:
s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
v_add_nc_u32_e32 v12, v16, v17
s_mov_b32 s5, exec_lo
v_mad_u64_u32 v[18:19], null, v12, v12, v[6:7]
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_cvt_f64_i32_e32 v[18:19], v18
v_cmpx_ge_f64_e32 v[8:9], v[18:19]
s_cbranch_execz .LBB0_7
v_ashrrev_i32_e32 v12, 31, v11
v_add_nc_u32_e32 v5, 1, v5
s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_1)
v_lshlrev_b64 v[18:19], 3, v[11:12]
s_waitcnt lgkmcnt(0)
v_add_co_u32 v18, s0, s2, v18
s_delay_alu instid0(VALU_DEP_1)
v_add_co_ci_u32_e64 v19, s0, s3, v19, s0
global_load_b64 v[18:19], v[18:19], off
s_waitcnt vmcnt(0)
v_add_f64 v[3:4], v[3:4], v[18:19]
s_branch .LBB0_7
.LBB0_10:
s_set_inst_prefetch_distance 0x2
s_or_b32 exec_lo, exec_lo, s7
.LBB0_11:
s_delay_alu instid0(SALU_CYCLE_1)
s_or_b32 exec_lo, exec_lo, s6
v_cmp_lt_i32_e32 vcc_lo, 0, v5
s_and_b32 exec_lo, exec_lo, vcc_lo
s_cbranch_execz .LBB0_13
v_cvt_f64_i32_e32 v[5:6], v5
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_div_scale_f64 v[7:8], null, v[5:6], v[5:6], v[3:4]
v_rcp_f64_e32 v[9:10], v[7:8]
s_waitcnt_depctr 0xfff
v_fma_f64 v[11:12], -v[7:8], v[9:10], 1.0
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_fma_f64 v[9:10], v[9:10], v[11:12], v[9:10]
v_fma_f64 v[11:12], -v[7:8], v[9:10], 1.0
s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
v_fma_f64 v[9:10], v[9:10], v[11:12], v[9:10]
v_div_scale_f64 v[11:12], vcc_lo, v[3:4], v[5:6], v[3:4]
v_mul_f64 v[13:14], v[11:12], v[9:10]
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_fma_f64 v[7:8], -v[7:8], v[13:14], v[11:12]
v_div_fmas_f64 v[7:8], v[7:8], v[9:10], v[13:14]
s_delay_alu instid0(VALU_DEP_1)
v_div_fixup_f64 v[3:4], v[7:8], v[5:6], v[3:4]
global_store_b64 v[1:2], v[3:4], off
.LBB0_13:
s_nop 0
s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
s_endpgm
.section .rodata,"a",@progbits
.p2align 6, 0x0
.amdhsa_kernel _Z10avg_kernelPdiidS_
.amdhsa_group_segment_fixed_size 0
.amdhsa_private_segment_fixed_size 0
.amdhsa_kernarg_size 288
.amdhsa_user_sgpr_count 14
.amdhsa_user_sgpr_dispatch_ptr 0
.amdhsa_user_sgpr_queue_ptr 0
.amdhsa_user_sgpr_kernarg_segment_ptr 1
.amdhsa_user_sgpr_dispatch_id 0
.amdhsa_user_sgpr_private_segment_size 0
.amdhsa_wavefront_size32 1
.amdhsa_uses_dynamic_stack 0
.amdhsa_enable_private_segment 0
.amdhsa_system_sgpr_workgroup_id_x 1
.amdhsa_system_sgpr_workgroup_id_y 1
.amdhsa_system_sgpr_workgroup_id_z 0
.amdhsa_system_sgpr_workgroup_info 0
.amdhsa_system_vgpr_workitem_id 1
.amdhsa_next_free_vgpr 20
.amdhsa_next_free_sgpr 16
.amdhsa_float_round_mode_32 0
.amdhsa_float_round_mode_16_64 0
.amdhsa_float_denorm_mode_32 3
.amdhsa_float_denorm_mode_16_64 3
.amdhsa_dx10_clamp 1
.amdhsa_ieee_mode 1
.amdhsa_fp16_overflow 0
.amdhsa_workgroup_processor_mode 1
.amdhsa_memory_ordered 1
.amdhsa_forward_progress 0
.amdhsa_shared_vgpr_count 0
.amdhsa_exception_fp_ieee_invalid_op 0
.amdhsa_exception_fp_denorm_src 0
.amdhsa_exception_fp_ieee_div_zero 0
.amdhsa_exception_fp_ieee_overflow 0
.amdhsa_exception_fp_ieee_underflow 0
.amdhsa_exception_fp_ieee_inexact 0
.amdhsa_exception_int_div_zero 0
.end_amdhsa_kernel
.text
.Lfunc_end0:
.size _Z10avg_kernelPdiidS_, .Lfunc_end0-_Z10avg_kernelPdiidS_
.section .AMDGPU.csdata,"",@progbits
.text
.p2alignl 7, 3214868480
.fill 96, 4, 3214868480
.type __hip_cuid_,@object
.section .bss,"aw",@nobits
.globl __hip_cuid_
__hip_cuid_:
.byte 0
.size __hip_cuid_, 1
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym __hip_cuid_
.amdgpu_metadata
---
amdhsa.kernels:
- .args:
- .address_space: global
.offset: 0
.size: 8
.value_kind: global_buffer
- .offset: 8
.size: 4
.value_kind: by_value
- .offset: 12
.size: 4
.value_kind: by_value
- .offset: 16
.size: 8
.value_kind: by_value
- .address_space: global
.offset: 24
.size: 8
.value_kind: global_buffer
- .offset: 32
.size: 4
.value_kind: hidden_block_count_x
- .offset: 36
.size: 4
.value_kind: hidden_block_count_y
- .offset: 40
.size: 4
.value_kind: hidden_block_count_z
- .offset: 44
.size: 2
.value_kind: hidden_group_size_x
- .offset: 46
.size: 2
.value_kind: hidden_group_size_y
- .offset: 48
.size: 2
.value_kind: hidden_group_size_z
- .offset: 50
.size: 2
.value_kind: hidden_remainder_x
- .offset: 52
.size: 2
.value_kind: hidden_remainder_y
- .offset: 54
.size: 2
.value_kind: hidden_remainder_z
- .offset: 72
.size: 8
.value_kind: hidden_global_offset_x
- .offset: 80
.size: 8
.value_kind: hidden_global_offset_y
- .offset: 88
.size: 8
.value_kind: hidden_global_offset_z
- .offset: 96
.size: 2
.value_kind: hidden_grid_dims
.group_segment_fixed_size: 0
.kernarg_segment_align: 8
.kernarg_segment_size: 288
.language: OpenCL C
.language_version:
- 2
- 0
.max_flat_workgroup_size: 1024
.name: _Z10avg_kernelPdiidS_
.private_segment_fixed_size: 0
.sgpr_count: 18
.sgpr_spill_count: 0
.symbol: _Z10avg_kernelPdiidS_.kd
.uniform_work_group_size: 1
.uses_dynamic_stack: false
.vgpr_count: 20
.vgpr_spill_count: 0
.wavefront_size: 32
.workgroup_processor_mode: 1
amdhsa.target: amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
- 1
- 2
...
.end_amdgpu_metadata |
You are a helpful coding assistant specialized in converting HIP source code to AMD host assembly. | #include <hip/hip_runtime.h>
#include <stdlib.h>
#include <stdio.h>
__global__ void avg_kernel(double *heights,
int nx, int ny,
double Radius,
double *output){
int i,j, ind;
int ix, iy;
int ixmin, ixmax, iymin, iymax;
double h;
int N;
double ave;
i = blockIdx.x * blockDim.x + threadIdx.x;
j = blockIdx.y * blockDim.y + threadIdx.y;
// check the array boundaries
if (i >= nx || j >= ny) return;
ind = j * nx + i; // location in the array
h = heights[ind];
output [ind] = 0;
ixmin = max( i - int(Radius) , 0);
ixmax = min( i + int(Radius), nx-1);
iymin = max( j - int(Radius) , 0);
iymax = min( j + int(Radius), ny-1);
N=0;
ave = 0;
for(ix = ixmin; ix <= ixmax; ix++){
for(iy = iymin; iy <= iymax; iy++){
if ((ix-i)*(ix-i) + (iy-j)*(iy-j) <= Radius*Radius ){
N++;
ave = ave + heights[iy*nx+ix];
}
}
}
if (N > 0) output [ind] = ave/N;
return;
}
#define BLOCK_SIZE 16
extern "C"{
void avg_cuda(double *heights,
int nx,
int ny,
double r,
double *output){
dim3 nThreads(BLOCK_SIZE,BLOCK_SIZE);
dim3 nBlocks ( (nx-1)/BLOCK_SIZE + 1, (ny-1)/BLOCK_SIZE + 1);
double *d_heights;
double *d_output;
// allocate memory on GPU
hipMalloc((void**) &d_heights, nx*ny * sizeof(double));
hipMalloc((void**) &d_output, nx*ny * sizeof(double));
// copy input array:
hipMemcpy(d_heights, heights, nx*ny*sizeof(double),hipMemcpyHostToDevice);
// execute Kernel
avg_kernel<<<nBlocks,nThreads>>>(d_heights, nx, ny, r, d_output);
// copy output array back to the CPU
hipMemcpy(output, d_output, nx*ny*sizeof(double),hipMemcpyDeviceToHost);
// free the memory
hipFree(d_heights);
hipFree(d_output);
}
} | .text
.file "avg.hip"
.globl _Z25__device_stub__avg_kernelPdiidS_ # -- Begin function _Z25__device_stub__avg_kernelPdiidS_
.p2align 4, 0x90
.type _Z25__device_stub__avg_kernelPdiidS_,@function
_Z25__device_stub__avg_kernelPdiidS_: # @_Z25__device_stub__avg_kernelPdiidS_
.cfi_startproc
# %bb.0:
subq $120, %rsp
.cfi_def_cfa_offset 128
movq %rdi, 72(%rsp)
movl %esi, 4(%rsp)
movl %edx, (%rsp)
movsd %xmm0, 64(%rsp)
movq %rcx, 56(%rsp)
leaq 72(%rsp), %rax
movq %rax, 80(%rsp)
leaq 4(%rsp), %rax
movq %rax, 88(%rsp)
movq %rsp, %rax
movq %rax, 96(%rsp)
leaq 64(%rsp), %rax
movq %rax, 104(%rsp)
leaq 56(%rsp), %rax
movq %rax, 112(%rsp)
leaq 40(%rsp), %rdi
leaq 24(%rsp), %rsi
leaq 16(%rsp), %rdx
leaq 8(%rsp), %rcx
callq __hipPopCallConfiguration
movq 40(%rsp), %rsi
movl 48(%rsp), %edx
movq 24(%rsp), %rcx
movl 32(%rsp), %r8d
leaq 80(%rsp), %r9
movl $_Z10avg_kernelPdiidS_, %edi
pushq 8(%rsp)
.cfi_adjust_cfa_offset 8
pushq 24(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $136, %rsp
.cfi_adjust_cfa_offset -136
retq
.Lfunc_end0:
.size _Z25__device_stub__avg_kernelPdiidS_, .Lfunc_end0-_Z25__device_stub__avg_kernelPdiidS_
.cfi_endproc
# -- End function
.globl avg_cuda # -- Begin function avg_cuda
.p2align 4, 0x90
.type avg_cuda,@function
avg_cuda: # @avg_cuda
.cfi_startproc
# %bb.0:
pushq %rbp
.cfi_def_cfa_offset 16
pushq %r15
.cfi_def_cfa_offset 24
pushq %r14
.cfi_def_cfa_offset 32
pushq %r13
.cfi_def_cfa_offset 40
pushq %r12
.cfi_def_cfa_offset 48
pushq %rbx
.cfi_def_cfa_offset 56
subq $152, %rsp
.cfi_def_cfa_offset 208
.cfi_offset %rbx, -56
.cfi_offset %r12, -48
.cfi_offset %r13, -40
.cfi_offset %r14, -32
.cfi_offset %r15, -24
.cfi_offset %rbp, -16
movq %rcx, %rbx
movsd %xmm0, 32(%rsp) # 8-byte Spill
movl %edx, %r15d
movl %esi, %r12d
leal -1(%r12), %eax
leal 14(%r12), %ecx
testl %eax, %eax
cmovnsl %eax, %ecx
movq %rdi, %rbp
sarl $4, %ecx
incl %ecx
leal -1(%r15), %eax
leal 14(%r15), %r13d
testl %eax, %eax
cmovnsl %eax, %r13d
sarl $4, %r13d
incl %r13d
shlq $32, %r13
orq %rcx, %r13
movl %edx, %eax
imull %esi, %eax
movslq %eax, %r14
shlq $3, %r14
leaq 16(%rsp), %rdi
movq %r14, %rsi
callq hipMalloc
leaq 8(%rsp), %rdi
movq %r14, %rsi
callq hipMalloc
movq 16(%rsp), %rdi
movq %rbp, %rsi
movq %r14, %rdx
movl $1, %ecx
callq hipMemcpy
movabsq $68719476752, %rdx # imm = 0x1000000010
movq %r13, %rdi
movl $1, %esi
movl $1, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq __hipPushCallConfiguration
testl %eax, %eax
jne .LBB1_2
# %bb.1:
movq 16(%rsp), %rax
movq 8(%rsp), %rcx
movq %rax, 104(%rsp)
movl %r12d, 28(%rsp)
movl %r15d, 24(%rsp)
movsd 32(%rsp), %xmm0 # 8-byte Reload
# xmm0 = mem[0],zero
movsd %xmm0, 96(%rsp)
movq %rcx, 88(%rsp)
leaq 104(%rsp), %rax
movq %rax, 112(%rsp)
leaq 28(%rsp), %rax
movq %rax, 120(%rsp)
leaq 24(%rsp), %rax
movq %rax, 128(%rsp)
leaq 96(%rsp), %rax
movq %rax, 136(%rsp)
leaq 88(%rsp), %rax
movq %rax, 144(%rsp)
leaq 72(%rsp), %rdi
leaq 56(%rsp), %rsi
leaq 48(%rsp), %rdx
leaq 40(%rsp), %rcx
callq __hipPopCallConfiguration
movq 72(%rsp), %rsi
movl 80(%rsp), %edx
movq 56(%rsp), %rcx
movl 64(%rsp), %r8d
leaq 112(%rsp), %r9
movl $_Z10avg_kernelPdiidS_, %edi
pushq 40(%rsp)
.cfi_adjust_cfa_offset 8
pushq 56(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $16, %rsp
.cfi_adjust_cfa_offset -16
.LBB1_2:
movq 8(%rsp), %rsi
movq %rbx, %rdi
movq %r14, %rdx
movl $2, %ecx
callq hipMemcpy
movq 16(%rsp), %rdi
callq hipFree
movq 8(%rsp), %rdi
callq hipFree
addq $152, %rsp
.cfi_def_cfa_offset 56
popq %rbx
.cfi_def_cfa_offset 48
popq %r12
.cfi_def_cfa_offset 40
popq %r13
.cfi_def_cfa_offset 32
popq %r14
.cfi_def_cfa_offset 24
popq %r15
.cfi_def_cfa_offset 16
popq %rbp
.cfi_def_cfa_offset 8
retq
.Lfunc_end1:
.size avg_cuda, .Lfunc_end1-avg_cuda
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_ctor
.type __hip_module_ctor,@function
__hip_module_ctor: # @__hip_module_ctor
.cfi_startproc
# %bb.0:
subq $40, %rsp
.cfi_def_cfa_offset 48
cmpq $0, __hip_gpubin_handle(%rip)
jne .LBB2_2
# %bb.1:
movl $__hip_fatbin_wrapper, %edi
callq __hipRegisterFatBinary
movq %rax, __hip_gpubin_handle(%rip)
.LBB2_2:
movq __hip_gpubin_handle(%rip), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 16(%rsp)
movups %xmm0, (%rsp)
movl $_Z10avg_kernelPdiidS_, %esi
movl $.L__unnamed_1, %edx
movl $.L__unnamed_1, %ecx
movl $-1, %r8d
xorl %r9d, %r9d
callq __hipRegisterFunction
movl $__hip_module_dtor, %edi
addq $40, %rsp
.cfi_def_cfa_offset 8
jmp atexit # TAILCALL
.Lfunc_end2:
.size __hip_module_ctor, .Lfunc_end2-__hip_module_ctor
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_dtor
.type __hip_module_dtor,@function
__hip_module_dtor: # @__hip_module_dtor
.cfi_startproc
# %bb.0:
movq __hip_gpubin_handle(%rip), %rdi
testq %rdi, %rdi
je .LBB3_2
# %bb.1:
pushq %rax
.cfi_def_cfa_offset 16
callq __hipUnregisterFatBinary
movq $0, __hip_gpubin_handle(%rip)
addq $8, %rsp
.cfi_def_cfa_offset 8
.LBB3_2:
retq
.Lfunc_end3:
.size __hip_module_dtor, .Lfunc_end3-__hip_module_dtor
.cfi_endproc
# -- End function
.type _Z10avg_kernelPdiidS_,@object # @_Z10avg_kernelPdiidS_
.section .rodata,"a",@progbits
.globl _Z10avg_kernelPdiidS_
.p2align 3, 0x0
_Z10avg_kernelPdiidS_:
.quad _Z25__device_stub__avg_kernelPdiidS_
.size _Z10avg_kernelPdiidS_, 8
.type .L__unnamed_1,@object # @0
.section .rodata.str1.1,"aMS",@progbits,1
.L__unnamed_1:
.asciz "_Z10avg_kernelPdiidS_"
.size .L__unnamed_1, 22
.type __hip_fatbin_wrapper,@object # @__hip_fatbin_wrapper
.section .hipFatBinSegment,"a",@progbits
.p2align 3, 0x0
__hip_fatbin_wrapper:
.long 1212764230 # 0x48495046
.long 1 # 0x1
.quad __hip_fatbin
.quad 0
.size __hip_fatbin_wrapper, 24
.type __hip_gpubin_handle,@object # @__hip_gpubin_handle
.local __hip_gpubin_handle
.comm __hip_gpubin_handle,8,8
.section .init_array,"aw",@init_array
.p2align 3, 0x0
.quad __hip_module_ctor
.type __hip_cuid_,@object # @__hip_cuid_
.bss
.globl __hip_cuid_
__hip_cuid_:
.byte 0 # 0x0
.size __hip_cuid_, 1
.section ".linker-options","e",@llvm_linker_options
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym _Z25__device_stub__avg_kernelPdiidS_
.addrsig_sym __hip_module_ctor
.addrsig_sym __hip_module_dtor
.addrsig_sym _Z10avg_kernelPdiidS_
.addrsig_sym __hip_fatbin
.addrsig_sym __hip_fatbin_wrapper
.addrsig_sym __hip_cuid_ |
You are a helpful coding assistant specialized in converting from CUDA host assembly to AMD host assembly. | .file "tmpxft_00114533_00000000-6_avg.cudafe1.cpp"
.text
#APP
#NO_APP
.type _ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2060:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaUnregisterFatBinary@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2060:
.size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
.globl _Z35__device_stub__Z10avg_kernelPdiidS_PdiidS_
.type _Z35__device_stub__Z10avg_kernelPdiidS_PdiidS_, @function
_Z35__device_stub__Z10avg_kernelPdiidS_PdiidS_:
.LFB2082:
.cfi_startproc
endbr64
subq $152, %rsp
.cfi_def_cfa_offset 160
movq %rdi, 24(%rsp)
movl %esi, 20(%rsp)
movl %edx, 16(%rsp)
movsd %xmm0, 8(%rsp)
movq %rcx, (%rsp)
movq %fs:40, %rax
movq %rax, 136(%rsp)
xorl %eax, %eax
leaq 24(%rsp), %rax
movq %rax, 96(%rsp)
leaq 20(%rsp), %rax
movq %rax, 104(%rsp)
leaq 16(%rsp), %rax
movq %rax, 112(%rsp)
leaq 8(%rsp), %rax
movq %rax, 120(%rsp)
movq %rsp, %rax
movq %rax, 128(%rsp)
movl $1, 48(%rsp)
movl $1, 52(%rsp)
movl $1, 56(%rsp)
movl $1, 60(%rsp)
movl $1, 64(%rsp)
movl $1, 68(%rsp)
leaq 40(%rsp), %rcx
leaq 32(%rsp), %rdx
leaq 60(%rsp), %rsi
leaq 48(%rsp), %rdi
call __cudaPopCallConfiguration@PLT
testl %eax, %eax
je .L7
.L3:
movq 136(%rsp), %rax
subq %fs:40, %rax
jne .L8
addq $152, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 8
ret
.L7:
.cfi_restore_state
pushq 40(%rsp)
.cfi_def_cfa_offset 168
pushq 40(%rsp)
.cfi_def_cfa_offset 176
leaq 112(%rsp), %r9
movq 76(%rsp), %rcx
movl 84(%rsp), %r8d
movq 64(%rsp), %rsi
movl 72(%rsp), %edx
leaq _Z10avg_kernelPdiidS_(%rip), %rdi
call cudaLaunchKernel@PLT
addq $16, %rsp
.cfi_def_cfa_offset 160
jmp .L3
.L8:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE2082:
.size _Z35__device_stub__Z10avg_kernelPdiidS_PdiidS_, .-_Z35__device_stub__Z10avg_kernelPdiidS_PdiidS_
.globl _Z10avg_kernelPdiidS_
.type _Z10avg_kernelPdiidS_, @function
_Z10avg_kernelPdiidS_:
.LFB2083:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
call _Z35__device_stub__Z10avg_kernelPdiidS_PdiidS_
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2083:
.size _Z10avg_kernelPdiidS_, .-_Z10avg_kernelPdiidS_
.globl avg_cuda
.type avg_cuda, @function
avg_cuda:
.LFB2057:
.cfi_startproc
endbr64
pushq %r14
.cfi_def_cfa_offset 16
.cfi_offset 14, -16
pushq %r13
.cfi_def_cfa_offset 24
.cfi_offset 13, -24
pushq %r12
.cfi_def_cfa_offset 32
.cfi_offset 12, -32
pushq %rbp
.cfi_def_cfa_offset 40
.cfi_offset 6, -40
pushq %rbx
.cfi_def_cfa_offset 48
.cfi_offset 3, -48
subq $64, %rsp
.cfi_def_cfa_offset 112
movq %rdi, %r14
movl %esi, %ebp
movl %edx, %r12d
movsd %xmm0, 8(%rsp)
movq %rcx, %r13
movq %fs:40, %rax
movq %rax, 56(%rsp)
xorl %eax, %eax
movl $16, 32(%rsp)
movl $16, 36(%rsp)
movl $1, 40(%rsp)
leal 14(%rsi), %eax
movl %esi, %edx
subl $1, %edx
cmovns %edx, %eax
sarl $4, %eax
addl $1, %eax
movl %eax, 44(%rsp)
leal 14(%r12), %eax
movl %r12d, %edx
subl $1, %edx
cmovns %edx, %eax
sarl $4, %eax
addl $1, %eax
movl %eax, 48(%rsp)
movl $1, 52(%rsp)
movl %r12d, %ebx
imull %esi, %ebx
movslq %ebx, %rbx
salq $3, %rbx
leaq 16(%rsp), %rdi
movq %rbx, %rsi
call cudaMalloc@PLT
leaq 24(%rsp), %rdi
movq %rbx, %rsi
call cudaMalloc@PLT
movl $1, %ecx
movq %rbx, %rdx
movq %r14, %rsi
movq 16(%rsp), %rdi
call cudaMemcpy@PLT
movl 40(%rsp), %ecx
movl $0, %r9d
movl $0, %r8d
movq 32(%rsp), %rdx
movq 44(%rsp), %rdi
movl 52(%rsp), %esi
call __cudaPushCallConfiguration@PLT
testl %eax, %eax
je .L15
.L12:
movl $2, %ecx
movq %rbx, %rdx
movq 24(%rsp), %rsi
movq %r13, %rdi
call cudaMemcpy@PLT
movq 16(%rsp), %rdi
call cudaFree@PLT
movq 24(%rsp), %rdi
call cudaFree@PLT
movq 56(%rsp), %rax
subq %fs:40, %rax
jne .L16
addq $64, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 48
popq %rbx
.cfi_def_cfa_offset 40
popq %rbp
.cfi_def_cfa_offset 32
popq %r12
.cfi_def_cfa_offset 24
popq %r13
.cfi_def_cfa_offset 16
popq %r14
.cfi_def_cfa_offset 8
ret
.L15:
.cfi_restore_state
movq 24(%rsp), %rcx
movsd 8(%rsp), %xmm0
movl %r12d, %edx
movl %ebp, %esi
movq 16(%rsp), %rdi
call _Z35__device_stub__Z10avg_kernelPdiidS_PdiidS_
jmp .L12
.L16:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE2057:
.size avg_cuda, .-avg_cuda
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "_Z10avg_kernelPdiidS_"
.text
.type _ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2085:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
leaq _ZL15__fatDeviceText(%rip), %rdi
call __cudaRegisterFatBinary@PLT
movq %rax, %rdi
movq %rax, _ZL20__cudaFatCubinHandle(%rip)
pushq $0
.cfi_def_cfa_offset 24
pushq $0
.cfi_def_cfa_offset 32
pushq $0
.cfi_def_cfa_offset 40
pushq $0
.cfi_def_cfa_offset 48
movl $0, %r9d
movl $-1, %r8d
leaq .LC0(%rip), %rdx
movq %rdx, %rcx
leaq _Z10avg_kernelPdiidS_(%rip), %rsi
call __cudaRegisterFunction@PLT
addq $32, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaRegisterFatBinaryEnd@PLT
leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
call atexit@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2085:
.size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
.section .init_array,"aw"
.align 8
.quad _ZL24__sti____cudaRegisterAllv
.section .nvFatBinSegment,"aw"
.align 8
.type _ZL15__fatDeviceText, @object
.size _ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
.long 1180844977
.long 1
.quad fatbinData
.quad 0
.local _ZL20__cudaFatCubinHandle
.comm _ZL20__cudaFatCubinHandle,8,8
.ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
.section .note.GNU-stack,"",@progbits
.section .note.gnu.property,"a"
.align 8
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.string "GNU"
1:
.align 8
.long 0xc0000002
.long 3f - 2f
2:
.long 0x3
3:
.align 8
4: | .text
.file "avg.hip"
.globl _Z25__device_stub__avg_kernelPdiidS_ # -- Begin function _Z25__device_stub__avg_kernelPdiidS_
.p2align 4, 0x90
.type _Z25__device_stub__avg_kernelPdiidS_,@function
_Z25__device_stub__avg_kernelPdiidS_: # @_Z25__device_stub__avg_kernelPdiidS_
.cfi_startproc
# %bb.0:
subq $120, %rsp
.cfi_def_cfa_offset 128
movq %rdi, 72(%rsp)
movl %esi, 4(%rsp)
movl %edx, (%rsp)
movsd %xmm0, 64(%rsp)
movq %rcx, 56(%rsp)
leaq 72(%rsp), %rax
movq %rax, 80(%rsp)
leaq 4(%rsp), %rax
movq %rax, 88(%rsp)
movq %rsp, %rax
movq %rax, 96(%rsp)
leaq 64(%rsp), %rax
movq %rax, 104(%rsp)
leaq 56(%rsp), %rax
movq %rax, 112(%rsp)
leaq 40(%rsp), %rdi
leaq 24(%rsp), %rsi
leaq 16(%rsp), %rdx
leaq 8(%rsp), %rcx
callq __hipPopCallConfiguration
movq 40(%rsp), %rsi
movl 48(%rsp), %edx
movq 24(%rsp), %rcx
movl 32(%rsp), %r8d
leaq 80(%rsp), %r9
movl $_Z10avg_kernelPdiidS_, %edi
pushq 8(%rsp)
.cfi_adjust_cfa_offset 8
pushq 24(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $136, %rsp
.cfi_adjust_cfa_offset -136
retq
.Lfunc_end0:
.size _Z25__device_stub__avg_kernelPdiidS_, .Lfunc_end0-_Z25__device_stub__avg_kernelPdiidS_
.cfi_endproc
# -- End function
.globl avg_cuda # -- Begin function avg_cuda
.p2align 4, 0x90
.type avg_cuda,@function
avg_cuda: # @avg_cuda
.cfi_startproc
# %bb.0:
pushq %rbp
.cfi_def_cfa_offset 16
pushq %r15
.cfi_def_cfa_offset 24
pushq %r14
.cfi_def_cfa_offset 32
pushq %r13
.cfi_def_cfa_offset 40
pushq %r12
.cfi_def_cfa_offset 48
pushq %rbx
.cfi_def_cfa_offset 56
subq $152, %rsp
.cfi_def_cfa_offset 208
.cfi_offset %rbx, -56
.cfi_offset %r12, -48
.cfi_offset %r13, -40
.cfi_offset %r14, -32
.cfi_offset %r15, -24
.cfi_offset %rbp, -16
movq %rcx, %rbx
movsd %xmm0, 32(%rsp) # 8-byte Spill
movl %edx, %r15d
movl %esi, %r12d
leal -1(%r12), %eax
leal 14(%r12), %ecx
testl %eax, %eax
cmovnsl %eax, %ecx
movq %rdi, %rbp
sarl $4, %ecx
incl %ecx
leal -1(%r15), %eax
leal 14(%r15), %r13d
testl %eax, %eax
cmovnsl %eax, %r13d
sarl $4, %r13d
incl %r13d
shlq $32, %r13
orq %rcx, %r13
movl %edx, %eax
imull %esi, %eax
movslq %eax, %r14
shlq $3, %r14
leaq 16(%rsp), %rdi
movq %r14, %rsi
callq hipMalloc
leaq 8(%rsp), %rdi
movq %r14, %rsi
callq hipMalloc
movq 16(%rsp), %rdi
movq %rbp, %rsi
movq %r14, %rdx
movl $1, %ecx
callq hipMemcpy
movabsq $68719476752, %rdx # imm = 0x1000000010
movq %r13, %rdi
movl $1, %esi
movl $1, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq __hipPushCallConfiguration
testl %eax, %eax
jne .LBB1_2
# %bb.1:
movq 16(%rsp), %rax
movq 8(%rsp), %rcx
movq %rax, 104(%rsp)
movl %r12d, 28(%rsp)
movl %r15d, 24(%rsp)
movsd 32(%rsp), %xmm0 # 8-byte Reload
# xmm0 = mem[0],zero
movsd %xmm0, 96(%rsp)
movq %rcx, 88(%rsp)
leaq 104(%rsp), %rax
movq %rax, 112(%rsp)
leaq 28(%rsp), %rax
movq %rax, 120(%rsp)
leaq 24(%rsp), %rax
movq %rax, 128(%rsp)
leaq 96(%rsp), %rax
movq %rax, 136(%rsp)
leaq 88(%rsp), %rax
movq %rax, 144(%rsp)
leaq 72(%rsp), %rdi
leaq 56(%rsp), %rsi
leaq 48(%rsp), %rdx
leaq 40(%rsp), %rcx
callq __hipPopCallConfiguration
movq 72(%rsp), %rsi
movl 80(%rsp), %edx
movq 56(%rsp), %rcx
movl 64(%rsp), %r8d
leaq 112(%rsp), %r9
movl $_Z10avg_kernelPdiidS_, %edi
pushq 40(%rsp)
.cfi_adjust_cfa_offset 8
pushq 56(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $16, %rsp
.cfi_adjust_cfa_offset -16
.LBB1_2:
movq 8(%rsp), %rsi
movq %rbx, %rdi
movq %r14, %rdx
movl $2, %ecx
callq hipMemcpy
movq 16(%rsp), %rdi
callq hipFree
movq 8(%rsp), %rdi
callq hipFree
addq $152, %rsp
.cfi_def_cfa_offset 56
popq %rbx
.cfi_def_cfa_offset 48
popq %r12
.cfi_def_cfa_offset 40
popq %r13
.cfi_def_cfa_offset 32
popq %r14
.cfi_def_cfa_offset 24
popq %r15
.cfi_def_cfa_offset 16
popq %rbp
.cfi_def_cfa_offset 8
retq
.Lfunc_end1:
.size avg_cuda, .Lfunc_end1-avg_cuda
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_ctor
.type __hip_module_ctor,@function
__hip_module_ctor: # @__hip_module_ctor
.cfi_startproc
# %bb.0:
subq $40, %rsp
.cfi_def_cfa_offset 48
cmpq $0, __hip_gpubin_handle(%rip)
jne .LBB2_2
# %bb.1:
movl $__hip_fatbin_wrapper, %edi
callq __hipRegisterFatBinary
movq %rax, __hip_gpubin_handle(%rip)
.LBB2_2:
movq __hip_gpubin_handle(%rip), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 16(%rsp)
movups %xmm0, (%rsp)
movl $_Z10avg_kernelPdiidS_, %esi
movl $.L__unnamed_1, %edx
movl $.L__unnamed_1, %ecx
movl $-1, %r8d
xorl %r9d, %r9d
callq __hipRegisterFunction
movl $__hip_module_dtor, %edi
addq $40, %rsp
.cfi_def_cfa_offset 8
jmp atexit # TAILCALL
.Lfunc_end2:
.size __hip_module_ctor, .Lfunc_end2-__hip_module_ctor
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_dtor
.type __hip_module_dtor,@function
__hip_module_dtor: # @__hip_module_dtor
.cfi_startproc
# %bb.0:
movq __hip_gpubin_handle(%rip), %rdi
testq %rdi, %rdi
je .LBB3_2
# %bb.1:
pushq %rax
.cfi_def_cfa_offset 16
callq __hipUnregisterFatBinary
movq $0, __hip_gpubin_handle(%rip)
addq $8, %rsp
.cfi_def_cfa_offset 8
.LBB3_2:
retq
.Lfunc_end3:
.size __hip_module_dtor, .Lfunc_end3-__hip_module_dtor
.cfi_endproc
# -- End function
.type _Z10avg_kernelPdiidS_,@object # @_Z10avg_kernelPdiidS_
.section .rodata,"a",@progbits
.globl _Z10avg_kernelPdiidS_
.p2align 3, 0x0
_Z10avg_kernelPdiidS_:
.quad _Z25__device_stub__avg_kernelPdiidS_
.size _Z10avg_kernelPdiidS_, 8
.type .L__unnamed_1,@object # @0
.section .rodata.str1.1,"aMS",@progbits,1
.L__unnamed_1:
.asciz "_Z10avg_kernelPdiidS_"
.size .L__unnamed_1, 22
.type __hip_fatbin_wrapper,@object # @__hip_fatbin_wrapper
.section .hipFatBinSegment,"a",@progbits
.p2align 3, 0x0
__hip_fatbin_wrapper:
.long 1212764230 # 0x48495046
.long 1 # 0x1
.quad __hip_fatbin
.quad 0
.size __hip_fatbin_wrapper, 24
.type __hip_gpubin_handle,@object # @__hip_gpubin_handle
.local __hip_gpubin_handle
.comm __hip_gpubin_handle,8,8
.section .init_array,"aw",@init_array
.p2align 3, 0x0
.quad __hip_module_ctor
.type __hip_cuid_,@object # @__hip_cuid_
.bss
.globl __hip_cuid_
__hip_cuid_:
.byte 0 # 0x0
.size __hip_cuid_, 1
.section ".linker-options","e",@llvm_linker_options
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym _Z25__device_stub__avg_kernelPdiidS_
.addrsig_sym __hip_module_ctor
.addrsig_sym __hip_module_dtor
.addrsig_sym _Z10avg_kernelPdiidS_
.addrsig_sym __hip_fatbin
.addrsig_sym __hip_fatbin_wrapper
.addrsig_sym __hip_cuid_ |
You are a helpful coding assistant specialized in converting CUDA source code to HIP/AMD source code. | #include <thrust/device_vector.h>
#include <thrust/extrema.h>
#include <thrust/transform.h>
#include <thrust/iterator/counting_iterator.h>
#include <thrust/functional.h>
#include <thrust/sort.h>
#include <thrust/unique.h>
#include <thrust/copy.h>
#include <iostream>
#include <cstdint>
#define PRINTER(name) print(#name, (name))
template <template <typename...> class V, typename T, typename ...Args>
void print(const char* name, const V<T,Args...> & v)
{
std::cout << name << ":\t";
thrust::copy(v.begin(), v.end(), std::ostream_iterator<T>(std::cout, "\t"));
std::cout << std::endl;
}
int main()
{
typedef uint32_t Integer;
const std::size_t per_array = 4;
const std::size_t array_num = 3;
const std::size_t total_count = array_num * per_array;
Integer demo_data[] = {1,0,1,2,2,2,0,0,0,0,0,0};
thrust::device_vector<Integer> data(demo_data, demo_data+total_count);
PRINTER(data);
// if max_element is known for your problem,
// you don't need the following operation
Integer max_element = *(thrust::max_element(data.begin(), data.end()));
std::cout << "max_element=" << max_element << std::endl;
using namespace thrust::placeholders;
// create the flags
// could be a smaller integer type as well
thrust::device_vector<uint32_t> flags(total_count);
thrust::counting_iterator<uint32_t> flags_cit(0);
thrust::transform(flags_cit,
flags_cit + total_count,
flags.begin(),
_1 / per_array);
PRINTER(flags);
// 1. transform data into unique ranges
thrust::transform(data.begin(),
data.end(),
thrust::counting_iterator<Integer>(0),
data.begin(),
_1 + (_2/per_array)*2*max_element);
PRINTER(data);
// 2. sort the transformed data
thrust::sort(data.begin(), data.end());
PRINTER(data);
// 3. eliminate duplicates per array
auto new_end = thrust::unique_by_key(data.begin(),
data.end(),
flags.begin());
uint32_t new_size = new_end.first - data.begin();
data.resize(new_size);
flags.resize(new_size);
PRINTER(data);
PRINTER(flags);
// 4. transform data back
thrust::transform(data.begin(),
data.end(),
flags.begin(),
data.begin(),
_1 - _2*2*max_element);
PRINTER(data);
} | #include <hip/hip_runtime.h>
#include <thrust/device_vector.h>
#include <thrust/extrema.h>
#include <thrust/transform.h>
#include <thrust/iterator/counting_iterator.h>
#include <thrust/functional.h>
#include <thrust/sort.h>
#include <thrust/unique.h>
#include <thrust/copy.h>
#include <iostream>
#include <cstdint>
#define PRINTER(name) print(#name, (name))
template <template <typename...> class V, typename T, typename ...Args>
void print(const char* name, const V<T,Args...> & v)
{
std::cout << name << ":\t";
thrust::copy(v.begin(), v.end(), std::ostream_iterator<T>(std::cout, "\t"));
std::cout << std::endl;
}
int main()
{
typedef uint32_t Integer;
const std::size_t per_array = 4;
const std::size_t array_num = 3;
const std::size_t total_count = array_num * per_array;
Integer demo_data[] = {1,0,1,2,2,2,0,0,0,0,0,0};
thrust::device_vector<Integer> data(demo_data, demo_data+total_count);
PRINTER(data);
// if max_element is known for your problem,
// you don't need the following operation
Integer max_element = *(thrust::max_element(data.begin(), data.end()));
std::cout << "max_element=" << max_element << std::endl;
using namespace thrust::placeholders;
// create the flags
// could be a smaller integer type as well
thrust::device_vector<uint32_t> flags(total_count);
thrust::counting_iterator<uint32_t> flags_cit(0);
thrust::transform(flags_cit,
flags_cit + total_count,
flags.begin(),
_1 / per_array);
PRINTER(flags);
// 1. transform data into unique ranges
thrust::transform(data.begin(),
data.end(),
thrust::counting_iterator<Integer>(0),
data.begin(),
_1 + (_2/per_array)*2*max_element);
PRINTER(data);
// 2. sort the transformed data
thrust::sort(data.begin(), data.end());
PRINTER(data);
// 3. eliminate duplicates per array
auto new_end = thrust::unique_by_key(data.begin(),
data.end(),
flags.begin());
uint32_t new_size = new_end.first - data.begin();
data.resize(new_size);
flags.resize(new_size);
PRINTER(data);
PRINTER(flags);
// 4. transform data back
thrust::transform(data.begin(),
data.end(),
flags.begin(),
data.begin(),
_1 - _2*2*max_element);
PRINTER(data);
} |
You are a helpful coding assistant specialized in converting CUDA source code to CUDA device assembly. | /* Derived from MLIFE exercise */
#include <stdio.h>
#include <stdlib.h>
#include <cuda.h>
#define BORN 1
#define DIES 0
#define id(r,c) ((r)*Ncolumns+(c))
/* build board */
void init(int Nrows, int Ncolumns, int **board, int **newboard, int **c_board, int **c_newboard){
int r,c,n;
*board = (int*) calloc(Nrows*Ncolumns, sizeof(int));
*newboard = (int*) calloc(Nrows*Ncolumns, sizeof(int));
/* death at the border */
for(r=0;r<Nrows;++r){
(*board)[id(r,0)] = DIES;
(*board)[id(r,Ncolumns-1)] = DIES;
(*newboard)[id(r,0)] = DIES;
(*newboard)[id(r,Ncolumns-1)] = DIES;
}
for(c=0;c<Ncolumns;++c){
(*board)[id(0,c)] = DIES;
(*board)[id(Nrows-1,c)] = DIES;
(*newboard)[id(0,c)] = DIES;
(*newboard)[id(Nrows-1,c)] = DIES;
}
/* random life */
srand48(12345);
for(r=1;r<Nrows-1;++r){
for(c=1;c<Ncolumns-1;++c){
double rn = drand48();
(*board)[id(r,c)] = BORN*(rn<0.5) + DIES*(rn>=0.5);
}
}
/* EX01: allocate DEVICE arrays for c_board and c_newboard here using cudaMalloc */
cudaMalloc(c_board, Nrows*Ncolumns*sizeof(int));
cudaMalloc(c_newboard, Nrows*Ncolumns*sizeof(int));
/* EX02: copy board state from HOST board to DEVICE c_board using cudaMemcpy */
cudaMemcpy(*c_board, *board, Nrows*Ncolumns*sizeof(int), cudaMemcpyHostToDevice);
cudaMemcpy(*c_newboard, *newboard, Nrows*Ncolumns*sizeof(int), cudaMemcpyHostToDevice);
}
void destroy(int *board, int *newboard){
free(board);
free(newboard);
}
/* EX03: convert this to a CUDA kernel */
/* EX03a: annotate to indicate a kernel */
__global__ void update(int Nrows, int Ncolumns, int *board, int *newboard){
/* EX03b: replace double loop with 2D thread array */
/* EX03c: convert thread indices and block indices into r,c */
int r = 1 + threadIdx.y + blockIdx.y*blockDim.y;
int c = 1 + threadIdx.x + blockIdx.x*blockDim.x;
if(r<Nrows-1 && c<Ncolumns-1){
/* this does not change */
int s =
board[id(r-1,c-1)]+board[id(r-1,c-0)]+board[id(r-1,c+1)]+
board[id(r+0,c-1)]+ board[id(r+0,c+1)]+
board[id(r+1,c-1)]+board[id(r+1,c-0)]+board[id(r+1,c+1)];
newboard[id(r,c)]
= (s<2)*DIES + (s==2)*board[id(r,c)] + (s==3)*BORN + (s>3)*DIES;
}
}
/* EX04: add a copy from DEVICE to HOST using cudaMemcpy */
void print(int Nrows, int Ncolumns, int *board, int *c_board){
/* EX04: put cudaMemcpy here to copy from DEVICE c_board to HOST board*/
cudaMemcpy(board, c_board, Nrows*Ncolumns*sizeof(int), cudaMemcpyDeviceToHost);
/* No need tochange this bit */
system("clear");
for(int r=0;r<Nrows;++r){
for(int c=0;c<Ncolumns;++c){
if(board[id(r,c)]==BORN) printf("*");
else printf(" ");
}
printf("\n");
}
}
int main(int argc, char **argv){
if(argc<3){
printf("usage: main [Nrows] [Ncolumns]\n");
exit(1);
}
/* initialize board */
int Nrows = atoi(argv[1]);
int Ncolumns = atoi(argv[2]);
int *board, *newboard;
int *c_board, *c_newboard;
init(Nrows, Ncolumns, &board, &newboard, &c_board, &c_newboard);
/* run some iterations */
int Nit = 100;
for(int it=0;it<Nit;++it){
/* EX05a: define thread-block size and grid size here */
int T = 16;
dim3 bDim(T,T,1);
dim3 gDim((Ncolumns-2+T-1)/T, (Nrows-2+T-1)/T,1);
/* EX05b: add kernel launch syntax here */
update <<< gDim, bDim >>> (Nrows, Ncolumns, c_board, c_newboard);
/* EX05c: add kernel launch syntax here */
update <<< gDim, bDim >>> (Nrows, Ncolumns, c_newboard, c_board);
print(Nrows, Ncolumns, board, c_board);
}
destroy(board, newboard);
exit(0);
return 0;
} | code for sm_80
Function : _Z6updateiiPiS_
.headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)"
/*0000*/ IMAD.MOV.U32 R1, RZ, RZ, c[0x0][0x28] ; /* 0x00000a00ff017624 */
/* 0x000fe400078e00ff */
/*0010*/ S2R R4, SR_TID.X ; /* 0x0000000000047919 */
/* 0x000e220000002100 */
/*0020*/ UMOV UR4, 0x1 ; /* 0x0000000100047882 */
/* 0x000fe40000000000 */
/*0030*/ ULDC.64 UR6, c[0x0][0x160] ; /* 0x0000580000067ab9 */
/* 0x000fe20000000a00 */
/*0040*/ S2R R5, SR_CTAID.X ; /* 0x0000000000057919 */
/* 0x000e220000002500 */
/*0050*/ UIADD3 UR5, -UR4, UR7, URZ ; /* 0x0000000704057290 */
/* 0x000fe4000fffe13f */
/*0060*/ UIADD3 UR4, -UR4, UR6, URZ ; /* 0x0000000604047290 */
/* 0x000fe2000fffe13f */
/*0070*/ S2R R2, SR_TID.Y ; /* 0x0000000000027919 */
/* 0x000e680000002200 */
/*0080*/ S2R R3, SR_CTAID.Y ; /* 0x0000000000037919 */
/* 0x000e620000002600 */
/*0090*/ IMAD R4, R5, c[0x0][0x0], R4 ; /* 0x0000000005047a24 */
/* 0x001fca00078e0204 */
/*00a0*/ IADD3 R0, R4, 0x1, RZ ; /* 0x0000000104007810 */
/* 0x000fe20007ffe0ff */
/*00b0*/ IMAD R2, R3, c[0x0][0x4], R2 ; /* 0x0000010003027a24 */
/* 0x002fc600078e0202 */
/*00c0*/ ISETP.GE.AND P0, PT, R0, UR5, PT ; /* 0x0000000500007c0c */
/* 0x000fe4000bf06270 */
/*00d0*/ IADD3 R3, R2, 0x1, RZ ; /* 0x0000000102037810 */
/* 0x000fc80007ffe0ff */
/*00e0*/ ISETP.GE.OR P0, PT, R3, UR4, P0 ; /* 0x0000000403007c0c */
/* 0x000fda0008706670 */
/*00f0*/ @P0 EXIT ; /* 0x000000000000094d */
/* 0x000fea0003800000 */
/*0100*/ HFMA2.MMA R0, -RZ, RZ, 0, 2.384185791015625e-07 ; /* 0x00000004ff007435 */
/* 0x000fe200000001ff */
/*0110*/ IMAD.MOV.U32 R6, RZ, RZ, c[0x0][0x164] ; /* 0x00005900ff067624 */
/* 0x000fe200078e00ff */
/*0120*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */
/* 0x000fe20000000a00 */
/*0130*/ IMAD R5, R2, c[0x0][0x164], R4.reuse ; /* 0x0000590002057a24 */
/* 0x100fe400078e0204 */
/*0140*/ IMAD R7, R3.reuse, R6, c[0x0][0x164] ; /* 0x0000590003077624 */
/* 0x040fe400078e0206 */
/*0150*/ IMAD R11, R3, c[0x0][0x164], R4 ; /* 0x00005900030b7a24 */
/* 0x000fe400078e0204 */
/*0160*/ IMAD.IADD R7, R4, 0x1, R7 ; /* 0x0000000104077824 */
/* 0x000fe400078e0207 */
/*0170*/ IMAD.WIDE R2, R5, R0, c[0x0][0x168] ; /* 0x00005a0005027625 */
/* 0x000fc800078e0200 */
/*0180*/ IMAD.WIDE R4, R11, R0.reuse, c[0x0][0x168] ; /* 0x00005a000b047625 */
/* 0x080fe200078e0200 */
/*0190*/ LDG.E R8, [R2.64+0x4] ; /* 0x0000040402087981 */
/* 0x0000a8000c1e1900 */
/*01a0*/ LDG.E R9, [R2.64] ; /* 0x0000000402097981 */
/* 0x0000a2000c1e1900 */
/*01b0*/ IMAD.WIDE R6, R7, R0, c[0x0][0x168] ; /* 0x00005a0007067625 */
/* 0x000fc600078e0200 */
/*01c0*/ LDG.E R10, [R2.64+0x8] ; /* 0x00000804020a7981 */
/* 0x0000a8000c1e1900 */
/*01d0*/ LDG.E R13, [R4.64] ; /* 0x00000004040d7981 */
/* 0x000ee8000c1e1900 */
/*01e0*/ LDG.E R12, [R4.64+0x8] ; /* 0x00000804040c7981 */
/* 0x000ee8000c1e1900 */
/*01f0*/ LDG.E R15, [R6.64] ; /* 0x00000004060f7981 */
/* 0x000f28000c1e1900 */
/*0200*/ LDG.E R14, [R6.64+0x4] ; /* 0x00000404060e7981 */
/* 0x000f28000c1e1900 */
/*0210*/ LDG.E R17, [R6.64+0x8] ; /* 0x0000080406117981 */
/* 0x000f68000c1e1900 */
/*0220*/ LDG.E R16, [R4.64+0x4] ; /* 0x0000040404107981 */
/* 0x000f62000c1e1900 */
/*0230*/ IMAD.WIDE R2, R11, R0, c[0x0][0x170] ; /* 0x00005c000b027625 */
/* 0x001fe200078e0200 */
/*0240*/ IADD3 R8, R10, R8, R9 ; /* 0x000000080a087210 */
/* 0x004fc80007ffe009 */
/*0250*/ IADD3 R8, R12, R8, R13 ; /* 0x000000080c087210 */
/* 0x008fc80007ffe00d */
/*0260*/ IADD3 R8, R14, R8, R15 ; /* 0x000000080e087210 */
/* 0x010fc80007ffe00f */
/*0270*/ IADD3 R8, R8, R17, RZ ; /* 0x0000001108087210 */
/* 0x020fc80007ffe0ff */
/*0280*/ ISETP.NE.AND P0, PT, R8.reuse, 0x2, PT ; /* 0x000000020800780c */
/* 0x040fe40003f05270 */
/*0290*/ ISETP.NE.AND P1, PT, R8, 0x3, PT ; /* 0x000000030800780c */
/* 0x000fe40003f25270 */
/*02a0*/ SEL R16, R16, RZ, !P0 ; /* 0x000000ff10107207 */
/* 0x000fe40004000000 */
/*02b0*/ SEL R9, RZ, 0x1, P1 ; /* 0x00000001ff097807 */
/* 0x000fca0000800000 */
/*02c0*/ IMAD.IADD R9, R16, 0x1, R9 ; /* 0x0000000110097824 */
/* 0x000fca00078e0209 */
/*02d0*/ STG.E [R2.64+0x4], R9 ; /* 0x0000040902007986 */
/* 0x000fe2000c101904 */
/*02e0*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*02f0*/ BRA 0x2f0; /* 0xfffffff000007947 */
/* 0x000fc0000383ffff */
/*0300*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0310*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0320*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0330*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0340*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0350*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0360*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0370*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
.......... |
You are a helpful coding assistant specialized in converting CUDA source code to CUDA host assembly. | /* Derived from MLIFE exercise */
#include <stdio.h>
#include <stdlib.h>
#include <cuda.h>
#define BORN 1
#define DIES 0
#define id(r,c) ((r)*Ncolumns+(c))
/* build board */
void init(int Nrows, int Ncolumns, int **board, int **newboard, int **c_board, int **c_newboard){
int r,c,n;
*board = (int*) calloc(Nrows*Ncolumns, sizeof(int));
*newboard = (int*) calloc(Nrows*Ncolumns, sizeof(int));
/* death at the border */
for(r=0;r<Nrows;++r){
(*board)[id(r,0)] = DIES;
(*board)[id(r,Ncolumns-1)] = DIES;
(*newboard)[id(r,0)] = DIES;
(*newboard)[id(r,Ncolumns-1)] = DIES;
}
for(c=0;c<Ncolumns;++c){
(*board)[id(0,c)] = DIES;
(*board)[id(Nrows-1,c)] = DIES;
(*newboard)[id(0,c)] = DIES;
(*newboard)[id(Nrows-1,c)] = DIES;
}
/* random life */
srand48(12345);
for(r=1;r<Nrows-1;++r){
for(c=1;c<Ncolumns-1;++c){
double rn = drand48();
(*board)[id(r,c)] = BORN*(rn<0.5) + DIES*(rn>=0.5);
}
}
/* EX01: allocate DEVICE arrays for c_board and c_newboard here using cudaMalloc */
cudaMalloc(c_board, Nrows*Ncolumns*sizeof(int));
cudaMalloc(c_newboard, Nrows*Ncolumns*sizeof(int));
/* EX02: copy board state from HOST board to DEVICE c_board using cudaMemcpy */
cudaMemcpy(*c_board, *board, Nrows*Ncolumns*sizeof(int), cudaMemcpyHostToDevice);
cudaMemcpy(*c_newboard, *newboard, Nrows*Ncolumns*sizeof(int), cudaMemcpyHostToDevice);
}
void destroy(int *board, int *newboard){
free(board);
free(newboard);
}
/* EX03: convert this to a CUDA kernel */
/* EX03a: annotate to indicate a kernel */
__global__ void update(int Nrows, int Ncolumns, int *board, int *newboard){
/* EX03b: replace double loop with 2D thread array */
/* EX03c: convert thread indices and block indices into r,c */
int r = 1 + threadIdx.y + blockIdx.y*blockDim.y;
int c = 1 + threadIdx.x + blockIdx.x*blockDim.x;
if(r<Nrows-1 && c<Ncolumns-1){
/* this does not change */
int s =
board[id(r-1,c-1)]+board[id(r-1,c-0)]+board[id(r-1,c+1)]+
board[id(r+0,c-1)]+ board[id(r+0,c+1)]+
board[id(r+1,c-1)]+board[id(r+1,c-0)]+board[id(r+1,c+1)];
newboard[id(r,c)]
= (s<2)*DIES + (s==2)*board[id(r,c)] + (s==3)*BORN + (s>3)*DIES;
}
}
/* EX04: add a copy from DEVICE to HOST using cudaMemcpy */
void print(int Nrows, int Ncolumns, int *board, int *c_board){
/* EX04: put cudaMemcpy here to copy from DEVICE c_board to HOST board*/
cudaMemcpy(board, c_board, Nrows*Ncolumns*sizeof(int), cudaMemcpyDeviceToHost);
/* No need tochange this bit */
system("clear");
for(int r=0;r<Nrows;++r){
for(int c=0;c<Ncolumns;++c){
if(board[id(r,c)]==BORN) printf("*");
else printf(" ");
}
printf("\n");
}
}
int main(int argc, char **argv){
if(argc<3){
printf("usage: main [Nrows] [Ncolumns]\n");
exit(1);
}
/* initialize board */
int Nrows = atoi(argv[1]);
int Ncolumns = atoi(argv[2]);
int *board, *newboard;
int *c_board, *c_newboard;
init(Nrows, Ncolumns, &board, &newboard, &c_board, &c_newboard);
/* run some iterations */
int Nit = 100;
for(int it=0;it<Nit;++it){
/* EX05a: define thread-block size and grid size here */
int T = 16;
dim3 bDim(T,T,1);
dim3 gDim((Ncolumns-2+T-1)/T, (Nrows-2+T-1)/T,1);
/* EX05b: add kernel launch syntax here */
update <<< gDim, bDim >>> (Nrows, Ncolumns, c_board, c_newboard);
/* EX05c: add kernel launch syntax here */
update <<< gDim, bDim >>> (Nrows, Ncolumns, c_newboard, c_board);
print(Nrows, Ncolumns, board, c_board);
}
destroy(board, newboard);
exit(0);
return 0;
} | .file "tmpxft_00093e09_00000000-6_solution.cudafe1.cpp"
.text
#APP
#NO_APP
.type _ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2063:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaUnregisterFatBinary@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2063:
.size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
.globl _Z4initiiPPiS0_S0_S0_
.type _Z4initiiPPiS0_S0_S0_, @function
_Z4initiiPPiS0_S0_S0_:
.LFB2057:
.cfi_startproc
endbr64
pushq %r15
.cfi_def_cfa_offset 16
.cfi_offset 15, -16
pushq %r14
.cfi_def_cfa_offset 24
.cfi_offset 14, -24
pushq %r13
.cfi_def_cfa_offset 32
.cfi_offset 13, -32
pushq %r12
.cfi_def_cfa_offset 40
.cfi_offset 12, -40
pushq %rbp
.cfi_def_cfa_offset 48
.cfi_offset 6, -48
pushq %rbx
.cfi_def_cfa_offset 56
.cfi_offset 3, -56
subq $40, %rsp
.cfi_def_cfa_offset 96
movl %edi, %ebx
movl %esi, %r14d
movq %rdx, %rbp
movq %rcx, %r13
movq %r8, 16(%rsp)
movq %r9, 24(%rsp)
movl %edi, %r12d
imull %esi, %r12d
movslq %r12d, %rax
movq %rax, %r15
movq %rax, 8(%rsp)
movl $4, %esi
movq %rax, %rdi
call calloc@PLT
movq %rax, 0(%rbp)
movl $4, %esi
movq %r15, %rdi
call calloc@PLT
movq %rax, 0(%r13)
testl %ebx, %ebx
jle .L4
movslq %r14d, %rdi
salq $2, %rdi
movl $0, %eax
movl $0, %edx
leaq -4(%rdi), %r8
.L5:
movq 0(%rbp), %rcx
movl $0, (%rcx,%rax)
leaq (%r8,%rax), %rcx
movq 0(%rbp), %rsi
movl $0, (%rsi,%rcx)
movq 0(%r13), %rsi
movl $0, (%rsi,%rax)
movq 0(%r13), %rsi
movl $0, (%rsi,%rcx)
addl $1, %edx
addq %rdi, %rax
cmpl %edx, %ebx
jne .L5
testl %r14d, %r14d
jle .L6
.L13:
movslq %r14d, %rdi
salq $2, %rdi
subl %r14d, %r12d
movslq %r12d, %rsi
salq $2, %rsi
movl $0, %eax
.L7:
movq 0(%rbp), %rdx
movl $0, (%rdx,%rax)
leaq (%rax,%rsi), %rdx
movq 0(%rbp), %rcx
movl $0, (%rcx,%rdx)
movq 0(%r13), %rcx
movl $0, (%rcx,%rax)
movq 0(%r13), %rcx
movl $0, (%rcx,%rdx)
addq $4, %rax
cmpq %rdi, %rax
jne .L7
.L6:
movl $12345, %edi
call srand48@PLT
cmpl $2, %ebx
jle .L8
leal -1(%rbx), %eax
movl %eax, 4(%rsp)
movl %r14d, (%rsp)
movl $1, %r15d
jmp .L9
.L11:
movslq (%rsp), %rax
leaq 4(,%rax,4), %rbx
leal -1(%r14), %r12d
addq %rax, %r12
salq $2, %r12
.L10:
call drand48@PLT
movq 0(%rbp), %rax
movsd .LC0(%rip), %xmm1
comisd %xmm0, %xmm1
seta %dl
movzbl %dl, %edx
movl %edx, (%rax,%rbx)
addq $4, %rbx
cmpq %r12, %rbx
jne .L10
.L12:
addl $1, %r15d
addl %r14d, (%rsp)
movl 4(%rsp), %eax
cmpl %eax, %r15d
je .L8
.L9:
cmpl $2, %r14d
jg .L11
jmp .L12
.L4:
testl %r14d, %r14d
jg .L13
movl $12345, %edi
call srand48@PLT
.L8:
movq 8(%rsp), %rbx
salq $2, %rbx
movq %rbx, %rsi
movq 16(%rsp), %r15
movq %r15, %rdi
call cudaMalloc@PLT
movq %rbx, %rsi
movq 24(%rsp), %r14
movq %r14, %rdi
call cudaMalloc@PLT
movq 0(%rbp), %rsi
movq (%r15), %rdi
movl $1, %ecx
movq %rbx, %rdx
call cudaMemcpy@PLT
movq 0(%r13), %rsi
movq (%r14), %rdi
movl $1, %ecx
movq %rbx, %rdx
call cudaMemcpy@PLT
addq $40, %rsp
.cfi_def_cfa_offset 56
popq %rbx
.cfi_def_cfa_offset 48
popq %rbp
.cfi_def_cfa_offset 40
popq %r12
.cfi_def_cfa_offset 32
popq %r13
.cfi_def_cfa_offset 24
popq %r14
.cfi_def_cfa_offset 16
popq %r15
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2057:
.size _Z4initiiPPiS0_S0_S0_, .-_Z4initiiPPiS0_S0_S0_
.globl _Z7destroyPiS_
.type _Z7destroyPiS_, @function
_Z7destroyPiS_:
.LFB2058:
.cfi_startproc
endbr64
pushq %rbx
.cfi_def_cfa_offset 16
.cfi_offset 3, -16
movq %rsi, %rbx
call free@PLT
movq %rbx, %rdi
call free@PLT
popq %rbx
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2058:
.size _Z7destroyPiS_, .-_Z7destroyPiS_
.section .rodata.str1.1,"aMS",@progbits,1
.LC1:
.string "clear"
.LC2:
.string "*"
.LC3:
.string " "
.LC4:
.string "\n"
.text
.globl _Z5printiiPiS_
.type _Z5printiiPiS_, @function
_Z5printiiPiS_:
.LFB2059:
.cfi_startproc
endbr64
pushq %r15
.cfi_def_cfa_offset 16
.cfi_offset 15, -16
pushq %r14
.cfi_def_cfa_offset 24
.cfi_offset 14, -24
pushq %r13
.cfi_def_cfa_offset 32
.cfi_offset 13, -32
pushq %r12
.cfi_def_cfa_offset 40
.cfi_offset 12, -40
pushq %rbp
.cfi_def_cfa_offset 48
.cfi_offset 6, -48
pushq %rbx
.cfi_def_cfa_offset 56
.cfi_offset 3, -56
subq $24, %rsp
.cfi_def_cfa_offset 80
movl %edi, %ebx
movl %edi, 4(%rsp)
movl %esi, %r13d
movq %rdx, %rdi
movq %rdx, 8(%rsp)
movq %rcx, %rsi
movl %ebx, %eax
imull %r13d, %eax
movslq %eax, %rdx
salq $2, %rdx
movl $2, %ecx
call cudaMemcpy@PLT
leaq .LC1(%rip), %rdi
call system@PLT
testl %ebx, %ebx
jle .L23
movl $0, %r15d
movl $0, %r14d
leaq .LC3(%rip), %r12
jmp .L25
.L26:
movq %r12, %rsi
movl $2, %edi
movl $0, %eax
call __printf_chk@PLT
.L27:
addq $4, %rbx
cmpq %rbp, %rbx
je .L30
.L28:
cmpl $1, (%rbx)
jne .L26
leaq .LC2(%rip), %rsi
movl $2, %edi
movl $0, %eax
call __printf_chk@PLT
jmp .L27
.L30:
leaq .LC4(%rip), %rsi
movl $2, %edi
movl $0, %eax
call __printf_chk@PLT
addl $1, %r14d
addl %r13d, %r15d
cmpl %r14d, 4(%rsp)
je .L23
.L25:
testl %r13d, %r13d
jle .L30
movslq %r15d, %rdx
movq 8(%rsp), %rcx
leaq (%rcx,%rdx,4), %rbx
movslq %r13d, %rax
addq %rdx, %rax
leaq (%rcx,%rax,4), %rbp
jmp .L28
.L23:
addq $24, %rsp
.cfi_def_cfa_offset 56
popq %rbx
.cfi_def_cfa_offset 48
popq %rbp
.cfi_def_cfa_offset 40
popq %r12
.cfi_def_cfa_offset 32
popq %r13
.cfi_def_cfa_offset 24
popq %r14
.cfi_def_cfa_offset 16
popq %r15
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2059:
.size _Z5printiiPiS_, .-_Z5printiiPiS_
.globl _Z29__device_stub__Z6updateiiPiS_iiPiS_
.type _Z29__device_stub__Z6updateiiPiS_iiPiS_, @function
_Z29__device_stub__Z6updateiiPiS_iiPiS_:
.LFB2085:
.cfi_startproc
endbr64
subq $152, %rsp
.cfi_def_cfa_offset 160
movl %edi, 28(%rsp)
movl %esi, 24(%rsp)
movq %rdx, 16(%rsp)
movq %rcx, 8(%rsp)
movq %fs:40, %rax
movq %rax, 136(%rsp)
xorl %eax, %eax
leaq 28(%rsp), %rax
movq %rax, 96(%rsp)
leaq 24(%rsp), %rax
movq %rax, 104(%rsp)
leaq 16(%rsp), %rax
movq %rax, 112(%rsp)
leaq 8(%rsp), %rax
movq %rax, 120(%rsp)
movl $1, 48(%rsp)
movl $1, 52(%rsp)
movl $1, 56(%rsp)
movl $1, 60(%rsp)
movl $1, 64(%rsp)
movl $1, 68(%rsp)
leaq 40(%rsp), %rcx
leaq 32(%rsp), %rdx
leaq 60(%rsp), %rsi
leaq 48(%rsp), %rdi
call __cudaPopCallConfiguration@PLT
testl %eax, %eax
je .L37
.L33:
movq 136(%rsp), %rax
subq %fs:40, %rax
jne .L38
addq $152, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 8
ret
.L37:
.cfi_restore_state
pushq 40(%rsp)
.cfi_def_cfa_offset 168
pushq 40(%rsp)
.cfi_def_cfa_offset 176
leaq 112(%rsp), %r9
movq 76(%rsp), %rcx
movl 84(%rsp), %r8d
movq 64(%rsp), %rsi
movl 72(%rsp), %edx
leaq _Z6updateiiPiS_(%rip), %rdi
call cudaLaunchKernel@PLT
addq $16, %rsp
.cfi_def_cfa_offset 160
jmp .L33
.L38:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE2085:
.size _Z29__device_stub__Z6updateiiPiS_iiPiS_, .-_Z29__device_stub__Z6updateiiPiS_iiPiS_
.globl _Z6updateiiPiS_
.type _Z6updateiiPiS_, @function
_Z6updateiiPiS_:
.LFB2086:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
call _Z29__device_stub__Z6updateiiPiS_iiPiS_
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2086:
.size _Z6updateiiPiS_, .-_Z6updateiiPiS_
.section .rodata.str1.8,"aMS",@progbits,1
.align 8
.LC5:
.string "usage: main [Nrows] [Ncolumns]\n"
.text
.globl main
.type main, @function
main:
.LFB2060:
.cfi_startproc
endbr64
pushq %r15
.cfi_def_cfa_offset 16
.cfi_offset 15, -16
pushq %r14
.cfi_def_cfa_offset 24
.cfi_offset 14, -24
pushq %r13
.cfi_def_cfa_offset 32
.cfi_offset 13, -32
pushq %r12
.cfi_def_cfa_offset 40
.cfi_offset 12, -40
pushq %rbp
.cfi_def_cfa_offset 48
.cfi_offset 6, -48
pushq %rbx
.cfi_def_cfa_offset 56
.cfi_offset 3, -56
subq $72, %rsp
.cfi_def_cfa_offset 128
movq %fs:40, %rax
movq %rax, 56(%rsp)
xorl %eax, %eax
cmpl $2, %edi
jg .L42
leaq .LC5(%rip), %rsi
movl $2, %edi
call __printf_chk@PLT
movl $1, %edi
call exit@PLT
.L42:
movq %rsi, %rbx
movq 8(%rsi), %rdi
movl $10, %edx
movl $0, %esi
call __isoc23_strtol@PLT
movq %rax, %rbp
movl %eax, %r12d
movq 16(%rbx), %rdi
movl $10, %edx
movl $0, %esi
call __isoc23_strtol@PLT
movq %rax, %rbx
movl %eax, %r13d
leaq 8(%rsp), %rcx
movq %rsp, %rdx
leaq 24(%rsp), %r9
leaq 16(%rsp), %r8
movl %eax, %esi
movl %ebp, %edi
call _Z4initiiPPiS0_S0_S0_
leal 13(%rbp), %eax
movl $16, %ecx
cltd
idivl %ecx
movl %eax, %r15d
leal 13(%rbx), %eax
cltd
idivl %ecx
movl %eax, %r14d
movl $100, %ebx
jmp .L45
.L50:
movq 24(%rsp), %rcx
movq 16(%rsp), %rdx
movl %r13d, %esi
movl %r12d, %edi
call _Z29__device_stub__Z6updateiiPiS_iiPiS_
jmp .L43
.L44:
movq (%rsp), %rbp
movq 16(%rsp), %rcx
movq %rbp, %rdx
movl %r13d, %esi
movl %r12d, %edi
call _Z5printiiPiS_
subl $1, %ebx
je .L49
.L45:
movl $16, 32(%rsp)
movl $16, 36(%rsp)
movl $1, 40(%rsp)
movl %r14d, 44(%rsp)
movl %r15d, 48(%rsp)
movl $1, 52(%rsp)
movl $0, %r9d
movl $0, %r8d
movq 32(%rsp), %rdx
movl $1, %ecx
movq 44(%rsp), %rdi
movl $1, %esi
call __cudaPushCallConfiguration@PLT
testl %eax, %eax
je .L50
.L43:
movl 40(%rsp), %ecx
movl $0, %r9d
movl $0, %r8d
movq 32(%rsp), %rdx
movq 44(%rsp), %rdi
movl 52(%rsp), %esi
call __cudaPushCallConfiguration@PLT
testl %eax, %eax
jne .L44
movq 16(%rsp), %rcx
movq 24(%rsp), %rdx
movl %r13d, %esi
movl %r12d, %edi
call _Z29__device_stub__Z6updateiiPiS_iiPiS_
jmp .L44
.L49:
movq 8(%rsp), %rsi
movq %rbp, %rdi
call _Z7destroyPiS_
movl $0, %edi
call exit@PLT
.cfi_endproc
.LFE2060:
.size main, .-main
.section .rodata.str1.1
.LC6:
.string "_Z6updateiiPiS_"
.text
.type _ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2088:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
leaq _ZL15__fatDeviceText(%rip), %rdi
call __cudaRegisterFatBinary@PLT
movq %rax, %rdi
movq %rax, _ZL20__cudaFatCubinHandle(%rip)
pushq $0
.cfi_def_cfa_offset 24
pushq $0
.cfi_def_cfa_offset 32
pushq $0
.cfi_def_cfa_offset 40
pushq $0
.cfi_def_cfa_offset 48
movl $0, %r9d
movl $-1, %r8d
leaq .LC6(%rip), %rdx
movq %rdx, %rcx
leaq _Z6updateiiPiS_(%rip), %rsi
call __cudaRegisterFunction@PLT
addq $32, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaRegisterFatBinaryEnd@PLT
leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
call atexit@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2088:
.size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
.section .init_array,"aw"
.align 8
.quad _ZL24__sti____cudaRegisterAllv
.section .nvFatBinSegment,"aw"
.align 8
.type _ZL15__fatDeviceText, @object
.size _ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
.long 1180844977
.long 1
.quad fatbinData
.quad 0
.local _ZL20__cudaFatCubinHandle
.comm _ZL20__cudaFatCubinHandle,8,8
.section .rodata.cst8,"aM",@progbits,8
.align 8
.LC0:
.long 0
.long 1071644672
.ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
.section .note.GNU-stack,"",@progbits
.section .note.gnu.property,"a"
.align 8
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.string "GNU"
1:
.align 8
.long 0xc0000002
.long 3f - 2f
2:
.long 0x3
3:
.align 8
4: |
You are a helpful coding assistant specialized in converting CUDA source code to HIP/AMD source code. | /* Derived from MLIFE exercise */
#include <stdio.h>
#include <stdlib.h>
#include <cuda.h>
#define BORN 1
#define DIES 0
#define id(r,c) ((r)*Ncolumns+(c))
/* build board */
void init(int Nrows, int Ncolumns, int **board, int **newboard, int **c_board, int **c_newboard){
int r,c,n;
*board = (int*) calloc(Nrows*Ncolumns, sizeof(int));
*newboard = (int*) calloc(Nrows*Ncolumns, sizeof(int));
/* death at the border */
for(r=0;r<Nrows;++r){
(*board)[id(r,0)] = DIES;
(*board)[id(r,Ncolumns-1)] = DIES;
(*newboard)[id(r,0)] = DIES;
(*newboard)[id(r,Ncolumns-1)] = DIES;
}
for(c=0;c<Ncolumns;++c){
(*board)[id(0,c)] = DIES;
(*board)[id(Nrows-1,c)] = DIES;
(*newboard)[id(0,c)] = DIES;
(*newboard)[id(Nrows-1,c)] = DIES;
}
/* random life */
srand48(12345);
for(r=1;r<Nrows-1;++r){
for(c=1;c<Ncolumns-1;++c){
double rn = drand48();
(*board)[id(r,c)] = BORN*(rn<0.5) + DIES*(rn>=0.5);
}
}
/* EX01: allocate DEVICE arrays for c_board and c_newboard here using cudaMalloc */
cudaMalloc(c_board, Nrows*Ncolumns*sizeof(int));
cudaMalloc(c_newboard, Nrows*Ncolumns*sizeof(int));
/* EX02: copy board state from HOST board to DEVICE c_board using cudaMemcpy */
cudaMemcpy(*c_board, *board, Nrows*Ncolumns*sizeof(int), cudaMemcpyHostToDevice);
cudaMemcpy(*c_newboard, *newboard, Nrows*Ncolumns*sizeof(int), cudaMemcpyHostToDevice);
}
void destroy(int *board, int *newboard){
free(board);
free(newboard);
}
/* EX03: convert this to a CUDA kernel */
/* EX03a: annotate to indicate a kernel */
__global__ void update(int Nrows, int Ncolumns, int *board, int *newboard){
/* EX03b: replace double loop with 2D thread array */
/* EX03c: convert thread indices and block indices into r,c */
int r = 1 + threadIdx.y + blockIdx.y*blockDim.y;
int c = 1 + threadIdx.x + blockIdx.x*blockDim.x;
if(r<Nrows-1 && c<Ncolumns-1){
/* this does not change */
int s =
board[id(r-1,c-1)]+board[id(r-1,c-0)]+board[id(r-1,c+1)]+
board[id(r+0,c-1)]+ board[id(r+0,c+1)]+
board[id(r+1,c-1)]+board[id(r+1,c-0)]+board[id(r+1,c+1)];
newboard[id(r,c)]
= (s<2)*DIES + (s==2)*board[id(r,c)] + (s==3)*BORN + (s>3)*DIES;
}
}
/* EX04: add a copy from DEVICE to HOST using cudaMemcpy */
void print(int Nrows, int Ncolumns, int *board, int *c_board){
/* EX04: put cudaMemcpy here to copy from DEVICE c_board to HOST board*/
cudaMemcpy(board, c_board, Nrows*Ncolumns*sizeof(int), cudaMemcpyDeviceToHost);
/* No need tochange this bit */
system("clear");
for(int r=0;r<Nrows;++r){
for(int c=0;c<Ncolumns;++c){
if(board[id(r,c)]==BORN) printf("*");
else printf(" ");
}
printf("\n");
}
}
int main(int argc, char **argv){
if(argc<3){
printf("usage: main [Nrows] [Ncolumns]\n");
exit(1);
}
/* initialize board */
int Nrows = atoi(argv[1]);
int Ncolumns = atoi(argv[2]);
int *board, *newboard;
int *c_board, *c_newboard;
init(Nrows, Ncolumns, &board, &newboard, &c_board, &c_newboard);
/* run some iterations */
int Nit = 100;
for(int it=0;it<Nit;++it){
/* EX05a: define thread-block size and grid size here */
int T = 16;
dim3 bDim(T,T,1);
dim3 gDim((Ncolumns-2+T-1)/T, (Nrows-2+T-1)/T,1);
/* EX05b: add kernel launch syntax here */
update <<< gDim, bDim >>> (Nrows, Ncolumns, c_board, c_newboard);
/* EX05c: add kernel launch syntax here */
update <<< gDim, bDim >>> (Nrows, Ncolumns, c_newboard, c_board);
print(Nrows, Ncolumns, board, c_board);
}
destroy(board, newboard);
exit(0);
return 0;
} | /* Derived from MLIFE exercise */
#include <stdio.h>
#include <stdlib.h>
#include <hip/hip_runtime.h>
#define BORN 1
#define DIES 0
#define id(r,c) ((r)*Ncolumns+(c))
/* build board */
void init(int Nrows, int Ncolumns, int **board, int **newboard, int **c_board, int **c_newboard){
int r,c,n;
*board = (int*) calloc(Nrows*Ncolumns, sizeof(int));
*newboard = (int*) calloc(Nrows*Ncolumns, sizeof(int));
/* death at the border */
for(r=0;r<Nrows;++r){
(*board)[id(r,0)] = DIES;
(*board)[id(r,Ncolumns-1)] = DIES;
(*newboard)[id(r,0)] = DIES;
(*newboard)[id(r,Ncolumns-1)] = DIES;
}
for(c=0;c<Ncolumns;++c){
(*board)[id(0,c)] = DIES;
(*board)[id(Nrows-1,c)] = DIES;
(*newboard)[id(0,c)] = DIES;
(*newboard)[id(Nrows-1,c)] = DIES;
}
/* random life */
srand48(12345);
for(r=1;r<Nrows-1;++r){
for(c=1;c<Ncolumns-1;++c){
double rn = drand48();
(*board)[id(r,c)] = BORN*(rn<0.5) + DIES*(rn>=0.5);
}
}
/* EX01: allocate DEVICE arrays for c_board and c_newboard here using cudaMalloc */
hipMalloc(c_board, Nrows*Ncolumns*sizeof(int));
hipMalloc(c_newboard, Nrows*Ncolumns*sizeof(int));
/* EX02: copy board state from HOST board to DEVICE c_board using cudaMemcpy */
hipMemcpy(*c_board, *board, Nrows*Ncolumns*sizeof(int), hipMemcpyHostToDevice);
hipMemcpy(*c_newboard, *newboard, Nrows*Ncolumns*sizeof(int), hipMemcpyHostToDevice);
}
void destroy(int *board, int *newboard){
free(board);
free(newboard);
}
/* EX03: convert this to a CUDA kernel */
/* EX03a: annotate to indicate a kernel */
__global__ void update(int Nrows, int Ncolumns, int *board, int *newboard){
/* EX03b: replace double loop with 2D thread array */
/* EX03c: convert thread indices and block indices into r,c */
int r = 1 + threadIdx.y + blockIdx.y*blockDim.y;
int c = 1 + threadIdx.x + blockIdx.x*blockDim.x;
if(r<Nrows-1 && c<Ncolumns-1){
/* this does not change */
int s =
board[id(r-1,c-1)]+board[id(r-1,c-0)]+board[id(r-1,c+1)]+
board[id(r+0,c-1)]+ board[id(r+0,c+1)]+
board[id(r+1,c-1)]+board[id(r+1,c-0)]+board[id(r+1,c+1)];
newboard[id(r,c)]
= (s<2)*DIES + (s==2)*board[id(r,c)] + (s==3)*BORN + (s>3)*DIES;
}
}
/* EX04: add a copy from DEVICE to HOST using cudaMemcpy */
void print(int Nrows, int Ncolumns, int *board, int *c_board){
/* EX04: put cudaMemcpy here to copy from DEVICE c_board to HOST board*/
hipMemcpy(board, c_board, Nrows*Ncolumns*sizeof(int), hipMemcpyDeviceToHost);
/* No need tochange this bit */
system("clear");
for(int r=0;r<Nrows;++r){
for(int c=0;c<Ncolumns;++c){
if(board[id(r,c)]==BORN) printf("*");
else printf(" ");
}
printf("\n");
}
}
int main(int argc, char **argv){
if(argc<3){
printf("usage: main [Nrows] [Ncolumns]\n");
exit(1);
}
/* initialize board */
int Nrows = atoi(argv[1]);
int Ncolumns = atoi(argv[2]);
int *board, *newboard;
int *c_board, *c_newboard;
init(Nrows, Ncolumns, &board, &newboard, &c_board, &c_newboard);
/* run some iterations */
int Nit = 100;
for(int it=0;it<Nit;++it){
/* EX05a: define thread-block size and grid size here */
int T = 16;
dim3 bDim(T,T,1);
dim3 gDim((Ncolumns-2+T-1)/T, (Nrows-2+T-1)/T,1);
/* EX05b: add kernel launch syntax here */
update <<< gDim, bDim >>> (Nrows, Ncolumns, c_board, c_newboard);
/* EX05c: add kernel launch syntax here */
update <<< gDim, bDim >>> (Nrows, Ncolumns, c_newboard, c_board);
print(Nrows, Ncolumns, board, c_board);
}
destroy(board, newboard);
exit(0);
return 0;
} |
You are a helpful coding assistant specialized in converting HIP source code to AMD device assembly. | /* Derived from MLIFE exercise */
#include <stdio.h>
#include <stdlib.h>
#include <hip/hip_runtime.h>
#define BORN 1
#define DIES 0
#define id(r,c) ((r)*Ncolumns+(c))
/* build board */
void init(int Nrows, int Ncolumns, int **board, int **newboard, int **c_board, int **c_newboard){
int r,c,n;
*board = (int*) calloc(Nrows*Ncolumns, sizeof(int));
*newboard = (int*) calloc(Nrows*Ncolumns, sizeof(int));
/* death at the border */
for(r=0;r<Nrows;++r){
(*board)[id(r,0)] = DIES;
(*board)[id(r,Ncolumns-1)] = DIES;
(*newboard)[id(r,0)] = DIES;
(*newboard)[id(r,Ncolumns-1)] = DIES;
}
for(c=0;c<Ncolumns;++c){
(*board)[id(0,c)] = DIES;
(*board)[id(Nrows-1,c)] = DIES;
(*newboard)[id(0,c)] = DIES;
(*newboard)[id(Nrows-1,c)] = DIES;
}
/* random life */
srand48(12345);
for(r=1;r<Nrows-1;++r){
for(c=1;c<Ncolumns-1;++c){
double rn = drand48();
(*board)[id(r,c)] = BORN*(rn<0.5) + DIES*(rn>=0.5);
}
}
/* EX01: allocate DEVICE arrays for c_board and c_newboard here using cudaMalloc */
hipMalloc(c_board, Nrows*Ncolumns*sizeof(int));
hipMalloc(c_newboard, Nrows*Ncolumns*sizeof(int));
/* EX02: copy board state from HOST board to DEVICE c_board using cudaMemcpy */
hipMemcpy(*c_board, *board, Nrows*Ncolumns*sizeof(int), hipMemcpyHostToDevice);
hipMemcpy(*c_newboard, *newboard, Nrows*Ncolumns*sizeof(int), hipMemcpyHostToDevice);
}
void destroy(int *board, int *newboard){
free(board);
free(newboard);
}
/* EX03: convert this to a CUDA kernel */
/* EX03a: annotate to indicate a kernel */
__global__ void update(int Nrows, int Ncolumns, int *board, int *newboard){
/* EX03b: replace double loop with 2D thread array */
/* EX03c: convert thread indices and block indices into r,c */
int r = 1 + threadIdx.y + blockIdx.y*blockDim.y;
int c = 1 + threadIdx.x + blockIdx.x*blockDim.x;
if(r<Nrows-1 && c<Ncolumns-1){
/* this does not change */
int s =
board[id(r-1,c-1)]+board[id(r-1,c-0)]+board[id(r-1,c+1)]+
board[id(r+0,c-1)]+ board[id(r+0,c+1)]+
board[id(r+1,c-1)]+board[id(r+1,c-0)]+board[id(r+1,c+1)];
newboard[id(r,c)]
= (s<2)*DIES + (s==2)*board[id(r,c)] + (s==3)*BORN + (s>3)*DIES;
}
}
/* EX04: add a copy from DEVICE to HOST using cudaMemcpy */
void print(int Nrows, int Ncolumns, int *board, int *c_board){
/* EX04: put cudaMemcpy here to copy from DEVICE c_board to HOST board*/
hipMemcpy(board, c_board, Nrows*Ncolumns*sizeof(int), hipMemcpyDeviceToHost);
/* No need tochange this bit */
system("clear");
for(int r=0;r<Nrows;++r){
for(int c=0;c<Ncolumns;++c){
if(board[id(r,c)]==BORN) printf("*");
else printf(" ");
}
printf("\n");
}
}
int main(int argc, char **argv){
if(argc<3){
printf("usage: main [Nrows] [Ncolumns]\n");
exit(1);
}
/* initialize board */
int Nrows = atoi(argv[1]);
int Ncolumns = atoi(argv[2]);
int *board, *newboard;
int *c_board, *c_newboard;
init(Nrows, Ncolumns, &board, &newboard, &c_board, &c_newboard);
/* run some iterations */
int Nit = 100;
for(int it=0;it<Nit;++it){
/* EX05a: define thread-block size and grid size here */
int T = 16;
dim3 bDim(T,T,1);
dim3 gDim((Ncolumns-2+T-1)/T, (Nrows-2+T-1)/T,1);
/* EX05b: add kernel launch syntax here */
update <<< gDim, bDim >>> (Nrows, Ncolumns, c_board, c_newboard);
/* EX05c: add kernel launch syntax here */
update <<< gDim, bDim >>> (Nrows, Ncolumns, c_newboard, c_board);
print(Nrows, Ncolumns, board, c_board);
}
destroy(board, newboard);
exit(0);
return 0;
} | .text
.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
.protected _Z6updateiiPiS_
.globl _Z6updateiiPiS_
.p2align 8
.type _Z6updateiiPiS_,@function
_Z6updateiiPiS_:
s_clause 0x1
s_load_b32 s2, s[0:1], 0x24
s_load_b64 s[4:5], s[0:1], 0x0
v_bfe_u32 v1, v0, 10, 10
v_and_b32_e32 v0, 0x3ff, v0
s_waitcnt lgkmcnt(0)
s_lshr_b32 s3, s2, 16
s_and_b32 s2, s2, 0xffff
s_mul_i32 s15, s15, s3
s_mul_i32 s14, s14, s2
v_add_nc_u32_e32 v2, s15, v1
v_add_nc_u32_e32 v1, s14, v0
s_add_i32 s2, s4, -1
s_add_i32 s3, s5, -1
s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
v_add_nc_u32_e32 v3, 1, v2
v_add_nc_u32_e32 v0, 1, v1
s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
v_cmp_gt_i32_e32 vcc_lo, s2, v3
v_cmp_gt_i32_e64 s2, s3, v0
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
s_and_b32 s2, vcc_lo, s2
s_and_saveexec_b32 s3, s2
s_cbranch_execz .LBB0_2
v_mul_lo_u32 v4, v2, s5
s_load_b128 s[0:3], s[0:1], 0x8
v_add_nc_u32_e32 v14, 2, v1
v_mul_lo_u32 v15, v3, s5
v_add_nc_u32_e32 v11, 2, v2
s_delay_alu instid0(VALU_DEP_4)
v_add_nc_u32_e32 v3, v4, v1
v_add_nc_u32_e32 v5, v4, v0
v_add_nc_u32_e32 v7, v4, v14
v_add_nc_u32_e32 v2, v1, v15
v_mul_lo_u32 v16, v11, s5
v_ashrrev_i32_e32 v4, 31, v3
v_ashrrev_i32_e32 v6, 31, v5
v_ashrrev_i32_e32 v8, 31, v7
s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
v_lshlrev_b64 v[9:10], 2, v[3:4]
v_lshlrev_b64 v[4:5], 2, v[5:6]
v_ashrrev_i32_e32 v3, 31, v2
s_delay_alu instid0(VALU_DEP_4)
v_lshlrev_b64 v[6:7], 2, v[7:8]
v_add_nc_u32_e32 v1, v1, v16
s_waitcnt lgkmcnt(0)
v_add_co_u32 v8, vcc_lo, s0, v9
v_add_co_ci_u32_e32 v9, vcc_lo, s1, v10, vcc_lo
v_add_co_u32 v4, vcc_lo, s0, v4
v_lshlrev_b64 v[2:3], 2, v[2:3]
v_add_co_ci_u32_e32 v5, vcc_lo, s1, v5, vcc_lo
v_add_nc_u32_e32 v10, v15, v14
v_add_co_u32 v6, vcc_lo, s0, v6
v_add_co_ci_u32_e32 v7, vcc_lo, s1, v7, vcc_lo
v_add_co_u32 v12, vcc_lo, s0, v2
s_delay_alu instid0(VALU_DEP_4)
v_ashrrev_i32_e32 v11, 31, v10
v_add_co_ci_u32_e32 v13, vcc_lo, s1, v3, vcc_lo
v_add_nc_u32_e32 v3, v16, v0
v_ashrrev_i32_e32 v2, 31, v1
s_clause 0x3
global_load_b32 v17, v[8:9], off
global_load_b32 v18, v[4:5], off
global_load_b32 v19, v[6:7], off
global_load_b32 v12, v[12:13], off
v_add_nc_u32_e32 v5, v16, v14
v_lshlrev_b64 v[10:11], 2, v[10:11]
v_ashrrev_i32_e32 v4, 31, v3
v_lshlrev_b64 v[1:2], 2, v[1:2]
v_add_nc_u32_e32 v9, v15, v0
v_ashrrev_i32_e32 v6, 31, v5
v_add_co_u32 v7, vcc_lo, s0, v10
v_lshlrev_b64 v[3:4], 2, v[3:4]
v_add_co_ci_u32_e32 v8, vcc_lo, s1, v11, vcc_lo
v_add_co_u32 v1, vcc_lo, s0, v1
v_lshlrev_b64 v[5:6], 2, v[5:6]
v_add_co_ci_u32_e32 v2, vcc_lo, s1, v2, vcc_lo
v_add_co_u32 v3, vcc_lo, s0, v3
v_add_co_ci_u32_e32 v4, vcc_lo, s1, v4, vcc_lo
v_ashrrev_i32_e32 v10, 31, v9
v_add_co_u32 v5, vcc_lo, s0, v5
v_add_co_ci_u32_e32 v6, vcc_lo, s1, v6, vcc_lo
s_delay_alu instid0(VALU_DEP_3)
v_lshlrev_b64 v[9:10], 2, v[9:10]
s_clause 0x3
global_load_b32 v7, v[7:8], off
global_load_b32 v2, v[1:2], off
global_load_b32 v3, v[3:4], off
global_load_b32 v4, v[5:6], off
v_add_co_u32 v0, vcc_lo, s0, v9
v_add_co_ci_u32_e32 v1, vcc_lo, s1, v10, vcc_lo
global_load_b32 v0, v[0:1], off
s_waitcnt vmcnt(7)
v_add_nc_u32_e32 v1, v18, v17
s_waitcnt vmcnt(5)
s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
v_add3_u32 v1, v1, v19, v12
s_waitcnt vmcnt(3)
v_add3_u32 v1, v1, v7, v2
s_waitcnt vmcnt(1)
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_add3_u32 v1, v1, v3, v4
v_cmp_eq_u32_e32 vcc_lo, 2, v1
s_waitcnt vmcnt(0)
v_cndmask_b32_e32 v0, 0, v0, vcc_lo
v_cmp_eq_u32_e32 vcc_lo, 3, v1
s_delay_alu instid0(VALU_DEP_2)
v_add_co_ci_u32_e32 v2, vcc_lo, 0, v0, vcc_lo
v_add_co_u32 v0, vcc_lo, s2, v9
v_add_co_ci_u32_e32 v1, vcc_lo, s3, v10, vcc_lo
global_store_b32 v[0:1], v2, off
.LBB0_2:
s_nop 0
s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
s_endpgm
.section .rodata,"a",@progbits
.p2align 6, 0x0
.amdhsa_kernel _Z6updateiiPiS_
.amdhsa_group_segment_fixed_size 0
.amdhsa_private_segment_fixed_size 0
.amdhsa_kernarg_size 280
.amdhsa_user_sgpr_count 14
.amdhsa_user_sgpr_dispatch_ptr 0
.amdhsa_user_sgpr_queue_ptr 0
.amdhsa_user_sgpr_kernarg_segment_ptr 1
.amdhsa_user_sgpr_dispatch_id 0
.amdhsa_user_sgpr_private_segment_size 0
.amdhsa_wavefront_size32 1
.amdhsa_uses_dynamic_stack 0
.amdhsa_enable_private_segment 0
.amdhsa_system_sgpr_workgroup_id_x 1
.amdhsa_system_sgpr_workgroup_id_y 1
.amdhsa_system_sgpr_workgroup_id_z 0
.amdhsa_system_sgpr_workgroup_info 0
.amdhsa_system_vgpr_workitem_id 1
.amdhsa_next_free_vgpr 20
.amdhsa_next_free_sgpr 16
.amdhsa_float_round_mode_32 0
.amdhsa_float_round_mode_16_64 0
.amdhsa_float_denorm_mode_32 3
.amdhsa_float_denorm_mode_16_64 3
.amdhsa_dx10_clamp 1
.amdhsa_ieee_mode 1
.amdhsa_fp16_overflow 0
.amdhsa_workgroup_processor_mode 1
.amdhsa_memory_ordered 1
.amdhsa_forward_progress 0
.amdhsa_shared_vgpr_count 0
.amdhsa_exception_fp_ieee_invalid_op 0
.amdhsa_exception_fp_denorm_src 0
.amdhsa_exception_fp_ieee_div_zero 0
.amdhsa_exception_fp_ieee_overflow 0
.amdhsa_exception_fp_ieee_underflow 0
.amdhsa_exception_fp_ieee_inexact 0
.amdhsa_exception_int_div_zero 0
.end_amdhsa_kernel
.text
.Lfunc_end0:
.size _Z6updateiiPiS_, .Lfunc_end0-_Z6updateiiPiS_
.section .AMDGPU.csdata,"",@progbits
.text
.p2alignl 7, 3214868480
.fill 96, 4, 3214868480
.type __hip_cuid_,@object
.section .bss,"aw",@nobits
.globl __hip_cuid_
__hip_cuid_:
.byte 0
.size __hip_cuid_, 1
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym __hip_cuid_
.amdgpu_metadata
---
amdhsa.kernels:
- .args:
- .offset: 0
.size: 4
.value_kind: by_value
- .offset: 4
.size: 4
.value_kind: by_value
- .address_space: global
.offset: 8
.size: 8
.value_kind: global_buffer
- .address_space: global
.offset: 16
.size: 8
.value_kind: global_buffer
- .offset: 24
.size: 4
.value_kind: hidden_block_count_x
- .offset: 28
.size: 4
.value_kind: hidden_block_count_y
- .offset: 32
.size: 4
.value_kind: hidden_block_count_z
- .offset: 36
.size: 2
.value_kind: hidden_group_size_x
- .offset: 38
.size: 2
.value_kind: hidden_group_size_y
- .offset: 40
.size: 2
.value_kind: hidden_group_size_z
- .offset: 42
.size: 2
.value_kind: hidden_remainder_x
- .offset: 44
.size: 2
.value_kind: hidden_remainder_y
- .offset: 46
.size: 2
.value_kind: hidden_remainder_z
- .offset: 64
.size: 8
.value_kind: hidden_global_offset_x
- .offset: 72
.size: 8
.value_kind: hidden_global_offset_y
- .offset: 80
.size: 8
.value_kind: hidden_global_offset_z
- .offset: 88
.size: 2
.value_kind: hidden_grid_dims
.group_segment_fixed_size: 0
.kernarg_segment_align: 8
.kernarg_segment_size: 280
.language: OpenCL C
.language_version:
- 2
- 0
.max_flat_workgroup_size: 1024
.name: _Z6updateiiPiS_
.private_segment_fixed_size: 0
.sgpr_count: 18
.sgpr_spill_count: 0
.symbol: _Z6updateiiPiS_.kd
.uniform_work_group_size: 1
.uses_dynamic_stack: false
.vgpr_count: 20
.vgpr_spill_count: 0
.wavefront_size: 32
.workgroup_processor_mode: 1
amdhsa.target: amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
- 1
- 2
...
.end_amdgpu_metadata |
You are a helpful coding assistant specialized in converting HIP source code to AMD host assembly. | /* Derived from MLIFE exercise */
#include <stdio.h>
#include <stdlib.h>
#include <hip/hip_runtime.h>
#define BORN 1
#define DIES 0
#define id(r,c) ((r)*Ncolumns+(c))
/* build board */
void init(int Nrows, int Ncolumns, int **board, int **newboard, int **c_board, int **c_newboard){
int r,c,n;
*board = (int*) calloc(Nrows*Ncolumns, sizeof(int));
*newboard = (int*) calloc(Nrows*Ncolumns, sizeof(int));
/* death at the border */
for(r=0;r<Nrows;++r){
(*board)[id(r,0)] = DIES;
(*board)[id(r,Ncolumns-1)] = DIES;
(*newboard)[id(r,0)] = DIES;
(*newboard)[id(r,Ncolumns-1)] = DIES;
}
for(c=0;c<Ncolumns;++c){
(*board)[id(0,c)] = DIES;
(*board)[id(Nrows-1,c)] = DIES;
(*newboard)[id(0,c)] = DIES;
(*newboard)[id(Nrows-1,c)] = DIES;
}
/* random life */
srand48(12345);
for(r=1;r<Nrows-1;++r){
for(c=1;c<Ncolumns-1;++c){
double rn = drand48();
(*board)[id(r,c)] = BORN*(rn<0.5) + DIES*(rn>=0.5);
}
}
/* EX01: allocate DEVICE arrays for c_board and c_newboard here using cudaMalloc */
hipMalloc(c_board, Nrows*Ncolumns*sizeof(int));
hipMalloc(c_newboard, Nrows*Ncolumns*sizeof(int));
/* EX02: copy board state from HOST board to DEVICE c_board using cudaMemcpy */
hipMemcpy(*c_board, *board, Nrows*Ncolumns*sizeof(int), hipMemcpyHostToDevice);
hipMemcpy(*c_newboard, *newboard, Nrows*Ncolumns*sizeof(int), hipMemcpyHostToDevice);
}
void destroy(int *board, int *newboard){
free(board);
free(newboard);
}
/* EX03: convert this to a CUDA kernel */
/* EX03a: annotate to indicate a kernel */
__global__ void update(int Nrows, int Ncolumns, int *board, int *newboard){
/* EX03b: replace double loop with 2D thread array */
/* EX03c: convert thread indices and block indices into r,c */
int r = 1 + threadIdx.y + blockIdx.y*blockDim.y;
int c = 1 + threadIdx.x + blockIdx.x*blockDim.x;
if(r<Nrows-1 && c<Ncolumns-1){
/* this does not change */
int s =
board[id(r-1,c-1)]+board[id(r-1,c-0)]+board[id(r-1,c+1)]+
board[id(r+0,c-1)]+ board[id(r+0,c+1)]+
board[id(r+1,c-1)]+board[id(r+1,c-0)]+board[id(r+1,c+1)];
newboard[id(r,c)]
= (s<2)*DIES + (s==2)*board[id(r,c)] + (s==3)*BORN + (s>3)*DIES;
}
}
/* EX04: add a copy from DEVICE to HOST using cudaMemcpy */
void print(int Nrows, int Ncolumns, int *board, int *c_board){
/* EX04: put cudaMemcpy here to copy from DEVICE c_board to HOST board*/
hipMemcpy(board, c_board, Nrows*Ncolumns*sizeof(int), hipMemcpyDeviceToHost);
/* No need tochange this bit */
system("clear");
for(int r=0;r<Nrows;++r){
for(int c=0;c<Ncolumns;++c){
if(board[id(r,c)]==BORN) printf("*");
else printf(" ");
}
printf("\n");
}
}
int main(int argc, char **argv){
if(argc<3){
printf("usage: main [Nrows] [Ncolumns]\n");
exit(1);
}
/* initialize board */
int Nrows = atoi(argv[1]);
int Ncolumns = atoi(argv[2]);
int *board, *newboard;
int *c_board, *c_newboard;
init(Nrows, Ncolumns, &board, &newboard, &c_board, &c_newboard);
/* run some iterations */
int Nit = 100;
for(int it=0;it<Nit;++it){
/* EX05a: define thread-block size and grid size here */
int T = 16;
dim3 bDim(T,T,1);
dim3 gDim((Ncolumns-2+T-1)/T, (Nrows-2+T-1)/T,1);
/* EX05b: add kernel launch syntax here */
update <<< gDim, bDim >>> (Nrows, Ncolumns, c_board, c_newboard);
/* EX05c: add kernel launch syntax here */
update <<< gDim, bDim >>> (Nrows, Ncolumns, c_newboard, c_board);
print(Nrows, Ncolumns, board, c_board);
}
destroy(board, newboard);
exit(0);
return 0;
} | .text
.file "solution.hip"
.section .rodata.cst8,"aM",@progbits,8
.p2align 3, 0x0 # -- Begin function _Z4initiiPPiS0_S0_S0_
.LCPI0_0:
.quad 0x3fe0000000000000 # double 0.5
.text
.globl _Z4initiiPPiS0_S0_S0_
.p2align 4, 0x90
.type _Z4initiiPPiS0_S0_S0_,@function
_Z4initiiPPiS0_S0_S0_: # @_Z4initiiPPiS0_S0_S0_
.cfi_startproc
# %bb.0:
pushq %rbp
.cfi_def_cfa_offset 16
pushq %r15
.cfi_def_cfa_offset 24
pushq %r14
.cfi_def_cfa_offset 32
pushq %r13
.cfi_def_cfa_offset 40
pushq %r12
.cfi_def_cfa_offset 48
pushq %rbx
.cfi_def_cfa_offset 56
subq $56, %rsp
.cfi_def_cfa_offset 112
.cfi_offset %rbx, -56
.cfi_offset %r12, -48
.cfi_offset %r13, -40
.cfi_offset %r14, -32
.cfi_offset %r15, -24
.cfi_offset %rbp, -16
movq %r9, 40(%rsp) # 8-byte Spill
movq %r8, 16(%rsp) # 8-byte Spill
movq %rcx, %rbx
movq %rdx, %r13
movl %esi, %ebp
movl %edi, %r15d
movl %esi, %eax
imull %edi, %eax
movslq %eax, %r14
movl $4, %esi
movq %r14, %rdi
callq calloc
movq %rax, (%r13)
movl $4, %esi
movq %r14, 24(%rsp) # 8-byte Spill
movq %r14, %rdi
callq calloc
movq %rbx, 32(%rsp) # 8-byte Spill
movq %rax, (%rbx)
movq %r15, 8(%rsp) # 8-byte Spill
testl %r15d, %r15d
jle .LBB0_3
# %bb.1: # %.lr.ph
movq (%r13), %rcx
movslq %ebp, %rdx
movl 8(%rsp), %esi # 4-byte Reload
leaq (%rcx,%rdx,4), %rdi
addq $-4, %rdi
leaq (%rax,%rdx,4), %r8
addq $-4, %r8
shlq $2, %rdx
xorl %r9d, %r9d
.p2align 4, 0x90
.LBB0_2: # =>This Inner Loop Header: Depth=1
movl $0, (%rcx,%r9)
movl $0, (%rdi,%r9)
movl $0, (%rax,%r9)
movl $0, (%r8,%r9)
addq %rdx, %r9
decq %rsi
jne .LBB0_2
.LBB0_3: # %.preheader70
testl %ebp, %ebp
jle .LBB0_6
# %bb.4: # %.lr.ph73
movq (%r13), %rcx
movq 8(%rsp), %rdx # 8-byte Reload
decl %edx
imull %ebp, %edx
movslq %edx, %rdi
movl %ebp, %edx
leaq (%rcx,%rdi,4), %rsi
leaq (%rax,%rdi,4), %rdi
xorl %r8d, %r8d
.p2align 4, 0x90
.LBB0_5: # =>This Inner Loop Header: Depth=1
movl $0, (%rcx,%r8,4)
movl $0, (%rsi,%r8,4)
movl $0, (%rax,%r8,4)
movl $0, (%rdi,%r8,4)
incq %r8
cmpq %r8, %rdx
jne .LBB0_5
.LBB0_6: # %._crit_edge
movl $12345, %edi # imm = 0x3039
callq srand48
cmpl $3, 8(%rsp) # 4-byte Folded Reload
jl .LBB0_12
# %bb.7: # %.preheader.lr.ph
movq 8(%rsp), %rax # 8-byte Reload
decl %eax
movq %rax, 8(%rsp) # 8-byte Spill
leal -1(%rbp), %eax
decq %rax
movq %rax, 48(%rsp) # 8-byte Spill
movl $1, %r12d
movl %ebp, %r15d
jmp .LBB0_8
.p2align 4, 0x90
.LBB0_11: # %._crit_edge76
# in Loop: Header=BB0_8 Depth=1
incq %r12
addl %ebp, %r15d
cmpq 8(%rsp), %r12 # 8-byte Folded Reload
je .LBB0_12
.LBB0_8: # %.preheader
# =>This Loop Header: Depth=1
# Child Loop BB0_10 Depth 2
cmpl $3, %ebp
jl .LBB0_11
# %bb.9: # %.lr.ph75
# in Loop: Header=BB0_8 Depth=1
movl %r15d, %r14d
incq %r14
movq 48(%rsp), %rbx # 8-byte Reload
.p2align 4, 0x90
.LBB0_10: # Parent Loop BB0_8 Depth=1
# => This Inner Loop Header: Depth=2
callq drand48
xorl %eax, %eax
movsd .LCPI0_0(%rip), %xmm1 # xmm1 = mem[0],zero
ucomisd %xmm0, %xmm1
seta %al
movq (%r13), %rcx
movl %eax, (%rcx,%r14,4)
incq %r14
decq %rbx
jne .LBB0_10
jmp .LBB0_11
.LBB0_12: # %._crit_edge78
movq 24(%rsp), %r14 # 8-byte Reload
shlq $2, %r14
movq 16(%rsp), %r15 # 8-byte Reload
movq %r15, %rdi
movq %r14, %rsi
callq hipMalloc
movq 40(%rsp), %rbx # 8-byte Reload
movq %rbx, %rdi
movq %r14, %rsi
callq hipMalloc
movq (%r15), %rdi
movq (%r13), %rsi
movq %r14, %rdx
movl $1, %ecx
callq hipMemcpy
movq (%rbx), %rdi
movq 32(%rsp), %rax # 8-byte Reload
movq (%rax), %rsi
movq %r14, %rdx
movl $1, %ecx
addq $56, %rsp
.cfi_def_cfa_offset 56
popq %rbx
.cfi_def_cfa_offset 48
popq %r12
.cfi_def_cfa_offset 40
popq %r13
.cfi_def_cfa_offset 32
popq %r14
.cfi_def_cfa_offset 24
popq %r15
.cfi_def_cfa_offset 16
popq %rbp
.cfi_def_cfa_offset 8
jmp hipMemcpy # TAILCALL
.Lfunc_end0:
.size _Z4initiiPPiS0_S0_S0_, .Lfunc_end0-_Z4initiiPPiS0_S0_S0_
.cfi_endproc
# -- End function
.globl _Z7destroyPiS_ # -- Begin function _Z7destroyPiS_
.p2align 4, 0x90
.type _Z7destroyPiS_,@function
_Z7destroyPiS_: # @_Z7destroyPiS_
.cfi_startproc
# %bb.0:
pushq %rbx
.cfi_def_cfa_offset 16
.cfi_offset %rbx, -16
movq %rsi, %rbx
callq free
movq %rbx, %rdi
popq %rbx
.cfi_def_cfa_offset 8
jmp free # TAILCALL
.Lfunc_end1:
.size _Z7destroyPiS_, .Lfunc_end1-_Z7destroyPiS_
.cfi_endproc
# -- End function
.globl _Z21__device_stub__updateiiPiS_ # -- Begin function _Z21__device_stub__updateiiPiS_
.p2align 4, 0x90
.type _Z21__device_stub__updateiiPiS_,@function
_Z21__device_stub__updateiiPiS_: # @_Z21__device_stub__updateiiPiS_
.cfi_startproc
# %bb.0:
subq $120, %rsp
.cfi_def_cfa_offset 128
movl %edi, 12(%rsp)
movl %esi, 8(%rsp)
movq %rdx, 72(%rsp)
movq %rcx, 64(%rsp)
leaq 12(%rsp), %rax
movq %rax, 80(%rsp)
leaq 8(%rsp), %rax
movq %rax, 88(%rsp)
leaq 72(%rsp), %rax
movq %rax, 96(%rsp)
leaq 64(%rsp), %rax
movq %rax, 104(%rsp)
leaq 48(%rsp), %rdi
leaq 32(%rsp), %rsi
leaq 24(%rsp), %rdx
leaq 16(%rsp), %rcx
callq __hipPopCallConfiguration
movq 48(%rsp), %rsi
movl 56(%rsp), %edx
movq 32(%rsp), %rcx
movl 40(%rsp), %r8d
leaq 80(%rsp), %r9
movl $_Z6updateiiPiS_, %edi
pushq 16(%rsp)
.cfi_adjust_cfa_offset 8
pushq 32(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $136, %rsp
.cfi_adjust_cfa_offset -136
retq
.Lfunc_end2:
.size _Z21__device_stub__updateiiPiS_, .Lfunc_end2-_Z21__device_stub__updateiiPiS_
.cfi_endproc
# -- End function
.globl _Z5printiiPiS_ # -- Begin function _Z5printiiPiS_
.p2align 4, 0x90
.type _Z5printiiPiS_,@function
_Z5printiiPiS_: # @_Z5printiiPiS_
.cfi_startproc
# %bb.0:
pushq %rbp
.cfi_def_cfa_offset 16
pushq %r15
.cfi_def_cfa_offset 24
pushq %r14
.cfi_def_cfa_offset 32
pushq %r13
.cfi_def_cfa_offset 40
pushq %r12
.cfi_def_cfa_offset 48
pushq %rbx
.cfi_def_cfa_offset 56
subq $24, %rsp
.cfi_def_cfa_offset 80
.cfi_offset %rbx, -56
.cfi_offset %r12, -48
.cfi_offset %r13, -40
.cfi_offset %r14, -32
.cfi_offset %r15, -24
.cfi_offset %rbp, -16
movq %rdx, %r8
movl %esi, %ebp
movl %edi, %r14d
movl %esi, %eax
imull %edi, %eax
movslq %eax, %rdx
shlq $2, %rdx
movq %r8, 8(%rsp) # 8-byte Spill
movq %r8, %rdi
movq %rcx, %rsi
movl $2, %ecx
callq hipMemcpy
movl $.L.str, %edi
callq system
testl %r14d, %r14d
jle .LBB3_8
# %bb.1: # %.preheader.lr.ph
movl %r14d, %eax
movq %rax, 16(%rsp) # 8-byte Spill
movl %ebp, %r15d
xorl %r12d, %r12d
xorl %r13d, %r13d
jmp .LBB3_2
.p2align 4, 0x90
.LBB3_7: # %._crit_edge
# in Loop: Header=BB3_2 Depth=1
movl $10, %edi
callq putchar@PLT
incq %r13
addl %ebp, %r12d
cmpq 16(%rsp), %r13 # 8-byte Folded Reload
je .LBB3_8
.LBB3_2: # %.preheader
# =>This Loop Header: Depth=1
# Child Loop BB3_4 Depth 2
testl %ebp, %ebp
jle .LBB3_7
# %bb.3: # %.lr.ph
# in Loop: Header=BB3_2 Depth=1
movl %r12d, %eax
movq 8(%rsp), %rcx # 8-byte Reload
leaq (%rcx,%rax,4), %rbx
xorl %r14d, %r14d
jmp .LBB3_4
.p2align 4, 0x90
.LBB3_6: # in Loop: Header=BB3_4 Depth=2
callq putchar@PLT
incq %r14
cmpq %r14, %r15
je .LBB3_7
.LBB3_4: # Parent Loop BB3_2 Depth=1
# => This Inner Loop Header: Depth=2
cmpl $1, (%rbx,%r14,4)
movl $42, %edi
je .LBB3_6
# %bb.5: # in Loop: Header=BB3_4 Depth=2
movl $32, %edi
jmp .LBB3_6
.LBB3_8: # %._crit_edge19
addq $24, %rsp
.cfi_def_cfa_offset 56
popq %rbx
.cfi_def_cfa_offset 48
popq %r12
.cfi_def_cfa_offset 40
popq %r13
.cfi_def_cfa_offset 32
popq %r14
.cfi_def_cfa_offset 24
popq %r15
.cfi_def_cfa_offset 16
popq %rbp
.cfi_def_cfa_offset 8
retq
.Lfunc_end3:
.size _Z5printiiPiS_, .Lfunc_end3-_Z5printiiPiS_
.cfi_endproc
# -- End function
.globl main # -- Begin function main
.p2align 4, 0x90
.type main,@function
main: # @main
.cfi_startproc
# %bb.0:
pushq %rbp
.cfi_def_cfa_offset 16
pushq %r15
.cfi_def_cfa_offset 24
pushq %r14
.cfi_def_cfa_offset 32
pushq %r13
.cfi_def_cfa_offset 40
pushq %r12
.cfi_def_cfa_offset 48
pushq %rbx
.cfi_def_cfa_offset 56
subq $136, %rsp
.cfi_def_cfa_offset 192
.cfi_offset %rbx, -56
.cfi_offset %r12, -48
.cfi_offset %r13, -40
.cfi_offset %r14, -32
.cfi_offset %r15, -24
.cfi_offset %rbp, -16
cmpl $2, %edi
jg .LBB4_1
# %bb.8:
movl $.Lstr, %edi
callq puts@PLT
movl $1, %edi
callq exit
.LBB4_1:
movabsq $68719476752, %rbx # imm = 0x1000000010
movq 8(%rsi), %rdi
movq %rsi, %r15
xorl %esi, %esi
movl $10, %edx
callq __isoc23_strtol
movq %rax, %r14
movq 16(%r15), %rdi
xorl %esi, %esi
movl $10, %edx
callq __isoc23_strtol
movq %rax, %r15
leaq 88(%rsp), %rdx
leaq 128(%rsp), %rcx
leaq 8(%rsp), %r8
leaq 80(%rsp), %r9
movl %r14d, %edi
movl %r15d, %esi
callq _Z4initiiPPiS0_S0_S0_
leal 13(%r15), %eax
leal 28(%r15), %ecx
testl %eax, %eax
cmovnsl %eax, %ecx
sarl $4, %ecx
leal 13(%r14), %eax
leal 28(%r14), %r12d
testl %eax, %eax
cmovnsl %eax, %r12d
sarl $4, %r12d
shlq $32, %r12
orq %rcx, %r12
movl $100, %ebp
movq 88(%rsp), %r13
jmp .LBB4_2
.p2align 4, 0x90
.LBB4_6: # in Loop: Header=BB4_2 Depth=1
movq 8(%rsp), %rcx
movl %r14d, %edi
movl %r15d, %esi
movq %r13, %rdx
callq _Z5printiiPiS_
decl %ebp
je .LBB4_7
.LBB4_2: # =>This Inner Loop Header: Depth=1
movq %r12, %rdi
movl $1, %esi
movq %rbx, %rdx
movl $1, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq __hipPushCallConfiguration
testl %eax, %eax
jne .LBB4_4
# %bb.3: # in Loop: Header=BB4_2 Depth=1
movq 8(%rsp), %rax
movq 80(%rsp), %rcx
movl %r14d, 4(%rsp)
movl %r15d, (%rsp)
movq %rax, 72(%rsp)
movq %rcx, 64(%rsp)
leaq 4(%rsp), %rax
movq %rax, 96(%rsp)
movq %rsp, %rax
movq %rax, 104(%rsp)
leaq 72(%rsp), %rax
movq %rax, 112(%rsp)
leaq 64(%rsp), %rax
movq %rax, 120(%rsp)
leaq 48(%rsp), %rdi
leaq 32(%rsp), %rsi
leaq 24(%rsp), %rdx
leaq 16(%rsp), %rcx
callq __hipPopCallConfiguration
movq 48(%rsp), %rsi
movl 56(%rsp), %edx
movq 32(%rsp), %rcx
movl 40(%rsp), %r8d
movl $_Z6updateiiPiS_, %edi
leaq 96(%rsp), %r9
pushq 16(%rsp)
.cfi_adjust_cfa_offset 8
pushq 32(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $16, %rsp
.cfi_adjust_cfa_offset -16
.LBB4_4: # in Loop: Header=BB4_2 Depth=1
movq %r12, %rdi
movl $1, %esi
movq %rbx, %rdx
movl $1, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq __hipPushCallConfiguration
testl %eax, %eax
jne .LBB4_6
# %bb.5: # in Loop: Header=BB4_2 Depth=1
movq 80(%rsp), %rax
movq 8(%rsp), %rcx
movl %r14d, 4(%rsp)
movl %r15d, (%rsp)
movq %rax, 72(%rsp)
movq %rcx, 64(%rsp)
leaq 4(%rsp), %rax
movq %rax, 96(%rsp)
movq %rsp, %rax
movq %rax, 104(%rsp)
leaq 72(%rsp), %rax
movq %rax, 112(%rsp)
leaq 64(%rsp), %rax
movq %rax, 120(%rsp)
leaq 48(%rsp), %rdi
leaq 32(%rsp), %rsi
leaq 24(%rsp), %rdx
leaq 16(%rsp), %rcx
callq __hipPopCallConfiguration
movq 48(%rsp), %rsi
movl 56(%rsp), %edx
movq 32(%rsp), %rcx
movl 40(%rsp), %r8d
movl $_Z6updateiiPiS_, %edi
leaq 96(%rsp), %r9
pushq 16(%rsp)
.cfi_adjust_cfa_offset 8
pushq 32(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $16, %rsp
.cfi_adjust_cfa_offset -16
jmp .LBB4_6
.LBB4_7:
movq 88(%rsp), %rdi
movq 128(%rsp), %rsi
callq _Z7destroyPiS_
xorl %edi, %edi
callq exit
.Lfunc_end4:
.size main, .Lfunc_end4-main
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_ctor
.type __hip_module_ctor,@function
__hip_module_ctor: # @__hip_module_ctor
.cfi_startproc
# %bb.0:
subq $40, %rsp
.cfi_def_cfa_offset 48
cmpq $0, __hip_gpubin_handle(%rip)
jne .LBB5_2
# %bb.1:
movl $__hip_fatbin_wrapper, %edi
callq __hipRegisterFatBinary
movq %rax, __hip_gpubin_handle(%rip)
.LBB5_2:
movq __hip_gpubin_handle(%rip), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 16(%rsp)
movups %xmm0, (%rsp)
movl $_Z6updateiiPiS_, %esi
movl $.L__unnamed_1, %edx
movl $.L__unnamed_1, %ecx
movl $-1, %r8d
xorl %r9d, %r9d
callq __hipRegisterFunction
movl $__hip_module_dtor, %edi
addq $40, %rsp
.cfi_def_cfa_offset 8
jmp atexit # TAILCALL
.Lfunc_end5:
.size __hip_module_ctor, .Lfunc_end5-__hip_module_ctor
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_dtor
.type __hip_module_dtor,@function
__hip_module_dtor: # @__hip_module_dtor
.cfi_startproc
# %bb.0:
movq __hip_gpubin_handle(%rip), %rdi
testq %rdi, %rdi
je .LBB6_2
# %bb.1:
pushq %rax
.cfi_def_cfa_offset 16
callq __hipUnregisterFatBinary
movq $0, __hip_gpubin_handle(%rip)
addq $8, %rsp
.cfi_def_cfa_offset 8
.LBB6_2:
retq
.Lfunc_end6:
.size __hip_module_dtor, .Lfunc_end6-__hip_module_dtor
.cfi_endproc
# -- End function
.type _Z6updateiiPiS_,@object # @_Z6updateiiPiS_
.section .rodata,"a",@progbits
.globl _Z6updateiiPiS_
.p2align 3, 0x0
_Z6updateiiPiS_:
.quad _Z21__device_stub__updateiiPiS_
.size _Z6updateiiPiS_, 8
.type .L.str,@object # @.str
.section .rodata.str1.1,"aMS",@progbits,1
.L.str:
.asciz "clear"
.size .L.str, 6
.type .L__unnamed_1,@object # @0
.L__unnamed_1:
.asciz "_Z6updateiiPiS_"
.size .L__unnamed_1, 16
.type __hip_fatbin_wrapper,@object # @__hip_fatbin_wrapper
.section .hipFatBinSegment,"a",@progbits
.p2align 3, 0x0
__hip_fatbin_wrapper:
.long 1212764230 # 0x48495046
.long 1 # 0x1
.quad __hip_fatbin
.quad 0
.size __hip_fatbin_wrapper, 24
.type __hip_gpubin_handle,@object # @__hip_gpubin_handle
.local __hip_gpubin_handle
.comm __hip_gpubin_handle,8,8
.section .init_array,"aw",@init_array
.p2align 3, 0x0
.quad __hip_module_ctor
.type __hip_cuid_,@object # @__hip_cuid_
.bss
.globl __hip_cuid_
__hip_cuid_:
.byte 0 # 0x0
.size __hip_cuid_, 1
.type .Lstr,@object # @str
.section .rodata.str1.1,"aMS",@progbits,1
.Lstr:
.asciz "usage: main [Nrows] [Ncolumns]"
.size .Lstr, 31
.section ".linker-options","e",@llvm_linker_options
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym _Z21__device_stub__updateiiPiS_
.addrsig_sym __hip_module_ctor
.addrsig_sym __hip_module_dtor
.addrsig_sym _Z6updateiiPiS_
.addrsig_sym __hip_fatbin
.addrsig_sym __hip_fatbin_wrapper
.addrsig_sym __hip_cuid_ |
You are a helpful coding assistant specialized in converting from CUDA device assembly to AMD device assembly. | code for sm_80
Function : _Z6updateiiPiS_
.headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)"
/*0000*/ IMAD.MOV.U32 R1, RZ, RZ, c[0x0][0x28] ; /* 0x00000a00ff017624 */
/* 0x000fe400078e00ff */
/*0010*/ S2R R4, SR_TID.X ; /* 0x0000000000047919 */
/* 0x000e220000002100 */
/*0020*/ UMOV UR4, 0x1 ; /* 0x0000000100047882 */
/* 0x000fe40000000000 */
/*0030*/ ULDC.64 UR6, c[0x0][0x160] ; /* 0x0000580000067ab9 */
/* 0x000fe20000000a00 */
/*0040*/ S2R R5, SR_CTAID.X ; /* 0x0000000000057919 */
/* 0x000e220000002500 */
/*0050*/ UIADD3 UR5, -UR4, UR7, URZ ; /* 0x0000000704057290 */
/* 0x000fe4000fffe13f */
/*0060*/ UIADD3 UR4, -UR4, UR6, URZ ; /* 0x0000000604047290 */
/* 0x000fe2000fffe13f */
/*0070*/ S2R R2, SR_TID.Y ; /* 0x0000000000027919 */
/* 0x000e680000002200 */
/*0080*/ S2R R3, SR_CTAID.Y ; /* 0x0000000000037919 */
/* 0x000e620000002600 */
/*0090*/ IMAD R4, R5, c[0x0][0x0], R4 ; /* 0x0000000005047a24 */
/* 0x001fca00078e0204 */
/*00a0*/ IADD3 R0, R4, 0x1, RZ ; /* 0x0000000104007810 */
/* 0x000fe20007ffe0ff */
/*00b0*/ IMAD R2, R3, c[0x0][0x4], R2 ; /* 0x0000010003027a24 */
/* 0x002fc600078e0202 */
/*00c0*/ ISETP.GE.AND P0, PT, R0, UR5, PT ; /* 0x0000000500007c0c */
/* 0x000fe4000bf06270 */
/*00d0*/ IADD3 R3, R2, 0x1, RZ ; /* 0x0000000102037810 */
/* 0x000fc80007ffe0ff */
/*00e0*/ ISETP.GE.OR P0, PT, R3, UR4, P0 ; /* 0x0000000403007c0c */
/* 0x000fda0008706670 */
/*00f0*/ @P0 EXIT ; /* 0x000000000000094d */
/* 0x000fea0003800000 */
/*0100*/ HFMA2.MMA R0, -RZ, RZ, 0, 2.384185791015625e-07 ; /* 0x00000004ff007435 */
/* 0x000fe200000001ff */
/*0110*/ IMAD.MOV.U32 R6, RZ, RZ, c[0x0][0x164] ; /* 0x00005900ff067624 */
/* 0x000fe200078e00ff */
/*0120*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */
/* 0x000fe20000000a00 */
/*0130*/ IMAD R5, R2, c[0x0][0x164], R4.reuse ; /* 0x0000590002057a24 */
/* 0x100fe400078e0204 */
/*0140*/ IMAD R7, R3.reuse, R6, c[0x0][0x164] ; /* 0x0000590003077624 */
/* 0x040fe400078e0206 */
/*0150*/ IMAD R11, R3, c[0x0][0x164], R4 ; /* 0x00005900030b7a24 */
/* 0x000fe400078e0204 */
/*0160*/ IMAD.IADD R7, R4, 0x1, R7 ; /* 0x0000000104077824 */
/* 0x000fe400078e0207 */
/*0170*/ IMAD.WIDE R2, R5, R0, c[0x0][0x168] ; /* 0x00005a0005027625 */
/* 0x000fc800078e0200 */
/*0180*/ IMAD.WIDE R4, R11, R0.reuse, c[0x0][0x168] ; /* 0x00005a000b047625 */
/* 0x080fe200078e0200 */
/*0190*/ LDG.E R8, [R2.64+0x4] ; /* 0x0000040402087981 */
/* 0x0000a8000c1e1900 */
/*01a0*/ LDG.E R9, [R2.64] ; /* 0x0000000402097981 */
/* 0x0000a2000c1e1900 */
/*01b0*/ IMAD.WIDE R6, R7, R0, c[0x0][0x168] ; /* 0x00005a0007067625 */
/* 0x000fc600078e0200 */
/*01c0*/ LDG.E R10, [R2.64+0x8] ; /* 0x00000804020a7981 */
/* 0x0000a8000c1e1900 */
/*01d0*/ LDG.E R13, [R4.64] ; /* 0x00000004040d7981 */
/* 0x000ee8000c1e1900 */
/*01e0*/ LDG.E R12, [R4.64+0x8] ; /* 0x00000804040c7981 */
/* 0x000ee8000c1e1900 */
/*01f0*/ LDG.E R15, [R6.64] ; /* 0x00000004060f7981 */
/* 0x000f28000c1e1900 */
/*0200*/ LDG.E R14, [R6.64+0x4] ; /* 0x00000404060e7981 */
/* 0x000f28000c1e1900 */
/*0210*/ LDG.E R17, [R6.64+0x8] ; /* 0x0000080406117981 */
/* 0x000f68000c1e1900 */
/*0220*/ LDG.E R16, [R4.64+0x4] ; /* 0x0000040404107981 */
/* 0x000f62000c1e1900 */
/*0230*/ IMAD.WIDE R2, R11, R0, c[0x0][0x170] ; /* 0x00005c000b027625 */
/* 0x001fe200078e0200 */
/*0240*/ IADD3 R8, R10, R8, R9 ; /* 0x000000080a087210 */
/* 0x004fc80007ffe009 */
/*0250*/ IADD3 R8, R12, R8, R13 ; /* 0x000000080c087210 */
/* 0x008fc80007ffe00d */
/*0260*/ IADD3 R8, R14, R8, R15 ; /* 0x000000080e087210 */
/* 0x010fc80007ffe00f */
/*0270*/ IADD3 R8, R8, R17, RZ ; /* 0x0000001108087210 */
/* 0x020fc80007ffe0ff */
/*0280*/ ISETP.NE.AND P0, PT, R8.reuse, 0x2, PT ; /* 0x000000020800780c */
/* 0x040fe40003f05270 */
/*0290*/ ISETP.NE.AND P1, PT, R8, 0x3, PT ; /* 0x000000030800780c */
/* 0x000fe40003f25270 */
/*02a0*/ SEL R16, R16, RZ, !P0 ; /* 0x000000ff10107207 */
/* 0x000fe40004000000 */
/*02b0*/ SEL R9, RZ, 0x1, P1 ; /* 0x00000001ff097807 */
/* 0x000fca0000800000 */
/*02c0*/ IMAD.IADD R9, R16, 0x1, R9 ; /* 0x0000000110097824 */
/* 0x000fca00078e0209 */
/*02d0*/ STG.E [R2.64+0x4], R9 ; /* 0x0000040902007986 */
/* 0x000fe2000c101904 */
/*02e0*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*02f0*/ BRA 0x2f0; /* 0xfffffff000007947 */
/* 0x000fc0000383ffff */
/*0300*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0310*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0320*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0330*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0340*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0350*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0360*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0370*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
.......... | .text
.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
.protected _Z6updateiiPiS_
.globl _Z6updateiiPiS_
.p2align 8
.type _Z6updateiiPiS_,@function
_Z6updateiiPiS_:
s_clause 0x1
s_load_b32 s2, s[0:1], 0x24
s_load_b64 s[4:5], s[0:1], 0x0
v_bfe_u32 v1, v0, 10, 10
v_and_b32_e32 v0, 0x3ff, v0
s_waitcnt lgkmcnt(0)
s_lshr_b32 s3, s2, 16
s_and_b32 s2, s2, 0xffff
s_mul_i32 s15, s15, s3
s_mul_i32 s14, s14, s2
v_add_nc_u32_e32 v2, s15, v1
v_add_nc_u32_e32 v1, s14, v0
s_add_i32 s2, s4, -1
s_add_i32 s3, s5, -1
s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
v_add_nc_u32_e32 v3, 1, v2
v_add_nc_u32_e32 v0, 1, v1
s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
v_cmp_gt_i32_e32 vcc_lo, s2, v3
v_cmp_gt_i32_e64 s2, s3, v0
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
s_and_b32 s2, vcc_lo, s2
s_and_saveexec_b32 s3, s2
s_cbranch_execz .LBB0_2
v_mul_lo_u32 v4, v2, s5
s_load_b128 s[0:3], s[0:1], 0x8
v_add_nc_u32_e32 v14, 2, v1
v_mul_lo_u32 v15, v3, s5
v_add_nc_u32_e32 v11, 2, v2
s_delay_alu instid0(VALU_DEP_4)
v_add_nc_u32_e32 v3, v4, v1
v_add_nc_u32_e32 v5, v4, v0
v_add_nc_u32_e32 v7, v4, v14
v_add_nc_u32_e32 v2, v1, v15
v_mul_lo_u32 v16, v11, s5
v_ashrrev_i32_e32 v4, 31, v3
v_ashrrev_i32_e32 v6, 31, v5
v_ashrrev_i32_e32 v8, 31, v7
s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
v_lshlrev_b64 v[9:10], 2, v[3:4]
v_lshlrev_b64 v[4:5], 2, v[5:6]
v_ashrrev_i32_e32 v3, 31, v2
s_delay_alu instid0(VALU_DEP_4)
v_lshlrev_b64 v[6:7], 2, v[7:8]
v_add_nc_u32_e32 v1, v1, v16
s_waitcnt lgkmcnt(0)
v_add_co_u32 v8, vcc_lo, s0, v9
v_add_co_ci_u32_e32 v9, vcc_lo, s1, v10, vcc_lo
v_add_co_u32 v4, vcc_lo, s0, v4
v_lshlrev_b64 v[2:3], 2, v[2:3]
v_add_co_ci_u32_e32 v5, vcc_lo, s1, v5, vcc_lo
v_add_nc_u32_e32 v10, v15, v14
v_add_co_u32 v6, vcc_lo, s0, v6
v_add_co_ci_u32_e32 v7, vcc_lo, s1, v7, vcc_lo
v_add_co_u32 v12, vcc_lo, s0, v2
s_delay_alu instid0(VALU_DEP_4)
v_ashrrev_i32_e32 v11, 31, v10
v_add_co_ci_u32_e32 v13, vcc_lo, s1, v3, vcc_lo
v_add_nc_u32_e32 v3, v16, v0
v_ashrrev_i32_e32 v2, 31, v1
s_clause 0x3
global_load_b32 v17, v[8:9], off
global_load_b32 v18, v[4:5], off
global_load_b32 v19, v[6:7], off
global_load_b32 v12, v[12:13], off
v_add_nc_u32_e32 v5, v16, v14
v_lshlrev_b64 v[10:11], 2, v[10:11]
v_ashrrev_i32_e32 v4, 31, v3
v_lshlrev_b64 v[1:2], 2, v[1:2]
v_add_nc_u32_e32 v9, v15, v0
v_ashrrev_i32_e32 v6, 31, v5
v_add_co_u32 v7, vcc_lo, s0, v10
v_lshlrev_b64 v[3:4], 2, v[3:4]
v_add_co_ci_u32_e32 v8, vcc_lo, s1, v11, vcc_lo
v_add_co_u32 v1, vcc_lo, s0, v1
v_lshlrev_b64 v[5:6], 2, v[5:6]
v_add_co_ci_u32_e32 v2, vcc_lo, s1, v2, vcc_lo
v_add_co_u32 v3, vcc_lo, s0, v3
v_add_co_ci_u32_e32 v4, vcc_lo, s1, v4, vcc_lo
v_ashrrev_i32_e32 v10, 31, v9
v_add_co_u32 v5, vcc_lo, s0, v5
v_add_co_ci_u32_e32 v6, vcc_lo, s1, v6, vcc_lo
s_delay_alu instid0(VALU_DEP_3)
v_lshlrev_b64 v[9:10], 2, v[9:10]
s_clause 0x3
global_load_b32 v7, v[7:8], off
global_load_b32 v2, v[1:2], off
global_load_b32 v3, v[3:4], off
global_load_b32 v4, v[5:6], off
v_add_co_u32 v0, vcc_lo, s0, v9
v_add_co_ci_u32_e32 v1, vcc_lo, s1, v10, vcc_lo
global_load_b32 v0, v[0:1], off
s_waitcnt vmcnt(7)
v_add_nc_u32_e32 v1, v18, v17
s_waitcnt vmcnt(5)
s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
v_add3_u32 v1, v1, v19, v12
s_waitcnt vmcnt(3)
v_add3_u32 v1, v1, v7, v2
s_waitcnt vmcnt(1)
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_add3_u32 v1, v1, v3, v4
v_cmp_eq_u32_e32 vcc_lo, 2, v1
s_waitcnt vmcnt(0)
v_cndmask_b32_e32 v0, 0, v0, vcc_lo
v_cmp_eq_u32_e32 vcc_lo, 3, v1
s_delay_alu instid0(VALU_DEP_2)
v_add_co_ci_u32_e32 v2, vcc_lo, 0, v0, vcc_lo
v_add_co_u32 v0, vcc_lo, s2, v9
v_add_co_ci_u32_e32 v1, vcc_lo, s3, v10, vcc_lo
global_store_b32 v[0:1], v2, off
.LBB0_2:
s_nop 0
s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
s_endpgm
.section .rodata,"a",@progbits
.p2align 6, 0x0
.amdhsa_kernel _Z6updateiiPiS_
.amdhsa_group_segment_fixed_size 0
.amdhsa_private_segment_fixed_size 0
.amdhsa_kernarg_size 280
.amdhsa_user_sgpr_count 14
.amdhsa_user_sgpr_dispatch_ptr 0
.amdhsa_user_sgpr_queue_ptr 0
.amdhsa_user_sgpr_kernarg_segment_ptr 1
.amdhsa_user_sgpr_dispatch_id 0
.amdhsa_user_sgpr_private_segment_size 0
.amdhsa_wavefront_size32 1
.amdhsa_uses_dynamic_stack 0
.amdhsa_enable_private_segment 0
.amdhsa_system_sgpr_workgroup_id_x 1
.amdhsa_system_sgpr_workgroup_id_y 1
.amdhsa_system_sgpr_workgroup_id_z 0
.amdhsa_system_sgpr_workgroup_info 0
.amdhsa_system_vgpr_workitem_id 1
.amdhsa_next_free_vgpr 20
.amdhsa_next_free_sgpr 16
.amdhsa_float_round_mode_32 0
.amdhsa_float_round_mode_16_64 0
.amdhsa_float_denorm_mode_32 3
.amdhsa_float_denorm_mode_16_64 3
.amdhsa_dx10_clamp 1
.amdhsa_ieee_mode 1
.amdhsa_fp16_overflow 0
.amdhsa_workgroup_processor_mode 1
.amdhsa_memory_ordered 1
.amdhsa_forward_progress 0
.amdhsa_shared_vgpr_count 0
.amdhsa_exception_fp_ieee_invalid_op 0
.amdhsa_exception_fp_denorm_src 0
.amdhsa_exception_fp_ieee_div_zero 0
.amdhsa_exception_fp_ieee_overflow 0
.amdhsa_exception_fp_ieee_underflow 0
.amdhsa_exception_fp_ieee_inexact 0
.amdhsa_exception_int_div_zero 0
.end_amdhsa_kernel
.text
.Lfunc_end0:
.size _Z6updateiiPiS_, .Lfunc_end0-_Z6updateiiPiS_
.section .AMDGPU.csdata,"",@progbits
.text
.p2alignl 7, 3214868480
.fill 96, 4, 3214868480
.type __hip_cuid_,@object
.section .bss,"aw",@nobits
.globl __hip_cuid_
__hip_cuid_:
.byte 0
.size __hip_cuid_, 1
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym __hip_cuid_
.amdgpu_metadata
---
amdhsa.kernels:
- .args:
- .offset: 0
.size: 4
.value_kind: by_value
- .offset: 4
.size: 4
.value_kind: by_value
- .address_space: global
.offset: 8
.size: 8
.value_kind: global_buffer
- .address_space: global
.offset: 16
.size: 8
.value_kind: global_buffer
- .offset: 24
.size: 4
.value_kind: hidden_block_count_x
- .offset: 28
.size: 4
.value_kind: hidden_block_count_y
- .offset: 32
.size: 4
.value_kind: hidden_block_count_z
- .offset: 36
.size: 2
.value_kind: hidden_group_size_x
- .offset: 38
.size: 2
.value_kind: hidden_group_size_y
- .offset: 40
.size: 2
.value_kind: hidden_group_size_z
- .offset: 42
.size: 2
.value_kind: hidden_remainder_x
- .offset: 44
.size: 2
.value_kind: hidden_remainder_y
- .offset: 46
.size: 2
.value_kind: hidden_remainder_z
- .offset: 64
.size: 8
.value_kind: hidden_global_offset_x
- .offset: 72
.size: 8
.value_kind: hidden_global_offset_y
- .offset: 80
.size: 8
.value_kind: hidden_global_offset_z
- .offset: 88
.size: 2
.value_kind: hidden_grid_dims
.group_segment_fixed_size: 0
.kernarg_segment_align: 8
.kernarg_segment_size: 280
.language: OpenCL C
.language_version:
- 2
- 0
.max_flat_workgroup_size: 1024
.name: _Z6updateiiPiS_
.private_segment_fixed_size: 0
.sgpr_count: 18
.sgpr_spill_count: 0
.symbol: _Z6updateiiPiS_.kd
.uniform_work_group_size: 1
.uses_dynamic_stack: false
.vgpr_count: 20
.vgpr_spill_count: 0
.wavefront_size: 32
.workgroup_processor_mode: 1
amdhsa.target: amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
- 1
- 2
...
.end_amdgpu_metadata |
You are a helpful coding assistant specialized in converting from CUDA host assembly to AMD host assembly. | .file "tmpxft_00093e09_00000000-6_solution.cudafe1.cpp"
.text
#APP
#NO_APP
.type _ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2063:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaUnregisterFatBinary@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2063:
.size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
.globl _Z4initiiPPiS0_S0_S0_
.type _Z4initiiPPiS0_S0_S0_, @function
_Z4initiiPPiS0_S0_S0_:
.LFB2057:
.cfi_startproc
endbr64
pushq %r15
.cfi_def_cfa_offset 16
.cfi_offset 15, -16
pushq %r14
.cfi_def_cfa_offset 24
.cfi_offset 14, -24
pushq %r13
.cfi_def_cfa_offset 32
.cfi_offset 13, -32
pushq %r12
.cfi_def_cfa_offset 40
.cfi_offset 12, -40
pushq %rbp
.cfi_def_cfa_offset 48
.cfi_offset 6, -48
pushq %rbx
.cfi_def_cfa_offset 56
.cfi_offset 3, -56
subq $40, %rsp
.cfi_def_cfa_offset 96
movl %edi, %ebx
movl %esi, %r14d
movq %rdx, %rbp
movq %rcx, %r13
movq %r8, 16(%rsp)
movq %r9, 24(%rsp)
movl %edi, %r12d
imull %esi, %r12d
movslq %r12d, %rax
movq %rax, %r15
movq %rax, 8(%rsp)
movl $4, %esi
movq %rax, %rdi
call calloc@PLT
movq %rax, 0(%rbp)
movl $4, %esi
movq %r15, %rdi
call calloc@PLT
movq %rax, 0(%r13)
testl %ebx, %ebx
jle .L4
movslq %r14d, %rdi
salq $2, %rdi
movl $0, %eax
movl $0, %edx
leaq -4(%rdi), %r8
.L5:
movq 0(%rbp), %rcx
movl $0, (%rcx,%rax)
leaq (%r8,%rax), %rcx
movq 0(%rbp), %rsi
movl $0, (%rsi,%rcx)
movq 0(%r13), %rsi
movl $0, (%rsi,%rax)
movq 0(%r13), %rsi
movl $0, (%rsi,%rcx)
addl $1, %edx
addq %rdi, %rax
cmpl %edx, %ebx
jne .L5
testl %r14d, %r14d
jle .L6
.L13:
movslq %r14d, %rdi
salq $2, %rdi
subl %r14d, %r12d
movslq %r12d, %rsi
salq $2, %rsi
movl $0, %eax
.L7:
movq 0(%rbp), %rdx
movl $0, (%rdx,%rax)
leaq (%rax,%rsi), %rdx
movq 0(%rbp), %rcx
movl $0, (%rcx,%rdx)
movq 0(%r13), %rcx
movl $0, (%rcx,%rax)
movq 0(%r13), %rcx
movl $0, (%rcx,%rdx)
addq $4, %rax
cmpq %rdi, %rax
jne .L7
.L6:
movl $12345, %edi
call srand48@PLT
cmpl $2, %ebx
jle .L8
leal -1(%rbx), %eax
movl %eax, 4(%rsp)
movl %r14d, (%rsp)
movl $1, %r15d
jmp .L9
.L11:
movslq (%rsp), %rax
leaq 4(,%rax,4), %rbx
leal -1(%r14), %r12d
addq %rax, %r12
salq $2, %r12
.L10:
call drand48@PLT
movq 0(%rbp), %rax
movsd .LC0(%rip), %xmm1
comisd %xmm0, %xmm1
seta %dl
movzbl %dl, %edx
movl %edx, (%rax,%rbx)
addq $4, %rbx
cmpq %r12, %rbx
jne .L10
.L12:
addl $1, %r15d
addl %r14d, (%rsp)
movl 4(%rsp), %eax
cmpl %eax, %r15d
je .L8
.L9:
cmpl $2, %r14d
jg .L11
jmp .L12
.L4:
testl %r14d, %r14d
jg .L13
movl $12345, %edi
call srand48@PLT
.L8:
movq 8(%rsp), %rbx
salq $2, %rbx
movq %rbx, %rsi
movq 16(%rsp), %r15
movq %r15, %rdi
call cudaMalloc@PLT
movq %rbx, %rsi
movq 24(%rsp), %r14
movq %r14, %rdi
call cudaMalloc@PLT
movq 0(%rbp), %rsi
movq (%r15), %rdi
movl $1, %ecx
movq %rbx, %rdx
call cudaMemcpy@PLT
movq 0(%r13), %rsi
movq (%r14), %rdi
movl $1, %ecx
movq %rbx, %rdx
call cudaMemcpy@PLT
addq $40, %rsp
.cfi_def_cfa_offset 56
popq %rbx
.cfi_def_cfa_offset 48
popq %rbp
.cfi_def_cfa_offset 40
popq %r12
.cfi_def_cfa_offset 32
popq %r13
.cfi_def_cfa_offset 24
popq %r14
.cfi_def_cfa_offset 16
popq %r15
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2057:
.size _Z4initiiPPiS0_S0_S0_, .-_Z4initiiPPiS0_S0_S0_
.globl _Z7destroyPiS_
.type _Z7destroyPiS_, @function
_Z7destroyPiS_:
.LFB2058:
.cfi_startproc
endbr64
pushq %rbx
.cfi_def_cfa_offset 16
.cfi_offset 3, -16
movq %rsi, %rbx
call free@PLT
movq %rbx, %rdi
call free@PLT
popq %rbx
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2058:
.size _Z7destroyPiS_, .-_Z7destroyPiS_
.section .rodata.str1.1,"aMS",@progbits,1
.LC1:
.string "clear"
.LC2:
.string "*"
.LC3:
.string " "
.LC4:
.string "\n"
.text
.globl _Z5printiiPiS_
.type _Z5printiiPiS_, @function
_Z5printiiPiS_:
.LFB2059:
.cfi_startproc
endbr64
pushq %r15
.cfi_def_cfa_offset 16
.cfi_offset 15, -16
pushq %r14
.cfi_def_cfa_offset 24
.cfi_offset 14, -24
pushq %r13
.cfi_def_cfa_offset 32
.cfi_offset 13, -32
pushq %r12
.cfi_def_cfa_offset 40
.cfi_offset 12, -40
pushq %rbp
.cfi_def_cfa_offset 48
.cfi_offset 6, -48
pushq %rbx
.cfi_def_cfa_offset 56
.cfi_offset 3, -56
subq $24, %rsp
.cfi_def_cfa_offset 80
movl %edi, %ebx
movl %edi, 4(%rsp)
movl %esi, %r13d
movq %rdx, %rdi
movq %rdx, 8(%rsp)
movq %rcx, %rsi
movl %ebx, %eax
imull %r13d, %eax
movslq %eax, %rdx
salq $2, %rdx
movl $2, %ecx
call cudaMemcpy@PLT
leaq .LC1(%rip), %rdi
call system@PLT
testl %ebx, %ebx
jle .L23
movl $0, %r15d
movl $0, %r14d
leaq .LC3(%rip), %r12
jmp .L25
.L26:
movq %r12, %rsi
movl $2, %edi
movl $0, %eax
call __printf_chk@PLT
.L27:
addq $4, %rbx
cmpq %rbp, %rbx
je .L30
.L28:
cmpl $1, (%rbx)
jne .L26
leaq .LC2(%rip), %rsi
movl $2, %edi
movl $0, %eax
call __printf_chk@PLT
jmp .L27
.L30:
leaq .LC4(%rip), %rsi
movl $2, %edi
movl $0, %eax
call __printf_chk@PLT
addl $1, %r14d
addl %r13d, %r15d
cmpl %r14d, 4(%rsp)
je .L23
.L25:
testl %r13d, %r13d
jle .L30
movslq %r15d, %rdx
movq 8(%rsp), %rcx
leaq (%rcx,%rdx,4), %rbx
movslq %r13d, %rax
addq %rdx, %rax
leaq (%rcx,%rax,4), %rbp
jmp .L28
.L23:
addq $24, %rsp
.cfi_def_cfa_offset 56
popq %rbx
.cfi_def_cfa_offset 48
popq %rbp
.cfi_def_cfa_offset 40
popq %r12
.cfi_def_cfa_offset 32
popq %r13
.cfi_def_cfa_offset 24
popq %r14
.cfi_def_cfa_offset 16
popq %r15
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2059:
.size _Z5printiiPiS_, .-_Z5printiiPiS_
.globl _Z29__device_stub__Z6updateiiPiS_iiPiS_
.type _Z29__device_stub__Z6updateiiPiS_iiPiS_, @function
_Z29__device_stub__Z6updateiiPiS_iiPiS_:
.LFB2085:
.cfi_startproc
endbr64
subq $152, %rsp
.cfi_def_cfa_offset 160
movl %edi, 28(%rsp)
movl %esi, 24(%rsp)
movq %rdx, 16(%rsp)
movq %rcx, 8(%rsp)
movq %fs:40, %rax
movq %rax, 136(%rsp)
xorl %eax, %eax
leaq 28(%rsp), %rax
movq %rax, 96(%rsp)
leaq 24(%rsp), %rax
movq %rax, 104(%rsp)
leaq 16(%rsp), %rax
movq %rax, 112(%rsp)
leaq 8(%rsp), %rax
movq %rax, 120(%rsp)
movl $1, 48(%rsp)
movl $1, 52(%rsp)
movl $1, 56(%rsp)
movl $1, 60(%rsp)
movl $1, 64(%rsp)
movl $1, 68(%rsp)
leaq 40(%rsp), %rcx
leaq 32(%rsp), %rdx
leaq 60(%rsp), %rsi
leaq 48(%rsp), %rdi
call __cudaPopCallConfiguration@PLT
testl %eax, %eax
je .L37
.L33:
movq 136(%rsp), %rax
subq %fs:40, %rax
jne .L38
addq $152, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 8
ret
.L37:
.cfi_restore_state
pushq 40(%rsp)
.cfi_def_cfa_offset 168
pushq 40(%rsp)
.cfi_def_cfa_offset 176
leaq 112(%rsp), %r9
movq 76(%rsp), %rcx
movl 84(%rsp), %r8d
movq 64(%rsp), %rsi
movl 72(%rsp), %edx
leaq _Z6updateiiPiS_(%rip), %rdi
call cudaLaunchKernel@PLT
addq $16, %rsp
.cfi_def_cfa_offset 160
jmp .L33
.L38:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE2085:
.size _Z29__device_stub__Z6updateiiPiS_iiPiS_, .-_Z29__device_stub__Z6updateiiPiS_iiPiS_
.globl _Z6updateiiPiS_
.type _Z6updateiiPiS_, @function
_Z6updateiiPiS_:
.LFB2086:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
call _Z29__device_stub__Z6updateiiPiS_iiPiS_
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2086:
.size _Z6updateiiPiS_, .-_Z6updateiiPiS_
.section .rodata.str1.8,"aMS",@progbits,1
.align 8
.LC5:
.string "usage: main [Nrows] [Ncolumns]\n"
.text
.globl main
.type main, @function
main:
.LFB2060:
.cfi_startproc
endbr64
pushq %r15
.cfi_def_cfa_offset 16
.cfi_offset 15, -16
pushq %r14
.cfi_def_cfa_offset 24
.cfi_offset 14, -24
pushq %r13
.cfi_def_cfa_offset 32
.cfi_offset 13, -32
pushq %r12
.cfi_def_cfa_offset 40
.cfi_offset 12, -40
pushq %rbp
.cfi_def_cfa_offset 48
.cfi_offset 6, -48
pushq %rbx
.cfi_def_cfa_offset 56
.cfi_offset 3, -56
subq $72, %rsp
.cfi_def_cfa_offset 128
movq %fs:40, %rax
movq %rax, 56(%rsp)
xorl %eax, %eax
cmpl $2, %edi
jg .L42
leaq .LC5(%rip), %rsi
movl $2, %edi
call __printf_chk@PLT
movl $1, %edi
call exit@PLT
.L42:
movq %rsi, %rbx
movq 8(%rsi), %rdi
movl $10, %edx
movl $0, %esi
call __isoc23_strtol@PLT
movq %rax, %rbp
movl %eax, %r12d
movq 16(%rbx), %rdi
movl $10, %edx
movl $0, %esi
call __isoc23_strtol@PLT
movq %rax, %rbx
movl %eax, %r13d
leaq 8(%rsp), %rcx
movq %rsp, %rdx
leaq 24(%rsp), %r9
leaq 16(%rsp), %r8
movl %eax, %esi
movl %ebp, %edi
call _Z4initiiPPiS0_S0_S0_
leal 13(%rbp), %eax
movl $16, %ecx
cltd
idivl %ecx
movl %eax, %r15d
leal 13(%rbx), %eax
cltd
idivl %ecx
movl %eax, %r14d
movl $100, %ebx
jmp .L45
.L50:
movq 24(%rsp), %rcx
movq 16(%rsp), %rdx
movl %r13d, %esi
movl %r12d, %edi
call _Z29__device_stub__Z6updateiiPiS_iiPiS_
jmp .L43
.L44:
movq (%rsp), %rbp
movq 16(%rsp), %rcx
movq %rbp, %rdx
movl %r13d, %esi
movl %r12d, %edi
call _Z5printiiPiS_
subl $1, %ebx
je .L49
.L45:
movl $16, 32(%rsp)
movl $16, 36(%rsp)
movl $1, 40(%rsp)
movl %r14d, 44(%rsp)
movl %r15d, 48(%rsp)
movl $1, 52(%rsp)
movl $0, %r9d
movl $0, %r8d
movq 32(%rsp), %rdx
movl $1, %ecx
movq 44(%rsp), %rdi
movl $1, %esi
call __cudaPushCallConfiguration@PLT
testl %eax, %eax
je .L50
.L43:
movl 40(%rsp), %ecx
movl $0, %r9d
movl $0, %r8d
movq 32(%rsp), %rdx
movq 44(%rsp), %rdi
movl 52(%rsp), %esi
call __cudaPushCallConfiguration@PLT
testl %eax, %eax
jne .L44
movq 16(%rsp), %rcx
movq 24(%rsp), %rdx
movl %r13d, %esi
movl %r12d, %edi
call _Z29__device_stub__Z6updateiiPiS_iiPiS_
jmp .L44
.L49:
movq 8(%rsp), %rsi
movq %rbp, %rdi
call _Z7destroyPiS_
movl $0, %edi
call exit@PLT
.cfi_endproc
.LFE2060:
.size main, .-main
.section .rodata.str1.1
.LC6:
.string "_Z6updateiiPiS_"
.text
.type _ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2088:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
leaq _ZL15__fatDeviceText(%rip), %rdi
call __cudaRegisterFatBinary@PLT
movq %rax, %rdi
movq %rax, _ZL20__cudaFatCubinHandle(%rip)
pushq $0
.cfi_def_cfa_offset 24
pushq $0
.cfi_def_cfa_offset 32
pushq $0
.cfi_def_cfa_offset 40
pushq $0
.cfi_def_cfa_offset 48
movl $0, %r9d
movl $-1, %r8d
leaq .LC6(%rip), %rdx
movq %rdx, %rcx
leaq _Z6updateiiPiS_(%rip), %rsi
call __cudaRegisterFunction@PLT
addq $32, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaRegisterFatBinaryEnd@PLT
leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
call atexit@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2088:
.size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
.section .init_array,"aw"
.align 8
.quad _ZL24__sti____cudaRegisterAllv
.section .nvFatBinSegment,"aw"
.align 8
.type _ZL15__fatDeviceText, @object
.size _ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
.long 1180844977
.long 1
.quad fatbinData
.quad 0
.local _ZL20__cudaFatCubinHandle
.comm _ZL20__cudaFatCubinHandle,8,8
.section .rodata.cst8,"aM",@progbits,8
.align 8
.LC0:
.long 0
.long 1071644672
.ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
.section .note.GNU-stack,"",@progbits
.section .note.gnu.property,"a"
.align 8
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.string "GNU"
1:
.align 8
.long 0xc0000002
.long 3f - 2f
2:
.long 0x3
3:
.align 8
4: | .text
.file "solution.hip"
.section .rodata.cst8,"aM",@progbits,8
.p2align 3, 0x0 # -- Begin function _Z4initiiPPiS0_S0_S0_
.LCPI0_0:
.quad 0x3fe0000000000000 # double 0.5
.text
.globl _Z4initiiPPiS0_S0_S0_
.p2align 4, 0x90
.type _Z4initiiPPiS0_S0_S0_,@function
_Z4initiiPPiS0_S0_S0_: # @_Z4initiiPPiS0_S0_S0_
.cfi_startproc
# %bb.0:
pushq %rbp
.cfi_def_cfa_offset 16
pushq %r15
.cfi_def_cfa_offset 24
pushq %r14
.cfi_def_cfa_offset 32
pushq %r13
.cfi_def_cfa_offset 40
pushq %r12
.cfi_def_cfa_offset 48
pushq %rbx
.cfi_def_cfa_offset 56
subq $56, %rsp
.cfi_def_cfa_offset 112
.cfi_offset %rbx, -56
.cfi_offset %r12, -48
.cfi_offset %r13, -40
.cfi_offset %r14, -32
.cfi_offset %r15, -24
.cfi_offset %rbp, -16
movq %r9, 40(%rsp) # 8-byte Spill
movq %r8, 16(%rsp) # 8-byte Spill
movq %rcx, %rbx
movq %rdx, %r13
movl %esi, %ebp
movl %edi, %r15d
movl %esi, %eax
imull %edi, %eax
movslq %eax, %r14
movl $4, %esi
movq %r14, %rdi
callq calloc
movq %rax, (%r13)
movl $4, %esi
movq %r14, 24(%rsp) # 8-byte Spill
movq %r14, %rdi
callq calloc
movq %rbx, 32(%rsp) # 8-byte Spill
movq %rax, (%rbx)
movq %r15, 8(%rsp) # 8-byte Spill
testl %r15d, %r15d
jle .LBB0_3
# %bb.1: # %.lr.ph
movq (%r13), %rcx
movslq %ebp, %rdx
movl 8(%rsp), %esi # 4-byte Reload
leaq (%rcx,%rdx,4), %rdi
addq $-4, %rdi
leaq (%rax,%rdx,4), %r8
addq $-4, %r8
shlq $2, %rdx
xorl %r9d, %r9d
.p2align 4, 0x90
.LBB0_2: # =>This Inner Loop Header: Depth=1
movl $0, (%rcx,%r9)
movl $0, (%rdi,%r9)
movl $0, (%rax,%r9)
movl $0, (%r8,%r9)
addq %rdx, %r9
decq %rsi
jne .LBB0_2
.LBB0_3: # %.preheader70
testl %ebp, %ebp
jle .LBB0_6
# %bb.4: # %.lr.ph73
movq (%r13), %rcx
movq 8(%rsp), %rdx # 8-byte Reload
decl %edx
imull %ebp, %edx
movslq %edx, %rdi
movl %ebp, %edx
leaq (%rcx,%rdi,4), %rsi
leaq (%rax,%rdi,4), %rdi
xorl %r8d, %r8d
.p2align 4, 0x90
.LBB0_5: # =>This Inner Loop Header: Depth=1
movl $0, (%rcx,%r8,4)
movl $0, (%rsi,%r8,4)
movl $0, (%rax,%r8,4)
movl $0, (%rdi,%r8,4)
incq %r8
cmpq %r8, %rdx
jne .LBB0_5
.LBB0_6: # %._crit_edge
movl $12345, %edi # imm = 0x3039
callq srand48
cmpl $3, 8(%rsp) # 4-byte Folded Reload
jl .LBB0_12
# %bb.7: # %.preheader.lr.ph
movq 8(%rsp), %rax # 8-byte Reload
decl %eax
movq %rax, 8(%rsp) # 8-byte Spill
leal -1(%rbp), %eax
decq %rax
movq %rax, 48(%rsp) # 8-byte Spill
movl $1, %r12d
movl %ebp, %r15d
jmp .LBB0_8
.p2align 4, 0x90
.LBB0_11: # %._crit_edge76
# in Loop: Header=BB0_8 Depth=1
incq %r12
addl %ebp, %r15d
cmpq 8(%rsp), %r12 # 8-byte Folded Reload
je .LBB0_12
.LBB0_8: # %.preheader
# =>This Loop Header: Depth=1
# Child Loop BB0_10 Depth 2
cmpl $3, %ebp
jl .LBB0_11
# %bb.9: # %.lr.ph75
# in Loop: Header=BB0_8 Depth=1
movl %r15d, %r14d
incq %r14
movq 48(%rsp), %rbx # 8-byte Reload
.p2align 4, 0x90
.LBB0_10: # Parent Loop BB0_8 Depth=1
# => This Inner Loop Header: Depth=2
callq drand48
xorl %eax, %eax
movsd .LCPI0_0(%rip), %xmm1 # xmm1 = mem[0],zero
ucomisd %xmm0, %xmm1
seta %al
movq (%r13), %rcx
movl %eax, (%rcx,%r14,4)
incq %r14
decq %rbx
jne .LBB0_10
jmp .LBB0_11
.LBB0_12: # %._crit_edge78
movq 24(%rsp), %r14 # 8-byte Reload
shlq $2, %r14
movq 16(%rsp), %r15 # 8-byte Reload
movq %r15, %rdi
movq %r14, %rsi
callq hipMalloc
movq 40(%rsp), %rbx # 8-byte Reload
movq %rbx, %rdi
movq %r14, %rsi
callq hipMalloc
movq (%r15), %rdi
movq (%r13), %rsi
movq %r14, %rdx
movl $1, %ecx
callq hipMemcpy
movq (%rbx), %rdi
movq 32(%rsp), %rax # 8-byte Reload
movq (%rax), %rsi
movq %r14, %rdx
movl $1, %ecx
addq $56, %rsp
.cfi_def_cfa_offset 56
popq %rbx
.cfi_def_cfa_offset 48
popq %r12
.cfi_def_cfa_offset 40
popq %r13
.cfi_def_cfa_offset 32
popq %r14
.cfi_def_cfa_offset 24
popq %r15
.cfi_def_cfa_offset 16
popq %rbp
.cfi_def_cfa_offset 8
jmp hipMemcpy # TAILCALL
.Lfunc_end0:
.size _Z4initiiPPiS0_S0_S0_, .Lfunc_end0-_Z4initiiPPiS0_S0_S0_
.cfi_endproc
# -- End function
.globl _Z7destroyPiS_ # -- Begin function _Z7destroyPiS_
.p2align 4, 0x90
.type _Z7destroyPiS_,@function
_Z7destroyPiS_: # @_Z7destroyPiS_
.cfi_startproc
# %bb.0:
pushq %rbx
.cfi_def_cfa_offset 16
.cfi_offset %rbx, -16
movq %rsi, %rbx
callq free
movq %rbx, %rdi
popq %rbx
.cfi_def_cfa_offset 8
jmp free # TAILCALL
.Lfunc_end1:
.size _Z7destroyPiS_, .Lfunc_end1-_Z7destroyPiS_
.cfi_endproc
# -- End function
.globl _Z21__device_stub__updateiiPiS_ # -- Begin function _Z21__device_stub__updateiiPiS_
.p2align 4, 0x90
.type _Z21__device_stub__updateiiPiS_,@function
_Z21__device_stub__updateiiPiS_: # @_Z21__device_stub__updateiiPiS_
.cfi_startproc
# %bb.0:
subq $120, %rsp
.cfi_def_cfa_offset 128
movl %edi, 12(%rsp)
movl %esi, 8(%rsp)
movq %rdx, 72(%rsp)
movq %rcx, 64(%rsp)
leaq 12(%rsp), %rax
movq %rax, 80(%rsp)
leaq 8(%rsp), %rax
movq %rax, 88(%rsp)
leaq 72(%rsp), %rax
movq %rax, 96(%rsp)
leaq 64(%rsp), %rax
movq %rax, 104(%rsp)
leaq 48(%rsp), %rdi
leaq 32(%rsp), %rsi
leaq 24(%rsp), %rdx
leaq 16(%rsp), %rcx
callq __hipPopCallConfiguration
movq 48(%rsp), %rsi
movl 56(%rsp), %edx
movq 32(%rsp), %rcx
movl 40(%rsp), %r8d
leaq 80(%rsp), %r9
movl $_Z6updateiiPiS_, %edi
pushq 16(%rsp)
.cfi_adjust_cfa_offset 8
pushq 32(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $136, %rsp
.cfi_adjust_cfa_offset -136
retq
.Lfunc_end2:
.size _Z21__device_stub__updateiiPiS_, .Lfunc_end2-_Z21__device_stub__updateiiPiS_
.cfi_endproc
# -- End function
.globl _Z5printiiPiS_ # -- Begin function _Z5printiiPiS_
.p2align 4, 0x90
.type _Z5printiiPiS_,@function
_Z5printiiPiS_: # @_Z5printiiPiS_
.cfi_startproc
# %bb.0:
pushq %rbp
.cfi_def_cfa_offset 16
pushq %r15
.cfi_def_cfa_offset 24
pushq %r14
.cfi_def_cfa_offset 32
pushq %r13
.cfi_def_cfa_offset 40
pushq %r12
.cfi_def_cfa_offset 48
pushq %rbx
.cfi_def_cfa_offset 56
subq $24, %rsp
.cfi_def_cfa_offset 80
.cfi_offset %rbx, -56
.cfi_offset %r12, -48
.cfi_offset %r13, -40
.cfi_offset %r14, -32
.cfi_offset %r15, -24
.cfi_offset %rbp, -16
movq %rdx, %r8
movl %esi, %ebp
movl %edi, %r14d
movl %esi, %eax
imull %edi, %eax
movslq %eax, %rdx
shlq $2, %rdx
movq %r8, 8(%rsp) # 8-byte Spill
movq %r8, %rdi
movq %rcx, %rsi
movl $2, %ecx
callq hipMemcpy
movl $.L.str, %edi
callq system
testl %r14d, %r14d
jle .LBB3_8
# %bb.1: # %.preheader.lr.ph
movl %r14d, %eax
movq %rax, 16(%rsp) # 8-byte Spill
movl %ebp, %r15d
xorl %r12d, %r12d
xorl %r13d, %r13d
jmp .LBB3_2
.p2align 4, 0x90
.LBB3_7: # %._crit_edge
# in Loop: Header=BB3_2 Depth=1
movl $10, %edi
callq putchar@PLT
incq %r13
addl %ebp, %r12d
cmpq 16(%rsp), %r13 # 8-byte Folded Reload
je .LBB3_8
.LBB3_2: # %.preheader
# =>This Loop Header: Depth=1
# Child Loop BB3_4 Depth 2
testl %ebp, %ebp
jle .LBB3_7
# %bb.3: # %.lr.ph
# in Loop: Header=BB3_2 Depth=1
movl %r12d, %eax
movq 8(%rsp), %rcx # 8-byte Reload
leaq (%rcx,%rax,4), %rbx
xorl %r14d, %r14d
jmp .LBB3_4
.p2align 4, 0x90
.LBB3_6: # in Loop: Header=BB3_4 Depth=2
callq putchar@PLT
incq %r14
cmpq %r14, %r15
je .LBB3_7
.LBB3_4: # Parent Loop BB3_2 Depth=1
# => This Inner Loop Header: Depth=2
cmpl $1, (%rbx,%r14,4)
movl $42, %edi
je .LBB3_6
# %bb.5: # in Loop: Header=BB3_4 Depth=2
movl $32, %edi
jmp .LBB3_6
.LBB3_8: # %._crit_edge19
addq $24, %rsp
.cfi_def_cfa_offset 56
popq %rbx
.cfi_def_cfa_offset 48
popq %r12
.cfi_def_cfa_offset 40
popq %r13
.cfi_def_cfa_offset 32
popq %r14
.cfi_def_cfa_offset 24
popq %r15
.cfi_def_cfa_offset 16
popq %rbp
.cfi_def_cfa_offset 8
retq
.Lfunc_end3:
.size _Z5printiiPiS_, .Lfunc_end3-_Z5printiiPiS_
.cfi_endproc
# -- End function
.globl main # -- Begin function main
.p2align 4, 0x90
.type main,@function
main: # @main
.cfi_startproc
# %bb.0:
pushq %rbp
.cfi_def_cfa_offset 16
pushq %r15
.cfi_def_cfa_offset 24
pushq %r14
.cfi_def_cfa_offset 32
pushq %r13
.cfi_def_cfa_offset 40
pushq %r12
.cfi_def_cfa_offset 48
pushq %rbx
.cfi_def_cfa_offset 56
subq $136, %rsp
.cfi_def_cfa_offset 192
.cfi_offset %rbx, -56
.cfi_offset %r12, -48
.cfi_offset %r13, -40
.cfi_offset %r14, -32
.cfi_offset %r15, -24
.cfi_offset %rbp, -16
cmpl $2, %edi
jg .LBB4_1
# %bb.8:
movl $.Lstr, %edi
callq puts@PLT
movl $1, %edi
callq exit
.LBB4_1:
movabsq $68719476752, %rbx # imm = 0x1000000010
movq 8(%rsi), %rdi
movq %rsi, %r15
xorl %esi, %esi
movl $10, %edx
callq __isoc23_strtol
movq %rax, %r14
movq 16(%r15), %rdi
xorl %esi, %esi
movl $10, %edx
callq __isoc23_strtol
movq %rax, %r15
leaq 88(%rsp), %rdx
leaq 128(%rsp), %rcx
leaq 8(%rsp), %r8
leaq 80(%rsp), %r9
movl %r14d, %edi
movl %r15d, %esi
callq _Z4initiiPPiS0_S0_S0_
leal 13(%r15), %eax
leal 28(%r15), %ecx
testl %eax, %eax
cmovnsl %eax, %ecx
sarl $4, %ecx
leal 13(%r14), %eax
leal 28(%r14), %r12d
testl %eax, %eax
cmovnsl %eax, %r12d
sarl $4, %r12d
shlq $32, %r12
orq %rcx, %r12
movl $100, %ebp
movq 88(%rsp), %r13
jmp .LBB4_2
.p2align 4, 0x90
.LBB4_6: # in Loop: Header=BB4_2 Depth=1
movq 8(%rsp), %rcx
movl %r14d, %edi
movl %r15d, %esi
movq %r13, %rdx
callq _Z5printiiPiS_
decl %ebp
je .LBB4_7
.LBB4_2: # =>This Inner Loop Header: Depth=1
movq %r12, %rdi
movl $1, %esi
movq %rbx, %rdx
movl $1, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq __hipPushCallConfiguration
testl %eax, %eax
jne .LBB4_4
# %bb.3: # in Loop: Header=BB4_2 Depth=1
movq 8(%rsp), %rax
movq 80(%rsp), %rcx
movl %r14d, 4(%rsp)
movl %r15d, (%rsp)
movq %rax, 72(%rsp)
movq %rcx, 64(%rsp)
leaq 4(%rsp), %rax
movq %rax, 96(%rsp)
movq %rsp, %rax
movq %rax, 104(%rsp)
leaq 72(%rsp), %rax
movq %rax, 112(%rsp)
leaq 64(%rsp), %rax
movq %rax, 120(%rsp)
leaq 48(%rsp), %rdi
leaq 32(%rsp), %rsi
leaq 24(%rsp), %rdx
leaq 16(%rsp), %rcx
callq __hipPopCallConfiguration
movq 48(%rsp), %rsi
movl 56(%rsp), %edx
movq 32(%rsp), %rcx
movl 40(%rsp), %r8d
movl $_Z6updateiiPiS_, %edi
leaq 96(%rsp), %r9
pushq 16(%rsp)
.cfi_adjust_cfa_offset 8
pushq 32(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $16, %rsp
.cfi_adjust_cfa_offset -16
.LBB4_4: # in Loop: Header=BB4_2 Depth=1
movq %r12, %rdi
movl $1, %esi
movq %rbx, %rdx
movl $1, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq __hipPushCallConfiguration
testl %eax, %eax
jne .LBB4_6
# %bb.5: # in Loop: Header=BB4_2 Depth=1
movq 80(%rsp), %rax
movq 8(%rsp), %rcx
movl %r14d, 4(%rsp)
movl %r15d, (%rsp)
movq %rax, 72(%rsp)
movq %rcx, 64(%rsp)
leaq 4(%rsp), %rax
movq %rax, 96(%rsp)
movq %rsp, %rax
movq %rax, 104(%rsp)
leaq 72(%rsp), %rax
movq %rax, 112(%rsp)
leaq 64(%rsp), %rax
movq %rax, 120(%rsp)
leaq 48(%rsp), %rdi
leaq 32(%rsp), %rsi
leaq 24(%rsp), %rdx
leaq 16(%rsp), %rcx
callq __hipPopCallConfiguration
movq 48(%rsp), %rsi
movl 56(%rsp), %edx
movq 32(%rsp), %rcx
movl 40(%rsp), %r8d
movl $_Z6updateiiPiS_, %edi
leaq 96(%rsp), %r9
pushq 16(%rsp)
.cfi_adjust_cfa_offset 8
pushq 32(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $16, %rsp
.cfi_adjust_cfa_offset -16
jmp .LBB4_6
.LBB4_7:
movq 88(%rsp), %rdi
movq 128(%rsp), %rsi
callq _Z7destroyPiS_
xorl %edi, %edi
callq exit
.Lfunc_end4:
.size main, .Lfunc_end4-main
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_ctor
.type __hip_module_ctor,@function
__hip_module_ctor: # @__hip_module_ctor
.cfi_startproc
# %bb.0:
subq $40, %rsp
.cfi_def_cfa_offset 48
cmpq $0, __hip_gpubin_handle(%rip)
jne .LBB5_2
# %bb.1:
movl $__hip_fatbin_wrapper, %edi
callq __hipRegisterFatBinary
movq %rax, __hip_gpubin_handle(%rip)
.LBB5_2:
movq __hip_gpubin_handle(%rip), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 16(%rsp)
movups %xmm0, (%rsp)
movl $_Z6updateiiPiS_, %esi
movl $.L__unnamed_1, %edx
movl $.L__unnamed_1, %ecx
movl $-1, %r8d
xorl %r9d, %r9d
callq __hipRegisterFunction
movl $__hip_module_dtor, %edi
addq $40, %rsp
.cfi_def_cfa_offset 8
jmp atexit # TAILCALL
.Lfunc_end5:
.size __hip_module_ctor, .Lfunc_end5-__hip_module_ctor
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_dtor
.type __hip_module_dtor,@function
__hip_module_dtor: # @__hip_module_dtor
.cfi_startproc
# %bb.0:
movq __hip_gpubin_handle(%rip), %rdi
testq %rdi, %rdi
je .LBB6_2
# %bb.1:
pushq %rax
.cfi_def_cfa_offset 16
callq __hipUnregisterFatBinary
movq $0, __hip_gpubin_handle(%rip)
addq $8, %rsp
.cfi_def_cfa_offset 8
.LBB6_2:
retq
.Lfunc_end6:
.size __hip_module_dtor, .Lfunc_end6-__hip_module_dtor
.cfi_endproc
# -- End function
.type _Z6updateiiPiS_,@object # @_Z6updateiiPiS_
.section .rodata,"a",@progbits
.globl _Z6updateiiPiS_
.p2align 3, 0x0
_Z6updateiiPiS_:
.quad _Z21__device_stub__updateiiPiS_
.size _Z6updateiiPiS_, 8
.type .L.str,@object # @.str
.section .rodata.str1.1,"aMS",@progbits,1
.L.str:
.asciz "clear"
.size .L.str, 6
.type .L__unnamed_1,@object # @0
.L__unnamed_1:
.asciz "_Z6updateiiPiS_"
.size .L__unnamed_1, 16
.type __hip_fatbin_wrapper,@object # @__hip_fatbin_wrapper
.section .hipFatBinSegment,"a",@progbits
.p2align 3, 0x0
__hip_fatbin_wrapper:
.long 1212764230 # 0x48495046
.long 1 # 0x1
.quad __hip_fatbin
.quad 0
.size __hip_fatbin_wrapper, 24
.type __hip_gpubin_handle,@object # @__hip_gpubin_handle
.local __hip_gpubin_handle
.comm __hip_gpubin_handle,8,8
.section .init_array,"aw",@init_array
.p2align 3, 0x0
.quad __hip_module_ctor
.type __hip_cuid_,@object # @__hip_cuid_
.bss
.globl __hip_cuid_
__hip_cuid_:
.byte 0 # 0x0
.size __hip_cuid_, 1
.type .Lstr,@object # @str
.section .rodata.str1.1,"aMS",@progbits,1
.Lstr:
.asciz "usage: main [Nrows] [Ncolumns]"
.size .Lstr, 31
.section ".linker-options","e",@llvm_linker_options
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym _Z21__device_stub__updateiiPiS_
.addrsig_sym __hip_module_ctor
.addrsig_sym __hip_module_dtor
.addrsig_sym _Z6updateiiPiS_
.addrsig_sym __hip_fatbin
.addrsig_sym __hip_fatbin_wrapper
.addrsig_sym __hip_cuid_ |
You are a helpful coding assistant specialized in converting CUDA source code to CUDA device assembly. | #include "includes.h"
__global__ void kSoftMaxCrossEntropyRowMajor(float* mat, float* labels, float* target, unsigned int width, unsigned int height, float tiny) {
const unsigned int idx = blockIdx.x * blockDim.x + threadIdx.x;
const unsigned int numThreads = blockDim.x * gridDim.x;
for (unsigned int i = idx; i < height; i += numThreads) {
target[i] = -__logf(mat[height * (int)labels[i] + i] + tiny);
}
} | code for sm_80
Function : _Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf
.headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)"
/*0000*/ MOV R1, c[0x0][0x28] ; /* 0x00000a0000017a02 */
/* 0x000fe40000000f00 */
/*0010*/ S2R R0, SR_CTAID.X ; /* 0x0000000000007919 */
/* 0x000e280000002500 */
/*0020*/ S2R R3, SR_TID.X ; /* 0x0000000000037919 */
/* 0x000e240000002100 */
/*0030*/ IMAD R0, R0, c[0x0][0x0], R3 ; /* 0x0000000000007a24 */
/* 0x001fca00078e0203 */
/*0040*/ ISETP.GE.U32.AND P0, PT, R0, c[0x0][0x17c], PT ; /* 0x00005f0000007a0c */
/* 0x000fda0003f06070 */
/*0050*/ @P0 EXIT ; /* 0x000000000000094d */
/* 0x000fea0003800000 */
/*0060*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */
/* 0x000fe40000000a00 */
/*0070*/ HFMA2.MMA R7, -RZ, RZ, 0, 2.384185791015625e-07 ; /* 0x00000004ff077435 */
/* 0x001fd400000001ff */
/*0080*/ IMAD.WIDE.U32 R2, R0, R7, c[0x0][0x168] ; /* 0x00005a0000027625 */
/* 0x000fcc00078e0007 */
/*0090*/ LDG.E R2, [R2.64] ; /* 0x0000000402027981 */
/* 0x000ea4000c1e1900 */
/*00a0*/ F2I.TRUNC.NTZ R5, R2 ; /* 0x0000000200057305 */
/* 0x004e24000020f100 */
/*00b0*/ IMAD R5, R5, c[0x0][0x17c], R0 ; /* 0x00005f0005057a24 */
/* 0x001fc800078e0200 */
/*00c0*/ IMAD.WIDE.U32 R4, R5, R7, c[0x0][0x160] ; /* 0x0000580005047625 */
/* 0x000fcc00078e0007 */
/*00d0*/ LDG.E R4, [R4.64] ; /* 0x0000000404047981 */
/* 0x000ea2000c1e1900 */
/*00e0*/ IMAD.WIDE.U32 R6, R0, R7, c[0x0][0x170] ; /* 0x00005c0000067625 */
/* 0x000fe200078e0007 */
/*00f0*/ MOV R3, c[0x0][0x0] ; /* 0x0000000000037a02 */
/* 0x000fca0000000f00 */
/*0100*/ IMAD R0, R3, c[0x0][0xc], R0 ; /* 0x0000030003007a24 */
/* 0x000fe400078e0200 */
/*0110*/ FADD R8, R4, c[0x0][0x180] ; /* 0x0000600004087621 */
/* 0x004fca0000000000 */
/*0120*/ FSETP.GEU.AND P0, PT, |R8|, 1.175494350822287508e-38, PT ; /* 0x008000000800780b */
/* 0x000fda0003f0e200 */
/*0130*/ @!P0 FMUL R8, R8, 16777216 ; /* 0x4b80000008088820 */
/* 0x000fc80000400000 */
/*0140*/ MUFU.LG2 R9, R8 ; /* 0x0000000800097308 */
/* 0x000e240000000c00 */
/*0150*/ @!P0 FADD R9, R9, -24 ; /* 0xc1c0000009098421 */
/* 0x001fe20000000000 */
/*0160*/ ISETP.GE.U32.AND P0, PT, R0, c[0x0][0x17c], PT ; /* 0x00005f0000007a0c */
/* 0x000fc60003f06070 */
/*0170*/ FMUL R9, R9, -0.69314718246459960938 ; /* 0xbf31721809097820 */
/* 0x000fca0000400000 */
/*0180*/ STG.E [R6.64], R9 ; /* 0x0000000906007986 */
/* 0x0001ea000c101904 */
/*0190*/ @!P0 BRA 0x70 ; /* 0xfffffed000008947 */
/* 0x000fea000383ffff */
/*01a0*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*01b0*/ BRA 0x1b0; /* 0xfffffff000007947 */
/* 0x000fc0000383ffff */
/*01c0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*01d0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*01e0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*01f0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0200*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0210*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0220*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0230*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0240*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0250*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0260*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0270*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
.......... |
You are a helpful coding assistant specialized in converting CUDA source code to CUDA host assembly. | #include "includes.h"
__global__ void kSoftMaxCrossEntropyRowMajor(float* mat, float* labels, float* target, unsigned int width, unsigned int height, float tiny) {
const unsigned int idx = blockIdx.x * blockDim.x + threadIdx.x;
const unsigned int numThreads = blockDim.x * gridDim.x;
for (unsigned int i = idx; i < height; i += numThreads) {
target[i] = -__logf(mat[height * (int)labels[i] + i] + tiny);
}
} | .file "tmpxft_000ebe02_00000000-6_kSoftMaxCrossEntropyRowMajor.cudafe1.cpp"
.text
#APP
#NO_APP
.type _ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2029:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaUnregisterFatBinary@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2029:
.size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
.globl _Z55__device_stub__Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjfPfS_S_jjf
.type _Z55__device_stub__Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjfPfS_S_jjf, @function
_Z55__device_stub__Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjfPfS_S_jjf:
.LFB2051:
.cfi_startproc
endbr64
subq $184, %rsp
.cfi_def_cfa_offset 192
movq %rdi, 40(%rsp)
movq %rsi, 32(%rsp)
movq %rdx, 24(%rsp)
movl %ecx, 20(%rsp)
movl %r8d, 16(%rsp)
movss %xmm0, 12(%rsp)
movq %fs:40, %rax
movq %rax, 168(%rsp)
xorl %eax, %eax
leaq 40(%rsp), %rax
movq %rax, 112(%rsp)
leaq 32(%rsp), %rax
movq %rax, 120(%rsp)
leaq 24(%rsp), %rax
movq %rax, 128(%rsp)
leaq 20(%rsp), %rax
movq %rax, 136(%rsp)
leaq 16(%rsp), %rax
movq %rax, 144(%rsp)
leaq 12(%rsp), %rax
movq %rax, 152(%rsp)
movl $1, 64(%rsp)
movl $1, 68(%rsp)
movl $1, 72(%rsp)
movl $1, 76(%rsp)
movl $1, 80(%rsp)
movl $1, 84(%rsp)
leaq 56(%rsp), %rcx
leaq 48(%rsp), %rdx
leaq 76(%rsp), %rsi
leaq 64(%rsp), %rdi
call __cudaPopCallConfiguration@PLT
testl %eax, %eax
je .L7
.L3:
movq 168(%rsp), %rax
subq %fs:40, %rax
jne .L8
addq $184, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 8
ret
.L7:
.cfi_restore_state
pushq 56(%rsp)
.cfi_def_cfa_offset 200
pushq 56(%rsp)
.cfi_def_cfa_offset 208
leaq 128(%rsp), %r9
movq 92(%rsp), %rcx
movl 100(%rsp), %r8d
movq 80(%rsp), %rsi
movl 88(%rsp), %edx
leaq _Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf(%rip), %rdi
call cudaLaunchKernel@PLT
addq $16, %rsp
.cfi_def_cfa_offset 192
jmp .L3
.L8:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE2051:
.size _Z55__device_stub__Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjfPfS_S_jjf, .-_Z55__device_stub__Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjfPfS_S_jjf
.globl _Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf
.type _Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf, @function
_Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf:
.LFB2052:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
call _Z55__device_stub__Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjfPfS_S_jjf
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2052:
.size _Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf, .-_Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf
.section .rodata.str1.8,"aMS",@progbits,1
.align 8
.LC0:
.string "_Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf"
.text
.type _ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2054:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
leaq _ZL15__fatDeviceText(%rip), %rdi
call __cudaRegisterFatBinary@PLT
movq %rax, %rdi
movq %rax, _ZL20__cudaFatCubinHandle(%rip)
pushq $0
.cfi_def_cfa_offset 24
pushq $0
.cfi_def_cfa_offset 32
pushq $0
.cfi_def_cfa_offset 40
pushq $0
.cfi_def_cfa_offset 48
movl $0, %r9d
movl $-1, %r8d
leaq .LC0(%rip), %rdx
movq %rdx, %rcx
leaq _Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf(%rip), %rsi
call __cudaRegisterFunction@PLT
addq $32, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaRegisterFatBinaryEnd@PLT
leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
call atexit@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2054:
.size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
.section .init_array,"aw"
.align 8
.quad _ZL24__sti____cudaRegisterAllv
.section .nvFatBinSegment,"aw"
.align 8
.type _ZL15__fatDeviceText, @object
.size _ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
.long 1180844977
.long 1
.quad fatbinData
.quad 0
.local _ZL20__cudaFatCubinHandle
.comm _ZL20__cudaFatCubinHandle,8,8
.ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
.section .note.GNU-stack,"",@progbits
.section .note.gnu.property,"a"
.align 8
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.string "GNU"
1:
.align 8
.long 0xc0000002
.long 3f - 2f
2:
.long 0x3
3:
.align 8
4: |
You are a helpful coding assistant specialized in converting CUDA source code to HIP/AMD source code. | #include "includes.h"
__global__ void kSoftMaxCrossEntropyRowMajor(float* mat, float* labels, float* target, unsigned int width, unsigned int height, float tiny) {
const unsigned int idx = blockIdx.x * blockDim.x + threadIdx.x;
const unsigned int numThreads = blockDim.x * gridDim.x;
for (unsigned int i = idx; i < height; i += numThreads) {
target[i] = -__logf(mat[height * (int)labels[i] + i] + tiny);
}
} | #include <hip/hip_runtime.h>
#include "includes.h"
__global__ void kSoftMaxCrossEntropyRowMajor(float* mat, float* labels, float* target, unsigned int width, unsigned int height, float tiny) {
const unsigned int idx = blockIdx.x * blockDim.x + threadIdx.x;
const unsigned int numThreads = blockDim.x * gridDim.x;
for (unsigned int i = idx; i < height; i += numThreads) {
target[i] = -__logf(mat[height * (int)labels[i] + i] + tiny);
}
} |
You are a helpful coding assistant specialized in converting HIP source code to AMD device assembly. | #include <hip/hip_runtime.h>
#include "includes.h"
__global__ void kSoftMaxCrossEntropyRowMajor(float* mat, float* labels, float* target, unsigned int width, unsigned int height, float tiny) {
const unsigned int idx = blockIdx.x * blockDim.x + threadIdx.x;
const unsigned int numThreads = blockDim.x * gridDim.x;
for (unsigned int i = idx; i < height; i += numThreads) {
target[i] = -__logf(mat[height * (int)labels[i] + i] + tiny);
}
} | .text
.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
.protected _Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf
.globl _Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf
.p2align 8
.type _Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf,@function
_Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf:
s_clause 0x1
s_load_b32 s4, s[0:1], 0x34
s_load_b32 s8, s[0:1], 0x1c
s_add_u32 s2, s0, 40
s_addc_u32 s3, s1, 0
s_waitcnt lgkmcnt(0)
s_and_b32 s9, s4, 0xffff
s_mov_b32 s4, exec_lo
v_mad_u64_u32 v[1:2], null, s15, s9, v[0:1]
s_delay_alu instid0(VALU_DEP_1)
v_cmpx_gt_u32_e64 s8, v1
s_cbranch_execz .LBB0_3
s_load_b32 s10, s[2:3], 0x0
s_clause 0x2
s_load_b128 s[4:7], s[0:1], 0x0
s_load_b64 s[2:3], s[0:1], 0x10
s_load_b32 s1, s[0:1], 0x20
s_waitcnt lgkmcnt(0)
s_mul_i32 s9, s10, s9
s_mov_b32 s10, 0
.LBB0_2:
v_mov_b32_e32 v2, 0
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_lshlrev_b64 v[3:4], 2, v[1:2]
v_add_co_u32 v5, vcc_lo, s6, v3
s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_1)
v_add_co_ci_u32_e32 v6, vcc_lo, s7, v4, vcc_lo
global_load_b32 v0, v[5:6], off
s_waitcnt vmcnt(0)
v_cvt_i32_f32_e32 v0, v0
v_mad_u64_u32 v[5:6], null, v0, s8, v[1:2]
v_dual_mov_b32 v6, v2 :: v_dual_add_nc_u32 v1, s9, v1
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_lshlrev_b64 v[5:6], 2, v[5:6]
v_add_co_u32 v5, vcc_lo, s4, v5
s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_1)
v_add_co_ci_u32_e32 v6, vcc_lo, s5, v6, vcc_lo
global_load_b32 v0, v[5:6], off
s_waitcnt vmcnt(0)
v_add_f32_e32 v0, s1, v0
v_cmp_gt_f32_e32 vcc_lo, 0x800000, v0
v_cndmask_b32_e64 v2, 1.0, 0x4f800000, vcc_lo
v_cndmask_b32_e64 v5, 0, 0x41b17218, vcc_lo
s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
v_mul_f32_e32 v0, v0, v2
v_log_f32_e32 v0, v0
s_waitcnt_depctr 0xfff
v_mul_f32_e32 v2, 0x3f317217, v0
v_cmp_gt_f32_e64 vcc_lo, 0x7f800000, |v0|
s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
v_fma_f32 v2, v0, 0x3f317217, -v2
v_fmac_f32_e32 v2, 0x3377d1cf, v0
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_fmac_f32_e32 v2, 0x3f317217, v0
v_cndmask_b32_e32 v0, v0, v2, vcc_lo
v_cmp_le_u32_e32 vcc_lo, s8, v1
v_add_co_u32 v2, s0, s2, v3
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_4)
v_add_co_ci_u32_e64 v3, s0, s3, v4, s0
v_sub_f32_e32 v0, v0, v5
s_or_b32 s10, vcc_lo, s10
s_delay_alu instid0(VALU_DEP_1)
v_xor_b32_e32 v0, 0x80000000, v0
global_store_b32 v[2:3], v0, off
s_and_not1_b32 exec_lo, exec_lo, s10
s_cbranch_execnz .LBB0_2
.LBB0_3:
s_nop 0
s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
s_endpgm
.section .rodata,"a",@progbits
.p2align 6, 0x0
.amdhsa_kernel _Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf
.amdhsa_group_segment_fixed_size 0
.amdhsa_private_segment_fixed_size 0
.amdhsa_kernarg_size 296
.amdhsa_user_sgpr_count 15
.amdhsa_user_sgpr_dispatch_ptr 0
.amdhsa_user_sgpr_queue_ptr 0
.amdhsa_user_sgpr_kernarg_segment_ptr 1
.amdhsa_user_sgpr_dispatch_id 0
.amdhsa_user_sgpr_private_segment_size 0
.amdhsa_wavefront_size32 1
.amdhsa_uses_dynamic_stack 0
.amdhsa_enable_private_segment 0
.amdhsa_system_sgpr_workgroup_id_x 1
.amdhsa_system_sgpr_workgroup_id_y 0
.amdhsa_system_sgpr_workgroup_id_z 0
.amdhsa_system_sgpr_workgroup_info 0
.amdhsa_system_vgpr_workitem_id 0
.amdhsa_next_free_vgpr 7
.amdhsa_next_free_sgpr 16
.amdhsa_float_round_mode_32 0
.amdhsa_float_round_mode_16_64 0
.amdhsa_float_denorm_mode_32 3
.amdhsa_float_denorm_mode_16_64 3
.amdhsa_dx10_clamp 1
.amdhsa_ieee_mode 1
.amdhsa_fp16_overflow 0
.amdhsa_workgroup_processor_mode 1
.amdhsa_memory_ordered 1
.amdhsa_forward_progress 0
.amdhsa_shared_vgpr_count 0
.amdhsa_exception_fp_ieee_invalid_op 0
.amdhsa_exception_fp_denorm_src 0
.amdhsa_exception_fp_ieee_div_zero 0
.amdhsa_exception_fp_ieee_overflow 0
.amdhsa_exception_fp_ieee_underflow 0
.amdhsa_exception_fp_ieee_inexact 0
.amdhsa_exception_int_div_zero 0
.end_amdhsa_kernel
.text
.Lfunc_end0:
.size _Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf, .Lfunc_end0-_Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf
.section .AMDGPU.csdata,"",@progbits
.text
.p2alignl 7, 3214868480
.fill 96, 4, 3214868480
.type __hip_cuid_,@object
.section .bss,"aw",@nobits
.globl __hip_cuid_
__hip_cuid_:
.byte 0
.size __hip_cuid_, 1
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym __hip_cuid_
.amdgpu_metadata
---
amdhsa.kernels:
- .args:
- .address_space: global
.offset: 0
.size: 8
.value_kind: global_buffer
- .address_space: global
.offset: 8
.size: 8
.value_kind: global_buffer
- .address_space: global
.offset: 16
.size: 8
.value_kind: global_buffer
- .offset: 24
.size: 4
.value_kind: by_value
- .offset: 28
.size: 4
.value_kind: by_value
- .offset: 32
.size: 4
.value_kind: by_value
- .offset: 40
.size: 4
.value_kind: hidden_block_count_x
- .offset: 44
.size: 4
.value_kind: hidden_block_count_y
- .offset: 48
.size: 4
.value_kind: hidden_block_count_z
- .offset: 52
.size: 2
.value_kind: hidden_group_size_x
- .offset: 54
.size: 2
.value_kind: hidden_group_size_y
- .offset: 56
.size: 2
.value_kind: hidden_group_size_z
- .offset: 58
.size: 2
.value_kind: hidden_remainder_x
- .offset: 60
.size: 2
.value_kind: hidden_remainder_y
- .offset: 62
.size: 2
.value_kind: hidden_remainder_z
- .offset: 80
.size: 8
.value_kind: hidden_global_offset_x
- .offset: 88
.size: 8
.value_kind: hidden_global_offset_y
- .offset: 96
.size: 8
.value_kind: hidden_global_offset_z
- .offset: 104
.size: 2
.value_kind: hidden_grid_dims
.group_segment_fixed_size: 0
.kernarg_segment_align: 8
.kernarg_segment_size: 296
.language: OpenCL C
.language_version:
- 2
- 0
.max_flat_workgroup_size: 1024
.name: _Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf
.private_segment_fixed_size: 0
.sgpr_count: 18
.sgpr_spill_count: 0
.symbol: _Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf.kd
.uniform_work_group_size: 1
.uses_dynamic_stack: false
.vgpr_count: 7
.vgpr_spill_count: 0
.wavefront_size: 32
.workgroup_processor_mode: 1
amdhsa.target: amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
- 1
- 2
...
.end_amdgpu_metadata |
You are a helpful coding assistant specialized in converting HIP source code to AMD host assembly. | #include <hip/hip_runtime.h>
#include "includes.h"
__global__ void kSoftMaxCrossEntropyRowMajor(float* mat, float* labels, float* target, unsigned int width, unsigned int height, float tiny) {
const unsigned int idx = blockIdx.x * blockDim.x + threadIdx.x;
const unsigned int numThreads = blockDim.x * gridDim.x;
for (unsigned int i = idx; i < height; i += numThreads) {
target[i] = -__logf(mat[height * (int)labels[i] + i] + tiny);
}
} | .text
.file "kSoftMaxCrossEntropyRowMajor.hip"
.globl _Z43__device_stub__kSoftMaxCrossEntropyRowMajorPfS_S_jjf # -- Begin function _Z43__device_stub__kSoftMaxCrossEntropyRowMajorPfS_S_jjf
.p2align 4, 0x90
.type _Z43__device_stub__kSoftMaxCrossEntropyRowMajorPfS_S_jjf,@function
_Z43__device_stub__kSoftMaxCrossEntropyRowMajorPfS_S_jjf: # @_Z43__device_stub__kSoftMaxCrossEntropyRowMajorPfS_S_jjf
.cfi_startproc
# %bb.0:
subq $152, %rsp
.cfi_def_cfa_offset 160
movq %rdi, 88(%rsp)
movq %rsi, 80(%rsp)
movq %rdx, 72(%rsp)
movl %ecx, 20(%rsp)
movl %r8d, 16(%rsp)
movss %xmm0, 12(%rsp)
leaq 88(%rsp), %rax
movq %rax, 96(%rsp)
leaq 80(%rsp), %rax
movq %rax, 104(%rsp)
leaq 72(%rsp), %rax
movq %rax, 112(%rsp)
leaq 20(%rsp), %rax
movq %rax, 120(%rsp)
leaq 16(%rsp), %rax
movq %rax, 128(%rsp)
leaq 12(%rsp), %rax
movq %rax, 136(%rsp)
leaq 56(%rsp), %rdi
leaq 40(%rsp), %rsi
leaq 32(%rsp), %rdx
leaq 24(%rsp), %rcx
callq __hipPopCallConfiguration
movq 56(%rsp), %rsi
movl 64(%rsp), %edx
movq 40(%rsp), %rcx
movl 48(%rsp), %r8d
leaq 96(%rsp), %r9
movl $_Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf, %edi
pushq 24(%rsp)
.cfi_adjust_cfa_offset 8
pushq 40(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $168, %rsp
.cfi_adjust_cfa_offset -168
retq
.Lfunc_end0:
.size _Z43__device_stub__kSoftMaxCrossEntropyRowMajorPfS_S_jjf, .Lfunc_end0-_Z43__device_stub__kSoftMaxCrossEntropyRowMajorPfS_S_jjf
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_ctor
.type __hip_module_ctor,@function
__hip_module_ctor: # @__hip_module_ctor
.cfi_startproc
# %bb.0:
subq $40, %rsp
.cfi_def_cfa_offset 48
cmpq $0, __hip_gpubin_handle(%rip)
jne .LBB1_2
# %bb.1:
movl $__hip_fatbin_wrapper, %edi
callq __hipRegisterFatBinary
movq %rax, __hip_gpubin_handle(%rip)
.LBB1_2:
movq __hip_gpubin_handle(%rip), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 16(%rsp)
movups %xmm0, (%rsp)
movl $_Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf, %esi
movl $.L__unnamed_1, %edx
movl $.L__unnamed_1, %ecx
movl $-1, %r8d
xorl %r9d, %r9d
callq __hipRegisterFunction
movl $__hip_module_dtor, %edi
addq $40, %rsp
.cfi_def_cfa_offset 8
jmp atexit # TAILCALL
.Lfunc_end1:
.size __hip_module_ctor, .Lfunc_end1-__hip_module_ctor
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_dtor
.type __hip_module_dtor,@function
__hip_module_dtor: # @__hip_module_dtor
.cfi_startproc
# %bb.0:
movq __hip_gpubin_handle(%rip), %rdi
testq %rdi, %rdi
je .LBB2_2
# %bb.1:
pushq %rax
.cfi_def_cfa_offset 16
callq __hipUnregisterFatBinary
movq $0, __hip_gpubin_handle(%rip)
addq $8, %rsp
.cfi_def_cfa_offset 8
.LBB2_2:
retq
.Lfunc_end2:
.size __hip_module_dtor, .Lfunc_end2-__hip_module_dtor
.cfi_endproc
# -- End function
.type _Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf,@object # @_Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf
.section .rodata,"a",@progbits
.globl _Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf
.p2align 3, 0x0
_Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf:
.quad _Z43__device_stub__kSoftMaxCrossEntropyRowMajorPfS_S_jjf
.size _Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf, 8
.type .L__unnamed_1,@object # @0
.section .rodata.str1.1,"aMS",@progbits,1
.L__unnamed_1:
.asciz "_Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf"
.size .L__unnamed_1, 42
.type __hip_fatbin_wrapper,@object # @__hip_fatbin_wrapper
.section .hipFatBinSegment,"a",@progbits
.p2align 3, 0x0
__hip_fatbin_wrapper:
.long 1212764230 # 0x48495046
.long 1 # 0x1
.quad __hip_fatbin
.quad 0
.size __hip_fatbin_wrapper, 24
.type __hip_gpubin_handle,@object # @__hip_gpubin_handle
.local __hip_gpubin_handle
.comm __hip_gpubin_handle,8,8
.section .init_array,"aw",@init_array
.p2align 3, 0x0
.quad __hip_module_ctor
.type __hip_cuid_,@object # @__hip_cuid_
.bss
.globl __hip_cuid_
__hip_cuid_:
.byte 0 # 0x0
.size __hip_cuid_, 1
.section ".linker-options","e",@llvm_linker_options
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym _Z43__device_stub__kSoftMaxCrossEntropyRowMajorPfS_S_jjf
.addrsig_sym __hip_module_ctor
.addrsig_sym __hip_module_dtor
.addrsig_sym _Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf
.addrsig_sym __hip_fatbin
.addrsig_sym __hip_fatbin_wrapper
.addrsig_sym __hip_cuid_ |
You are a helpful coding assistant specialized in converting from CUDA device assembly to AMD device assembly. | code for sm_80
Function : _Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf
.headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)"
/*0000*/ MOV R1, c[0x0][0x28] ; /* 0x00000a0000017a02 */
/* 0x000fe40000000f00 */
/*0010*/ S2R R0, SR_CTAID.X ; /* 0x0000000000007919 */
/* 0x000e280000002500 */
/*0020*/ S2R R3, SR_TID.X ; /* 0x0000000000037919 */
/* 0x000e240000002100 */
/*0030*/ IMAD R0, R0, c[0x0][0x0], R3 ; /* 0x0000000000007a24 */
/* 0x001fca00078e0203 */
/*0040*/ ISETP.GE.U32.AND P0, PT, R0, c[0x0][0x17c], PT ; /* 0x00005f0000007a0c */
/* 0x000fda0003f06070 */
/*0050*/ @P0 EXIT ; /* 0x000000000000094d */
/* 0x000fea0003800000 */
/*0060*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */
/* 0x000fe40000000a00 */
/*0070*/ HFMA2.MMA R7, -RZ, RZ, 0, 2.384185791015625e-07 ; /* 0x00000004ff077435 */
/* 0x001fd400000001ff */
/*0080*/ IMAD.WIDE.U32 R2, R0, R7, c[0x0][0x168] ; /* 0x00005a0000027625 */
/* 0x000fcc00078e0007 */
/*0090*/ LDG.E R2, [R2.64] ; /* 0x0000000402027981 */
/* 0x000ea4000c1e1900 */
/*00a0*/ F2I.TRUNC.NTZ R5, R2 ; /* 0x0000000200057305 */
/* 0x004e24000020f100 */
/*00b0*/ IMAD R5, R5, c[0x0][0x17c], R0 ; /* 0x00005f0005057a24 */
/* 0x001fc800078e0200 */
/*00c0*/ IMAD.WIDE.U32 R4, R5, R7, c[0x0][0x160] ; /* 0x0000580005047625 */
/* 0x000fcc00078e0007 */
/*00d0*/ LDG.E R4, [R4.64] ; /* 0x0000000404047981 */
/* 0x000ea2000c1e1900 */
/*00e0*/ IMAD.WIDE.U32 R6, R0, R7, c[0x0][0x170] ; /* 0x00005c0000067625 */
/* 0x000fe200078e0007 */
/*00f0*/ MOV R3, c[0x0][0x0] ; /* 0x0000000000037a02 */
/* 0x000fca0000000f00 */
/*0100*/ IMAD R0, R3, c[0x0][0xc], R0 ; /* 0x0000030003007a24 */
/* 0x000fe400078e0200 */
/*0110*/ FADD R8, R4, c[0x0][0x180] ; /* 0x0000600004087621 */
/* 0x004fca0000000000 */
/*0120*/ FSETP.GEU.AND P0, PT, |R8|, 1.175494350822287508e-38, PT ; /* 0x008000000800780b */
/* 0x000fda0003f0e200 */
/*0130*/ @!P0 FMUL R8, R8, 16777216 ; /* 0x4b80000008088820 */
/* 0x000fc80000400000 */
/*0140*/ MUFU.LG2 R9, R8 ; /* 0x0000000800097308 */
/* 0x000e240000000c00 */
/*0150*/ @!P0 FADD R9, R9, -24 ; /* 0xc1c0000009098421 */
/* 0x001fe20000000000 */
/*0160*/ ISETP.GE.U32.AND P0, PT, R0, c[0x0][0x17c], PT ; /* 0x00005f0000007a0c */
/* 0x000fc60003f06070 */
/*0170*/ FMUL R9, R9, -0.69314718246459960938 ; /* 0xbf31721809097820 */
/* 0x000fca0000400000 */
/*0180*/ STG.E [R6.64], R9 ; /* 0x0000000906007986 */
/* 0x0001ea000c101904 */
/*0190*/ @!P0 BRA 0x70 ; /* 0xfffffed000008947 */
/* 0x000fea000383ffff */
/*01a0*/ EXIT ; /* 0x000000000000794d */
/* 0x000fea0003800000 */
/*01b0*/ BRA 0x1b0; /* 0xfffffff000007947 */
/* 0x000fc0000383ffff */
/*01c0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*01d0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*01e0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*01f0*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0200*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0210*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0220*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0230*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0240*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0250*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0260*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
/*0270*/ NOP; /* 0x0000000000007918 */
/* 0x000fc00000000000 */
.......... | .text
.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
.protected _Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf
.globl _Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf
.p2align 8
.type _Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf,@function
_Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf:
s_clause 0x1
s_load_b32 s4, s[0:1], 0x34
s_load_b32 s8, s[0:1], 0x1c
s_add_u32 s2, s0, 40
s_addc_u32 s3, s1, 0
s_waitcnt lgkmcnt(0)
s_and_b32 s9, s4, 0xffff
s_mov_b32 s4, exec_lo
v_mad_u64_u32 v[1:2], null, s15, s9, v[0:1]
s_delay_alu instid0(VALU_DEP_1)
v_cmpx_gt_u32_e64 s8, v1
s_cbranch_execz .LBB0_3
s_load_b32 s10, s[2:3], 0x0
s_clause 0x2
s_load_b128 s[4:7], s[0:1], 0x0
s_load_b64 s[2:3], s[0:1], 0x10
s_load_b32 s1, s[0:1], 0x20
s_waitcnt lgkmcnt(0)
s_mul_i32 s9, s10, s9
s_mov_b32 s10, 0
.LBB0_2:
v_mov_b32_e32 v2, 0
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_lshlrev_b64 v[3:4], 2, v[1:2]
v_add_co_u32 v5, vcc_lo, s6, v3
s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_1)
v_add_co_ci_u32_e32 v6, vcc_lo, s7, v4, vcc_lo
global_load_b32 v0, v[5:6], off
s_waitcnt vmcnt(0)
v_cvt_i32_f32_e32 v0, v0
v_mad_u64_u32 v[5:6], null, v0, s8, v[1:2]
v_dual_mov_b32 v6, v2 :: v_dual_add_nc_u32 v1, s9, v1
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_lshlrev_b64 v[5:6], 2, v[5:6]
v_add_co_u32 v5, vcc_lo, s4, v5
s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_1)
v_add_co_ci_u32_e32 v6, vcc_lo, s5, v6, vcc_lo
global_load_b32 v0, v[5:6], off
s_waitcnt vmcnt(0)
v_add_f32_e32 v0, s1, v0
v_cmp_gt_f32_e32 vcc_lo, 0x800000, v0
v_cndmask_b32_e64 v2, 1.0, 0x4f800000, vcc_lo
v_cndmask_b32_e64 v5, 0, 0x41b17218, vcc_lo
s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
v_mul_f32_e32 v0, v0, v2
v_log_f32_e32 v0, v0
s_waitcnt_depctr 0xfff
v_mul_f32_e32 v2, 0x3f317217, v0
v_cmp_gt_f32_e64 vcc_lo, 0x7f800000, |v0|
s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
v_fma_f32 v2, v0, 0x3f317217, -v2
v_fmac_f32_e32 v2, 0x3377d1cf, v0
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
v_fmac_f32_e32 v2, 0x3f317217, v0
v_cndmask_b32_e32 v0, v0, v2, vcc_lo
v_cmp_le_u32_e32 vcc_lo, s8, v1
v_add_co_u32 v2, s0, s2, v3
s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_4)
v_add_co_ci_u32_e64 v3, s0, s3, v4, s0
v_sub_f32_e32 v0, v0, v5
s_or_b32 s10, vcc_lo, s10
s_delay_alu instid0(VALU_DEP_1)
v_xor_b32_e32 v0, 0x80000000, v0
global_store_b32 v[2:3], v0, off
s_and_not1_b32 exec_lo, exec_lo, s10
s_cbranch_execnz .LBB0_2
.LBB0_3:
s_nop 0
s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
s_endpgm
.section .rodata,"a",@progbits
.p2align 6, 0x0
.amdhsa_kernel _Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf
.amdhsa_group_segment_fixed_size 0
.amdhsa_private_segment_fixed_size 0
.amdhsa_kernarg_size 296
.amdhsa_user_sgpr_count 15
.amdhsa_user_sgpr_dispatch_ptr 0
.amdhsa_user_sgpr_queue_ptr 0
.amdhsa_user_sgpr_kernarg_segment_ptr 1
.amdhsa_user_sgpr_dispatch_id 0
.amdhsa_user_sgpr_private_segment_size 0
.amdhsa_wavefront_size32 1
.amdhsa_uses_dynamic_stack 0
.amdhsa_enable_private_segment 0
.amdhsa_system_sgpr_workgroup_id_x 1
.amdhsa_system_sgpr_workgroup_id_y 0
.amdhsa_system_sgpr_workgroup_id_z 0
.amdhsa_system_sgpr_workgroup_info 0
.amdhsa_system_vgpr_workitem_id 0
.amdhsa_next_free_vgpr 7
.amdhsa_next_free_sgpr 16
.amdhsa_float_round_mode_32 0
.amdhsa_float_round_mode_16_64 0
.amdhsa_float_denorm_mode_32 3
.amdhsa_float_denorm_mode_16_64 3
.amdhsa_dx10_clamp 1
.amdhsa_ieee_mode 1
.amdhsa_fp16_overflow 0
.amdhsa_workgroup_processor_mode 1
.amdhsa_memory_ordered 1
.amdhsa_forward_progress 0
.amdhsa_shared_vgpr_count 0
.amdhsa_exception_fp_ieee_invalid_op 0
.amdhsa_exception_fp_denorm_src 0
.amdhsa_exception_fp_ieee_div_zero 0
.amdhsa_exception_fp_ieee_overflow 0
.amdhsa_exception_fp_ieee_underflow 0
.amdhsa_exception_fp_ieee_inexact 0
.amdhsa_exception_int_div_zero 0
.end_amdhsa_kernel
.text
.Lfunc_end0:
.size _Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf, .Lfunc_end0-_Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf
.section .AMDGPU.csdata,"",@progbits
.text
.p2alignl 7, 3214868480
.fill 96, 4, 3214868480
.type __hip_cuid_,@object
.section .bss,"aw",@nobits
.globl __hip_cuid_
__hip_cuid_:
.byte 0
.size __hip_cuid_, 1
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym __hip_cuid_
.amdgpu_metadata
---
amdhsa.kernels:
- .args:
- .address_space: global
.offset: 0
.size: 8
.value_kind: global_buffer
- .address_space: global
.offset: 8
.size: 8
.value_kind: global_buffer
- .address_space: global
.offset: 16
.size: 8
.value_kind: global_buffer
- .offset: 24
.size: 4
.value_kind: by_value
- .offset: 28
.size: 4
.value_kind: by_value
- .offset: 32
.size: 4
.value_kind: by_value
- .offset: 40
.size: 4
.value_kind: hidden_block_count_x
- .offset: 44
.size: 4
.value_kind: hidden_block_count_y
- .offset: 48
.size: 4
.value_kind: hidden_block_count_z
- .offset: 52
.size: 2
.value_kind: hidden_group_size_x
- .offset: 54
.size: 2
.value_kind: hidden_group_size_y
- .offset: 56
.size: 2
.value_kind: hidden_group_size_z
- .offset: 58
.size: 2
.value_kind: hidden_remainder_x
- .offset: 60
.size: 2
.value_kind: hidden_remainder_y
- .offset: 62
.size: 2
.value_kind: hidden_remainder_z
- .offset: 80
.size: 8
.value_kind: hidden_global_offset_x
- .offset: 88
.size: 8
.value_kind: hidden_global_offset_y
- .offset: 96
.size: 8
.value_kind: hidden_global_offset_z
- .offset: 104
.size: 2
.value_kind: hidden_grid_dims
.group_segment_fixed_size: 0
.kernarg_segment_align: 8
.kernarg_segment_size: 296
.language: OpenCL C
.language_version:
- 2
- 0
.max_flat_workgroup_size: 1024
.name: _Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf
.private_segment_fixed_size: 0
.sgpr_count: 18
.sgpr_spill_count: 0
.symbol: _Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf.kd
.uniform_work_group_size: 1
.uses_dynamic_stack: false
.vgpr_count: 7
.vgpr_spill_count: 0
.wavefront_size: 32
.workgroup_processor_mode: 1
amdhsa.target: amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
- 1
- 2
...
.end_amdgpu_metadata |
You are a helpful coding assistant specialized in converting from CUDA host assembly to AMD host assembly. | .file "tmpxft_000ebe02_00000000-6_kSoftMaxCrossEntropyRowMajor.cudafe1.cpp"
.text
#APP
#NO_APP
.type _ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2029:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaUnregisterFatBinary@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2029:
.size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
.globl _Z55__device_stub__Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjfPfS_S_jjf
.type _Z55__device_stub__Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjfPfS_S_jjf, @function
_Z55__device_stub__Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjfPfS_S_jjf:
.LFB2051:
.cfi_startproc
endbr64
subq $184, %rsp
.cfi_def_cfa_offset 192
movq %rdi, 40(%rsp)
movq %rsi, 32(%rsp)
movq %rdx, 24(%rsp)
movl %ecx, 20(%rsp)
movl %r8d, 16(%rsp)
movss %xmm0, 12(%rsp)
movq %fs:40, %rax
movq %rax, 168(%rsp)
xorl %eax, %eax
leaq 40(%rsp), %rax
movq %rax, 112(%rsp)
leaq 32(%rsp), %rax
movq %rax, 120(%rsp)
leaq 24(%rsp), %rax
movq %rax, 128(%rsp)
leaq 20(%rsp), %rax
movq %rax, 136(%rsp)
leaq 16(%rsp), %rax
movq %rax, 144(%rsp)
leaq 12(%rsp), %rax
movq %rax, 152(%rsp)
movl $1, 64(%rsp)
movl $1, 68(%rsp)
movl $1, 72(%rsp)
movl $1, 76(%rsp)
movl $1, 80(%rsp)
movl $1, 84(%rsp)
leaq 56(%rsp), %rcx
leaq 48(%rsp), %rdx
leaq 76(%rsp), %rsi
leaq 64(%rsp), %rdi
call __cudaPopCallConfiguration@PLT
testl %eax, %eax
je .L7
.L3:
movq 168(%rsp), %rax
subq %fs:40, %rax
jne .L8
addq $184, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 8
ret
.L7:
.cfi_restore_state
pushq 56(%rsp)
.cfi_def_cfa_offset 200
pushq 56(%rsp)
.cfi_def_cfa_offset 208
leaq 128(%rsp), %r9
movq 92(%rsp), %rcx
movl 100(%rsp), %r8d
movq 80(%rsp), %rsi
movl 88(%rsp), %edx
leaq _Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf(%rip), %rdi
call cudaLaunchKernel@PLT
addq $16, %rsp
.cfi_def_cfa_offset 192
jmp .L3
.L8:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE2051:
.size _Z55__device_stub__Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjfPfS_S_jjf, .-_Z55__device_stub__Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjfPfS_S_jjf
.globl _Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf
.type _Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf, @function
_Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf:
.LFB2052:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
call _Z55__device_stub__Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjfPfS_S_jjf
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2052:
.size _Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf, .-_Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf
.section .rodata.str1.8,"aMS",@progbits,1
.align 8
.LC0:
.string "_Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf"
.text
.type _ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2054:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
leaq _ZL15__fatDeviceText(%rip), %rdi
call __cudaRegisterFatBinary@PLT
movq %rax, %rdi
movq %rax, _ZL20__cudaFatCubinHandle(%rip)
pushq $0
.cfi_def_cfa_offset 24
pushq $0
.cfi_def_cfa_offset 32
pushq $0
.cfi_def_cfa_offset 40
pushq $0
.cfi_def_cfa_offset 48
movl $0, %r9d
movl $-1, %r8d
leaq .LC0(%rip), %rdx
movq %rdx, %rcx
leaq _Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf(%rip), %rsi
call __cudaRegisterFunction@PLT
addq $32, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaRegisterFatBinaryEnd@PLT
leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
call atexit@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2054:
.size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
.section .init_array,"aw"
.align 8
.quad _ZL24__sti____cudaRegisterAllv
.section .nvFatBinSegment,"aw"
.align 8
.type _ZL15__fatDeviceText, @object
.size _ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
.long 1180844977
.long 1
.quad fatbinData
.quad 0
.local _ZL20__cudaFatCubinHandle
.comm _ZL20__cudaFatCubinHandle,8,8
.ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
.section .note.GNU-stack,"",@progbits
.section .note.gnu.property,"a"
.align 8
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.string "GNU"
1:
.align 8
.long 0xc0000002
.long 3f - 2f
2:
.long 0x3
3:
.align 8
4: | .text
.file "kSoftMaxCrossEntropyRowMajor.hip"
.globl _Z43__device_stub__kSoftMaxCrossEntropyRowMajorPfS_S_jjf # -- Begin function _Z43__device_stub__kSoftMaxCrossEntropyRowMajorPfS_S_jjf
.p2align 4, 0x90
.type _Z43__device_stub__kSoftMaxCrossEntropyRowMajorPfS_S_jjf,@function
_Z43__device_stub__kSoftMaxCrossEntropyRowMajorPfS_S_jjf: # @_Z43__device_stub__kSoftMaxCrossEntropyRowMajorPfS_S_jjf
.cfi_startproc
# %bb.0:
subq $152, %rsp
.cfi_def_cfa_offset 160
movq %rdi, 88(%rsp)
movq %rsi, 80(%rsp)
movq %rdx, 72(%rsp)
movl %ecx, 20(%rsp)
movl %r8d, 16(%rsp)
movss %xmm0, 12(%rsp)
leaq 88(%rsp), %rax
movq %rax, 96(%rsp)
leaq 80(%rsp), %rax
movq %rax, 104(%rsp)
leaq 72(%rsp), %rax
movq %rax, 112(%rsp)
leaq 20(%rsp), %rax
movq %rax, 120(%rsp)
leaq 16(%rsp), %rax
movq %rax, 128(%rsp)
leaq 12(%rsp), %rax
movq %rax, 136(%rsp)
leaq 56(%rsp), %rdi
leaq 40(%rsp), %rsi
leaq 32(%rsp), %rdx
leaq 24(%rsp), %rcx
callq __hipPopCallConfiguration
movq 56(%rsp), %rsi
movl 64(%rsp), %edx
movq 40(%rsp), %rcx
movl 48(%rsp), %r8d
leaq 96(%rsp), %r9
movl $_Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf, %edi
pushq 24(%rsp)
.cfi_adjust_cfa_offset 8
pushq 40(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $168, %rsp
.cfi_adjust_cfa_offset -168
retq
.Lfunc_end0:
.size _Z43__device_stub__kSoftMaxCrossEntropyRowMajorPfS_S_jjf, .Lfunc_end0-_Z43__device_stub__kSoftMaxCrossEntropyRowMajorPfS_S_jjf
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_ctor
.type __hip_module_ctor,@function
__hip_module_ctor: # @__hip_module_ctor
.cfi_startproc
# %bb.0:
subq $40, %rsp
.cfi_def_cfa_offset 48
cmpq $0, __hip_gpubin_handle(%rip)
jne .LBB1_2
# %bb.1:
movl $__hip_fatbin_wrapper, %edi
callq __hipRegisterFatBinary
movq %rax, __hip_gpubin_handle(%rip)
.LBB1_2:
movq __hip_gpubin_handle(%rip), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 16(%rsp)
movups %xmm0, (%rsp)
movl $_Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf, %esi
movl $.L__unnamed_1, %edx
movl $.L__unnamed_1, %ecx
movl $-1, %r8d
xorl %r9d, %r9d
callq __hipRegisterFunction
movl $__hip_module_dtor, %edi
addq $40, %rsp
.cfi_def_cfa_offset 8
jmp atexit # TAILCALL
.Lfunc_end1:
.size __hip_module_ctor, .Lfunc_end1-__hip_module_ctor
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_dtor
.type __hip_module_dtor,@function
__hip_module_dtor: # @__hip_module_dtor
.cfi_startproc
# %bb.0:
movq __hip_gpubin_handle(%rip), %rdi
testq %rdi, %rdi
je .LBB2_2
# %bb.1:
pushq %rax
.cfi_def_cfa_offset 16
callq __hipUnregisterFatBinary
movq $0, __hip_gpubin_handle(%rip)
addq $8, %rsp
.cfi_def_cfa_offset 8
.LBB2_2:
retq
.Lfunc_end2:
.size __hip_module_dtor, .Lfunc_end2-__hip_module_dtor
.cfi_endproc
# -- End function
.type _Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf,@object # @_Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf
.section .rodata,"a",@progbits
.globl _Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf
.p2align 3, 0x0
_Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf:
.quad _Z43__device_stub__kSoftMaxCrossEntropyRowMajorPfS_S_jjf
.size _Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf, 8
.type .L__unnamed_1,@object # @0
.section .rodata.str1.1,"aMS",@progbits,1
.L__unnamed_1:
.asciz "_Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf"
.size .L__unnamed_1, 42
.type __hip_fatbin_wrapper,@object # @__hip_fatbin_wrapper
.section .hipFatBinSegment,"a",@progbits
.p2align 3, 0x0
__hip_fatbin_wrapper:
.long 1212764230 # 0x48495046
.long 1 # 0x1
.quad __hip_fatbin
.quad 0
.size __hip_fatbin_wrapper, 24
.type __hip_gpubin_handle,@object # @__hip_gpubin_handle
.local __hip_gpubin_handle
.comm __hip_gpubin_handle,8,8
.section .init_array,"aw",@init_array
.p2align 3, 0x0
.quad __hip_module_ctor
.type __hip_cuid_,@object # @__hip_cuid_
.bss
.globl __hip_cuid_
__hip_cuid_:
.byte 0 # 0x0
.size __hip_cuid_, 1
.section ".linker-options","e",@llvm_linker_options
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym _Z43__device_stub__kSoftMaxCrossEntropyRowMajorPfS_S_jjf
.addrsig_sym __hip_module_ctor
.addrsig_sym __hip_module_dtor
.addrsig_sym _Z28kSoftMaxCrossEntropyRowMajorPfS_S_jjf
.addrsig_sym __hip_fatbin
.addrsig_sym __hip_fatbin_wrapper
.addrsig_sym __hip_cuid_ |
You are a helpful coding assistant specialized in converting CUDA source code to CUDA host assembly. | #include "includes.h"
__global__ void CalcAngMom(double *AngMomx_d, double *AngMomy_d, double *AngMomz_d, double *GlobalAMx_d, double *GlobalAMy_d, double *GlobalAMz_d, double *Mh_d, double *Rho_d, double A, double Omega, double *Altitude_d, double *Altitudeh_d, double *lonlat_d, double *areasT, double *func_r_d, int num, bool DeepModel) {
int id = blockIdx.x * blockDim.x + threadIdx.x;
int nv = gridDim.y;
int lev = blockIdx.y;
if (id < num) {
double AMx, AMy, AMz;
double rx, ry, rz, r;
//calculate control volume
double zup, zlow, Vol;
zup = Altitudeh_d[lev + 1] + A;
zlow = Altitudeh_d[lev] + A;
if (DeepModel) {
Vol = areasT[id] / pow(A, 2) * (pow(zup, 3) - pow(zlow, 3)) / 3;
}
else {
Vol = areasT[id] * (zup - zlow);
}
//radius vector
r = (A + Altitude_d[lev]);
rx = r * func_r_d[id * 3 + 0];
ry = r * func_r_d[id * 3 + 1];
rz = r * func_r_d[id * 3 + 2];
//angular momentum r x p (total x and y over globe should ~ 0, z ~ const)
AMx = ry * Mh_d[id * 3 * nv + lev * 3 + 2] - rz * Mh_d[id * 3 * nv + lev * 3 + 1]
- Rho_d[id * nv + lev] * Omega * r * rz * cos(lonlat_d[id * 2 + 1])
* cos(lonlat_d[id * 2]);
AMy = -rx * Mh_d[id * 3 * nv + lev * 3 + 2] + rz * Mh_d[id * 3 * nv + lev * 3 + 0]
- Rho_d[id * nv + lev] * Omega * r * rz * cos(lonlat_d[id * 2 + 1])
* sin(lonlat_d[id * 2]);
AMz = rx * Mh_d[id * 3 * nv + lev * 3 + 1] - ry * Mh_d[id * 3 * nv + lev * 3 + 0]
+ Rho_d[id * nv + lev] * Omega * r * r * cos(lonlat_d[id * 2 + 1])
* cos(lonlat_d[id * 2 + 1]);
//AMx, AMy should go to zero when integrated over globe
// (but in practice, are just much smaller than AMz)
//total in control volume
AngMomx_d[id * nv + lev] = AMx * Vol;
AngMomy_d[id * nv + lev] = AMy * Vol;
AngMomz_d[id * nv + lev] = AMz * Vol;
}
} | .file "tmpxft_000dc463_00000000-6_CalcAngMom.cudafe1.cpp"
.text
#APP
#NO_APP
.type _ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2029:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaUnregisterFatBinary@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2029:
.size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
.globl _Z58__device_stub__Z10CalcAngMomPdS_S_S_S_S_S_S_ddS_S_S_S_S_ibPdS_S_S_S_S_S_S_ddS_S_S_S_S_ib
.type _Z58__device_stub__Z10CalcAngMomPdS_S_S_S_S_S_S_ddS_S_S_S_S_ibPdS_S_S_S_S_S_S_ddS_S_S_S_S_ib, @function
_Z58__device_stub__Z10CalcAngMomPdS_S_S_S_S_S_S_ddS_S_S_S_S_ibPdS_S_S_S_S_S_S_ddS_S_S_S_S_ib:
.LFB2051:
.cfi_startproc
endbr64
subq $344, %rsp
.cfi_def_cfa_offset 352
movq %rdi, 120(%rsp)
movq %rsi, 112(%rsp)
movq %rdx, 104(%rsp)
movq %rcx, 96(%rsp)
movq %r8, 88(%rsp)
movq %r9, 80(%rsp)
movsd %xmm0, 56(%rsp)
movsd %xmm1, 48(%rsp)
movq 352(%rsp), %rax
movq %rax, 72(%rsp)
movq 360(%rsp), %rax
movq %rax, 64(%rsp)
movq 368(%rsp), %rax
movq %rax, 40(%rsp)
movq 376(%rsp), %rax
movq %rax, 32(%rsp)
movq 384(%rsp), %rax
movq %rax, 24(%rsp)
movq 392(%rsp), %rax
movq %rax, 16(%rsp)
movq 400(%rsp), %rax
movq %rax, 8(%rsp)
movl 416(%rsp), %eax
movb %al, 4(%rsp)
movq %fs:40, %rax
movq %rax, 328(%rsp)
xorl %eax, %eax
leaq 120(%rsp), %rax
movq %rax, 192(%rsp)
leaq 112(%rsp), %rax
movq %rax, 200(%rsp)
leaq 104(%rsp), %rax
movq %rax, 208(%rsp)
leaq 96(%rsp), %rax
movq %rax, 216(%rsp)
leaq 88(%rsp), %rax
movq %rax, 224(%rsp)
leaq 80(%rsp), %rax
movq %rax, 232(%rsp)
leaq 72(%rsp), %rax
movq %rax, 240(%rsp)
leaq 64(%rsp), %rax
movq %rax, 248(%rsp)
leaq 56(%rsp), %rax
movq %rax, 256(%rsp)
leaq 48(%rsp), %rax
movq %rax, 264(%rsp)
leaq 40(%rsp), %rax
movq %rax, 272(%rsp)
leaq 32(%rsp), %rax
movq %rax, 280(%rsp)
leaq 24(%rsp), %rax
movq %rax, 288(%rsp)
leaq 16(%rsp), %rax
movq %rax, 296(%rsp)
leaq 8(%rsp), %rax
movq %rax, 304(%rsp)
leaq 408(%rsp), %rax
movq %rax, 312(%rsp)
leaq 4(%rsp), %rax
movq %rax, 320(%rsp)
movl $1, 144(%rsp)
movl $1, 148(%rsp)
movl $1, 152(%rsp)
movl $1, 156(%rsp)
movl $1, 160(%rsp)
movl $1, 164(%rsp)
leaq 136(%rsp), %rcx
leaq 128(%rsp), %rdx
leaq 156(%rsp), %rsi
leaq 144(%rsp), %rdi
call __cudaPopCallConfiguration@PLT
testl %eax, %eax
je .L7
.L3:
movq 328(%rsp), %rax
subq %fs:40, %rax
jne .L8
addq $344, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 8
ret
.L7:
.cfi_restore_state
pushq 136(%rsp)
.cfi_def_cfa_offset 360
pushq 136(%rsp)
.cfi_def_cfa_offset 368
leaq 208(%rsp), %r9
movq 172(%rsp), %rcx
movl 180(%rsp), %r8d
movq 160(%rsp), %rsi
movl 168(%rsp), %edx
leaq _Z10CalcAngMomPdS_S_S_S_S_S_S_ddS_S_S_S_S_ib(%rip), %rdi
call cudaLaunchKernel@PLT
addq $16, %rsp
.cfi_def_cfa_offset 352
jmp .L3
.L8:
call __stack_chk_fail@PLT
.cfi_endproc
.LFE2051:
.size _Z58__device_stub__Z10CalcAngMomPdS_S_S_S_S_S_S_ddS_S_S_S_S_ibPdS_S_S_S_S_S_S_ddS_S_S_S_S_ib, .-_Z58__device_stub__Z10CalcAngMomPdS_S_S_S_S_S_S_ddS_S_S_S_S_ibPdS_S_S_S_S_S_S_ddS_S_S_S_S_ib
.globl _Z10CalcAngMomPdS_S_S_S_S_S_S_ddS_S_S_S_S_ib
.type _Z10CalcAngMomPdS_S_S_S_S_S_S_ddS_S_S_S_S_ib, @function
_Z10CalcAngMomPdS_S_S_S_S_S_S_ddS_S_S_S_S_ib:
.LFB2052:
.cfi_startproc
endbr64
subq $16, %rsp
.cfi_def_cfa_offset 24
movzbl 88(%rsp), %eax
pushq %rax
.cfi_def_cfa_offset 32
movl 88(%rsp), %eax
pushq %rax
.cfi_def_cfa_offset 40
pushq 88(%rsp)
.cfi_def_cfa_offset 48
pushq 88(%rsp)
.cfi_def_cfa_offset 56
pushq 88(%rsp)
.cfi_def_cfa_offset 64
pushq 88(%rsp)
.cfi_def_cfa_offset 72
pushq 88(%rsp)
.cfi_def_cfa_offset 80
pushq 88(%rsp)
.cfi_def_cfa_offset 88
pushq 88(%rsp)
.cfi_def_cfa_offset 96
call _Z58__device_stub__Z10CalcAngMomPdS_S_S_S_S_S_S_ddS_S_S_S_S_ibPdS_S_S_S_S_S_S_ddS_S_S_S_S_ib
addq $88, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2052:
.size _Z10CalcAngMomPdS_S_S_S_S_S_S_ddS_S_S_S_S_ib, .-_Z10CalcAngMomPdS_S_S_S_S_S_S_ddS_S_S_S_S_ib
.section .rodata.str1.8,"aMS",@progbits,1
.align 8
.LC0:
.string "_Z10CalcAngMomPdS_S_S_S_S_S_S_ddS_S_S_S_S_ib"
.text
.type _ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2054:
.cfi_startproc
endbr64
subq $8, %rsp
.cfi_def_cfa_offset 16
leaq _ZL15__fatDeviceText(%rip), %rdi
call __cudaRegisterFatBinary@PLT
movq %rax, %rdi
movq %rax, _ZL20__cudaFatCubinHandle(%rip)
pushq $0
.cfi_def_cfa_offset 24
pushq $0
.cfi_def_cfa_offset 32
pushq $0
.cfi_def_cfa_offset 40
pushq $0
.cfi_def_cfa_offset 48
movl $0, %r9d
movl $-1, %r8d
leaq .LC0(%rip), %rdx
movq %rdx, %rcx
leaq _Z10CalcAngMomPdS_S_S_S_S_S_S_ddS_S_S_S_S_ib(%rip), %rsi
call __cudaRegisterFunction@PLT
addq $32, %rsp
.cfi_def_cfa_offset 16
movq _ZL20__cudaFatCubinHandle(%rip), %rdi
call __cudaRegisterFatBinaryEnd@PLT
leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
call atexit@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE2054:
.size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
.section .init_array,"aw"
.align 8
.quad _ZL24__sti____cudaRegisterAllv
.section .nvFatBinSegment,"aw"
.align 8
.type _ZL15__fatDeviceText, @object
.size _ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
.long 1180844977
.long 1
.quad fatbinData
.quad 0
.local _ZL20__cudaFatCubinHandle
.comm _ZL20__cudaFatCubinHandle,8,8
.ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
.section .note.GNU-stack,"",@progbits
.section .note.gnu.property,"a"
.align 8
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.string "GNU"
1:
.align 8
.long 0xc0000002
.long 3f - 2f
2:
.long 0x3
3:
.align 8
4: |
You are a helpful coding assistant specialized in converting CUDA source code to HIP/AMD source code. | #include "includes.h"
__global__ void CalcAngMom(double *AngMomx_d, double *AngMomy_d, double *AngMomz_d, double *GlobalAMx_d, double *GlobalAMy_d, double *GlobalAMz_d, double *Mh_d, double *Rho_d, double A, double Omega, double *Altitude_d, double *Altitudeh_d, double *lonlat_d, double *areasT, double *func_r_d, int num, bool DeepModel) {
int id = blockIdx.x * blockDim.x + threadIdx.x;
int nv = gridDim.y;
int lev = blockIdx.y;
if (id < num) {
double AMx, AMy, AMz;
double rx, ry, rz, r;
//calculate control volume
double zup, zlow, Vol;
zup = Altitudeh_d[lev + 1] + A;
zlow = Altitudeh_d[lev] + A;
if (DeepModel) {
Vol = areasT[id] / pow(A, 2) * (pow(zup, 3) - pow(zlow, 3)) / 3;
}
else {
Vol = areasT[id] * (zup - zlow);
}
//radius vector
r = (A + Altitude_d[lev]);
rx = r * func_r_d[id * 3 + 0];
ry = r * func_r_d[id * 3 + 1];
rz = r * func_r_d[id * 3 + 2];
//angular momentum r x p (total x and y over globe should ~ 0, z ~ const)
AMx = ry * Mh_d[id * 3 * nv + lev * 3 + 2] - rz * Mh_d[id * 3 * nv + lev * 3 + 1]
- Rho_d[id * nv + lev] * Omega * r * rz * cos(lonlat_d[id * 2 + 1])
* cos(lonlat_d[id * 2]);
AMy = -rx * Mh_d[id * 3 * nv + lev * 3 + 2] + rz * Mh_d[id * 3 * nv + lev * 3 + 0]
- Rho_d[id * nv + lev] * Omega * r * rz * cos(lonlat_d[id * 2 + 1])
* sin(lonlat_d[id * 2]);
AMz = rx * Mh_d[id * 3 * nv + lev * 3 + 1] - ry * Mh_d[id * 3 * nv + lev * 3 + 0]
+ Rho_d[id * nv + lev] * Omega * r * r * cos(lonlat_d[id * 2 + 1])
* cos(lonlat_d[id * 2 + 1]);
//AMx, AMy should go to zero when integrated over globe
// (but in practice, are just much smaller than AMz)
//total in control volume
AngMomx_d[id * nv + lev] = AMx * Vol;
AngMomy_d[id * nv + lev] = AMy * Vol;
AngMomz_d[id * nv + lev] = AMz * Vol;
}
} | #include <hip/hip_runtime.h>
#include "includes.h"
__global__ void CalcAngMom(double *AngMomx_d, double *AngMomy_d, double *AngMomz_d, double *GlobalAMx_d, double *GlobalAMy_d, double *GlobalAMz_d, double *Mh_d, double *Rho_d, double A, double Omega, double *Altitude_d, double *Altitudeh_d, double *lonlat_d, double *areasT, double *func_r_d, int num, bool DeepModel) {
int id = blockIdx.x * blockDim.x + threadIdx.x;
int nv = gridDim.y;
int lev = blockIdx.y;
if (id < num) {
double AMx, AMy, AMz;
double rx, ry, rz, r;
//calculate control volume
double zup, zlow, Vol;
zup = Altitudeh_d[lev + 1] + A;
zlow = Altitudeh_d[lev] + A;
if (DeepModel) {
Vol = areasT[id] / pow(A, 2) * (pow(zup, 3) - pow(zlow, 3)) / 3;
}
else {
Vol = areasT[id] * (zup - zlow);
}
//radius vector
r = (A + Altitude_d[lev]);
rx = r * func_r_d[id * 3 + 0];
ry = r * func_r_d[id * 3 + 1];
rz = r * func_r_d[id * 3 + 2];
//angular momentum r x p (total x and y over globe should ~ 0, z ~ const)
AMx = ry * Mh_d[id * 3 * nv + lev * 3 + 2] - rz * Mh_d[id * 3 * nv + lev * 3 + 1]
- Rho_d[id * nv + lev] * Omega * r * rz * cos(lonlat_d[id * 2 + 1])
* cos(lonlat_d[id * 2]);
AMy = -rx * Mh_d[id * 3 * nv + lev * 3 + 2] + rz * Mh_d[id * 3 * nv + lev * 3 + 0]
- Rho_d[id * nv + lev] * Omega * r * rz * cos(lonlat_d[id * 2 + 1])
* sin(lonlat_d[id * 2]);
AMz = rx * Mh_d[id * 3 * nv + lev * 3 + 1] - ry * Mh_d[id * 3 * nv + lev * 3 + 0]
+ Rho_d[id * nv + lev] * Omega * r * r * cos(lonlat_d[id * 2 + 1])
* cos(lonlat_d[id * 2 + 1]);
//AMx, AMy should go to zero when integrated over globe
// (but in practice, are just much smaller than AMz)
//total in control volume
AngMomx_d[id * nv + lev] = AMx * Vol;
AngMomy_d[id * nv + lev] = AMy * Vol;
AngMomz_d[id * nv + lev] = AMz * Vol;
}
} |
You are a helpful coding assistant specialized in converting HIP source code to AMD host assembly. | #include <hip/hip_runtime.h>
#include "includes.h"
__global__ void CalcAngMom(double *AngMomx_d, double *AngMomy_d, double *AngMomz_d, double *GlobalAMx_d, double *GlobalAMy_d, double *GlobalAMz_d, double *Mh_d, double *Rho_d, double A, double Omega, double *Altitude_d, double *Altitudeh_d, double *lonlat_d, double *areasT, double *func_r_d, int num, bool DeepModel) {
int id = blockIdx.x * blockDim.x + threadIdx.x;
int nv = gridDim.y;
int lev = blockIdx.y;
if (id < num) {
double AMx, AMy, AMz;
double rx, ry, rz, r;
//calculate control volume
double zup, zlow, Vol;
zup = Altitudeh_d[lev + 1] + A;
zlow = Altitudeh_d[lev] + A;
if (DeepModel) {
Vol = areasT[id] / pow(A, 2) * (pow(zup, 3) - pow(zlow, 3)) / 3;
}
else {
Vol = areasT[id] * (zup - zlow);
}
//radius vector
r = (A + Altitude_d[lev]);
rx = r * func_r_d[id * 3 + 0];
ry = r * func_r_d[id * 3 + 1];
rz = r * func_r_d[id * 3 + 2];
//angular momentum r x p (total x and y over globe should ~ 0, z ~ const)
AMx = ry * Mh_d[id * 3 * nv + lev * 3 + 2] - rz * Mh_d[id * 3 * nv + lev * 3 + 1]
- Rho_d[id * nv + lev] * Omega * r * rz * cos(lonlat_d[id * 2 + 1])
* cos(lonlat_d[id * 2]);
AMy = -rx * Mh_d[id * 3 * nv + lev * 3 + 2] + rz * Mh_d[id * 3 * nv + lev * 3 + 0]
- Rho_d[id * nv + lev] * Omega * r * rz * cos(lonlat_d[id * 2 + 1])
* sin(lonlat_d[id * 2]);
AMz = rx * Mh_d[id * 3 * nv + lev * 3 + 1] - ry * Mh_d[id * 3 * nv + lev * 3 + 0]
+ Rho_d[id * nv + lev] * Omega * r * r * cos(lonlat_d[id * 2 + 1])
* cos(lonlat_d[id * 2 + 1]);
//AMx, AMy should go to zero when integrated over globe
// (but in practice, are just much smaller than AMz)
//total in control volume
AngMomx_d[id * nv + lev] = AMx * Vol;
AngMomy_d[id * nv + lev] = AMy * Vol;
AngMomz_d[id * nv + lev] = AMz * Vol;
}
} | .text
.file "CalcAngMom.hip"
.globl _Z25__device_stub__CalcAngMomPdS_S_S_S_S_S_S_ddS_S_S_S_S_ib # -- Begin function _Z25__device_stub__CalcAngMomPdS_S_S_S_S_S_S_ddS_S_S_S_S_ib
.p2align 4, 0x90
.type _Z25__device_stub__CalcAngMomPdS_S_S_S_S_S_S_ddS_S_S_S_S_ib,@function
_Z25__device_stub__CalcAngMomPdS_S_S_S_S_S_S_ddS_S_S_S_S_ib: # @_Z25__device_stub__CalcAngMomPdS_S_S_S_S_S_S_ddS_S_S_S_S_ib
.cfi_startproc
# %bb.0:
subq $264, %rsp # imm = 0x108
.cfi_def_cfa_offset 272
movzbl 336(%rsp), %eax
movq %rdi, 120(%rsp)
movq %rsi, 112(%rsp)
movq %rdx, 104(%rsp)
movq %rcx, 96(%rsp)
movq %r8, 88(%rsp)
movq %r9, 80(%rsp)
movsd %xmm0, 72(%rsp)
movsd %xmm1, 64(%rsp)
movb %al, 15(%rsp)
leaq 120(%rsp), %rax
movq %rax, 128(%rsp)
leaq 112(%rsp), %rax
movq %rax, 136(%rsp)
leaq 104(%rsp), %rax
movq %rax, 144(%rsp)
leaq 96(%rsp), %rax
movq %rax, 152(%rsp)
leaq 88(%rsp), %rax
movq %rax, 160(%rsp)
leaq 80(%rsp), %rax
movq %rax, 168(%rsp)
leaq 272(%rsp), %rax
movq %rax, 176(%rsp)
leaq 280(%rsp), %rax
movq %rax, 184(%rsp)
leaq 72(%rsp), %rax
movq %rax, 192(%rsp)
leaq 64(%rsp), %rax
movq %rax, 200(%rsp)
leaq 288(%rsp), %rax
movq %rax, 208(%rsp)
leaq 296(%rsp), %rax
movq %rax, 216(%rsp)
leaq 304(%rsp), %rax
movq %rax, 224(%rsp)
leaq 312(%rsp), %rax
movq %rax, 232(%rsp)
leaq 320(%rsp), %rax
movq %rax, 240(%rsp)
leaq 328(%rsp), %rax
movq %rax, 248(%rsp)
leaq 15(%rsp), %rax
movq %rax, 256(%rsp)
leaq 48(%rsp), %rdi
leaq 32(%rsp), %rsi
leaq 24(%rsp), %rdx
leaq 16(%rsp), %rcx
callq __hipPopCallConfiguration
movq 48(%rsp), %rsi
movl 56(%rsp), %edx
movq 32(%rsp), %rcx
movl 40(%rsp), %r8d
leaq 128(%rsp), %r9
movl $_Z10CalcAngMomPdS_S_S_S_S_S_S_ddS_S_S_S_S_ib, %edi
pushq 16(%rsp)
.cfi_adjust_cfa_offset 8
pushq 32(%rsp)
.cfi_adjust_cfa_offset 8
callq hipLaunchKernel
addq $280, %rsp # imm = 0x118
.cfi_adjust_cfa_offset -280
retq
.Lfunc_end0:
.size _Z25__device_stub__CalcAngMomPdS_S_S_S_S_S_S_ddS_S_S_S_S_ib, .Lfunc_end0-_Z25__device_stub__CalcAngMomPdS_S_S_S_S_S_S_ddS_S_S_S_S_ib
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_ctor
.type __hip_module_ctor,@function
__hip_module_ctor: # @__hip_module_ctor
.cfi_startproc
# %bb.0:
subq $40, %rsp
.cfi_def_cfa_offset 48
cmpq $0, __hip_gpubin_handle(%rip)
jne .LBB1_2
# %bb.1:
movl $__hip_fatbin_wrapper, %edi
callq __hipRegisterFatBinary
movq %rax, __hip_gpubin_handle(%rip)
.LBB1_2:
movq __hip_gpubin_handle(%rip), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 16(%rsp)
movups %xmm0, (%rsp)
movl $_Z10CalcAngMomPdS_S_S_S_S_S_S_ddS_S_S_S_S_ib, %esi
movl $.L__unnamed_1, %edx
movl $.L__unnamed_1, %ecx
movl $-1, %r8d
xorl %r9d, %r9d
callq __hipRegisterFunction
movl $__hip_module_dtor, %edi
addq $40, %rsp
.cfi_def_cfa_offset 8
jmp atexit # TAILCALL
.Lfunc_end1:
.size __hip_module_ctor, .Lfunc_end1-__hip_module_ctor
.cfi_endproc
# -- End function
.p2align 4, 0x90 # -- Begin function __hip_module_dtor
.type __hip_module_dtor,@function
__hip_module_dtor: # @__hip_module_dtor
.cfi_startproc
# %bb.0:
movq __hip_gpubin_handle(%rip), %rdi
testq %rdi, %rdi
je .LBB2_2
# %bb.1:
pushq %rax
.cfi_def_cfa_offset 16
callq __hipUnregisterFatBinary
movq $0, __hip_gpubin_handle(%rip)
addq $8, %rsp
.cfi_def_cfa_offset 8
.LBB2_2:
retq
.Lfunc_end2:
.size __hip_module_dtor, .Lfunc_end2-__hip_module_dtor
.cfi_endproc
# -- End function
.type _Z10CalcAngMomPdS_S_S_S_S_S_S_ddS_S_S_S_S_ib,@object # @_Z10CalcAngMomPdS_S_S_S_S_S_S_ddS_S_S_S_S_ib
.section .rodata,"a",@progbits
.globl _Z10CalcAngMomPdS_S_S_S_S_S_S_ddS_S_S_S_S_ib
.p2align 3, 0x0
_Z10CalcAngMomPdS_S_S_S_S_S_S_ddS_S_S_S_S_ib:
.quad _Z25__device_stub__CalcAngMomPdS_S_S_S_S_S_S_ddS_S_S_S_S_ib
.size _Z10CalcAngMomPdS_S_S_S_S_S_S_ddS_S_S_S_S_ib, 8
.type .L__unnamed_1,@object # @0
.section .rodata.str1.1,"aMS",@progbits,1
.L__unnamed_1:
.asciz "_Z10CalcAngMomPdS_S_S_S_S_S_S_ddS_S_S_S_S_ib"
.size .L__unnamed_1, 45
.type __hip_fatbin_wrapper,@object # @__hip_fatbin_wrapper
.section .hipFatBinSegment,"a",@progbits
.p2align 3, 0x0
__hip_fatbin_wrapper:
.long 1212764230 # 0x48495046
.long 1 # 0x1
.quad __hip_fatbin
.quad 0
.size __hip_fatbin_wrapper, 24
.type __hip_gpubin_handle,@object # @__hip_gpubin_handle
.local __hip_gpubin_handle
.comm __hip_gpubin_handle,8,8
.section .init_array,"aw",@init_array
.p2align 3, 0x0
.quad __hip_module_ctor
.type __hip_cuid_,@object # @__hip_cuid_
.bss
.globl __hip_cuid_
__hip_cuid_:
.byte 0 # 0x0
.size __hip_cuid_, 1
.section ".linker-options","e",@llvm_linker_options
.ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
.section ".note.GNU-stack","",@progbits
.addrsig
.addrsig_sym _Z25__device_stub__CalcAngMomPdS_S_S_S_S_S_S_ddS_S_S_S_S_ib
.addrsig_sym __hip_module_ctor
.addrsig_sym __hip_module_dtor
.addrsig_sym _Z10CalcAngMomPdS_S_S_S_S_S_S_ddS_S_S_S_S_ib
.addrsig_sym __hip_fatbin
.addrsig_sym __hip_fatbin_wrapper
.addrsig_sym __hip_cuid_ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.