system
stringclasses
7 values
input
stringlengths
10
94.5k
output
stringlengths
14
55.5k
You are a helpful coding assistant specialized in converting from CUDA host assembly to AMD host assembly.
.file "tmpxft_001582e7_00000000-6_squareArray.cudafe1.cpp" .text #APP .globl _ZSt21ios_base_library_initv #NO_APP .type _ZL26__cudaUnregisterBinaryUtilv, @function _ZL26__cudaUnregisterBinaryUtilv: .LFB3674: .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 .LFE3674: .size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string ", line " .LC1: .string ": " .LC2: .string " (" .LC3: .string ")" .text .globl _Z10cuda_checkNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi .type _Z10cuda_checkNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi, @function _Z10cuda_checkNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi: .LFB3669: .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 movq %rdi, %rbp movl %esi, %r12d call cudaGetLastError@PLT testl %eax, %eax jne .L6 popq %rbx .cfi_remember_state .cfi_def_cfa_offset 24 popq %rbp .cfi_def_cfa_offset 16 popq %r12 .cfi_def_cfa_offset 8 ret .L6: .cfi_restore_state movl %eax, %ebx leaq _ZSt4cout(%rip), %rdi call _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT movq %rax, %rdi movq 8(%rbp), %rdx movq 0(%rbp), %rsi call _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT movq %rax, %rdi leaq .LC0(%rip), %rsi call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT movq %rax, %rdi movl %r12d, %esi call _ZNSolsEi@PLT movq %rax, %rdi leaq .LC1(%rip), %rsi call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT movq %rax, %rbp movl %ebx, %edi call cudaGetErrorString@PLT movq %rax, %rsi movq %rbp, %rdi call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT movq %rax, %rdi leaq .LC2(%rip), %rsi call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT movq %rax, %rdi movl %ebx, %esi call _ZNSolsEi@PLT movq %rax, %rdi leaq .LC3(%rip), %rsi call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT movq %rax, %rdi call _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT movl $1, %edi call exit@PLT .cfi_endproc .LFE3669: .size _Z10cuda_checkNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi, .-_Z10cuda_checkNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi .globl _Z12square_valuef .type _Z12square_valuef, @function _Z12square_valuef: .LFB3670: .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 .LFE3670: .size _Z12square_valuef, .-_Z12square_valuef .globl _Z33__device_stub__Z12square_arrayPfiPfi .type _Z33__device_stub__Z12square_arrayPfiPfi, @function _Z33__device_stub__Z12square_arrayPfiPfi: .LFB3696: .cfi_startproc endbr64 subq $120, %rsp .cfi_def_cfa_offset 128 movq %rdi, 8(%rsp) movl %esi, 4(%rsp) movq %fs:40, %rax movq %rax, 104(%rsp) xorl %eax, %eax leaq 8(%rsp), %rax movq %rax, 80(%rsp) leaq 4(%rsp), %rax movq %rax, 88(%rsp) movl $1, 32(%rsp) movl $1, 36(%rsp) movl $1, 40(%rsp) movl $1, 44(%rsp) movl $1, 48(%rsp) movl $1, 52(%rsp) leaq 24(%rsp), %rcx leaq 16(%rsp), %rdx leaq 44(%rsp), %rsi leaq 32(%rsp), %rdi call __cudaPopCallConfiguration@PLT testl %eax, %eax je .L13 .L9: movq 104(%rsp), %rax subq %fs:40, %rax jne .L14 addq $120, %rsp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L13: .cfi_restore_state pushq 24(%rsp) .cfi_def_cfa_offset 136 pushq 24(%rsp) .cfi_def_cfa_offset 144 leaq 96(%rsp), %r9 movq 60(%rsp), %rcx movl 68(%rsp), %r8d movq 48(%rsp), %rsi movl 56(%rsp), %edx leaq _Z12square_arrayPfi(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 128 jmp .L9 .L14: call __stack_chk_fail@PLT .cfi_endproc .LFE3696: .size _Z33__device_stub__Z12square_arrayPfiPfi, .-_Z33__device_stub__Z12square_arrayPfiPfi .globl _Z12square_arrayPfi .type _Z12square_arrayPfi, @function _Z12square_arrayPfi: .LFB3697: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z33__device_stub__Z12square_arrayPfiPfi addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE3697: .size _Z12square_arrayPfi, .-_Z12square_arrayPfi .section .rodata.str1.1 .LC4: .string "_Z12square_arrayPfi" .text .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB3699: .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 _Z12square_arrayPfi(%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 .LFE3699: .size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv .section .init_array,"aw" .align 8 .quad _ZL24__sti____cudaRegisterAllv .section .rodata._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_.str1.8,"aMS",@progbits,1 .align 8 .LC5: .string "basic_string: construction from null is not valid" .section .text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC5IS3_EEPKcRKS3_,comdat .align 2 .weak _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_ .type _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_, @function _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_: .LFB4006: .cfi_startproc endbr64 pushq %r13 .cfi_def_cfa_offset 16 .cfi_offset 13, -16 pushq %r12 .cfi_def_cfa_offset 24 .cfi_offset 12, -24 pushq %rbp .cfi_def_cfa_offset 32 .cfi_offset 6, -32 pushq %rbx .cfi_def_cfa_offset 40 .cfi_offset 3, -40 subq $24, %rsp .cfi_def_cfa_offset 64 movq %fs:40, %rax movq %rax, 8(%rsp) xorl %eax, %eax leaq 16(%rdi), %r12 movq %r12, (%rdi) testq %rsi, %rsi je .L28 movq %rdi, %rbx movq %rsi, %r13 movq %rsi, %rdi call strlen@PLT movq %rax, %rbp movq %rax, (%rsp) cmpq $15, %rax ja .L29 cmpq $1, %rax jne .L24 movzbl 0(%r13), %eax movb %al, 16(%rbx) .L25: movq (%rsp), %rax movq %rax, 8(%rbx) movq (%rbx), %rdx movb $0, (%rdx,%rax) movq 8(%rsp), %rax subq %fs:40, %rax jne .L30 addq $24, %rsp .cfi_remember_state .cfi_def_cfa_offset 40 popq %rbx .cfi_def_cfa_offset 32 popq %rbp .cfi_def_cfa_offset 24 popq %r12 .cfi_def_cfa_offset 16 popq %r13 .cfi_def_cfa_offset 8 ret .L28: .cfi_restore_state movq 8(%rsp), %rax subq %fs:40, %rax jne .L31 leaq .LC5(%rip), %rdi call _ZSt19__throw_logic_errorPKc@PLT .L31: call __stack_chk_fail@PLT .L29: movq %rsp, %rsi movl $0, %edx movq %rbx, %rdi call _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm@PLT movq %rax, %r12 movq %rax, (%rbx) movq (%rsp), %rax movq %rax, 16(%rbx) .L23: movq %rbp, %rdx movq %r13, %rsi movq %r12, %rdi call memcpy@PLT jmp .L25 .L24: testq %rax, %rax je .L25 jmp .L23 .L30: call __stack_chk_fail@PLT .cfi_endproc .LFE4006: .size _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_, .-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_ .weak _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_ .set _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_ .section .rodata.str1.1 .LC6: .string "CPU:" .section .rodata.str1.8,"aMS",@progbits,1 .align 8 .LC7: .string "/home/ubuntu/Datasets/stackv2/train-structured/gaow0007/gpu-programming/master/02_basic_kernels/squareArray.cu" .section .rodata.str1.1 .LC8: .string "GPU:" .text .globl main .type main, @function main: .LFB3671: .cfi_startproc .cfi_personality 0x9b,DW.ref.__gxx_personality_v0 .cfi_lsda 0x1b,.LLSDA3671 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 movq %fs:40, %rax movq %rax, 88(%rsp) xorl %eax, %eax movl $40, %edi .LEHB0: call _Znam@PLT movq %rax, %rbp movl $0, %eax .L33: pxor %xmm0, %xmm0 cvtsi2ssl %eax, %xmm0 movss %xmm0, 0(%rbp,%rax,4) addq $1, %rax cmpq $10, %rax jne .L33 movq %rbp, %rax leaq 40(%rbp), %rdx .L34: movss (%rax), %xmm0 mulss %xmm0, %xmm0 movss %xmm0, (%rax) addq $4, %rax cmpq %rax, %rdx jne .L34 leaq .LC6(%rip), %rsi leaq _ZSt4cout(%rip), %rdi call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT movq %rax, %rdi call _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT movl $0, %r12d leaq _ZSt4cout(%rip), %r14 leaq .LC1(%rip), %r13 jmp .L39 .L69: movq 88(%rsp), %rax subq %fs:40, %rax jne .L67 call _ZSt16__throw_bad_castv@PLT .L67: call __stack_chk_fail@PLT .L37: movq %r15, %rdi call _ZNKSt5ctypeIcE13_M_widen_initEv@PLT movq (%r15), %rax movl $10, %esi movq %r15, %rdi call *48(%rax) movl %eax, %esi .L38: movsbl %sil, %esi movq %rbx, %rdi call _ZNSo3putEc@PLT movq %rax, %rdi call _ZNSo5flushEv@PLT addq $1, %r12 cmpq $10, %r12 je .L68 .L39: movl %r12d, %esi movq %r14, %rdi call _ZNSolsEi@PLT movq %rax, %rbx movl $2, %edx movq %r13, %rsi movq %rax, %rdi call _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT pxor %xmm0, %xmm0 cvtss2sd 0(%rbp,%r12,4), %xmm0 movq %rbx, %rdi call _ZNSo9_M_insertIdEERSoT_@PLT movq %rax, %rbx movq (%rax), %rax movq -24(%rax), %rax movq 240(%rbx,%rax), %r15 testq %r15, %r15 je .L69 cmpb $0, 56(%r15) je .L37 movzbl 67(%r15), %esi jmp .L38 .L68: leaq _ZSt4cout(%rip), %rdi call _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT movl $0, %eax .L40: pxor %xmm0, %xmm0 cvtsi2ssl %eax, %xmm0 movss %xmm0, 0(%rbp,%rax,4) addq $1, %rax cmpq $10, %rax jne .L40 movq $0, 16(%rsp) leaq 16(%rsp), %rdi movl $40, %esi call cudaMalloc@PLT leaq 36(%rsp), %rdx leaq 48(%rsp), %rbx leaq .LC7(%rip), %rsi movq %rbx, %rdi call _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_ .LEHE0: movl $92, %esi movq %rbx, %rdi .LEHB1: call _Z10cuda_checkNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi .LEHE1: movq %rbx, %rdi call _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT movl $1, %ecx movl $40, %edx movq %rbp, %rsi movq 16(%rsp), %rdi .LEHB2: call cudaMemcpy@PLT leaq 36(%rsp), %rdx leaq .LC7(%rip), %rsi movq %rbx, %rdi call _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_ .LEHE2: movl $95, %esi movq %rbx, %rdi .LEHB3: call _Z10cuda_checkNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi .LEHE3: movq %rbx, %rdi call _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT movl $1, 28(%rsp) movl $1, 32(%rsp) movl $5, 36(%rsp) movl $1, 40(%rsp) movl $1, 44(%rsp) movl $2, 24(%rsp) movl $0, %r9d movl $0, %r8d movq 24(%rsp), %rdx movl $1, %ecx movq 36(%rsp), %rdi movl $1, %esi .LEHB4: call __cudaPushCallConfiguration@PLT testl %eax, %eax je .L70 .L41: movl $2, %ecx movl $40, %edx movq 16(%rsp), %rsi movq %rbp, %rdi call cudaMemcpy@PLT leaq 15(%rsp), %rdx leaq 48(%rsp), %rbx leaq .LC7(%rip), %rsi movq %rbx, %rdi call _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_ .LEHE4: movl $106, %esi movq %rbx, %rdi .LEHB5: call _Z10cuda_checkNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi .LEHE5: jmp .L71 .L70: movl $10, %esi movq 16(%rsp), %rdi .LEHB6: call _Z33__device_stub__Z12square_arrayPfiPfi jmp .L41 .L71: movq %rbx, %rdi call _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT movq 16(%rsp), %rdi call cudaFree@PLT leaq 15(%rsp), %rdx leaq .LC7(%rip), %rsi movq %rbx, %rdi call _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_ .LEHE6: movl $109, %esi movq %rbx, %rdi .LEHB7: call _Z10cuda_checkNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi .LEHE7: movq %rbx, %rdi call _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT leaq .LC8(%rip), %rsi leaq _ZSt4cout(%rip), %rdi .LEHB8: call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT movq %rax, %rdi call _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT movl $0, %r12d leaq _ZSt4cout(%rip), %r14 leaq .LC1(%rip), %r13 jmp .L46 .L74: movq 88(%rsp), %rax subq %fs:40, %rax jne .L72 call _ZSt16__throw_bad_castv@PLT .L72: call __stack_chk_fail@PLT .L44: movq %r15, %rdi call _ZNKSt5ctypeIcE13_M_widen_initEv@PLT movq (%r15), %rax movl $10, %esi movq %r15, %rdi call *48(%rax) movl %eax, %esi .L45: movsbl %sil, %esi movq %rbx, %rdi call _ZNSo3putEc@PLT movq %rax, %rdi call _ZNSo5flushEv@PLT addq $1, %r12 cmpq $10, %r12 je .L73 .L46: movl %r12d, %esi movq %r14, %rdi call _ZNSolsEi@PLT movq %rax, %rbx movl $2, %edx movq %r13, %rsi movq %rax, %rdi call _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT pxor %xmm0, %xmm0 cvtss2sd 0(%rbp,%r12,4), %xmm0 movq %rbx, %rdi call _ZNSo9_M_insertIdEERSoT_@PLT movq %rax, %rbx movq (%rax), %rax movq -24(%rax), %rax movq 240(%rbx,%rax), %r15 testq %r15, %r15 je .L74 cmpb $0, 56(%r15) je .L44 movzbl 67(%r15), %esi jmp .L45 .L73: leaq _ZSt4cout(%rip), %rdi call _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT movq %rbp, %rdi call _ZdaPv@PLT movq 88(%rsp), %rax subq %fs:40, %rax jne .L75 movl $0, %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 .L56: .cfi_restore_state endbr64 movq %rax, %rbx leaq 48(%rsp), %rdi call _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT movq 88(%rsp), %rax subq %fs:40, %rax je .L48 call __stack_chk_fail@PLT .L48: movq %rbx, %rdi call _Unwind_Resume@PLT .L57: endbr64 movq %rax, %rbx leaq 48(%rsp), %rdi call _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT movq 88(%rsp), %rax subq %fs:40, %rax je .L50 call __stack_chk_fail@PLT .L50: movq %rbx, %rdi call _Unwind_Resume@PLT .L58: endbr64 movq %rax, %rbx leaq 48(%rsp), %rdi call _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT movq 88(%rsp), %rax subq %fs:40, %rax je .L52 call __stack_chk_fail@PLT .L52: movq %rbx, %rdi call _Unwind_Resume@PLT .L59: endbr64 movq %rax, %rbx leaq 48(%rsp), %rdi call _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT movq 88(%rsp), %rax subq %fs:40, %rax je .L54 call __stack_chk_fail@PLT .L54: movq %rbx, %rdi call _Unwind_Resume@PLT .LEHE8: .L75: call __stack_chk_fail@PLT .cfi_endproc .LFE3671: .globl __gxx_personality_v0 .section .gcc_except_table,"a",@progbits .LLSDA3671: .byte 0xff .byte 0xff .byte 0x1 .uleb128 .LLSDACSE3671-.LLSDACSB3671 .LLSDACSB3671: .uleb128 .LEHB0-.LFB3671 .uleb128 .LEHE0-.LEHB0 .uleb128 0 .uleb128 0 .uleb128 .LEHB1-.LFB3671 .uleb128 .LEHE1-.LEHB1 .uleb128 .L56-.LFB3671 .uleb128 0 .uleb128 .LEHB2-.LFB3671 .uleb128 .LEHE2-.LEHB2 .uleb128 0 .uleb128 0 .uleb128 .LEHB3-.LFB3671 .uleb128 .LEHE3-.LEHB3 .uleb128 .L57-.LFB3671 .uleb128 0 .uleb128 .LEHB4-.LFB3671 .uleb128 .LEHE4-.LEHB4 .uleb128 0 .uleb128 0 .uleb128 .LEHB5-.LFB3671 .uleb128 .LEHE5-.LEHB5 .uleb128 .L58-.LFB3671 .uleb128 0 .uleb128 .LEHB6-.LFB3671 .uleb128 .LEHE6-.LEHB6 .uleb128 0 .uleb128 0 .uleb128 .LEHB7-.LFB3671 .uleb128 .LEHE7-.LEHB7 .uleb128 .L59-.LFB3671 .uleb128 0 .uleb128 .LEHB8-.LFB3671 .uleb128 .LEHE8-.LEHB8 .uleb128 0 .uleb128 0 .LLSDACSE3671: .text .size main, .-main .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 .hidden DW.ref.__gxx_personality_v0 .weak DW.ref.__gxx_personality_v0 .section .data.rel.local.DW.ref.__gxx_personality_v0,"awG",@progbits,DW.ref.__gxx_personality_v0,comdat .align 8 .type DW.ref.__gxx_personality_v0, @object .size DW.ref.__gxx_personality_v0, 8 DW.ref.__gxx_personality_v0: .quad __gxx_personality_v0 .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 "squareArray.hip" # Start of file scope inline assembly .globl _ZSt21ios_base_library_initv # End of file scope inline assembly .globl _Z10cuda_checkNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi # -- Begin function _Z10cuda_checkNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi .p2align 4, 0x90 .type _Z10cuda_checkNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi,@function _Z10cuda_checkNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi: # @_Z10cuda_checkNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi .cfi_startproc # %bb.0: pushq %rbp .cfi_def_cfa_offset 16 pushq %r14 .cfi_def_cfa_offset 24 pushq %rbx .cfi_def_cfa_offset 32 .cfi_offset %rbx, -32 .cfi_offset %r14, -24 .cfi_offset %rbp, -16 movl %esi, %ebp movq %rdi, %r14 callq hipGetLastError testl %eax, %eax jne .LBB0_2 # %bb.1: popq %rbx .cfi_def_cfa_offset 24 popq %r14 .cfi_def_cfa_offset 16 popq %rbp .cfi_def_cfa_offset 8 retq .LBB0_2: .cfi_def_cfa_offset 32 movl $_ZSt4cout, %edi movl %eax, %ebx callq _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_ movq %rax, %rdi movq %r14, %rsi callq _ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE movl $.L.str, %esi movq %rax, %rdi callq _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc movq %rax, %rdi movl %ebp, %esi callq _ZNSolsEi movl $.L.str.1, %esi movq %rax, %rdi callq _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc movq %rax, %r14 movl %ebx, %edi callq hipGetErrorString movq %r14, %rdi movq %rax, %rsi callq _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc movl $.L.str.2, %esi movq %rax, %rdi callq _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc movq %rax, %rdi movl %ebx, %esi callq _ZNSolsEi movl $.L.str.3, %esi movq %rax, %rdi callq _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc movq %rax, %rdi callq _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_ movl $1, %edi callq exit .Lfunc_end0: .size _Z10cuda_checkNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi, .Lfunc_end0-_Z10cuda_checkNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi .cfi_endproc # -- End function .globl _Z27__device_stub__square_arrayPfi # -- Begin function _Z27__device_stub__square_arrayPfi .p2align 4, 0x90 .type _Z27__device_stub__square_arrayPfi,@function _Z27__device_stub__square_arrayPfi: # @_Z27__device_stub__square_arrayPfi .cfi_startproc # %bb.0: subq $88, %rsp .cfi_def_cfa_offset 96 movq %rdi, 56(%rsp) movl %esi, 4(%rsp) leaq 56(%rsp), %rax movq %rax, 64(%rsp) leaq 4(%rsp), %rax movq %rax, 72(%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 64(%rsp), %r9 movl $_Z12square_arrayPfi, %edi pushq 8(%rsp) .cfi_adjust_cfa_offset 8 pushq 24(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $104, %rsp .cfi_adjust_cfa_offset -104 retq .Lfunc_end1: .size _Z27__device_stub__square_arrayPfi, .Lfunc_end1-_Z27__device_stub__square_arrayPfi .cfi_endproc # -- End function .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .Lfunc_begin0: .cfi_startproc .cfi_personality 3, __gxx_personality_v0 .cfi_lsda 3, .Lexception0 # %bb.0: pushq %r15 .cfi_def_cfa_offset 16 pushq %r14 .cfi_def_cfa_offset 24 pushq %r12 .cfi_def_cfa_offset 32 pushq %rbx .cfi_def_cfa_offset 40 subq $232, %rsp .cfi_def_cfa_offset 272 .cfi_offset %rbx, -40 .cfi_offset %r12, -32 .cfi_offset %r14, -24 .cfi_offset %r15, -16 .cfi_escape 0x2e, 0x00 movl $40, %edi callq _Znam movq %rax, %rbx xorl %eax, %eax .p2align 4, 0x90 .LBB2_1: # =>This Inner Loop Header: Depth=1 xorps %xmm0, %xmm0 cvtsi2ss %eax, %xmm0 movss %xmm0, (%rbx,%rax,4) incq %rax cmpq $10, %rax jne .LBB2_1 # %bb.2: # %.preheader.preheader xorl %eax, %eax .p2align 4, 0x90 .LBB2_3: # %.preheader # =>This Inner Loop Header: Depth=1 movss (%rbx,%rax,4), %xmm0 # xmm0 = mem[0],zero,zero,zero mulss %xmm0, %xmm0 movss %xmm0, (%rbx,%rax,4) incq %rax cmpq $10, %rax jne .LBB2_3 # %bb.4: .cfi_escape 0x2e, 0x00 movl $_ZSt4cout, %edi movl $.L.str.4, %esi movl $4, %edx callq _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l movq _ZSt4cout(%rip), %rax movq -24(%rax), %rax movq _ZSt4cout+240(%rax), %r14 testq %r14, %r14 je .LBB2_62 # %bb.5: # %_ZSt13__check_facetISt5ctypeIcEERKT_PS3_.exit.i.i cmpb $0, 56(%r14) je .LBB2_7 # %bb.6: movzbl 67(%r14), %eax jmp .LBB2_8 .LBB2_7: .cfi_escape 0x2e, 0x00 movq %r14, %rdi callq _ZNKSt5ctypeIcE13_M_widen_initEv movq (%r14), %rax .cfi_escape 0x2e, 0x00 movq %r14, %rdi movl $10, %esi callq *48(%rax) .LBB2_8: # %_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_.exit .cfi_escape 0x2e, 0x00 movsbl %al, %esi movl $_ZSt4cout, %edi callq _ZNSo3putEc .cfi_escape 0x2e, 0x00 movq %rax, %rdi callq _ZNSo5flushEv xorl %r14d, %r14d jmp .LBB2_9 .p2align 4, 0x90 .LBB2_35: # in Loop: Header=BB2_9 Depth=1 .cfi_escape 0x2e, 0x00 movq %r15, %rdi movq %rax, %r12 callq _ZNKSt5ctypeIcE13_M_widen_initEv movq (%r15), %rax .cfi_escape 0x2e, 0x00 movq %r15, %rdi movl $10, %esi callq *48(%rax) movl %eax, %ecx movq %r12, %rax .LBB2_36: # %_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_.exit125 # in Loop: Header=BB2_9 Depth=1 .cfi_escape 0x2e, 0x00 movsbl %cl, %esi movq %rax, %rdi callq _ZNSo3putEc .cfi_escape 0x2e, 0x00 movq %rax, %rdi callq _ZNSo5flushEv incq %r14 cmpq $10, %r14 je .LBB2_11 .LBB2_9: # =>This Inner Loop Header: Depth=1 .cfi_escape 0x2e, 0x00 movl $_ZSt4cout, %edi movl %r14d, %esi callq _ZNSolsEi movq %rax, %r15 .cfi_escape 0x2e, 0x00 movl $.L.str.1, %esi movl $2, %edx movq %rax, %rdi callq _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l movss (%rbx,%r14,4), %xmm0 # xmm0 = mem[0],zero,zero,zero cvtss2sd %xmm0, %xmm0 .cfi_escape 0x2e, 0x00 movq %r15, %rdi callq _ZNSo9_M_insertIdEERSoT_ movq (%rax), %rcx movq -24(%rcx), %rcx movq 240(%rax,%rcx), %r15 testq %r15, %r15 je .LBB2_10 # %bb.33: # %_ZSt13__check_facetISt5ctypeIcEERKT_PS3_.exit.i.i122 # in Loop: Header=BB2_9 Depth=1 cmpb $0, 56(%r15) je .LBB2_35 # %bb.34: # in Loop: Header=BB2_9 Depth=1 movzbl 67(%r15), %ecx jmp .LBB2_36 .LBB2_11: movq _ZSt4cout(%rip), %rax movq -24(%rax), %rax movq _ZSt4cout+240(%rax), %r14 testq %r14, %r14 je .LBB2_63 # %bb.12: # %_ZSt13__check_facetISt5ctypeIcEERKT_PS3_.exit.i.i117 cmpb $0, 56(%r14) je .LBB2_14 # %bb.13: movzbl 67(%r14), %eax jmp .LBB2_15 .LBB2_14: .cfi_escape 0x2e, 0x00 movq %r14, %rdi callq _ZNKSt5ctypeIcE13_M_widen_initEv movq (%r14), %rax .cfi_escape 0x2e, 0x00 movq %r14, %rdi movl $10, %esi callq *48(%rax) .LBB2_15: # %_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_.exit120 .cfi_escape 0x2e, 0x00 movsbl %al, %esi movl $_ZSt4cout, %edi callq _ZNSo3putEc .cfi_escape 0x2e, 0x00 movq %rax, %rdi callq _ZNSo5flushEv xorl %eax, %eax .p2align 4, 0x90 .LBB2_16: # =>This Inner Loop Header: Depth=1 xorps %xmm0, %xmm0 cvtsi2ss %eax, %xmm0 movss %xmm0, (%rbx,%rax,4) incq %rax cmpq $10, %rax jne .LBB2_16 # %bb.17: # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm.exit.i.i movq $0, 8(%rsp) .cfi_escape 0x2e, 0x00 leaq 8(%rsp), %rdi movl $40, %esi callq hipMalloc leaq 136(%rsp), %r14 movq %r14, 120(%rsp) .cfi_escape 0x2e, 0x00 movl $122, %edi callq _Znwm movq %rax, 120(%rsp) movq $121, 136(%rsp) movups .L.str.5(%rip), %xmm0 movups %xmm0, (%rax) movups .L.str.5+16(%rip), %xmm0 movups %xmm0, 16(%rax) movups .L.str.5+32(%rip), %xmm0 movups %xmm0, 32(%rax) movups .L.str.5+48(%rip), %xmm0 movups %xmm0, 48(%rax) movups .L.str.5+64(%rip), %xmm0 movups %xmm0, 64(%rax) movups .L.str.5+80(%rip), %xmm0 movups %xmm0, 80(%rax) movups .L.str.5+96(%rip), %xmm0 movups %xmm0, 96(%rax) movups .L.str.5+105(%rip), %xmm0 movups %xmm0, 105(%rax) movq $121, 128(%rsp) movb $0, 121(%rax) .Ltmp0: .cfi_escape 0x2e, 0x00 leaq 120(%rsp), %rdi movl $92, %esi callq _Z10cuda_checkNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi .Ltmp1: # %bb.18: movq 120(%rsp), %rdi cmpq %r14, %rdi je .LBB2_20 # %bb.19: # %.critedge.i.i .cfi_escape 0x2e, 0x00 callq _ZdlPv .LBB2_20: # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit movq 8(%rsp), %rdi .cfi_escape 0x2e, 0x00 movl $40, %edx movq %rbx, %rsi movl $1, %ecx callq hipMemcpy leaq 104(%rsp), %r14 movq %r14, 88(%rsp) .cfi_escape 0x2e, 0x00 movl $122, %edi callq _Znwm movq %rax, 88(%rsp) movq $121, 104(%rsp) movups .L.str.5(%rip), %xmm0 movups %xmm0, (%rax) movups .L.str.5+16(%rip), %xmm0 movups %xmm0, 16(%rax) movups .L.str.5+32(%rip), %xmm0 movups %xmm0, 32(%rax) movups .L.str.5+48(%rip), %xmm0 movups %xmm0, 48(%rax) movups .L.str.5+64(%rip), %xmm0 movups %xmm0, 64(%rax) movups .L.str.5+80(%rip), %xmm0 movups %xmm0, 80(%rax) movups .L.str.5+96(%rip), %xmm0 movups %xmm0, 96(%rax) movups .L.str.5+105(%rip), %xmm0 movups %xmm0, 105(%rax) movq $121, 96(%rsp) movb $0, 121(%rax) .Ltmp3: .cfi_escape 0x2e, 0x00 leaq 88(%rsp), %rdi movl $95, %esi callq _Z10cuda_checkNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi .Ltmp4: # %bb.21: movq 88(%rsp), %rdi cmpq %r14, %rdi je .LBB2_23 # %bb.22: # %.critedge.i.i81 .cfi_escape 0x2e, 0x00 callq _ZdlPv .LBB2_23: # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit83 movabsq $4294967298, %rdx # imm = 0x100000002 leaq 3(%rdx), %rdi .cfi_escape 0x2e, 0x00 movl $1, %esi movl $1, %ecx xorl %r8d, %r8d xorl %r9d, %r9d callq __hipPushCallConfiguration testl %eax, %eax jne .LBB2_25 # %bb.24: movq 8(%rsp), %rax movq %rax, 200(%rsp) movl $10, 20(%rsp) leaq 200(%rsp), %rax movq %rax, 208(%rsp) leaq 20(%rsp), %rax movq %rax, 216(%rsp) .cfi_escape 0x2e, 0x00 leaq 184(%rsp), %rdi leaq 168(%rsp), %rsi leaq 160(%rsp), %rdx leaq 152(%rsp), %rcx callq __hipPopCallConfiguration movq 184(%rsp), %rsi movl 192(%rsp), %edx movq 168(%rsp), %rcx movl 176(%rsp), %r8d .cfi_escape 0x2e, 0x10 leaq 208(%rsp), %r9 movl $_Z12square_arrayPfi, %edi pushq 152(%rsp) .cfi_adjust_cfa_offset 8 pushq 168(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $16, %rsp .cfi_adjust_cfa_offset -16 .LBB2_25: # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm.exit.i.i90 movq 8(%rsp), %rsi .cfi_escape 0x2e, 0x00 movl $40, %edx movq %rbx, %rdi movl $2, %ecx callq hipMemcpy leaq 72(%rsp), %r14 movq %r14, 56(%rsp) .cfi_escape 0x2e, 0x00 movl $122, %edi callq _Znwm movq %rax, 56(%rsp) movq $121, 72(%rsp) movups .L.str.5(%rip), %xmm0 movups %xmm0, (%rax) movups .L.str.5+16(%rip), %xmm0 movups %xmm0, 16(%rax) movups .L.str.5+32(%rip), %xmm0 movups %xmm0, 32(%rax) movups .L.str.5+48(%rip), %xmm0 movups %xmm0, 48(%rax) movups .L.str.5+64(%rip), %xmm0 movups %xmm0, 64(%rax) movups .L.str.5+80(%rip), %xmm0 movups %xmm0, 80(%rax) movups .L.str.5+96(%rip), %xmm0 movups %xmm0, 96(%rax) movups .L.str.5+105(%rip), %xmm0 movups %xmm0, 105(%rax) movq $121, 64(%rsp) movb $0, 121(%rax) .Ltmp6: .cfi_escape 0x2e, 0x00 leaq 56(%rsp), %rdi movl $106, %esi callq _Z10cuda_checkNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi .Ltmp7: # %bb.26: movq 56(%rsp), %rdi cmpq %r14, %rdi je .LBB2_28 # %bb.27: # %.critedge.i.i97 .cfi_escape 0x2e, 0x00 callq _ZdlPv .LBB2_28: # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit99 movq 8(%rsp), %rdi .cfi_escape 0x2e, 0x00 callq hipFree leaq 40(%rsp), %r14 movq %r14, 24(%rsp) .cfi_escape 0x2e, 0x00 movl $122, %edi callq _Znwm movq %rax, 24(%rsp) movq $121, 40(%rsp) movups .L.str.5(%rip), %xmm0 movups %xmm0, (%rax) movups .L.str.5+16(%rip), %xmm0 movups %xmm0, 16(%rax) movups .L.str.5+32(%rip), %xmm0 movups %xmm0, 32(%rax) movups .L.str.5+48(%rip), %xmm0 movups %xmm0, 48(%rax) movups .L.str.5+64(%rip), %xmm0 movups %xmm0, 64(%rax) movups .L.str.5+80(%rip), %xmm0 movups %xmm0, 80(%rax) movups .L.str.5+96(%rip), %xmm0 movups %xmm0, 96(%rax) movups .L.str.5+105(%rip), %xmm0 movups %xmm0, 105(%rax) movq $121, 32(%rsp) movb $0, 121(%rax) .Ltmp9: .cfi_escape 0x2e, 0x00 leaq 24(%rsp), %rdi movl $109, %esi callq _Z10cuda_checkNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi .Ltmp10: # %bb.29: movq 24(%rsp), %rdi cmpq %r14, %rdi je .LBB2_31 # %bb.30: # %.critedge.i.i107 .cfi_escape 0x2e, 0x00 callq _ZdlPv .LBB2_31: # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit109 .cfi_escape 0x2e, 0x00 movl $_ZSt4cout, %edi movl $.L.str.6, %esi movl $4, %edx callq _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l movq _ZSt4cout(%rip), %rax movq -24(%rax), %rax movq _ZSt4cout+240(%rax), %r14 testq %r14, %r14 je .LBB2_32 # %bb.43: # %_ZSt13__check_facetISt5ctypeIcEERKT_PS3_.exit.i.i127 cmpb $0, 56(%r14) je .LBB2_45 # %bb.44: movzbl 67(%r14), %eax jmp .LBB2_46 .LBB2_45: .cfi_escape 0x2e, 0x00 movq %r14, %rdi callq _ZNKSt5ctypeIcE13_M_widen_initEv movq (%r14), %rax .cfi_escape 0x2e, 0x00 movq %r14, %rdi movl $10, %esi callq *48(%rax) .LBB2_46: # %_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_.exit130 .cfi_escape 0x2e, 0x00 movsbl %al, %esi movl $_ZSt4cout, %edi callq _ZNSo3putEc .cfi_escape 0x2e, 0x00 movq %rax, %rdi callq _ZNSo5flushEv xorl %r14d, %r14d jmp .LBB2_47 .p2align 4, 0x90 .LBB2_60: # in Loop: Header=BB2_47 Depth=1 .cfi_escape 0x2e, 0x00 movq %r15, %rdi movq %rax, %r12 callq _ZNKSt5ctypeIcE13_M_widen_initEv movq (%r15), %rax .cfi_escape 0x2e, 0x00 movq %r15, %rdi movl $10, %esi callq *48(%rax) movl %eax, %ecx movq %r12, %rax .LBB2_61: # %_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_.exit140 # in Loop: Header=BB2_47 Depth=1 .cfi_escape 0x2e, 0x00 movsbl %cl, %esi movq %rax, %rdi callq _ZNSo3putEc .cfi_escape 0x2e, 0x00 movq %rax, %rdi callq _ZNSo5flushEv incq %r14 cmpq $10, %r14 je .LBB2_49 .LBB2_47: # =>This Inner Loop Header: Depth=1 .cfi_escape 0x2e, 0x00 movl $_ZSt4cout, %edi movl %r14d, %esi callq _ZNSolsEi movq %rax, %r15 .cfi_escape 0x2e, 0x00 movl $.L.str.1, %esi movl $2, %edx movq %rax, %rdi callq _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l movss (%rbx,%r14,4), %xmm0 # xmm0 = mem[0],zero,zero,zero cvtss2sd %xmm0, %xmm0 .cfi_escape 0x2e, 0x00 movq %r15, %rdi callq _ZNSo9_M_insertIdEERSoT_ movq (%rax), %rcx movq -24(%rcx), %rcx movq 240(%rax,%rcx), %r15 testq %r15, %r15 je .LBB2_48 # %bb.58: # %_ZSt13__check_facetISt5ctypeIcEERKT_PS3_.exit.i.i137 # in Loop: Header=BB2_47 Depth=1 cmpb $0, 56(%r15) je .LBB2_60 # %bb.59: # in Loop: Header=BB2_47 Depth=1 movzbl 67(%r15), %ecx jmp .LBB2_61 .LBB2_49: movq _ZSt4cout(%rip), %rax movq -24(%rax), %rax movq _ZSt4cout+240(%rax), %r14 testq %r14, %r14 je .LBB2_64 # %bb.50: # %_ZSt13__check_facetISt5ctypeIcEERKT_PS3_.exit.i.i132 cmpb $0, 56(%r14) je .LBB2_52 # %bb.51: movzbl 67(%r14), %eax jmp .LBB2_53 .LBB2_52: .cfi_escape 0x2e, 0x00 movq %r14, %rdi callq _ZNKSt5ctypeIcE13_M_widen_initEv movq (%r14), %rax .cfi_escape 0x2e, 0x00 movq %r14, %rdi movl $10, %esi callq *48(%rax) .LBB2_53: # %_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_.exit135 .cfi_escape 0x2e, 0x00 movsbl %al, %esi movl $_ZSt4cout, %edi callq _ZNSo3putEc .cfi_escape 0x2e, 0x00 movq %rax, %rdi callq _ZNSo5flushEv .cfi_escape 0x2e, 0x00 movq %rbx, %rdi callq _ZdaPv xorl %eax, %eax addq $232, %rsp .cfi_def_cfa_offset 40 popq %rbx .cfi_def_cfa_offset 32 popq %r12 .cfi_def_cfa_offset 24 popq %r14 .cfi_def_cfa_offset 16 popq %r15 .cfi_def_cfa_offset 8 retq .LBB2_10: .cfi_def_cfa_offset 272 .cfi_escape 0x2e, 0x00 callq _ZSt16__throw_bad_castv .LBB2_48: .cfi_escape 0x2e, 0x00 callq _ZSt16__throw_bad_castv .LBB2_62: .cfi_escape 0x2e, 0x00 callq _ZSt16__throw_bad_castv .LBB2_63: .cfi_escape 0x2e, 0x00 callq _ZSt16__throw_bad_castv .LBB2_32: .cfi_escape 0x2e, 0x00 callq _ZSt16__throw_bad_castv .LBB2_64: .cfi_escape 0x2e, 0x00 callq _ZSt16__throw_bad_castv .LBB2_56: .Ltmp11: movq %rax, %rbx movq 24(%rsp), %rdi cmpq %r14, %rdi je .LBB2_40 # %bb.57: # %.critedge.i.i113 .cfi_escape 0x2e, 0x00 jmp .LBB2_39 .LBB2_54: .Ltmp8: movq %rax, %rbx movq 56(%rsp), %rdi cmpq %r14, %rdi je .LBB2_40 # %bb.55: # %.critedge.i.i110 .cfi_escape 0x2e, 0x00 jmp .LBB2_39 .LBB2_41: .Ltmp5: movq %rax, %rbx movq 88(%rsp), %rdi cmpq %r14, %rdi je .LBB2_40 # %bb.42: # %.critedge.i.i87 .cfi_escape 0x2e, 0x00 jmp .LBB2_39 .LBB2_37: .Ltmp2: movq %rax, %rbx movq 120(%rsp), %rdi cmpq %r14, %rdi je .LBB2_40 # %bb.38: # %.critedge.i.i84 .cfi_escape 0x2e, 0x00 .LBB2_39: # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit86 callq _ZdlPv .LBB2_40: # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit86 .cfi_escape 0x2e, 0x00 movq %rbx, %rdi callq _Unwind_Resume@PLT .Lfunc_end2: .size main, .Lfunc_end2-main .cfi_endproc .section .gcc_except_table,"a",@progbits .p2align 2, 0x0 GCC_except_table2: .Lexception0: .byte 255 # @LPStart Encoding = omit .byte 255 # @TType Encoding = omit .byte 1 # Call site Encoding = uleb128 .uleb128 .Lcst_end0-.Lcst_begin0 .Lcst_begin0: .uleb128 .Lfunc_begin0-.Lfunc_begin0 # >> Call Site 1 << .uleb128 .Ltmp0-.Lfunc_begin0 # Call between .Lfunc_begin0 and .Ltmp0 .byte 0 # has no landing pad .byte 0 # On action: cleanup .uleb128 .Ltmp0-.Lfunc_begin0 # >> Call Site 2 << .uleb128 .Ltmp1-.Ltmp0 # Call between .Ltmp0 and .Ltmp1 .uleb128 .Ltmp2-.Lfunc_begin0 # jumps to .Ltmp2 .byte 0 # On action: cleanup .uleb128 .Ltmp1-.Lfunc_begin0 # >> Call Site 3 << .uleb128 .Ltmp3-.Ltmp1 # Call between .Ltmp1 and .Ltmp3 .byte 0 # has no landing pad .byte 0 # On action: cleanup .uleb128 .Ltmp3-.Lfunc_begin0 # >> Call Site 4 << .uleb128 .Ltmp4-.Ltmp3 # Call between .Ltmp3 and .Ltmp4 .uleb128 .Ltmp5-.Lfunc_begin0 # jumps to .Ltmp5 .byte 0 # On action: cleanup .uleb128 .Ltmp4-.Lfunc_begin0 # >> Call Site 5 << .uleb128 .Ltmp6-.Ltmp4 # Call between .Ltmp4 and .Ltmp6 .byte 0 # has no landing pad .byte 0 # On action: cleanup .uleb128 .Ltmp6-.Lfunc_begin0 # >> Call Site 6 << .uleb128 .Ltmp7-.Ltmp6 # Call between .Ltmp6 and .Ltmp7 .uleb128 .Ltmp8-.Lfunc_begin0 # jumps to .Ltmp8 .byte 0 # On action: cleanup .uleb128 .Ltmp7-.Lfunc_begin0 # >> Call Site 7 << .uleb128 .Ltmp9-.Ltmp7 # Call between .Ltmp7 and .Ltmp9 .byte 0 # has no landing pad .byte 0 # On action: cleanup .uleb128 .Ltmp9-.Lfunc_begin0 # >> Call Site 8 << .uleb128 .Ltmp10-.Ltmp9 # Call between .Ltmp9 and .Ltmp10 .uleb128 .Ltmp11-.Lfunc_begin0 # jumps to .Ltmp11 .byte 0 # On action: cleanup .uleb128 .Ltmp10-.Lfunc_begin0 # >> Call Site 9 << .uleb128 .Lfunc_end2-.Ltmp10 # Call between .Ltmp10 and .Lfunc_end2 .byte 0 # has no landing pad .byte 0 # On action: cleanup .Lcst_end0: .p2align 2, 0x0 # -- End function .text .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 $_Z12square_arrayPfi, %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 .L.str,@object # @.str .section .rodata.str1.1,"aMS",@progbits,1 .L.str: .asciz ", line " .size .L.str, 8 .type .L.str.1,@object # @.str.1 .L.str.1: .asciz ": " .size .L.str.1, 3 .type .L.str.2,@object # @.str.2 .L.str.2: .asciz " (" .size .L.str.2, 3 .type .L.str.3,@object # @.str.3 .L.str.3: .asciz ")" .size .L.str.3, 2 .type _Z12square_arrayPfi,@object # @_Z12square_arrayPfi .section .rodata,"a",@progbits .globl _Z12square_arrayPfi .p2align 3, 0x0 _Z12square_arrayPfi: .quad _Z27__device_stub__square_arrayPfi .size _Z12square_arrayPfi, 8 .type .L.str.4,@object # @.str.4 .section .rodata.str1.1,"aMS",@progbits,1 .L.str.4: .asciz "CPU:" .size .L.str.4, 5 .type .L.str.5,@object # @.str.5 .L.str.5: .asciz "/home/ubuntu/Datasets/stackv2/train-structured-repos-hip/gaow0007/gpu-programming/master/02_basic_kernels/squareArray.hip" .size .L.str.5, 122 .type .L.str.6,@object # @.str.6 .L.str.6: .asciz "GPU:" .size .L.str.6, 5 .type .L__unnamed_1,@object # @0 .L__unnamed_1: .asciz "_Z12square_arrayPfi" .size .L__unnamed_1, 20 .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 _Z27__device_stub__square_arrayPfi .addrsig_sym __gxx_personality_v0 .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Unwind_Resume .addrsig_sym _ZSt4cout .addrsig_sym _Z12square_arrayPfi .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 <cuda.h> #include <cuda_runtime.h> #include <time.h> #include <algorithm> #include <iostream> #include <cuda_fp16.h> using namespace std; #define N 32*1024*1024 #define kBlockSize 256 // CUDA: grid stride looping #define CUDA_1D_KERNEL_LOOP(i, n) \ for (int32_t i = blockIdx.x * blockDim.x + threadIdx.x, step = blockDim.x * gridDim.x; i < (n); \ i += step) // Upsample Nearest2D Kernel is copyed from https://github.com/Oneflow-Inc/oneflow/blob/master/oneflow/user/kernels/upsample_nearest_kernel.cu#L78 template<typename T> struct alignas(2 * sizeof(T)) Pack2X { T x; T y; }; template<typename T> __global__ void UpsampleNearest2D2XForward(const int32_t in_elem_cnt, const T* in_dptr, const int32_t in_height, const int32_t in_width, T* out_dptr) { const int32_t in_hw_size = in_width * in_height; CUDA_1D_KERNEL_LOOP(index, in_elem_cnt) { const T in_value = in_dptr[index]; const int32_t nc_idx = index / in_hw_size; const int32_t hw_off = index - nc_idx * in_hw_size; const int32_t h = hw_off / in_width; const int32_t w = hw_off - h * in_width; Pack2X<T> out_value{in_value, in_value}; Pack2X<T>* out_pack_dptr = reinterpret_cast<Pack2X<T>*>(out_dptr); out_pack_dptr[nc_idx * in_hw_size * 2 + h * 2 * in_width + w] = out_value; out_pack_dptr[nc_idx * in_hw_size * 2 + (h * 2 + 1) * in_width + w] = out_value; } } template<typename T> __global__ void UpsampleNearest2D2XBackward(const int32_t in_elem_cnt, const T* dy_dptr, const int32_t dx_height, const int32_t dx_width, T* dx_dptr) { const int32_t dx_hw_size = dx_height * dx_width; CUDA_1D_KERNEL_LOOP(index, in_elem_cnt) { T dx_value = 0.0; const int32_t nc_idx = index / dx_hw_size; const int32_t dx_hw_off = index - nc_idx * dx_hw_size; const int32_t dx_h = dx_hw_off / dx_width; const int32_t dx_w = dx_hw_off - dx_h * dx_width; const Pack2X<T>* dy_pack_dptr = reinterpret_cast<const Pack2X<T>*>(dy_dptr); const Pack2X<T> dy_pack_value1 = dy_pack_dptr[nc_idx * dx_hw_size * 2 + dx_h * 2 * dx_width + dx_w]; const Pack2X<T> dy_pack_value2 = dy_pack_dptr[nc_idx * dx_hw_size * 2 + (dx_h * 2 + 1) * dx_width + dx_w]; dx_value += dy_pack_value1.x; dx_value += dy_pack_value1.y; dx_value += dy_pack_value2.x; dx_value += dy_pack_value2.y; dx_dptr[index] = dx_value; } } int main(){ float *input_host = (float*)malloc(N*sizeof(float)); float *input_device; cudaMalloc((void **)&input_device, N*sizeof(float)); for (int i = 0; i < N; i++) input_host[i] = 1.0; cudaMemcpy(input_device, input_host, N*sizeof(float), cudaMemcpyHostToDevice); float *output_host = (float*)malloc(N * 4 * sizeof(float)); float *output_device; cudaMalloc((void **)&output_device, N * 4 * sizeof(float)); dim3 grid(N / kBlockSize, 1); dim3 block(kBlockSize, 1); UpsampleNearest2D2XForward<<<grid, block>>>(N, input_device, 1024, 1024, output_device); cudaMemcpy(output_host, output_device, N * 4 * sizeof(float), cudaMemcpyDeviceToHost); for(int i = 0; i < 50; i++) { printf("%.5f\n", output_host[i]); } return 0; }
.file "tmpxft_00135484_00000000-6_upsample_nearest_2d.cudafe1.cpp" .text #APP .globl _ZSt21ios_base_library_initv #NO_APP .section .text._Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_,"axG",@progbits,_Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_,comdat .weak _Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_ .type _Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_, @function _Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_: .LFB4629: .cfi_startproc endbr64 subq $152, %rsp .cfi_def_cfa_offset 160 movq %fs:40, %rax movq %rax, 136(%rsp) xorl %eax, %eax movl %edi, 4(%rsp) movq %rsi, 16(%rsp) movl %edx, 8(%rsp) movl %ecx, 12(%rsp) movq %r8, 24(%rsp) leaq 4(%rsp), %rax movq %rax, 96(%rsp) leaq 16(%rsp), %rax movq %rax, 104(%rsp) leaq 8(%rsp), %rax movq %rax, 112(%rsp) leaq 12(%rsp), %rax movq %rax, 120(%rsp) leaq 24(%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 .L5 .L1: movq 136(%rsp), %rax subq %fs:40, %rax jne .L6 addq $152, %rsp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L5: .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 _Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 160 jmp .L1 .L6: call __stack_chk_fail@PLT .cfi_endproc .LFE4629: .size _Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_, .-_Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_ .text .type _ZL26__cudaUnregisterBinaryUtilv, @function _ZL26__cudaUnregisterBinaryUtilv: .LFB4304: .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 .LFE4304: .size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv .section .rodata.str1.1,"aMS",@progbits,1 .LC1: .string "%.5f\n" .text .globl main .type main, @function main: .LFB4301: .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 $48, %rsp .cfi_def_cfa_offset 80 movq %fs:40, %rax movq %rax, 40(%rsp) xorl %eax, %eax movl $134217728, %edi call malloc@PLT movq %rax, %rbx movq %rsp, %rdi movl $134217728, %esi call cudaMalloc@PLT movq %rbx, %rax leaq 134217728(%rbx), %rdx movss .LC0(%rip), %xmm0 .L10: movss %xmm0, (%rax) addq $4, %rax cmpq %rdx, %rax jne .L10 movl $1, %ecx movl $134217728, %edx movq %rbx, %rsi movq (%rsp), %rdi call cudaMemcpy@PLT movl $536870912, %edi call malloc@PLT movq %rax, %rbp leaq 8(%rsp), %rdi movl $536870912, %esi call cudaMalloc@PLT movl $131072, 16(%rsp) movl $1, 20(%rsp) movl $256, 28(%rsp) movl $1, 32(%rsp) movl $0, %r9d movl $0, %r8d movq 28(%rsp), %rdx movl $1, %ecx movq 16(%rsp), %rdi movl $1, %esi call __cudaPushCallConfiguration@PLT testl %eax, %eax je .L17 .L11: movl $2, %ecx movl $536870912, %edx movq 8(%rsp), %rsi movq %rbp, %rdi call cudaMemcpy@PLT movq %rbp, %rbx addq $200, %rbp leaq .LC1(%rip), %r12 .L12: pxor %xmm0, %xmm0 cvtss2sd (%rbx), %xmm0 movq %r12, %rsi movl $2, %edi movl $1, %eax call __printf_chk@PLT addq $4, %rbx cmpq %rbp, %rbx jne .L12 movq 40(%rsp), %rax subq %fs:40, %rax jne .L18 movl $0, %eax addq $48, %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 .L17: .cfi_restore_state movq 8(%rsp), %r8 movl $1024, %ecx movl $1024, %edx movq (%rsp), %rsi movl $33554432, %edi call _Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_ jmp .L11 .L18: call __stack_chk_fail@PLT .cfi_endproc .LFE4301: .size main, .-main .section .rodata.str1.8,"aMS",@progbits,1 .align 8 .LC2: .string "_Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_" .text .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB4329: .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 _Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_(%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 .LFE4329: .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 .LC0: .long 1065353216 .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 <cuda.h> #include <cuda_runtime.h> #include <time.h> #include <algorithm> #include <iostream> #include <cuda_fp16.h> using namespace std; #define N 32*1024*1024 #define kBlockSize 256 // CUDA: grid stride looping #define CUDA_1D_KERNEL_LOOP(i, n) \ for (int32_t i = blockIdx.x * blockDim.x + threadIdx.x, step = blockDim.x * gridDim.x; i < (n); \ i += step) // Upsample Nearest2D Kernel is copyed from https://github.com/Oneflow-Inc/oneflow/blob/master/oneflow/user/kernels/upsample_nearest_kernel.cu#L78 template<typename T> struct alignas(2 * sizeof(T)) Pack2X { T x; T y; }; template<typename T> __global__ void UpsampleNearest2D2XForward(const int32_t in_elem_cnt, const T* in_dptr, const int32_t in_height, const int32_t in_width, T* out_dptr) { const int32_t in_hw_size = in_width * in_height; CUDA_1D_KERNEL_LOOP(index, in_elem_cnt) { const T in_value = in_dptr[index]; const int32_t nc_idx = index / in_hw_size; const int32_t hw_off = index - nc_idx * in_hw_size; const int32_t h = hw_off / in_width; const int32_t w = hw_off - h * in_width; Pack2X<T> out_value{in_value, in_value}; Pack2X<T>* out_pack_dptr = reinterpret_cast<Pack2X<T>*>(out_dptr); out_pack_dptr[nc_idx * in_hw_size * 2 + h * 2 * in_width + w] = out_value; out_pack_dptr[nc_idx * in_hw_size * 2 + (h * 2 + 1) * in_width + w] = out_value; } } template<typename T> __global__ void UpsampleNearest2D2XBackward(const int32_t in_elem_cnt, const T* dy_dptr, const int32_t dx_height, const int32_t dx_width, T* dx_dptr) { const int32_t dx_hw_size = dx_height * dx_width; CUDA_1D_KERNEL_LOOP(index, in_elem_cnt) { T dx_value = 0.0; const int32_t nc_idx = index / dx_hw_size; const int32_t dx_hw_off = index - nc_idx * dx_hw_size; const int32_t dx_h = dx_hw_off / dx_width; const int32_t dx_w = dx_hw_off - dx_h * dx_width; const Pack2X<T>* dy_pack_dptr = reinterpret_cast<const Pack2X<T>*>(dy_dptr); const Pack2X<T> dy_pack_value1 = dy_pack_dptr[nc_idx * dx_hw_size * 2 + dx_h * 2 * dx_width + dx_w]; const Pack2X<T> dy_pack_value2 = dy_pack_dptr[nc_idx * dx_hw_size * 2 + (dx_h * 2 + 1) * dx_width + dx_w]; dx_value += dy_pack_value1.x; dx_value += dy_pack_value1.y; dx_value += dy_pack_value2.x; dx_value += dy_pack_value2.y; dx_dptr[index] = dx_value; } } int main(){ float *input_host = (float*)malloc(N*sizeof(float)); float *input_device; cudaMalloc((void **)&input_device, N*sizeof(float)); for (int i = 0; i < N; i++) input_host[i] = 1.0; cudaMemcpy(input_device, input_host, N*sizeof(float), cudaMemcpyHostToDevice); float *output_host = (float*)malloc(N * 4 * sizeof(float)); float *output_device; cudaMalloc((void **)&output_device, N * 4 * sizeof(float)); dim3 grid(N / kBlockSize, 1); dim3 block(kBlockSize, 1); UpsampleNearest2D2XForward<<<grid, block>>>(N, input_device, 1024, 1024, output_device); cudaMemcpy(output_host, output_device, N * 4 * sizeof(float), cudaMemcpyDeviceToHost); for(int i = 0; i < 50; i++) { printf("%.5f\n", output_host[i]); } return 0; }
#include <hip/hip_runtime.h> #include <time.h> #include <algorithm> #include <iostream> #include <hip/hip_fp16.h> using namespace std; #define N 32*1024*1024 #define kBlockSize 256 // CUDA: grid stride looping #define CUDA_1D_KERNEL_LOOP(i, n) \ for (int32_t i = blockIdx.x * blockDim.x + threadIdx.x, step = blockDim.x * gridDim.x; i < (n); \ i += step) // Upsample Nearest2D Kernel is copyed from https://github.com/Oneflow-Inc/oneflow/blob/master/oneflow/user/kernels/upsample_nearest_kernel.cu#L78 template<typename T> struct alignas(2 * sizeof(T)) Pack2X { T x; T y; }; template<typename T> __global__ void UpsampleNearest2D2XForward(const int32_t in_elem_cnt, const T* in_dptr, const int32_t in_height, const int32_t in_width, T* out_dptr) { const int32_t in_hw_size = in_width * in_height; CUDA_1D_KERNEL_LOOP(index, in_elem_cnt) { const T in_value = in_dptr[index]; const int32_t nc_idx = index / in_hw_size; const int32_t hw_off = index - nc_idx * in_hw_size; const int32_t h = hw_off / in_width; const int32_t w = hw_off - h * in_width; Pack2X<T> out_value{in_value, in_value}; Pack2X<T>* out_pack_dptr = reinterpret_cast<Pack2X<T>*>(out_dptr); out_pack_dptr[nc_idx * in_hw_size * 2 + h * 2 * in_width + w] = out_value; out_pack_dptr[nc_idx * in_hw_size * 2 + (h * 2 + 1) * in_width + w] = out_value; } } template<typename T> __global__ void UpsampleNearest2D2XBackward(const int32_t in_elem_cnt, const T* dy_dptr, const int32_t dx_height, const int32_t dx_width, T* dx_dptr) { const int32_t dx_hw_size = dx_height * dx_width; CUDA_1D_KERNEL_LOOP(index, in_elem_cnt) { T dx_value = 0.0; const int32_t nc_idx = index / dx_hw_size; const int32_t dx_hw_off = index - nc_idx * dx_hw_size; const int32_t dx_h = dx_hw_off / dx_width; const int32_t dx_w = dx_hw_off - dx_h * dx_width; const Pack2X<T>* dy_pack_dptr = reinterpret_cast<const Pack2X<T>*>(dy_dptr); const Pack2X<T> dy_pack_value1 = dy_pack_dptr[nc_idx * dx_hw_size * 2 + dx_h * 2 * dx_width + dx_w]; const Pack2X<T> dy_pack_value2 = dy_pack_dptr[nc_idx * dx_hw_size * 2 + (dx_h * 2 + 1) * dx_width + dx_w]; dx_value += dy_pack_value1.x; dx_value += dy_pack_value1.y; dx_value += dy_pack_value2.x; dx_value += dy_pack_value2.y; dx_dptr[index] = dx_value; } } int main(){ float *input_host = (float*)malloc(N*sizeof(float)); float *input_device; hipMalloc((void **)&input_device, N*sizeof(float)); for (int i = 0; i < N; i++) input_host[i] = 1.0; hipMemcpy(input_device, input_host, N*sizeof(float), hipMemcpyHostToDevice); float *output_host = (float*)malloc(N * 4 * sizeof(float)); float *output_device; hipMalloc((void **)&output_device, N * 4 * sizeof(float)); dim3 grid(N / kBlockSize, 1); dim3 block(kBlockSize, 1); UpsampleNearest2D2XForward<<<grid, block>>>(N, input_device, 1024, 1024, output_device); hipMemcpy(output_host, output_device, N * 4 * sizeof(float), hipMemcpyDeviceToHost); for(int i = 0; i < 50; i++) { printf("%.5f\n", output_host[i]); } return 0; }
You are a helpful coding assistant specialized in converting HIP source code to AMD device assembly.
#include <hip/hip_runtime.h> #include <time.h> #include <algorithm> #include <iostream> #include <hip/hip_fp16.h> using namespace std; #define N 32*1024*1024 #define kBlockSize 256 // CUDA: grid stride looping #define CUDA_1D_KERNEL_LOOP(i, n) \ for (int32_t i = blockIdx.x * blockDim.x + threadIdx.x, step = blockDim.x * gridDim.x; i < (n); \ i += step) // Upsample Nearest2D Kernel is copyed from https://github.com/Oneflow-Inc/oneflow/blob/master/oneflow/user/kernels/upsample_nearest_kernel.cu#L78 template<typename T> struct alignas(2 * sizeof(T)) Pack2X { T x; T y; }; template<typename T> __global__ void UpsampleNearest2D2XForward(const int32_t in_elem_cnt, const T* in_dptr, const int32_t in_height, const int32_t in_width, T* out_dptr) { const int32_t in_hw_size = in_width * in_height; CUDA_1D_KERNEL_LOOP(index, in_elem_cnt) { const T in_value = in_dptr[index]; const int32_t nc_idx = index / in_hw_size; const int32_t hw_off = index - nc_idx * in_hw_size; const int32_t h = hw_off / in_width; const int32_t w = hw_off - h * in_width; Pack2X<T> out_value{in_value, in_value}; Pack2X<T>* out_pack_dptr = reinterpret_cast<Pack2X<T>*>(out_dptr); out_pack_dptr[nc_idx * in_hw_size * 2 + h * 2 * in_width + w] = out_value; out_pack_dptr[nc_idx * in_hw_size * 2 + (h * 2 + 1) * in_width + w] = out_value; } } template<typename T> __global__ void UpsampleNearest2D2XBackward(const int32_t in_elem_cnt, const T* dy_dptr, const int32_t dx_height, const int32_t dx_width, T* dx_dptr) { const int32_t dx_hw_size = dx_height * dx_width; CUDA_1D_KERNEL_LOOP(index, in_elem_cnt) { T dx_value = 0.0; const int32_t nc_idx = index / dx_hw_size; const int32_t dx_hw_off = index - nc_idx * dx_hw_size; const int32_t dx_h = dx_hw_off / dx_width; const int32_t dx_w = dx_hw_off - dx_h * dx_width; const Pack2X<T>* dy_pack_dptr = reinterpret_cast<const Pack2X<T>*>(dy_dptr); const Pack2X<T> dy_pack_value1 = dy_pack_dptr[nc_idx * dx_hw_size * 2 + dx_h * 2 * dx_width + dx_w]; const Pack2X<T> dy_pack_value2 = dy_pack_dptr[nc_idx * dx_hw_size * 2 + (dx_h * 2 + 1) * dx_width + dx_w]; dx_value += dy_pack_value1.x; dx_value += dy_pack_value1.y; dx_value += dy_pack_value2.x; dx_value += dy_pack_value2.y; dx_dptr[index] = dx_value; } } int main(){ float *input_host = (float*)malloc(N*sizeof(float)); float *input_device; hipMalloc((void **)&input_device, N*sizeof(float)); for (int i = 0; i < N; i++) input_host[i] = 1.0; hipMemcpy(input_device, input_host, N*sizeof(float), hipMemcpyHostToDevice); float *output_host = (float*)malloc(N * 4 * sizeof(float)); float *output_device; hipMalloc((void **)&output_device, N * 4 * sizeof(float)); dim3 grid(N / kBlockSize, 1); dim3 block(kBlockSize, 1); UpsampleNearest2D2XForward<<<grid, block>>>(N, input_device, 1024, 1024, output_device); hipMemcpy(output_host, output_device, N * 4 * sizeof(float), hipMemcpyDeviceToHost); for(int i = 0; i < 50; i++) { printf("%.5f\n", output_host[i]); } return 0; }
.text .amdgcn_target "amdgcn-amd-amdhsa--gfx1100" .section .text._Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_,"axG",@progbits,_Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_,comdat .protected _Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_ .globl _Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_ .p2align 8 .type _Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_,@function _Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_: s_clause 0x1 s_load_b32 s4, s[0:1], 0x2c s_load_b32 s8, s[0:1], 0x0 s_add_u32 s2, s0, 32 s_addc_u32 s3, s1, 0 s_waitcnt lgkmcnt(0) s_and_b32 s11, s4, 0xffff s_mov_b32 s4, exec_lo v_mad_u64_u32 v[1:2], null, s15, s11, v[0:1] s_delay_alu instid0(VALU_DEP_1) v_cmpx_gt_i32_e64 s8, v1 s_cbranch_execz .LBB0_3 s_load_b128 s[4:7], s[0:1], 0x10 s_waitcnt lgkmcnt(0) s_mul_i32 s9, s5, s4 s_ashr_i32 s4, s5, 31 s_ashr_i32 s10, s9, 31 s_add_i32 s12, s5, s4 s_add_i32 s9, s9, s10 s_delay_alu instid0(SALU_CYCLE_1) s_xor_b32 s9, s9, s10 s_xor_b32 s10, s12, s4 v_cvt_f32_u32_e32 v0, s9 v_cvt_f32_u32_e32 v2, s10 s_load_b32 s12, s[2:3], 0x0 s_sub_i32 s2, 0, s9 s_sub_i32 s3, 0, s10 v_rcp_iflag_f32_e32 v0, v0 v_rcp_iflag_f32_e32 v2, v2 s_waitcnt_depctr 0xfff v_mul_f32_e32 v0, 0x4f7ffffe, v0 v_mul_f32_e32 v2, 0x4f7ffffe, v2 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_cvt_u32_f32_e32 v0, v0 v_cvt_u32_f32_e32 v2, v2 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_mul_lo_u32 v3, s2, v0 v_mul_lo_u32 v4, s3, v2 s_load_b64 s[2:3], s[0:1], 0x8 s_waitcnt lgkmcnt(0) s_mul_i32 s1, s12, s11 s_mov_b32 s11, 0 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_mul_hi_u32 v3, v0, v3 v_mul_hi_u32 v4, v2, v4 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_add_nc_u32_e32 v0, v0, v3 v_add_nc_u32_e32 v3, v2, v4 .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_ashrrev_i32_e32 v2, 31, v1 v_add_co_u32 v4, vcc_lo, s2, v4 s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_3) | instid1(VALU_DEP_2) v_add_co_ci_u32_e32 v5, vcc_lo, s3, v5, vcc_lo global_load_b32 v4, v[4:5], off v_add_nc_u32_e32 v5, v1, v2 v_add_nc_u32_e32 v1, s1, v1 v_xor_b32_e32 v6, v5, v2 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_mul_hi_u32 v7, v6, v0 v_mul_lo_u32 v7, v7, s9 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_sub_nc_u32_e32 v6, v6, v7 v_subrev_nc_u32_e32 v7, s9, v6 v_cmp_le_u32_e32 vcc_lo, s9, v6 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1) v_cndmask_b32_e32 v6, v6, v7, vcc_lo v_subrev_nc_u32_e32 v7, s9, v6 v_cmp_le_u32_e32 vcc_lo, s9, v6 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1) v_cndmask_b32_e32 v6, v6, v7, vcc_lo v_xor_b32_e32 v6, v6, v2 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2) v_sub_nc_u32_e32 v2, v6, v2 v_sub_nc_u32_e32 v5, v5, v6 v_ashrrev_i32_e32 v7, 31, v2 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_add_nc_u32_e32 v8, v2, v7 v_xor_b32_e32 v8, v8, v7 v_xor_b32_e32 v7, s4, v7 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1) v_mul_hi_u32 v9, v8, v3 v_mul_lo_u32 v10, v9, s10 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2) v_sub_nc_u32_e32 v8, v8, v10 v_add_nc_u32_e32 v10, 1, v9 v_subrev_nc_u32_e32 v11, s10, v8 v_cmp_le_u32_e32 vcc_lo, s10, v8 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1) v_dual_cndmask_b32 v9, v9, v10 :: v_dual_cndmask_b32 v8, v8, v11 v_add_nc_u32_e32 v10, 1, v9 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_cmp_le_u32_e32 vcc_lo, s10, v8 v_cndmask_b32_e32 v8, v9, v10, vcc_lo v_cmp_le_i32_e32 vcc_lo, s8, v1 s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_xor_b32_e32 v8, v8, v7 s_or_b32 s11, vcc_lo, s11 v_sub_nc_u32_e32 v7, v8, v7 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_mul_lo_u32 v8, v7, s5 v_lshlrev_b32_e32 v7, 1, v7 v_or_b32_e32 v9, 1, v7 s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1) v_sub_nc_u32_e32 v2, v2, v8 v_lshl_add_u32 v2, v5, 1, v2 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_4) v_mad_u64_u32 v[5:6], null, v7, s5, v[2:3] v_mad_u64_u32 v[7:8], null, v9, s5, v[2:3] s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_ashrrev_i32_e32 v6, 31, v5 v_ashrrev_i32_e32 v8, 31, v7 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_lshlrev_b64 v[5:6], 3, v[5:6] v_lshlrev_b64 v[7:8], 3, v[7:8] s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1) v_add_co_u32 v9, s0, s6, v5 v_add_co_ci_u32_e64 v10, s0, s7, v6, s0 s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1) v_add_co_u32 v6, s0, s6, v7 v_add_co_ci_u32_e64 v7, s0, s7, v8, s0 s_waitcnt vmcnt(0) v_mov_b32_e32 v5, v4 s_clause 0x1 global_store_b64 v[9:10], v[4:5], off global_store_b64 v[6:7], v[4:5], off s_and_not1_b32 exec_lo, exec_lo, s11 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 _Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_ .amdhsa_group_segment_fixed_size 0 .amdhsa_private_segment_fixed_size 0 .amdhsa_kernarg_size 288 .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 12 .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._Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_,"axG",@progbits,_Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_,comdat .Lfunc_end0: .size _Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_, .Lfunc_end0-_Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_ .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 - .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 - .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: _Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_ .private_segment_fixed_size: 0 .sgpr_count: 18 .sgpr_spill_count: 0 .symbol: _Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_.kd .uniform_work_group_size: 1 .uses_dynamic_stack: false .vgpr_count: 12 .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 <time.h> #include <algorithm> #include <iostream> #include <hip/hip_fp16.h> using namespace std; #define N 32*1024*1024 #define kBlockSize 256 // CUDA: grid stride looping #define CUDA_1D_KERNEL_LOOP(i, n) \ for (int32_t i = blockIdx.x * blockDim.x + threadIdx.x, step = blockDim.x * gridDim.x; i < (n); \ i += step) // Upsample Nearest2D Kernel is copyed from https://github.com/Oneflow-Inc/oneflow/blob/master/oneflow/user/kernels/upsample_nearest_kernel.cu#L78 template<typename T> struct alignas(2 * sizeof(T)) Pack2X { T x; T y; }; template<typename T> __global__ void UpsampleNearest2D2XForward(const int32_t in_elem_cnt, const T* in_dptr, const int32_t in_height, const int32_t in_width, T* out_dptr) { const int32_t in_hw_size = in_width * in_height; CUDA_1D_KERNEL_LOOP(index, in_elem_cnt) { const T in_value = in_dptr[index]; const int32_t nc_idx = index / in_hw_size; const int32_t hw_off = index - nc_idx * in_hw_size; const int32_t h = hw_off / in_width; const int32_t w = hw_off - h * in_width; Pack2X<T> out_value{in_value, in_value}; Pack2X<T>* out_pack_dptr = reinterpret_cast<Pack2X<T>*>(out_dptr); out_pack_dptr[nc_idx * in_hw_size * 2 + h * 2 * in_width + w] = out_value; out_pack_dptr[nc_idx * in_hw_size * 2 + (h * 2 + 1) * in_width + w] = out_value; } } template<typename T> __global__ void UpsampleNearest2D2XBackward(const int32_t in_elem_cnt, const T* dy_dptr, const int32_t dx_height, const int32_t dx_width, T* dx_dptr) { const int32_t dx_hw_size = dx_height * dx_width; CUDA_1D_KERNEL_LOOP(index, in_elem_cnt) { T dx_value = 0.0; const int32_t nc_idx = index / dx_hw_size; const int32_t dx_hw_off = index - nc_idx * dx_hw_size; const int32_t dx_h = dx_hw_off / dx_width; const int32_t dx_w = dx_hw_off - dx_h * dx_width; const Pack2X<T>* dy_pack_dptr = reinterpret_cast<const Pack2X<T>*>(dy_dptr); const Pack2X<T> dy_pack_value1 = dy_pack_dptr[nc_idx * dx_hw_size * 2 + dx_h * 2 * dx_width + dx_w]; const Pack2X<T> dy_pack_value2 = dy_pack_dptr[nc_idx * dx_hw_size * 2 + (dx_h * 2 + 1) * dx_width + dx_w]; dx_value += dy_pack_value1.x; dx_value += dy_pack_value1.y; dx_value += dy_pack_value2.x; dx_value += dy_pack_value2.y; dx_dptr[index] = dx_value; } } int main(){ float *input_host = (float*)malloc(N*sizeof(float)); float *input_device; hipMalloc((void **)&input_device, N*sizeof(float)); for (int i = 0; i < N; i++) input_host[i] = 1.0; hipMemcpy(input_device, input_host, N*sizeof(float), hipMemcpyHostToDevice); float *output_host = (float*)malloc(N * 4 * sizeof(float)); float *output_device; hipMalloc((void **)&output_device, N * 4 * sizeof(float)); dim3 grid(N / kBlockSize, 1); dim3 block(kBlockSize, 1); UpsampleNearest2D2XForward<<<grid, block>>>(N, input_device, 1024, 1024, output_device); hipMemcpy(output_host, output_device, N * 4 * sizeof(float), hipMemcpyDeviceToHost); for(int i = 0; i < 50; i++) { printf("%.5f\n", output_host[i]); } return 0; }
.text .file "upsample_nearest_2d.hip" # Start of file scope inline assembly .globl _ZSt21ios_base_library_initv # End of file scope inline assembly .globl main # -- Begin function 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 subq $136, %rsp .cfi_def_cfa_offset 160 .cfi_offset %rbx, -24 .cfi_offset %r14, -16 movl $134217728, %edi # imm = 0x8000000 callq malloc movq %rax, %rbx leaq 24(%rsp), %rdi movl $134217728, %esi # imm = 0x8000000 callq hipMalloc xorl %eax, %eax .p2align 4, 0x90 .LBB0_1: # =>This Inner Loop Header: Depth=1 movl $1065353216, (%rbx,%rax,4) # imm = 0x3F800000 incq %rax cmpq $33554432, %rax # imm = 0x2000000 jne .LBB0_1 # %bb.2: movq 24(%rsp), %rdi movl $134217728, %edx # imm = 0x8000000 movq %rbx, %rsi movl $1, %ecx callq hipMemcpy movl $536870912, %edi # imm = 0x20000000 callq malloc movq %rax, %rbx leaq 16(%rsp), %rdi movl $536870912, %esi # imm = 0x20000000 callq hipMalloc movabsq $4294967552, %rdx # imm = 0x100000100 leaq 130816(%rdx), %rdi movl $1, %esi movl $1, %ecx xorl %r8d, %r8d xorl %r9d, %r9d callq __hipPushCallConfiguration testl %eax, %eax jne .LBB0_4 # %bb.3: movq 24(%rsp), %rax movq 16(%rsp), %rcx movl $33554432, 12(%rsp) # imm = 0x2000000 movq %rax, 88(%rsp) movl $1024, 8(%rsp) # imm = 0x400 movl $1024, 4(%rsp) # imm = 0x400 movq %rcx, 80(%rsp) leaq 12(%rsp), %rax movq %rax, 96(%rsp) leaq 88(%rsp), %rax movq %rax, 104(%rsp) leaq 8(%rsp), %rax movq %rax, 112(%rsp) leaq 4(%rsp), %rax movq %rax, 120(%rsp) leaq 80(%rsp), %rax movq %rax, 128(%rsp) leaq 64(%rsp), %rdi leaq 48(%rsp), %rsi leaq 40(%rsp), %rdx leaq 32(%rsp), %rcx callq __hipPopCallConfiguration movq 64(%rsp), %rsi movl 72(%rsp), %edx movq 48(%rsp), %rcx movl 56(%rsp), %r8d leaq 96(%rsp), %r9 movl $_Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_, %edi pushq 32(%rsp) .cfi_adjust_cfa_offset 8 pushq 48(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $16, %rsp .cfi_adjust_cfa_offset -16 .LBB0_4: movq 16(%rsp), %rsi movl $536870912, %edx # imm = 0x20000000 movq %rbx, %rdi movl $2, %ecx callq hipMemcpy xorl %r14d, %r14d .p2align 4, 0x90 .LBB0_5: # =>This Inner Loop Header: Depth=1 movss (%rbx,%r14,4), %xmm0 # xmm0 = mem[0],zero,zero,zero cvtss2sd %xmm0, %xmm0 movl $.L.str, %edi movb $1, %al callq printf incq %r14 cmpq $50, %r14 jne .LBB0_5 # %bb.6: xorl %eax, %eax addq $136, %rsp .cfi_def_cfa_offset 24 popq %rbx .cfi_def_cfa_offset 16 popq %r14 .cfi_def_cfa_offset 8 retq .Lfunc_end0: .size main, .Lfunc_end0-main .cfi_endproc # -- End function .section .text._Z41__device_stub__UpsampleNearest2D2XForwardIfEviPKT_iiPS0_,"axG",@progbits,_Z41__device_stub__UpsampleNearest2D2XForwardIfEviPKT_iiPS0_,comdat .weak _Z41__device_stub__UpsampleNearest2D2XForwardIfEviPKT_iiPS0_ # -- Begin function _Z41__device_stub__UpsampleNearest2D2XForwardIfEviPKT_iiPS0_ .p2align 4, 0x90 .type _Z41__device_stub__UpsampleNearest2D2XForwardIfEviPKT_iiPS0_,@function _Z41__device_stub__UpsampleNearest2D2XForwardIfEviPKT_iiPS0_: # @_Z41__device_stub__UpsampleNearest2D2XForwardIfEviPKT_iiPS0_ .cfi_startproc # %bb.0: subq $120, %rsp .cfi_def_cfa_offset 128 movl %edi, 12(%rsp) movq %rsi, 72(%rsp) movl %edx, 8(%rsp) movl %ecx, 4(%rsp) movq %r8, 64(%rsp) leaq 12(%rsp), %rax movq %rax, 80(%rsp) leaq 72(%rsp), %rax movq %rax, 88(%rsp) leaq 8(%rsp), %rax movq %rax, 96(%rsp) leaq 4(%rsp), %rax movq %rax, 104(%rsp) leaq 64(%rsp), %rax movq %rax, 112(%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 $_Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_, %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_end1: .size _Z41__device_stub__UpsampleNearest2D2XForwardIfEviPKT_iiPS0_, .Lfunc_end1-_Z41__device_stub__UpsampleNearest2D2XForwardIfEviPKT_iiPS0_ .cfi_endproc # -- End function .text .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 $_Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_, %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 _Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_,@object # @_Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_ .section .rodata._Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_,"aG",@progbits,_Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_,comdat .weak _Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_ .p2align 3, 0x0 _Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_: .quad _Z41__device_stub__UpsampleNearest2D2XForwardIfEviPKT_iiPS0_ .size _Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_, 8 .type .L.str,@object # @.str .section .rodata.str1.1,"aMS",@progbits,1 .L.str: .asciz "%.5f\n" .size .L.str, 6 .type .L__unnamed_1,@object # @0 .L__unnamed_1: .asciz "_Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_" .size .L__unnamed_1, 46 .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 _Z41__device_stub__UpsampleNearest2D2XForwardIfEviPKT_iiPS0_ .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_ .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_00135484_00000000-6_upsample_nearest_2d.cudafe1.cpp" .text #APP .globl _ZSt21ios_base_library_initv #NO_APP .section .text._Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_,"axG",@progbits,_Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_,comdat .weak _Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_ .type _Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_, @function _Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_: .LFB4629: .cfi_startproc endbr64 subq $152, %rsp .cfi_def_cfa_offset 160 movq %fs:40, %rax movq %rax, 136(%rsp) xorl %eax, %eax movl %edi, 4(%rsp) movq %rsi, 16(%rsp) movl %edx, 8(%rsp) movl %ecx, 12(%rsp) movq %r8, 24(%rsp) leaq 4(%rsp), %rax movq %rax, 96(%rsp) leaq 16(%rsp), %rax movq %rax, 104(%rsp) leaq 8(%rsp), %rax movq %rax, 112(%rsp) leaq 12(%rsp), %rax movq %rax, 120(%rsp) leaq 24(%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 .L5 .L1: movq 136(%rsp), %rax subq %fs:40, %rax jne .L6 addq $152, %rsp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L5: .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 _Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 160 jmp .L1 .L6: call __stack_chk_fail@PLT .cfi_endproc .LFE4629: .size _Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_, .-_Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_ .text .type _ZL26__cudaUnregisterBinaryUtilv, @function _ZL26__cudaUnregisterBinaryUtilv: .LFB4304: .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 .LFE4304: .size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv .section .rodata.str1.1,"aMS",@progbits,1 .LC1: .string "%.5f\n" .text .globl main .type main, @function main: .LFB4301: .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 $48, %rsp .cfi_def_cfa_offset 80 movq %fs:40, %rax movq %rax, 40(%rsp) xorl %eax, %eax movl $134217728, %edi call malloc@PLT movq %rax, %rbx movq %rsp, %rdi movl $134217728, %esi call cudaMalloc@PLT movq %rbx, %rax leaq 134217728(%rbx), %rdx movss .LC0(%rip), %xmm0 .L10: movss %xmm0, (%rax) addq $4, %rax cmpq %rdx, %rax jne .L10 movl $1, %ecx movl $134217728, %edx movq %rbx, %rsi movq (%rsp), %rdi call cudaMemcpy@PLT movl $536870912, %edi call malloc@PLT movq %rax, %rbp leaq 8(%rsp), %rdi movl $536870912, %esi call cudaMalloc@PLT movl $131072, 16(%rsp) movl $1, 20(%rsp) movl $256, 28(%rsp) movl $1, 32(%rsp) movl $0, %r9d movl $0, %r8d movq 28(%rsp), %rdx movl $1, %ecx movq 16(%rsp), %rdi movl $1, %esi call __cudaPushCallConfiguration@PLT testl %eax, %eax je .L17 .L11: movl $2, %ecx movl $536870912, %edx movq 8(%rsp), %rsi movq %rbp, %rdi call cudaMemcpy@PLT movq %rbp, %rbx addq $200, %rbp leaq .LC1(%rip), %r12 .L12: pxor %xmm0, %xmm0 cvtss2sd (%rbx), %xmm0 movq %r12, %rsi movl $2, %edi movl $1, %eax call __printf_chk@PLT addq $4, %rbx cmpq %rbp, %rbx jne .L12 movq 40(%rsp), %rax subq %fs:40, %rax jne .L18 movl $0, %eax addq $48, %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 .L17: .cfi_restore_state movq 8(%rsp), %r8 movl $1024, %ecx movl $1024, %edx movq (%rsp), %rsi movl $33554432, %edi call _Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_ jmp .L11 .L18: call __stack_chk_fail@PLT .cfi_endproc .LFE4301: .size main, .-main .section .rodata.str1.8,"aMS",@progbits,1 .align 8 .LC2: .string "_Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_" .text .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB4329: .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 _Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_(%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 .LFE4329: .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 .LC0: .long 1065353216 .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 "upsample_nearest_2d.hip" # Start of file scope inline assembly .globl _ZSt21ios_base_library_initv # End of file scope inline assembly .globl main # -- Begin function 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 subq $136, %rsp .cfi_def_cfa_offset 160 .cfi_offset %rbx, -24 .cfi_offset %r14, -16 movl $134217728, %edi # imm = 0x8000000 callq malloc movq %rax, %rbx leaq 24(%rsp), %rdi movl $134217728, %esi # imm = 0x8000000 callq hipMalloc xorl %eax, %eax .p2align 4, 0x90 .LBB0_1: # =>This Inner Loop Header: Depth=1 movl $1065353216, (%rbx,%rax,4) # imm = 0x3F800000 incq %rax cmpq $33554432, %rax # imm = 0x2000000 jne .LBB0_1 # %bb.2: movq 24(%rsp), %rdi movl $134217728, %edx # imm = 0x8000000 movq %rbx, %rsi movl $1, %ecx callq hipMemcpy movl $536870912, %edi # imm = 0x20000000 callq malloc movq %rax, %rbx leaq 16(%rsp), %rdi movl $536870912, %esi # imm = 0x20000000 callq hipMalloc movabsq $4294967552, %rdx # imm = 0x100000100 leaq 130816(%rdx), %rdi movl $1, %esi movl $1, %ecx xorl %r8d, %r8d xorl %r9d, %r9d callq __hipPushCallConfiguration testl %eax, %eax jne .LBB0_4 # %bb.3: movq 24(%rsp), %rax movq 16(%rsp), %rcx movl $33554432, 12(%rsp) # imm = 0x2000000 movq %rax, 88(%rsp) movl $1024, 8(%rsp) # imm = 0x400 movl $1024, 4(%rsp) # imm = 0x400 movq %rcx, 80(%rsp) leaq 12(%rsp), %rax movq %rax, 96(%rsp) leaq 88(%rsp), %rax movq %rax, 104(%rsp) leaq 8(%rsp), %rax movq %rax, 112(%rsp) leaq 4(%rsp), %rax movq %rax, 120(%rsp) leaq 80(%rsp), %rax movq %rax, 128(%rsp) leaq 64(%rsp), %rdi leaq 48(%rsp), %rsi leaq 40(%rsp), %rdx leaq 32(%rsp), %rcx callq __hipPopCallConfiguration movq 64(%rsp), %rsi movl 72(%rsp), %edx movq 48(%rsp), %rcx movl 56(%rsp), %r8d leaq 96(%rsp), %r9 movl $_Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_, %edi pushq 32(%rsp) .cfi_adjust_cfa_offset 8 pushq 48(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $16, %rsp .cfi_adjust_cfa_offset -16 .LBB0_4: movq 16(%rsp), %rsi movl $536870912, %edx # imm = 0x20000000 movq %rbx, %rdi movl $2, %ecx callq hipMemcpy xorl %r14d, %r14d .p2align 4, 0x90 .LBB0_5: # =>This Inner Loop Header: Depth=1 movss (%rbx,%r14,4), %xmm0 # xmm0 = mem[0],zero,zero,zero cvtss2sd %xmm0, %xmm0 movl $.L.str, %edi movb $1, %al callq printf incq %r14 cmpq $50, %r14 jne .LBB0_5 # %bb.6: xorl %eax, %eax addq $136, %rsp .cfi_def_cfa_offset 24 popq %rbx .cfi_def_cfa_offset 16 popq %r14 .cfi_def_cfa_offset 8 retq .Lfunc_end0: .size main, .Lfunc_end0-main .cfi_endproc # -- End function .section .text._Z41__device_stub__UpsampleNearest2D2XForwardIfEviPKT_iiPS0_,"axG",@progbits,_Z41__device_stub__UpsampleNearest2D2XForwardIfEviPKT_iiPS0_,comdat .weak _Z41__device_stub__UpsampleNearest2D2XForwardIfEviPKT_iiPS0_ # -- Begin function _Z41__device_stub__UpsampleNearest2D2XForwardIfEviPKT_iiPS0_ .p2align 4, 0x90 .type _Z41__device_stub__UpsampleNearest2D2XForwardIfEviPKT_iiPS0_,@function _Z41__device_stub__UpsampleNearest2D2XForwardIfEviPKT_iiPS0_: # @_Z41__device_stub__UpsampleNearest2D2XForwardIfEviPKT_iiPS0_ .cfi_startproc # %bb.0: subq $120, %rsp .cfi_def_cfa_offset 128 movl %edi, 12(%rsp) movq %rsi, 72(%rsp) movl %edx, 8(%rsp) movl %ecx, 4(%rsp) movq %r8, 64(%rsp) leaq 12(%rsp), %rax movq %rax, 80(%rsp) leaq 72(%rsp), %rax movq %rax, 88(%rsp) leaq 8(%rsp), %rax movq %rax, 96(%rsp) leaq 4(%rsp), %rax movq %rax, 104(%rsp) leaq 64(%rsp), %rax movq %rax, 112(%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 $_Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_, %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_end1: .size _Z41__device_stub__UpsampleNearest2D2XForwardIfEviPKT_iiPS0_, .Lfunc_end1-_Z41__device_stub__UpsampleNearest2D2XForwardIfEviPKT_iiPS0_ .cfi_endproc # -- End function .text .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 $_Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_, %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 _Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_,@object # @_Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_ .section .rodata._Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_,"aG",@progbits,_Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_,comdat .weak _Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_ .p2align 3, 0x0 _Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_: .quad _Z41__device_stub__UpsampleNearest2D2XForwardIfEviPKT_iiPS0_ .size _Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_, 8 .type .L.str,@object # @.str .section .rodata.str1.1,"aMS",@progbits,1 .L.str: .asciz "%.5f\n" .size .L.str, 6 .type .L__unnamed_1,@object # @0 .L__unnamed_1: .asciz "_Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_" .size .L__unnamed_1, 46 .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 _Z41__device_stub__UpsampleNearest2D2XForwardIfEviPKT_iiPS0_ .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z26UpsampleNearest2D2XForwardIfEviPKT_iiPS0_ .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 <iostream> int main(void){ int xs[2] = {1,2}; thrust::device_vector<int> d_xs(xs, xs+2); thrust::device_vector<int> d_ys(xs, xs+2); std::cout << (d_xs == d_xs) << std::endl; if(d_xs != d_xs){ std::cout << "FALSE" << std::endl; } if(d_xs != d_ys){ std::cout << "FALSE" << std::endl; } std::cout << true << std::endl; std::cout << false << std::endl; return 0; }
#include <hip/hip_runtime.h> #include <thrust/device_vector.h> #include <iostream> int main(void){ int xs[2] = {1,2}; thrust::device_vector<int> d_xs(xs, xs+2); thrust::device_vector<int> d_ys(xs, xs+2); std::cout << (d_xs == d_xs) << std::endl; if(d_xs != d_xs){ std::cout << "FALSE" << std::endl; } if(d_xs != d_ys){ std::cout << "FALSE" << std::endl; } std::cout << true << std::endl; std::cout << false << std::endl; return 0; }
You are a helpful coding assistant specialized in converting CUDA source code to CUDA device assembly.
__global__ void vecAdd(float *l, float *r, float *result, size_t N) { for (size_t i = 0; i < N; ++i) { for (size_t j = 0; j < N; ++j) { for (size_t k = 0; k < N; ++k) { for (size_t v = 0; v < N; ++v) { for (size_t u = 0; u < N; ++u) { result[i + j + k + v + u] = l[i + j] + r[v + u + k]; } } } } } }
code for sm_80 Function : _Z6vecAddPfS_S_m .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*/ ISETP.NE.U32.AND P0, PT, RZ, c[0x0][0x178], PT ; /* 0x00005e00ff007a0c */ /* 0x000fc80003f05070 */ /*0020*/ ISETP.NE.AND.EX P0, PT, RZ, c[0x0][0x17c], PT, P0 ; /* 0x00005f00ff007a0c */ /* 0x000fda0003f05300 */ /*0030*/ @!P0 EXIT ; /* 0x000000000000894d */ /* 0x000fea0003800000 */ /*0040*/ IMAD.MOV.U32 R0, RZ, RZ, 0x1 ; /* 0x00000001ff007424 */ /* 0x000fe200078e00ff */ /*0050*/ UMOV UR6, 0x8 ; /* 0x0000000800067882 */ /* 0x000fe20000000000 */ /*0060*/ IMAD.MOV.U32 R2, RZ, RZ, c[0x0][0x17c] ; /* 0x00005f00ff027624 */ /* 0x000fe200078e00ff */ /*0070*/ ULDC.64 UR8, c[0x0][0x168] ; /* 0x00005a0000087ab9 */ /* 0x000fe20000000a00 */ /*0080*/ CS2R R8, SRZ ; /* 0x0000000000087805 */ /* 0x000fe2000001ff00 */ /*0090*/ IADD3 R0, P1, -R0, c[0x0][0x178], RZ ; /* 0x00005e0000007a10 */ /* 0x000fe20007f3e1ff */ /*00a0*/ ULDC.64 UR4, c[0x0][0x170] ; /* 0x00005c0000047ab9 */ /* 0x000fe40000000a00 */ /*00b0*/ UIADD3 UR8, UP0, UR6, UR8, URZ ; /* 0x0000000806087290 */ /* 0x000fe2000ff1e03f */ /*00c0*/ ISETP.GE.U32.AND P0, PT, R0, 0x3, PT ; /* 0x000000030000780c */ /* 0x000fe20003f06070 */ /*00d0*/ IMAD.MOV.U32 R0, RZ, RZ, c[0x0][0x178] ; /* 0x00005e00ff007624 */ /* 0x000fe200078e00ff */ /*00e0*/ IADD3.X R2, R2, -0x1, RZ, P1, !PT ; /* 0xffffffff02027810 */ /* 0x000fe20000ffe4ff */ /*00f0*/ UIADD3 UR6, UP1, UR6, UR4, URZ ; /* 0x0000000406067290 */ /* 0x000fc4000ff3e03f */ /*0100*/ UIADD3.X UR9, URZ, UR9, URZ, UP0, !UPT ; /* 0x000000093f097290 */ /* 0x000fe200087fe43f */ /*0110*/ LOP3.LUT R0, R0, 0x3, RZ, 0xc0, !PT ; /* 0x0000000300007812 */ /* 0x000fe200078ec0ff */ /*0120*/ UIADD3.X UR7, URZ, UR5, URZ, UP1, !UPT ; /* 0x000000053f077290 */ /* 0x000fe20008ffe43f */ /*0130*/ ISETP.GE.U32.AND.EX P0, PT, R2, RZ, PT, P0 ; /* 0x000000ff0200720c */ /* 0x000fe20003f06100 */ /*0140*/ ULDC.64 UR10, c[0x0][0x118] ; /* 0x00004600000a7ab9 */ /* 0x000fe20000000a00 */ /*0150*/ IADD3 R23, P1, R0, -c[0x0][0x178], RZ ; /* 0x80005e0000177a10 */ /* 0x000fca0007f3e0ff */ /*0160*/ IMAD.X R24, RZ, RZ, ~c[0x0][0x17c], P1 ; /* 0x80005f00ff187624 */ /* 0x000fe400008e06ff */ /*0170*/ CS2R R10, SRZ ; /* 0x00000000000a7805 */ /* 0x003fcc000001ff00 */ /*0180*/ IADD3 R12, P1, R8, R11, RZ ; /* 0x0000000b080c7210 */ /* 0x000fe20007f3e0ff */ /*0190*/ CS2R R14, SRZ ; /* 0x00000000000e7805 */ /* 0x000fe2000001ff00 */ /*01a0*/ IADD3 R11, P2, R11, 0x1, RZ ; /* 0x000000010b0b7810 */ /* 0x000fc60007f5e0ff */ /*01b0*/ IMAD.X R13, R9, 0x1, R10.reuse, P1 ; /* 0x00000001090d7824 */ /* 0x100fe200008e060a */ /*01c0*/ ISETP.GE.U32.AND P1, PT, R11, c[0x0][0x178], PT ; /* 0x00005e000b007a0c */ /* 0x000fe20003f26070 */ /*01d0*/ IMAD.X R10, RZ, RZ, R10, P2 ; /* 0x000000ffff0a7224 */ /* 0x000fe200010e060a */ /*01e0*/ LEA R2, P2, R12, c[0x0][0x160], 0x2 ; /* 0x000058000c027a11 */ /* 0x000fc800078410ff */ /*01f0*/ ISETP.GE.U32.AND.EX P1, PT, R10, c[0x0][0x17c], PT, P1 ; /* 0x00005f000a007a0c */ /* 0x000fe40003f26110 */ /*0200*/ LEA.HI.X R3, R12, c[0x0][0x164], R13, 0x2, P2 ; /* 0x000059000c037a11 */ /* 0x003fe400010f140d */ /*0210*/ IADD3 R16, P2, R15, R12, RZ ; /* 0x0000000c0f107210 */ /* 0x000fe20007f5e0ff */ /*0220*/ IMAD.MOV.U32 R17, RZ, RZ, RZ ; /* 0x000000ffff117224 */ /* 0x000fe400078e00ff */ /*0230*/ IMAD.MOV.U32 R19, RZ, RZ, RZ ; /* 0x000000ffff137224 */ /* 0x000fe400078e00ff */ /*0240*/ IMAD.X R18, R14, 0x1, R13, P2 ; /* 0x000000010e127824 */ /* 0x003fc800010e060d */ /*0250*/ IADD3 R21, P3, R15, R17, RZ ; /* 0x000000110f157210 */ /* 0x002fe20007f7e0ff */ /*0260*/ UMOV UR4, URZ ; /* 0x0000003f00047c82 */ /* 0x000fe20008000000 */ /*0270*/ ISETP.NE.U32.AND P2, PT, R0, RZ, PT ; /* 0x000000ff0000720c */ /* 0x000fe20003f45070 */ /*0280*/ UMOV UR5, URZ ; /* 0x0000003f00057c82 */ /* 0x000fc40008000000 */ /*0290*/ IMAD.X R20, R14, 0x1, R19, P3 ; /* 0x000000010e147824 */ /* 0x000fe200018e0613 */ /*02a0*/ ISETP.NE.AND.EX P2, PT, RZ, RZ, PT, P2 ; /* 0x000000ffff00720c */ /* 0x000fe20003f45320 */ /*02b0*/ @!P0 BRA 0x510 ; /* 0x0000025000008947 */ /* 0x001fd80003800000 */ /*02c0*/ IADD3 R27, P4, R17, R16, RZ ; /* 0x00000010111b7210 */ /* 0x000fe20007f9e0ff */ /*02d0*/ UMOV UR4, URZ ; /* 0x0000003f00047c82 */ /* 0x000fe20008000000 */ /*02e0*/ LEA R4, P3, R21, UR8, 0x2 ; /* 0x0000000815047c11 */ /* 0x000fe2000f8610ff */ /*02f0*/ UMOV UR5, URZ ; /* 0x0000003f00057c82 */ /* 0x000fe20008000000 */ /*0300*/ LEA R22, P5, R27, UR6, 0x2 ; /* 0x000000061b167c11 */ /* 0x000fe2000f8a10ff */ /*0310*/ IMAD.X R6, R19, 0x1, R18, P4 ; /* 0x0000000113067824 */ /* 0x000fe200020e0612 */ /*0320*/ LEA.HI.X R5, R21, UR9, R20, 0x2, P3 ; /* 0x0000000915057c11 */ /* 0x000fc800098f1414 */ /*0330*/ LEA.HI.X R27, R27, UR7, R6, 0x2, P5 ; /* 0x000000071b1b7c11 */ /* 0x000fe4000a8f1406 */ /*0340*/ LDG.E R7, [R2.64] ; /* 0x0000000a02077981 */ /* 0x000ea8000c1e1900 */ /*0350*/ LDG.E R6, [R4.64+-0x8] ; /* 0xfffff80a04067981 */ /* 0x000ea4000c1e1900 */ /*0360*/ FADD R25, R6, R7 ; /* 0x0000000706197221 */ /* 0x004fe40000000000 */ /*0370*/ IMAD.MOV.U32 R6, RZ, RZ, R22 ; /* 0x000000ffff067224 */ /* 0x000fe400078e0016 */ /*0380*/ IMAD.MOV.U32 R7, RZ, RZ, R27 ; /* 0x000000ffff077224 */ /* 0x000fca00078e001b */ /*0390*/ STG.E [R6.64+-0x8], R25 ; /* 0xfffff81906007986 */ /* 0x0001e8000c10190a */ /*03a0*/ LDG.E R22, [R4.64+-0x4] ; /* 0xfffffc0a04167981 */ /* 0x000ea8000c1e1900 */ /*03b0*/ LDG.E R27, [R2.64] ; /* 0x0000000a021b7981 */ /* 0x000ea4000c1e1900 */ /*03c0*/ FADD R27, R22, R27 ; /* 0x0000001b161b7221 */ /* 0x004fca0000000000 */ /*03d0*/ STG.E [R6.64+-0x4], R27 ; /* 0xfffffc1b06007986 */ /* 0x0003e8000c10190a */ /*03e0*/ LDG.E R22, [R4.64] ; /* 0x0000000a04167981 */ /* 0x000ea8000c1e1900 */ /*03f0*/ LDG.E R29, [R2.64] ; /* 0x0000000a021d7981 */ /* 0x000ea4000c1e1900 */ /*0400*/ FADD R29, R22, R29 ; /* 0x0000001d161d7221 */ /* 0x004fca0000000000 */ /*0410*/ STG.E [R6.64], R29 ; /* 0x0000001d06007986 */ /* 0x0005e8000c10190a */ /*0420*/ LDG.E R22, [R4.64+0x4] ; /* 0x0000040a04167981 */ /* 0x000e28000c1e1900 */ /*0430*/ LDG.E R26, [R2.64] ; /* 0x0000000a021a7981 */ /* 0x000e22000c1e1900 */ /*0440*/ UIADD3 UR4, UP0, UR4, 0x4, URZ ; /* 0x0000000404047890 */ /* 0x000fc8000ff1e03f */ /*0450*/ UIADD3.X UR5, URZ, UR5, URZ, UP0, !UPT ; /* 0x000000053f057290 */ /* 0x000fe200087fe43f */ /*0460*/ FADD R25, R22, R26 ; /* 0x0000001a16197221 */ /* 0x001fe20000000000 */ /*0470*/ IADD3 R22, P4, R23, UR4, RZ ; /* 0x0000000417167c10 */ /* 0x000fc8000ff9e0ff */ /*0480*/ ISETP.NE.U32.AND P3, PT, R22, RZ, PT ; /* 0x000000ff1600720c */ /* 0x000fe20003f65070 */ /*0490*/ STG.E [R6.64+0x4], R25 ; /* 0x0000041906007986 */ /* 0x0005e2000c10190a */ /*04a0*/ IADD3.X R22, R24, UR5, RZ, P4, !PT ; /* 0x0000000518167c10 */ /* 0x000fe4000a7fe4ff */ /*04b0*/ IADD3 R4, P4, R4, 0x10, RZ ; /* 0x0000001004047810 */ /* 0x000fe40007f9e0ff */ /*04c0*/ ISETP.NE.AND.EX P3, PT, R22, RZ, PT, P3 ; /* 0x000000ff1600720c */ /* 0x000fe40003f65330 */ /*04d0*/ IADD3 R22, P5, R6, 0x10, RZ ; /* 0x0000001006167810 */ /* 0x000fe20007fbe0ff */ /*04e0*/ IMAD.X R5, RZ, RZ, R5, P4 ; /* 0x000000ffff057224 */ /* 0x000fc800020e0605 */ /*04f0*/ IMAD.X R27, RZ, RZ, R7, P5 ; /* 0x000000ffff1b7224 */ /* 0x002fcc00028e0607 */ /*0500*/ @P3 BRA 0x340 ; /* 0xfffffe3000003947 */ /* 0x004fea000383ffff */ /*0510*/ @!P2 BRA 0x6c0 ; /* 0x000001a00000a947 */ /* 0x000fea0003800000 */ /*0520*/ IADD3 R5, P2, R21, UR4, RZ ; /* 0x0000000415057c10 */ /* 0x000fe2000ff5e0ff */ /*0530*/ LDG.E R25, [R2.64] ; /* 0x0000000a02197981 */ /* 0x000ea6000c1e1900 */ /*0540*/ IADD3.X R6, R20, UR5, RZ, P2, !PT ; /* 0x0000000514067c10 */ /* 0x000fe400097fe4ff */ /*0550*/ LEA R4, P2, R5, c[0x0][0x168], 0x2 ; /* 0x00005a0005047a11 */ /* 0x000fc800078410ff */ /*0560*/ LEA.HI.X R5, R5, c[0x0][0x16c], R6, 0x2, P2 ; /* 0x00005b0005057a11 */ /* 0x000fca00010f1406 */ /*0570*/ LDG.E R22, [R4.64] ; /* 0x0000000a04167981 */ /* 0x000ea2000c1e1900 */ /*0580*/ IADD3 R21, P2, P3, R21, UR4, R12 ; /* 0x0000000415157c10 */ /* 0x000fc8000fb5e00c */ /*0590*/ IADD3.X R20, R20, UR5, R13, P2, P3 ; /* 0x0000000514147c10 */ /* 0x000fe400097e640d */ /*05a0*/ LEA R6, P2, R21, c[0x0][0x170], 0x2 ; /* 0x00005c0015067a11 */ /* 0x000fc800078410ff */ /*05b0*/ LEA.HI.X R7, R21, c[0x0][0x174], R20, 0x2, P2 ; /* 0x00005d0015077a11 */ /* 0x000fe400010f1414 */ /*05c0*/ ISETP.NE.U32.AND P2, PT, R0, 0x1, PT ; /* 0x000000010000780c */ /* 0x000fc80003f45070 */ /*05d0*/ ISETP.NE.AND.EX P2, PT, RZ, RZ, PT, P2 ; /* 0x000000ffff00720c */ /* 0x000fe20003f45320 */ /*05e0*/ FADD R25, R22, R25 ; /* 0x0000001916197221 */ /* 0x004fca0000000000 */ /*05f0*/ STG.E [R6.64], R25 ; /* 0x0000001906007986 */ /* 0x0001ee000c10190a */ /*0600*/ @!P2 BRA 0x6c0 ; /* 0x000000b00000a947 */ /* 0x000fea0003800000 */ /*0610*/ LDG.E R20, [R4.64+0x4] ; /* 0x0000040a04147981 */ /* 0x000ea8000c1e1900 */ /*0620*/ LDG.E R21, [R2.64] ; /* 0x0000000a02157981 */ /* 0x000ea2000c1e1900 */ /*0630*/ ISETP.NE.U32.AND P2, PT, R0, 0x2, PT ; /* 0x000000020000780c */ /* 0x000fc80003f45070 */ /*0640*/ ISETP.NE.AND.EX P2, PT, RZ, RZ, PT, P2 ; /* 0x000000ffff00720c */ /* 0x000fe20003f45320 */ /*0650*/ FADD R21, R20, R21 ; /* 0x0000001514157221 */ /* 0x004fca0000000000 */ /*0660*/ STG.E [R6.64+0x4], R21 ; /* 0x0000041506007986 */ /* 0x0003ee000c10190a */ /*0670*/ @!P2 BRA 0x6c0 ; /* 0x000000400000a947 */ /* 0x000fea0003800000 */ /*0680*/ LDG.E R5, [R4.64+0x8] ; /* 0x0000080a04057981 */ /* 0x000ea8000c1e1900 */ /*0690*/ LDG.E R20, [R2.64] ; /* 0x0000000a02147981 */ /* 0x000ea4000c1e1900 */ /*06a0*/ FADD R21, R20, R5 ; /* 0x0000000514157221 */ /* 0x006fca0000000000 */ /*06b0*/ STG.E [R6.64+0x8], R21 ; /* 0x0000081506007986 */ /* 0x0003e4000c10190a */ /*06c0*/ IADD3 R17, P2, R17, 0x1, RZ ; /* 0x0000000111117810 */ /* 0x000fca0007f5e0ff */ /*06d0*/ IMAD.X R19, RZ, RZ, R19, P2 ; /* 0x000000ffff137224 */ /* 0x000fe200010e0613 */ /*06e0*/ ISETP.GE.U32.AND P2, PT, R17, c[0x0][0x178], PT ; /* 0x00005e0011007a0c */ /* 0x000fc80003f46070 */ /*06f0*/ ISETP.GE.U32.AND.EX P2, PT, R19, c[0x0][0x17c], PT, P2 ; /* 0x00005f0013007a0c */ /* 0x000fda0003f46120 */ /*0700*/ @!P2 BRA 0x250 ; /* 0xfffffb400000a947 */ /* 0x000fea000383ffff */ /*0710*/ IADD3 R15, P2, R15, 0x1, RZ ; /* 0x000000010f0f7810 */ /* 0x000fca0007f5e0ff */ /*0720*/ IMAD.X R14, RZ, RZ, R14, P2 ; /* 0x000000ffff0e7224 */ /* 0x000fe200010e060e */ /*0730*/ ISETP.GE.U32.AND P2, PT, R15, c[0x0][0x178], PT ; /* 0x00005e000f007a0c */ /* 0x000fc80003f46070 */ /*0740*/ ISETP.GE.U32.AND.EX P2, PT, R14, c[0x0][0x17c], PT, P2 ; /* 0x00005f000e007a0c */ /* 0x000fda0003f46120 */ /*0750*/ @!P2 BRA 0x210 ; /* 0xfffffab00000a947 */ /* 0x000fea000383ffff */ /*0760*/ @!P1 BRA 0x180 ; /* 0xfffffa1000009947 */ /* 0x000fea000383ffff */ /*0770*/ IADD3 R8, P1, R8, 0x1, RZ ; /* 0x0000000108087810 */ /* 0x000fca0007f3e0ff */ /*0780*/ IMAD.X R9, RZ, RZ, R9, P1 ; /* 0x000000ffff097224 */ /* 0x000fe200008e0609 */ /*0790*/ ISETP.GE.U32.AND P1, PT, R8, c[0x0][0x178], PT ; /* 0x00005e0008007a0c */ /* 0x000fc80003f26070 */ /*07a0*/ ISETP.GE.U32.AND.EX P1, PT, R9, c[0x0][0x17c], PT, P1 ; /* 0x00005f0009007a0c */ /* 0x000fda0003f26110 */ /*07b0*/ @!P1 BRA 0x170 ; /* 0xfffff9b000009947 */ /* 0x000fea000383ffff */ /*07c0*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*07d0*/ BRA 0x7d0; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*07e0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*07f0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0800*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0810*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0820*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0830*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0840*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0850*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0860*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0870*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ ..........
You are a helpful coding assistant specialized in converting CUDA source code to CUDA host assembly.
__global__ void vecAdd(float *l, float *r, float *result, size_t N) { for (size_t i = 0; i < N; ++i) { for (size_t j = 0; j < N; ++j) { for (size_t k = 0; k < N; ++k) { for (size_t v = 0; v < N; ++v) { for (size_t u = 0; u < N; ++u) { result[i + j + k + v + u] = l[i + j] + r[v + u + k]; } } } } } }
.file "tmpxft_00007383_00000000-6_loop6.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 _Z30__device_stub__Z6vecAddPfS_S_mPfS_S_m .type _Z30__device_stub__Z6vecAddPfS_S_mPfS_S_m, @function _Z30__device_stub__Z6vecAddPfS_S_mPfS_S_m: .LFB2051: .cfi_startproc endbr64 subq $152, %rsp .cfi_def_cfa_offset 160 movq %rdi, 24(%rsp) movq %rsi, 16(%rsp) movq %rdx, 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 16(%rsp), %rax movq %rax, 104(%rsp) leaq 8(%rsp), %rax movq %rax, 112(%rsp) movq %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 _Z6vecAddPfS_S_m(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 160 jmp .L3 .L8: call __stack_chk_fail@PLT .cfi_endproc .LFE2051: .size _Z30__device_stub__Z6vecAddPfS_S_mPfS_S_m, .-_Z30__device_stub__Z6vecAddPfS_S_mPfS_S_m .globl _Z6vecAddPfS_S_m .type _Z6vecAddPfS_S_m, @function _Z6vecAddPfS_S_m: .LFB2052: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z30__device_stub__Z6vecAddPfS_S_mPfS_S_m addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2052: .size _Z6vecAddPfS_S_m, .-_Z6vecAddPfS_S_m .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "_Z6vecAddPfS_S_m" .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 _Z6vecAddPfS_S_m(%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.
__global__ void vecAdd(float *l, float *r, float *result, size_t N) { for (size_t i = 0; i < N; ++i) { for (size_t j = 0; j < N; ++j) { for (size_t k = 0; k < N; ++k) { for (size_t v = 0; v < N; ++v) { for (size_t u = 0; u < N; ++u) { result[i + j + k + v + u] = l[i + j] + r[v + u + k]; } } } } } }
#include <hip/hip_runtime.h> __global__ void vecAdd(float *l, float *r, float *result, size_t N) { for (size_t i = 0; i < N; ++i) { for (size_t j = 0; j < N; ++j) { for (size_t k = 0; k < N; ++k) { for (size_t v = 0; v < N; ++v) { for (size_t u = 0; u < N; ++u) { result[i + j + k + v + u] = l[i + j] + r[v + u + k]; } } } } } }
You are a helpful coding assistant specialized in converting HIP source code to AMD device assembly.
#include <hip/hip_runtime.h> __global__ void vecAdd(float *l, float *r, float *result, size_t N) { for (size_t i = 0; i < N; ++i) { for (size_t j = 0; j < N; ++j) { for (size_t k = 0; k < N; ++k) { for (size_t v = 0; v < N; ++v) { for (size_t u = 0; u < N; ++u) { result[i + j + k + v + u] = l[i + j] + r[v + u + k]; } } } } } }
.text .amdgcn_target "amdgcn-amd-amdhsa--gfx1100" .protected _Z6vecAddPfS_S_m .globl _Z6vecAddPfS_S_m .p2align 8 .type _Z6vecAddPfS_S_m,@function _Z6vecAddPfS_S_m: s_load_b64 s[2:3], s[0:1], 0x18 s_mov_b64 s[8:9], 0 s_waitcnt lgkmcnt(0) s_cmp_eq_u64 s[2:3], 0 s_cbranch_scc1 .LBB0_11 s_clause 0x1 s_load_b128 s[4:7], s[0:1], 0x0 s_load_b64 s[0:1], s[0:1], 0x10 v_mov_b32_e32 v0, 0 .LBB0_2: s_mov_b64 s[10:11], 0 s_waitcnt lgkmcnt(0) s_mov_b64 s[12:13], s[0:1] .LBB0_3: s_add_u32 s16, s10, s8 s_addc_u32 s17, s11, s9 s_mov_b64 s[14:15], s[6:7] s_lshl_b64 s[18:19], s[16:17], 2 s_mov_b64 s[16:17], s[12:13] s_add_u32 s18, s4, s18 s_addc_u32 s19, s5, s19 s_mov_b64 s[20:21], 0 s_set_inst_prefetch_distance 0x1 .p2align 6 .LBB0_4: s_mov_b64 s[22:23], 0 s_mov_b64 s[24:25], s[14:15] s_mov_b64 s[26:27], s[16:17] .p2align 6 .LBB0_5: s_mov_b64 s[28:29], s[24:25] s_mov_b64 s[30:31], s[26:27] s_mov_b64 s[34:35], s[2:3] .LBB0_6: s_clause 0x1 global_load_b32 v1, v0, s[18:19] global_load_b32 v2, v0, s[28:29] s_add_u32 s34, s34, -1 s_addc_u32 s35, s35, -1 s_waitcnt vmcnt(0) v_add_f32_e32 v1, v1, v2 global_store_b32 v0, v1, s[30:31] s_add_u32 s30, s30, 4 s_addc_u32 s31, s31, 0 s_add_u32 s28, s28, 4 s_addc_u32 s29, s29, 0 s_cmp_eq_u64 s[34:35], 0 s_cbranch_scc0 .LBB0_6 s_add_u32 s22, s22, 1 s_addc_u32 s23, s23, 0 s_add_u32 s26, s26, 4 s_addc_u32 s27, s27, 0 s_add_u32 s24, s24, 4 s_addc_u32 s25, s25, 0 s_cmp_eq_u64 s[22:23], s[2:3] s_cbranch_scc0 .LBB0_5 s_add_u32 s20, s20, 1 s_addc_u32 s21, s21, 0 s_add_u32 s16, s16, 4 s_addc_u32 s17, s17, 0 s_add_u32 s14, s14, 4 s_addc_u32 s15, s15, 0 s_cmp_eq_u64 s[20:21], s[2:3] s_cbranch_scc0 .LBB0_4 s_set_inst_prefetch_distance 0x2 s_add_u32 s10, s10, 1 s_addc_u32 s11, s11, 0 s_add_u32 s12, s12, 4 s_addc_u32 s13, s13, 0 s_cmp_eq_u64 s[10:11], s[2:3] s_cbranch_scc0 .LBB0_3 s_add_u32 s8, s8, 1 s_addc_u32 s9, s9, 0 s_add_u32 s0, s0, 4 s_addc_u32 s1, s1, 0 s_cmp_eq_u64 s[8:9], s[2:3] s_cbranch_scc0 .LBB0_2 .LBB0_11: s_nop 0 s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z6vecAddPfS_S_m .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 36 .amdhsa_reserve_vcc 0 .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 _Z6vecAddPfS_S_m, .Lfunc_end0-_Z6vecAddPfS_S_m .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: 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: 1024 .name: _Z6vecAddPfS_S_m .private_segment_fixed_size: 0 .sgpr_count: 36 .sgpr_spill_count: 0 .symbol: _Z6vecAddPfS_S_m.kd .uniform_work_group_size: 1 .uses_dynamic_stack: false .vgpr_count: 3 .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> __global__ void vecAdd(float *l, float *r, float *result, size_t N) { for (size_t i = 0; i < N; ++i) { for (size_t j = 0; j < N; ++j) { for (size_t k = 0; k < N; ++k) { for (size_t v = 0; v < N; ++v) { for (size_t u = 0; u < N; ++u) { result[i + j + k + v + u] = l[i + j] + r[v + u + k]; } } } } } }
.text .file "loop6.hip" .globl _Z21__device_stub__vecAddPfS_S_m # -- Begin function _Z21__device_stub__vecAddPfS_S_m .p2align 4, 0x90 .type _Z21__device_stub__vecAddPfS_S_m,@function _Z21__device_stub__vecAddPfS_S_m: # @_Z21__device_stub__vecAddPfS_S_m .cfi_startproc # %bb.0: subq $120, %rsp .cfi_def_cfa_offset 128 movq %rdi, 72(%rsp) movq %rsi, 64(%rsp) movq %rdx, 56(%rsp) movq %rcx, 48(%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 48(%rsp), %rax movq %rax, 104(%rsp) 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 80(%rsp), %r9 movl $_Z6vecAddPfS_S_m, %edi pushq (%rsp) .cfi_adjust_cfa_offset 8 pushq 16(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $136, %rsp .cfi_adjust_cfa_offset -136 retq .Lfunc_end0: .size _Z21__device_stub__vecAddPfS_S_m, .Lfunc_end0-_Z21__device_stub__vecAddPfS_S_m .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 $_Z6vecAddPfS_S_m, %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 _Z6vecAddPfS_S_m,@object # @_Z6vecAddPfS_S_m .section .rodata,"a",@progbits .globl _Z6vecAddPfS_S_m .p2align 3, 0x0 _Z6vecAddPfS_S_m: .quad _Z21__device_stub__vecAddPfS_S_m .size _Z6vecAddPfS_S_m, 8 .type .L__unnamed_1,@object # @0 .section .rodata.str1.1,"aMS",@progbits,1 .L__unnamed_1: .asciz "_Z6vecAddPfS_S_m" .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 _Z21__device_stub__vecAddPfS_S_m .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z6vecAddPfS_S_m .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 : _Z6vecAddPfS_S_m .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*/ ISETP.NE.U32.AND P0, PT, RZ, c[0x0][0x178], PT ; /* 0x00005e00ff007a0c */ /* 0x000fc80003f05070 */ /*0020*/ ISETP.NE.AND.EX P0, PT, RZ, c[0x0][0x17c], PT, P0 ; /* 0x00005f00ff007a0c */ /* 0x000fda0003f05300 */ /*0030*/ @!P0 EXIT ; /* 0x000000000000894d */ /* 0x000fea0003800000 */ /*0040*/ IMAD.MOV.U32 R0, RZ, RZ, 0x1 ; /* 0x00000001ff007424 */ /* 0x000fe200078e00ff */ /*0050*/ UMOV UR6, 0x8 ; /* 0x0000000800067882 */ /* 0x000fe20000000000 */ /*0060*/ IMAD.MOV.U32 R2, RZ, RZ, c[0x0][0x17c] ; /* 0x00005f00ff027624 */ /* 0x000fe200078e00ff */ /*0070*/ ULDC.64 UR8, c[0x0][0x168] ; /* 0x00005a0000087ab9 */ /* 0x000fe20000000a00 */ /*0080*/ CS2R R8, SRZ ; /* 0x0000000000087805 */ /* 0x000fe2000001ff00 */ /*0090*/ IADD3 R0, P1, -R0, c[0x0][0x178], RZ ; /* 0x00005e0000007a10 */ /* 0x000fe20007f3e1ff */ /*00a0*/ ULDC.64 UR4, c[0x0][0x170] ; /* 0x00005c0000047ab9 */ /* 0x000fe40000000a00 */ /*00b0*/ UIADD3 UR8, UP0, UR6, UR8, URZ ; /* 0x0000000806087290 */ /* 0x000fe2000ff1e03f */ /*00c0*/ ISETP.GE.U32.AND P0, PT, R0, 0x3, PT ; /* 0x000000030000780c */ /* 0x000fe20003f06070 */ /*00d0*/ IMAD.MOV.U32 R0, RZ, RZ, c[0x0][0x178] ; /* 0x00005e00ff007624 */ /* 0x000fe200078e00ff */ /*00e0*/ IADD3.X R2, R2, -0x1, RZ, P1, !PT ; /* 0xffffffff02027810 */ /* 0x000fe20000ffe4ff */ /*00f0*/ UIADD3 UR6, UP1, UR6, UR4, URZ ; /* 0x0000000406067290 */ /* 0x000fc4000ff3e03f */ /*0100*/ UIADD3.X UR9, URZ, UR9, URZ, UP0, !UPT ; /* 0x000000093f097290 */ /* 0x000fe200087fe43f */ /*0110*/ LOP3.LUT R0, R0, 0x3, RZ, 0xc0, !PT ; /* 0x0000000300007812 */ /* 0x000fe200078ec0ff */ /*0120*/ UIADD3.X UR7, URZ, UR5, URZ, UP1, !UPT ; /* 0x000000053f077290 */ /* 0x000fe20008ffe43f */ /*0130*/ ISETP.GE.U32.AND.EX P0, PT, R2, RZ, PT, P0 ; /* 0x000000ff0200720c */ /* 0x000fe20003f06100 */ /*0140*/ ULDC.64 UR10, c[0x0][0x118] ; /* 0x00004600000a7ab9 */ /* 0x000fe20000000a00 */ /*0150*/ IADD3 R23, P1, R0, -c[0x0][0x178], RZ ; /* 0x80005e0000177a10 */ /* 0x000fca0007f3e0ff */ /*0160*/ IMAD.X R24, RZ, RZ, ~c[0x0][0x17c], P1 ; /* 0x80005f00ff187624 */ /* 0x000fe400008e06ff */ /*0170*/ CS2R R10, SRZ ; /* 0x00000000000a7805 */ /* 0x003fcc000001ff00 */ /*0180*/ IADD3 R12, P1, R8, R11, RZ ; /* 0x0000000b080c7210 */ /* 0x000fe20007f3e0ff */ /*0190*/ CS2R R14, SRZ ; /* 0x00000000000e7805 */ /* 0x000fe2000001ff00 */ /*01a0*/ IADD3 R11, P2, R11, 0x1, RZ ; /* 0x000000010b0b7810 */ /* 0x000fc60007f5e0ff */ /*01b0*/ IMAD.X R13, R9, 0x1, R10.reuse, P1 ; /* 0x00000001090d7824 */ /* 0x100fe200008e060a */ /*01c0*/ ISETP.GE.U32.AND P1, PT, R11, c[0x0][0x178], PT ; /* 0x00005e000b007a0c */ /* 0x000fe20003f26070 */ /*01d0*/ IMAD.X R10, RZ, RZ, R10, P2 ; /* 0x000000ffff0a7224 */ /* 0x000fe200010e060a */ /*01e0*/ LEA R2, P2, R12, c[0x0][0x160], 0x2 ; /* 0x000058000c027a11 */ /* 0x000fc800078410ff */ /*01f0*/ ISETP.GE.U32.AND.EX P1, PT, R10, c[0x0][0x17c], PT, P1 ; /* 0x00005f000a007a0c */ /* 0x000fe40003f26110 */ /*0200*/ LEA.HI.X R3, R12, c[0x0][0x164], R13, 0x2, P2 ; /* 0x000059000c037a11 */ /* 0x003fe400010f140d */ /*0210*/ IADD3 R16, P2, R15, R12, RZ ; /* 0x0000000c0f107210 */ /* 0x000fe20007f5e0ff */ /*0220*/ IMAD.MOV.U32 R17, RZ, RZ, RZ ; /* 0x000000ffff117224 */ /* 0x000fe400078e00ff */ /*0230*/ IMAD.MOV.U32 R19, RZ, RZ, RZ ; /* 0x000000ffff137224 */ /* 0x000fe400078e00ff */ /*0240*/ IMAD.X R18, R14, 0x1, R13, P2 ; /* 0x000000010e127824 */ /* 0x003fc800010e060d */ /*0250*/ IADD3 R21, P3, R15, R17, RZ ; /* 0x000000110f157210 */ /* 0x002fe20007f7e0ff */ /*0260*/ UMOV UR4, URZ ; /* 0x0000003f00047c82 */ /* 0x000fe20008000000 */ /*0270*/ ISETP.NE.U32.AND P2, PT, R0, RZ, PT ; /* 0x000000ff0000720c */ /* 0x000fe20003f45070 */ /*0280*/ UMOV UR5, URZ ; /* 0x0000003f00057c82 */ /* 0x000fc40008000000 */ /*0290*/ IMAD.X R20, R14, 0x1, R19, P3 ; /* 0x000000010e147824 */ /* 0x000fe200018e0613 */ /*02a0*/ ISETP.NE.AND.EX P2, PT, RZ, RZ, PT, P2 ; /* 0x000000ffff00720c */ /* 0x000fe20003f45320 */ /*02b0*/ @!P0 BRA 0x510 ; /* 0x0000025000008947 */ /* 0x001fd80003800000 */ /*02c0*/ IADD3 R27, P4, R17, R16, RZ ; /* 0x00000010111b7210 */ /* 0x000fe20007f9e0ff */ /*02d0*/ UMOV UR4, URZ ; /* 0x0000003f00047c82 */ /* 0x000fe20008000000 */ /*02e0*/ LEA R4, P3, R21, UR8, 0x2 ; /* 0x0000000815047c11 */ /* 0x000fe2000f8610ff */ /*02f0*/ UMOV UR5, URZ ; /* 0x0000003f00057c82 */ /* 0x000fe20008000000 */ /*0300*/ LEA R22, P5, R27, UR6, 0x2 ; /* 0x000000061b167c11 */ /* 0x000fe2000f8a10ff */ /*0310*/ IMAD.X R6, R19, 0x1, R18, P4 ; /* 0x0000000113067824 */ /* 0x000fe200020e0612 */ /*0320*/ LEA.HI.X R5, R21, UR9, R20, 0x2, P3 ; /* 0x0000000915057c11 */ /* 0x000fc800098f1414 */ /*0330*/ LEA.HI.X R27, R27, UR7, R6, 0x2, P5 ; /* 0x000000071b1b7c11 */ /* 0x000fe4000a8f1406 */ /*0340*/ LDG.E R7, [R2.64] ; /* 0x0000000a02077981 */ /* 0x000ea8000c1e1900 */ /*0350*/ LDG.E R6, [R4.64+-0x8] ; /* 0xfffff80a04067981 */ /* 0x000ea4000c1e1900 */ /*0360*/ FADD R25, R6, R7 ; /* 0x0000000706197221 */ /* 0x004fe40000000000 */ /*0370*/ IMAD.MOV.U32 R6, RZ, RZ, R22 ; /* 0x000000ffff067224 */ /* 0x000fe400078e0016 */ /*0380*/ IMAD.MOV.U32 R7, RZ, RZ, R27 ; /* 0x000000ffff077224 */ /* 0x000fca00078e001b */ /*0390*/ STG.E [R6.64+-0x8], R25 ; /* 0xfffff81906007986 */ /* 0x0001e8000c10190a */ /*03a0*/ LDG.E R22, [R4.64+-0x4] ; /* 0xfffffc0a04167981 */ /* 0x000ea8000c1e1900 */ /*03b0*/ LDG.E R27, [R2.64] ; /* 0x0000000a021b7981 */ /* 0x000ea4000c1e1900 */ /*03c0*/ FADD R27, R22, R27 ; /* 0x0000001b161b7221 */ /* 0x004fca0000000000 */ /*03d0*/ STG.E [R6.64+-0x4], R27 ; /* 0xfffffc1b06007986 */ /* 0x0003e8000c10190a */ /*03e0*/ LDG.E R22, [R4.64] ; /* 0x0000000a04167981 */ /* 0x000ea8000c1e1900 */ /*03f0*/ LDG.E R29, [R2.64] ; /* 0x0000000a021d7981 */ /* 0x000ea4000c1e1900 */ /*0400*/ FADD R29, R22, R29 ; /* 0x0000001d161d7221 */ /* 0x004fca0000000000 */ /*0410*/ STG.E [R6.64], R29 ; /* 0x0000001d06007986 */ /* 0x0005e8000c10190a */ /*0420*/ LDG.E R22, [R4.64+0x4] ; /* 0x0000040a04167981 */ /* 0x000e28000c1e1900 */ /*0430*/ LDG.E R26, [R2.64] ; /* 0x0000000a021a7981 */ /* 0x000e22000c1e1900 */ /*0440*/ UIADD3 UR4, UP0, UR4, 0x4, URZ ; /* 0x0000000404047890 */ /* 0x000fc8000ff1e03f */ /*0450*/ UIADD3.X UR5, URZ, UR5, URZ, UP0, !UPT ; /* 0x000000053f057290 */ /* 0x000fe200087fe43f */ /*0460*/ FADD R25, R22, R26 ; /* 0x0000001a16197221 */ /* 0x001fe20000000000 */ /*0470*/ IADD3 R22, P4, R23, UR4, RZ ; /* 0x0000000417167c10 */ /* 0x000fc8000ff9e0ff */ /*0480*/ ISETP.NE.U32.AND P3, PT, R22, RZ, PT ; /* 0x000000ff1600720c */ /* 0x000fe20003f65070 */ /*0490*/ STG.E [R6.64+0x4], R25 ; /* 0x0000041906007986 */ /* 0x0005e2000c10190a */ /*04a0*/ IADD3.X R22, R24, UR5, RZ, P4, !PT ; /* 0x0000000518167c10 */ /* 0x000fe4000a7fe4ff */ /*04b0*/ IADD3 R4, P4, R4, 0x10, RZ ; /* 0x0000001004047810 */ /* 0x000fe40007f9e0ff */ /*04c0*/ ISETP.NE.AND.EX P3, PT, R22, RZ, PT, P3 ; /* 0x000000ff1600720c */ /* 0x000fe40003f65330 */ /*04d0*/ IADD3 R22, P5, R6, 0x10, RZ ; /* 0x0000001006167810 */ /* 0x000fe20007fbe0ff */ /*04e0*/ IMAD.X R5, RZ, RZ, R5, P4 ; /* 0x000000ffff057224 */ /* 0x000fc800020e0605 */ /*04f0*/ IMAD.X R27, RZ, RZ, R7, P5 ; /* 0x000000ffff1b7224 */ /* 0x002fcc00028e0607 */ /*0500*/ @P3 BRA 0x340 ; /* 0xfffffe3000003947 */ /* 0x004fea000383ffff */ /*0510*/ @!P2 BRA 0x6c0 ; /* 0x000001a00000a947 */ /* 0x000fea0003800000 */ /*0520*/ IADD3 R5, P2, R21, UR4, RZ ; /* 0x0000000415057c10 */ /* 0x000fe2000ff5e0ff */ /*0530*/ LDG.E R25, [R2.64] ; /* 0x0000000a02197981 */ /* 0x000ea6000c1e1900 */ /*0540*/ IADD3.X R6, R20, UR5, RZ, P2, !PT ; /* 0x0000000514067c10 */ /* 0x000fe400097fe4ff */ /*0550*/ LEA R4, P2, R5, c[0x0][0x168], 0x2 ; /* 0x00005a0005047a11 */ /* 0x000fc800078410ff */ /*0560*/ LEA.HI.X R5, R5, c[0x0][0x16c], R6, 0x2, P2 ; /* 0x00005b0005057a11 */ /* 0x000fca00010f1406 */ /*0570*/ LDG.E R22, [R4.64] ; /* 0x0000000a04167981 */ /* 0x000ea2000c1e1900 */ /*0580*/ IADD3 R21, P2, P3, R21, UR4, R12 ; /* 0x0000000415157c10 */ /* 0x000fc8000fb5e00c */ /*0590*/ IADD3.X R20, R20, UR5, R13, P2, P3 ; /* 0x0000000514147c10 */ /* 0x000fe400097e640d */ /*05a0*/ LEA R6, P2, R21, c[0x0][0x170], 0x2 ; /* 0x00005c0015067a11 */ /* 0x000fc800078410ff */ /*05b0*/ LEA.HI.X R7, R21, c[0x0][0x174], R20, 0x2, P2 ; /* 0x00005d0015077a11 */ /* 0x000fe400010f1414 */ /*05c0*/ ISETP.NE.U32.AND P2, PT, R0, 0x1, PT ; /* 0x000000010000780c */ /* 0x000fc80003f45070 */ /*05d0*/ ISETP.NE.AND.EX P2, PT, RZ, RZ, PT, P2 ; /* 0x000000ffff00720c */ /* 0x000fe20003f45320 */ /*05e0*/ FADD R25, R22, R25 ; /* 0x0000001916197221 */ /* 0x004fca0000000000 */ /*05f0*/ STG.E [R6.64], R25 ; /* 0x0000001906007986 */ /* 0x0001ee000c10190a */ /*0600*/ @!P2 BRA 0x6c0 ; /* 0x000000b00000a947 */ /* 0x000fea0003800000 */ /*0610*/ LDG.E R20, [R4.64+0x4] ; /* 0x0000040a04147981 */ /* 0x000ea8000c1e1900 */ /*0620*/ LDG.E R21, [R2.64] ; /* 0x0000000a02157981 */ /* 0x000ea2000c1e1900 */ /*0630*/ ISETP.NE.U32.AND P2, PT, R0, 0x2, PT ; /* 0x000000020000780c */ /* 0x000fc80003f45070 */ /*0640*/ ISETP.NE.AND.EX P2, PT, RZ, RZ, PT, P2 ; /* 0x000000ffff00720c */ /* 0x000fe20003f45320 */ /*0650*/ FADD R21, R20, R21 ; /* 0x0000001514157221 */ /* 0x004fca0000000000 */ /*0660*/ STG.E [R6.64+0x4], R21 ; /* 0x0000041506007986 */ /* 0x0003ee000c10190a */ /*0670*/ @!P2 BRA 0x6c0 ; /* 0x000000400000a947 */ /* 0x000fea0003800000 */ /*0680*/ LDG.E R5, [R4.64+0x8] ; /* 0x0000080a04057981 */ /* 0x000ea8000c1e1900 */ /*0690*/ LDG.E R20, [R2.64] ; /* 0x0000000a02147981 */ /* 0x000ea4000c1e1900 */ /*06a0*/ FADD R21, R20, R5 ; /* 0x0000000514157221 */ /* 0x006fca0000000000 */ /*06b0*/ STG.E [R6.64+0x8], R21 ; /* 0x0000081506007986 */ /* 0x0003e4000c10190a */ /*06c0*/ IADD3 R17, P2, R17, 0x1, RZ ; /* 0x0000000111117810 */ /* 0x000fca0007f5e0ff */ /*06d0*/ IMAD.X R19, RZ, RZ, R19, P2 ; /* 0x000000ffff137224 */ /* 0x000fe200010e0613 */ /*06e0*/ ISETP.GE.U32.AND P2, PT, R17, c[0x0][0x178], PT ; /* 0x00005e0011007a0c */ /* 0x000fc80003f46070 */ /*06f0*/ ISETP.GE.U32.AND.EX P2, PT, R19, c[0x0][0x17c], PT, P2 ; /* 0x00005f0013007a0c */ /* 0x000fda0003f46120 */ /*0700*/ @!P2 BRA 0x250 ; /* 0xfffffb400000a947 */ /* 0x000fea000383ffff */ /*0710*/ IADD3 R15, P2, R15, 0x1, RZ ; /* 0x000000010f0f7810 */ /* 0x000fca0007f5e0ff */ /*0720*/ IMAD.X R14, RZ, RZ, R14, P2 ; /* 0x000000ffff0e7224 */ /* 0x000fe200010e060e */ /*0730*/ ISETP.GE.U32.AND P2, PT, R15, c[0x0][0x178], PT ; /* 0x00005e000f007a0c */ /* 0x000fc80003f46070 */ /*0740*/ ISETP.GE.U32.AND.EX P2, PT, R14, c[0x0][0x17c], PT, P2 ; /* 0x00005f000e007a0c */ /* 0x000fda0003f46120 */ /*0750*/ @!P2 BRA 0x210 ; /* 0xfffffab00000a947 */ /* 0x000fea000383ffff */ /*0760*/ @!P1 BRA 0x180 ; /* 0xfffffa1000009947 */ /* 0x000fea000383ffff */ /*0770*/ IADD3 R8, P1, R8, 0x1, RZ ; /* 0x0000000108087810 */ /* 0x000fca0007f3e0ff */ /*0780*/ IMAD.X R9, RZ, RZ, R9, P1 ; /* 0x000000ffff097224 */ /* 0x000fe200008e0609 */ /*0790*/ ISETP.GE.U32.AND P1, PT, R8, c[0x0][0x178], PT ; /* 0x00005e0008007a0c */ /* 0x000fc80003f26070 */ /*07a0*/ ISETP.GE.U32.AND.EX P1, PT, R9, c[0x0][0x17c], PT, P1 ; /* 0x00005f0009007a0c */ /* 0x000fda0003f26110 */ /*07b0*/ @!P1 BRA 0x170 ; /* 0xfffff9b000009947 */ /* 0x000fea000383ffff */ /*07c0*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*07d0*/ BRA 0x7d0; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*07e0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*07f0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0800*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0810*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0820*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0830*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0840*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0850*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0860*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0870*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ ..........
.text .amdgcn_target "amdgcn-amd-amdhsa--gfx1100" .protected _Z6vecAddPfS_S_m .globl _Z6vecAddPfS_S_m .p2align 8 .type _Z6vecAddPfS_S_m,@function _Z6vecAddPfS_S_m: s_load_b64 s[2:3], s[0:1], 0x18 s_mov_b64 s[8:9], 0 s_waitcnt lgkmcnt(0) s_cmp_eq_u64 s[2:3], 0 s_cbranch_scc1 .LBB0_11 s_clause 0x1 s_load_b128 s[4:7], s[0:1], 0x0 s_load_b64 s[0:1], s[0:1], 0x10 v_mov_b32_e32 v0, 0 .LBB0_2: s_mov_b64 s[10:11], 0 s_waitcnt lgkmcnt(0) s_mov_b64 s[12:13], s[0:1] .LBB0_3: s_add_u32 s16, s10, s8 s_addc_u32 s17, s11, s9 s_mov_b64 s[14:15], s[6:7] s_lshl_b64 s[18:19], s[16:17], 2 s_mov_b64 s[16:17], s[12:13] s_add_u32 s18, s4, s18 s_addc_u32 s19, s5, s19 s_mov_b64 s[20:21], 0 s_set_inst_prefetch_distance 0x1 .p2align 6 .LBB0_4: s_mov_b64 s[22:23], 0 s_mov_b64 s[24:25], s[14:15] s_mov_b64 s[26:27], s[16:17] .p2align 6 .LBB0_5: s_mov_b64 s[28:29], s[24:25] s_mov_b64 s[30:31], s[26:27] s_mov_b64 s[34:35], s[2:3] .LBB0_6: s_clause 0x1 global_load_b32 v1, v0, s[18:19] global_load_b32 v2, v0, s[28:29] s_add_u32 s34, s34, -1 s_addc_u32 s35, s35, -1 s_waitcnt vmcnt(0) v_add_f32_e32 v1, v1, v2 global_store_b32 v0, v1, s[30:31] s_add_u32 s30, s30, 4 s_addc_u32 s31, s31, 0 s_add_u32 s28, s28, 4 s_addc_u32 s29, s29, 0 s_cmp_eq_u64 s[34:35], 0 s_cbranch_scc0 .LBB0_6 s_add_u32 s22, s22, 1 s_addc_u32 s23, s23, 0 s_add_u32 s26, s26, 4 s_addc_u32 s27, s27, 0 s_add_u32 s24, s24, 4 s_addc_u32 s25, s25, 0 s_cmp_eq_u64 s[22:23], s[2:3] s_cbranch_scc0 .LBB0_5 s_add_u32 s20, s20, 1 s_addc_u32 s21, s21, 0 s_add_u32 s16, s16, 4 s_addc_u32 s17, s17, 0 s_add_u32 s14, s14, 4 s_addc_u32 s15, s15, 0 s_cmp_eq_u64 s[20:21], s[2:3] s_cbranch_scc0 .LBB0_4 s_set_inst_prefetch_distance 0x2 s_add_u32 s10, s10, 1 s_addc_u32 s11, s11, 0 s_add_u32 s12, s12, 4 s_addc_u32 s13, s13, 0 s_cmp_eq_u64 s[10:11], s[2:3] s_cbranch_scc0 .LBB0_3 s_add_u32 s8, s8, 1 s_addc_u32 s9, s9, 0 s_add_u32 s0, s0, 4 s_addc_u32 s1, s1, 0 s_cmp_eq_u64 s[8:9], s[2:3] s_cbranch_scc0 .LBB0_2 .LBB0_11: s_nop 0 s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z6vecAddPfS_S_m .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 36 .amdhsa_reserve_vcc 0 .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 _Z6vecAddPfS_S_m, .Lfunc_end0-_Z6vecAddPfS_S_m .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: 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: 1024 .name: _Z6vecAddPfS_S_m .private_segment_fixed_size: 0 .sgpr_count: 36 .sgpr_spill_count: 0 .symbol: _Z6vecAddPfS_S_m.kd .uniform_work_group_size: 1 .uses_dynamic_stack: false .vgpr_count: 3 .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_00007383_00000000-6_loop6.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 _Z30__device_stub__Z6vecAddPfS_S_mPfS_S_m .type _Z30__device_stub__Z6vecAddPfS_S_mPfS_S_m, @function _Z30__device_stub__Z6vecAddPfS_S_mPfS_S_m: .LFB2051: .cfi_startproc endbr64 subq $152, %rsp .cfi_def_cfa_offset 160 movq %rdi, 24(%rsp) movq %rsi, 16(%rsp) movq %rdx, 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 16(%rsp), %rax movq %rax, 104(%rsp) leaq 8(%rsp), %rax movq %rax, 112(%rsp) movq %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 _Z6vecAddPfS_S_m(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 160 jmp .L3 .L8: call __stack_chk_fail@PLT .cfi_endproc .LFE2051: .size _Z30__device_stub__Z6vecAddPfS_S_mPfS_S_m, .-_Z30__device_stub__Z6vecAddPfS_S_mPfS_S_m .globl _Z6vecAddPfS_S_m .type _Z6vecAddPfS_S_m, @function _Z6vecAddPfS_S_m: .LFB2052: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z30__device_stub__Z6vecAddPfS_S_mPfS_S_m addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2052: .size _Z6vecAddPfS_S_m, .-_Z6vecAddPfS_S_m .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "_Z6vecAddPfS_S_m" .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 _Z6vecAddPfS_S_m(%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 "loop6.hip" .globl _Z21__device_stub__vecAddPfS_S_m # -- Begin function _Z21__device_stub__vecAddPfS_S_m .p2align 4, 0x90 .type _Z21__device_stub__vecAddPfS_S_m,@function _Z21__device_stub__vecAddPfS_S_m: # @_Z21__device_stub__vecAddPfS_S_m .cfi_startproc # %bb.0: subq $120, %rsp .cfi_def_cfa_offset 128 movq %rdi, 72(%rsp) movq %rsi, 64(%rsp) movq %rdx, 56(%rsp) movq %rcx, 48(%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 48(%rsp), %rax movq %rax, 104(%rsp) 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 80(%rsp), %r9 movl $_Z6vecAddPfS_S_m, %edi pushq (%rsp) .cfi_adjust_cfa_offset 8 pushq 16(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $136, %rsp .cfi_adjust_cfa_offset -136 retq .Lfunc_end0: .size _Z21__device_stub__vecAddPfS_S_m, .Lfunc_end0-_Z21__device_stub__vecAddPfS_S_m .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 $_Z6vecAddPfS_S_m, %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 _Z6vecAddPfS_S_m,@object # @_Z6vecAddPfS_S_m .section .rodata,"a",@progbits .globl _Z6vecAddPfS_S_m .p2align 3, 0x0 _Z6vecAddPfS_S_m: .quad _Z21__device_stub__vecAddPfS_S_m .size _Z6vecAddPfS_S_m, 8 .type .L__unnamed_1,@object # @0 .section .rodata.str1.1,"aMS",@progbits,1 .L__unnamed_1: .asciz "_Z6vecAddPfS_S_m" .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 _Z21__device_stub__vecAddPfS_S_m .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z6vecAddPfS_S_m .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 <math.h> #include <cuda_runtime_api.h> #include <cuda.h> __global__ void add(int n, float *x, float *y) { int index = threadIdx.x; int stride = blockDim.x; for (int i = 0; i < n; i++){ y[i] = x[i] + y[i]; } } int main(void) { int N = 1<<20; float *x, *y; // allocate unified memory cudaMallocManaged(&x, N*sizeof(float)); cudaMallocManaged(&y, N*sizeof(float)); for (int i = 0; i < N; i++){ x[i] = 1.0f; y[i] = 2.0f; } // run the kernel on 1M elements add<<<1, 256>>>(N, x, y); cudaDeviceSynchronize(); float max_error = 0.0f; for (int i = 0; i < N; i++) max_error = fmax(max_error, fabs(y[i]-3.0f)); std::cout << "max error " << max_error <<std::endl; // free cuda memory cudaFree(x); cudaFree(y); return 0; }
code for sm_80 Function : _Z3addiPfS_ .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*/ IMAD.MOV.U32 R0, RZ, RZ, c[0x0][0x160] ; /* 0x00005800ff007624 */ /* 0x000fca00078e00ff */ /*0020*/ ISETP.GE.AND P0, PT, R0, 0x1, PT ; /* 0x000000010000780c */ /* 0x000fda0003f06270 */ /*0030*/ @!P0 EXIT ; /* 0x000000000000894d */ /* 0x000fea0003800000 */ /*0040*/ IADD3 R2, R0.reuse, -0x1, RZ ; /* 0xffffffff00027810 */ /* 0x040fe20007ffe0ff */ /*0050*/ UMOV UR4, URZ ; /* 0x0000003f00047c82 */ /* 0x000fe20008000000 */ /*0060*/ LOP3.LUT R0, R0, 0x3, RZ, 0xc0, !PT ; /* 0x0000000300007812 */ /* 0x000fe200078ec0ff */ /*0070*/ ULDC.64 UR10, c[0x0][0x118] ; /* 0x00004600000a7ab9 */ /* 0x000fe20000000a00 */ /*0080*/ ISETP.GE.U32.AND P0, PT, R2, 0x3, PT ; /* 0x000000030200780c */ /* 0x000fda0003f06070 */ /*0090*/ @!P0 BRA 0xaa0 ; /* 0x00000a0000008947 */ /* 0x000fea0003800000 */ /*00a0*/ IADD3 R6, -R0, c[0x0][0x160], RZ ; /* 0x0000580000067a10 */ /* 0x000fe20007ffe1ff */ /*00b0*/ UMOV UR4, URZ ; /* 0x0000003f00047c82 */ /* 0x000fe20008000000 */ /*00c0*/ MOV R4, c[0x0][0x170] ; /* 0x00005c0000047a02 */ /* 0x000fe20000000f00 */ /*00d0*/ IMAD.MOV.U32 R5, RZ, RZ, c[0x0][0x174] ; /* 0x00005d00ff057624 */ /* 0x000fe200078e00ff */ /*00e0*/ ISETP.GT.AND P0, PT, R6, RZ, PT ; /* 0x000000ff0600720c */ /* 0x000fe20003f04270 */ /*00f0*/ IMAD.MOV.U32 R3, RZ, RZ, c[0x0][0x16c] ; /* 0x00005b00ff037624 */ /* 0x000fe200078e00ff */ /*0100*/ MOV R2, c[0x0][0x168] ; /* 0x00005a0000027a02 */ /* 0x000fd60000000f00 */ /*0110*/ @!P0 BRA 0x8f0 ; /* 0x000007d000008947 */ /* 0x000fea0003800000 */ /*0120*/ ISETP.GT.AND P1, PT, R6, 0xc, PT ; /* 0x0000000c0600780c */ /* 0x000fe40003f24270 */ /*0130*/ PLOP3.LUT P0, PT, PT, PT, PT, 0x80, 0x0 ; /* 0x000000000000781c */ /* 0x000fd60003f0f070 */ /*0140*/ @!P1 BRA 0x610 ; /* 0x000004c000009947 */ /* 0x000fea0003800000 */ /*0150*/ PLOP3.LUT P0, PT, PT, PT, PT, 0x8, 0x0 ; /* 0x000000000000781c */ /* 0x000fe40003f0e170 */ /*0160*/ LDG.E R7, [R4.64] ; /* 0x0000000a04077981 */ /* 0x000ea8000c1e1900 */ /*0170*/ LDG.E R8, [R2.64] ; /* 0x0000000a02087981 */ /* 0x000ea4000c1e1900 */ /*0180*/ FADD R7, R7, R8 ; /* 0x0000000807077221 */ /* 0x004fe40000000000 */ /*0190*/ LDG.E R8, [R4.64+0x4] ; /* 0x0000040a04087981 */ /* 0x000ea8000c1e1900 */ /*01a0*/ STG.E [R4.64], R7 ; /* 0x0000000704007986 */ /* 0x0001e8000c10190a */ /*01b0*/ LDG.E R9, [R2.64+0x4] ; /* 0x0000040a02097981 */ /* 0x000ea8000c1e1900 */ /*01c0*/ LDG.E R7, [R4.64+0x10] ; /* 0x0000100a04077981 */ /* 0x001ee2000c1e1900 */ /*01d0*/ FADD R9, R8, R9 ; /* 0x0000000908097221 */ /* 0x004fc60000000000 */ /*01e0*/ LDG.E R8, [R4.64+0x8] ; /* 0x0000080a04087981 */ /* 0x000ea8000c1e1900 */ /*01f0*/ STG.E [R4.64+0x4], R9 ; /* 0x0000040904007986 */ /* 0x0001e8000c10190a */ /*0200*/ LDG.E R11, [R2.64+0x8] ; /* 0x0000080a020b7981 */ /* 0x000ea4000c1e1900 */ /*0210*/ FADD R11, R8, R11 ; /* 0x0000000b080b7221 */ /* 0x004fc40000000000 */ /*0220*/ LDG.E R8, [R4.64+0xc] ; /* 0x00000c0a04087981 */ /* 0x000ea8000c1e1900 */ /*0230*/ STG.E [R4.64+0x8], R11 ; /* 0x0000080b04007986 */ /* 0x000fe8000c10190a */ /*0240*/ LDG.E R13, [R2.64+0xc] ; /* 0x00000c0a020d7981 */ /* 0x000ea4000c1e1900 */ /*0250*/ FADD R13, R8, R13 ; /* 0x0000000d080d7221 */ /* 0x004fca0000000000 */ /*0260*/ STG.E [R4.64+0xc], R13 ; /* 0x00000c0d04007986 */ /* 0x000fe8000c10190a */ /*0270*/ LDG.E R8, [R2.64+0x10] ; /* 0x0000100a02087981 */ /* 0x000ee4000c1e1900 */ /*0280*/ FADD R7, R7, R8 ; /* 0x0000000807077221 */ /* 0x008fe40000000000 */ /*0290*/ LDG.E R8, [R4.64+0x14] ; /* 0x0000140a04087981 */ /* 0x000ea8000c1e1900 */ /*02a0*/ STG.E [R4.64+0x10], R7 ; /* 0x0000100704007986 */ /* 0x0003e8000c10190a */ /*02b0*/ LDG.E R9, [R2.64+0x14] ; /* 0x0000140a02097981 */ /* 0x001ea8000c1e1900 */ /*02c0*/ LDG.E R7, [R4.64+0x20] ; /* 0x0000200a04077981 */ /* 0x002ee2000c1e1900 */ /*02d0*/ FADD R9, R8, R9 ; /* 0x0000000908097221 */ /* 0x004fc60000000000 */ /*02e0*/ LDG.E R8, [R4.64+0x18] ; /* 0x0000180a04087981 */ /* 0x000ea8000c1e1900 */ /*02f0*/ STG.E [R4.64+0x14], R9 ; /* 0x0000140904007986 */ /* 0x0001e8000c10190a */ /*0300*/ LDG.E R11, [R2.64+0x18] ; /* 0x0000180a020b7981 */ /* 0x000ea4000c1e1900 */ /*0310*/ FADD R11, R8, R11 ; /* 0x0000000b080b7221 */ /* 0x004fc40000000000 */ /*0320*/ LDG.E R8, [R4.64+0x1c] ; /* 0x00001c0a04087981 */ /* 0x000ea8000c1e1900 */ /*0330*/ STG.E [R4.64+0x18], R11 ; /* 0x0000180b04007986 */ /* 0x000fe8000c10190a */ /*0340*/ LDG.E R13, [R2.64+0x1c] ; /* 0x00001c0a020d7981 */ /* 0x000ea4000c1e1900 */ /*0350*/ FADD R13, R8, R13 ; /* 0x0000000d080d7221 */ /* 0x004fca0000000000 */ /*0360*/ STG.E [R4.64+0x1c], R13 ; /* 0x00001c0d04007986 */ /* 0x000fe8000c10190a */ /*0370*/ LDG.E R8, [R2.64+0x20] ; /* 0x0000200a02087981 */ /* 0x000ee4000c1e1900 */ /*0380*/ FADD R7, R7, R8 ; /* 0x0000000807077221 */ /* 0x008fe40000000000 */ /*0390*/ LDG.E R8, [R4.64+0x24] ; /* 0x0000240a04087981 */ /* 0x000ea8000c1e1900 */ /*03a0*/ STG.E [R4.64+0x20], R7 ; /* 0x0000200704007986 */ /* 0x0003e8000c10190a */ /*03b0*/ LDG.E R9, [R2.64+0x24] ; /* 0x0000240a02097981 */ /* 0x001ea8000c1e1900 */ /*03c0*/ LDG.E R7, [R4.64+0x30] ; /* 0x0000300a04077981 */ /* 0x002ee2000c1e1900 */ /*03d0*/ FADD R9, R8, R9 ; /* 0x0000000908097221 */ /* 0x004fc60000000000 */ /*03e0*/ LDG.E R8, [R4.64+0x28] ; /* 0x0000280a04087981 */ /* 0x000ea8000c1e1900 */ /*03f0*/ STG.E [R4.64+0x24], R9 ; /* 0x0000240904007986 */ /* 0x0001e8000c10190a */ /*0400*/ LDG.E R11, [R2.64+0x28] ; /* 0x0000280a020b7981 */ /* 0x000ea4000c1e1900 */ /*0410*/ FADD R11, R8, R11 ; /* 0x0000000b080b7221 */ /* 0x004fc40000000000 */ /*0420*/ LDG.E R8, [R4.64+0x2c] ; /* 0x00002c0a04087981 */ /* 0x000ea8000c1e1900 */ /*0430*/ STG.E [R4.64+0x28], R11 ; /* 0x0000280b04007986 */ /* 0x0003e8000c10190a */ /*0440*/ LDG.E R13, [R2.64+0x2c] ; /* 0x00002c0a020d7981 */ /* 0x000ea4000c1e1900 */ /*0450*/ FADD R13, R8, R13 ; /* 0x0000000d080d7221 */ /* 0x004fca0000000000 */ /*0460*/ STG.E [R4.64+0x2c], R13 ; /* 0x00002c0d04007986 */ /* 0x0005e8000c10190a */ /*0470*/ LDG.E R8, [R2.64+0x30] ; /* 0x0000300a02087981 */ /* 0x000ee4000c1e1900 */ /*0480*/ FADD R7, R7, R8 ; /* 0x0000000807077221 */ /* 0x008fe40000000000 */ /*0490*/ LDG.E R8, [R4.64+0x34] ; /* 0x0000340a04087981 */ /* 0x000ee8000c1e1900 */ /*04a0*/ STG.E [R4.64+0x30], R7 ; /* 0x0000300704007986 */ /* 0x0009e8000c10190a */ /*04b0*/ LDG.E R9, [R2.64+0x34] ; /* 0x0000340a02097981 */ /* 0x001ee4000c1e1900 */ /*04c0*/ FADD R9, R8, R9 ; /* 0x0000000908097221 */ /* 0x008fc40000000000 */ /*04d0*/ LDG.E R8, [R4.64+0x38] ; /* 0x0000380a04087981 */ /* 0x000ee8000c1e1900 */ /*04e0*/ STG.E [R4.64+0x34], R9 ; /* 0x0000340904007986 */ /* 0x000fe8000c10190a */ /*04f0*/ LDG.E R11, [R2.64+0x38] ; /* 0x0000380a020b7981 */ /* 0x002ee2000c1e1900 */ /*0500*/ IADD3 R6, R6, -0x10, RZ ; /* 0xfffffff006067810 */ /* 0x000fe20007ffe0ff */ /*0510*/ FADD R11, R8, R11 ; /* 0x0000000b080b7221 */ /* 0x008fc40000000000 */ /*0520*/ LDG.E R8, [R4.64+0x3c] ; /* 0x00003c0a04087981 */ /* 0x000ee8000c1e1900 */ /*0530*/ STG.E [R4.64+0x38], R11 ; /* 0x0000380b04007986 */ /* 0x000fe8000c10190a */ /*0540*/ LDG.E R13, [R2.64+0x3c] ; /* 0x00003c0a020d7981 */ /* 0x0040e2000c1e1900 */ /*0550*/ ISETP.GT.AND P1, PT, R6, 0xc, PT ; /* 0x0000000c0600780c */ /* 0x000fe40003f24270 */ /*0560*/ IADD3 R7, P3, R4, 0x40, RZ ; /* 0x0000004004077810 */ /* 0x010fe20007f7e0ff */ /*0570*/ UIADD3 UR4, UR4, 0x10, URZ ; /* 0x0000001004047890 */ /* 0x000fe2000fffe03f */ /*0580*/ IADD3 R10, P2, R2, 0x40, RZ ; /* 0x00000040020a7810 */ /* 0x000fc80007f5e0ff */ /*0590*/ IADD3.X R3, RZ, R3, RZ, P2, !PT ; /* 0x00000003ff037210 */ /* 0x001fe400017fe4ff */ /*05a0*/ MOV R2, R10 ; /* 0x0000000a00027202 */ /* 0x000fe20000000f00 */ /*05b0*/ FADD R13, R8, R13 ; /* 0x0000000d080d7221 */ /* 0x008fe40000000000 */ /*05c0*/ IMAD.X R8, RZ, RZ, R5, P3 ; /* 0x000000ffff087224 */ /* 0x000fc600018e0605 */ /*05d0*/ STG.E [R4.64+0x3c], R13 ; /* 0x00003c0d04007986 */ /* 0x0001e4000c10190a */ /*05e0*/ IMAD.MOV.U32 R4, RZ, RZ, R7 ; /* 0x000000ffff047224 */ /* 0x001fe200078e0007 */ /*05f0*/ MOV R5, R8 ; /* 0x0000000800057202 */ /* 0x000fe20000000f00 */ /*0600*/ @P1 BRA 0x160 ; /* 0xfffffb5000001947 */ /* 0x000fea000383ffff */ /*0610*/ ISETP.GT.AND P1, PT, R6, 0x4, PT ; /* 0x000000040600780c */ /* 0x000fda0003f24270 */ /*0620*/ @!P1 BRA 0x8d0 ; /* 0x000002a000009947 */ /* 0x000fea0003800000 */ /*0630*/ LDG.E R7, [R4.64] ; /* 0x0000000a04077981 */ /* 0x000ea8000c1e1900 */ /*0640*/ LDG.E R8, [R2.64] ; /* 0x0000000a02087981 */ /* 0x000ea4000c1e1900 */ /*0650*/ FADD R7, R7, R8 ; /* 0x0000000807077221 */ /* 0x004fe40000000000 */ /*0660*/ LDG.E R8, [R4.64+0x4] ; /* 0x0000040a04087981 */ /* 0x000ea8000c1e1900 */ /*0670*/ STG.E [R4.64], R7 ; /* 0x0000000704007986 */ /* 0x0001e8000c10190a */ /*0680*/ LDG.E R9, [R2.64+0x4] ; /* 0x0000040a02097981 */ /* 0x000ea8000c1e1900 */ /*0690*/ LDG.E R7, [R4.64+0x10] ; /* 0x0000100a04077981 */ /* 0x001ee2000c1e1900 */ /*06a0*/ FADD R9, R8, R9 ; /* 0x0000000908097221 */ /* 0x004fc60000000000 */ /*06b0*/ LDG.E R8, [R4.64+0x8] ; /* 0x0000080a04087981 */ /* 0x000ea8000c1e1900 */ /*06c0*/ STG.E [R4.64+0x4], R9 ; /* 0x0000040904007986 */ /* 0x0001e8000c10190a */ /*06d0*/ LDG.E R11, [R2.64+0x8] ; /* 0x0000080a020b7981 */ /* 0x000ea4000c1e1900 */ /*06e0*/ FADD R11, R8, R11 ; /* 0x0000000b080b7221 */ /* 0x004fc40000000000 */ /*06f0*/ LDG.E R8, [R4.64+0xc] ; /* 0x00000c0a04087981 */ /* 0x000ea8000c1e1900 */ /*0700*/ STG.E [R4.64+0x8], R11 ; /* 0x0000080b04007986 */ /* 0x0003e8000c10190a */ /*0710*/ LDG.E R13, [R2.64+0xc] ; /* 0x00000c0a020d7981 */ /* 0x000ea4000c1e1900 */ /*0720*/ FADD R13, R8, R13 ; /* 0x0000000d080d7221 */ /* 0x004fca0000000000 */ /*0730*/ STG.E [R4.64+0xc], R13 ; /* 0x00000c0d04007986 */ /* 0x0005e8000c10190a */ /*0740*/ LDG.E R8, [R2.64+0x10] ; /* 0x0000100a02087981 */ /* 0x000ee4000c1e1900 */ /*0750*/ FADD R7, R7, R8 ; /* 0x0000000807077221 */ /* 0x008fe40000000000 */ /*0760*/ LDG.E R8, [R4.64+0x14] ; /* 0x0000140a04087981 */ /* 0x000ee8000c1e1900 */ /*0770*/ STG.E [R4.64+0x10], R7 ; /* 0x0000100704007986 */ /* 0x0009e8000c10190a */ /*0780*/ LDG.E R9, [R2.64+0x14] ; /* 0x0000140a02097981 */ /* 0x001ee4000c1e1900 */ /*0790*/ FADD R9, R8, R9 ; /* 0x0000000908097221 */ /* 0x008fc40000000000 */ /*07a0*/ LDG.E R8, [R4.64+0x18] ; /* 0x0000180a04087981 */ /* 0x000ee8000c1e1900 */ /*07b0*/ STG.E [R4.64+0x14], R9 ; /* 0x0000140904007986 */ /* 0x000fe8000c10190a */ /*07c0*/ LDG.E R11, [R2.64+0x18] ; /* 0x0000180a020b7981 */ /* 0x002ee4000c1e1900 */ /*07d0*/ FADD R11, R8, R11 ; /* 0x0000000b080b7221 */ /* 0x008fc40000000000 */ /*07e0*/ LDG.E R8, [R4.64+0x1c] ; /* 0x00001c0a04087981 */ /* 0x000ee8000c1e1900 */ /*07f0*/ STG.E [R4.64+0x18], R11 ; /* 0x0000180b04007986 */ /* 0x000fe8000c10190a */ /*0800*/ LDG.E R13, [R2.64+0x1c] ; /* 0x00001c0a020d7981 */ /* 0x0040e2000c1e1900 */ /*0810*/ IADD3 R7, P2, R4, 0x20, RZ ; /* 0x0000002004077810 */ /* 0x010fe40007f5e0ff */ /*0820*/ IADD3 R10, P1, R2, 0x20, RZ ; /* 0x00000020020a7810 */ /* 0x000fc40007f3e0ff */ /*0830*/ PLOP3.LUT P0, PT, PT, PT, PT, 0x8, 0x0 ; /* 0x000000000000781c */ /* 0x000fe40003f0e170 */ /*0840*/ IADD3 R6, R6, -0x8, RZ ; /* 0xfffffff806067810 */ /* 0x000fe20007ffe0ff */ /*0850*/ IMAD.X R3, RZ, RZ, R3, P1 ; /* 0x000000ffff037224 */ /* 0x001fe400008e0603 */ /*0860*/ IMAD.MOV.U32 R2, RZ, RZ, R10 ; /* 0x000000ffff027224 */ /* 0x000fe200078e000a */ /*0870*/ UIADD3 UR4, UR4, 0x8, URZ ; /* 0x0000000804047890 */ /* 0x000fe2000fffe03f */ /*0880*/ FADD R13, R8, R13 ; /* 0x0000000d080d7221 */ /* 0x008fe20000000000 */ /*0890*/ IADD3.X R8, RZ, R5, RZ, P2, !PT ; /* 0x00000005ff087210 */ /* 0x000fc800017fe4ff */ /*08a0*/ STG.E [R4.64+0x1c], R13 ; /* 0x00001c0d04007986 */ /* 0x0001e4000c10190a */ /*08b0*/ MOV R4, R7 ; /* 0x0000000700047202 */ /* 0x001fe20000000f00 */ /*08c0*/ IMAD.MOV.U32 R5, RZ, RZ, R8 ; /* 0x000000ffff057224 */ /* 0x000fe400078e0008 */ /*08d0*/ ISETP.NE.OR P0, PT, R6, RZ, P0 ; /* 0x000000ff0600720c */ /* 0x000fda0000705670 */ /*08e0*/ @!P0 BRA 0xaa0 ; /* 0x000001b000008947 */ /* 0x000fea0003800000 */ /*08f0*/ LDG.E R7, [R4.64] ; /* 0x0000000a04077981 */ /* 0x000ea8000c1e1900 */ /*0900*/ LDG.E R8, [R2.64] ; /* 0x0000000a02087981 */ /* 0x000ea4000c1e1900 */ /*0910*/ FADD R7, R7, R8 ; /* 0x0000000807077221 */ /* 0x004fe40000000000 */ /*0920*/ LDG.E R8, [R4.64+0x4] ; /* 0x0000040a04087981 */ /* 0x000ea8000c1e1900 */ /*0930*/ STG.E [R4.64], R7 ; /* 0x0000000704007986 */ /* 0x0001e8000c10190a */ /*0940*/ LDG.E R9, [R2.64+0x4] ; /* 0x0000040a02097981 */ /* 0x000ea4000c1e1900 */ /*0950*/ FADD R9, R8, R9 ; /* 0x0000000908097221 */ /* 0x004fc40000000000 */ /*0960*/ LDG.E R8, [R4.64+0x8] ; /* 0x0000080a04087981 */ /* 0x000ea8000c1e1900 */ /*0970*/ STG.E [R4.64+0x4], R9 ; /* 0x0000040904007986 */ /* 0x000fe8000c10190a */ /*0980*/ LDG.E R11, [R2.64+0x8] ; /* 0x0000080a020b7981 */ /* 0x000ea2000c1e1900 */ /*0990*/ IADD3 R6, R6, -0x4, RZ ; /* 0xfffffffc06067810 */ /* 0x000fe20007ffe0ff */ /*09a0*/ FADD R11, R8, R11 ; /* 0x0000000b080b7221 */ /* 0x004fc40000000000 */ /*09b0*/ LDG.E R8, [R4.64+0xc] ; /* 0x00000c0a04087981 */ /* 0x000ea8000c1e1900 */ /*09c0*/ STG.E [R4.64+0x8], R11 ; /* 0x0000080b04007986 */ /* 0x000fe8000c10190a */ /*09d0*/ LDG.E R13, [R2.64+0xc] ; /* 0x00000c0a020d7981 */ /* 0x0002a2000c1e1900 */ /*09e0*/ ISETP.NE.AND P0, PT, R6, RZ, PT ; /* 0x000000ff0600720c */ /* 0x000fe20003f05270 */ /*09f0*/ UIADD3 UR4, UR4, 0x4, URZ ; /* 0x0000000404047890 */ /* 0x000fe2000fffe03f */ /*0a00*/ IADD3 R7, P2, R4, 0x10, RZ ; /* 0x0000001004077810 */ /* 0x001fc40007f5e0ff */ /*0a10*/ IADD3 R10, P1, R2, 0x10, RZ ; /* 0x00000010020a7810 */ /* 0x000fc80007f3e0ff */ /*0a20*/ IADD3.X R3, RZ, R3, RZ, P1, !PT ; /* 0x00000003ff037210 */ /* 0x002fe40000ffe4ff */ /*0a30*/ MOV R2, R10 ; /* 0x0000000a00027202 */ /* 0x000fe20000000f00 */ /*0a40*/ FADD R13, R8, R13 ; /* 0x0000000d080d7221 */ /* 0x004fe40000000000 */ /*0a50*/ IMAD.X R8, RZ, RZ, R5, P2 ; /* 0x000000ffff087224 */ /* 0x000fc600010e0605 */ /*0a60*/ STG.E [R4.64+0xc], R13 ; /* 0x00000c0d04007986 */ /* 0x0001e4000c10190a */ /*0a70*/ IMAD.MOV.U32 R4, RZ, RZ, R7 ; /* 0x000000ffff047224 */ /* 0x001fe200078e0007 */ /*0a80*/ MOV R5, R8 ; /* 0x0000000800057202 */ /* 0x000fe20000000f00 */ /*0a90*/ @P0 BRA 0x8f0 ; /* 0xfffffe5000000947 */ /* 0x000fea000383ffff */ /*0aa0*/ ISETP.NE.AND P0, PT, R0, RZ, PT ; /* 0x000000ff0000720c */ /* 0x000fda0003f05270 */ /*0ab0*/ @!P0 EXIT ; /* 0x000000000000894d */ /* 0x000fea0003800000 */ /*0ac0*/ UMOV UR5, 0x4 ; /* 0x0000000400057882 */ /* 0x000fe40000000000 */ /*0ad0*/ ULDC.64 UR6, c[0x0][0x170] ; /* 0x00005c0000067ab9 */ /* 0x000fe40000000a00 */ /*0ae0*/ UIMAD.WIDE UR6, UR4, UR5, UR6 ; /* 0x00000005040672a5 */ /* 0x000fe4000f8e0206 */ /*0af0*/ ULDC.64 UR8, c[0x0][0x168] ; /* 0x00005a0000087ab9 */ /* 0x000fe40000000a00 */ /*0b00*/ UIMAD.WIDE UR4, UR4, UR5, UR8 ; /* 0x00000005040472a5 */ /* 0x000fe4000f8e0208 */ /*0b10*/ IMAD.U32 R2, RZ, RZ, UR6 ; /* 0x00000006ff027e24 */ /* 0x000fe2000f8e00ff */ /*0b20*/ MOV R5, UR7 ; /* 0x0000000700057c02 */ /* 0x000fe20008000f00 */ /*0b30*/ IMAD.U32 R4, RZ, RZ, UR6 ; /* 0x00000006ff047e24 */ /* 0x000fe2000f8e00ff */ /*0b40*/ MOV R3, UR7 ; /* 0x0000000700037c02 */ /* 0x000fe20008000f00 */ /*0b50*/ IMAD.MOV.U32 R6, RZ, RZ, R2 ; /* 0x000000ffff067224 */ /* 0x000fe200078e0002 */ /*0b60*/ MOV R9, R5 ; /* 0x0000000500097202 */ /* 0x000fc40000000f00 */ /*0b70*/ MOV R5, UR5 ; /* 0x0000000500057c02 */ /* 0x000fe20008000f00 */ /*0b80*/ IMAD.U32 R4, RZ, RZ, UR4 ; /* 0x00000004ff047e24 */ /* 0x000fe2000f8e00ff */ /*0b90*/ MOV R3, R9 ; /* 0x0000000900037202 */ /* 0x001fe20000000f00 */ /*0ba0*/ IMAD.MOV.U32 R2, RZ, RZ, R6 ; /* 0x000000ffff027224 */ /* 0x000fc600078e0006 */ /*0bb0*/ LDG.E R5, [R4.64] ; /* 0x0000000a04057981 */ /* 0x000ea8000c1e1900 */ /*0bc0*/ LDG.E R6, [R2.64] ; /* 0x0000000a02067981 */ /* 0x000ea2000c1e1900 */ /*0bd0*/ IADD3 R0, R0, -0x1, RZ ; /* 0xffffffff00007810 */ /* 0x000fc80007ffe0ff */ /*0be0*/ ISETP.NE.AND P0, PT, R0, RZ, PT ; /* 0x000000ff0000720c */ /* 0x000fe20003f05270 */ /*0bf0*/ UIADD3 UR4, UP0, UR4, 0x4, URZ ; /* 0x0000000404047890 */ /* 0x000fc8000ff1e03f */ /*0c00*/ UIADD3.X UR5, URZ, UR5, URZ, UP0, !UPT ; /* 0x000000053f057290 */ /* 0x000fe200087fe43f */ /*0c10*/ FADD R7, R6, R5 ; /* 0x0000000506077221 */ /* 0x004fe20000000000 */ /*0c20*/ IADD3 R6, P1, R2, 0x4, RZ ; /* 0x0000000402067810 */ /* 0x000fc80007f3e0ff */ /*0c30*/ STG.E [R2.64], R7 ; /* 0x0000000702007986 */ /* 0x0001e2000c10190a */ /*0c40*/ IADD3.X R9, RZ, R3, RZ, P1, !PT ; /* 0x00000003ff097210 */ /* 0x000fe20000ffe4ff */ /*0c50*/ @P0 BRA 0xb70 ; /* 0xffffff1000000947 */ /* 0x000fea000383ffff */ /*0c60*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*0c70*/ BRA 0xc70; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*0c80*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0c90*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0ca0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0cb0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0cc0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0cd0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0ce0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0cf0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ ..........
You are a helpful coding assistant specialized in converting CUDA source code to CUDA host assembly.
#include <iostream> #include <math.h> #include <cuda_runtime_api.h> #include <cuda.h> __global__ void add(int n, float *x, float *y) { int index = threadIdx.x; int stride = blockDim.x; for (int i = 0; i < n; i++){ y[i] = x[i] + y[i]; } } int main(void) { int N = 1<<20; float *x, *y; // allocate unified memory cudaMallocManaged(&x, N*sizeof(float)); cudaMallocManaged(&y, N*sizeof(float)); for (int i = 0; i < N; i++){ x[i] = 1.0f; y[i] = 2.0f; } // run the kernel on 1M elements add<<<1, 256>>>(N, x, y); cudaDeviceSynchronize(); float max_error = 0.0f; for (int i = 0; i < N; i++) max_error = fmax(max_error, fabs(y[i]-3.0f)); std::cout << "max error " << max_error <<std::endl; // free cuda memory cudaFree(x); cudaFree(y); return 0; }
.file "tmpxft_0013c2dc_00000000-6_cuda_test.cudafe1.cpp" .text #APP .globl _ZSt21ios_base_library_initv #NO_APP .type _ZL26__cudaUnregisterBinaryUtilv, @function _ZL26__cudaUnregisterBinaryUtilv: .LFB3672: .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 .LFE3672: .size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv .globl _Z25__device_stub__Z3addiPfS_iPfS_ .type _Z25__device_stub__Z3addiPfS_iPfS_, @function _Z25__device_stub__Z3addiPfS_iPfS_: .LFB3694: .cfi_startproc endbr64 subq $136, %rsp .cfi_def_cfa_offset 144 movl %edi, 28(%rsp) movq %rsi, 16(%rsp) movq %rdx, 8(%rsp) movq %fs:40, %rax movq %rax, 120(%rsp) xorl %eax, %eax leaq 28(%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 _Z3addiPfS_(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 144 jmp .L3 .L8: call __stack_chk_fail@PLT .cfi_endproc .LFE3694: .size _Z25__device_stub__Z3addiPfS_iPfS_, .-_Z25__device_stub__Z3addiPfS_iPfS_ .globl _Z3addiPfS_ .type _Z3addiPfS_, @function _Z3addiPfS_: .LFB3695: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z25__device_stub__Z3addiPfS_iPfS_ addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE3695: .size _Z3addiPfS_, .-_Z3addiPfS_ .section .rodata.str1.1,"aMS",@progbits,1 .LC5: .string "max error " .text .globl main .type main, @function main: .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 $72, %rsp .cfi_def_cfa_offset 96 movq %fs:40, %rax movq %rax, 56(%rsp) xorl %eax, %eax leaq 16(%rsp), %rdi movl $1, %edx movl $4194304, %esi call cudaMallocManaged@PLT leaq 24(%rsp), %rdi movl $1, %edx movl $4194304, %esi call cudaMallocManaged@PLT movl $0, %eax movss .LC1(%rip), %xmm1 movss .LC2(%rip), %xmm0 .L12: movq 16(%rsp), %rdx movss %xmm1, (%rdx,%rax) movq 24(%rsp), %rdx movss %xmm0, (%rdx,%rax) addq $4, %rax cmpq $4194304, %rax jne .L12 movl $256, 44(%rsp) movl $1, 48(%rsp) movl $1, 52(%rsp) movl $1, 32(%rsp) movl $1, 36(%rsp) movl $1, 40(%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: call cudaDeviceSynchronize@PLT movq 24(%rsp), %rbx leaq 4194304(%rbx), %rbp movl $0x00000000, 12(%rsp) .L14: movss (%rbx), %xmm0 subss .LC3(%rip), %xmm0 andps .LC4(%rip), %xmm0 movss 12(%rsp), %xmm1 call fmaxf@PLT movss %xmm0, 12(%rsp) addq $4, %rbx cmpq %rbp, %rbx jne .L14 leaq .LC5(%rip), %rsi leaq _ZSt4cout(%rip), %rdi call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT movq %rax, %rdi pxor %xmm0, %xmm0 cvtss2sd 12(%rsp), %xmm0 call _ZNSo9_M_insertIdEERSoT_@PLT movq %rax, %rdi call _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@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 $72, %rsp .cfi_remember_state .cfi_def_cfa_offset 24 popq %rbx .cfi_def_cfa_offset 16 popq %rbp .cfi_def_cfa_offset 8 ret .L19: .cfi_restore_state movq 24(%rsp), %rdx movq 16(%rsp), %rsi movl $1048576, %edi call _Z25__device_stub__Z3addiPfS_iPfS_ jmp .L13 .L20: call __stack_chk_fail@PLT .cfi_endproc .LFE3669: .size main, .-main .section .rodata.str1.1 .LC6: .string "_Z3addiPfS_" .text .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB3697: .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 _Z3addiPfS_(%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 .LFE3697: .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 .LC1: .long 1065353216 .align 4 .LC2: .long 1073741824 .align 4 .LC3: .long 1077936128 .section .rodata.cst16,"aM",@progbits,16 .align 16 .LC4: .long 2147483647 .long 0 .long 0 .long 0 .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 <math.h> #include <cuda_runtime_api.h> #include <cuda.h> __global__ void add(int n, float *x, float *y) { int index = threadIdx.x; int stride = blockDim.x; for (int i = 0; i < n; i++){ y[i] = x[i] + y[i]; } } int main(void) { int N = 1<<20; float *x, *y; // allocate unified memory cudaMallocManaged(&x, N*sizeof(float)); cudaMallocManaged(&y, N*sizeof(float)); for (int i = 0; i < N; i++){ x[i] = 1.0f; y[i] = 2.0f; } // run the kernel on 1M elements add<<<1, 256>>>(N, x, y); cudaDeviceSynchronize(); float max_error = 0.0f; for (int i = 0; i < N; i++) max_error = fmax(max_error, fabs(y[i]-3.0f)); std::cout << "max error " << max_error <<std::endl; // free cuda memory cudaFree(x); cudaFree(y); return 0; }
#include <iostream> #include <math.h> #include <hip/hip_runtime_api.h> #include <hip/hip_runtime.h> __global__ void add(int n, float *x, float *y) { int index = threadIdx.x; int stride = blockDim.x; for (int i = 0; i < n; i++){ y[i] = x[i] + y[i]; } } int main(void) { int N = 1<<20; float *x, *y; // allocate unified memory hipMallocManaged(&x, N*sizeof(float)); hipMallocManaged(&y, N*sizeof(float)); for (int i = 0; i < N; i++){ x[i] = 1.0f; y[i] = 2.0f; } // run the kernel on 1M elements add<<<1, 256>>>(N, x, y); hipDeviceSynchronize(); float max_error = 0.0f; for (int i = 0; i < N; i++) max_error = fmax(max_error, fabs(y[i]-3.0f)); std::cout << "max error " << max_error <<std::endl; // free cuda memory hipFree(x); hipFree(y); return 0; }
You are a helpful coding assistant specialized in converting HIP source code to AMD device assembly.
#include <iostream> #include <math.h> #include <hip/hip_runtime_api.h> #include <hip/hip_runtime.h> __global__ void add(int n, float *x, float *y) { int index = threadIdx.x; int stride = blockDim.x; for (int i = 0; i < n; i++){ y[i] = x[i] + y[i]; } } int main(void) { int N = 1<<20; float *x, *y; // allocate unified memory hipMallocManaged(&x, N*sizeof(float)); hipMallocManaged(&y, N*sizeof(float)); for (int i = 0; i < N; i++){ x[i] = 1.0f; y[i] = 2.0f; } // run the kernel on 1M elements add<<<1, 256>>>(N, x, y); hipDeviceSynchronize(); float max_error = 0.0f; for (int i = 0; i < N; i++) max_error = fmax(max_error, fabs(y[i]-3.0f)); std::cout << "max error " << max_error <<std::endl; // free cuda memory hipFree(x); hipFree(y); return 0; }
.text .amdgcn_target "amdgcn-amd-amdhsa--gfx1100" .protected _Z3addiPfS_ .globl _Z3addiPfS_ .p2align 8 .type _Z3addiPfS_,@function _Z3addiPfS_: s_load_b32 s4, s[0:1], 0x0 s_waitcnt lgkmcnt(0) s_cmp_lt_i32 s4, 1 s_cbranch_scc1 .LBB0_3 s_load_b128 s[0:3], s[0:1], 0x8 v_mov_b32_e32 v0, 0 .LBB0_2: s_waitcnt lgkmcnt(0) s_clause 0x1 global_load_b32 v1, v0, s[0:1] global_load_b32 v2, v0, s[2:3] s_add_i32 s4, s4, -1 s_add_u32 s0, s0, 4 s_addc_u32 s1, s1, 0 s_waitcnt vmcnt(0) v_add_f32_e32 v1, v1, v2 global_store_b32 v0, v1, s[2:3] s_add_u32 s2, s2, 4 s_addc_u32 s3, s3, 0 s_cmp_eq_u32 s4, 0 s_cbranch_scc0 .LBB0_2 .LBB0_3: s_nop 0 s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z3addiPfS_ .amdhsa_group_segment_fixed_size 0 .amdhsa_private_segment_fixed_size 0 .amdhsa_kernarg_size 24 .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 5 .amdhsa_reserve_vcc 0 .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 _Z3addiPfS_, .Lfunc_end0-_Z3addiPfS_ .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 - .address_space: global .offset: 8 .size: 8 .value_kind: global_buffer - .address_space: global .offset: 16 .size: 8 .value_kind: global_buffer .group_segment_fixed_size: 0 .kernarg_segment_align: 8 .kernarg_segment_size: 24 .language: OpenCL C .language_version: - 2 - 0 .max_flat_workgroup_size: 1024 .name: _Z3addiPfS_ .private_segment_fixed_size: 0 .sgpr_count: 5 .sgpr_spill_count: 0 .symbol: _Z3addiPfS_.kd .uniform_work_group_size: 1 .uses_dynamic_stack: false .vgpr_count: 3 .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 <iostream> #include <math.h> #include <hip/hip_runtime_api.h> #include <hip/hip_runtime.h> __global__ void add(int n, float *x, float *y) { int index = threadIdx.x; int stride = blockDim.x; for (int i = 0; i < n; i++){ y[i] = x[i] + y[i]; } } int main(void) { int N = 1<<20; float *x, *y; // allocate unified memory hipMallocManaged(&x, N*sizeof(float)); hipMallocManaged(&y, N*sizeof(float)); for (int i = 0; i < N; i++){ x[i] = 1.0f; y[i] = 2.0f; } // run the kernel on 1M elements add<<<1, 256>>>(N, x, y); hipDeviceSynchronize(); float max_error = 0.0f; for (int i = 0; i < N; i++) max_error = fmax(max_error, fabs(y[i]-3.0f)); std::cout << "max error " << max_error <<std::endl; // free cuda memory hipFree(x); hipFree(y); return 0; }
.text .file "cuda_test.hip" # Start of file scope inline assembly .globl _ZSt21ios_base_library_initv # End of file scope inline assembly .globl _Z18__device_stub__addiPfS_ # -- Begin function _Z18__device_stub__addiPfS_ .p2align 4, 0x90 .type _Z18__device_stub__addiPfS_,@function _Z18__device_stub__addiPfS_: # @_Z18__device_stub__addiPfS_ .cfi_startproc # %bb.0: subq $104, %rsp .cfi_def_cfa_offset 112 movl %edi, 12(%rsp) movq %rsi, 72(%rsp) movq %rdx, 64(%rsp) leaq 12(%rsp), %rax movq %rax, 80(%rsp) leaq 72(%rsp), %rax movq %rax, 88(%rsp) leaq 64(%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 $_Z3addiPfS_, %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 _Z18__device_stub__addiPfS_, .Lfunc_end0-_Z18__device_stub__addiPfS_ .cfi_endproc # -- End function .section .rodata.cst4,"aM",@progbits,4 .p2align 2, 0x0 # -- Begin function main .LCPI1_0: .long 0xc0400000 # float -3 .section .rodata.cst16,"aM",@progbits,16 .p2align 4, 0x0 .LCPI1_1: .long 0x7fffffff # float NaN .long 0x7fffffff # float NaN .long 0x7fffffff # float NaN .long 0x7fffffff # float NaN .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 subq $152, %rsp .cfi_def_cfa_offset 176 .cfi_offset %rbx, -24 .cfi_offset %r14, -16 leaq 16(%rsp), %rdi movl $4194304, %esi # imm = 0x400000 movl $1, %edx callq hipMallocManaged leaq 8(%rsp), %rdi movl $4194304, %esi # imm = 0x400000 movl $1, %edx callq hipMallocManaged movq 16(%rsp), %rax xorl %ecx, %ecx movq 8(%rsp), %rdx .p2align 4, 0x90 .LBB1_1: # =>This Inner Loop Header: Depth=1 movl $1065353216, (%rax,%rcx,4) # imm = 0x3F800000 movl $1073741824, (%rdx,%rcx,4) # imm = 0x40000000 incq %rcx cmpq $1048576, %rcx # imm = 0x100000 jne .LBB1_1 # %bb.2: movabsq $4294967297, %rdi # imm = 0x100000001 leaq 255(%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 movl $1048576, 28(%rsp) # imm = 0x100000 movq %rax, 88(%rsp) movq %rcx, 80(%rsp) leaq 28(%rsp), %rax movq %rax, 96(%rsp) leaq 88(%rsp), %rax movq %rax, 104(%rsp) leaq 80(%rsp), %rax movq %rax, 112(%rsp) leaq 64(%rsp), %rdi leaq 48(%rsp), %rsi leaq 40(%rsp), %rdx leaq 32(%rsp), %rcx callq __hipPopCallConfiguration movq 64(%rsp), %rsi movl 72(%rsp), %edx movq 48(%rsp), %rcx movl 56(%rsp), %r8d leaq 96(%rsp), %r9 movl $_Z3addiPfS_, %edi pushq 32(%rsp) .cfi_adjust_cfa_offset 8 pushq 48(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $16, %rsp .cfi_adjust_cfa_offset -16 .LBB1_4: callq hipDeviceSynchronize xorps %xmm2, %xmm2 xorl %eax, %eax movq 8(%rsp), %rcx movss .LCPI1_0(%rip), %xmm0 # xmm0 = mem[0],zero,zero,zero movaps .LCPI1_1(%rip), %xmm1 # xmm1 = [NaN,NaN,NaN,NaN] movaps %xmm2, %xmm5 .p2align 4, 0x90 .LBB1_5: # =>This Inner Loop Header: Depth=1 movss (%rcx,%rax,4), %xmm3 # xmm3 = mem[0],zero,zero,zero addss %xmm0, %xmm3 andps %xmm1, %xmm3 cmpunordss %xmm5, %xmm5 movaps %xmm5, %xmm4 andps %xmm3, %xmm4 maxss %xmm2, %xmm3 andnps %xmm3, %xmm5 orps %xmm4, %xmm5 incq %rax movaps %xmm5, %xmm2 cmpq $1048576, %rax # imm = 0x100000 jne .LBB1_5 # %bb.6: movl $_ZSt4cout, %edi movl $.L.str, %esi movl $10, %edx movaps %xmm5, 128(%rsp) # 16-byte Spill callq _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l movaps 128(%rsp), %xmm0 # 16-byte Reload cvtss2sd %xmm0, %xmm0 movl $_ZSt4cout, %edi callq _ZNSo9_M_insertIdEERSoT_ movq (%rax), %rcx movq -24(%rcx), %rcx movq 240(%rax,%rcx), %rbx testq %rbx, %rbx je .LBB1_11 # %bb.7: # %_ZSt13__check_facetISt5ctypeIcEERKT_PS3_.exit.i.i cmpb $0, 56(%rbx) je .LBB1_9 # %bb.8: movzbl 67(%rbx), %ecx jmp .LBB1_10 .LBB1_9: 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_10: # %_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_.exit movsbl %cl, %esi movq %rax, %rdi callq _ZNSo3putEc movq %rax, %rdi callq _ZNSo5flushEv movq 16(%rsp), %rdi callq hipFree movq 8(%rsp), %rdi callq hipFree xorl %eax, %eax addq $152, %rsp .cfi_def_cfa_offset 24 popq %rbx .cfi_def_cfa_offset 16 popq %r14 .cfi_def_cfa_offset 8 retq .LBB1_11: .cfi_def_cfa_offset 176 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 $_Z3addiPfS_, %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 _Z3addiPfS_,@object # @_Z3addiPfS_ .section .rodata,"a",@progbits .globl _Z3addiPfS_ .p2align 3, 0x0 _Z3addiPfS_: .quad _Z18__device_stub__addiPfS_ .size _Z3addiPfS_, 8 .type .L.str,@object # @.str .section .rodata.str1.1,"aMS",@progbits,1 .L.str: .asciz "max error " .size .L.str, 11 .type .L__unnamed_1,@object # @0 .L__unnamed_1: .asciz "_Z3addiPfS_" .size .L__unnamed_1, 12 .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__addiPfS_ .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z3addiPfS_ .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 : _Z3addiPfS_ .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*/ IMAD.MOV.U32 R0, RZ, RZ, c[0x0][0x160] ; /* 0x00005800ff007624 */ /* 0x000fca00078e00ff */ /*0020*/ ISETP.GE.AND P0, PT, R0, 0x1, PT ; /* 0x000000010000780c */ /* 0x000fda0003f06270 */ /*0030*/ @!P0 EXIT ; /* 0x000000000000894d */ /* 0x000fea0003800000 */ /*0040*/ IADD3 R2, R0.reuse, -0x1, RZ ; /* 0xffffffff00027810 */ /* 0x040fe20007ffe0ff */ /*0050*/ UMOV UR4, URZ ; /* 0x0000003f00047c82 */ /* 0x000fe20008000000 */ /*0060*/ LOP3.LUT R0, R0, 0x3, RZ, 0xc0, !PT ; /* 0x0000000300007812 */ /* 0x000fe200078ec0ff */ /*0070*/ ULDC.64 UR10, c[0x0][0x118] ; /* 0x00004600000a7ab9 */ /* 0x000fe20000000a00 */ /*0080*/ ISETP.GE.U32.AND P0, PT, R2, 0x3, PT ; /* 0x000000030200780c */ /* 0x000fda0003f06070 */ /*0090*/ @!P0 BRA 0xaa0 ; /* 0x00000a0000008947 */ /* 0x000fea0003800000 */ /*00a0*/ IADD3 R6, -R0, c[0x0][0x160], RZ ; /* 0x0000580000067a10 */ /* 0x000fe20007ffe1ff */ /*00b0*/ UMOV UR4, URZ ; /* 0x0000003f00047c82 */ /* 0x000fe20008000000 */ /*00c0*/ MOV R4, c[0x0][0x170] ; /* 0x00005c0000047a02 */ /* 0x000fe20000000f00 */ /*00d0*/ IMAD.MOV.U32 R5, RZ, RZ, c[0x0][0x174] ; /* 0x00005d00ff057624 */ /* 0x000fe200078e00ff */ /*00e0*/ ISETP.GT.AND P0, PT, R6, RZ, PT ; /* 0x000000ff0600720c */ /* 0x000fe20003f04270 */ /*00f0*/ IMAD.MOV.U32 R3, RZ, RZ, c[0x0][0x16c] ; /* 0x00005b00ff037624 */ /* 0x000fe200078e00ff */ /*0100*/ MOV R2, c[0x0][0x168] ; /* 0x00005a0000027a02 */ /* 0x000fd60000000f00 */ /*0110*/ @!P0 BRA 0x8f0 ; /* 0x000007d000008947 */ /* 0x000fea0003800000 */ /*0120*/ ISETP.GT.AND P1, PT, R6, 0xc, PT ; /* 0x0000000c0600780c */ /* 0x000fe40003f24270 */ /*0130*/ PLOP3.LUT P0, PT, PT, PT, PT, 0x80, 0x0 ; /* 0x000000000000781c */ /* 0x000fd60003f0f070 */ /*0140*/ @!P1 BRA 0x610 ; /* 0x000004c000009947 */ /* 0x000fea0003800000 */ /*0150*/ PLOP3.LUT P0, PT, PT, PT, PT, 0x8, 0x0 ; /* 0x000000000000781c */ /* 0x000fe40003f0e170 */ /*0160*/ LDG.E R7, [R4.64] ; /* 0x0000000a04077981 */ /* 0x000ea8000c1e1900 */ /*0170*/ LDG.E R8, [R2.64] ; /* 0x0000000a02087981 */ /* 0x000ea4000c1e1900 */ /*0180*/ FADD R7, R7, R8 ; /* 0x0000000807077221 */ /* 0x004fe40000000000 */ /*0190*/ LDG.E R8, [R4.64+0x4] ; /* 0x0000040a04087981 */ /* 0x000ea8000c1e1900 */ /*01a0*/ STG.E [R4.64], R7 ; /* 0x0000000704007986 */ /* 0x0001e8000c10190a */ /*01b0*/ LDG.E R9, [R2.64+0x4] ; /* 0x0000040a02097981 */ /* 0x000ea8000c1e1900 */ /*01c0*/ LDG.E R7, [R4.64+0x10] ; /* 0x0000100a04077981 */ /* 0x001ee2000c1e1900 */ /*01d0*/ FADD R9, R8, R9 ; /* 0x0000000908097221 */ /* 0x004fc60000000000 */ /*01e0*/ LDG.E R8, [R4.64+0x8] ; /* 0x0000080a04087981 */ /* 0x000ea8000c1e1900 */ /*01f0*/ STG.E [R4.64+0x4], R9 ; /* 0x0000040904007986 */ /* 0x0001e8000c10190a */ /*0200*/ LDG.E R11, [R2.64+0x8] ; /* 0x0000080a020b7981 */ /* 0x000ea4000c1e1900 */ /*0210*/ FADD R11, R8, R11 ; /* 0x0000000b080b7221 */ /* 0x004fc40000000000 */ /*0220*/ LDG.E R8, [R4.64+0xc] ; /* 0x00000c0a04087981 */ /* 0x000ea8000c1e1900 */ /*0230*/ STG.E [R4.64+0x8], R11 ; /* 0x0000080b04007986 */ /* 0x000fe8000c10190a */ /*0240*/ LDG.E R13, [R2.64+0xc] ; /* 0x00000c0a020d7981 */ /* 0x000ea4000c1e1900 */ /*0250*/ FADD R13, R8, R13 ; /* 0x0000000d080d7221 */ /* 0x004fca0000000000 */ /*0260*/ STG.E [R4.64+0xc], R13 ; /* 0x00000c0d04007986 */ /* 0x000fe8000c10190a */ /*0270*/ LDG.E R8, [R2.64+0x10] ; /* 0x0000100a02087981 */ /* 0x000ee4000c1e1900 */ /*0280*/ FADD R7, R7, R8 ; /* 0x0000000807077221 */ /* 0x008fe40000000000 */ /*0290*/ LDG.E R8, [R4.64+0x14] ; /* 0x0000140a04087981 */ /* 0x000ea8000c1e1900 */ /*02a0*/ STG.E [R4.64+0x10], R7 ; /* 0x0000100704007986 */ /* 0x0003e8000c10190a */ /*02b0*/ LDG.E R9, [R2.64+0x14] ; /* 0x0000140a02097981 */ /* 0x001ea8000c1e1900 */ /*02c0*/ LDG.E R7, [R4.64+0x20] ; /* 0x0000200a04077981 */ /* 0x002ee2000c1e1900 */ /*02d0*/ FADD R9, R8, R9 ; /* 0x0000000908097221 */ /* 0x004fc60000000000 */ /*02e0*/ LDG.E R8, [R4.64+0x18] ; /* 0x0000180a04087981 */ /* 0x000ea8000c1e1900 */ /*02f0*/ STG.E [R4.64+0x14], R9 ; /* 0x0000140904007986 */ /* 0x0001e8000c10190a */ /*0300*/ LDG.E R11, [R2.64+0x18] ; /* 0x0000180a020b7981 */ /* 0x000ea4000c1e1900 */ /*0310*/ FADD R11, R8, R11 ; /* 0x0000000b080b7221 */ /* 0x004fc40000000000 */ /*0320*/ LDG.E R8, [R4.64+0x1c] ; /* 0x00001c0a04087981 */ /* 0x000ea8000c1e1900 */ /*0330*/ STG.E [R4.64+0x18], R11 ; /* 0x0000180b04007986 */ /* 0x000fe8000c10190a */ /*0340*/ LDG.E R13, [R2.64+0x1c] ; /* 0x00001c0a020d7981 */ /* 0x000ea4000c1e1900 */ /*0350*/ FADD R13, R8, R13 ; /* 0x0000000d080d7221 */ /* 0x004fca0000000000 */ /*0360*/ STG.E [R4.64+0x1c], R13 ; /* 0x00001c0d04007986 */ /* 0x000fe8000c10190a */ /*0370*/ LDG.E R8, [R2.64+0x20] ; /* 0x0000200a02087981 */ /* 0x000ee4000c1e1900 */ /*0380*/ FADD R7, R7, R8 ; /* 0x0000000807077221 */ /* 0x008fe40000000000 */ /*0390*/ LDG.E R8, [R4.64+0x24] ; /* 0x0000240a04087981 */ /* 0x000ea8000c1e1900 */ /*03a0*/ STG.E [R4.64+0x20], R7 ; /* 0x0000200704007986 */ /* 0x0003e8000c10190a */ /*03b0*/ LDG.E R9, [R2.64+0x24] ; /* 0x0000240a02097981 */ /* 0x001ea8000c1e1900 */ /*03c0*/ LDG.E R7, [R4.64+0x30] ; /* 0x0000300a04077981 */ /* 0x002ee2000c1e1900 */ /*03d0*/ FADD R9, R8, R9 ; /* 0x0000000908097221 */ /* 0x004fc60000000000 */ /*03e0*/ LDG.E R8, [R4.64+0x28] ; /* 0x0000280a04087981 */ /* 0x000ea8000c1e1900 */ /*03f0*/ STG.E [R4.64+0x24], R9 ; /* 0x0000240904007986 */ /* 0x0001e8000c10190a */ /*0400*/ LDG.E R11, [R2.64+0x28] ; /* 0x0000280a020b7981 */ /* 0x000ea4000c1e1900 */ /*0410*/ FADD R11, R8, R11 ; /* 0x0000000b080b7221 */ /* 0x004fc40000000000 */ /*0420*/ LDG.E R8, [R4.64+0x2c] ; /* 0x00002c0a04087981 */ /* 0x000ea8000c1e1900 */ /*0430*/ STG.E [R4.64+0x28], R11 ; /* 0x0000280b04007986 */ /* 0x0003e8000c10190a */ /*0440*/ LDG.E R13, [R2.64+0x2c] ; /* 0x00002c0a020d7981 */ /* 0x000ea4000c1e1900 */ /*0450*/ FADD R13, R8, R13 ; /* 0x0000000d080d7221 */ /* 0x004fca0000000000 */ /*0460*/ STG.E [R4.64+0x2c], R13 ; /* 0x00002c0d04007986 */ /* 0x0005e8000c10190a */ /*0470*/ LDG.E R8, [R2.64+0x30] ; /* 0x0000300a02087981 */ /* 0x000ee4000c1e1900 */ /*0480*/ FADD R7, R7, R8 ; /* 0x0000000807077221 */ /* 0x008fe40000000000 */ /*0490*/ LDG.E R8, [R4.64+0x34] ; /* 0x0000340a04087981 */ /* 0x000ee8000c1e1900 */ /*04a0*/ STG.E [R4.64+0x30], R7 ; /* 0x0000300704007986 */ /* 0x0009e8000c10190a */ /*04b0*/ LDG.E R9, [R2.64+0x34] ; /* 0x0000340a02097981 */ /* 0x001ee4000c1e1900 */ /*04c0*/ FADD R9, R8, R9 ; /* 0x0000000908097221 */ /* 0x008fc40000000000 */ /*04d0*/ LDG.E R8, [R4.64+0x38] ; /* 0x0000380a04087981 */ /* 0x000ee8000c1e1900 */ /*04e0*/ STG.E [R4.64+0x34], R9 ; /* 0x0000340904007986 */ /* 0x000fe8000c10190a */ /*04f0*/ LDG.E R11, [R2.64+0x38] ; /* 0x0000380a020b7981 */ /* 0x002ee2000c1e1900 */ /*0500*/ IADD3 R6, R6, -0x10, RZ ; /* 0xfffffff006067810 */ /* 0x000fe20007ffe0ff */ /*0510*/ FADD R11, R8, R11 ; /* 0x0000000b080b7221 */ /* 0x008fc40000000000 */ /*0520*/ LDG.E R8, [R4.64+0x3c] ; /* 0x00003c0a04087981 */ /* 0x000ee8000c1e1900 */ /*0530*/ STG.E [R4.64+0x38], R11 ; /* 0x0000380b04007986 */ /* 0x000fe8000c10190a */ /*0540*/ LDG.E R13, [R2.64+0x3c] ; /* 0x00003c0a020d7981 */ /* 0x0040e2000c1e1900 */ /*0550*/ ISETP.GT.AND P1, PT, R6, 0xc, PT ; /* 0x0000000c0600780c */ /* 0x000fe40003f24270 */ /*0560*/ IADD3 R7, P3, R4, 0x40, RZ ; /* 0x0000004004077810 */ /* 0x010fe20007f7e0ff */ /*0570*/ UIADD3 UR4, UR4, 0x10, URZ ; /* 0x0000001004047890 */ /* 0x000fe2000fffe03f */ /*0580*/ IADD3 R10, P2, R2, 0x40, RZ ; /* 0x00000040020a7810 */ /* 0x000fc80007f5e0ff */ /*0590*/ IADD3.X R3, RZ, R3, RZ, P2, !PT ; /* 0x00000003ff037210 */ /* 0x001fe400017fe4ff */ /*05a0*/ MOV R2, R10 ; /* 0x0000000a00027202 */ /* 0x000fe20000000f00 */ /*05b0*/ FADD R13, R8, R13 ; /* 0x0000000d080d7221 */ /* 0x008fe40000000000 */ /*05c0*/ IMAD.X R8, RZ, RZ, R5, P3 ; /* 0x000000ffff087224 */ /* 0x000fc600018e0605 */ /*05d0*/ STG.E [R4.64+0x3c], R13 ; /* 0x00003c0d04007986 */ /* 0x0001e4000c10190a */ /*05e0*/ IMAD.MOV.U32 R4, RZ, RZ, R7 ; /* 0x000000ffff047224 */ /* 0x001fe200078e0007 */ /*05f0*/ MOV R5, R8 ; /* 0x0000000800057202 */ /* 0x000fe20000000f00 */ /*0600*/ @P1 BRA 0x160 ; /* 0xfffffb5000001947 */ /* 0x000fea000383ffff */ /*0610*/ ISETP.GT.AND P1, PT, R6, 0x4, PT ; /* 0x000000040600780c */ /* 0x000fda0003f24270 */ /*0620*/ @!P1 BRA 0x8d0 ; /* 0x000002a000009947 */ /* 0x000fea0003800000 */ /*0630*/ LDG.E R7, [R4.64] ; /* 0x0000000a04077981 */ /* 0x000ea8000c1e1900 */ /*0640*/ LDG.E R8, [R2.64] ; /* 0x0000000a02087981 */ /* 0x000ea4000c1e1900 */ /*0650*/ FADD R7, R7, R8 ; /* 0x0000000807077221 */ /* 0x004fe40000000000 */ /*0660*/ LDG.E R8, [R4.64+0x4] ; /* 0x0000040a04087981 */ /* 0x000ea8000c1e1900 */ /*0670*/ STG.E [R4.64], R7 ; /* 0x0000000704007986 */ /* 0x0001e8000c10190a */ /*0680*/ LDG.E R9, [R2.64+0x4] ; /* 0x0000040a02097981 */ /* 0x000ea8000c1e1900 */ /*0690*/ LDG.E R7, [R4.64+0x10] ; /* 0x0000100a04077981 */ /* 0x001ee2000c1e1900 */ /*06a0*/ FADD R9, R8, R9 ; /* 0x0000000908097221 */ /* 0x004fc60000000000 */ /*06b0*/ LDG.E R8, [R4.64+0x8] ; /* 0x0000080a04087981 */ /* 0x000ea8000c1e1900 */ /*06c0*/ STG.E [R4.64+0x4], R9 ; /* 0x0000040904007986 */ /* 0x0001e8000c10190a */ /*06d0*/ LDG.E R11, [R2.64+0x8] ; /* 0x0000080a020b7981 */ /* 0x000ea4000c1e1900 */ /*06e0*/ FADD R11, R8, R11 ; /* 0x0000000b080b7221 */ /* 0x004fc40000000000 */ /*06f0*/ LDG.E R8, [R4.64+0xc] ; /* 0x00000c0a04087981 */ /* 0x000ea8000c1e1900 */ /*0700*/ STG.E [R4.64+0x8], R11 ; /* 0x0000080b04007986 */ /* 0x0003e8000c10190a */ /*0710*/ LDG.E R13, [R2.64+0xc] ; /* 0x00000c0a020d7981 */ /* 0x000ea4000c1e1900 */ /*0720*/ FADD R13, R8, R13 ; /* 0x0000000d080d7221 */ /* 0x004fca0000000000 */ /*0730*/ STG.E [R4.64+0xc], R13 ; /* 0x00000c0d04007986 */ /* 0x0005e8000c10190a */ /*0740*/ LDG.E R8, [R2.64+0x10] ; /* 0x0000100a02087981 */ /* 0x000ee4000c1e1900 */ /*0750*/ FADD R7, R7, R8 ; /* 0x0000000807077221 */ /* 0x008fe40000000000 */ /*0760*/ LDG.E R8, [R4.64+0x14] ; /* 0x0000140a04087981 */ /* 0x000ee8000c1e1900 */ /*0770*/ STG.E [R4.64+0x10], R7 ; /* 0x0000100704007986 */ /* 0x0009e8000c10190a */ /*0780*/ LDG.E R9, [R2.64+0x14] ; /* 0x0000140a02097981 */ /* 0x001ee4000c1e1900 */ /*0790*/ FADD R9, R8, R9 ; /* 0x0000000908097221 */ /* 0x008fc40000000000 */ /*07a0*/ LDG.E R8, [R4.64+0x18] ; /* 0x0000180a04087981 */ /* 0x000ee8000c1e1900 */ /*07b0*/ STG.E [R4.64+0x14], R9 ; /* 0x0000140904007986 */ /* 0x000fe8000c10190a */ /*07c0*/ LDG.E R11, [R2.64+0x18] ; /* 0x0000180a020b7981 */ /* 0x002ee4000c1e1900 */ /*07d0*/ FADD R11, R8, R11 ; /* 0x0000000b080b7221 */ /* 0x008fc40000000000 */ /*07e0*/ LDG.E R8, [R4.64+0x1c] ; /* 0x00001c0a04087981 */ /* 0x000ee8000c1e1900 */ /*07f0*/ STG.E [R4.64+0x18], R11 ; /* 0x0000180b04007986 */ /* 0x000fe8000c10190a */ /*0800*/ LDG.E R13, [R2.64+0x1c] ; /* 0x00001c0a020d7981 */ /* 0x0040e2000c1e1900 */ /*0810*/ IADD3 R7, P2, R4, 0x20, RZ ; /* 0x0000002004077810 */ /* 0x010fe40007f5e0ff */ /*0820*/ IADD3 R10, P1, R2, 0x20, RZ ; /* 0x00000020020a7810 */ /* 0x000fc40007f3e0ff */ /*0830*/ PLOP3.LUT P0, PT, PT, PT, PT, 0x8, 0x0 ; /* 0x000000000000781c */ /* 0x000fe40003f0e170 */ /*0840*/ IADD3 R6, R6, -0x8, RZ ; /* 0xfffffff806067810 */ /* 0x000fe20007ffe0ff */ /*0850*/ IMAD.X R3, RZ, RZ, R3, P1 ; /* 0x000000ffff037224 */ /* 0x001fe400008e0603 */ /*0860*/ IMAD.MOV.U32 R2, RZ, RZ, R10 ; /* 0x000000ffff027224 */ /* 0x000fe200078e000a */ /*0870*/ UIADD3 UR4, UR4, 0x8, URZ ; /* 0x0000000804047890 */ /* 0x000fe2000fffe03f */ /*0880*/ FADD R13, R8, R13 ; /* 0x0000000d080d7221 */ /* 0x008fe20000000000 */ /*0890*/ IADD3.X R8, RZ, R5, RZ, P2, !PT ; /* 0x00000005ff087210 */ /* 0x000fc800017fe4ff */ /*08a0*/ STG.E [R4.64+0x1c], R13 ; /* 0x00001c0d04007986 */ /* 0x0001e4000c10190a */ /*08b0*/ MOV R4, R7 ; /* 0x0000000700047202 */ /* 0x001fe20000000f00 */ /*08c0*/ IMAD.MOV.U32 R5, RZ, RZ, R8 ; /* 0x000000ffff057224 */ /* 0x000fe400078e0008 */ /*08d0*/ ISETP.NE.OR P0, PT, R6, RZ, P0 ; /* 0x000000ff0600720c */ /* 0x000fda0000705670 */ /*08e0*/ @!P0 BRA 0xaa0 ; /* 0x000001b000008947 */ /* 0x000fea0003800000 */ /*08f0*/ LDG.E R7, [R4.64] ; /* 0x0000000a04077981 */ /* 0x000ea8000c1e1900 */ /*0900*/ LDG.E R8, [R2.64] ; /* 0x0000000a02087981 */ /* 0x000ea4000c1e1900 */ /*0910*/ FADD R7, R7, R8 ; /* 0x0000000807077221 */ /* 0x004fe40000000000 */ /*0920*/ LDG.E R8, [R4.64+0x4] ; /* 0x0000040a04087981 */ /* 0x000ea8000c1e1900 */ /*0930*/ STG.E [R4.64], R7 ; /* 0x0000000704007986 */ /* 0x0001e8000c10190a */ /*0940*/ LDG.E R9, [R2.64+0x4] ; /* 0x0000040a02097981 */ /* 0x000ea4000c1e1900 */ /*0950*/ FADD R9, R8, R9 ; /* 0x0000000908097221 */ /* 0x004fc40000000000 */ /*0960*/ LDG.E R8, [R4.64+0x8] ; /* 0x0000080a04087981 */ /* 0x000ea8000c1e1900 */ /*0970*/ STG.E [R4.64+0x4], R9 ; /* 0x0000040904007986 */ /* 0x000fe8000c10190a */ /*0980*/ LDG.E R11, [R2.64+0x8] ; /* 0x0000080a020b7981 */ /* 0x000ea2000c1e1900 */ /*0990*/ IADD3 R6, R6, -0x4, RZ ; /* 0xfffffffc06067810 */ /* 0x000fe20007ffe0ff */ /*09a0*/ FADD R11, R8, R11 ; /* 0x0000000b080b7221 */ /* 0x004fc40000000000 */ /*09b0*/ LDG.E R8, [R4.64+0xc] ; /* 0x00000c0a04087981 */ /* 0x000ea8000c1e1900 */ /*09c0*/ STG.E [R4.64+0x8], R11 ; /* 0x0000080b04007986 */ /* 0x000fe8000c10190a */ /*09d0*/ LDG.E R13, [R2.64+0xc] ; /* 0x00000c0a020d7981 */ /* 0x0002a2000c1e1900 */ /*09e0*/ ISETP.NE.AND P0, PT, R6, RZ, PT ; /* 0x000000ff0600720c */ /* 0x000fe20003f05270 */ /*09f0*/ UIADD3 UR4, UR4, 0x4, URZ ; /* 0x0000000404047890 */ /* 0x000fe2000fffe03f */ /*0a00*/ IADD3 R7, P2, R4, 0x10, RZ ; /* 0x0000001004077810 */ /* 0x001fc40007f5e0ff */ /*0a10*/ IADD3 R10, P1, R2, 0x10, RZ ; /* 0x00000010020a7810 */ /* 0x000fc80007f3e0ff */ /*0a20*/ IADD3.X R3, RZ, R3, RZ, P1, !PT ; /* 0x00000003ff037210 */ /* 0x002fe40000ffe4ff */ /*0a30*/ MOV R2, R10 ; /* 0x0000000a00027202 */ /* 0x000fe20000000f00 */ /*0a40*/ FADD R13, R8, R13 ; /* 0x0000000d080d7221 */ /* 0x004fe40000000000 */ /*0a50*/ IMAD.X R8, RZ, RZ, R5, P2 ; /* 0x000000ffff087224 */ /* 0x000fc600010e0605 */ /*0a60*/ STG.E [R4.64+0xc], R13 ; /* 0x00000c0d04007986 */ /* 0x0001e4000c10190a */ /*0a70*/ IMAD.MOV.U32 R4, RZ, RZ, R7 ; /* 0x000000ffff047224 */ /* 0x001fe200078e0007 */ /*0a80*/ MOV R5, R8 ; /* 0x0000000800057202 */ /* 0x000fe20000000f00 */ /*0a90*/ @P0 BRA 0x8f0 ; /* 0xfffffe5000000947 */ /* 0x000fea000383ffff */ /*0aa0*/ ISETP.NE.AND P0, PT, R0, RZ, PT ; /* 0x000000ff0000720c */ /* 0x000fda0003f05270 */ /*0ab0*/ @!P0 EXIT ; /* 0x000000000000894d */ /* 0x000fea0003800000 */ /*0ac0*/ UMOV UR5, 0x4 ; /* 0x0000000400057882 */ /* 0x000fe40000000000 */ /*0ad0*/ ULDC.64 UR6, c[0x0][0x170] ; /* 0x00005c0000067ab9 */ /* 0x000fe40000000a00 */ /*0ae0*/ UIMAD.WIDE UR6, UR4, UR5, UR6 ; /* 0x00000005040672a5 */ /* 0x000fe4000f8e0206 */ /*0af0*/ ULDC.64 UR8, c[0x0][0x168] ; /* 0x00005a0000087ab9 */ /* 0x000fe40000000a00 */ /*0b00*/ UIMAD.WIDE UR4, UR4, UR5, UR8 ; /* 0x00000005040472a5 */ /* 0x000fe4000f8e0208 */ /*0b10*/ IMAD.U32 R2, RZ, RZ, UR6 ; /* 0x00000006ff027e24 */ /* 0x000fe2000f8e00ff */ /*0b20*/ MOV R5, UR7 ; /* 0x0000000700057c02 */ /* 0x000fe20008000f00 */ /*0b30*/ IMAD.U32 R4, RZ, RZ, UR6 ; /* 0x00000006ff047e24 */ /* 0x000fe2000f8e00ff */ /*0b40*/ MOV R3, UR7 ; /* 0x0000000700037c02 */ /* 0x000fe20008000f00 */ /*0b50*/ IMAD.MOV.U32 R6, RZ, RZ, R2 ; /* 0x000000ffff067224 */ /* 0x000fe200078e0002 */ /*0b60*/ MOV R9, R5 ; /* 0x0000000500097202 */ /* 0x000fc40000000f00 */ /*0b70*/ MOV R5, UR5 ; /* 0x0000000500057c02 */ /* 0x000fe20008000f00 */ /*0b80*/ IMAD.U32 R4, RZ, RZ, UR4 ; /* 0x00000004ff047e24 */ /* 0x000fe2000f8e00ff */ /*0b90*/ MOV R3, R9 ; /* 0x0000000900037202 */ /* 0x001fe20000000f00 */ /*0ba0*/ IMAD.MOV.U32 R2, RZ, RZ, R6 ; /* 0x000000ffff027224 */ /* 0x000fc600078e0006 */ /*0bb0*/ LDG.E R5, [R4.64] ; /* 0x0000000a04057981 */ /* 0x000ea8000c1e1900 */ /*0bc0*/ LDG.E R6, [R2.64] ; /* 0x0000000a02067981 */ /* 0x000ea2000c1e1900 */ /*0bd0*/ IADD3 R0, R0, -0x1, RZ ; /* 0xffffffff00007810 */ /* 0x000fc80007ffe0ff */ /*0be0*/ ISETP.NE.AND P0, PT, R0, RZ, PT ; /* 0x000000ff0000720c */ /* 0x000fe20003f05270 */ /*0bf0*/ UIADD3 UR4, UP0, UR4, 0x4, URZ ; /* 0x0000000404047890 */ /* 0x000fc8000ff1e03f */ /*0c00*/ UIADD3.X UR5, URZ, UR5, URZ, UP0, !UPT ; /* 0x000000053f057290 */ /* 0x000fe200087fe43f */ /*0c10*/ FADD R7, R6, R5 ; /* 0x0000000506077221 */ /* 0x004fe20000000000 */ /*0c20*/ IADD3 R6, P1, R2, 0x4, RZ ; /* 0x0000000402067810 */ /* 0x000fc80007f3e0ff */ /*0c30*/ STG.E [R2.64], R7 ; /* 0x0000000702007986 */ /* 0x0001e2000c10190a */ /*0c40*/ IADD3.X R9, RZ, R3, RZ, P1, !PT ; /* 0x00000003ff097210 */ /* 0x000fe20000ffe4ff */ /*0c50*/ @P0 BRA 0xb70 ; /* 0xffffff1000000947 */ /* 0x000fea000383ffff */ /*0c60*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*0c70*/ BRA 0xc70; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*0c80*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0c90*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0ca0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0cb0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0cc0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0cd0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0ce0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0cf0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ ..........
.text .amdgcn_target "amdgcn-amd-amdhsa--gfx1100" .protected _Z3addiPfS_ .globl _Z3addiPfS_ .p2align 8 .type _Z3addiPfS_,@function _Z3addiPfS_: s_load_b32 s4, s[0:1], 0x0 s_waitcnt lgkmcnt(0) s_cmp_lt_i32 s4, 1 s_cbranch_scc1 .LBB0_3 s_load_b128 s[0:3], s[0:1], 0x8 v_mov_b32_e32 v0, 0 .LBB0_2: s_waitcnt lgkmcnt(0) s_clause 0x1 global_load_b32 v1, v0, s[0:1] global_load_b32 v2, v0, s[2:3] s_add_i32 s4, s4, -1 s_add_u32 s0, s0, 4 s_addc_u32 s1, s1, 0 s_waitcnt vmcnt(0) v_add_f32_e32 v1, v1, v2 global_store_b32 v0, v1, s[2:3] s_add_u32 s2, s2, 4 s_addc_u32 s3, s3, 0 s_cmp_eq_u32 s4, 0 s_cbranch_scc0 .LBB0_2 .LBB0_3: s_nop 0 s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z3addiPfS_ .amdhsa_group_segment_fixed_size 0 .amdhsa_private_segment_fixed_size 0 .amdhsa_kernarg_size 24 .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 5 .amdhsa_reserve_vcc 0 .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 _Z3addiPfS_, .Lfunc_end0-_Z3addiPfS_ .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 - .address_space: global .offset: 8 .size: 8 .value_kind: global_buffer - .address_space: global .offset: 16 .size: 8 .value_kind: global_buffer .group_segment_fixed_size: 0 .kernarg_segment_align: 8 .kernarg_segment_size: 24 .language: OpenCL C .language_version: - 2 - 0 .max_flat_workgroup_size: 1024 .name: _Z3addiPfS_ .private_segment_fixed_size: 0 .sgpr_count: 5 .sgpr_spill_count: 0 .symbol: _Z3addiPfS_.kd .uniform_work_group_size: 1 .uses_dynamic_stack: false .vgpr_count: 3 .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_0013c2dc_00000000-6_cuda_test.cudafe1.cpp" .text #APP .globl _ZSt21ios_base_library_initv #NO_APP .type _ZL26__cudaUnregisterBinaryUtilv, @function _ZL26__cudaUnregisterBinaryUtilv: .LFB3672: .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 .LFE3672: .size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv .globl _Z25__device_stub__Z3addiPfS_iPfS_ .type _Z25__device_stub__Z3addiPfS_iPfS_, @function _Z25__device_stub__Z3addiPfS_iPfS_: .LFB3694: .cfi_startproc endbr64 subq $136, %rsp .cfi_def_cfa_offset 144 movl %edi, 28(%rsp) movq %rsi, 16(%rsp) movq %rdx, 8(%rsp) movq %fs:40, %rax movq %rax, 120(%rsp) xorl %eax, %eax leaq 28(%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 _Z3addiPfS_(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 144 jmp .L3 .L8: call __stack_chk_fail@PLT .cfi_endproc .LFE3694: .size _Z25__device_stub__Z3addiPfS_iPfS_, .-_Z25__device_stub__Z3addiPfS_iPfS_ .globl _Z3addiPfS_ .type _Z3addiPfS_, @function _Z3addiPfS_: .LFB3695: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z25__device_stub__Z3addiPfS_iPfS_ addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE3695: .size _Z3addiPfS_, .-_Z3addiPfS_ .section .rodata.str1.1,"aMS",@progbits,1 .LC5: .string "max error " .text .globl main .type main, @function main: .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 $72, %rsp .cfi_def_cfa_offset 96 movq %fs:40, %rax movq %rax, 56(%rsp) xorl %eax, %eax leaq 16(%rsp), %rdi movl $1, %edx movl $4194304, %esi call cudaMallocManaged@PLT leaq 24(%rsp), %rdi movl $1, %edx movl $4194304, %esi call cudaMallocManaged@PLT movl $0, %eax movss .LC1(%rip), %xmm1 movss .LC2(%rip), %xmm0 .L12: movq 16(%rsp), %rdx movss %xmm1, (%rdx,%rax) movq 24(%rsp), %rdx movss %xmm0, (%rdx,%rax) addq $4, %rax cmpq $4194304, %rax jne .L12 movl $256, 44(%rsp) movl $1, 48(%rsp) movl $1, 52(%rsp) movl $1, 32(%rsp) movl $1, 36(%rsp) movl $1, 40(%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: call cudaDeviceSynchronize@PLT movq 24(%rsp), %rbx leaq 4194304(%rbx), %rbp movl $0x00000000, 12(%rsp) .L14: movss (%rbx), %xmm0 subss .LC3(%rip), %xmm0 andps .LC4(%rip), %xmm0 movss 12(%rsp), %xmm1 call fmaxf@PLT movss %xmm0, 12(%rsp) addq $4, %rbx cmpq %rbp, %rbx jne .L14 leaq .LC5(%rip), %rsi leaq _ZSt4cout(%rip), %rdi call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT movq %rax, %rdi pxor %xmm0, %xmm0 cvtss2sd 12(%rsp), %xmm0 call _ZNSo9_M_insertIdEERSoT_@PLT movq %rax, %rdi call _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@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 $72, %rsp .cfi_remember_state .cfi_def_cfa_offset 24 popq %rbx .cfi_def_cfa_offset 16 popq %rbp .cfi_def_cfa_offset 8 ret .L19: .cfi_restore_state movq 24(%rsp), %rdx movq 16(%rsp), %rsi movl $1048576, %edi call _Z25__device_stub__Z3addiPfS_iPfS_ jmp .L13 .L20: call __stack_chk_fail@PLT .cfi_endproc .LFE3669: .size main, .-main .section .rodata.str1.1 .LC6: .string "_Z3addiPfS_" .text .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB3697: .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 _Z3addiPfS_(%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 .LFE3697: .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 .LC1: .long 1065353216 .align 4 .LC2: .long 1073741824 .align 4 .LC3: .long 1077936128 .section .rodata.cst16,"aM",@progbits,16 .align 16 .LC4: .long 2147483647 .long 0 .long 0 .long 0 .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 "cuda_test.hip" # Start of file scope inline assembly .globl _ZSt21ios_base_library_initv # End of file scope inline assembly .globl _Z18__device_stub__addiPfS_ # -- Begin function _Z18__device_stub__addiPfS_ .p2align 4, 0x90 .type _Z18__device_stub__addiPfS_,@function _Z18__device_stub__addiPfS_: # @_Z18__device_stub__addiPfS_ .cfi_startproc # %bb.0: subq $104, %rsp .cfi_def_cfa_offset 112 movl %edi, 12(%rsp) movq %rsi, 72(%rsp) movq %rdx, 64(%rsp) leaq 12(%rsp), %rax movq %rax, 80(%rsp) leaq 72(%rsp), %rax movq %rax, 88(%rsp) leaq 64(%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 $_Z3addiPfS_, %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 _Z18__device_stub__addiPfS_, .Lfunc_end0-_Z18__device_stub__addiPfS_ .cfi_endproc # -- End function .section .rodata.cst4,"aM",@progbits,4 .p2align 2, 0x0 # -- Begin function main .LCPI1_0: .long 0xc0400000 # float -3 .section .rodata.cst16,"aM",@progbits,16 .p2align 4, 0x0 .LCPI1_1: .long 0x7fffffff # float NaN .long 0x7fffffff # float NaN .long 0x7fffffff # float NaN .long 0x7fffffff # float NaN .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 subq $152, %rsp .cfi_def_cfa_offset 176 .cfi_offset %rbx, -24 .cfi_offset %r14, -16 leaq 16(%rsp), %rdi movl $4194304, %esi # imm = 0x400000 movl $1, %edx callq hipMallocManaged leaq 8(%rsp), %rdi movl $4194304, %esi # imm = 0x400000 movl $1, %edx callq hipMallocManaged movq 16(%rsp), %rax xorl %ecx, %ecx movq 8(%rsp), %rdx .p2align 4, 0x90 .LBB1_1: # =>This Inner Loop Header: Depth=1 movl $1065353216, (%rax,%rcx,4) # imm = 0x3F800000 movl $1073741824, (%rdx,%rcx,4) # imm = 0x40000000 incq %rcx cmpq $1048576, %rcx # imm = 0x100000 jne .LBB1_1 # %bb.2: movabsq $4294967297, %rdi # imm = 0x100000001 leaq 255(%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 movl $1048576, 28(%rsp) # imm = 0x100000 movq %rax, 88(%rsp) movq %rcx, 80(%rsp) leaq 28(%rsp), %rax movq %rax, 96(%rsp) leaq 88(%rsp), %rax movq %rax, 104(%rsp) leaq 80(%rsp), %rax movq %rax, 112(%rsp) leaq 64(%rsp), %rdi leaq 48(%rsp), %rsi leaq 40(%rsp), %rdx leaq 32(%rsp), %rcx callq __hipPopCallConfiguration movq 64(%rsp), %rsi movl 72(%rsp), %edx movq 48(%rsp), %rcx movl 56(%rsp), %r8d leaq 96(%rsp), %r9 movl $_Z3addiPfS_, %edi pushq 32(%rsp) .cfi_adjust_cfa_offset 8 pushq 48(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $16, %rsp .cfi_adjust_cfa_offset -16 .LBB1_4: callq hipDeviceSynchronize xorps %xmm2, %xmm2 xorl %eax, %eax movq 8(%rsp), %rcx movss .LCPI1_0(%rip), %xmm0 # xmm0 = mem[0],zero,zero,zero movaps .LCPI1_1(%rip), %xmm1 # xmm1 = [NaN,NaN,NaN,NaN] movaps %xmm2, %xmm5 .p2align 4, 0x90 .LBB1_5: # =>This Inner Loop Header: Depth=1 movss (%rcx,%rax,4), %xmm3 # xmm3 = mem[0],zero,zero,zero addss %xmm0, %xmm3 andps %xmm1, %xmm3 cmpunordss %xmm5, %xmm5 movaps %xmm5, %xmm4 andps %xmm3, %xmm4 maxss %xmm2, %xmm3 andnps %xmm3, %xmm5 orps %xmm4, %xmm5 incq %rax movaps %xmm5, %xmm2 cmpq $1048576, %rax # imm = 0x100000 jne .LBB1_5 # %bb.6: movl $_ZSt4cout, %edi movl $.L.str, %esi movl $10, %edx movaps %xmm5, 128(%rsp) # 16-byte Spill callq _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l movaps 128(%rsp), %xmm0 # 16-byte Reload cvtss2sd %xmm0, %xmm0 movl $_ZSt4cout, %edi callq _ZNSo9_M_insertIdEERSoT_ movq (%rax), %rcx movq -24(%rcx), %rcx movq 240(%rax,%rcx), %rbx testq %rbx, %rbx je .LBB1_11 # %bb.7: # %_ZSt13__check_facetISt5ctypeIcEERKT_PS3_.exit.i.i cmpb $0, 56(%rbx) je .LBB1_9 # %bb.8: movzbl 67(%rbx), %ecx jmp .LBB1_10 .LBB1_9: 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_10: # %_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_.exit movsbl %cl, %esi movq %rax, %rdi callq _ZNSo3putEc movq %rax, %rdi callq _ZNSo5flushEv movq 16(%rsp), %rdi callq hipFree movq 8(%rsp), %rdi callq hipFree xorl %eax, %eax addq $152, %rsp .cfi_def_cfa_offset 24 popq %rbx .cfi_def_cfa_offset 16 popq %r14 .cfi_def_cfa_offset 8 retq .LBB1_11: .cfi_def_cfa_offset 176 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 $_Z3addiPfS_, %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 _Z3addiPfS_,@object # @_Z3addiPfS_ .section .rodata,"a",@progbits .globl _Z3addiPfS_ .p2align 3, 0x0 _Z3addiPfS_: .quad _Z18__device_stub__addiPfS_ .size _Z3addiPfS_, 8 .type .L.str,@object # @.str .section .rodata.str1.1,"aMS",@progbits,1 .L.str: .asciz "max error " .size .L.str, 11 .type .L__unnamed_1,@object # @0 .L__unnamed_1: .asciz "_Z3addiPfS_" .size .L__unnamed_1, 12 .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__addiPfS_ .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z3addiPfS_ .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 <stdio.h> // Simple transformation kernel __global__ void transformKernel( float* d_output, cudaTextureObject_t texObj, int width){ // Calculate normalized texture coordinates float u = threadIdx.x/(float) blockDim.x; // Read from texture and write to global memory d_output[threadIdx.x] = tex1D<float>(texObj,u); for (int i = 0; i < blockDim.x; i++){ if (threadIdx.x == i){ printf("(%.2f, %.2f )\t",u,d_output[threadIdx.x]); } __syncthreads(); } __syncthreads(); if (threadIdx.x == 1){ printf("\n"); } } // Host code int main(){ int width = 10; float * h_data =(float *) malloc(sizeof(float)*width);; for (int i=0; i<width; i++){ h_data[i]=(float) i; } int size = width*sizeof(float); // Allocate CUDA array in device memory cudaChannelFormatDesc channelDesc = cudaCreateChannelDesc( 32, 0, 0, 0, cudaChannelFormatKindFloat); cudaArray* cuArray; cudaMallocArray(&cuArray, &channelDesc, size,1); printf("cuda malloc array\n"); printf(cudaGetErrorString(cudaGetLastError())); printf("\n"); // Copy to device memory some data located at address h_data // in host memory cudaMemcpyToArray( cuArray, 0, 0, h_data, size, cudaMemcpyHostToDevice); printf("cuda memcpy to array\n"); printf(cudaGetErrorString(cudaGetLastError())); printf("\n"); // Specify texture struct cudaResourceDesc resDesc; memset(&resDesc, 0, sizeof(resDesc)); resDesc.resType = cudaResourceTypeArray; resDesc.res.array.array = cuArray; // Specify texture object parameters struct cudaTextureDesc texDesc; memset(&texDesc, 0, sizeof(texDesc)); texDesc.addressMode[0] = cudaAddressModeClamp; texDesc.addressMode[1] = cudaAddressModeClamp; texDesc.filterMode = cudaFilterModeLinear; texDesc.readMode = cudaReadModeElementType; texDesc.normalizedCoords = 1; // Create texture object cudaTextureObject_t texObj = 0; cudaCreateTextureObject( &texObj, &resDesc, &texDesc, NULL); printf("create texture \n"); printf(cudaGetErrorString(cudaGetLastError())); printf("\n"); int num = 10; // Allocate result of transformation in device memory float* d_output; cudaMalloc(&d_output, num*width*sizeof(float)); float* output = (float *) malloc(num*width*sizeof(float)); // Invoke kernel transformKernel<<<1,100>>>( d_output, texObj, width); // retrieve the output cudaMemcpy(output,d_output,num*width*sizeof(float),cudaMemcpyDeviceToHost); for (int i=0; i< width; i++){ printf("%.2f \t",h_data[i]); } printf("\n"); // Destroy texture object cudaDestroyTextureObject(texObj); // Free device memory cudaFreeArray(cuArray); cudaFree(d_output); return 0; }
code for sm_80 Function : _Z15transformKernelPfyi .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 */ /* 0x000fc600078e00ff */ /*0010*/ S2R R24, SR_TID.X ; /* 0x0000000000187919 */ /* 0x000e220000002100 */ /*0020*/ I2F.U32 R5, c[0x0][0x0] ; /* 0x0000000000057b06 */ /* 0x000e620000201000 */ /*0030*/ IADD3 R1, R1, -0x10, RZ ; /* 0xfffffff001017810 */ /* 0x000fe20007ffe0ff */ /*0040*/ ULDC.64 UR36, c[0x0][0x118] ; /* 0x0000460000247ab9 */ /* 0x000fe20000000a00 */ /*0050*/ BSSY B0, 0x140 ; /* 0x000000e000007945 */ /* 0x000fe40003800000 */ /*0060*/ R2UR UR44, R1 ; /* 0x00000000012c73c2 */ /* 0x0004e600000e0000 */ /*0070*/ MUFU.RCP R2, R5 ; /* 0x0000000500027308 */ /* 0x002e700000001000 */ /*0080*/ I2F.U32 R4, R24 ; /* 0x0000001800047306 */ /* 0x001e220000201000 */ /*0090*/ FFMA R0, -R5, R2, 1 ; /* 0x3f80000005007423 */ /* 0x002fc80000000102 */ /*00a0*/ FFMA R0, R2, R0, R2 ; /* 0x0000000002007223 */ /* 0x000fc60000000002 */ /*00b0*/ FCHK P0, R4, R5 ; /* 0x0000000504007302 */ /* 0x001e220000000000 */ /*00c0*/ FFMA R3, R4, R0, RZ ; /* 0x0000000004037223 */ /* 0x000fc800000000ff */ /*00d0*/ FFMA R2, -R5, R3, R4 ; /* 0x0000000305027223 */ /* 0x000fc80000000104 */ /*00e0*/ FFMA R2, R0, R2, R3 ; /* 0x0000000200027223 */ /* 0x000fe20000000003 */ /*00f0*/ @!P0 BRA 0x130 ; /* 0x0000003000008947 */ /* 0x001fea0003800000 */ /*0100*/ MOV R0, 0x120 ; /* 0x0000012000007802 */ /* 0x00cfe40000000f00 */ /*0110*/ CALL.REL.NOINC 0xba0 ; /* 0x00000a8000007944 */ /* 0x000fea0003c00000 */ /*0120*/ IMAD.MOV.U32 R2, RZ, RZ, R4 ; /* 0x000000ffff027224 */ /* 0x000fe400078e0004 */ /*0130*/ BSYNC B0 ; /* 0x0000000000007941 */ /* 0x00cfea0003800000 */ /*0140*/ IMAD.MOV.U32 R3, RZ, RZ, RZ ; /* 0x000000ffff037224 */ /* 0x000fe400078e00ff */ /*0150*/ IMAD.MOV.U32 R0, RZ, RZ, -0x3e000000 ; /* 0xc2000000ff007424 */ /* 0x000fc800078e00ff */ /*0160*/ TEX.SCR.LL RZ, R3, R2, R0, 0x0, 0x5a, 2D, 0x1 ; /* 0x30005a0002037b60 */ /* 0x000f4200019e01ff */ /*0170*/ IMAD.MOV.U32 R23, RZ, RZ, 0x4 ; /* 0x00000004ff177424 */ /* 0x000fe200078e00ff */ /*0180*/ ISETP.NE.AND P0, PT, RZ, c[0x0][0x0], PT ; /* 0x00000000ff007a0c */ /* 0x000fc60003f05270 */ /*0190*/ IMAD.WIDE.U32 R22, R24, R23, c[0x0][0x160] ; /* 0x0000580018167625 */ /* 0x000fca00078e0017 */ /*01a0*/ STG.E [R22.64], R3 ; /* 0x0000000316007986 */ /* 0x0201ea000c101924 */ /*01b0*/ @!P0 BRA 0xa90 ; /* 0x000008d000008947 */ /* 0x000fea0003800000 */ /*01c0*/ ULDC UR39, c[0x0][0x0] ; /* 0x0000000000277ab9 */ /* 0x000fe20000000800 */ /*01d0*/ F2F.F64.F32 R16, R2 ; /* 0x0000000200107310 */ /* 0x0002a20000201800 */ /*01e0*/ UIADD3 UR4, UR39, -0x1, URZ ; /* 0xffffffff27047890 */ /* 0x000fe4000fffe03f */ /*01f0*/ ULDC UR41, c[0x0][0x20] ; /* 0x0000080000297ab9 */ /* 0x000fe40000000800 */ /*0200*/ UISETP.GE.U32.AND UP0, UPT, UR4, 0x3, UPT ; /* 0x000000030400788c */ /* 0x000fc4000bf06070 */ /*0210*/ UIADD3 UR41, UP1, UR44, UR41, URZ ; /* 0x000000292c297290 */ /* 0x000fe4000ff3e03f */ /*0220*/ ULDC UR42, c[0x0][0x24] ; /* 0x00000900002a7ab9 */ /* 0x000fe40000000800 */ /*0230*/ PLOP3.LUT P0, PT, PT, PT, UP0, 0x80, 0x0 ; /* 0x000000000000781c */ /* 0x000fe20003f0f008 */ /*0240*/ ULOP3.LUT UR39, UR39, 0x3, URZ, 0xc0, !UPT ; /* 0x0000000327277892 */ /* 0x000fe4000f8ec03f */ /*0250*/ UIADD3.X UR42, URZ, UR42, URZ, UP1, !UPT ; /* 0x0000002a3f2a7290 */ /* 0x000fe40008ffe43f */ /*0260*/ UMOV UR38, URZ ; /* 0x0000003f00267c82 */ /* 0x000fd00008000000 */ /*0270*/ @!P0 BRA 0x8b0 ; /* 0x0000063000008947 */ /* 0x000fea0003800000 */ /*0280*/ IMAD.MOV R25, RZ, RZ, -R24 ; /* 0x000000ffff197224 */ /* 0x006fe200078e0a18 */ /*0290*/ ULDC UR40, c[0x0][0x0] ; /* 0x0000000000287ab9 */ /* 0x000fe40000000800 */ /*02a0*/ UIADD3 UR40, -UR39, UR40, URZ ; /* 0x0000002827287290 */ /* 0x000fe4000fffe13f */ /*02b0*/ UMOV UR38, URZ ; /* 0x0000003f00267c82 */ /* 0x000fe40008000000 */ /*02c0*/ ISETP.NE.AND P0, PT, R25, RZ, PT ; /* 0x000000ff1900720c */ /* 0x000fe20003f05270 */ /*02d0*/ UIADD3 UR40, UR40, -0x4, URZ ; /* 0xfffffffc28287890 */ /* 0x000fc8000fffe03f */ /*02e0*/ UISETP.NE.AND UP0, UPT, UR40, URZ, UPT ; /* 0x0000003f2800728c */ /* 0x000fc8000bf05270 */ /*02f0*/ UP2UR UR43, UPR, URZ, 0x1 ; /* 0x000000013f2b7883 */ /* 0x000fc80008000000 */ /*0300*/ @P0 BRA 0x420 ; /* 0x0000011000000947 */ /* 0x001fea0003800000 */ /*0310*/ LDG.E R18, [R22.64] ; /* 0x0000002416127981 */ /* 0x000ea2000c1e1900 */ /*0320*/ MOV R2, 0x0 ; /* 0x0000000000027802 */ /* 0x000fe20000000f00 */ /*0330*/ IMAD.MOV.U32 R4, RZ, RZ, c[0x4][0x8] ; /* 0x01000200ff047624 */ /* 0x000fe400078e00ff */ /*0340*/ IMAD.MOV.U32 R5, RZ, RZ, c[0x4][0xc] ; /* 0x01000300ff057624 */ /* 0x000fe400078e00ff */ /*0350*/ IMAD.U32 R6, RZ, RZ, UR41 ; /* 0x00000029ff067e24 */ /* 0x000fe2000f8e00ff */ /*0360*/ LDC.64 R2, c[0x4][R2] ; /* 0x0100000002027b82 */ /* 0x001e220000000a00 */ /*0370*/ IMAD.U32 R7, RZ, RZ, UR42 ; /* 0x0000002aff077e24 */ /* 0x000fe2000f8e00ff */ /*0380*/ F2F.F64.F32 R18, R18 ; /* 0x0000001200127310 */ /* 0x004e640000201800 */ /*0390*/ STL.128 [R1], R16 ; /* 0x0000001001007387 */ /* 0x0023e80000100c00 */ /*03a0*/ LEPC R8 ; /* 0x000000000008734e */ /* 0x001fe20000000000 */ /*03b0*/ MOV R11, 0x420 ; /* 0x00000420000b7802 */ /* 0x000fc40000000f00 */ /*03c0*/ MOV R20, 0x3a0 ; /* 0x000003a000147802 */ /* 0x000fe40000000f00 */ /*03d0*/ MOV R21, 0x0 ; /* 0x0000000000157802 */ /* 0x000fe40000000f00 */ /*03e0*/ MOV R0, 0x0 ; /* 0x0000000000007802 */ /* 0x000fe40000000f00 */ /*03f0*/ IADD3 R20, P0, P1, -R20, R11, R8 ; /* 0x0000000b14147210 */ /* 0x000fc8000791e108 */ /*0400*/ IADD3.X R21, ~R0, R21, R9, P0, P1 ; /* 0x0000001500157210 */ /* 0x000fc800007e2509 */ /*0410*/ CALL.ABS.NOINC R2 ; /* 0x0000000002007343 */ /* 0x002fea0003c00000 */ /*0420*/ WARPSYNC 0xffffffff ; /* 0xffffffff00007948 */ /* 0x000fe20003800000 */ /*0430*/ UIADD3 UR4, UR38, 0x1, URZ ; /* 0x0000000126047890 */ /* 0x000fe2000fffe03f */ /*0440*/ BAR.SYNC.DEFER_BLOCKING 0x0 ; /* 0x0000000000007b1d */ /* 0x000fea0000010000 */ /*0450*/ ISETP.NE.AND P0, PT, R24, UR4, PT ; /* 0x0000000418007c0c */ /* 0x000fda000bf05270 */ /*0460*/ @P0 BRA 0x580 ; /* 0x0000011000000947 */ /* 0x000fea0003800000 */ /*0470*/ LDG.E R0, [R22.64] ; /* 0x0000002416007981 */ /* 0x000ea2000c1e1900 */ /*0480*/ MOV R2, 0x0 ; /* 0x0000000000027802 */ /* 0x000fe20000000f00 */ /*0490*/ IMAD.MOV.U32 R4, RZ, RZ, c[0x4][0x8] ; /* 0x01000200ff047624 */ /* 0x000fe400078e00ff */ /*04a0*/ IMAD.MOV.U32 R5, RZ, RZ, c[0x4][0xc] ; /* 0x01000300ff057624 */ /* 0x000fe400078e00ff */ /*04b0*/ IMAD.U32 R6, RZ, RZ, UR41 ; /* 0x00000029ff067e24 */ /* 0x000fe2000f8e00ff */ /*04c0*/ LDC.64 R2, c[0x4][R2] ; /* 0x0100000002027b82 */ /* 0x001e220000000a00 */ /*04d0*/ IMAD.U32 R7, RZ, RZ, UR42 ; /* 0x0000002aff077e24 */ /* 0x000fe2000f8e00ff */ /*04e0*/ F2F.F64.F32 R18, R0 ; /* 0x0000000000127310 */ /* 0x004e640000201800 */ /*04f0*/ STL.128 [R1], R16 ; /* 0x0000001001007387 */ /* 0x0023e80000100c00 */ /*0500*/ LEPC R8 ; /* 0x000000000008734e */ /* 0x001fe20000000000 */ /*0510*/ MOV R11, 0x580 ; /* 0x00000580000b7802 */ /* 0x000fc40000000f00 */ /*0520*/ MOV R20, 0x500 ; /* 0x0000050000147802 */ /* 0x000fe40000000f00 */ /*0530*/ MOV R21, 0x0 ; /* 0x0000000000157802 */ /* 0x000fe40000000f00 */ /*0540*/ MOV R0, 0x0 ; /* 0x0000000000007802 */ /* 0x000fe40000000f00 */ /*0550*/ IADD3 R20, P0, P1, -R20, R11, R8 ; /* 0x0000000b14147210 */ /* 0x000fc8000791e108 */ /*0560*/ IADD3.X R21, ~R0, R21, R9, P0, P1 ; /* 0x0000001500157210 */ /* 0x000fc800007e2509 */ /*0570*/ CALL.ABS.NOINC R2 ; /* 0x0000000002007343 */ /* 0x002fea0003c00000 */ /*0580*/ WARPSYNC 0xffffffff ; /* 0xffffffff00007948 */ /* 0x000fe20003800000 */ /*0590*/ UIADD3 UR4, UR38, 0x2, URZ ; /* 0x0000000226047890 */ /* 0x000fe2000fffe03f */ /*05a0*/ BAR.SYNC.DEFER_BLOCKING 0x0 ; /* 0x0000000000007b1d */ /* 0x000fea0000010000 */ /*05b0*/ ISETP.NE.AND P0, PT, R24, UR4, PT ; /* 0x0000000418007c0c */ /* 0x000fda000bf05270 */ /*05c0*/ @P0 BRA 0x6e0 ; /* 0x0000011000000947 */ /* 0x000fea0003800000 */ /*05d0*/ LDG.E R0, [R22.64] ; /* 0x0000002416007981 */ /* 0x000ea2000c1e1900 */ /*05e0*/ MOV R2, 0x0 ; /* 0x0000000000027802 */ /* 0x000fe20000000f00 */ /*05f0*/ IMAD.MOV.U32 R4, RZ, RZ, c[0x4][0x8] ; /* 0x01000200ff047624 */ /* 0x000fe400078e00ff */ /*0600*/ IMAD.MOV.U32 R5, RZ, RZ, c[0x4][0xc] ; /* 0x01000300ff057624 */ /* 0x000fe400078e00ff */ /*0610*/ IMAD.U32 R6, RZ, RZ, UR41 ; /* 0x00000029ff067e24 */ /* 0x000fe2000f8e00ff */ /*0620*/ LDC.64 R2, c[0x4][R2] ; /* 0x0100000002027b82 */ /* 0x001e220000000a00 */ /*0630*/ IMAD.U32 R7, RZ, RZ, UR42 ; /* 0x0000002aff077e24 */ /* 0x000fe2000f8e00ff */ /*0640*/ F2F.F64.F32 R18, R0 ; /* 0x0000000000127310 */ /* 0x004e640000201800 */ /*0650*/ STL.128 [R1], R16 ; /* 0x0000001001007387 */ /* 0x0023e80000100c00 */ /*0660*/ LEPC R8 ; /* 0x000000000008734e */ /* 0x001fe20000000000 */ /*0670*/ MOV R11, 0x6e0 ; /* 0x000006e0000b7802 */ /* 0x000fc40000000f00 */ /*0680*/ MOV R20, 0x660 ; /* 0x0000066000147802 */ /* 0x000fe40000000f00 */ /*0690*/ MOV R21, 0x0 ; /* 0x0000000000157802 */ /* 0x000fe40000000f00 */ /*06a0*/ MOV R0, 0x0 ; /* 0x0000000000007802 */ /* 0x000fe40000000f00 */ /*06b0*/ IADD3 R20, P0, P1, -R20, R11, R8 ; /* 0x0000000b14147210 */ /* 0x000fc8000791e108 */ /*06c0*/ IADD3.X R21, ~R0, R21, R9, P0, P1 ; /* 0x0000001500157210 */ /* 0x000fc800007e2509 */ /*06d0*/ CALL.ABS.NOINC R2 ; /* 0x0000000002007343 */ /* 0x002fea0003c00000 */ /*06e0*/ WARPSYNC 0xffffffff ; /* 0xffffffff00007948 */ /* 0x000fe20003800000 */ /*06f0*/ UIADD3 UR4, UR38, 0x3, URZ ; /* 0x0000000326047890 */ /* 0x000fe2000fffe03f */ /*0700*/ BAR.SYNC.DEFER_BLOCKING 0x0 ; /* 0x0000000000007b1d */ /* 0x000fea0000010000 */ /*0710*/ ISETP.NE.AND P0, PT, R24, UR4, PT ; /* 0x0000000418007c0c */ /* 0x000fda000bf05270 */ /*0720*/ @P0 BRA 0x840 ; /* 0x0000011000000947 */ /* 0x000fea0003800000 */ /*0730*/ LDG.E R0, [R22.64] ; /* 0x0000002416007981 */ /* 0x000ea2000c1e1900 */ /*0740*/ MOV R2, 0x0 ; /* 0x0000000000027802 */ /* 0x000fe20000000f00 */ /*0750*/ IMAD.MOV.U32 R4, RZ, RZ, c[0x4][0x8] ; /* 0x01000200ff047624 */ /* 0x000fe400078e00ff */ /*0760*/ IMAD.MOV.U32 R5, RZ, RZ, c[0x4][0xc] ; /* 0x01000300ff057624 */ /* 0x000fe400078e00ff */ /*0770*/ IMAD.U32 R6, RZ, RZ, UR41 ; /* 0x00000029ff067e24 */ /* 0x000fe2000f8e00ff */ /*0780*/ LDC.64 R2, c[0x4][R2] ; /* 0x0100000002027b82 */ /* 0x001e220000000a00 */ /*0790*/ IMAD.U32 R7, RZ, RZ, UR42 ; /* 0x0000002aff077e24 */ /* 0x000fe2000f8e00ff */ /*07a0*/ F2F.F64.F32 R18, R0 ; /* 0x0000000000127310 */ /* 0x004e640000201800 */ /*07b0*/ STL.128 [R1], R16 ; /* 0x0000001001007387 */ /* 0x0023e80000100c00 */ /*07c0*/ LEPC R8 ; /* 0x000000000008734e */ /* 0x001fe20000000000 */ /*07d0*/ MOV R11, 0x840 ; /* 0x00000840000b7802 */ /* 0x000fc40000000f00 */ /*07e0*/ MOV R20, 0x7c0 ; /* 0x000007c000147802 */ /* 0x000fe40000000f00 */ /*07f0*/ MOV R21, 0x0 ; /* 0x0000000000157802 */ /* 0x000fe40000000f00 */ /*0800*/ MOV R0, 0x0 ; /* 0x0000000000007802 */ /* 0x000fe40000000f00 */ /*0810*/ IADD3 R20, P0, P1, -R20, R11, R8 ; /* 0x0000000b14147210 */ /* 0x000fc8000791e108 */ /*0820*/ IADD3.X R21, ~R0, R21, R9, P0, P1 ; /* 0x0000001500157210 */ /* 0x000fc800007e2509 */ /*0830*/ CALL.ABS.NOINC R2 ; /* 0x0000000002007343 */ /* 0x002fea0003c00000 */ /*0840*/ WARPSYNC 0xffffffff ; /* 0xffffffff00007948 */ /* 0x000fe40003800000 */ /*0850*/ UISETP.NE.AND UP0, UPT, UR43, URZ, UPT ; /* 0x0000003f2b00728c */ /* 0x000fe2000bf05270 */ /*0860*/ BAR.SYNC.DEFER_BLOCKING 0x0 ; /* 0x0000000000007b1d */ /* 0x000fe20000010000 */ /*0870*/ UIADD3 UR38, UR38, 0x4, URZ ; /* 0x0000000426267890 */ /* 0x000fe2000fffe03f */ /*0880*/ IADD3 R25, R25, 0x4, RZ ; /* 0x0000000419197810 */ /* 0x000fc60007ffe0ff */ /*0890*/ PLOP3.LUT P0, PT, PT, PT, UP0, 0x80, 0x0 ; /* 0x000000000000781c */ /* 0x000fda0003f0f008 */ /*08a0*/ @P0 BRA 0x2c0 ; /* 0xfffffa1000000947 */ /* 0x000fea000383ffff */ /*08b0*/ ISETP.NE.AND P0, PT, RZ, UR39, PT ; /* 0x00000027ff007c0c */ /* 0x006fda000bf05270 */ /*08c0*/ @!P0 BRA 0xa90 ; /* 0x000001c000008947 */ /* 0x000fea0003800000 */ /*08d0*/ IADD3 R18, -R24, UR38, RZ ; /* 0x0000002618127c10 */ /* 0x000fc8000fffe1ff */ /*08e0*/ ISETP.NE.AND P0, PT, R18, RZ, PT ; /* 0x000000ff1200720c */ /* 0x000fda0003f05270 */ /*08f0*/ @P0 BRA 0xa30 ; /* 0x0000013000000947 */ /* 0x001fea0003800000 */ /*0900*/ LDG.E R0, [R22.64] ; /* 0x0000002416007981 */ /* 0x000ea2000c1e1900 */ /*0910*/ MOV R2, 0x0 ; /* 0x0000000000027802 */ /* 0x000fe20000000f00 */ /*0920*/ IMAD.MOV.U32 R8, RZ, RZ, R16 ; /* 0x000000ffff087224 */ /* 0x000fe400078e0010 */ /*0930*/ IMAD.MOV.U32 R9, RZ, RZ, R17 ; /* 0x000000ffff097224 */ /* 0x000fe400078e0011 */ /*0940*/ IMAD.MOV.U32 R4, RZ, RZ, c[0x4][0x8] ; /* 0x01000200ff047624 */ /* 0x000fe200078e00ff */ /*0950*/ LDC.64 R2, c[0x4][R2] ; /* 0x0100000002027b82 */ /* 0x001e220000000a00 */ /*0960*/ IMAD.MOV.U32 R5, RZ, RZ, c[0x4][0xc] ; /* 0x01000300ff057624 */ /* 0x000fe400078e00ff */ /*0970*/ IMAD.U32 R6, RZ, RZ, UR41 ; /* 0x00000029ff067e24 */ /* 0x000fc4000f8e00ff */ /*0980*/ IMAD.U32 R7, RZ, RZ, UR42 ; /* 0x0000002aff077e24 */ /* 0x000fe2000f8e00ff */ /*0990*/ F2F.F64.F32 R10, R0 ; /* 0x00000000000a7310 */ /* 0x004e640000201800 */ /*09a0*/ STL.128 [R1], R8 ; /* 0x0000000801007387 */ /* 0x0023e80000100c00 */ /*09b0*/ LEPC R8 ; /* 0x000000000008734e */ /* 0x003fe20000000000 */ /*09c0*/ MOV R11, 0xa30 ; /* 0x00000a30000b7802 */ /* 0x000fe40000000f00 */ /*09d0*/ MOV R20, 0x9b0 ; /* 0x000009b000147802 */ /* 0x000fe40000000f00 */ /*09e0*/ MOV R21, 0x0 ; /* 0x0000000000157802 */ /* 0x000fe40000000f00 */ /*09f0*/ MOV R0, 0x0 ; /* 0x0000000000007802 */ /* 0x000fc40000000f00 */ /*0a00*/ IADD3 R20, P0, P1, -R20, R11, R8 ; /* 0x0000000b14147210 */ /* 0x000fc8000791e108 */ /*0a10*/ IADD3.X R21, ~R0, R21, R9, P0, P1 ; /* 0x0000001500157210 */ /* 0x000fc800007e2509 */ /*0a20*/ CALL.ABS.NOINC R2 ; /* 0x0000000002007343 */ /* 0x000fea0003c00000 */ /*0a30*/ WARPSYNC 0xffffffff ; /* 0xffffffff00007948 */ /* 0x000fe40003800000 */ /*0a40*/ UIADD3 UR39, UR39, -0x1, URZ ; /* 0xffffffff27277890 */ /* 0x000fe2000fffe03f */ /*0a50*/ BAR.SYNC.DEFER_BLOCKING 0x0 ; /* 0x0000000000007b1d */ /* 0x000fe20000010000 */ /*0a60*/ IADD3 R18, R18, 0x1, RZ ; /* 0x0000000112127810 */ /* 0x000fc80007ffe0ff */ /*0a70*/ ISETP.NE.AND P0, PT, RZ, UR39, PT ; /* 0x00000027ff007c0c */ /* 0x000fda000bf05270 */ /*0a80*/ @P0 BRA 0x8e0 ; /* 0xfffffe5000000947 */ /* 0x000fea000383ffff */ /*0a90*/ BAR.SYNC.DEFER_BLOCKING 0x0 ; /* 0x0000000000007b1d */ /* 0x000fe20000010000 */ /*0aa0*/ ISETP.NE.AND P0, PT, R24, 0x1, PT ; /* 0x000000011800780c */ /* 0x000fda0003f05270 */ /*0ab0*/ @P0 EXIT ; /* 0x000000000000094d */ /* 0x000fea0003800000 */ /*0ac0*/ MOV R0, 0x0 ; /* 0x0000000000007802 */ /* 0x000fe20000000f00 */ /*0ad0*/ IMAD.MOV.U32 R4, RZ, RZ, c[0x4][0x10] ; /* 0x01000400ff047624 */ /* 0x000fe200078e00ff */ /*0ae0*/ CS2R R6, SRZ ; /* 0x0000000000067805 */ /* 0x000fe2000001ff00 */ /*0af0*/ IMAD.MOV.U32 R5, RZ, RZ, c[0x4][0x14] ; /* 0x01000500ff057624 */ /* 0x000fe200078e00ff */ /*0b00*/ LDC.64 R2, c[0x4][R0] ; /* 0x0100000000027b82 */ /* 0x00106c0000000a00 */ /*0b10*/ LEPC R8 ; /* 0x000000000008734e */ /* 0x000fe20000000000 */ /*0b20*/ MOV R11, 0xb90 ; /* 0x00000b90000b7802 */ /* 0x000fe40000000f00 */ /*0b30*/ MOV R20, 0xb10 ; /* 0x00000b1000147802 */ /* 0x000fe40000000f00 */ /*0b40*/ MOV R21, 0x0 ; /* 0x0000000000157802 */ /* 0x000fe40000000f00 */ /*0b50*/ MOV R0, 0x0 ; /* 0x0000000000007802 */ /* 0x001fc40000000f00 */ /*0b60*/ IADD3 R20, P0, P1, -R20, R11, R8 ; /* 0x0000000b14147210 */ /* 0x000fc8000791e108 */ /*0b70*/ IADD3.X R21, ~R0, R21, R9, P0, P1 ; /* 0x0000001500157210 */ /* 0x000fc800007e2509 */ /*0b80*/ CALL.ABS.NOINC R2 ; /* 0x0000000002007343 */ /* 0x002fea0003c00000 */ /*0b90*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*0ba0*/ SHF.R.U32.HI R3, RZ, 0x17, R5.reuse ; /* 0x00000017ff037819 */ /* 0x100fe20000011605 */ /*0bb0*/ BSSY B1, 0x1200 ; /* 0x0000064000017945 */ /* 0x000fe20003800000 */ /*0bc0*/ SHF.R.U32.HI R2, RZ, 0x17, R4.reuse ; /* 0x00000017ff027819 */ /* 0x100fe20000011604 */ /*0bd0*/ IMAD.MOV.U32 R6, RZ, RZ, R4 ; /* 0x000000ffff067224 */ /* 0x000fe200078e0004 */ /*0be0*/ LOP3.LUT R3, R3, 0xff, RZ, 0xc0, !PT ; /* 0x000000ff03037812 */ /* 0x000fe200078ec0ff */ /*0bf0*/ IMAD.MOV.U32 R7, RZ, RZ, R5 ; /* 0x000000ffff077224 */ /* 0x000fe200078e0005 */ /*0c00*/ LOP3.LUT R2, R2, 0xff, RZ, 0xc0, !PT ; /* 0x000000ff02027812 */ /* 0x000fe400078ec0ff */ /*0c10*/ IADD3 R10, R3, -0x1, RZ ; /* 0xffffffff030a7810 */ /* 0x000fe40007ffe0ff */ /*0c20*/ IADD3 R9, R2, -0x1, RZ ; /* 0xffffffff02097810 */ /* 0x000fc40007ffe0ff */ /*0c30*/ ISETP.GT.U32.AND P0, PT, R10, 0xfd, PT ; /* 0x000000fd0a00780c */ /* 0x000fc80003f04070 */ /*0c40*/ ISETP.GT.U32.OR P0, PT, R9, 0xfd, P0 ; /* 0x000000fd0900780c */ /* 0x000fda0000704470 */ /*0c50*/ @!P0 IMAD.MOV.U32 R8, RZ, RZ, RZ ; /* 0x000000ffff088224 */ /* 0x000fe200078e00ff */ /*0c60*/ @!P0 BRA 0xde0 ; /* 0x0000017000008947 */ /* 0x000fea0003800000 */ /*0c70*/ FSETP.GTU.FTZ.AND P0, PT, |R4|, +INF , PT ; /* 0x7f8000000400780b */ /* 0x000fe40003f1c200 */ /*0c80*/ FSETP.GTU.FTZ.AND P1, PT, |R5|, +INF , PT ; /* 0x7f8000000500780b */ /* 0x000fc80003f3c200 */ /*0c90*/ PLOP3.LUT P0, PT, P0, P1, PT, 0xa8, 0x0 ; /* 0x000000000000781c */ /* 0x000fda0000703570 */ /*0ca0*/ @P0 BRA 0x11e0 ; /* 0x0000053000000947 */ /* 0x000fea0003800000 */ /*0cb0*/ LOP3.LUT P0, RZ, R7, 0x7fffffff, R6, 0xc8, !PT ; /* 0x7fffffff07ff7812 */ /* 0x000fda000780c806 */ /*0cc0*/ @!P0 BRA 0x11c0 ; /* 0x000004f000008947 */ /* 0x000fea0003800000 */ /*0cd0*/ FSETP.NEU.FTZ.AND P2, PT, |R4|.reuse, +INF , PT ; /* 0x7f8000000400780b */ /* 0x040fe40003f5d200 */ /*0ce0*/ FSETP.NEU.FTZ.AND P1, PT, |R5|, +INF , PT ; /* 0x7f8000000500780b */ /* 0x000fe40003f3d200 */ /*0cf0*/ FSETP.NEU.FTZ.AND P0, PT, |R4|, +INF , PT ; /* 0x7f8000000400780b */ /* 0x000fd60003f1d200 */ /*0d00*/ @!P1 BRA !P2, 0x11c0 ; /* 0x000004b000009947 */ /* 0x000fea0005000000 */ /*0d10*/ LOP3.LUT P2, RZ, R6, 0x7fffffff, RZ, 0xc0, !PT ; /* 0x7fffffff06ff7812 */ /* 0x000fc8000784c0ff */ /*0d20*/ PLOP3.LUT P1, PT, P1, P2, PT, 0x2a, 0x0 ; /* 0x000000000000781c */ /* 0x000fda0000f24572 */ /*0d30*/ @P1 BRA 0x11a0 ; /* 0x0000046000001947 */ /* 0x000fea0003800000 */ /*0d40*/ LOP3.LUT P1, RZ, R7, 0x7fffffff, RZ, 0xc0, !PT ; /* 0x7fffffff07ff7812 */ /* 0x000fc8000782c0ff */ /*0d50*/ PLOP3.LUT P0, PT, P0, P1, PT, 0x2a, 0x0 ; /* 0x000000000000781c */ /* 0x000fda0000702572 */ /*0d60*/ @P0 BRA 0x1170 ; /* 0x0000040000000947 */ /* 0x000fea0003800000 */ /*0d70*/ ISETP.GE.AND P0, PT, R9, RZ, PT ; /* 0x000000ff0900720c */ /* 0x000fe40003f06270 */ /*0d80*/ ISETP.GE.AND P1, PT, R10, RZ, PT ; /* 0x000000ff0a00720c */ /* 0x000fd60003f26270 */ /*0d90*/ @P0 IMAD.MOV.U32 R8, RZ, RZ, RZ ; /* 0x000000ffff080224 */ /* 0x000fe400078e00ff */ /*0da0*/ @!P0 IMAD.MOV.U32 R8, RZ, RZ, -0x40 ; /* 0xffffffc0ff088424 */ /* 0x000fe400078e00ff */ /*0db0*/ @!P0 FFMA R6, R4, 1.84467440737095516160e+19, RZ ; /* 0x5f80000004068823 */ /* 0x000fe400000000ff */ /*0dc0*/ @!P1 FFMA R7, R5, 1.84467440737095516160e+19, RZ ; /* 0x5f80000005079823 */ /* 0x000fe200000000ff */ /*0dd0*/ @!P1 IADD3 R8, R8, 0x40, RZ ; /* 0x0000004008089810 */ /* 0x000fe40007ffe0ff */ /*0de0*/ LEA R4, R3, 0xc0800000, 0x17 ; /* 0xc080000003047811 */ /* 0x000fe200078eb8ff */ /*0df0*/ BSSY B2, 0x1160 ; /* 0x0000036000027945 */ /* 0x000fe80003800000 */ /*0e00*/ IMAD.IADD R7, R7, 0x1, -R4 ; /* 0x0000000107077824 */ /* 0x000fe200078e0a04 */ /*0e10*/ IADD3 R4, R2, -0x7f, RZ ; /* 0xffffff8102047810 */ /* 0x000fc60007ffe0ff */ /*0e20*/ MUFU.RCP R5, R7 ; /* 0x0000000700057308 */ /* 0x000e220000001000 */ /*0e30*/ FADD.FTZ R9, -R7, -RZ ; /* 0x800000ff07097221 */ /* 0x000fe40000010100 */ /*0e40*/ IMAD R6, R4, -0x800000, R6 ; /* 0xff80000004067824 */ /* 0x000fe400078e0206 */ /*0e50*/ FFMA R2, R5, R9, 1 ; /* 0x3f80000005027423 */ /* 0x001fc80000000009 */ /*0e60*/ FFMA R11, R5, R2, R5 ; /* 0x00000002050b7223 */ /* 0x000fc80000000005 */ /*0e70*/ FFMA R2, R6, R11, RZ ; /* 0x0000000b06027223 */ /* 0x000fc800000000ff */ /*0e80*/ FFMA R5, R9, R2, R6 ; /* 0x0000000209057223 */ /* 0x000fc80000000006 */ /*0e90*/ FFMA R10, R11, R5, R2 ; /* 0x000000050b0a7223 */ /* 0x000fe20000000002 */ /*0ea0*/ IADD3 R5, R4, 0x7f, -R3 ; /* 0x0000007f04057810 */ /* 0x000fc60007ffe803 */ /*0eb0*/ FFMA R6, R9, R10, R6 ; /* 0x0000000a09067223 */ /* 0x000fe40000000006 */ /*0ec0*/ IMAD.IADD R5, R5, 0x1, R8 ; /* 0x0000000105057824 */ /* 0x000fe400078e0208 */ /*0ed0*/ FFMA R2, R11, R6, R10 ; /* 0x000000060b027223 */ /* 0x000fca000000000a */ /*0ee0*/ SHF.R.U32.HI R3, RZ, 0x17, R2 ; /* 0x00000017ff037819 */ /* 0x000fc80000011602 */ /*0ef0*/ LOP3.LUT R3, R3, 0xff, RZ, 0xc0, !PT ; /* 0x000000ff03037812 */ /* 0x000fca00078ec0ff */ /*0f00*/ IMAD.IADD R7, R3, 0x1, R5 ; /* 0x0000000103077824 */ /* 0x000fca00078e0205 */ /*0f10*/ IADD3 R3, R7, -0x1, RZ ; /* 0xffffffff07037810 */ /* 0x000fc80007ffe0ff */ /*0f20*/ ISETP.GE.U32.AND P0, PT, R3, 0xfe, PT ; /* 0x000000fe0300780c */ /* 0x000fda0003f06070 */ /*0f30*/ @!P0 BRA 0x1140 ; /* 0x0000020000008947 */ /* 0x000fea0003800000 */ /*0f40*/ ISETP.GT.AND P0, PT, R7, 0xfe, PT ; /* 0x000000fe0700780c */ /* 0x000fda0003f04270 */ /*0f50*/ @P0 BRA 0x1110 ; /* 0x000001b000000947 */ /* 0x000fea0003800000 */ /*0f60*/ ISETP.GE.AND P0, PT, R7, 0x1, PT ; /* 0x000000010700780c */ /* 0x000fda0003f06270 */ /*0f70*/ @P0 BRA 0x1150 ; /* 0x000001d000000947 */ /* 0x000fea0003800000 */ /*0f80*/ ISETP.GE.AND P0, PT, R7, -0x18, PT ; /* 0xffffffe80700780c */ /* 0x000fe40003f06270 */ /*0f90*/ LOP3.LUT R2, R2, 0x80000000, RZ, 0xc0, !PT ; /* 0x8000000002027812 */ /* 0x000fd600078ec0ff */ /*0fa0*/ @!P0 BRA 0x1150 ; /* 0x000001a000008947 */ /* 0x000fea0003800000 */ /*0fb0*/ FFMA.RZ R3, R11, R6.reuse, R10.reuse ; /* 0x000000060b037223 */ /* 0x180fe2000000c00a */ /*0fc0*/ ISETP.NE.AND P2, PT, R7, RZ, PT ; /* 0x000000ff0700720c */ /* 0x000fe20003f45270 */ /*0fd0*/ FFMA.RM R4, R11, R6.reuse, R10.reuse ; /* 0x000000060b047223 */ /* 0x180fe2000000400a */ /*0fe0*/ ISETP.NE.AND P1, PT, R7, RZ, PT ; /* 0x000000ff0700720c */ /* 0x000fe40003f25270 */ /*0ff0*/ LOP3.LUT R5, R3, 0x7fffff, RZ, 0xc0, !PT ; /* 0x007fffff03057812 */ /* 0x000fe200078ec0ff */ /*1000*/ FFMA.RP R3, R11, R6, R10 ; /* 0x000000060b037223 */ /* 0x000fe2000000800a */ /*1010*/ IADD3 R6, R7, 0x20, RZ ; /* 0x0000002007067810 */ /* 0x000fe20007ffe0ff */ /*1020*/ IMAD.MOV R7, RZ, RZ, -R7 ; /* 0x000000ffff077224 */ /* 0x000fe200078e0a07 */ /*1030*/ LOP3.LUT R5, R5, 0x800000, RZ, 0xfc, !PT ; /* 0x0080000005057812 */ /* 0x000fe400078efcff */ /*1040*/ FSETP.NEU.FTZ.AND P0, PT, R3, R4, PT ; /* 0x000000040300720b */ /* 0x000fc40003f1d000 */ /*1050*/ SHF.L.U32 R6, R5, R6, RZ ; /* 0x0000000605067219 */ /* 0x000fe400000006ff */ /*1060*/ SEL R4, R7, RZ, P2 ; /* 0x000000ff07047207 */ /* 0x000fe40001000000 */ /*1070*/ ISETP.NE.AND P1, PT, R6, RZ, P1 ; /* 0x000000ff0600720c */ /* 0x000fe40000f25270 */ /*1080*/ SHF.R.U32.HI R4, RZ, R4, R5 ; /* 0x00000004ff047219 */ /* 0x000fe40000011605 */ /*1090*/ PLOP3.LUT P0, PT, P0, P1, PT, 0xa8, 0x0 ; /* 0x000000000000781c */ /* 0x000fe40000703570 */ /*10a0*/ SHF.R.U32.HI R6, RZ, 0x1, R4 ; /* 0x00000001ff067819 */ /* 0x000fc40000011604 */ /*10b0*/ SEL R3, RZ, 0x1, !P0 ; /* 0x00000001ff037807 */ /* 0x000fc80004000000 */ /*10c0*/ LOP3.LUT R3, R3, 0x1, R6, 0xf8, !PT ; /* 0x0000000103037812 */ /* 0x000fc800078ef806 */ /*10d0*/ LOP3.LUT R3, R3, R4, RZ, 0xc0, !PT ; /* 0x0000000403037212 */ /* 0x000fca00078ec0ff */ /*10e0*/ IMAD.IADD R3, R6, 0x1, R3 ; /* 0x0000000106037824 */ /* 0x000fca00078e0203 */ /*10f0*/ LOP3.LUT R2, R3, R2, RZ, 0xfc, !PT ; /* 0x0000000203027212 */ /* 0x000fe200078efcff */ /*1100*/ BRA 0x1150 ; /* 0x0000004000007947 */ /* 0x000fea0003800000 */ /*1110*/ LOP3.LUT R2, R2, 0x80000000, RZ, 0xc0, !PT ; /* 0x8000000002027812 */ /* 0x000fc800078ec0ff */ /*1120*/ LOP3.LUT R2, R2, 0x7f800000, RZ, 0xfc, !PT ; /* 0x7f80000002027812 */ /* 0x000fe200078efcff */ /*1130*/ BRA 0x1150 ; /* 0x0000001000007947 */ /* 0x000fea0003800000 */ /*1140*/ IMAD R2, R5, 0x800000, R2 ; /* 0x0080000005027824 */ /* 0x000fe400078e0202 */ /*1150*/ BSYNC B2 ; /* 0x0000000000027941 */ /* 0x000fea0003800000 */ /*1160*/ BRA 0x11f0 ; /* 0x0000008000007947 */ /* 0x000fea0003800000 */ /*1170*/ LOP3.LUT R2, R7, 0x80000000, R6, 0x48, !PT ; /* 0x8000000007027812 */ /* 0x000fc800078e4806 */ /*1180*/ LOP3.LUT R2, R2, 0x7f800000, RZ, 0xfc, !PT ; /* 0x7f80000002027812 */ /* 0x000fe200078efcff */ /*1190*/ BRA 0x11f0 ; /* 0x0000005000007947 */ /* 0x000fea0003800000 */ /*11a0*/ LOP3.LUT R2, R7, 0x80000000, R6, 0x48, !PT ; /* 0x8000000007027812 */ /* 0x000fe200078e4806 */ /*11b0*/ BRA 0x11f0 ; /* 0x0000003000007947 */ /* 0x000fea0003800000 */ /*11c0*/ MUFU.RSQ R2, -QNAN ; /* 0xffc0000000027908 */ /* 0x000e220000001400 */ /*11d0*/ BRA 0x11f0 ; /* 0x0000001000007947 */ /* 0x000fea0003800000 */ /*11e0*/ FADD.FTZ R2, R4, R5 ; /* 0x0000000504027221 */ /* 0x000fe40000010000 */ /*11f0*/ BSYNC B1 ; /* 0x0000000000017941 */ /* 0x000fea0003800000 */ /*1200*/ IMAD.MOV.U32 R4, RZ, RZ, R2 ; /* 0x000000ffff047224 */ /* 0x001fe400078e0002 */ /*1210*/ IMAD.MOV.U32 R2, RZ, RZ, R0 ; /* 0x000000ffff027224 */ /* 0x000fe400078e0000 */ /*1220*/ IMAD.MOV.U32 R3, RZ, RZ, 0x0 ; /* 0x00000000ff037424 */ /* 0x000fc800078e00ff */ /*1230*/ RET.REL.NODEC R2 0x0 ; /* 0xffffedc002007950 */ /* 0x000fea0003c3ffff */ /*1240*/ BRA 0x1240; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*1250*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*1260*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*1270*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*1280*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*1290*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*12a0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*12b0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*12c0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*12d0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*12e0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*12f0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ ..........
You are a helpful coding assistant specialized in converting CUDA source code to CUDA host assembly.
#include <stdio.h> // Simple transformation kernel __global__ void transformKernel( float* d_output, cudaTextureObject_t texObj, int width){ // Calculate normalized texture coordinates float u = threadIdx.x/(float) blockDim.x; // Read from texture and write to global memory d_output[threadIdx.x] = tex1D<float>(texObj,u); for (int i = 0; i < blockDim.x; i++){ if (threadIdx.x == i){ printf("(%.2f, %.2f )\t",u,d_output[threadIdx.x]); } __syncthreads(); } __syncthreads(); if (threadIdx.x == 1){ printf("\n"); } } // Host code int main(){ int width = 10; float * h_data =(float *) malloc(sizeof(float)*width);; for (int i=0; i<width; i++){ h_data[i]=(float) i; } int size = width*sizeof(float); // Allocate CUDA array in device memory cudaChannelFormatDesc channelDesc = cudaCreateChannelDesc( 32, 0, 0, 0, cudaChannelFormatKindFloat); cudaArray* cuArray; cudaMallocArray(&cuArray, &channelDesc, size,1); printf("cuda malloc array\n"); printf(cudaGetErrorString(cudaGetLastError())); printf("\n"); // Copy to device memory some data located at address h_data // in host memory cudaMemcpyToArray( cuArray, 0, 0, h_data, size, cudaMemcpyHostToDevice); printf("cuda memcpy to array\n"); printf(cudaGetErrorString(cudaGetLastError())); printf("\n"); // Specify texture struct cudaResourceDesc resDesc; memset(&resDesc, 0, sizeof(resDesc)); resDesc.resType = cudaResourceTypeArray; resDesc.res.array.array = cuArray; // Specify texture object parameters struct cudaTextureDesc texDesc; memset(&texDesc, 0, sizeof(texDesc)); texDesc.addressMode[0] = cudaAddressModeClamp; texDesc.addressMode[1] = cudaAddressModeClamp; texDesc.filterMode = cudaFilterModeLinear; texDesc.readMode = cudaReadModeElementType; texDesc.normalizedCoords = 1; // Create texture object cudaTextureObject_t texObj = 0; cudaCreateTextureObject( &texObj, &resDesc, &texDesc, NULL); printf("create texture \n"); printf(cudaGetErrorString(cudaGetLastError())); printf("\n"); int num = 10; // Allocate result of transformation in device memory float* d_output; cudaMalloc(&d_output, num*width*sizeof(float)); float* output = (float *) malloc(num*width*sizeof(float)); // Invoke kernel transformKernel<<<1,100>>>( d_output, texObj, width); // retrieve the output cudaMemcpy(output,d_output,num*width*sizeof(float),cudaMemcpyDeviceToHost); for (int i=0; i< width; i++){ printf("%.2f \t",h_data[i]); } printf("\n"); // Destroy texture object cudaDestroyTextureObject(texObj); // Free device memory cudaFreeArray(cuArray); cudaFree(d_output); return 0; }
.file "tmpxft_000311e1_00000000-6_texture_test.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 _Z37__device_stub__Z15transformKernelPfyiPfyi .type _Z37__device_stub__Z15transformKernelPfyiPfyi, @function _Z37__device_stub__Z15transformKernelPfyiPfyi: .LFB2082: .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 _Z15transformKernelPfyi(%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 _Z37__device_stub__Z15transformKernelPfyiPfyi, .-_Z37__device_stub__Z15transformKernelPfyiPfyi .globl _Z15transformKernelPfyi .type _Z15transformKernelPfyi, @function _Z15transformKernelPfyi: .LFB2083: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z37__device_stub__Z15transformKernelPfyiPfyi addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2083: .size _Z15transformKernelPfyi, .-_Z15transformKernelPfyi .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "cuda malloc array\n" .LC1: .string "\n" .LC2: .string "cuda memcpy to array\n" .LC3: .string "create texture \n" .LC4: .string "%.2f \t" .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 $224, %rsp .cfi_def_cfa_offset 256 movq %fs:40, %rax movq %rax, 216(%rsp) xorl %eax, %eax movl $40, %edi call malloc@PLT movq %rax, %rbp movl $0, %eax .L12: pxor %xmm0, %xmm0 cvtsi2ssl %eax, %xmm0 movss %xmm0, 0(%rbp,%rax,4) addq $1, %rax cmpq $10, %rax jne .L12 leaq 48(%rsp), %rbx movl $2, %r9d movl $0, %r8d movl $0, %ecx movl $0, %edx movl $32, %esi movq %rbx, %rdi call cudaCreateChannelDesc@PLT movq %rsp, %rdi movl $0, %r8d movl $1, %ecx movl $40, %edx movq %rbx, %rsi call cudaMallocArray@PLT leaq .LC0(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT leaq .LC1(%rip), %rbx movq %rbx, %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %r9d movl $40, %r8d movq %rbp, %rcx movl $0, %edx movl $0, %esi movq (%rsp), %rdi call cudaMemcpyToArray@PLT leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movq %rbx, %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT leaq 80(%rsp), %rsi pxor %xmm0, %xmm0 movaps %xmm0, 80(%rsp) movaps %xmm0, 96(%rsp) movaps %xmm0, 112(%rsp) movaps %xmm0, 128(%rsp) movq (%rsp), %rax movq %rax, 88(%rsp) leaq 144(%rsp), %rdx movups %xmm0, 152(%rsp) movups %xmm0, 168(%rsp) movups %xmm0, 184(%rsp) movups %xmm0, 200(%rsp) movl $1, 144(%rsp) movl $1, 148(%rsp) movl $1, 156(%rsp) movl $1, 184(%rsp) movq $0, 8(%rsp) leaq 8(%rsp), %rdi movl $0, %ecx call cudaCreateTextureObject@PLT leaq .LC3(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movq %rbx, %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT leaq 16(%rsp), %rdi movl $400, %esi call cudaMalloc@PLT movl $400, %edi call malloc@PLT movq %rax, %rbx movl $100, 36(%rsp) movl $1, 40(%rsp) movl $1, 24(%rsp) movl $1, 28(%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 .L19 .L13: movl $2, %ecx movl $400, %edx movq 16(%rsp), %rsi movq %rbx, %rdi call cudaMemcpy@PLT movq %rbp, %rbx addq $40, %rbp leaq .LC4(%rip), %r12 .L14: pxor %xmm0, %xmm0 cvtss2sd (%rbx), %xmm0 movq %r12, %rsi movl $2, %edi movl $1, %eax call __printf_chk@PLT addq $4, %rbx cmpq %rbp, %rbx jne .L14 leaq .LC1(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movq 8(%rsp), %rdi call cudaDestroyTextureObject@PLT movq (%rsp), %rdi call cudaFreeArray@PLT movq 16(%rsp), %rdi call cudaFree@PLT movq 216(%rsp), %rax subq %fs:40, %rax jne .L20 movl $0, %eax addq $224, %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 movl $10, %edx movq 8(%rsp), %rsi movq 16(%rsp), %rdi call _Z37__device_stub__Z15transformKernelPfyiPfyi jmp .L13 .L20: call __stack_chk_fail@PLT .cfi_endproc .LFE2057: .size main, .-main .section .rodata.str1.1 .LC5: .string "_Z15transformKernelPfyi" .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 .LC5(%rip), %rdx movq %rdx, %rcx leaq _Z15transformKernelPfyi(%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> // Simple transformation kernel __global__ void transformKernel( float* d_output, cudaTextureObject_t texObj, int width){ // Calculate normalized texture coordinates float u = threadIdx.x/(float) blockDim.x; // Read from texture and write to global memory d_output[threadIdx.x] = tex1D<float>(texObj,u); for (int i = 0; i < blockDim.x; i++){ if (threadIdx.x == i){ printf("(%.2f, %.2f )\t",u,d_output[threadIdx.x]); } __syncthreads(); } __syncthreads(); if (threadIdx.x == 1){ printf("\n"); } } // Host code int main(){ int width = 10; float * h_data =(float *) malloc(sizeof(float)*width);; for (int i=0; i<width; i++){ h_data[i]=(float) i; } int size = width*sizeof(float); // Allocate CUDA array in device memory cudaChannelFormatDesc channelDesc = cudaCreateChannelDesc( 32, 0, 0, 0, cudaChannelFormatKindFloat); cudaArray* cuArray; cudaMallocArray(&cuArray, &channelDesc, size,1); printf("cuda malloc array\n"); printf(cudaGetErrorString(cudaGetLastError())); printf("\n"); // Copy to device memory some data located at address h_data // in host memory cudaMemcpyToArray( cuArray, 0, 0, h_data, size, cudaMemcpyHostToDevice); printf("cuda memcpy to array\n"); printf(cudaGetErrorString(cudaGetLastError())); printf("\n"); // Specify texture struct cudaResourceDesc resDesc; memset(&resDesc, 0, sizeof(resDesc)); resDesc.resType = cudaResourceTypeArray; resDesc.res.array.array = cuArray; // Specify texture object parameters struct cudaTextureDesc texDesc; memset(&texDesc, 0, sizeof(texDesc)); texDesc.addressMode[0] = cudaAddressModeClamp; texDesc.addressMode[1] = cudaAddressModeClamp; texDesc.filterMode = cudaFilterModeLinear; texDesc.readMode = cudaReadModeElementType; texDesc.normalizedCoords = 1; // Create texture object cudaTextureObject_t texObj = 0; cudaCreateTextureObject( &texObj, &resDesc, &texDesc, NULL); printf("create texture \n"); printf(cudaGetErrorString(cudaGetLastError())); printf("\n"); int num = 10; // Allocate result of transformation in device memory float* d_output; cudaMalloc(&d_output, num*width*sizeof(float)); float* output = (float *) malloc(num*width*sizeof(float)); // Invoke kernel transformKernel<<<1,100>>>( d_output, texObj, width); // retrieve the output cudaMemcpy(output,d_output,num*width*sizeof(float),cudaMemcpyDeviceToHost); for (int i=0; i< width; i++){ printf("%.2f \t",h_data[i]); } printf("\n"); // Destroy texture object cudaDestroyTextureObject(texObj); // Free device memory cudaFreeArray(cuArray); cudaFree(d_output); return 0; }
#include <hip/hip_runtime.h> #include <stdio.h> // Simple transformation kernel __global__ void transformKernel( float* d_output, hipTextureObject_t texObj, int width){ // Calculate normalized texture coordinates float u = threadIdx.x/(float) blockDim.x; // Read from texture and write to global memory d_output[threadIdx.x] = tex1D<float>(texObj,u); for (int i = 0; i < blockDim.x; i++){ if (threadIdx.x == i){ printf("(%.2f, %.2f )\t",u,d_output[threadIdx.x]); } __syncthreads(); } __syncthreads(); if (threadIdx.x == 1){ printf("\n"); } } // Host code int main(){ int width = 10; float * h_data =(float *) malloc(sizeof(float)*width);; for (int i=0; i<width; i++){ h_data[i]=(float) i; } int size = width*sizeof(float); // Allocate CUDA array in device memory hipChannelFormatDesc channelDesc = hipCreateChannelDesc( 32, 0, 0, 0, hipChannelFormatKindFloat); hipArray* cuArray; hipMallocArray(&cuArray, &channelDesc, size,1); printf("cuda malloc array\n"); printf(hipGetErrorString(hipGetLastError())); printf("\n"); // Copy to device memory some data located at address h_data // in host memory hipMemcpyToArray( cuArray, 0, 0, h_data, size, hipMemcpyHostToDevice); printf("cuda memcpy to array\n"); printf(hipGetErrorString(hipGetLastError())); printf("\n"); // Specify texture struct hipResourceDesc resDesc; memset(&resDesc, 0, sizeof(resDesc)); resDesc.resType = hipResourceTypeArray; resDesc.res.array.array = cuArray; // Specify texture object parameters struct hipTextureDesc texDesc; memset(&texDesc, 0, sizeof(texDesc)); texDesc.addressMode[0] = hipAddressModeClamp; texDesc.addressMode[1] = hipAddressModeClamp; texDesc.filterMode = hipFilterModeLinear; texDesc.readMode = hipReadModeElementType; texDesc.normalizedCoords = 1; // Create texture object hipTextureObject_t texObj = 0; hipCreateTextureObject( &texObj, &resDesc, &texDesc, NULL); printf("create texture \n"); printf(hipGetErrorString(hipGetLastError())); printf("\n"); int num = 10; // Allocate result of transformation in device memory float* d_output; hipMalloc(&d_output, num*width*sizeof(float)); float* output = (float *) malloc(num*width*sizeof(float)); // Invoke kernel transformKernel<<<1,100>>>( d_output, texObj, width); // retrieve the output hipMemcpy(output,d_output,num*width*sizeof(float),hipMemcpyDeviceToHost); for (int i=0; i< width; i++){ printf("%.2f \t",h_data[i]); } printf("\n"); // Destroy texture object hipDestroyTextureObject(texObj); // Free device memory hipFreeArray(cuArray); hipFree(d_output); return 0; }
You are a helpful coding assistant specialized in converting HIP source code to AMD host assembly.
#include <hip/hip_runtime.h> #include <stdio.h> // Simple transformation kernel __global__ void transformKernel( float* d_output, hipTextureObject_t texObj, int width){ // Calculate normalized texture coordinates float u = threadIdx.x/(float) blockDim.x; // Read from texture and write to global memory d_output[threadIdx.x] = tex1D<float>(texObj,u); for (int i = 0; i < blockDim.x; i++){ if (threadIdx.x == i){ printf("(%.2f, %.2f )\t",u,d_output[threadIdx.x]); } __syncthreads(); } __syncthreads(); if (threadIdx.x == 1){ printf("\n"); } } // Host code int main(){ int width = 10; float * h_data =(float *) malloc(sizeof(float)*width);; for (int i=0; i<width; i++){ h_data[i]=(float) i; } int size = width*sizeof(float); // Allocate CUDA array in device memory hipChannelFormatDesc channelDesc = hipCreateChannelDesc( 32, 0, 0, 0, hipChannelFormatKindFloat); hipArray* cuArray; hipMallocArray(&cuArray, &channelDesc, size,1); printf("cuda malloc array\n"); printf(hipGetErrorString(hipGetLastError())); printf("\n"); // Copy to device memory some data located at address h_data // in host memory hipMemcpyToArray( cuArray, 0, 0, h_data, size, hipMemcpyHostToDevice); printf("cuda memcpy to array\n"); printf(hipGetErrorString(hipGetLastError())); printf("\n"); // Specify texture struct hipResourceDesc resDesc; memset(&resDesc, 0, sizeof(resDesc)); resDesc.resType = hipResourceTypeArray; resDesc.res.array.array = cuArray; // Specify texture object parameters struct hipTextureDesc texDesc; memset(&texDesc, 0, sizeof(texDesc)); texDesc.addressMode[0] = hipAddressModeClamp; texDesc.addressMode[1] = hipAddressModeClamp; texDesc.filterMode = hipFilterModeLinear; texDesc.readMode = hipReadModeElementType; texDesc.normalizedCoords = 1; // Create texture object hipTextureObject_t texObj = 0; hipCreateTextureObject( &texObj, &resDesc, &texDesc, NULL); printf("create texture \n"); printf(hipGetErrorString(hipGetLastError())); printf("\n"); int num = 10; // Allocate result of transformation in device memory float* d_output; hipMalloc(&d_output, num*width*sizeof(float)); float* output = (float *) malloc(num*width*sizeof(float)); // Invoke kernel transformKernel<<<1,100>>>( d_output, texObj, width); // retrieve the output hipMemcpy(output,d_output,num*width*sizeof(float),hipMemcpyDeviceToHost); for (int i=0; i< width; i++){ printf("%.2f \t",h_data[i]); } printf("\n"); // Destroy texture object hipDestroyTextureObject(texObj); // Free device memory hipFreeArray(cuArray); hipFree(d_output); return 0; }
.text .file "texture_test.hip" .globl _Z30__device_stub__transformKernelPfP13__hip_texturei # -- Begin function _Z30__device_stub__transformKernelPfP13__hip_texturei .p2align 4, 0x90 .type _Z30__device_stub__transformKernelPfP13__hip_texturei,@function _Z30__device_stub__transformKernelPfP13__hip_texturei: # @_Z30__device_stub__transformKernelPfP13__hip_texturei .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 $_Z15transformKernelPfP13__hip_texturei, %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 _Z30__device_stub__transformKernelPfP13__hip_texturei, .Lfunc_end0-_Z30__device_stub__transformKernelPfP13__hip_texturei .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 $288, %rsp # imm = 0x120 .cfi_def_cfa_offset 320 .cfi_offset %rbx, -32 .cfi_offset %r14, -24 .cfi_offset %r15, -16 movl $40, %edi callq malloc movq %rax, %rbx xorl %eax, %eax .p2align 4, 0x90 .LBB1_1: # =>This Inner Loop Header: Depth=1 xorps %xmm0, %xmm0 cvtsi2ss %eax, %xmm0 movss %xmm0, (%rbx,%rax,4) incq %rax cmpq $10, %rax jne .LBB1_1 # %bb.2: leaq 268(%rsp), %r14 movq %r14, %rdi movl $32, %esi xorl %edx, %edx xorl %ecx, %ecx xorl %r8d, %r8d movl $2, %r9d callq hipCreateChannelDesc leaq 16(%rsp), %rdi movl $40, %edx movl $1, %ecx movq %r14, %rsi xorl %r8d, %r8d callq hipMallocArray movl $.Lstr, %edi callq puts@PLT callq hipGetLastError movl %eax, %edi callq hipGetErrorString movq %rax, %rdi xorl %eax, %eax callq printf movl $10, %edi callq putchar@PLT movq 16(%rsp), %rdi movl $40, %r8d xorl %esi, %esi xorl %edx, %edx movq %rbx, %rcx movl $1, %r9d callq hipMemcpyToArray movl $.Lstr.1, %edi callq puts@PLT callq hipGetLastError movl %eax, %edi callq hipGetErrorString movq %rax, %rdi xorl %eax, %eax callq printf movl $10, %edi callq putchar@PLT xorps %xmm0, %xmm0 movaps %xmm0, 192(%rsp) movaps %xmm0, 240(%rsp) movaps %xmm0, 224(%rsp) movaps %xmm0, 208(%rsp) movq 16(%rsp), %rax movq %rax, 200(%rsp) movaps %xmm0, 128(%rsp) movaps %xmm0, 144(%rsp) movaps %xmm0, 160(%rsp) movaps %xmm0, 176(%rsp) movabsq $4294967297, %r15 # imm = 0x100000001 movq %r15, 128(%rsp) movl $1, 140(%rsp) movl $0, 144(%rsp) movl $1, 168(%rsp) movq $0, 8(%rsp) leaq 8(%rsp), %rdi leaq 192(%rsp), %rsi leaq 128(%rsp), %rdx xorl %ecx, %ecx callq hipCreateTextureObject movl $.Lstr.2, %edi callq puts@PLT callq hipGetLastError movl %eax, %edi callq hipGetErrorString movq %rax, %rdi xorl %eax, %eax callq printf movl $10, %edi callq putchar@PLT movq %rsp, %rdi movl $400, %esi # imm = 0x190 callq hipMalloc movl $400, %edi # imm = 0x190 callq malloc movq %rax, %r14 leaq 99(%r15), %rdx movq %r15, %rdi movl $1, %esi movl $1, %ecx xorl %r8d, %r8d xorl %r9d, %r9d callq __hipPushCallConfiguration testl %eax, %eax jne .LBB1_4 # %bb.3: movq (%rsp), %rax movq 8(%rsp), %rcx movq %rax, 88(%rsp) movq %rcx, 80(%rsp) movl $10, 28(%rsp) leaq 88(%rsp), %rax movq %rax, 96(%rsp) leaq 80(%rsp), %rax movq %rax, 104(%rsp) leaq 28(%rsp), %rax movq %rax, 112(%rsp) leaq 64(%rsp), %rdi leaq 48(%rsp), %rsi leaq 40(%rsp), %rdx leaq 32(%rsp), %rcx callq __hipPopCallConfiguration movq 64(%rsp), %rsi movl 72(%rsp), %edx movq 48(%rsp), %rcx movl 56(%rsp), %r8d leaq 96(%rsp), %r9 movl $_Z15transformKernelPfP13__hip_texturei, %edi pushq 32(%rsp) .cfi_adjust_cfa_offset 8 pushq 48(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $16, %rsp .cfi_adjust_cfa_offset -16 .LBB1_4: movq (%rsp), %rsi movl $400, %edx # imm = 0x190 movq %r14, %rdi movl $2, %ecx callq hipMemcpy xorl %r14d, %r14d .p2align 4, 0x90 .LBB1_5: # =>This Inner Loop Header: Depth=1 movss (%rbx,%r14,4), %xmm0 # xmm0 = mem[0],zero,zero,zero cvtss2sd %xmm0, %xmm0 movl $.L.str.4, %edi movb $1, %al callq printf incq %r14 cmpq $10, %r14 jne .LBB1_5 # %bb.6: movl $10, %edi callq putchar@PLT movq 8(%rsp), %rdi callq hipDestroyTextureObject movq 16(%rsp), %rdi callq hipFreeArray movq (%rsp), %rdi callq hipFree xorl %eax, %eax addq $288, %rsp # imm = 0x120 .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 $_Z15transformKernelPfP13__hip_texturei, %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 _Z15transformKernelPfP13__hip_texturei,@object # @_Z15transformKernelPfP13__hip_texturei .section .rodata,"a",@progbits .globl _Z15transformKernelPfP13__hip_texturei .p2align 3, 0x0 _Z15transformKernelPfP13__hip_texturei: .quad _Z30__device_stub__transformKernelPfP13__hip_texturei .size _Z15transformKernelPfP13__hip_texturei, 8 .type .L.str.4,@object # @.str.4 .section .rodata.str1.1,"aMS",@progbits,1 .L.str.4: .asciz "%.2f \t" .size .L.str.4, 7 .type .L__unnamed_1,@object # @0 .L__unnamed_1: .asciz "_Z15transformKernelPfP13__hip_texturei" .size .L__unnamed_1, 39 .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 "cuda malloc array" .size .Lstr, 18 .type .Lstr.1,@object # @str.1 .Lstr.1: .asciz "cuda memcpy to array" .size .Lstr.1, 21 .type .Lstr.2,@object # @str.2 .Lstr.2: .asciz "create texture " .size .Lstr.2, 16 .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 _Z30__device_stub__transformKernelPfP13__hip_texturei .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z15transformKernelPfP13__hip_texturei .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_000311e1_00000000-6_texture_test.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 _Z37__device_stub__Z15transformKernelPfyiPfyi .type _Z37__device_stub__Z15transformKernelPfyiPfyi, @function _Z37__device_stub__Z15transformKernelPfyiPfyi: .LFB2082: .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 _Z15transformKernelPfyi(%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 _Z37__device_stub__Z15transformKernelPfyiPfyi, .-_Z37__device_stub__Z15transformKernelPfyiPfyi .globl _Z15transformKernelPfyi .type _Z15transformKernelPfyi, @function _Z15transformKernelPfyi: .LFB2083: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z37__device_stub__Z15transformKernelPfyiPfyi addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2083: .size _Z15transformKernelPfyi, .-_Z15transformKernelPfyi .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "cuda malloc array\n" .LC1: .string "\n" .LC2: .string "cuda memcpy to array\n" .LC3: .string "create texture \n" .LC4: .string "%.2f \t" .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 $224, %rsp .cfi_def_cfa_offset 256 movq %fs:40, %rax movq %rax, 216(%rsp) xorl %eax, %eax movl $40, %edi call malloc@PLT movq %rax, %rbp movl $0, %eax .L12: pxor %xmm0, %xmm0 cvtsi2ssl %eax, %xmm0 movss %xmm0, 0(%rbp,%rax,4) addq $1, %rax cmpq $10, %rax jne .L12 leaq 48(%rsp), %rbx movl $2, %r9d movl $0, %r8d movl $0, %ecx movl $0, %edx movl $32, %esi movq %rbx, %rdi call cudaCreateChannelDesc@PLT movq %rsp, %rdi movl $0, %r8d movl $1, %ecx movl $40, %edx movq %rbx, %rsi call cudaMallocArray@PLT leaq .LC0(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT leaq .LC1(%rip), %rbx movq %rbx, %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %r9d movl $40, %r8d movq %rbp, %rcx movl $0, %edx movl $0, %esi movq (%rsp), %rdi call cudaMemcpyToArray@PLT leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movq %rbx, %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT leaq 80(%rsp), %rsi pxor %xmm0, %xmm0 movaps %xmm0, 80(%rsp) movaps %xmm0, 96(%rsp) movaps %xmm0, 112(%rsp) movaps %xmm0, 128(%rsp) movq (%rsp), %rax movq %rax, 88(%rsp) leaq 144(%rsp), %rdx movups %xmm0, 152(%rsp) movups %xmm0, 168(%rsp) movups %xmm0, 184(%rsp) movups %xmm0, 200(%rsp) movl $1, 144(%rsp) movl $1, 148(%rsp) movl $1, 156(%rsp) movl $1, 184(%rsp) movq $0, 8(%rsp) leaq 8(%rsp), %rdi movl $0, %ecx call cudaCreateTextureObject@PLT leaq .LC3(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movq %rbx, %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT leaq 16(%rsp), %rdi movl $400, %esi call cudaMalloc@PLT movl $400, %edi call malloc@PLT movq %rax, %rbx movl $100, 36(%rsp) movl $1, 40(%rsp) movl $1, 24(%rsp) movl $1, 28(%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 .L19 .L13: movl $2, %ecx movl $400, %edx movq 16(%rsp), %rsi movq %rbx, %rdi call cudaMemcpy@PLT movq %rbp, %rbx addq $40, %rbp leaq .LC4(%rip), %r12 .L14: pxor %xmm0, %xmm0 cvtss2sd (%rbx), %xmm0 movq %r12, %rsi movl $2, %edi movl $1, %eax call __printf_chk@PLT addq $4, %rbx cmpq %rbp, %rbx jne .L14 leaq .LC1(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movq 8(%rsp), %rdi call cudaDestroyTextureObject@PLT movq (%rsp), %rdi call cudaFreeArray@PLT movq 16(%rsp), %rdi call cudaFree@PLT movq 216(%rsp), %rax subq %fs:40, %rax jne .L20 movl $0, %eax addq $224, %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 movl $10, %edx movq 8(%rsp), %rsi movq 16(%rsp), %rdi call _Z37__device_stub__Z15transformKernelPfyiPfyi jmp .L13 .L20: call __stack_chk_fail@PLT .cfi_endproc .LFE2057: .size main, .-main .section .rodata.str1.1 .LC5: .string "_Z15transformKernelPfyi" .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 .LC5(%rip), %rdx movq %rdx, %rcx leaq _Z15transformKernelPfyi(%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 "texture_test.hip" .globl _Z30__device_stub__transformKernelPfP13__hip_texturei # -- Begin function _Z30__device_stub__transformKernelPfP13__hip_texturei .p2align 4, 0x90 .type _Z30__device_stub__transformKernelPfP13__hip_texturei,@function _Z30__device_stub__transformKernelPfP13__hip_texturei: # @_Z30__device_stub__transformKernelPfP13__hip_texturei .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 $_Z15transformKernelPfP13__hip_texturei, %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 _Z30__device_stub__transformKernelPfP13__hip_texturei, .Lfunc_end0-_Z30__device_stub__transformKernelPfP13__hip_texturei .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 $288, %rsp # imm = 0x120 .cfi_def_cfa_offset 320 .cfi_offset %rbx, -32 .cfi_offset %r14, -24 .cfi_offset %r15, -16 movl $40, %edi callq malloc movq %rax, %rbx xorl %eax, %eax .p2align 4, 0x90 .LBB1_1: # =>This Inner Loop Header: Depth=1 xorps %xmm0, %xmm0 cvtsi2ss %eax, %xmm0 movss %xmm0, (%rbx,%rax,4) incq %rax cmpq $10, %rax jne .LBB1_1 # %bb.2: leaq 268(%rsp), %r14 movq %r14, %rdi movl $32, %esi xorl %edx, %edx xorl %ecx, %ecx xorl %r8d, %r8d movl $2, %r9d callq hipCreateChannelDesc leaq 16(%rsp), %rdi movl $40, %edx movl $1, %ecx movq %r14, %rsi xorl %r8d, %r8d callq hipMallocArray movl $.Lstr, %edi callq puts@PLT callq hipGetLastError movl %eax, %edi callq hipGetErrorString movq %rax, %rdi xorl %eax, %eax callq printf movl $10, %edi callq putchar@PLT movq 16(%rsp), %rdi movl $40, %r8d xorl %esi, %esi xorl %edx, %edx movq %rbx, %rcx movl $1, %r9d callq hipMemcpyToArray movl $.Lstr.1, %edi callq puts@PLT callq hipGetLastError movl %eax, %edi callq hipGetErrorString movq %rax, %rdi xorl %eax, %eax callq printf movl $10, %edi callq putchar@PLT xorps %xmm0, %xmm0 movaps %xmm0, 192(%rsp) movaps %xmm0, 240(%rsp) movaps %xmm0, 224(%rsp) movaps %xmm0, 208(%rsp) movq 16(%rsp), %rax movq %rax, 200(%rsp) movaps %xmm0, 128(%rsp) movaps %xmm0, 144(%rsp) movaps %xmm0, 160(%rsp) movaps %xmm0, 176(%rsp) movabsq $4294967297, %r15 # imm = 0x100000001 movq %r15, 128(%rsp) movl $1, 140(%rsp) movl $0, 144(%rsp) movl $1, 168(%rsp) movq $0, 8(%rsp) leaq 8(%rsp), %rdi leaq 192(%rsp), %rsi leaq 128(%rsp), %rdx xorl %ecx, %ecx callq hipCreateTextureObject movl $.Lstr.2, %edi callq puts@PLT callq hipGetLastError movl %eax, %edi callq hipGetErrorString movq %rax, %rdi xorl %eax, %eax callq printf movl $10, %edi callq putchar@PLT movq %rsp, %rdi movl $400, %esi # imm = 0x190 callq hipMalloc movl $400, %edi # imm = 0x190 callq malloc movq %rax, %r14 leaq 99(%r15), %rdx movq %r15, %rdi movl $1, %esi movl $1, %ecx xorl %r8d, %r8d xorl %r9d, %r9d callq __hipPushCallConfiguration testl %eax, %eax jne .LBB1_4 # %bb.3: movq (%rsp), %rax movq 8(%rsp), %rcx movq %rax, 88(%rsp) movq %rcx, 80(%rsp) movl $10, 28(%rsp) leaq 88(%rsp), %rax movq %rax, 96(%rsp) leaq 80(%rsp), %rax movq %rax, 104(%rsp) leaq 28(%rsp), %rax movq %rax, 112(%rsp) leaq 64(%rsp), %rdi leaq 48(%rsp), %rsi leaq 40(%rsp), %rdx leaq 32(%rsp), %rcx callq __hipPopCallConfiguration movq 64(%rsp), %rsi movl 72(%rsp), %edx movq 48(%rsp), %rcx movl 56(%rsp), %r8d leaq 96(%rsp), %r9 movl $_Z15transformKernelPfP13__hip_texturei, %edi pushq 32(%rsp) .cfi_adjust_cfa_offset 8 pushq 48(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $16, %rsp .cfi_adjust_cfa_offset -16 .LBB1_4: movq (%rsp), %rsi movl $400, %edx # imm = 0x190 movq %r14, %rdi movl $2, %ecx callq hipMemcpy xorl %r14d, %r14d .p2align 4, 0x90 .LBB1_5: # =>This Inner Loop Header: Depth=1 movss (%rbx,%r14,4), %xmm0 # xmm0 = mem[0],zero,zero,zero cvtss2sd %xmm0, %xmm0 movl $.L.str.4, %edi movb $1, %al callq printf incq %r14 cmpq $10, %r14 jne .LBB1_5 # %bb.6: movl $10, %edi callq putchar@PLT movq 8(%rsp), %rdi callq hipDestroyTextureObject movq 16(%rsp), %rdi callq hipFreeArray movq (%rsp), %rdi callq hipFree xorl %eax, %eax addq $288, %rsp # imm = 0x120 .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 $_Z15transformKernelPfP13__hip_texturei, %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 _Z15transformKernelPfP13__hip_texturei,@object # @_Z15transformKernelPfP13__hip_texturei .section .rodata,"a",@progbits .globl _Z15transformKernelPfP13__hip_texturei .p2align 3, 0x0 _Z15transformKernelPfP13__hip_texturei: .quad _Z30__device_stub__transformKernelPfP13__hip_texturei .size _Z15transformKernelPfP13__hip_texturei, 8 .type .L.str.4,@object # @.str.4 .section .rodata.str1.1,"aMS",@progbits,1 .L.str.4: .asciz "%.2f \t" .size .L.str.4, 7 .type .L__unnamed_1,@object # @0 .L__unnamed_1: .asciz "_Z15transformKernelPfP13__hip_texturei" .size .L__unnamed_1, 39 .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 "cuda malloc array" .size .Lstr, 18 .type .Lstr.1,@object # @str.1 .Lstr.1: .asciz "cuda memcpy to array" .size .Lstr.1, 21 .type .Lstr.2,@object # @str.2 .Lstr.2: .asciz "create texture " .size .Lstr.2, 16 .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 _Z30__device_stub__transformKernelPfP13__hip_texturei .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z15transformKernelPfP13__hip_texturei .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" //CUDA reduction algorithm. simple approach //Tom Dale //11-20-18 using namespace std; #define N 100000//number of input values #define R 100//reduction factor #define F (1+((N-1)/R))//how many values will be in the final output //basicRun will F number of threads go through R number of values and put the average in z[tid] __global__ void basicRun(double *a,double *z){ int tid = blockDim.x*blockIdx.x + threadIdx.x; if(tid > F) return; double avg=0; for(int i= 0;i<R;i++){//get sum of input values in this threads domain avg += a[i+tid*R]; } z[tid]=avg/R;//divide sum by total number of input values to get average }
code for sm_80 Function : _Z8basicRunPdS_ .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.X ; /* 0x0000000000007919 */ /* 0x000e280000002500 */ /*0020*/ S2R R3, SR_TID.X ; /* 0x0000000000037919 */ /* 0x000e240000002100 */ /*0030*/ IMAD R0, R0, c[0x0][0x0], R3 ; /* 0x0000000000007a24 */ /* 0x001fca00078e0203 */ /*0040*/ ISETP.GT.AND P0, PT, R0, 0x3e8, PT ; /* 0x000003e80000780c */ /* 0x000fda0003f04270 */ /*0050*/ @P0 EXIT ; /* 0x000000000000094d */ /* 0x000fea0003800000 */ /*0060*/ IMAD.MOV.U32 R3, RZ, RZ, 0x8 ; /* 0x00000008ff037424 */ /* 0x000fe200078e00ff */ /*0070*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */ /* 0x000fe20000000a00 */ /*0080*/ IMAD R2, R0, 0x64, RZ ; /* 0x0000006400027824 */ /* 0x000fc800078e02ff */ /*0090*/ IMAD.WIDE R2, R2, R3, c[0x0][0x160] ; /* 0x0000580002027625 */ /* 0x000fca00078e0203 */ /*00a0*/ LDG.E.64 R8, [R2.64] ; /* 0x0000000402087981 */ /* 0x000ea8000c1e1b00 */ /*00b0*/ LDG.E.64 R24, [R2.64+0x8] ; /* 0x0000080402187981 */ /* 0x000ee8000c1e1b00 */ /*00c0*/ LDG.E.64 R12, [R2.64+0x10] ; /* 0x00001004020c7981 */ /* 0x000f28000c1e1b00 */ /*00d0*/ LDG.E.64 R14, [R2.64+0x18] ; /* 0x00001804020e7981 */ /* 0x000f68000c1e1b00 */ /*00e0*/ LDG.E.64 R16, [R2.64+0x20] ; /* 0x0000200402107981 */ /* 0x000f68000c1e1b00 */ /*00f0*/ LDG.E.64 R20, [R2.64+0x28] ; /* 0x0000280402147981 */ /* 0x000f68000c1e1b00 */ /*0100*/ LDG.E.64 R22, [R2.64+0x30] ; /* 0x0000300402167981 */ /* 0x000f68000c1e1b00 */ /*0110*/ LDG.E.64 R18, [R2.64+0x38] ; /* 0x0000380402127981 */ /* 0x000f68000c1e1b00 */ /*0120*/ LDG.E.64 R4, [R2.64+0x40] ; /* 0x0000400402047981 */ /* 0x000f68000c1e1b00 */ /*0130*/ LDG.E.64 R6, [R2.64+0x48] ; /* 0x0000480402067981 */ /* 0x000f62000c1e1b00 */ /*0140*/ DADD R10, RZ, R8 ; /* 0x00000000ff0a7229 */ /* 0x0040c60000000008 */ /*0150*/ LDG.E.64 R8, [R2.64+0x50] ; /* 0x0000500402087981 */ /* 0x001ea6000c1e1b00 */ /*0160*/ DADD R24, R10, R24 ; /* 0x000000000a187229 */ /* 0x0081080000000018 */ /*0170*/ LDG.E.64 R10, [R2.64+0x58] ; /* 0x00005804020a7981 */ /* 0x001ee4000c1e1b00 */ /*0180*/ DADD R24, R24, R12 ; /* 0x0000000018187229 */ /* 0x010164000000000c */ /*0190*/ LDG.E.64 R12, [R2.64+0x60] ; /* 0x00006004020c7981 */ /* 0x001f28000c1e1b00 */ /*01a0*/ DADD R24, R24, R14 ; /* 0x0000000018187229 */ /* 0x020064000000000e */ /*01b0*/ LDG.E.64 R14, [R2.64+0x68] ; /* 0x00006804020e7981 */ /* 0x001f68000c1e1b00 */ /*01c0*/ DADD R24, R24, R16 ; /* 0x0000000018187229 */ /* 0x0020440000000010 */ /*01d0*/ LDG.E.64 R16, [R2.64+0x70] ; /* 0x0000700402107981 */ /* 0x001f68000c1e1b00 */ /*01e0*/ DADD R24, R24, R20 ; /* 0x0000000018187229 */ /* 0x0020640000000014 */ /*01f0*/ LDG.E.64 R20, [R2.64+0x78] ; /* 0x0000780402147981 */ /* 0x001f68000c1e1b00 */ /*0200*/ DADD R24, R24, R22 ; /* 0x0000000018187229 */ /* 0x0020440000000016 */ /*0210*/ LDG.E.64 R22, [R2.64+0x80] ; /* 0x0000800402167981 */ /* 0x001f68000c1e1b00 */ /*0220*/ DADD R24, R24, R18 ; /* 0x0000000018187229 */ /* 0x0020640000000012 */ /*0230*/ LDG.E.64 R18, [R2.64+0x88] ; /* 0x0000880402127981 */ /* 0x001f68000c1e1b00 */ /*0240*/ DADD R24, R24, R4 ; /* 0x0000000018187229 */ /* 0x0020440000000004 */ /*0250*/ LDG.E.64 R4, [R2.64+0x90] ; /* 0x0000900402047981 */ /* 0x001f68000c1e1b00 */ /*0260*/ DADD R24, R24, R6 ; /* 0x0000000018187229 */ /* 0x0020a40000000006 */ /*0270*/ LDG.E.64 R6, [R2.64+0x98] ; /* 0x0000980402067981 */ /* 0x001f68000c1e1b00 */ /*0280*/ DADD R24, R24, R8 ; /* 0x0000000018187229 */ /* 0x0040c40000000008 */ /*0290*/ LDG.E.64 R8, [R2.64+0xa0] ; /* 0x0000a00402087981 */ /* 0x001ea8000c1e1b00 */ /*02a0*/ DADD R24, R24, R10 ; /* 0x0000000018187229 */ /* 0x008124000000000a */ /*02b0*/ LDG.E.64 R10, [R2.64+0xa8] ; /* 0x0000a804020a7981 */ /* 0x001ee8000c1e1b00 */ /*02c0*/ DADD R24, R24, R12 ; /* 0x0000000018187229 */ /* 0x010144000000000c */ /*02d0*/ LDG.E.64 R12, [R2.64+0xb0] ; /* 0x0000b004020c7981 */ /* 0x001f28000c1e1b00 */ /*02e0*/ DADD R24, R24, R14 ; /* 0x0000000018187229 */ /* 0x020064000000000e */ /*02f0*/ LDG.E.64 R14, [R2.64+0xb8] ; /* 0x0000b804020e7981 */ /* 0x001f68000c1e1b00 */ /*0300*/ DADD R24, R24, R16 ; /* 0x0000000018187229 */ /* 0x0020440000000010 */ /*0310*/ LDG.E.64 R16, [R2.64+0xc0] ; /* 0x0000c00402107981 */ /* 0x001f68000c1e1b00 */ /*0320*/ DADD R24, R24, R20 ; /* 0x0000000018187229 */ /* 0x0020640000000014 */ /*0330*/ LDG.E.64 R20, [R2.64+0xc8] ; /* 0x0000c80402147981 */ /* 0x001f68000c1e1b00 */ /*0340*/ DADD R24, R24, R22 ; /* 0x0000000018187229 */ /* 0x0020440000000016 */ /*0350*/ LDG.E.64 R22, [R2.64+0xd0] ; /* 0x0000d00402167981 */ /* 0x001f68000c1e1b00 */ /*0360*/ DADD R24, R24, R18 ; /* 0x0000000018187229 */ /* 0x0020640000000012 */ /*0370*/ LDG.E.64 R18, [R2.64+0xd8] ; /* 0x0000d80402127981 */ /* 0x001f68000c1e1b00 */ /*0380*/ DADD R24, R24, R4 ; /* 0x0000000018187229 */ /* 0x0020440000000004 */ /*0390*/ LDG.E.64 R4, [R2.64+0xe0] ; /* 0x0000e00402047981 */ /* 0x001f68000c1e1b00 */ /*03a0*/ DADD R24, R24, R6 ; /* 0x0000000018187229 */ /* 0x0020a40000000006 */ /*03b0*/ LDG.E.64 R6, [R2.64+0xe8] ; /* 0x0000e80402067981 */ /* 0x001f68000c1e1b00 */ /*03c0*/ DADD R24, R24, R8 ; /* 0x0000000018187229 */ /* 0x0040c40000000008 */ /*03d0*/ LDG.E.64 R8, [R2.64+0xf0] ; /* 0x0000f00402087981 */ /* 0x001ea8000c1e1b00 */ /*03e0*/ DADD R24, R24, R10 ; /* 0x0000000018187229 */ /* 0x008124000000000a */ /*03f0*/ LDG.E.64 R10, [R2.64+0xf8] ; /* 0x0000f804020a7981 */ /* 0x001ee8000c1e1b00 */ /*0400*/ DADD R24, R24, R12 ; /* 0x0000000018187229 */ /* 0x010144000000000c */ /*0410*/ LDG.E.64 R12, [R2.64+0x100] ; /* 0x00010004020c7981 */ /* 0x001f28000c1e1b00 */ /*0420*/ DADD R24, R24, R14 ; /* 0x0000000018187229 */ /* 0x020064000000000e */ /*0430*/ LDG.E.64 R14, [R2.64+0x108] ; /* 0x00010804020e7981 */ /* 0x001f68000c1e1b00 */ /*0440*/ DADD R24, R24, R16 ; /* 0x0000000018187229 */ /* 0x0020440000000010 */ /*0450*/ LDG.E.64 R16, [R2.64+0x110] ; /* 0x0001100402107981 */ /* 0x001f68000c1e1b00 */ /*0460*/ DADD R24, R24, R20 ; /* 0x0000000018187229 */ /* 0x0020640000000014 */ /*0470*/ LDG.E.64 R20, [R2.64+0x118] ; /* 0x0001180402147981 */ /* 0x001f68000c1e1b00 */ /*0480*/ DADD R24, R24, R22 ; /* 0x0000000018187229 */ /* 0x0020440000000016 */ /*0490*/ LDG.E.64 R22, [R2.64+0x120] ; /* 0x0001200402167981 */ /* 0x001f68000c1e1b00 */ /*04a0*/ DADD R24, R24, R18 ; /* 0x0000000018187229 */ /* 0x0020640000000012 */ /*04b0*/ LDG.E.64 R18, [R2.64+0x128] ; /* 0x0001280402127981 */ /* 0x001f68000c1e1b00 */ /*04c0*/ DADD R24, R24, R4 ; /* 0x0000000018187229 */ /* 0x0020440000000004 */ /*04d0*/ LDG.E.64 R4, [R2.64+0x130] ; /* 0x0001300402047981 */ /* 0x001f68000c1e1b00 */ /*04e0*/ DADD R24, R24, R6 ; /* 0x0000000018187229 */ /* 0x0020a40000000006 */ /*04f0*/ LDG.E.64 R6, [R2.64+0x138] ; /* 0x0001380402067981 */ /* 0x001f68000c1e1b00 */ /*0500*/ DADD R24, R24, R8 ; /* 0x0000000018187229 */ /* 0x0040c40000000008 */ /*0510*/ LDG.E.64 R8, [R2.64+0x140] ; /* 0x0001400402087981 */ /* 0x001ea8000c1e1b00 */ /*0520*/ DADD R24, R24, R10 ; /* 0x0000000018187229 */ /* 0x008124000000000a */ /*0530*/ LDG.E.64 R10, [R2.64+0x148] ; /* 0x00014804020a7981 */ /* 0x001ee8000c1e1b00 */ /*0540*/ DADD R24, R24, R12 ; /* 0x0000000018187229 */ /* 0x010144000000000c */ /*0550*/ LDG.E.64 R12, [R2.64+0x150] ; /* 0x00015004020c7981 */ /* 0x001f28000c1e1b00 */ /*0560*/ DADD R24, R24, R14 ; /* 0x0000000018187229 */ /* 0x020064000000000e */ /*0570*/ LDG.E.64 R14, [R2.64+0x158] ; /* 0x00015804020e7981 */ /* 0x001f68000c1e1b00 */ /*0580*/ DADD R24, R24, R16 ; /* 0x0000000018187229 */ /* 0x0020440000000010 */ /*0590*/ LDG.E.64 R16, [R2.64+0x160] ; /* 0x0001600402107981 */ /* 0x001f68000c1e1b00 */ /*05a0*/ DADD R24, R24, R20 ; /* 0x0000000018187229 */ /* 0x0020640000000014 */ /*05b0*/ LDG.E.64 R20, [R2.64+0x168] ; /* 0x0001680402147981 */ /* 0x001f68000c1e1b00 */ /*05c0*/ DADD R24, R24, R22 ; /* 0x0000000018187229 */ /* 0x0020440000000016 */ /*05d0*/ LDG.E.64 R22, [R2.64+0x170] ; /* 0x0001700402167981 */ /* 0x001f68000c1e1b00 */ /*05e0*/ DADD R24, R24, R18 ; /* 0x0000000018187229 */ /* 0x0020640000000012 */ /*05f0*/ LDG.E.64 R18, [R2.64+0x178] ; /* 0x0001780402127981 */ /* 0x001f68000c1e1b00 */ /*0600*/ DADD R24, R24, R4 ; /* 0x0000000018187229 */ /* 0x0020440000000004 */ /*0610*/ LDG.E.64 R4, [R2.64+0x180] ; /* 0x0001800402047981 */ /* 0x001f68000c1e1b00 */ /*0620*/ DADD R24, R24, R6 ; /* 0x0000000018187229 */ /* 0x0020a40000000006 */ /*0630*/ LDG.E.64 R6, [R2.64+0x188] ; /* 0x0001880402067981 */ /* 0x001f68000c1e1b00 */ /*0640*/ DADD R24, R24, R8 ; /* 0x0000000018187229 */ /* 0x0040c40000000008 */ /*0650*/ LDG.E.64 R8, [R2.64+0x190] ; /* 0x0001900402087981 */ /* 0x001ea8000c1e1b00 */ /*0660*/ DADD R24, R24, R10 ; /* 0x0000000018187229 */ /* 0x008124000000000a */ /*0670*/ LDG.E.64 R10, [R2.64+0x198] ; /* 0x00019804020a7981 */ /* 0x001ee8000c1e1b00 */ /*0680*/ DADD R24, R24, R12 ; /* 0x0000000018187229 */ /* 0x010144000000000c */ /*0690*/ LDG.E.64 R12, [R2.64+0x1a0] ; /* 0x0001a004020c7981 */ /* 0x001f28000c1e1b00 */ /*06a0*/ DADD R24, R24, R14 ; /* 0x0000000018187229 */ /* 0x020064000000000e */ /*06b0*/ LDG.E.64 R14, [R2.64+0x1a8] ; /* 0x0001a804020e7981 */ /* 0x001f68000c1e1b00 */ /*06c0*/ DADD R24, R24, R16 ; /* 0x0000000018187229 */ /* 0x0020440000000010 */ /*06d0*/ LDG.E.64 R16, [R2.64+0x1b0] ; /* 0x0001b00402107981 */ /* 0x001f68000c1e1b00 */ /*06e0*/ DADD R24, R24, R20 ; /* 0x0000000018187229 */ /* 0x0020640000000014 */ /*06f0*/ LDG.E.64 R20, [R2.64+0x1b8] ; /* 0x0001b80402147981 */ /* 0x001f68000c1e1b00 */ /*0700*/ DADD R24, R24, R22 ; /* 0x0000000018187229 */ /* 0x0020440000000016 */ /*0710*/ LDG.E.64 R22, [R2.64+0x1c0] ; /* 0x0001c00402167981 */ /* 0x001f68000c1e1b00 */ /*0720*/ DADD R24, R24, R18 ; /* 0x0000000018187229 */ /* 0x0020640000000012 */ /*0730*/ LDG.E.64 R18, [R2.64+0x1c8] ; /* 0x0001c80402127981 */ /* 0x001f68000c1e1b00 */ /*0740*/ DADD R24, R24, R4 ; /* 0x0000000018187229 */ /* 0x0020440000000004 */ /*0750*/ LDG.E.64 R4, [R2.64+0x1d0] ; /* 0x0001d00402047981 */ /* 0x001f68000c1e1b00 */ /*0760*/ DADD R24, R24, R6 ; /* 0x0000000018187229 */ /* 0x0020a40000000006 */ /*0770*/ LDG.E.64 R6, [R2.64+0x1d8] ; /* 0x0001d80402067981 */ /* 0x001f68000c1e1b00 */ /*0780*/ DADD R24, R24, R8 ; /* 0x0000000018187229 */ /* 0x0040c40000000008 */ /*0790*/ LDG.E.64 R8, [R2.64+0x1e0] ; /* 0x0001e00402087981 */ /* 0x001ea8000c1e1b00 */ /*07a0*/ DADD R24, R24, R10 ; /* 0x0000000018187229 */ /* 0x008124000000000a */ /*07b0*/ LDG.E.64 R10, [R2.64+0x1e8] ; /* 0x0001e804020a7981 */ /* 0x001ee8000c1e1b00 */ /*07c0*/ DADD R24, R24, R12 ; /* 0x0000000018187229 */ /* 0x010144000000000c */ /*07d0*/ LDG.E.64 R12, [R2.64+0x1f0] ; /* 0x0001f004020c7981 */ /* 0x001f28000c1e1b00 */ /*07e0*/ DADD R24, R24, R14 ; /* 0x0000000018187229 */ /* 0x020064000000000e */ /*07f0*/ LDG.E.64 R14, [R2.64+0x1f8] ; /* 0x0001f804020e7981 */ /* 0x001f68000c1e1b00 */ /*0800*/ DADD R24, R24, R16 ; /* 0x0000000018187229 */ /* 0x0020440000000010 */ /*0810*/ LDG.E.64 R16, [R2.64+0x200] ; /* 0x0002000402107981 */ /* 0x001f68000c1e1b00 */ /*0820*/ DADD R24, R24, R20 ; /* 0x0000000018187229 */ /* 0x0020640000000014 */ /*0830*/ LDG.E.64 R20, [R2.64+0x208] ; /* 0x0002080402147981 */ /* 0x001f68000c1e1b00 */ /*0840*/ DADD R24, R24, R22 ; /* 0x0000000018187229 */ /* 0x0020440000000016 */ /*0850*/ LDG.E.64 R22, [R2.64+0x210] ; /* 0x0002100402167981 */ /* 0x001f68000c1e1b00 */ /*0860*/ DADD R24, R24, R18 ; /* 0x0000000018187229 */ /* 0x0020640000000012 */ /*0870*/ LDG.E.64 R18, [R2.64+0x218] ; /* 0x0002180402127981 */ /* 0x001f68000c1e1b00 */ /*0880*/ DADD R24, R24, R4 ; /* 0x0000000018187229 */ /* 0x0020440000000004 */ /*0890*/ LDG.E.64 R4, [R2.64+0x220] ; /* 0x0002200402047981 */ /* 0x001f68000c1e1b00 */ /*08a0*/ DADD R24, R24, R6 ; /* 0x0000000018187229 */ /* 0x0020a40000000006 */ /*08b0*/ LDG.E.64 R6, [R2.64+0x228] ; /* 0x0002280402067981 */ /* 0x001f68000c1e1b00 */ /*08c0*/ DADD R24, R24, R8 ; /* 0x0000000018187229 */ /* 0x0040c40000000008 */ /*08d0*/ LDG.E.64 R8, [R2.64+0x230] ; /* 0x0002300402087981 */ /* 0x001ea8000c1e1b00 */ /*08e0*/ DADD R24, R24, R10 ; /* 0x0000000018187229 */ /* 0x008124000000000a */ /*08f0*/ LDG.E.64 R10, [R2.64+0x238] ; /* 0x00023804020a7981 */ /* 0x001ee8000c1e1b00 */ /*0900*/ DADD R24, R24, R12 ; /* 0x0000000018187229 */ /* 0x010144000000000c */ /*0910*/ LDG.E.64 R12, [R2.64+0x240] ; /* 0x00024004020c7981 */ /* 0x001f28000c1e1b00 */ /*0920*/ DADD R24, R24, R14 ; /* 0x0000000018187229 */ /* 0x020064000000000e */ /*0930*/ LDG.E.64 R14, [R2.64+0x248] ; /* 0x00024804020e7981 */ /* 0x001f68000c1e1b00 */ /*0940*/ DADD R24, R24, R16 ; /* 0x0000000018187229 */ /* 0x0020440000000010 */ /*0950*/ LDG.E.64 R16, [R2.64+0x250] ; /* 0x0002500402107981 */ /* 0x001f68000c1e1b00 */ /*0960*/ DADD R24, R24, R20 ; /* 0x0000000018187229 */ /* 0x0020640000000014 */ /*0970*/ LDG.E.64 R20, [R2.64+0x258] ; /* 0x0002580402147981 */ /* 0x001f68000c1e1b00 */ /*0980*/ DADD R24, R24, R22 ; /* 0x0000000018187229 */ /* 0x0020440000000016 */ /*0990*/ LDG.E.64 R22, [R2.64+0x260] ; /* 0x0002600402167981 */ /* 0x001f68000c1e1b00 */ /*09a0*/ DADD R24, R24, R18 ; /* 0x0000000018187229 */ /* 0x0020640000000012 */ /*09b0*/ LDG.E.64 R18, [R2.64+0x268] ; /* 0x0002680402127981 */ /* 0x001f68000c1e1b00 */ /*09c0*/ DADD R24, R24, R4 ; /* 0x0000000018187229 */ /* 0x0020440000000004 */ /*09d0*/ LDG.E.64 R4, [R2.64+0x270] ; /* 0x0002700402047981 */ /* 0x001f68000c1e1b00 */ /*09e0*/ DADD R24, R24, R6 ; /* 0x0000000018187229 */ /* 0x0020a40000000006 */ /*09f0*/ LDG.E.64 R6, [R2.64+0x278] ; /* 0x0002780402067981 */ /* 0x001f68000c1e1b00 */ /*0a00*/ DADD R24, R24, R8 ; /* 0x0000000018187229 */ /* 0x0040c40000000008 */ /*0a10*/ LDG.E.64 R8, [R2.64+0x280] ; /* 0x0002800402087981 */ /* 0x001ea8000c1e1b00 */ /*0a20*/ DADD R24, R24, R10 ; /* 0x0000000018187229 */ /* 0x008124000000000a */ /*0a30*/ LDG.E.64 R10, [R2.64+0x288] ; /* 0x00028804020a7981 */ /* 0x001ee8000c1e1b00 */ /*0a40*/ DADD R24, R24, R12 ; /* 0x0000000018187229 */ /* 0x010144000000000c */ /*0a50*/ LDG.E.64 R12, [R2.64+0x290] ; /* 0x00029004020c7981 */ /* 0x001f28000c1e1b00 */ /*0a60*/ DADD R24, R24, R14 ; /* 0x0000000018187229 */ /* 0x020064000000000e */ /*0a70*/ LDG.E.64 R14, [R2.64+0x298] ; /* 0x00029804020e7981 */ /* 0x001f68000c1e1b00 */ /*0a80*/ DADD R24, R24, R16 ; /* 0x0000000018187229 */ /* 0x0020440000000010 */ /*0a90*/ LDG.E.64 R16, [R2.64+0x2a0] ; /* 0x0002a00402107981 */ /* 0x001f68000c1e1b00 */ /*0aa0*/ DADD R24, R24, R20 ; /* 0x0000000018187229 */ /* 0x0020640000000014 */ /*0ab0*/ LDG.E.64 R20, [R2.64+0x2a8] ; /* 0x0002a80402147981 */ /* 0x001f68000c1e1b00 */ /*0ac0*/ DADD R24, R24, R22 ; /* 0x0000000018187229 */ /* 0x0020440000000016 */ /*0ad0*/ LDG.E.64 R22, [R2.64+0x2b0] ; /* 0x0002b00402167981 */ /* 0x001f68000c1e1b00 */ /*0ae0*/ DADD R24, R24, R18 ; /* 0x0000000018187229 */ /* 0x0020640000000012 */ /*0af0*/ LDG.E.64 R18, [R2.64+0x2b8] ; /* 0x0002b80402127981 */ /* 0x001f68000c1e1b00 */ /*0b00*/ DADD R24, R24, R4 ; /* 0x0000000018187229 */ /* 0x0020440000000004 */ /*0b10*/ LDG.E.64 R4, [R2.64+0x2c0] ; /* 0x0002c00402047981 */ /* 0x001f68000c1e1b00 */ /*0b20*/ DADD R24, R24, R6 ; /* 0x0000000018187229 */ /* 0x0020a40000000006 */ /*0b30*/ LDG.E.64 R6, [R2.64+0x2c8] ; /* 0x0002c80402067981 */ /* 0x001f68000c1e1b00 */ /*0b40*/ DADD R24, R24, R8 ; /* 0x0000000018187229 */ /* 0x0040c40000000008 */ /*0b50*/ LDG.E.64 R8, [R2.64+0x2d0] ; /* 0x0002d00402087981 */ /* 0x001ea8000c1e1b00 */ /*0b60*/ DADD R24, R24, R10 ; /* 0x0000000018187229 */ /* 0x008124000000000a */ /*0b70*/ LDG.E.64 R10, [R2.64+0x2d8] ; /* 0x0002d804020a7981 */ /* 0x001ee8000c1e1b00 */ /*0b80*/ DADD R24, R24, R12 ; /* 0x0000000018187229 */ /* 0x010144000000000c */ /*0b90*/ LDG.E.64 R12, [R2.64+0x2e0] ; /* 0x0002e004020c7981 */ /* 0x001f28000c1e1b00 */ /*0ba0*/ DADD R24, R24, R14 ; /* 0x0000000018187229 */ /* 0x020064000000000e */ /*0bb0*/ LDG.E.64 R14, [R2.64+0x2e8] ; /* 0x0002e804020e7981 */ /* 0x001f68000c1e1b00 */ /*0bc0*/ DADD R24, R24, R16 ; /* 0x0000000018187229 */ /* 0x0020440000000010 */ /*0bd0*/ LDG.E.64 R16, [R2.64+0x2f0] ; /* 0x0002f00402107981 */ /* 0x001f68000c1e1b00 */ /*0be0*/ DADD R24, R24, R20 ; /* 0x0000000018187229 */ /* 0x0020640000000014 */ /*0bf0*/ LDG.E.64 R20, [R2.64+0x2f8] ; /* 0x0002f80402147981 */ /* 0x001f68000c1e1b00 */ /*0c00*/ DADD R24, R24, R22 ; /* 0x0000000018187229 */ /* 0x0020440000000016 */ /*0c10*/ LDG.E.64 R22, [R2.64+0x300] ; /* 0x0003000402167981 */ /* 0x001f68000c1e1b00 */ /*0c20*/ DADD R24, R24, R18 ; /* 0x0000000018187229 */ /* 0x0020640000000012 */ /*0c30*/ LDG.E.64 R18, [R2.64+0x308] ; /* 0x0003080402127981 */ /* 0x001f68000c1e1b00 */ /*0c40*/ DADD R26, R24, R4 ; /* 0x00000000181a7229 */ /* 0x0020440000000004 */ /*0c50*/ LDG.E.64 R4, [R2.64+0x310] ; /* 0x0003100402047981 */ /* 0x001f68000c1e1b00 */ /*0c60*/ LDG.E.64 R24, [R2.64+0x318] ; /* 0x0003180402187981 */ /* 0x000f62000c1e1b00 */ /*0c70*/ DADD R6, R26, R6 ; /* 0x000000001a067229 */ /* 0x002ea20000000006 */ /*0c80*/ BSSY B0, 0xe60 ; /* 0x000001d000007945 */ /* 0x000fea0003800000 */ /*0c90*/ DADD R6, R6, R8 ; /* 0x0000000006067229 */ /* 0x0040c40000000008 */ /*0ca0*/ IMAD.MOV.U32 R8, RZ, RZ, 0x0 ; /* 0x00000000ff087424 */ /* 0x001fe400078e00ff */ /*0cb0*/ IMAD.MOV.U32 R9, RZ, RZ, 0x40590000 ; /* 0x40590000ff097424 */ /* 0x000fe400078e00ff */ /*0cc0*/ DADD R6, R6, R10 ; /* 0x0000000006067229 */ /* 0x008f0c000000000a */ /*0cd0*/ DADD R12, R6, R12 ; /* 0x00000000060c7229 */ /* 0x010164000000000c */ /*0ce0*/ IMAD.MOV.U32 R6, RZ, RZ, 0x1 ; /* 0x00000001ff067424 */ /* 0x001fe400078e00ff */ /*0cf0*/ MUFU.RCP64H R7, 100 ; /* 0x4059000000077908 */ /* 0x000e240000001800 */ /*0d00*/ DADD R12, R12, R14 ; /* 0x000000000c0c7229 */ /* 0x020e4c000000000e */ /*0d10*/ DADD R12, R12, R16 ; /* 0x000000000c0c7229 */ /* 0x002e4c0000000010 */ /*0d20*/ DADD R12, R12, R20 ; /* 0x000000000c0c7229 */ /* 0x002e480000000014 */ /*0d30*/ DFMA R10, R6, -R8, 1 ; /* 0x3ff00000060a742b */ /* 0x001e080000000808 */ /*0d40*/ DADD R22, R22, R12 ; /* 0x0000000016167229 */ /* 0x002e48000000000c */ /*0d50*/ DFMA R10, R10, R10, R10 ; /* 0x0000000a0a0a722b */ /* 0x001e08000000000a */ /*0d60*/ DADD R18, R22, R18 ; /* 0x0000000016127229 */ /* 0x002e480000000012 */ /*0d70*/ DFMA R10, R6, R10, R6 ; /* 0x0000000a060a722b */ /* 0x001e080000000006 */ /*0d80*/ DADD R4, R18, R4 ; /* 0x0000000012047229 */ /* 0x002e480000000004 */ /*0d90*/ DFMA R8, R10, -R8, 1 ; /* 0x3ff000000a08742b */ /* 0x001e080000000808 */ /*0da0*/ DADD R4, R4, R24 ; /* 0x0000000004047229 */ /* 0x002fc80000000018 */ /*0db0*/ DFMA R8, R10, R8, R10 ; /* 0x000000080a08722b */ /* 0x001e0c000000000a */ /*0dc0*/ DMUL R2, R4, R8 ; /* 0x0000000804027228 */ /* 0x001e220000000000 */ /*0dd0*/ FSETP.GEU.AND P1, PT, |R5|, 6.5827683646048100446e-37, PT ; /* 0x036000000500780b */ /* 0x000fca0003f2e200 */ /*0de0*/ DFMA R6, R2, -100, R4 ; /* 0xc05900000206782b */ /* 0x001e0c0000000004 */ /*0df0*/ DFMA R2, R8, R6, R2 ; /* 0x000000060802722b */ /* 0x001e140000000002 */ /*0e00*/ FFMA R6, RZ, 3.390625, R3 ; /* 0x40590000ff067823 */ /* 0x001fca0000000003 */ /*0e10*/ FSETP.GT.AND P0, PT, |R6|, 1.469367938527859385e-39, PT ; /* 0x001000000600780b */ /* 0x000fda0003f04200 */ /*0e20*/ @P0 BRA P1, 0xe50 ; /* 0x0000002000000947 */ /* 0x000fea0000800000 */ /*0e30*/ MOV R6, 0xe50 ; /* 0x00000e5000067802 */ /* 0x000fe40000000f00 */ /*0e40*/ CALL.REL.NOINC 0xea0 ; /* 0x0000005000007944 */ /* 0x000fea0003c00000 */ /*0e50*/ BSYNC B0 ; /* 0x0000000000007941 */ /* 0x000fea0003800000 */ /*0e60*/ IMAD.MOV.U32 R5, RZ, RZ, 0x8 ; /* 0x00000008ff057424 */ /* 0x000fc800078e00ff */ /*0e70*/ IMAD.WIDE R4, R0, R5, c[0x0][0x168] ; /* 0x00005a0000047625 */ /* 0x000fca00078e0205 */ /*0e80*/ STG.E.64 [R4.64], R2 ; /* 0x0000000204007986 */ /* 0x000fe2000c101b04 */ /*0e90*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*0ea0*/ IMAD.MOV.U32 R3, RZ, RZ, 0x3ff90000 ; /* 0x3ff90000ff037424 */ /* 0x000fe200078e00ff */ /*0eb0*/ FSETP.GEU.AND P1, PT, |R5|.reuse, 1.469367938527859385e-39, PT ; /* 0x001000000500780b */ /* 0x040fe20003f2e200 */ /*0ec0*/ IMAD.MOV.U32 R2, RZ, RZ, 0x0 ; /* 0x00000000ff027424 */ /* 0x000fe200078e00ff */ /*0ed0*/ LOP3.LUT R7, R5, 0x7ff00000, RZ, 0xc0, !PT ; /* 0x7ff0000005077812 */ /* 0x000fe200078ec0ff */ /*0ee0*/ MUFU.RCP64H R9, R3 ; /* 0x0000000300097308 */ /* 0x000e220000001800 */ /*0ef0*/ IMAD.MOV.U32 R8, RZ, RZ, 0x1 ; /* 0x00000001ff087424 */ /* 0x000fe200078e00ff */ /*0f00*/ BSSY B1, 0x1360 ; /* 0x0000045000017945 */ /* 0x000fe20003800000 */ /*0f10*/ IMAD.MOV.U32 R13, RZ, RZ, 0x1ca00000 ; /* 0x1ca00000ff0d7424 */ /* 0x000fe200078e00ff */ /*0f20*/ ISETP.GE.U32.AND P0, PT, R7, 0x40500000, PT ; /* 0x405000000700780c */ /* 0x000fe20003f06070 */ /*0f30*/ IMAD.MOV.U32 R18, RZ, RZ, R7 ; /* 0x000000ffff127224 */ /* 0x000fc400078e0007 */ /*0f40*/ IMAD.MOV.U32 R19, RZ, RZ, 0x40500000 ; /* 0x40500000ff137424 */ /* 0x000fe200078e00ff */ /*0f50*/ SEL R13, R13, 0x63400000, !P0 ; /* 0x634000000d0d7807 */ /* 0x000fc80004000000 */ /*0f60*/ @!P1 LOP3.LUT R12, R13, 0x80000000, R5, 0xf8, !PT ; /* 0x800000000d0c9812 */ /* 0x000fe400078ef805 */ /*0f70*/ IADD3 R20, R19, -0x1, RZ ; /* 0xffffffff13147810 */ /* 0x000fe20007ffe0ff */ /*0f80*/ DFMA R10, R8, -R2, 1 ; /* 0x3ff00000080a742b */ /* 0x001e0c0000000802 */ /*0f90*/ DFMA R10, R10, R10, R10 ; /* 0x0000000a0a0a722b */ /* 0x001e0c000000000a */ /*0fa0*/ DFMA R14, R8, R10, R8 ; /* 0x0000000a080e722b */ /* 0x0010640000000008 */ /*0fb0*/ LOP3.LUT R9, R13, 0x800fffff, R5, 0xf8, !PT ; /* 0x800fffff0d097812 */ /* 0x001fe200078ef805 */ /*0fc0*/ IMAD.MOV.U32 R8, RZ, RZ, R4 ; /* 0x000000ffff087224 */ /* 0x000fe200078e0004 */ /*0fd0*/ @!P1 LOP3.LUT R11, R12, 0x100000, RZ, 0xfc, !PT ; /* 0x001000000c0b9812 */ /* 0x000fe200078efcff */ /*0fe0*/ @!P1 IMAD.MOV.U32 R10, RZ, RZ, RZ ; /* 0x000000ffff0a9224 */ /* 0x000fe200078e00ff */ /*0ff0*/ DFMA R16, R14, -R2, 1 ; /* 0x3ff000000e10742b */ /* 0x002e0a0000000802 */ /*1000*/ @!P1 DFMA R8, R8, 2, -R10 ; /* 0x400000000808982b */ /* 0x000e48000000080a */ /*1010*/ DFMA R16, R14, R16, R14 ; /* 0x000000100e10722b */ /* 0x001e0c000000000e */ /*1020*/ @!P1 LOP3.LUT R18, R9, 0x7ff00000, RZ, 0xc0, !PT ; /* 0x7ff0000009129812 */ /* 0x002fe200078ec0ff */ /*1030*/ DMUL R10, R16, R8 ; /* 0x00000008100a7228 */ /* 0x001e060000000000 */ /*1040*/ IADD3 R12, R18, -0x1, RZ ; /* 0xffffffff120c7810 */ /* 0x000fc60007ffe0ff */ /*1050*/ DFMA R14, R10, -R2, R8 ; /* 0x800000020a0e722b */ /* 0x001e220000000008 */ /*1060*/ ISETP.GT.U32.AND P0, PT, R12, 0x7feffffe, PT ; /* 0x7feffffe0c00780c */ /* 0x000fc80003f04070 */ /*1070*/ ISETP.GT.U32.OR P0, PT, R20, 0x7feffffe, P0 ; /* 0x7feffffe1400780c */ /* 0x000fe20000704470 */ /*1080*/ DFMA R10, R16, R14, R10 ; /* 0x0000000e100a722b */ /* 0x001058000000000a */ /*1090*/ @P0 BRA 0x1240 ; /* 0x000001a000000947 */ /* 0x000fea0003800000 */ /*10a0*/ IADD3 R7, R7, -0x40500000, RZ ; /* 0xbfb0000007077810 */ /* 0x003fc80007ffe0ff */ /*10b0*/ IMNMX R7, R7, -0x46a00000, !PT ; /* 0xb960000007077817 */ /* 0x000fc80007800200 */ /*10c0*/ IMNMX R4, R7, 0x46a00000, PT ; /* 0x46a0000007047817 */ /* 0x000fca0003800200 */ /*10d0*/ IMAD.IADD R7, R4, 0x1, -R13 ; /* 0x0000000104077824 */ /* 0x000fe400078e0a0d */ /*10e0*/ IMAD.MOV.U32 R4, RZ, RZ, RZ ; /* 0x000000ffff047224 */ /* 0x000fc600078e00ff */ /*10f0*/ IADD3 R5, R7, 0x7fe00000, RZ ; /* 0x7fe0000007057810 */ /* 0x000fcc0007ffe0ff */ /*1100*/ DMUL R12, R10, R4 ; /* 0x000000040a0c7228 */ /* 0x000e140000000000 */ /*1110*/ FSETP.GTU.AND P0, PT, |R13|, 1.469367938527859385e-39, PT ; /* 0x001000000d00780b */ /* 0x001fda0003f0c200 */ /*1120*/ @P0 BRA 0x1350 ; /* 0x0000022000000947 */ /* 0x000fea0003800000 */ /*1130*/ DFMA R2, R10, -R2, R8 ; /* 0x800000020a02722b */ /* 0x000e220000000008 */ /*1140*/ IMAD.MOV.U32 R4, RZ, RZ, RZ ; /* 0x000000ffff047224 */ /* 0x000fd200078e00ff */ /*1150*/ FSETP.NEU.AND P0, PT, R3.reuse, RZ, PT ; /* 0x000000ff0300720b */ /* 0x041fe40003f0d000 */ /*1160*/ LOP3.LUT R2, R3, 0x40590000, RZ, 0x3c, !PT ; /* 0x4059000003027812 */ /* 0x000fc800078e3cff */ /*1170*/ LOP3.LUT R9, R2, 0x80000000, RZ, 0xc0, !PT ; /* 0x8000000002097812 */ /* 0x000fc800078ec0ff */ /*1180*/ LOP3.LUT R5, R9, R5, RZ, 0xfc, !PT ; /* 0x0000000509057212 */ /* 0x000fc600078efcff */ /*1190*/ @!P0 BRA 0x1350 ; /* 0x000001b000008947 */ /* 0x000fea0003800000 */ /*11a0*/ IMAD.MOV R3, RZ, RZ, -R7 ; /* 0x000000ffff037224 */ /* 0x000fe200078e0a07 */ /*11b0*/ DMUL.RP R4, R10, R4 ; /* 0x000000040a047228 */ /* 0x000e220000008000 */ /*11c0*/ IMAD.MOV.U32 R2, RZ, RZ, RZ ; /* 0x000000ffff027224 */ /* 0x000fe200078e00ff */ /*11d0*/ IADD3 R7, -R7, -0x43300000, RZ ; /* 0xbcd0000007077810 */ /* 0x000fca0007ffe1ff */ /*11e0*/ DFMA R2, R12, -R2, R10 ; /* 0x800000020c02722b */ /* 0x000e46000000000a */ /*11f0*/ LOP3.LUT R9, R5, R9, RZ, 0x3c, !PT ; /* 0x0000000905097212 */ /* 0x001fce00078e3cff */ /*1200*/ FSETP.NEU.AND P0, PT, |R3|, R7, PT ; /* 0x000000070300720b */ /* 0x002fc80003f0d200 */ /*1210*/ FSEL R12, R4, R12, !P0 ; /* 0x0000000c040c7208 */ /* 0x000fe40004000000 */ /*1220*/ FSEL R13, R9, R13, !P0 ; /* 0x0000000d090d7208 */ /* 0x000fe20004000000 */ /*1230*/ BRA 0x1350 ; /* 0x0000011000007947 */ /* 0x000fea0003800000 */ /*1240*/ DSETP.NAN.AND P0, PT, R4, R4, PT ; /* 0x000000040400722a */ /* 0x003e1c0003f08000 */ /*1250*/ @P0 BRA 0x1330 ; /* 0x000000d000000947 */ /* 0x001fea0003800000 */ /*1260*/ ISETP.NE.AND P0, PT, R18, R19, PT ; /* 0x000000131200720c */ /* 0x000fe20003f05270 */ /*1270*/ IMAD.MOV.U32 R12, RZ, RZ, 0x0 ; /* 0x00000000ff0c7424 */ /* 0x000fe400078e00ff */ /*1280*/ IMAD.MOV.U32 R13, RZ, RZ, -0x80000 ; /* 0xfff80000ff0d7424 */ /* 0x000fd400078e00ff */ /*1290*/ @!P0 BRA 0x1350 ; /* 0x000000b000008947 */ /* 0x000fea0003800000 */ /*12a0*/ ISETP.NE.AND P0, PT, R18, 0x7ff00000, PT ; /* 0x7ff000001200780c */ /* 0x000fe40003f05270 */ /*12b0*/ LOP3.LUT R4, R5, 0x40590000, RZ, 0x3c, !PT ; /* 0x4059000005047812 */ /* 0x000fe400078e3cff */ /*12c0*/ ISETP.EQ.OR P0, PT, R19, RZ, !P0 ; /* 0x000000ff1300720c */ /* 0x000fe40004702670 */ /*12d0*/ LOP3.LUT R13, R4, 0x80000000, RZ, 0xc0, !PT ; /* 0x80000000040d7812 */ /* 0x000fd600078ec0ff */ /*12e0*/ @P0 LOP3.LUT R2, R13, 0x7ff00000, RZ, 0xfc, !PT ; /* 0x7ff000000d020812 */ /* 0x000fe200078efcff */ /*12f0*/ @!P0 IMAD.MOV.U32 R12, RZ, RZ, RZ ; /* 0x000000ffff0c8224 */ /* 0x000fe400078e00ff */ /*1300*/ @P0 IMAD.MOV.U32 R12, RZ, RZ, RZ ; /* 0x000000ffff0c0224 */ /* 0x000fe400078e00ff */ /*1310*/ @P0 IMAD.MOV.U32 R13, RZ, RZ, R2 ; /* 0x000000ffff0d0224 */ /* 0x000fe200078e0002 */ /*1320*/ BRA 0x1350 ; /* 0x0000002000007947 */ /* 0x000fea0003800000 */ /*1330*/ LOP3.LUT R13, R5, 0x80000, RZ, 0xfc, !PT ; /* 0x00080000050d7812 */ /* 0x000fe200078efcff */ /*1340*/ IMAD.MOV.U32 R12, RZ, RZ, R4 ; /* 0x000000ffff0c7224 */ /* 0x000fe400078e0004 */ /*1350*/ BSYNC B1 ; /* 0x0000000000017941 */ /* 0x000fea0003800000 */ /*1360*/ IMAD.MOV.U32 R7, RZ, RZ, 0x0 ; /* 0x00000000ff077424 */ /* 0x000fe400078e00ff */ /*1370*/ IMAD.MOV.U32 R2, RZ, RZ, R12 ; /* 0x000000ffff027224 */ /* 0x000fe400078e000c */ /*1380*/ IMAD.MOV.U32 R3, RZ, RZ, R13 ; /* 0x000000ffff037224 */ /* 0x000fe200078e000d */ /*1390*/ RET.REL.NODEC R6 0x0 ; /* 0xffffec6006007950 */ /* 0x000fec0003c3ffff */ /*13a0*/ BRA 0x13a0; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*13b0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*13c0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*13d0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*13e0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*13f0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*1400*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*1410*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*1420*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*1430*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*1440*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*1450*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*1460*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*1470*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ ..........
You are a helpful coding assistant specialized in converting CUDA source code to CUDA host assembly.
#include "includes.h" //CUDA reduction algorithm. simple approach //Tom Dale //11-20-18 using namespace std; #define N 100000//number of input values #define R 100//reduction factor #define F (1+((N-1)/R))//how many values will be in the final output //basicRun will F number of threads go through R number of values and put the average in z[tid] __global__ void basicRun(double *a,double *z){ int tid = blockDim.x*blockIdx.x + threadIdx.x; if(tid > F) return; double avg=0; for(int i= 0;i<R;i++){//get sum of input values in this threads domain avg += a[i+tid*R]; } z[tid]=avg/R;//divide sum by total number of input values to get average }
.file "tmpxft_0015e64d_00000000-6_basicRun.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 _Z29__device_stub__Z8basicRunPdS_PdS_ .type _Z29__device_stub__Z8basicRunPdS_PdS_, @function _Z29__device_stub__Z8basicRunPdS_PdS_: .LFB2051: .cfi_startproc endbr64 subq $120, %rsp .cfi_def_cfa_offset 128 movq %rdi, 8(%rsp) movq %rsi, (%rsp) movq %fs:40, %rax movq %rax, 104(%rsp) xorl %eax, %eax leaq 8(%rsp), %rax movq %rax, 80(%rsp) movq %rsp, %rax movq %rax, 88(%rsp) movl $1, 32(%rsp) movl $1, 36(%rsp) movl $1, 40(%rsp) movl $1, 44(%rsp) movl $1, 48(%rsp) movl $1, 52(%rsp) leaq 24(%rsp), %rcx leaq 16(%rsp), %rdx leaq 44(%rsp), %rsi leaq 32(%rsp), %rdi call __cudaPopCallConfiguration@PLT testl %eax, %eax je .L7 .L3: movq 104(%rsp), %rax subq %fs:40, %rax jne .L8 addq $120, %rsp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L7: .cfi_restore_state pushq 24(%rsp) .cfi_def_cfa_offset 136 pushq 24(%rsp) .cfi_def_cfa_offset 144 leaq 96(%rsp), %r9 movq 60(%rsp), %rcx movl 68(%rsp), %r8d movq 48(%rsp), %rsi movl 56(%rsp), %edx leaq _Z8basicRunPdS_(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 128 jmp .L3 .L8: call __stack_chk_fail@PLT .cfi_endproc .LFE2051: .size _Z29__device_stub__Z8basicRunPdS_PdS_, .-_Z29__device_stub__Z8basicRunPdS_PdS_ .globl _Z8basicRunPdS_ .type _Z8basicRunPdS_, @function _Z8basicRunPdS_: .LFB2052: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z29__device_stub__Z8basicRunPdS_PdS_ addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2052: .size _Z8basicRunPdS_, .-_Z8basicRunPdS_ .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "_Z8basicRunPdS_" .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 _Z8basicRunPdS_(%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" //CUDA reduction algorithm. simple approach //Tom Dale //11-20-18 using namespace std; #define N 100000//number of input values #define R 100//reduction factor #define F (1+((N-1)/R))//how many values will be in the final output //basicRun will F number of threads go through R number of values and put the average in z[tid] __global__ void basicRun(double *a,double *z){ int tid = blockDim.x*blockIdx.x + threadIdx.x; if(tid > F) return; double avg=0; for(int i= 0;i<R;i++){//get sum of input values in this threads domain avg += a[i+tid*R]; } z[tid]=avg/R;//divide sum by total number of input values to get average }
#include <hip/hip_runtime.h> #include "includes.h" //CUDA reduction algorithm. simple approach //Tom Dale //11-20-18 using namespace std; #define N 100000//number of input values #define R 100//reduction factor #define F (1+((N-1)/R))//how many values will be in the final output //basicRun will F number of threads go through R number of values and put the average in z[tid] __global__ void basicRun(double *a,double *z){ int tid = blockDim.x*blockIdx.x + threadIdx.x; if(tid > F) return; double avg=0; for(int i= 0;i<R;i++){//get sum of input values in this threads domain avg += a[i+tid*R]; } z[tid]=avg/R;//divide sum by total number of input values to get average }
You are a helpful coding assistant specialized in converting HIP source code to AMD device assembly.
#include <hip/hip_runtime.h> #include "includes.h" //CUDA reduction algorithm. simple approach //Tom Dale //11-20-18 using namespace std; #define N 100000//number of input values #define R 100//reduction factor #define F (1+((N-1)/R))//how many values will be in the final output //basicRun will F number of threads go through R number of values and put the average in z[tid] __global__ void basicRun(double *a,double *z){ int tid = blockDim.x*blockIdx.x + threadIdx.x; if(tid > F) return; double avg=0; for(int i= 0;i<R;i++){//get sum of input values in this threads domain avg += a[i+tid*R]; } z[tid]=avg/R;//divide sum by total number of input values to get average }
.text .amdgcn_target "amdgcn-amd-amdhsa--gfx1100" .protected _Z8basicRunPdS_ .globl _Z8basicRunPdS_ .p2align 8 .type _Z8basicRunPdS_,@function _Z8basicRunPdS_: s_load_b32 s2, s[0:1], 0x1c 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 0x3e9, v1 s_cbranch_execz .LBB0_4 s_load_b64 s[2:3], s[0:1], 0x0 v_mul_lo_u32 v2, v1, 0x64 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_ashrrev_i32_e32 v3, 31, v2 v_lshlrev_b64 v[4:5], 3, v[2:3] v_mov_b32_e32 v2, 0 v_mov_b32_e32 v3, 0 s_waitcnt lgkmcnt(0) s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_4) v_add_co_u32 v0, vcc_lo, s2, v4 v_add_co_ci_u32_e32 v4, vcc_lo, s3, v5, vcc_lo s_mov_b64 s[2:3], 0 .LBB0_2: s_delay_alu instid0(VALU_DEP_2) | instid1(SALU_CYCLE_1) v_add_co_u32 v5, vcc_lo, v0, s2 s_delay_alu instid0(VALU_DEP_2) v_add_co_ci_u32_e32 v6, vcc_lo, s3, v4, vcc_lo s_add_u32 s2, s2, 8 s_addc_u32 s3, s3, 0 s_cmpk_eq_i32 s2, 0x320 global_load_b64 v[5:6], v[5:6], off s_waitcnt vmcnt(0) v_add_f64 v[2:3], v[2:3], v[5:6] s_cbranch_scc0 .LBB0_2 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_div_scale_f64 v[4:5], null, 0x40590000, 0x40590000, v[2:3] s_load_b64 s[0:1], s[0:1], 0x8 v_rcp_f64_e32 v[6:7], v[4:5] s_waitcnt_depctr 0xfff v_fma_f64 v[8:9], -v[4:5], v[6:7], 1.0 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7] v_fma_f64 v[8:9], -v[4:5], v[6:7], 1.0 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7] v_div_scale_f64 v[8:9], vcc_lo, v[2:3], 0x40590000, v[2:3] v_mul_f64 v[10:11], v[8:9], v[6:7] s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_fma_f64 v[4:5], -v[4:5], v[10:11], v[8:9] v_div_fmas_f64 v[4:5], v[4:5], v[6:7], v[10:11] s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_div_fixup_f64 v[3:4], v[4:5], 0x40590000, v[2:3] v_ashrrev_i32_e32 v2, 31, v1 v_lshlrev_b64 v[0:1], 3, v[1:2] 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_b64 v[0:1], v[3:4], off .LBB0_4: s_nop 0 s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z8basicRunPdS_ .amdhsa_group_segment_fixed_size 0 .amdhsa_private_segment_fixed_size 0 .amdhsa_kernarg_size 272 .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 12 .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 _Z8basicRunPdS_, .Lfunc_end0-_Z8basicRunPdS_ .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: hidden_block_count_x - .offset: 20 .size: 4 .value_kind: hidden_block_count_y - .offset: 24 .size: 4 .value_kind: hidden_block_count_z - .offset: 28 .size: 2 .value_kind: hidden_group_size_x - .offset: 30 .size: 2 .value_kind: hidden_group_size_y - .offset: 32 .size: 2 .value_kind: hidden_group_size_z - .offset: 34 .size: 2 .value_kind: hidden_remainder_x - .offset: 36 .size: 2 .value_kind: hidden_remainder_y - .offset: 38 .size: 2 .value_kind: hidden_remainder_z - .offset: 56 .size: 8 .value_kind: hidden_global_offset_x - .offset: 64 .size: 8 .value_kind: hidden_global_offset_y - .offset: 72 .size: 8 .value_kind: hidden_global_offset_z - .offset: 80 .size: 2 .value_kind: hidden_grid_dims .group_segment_fixed_size: 0 .kernarg_segment_align: 8 .kernarg_segment_size: 272 .language: OpenCL C .language_version: - 2 - 0 .max_flat_workgroup_size: 1024 .name: _Z8basicRunPdS_ .private_segment_fixed_size: 0 .sgpr_count: 18 .sgpr_spill_count: 0 .symbol: _Z8basicRunPdS_.kd .uniform_work_group_size: 1 .uses_dynamic_stack: false .vgpr_count: 12 .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" //CUDA reduction algorithm. simple approach //Tom Dale //11-20-18 using namespace std; #define N 100000//number of input values #define R 100//reduction factor #define F (1+((N-1)/R))//how many values will be in the final output //basicRun will F number of threads go through R number of values and put the average in z[tid] __global__ void basicRun(double *a,double *z){ int tid = blockDim.x*blockIdx.x + threadIdx.x; if(tid > F) return; double avg=0; for(int i= 0;i<R;i++){//get sum of input values in this threads domain avg += a[i+tid*R]; } z[tid]=avg/R;//divide sum by total number of input values to get average }
.text .file "basicRun.hip" .globl _Z23__device_stub__basicRunPdS_ # -- Begin function _Z23__device_stub__basicRunPdS_ .p2align 4, 0x90 .type _Z23__device_stub__basicRunPdS_,@function _Z23__device_stub__basicRunPdS_: # @_Z23__device_stub__basicRunPdS_ .cfi_startproc # %bb.0: subq $88, %rsp .cfi_def_cfa_offset 96 movq %rdi, 56(%rsp) movq %rsi, 48(%rsp) leaq 56(%rsp), %rax movq %rax, 64(%rsp) leaq 48(%rsp), %rax movq %rax, 72(%rsp) 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 64(%rsp), %r9 movl $_Z8basicRunPdS_, %edi pushq (%rsp) .cfi_adjust_cfa_offset 8 pushq 16(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $104, %rsp .cfi_adjust_cfa_offset -104 retq .Lfunc_end0: .size _Z23__device_stub__basicRunPdS_, .Lfunc_end0-_Z23__device_stub__basicRunPdS_ .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 $_Z8basicRunPdS_, %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 _Z8basicRunPdS_,@object # @_Z8basicRunPdS_ .section .rodata,"a",@progbits .globl _Z8basicRunPdS_ .p2align 3, 0x0 _Z8basicRunPdS_: .quad _Z23__device_stub__basicRunPdS_ .size _Z8basicRunPdS_, 8 .type .L__unnamed_1,@object # @0 .section .rodata.str1.1,"aMS",@progbits,1 .L__unnamed_1: .asciz "_Z8basicRunPdS_" .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 _Z23__device_stub__basicRunPdS_ .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z8basicRunPdS_ .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_0015e64d_00000000-6_basicRun.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 _Z29__device_stub__Z8basicRunPdS_PdS_ .type _Z29__device_stub__Z8basicRunPdS_PdS_, @function _Z29__device_stub__Z8basicRunPdS_PdS_: .LFB2051: .cfi_startproc endbr64 subq $120, %rsp .cfi_def_cfa_offset 128 movq %rdi, 8(%rsp) movq %rsi, (%rsp) movq %fs:40, %rax movq %rax, 104(%rsp) xorl %eax, %eax leaq 8(%rsp), %rax movq %rax, 80(%rsp) movq %rsp, %rax movq %rax, 88(%rsp) movl $1, 32(%rsp) movl $1, 36(%rsp) movl $1, 40(%rsp) movl $1, 44(%rsp) movl $1, 48(%rsp) movl $1, 52(%rsp) leaq 24(%rsp), %rcx leaq 16(%rsp), %rdx leaq 44(%rsp), %rsi leaq 32(%rsp), %rdi call __cudaPopCallConfiguration@PLT testl %eax, %eax je .L7 .L3: movq 104(%rsp), %rax subq %fs:40, %rax jne .L8 addq $120, %rsp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L7: .cfi_restore_state pushq 24(%rsp) .cfi_def_cfa_offset 136 pushq 24(%rsp) .cfi_def_cfa_offset 144 leaq 96(%rsp), %r9 movq 60(%rsp), %rcx movl 68(%rsp), %r8d movq 48(%rsp), %rsi movl 56(%rsp), %edx leaq _Z8basicRunPdS_(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 128 jmp .L3 .L8: call __stack_chk_fail@PLT .cfi_endproc .LFE2051: .size _Z29__device_stub__Z8basicRunPdS_PdS_, .-_Z29__device_stub__Z8basicRunPdS_PdS_ .globl _Z8basicRunPdS_ .type _Z8basicRunPdS_, @function _Z8basicRunPdS_: .LFB2052: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z29__device_stub__Z8basicRunPdS_PdS_ addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2052: .size _Z8basicRunPdS_, .-_Z8basicRunPdS_ .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "_Z8basicRunPdS_" .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 _Z8basicRunPdS_(%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 "basicRun.hip" .globl _Z23__device_stub__basicRunPdS_ # -- Begin function _Z23__device_stub__basicRunPdS_ .p2align 4, 0x90 .type _Z23__device_stub__basicRunPdS_,@function _Z23__device_stub__basicRunPdS_: # @_Z23__device_stub__basicRunPdS_ .cfi_startproc # %bb.0: subq $88, %rsp .cfi_def_cfa_offset 96 movq %rdi, 56(%rsp) movq %rsi, 48(%rsp) leaq 56(%rsp), %rax movq %rax, 64(%rsp) leaq 48(%rsp), %rax movq %rax, 72(%rsp) 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 64(%rsp), %r9 movl $_Z8basicRunPdS_, %edi pushq (%rsp) .cfi_adjust_cfa_offset 8 pushq 16(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $104, %rsp .cfi_adjust_cfa_offset -104 retq .Lfunc_end0: .size _Z23__device_stub__basicRunPdS_, .Lfunc_end0-_Z23__device_stub__basicRunPdS_ .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 $_Z8basicRunPdS_, %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 _Z8basicRunPdS_,@object # @_Z8basicRunPdS_ .section .rodata,"a",@progbits .globl _Z8basicRunPdS_ .p2align 3, 0x0 _Z8basicRunPdS_: .quad _Z23__device_stub__basicRunPdS_ .size _Z8basicRunPdS_, 8 .type .L__unnamed_1,@object # @0 .section .rodata.str1.1,"aMS",@progbits,1 .L__unnamed_1: .asciz "_Z8basicRunPdS_" .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 _Z23__device_stub__basicRunPdS_ .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z8basicRunPdS_ .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.
int main() { const unsigned int N = 1048576; const unsigned int bytes = N * sizeof(int); int *h_a = (int*)malloc(bytes); int *d_a; cudaMalloc((int**)&d_a, bytes); memset(h_a, 0, bytes); cudaMemcpy(d_a, h_a, bytes, cudaMemcpyHostToDevice); cudaMemcpy(h_a, d_a, bytes, cudaMemcpyDeviceToHost); return 0; } /* Run these next commands to run the program: $ nvcc profile.cu -o profile_test $ nvprof ./profile_test */
code for sm_80
You are a helpful coding assistant specialized in converting CUDA source code to CUDA host assembly.
int main() { const unsigned int N = 1048576; const unsigned int bytes = N * sizeof(int); int *h_a = (int*)malloc(bytes); int *d_a; cudaMalloc((int**)&d_a, bytes); memset(h_a, 0, bytes); cudaMemcpy(d_a, h_a, bytes, cudaMemcpyHostToDevice); cudaMemcpy(h_a, d_a, bytes, cudaMemcpyDeviceToHost); return 0; } /* Run these next commands to run the program: $ nvcc profile.cu -o profile_test $ nvprof ./profile_test */
.file "tmpxft_0018856e_00000000-6_profile.cudafe1.cpp" .text #APP #NO_APP .type _ZL26__cudaUnregisterBinaryUtilv, @function _ZL26__cudaUnregisterBinaryUtilv: .LFB2030: .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 .LFE2030: .size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv .globl main .type main, @function main: .LFB2027: .cfi_startproc endbr64 pushq %rbx .cfi_def_cfa_offset 16 .cfi_offset 3, -16 subq $16, %rsp .cfi_def_cfa_offset 32 movq %fs:40, %rax movq %rax, 8(%rsp) xorl %eax, %eax movl $4194304, %edi call malloc@PLT movq %rax, %rbx movq %rsp, %rdi movl $4194304, %esi call cudaMalloc@PLT movl $4194304, %edx movl $0, %esi movq %rbx, %rdi call memset@PLT movl $1, %ecx movl $4194304, %edx movq %rbx, %rsi movq (%rsp), %rdi call cudaMemcpy@PLT movl $2, %ecx movl $4194304, %edx movq (%rsp), %rsi movq %rbx, %rdi call cudaMemcpy@PLT movq 8(%rsp), %rax subq %fs:40, %rax jne .L6 movl $0, %eax addq $16, %rsp .cfi_remember_state .cfi_def_cfa_offset 16 popq %rbx .cfi_def_cfa_offset 8 ret .L6: .cfi_restore_state call __stack_chk_fail@PLT .cfi_endproc .LFE2027: .size main, .-main .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB2053: .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 .LFE2053: .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.
int main() { const unsigned int N = 1048576; const unsigned int bytes = N * sizeof(int); int *h_a = (int*)malloc(bytes); int *d_a; cudaMalloc((int**)&d_a, bytes); memset(h_a, 0, bytes); cudaMemcpy(d_a, h_a, bytes, cudaMemcpyHostToDevice); cudaMemcpy(h_a, d_a, bytes, cudaMemcpyDeviceToHost); return 0; } /* Run these next commands to run the program: $ nvcc profile.cu -o profile_test $ nvprof ./profile_test */
#include <hip/hip_runtime.h> int main() { const unsigned int N = 1048576; const unsigned int bytes = N * sizeof(int); int *h_a = (int*)malloc(bytes); int *d_a; hipMalloc((int**)&d_a, bytes); memset(h_a, 0, bytes); hipMemcpy(d_a, h_a, bytes, hipMemcpyHostToDevice); hipMemcpy(h_a, d_a, bytes, hipMemcpyDeviceToHost); return 0; } /* Run these next commands to run the program: $ nvcc profile.cu -o profile_test $ nvprof ./profile_test */
You are a helpful coding assistant specialized in converting HIP source code to AMD device assembly.
#include <hip/hip_runtime.h> int main() { const unsigned int N = 1048576; const unsigned int bytes = N * sizeof(int); int *h_a = (int*)malloc(bytes); int *d_a; hipMalloc((int**)&d_a, bytes); memset(h_a, 0, bytes); hipMemcpy(d_a, h_a, bytes, hipMemcpyHostToDevice); hipMemcpy(h_a, d_a, bytes, hipMemcpyDeviceToHost); return 0; } /* Run these next commands to run the program: $ nvcc profile.cu -o profile_test $ nvprof ./profile_test */
.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> int main() { const unsigned int N = 1048576; const unsigned int bytes = N * sizeof(int); int *h_a = (int*)malloc(bytes); int *d_a; hipMalloc((int**)&d_a, bytes); memset(h_a, 0, bytes); hipMemcpy(d_a, h_a, bytes, hipMemcpyHostToDevice); hipMemcpy(h_a, d_a, bytes, hipMemcpyDeviceToHost); return 0; } /* Run these next commands to run the program: $ nvcc profile.cu -o profile_test $ nvprof ./profile_test */
.text .file "profile.hip" .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 $16, %rsp .cfi_def_cfa_offset 32 .cfi_offset %rbx, -16 movl $4194304, %edi # imm = 0x400000 callq malloc movq %rax, %rbx leaq 8(%rsp), %rdi movl $4194304, %esi # imm = 0x400000 callq hipMalloc movl $4194304, %edx # imm = 0x400000 movq %rbx, %rdi xorl %esi, %esi callq memset@PLT movq 8(%rsp), %rdi movl $4194304, %edx # imm = 0x400000 movq %rbx, %rsi movl $1, %ecx callq hipMemcpy movq 8(%rsp), %rsi movl $4194304, %edx # imm = 0x400000 movq %rbx, %rdi movl $2, %ecx callq hipMemcpy xorl %eax, %eax addq $16, %rsp .cfi_def_cfa_offset 16 popq %rbx .cfi_def_cfa_offset 8 retq .Lfunc_end0: .size main, .Lfunc_end0-main .cfi_endproc # -- End function .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 __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_0018856e_00000000-6_profile.cudafe1.cpp" .text #APP #NO_APP .type _ZL26__cudaUnregisterBinaryUtilv, @function _ZL26__cudaUnregisterBinaryUtilv: .LFB2030: .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 .LFE2030: .size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv .globl main .type main, @function main: .LFB2027: .cfi_startproc endbr64 pushq %rbx .cfi_def_cfa_offset 16 .cfi_offset 3, -16 subq $16, %rsp .cfi_def_cfa_offset 32 movq %fs:40, %rax movq %rax, 8(%rsp) xorl %eax, %eax movl $4194304, %edi call malloc@PLT movq %rax, %rbx movq %rsp, %rdi movl $4194304, %esi call cudaMalloc@PLT movl $4194304, %edx movl $0, %esi movq %rbx, %rdi call memset@PLT movl $1, %ecx movl $4194304, %edx movq %rbx, %rsi movq (%rsp), %rdi call cudaMemcpy@PLT movl $2, %ecx movl $4194304, %edx movq (%rsp), %rsi movq %rbx, %rdi call cudaMemcpy@PLT movq 8(%rsp), %rax subq %fs:40, %rax jne .L6 movl $0, %eax addq $16, %rsp .cfi_remember_state .cfi_def_cfa_offset 16 popq %rbx .cfi_def_cfa_offset 8 ret .L6: .cfi_restore_state call __stack_chk_fail@PLT .cfi_endproc .LFE2027: .size main, .-main .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB2053: .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 .LFE2053: .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 "profile.hip" .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 $16, %rsp .cfi_def_cfa_offset 32 .cfi_offset %rbx, -16 movl $4194304, %edi # imm = 0x400000 callq malloc movq %rax, %rbx leaq 8(%rsp), %rdi movl $4194304, %esi # imm = 0x400000 callq hipMalloc movl $4194304, %edx # imm = 0x400000 movq %rbx, %rdi xorl %esi, %esi callq memset@PLT movq 8(%rsp), %rdi movl $4194304, %edx # imm = 0x400000 movq %rbx, %rsi movl $1, %ecx callq hipMemcpy movq 8(%rsp), %rsi movl $4194304, %edx # imm = 0x400000 movq %rbx, %rdi movl $2, %ecx callq hipMemcpy xorl %eax, %eax addq $16, %rsp .cfi_def_cfa_offset 16 popq %rbx .cfi_def_cfa_offset 8 retq .Lfunc_end0: .size main, .Lfunc_end0-main .cfi_endproc # -- End function .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 __hip_cuid_
You are a helpful coding assistant specialized in converting CUDA source code to CUDA device assembly.
#include <stdlib.h> #include <stdio.h> #include <time.h> #include <math.h> #define N 20480 // declare the kernel __global__ void daxpy(double a, double *x, double *y) { int i = blockIdx.x * blockDim.x + threadIdx.x; if (i < N) { y[i] += a*x[i]; } } int main(void) { double *x, *y, *d, a, *dx, *dy; double m = -1.; double tmp; int i; size_t size = N*sizeof(double); x = (double *)malloc(size); y = (double *)malloc(size); // initialize x and y srand(time(NULL)); a = (double)random() / RAND_MAX; for (i=0; i<N; i++) x[i] = (double)random() / RAND_MAX; for (i=0; i<N; i++) y[i] = (double)random() / RAND_MAX; // allocate device memory for x and y cudaMalloc((void **) &dx, size); cudaMalloc((void **) &dy, size); // copy host memory to device memory cudaMemcpy(dx, x, size, cudaMemcpyHostToDevice); cudaMemcpy(dy, y, size, cudaMemcpyHostToDevice); // launch the kernel function daxpy<<<N/256,256>>>(a, dx, dy); // copy device memory to host memory d = (double *)malloc(size); cudaMemcpy(d, dy, size, cudaMemcpyDeviceToHost); // verify the results for (i=0; i<N; i++) { y[i] += a * x[i]; tmp = fabs( (d[i]-y[i])/y[i] ); if ( tmp > m ) m = tmp; } // deallocate device memory cudaFree(dx); cudaFree(dy); free(x); free(y); free(d); if ( m < 1E-12 ) { printf("Success!\n"); return 0; } else { printf("Failure!\n"); return 1; } }
code for sm_80 Function : _Z5daxpydPdS_ .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.GT.AND P0, PT, R4, 0x4fff, PT ; /* 0x00004fff0400780c */ /* 0x000fda0003f04270 */ /*0050*/ @P0 EXIT ; /* 0x000000000000094d */ /* 0x000fea0003800000 */ /*0060*/ HFMA2.MMA R5, -RZ, RZ, 0, 4.76837158203125e-07 ; /* 0x00000008ff057435 */ /* 0x000fe200000001ff */ /*0070*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */ /* 0x000fd20000000a00 */ /*0080*/ IMAD.WIDE R2, R4, R5, c[0x0][0x168] ; /* 0x00005a0004027625 */ /* 0x000fc800078e0205 */ /*0090*/ IMAD.WIDE R4, R4, R5, c[0x0][0x170] ; /* 0x00005c0004047625 */ /* 0x000fe400078e0205 */ /*00a0*/ LDG.E.64 R2, [R2.64] ; /* 0x0000000402027981 */ /* 0x000ea8000c1e1b00 */ /*00b0*/ LDG.E.64 R6, [R4.64] ; /* 0x0000000404067981 */ /* 0x000ea4000c1e1b00 */ /*00c0*/ DFMA R6, R2, c[0x0][0x160], R6 ; /* 0x0000580002067a2b */ /* 0x004e0e0000000006 */ /*00d0*/ STG.E.64 [R4.64], R6 ; /* 0x0000000604007986 */ /* 0x001fe2000c101b04 */ /*00e0*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*00f0*/ BRA 0xf0; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*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 <stdlib.h> #include <stdio.h> #include <time.h> #include <math.h> #define N 20480 // declare the kernel __global__ void daxpy(double a, double *x, double *y) { int i = blockIdx.x * blockDim.x + threadIdx.x; if (i < N) { y[i] += a*x[i]; } } int main(void) { double *x, *y, *d, a, *dx, *dy; double m = -1.; double tmp; int i; size_t size = N*sizeof(double); x = (double *)malloc(size); y = (double *)malloc(size); // initialize x and y srand(time(NULL)); a = (double)random() / RAND_MAX; for (i=0; i<N; i++) x[i] = (double)random() / RAND_MAX; for (i=0; i<N; i++) y[i] = (double)random() / RAND_MAX; // allocate device memory for x and y cudaMalloc((void **) &dx, size); cudaMalloc((void **) &dy, size); // copy host memory to device memory cudaMemcpy(dx, x, size, cudaMemcpyHostToDevice); cudaMemcpy(dy, y, size, cudaMemcpyHostToDevice); // launch the kernel function daxpy<<<N/256,256>>>(a, dx, dy); // copy device memory to host memory d = (double *)malloc(size); cudaMemcpy(d, dy, size, cudaMemcpyDeviceToHost); // verify the results for (i=0; i<N; i++) { y[i] += a * x[i]; tmp = fabs( (d[i]-y[i])/y[i] ); if ( tmp > m ) m = tmp; } // deallocate device memory cudaFree(dx); cudaFree(dy); free(x); free(y); free(d); if ( m < 1E-12 ) { printf("Success!\n"); return 0; } else { printf("Failure!\n"); return 1; } }
.file "tmpxft_000f379e_00000000-6_daxpy.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__Z5daxpydPdS_dPdS_ .type _Z27__device_stub__Z5daxpydPdS_dPdS_, @function _Z27__device_stub__Z5daxpydPdS_dPdS_: .LFB2082: .cfi_startproc endbr64 subq $136, %rsp .cfi_def_cfa_offset 144 movsd %xmm0, 24(%rsp) movq %rdi, 16(%rsp) movq %rsi, 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 _Z5daxpydPdS_(%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 _Z27__device_stub__Z5daxpydPdS_dPdS_, .-_Z27__device_stub__Z5daxpydPdS_dPdS_ .globl _Z5daxpydPdS_ .type _Z5daxpydPdS_, @function _Z5daxpydPdS_: .LFB2083: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z27__device_stub__Z5daxpydPdS_dPdS_ addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2083: .size _Z5daxpydPdS_, .-_Z5daxpydPdS_ .section .rodata.str1.1,"aMS",@progbits,1 .LC4: .string "Success!\n" .LC5: .string "Failure!\n" .text .globl main .type main, @function main: .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 %fs:40, %rax movq %rax, 56(%rsp) xorl %eax, %eax movl $163840, %edi call malloc@PLT movq %rax, %rbp movl $163840, %edi call malloc@PLT movq %rax, %rbx movl $0, %edi call time@PLT movl %eax, %edi call srand@PLT call random@PLT pxor %xmm0, %xmm0 cvtsi2sdq %rax, %xmm0 divsd .LC1(%rip), %xmm0 movq %xmm0, %r14 movq %rbp, %r12 leaq 163840(%rbp), %r13 .L12: call random@PLT pxor %xmm0, %xmm0 cvtsi2sdq %rax, %xmm0 divsd .LC1(%rip), %xmm0 movsd %xmm0, (%r12) addq $8, %r12 cmpq %r13, %r12 jne .L12 movq %rbx, %r12 leaq 163840(%rbx), %r13 .L13: call random@PLT pxor %xmm0, %xmm0 cvtsi2sdq %rax, %xmm0 divsd .LC1(%rip), %xmm0 movsd %xmm0, (%r12) addq $8, %r12 cmpq %r12, %r13 jne .L13 leaq 16(%rsp), %rdi movl $163840, %esi call cudaMalloc@PLT leaq 24(%rsp), %rdi movl $163840, %esi call cudaMalloc@PLT movl $1, %ecx movl $163840, %edx movq %rbp, %rsi movq 16(%rsp), %rdi call cudaMemcpy@PLT movl $1, %ecx movl $163840, %edx movq %rbx, %rsi movq 24(%rsp), %rdi call cudaMemcpy@PLT movl $256, 44(%rsp) movl $1, 48(%rsp) movl $80, 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 .L28 .L14: movl $163840, %edi call malloc@PLT movq %rax, %r12 movl $2, %ecx movl $163840, %edx movq 24(%rsp), %rsi movq %rax, %rdi call cudaMemcpy@PLT movl $0, %eax movsd .LC0(%rip), %xmm4 movsd %xmm4, 8(%rsp) movq .LC2(%rip), %xmm2 .L16: movq %r14, %xmm1 mulsd 0(%rbp,%rax), %xmm1 addsd (%rbx,%rax), %xmm1 movsd %xmm1, (%rbx,%rax) movsd (%r12,%rax), %xmm0 subsd %xmm1, %xmm0 divsd %xmm1, %xmm0 andpd %xmm2, %xmm0 maxsd 8(%rsp), %xmm0 movsd %xmm0, 8(%rsp) addq $8, %rax cmpq $163840, %rax jne .L16 movq 16(%rsp), %rdi call cudaFree@PLT movq 24(%rsp), %rdi call cudaFree@PLT movq %rbp, %rdi call free@PLT movq %rbx, %rdi call free@PLT movq %r12, %rdi call free@PLT movsd .LC3(%rip), %xmm0 comisd 8(%rsp), %xmm0 jbe .L26 leaq .LC4(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $0, %eax .L11: movq 56(%rsp), %rdx subq %fs:40, %rdx jne .L29 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 .L28: .cfi_restore_state movq 24(%rsp), %rsi movq 16(%rsp), %rdi movq %r14, %xmm0 call _Z27__device_stub__Z5daxpydPdS_dPdS_ jmp .L14 .L26: leaq .LC5(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %eax jmp .L11 .L29: call __stack_chk_fail@PLT .cfi_endproc .LFE2057: .size main, .-main .section .rodata.str1.1 .LC6: .string "_Z5daxpydPdS_" .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 .LC6(%rip), %rdx movq %rdx, %rcx leaq _Z5daxpydPdS_(%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 .section .rodata.cst8,"aM",@progbits,8 .align 8 .LC0: .long 0 .long -1074790400 .align 8 .LC1: .long -4194304 .long 1105199103 .section .rodata.cst16,"aM",@progbits,16 .align 16 .LC2: .long -1 .long 2147483647 .long 0 .long 0 .section .rodata.cst8 .align 8 .LC3: .long -2127697391 .long 1030854553 .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> #include <time.h> #include <math.h> #define N 20480 // declare the kernel __global__ void daxpy(double a, double *x, double *y) { int i = blockIdx.x * blockDim.x + threadIdx.x; if (i < N) { y[i] += a*x[i]; } } int main(void) { double *x, *y, *d, a, *dx, *dy; double m = -1.; double tmp; int i; size_t size = N*sizeof(double); x = (double *)malloc(size); y = (double *)malloc(size); // initialize x and y srand(time(NULL)); a = (double)random() / RAND_MAX; for (i=0; i<N; i++) x[i] = (double)random() / RAND_MAX; for (i=0; i<N; i++) y[i] = (double)random() / RAND_MAX; // allocate device memory for x and y cudaMalloc((void **) &dx, size); cudaMalloc((void **) &dy, size); // copy host memory to device memory cudaMemcpy(dx, x, size, cudaMemcpyHostToDevice); cudaMemcpy(dy, y, size, cudaMemcpyHostToDevice); // launch the kernel function daxpy<<<N/256,256>>>(a, dx, dy); // copy device memory to host memory d = (double *)malloc(size); cudaMemcpy(d, dy, size, cudaMemcpyDeviceToHost); // verify the results for (i=0; i<N; i++) { y[i] += a * x[i]; tmp = fabs( (d[i]-y[i])/y[i] ); if ( tmp > m ) m = tmp; } // deallocate device memory cudaFree(dx); cudaFree(dy); free(x); free(y); free(d); if ( m < 1E-12 ) { printf("Success!\n"); return 0; } else { printf("Failure!\n"); return 1; } }
#include <hip/hip_runtime.h> #include <stdlib.h> #include <stdio.h> #include <time.h> #include <math.h> #define N 20480 // declare the kernel __global__ void daxpy(double a, double *x, double *y) { int i = blockIdx.x * blockDim.x + threadIdx.x; if (i < N) { y[i] += a*x[i]; } } int main(void) { double *x, *y, *d, a, *dx, *dy; double m = -1.; double tmp; int i; size_t size = N*sizeof(double); x = (double *)malloc(size); y = (double *)malloc(size); // initialize x and y srand(time(NULL)); a = (double)random() / RAND_MAX; for (i=0; i<N; i++) x[i] = (double)random() / RAND_MAX; for (i=0; i<N; i++) y[i] = (double)random() / RAND_MAX; // allocate device memory for x and y hipMalloc((void **) &dx, size); hipMalloc((void **) &dy, size); // copy host memory to device memory hipMemcpy(dx, x, size, hipMemcpyHostToDevice); hipMemcpy(dy, y, size, hipMemcpyHostToDevice); // launch the kernel function daxpy<<<N/256,256>>>(a, dx, dy); // copy device memory to host memory d = (double *)malloc(size); hipMemcpy(d, dy, size, hipMemcpyDeviceToHost); // verify the results for (i=0; i<N; i++) { y[i] += a * x[i]; tmp = fabs( (d[i]-y[i])/y[i] ); if ( tmp > m ) m = tmp; } // deallocate device memory hipFree(dx); hipFree(dy); free(x); free(y); free(d); if ( m < 1E-12 ) { printf("Success!\n"); return 0; } else { printf("Failure!\n"); return 1; } }
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> #include <time.h> #include <math.h> #define N 20480 // declare the kernel __global__ void daxpy(double a, double *x, double *y) { int i = blockIdx.x * blockDim.x + threadIdx.x; if (i < N) { y[i] += a*x[i]; } } int main(void) { double *x, *y, *d, a, *dx, *dy; double m = -1.; double tmp; int i; size_t size = N*sizeof(double); x = (double *)malloc(size); y = (double *)malloc(size); // initialize x and y srand(time(NULL)); a = (double)random() / RAND_MAX; for (i=0; i<N; i++) x[i] = (double)random() / RAND_MAX; for (i=0; i<N; i++) y[i] = (double)random() / RAND_MAX; // allocate device memory for x and y hipMalloc((void **) &dx, size); hipMalloc((void **) &dy, size); // copy host memory to device memory hipMemcpy(dx, x, size, hipMemcpyHostToDevice); hipMemcpy(dy, y, size, hipMemcpyHostToDevice); // launch the kernel function daxpy<<<N/256,256>>>(a, dx, dy); // copy device memory to host memory d = (double *)malloc(size); hipMemcpy(d, dy, size, hipMemcpyDeviceToHost); // verify the results for (i=0; i<N; i++) { y[i] += a * x[i]; tmp = fabs( (d[i]-y[i])/y[i] ); if ( tmp > m ) m = tmp; } // deallocate device memory hipFree(dx); hipFree(dy); free(x); free(y); free(d); if ( m < 1E-12 ) { printf("Success!\n"); return 0; } else { printf("Failure!\n"); return 1; } }
.text .amdgcn_target "amdgcn-amd-amdhsa--gfx1100" .protected _Z5daxpydPdS_ .globl _Z5daxpydPdS_ .p2align 8 .type _Z5daxpydPdS_,@function _Z5daxpydPdS_: 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 0x5000, v1 s_cbranch_execz .LBB0_2 s_clause 0x1 s_load_b128 s[4:7], s[0:1], 0x0 s_load_b64 s[0:1], s[0:1], 0x10 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], 3, v[1:2] s_waitcnt lgkmcnt(0) v_add_co_u32 v2, vcc_lo, s6, v0 s_delay_alu instid0(VALU_DEP_2) v_add_co_ci_u32_e32 v3, vcc_lo, s7, v1, vcc_lo v_add_co_u32 v0, vcc_lo, s0, v0 v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo global_load_b64 v[2:3], v[2:3], off global_load_b64 v[4:5], v[0:1], off s_waitcnt vmcnt(0) v_fma_f64 v[2:3], v[2:3], s[4:5], v[4:5] global_store_b64 v[0:1], v[2:3], off .LBB0_2: s_nop 0 s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z5daxpydPdS_ .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 _Z5daxpydPdS_, .Lfunc_end0-_Z5daxpydPdS_ .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: 8 .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: _Z5daxpydPdS_ .private_segment_fixed_size: 0 .sgpr_count: 18 .sgpr_spill_count: 0 .symbol: _Z5daxpydPdS_.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 <stdlib.h> #include <stdio.h> #include <time.h> #include <math.h> #define N 20480 // declare the kernel __global__ void daxpy(double a, double *x, double *y) { int i = blockIdx.x * blockDim.x + threadIdx.x; if (i < N) { y[i] += a*x[i]; } } int main(void) { double *x, *y, *d, a, *dx, *dy; double m = -1.; double tmp; int i; size_t size = N*sizeof(double); x = (double *)malloc(size); y = (double *)malloc(size); // initialize x and y srand(time(NULL)); a = (double)random() / RAND_MAX; for (i=0; i<N; i++) x[i] = (double)random() / RAND_MAX; for (i=0; i<N; i++) y[i] = (double)random() / RAND_MAX; // allocate device memory for x and y hipMalloc((void **) &dx, size); hipMalloc((void **) &dy, size); // copy host memory to device memory hipMemcpy(dx, x, size, hipMemcpyHostToDevice); hipMemcpy(dy, y, size, hipMemcpyHostToDevice); // launch the kernel function daxpy<<<N/256,256>>>(a, dx, dy); // copy device memory to host memory d = (double *)malloc(size); hipMemcpy(d, dy, size, hipMemcpyDeviceToHost); // verify the results for (i=0; i<N; i++) { y[i] += a * x[i]; tmp = fabs( (d[i]-y[i])/y[i] ); if ( tmp > m ) m = tmp; } // deallocate device memory hipFree(dx); hipFree(dy); free(x); free(y); free(d); if ( m < 1E-12 ) { printf("Success!\n"); return 0; } else { printf("Failure!\n"); return 1; } }
.text .file "daxpy.hip" .globl _Z20__device_stub__daxpydPdS_ # -- Begin function _Z20__device_stub__daxpydPdS_ .p2align 4, 0x90 .type _Z20__device_stub__daxpydPdS_,@function _Z20__device_stub__daxpydPdS_: # @_Z20__device_stub__daxpydPdS_ .cfi_startproc # %bb.0: subq $104, %rsp .cfi_def_cfa_offset 112 movsd %xmm0, 72(%rsp) movq %rdi, 64(%rsp) movq %rsi, 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 $_Z5daxpydPdS_, %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 _Z20__device_stub__daxpydPdS_, .Lfunc_end0-_Z20__device_stub__daxpydPdS_ .cfi_endproc # -- End function .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 # -- Begin function main .LCPI1_0: .quad 0x41dfffffffc00000 # double 2147483647 .LCPI1_1: .quad 0xbff0000000000000 # double -1 .LCPI1_3: .quad 0x3d719799812dea11 # double 9.9999999999999998E-13 .section .rodata.cst16,"aM",@progbits,16 .p2align 4, 0x0 .LCPI1_2: .quad 0x7fffffffffffffff # double NaN .quad 0x7fffffffffffffff # double NaN .text .globl 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 $144, %rsp .cfi_def_cfa_offset 176 .cfi_offset %rbx, -32 .cfi_offset %r14, -24 .cfi_offset %r15, -16 movl $163840, %edi # imm = 0x28000 callq malloc movq %rax, %rbx movl $163840, %edi # imm = 0x28000 callq malloc movq %rax, %r14 xorl %r15d, %r15d xorl %edi, %edi callq time movl %eax, %edi callq srand callq random cvtsi2sd %rax, %xmm0 movsd %xmm0, 16(%rsp) # 8-byte Spill .p2align 4, 0x90 .LBB1_1: # =>This Inner Loop Header: Depth=1 callq random movsd .LCPI1_0(%rip), %xmm1 # xmm1 = mem[0],zero xorps %xmm0, %xmm0 cvtsi2sd %rax, %xmm0 divsd %xmm1, %xmm0 movsd %xmm0, (%rbx,%r15,8) incq %r15 cmpq $20480, %r15 # imm = 0x5000 jne .LBB1_1 # %bb.2: # %.preheader.preheader xorl %r15d, %r15d .p2align 4, 0x90 .LBB1_3: # %.preheader # =>This Inner Loop Header: Depth=1 callq random xorps %xmm0, %xmm0 cvtsi2sd %rax, %xmm0 divsd .LCPI1_0(%rip), %xmm0 movsd %xmm0, (%r14,%r15,8) incq %r15 cmpq $20480, %r15 # imm = 0x5000 jne .LBB1_3 # %bb.4: movsd 16(%rsp), %xmm0 # 8-byte Reload # xmm0 = mem[0],zero divsd .LCPI1_0(%rip), %xmm0 movsd %xmm0, 16(%rsp) # 8-byte Spill leaq 8(%rsp), %rdi movl $163840, %esi # imm = 0x28000 callq hipMalloc movq %rsp, %rdi movl $163840, %esi # imm = 0x28000 callq hipMalloc movq 8(%rsp), %rdi movl $163840, %edx # imm = 0x28000 movq %rbx, %rsi movl $1, %ecx callq hipMemcpy movq (%rsp), %rdi movl $163840, %edx # imm = 0x28000 movq %r14, %rsi movl $1, %ecx callq hipMemcpy movabsq $4294967376, %rdi # imm = 0x100000050 leaq 176(%rdi), %rdx movl $1, %esi movl $1, %ecx xorl %r8d, %r8d xorl %r9d, %r9d callq __hipPushCallConfiguration testl %eax, %eax jne .LBB1_6 # %bb.5: movq 8(%rsp), %rax movq (%rsp), %rcx movsd 16(%rsp), %xmm0 # 8-byte Reload # xmm0 = mem[0],zero movsd %xmm0, 104(%rsp) movq %rax, 96(%rsp) movq %rcx, 88(%rsp) leaq 104(%rsp), %rax movq %rax, 112(%rsp) leaq 96(%rsp), %rax movq %rax, 120(%rsp) leaq 88(%rsp), %rax movq %rax, 128(%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 $_Z5daxpydPdS_, %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_6: movl $163840, %edi # imm = 0x28000 callq malloc movq %rax, %r15 movq (%rsp), %rsi movl $163840, %edx # imm = 0x28000 movq %rax, %rdi movl $2, %ecx callq hipMemcpy movsd .LCPI1_1(%rip), %xmm4 # xmm4 = mem[0],zero xorl %eax, %eax movapd .LCPI1_2(%rip), %xmm0 # xmm0 = [NaN,NaN] movsd 16(%rsp), %xmm3 # 8-byte Reload # xmm3 = mem[0],zero .p2align 4, 0x90 .LBB1_7: # =>This Inner Loop Header: Depth=1 movapd %xmm4, %xmm1 movsd (%rbx,%rax,8), %xmm2 # xmm2 = mem[0],zero mulsd %xmm3, %xmm2 addsd (%r14,%rax,8), %xmm2 movsd %xmm2, (%r14,%rax,8) movsd (%r15,%rax,8), %xmm4 # xmm4 = mem[0],zero subsd %xmm2, %xmm4 divsd %xmm2, %xmm4 andpd %xmm0, %xmm4 maxsd %xmm1, %xmm4 incq %rax cmpq $20480, %rax # imm = 0x5000 jne .LBB1_7 # %bb.8: movq 8(%rsp), %rdi movapd %xmm4, 16(%rsp) # 16-byte Spill callq hipFree movq (%rsp), %rdi callq hipFree movq %rbx, %rdi callq free movq %r14, %rdi callq free movq %r15, %rdi callq free movsd .LCPI1_3(%rip), %xmm0 # xmm0 = mem[0],zero xorl %ebx, %ebx ucomisd 16(%rsp), %xmm0 # 16-byte Folded Reload setbe %bl movl $.Lstr, %eax movl $.Lstr.1, %edi cmovbeq %rax, %rdi callq puts@PLT movl %ebx, %eax addq $144, %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 $_Z5daxpydPdS_, %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 _Z5daxpydPdS_,@object # @_Z5daxpydPdS_ .section .rodata,"a",@progbits .globl _Z5daxpydPdS_ .p2align 3, 0x0 _Z5daxpydPdS_: .quad _Z20__device_stub__daxpydPdS_ .size _Z5daxpydPdS_, 8 .type .L__unnamed_1,@object # @0 .section .rodata.str1.1,"aMS",@progbits,1 .L__unnamed_1: .asciz "_Z5daxpydPdS_" .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 "Failure!" .size .Lstr, 9 .type .Lstr.1,@object # @str.1 .Lstr.1: .asciz "Success!" .size .Lstr.1, 9 .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 _Z20__device_stub__daxpydPdS_ .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z5daxpydPdS_ .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 : _Z5daxpydPdS_ .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.GT.AND P0, PT, R4, 0x4fff, PT ; /* 0x00004fff0400780c */ /* 0x000fda0003f04270 */ /*0050*/ @P0 EXIT ; /* 0x000000000000094d */ /* 0x000fea0003800000 */ /*0060*/ HFMA2.MMA R5, -RZ, RZ, 0, 4.76837158203125e-07 ; /* 0x00000008ff057435 */ /* 0x000fe200000001ff */ /*0070*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */ /* 0x000fd20000000a00 */ /*0080*/ IMAD.WIDE R2, R4, R5, c[0x0][0x168] ; /* 0x00005a0004027625 */ /* 0x000fc800078e0205 */ /*0090*/ IMAD.WIDE R4, R4, R5, c[0x0][0x170] ; /* 0x00005c0004047625 */ /* 0x000fe400078e0205 */ /*00a0*/ LDG.E.64 R2, [R2.64] ; /* 0x0000000402027981 */ /* 0x000ea8000c1e1b00 */ /*00b0*/ LDG.E.64 R6, [R4.64] ; /* 0x0000000404067981 */ /* 0x000ea4000c1e1b00 */ /*00c0*/ DFMA R6, R2, c[0x0][0x160], R6 ; /* 0x0000580002067a2b */ /* 0x004e0e0000000006 */ /*00d0*/ STG.E.64 [R4.64], R6 ; /* 0x0000000604007986 */ /* 0x001fe2000c101b04 */ /*00e0*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*00f0*/ BRA 0xf0; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*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 _Z5daxpydPdS_ .globl _Z5daxpydPdS_ .p2align 8 .type _Z5daxpydPdS_,@function _Z5daxpydPdS_: 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 0x5000, v1 s_cbranch_execz .LBB0_2 s_clause 0x1 s_load_b128 s[4:7], s[0:1], 0x0 s_load_b64 s[0:1], s[0:1], 0x10 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], 3, v[1:2] s_waitcnt lgkmcnt(0) v_add_co_u32 v2, vcc_lo, s6, v0 s_delay_alu instid0(VALU_DEP_2) v_add_co_ci_u32_e32 v3, vcc_lo, s7, v1, vcc_lo v_add_co_u32 v0, vcc_lo, s0, v0 v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo global_load_b64 v[2:3], v[2:3], off global_load_b64 v[4:5], v[0:1], off s_waitcnt vmcnt(0) v_fma_f64 v[2:3], v[2:3], s[4:5], v[4:5] global_store_b64 v[0:1], v[2:3], off .LBB0_2: s_nop 0 s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z5daxpydPdS_ .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 _Z5daxpydPdS_, .Lfunc_end0-_Z5daxpydPdS_ .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: 8 .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: _Z5daxpydPdS_ .private_segment_fixed_size: 0 .sgpr_count: 18 .sgpr_spill_count: 0 .symbol: _Z5daxpydPdS_.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_000f379e_00000000-6_daxpy.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__Z5daxpydPdS_dPdS_ .type _Z27__device_stub__Z5daxpydPdS_dPdS_, @function _Z27__device_stub__Z5daxpydPdS_dPdS_: .LFB2082: .cfi_startproc endbr64 subq $136, %rsp .cfi_def_cfa_offset 144 movsd %xmm0, 24(%rsp) movq %rdi, 16(%rsp) movq %rsi, 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 _Z5daxpydPdS_(%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 _Z27__device_stub__Z5daxpydPdS_dPdS_, .-_Z27__device_stub__Z5daxpydPdS_dPdS_ .globl _Z5daxpydPdS_ .type _Z5daxpydPdS_, @function _Z5daxpydPdS_: .LFB2083: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z27__device_stub__Z5daxpydPdS_dPdS_ addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2083: .size _Z5daxpydPdS_, .-_Z5daxpydPdS_ .section .rodata.str1.1,"aMS",@progbits,1 .LC4: .string "Success!\n" .LC5: .string "Failure!\n" .text .globl main .type main, @function main: .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 %fs:40, %rax movq %rax, 56(%rsp) xorl %eax, %eax movl $163840, %edi call malloc@PLT movq %rax, %rbp movl $163840, %edi call malloc@PLT movq %rax, %rbx movl $0, %edi call time@PLT movl %eax, %edi call srand@PLT call random@PLT pxor %xmm0, %xmm0 cvtsi2sdq %rax, %xmm0 divsd .LC1(%rip), %xmm0 movq %xmm0, %r14 movq %rbp, %r12 leaq 163840(%rbp), %r13 .L12: call random@PLT pxor %xmm0, %xmm0 cvtsi2sdq %rax, %xmm0 divsd .LC1(%rip), %xmm0 movsd %xmm0, (%r12) addq $8, %r12 cmpq %r13, %r12 jne .L12 movq %rbx, %r12 leaq 163840(%rbx), %r13 .L13: call random@PLT pxor %xmm0, %xmm0 cvtsi2sdq %rax, %xmm0 divsd .LC1(%rip), %xmm0 movsd %xmm0, (%r12) addq $8, %r12 cmpq %r12, %r13 jne .L13 leaq 16(%rsp), %rdi movl $163840, %esi call cudaMalloc@PLT leaq 24(%rsp), %rdi movl $163840, %esi call cudaMalloc@PLT movl $1, %ecx movl $163840, %edx movq %rbp, %rsi movq 16(%rsp), %rdi call cudaMemcpy@PLT movl $1, %ecx movl $163840, %edx movq %rbx, %rsi movq 24(%rsp), %rdi call cudaMemcpy@PLT movl $256, 44(%rsp) movl $1, 48(%rsp) movl $80, 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 .L28 .L14: movl $163840, %edi call malloc@PLT movq %rax, %r12 movl $2, %ecx movl $163840, %edx movq 24(%rsp), %rsi movq %rax, %rdi call cudaMemcpy@PLT movl $0, %eax movsd .LC0(%rip), %xmm4 movsd %xmm4, 8(%rsp) movq .LC2(%rip), %xmm2 .L16: movq %r14, %xmm1 mulsd 0(%rbp,%rax), %xmm1 addsd (%rbx,%rax), %xmm1 movsd %xmm1, (%rbx,%rax) movsd (%r12,%rax), %xmm0 subsd %xmm1, %xmm0 divsd %xmm1, %xmm0 andpd %xmm2, %xmm0 maxsd 8(%rsp), %xmm0 movsd %xmm0, 8(%rsp) addq $8, %rax cmpq $163840, %rax jne .L16 movq 16(%rsp), %rdi call cudaFree@PLT movq 24(%rsp), %rdi call cudaFree@PLT movq %rbp, %rdi call free@PLT movq %rbx, %rdi call free@PLT movq %r12, %rdi call free@PLT movsd .LC3(%rip), %xmm0 comisd 8(%rsp), %xmm0 jbe .L26 leaq .LC4(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $0, %eax .L11: movq 56(%rsp), %rdx subq %fs:40, %rdx jne .L29 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 .L28: .cfi_restore_state movq 24(%rsp), %rsi movq 16(%rsp), %rdi movq %r14, %xmm0 call _Z27__device_stub__Z5daxpydPdS_dPdS_ jmp .L14 .L26: leaq .LC5(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %eax jmp .L11 .L29: call __stack_chk_fail@PLT .cfi_endproc .LFE2057: .size main, .-main .section .rodata.str1.1 .LC6: .string "_Z5daxpydPdS_" .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 .LC6(%rip), %rdx movq %rdx, %rcx leaq _Z5daxpydPdS_(%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 .section .rodata.cst8,"aM",@progbits,8 .align 8 .LC0: .long 0 .long -1074790400 .align 8 .LC1: .long -4194304 .long 1105199103 .section .rodata.cst16,"aM",@progbits,16 .align 16 .LC2: .long -1 .long 2147483647 .long 0 .long 0 .section .rodata.cst8 .align 8 .LC3: .long -2127697391 .long 1030854553 .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 "daxpy.hip" .globl _Z20__device_stub__daxpydPdS_ # -- Begin function _Z20__device_stub__daxpydPdS_ .p2align 4, 0x90 .type _Z20__device_stub__daxpydPdS_,@function _Z20__device_stub__daxpydPdS_: # @_Z20__device_stub__daxpydPdS_ .cfi_startproc # %bb.0: subq $104, %rsp .cfi_def_cfa_offset 112 movsd %xmm0, 72(%rsp) movq %rdi, 64(%rsp) movq %rsi, 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 $_Z5daxpydPdS_, %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 _Z20__device_stub__daxpydPdS_, .Lfunc_end0-_Z20__device_stub__daxpydPdS_ .cfi_endproc # -- End function .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 # -- Begin function main .LCPI1_0: .quad 0x41dfffffffc00000 # double 2147483647 .LCPI1_1: .quad 0xbff0000000000000 # double -1 .LCPI1_3: .quad 0x3d719799812dea11 # double 9.9999999999999998E-13 .section .rodata.cst16,"aM",@progbits,16 .p2align 4, 0x0 .LCPI1_2: .quad 0x7fffffffffffffff # double NaN .quad 0x7fffffffffffffff # double NaN .text .globl 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 $144, %rsp .cfi_def_cfa_offset 176 .cfi_offset %rbx, -32 .cfi_offset %r14, -24 .cfi_offset %r15, -16 movl $163840, %edi # imm = 0x28000 callq malloc movq %rax, %rbx movl $163840, %edi # imm = 0x28000 callq malloc movq %rax, %r14 xorl %r15d, %r15d xorl %edi, %edi callq time movl %eax, %edi callq srand callq random cvtsi2sd %rax, %xmm0 movsd %xmm0, 16(%rsp) # 8-byte Spill .p2align 4, 0x90 .LBB1_1: # =>This Inner Loop Header: Depth=1 callq random movsd .LCPI1_0(%rip), %xmm1 # xmm1 = mem[0],zero xorps %xmm0, %xmm0 cvtsi2sd %rax, %xmm0 divsd %xmm1, %xmm0 movsd %xmm0, (%rbx,%r15,8) incq %r15 cmpq $20480, %r15 # imm = 0x5000 jne .LBB1_1 # %bb.2: # %.preheader.preheader xorl %r15d, %r15d .p2align 4, 0x90 .LBB1_3: # %.preheader # =>This Inner Loop Header: Depth=1 callq random xorps %xmm0, %xmm0 cvtsi2sd %rax, %xmm0 divsd .LCPI1_0(%rip), %xmm0 movsd %xmm0, (%r14,%r15,8) incq %r15 cmpq $20480, %r15 # imm = 0x5000 jne .LBB1_3 # %bb.4: movsd 16(%rsp), %xmm0 # 8-byte Reload # xmm0 = mem[0],zero divsd .LCPI1_0(%rip), %xmm0 movsd %xmm0, 16(%rsp) # 8-byte Spill leaq 8(%rsp), %rdi movl $163840, %esi # imm = 0x28000 callq hipMalloc movq %rsp, %rdi movl $163840, %esi # imm = 0x28000 callq hipMalloc movq 8(%rsp), %rdi movl $163840, %edx # imm = 0x28000 movq %rbx, %rsi movl $1, %ecx callq hipMemcpy movq (%rsp), %rdi movl $163840, %edx # imm = 0x28000 movq %r14, %rsi movl $1, %ecx callq hipMemcpy movabsq $4294967376, %rdi # imm = 0x100000050 leaq 176(%rdi), %rdx movl $1, %esi movl $1, %ecx xorl %r8d, %r8d xorl %r9d, %r9d callq __hipPushCallConfiguration testl %eax, %eax jne .LBB1_6 # %bb.5: movq 8(%rsp), %rax movq (%rsp), %rcx movsd 16(%rsp), %xmm0 # 8-byte Reload # xmm0 = mem[0],zero movsd %xmm0, 104(%rsp) movq %rax, 96(%rsp) movq %rcx, 88(%rsp) leaq 104(%rsp), %rax movq %rax, 112(%rsp) leaq 96(%rsp), %rax movq %rax, 120(%rsp) leaq 88(%rsp), %rax movq %rax, 128(%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 $_Z5daxpydPdS_, %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_6: movl $163840, %edi # imm = 0x28000 callq malloc movq %rax, %r15 movq (%rsp), %rsi movl $163840, %edx # imm = 0x28000 movq %rax, %rdi movl $2, %ecx callq hipMemcpy movsd .LCPI1_1(%rip), %xmm4 # xmm4 = mem[0],zero xorl %eax, %eax movapd .LCPI1_2(%rip), %xmm0 # xmm0 = [NaN,NaN] movsd 16(%rsp), %xmm3 # 8-byte Reload # xmm3 = mem[0],zero .p2align 4, 0x90 .LBB1_7: # =>This Inner Loop Header: Depth=1 movapd %xmm4, %xmm1 movsd (%rbx,%rax,8), %xmm2 # xmm2 = mem[0],zero mulsd %xmm3, %xmm2 addsd (%r14,%rax,8), %xmm2 movsd %xmm2, (%r14,%rax,8) movsd (%r15,%rax,8), %xmm4 # xmm4 = mem[0],zero subsd %xmm2, %xmm4 divsd %xmm2, %xmm4 andpd %xmm0, %xmm4 maxsd %xmm1, %xmm4 incq %rax cmpq $20480, %rax # imm = 0x5000 jne .LBB1_7 # %bb.8: movq 8(%rsp), %rdi movapd %xmm4, 16(%rsp) # 16-byte Spill callq hipFree movq (%rsp), %rdi callq hipFree movq %rbx, %rdi callq free movq %r14, %rdi callq free movq %r15, %rdi callq free movsd .LCPI1_3(%rip), %xmm0 # xmm0 = mem[0],zero xorl %ebx, %ebx ucomisd 16(%rsp), %xmm0 # 16-byte Folded Reload setbe %bl movl $.Lstr, %eax movl $.Lstr.1, %edi cmovbeq %rax, %rdi callq puts@PLT movl %ebx, %eax addq $144, %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 $_Z5daxpydPdS_, %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 _Z5daxpydPdS_,@object # @_Z5daxpydPdS_ .section .rodata,"a",@progbits .globl _Z5daxpydPdS_ .p2align 3, 0x0 _Z5daxpydPdS_: .quad _Z20__device_stub__daxpydPdS_ .size _Z5daxpydPdS_, 8 .type .L__unnamed_1,@object # @0 .section .rodata.str1.1,"aMS",@progbits,1 .L__unnamed_1: .asciz "_Z5daxpydPdS_" .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 "Failure!" .size .Lstr, 9 .type .Lstr.1,@object # @str.1 .Lstr.1: .asciz "Success!" .size .Lstr.1, 9 .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 _Z20__device_stub__daxpydPdS_ .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z5daxpydPdS_ .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.
#define TILE_DIM 32 template<typename T, typename R> __device__ void common_std(const T* matrix, R* result, const int numRows, const int numColumns) { __shared__ R sumTile[TILE_DIM][TILE_DIM]; __shared__ R squareSumTile[TILE_DIM][TILE_DIM]; int tx = threadIdx.x; int ty = threadIdx.y; sumTile[ty][tx] = 0; squareSumTile[ty][tx] = 0; #pragma unroll for (int tr = 0; tr < (numRows - 1) / TILE_DIM + 1; tr++) { for (int tc = 0; tc < (numColumns - 1) / TILE_DIM + 1; tc++) { int r = tr * TILE_DIM + ty; int c = tc * TILE_DIM + tx; if (r < numRows && c < numColumns) { T value = matrix[r * numColumns + c]; sumTile[ty][tx] += value; squareSumTile[ty][tx] += value * value; } __syncthreads(); } } if (tx == 0 && ty == 0) { R sum = 0; R squareSum = 0; #pragma unroll for (int i = 0; i < TILE_DIM; i++) { #pragma unroll for (int j = 0; j < TILE_DIM; j++) { sum += sumTile[i][j]; squareSum += squareSumTile[i][j]; } } int length = numRows * numColumns; result[0] = sqrt((squareSum - (sum * sum) / length) / length); } } template<typename T> __device__ void math_std(const T* matrix, float* result, const int numRows, const int numColumns) { common_std<T, float>(matrix, result, numRows, numColumns); } template<typename T> __device__ void math_stdd(const T* matrix, double* result, const int numRows, const int numColumns) { common_std<T, double>(matrix, result, numRows, numColumns); } template<typename T, typename R> __device__ void common_rowsStd(const T* matrix, R* result, const int numRows, const int numColumns) { __shared__ T tile[TILE_DIM][TILE_DIM]; int by = blockIdx.y; int ty = threadIdx.y; int row = by * blockDim.y + ty; R sum = 0; R squareSum = 0; #pragma unroll for (int t = 0; t < (numColumns - 1) / TILE_DIM + 1; t++) { #pragma unroll for (int i = 0; i < TILE_DIM; i++) { int r = by * TILE_DIM + i; int c = t * TILE_DIM + ty; if (r < numRows && c < numColumns) { tile[i][ty] = matrix[r * numColumns + c]; } else { tile[i][ty] = 0; } } __syncthreads(); #pragma unroll for (int j = 0; j < TILE_DIM; j++) { T value = tile[ty][j]; sum += value; squareSum += value * value; } __syncthreads(); } if (row < numRows) { result[row] = sqrt((squareSum - (sum * sum) / numColumns) / numColumns); } } template<typename T> __device__ void rowsStd(const T* matrix, float* result, const int numRows, const int numColumns) { common_rowsStd<T, float>(matrix, result, numRows, numColumns); } template<typename T> __device__ void rowsStdd(const T* matrix, double* result, const int numRows, const int numColumns) { common_rowsStd<T, double>(matrix, result, numRows, numColumns); } template<typename T, typename R> __device__ void common_columnsStd(const T* matrix, R* result, const int numRows, const int numColumns) { int bx = blockIdx.x; int tx = threadIdx.x; int col = bx * blockDim.x + tx; if (col < numColumns) { R sum = 0; R squareSum = 0; #pragma unroll for (int i = 0; i < numRows; i++) { int index = i * numColumns + col; T value = matrix[index]; sum += value; squareSum += value * value; } result[col] = sqrt((squareSum - (sum * sum) / numRows) / numRows); } } template<typename T> __device__ void columnsStd(const T* matrix, float* result, const int numRows, const int numColumns) { common_columnsStd<T, float>(matrix, result, numRows, numColumns); } template<typename T> __device__ void columnsStdd(const T* matrix, double* result, const int numRows, const int numColumns) { common_columnsStd<T, double>(matrix, result, numRows, numColumns); }
code for sm_80
You are a helpful coding assistant specialized in converting CUDA source code to CUDA host assembly.
#define TILE_DIM 32 template<typename T, typename R> __device__ void common_std(const T* matrix, R* result, const int numRows, const int numColumns) { __shared__ R sumTile[TILE_DIM][TILE_DIM]; __shared__ R squareSumTile[TILE_DIM][TILE_DIM]; int tx = threadIdx.x; int ty = threadIdx.y; sumTile[ty][tx] = 0; squareSumTile[ty][tx] = 0; #pragma unroll for (int tr = 0; tr < (numRows - 1) / TILE_DIM + 1; tr++) { for (int tc = 0; tc < (numColumns - 1) / TILE_DIM + 1; tc++) { int r = tr * TILE_DIM + ty; int c = tc * TILE_DIM + tx; if (r < numRows && c < numColumns) { T value = matrix[r * numColumns + c]; sumTile[ty][tx] += value; squareSumTile[ty][tx] += value * value; } __syncthreads(); } } if (tx == 0 && ty == 0) { R sum = 0; R squareSum = 0; #pragma unroll for (int i = 0; i < TILE_DIM; i++) { #pragma unroll for (int j = 0; j < TILE_DIM; j++) { sum += sumTile[i][j]; squareSum += squareSumTile[i][j]; } } int length = numRows * numColumns; result[0] = sqrt((squareSum - (sum * sum) / length) / length); } } template<typename T> __device__ void math_std(const T* matrix, float* result, const int numRows, const int numColumns) { common_std<T, float>(matrix, result, numRows, numColumns); } template<typename T> __device__ void math_stdd(const T* matrix, double* result, const int numRows, const int numColumns) { common_std<T, double>(matrix, result, numRows, numColumns); } template<typename T, typename R> __device__ void common_rowsStd(const T* matrix, R* result, const int numRows, const int numColumns) { __shared__ T tile[TILE_DIM][TILE_DIM]; int by = blockIdx.y; int ty = threadIdx.y; int row = by * blockDim.y + ty; R sum = 0; R squareSum = 0; #pragma unroll for (int t = 0; t < (numColumns - 1) / TILE_DIM + 1; t++) { #pragma unroll for (int i = 0; i < TILE_DIM; i++) { int r = by * TILE_DIM + i; int c = t * TILE_DIM + ty; if (r < numRows && c < numColumns) { tile[i][ty] = matrix[r * numColumns + c]; } else { tile[i][ty] = 0; } } __syncthreads(); #pragma unroll for (int j = 0; j < TILE_DIM; j++) { T value = tile[ty][j]; sum += value; squareSum += value * value; } __syncthreads(); } if (row < numRows) { result[row] = sqrt((squareSum - (sum * sum) / numColumns) / numColumns); } } template<typename T> __device__ void rowsStd(const T* matrix, float* result, const int numRows, const int numColumns) { common_rowsStd<T, float>(matrix, result, numRows, numColumns); } template<typename T> __device__ void rowsStdd(const T* matrix, double* result, const int numRows, const int numColumns) { common_rowsStd<T, double>(matrix, result, numRows, numColumns); } template<typename T, typename R> __device__ void common_columnsStd(const T* matrix, R* result, const int numRows, const int numColumns) { int bx = blockIdx.x; int tx = threadIdx.x; int col = bx * blockDim.x + tx; if (col < numColumns) { R sum = 0; R squareSum = 0; #pragma unroll for (int i = 0; i < numRows; i++) { int index = i * numColumns + col; T value = matrix[index]; sum += value; squareSum += value * value; } result[col] = sqrt((squareSum - (sum * sum) / numRows) / numRows); } } template<typename T> __device__ void columnsStd(const T* matrix, float* result, const int numRows, const int numColumns) { common_columnsStd<T, float>(matrix, result, numRows, numColumns); } template<typename T> __device__ void columnsStdd(const T* matrix, double* result, const int numRows, const int numColumns) { common_columnsStd<T, double>(matrix, result, numRows, numColumns); }
.file "tmpxft_000dde94_00000000-6_Std.cudafe1.cpp" .text #APP #NO_APP .type _ZL26__cudaUnregisterBinaryUtilv, @function _ZL26__cudaUnregisterBinaryUtilv: .LFB2038: .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 .LFE2038: .size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB2061: .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 .LFE2061: .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.
#define TILE_DIM 32 template<typename T, typename R> __device__ void common_std(const T* matrix, R* result, const int numRows, const int numColumns) { __shared__ R sumTile[TILE_DIM][TILE_DIM]; __shared__ R squareSumTile[TILE_DIM][TILE_DIM]; int tx = threadIdx.x; int ty = threadIdx.y; sumTile[ty][tx] = 0; squareSumTile[ty][tx] = 0; #pragma unroll for (int tr = 0; tr < (numRows - 1) / TILE_DIM + 1; tr++) { for (int tc = 0; tc < (numColumns - 1) / TILE_DIM + 1; tc++) { int r = tr * TILE_DIM + ty; int c = tc * TILE_DIM + tx; if (r < numRows && c < numColumns) { T value = matrix[r * numColumns + c]; sumTile[ty][tx] += value; squareSumTile[ty][tx] += value * value; } __syncthreads(); } } if (tx == 0 && ty == 0) { R sum = 0; R squareSum = 0; #pragma unroll for (int i = 0; i < TILE_DIM; i++) { #pragma unroll for (int j = 0; j < TILE_DIM; j++) { sum += sumTile[i][j]; squareSum += squareSumTile[i][j]; } } int length = numRows * numColumns; result[0] = sqrt((squareSum - (sum * sum) / length) / length); } } template<typename T> __device__ void math_std(const T* matrix, float* result, const int numRows, const int numColumns) { common_std<T, float>(matrix, result, numRows, numColumns); } template<typename T> __device__ void math_stdd(const T* matrix, double* result, const int numRows, const int numColumns) { common_std<T, double>(matrix, result, numRows, numColumns); } template<typename T, typename R> __device__ void common_rowsStd(const T* matrix, R* result, const int numRows, const int numColumns) { __shared__ T tile[TILE_DIM][TILE_DIM]; int by = blockIdx.y; int ty = threadIdx.y; int row = by * blockDim.y + ty; R sum = 0; R squareSum = 0; #pragma unroll for (int t = 0; t < (numColumns - 1) / TILE_DIM + 1; t++) { #pragma unroll for (int i = 0; i < TILE_DIM; i++) { int r = by * TILE_DIM + i; int c = t * TILE_DIM + ty; if (r < numRows && c < numColumns) { tile[i][ty] = matrix[r * numColumns + c]; } else { tile[i][ty] = 0; } } __syncthreads(); #pragma unroll for (int j = 0; j < TILE_DIM; j++) { T value = tile[ty][j]; sum += value; squareSum += value * value; } __syncthreads(); } if (row < numRows) { result[row] = sqrt((squareSum - (sum * sum) / numColumns) / numColumns); } } template<typename T> __device__ void rowsStd(const T* matrix, float* result, const int numRows, const int numColumns) { common_rowsStd<T, float>(matrix, result, numRows, numColumns); } template<typename T> __device__ void rowsStdd(const T* matrix, double* result, const int numRows, const int numColumns) { common_rowsStd<T, double>(matrix, result, numRows, numColumns); } template<typename T, typename R> __device__ void common_columnsStd(const T* matrix, R* result, const int numRows, const int numColumns) { int bx = blockIdx.x; int tx = threadIdx.x; int col = bx * blockDim.x + tx; if (col < numColumns) { R sum = 0; R squareSum = 0; #pragma unroll for (int i = 0; i < numRows; i++) { int index = i * numColumns + col; T value = matrix[index]; sum += value; squareSum += value * value; } result[col] = sqrt((squareSum - (sum * sum) / numRows) / numRows); } } template<typename T> __device__ void columnsStd(const T* matrix, float* result, const int numRows, const int numColumns) { common_columnsStd<T, float>(matrix, result, numRows, numColumns); } template<typename T> __device__ void columnsStdd(const T* matrix, double* result, const int numRows, const int numColumns) { common_columnsStd<T, double>(matrix, result, numRows, numColumns); }
#include <hip/hip_runtime.h> #define TILE_DIM 32 template<typename T, typename R> __device__ void common_std(const T* matrix, R* result, const int numRows, const int numColumns) { __shared__ R sumTile[TILE_DIM][TILE_DIM]; __shared__ R squareSumTile[TILE_DIM][TILE_DIM]; int tx = threadIdx.x; int ty = threadIdx.y; sumTile[ty][tx] = 0; squareSumTile[ty][tx] = 0; #pragma unroll for (int tr = 0; tr < (numRows - 1) / TILE_DIM + 1; tr++) { for (int tc = 0; tc < (numColumns - 1) / TILE_DIM + 1; tc++) { int r = tr * TILE_DIM + ty; int c = tc * TILE_DIM + tx; if (r < numRows && c < numColumns) { T value = matrix[r * numColumns + c]; sumTile[ty][tx] += value; squareSumTile[ty][tx] += value * value; } __syncthreads(); } } if (tx == 0 && ty == 0) { R sum = 0; R squareSum = 0; #pragma unroll for (int i = 0; i < TILE_DIM; i++) { #pragma unroll for (int j = 0; j < TILE_DIM; j++) { sum += sumTile[i][j]; squareSum += squareSumTile[i][j]; } } int length = numRows * numColumns; result[0] = sqrt((squareSum - (sum * sum) / length) / length); } } template<typename T> __device__ void math_std(const T* matrix, float* result, const int numRows, const int numColumns) { common_std<T, float>(matrix, result, numRows, numColumns); } template<typename T> __device__ void math_stdd(const T* matrix, double* result, const int numRows, const int numColumns) { common_std<T, double>(matrix, result, numRows, numColumns); } template<typename T, typename R> __device__ void common_rowsStd(const T* matrix, R* result, const int numRows, const int numColumns) { __shared__ T tile[TILE_DIM][TILE_DIM]; int by = blockIdx.y; int ty = threadIdx.y; int row = by * blockDim.y + ty; R sum = 0; R squareSum = 0; #pragma unroll for (int t = 0; t < (numColumns - 1) / TILE_DIM + 1; t++) { #pragma unroll for (int i = 0; i < TILE_DIM; i++) { int r = by * TILE_DIM + i; int c = t * TILE_DIM + ty; if (r < numRows && c < numColumns) { tile[i][ty] = matrix[r * numColumns + c]; } else { tile[i][ty] = 0; } } __syncthreads(); #pragma unroll for (int j = 0; j < TILE_DIM; j++) { T value = tile[ty][j]; sum += value; squareSum += value * value; } __syncthreads(); } if (row < numRows) { result[row] = sqrt((squareSum - (sum * sum) / numColumns) / numColumns); } } template<typename T> __device__ void rowsStd(const T* matrix, float* result, const int numRows, const int numColumns) { common_rowsStd<T, float>(matrix, result, numRows, numColumns); } template<typename T> __device__ void rowsStdd(const T* matrix, double* result, const int numRows, const int numColumns) { common_rowsStd<T, double>(matrix, result, numRows, numColumns); } template<typename T, typename R> __device__ void common_columnsStd(const T* matrix, R* result, const int numRows, const int numColumns) { int bx = blockIdx.x; int tx = threadIdx.x; int col = bx * blockDim.x + tx; if (col < numColumns) { R sum = 0; R squareSum = 0; #pragma unroll for (int i = 0; i < numRows; i++) { int index = i * numColumns + col; T value = matrix[index]; sum += value; squareSum += value * value; } result[col] = sqrt((squareSum - (sum * sum) / numRows) / numRows); } } template<typename T> __device__ void columnsStd(const T* matrix, float* result, const int numRows, const int numColumns) { common_columnsStd<T, float>(matrix, result, numRows, numColumns); } template<typename T> __device__ void columnsStdd(const T* matrix, double* result, const int numRows, const int numColumns) { common_columnsStd<T, double>(matrix, result, numRows, numColumns); }
You are a helpful coding assistant specialized in converting HIP source code to AMD device assembly.
#include <hip/hip_runtime.h> #define TILE_DIM 32 template<typename T, typename R> __device__ void common_std(const T* matrix, R* result, const int numRows, const int numColumns) { __shared__ R sumTile[TILE_DIM][TILE_DIM]; __shared__ R squareSumTile[TILE_DIM][TILE_DIM]; int tx = threadIdx.x; int ty = threadIdx.y; sumTile[ty][tx] = 0; squareSumTile[ty][tx] = 0; #pragma unroll for (int tr = 0; tr < (numRows - 1) / TILE_DIM + 1; tr++) { for (int tc = 0; tc < (numColumns - 1) / TILE_DIM + 1; tc++) { int r = tr * TILE_DIM + ty; int c = tc * TILE_DIM + tx; if (r < numRows && c < numColumns) { T value = matrix[r * numColumns + c]; sumTile[ty][tx] += value; squareSumTile[ty][tx] += value * value; } __syncthreads(); } } if (tx == 0 && ty == 0) { R sum = 0; R squareSum = 0; #pragma unroll for (int i = 0; i < TILE_DIM; i++) { #pragma unroll for (int j = 0; j < TILE_DIM; j++) { sum += sumTile[i][j]; squareSum += squareSumTile[i][j]; } } int length = numRows * numColumns; result[0] = sqrt((squareSum - (sum * sum) / length) / length); } } template<typename T> __device__ void math_std(const T* matrix, float* result, const int numRows, const int numColumns) { common_std<T, float>(matrix, result, numRows, numColumns); } template<typename T> __device__ void math_stdd(const T* matrix, double* result, const int numRows, const int numColumns) { common_std<T, double>(matrix, result, numRows, numColumns); } template<typename T, typename R> __device__ void common_rowsStd(const T* matrix, R* result, const int numRows, const int numColumns) { __shared__ T tile[TILE_DIM][TILE_DIM]; int by = blockIdx.y; int ty = threadIdx.y; int row = by * blockDim.y + ty; R sum = 0; R squareSum = 0; #pragma unroll for (int t = 0; t < (numColumns - 1) / TILE_DIM + 1; t++) { #pragma unroll for (int i = 0; i < TILE_DIM; i++) { int r = by * TILE_DIM + i; int c = t * TILE_DIM + ty; if (r < numRows && c < numColumns) { tile[i][ty] = matrix[r * numColumns + c]; } else { tile[i][ty] = 0; } } __syncthreads(); #pragma unroll for (int j = 0; j < TILE_DIM; j++) { T value = tile[ty][j]; sum += value; squareSum += value * value; } __syncthreads(); } if (row < numRows) { result[row] = sqrt((squareSum - (sum * sum) / numColumns) / numColumns); } } template<typename T> __device__ void rowsStd(const T* matrix, float* result, const int numRows, const int numColumns) { common_rowsStd<T, float>(matrix, result, numRows, numColumns); } template<typename T> __device__ void rowsStdd(const T* matrix, double* result, const int numRows, const int numColumns) { common_rowsStd<T, double>(matrix, result, numRows, numColumns); } template<typename T, typename R> __device__ void common_columnsStd(const T* matrix, R* result, const int numRows, const int numColumns) { int bx = blockIdx.x; int tx = threadIdx.x; int col = bx * blockDim.x + tx; if (col < numColumns) { R sum = 0; R squareSum = 0; #pragma unroll for (int i = 0; i < numRows; i++) { int index = i * numColumns + col; T value = matrix[index]; sum += value; squareSum += value * value; } result[col] = sqrt((squareSum - (sum * sum) / numRows) / numRows); } } template<typename T> __device__ void columnsStd(const T* matrix, float* result, const int numRows, const int numColumns) { common_columnsStd<T, float>(matrix, result, numRows, numColumns); } template<typename T> __device__ void columnsStdd(const T* matrix, double* result, const int numRows, const int numColumns) { common_columnsStd<T, double>(matrix, result, numRows, numColumns); }
.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> #define TILE_DIM 32 template<typename T, typename R> __device__ void common_std(const T* matrix, R* result, const int numRows, const int numColumns) { __shared__ R sumTile[TILE_DIM][TILE_DIM]; __shared__ R squareSumTile[TILE_DIM][TILE_DIM]; int tx = threadIdx.x; int ty = threadIdx.y; sumTile[ty][tx] = 0; squareSumTile[ty][tx] = 0; #pragma unroll for (int tr = 0; tr < (numRows - 1) / TILE_DIM + 1; tr++) { for (int tc = 0; tc < (numColumns - 1) / TILE_DIM + 1; tc++) { int r = tr * TILE_DIM + ty; int c = tc * TILE_DIM + tx; if (r < numRows && c < numColumns) { T value = matrix[r * numColumns + c]; sumTile[ty][tx] += value; squareSumTile[ty][tx] += value * value; } __syncthreads(); } } if (tx == 0 && ty == 0) { R sum = 0; R squareSum = 0; #pragma unroll for (int i = 0; i < TILE_DIM; i++) { #pragma unroll for (int j = 0; j < TILE_DIM; j++) { sum += sumTile[i][j]; squareSum += squareSumTile[i][j]; } } int length = numRows * numColumns; result[0] = sqrt((squareSum - (sum * sum) / length) / length); } } template<typename T> __device__ void math_std(const T* matrix, float* result, const int numRows, const int numColumns) { common_std<T, float>(matrix, result, numRows, numColumns); } template<typename T> __device__ void math_stdd(const T* matrix, double* result, const int numRows, const int numColumns) { common_std<T, double>(matrix, result, numRows, numColumns); } template<typename T, typename R> __device__ void common_rowsStd(const T* matrix, R* result, const int numRows, const int numColumns) { __shared__ T tile[TILE_DIM][TILE_DIM]; int by = blockIdx.y; int ty = threadIdx.y; int row = by * blockDim.y + ty; R sum = 0; R squareSum = 0; #pragma unroll for (int t = 0; t < (numColumns - 1) / TILE_DIM + 1; t++) { #pragma unroll for (int i = 0; i < TILE_DIM; i++) { int r = by * TILE_DIM + i; int c = t * TILE_DIM + ty; if (r < numRows && c < numColumns) { tile[i][ty] = matrix[r * numColumns + c]; } else { tile[i][ty] = 0; } } __syncthreads(); #pragma unroll for (int j = 0; j < TILE_DIM; j++) { T value = tile[ty][j]; sum += value; squareSum += value * value; } __syncthreads(); } if (row < numRows) { result[row] = sqrt((squareSum - (sum * sum) / numColumns) / numColumns); } } template<typename T> __device__ void rowsStd(const T* matrix, float* result, const int numRows, const int numColumns) { common_rowsStd<T, float>(matrix, result, numRows, numColumns); } template<typename T> __device__ void rowsStdd(const T* matrix, double* result, const int numRows, const int numColumns) { common_rowsStd<T, double>(matrix, result, numRows, numColumns); } template<typename T, typename R> __device__ void common_columnsStd(const T* matrix, R* result, const int numRows, const int numColumns) { int bx = blockIdx.x; int tx = threadIdx.x; int col = bx * blockDim.x + tx; if (col < numColumns) { R sum = 0; R squareSum = 0; #pragma unroll for (int i = 0; i < numRows; i++) { int index = i * numColumns + col; T value = matrix[index]; sum += value; squareSum += value * value; } result[col] = sqrt((squareSum - (sum * sum) / numRows) / numRows); } } template<typename T> __device__ void columnsStd(const T* matrix, float* result, const int numRows, const int numColumns) { common_columnsStd<T, float>(matrix, result, numRows, numColumns); } template<typename T> __device__ void columnsStdd(const T* matrix, double* result, const int numRows, const int numColumns) { common_columnsStd<T, double>(matrix, result, numRows, numColumns); }
.text .file "Std.hip" .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 __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_000dde94_00000000-6_Std.cudafe1.cpp" .text #APP #NO_APP .type _ZL26__cudaUnregisterBinaryUtilv, @function _ZL26__cudaUnregisterBinaryUtilv: .LFB2038: .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 .LFE2038: .size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB2061: .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 .LFE2061: .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 "Std.hip" .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 __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/copy.h> #include <stdio.h> #include <iostream> #include <time.h> #include <chrono> struct is_even{ __host__ __device__ bool operator () (const int x){ return (x & 1) == 0; } }; int main(int argc, char** argv){ int size = atoi(argv[1]); thrust::device_vector<int> test(size); thrust::fill(test.begin(), test.end(), 1); auto started = std::chrono::high_resolution_clock::now(); thrust::device_vector<int> res(size); thrust::copy_if(test.begin(), test.end(), res.begin(), is_even()); auto end = std::chrono::high_resolution_clock::now(); printf("Thrust time %.4f\n", (std::chrono::duration_cast<std::chrono::milliseconds>(end - started).count()) / 1000.0); return 0; }
#include <hip/hip_runtime.h> #include <thrust/device_vector.h> #include <thrust/copy.h> #include <stdio.h> #include <iostream> #include <time.h> #include <chrono> struct is_even{ __host__ __device__ bool operator () (const int x){ return (x & 1) == 0; } }; int main(int argc, char** argv){ int size = atoi(argv[1]); thrust::device_vector<int> test(size); thrust::fill(test.begin(), test.end(), 1); auto started = std::chrono::high_resolution_clock::now(); thrust::device_vector<int> res(size); thrust::copy_if(test.begin(), test.end(), res.begin(), is_even()); auto end = std::chrono::high_resolution_clock::now(); printf("Thrust time %.4f\n", (std::chrono::duration_cast<std::chrono::milliseconds>(end - started).count()) / 1000.0); return 0; }
You are a helpful coding assistant specialized in converting CUDA source code to CUDA device assembly.
/* Write GPU kernels to compete the functionality of estimating the integral via the trapezoidal rule. */
code for sm_80
You are a helpful coding assistant specialized in converting CUDA source code to CUDA host assembly.
/* Write GPU kernels to compete the functionality of estimating the integral via the trapezoidal rule. */
.file "tmpxft_000f1584_00000000-6_trap_kernel.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 .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB2052: .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 .LFE2052: .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.
/* Write GPU kernels to compete the functionality of estimating the integral via the trapezoidal rule. */
#include <hip/hip_runtime.h> /* Write GPU kernels to compete the functionality of estimating the integral via the trapezoidal rule. */
You are a helpful coding assistant specialized in converting HIP source code to AMD device assembly.
#include <hip/hip_runtime.h> /* Write GPU kernels to compete the functionality of estimating the integral via the trapezoidal rule. */
.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> /* Write GPU kernels to compete the functionality of estimating the integral via the trapezoidal rule. */
.text .file "trap_kernel.hip" .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 __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_000f1584_00000000-6_trap_kernel.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 .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB2052: .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 .LFE2052: .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 "trap_kernel.hip" .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 __hip_cuid_
You are a helpful coding assistant specialized in converting CUDA source code to CUDA device assembly.
#include <stdio.h> #include <stdlib.h> __global__ void gpu_add_two_vectors(void) { } int main() { printf("Adding Vectors: \n"); return 0; }
code for sm_80 Function : _Z19gpu_add_two_vectorsv .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 CUDA host assembly.
#include <stdio.h> #include <stdlib.h> __global__ void gpu_add_two_vectors(void) { } int main() { printf("Adding Vectors: \n"); return 0; }
.file "tmpxft_000cc257_00000000-6_add_two_vectors.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 .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "Adding Vectors: \n" .text .globl main .type main, @function main: .LFB2057: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 leaq .LC0(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $0, %eax addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2057: .size main, .-main .globl _Z38__device_stub__Z19gpu_add_two_vectorsvv .type _Z38__device_stub__Z19gpu_add_two_vectorsvv, @function _Z38__device_stub__Z19gpu_add_two_vectorsvv: .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 .L9 .L5: movq 72(%rsp), %rax subq %fs:40, %rax jne .L10 addq $88, %rsp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L9: .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 _Z19gpu_add_two_vectorsv(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 96 jmp .L5 .L10: call __stack_chk_fail@PLT .cfi_endproc .LFE2082: .size _Z38__device_stub__Z19gpu_add_two_vectorsvv, .-_Z38__device_stub__Z19gpu_add_two_vectorsvv .globl _Z19gpu_add_two_vectorsv .type _Z19gpu_add_two_vectorsv, @function _Z19gpu_add_two_vectorsv: .LFB2083: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z38__device_stub__Z19gpu_add_two_vectorsvv addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2083: .size _Z19gpu_add_two_vectorsv, .-_Z19gpu_add_two_vectorsv .section .rodata.str1.1 .LC1: .string "_Z19gpu_add_two_vectorsv" .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 _Z19gpu_add_two_vectorsv(%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> __global__ void gpu_add_two_vectors(void) { } int main() { printf("Adding Vectors: \n"); return 0; }
#include <hip/hip_runtime.h> #include <stdio.h> #include <stdlib.h> __global__ void gpu_add_two_vectors(void) { } int main() { printf("Adding Vectors: \n"); return 0; }
You are a helpful coding assistant specialized in converting HIP source code to AMD device assembly.
#include <hip/hip_runtime.h> #include <stdio.h> #include <stdlib.h> __global__ void gpu_add_two_vectors(void) { } int main() { printf("Adding Vectors: \n"); return 0; }
.text .amdgcn_target "amdgcn-amd-amdhsa--gfx1100" .protected _Z19gpu_add_two_vectorsv .globl _Z19gpu_add_two_vectorsv .p2align 8 .type _Z19gpu_add_two_vectorsv,@function _Z19gpu_add_two_vectorsv: s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z19gpu_add_two_vectorsv .amdhsa_group_segment_fixed_size 0 .amdhsa_private_segment_fixed_size 0 .amdhsa_kernarg_size 0 .amdhsa_user_sgpr_count 15 .amdhsa_user_sgpr_dispatch_ptr 0 .amdhsa_user_sgpr_queue_ptr 0 .amdhsa_user_sgpr_kernarg_segment_ptr 0 .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 1 .amdhsa_next_free_sgpr 1 .amdhsa_reserve_vcc 0 .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 _Z19gpu_add_two_vectorsv, .Lfunc_end0-_Z19gpu_add_two_vectorsv .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: [] .group_segment_fixed_size: 0 .kernarg_segment_align: 4 .kernarg_segment_size: 0 .language: OpenCL C .language_version: - 2 - 0 .max_flat_workgroup_size: 1024 .name: _Z19gpu_add_two_vectorsv .private_segment_fixed_size: 0 .sgpr_count: 0 .sgpr_spill_count: 0 .symbol: _Z19gpu_add_two_vectorsv.kd .uniform_work_group_size: 1 .uses_dynamic_stack: false .vgpr_count: 0 .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> #include <stdlib.h> __global__ void gpu_add_two_vectors(void) { } int main() { printf("Adding Vectors: \n"); return 0; }
.text .file "add_two_vectors.hip" .globl _Z34__device_stub__gpu_add_two_vectorsv # -- Begin function _Z34__device_stub__gpu_add_two_vectorsv .p2align 4, 0x90 .type _Z34__device_stub__gpu_add_two_vectorsv,@function _Z34__device_stub__gpu_add_two_vectorsv: # @_Z34__device_stub__gpu_add_two_vectorsv .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 $_Z19gpu_add_two_vectorsv, %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 _Z34__device_stub__gpu_add_two_vectorsv, .Lfunc_end0-_Z34__device_stub__gpu_add_two_vectorsv .cfi_endproc # -- End function .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: pushq %rax .cfi_def_cfa_offset 16 movl $.Lstr, %edi callq puts@PLT xorl %eax, %eax popq %rcx .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 $_Z19gpu_add_two_vectorsv, %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 _Z19gpu_add_two_vectorsv,@object # @_Z19gpu_add_two_vectorsv .section .rodata,"a",@progbits .globl _Z19gpu_add_two_vectorsv .p2align 3, 0x0 _Z19gpu_add_two_vectorsv: .quad _Z34__device_stub__gpu_add_two_vectorsv .size _Z19gpu_add_two_vectorsv, 8 .type .L__unnamed_1,@object # @0 .section .rodata.str1.1,"aMS",@progbits,1 .L__unnamed_1: .asciz "_Z19gpu_add_two_vectorsv" .size .L__unnamed_1, 25 .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 "Adding Vectors: " .size .Lstr, 17 .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 _Z34__device_stub__gpu_add_two_vectorsv .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z19gpu_add_two_vectorsv .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 : _Z19gpu_add_two_vectorsv .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" .protected _Z19gpu_add_two_vectorsv .globl _Z19gpu_add_two_vectorsv .p2align 8 .type _Z19gpu_add_two_vectorsv,@function _Z19gpu_add_two_vectorsv: s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z19gpu_add_two_vectorsv .amdhsa_group_segment_fixed_size 0 .amdhsa_private_segment_fixed_size 0 .amdhsa_kernarg_size 0 .amdhsa_user_sgpr_count 15 .amdhsa_user_sgpr_dispatch_ptr 0 .amdhsa_user_sgpr_queue_ptr 0 .amdhsa_user_sgpr_kernarg_segment_ptr 0 .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 1 .amdhsa_next_free_sgpr 1 .amdhsa_reserve_vcc 0 .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 _Z19gpu_add_two_vectorsv, .Lfunc_end0-_Z19gpu_add_two_vectorsv .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: [] .group_segment_fixed_size: 0 .kernarg_segment_align: 4 .kernarg_segment_size: 0 .language: OpenCL C .language_version: - 2 - 0 .max_flat_workgroup_size: 1024 .name: _Z19gpu_add_two_vectorsv .private_segment_fixed_size: 0 .sgpr_count: 0 .sgpr_spill_count: 0 .symbol: _Z19gpu_add_two_vectorsv.kd .uniform_work_group_size: 1 .uses_dynamic_stack: false .vgpr_count: 0 .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_000cc257_00000000-6_add_two_vectors.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 .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "Adding Vectors: \n" .text .globl main .type main, @function main: .LFB2057: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 leaq .LC0(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $0, %eax addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2057: .size main, .-main .globl _Z38__device_stub__Z19gpu_add_two_vectorsvv .type _Z38__device_stub__Z19gpu_add_two_vectorsvv, @function _Z38__device_stub__Z19gpu_add_two_vectorsvv: .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 .L9 .L5: movq 72(%rsp), %rax subq %fs:40, %rax jne .L10 addq $88, %rsp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L9: .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 _Z19gpu_add_two_vectorsv(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 96 jmp .L5 .L10: call __stack_chk_fail@PLT .cfi_endproc .LFE2082: .size _Z38__device_stub__Z19gpu_add_two_vectorsvv, .-_Z38__device_stub__Z19gpu_add_two_vectorsvv .globl _Z19gpu_add_two_vectorsv .type _Z19gpu_add_two_vectorsv, @function _Z19gpu_add_two_vectorsv: .LFB2083: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z38__device_stub__Z19gpu_add_two_vectorsvv addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2083: .size _Z19gpu_add_two_vectorsv, .-_Z19gpu_add_two_vectorsv .section .rodata.str1.1 .LC1: .string "_Z19gpu_add_two_vectorsv" .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 _Z19gpu_add_two_vectorsv(%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 "add_two_vectors.hip" .globl _Z34__device_stub__gpu_add_two_vectorsv # -- Begin function _Z34__device_stub__gpu_add_two_vectorsv .p2align 4, 0x90 .type _Z34__device_stub__gpu_add_two_vectorsv,@function _Z34__device_stub__gpu_add_two_vectorsv: # @_Z34__device_stub__gpu_add_two_vectorsv .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 $_Z19gpu_add_two_vectorsv, %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 _Z34__device_stub__gpu_add_two_vectorsv, .Lfunc_end0-_Z34__device_stub__gpu_add_two_vectorsv .cfi_endproc # -- End function .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: pushq %rax .cfi_def_cfa_offset 16 movl $.Lstr, %edi callq puts@PLT xorl %eax, %eax popq %rcx .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 $_Z19gpu_add_two_vectorsv, %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 _Z19gpu_add_two_vectorsv,@object # @_Z19gpu_add_two_vectorsv .section .rodata,"a",@progbits .globl _Z19gpu_add_two_vectorsv .p2align 3, 0x0 _Z19gpu_add_two_vectorsv: .quad _Z34__device_stub__gpu_add_two_vectorsv .size _Z19gpu_add_two_vectorsv, 8 .type .L__unnamed_1,@object # @0 .section .rodata.str1.1,"aMS",@progbits,1 .L__unnamed_1: .asciz "_Z19gpu_add_two_vectorsv" .size .L__unnamed_1, 25 .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 "Adding Vectors: " .size .Lstr, 17 .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 _Z34__device_stub__gpu_add_two_vectorsv .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z19gpu_add_two_vectorsv .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/host_vector.h> #include <thrust/device_vector.h> #include <iostream> struct COLOR { uint8_t R; uint8_t G; uint8_t B; }; std::ostream &operator<<(std::ostream &os, COLOR const &m) { return os << m.R << " " << m.G << " " << m.B; } int main(void) { const int height = 1; const int width = 2; COLOR RED = {255, 0, 0}; std::cout << RED << std::endl; std::vector<COLOR> A(height*width); std::fill(A.begin(), A.end(), RED); for(int i = 0; i < A.size(); i++) std::cout << "A[" << i << "] = " << A[i] << std::endl; thrust::device_vector<COLOR> D(height*width); thrust::fill(D.begin(), D.end(), RED); thrust::host_vector<COLOR> H(height*width); thrust::copy(H.begin(), H.end(), D.begin()); // print D for(int i = 0; i < D.size(); i++) std::cout << "D[" << i << "] = " << D[i] << std::endl; for(int i = 0; i < H.size(); i++) std::cout << "H[" << i << "] = " << H[i] << std::endl; }
code for sm_80 Function : _ZN3cub17CUB_200700_800_NS6detail8for_each13static_kernelINS2_12policy_hub_t12policy_350_tElN6thrust20THRUST_200700_800_NS8cuda_cub6__fill7functorINS7_6detail15normal_iteratorINS7_10device_ptrI5COLOREEEESE_EEEEvT0_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*/ LDC.U8 R9, c[0x0][0x170] ; /* 0x00005c00ff097b82 */ /* 0x000e620000000000 */ /*0030*/ IMAD.MOV.U32 R7, RZ, RZ, 0x3 ; /* 0x00000003ff077424 */ /* 0x000fe200078e00ff */ /*0040*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */ /* 0x000fe20000000a00 */ /*0050*/ S2R R5, SR_TID.X ; /* 0x0000000000057919 */ /* 0x000eaa0000002100 */ /*0060*/ LDC.U8 R11, c[0x0][0x171] ; /* 0x00005c40ff0b7b82 */ /* 0x000ef00000000000 */ /*0070*/ LDC.U8 R13, c[0x0][0x172] ; /* 0x00005c80ff0d7b82 */ /* 0x000f220000000000 */ /*0080*/ IMAD.WIDE.U32 R2, R2, 0x200, RZ ; /* 0x0000020002027825 */ /* 0x001fca00078e00ff */ /*0090*/ IADD3 R4, P0, -R2.reuse, c[0x0][0x160], RZ ; /* 0x0000580002047a10 */ /* 0x040fe40007f1e1ff */ /*00a0*/ IADD3 R2, P1, R2, R5, RZ ; /* 0x0000000502027210 */ /* 0x004fe40007f3e0ff */ /*00b0*/ IADD3.X R6, ~R3, c[0x0][0x164], RZ, P0, !PT ; /* 0x0000590003067a10 */ /* 0x000fe400007fe5ff */ /*00c0*/ ISETP.GT.U32.AND P0, PT, R4, 0x1ff, PT ; /* 0x000001ff0400780c */ /* 0x000fe20003f04070 */ /*00d0*/ IMAD.X R0, RZ, RZ, R3, P1 ; /* 0x000000ffff007224 */ /* 0x000fe400008e0603 */ /*00e0*/ IMAD.WIDE.U32 R2, R2, R7, c[0x0][0x168] ; /* 0x00005a0002027625 */ /* 0x000fe200078e0007 */ /*00f0*/ ISETP.GT.AND.EX P0, PT, R6, RZ, PT, P0 ; /* 0x000000ff0600720c */ /* 0x000fc60003f04300 */ /*0100*/ IMAD R7, R0, 0x3, RZ ; /* 0x0000000300077824 */ /* 0x000fc800078e02ff */ /*0110*/ IMAD.IADD R3, R3, 0x1, R7 ; /* 0x0000000103037824 */ /* 0x000fcc00078e0207 */ /*0120*/ @P0 BRA 0x210 ; /* 0x000000e000000947 */ /* 0x000fea0003800000 */ /*0130*/ ISETP.GT.U32.AND P0, PT, R4, R5, PT ; /* 0x000000050400720c */ /* 0x01afe40003f04070 */ /*0140*/ SHF.R.S32.HI R6, RZ, 0x1f, R4 ; /* 0x0000001fff067819 */ /* 0x000fe40000011404 */ /*0150*/ IADD3 R0, R5, 0x100, RZ ; /* 0x0000010005007810 */ /* 0x000fe40007ffe0ff */ /*0160*/ ISETP.GT.AND.EX P0, PT, R6, RZ, PT, P0 ; /* 0x000000ff0600720c */ /* 0x000fda0003f04300 */ /*0170*/ @P0 STG.E.U8 [R2.64], R9 ; /* 0x0000000902000986 */ /* 0x0001e8000c101104 */ /*0180*/ @P0 STG.E.U8 [R2.64+0x1], R11 ; /* 0x0000010b02000986 */ /* 0x0001e8000c101104 */ /*0190*/ @P0 STG.E.U8 [R2.64+0x2], R13 ; /* 0x0000020d02000986 */ /* 0x0001e2000c101104 */ /*01a0*/ ISETP.GT.U32.AND P0, PT, R4, R0, PT ; /* 0x000000000400720c */ /* 0x000fc80003f04070 */ /*01b0*/ ISETP.GT.AND.EX P0, PT, R6, RZ, PT, P0 ; /* 0x000000ff0600720c */ /* 0x000fda0003f04300 */ /*01c0*/ @!P0 EXIT ; /* 0x000000000000894d */ /* 0x000fea0003800000 */ /*01d0*/ STG.E.U8 [R2.64+0x300], R9 ; /* 0x0003000902007986 */ /* 0x001fe8000c101104 */ /*01e0*/ STG.E.U8 [R2.64+0x301], R11 ; /* 0x0003010b02007986 */ /* 0x000fe8000c101104 */ /*01f0*/ STG.E.U8 [R2.64+0x302], R13 ; /* 0x0003020d02007986 */ /* 0x000fe2000c101104 */ /*0200*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*0210*/ STG.E.U8 [R2.64], R9 ; /* 0x0000000902007986 */ /* 0x01afe8000c101104 */ /*0220*/ STG.E.U8 [R2.64+0x300], R9 ; /* 0x0003000902007986 */ /* 0x000fe8000c101104 */ /*0230*/ STG.E.U8 [R2.64+0x1], R11 ; /* 0x0000010b02007986 */ /* 0x000fe8000c101104 */ /*0240*/ STG.E.U8 [R2.64+0x301], R11 ; /* 0x0003010b02007986 */ /* 0x000fe8000c101104 */ /*0250*/ STG.E.U8 [R2.64+0x2], R13 ; /* 0x0000020d02007986 */ /* 0x000fe8000c101104 */ /*0260*/ STG.E.U8 [R2.64+0x302], R13 ; /* 0x0003020d02007986 */ /* 0x000fe2000c101104 */ /*0270*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*0280*/ BRA 0x280; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*0290*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*02a0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*02b0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*02c0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*02d0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*02e0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*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 */ .......... Function : _ZN3cub17CUB_200700_800_NS6detail8for_each13static_kernelINS2_12policy_hub_t12policy_350_tEmN6thrust20THRUST_200700_800_NS8cuda_cub20__uninitialized_fill7functorINS7_10device_ptrI5COLOREESC_EEEEvT0_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*/ LDC.U8 R9, c[0x0][0x170] ; /* 0x00005c00ff097b82 */ /* 0x000e620000000000 */ /*0030*/ IMAD.MOV.U32 R7, RZ, RZ, 0x3 ; /* 0x00000003ff077424 */ /* 0x000fe200078e00ff */ /*0040*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */ /* 0x000fe20000000a00 */ /*0050*/ S2R R5, SR_TID.X ; /* 0x0000000000057919 */ /* 0x000eaa0000002100 */ /*0060*/ LDC.U8 R11, c[0x0][0x171] ; /* 0x00005c40ff0b7b82 */ /* 0x000ef00000000000 */ /*0070*/ LDC.U8 R13, c[0x0][0x172] ; /* 0x00005c80ff0d7b82 */ /* 0x000f220000000000 */ /*0080*/ IMAD.WIDE.U32 R2, R2, 0x200, RZ ; /* 0x0000020002027825 */ /* 0x001fca00078e00ff */ /*0090*/ IADD3 R4, P0, -R2.reuse, c[0x0][0x160], RZ ; /* 0x0000580002047a10 */ /* 0x040fe40007f1e1ff */ /*00a0*/ IADD3 R2, P1, R2, R5, RZ ; /* 0x0000000502027210 */ /* 0x004fe40007f3e0ff */ /*00b0*/ IADD3.X R6, ~R3, c[0x0][0x164], RZ, P0, !PT ; /* 0x0000590003067a10 */ /* 0x000fe400007fe5ff */ /*00c0*/ ISETP.GT.U32.AND P0, PT, R4, 0x1ff, PT ; /* 0x000001ff0400780c */ /* 0x000fe20003f04070 */ /*00d0*/ IMAD.X R0, RZ, RZ, R3, P1 ; /* 0x000000ffff007224 */ /* 0x000fe400008e0603 */ /*00e0*/ IMAD.WIDE.U32 R2, R2, R7, c[0x0][0x168] ; /* 0x00005a0002027625 */ /* 0x000fe200078e0007 */ /*00f0*/ ISETP.GT.U32.AND.EX P0, PT, R6, RZ, PT, P0 ; /* 0x000000ff0600720c */ /* 0x000fc60003f04100 */ /*0100*/ IMAD R7, R0, 0x3, RZ ; /* 0x0000000300077824 */ /* 0x000fc800078e02ff */ /*0110*/ IMAD.IADD R3, R3, 0x1, R7 ; /* 0x0000000103037824 */ /* 0x000fcc00078e0207 */ /*0120*/ @P0 BRA 0x210 ; /* 0x000000e000000947 */ /* 0x000fea0003800000 */ /*0130*/ ISETP.GT.U32.AND P0, PT, R4, R5, PT ; /* 0x000000050400720c */ /* 0x01afe40003f04070 */ /*0140*/ SHF.R.S32.HI R6, RZ, 0x1f, R4 ; /* 0x0000001fff067819 */ /* 0x000fe40000011404 */ /*0150*/ IADD3 R0, R5, 0x100, RZ ; /* 0x0000010005007810 */ /* 0x000fe40007ffe0ff */ /*0160*/ ISETP.GT.U32.AND.EX P0, PT, R6, RZ, PT, P0 ; /* 0x000000ff0600720c */ /* 0x000fda0003f04100 */ /*0170*/ @P0 STG.E.U8 [R2.64], R9 ; /* 0x0000000902000986 */ /* 0x0001e8000c101104 */ /*0180*/ @P0 STG.E.U8 [R2.64+0x1], R11 ; /* 0x0000010b02000986 */ /* 0x0001e8000c101104 */ /*0190*/ @P0 STG.E.U8 [R2.64+0x2], R13 ; /* 0x0000020d02000986 */ /* 0x0001e2000c101104 */ /*01a0*/ ISETP.GT.U32.AND P0, PT, R4, R0, PT ; /* 0x000000000400720c */ /* 0x000fc80003f04070 */ /*01b0*/ ISETP.GT.U32.AND.EX P0, PT, R6, RZ, PT, P0 ; /* 0x000000ff0600720c */ /* 0x000fda0003f04100 */ /*01c0*/ @!P0 EXIT ; /* 0x000000000000894d */ /* 0x000fea0003800000 */ /*01d0*/ STG.E.U8 [R2.64+0x300], R9 ; /* 0x0003000902007986 */ /* 0x001fe8000c101104 */ /*01e0*/ STG.E.U8 [R2.64+0x301], R11 ; /* 0x0003010b02007986 */ /* 0x000fe8000c101104 */ /*01f0*/ STG.E.U8 [R2.64+0x302], R13 ; /* 0x0003020d02007986 */ /* 0x000fe2000c101104 */ /*0200*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*0210*/ STG.E.U8 [R2.64], R9 ; /* 0x0000000902007986 */ /* 0x01afe8000c101104 */ /*0220*/ STG.E.U8 [R2.64+0x300], R9 ; /* 0x0003000902007986 */ /* 0x000fe8000c101104 */ /*0230*/ STG.E.U8 [R2.64+0x1], R11 ; /* 0x0000010b02007986 */ /* 0x000fe8000c101104 */ /*0240*/ STG.E.U8 [R2.64+0x301], R11 ; /* 0x0003010b02007986 */ /* 0x000fe8000c101104 */ /*0250*/ STG.E.U8 [R2.64+0x2], R13 ; /* 0x0000020d02007986 */ /* 0x000fe8000c101104 */ /*0260*/ STG.E.U8 [R2.64+0x302], R13 ; /* 0x0003020d02007986 */ /* 0x000fe2000c101104 */ /*0270*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*0280*/ BRA 0x280; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*0290*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*02a0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*02b0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*02c0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*02d0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*02e0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*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 */ .......... 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/host_vector.h> #include <thrust/device_vector.h> #include <iostream> struct COLOR { uint8_t R; uint8_t G; uint8_t B; }; std::ostream &operator<<(std::ostream &os, COLOR const &m) { return os << m.R << " " << m.G << " " << m.B; } int main(void) { const int height = 1; const int width = 2; COLOR RED = {255, 0, 0}; std::cout << RED << std::endl; std::vector<COLOR> A(height*width); std::fill(A.begin(), A.end(), RED); for(int i = 0; i < A.size(); i++) std::cout << "A[" << i << "] = " << A[i] << std::endl; thrust::device_vector<COLOR> D(height*width); thrust::fill(D.begin(), D.end(), RED); thrust::host_vector<COLOR> H(height*width); thrust::copy(H.begin(), H.end(), D.begin()); // print D for(int i = 0; i < D.size(); i++) std::cout << "D[" << i << "] = " << D[i] << std::endl; for(int i = 0; i < H.size(); i++) std::cout << "H[" << i << "] = " << H[i] << std::endl; }
#include <hip/hip_runtime.h> #include <thrust/host_vector.h> #include <thrust/device_vector.h> #include <iostream> struct COLOR { uint8_t R; uint8_t G; uint8_t B; }; std::ostream &operator<<(std::ostream &os, COLOR const &m) { return os << m.R << " " << m.G << " " << m.B; } int main(void) { const int height = 1; const int width = 2; COLOR RED = {255, 0, 0}; std::cout << RED << std::endl; std::vector<COLOR> A(height*width); std::fill(A.begin(), A.end(), RED); for(int i = 0; i < A.size(); i++) std::cout << "A[" << i << "] = " << A[i] << std::endl; thrust::device_vector<COLOR> D(height*width); thrust::fill(D.begin(), D.end(), RED); thrust::host_vector<COLOR> H(height*width); thrust::copy(H.begin(), H.end(), D.begin()); // print D for(int i = 0; i < D.size(); i++) std::cout << "D[" << i << "] = " << D[i] << std::endl; for(int i = 0; i < H.size(); i++) std::cout << "H[" << i << "] = " << H[i] << std::endl; }
You are a helpful coding assistant specialized in converting HIP source code to AMD device assembly.
#include <hip/hip_runtime.h> #include <thrust/host_vector.h> #include <thrust/device_vector.h> #include <iostream> struct COLOR { uint8_t R; uint8_t G; uint8_t B; }; std::ostream &operator<<(std::ostream &os, COLOR const &m) { return os << m.R << " " << m.G << " " << m.B; } int main(void) { const int height = 1; const int width = 2; COLOR RED = {255, 0, 0}; std::cout << RED << std::endl; std::vector<COLOR> A(height*width); std::fill(A.begin(), A.end(), RED); for(int i = 0; i < A.size(); i++) std::cout << "A[" << i << "] = " << A[i] << std::endl; thrust::device_vector<COLOR> D(height*width); thrust::fill(D.begin(), D.end(), RED); thrust::host_vector<COLOR> H(height*width); thrust::copy(H.begin(), H.end(), D.begin()); // print D for(int i = 0; i < D.size(); i++) std::cout << "D[" << i << "] = " << D[i] << std::endl; for(int i = 0; i < H.size(); i++) std::cout << "H[" << i << "] = " << H[i] << std::endl; }
.text .amdgcn_target "amdgcn-amd-amdhsa--gfx1100" .section .text._ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrI5COLOREES6_EEmLj1EEEvT0_T1_SA_,"axG",@progbits,_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrI5COLOREES6_EEmLj1EEEvT0_T1_SA_,comdat .protected _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrI5COLOREES6_EEmLj1EEEvT0_T1_SA_ .globl _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrI5COLOREES6_EEmLj1EEEvT0_T1_SA_ .p2align 8 .type _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrI5COLOREES6_EEmLj1EEEvT0_T1_SA_,@function _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrI5COLOREES6_EEmLj1EEEvT0_T1_SA_: 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 v_mov_b32_e32 v1, 0 s_mul_i32 s3, s3, 3 s_mul_hi_u32 s4, s2, 3 s_mul_i32 s2, s2, 3 s_add_i32 s4, s4, s3 s_clause 0x2 global_load_u8 v3, v1, s[0:1] offset:10 global_load_u8 v4, v1, s[0:1] offset:9 global_load_u8 v5, v1, s[0:1] offset:8 s_load_b64 s[0:1], s[0:1], 0x0 s_waitcnt lgkmcnt(0) s_add_u32 s0, s0, s2 s_addc_u32 s1, s1, s4 s_delay_alu instid0(SALU_CYCLE_1) v_mad_u64_u32 v[1:2], null, v0, 3, s[0:1] s_waitcnt vmcnt(2) flat_store_b8 v[1:2], v3 offset:2 s_waitcnt vmcnt(1) flat_store_b8 v[1:2], v4 offset:1 s_waitcnt vmcnt(0) flat_store_b8 v[1:2], v5 .LBB0_2: s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrI5COLOREES6_EEmLj1EEEvT0_T1_SA_ .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 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_20__uninitialized_fill7functorINS_10device_ptrI5COLOREES6_EEmLj1EEEvT0_T1_SA_,"axG",@progbits,_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrI5COLOREES6_EEmLj1EEEvT0_T1_SA_,comdat .Lfunc_end0: .size _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrI5COLOREES6_EEmLj1EEEvT0_T1_SA_, .Lfunc_end0-_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrI5COLOREES6_EEmLj1EEEvT0_T1_SA_ .section .AMDGPU.csdata,"",@progbits .section .text._ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrI5COLOREEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESD_lSB_EET0_RNS0_16execution_policyIT_EESH_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSH_SM_SM_,"axG",@progbits,_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrI5COLOREEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESD_lSB_EET0_RNS0_16execution_policyIT_EESH_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSH_SM_SM_,comdat .protected _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrI5COLOREEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESD_lSB_EET0_RNS0_16execution_policyIT_EESH_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSH_SM_SM_ .globl _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrI5COLOREEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESD_lSB_EET0_RNS0_16execution_policyIT_EESH_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSH_SM_SM_ .p2align 8 .type _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrI5COLOREEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESD_lSB_EET0_RNS0_16execution_policyIT_EESH_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSH_SM_SM_,@function _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrI5COLOREEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESD_lSB_EET0_RNS0_16execution_policyIT_EESH_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSH_SM_SM_: 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 s_mul_i32 s3, s3, 3 s_mul_hi_u32 s0, s2, 3 s_mul_i32 s2, s2, 3 s_add_i32 s1, s0, s3 s_waitcnt lgkmcnt(0) s_add_u32 s0, s4, s2 s_addc_u32 s1, s5, s1 s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1) v_mad_u64_u32 v[1:2], null, v0, 3, s[0:1] s_lshr_b32 s0, s6, 8 v_dual_mov_b32 v0, s6 :: v_dual_mov_b32 v3, s0 s_clause 0x2 flat_store_b8 v[1:2], v0 flat_store_b8 v[1:2], v3 offset:1 flat_store_d16_hi_b8 v[1:2], v0 offset:2 .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_ptrI5COLOREEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESD_lSB_EET0_RNS0_16execution_policyIT_EESH_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSH_SM_SM_ .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 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 .section .text._ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrI5COLOREEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESD_lSB_EET0_RNS0_16execution_policyIT_EESH_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSH_SM_SM_,"axG",@progbits,_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrI5COLOREEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESD_lSB_EET0_RNS0_16execution_policyIT_EESH_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSH_SM_SM_,comdat .Lfunc_end1: .size _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrI5COLOREEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESD_lSB_EET0_RNS0_16execution_policyIT_EESH_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSH_SM_SM_, .Lfunc_end1-_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrI5COLOREEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESD_lSB_EET0_RNS0_16execution_policyIT_EESH_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSH_SM_SM_ .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_ptrI5COLOREES6_EEmLj1EEEvT0_T1_SA_ .private_segment_fixed_size: 0 .sgpr_count: 18 .sgpr_spill_count: 0 .symbol: _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrI5COLOREES6_EEmLj1EEEvT0_T1_SA_.kd .uniform_work_group_size: 1 .uses_dynamic_stack: false .vgpr_count: 6 .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_ptrI5COLOREEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESD_lSB_EET0_RNS0_16execution_policyIT_EESH_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSH_SM_SM_ .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_ptrI5COLOREEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESD_lSB_EET0_RNS0_16execution_policyIT_EESH_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSH_SM_SM_.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 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_cub6__fill7functorINS7_6detail15normal_iteratorINS7_10device_ptrI5COLOREEEESE_EEEEvT0_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*/ LDC.U8 R9, c[0x0][0x170] ; /* 0x00005c00ff097b82 */ /* 0x000e620000000000 */ /*0030*/ IMAD.MOV.U32 R7, RZ, RZ, 0x3 ; /* 0x00000003ff077424 */ /* 0x000fe200078e00ff */ /*0040*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */ /* 0x000fe20000000a00 */ /*0050*/ S2R R5, SR_TID.X ; /* 0x0000000000057919 */ /* 0x000eaa0000002100 */ /*0060*/ LDC.U8 R11, c[0x0][0x171] ; /* 0x00005c40ff0b7b82 */ /* 0x000ef00000000000 */ /*0070*/ LDC.U8 R13, c[0x0][0x172] ; /* 0x00005c80ff0d7b82 */ /* 0x000f220000000000 */ /*0080*/ IMAD.WIDE.U32 R2, R2, 0x200, RZ ; /* 0x0000020002027825 */ /* 0x001fca00078e00ff */ /*0090*/ IADD3 R4, P0, -R2.reuse, c[0x0][0x160], RZ ; /* 0x0000580002047a10 */ /* 0x040fe40007f1e1ff */ /*00a0*/ IADD3 R2, P1, R2, R5, RZ ; /* 0x0000000502027210 */ /* 0x004fe40007f3e0ff */ /*00b0*/ IADD3.X R6, ~R3, c[0x0][0x164], RZ, P0, !PT ; /* 0x0000590003067a10 */ /* 0x000fe400007fe5ff */ /*00c0*/ ISETP.GT.U32.AND P0, PT, R4, 0x1ff, PT ; /* 0x000001ff0400780c */ /* 0x000fe20003f04070 */ /*00d0*/ IMAD.X R0, RZ, RZ, R3, P1 ; /* 0x000000ffff007224 */ /* 0x000fe400008e0603 */ /*00e0*/ IMAD.WIDE.U32 R2, R2, R7, c[0x0][0x168] ; /* 0x00005a0002027625 */ /* 0x000fe200078e0007 */ /*00f0*/ ISETP.GT.AND.EX P0, PT, R6, RZ, PT, P0 ; /* 0x000000ff0600720c */ /* 0x000fc60003f04300 */ /*0100*/ IMAD R7, R0, 0x3, RZ ; /* 0x0000000300077824 */ /* 0x000fc800078e02ff */ /*0110*/ IMAD.IADD R3, R3, 0x1, R7 ; /* 0x0000000103037824 */ /* 0x000fcc00078e0207 */ /*0120*/ @P0 BRA 0x210 ; /* 0x000000e000000947 */ /* 0x000fea0003800000 */ /*0130*/ ISETP.GT.U32.AND P0, PT, R4, R5, PT ; /* 0x000000050400720c */ /* 0x01afe40003f04070 */ /*0140*/ SHF.R.S32.HI R6, RZ, 0x1f, R4 ; /* 0x0000001fff067819 */ /* 0x000fe40000011404 */ /*0150*/ IADD3 R0, R5, 0x100, RZ ; /* 0x0000010005007810 */ /* 0x000fe40007ffe0ff */ /*0160*/ ISETP.GT.AND.EX P0, PT, R6, RZ, PT, P0 ; /* 0x000000ff0600720c */ /* 0x000fda0003f04300 */ /*0170*/ @P0 STG.E.U8 [R2.64], R9 ; /* 0x0000000902000986 */ /* 0x0001e8000c101104 */ /*0180*/ @P0 STG.E.U8 [R2.64+0x1], R11 ; /* 0x0000010b02000986 */ /* 0x0001e8000c101104 */ /*0190*/ @P0 STG.E.U8 [R2.64+0x2], R13 ; /* 0x0000020d02000986 */ /* 0x0001e2000c101104 */ /*01a0*/ ISETP.GT.U32.AND P0, PT, R4, R0, PT ; /* 0x000000000400720c */ /* 0x000fc80003f04070 */ /*01b0*/ ISETP.GT.AND.EX P0, PT, R6, RZ, PT, P0 ; /* 0x000000ff0600720c */ /* 0x000fda0003f04300 */ /*01c0*/ @!P0 EXIT ; /* 0x000000000000894d */ /* 0x000fea0003800000 */ /*01d0*/ STG.E.U8 [R2.64+0x300], R9 ; /* 0x0003000902007986 */ /* 0x001fe8000c101104 */ /*01e0*/ STG.E.U8 [R2.64+0x301], R11 ; /* 0x0003010b02007986 */ /* 0x000fe8000c101104 */ /*01f0*/ STG.E.U8 [R2.64+0x302], R13 ; /* 0x0003020d02007986 */ /* 0x000fe2000c101104 */ /*0200*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*0210*/ STG.E.U8 [R2.64], R9 ; /* 0x0000000902007986 */ /* 0x01afe8000c101104 */ /*0220*/ STG.E.U8 [R2.64+0x300], R9 ; /* 0x0003000902007986 */ /* 0x000fe8000c101104 */ /*0230*/ STG.E.U8 [R2.64+0x1], R11 ; /* 0x0000010b02007986 */ /* 0x000fe8000c101104 */ /*0240*/ STG.E.U8 [R2.64+0x301], R11 ; /* 0x0003010b02007986 */ /* 0x000fe8000c101104 */ /*0250*/ STG.E.U8 [R2.64+0x2], R13 ; /* 0x0000020d02007986 */ /* 0x000fe8000c101104 */ /*0260*/ STG.E.U8 [R2.64+0x302], R13 ; /* 0x0003020d02007986 */ /* 0x000fe2000c101104 */ /*0270*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*0280*/ BRA 0x280; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*0290*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*02a0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*02b0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*02c0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*02d0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*02e0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*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 */ .......... Function : _ZN3cub17CUB_200700_800_NS6detail8for_each13static_kernelINS2_12policy_hub_t12policy_350_tEmN6thrust20THRUST_200700_800_NS8cuda_cub20__uninitialized_fill7functorINS7_10device_ptrI5COLOREESC_EEEEvT0_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*/ LDC.U8 R9, c[0x0][0x170] ; /* 0x00005c00ff097b82 */ /* 0x000e620000000000 */ /*0030*/ IMAD.MOV.U32 R7, RZ, RZ, 0x3 ; /* 0x00000003ff077424 */ /* 0x000fe200078e00ff */ /*0040*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */ /* 0x000fe20000000a00 */ /*0050*/ S2R R5, SR_TID.X ; /* 0x0000000000057919 */ /* 0x000eaa0000002100 */ /*0060*/ LDC.U8 R11, c[0x0][0x171] ; /* 0x00005c40ff0b7b82 */ /* 0x000ef00000000000 */ /*0070*/ LDC.U8 R13, c[0x0][0x172] ; /* 0x00005c80ff0d7b82 */ /* 0x000f220000000000 */ /*0080*/ IMAD.WIDE.U32 R2, R2, 0x200, RZ ; /* 0x0000020002027825 */ /* 0x001fca00078e00ff */ /*0090*/ IADD3 R4, P0, -R2.reuse, c[0x0][0x160], RZ ; /* 0x0000580002047a10 */ /* 0x040fe40007f1e1ff */ /*00a0*/ IADD3 R2, P1, R2, R5, RZ ; /* 0x0000000502027210 */ /* 0x004fe40007f3e0ff */ /*00b0*/ IADD3.X R6, ~R3, c[0x0][0x164], RZ, P0, !PT ; /* 0x0000590003067a10 */ /* 0x000fe400007fe5ff */ /*00c0*/ ISETP.GT.U32.AND P0, PT, R4, 0x1ff, PT ; /* 0x000001ff0400780c */ /* 0x000fe20003f04070 */ /*00d0*/ IMAD.X R0, RZ, RZ, R3, P1 ; /* 0x000000ffff007224 */ /* 0x000fe400008e0603 */ /*00e0*/ IMAD.WIDE.U32 R2, R2, R7, c[0x0][0x168] ; /* 0x00005a0002027625 */ /* 0x000fe200078e0007 */ /*00f0*/ ISETP.GT.U32.AND.EX P0, PT, R6, RZ, PT, P0 ; /* 0x000000ff0600720c */ /* 0x000fc60003f04100 */ /*0100*/ IMAD R7, R0, 0x3, RZ ; /* 0x0000000300077824 */ /* 0x000fc800078e02ff */ /*0110*/ IMAD.IADD R3, R3, 0x1, R7 ; /* 0x0000000103037824 */ /* 0x000fcc00078e0207 */ /*0120*/ @P0 BRA 0x210 ; /* 0x000000e000000947 */ /* 0x000fea0003800000 */ /*0130*/ ISETP.GT.U32.AND P0, PT, R4, R5, PT ; /* 0x000000050400720c */ /* 0x01afe40003f04070 */ /*0140*/ SHF.R.S32.HI R6, RZ, 0x1f, R4 ; /* 0x0000001fff067819 */ /* 0x000fe40000011404 */ /*0150*/ IADD3 R0, R5, 0x100, RZ ; /* 0x0000010005007810 */ /* 0x000fe40007ffe0ff */ /*0160*/ ISETP.GT.U32.AND.EX P0, PT, R6, RZ, PT, P0 ; /* 0x000000ff0600720c */ /* 0x000fda0003f04100 */ /*0170*/ @P0 STG.E.U8 [R2.64], R9 ; /* 0x0000000902000986 */ /* 0x0001e8000c101104 */ /*0180*/ @P0 STG.E.U8 [R2.64+0x1], R11 ; /* 0x0000010b02000986 */ /* 0x0001e8000c101104 */ /*0190*/ @P0 STG.E.U8 [R2.64+0x2], R13 ; /* 0x0000020d02000986 */ /* 0x0001e2000c101104 */ /*01a0*/ ISETP.GT.U32.AND P0, PT, R4, R0, PT ; /* 0x000000000400720c */ /* 0x000fc80003f04070 */ /*01b0*/ ISETP.GT.U32.AND.EX P0, PT, R6, RZ, PT, P0 ; /* 0x000000ff0600720c */ /* 0x000fda0003f04100 */ /*01c0*/ @!P0 EXIT ; /* 0x000000000000894d */ /* 0x000fea0003800000 */ /*01d0*/ STG.E.U8 [R2.64+0x300], R9 ; /* 0x0003000902007986 */ /* 0x001fe8000c101104 */ /*01e0*/ STG.E.U8 [R2.64+0x301], R11 ; /* 0x0003010b02007986 */ /* 0x000fe8000c101104 */ /*01f0*/ STG.E.U8 [R2.64+0x302], R13 ; /* 0x0003020d02007986 */ /* 0x000fe2000c101104 */ /*0200*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*0210*/ STG.E.U8 [R2.64], R9 ; /* 0x0000000902007986 */ /* 0x01afe8000c101104 */ /*0220*/ STG.E.U8 [R2.64+0x300], R9 ; /* 0x0003000902007986 */ /* 0x000fe8000c101104 */ /*0230*/ STG.E.U8 [R2.64+0x1], R11 ; /* 0x0000010b02007986 */ /* 0x000fe8000c101104 */ /*0240*/ STG.E.U8 [R2.64+0x301], R11 ; /* 0x0003010b02007986 */ /* 0x000fe8000c101104 */ /*0250*/ STG.E.U8 [R2.64+0x2], R13 ; /* 0x0000020d02007986 */ /* 0x000fe8000c101104 */ /*0260*/ STG.E.U8 [R2.64+0x302], R13 ; /* 0x0003020d02007986 */ /* 0x000fe2000c101104 */ /*0270*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*0280*/ BRA 0x280; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*0290*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*02a0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*02b0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*02c0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*02d0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*02e0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*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 */ .......... 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_ptrI5COLOREES6_EEmLj1EEEvT0_T1_SA_,"axG",@progbits,_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrI5COLOREES6_EEmLj1EEEvT0_T1_SA_,comdat .protected _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrI5COLOREES6_EEmLj1EEEvT0_T1_SA_ .globl _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrI5COLOREES6_EEmLj1EEEvT0_T1_SA_ .p2align 8 .type _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrI5COLOREES6_EEmLj1EEEvT0_T1_SA_,@function _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrI5COLOREES6_EEmLj1EEEvT0_T1_SA_: 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 v_mov_b32_e32 v1, 0 s_mul_i32 s3, s3, 3 s_mul_hi_u32 s4, s2, 3 s_mul_i32 s2, s2, 3 s_add_i32 s4, s4, s3 s_clause 0x2 global_load_u8 v3, v1, s[0:1] offset:10 global_load_u8 v4, v1, s[0:1] offset:9 global_load_u8 v5, v1, s[0:1] offset:8 s_load_b64 s[0:1], s[0:1], 0x0 s_waitcnt lgkmcnt(0) s_add_u32 s0, s0, s2 s_addc_u32 s1, s1, s4 s_delay_alu instid0(SALU_CYCLE_1) v_mad_u64_u32 v[1:2], null, v0, 3, s[0:1] s_waitcnt vmcnt(2) flat_store_b8 v[1:2], v3 offset:2 s_waitcnt vmcnt(1) flat_store_b8 v[1:2], v4 offset:1 s_waitcnt vmcnt(0) flat_store_b8 v[1:2], v5 .LBB0_2: s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrI5COLOREES6_EEmLj1EEEvT0_T1_SA_ .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 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_20__uninitialized_fill7functorINS_10device_ptrI5COLOREES6_EEmLj1EEEvT0_T1_SA_,"axG",@progbits,_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrI5COLOREES6_EEmLj1EEEvT0_T1_SA_,comdat .Lfunc_end0: .size _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrI5COLOREES6_EEmLj1EEEvT0_T1_SA_, .Lfunc_end0-_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrI5COLOREES6_EEmLj1EEEvT0_T1_SA_ .section .AMDGPU.csdata,"",@progbits .section .text._ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrI5COLOREEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESD_lSB_EET0_RNS0_16execution_policyIT_EESH_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSH_SM_SM_,"axG",@progbits,_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrI5COLOREEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESD_lSB_EET0_RNS0_16execution_policyIT_EESH_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSH_SM_SM_,comdat .protected _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrI5COLOREEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESD_lSB_EET0_RNS0_16execution_policyIT_EESH_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSH_SM_SM_ .globl _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrI5COLOREEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESD_lSB_EET0_RNS0_16execution_policyIT_EESH_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSH_SM_SM_ .p2align 8 .type _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrI5COLOREEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESD_lSB_EET0_RNS0_16execution_policyIT_EESH_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSH_SM_SM_,@function _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrI5COLOREEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESD_lSB_EET0_RNS0_16execution_policyIT_EESH_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSH_SM_SM_: 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 s_mul_i32 s3, s3, 3 s_mul_hi_u32 s0, s2, 3 s_mul_i32 s2, s2, 3 s_add_i32 s1, s0, s3 s_waitcnt lgkmcnt(0) s_add_u32 s0, s4, s2 s_addc_u32 s1, s5, s1 s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1) v_mad_u64_u32 v[1:2], null, v0, 3, s[0:1] s_lshr_b32 s0, s6, 8 v_dual_mov_b32 v0, s6 :: v_dual_mov_b32 v3, s0 s_clause 0x2 flat_store_b8 v[1:2], v0 flat_store_b8 v[1:2], v3 offset:1 flat_store_d16_hi_b8 v[1:2], v0 offset:2 .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_ptrI5COLOREEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESD_lSB_EET0_RNS0_16execution_policyIT_EESH_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSH_SM_SM_ .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 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 .section .text._ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrI5COLOREEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESD_lSB_EET0_RNS0_16execution_policyIT_EESH_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSH_SM_SM_,"axG",@progbits,_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrI5COLOREEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESD_lSB_EET0_RNS0_16execution_policyIT_EESH_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSH_SM_SM_,comdat .Lfunc_end1: .size _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrI5COLOREEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESD_lSB_EET0_RNS0_16execution_policyIT_EESH_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSH_SM_SM_, .Lfunc_end1-_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_11__transform17unary_transform_fINS_17counting_iteratorIlNS_11use_defaultES6_S6_EENS_6detail15normal_iteratorINS_10device_ptrI5COLOREEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESD_lSB_EET0_RNS0_16execution_policyIT_EESH_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSH_SM_SM_ .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_ptrI5COLOREES6_EEmLj1EEEvT0_T1_SA_ .private_segment_fixed_size: 0 .sgpr_count: 18 .sgpr_spill_count: 0 .symbol: _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrI5COLOREES6_EEmLj1EEEvT0_T1_SA_.kd .uniform_work_group_size: 1 .uses_dynamic_stack: false .vgpr_count: 6 .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_ptrI5COLOREEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESD_lSB_EET0_RNS0_16execution_policyIT_EESH_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSH_SM_SM_ .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_ptrI5COLOREEEENS3_14no_stencil_tagEZNS0_6fill_nINS0_3tagESD_lSB_EET0_RNS0_16execution_policyIT_EESH_T1_RKT2_EUllE_NS3_21always_true_predicateEEElLj1EEEvSH_SM_SM_.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 CUDA source code to CUDA device assembly.
#include "includes.h" // helper for CUDA error handling __global__ void getLowerAAt( const double* A, double* S, std::size_t imageNum, std::size_t pixelNum ) { std::size_t row = blockIdx.x; std::size_t col = blockIdx.y * blockDim.x + threadIdx.x; if(row >= imageNum || col >= imageNum) { return; } S[row * imageNum + col] = 0.0; for(std::size_t i = 0; i < pixelNum; ++i) { S[row * imageNum + col] += A[row * pixelNum + i] * A[col * pixelNum + i]; } }
code for sm_80 Function : _Z11getLowerAAtPKdPdmm .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 R8, SR_CTAID.Y ; /* 0x0000000000087919 */ /* 0x000e280000002600 */ /*0020*/ S2R R9, SR_TID.X ; /* 0x0000000000097919 */ /* 0x000e280000002100 */ /*0030*/ S2R R13, SR_CTAID.X ; /* 0x00000000000d7919 */ /* 0x000e620000002500 */ /*0040*/ IMAD R8, R8, c[0x0][0x0], R9 ; /* 0x0000000008087a24 */ /* 0x001fe200078e0209 */ /*0050*/ ISETP.GE.U32.AND P0, PT, R13, c[0x0][0x170], PT ; /* 0x00005c000d007a0c */ /* 0x002fc80003f06070 */ /*0060*/ ISETP.GE.U32.AND P1, PT, R8, c[0x0][0x170], PT ; /* 0x00005c0008007a0c */ /* 0x000fe40003f26070 */ /*0070*/ ISETP.GE.U32.AND.EX P0, PT, RZ, c[0x0][0x174], PT, P0 ; /* 0x00005d00ff007a0c */ /* 0x000fc80003f06100 */ /*0080*/ ISETP.GE.U32.OR.EX P0, PT, RZ, c[0x0][0x174], P0, P1 ; /* 0x00005d00ff007a0c */ /* 0x000fda0000706510 */ /*0090*/ @P0 EXIT ; /* 0x000000000000094d */ /* 0x000fea0003800000 */ /*00a0*/ IMAD.MOV.U32 R9, RZ, RZ, RZ ; /* 0x000000ffff097224 */ /* 0x000fe200078e00ff */ /*00b0*/ ISETP.NE.U32.AND P0, PT, RZ, c[0x0][0x178], PT ; /* 0x00005e00ff007a0c */ /* 0x000fe20003f05070 */ /*00c0*/ ULDC.64 UR6, c[0x0][0x118] ; /* 0x0000460000067ab9 */ /* 0x000fe40000000a00 */ /*00d0*/ IMAD.WIDE.U32 R4, R13, c[0x0][0x170], R8 ; /* 0x00005c000d047a25 */ /* 0x000fe200078e0008 */ /*00e0*/ ISETP.NE.AND.EX P0, PT, RZ, c[0x0][0x17c], PT, P0 ; /* 0x00005f00ff007a0c */ /* 0x000fc60003f05300 */ /*00f0*/ IMAD R3, R13, c[0x0][0x174], R5 ; /* 0x00005d000d037a24 */ /* 0x000fe200078e0205 */ /*0100*/ LEA R2, P1, R4, c[0x0][0x168], 0x3 ; /* 0x00005a0004027a11 */ /* 0x000fc800078218ff */ /*0110*/ LEA.HI.X R3, R4, c[0x0][0x16c], R3, 0x3, P1 ; /* 0x00005b0004037a11 */ /* 0x000fca00008f1c03 */ /*0120*/ STG.E.64 [R2.64], RZ ; /* 0x000000ff02007986 */ /* 0x0001e2000c101b06 */ /*0130*/ @!P0 EXIT ; /* 0x000000000000894d */ /* 0x000fea0003800000 */ /*0140*/ IMAD.MOV.U32 R0, RZ, RZ, c[0x0][0x178] ; /* 0x00005e00ff007624 */ /* 0x000fe200078e00ff */ /*0150*/ UMOV UR4, URZ ; /* 0x0000003f00047c82 */ /* 0x000fe20008000000 */ /*0160*/ IMAD.MOV.U32 R4, RZ, RZ, c[0x0][0x17c] ; /* 0x00005f00ff047624 */ /* 0x000fe200078e00ff */ /*0170*/ UMOV UR5, URZ ; /* 0x0000003f00057c82 */ /* 0x000fe20008000000 */ /*0180*/ IMAD.WIDE.U32 R6, R8, c[0x0][0x178], RZ ; /* 0x00005e0008067a25 */ /* 0x000fe200078e00ff */ /*0190*/ IADD3 R5, P0, R0.reuse, -0x1, RZ ; /* 0xffffffff00057810 */ /* 0x040fe20007f1e0ff */ /*01a0*/ CS2R R16, SRZ ; /* 0x0000000000107805 */ /* 0x000fe2000001ff00 */ /*01b0*/ LOP3.LUT R0, R0, 0x3, RZ, 0xc0, !PT ; /* 0x0000000300007812 */ /* 0x000fe200078ec0ff */ /*01c0*/ IMAD R15, R8, c[0x0][0x17c], R7 ; /* 0x00005f00080f7a24 */ /* 0x000fe200078e0207 */ /*01d0*/ ISETP.GE.U32.AND P1, PT, R5, 0x3, PT ; /* 0x000000030500780c */ /* 0x000fc40003f26070 */ /*01e0*/ IADD3.X R4, R4, -0x1, RZ, P0, !PT ; /* 0xffffffff04047810 */ /* 0x000fe400007fe4ff */ /*01f0*/ ISETP.NE.U32.AND P0, PT, R0, RZ, PT ; /* 0x000000ff0000720c */ /* 0x000fe40003f05070 */ /*0200*/ ISETP.GE.U32.AND.EX P1, PT, R4, RZ, PT, P1 ; /* 0x000000ff0400720c */ /* 0x000fe20003f26110 */ /*0210*/ IMAD.WIDE.U32 R4, R13, c[0x0][0x178], RZ ; /* 0x00005e000d047a25 */ /* 0x000fe200078e00ff */ /*0220*/ ISETP.NE.AND.EX P0, PT, RZ, RZ, PT, P0 ; /* 0x000000ffff00720c */ /* 0x000fc60003f05300 */ /*0230*/ IMAD R13, R13, c[0x0][0x17c], R5 ; /* 0x00005f000d0d7a24 */ /* 0x000fd000078e0205 */ /*0240*/ @!P1 BRA 0x4d0 ; /* 0x0000028000009947 */ /* 0x000fea0003800000 */ /*0250*/ LEA R10, P2, R4, c[0x0][0x160], 0x3 ; /* 0x00005800040a7a11 */ /* 0x000fe200078418ff */ /*0260*/ CS2R R16, SRZ ; /* 0x0000000000107805 */ /* 0x000fe2000001ff00 */ /*0270*/ LEA R8, P4, R6, c[0x0][0x160], 0x3 ; /* 0x0000580006087a11 */ /* 0x000fe200078818ff */ /*0280*/ UMOV UR4, URZ ; /* 0x0000003f00047c82 */ /* 0x000fe20008000000 */ /*0290*/ IADD3 R14, P1, R0, -c[0x0][0x178], RZ ; /* 0x80005e00000e7a10 */ /* 0x000fe20007f3e0ff */ /*02a0*/ UMOV UR5, URZ ; /* 0x0000003f00057c82 */ /* 0x000fe20008000000 */ /*02b0*/ IADD3 R10, P3, R10, 0x10, RZ ; /* 0x000000100a0a7810 */ /* 0x000fe40007f7e0ff */ /*02c0*/ IADD3 R8, P5, R8, 0x10, RZ ; /* 0x0000001008087810 */ /* 0x000fe20007fbe0ff */ /*02d0*/ IMAD.X R12, RZ, RZ, ~c[0x0][0x17c], P1 ; /* 0x80005f00ff0c7624 */ /* 0x000fe200008e06ff */ /*02e0*/ LEA.HI.X R11, R4, c[0x0][0x164], R13, 0x3, P2 ; /* 0x00005900040b7a11 */ /* 0x000fc400010f1c0d */ /*02f0*/ LEA.HI.X R9, R6, c[0x0][0x164], R15, 0x3, P4 ; /* 0x0000590006097a11 */ /* 0x000fc600020f1c0f */ /*0300*/ IMAD.X R11, RZ, RZ, R11, P3 ; /* 0x000000ffff0b7224 */ /* 0x000fe400018e060b */ /*0310*/ IMAD.X R9, RZ, RZ, R9, P5 ; /* 0x000000ffff097224 */ /* 0x000fca00028e0609 */ /*0320*/ LDG.E.64 R18, [R8.64+-0x10] ; /* 0xfffff00608127981 */ /* 0x004ea8000c1e1b00 */ /*0330*/ LDG.E.64 R20, [R10.64+-0x10] ; /* 0xfffff0060a147981 */ /* 0x000ea4000c1e1b00 */ /*0340*/ DFMA R18, R18, R20, R16 ; /* 0x000000141212722b */ /* 0x004e4e0000000010 */ /*0350*/ STG.E.64 [R2.64], R18 ; /* 0x0000001202007986 */ /* 0x0023e8000c101b06 */ /*0360*/ LDG.E.64 R16, [R8.64+-0x8] ; /* 0xfffff80608107981 */ /* 0x000ea8000c1e1b00 */ /*0370*/ LDG.E.64 R20, [R10.64+-0x8] ; /* 0xfffff8060a147981 */ /* 0x000ea4000c1e1b00 */ /*0380*/ DFMA R20, R16, R20, R18 ; /* 0x000000141014722b */ /* 0x004e8e0000000012 */ /*0390*/ STG.E.64 [R2.64], R20 ; /* 0x0000001402007986 */ /* 0x0045e8000c101b06 */ /*03a0*/ LDG.E.64 R16, [R8.64] ; /* 0x0000000608107981 */ /* 0x000ee8000c1e1b00 */ /*03b0*/ LDG.E.64 R22, [R10.64] ; /* 0x000000060a167981 */ /* 0x000ee2000c1e1b00 */ /*03c0*/ UIADD3 UR4, UP0, UR4, 0x4, URZ ; /* 0x0000000404047890 */ /* 0x000fc8000ff1e03f */ /*03d0*/ UIADD3.X UR5, URZ, UR5, URZ, UP0, !UPT ; /* 0x000000053f057290 */ /* 0x000fe200087fe43f */ /*03e0*/ DFMA R22, R16, R22, R20 ; /* 0x000000161016722b */ /* 0x008ece0000000014 */ /*03f0*/ STG.E.64 [R2.64], R22 ; /* 0x0000001602007986 */ /* 0x0085e8000c101b06 */ /*0400*/ LDG.E.64 R16, [R8.64+0x8] ; /* 0x0000080608107981 */ /* 0x000728000c1e1b00 */ /*0410*/ LDG.E.64 R24, [R10.64+0x8] ; /* 0x000008060a187981 */ /* 0x000b22000c1e1b00 */ /*0420*/ IADD3 R18, P2, R14, UR4, RZ ; /* 0x000000040e127c10 */ /* 0x002fc8000ff5e0ff */ /*0430*/ ISETP.NE.U32.AND P1, PT, R18, RZ, PT ; /* 0x000000ff1200720c */ /* 0x000fe40003f25070 */ /*0440*/ IADD3.X R18, R12, UR5, RZ, P2, !PT ; /* 0x000000050c127c10 */ /* 0x000fe400097fe4ff */ /*0450*/ IADD3 R8, P3, R8, 0x20, RZ ; /* 0x0000002008087810 */ /* 0x008fe40007f7e0ff */ /*0460*/ ISETP.NE.AND.EX P1, PT, R18, RZ, PT, P1 ; /* 0x000000ff1200720c */ /* 0x000fe40003f25310 */ /*0470*/ IADD3 R10, P2, R10, 0x20, RZ ; /* 0x000000200a0a7810 */ /* 0x020fe20007f5e0ff */ /*0480*/ IMAD.X R9, RZ, RZ, R9, P3 ; /* 0x000000ffff097224 */ /* 0x000fc800018e0609 */ /*0490*/ IMAD.X R11, RZ, RZ, R11, P2 ; /* 0x000000ffff0b7224 */ /* 0x000fe200010e060b */ /*04a0*/ DFMA R16, R16, R24, R22 ; /* 0x000000181010722b */ /* 0x010e4e0000000016 */ /*04b0*/ STG.E.64 [R2.64], R16 ; /* 0x0000001002007986 */ /* 0x0025e2000c101b06 */ /*04c0*/ @P1 BRA 0x320 ; /* 0xfffffe5000001947 */ /* 0x000fea000383ffff */ /*04d0*/ @!P0 EXIT ; /* 0x000000000000894d */ /* 0x000fea0003800000 */ /*04e0*/ IADD3 R6, P0, R6, UR4, RZ ; /* 0x0000000406067c10 */ /* 0x000fe4000ff1e0ff */ /*04f0*/ IADD3 R4, P1, R4, UR4, RZ ; /* 0x0000000404047c10 */ /* 0x000fe4000ff3e0ff */ /*0500*/ IADD3 R0, P3, RZ, -R0, RZ ; /* 0x80000000ff007210 */ /* 0x000fe40007f7e0ff */ /*0510*/ IADD3.X R15, R15, UR5, RZ, P0, !PT ; /* 0x000000050f0f7c10 */ /* 0x000fe400087fe4ff */ /*0520*/ LEA R11, P0, R6, c[0x0][0x160], 0x3 ; /* 0x00005800060b7a11 */ /* 0x000fe200078018ff */ /*0530*/ IMAD.X R8, RZ, RZ, -0x1, P3 ; /* 0xffffffffff087424 */ /* 0x000fe200018e06ff */ /*0540*/ LEA R9, P2, R4, c[0x0][0x160], 0x3 ; /* 0x0000580004097a11 */ /* 0x000fc400078418ff */ /*0550*/ IADD3.X R13, R13, UR5, RZ, P1, !PT ; /* 0x000000050d0d7c10 */ /* 0x000fe40008ffe4ff */ /*0560*/ LEA.HI.X R12, R6, c[0x0][0x164], R15, 0x3, P0 ; /* 0x00005900060c7a11 */ /* 0x000fe400000f1c0f */ /*0570*/ LEA.HI.X R10, R4, c[0x0][0x164], R13, 0x3, P2 ; /* 0x00005900040a7a11 */ /* 0x000fe400010f1c0d */ /*0580*/ IMAD.MOV.U32 R4, RZ, RZ, R11 ; /* 0x000000ffff047224 */ /* 0x000fe400078e000b */ /*0590*/ IMAD.MOV.U32 R5, RZ, RZ, R12 ; /* 0x000000ffff057224 */ /* 0x000fe400078e000c */ /*05a0*/ IMAD.MOV.U32 R6, RZ, RZ, R9 ; /* 0x000000ffff067224 */ /* 0x000fe400078e0009 */ /*05b0*/ IMAD.MOV.U32 R7, RZ, RZ, R10 ; /* 0x000000ffff077224 */ /* 0x000fc400078e000a */ /*05c0*/ LDG.E.64 R4, [R4.64] ; /* 0x0000000604047981 */ /* 0x000ee8000c1e1b00 */ /*05d0*/ LDG.E.64 R6, [R6.64] ; /* 0x0000000606067981 */ /* 0x000ee2000c1e1b00 */ /*05e0*/ IADD3 R0, P0, R0, 0x1, RZ ; /* 0x0000000100007810 */ /* 0x000fe40007f1e0ff */ /*05f0*/ IADD3 R11, P1, R11, 0x8, RZ ; /* 0x000000080b0b7810 */ /* 0x000fe40007f3e0ff */ /*0600*/ IADD3 R9, P2, R9, 0x8, RZ ; /* 0x0000000809097810 */ /* 0x000fe20007f5e0ff */ /*0610*/ IMAD.X R8, RZ, RZ, R8, P0 ; /* 0x000000ffff087224 */ /* 0x000fe200000e0608 */ /*0620*/ ISETP.NE.U32.AND P0, PT, R0, RZ, PT ; /* 0x000000ff0000720c */ /* 0x000fe20003f05070 */ /*0630*/ IMAD.X R12, RZ, RZ, R12, P1 ; /* 0x000000ffff0c7224 */ /* 0x000fc400008e060c */ /*0640*/ IMAD.X R10, RZ, RZ, R10, P2 ; /* 0x000000ffff0a7224 */ /* 0x000fe200010e060a */ /*0650*/ ISETP.NE.AND.EX P0, PT, R8, RZ, PT, P0 ; /* 0x000000ff0800720c */ /* 0x000fe20003f05300 */ /*0660*/ DFMA R16, R4, R6, R16 ; /* 0x000000060410722b */ /* 0x00ee4e0000000010 */ /*0670*/ STG.E.64 [R2.64], R16 ; /* 0x0000001002007986 */ /* 0x0023ea000c101b06 */ /*0680*/ @P0 BRA 0x580 ; /* 0xfffffef000000947 */ /* 0x000fea000383ffff */ /*0690*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*06a0*/ BRA 0x6a0; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*06b0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*06c0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*06d0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*06e0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*06f0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0700*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0710*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0720*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0730*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0740*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0750*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0760*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0770*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ ..........
You are a helpful coding assistant specialized in converting CUDA source code to CUDA host assembly.
#include "includes.h" // helper for CUDA error handling __global__ void getLowerAAt( const double* A, double* S, std::size_t imageNum, std::size_t pixelNum ) { std::size_t row = blockIdx.x; std::size_t col = blockIdx.y * blockDim.x + threadIdx.x; if(row >= imageNum || col >= imageNum) { return; } S[row * imageNum + col] = 0.0; for(std::size_t i = 0; i < pixelNum; ++i) { S[row * imageNum + col] += A[row * pixelNum + i] * A[col * pixelNum + i]; } }
.file "tmpxft_0018be0c_00000000-6_getLowerAAt.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 _Z36__device_stub__Z11getLowerAAtPKdPdmmPKdPdmm .type _Z36__device_stub__Z11getLowerAAtPKdPdmmPKdPdmm, @function _Z36__device_stub__Z11getLowerAAtPKdPdmmPKdPdmm: .LFB2051: .cfi_startproc endbr64 subq $152, %rsp .cfi_def_cfa_offset 160 movq %rdi, 24(%rsp) movq %rsi, 16(%rsp) movq %rdx, 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 16(%rsp), %rax movq %rax, 104(%rsp) leaq 8(%rsp), %rax movq %rax, 112(%rsp) movq %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 _Z11getLowerAAtPKdPdmm(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 160 jmp .L3 .L8: call __stack_chk_fail@PLT .cfi_endproc .LFE2051: .size _Z36__device_stub__Z11getLowerAAtPKdPdmmPKdPdmm, .-_Z36__device_stub__Z11getLowerAAtPKdPdmmPKdPdmm .globl _Z11getLowerAAtPKdPdmm .type _Z11getLowerAAtPKdPdmm, @function _Z11getLowerAAtPKdPdmm: .LFB2052: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z36__device_stub__Z11getLowerAAtPKdPdmmPKdPdmm addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2052: .size _Z11getLowerAAtPKdPdmm, .-_Z11getLowerAAtPKdPdmm .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "_Z11getLowerAAtPKdPdmm" .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 _Z11getLowerAAtPKdPdmm(%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" // helper for CUDA error handling __global__ void getLowerAAt( const double* A, double* S, std::size_t imageNum, std::size_t pixelNum ) { std::size_t row = blockIdx.x; std::size_t col = blockIdx.y * blockDim.x + threadIdx.x; if(row >= imageNum || col >= imageNum) { return; } S[row * imageNum + col] = 0.0; for(std::size_t i = 0; i < pixelNum; ++i) { S[row * imageNum + col] += A[row * pixelNum + i] * A[col * pixelNum + i]; } }
#include <hip/hip_runtime.h> #include "includes.h" // helper for CUDA error handling __global__ void getLowerAAt( const double* A, double* S, std::size_t imageNum, std::size_t pixelNum ) { std::size_t row = blockIdx.x; std::size_t col = blockIdx.y * blockDim.x + threadIdx.x; if(row >= imageNum || col >= imageNum) { return; } S[row * imageNum + col] = 0.0; for(std::size_t i = 0; i < pixelNum; ++i) { S[row * imageNum + col] += A[row * pixelNum + i] * A[col * pixelNum + i]; } }
You are a helpful coding assistant specialized in converting HIP source code to AMD device assembly.
#include <hip/hip_runtime.h> #include "includes.h" // helper for CUDA error handling __global__ void getLowerAAt( const double* A, double* S, std::size_t imageNum, std::size_t pixelNum ) { std::size_t row = blockIdx.x; std::size_t col = blockIdx.y * blockDim.x + threadIdx.x; if(row >= imageNum || col >= imageNum) { return; } S[row * imageNum + col] = 0.0; for(std::size_t i = 0; i < pixelNum; ++i) { S[row * imageNum + col] += A[row * pixelNum + i] * A[col * pixelNum + i]; } }
.text .amdgcn_target "amdgcn-amd-amdhsa--gfx1100" .protected _Z11getLowerAAtPKdPdmm .globl _Z11getLowerAAtPKdPdmm .p2align 8 .type _Z11getLowerAAtPKdPdmm,@function _Z11getLowerAAtPKdPdmm: s_clause 0x1 s_load_b32 s2, s[0:1], 0x2c s_load_b64 s[4:5], s[0:1], 0x10 s_waitcnt lgkmcnt(0) s_and_b32 s2, s2, 0xffff s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1) v_mad_u64_u32 v[2:3], null, s15, s2, v[0:1] v_mov_b32_e32 v3, 0 s_mov_b32 s15, 0 v_cmp_lt_u64_e64 s2, s[14:15], s[4:5] s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_cmp_gt_u64_e32 vcc_lo, s[4:5], v[2:3] s_and_b32 s2, s2, vcc_lo s_delay_alu instid0(SALU_CYCLE_1) s_and_saveexec_b32 s3, s2 s_cbranch_execz .LBB0_4 s_clause 0x1 s_load_b64 s[6:7], s[0:1], 0x8 s_load_b64 s[2:3], s[0:1], 0x18 s_mul_i32 s5, s14, s5 s_mul_hi_u32 s8, s14, s4 s_mul_i32 s4, s14, s4 s_add_i32 s5, s8, s5 v_lshlrev_b64 v[0:1], 3, v[2:3] s_lshl_b64 s[4:5], s[4:5], 3 v_mov_b32_e32 v3, 0 s_delay_alu instid0(VALU_DEP_1) v_mov_b32_e32 v4, v3 s_waitcnt lgkmcnt(0) s_add_u32 s4, s6, s4 s_addc_u32 s5, s7, s5 v_add_co_u32 v0, vcc_lo, s4, v0 v_add_co_ci_u32_e32 v1, vcc_lo, s5, v1, vcc_lo s_cmp_eq_u64 s[2:3], 0 global_store_b64 v[0:1], v[3:4], off s_cbranch_scc1 .LBB0_4 global_load_b64 v[3:4], v[0:1], off v_mad_u64_u32 v[5:6], null, v2, s2, 0 s_load_b64 s[0:1], s[0:1], 0x0 s_mul_i32 s4, s14, s3 s_mul_hi_u32 s5, s14, s2 s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1) s_add_i32 s5, s5, s4 s_mul_i32 s4, s14, s2 v_mad_u64_u32 v[7:8], null, v2, s3, v[6:7] s_lshl_b64 s[4:5], s[4:5], 3 v_mov_b32_e32 v2, 0 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1) v_mov_b32_e32 v6, v7 v_lshlrev_b64 v[5:6], 3, v[5:6] s_waitcnt lgkmcnt(0) s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2) v_add_co_u32 v5, vcc_lo, s0, v5 v_add_co_ci_u32_e32 v6, vcc_lo, s1, v6, vcc_lo s_add_u32 s0, s0, s4 s_addc_u32 s1, s1, s5 .p2align 6 .LBB0_3: global_load_b64 v[7:8], v2, s[0:1] global_load_b64 v[9:10], v[5:6], off v_add_co_u32 v5, vcc_lo, v5, 8 s_add_u32 s2, s2, -1 v_add_co_ci_u32_e32 v6, vcc_lo, 0, v6, vcc_lo s_addc_u32 s3, s3, -1 s_add_u32 s0, s0, 8 s_addc_u32 s1, s1, 0 s_cmp_lg_u64 s[2:3], 0 s_waitcnt vmcnt(0) v_fma_f64 v[3:4], v[7:8], v[9:10], v[3:4] global_store_b64 v[0:1], v[3:4], off s_cbranch_scc1 .LBB0_3 .LBB0_4: s_nop 0 s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z11getLowerAAtPKdPdmm .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 0 .amdhsa_next_free_vgpr 11 .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 _Z11getLowerAAtPKdPdmm, .Lfunc_end0-_Z11getLowerAAtPKdPdmm .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: 8 .value_kind: by_value - .offset: 24 .size: 8 .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: _Z11getLowerAAtPKdPdmm .private_segment_fixed_size: 0 .sgpr_count: 18 .sgpr_spill_count: 0 .symbol: _Z11getLowerAAtPKdPdmm.kd .uniform_work_group_size: 1 .uses_dynamic_stack: false .vgpr_count: 11 .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" // helper for CUDA error handling __global__ void getLowerAAt( const double* A, double* S, std::size_t imageNum, std::size_t pixelNum ) { std::size_t row = blockIdx.x; std::size_t col = blockIdx.y * blockDim.x + threadIdx.x; if(row >= imageNum || col >= imageNum) { return; } S[row * imageNum + col] = 0.0; for(std::size_t i = 0; i < pixelNum; ++i) { S[row * imageNum + col] += A[row * pixelNum + i] * A[col * pixelNum + i]; } }
.text .file "getLowerAAt.hip" .globl _Z26__device_stub__getLowerAAtPKdPdmm # -- Begin function _Z26__device_stub__getLowerAAtPKdPdmm .p2align 4, 0x90 .type _Z26__device_stub__getLowerAAtPKdPdmm,@function _Z26__device_stub__getLowerAAtPKdPdmm: # @_Z26__device_stub__getLowerAAtPKdPdmm .cfi_startproc # %bb.0: subq $120, %rsp .cfi_def_cfa_offset 128 movq %rdi, 72(%rsp) movq %rsi, 64(%rsp) movq %rdx, 56(%rsp) movq %rcx, 48(%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 48(%rsp), %rax movq %rax, 104(%rsp) 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 80(%rsp), %r9 movl $_Z11getLowerAAtPKdPdmm, %edi pushq (%rsp) .cfi_adjust_cfa_offset 8 pushq 16(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $136, %rsp .cfi_adjust_cfa_offset -136 retq .Lfunc_end0: .size _Z26__device_stub__getLowerAAtPKdPdmm, .Lfunc_end0-_Z26__device_stub__getLowerAAtPKdPdmm .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 $_Z11getLowerAAtPKdPdmm, %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 _Z11getLowerAAtPKdPdmm,@object # @_Z11getLowerAAtPKdPdmm .section .rodata,"a",@progbits .globl _Z11getLowerAAtPKdPdmm .p2align 3, 0x0 _Z11getLowerAAtPKdPdmm: .quad _Z26__device_stub__getLowerAAtPKdPdmm .size _Z11getLowerAAtPKdPdmm, 8 .type .L__unnamed_1,@object # @0 .section .rodata.str1.1,"aMS",@progbits,1 .L__unnamed_1: .asciz "_Z11getLowerAAtPKdPdmm" .size .L__unnamed_1, 23 .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 _Z26__device_stub__getLowerAAtPKdPdmm .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z11getLowerAAtPKdPdmm .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 : _Z11getLowerAAtPKdPdmm .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 R8, SR_CTAID.Y ; /* 0x0000000000087919 */ /* 0x000e280000002600 */ /*0020*/ S2R R9, SR_TID.X ; /* 0x0000000000097919 */ /* 0x000e280000002100 */ /*0030*/ S2R R13, SR_CTAID.X ; /* 0x00000000000d7919 */ /* 0x000e620000002500 */ /*0040*/ IMAD R8, R8, c[0x0][0x0], R9 ; /* 0x0000000008087a24 */ /* 0x001fe200078e0209 */ /*0050*/ ISETP.GE.U32.AND P0, PT, R13, c[0x0][0x170], PT ; /* 0x00005c000d007a0c */ /* 0x002fc80003f06070 */ /*0060*/ ISETP.GE.U32.AND P1, PT, R8, c[0x0][0x170], PT ; /* 0x00005c0008007a0c */ /* 0x000fe40003f26070 */ /*0070*/ ISETP.GE.U32.AND.EX P0, PT, RZ, c[0x0][0x174], PT, P0 ; /* 0x00005d00ff007a0c */ /* 0x000fc80003f06100 */ /*0080*/ ISETP.GE.U32.OR.EX P0, PT, RZ, c[0x0][0x174], P0, P1 ; /* 0x00005d00ff007a0c */ /* 0x000fda0000706510 */ /*0090*/ @P0 EXIT ; /* 0x000000000000094d */ /* 0x000fea0003800000 */ /*00a0*/ IMAD.MOV.U32 R9, RZ, RZ, RZ ; /* 0x000000ffff097224 */ /* 0x000fe200078e00ff */ /*00b0*/ ISETP.NE.U32.AND P0, PT, RZ, c[0x0][0x178], PT ; /* 0x00005e00ff007a0c */ /* 0x000fe20003f05070 */ /*00c0*/ ULDC.64 UR6, c[0x0][0x118] ; /* 0x0000460000067ab9 */ /* 0x000fe40000000a00 */ /*00d0*/ IMAD.WIDE.U32 R4, R13, c[0x0][0x170], R8 ; /* 0x00005c000d047a25 */ /* 0x000fe200078e0008 */ /*00e0*/ ISETP.NE.AND.EX P0, PT, RZ, c[0x0][0x17c], PT, P0 ; /* 0x00005f00ff007a0c */ /* 0x000fc60003f05300 */ /*00f0*/ IMAD R3, R13, c[0x0][0x174], R5 ; /* 0x00005d000d037a24 */ /* 0x000fe200078e0205 */ /*0100*/ LEA R2, P1, R4, c[0x0][0x168], 0x3 ; /* 0x00005a0004027a11 */ /* 0x000fc800078218ff */ /*0110*/ LEA.HI.X R3, R4, c[0x0][0x16c], R3, 0x3, P1 ; /* 0x00005b0004037a11 */ /* 0x000fca00008f1c03 */ /*0120*/ STG.E.64 [R2.64], RZ ; /* 0x000000ff02007986 */ /* 0x0001e2000c101b06 */ /*0130*/ @!P0 EXIT ; /* 0x000000000000894d */ /* 0x000fea0003800000 */ /*0140*/ IMAD.MOV.U32 R0, RZ, RZ, c[0x0][0x178] ; /* 0x00005e00ff007624 */ /* 0x000fe200078e00ff */ /*0150*/ UMOV UR4, URZ ; /* 0x0000003f00047c82 */ /* 0x000fe20008000000 */ /*0160*/ IMAD.MOV.U32 R4, RZ, RZ, c[0x0][0x17c] ; /* 0x00005f00ff047624 */ /* 0x000fe200078e00ff */ /*0170*/ UMOV UR5, URZ ; /* 0x0000003f00057c82 */ /* 0x000fe20008000000 */ /*0180*/ IMAD.WIDE.U32 R6, R8, c[0x0][0x178], RZ ; /* 0x00005e0008067a25 */ /* 0x000fe200078e00ff */ /*0190*/ IADD3 R5, P0, R0.reuse, -0x1, RZ ; /* 0xffffffff00057810 */ /* 0x040fe20007f1e0ff */ /*01a0*/ CS2R R16, SRZ ; /* 0x0000000000107805 */ /* 0x000fe2000001ff00 */ /*01b0*/ LOP3.LUT R0, R0, 0x3, RZ, 0xc0, !PT ; /* 0x0000000300007812 */ /* 0x000fe200078ec0ff */ /*01c0*/ IMAD R15, R8, c[0x0][0x17c], R7 ; /* 0x00005f00080f7a24 */ /* 0x000fe200078e0207 */ /*01d0*/ ISETP.GE.U32.AND P1, PT, R5, 0x3, PT ; /* 0x000000030500780c */ /* 0x000fc40003f26070 */ /*01e0*/ IADD3.X R4, R4, -0x1, RZ, P0, !PT ; /* 0xffffffff04047810 */ /* 0x000fe400007fe4ff */ /*01f0*/ ISETP.NE.U32.AND P0, PT, R0, RZ, PT ; /* 0x000000ff0000720c */ /* 0x000fe40003f05070 */ /*0200*/ ISETP.GE.U32.AND.EX P1, PT, R4, RZ, PT, P1 ; /* 0x000000ff0400720c */ /* 0x000fe20003f26110 */ /*0210*/ IMAD.WIDE.U32 R4, R13, c[0x0][0x178], RZ ; /* 0x00005e000d047a25 */ /* 0x000fe200078e00ff */ /*0220*/ ISETP.NE.AND.EX P0, PT, RZ, RZ, PT, P0 ; /* 0x000000ffff00720c */ /* 0x000fc60003f05300 */ /*0230*/ IMAD R13, R13, c[0x0][0x17c], R5 ; /* 0x00005f000d0d7a24 */ /* 0x000fd000078e0205 */ /*0240*/ @!P1 BRA 0x4d0 ; /* 0x0000028000009947 */ /* 0x000fea0003800000 */ /*0250*/ LEA R10, P2, R4, c[0x0][0x160], 0x3 ; /* 0x00005800040a7a11 */ /* 0x000fe200078418ff */ /*0260*/ CS2R R16, SRZ ; /* 0x0000000000107805 */ /* 0x000fe2000001ff00 */ /*0270*/ LEA R8, P4, R6, c[0x0][0x160], 0x3 ; /* 0x0000580006087a11 */ /* 0x000fe200078818ff */ /*0280*/ UMOV UR4, URZ ; /* 0x0000003f00047c82 */ /* 0x000fe20008000000 */ /*0290*/ IADD3 R14, P1, R0, -c[0x0][0x178], RZ ; /* 0x80005e00000e7a10 */ /* 0x000fe20007f3e0ff */ /*02a0*/ UMOV UR5, URZ ; /* 0x0000003f00057c82 */ /* 0x000fe20008000000 */ /*02b0*/ IADD3 R10, P3, R10, 0x10, RZ ; /* 0x000000100a0a7810 */ /* 0x000fe40007f7e0ff */ /*02c0*/ IADD3 R8, P5, R8, 0x10, RZ ; /* 0x0000001008087810 */ /* 0x000fe20007fbe0ff */ /*02d0*/ IMAD.X R12, RZ, RZ, ~c[0x0][0x17c], P1 ; /* 0x80005f00ff0c7624 */ /* 0x000fe200008e06ff */ /*02e0*/ LEA.HI.X R11, R4, c[0x0][0x164], R13, 0x3, P2 ; /* 0x00005900040b7a11 */ /* 0x000fc400010f1c0d */ /*02f0*/ LEA.HI.X R9, R6, c[0x0][0x164], R15, 0x3, P4 ; /* 0x0000590006097a11 */ /* 0x000fc600020f1c0f */ /*0300*/ IMAD.X R11, RZ, RZ, R11, P3 ; /* 0x000000ffff0b7224 */ /* 0x000fe400018e060b */ /*0310*/ IMAD.X R9, RZ, RZ, R9, P5 ; /* 0x000000ffff097224 */ /* 0x000fca00028e0609 */ /*0320*/ LDG.E.64 R18, [R8.64+-0x10] ; /* 0xfffff00608127981 */ /* 0x004ea8000c1e1b00 */ /*0330*/ LDG.E.64 R20, [R10.64+-0x10] ; /* 0xfffff0060a147981 */ /* 0x000ea4000c1e1b00 */ /*0340*/ DFMA R18, R18, R20, R16 ; /* 0x000000141212722b */ /* 0x004e4e0000000010 */ /*0350*/ STG.E.64 [R2.64], R18 ; /* 0x0000001202007986 */ /* 0x0023e8000c101b06 */ /*0360*/ LDG.E.64 R16, [R8.64+-0x8] ; /* 0xfffff80608107981 */ /* 0x000ea8000c1e1b00 */ /*0370*/ LDG.E.64 R20, [R10.64+-0x8] ; /* 0xfffff8060a147981 */ /* 0x000ea4000c1e1b00 */ /*0380*/ DFMA R20, R16, R20, R18 ; /* 0x000000141014722b */ /* 0x004e8e0000000012 */ /*0390*/ STG.E.64 [R2.64], R20 ; /* 0x0000001402007986 */ /* 0x0045e8000c101b06 */ /*03a0*/ LDG.E.64 R16, [R8.64] ; /* 0x0000000608107981 */ /* 0x000ee8000c1e1b00 */ /*03b0*/ LDG.E.64 R22, [R10.64] ; /* 0x000000060a167981 */ /* 0x000ee2000c1e1b00 */ /*03c0*/ UIADD3 UR4, UP0, UR4, 0x4, URZ ; /* 0x0000000404047890 */ /* 0x000fc8000ff1e03f */ /*03d0*/ UIADD3.X UR5, URZ, UR5, URZ, UP0, !UPT ; /* 0x000000053f057290 */ /* 0x000fe200087fe43f */ /*03e0*/ DFMA R22, R16, R22, R20 ; /* 0x000000161016722b */ /* 0x008ece0000000014 */ /*03f0*/ STG.E.64 [R2.64], R22 ; /* 0x0000001602007986 */ /* 0x0085e8000c101b06 */ /*0400*/ LDG.E.64 R16, [R8.64+0x8] ; /* 0x0000080608107981 */ /* 0x000728000c1e1b00 */ /*0410*/ LDG.E.64 R24, [R10.64+0x8] ; /* 0x000008060a187981 */ /* 0x000b22000c1e1b00 */ /*0420*/ IADD3 R18, P2, R14, UR4, RZ ; /* 0x000000040e127c10 */ /* 0x002fc8000ff5e0ff */ /*0430*/ ISETP.NE.U32.AND P1, PT, R18, RZ, PT ; /* 0x000000ff1200720c */ /* 0x000fe40003f25070 */ /*0440*/ IADD3.X R18, R12, UR5, RZ, P2, !PT ; /* 0x000000050c127c10 */ /* 0x000fe400097fe4ff */ /*0450*/ IADD3 R8, P3, R8, 0x20, RZ ; /* 0x0000002008087810 */ /* 0x008fe40007f7e0ff */ /*0460*/ ISETP.NE.AND.EX P1, PT, R18, RZ, PT, P1 ; /* 0x000000ff1200720c */ /* 0x000fe40003f25310 */ /*0470*/ IADD3 R10, P2, R10, 0x20, RZ ; /* 0x000000200a0a7810 */ /* 0x020fe20007f5e0ff */ /*0480*/ IMAD.X R9, RZ, RZ, R9, P3 ; /* 0x000000ffff097224 */ /* 0x000fc800018e0609 */ /*0490*/ IMAD.X R11, RZ, RZ, R11, P2 ; /* 0x000000ffff0b7224 */ /* 0x000fe200010e060b */ /*04a0*/ DFMA R16, R16, R24, R22 ; /* 0x000000181010722b */ /* 0x010e4e0000000016 */ /*04b0*/ STG.E.64 [R2.64], R16 ; /* 0x0000001002007986 */ /* 0x0025e2000c101b06 */ /*04c0*/ @P1 BRA 0x320 ; /* 0xfffffe5000001947 */ /* 0x000fea000383ffff */ /*04d0*/ @!P0 EXIT ; /* 0x000000000000894d */ /* 0x000fea0003800000 */ /*04e0*/ IADD3 R6, P0, R6, UR4, RZ ; /* 0x0000000406067c10 */ /* 0x000fe4000ff1e0ff */ /*04f0*/ IADD3 R4, P1, R4, UR4, RZ ; /* 0x0000000404047c10 */ /* 0x000fe4000ff3e0ff */ /*0500*/ IADD3 R0, P3, RZ, -R0, RZ ; /* 0x80000000ff007210 */ /* 0x000fe40007f7e0ff */ /*0510*/ IADD3.X R15, R15, UR5, RZ, P0, !PT ; /* 0x000000050f0f7c10 */ /* 0x000fe400087fe4ff */ /*0520*/ LEA R11, P0, R6, c[0x0][0x160], 0x3 ; /* 0x00005800060b7a11 */ /* 0x000fe200078018ff */ /*0530*/ IMAD.X R8, RZ, RZ, -0x1, P3 ; /* 0xffffffffff087424 */ /* 0x000fe200018e06ff */ /*0540*/ LEA R9, P2, R4, c[0x0][0x160], 0x3 ; /* 0x0000580004097a11 */ /* 0x000fc400078418ff */ /*0550*/ IADD3.X R13, R13, UR5, RZ, P1, !PT ; /* 0x000000050d0d7c10 */ /* 0x000fe40008ffe4ff */ /*0560*/ LEA.HI.X R12, R6, c[0x0][0x164], R15, 0x3, P0 ; /* 0x00005900060c7a11 */ /* 0x000fe400000f1c0f */ /*0570*/ LEA.HI.X R10, R4, c[0x0][0x164], R13, 0x3, P2 ; /* 0x00005900040a7a11 */ /* 0x000fe400010f1c0d */ /*0580*/ IMAD.MOV.U32 R4, RZ, RZ, R11 ; /* 0x000000ffff047224 */ /* 0x000fe400078e000b */ /*0590*/ IMAD.MOV.U32 R5, RZ, RZ, R12 ; /* 0x000000ffff057224 */ /* 0x000fe400078e000c */ /*05a0*/ IMAD.MOV.U32 R6, RZ, RZ, R9 ; /* 0x000000ffff067224 */ /* 0x000fe400078e0009 */ /*05b0*/ IMAD.MOV.U32 R7, RZ, RZ, R10 ; /* 0x000000ffff077224 */ /* 0x000fc400078e000a */ /*05c0*/ LDG.E.64 R4, [R4.64] ; /* 0x0000000604047981 */ /* 0x000ee8000c1e1b00 */ /*05d0*/ LDG.E.64 R6, [R6.64] ; /* 0x0000000606067981 */ /* 0x000ee2000c1e1b00 */ /*05e0*/ IADD3 R0, P0, R0, 0x1, RZ ; /* 0x0000000100007810 */ /* 0x000fe40007f1e0ff */ /*05f0*/ IADD3 R11, P1, R11, 0x8, RZ ; /* 0x000000080b0b7810 */ /* 0x000fe40007f3e0ff */ /*0600*/ IADD3 R9, P2, R9, 0x8, RZ ; /* 0x0000000809097810 */ /* 0x000fe20007f5e0ff */ /*0610*/ IMAD.X R8, RZ, RZ, R8, P0 ; /* 0x000000ffff087224 */ /* 0x000fe200000e0608 */ /*0620*/ ISETP.NE.U32.AND P0, PT, R0, RZ, PT ; /* 0x000000ff0000720c */ /* 0x000fe20003f05070 */ /*0630*/ IMAD.X R12, RZ, RZ, R12, P1 ; /* 0x000000ffff0c7224 */ /* 0x000fc400008e060c */ /*0640*/ IMAD.X R10, RZ, RZ, R10, P2 ; /* 0x000000ffff0a7224 */ /* 0x000fe200010e060a */ /*0650*/ ISETP.NE.AND.EX P0, PT, R8, RZ, PT, P0 ; /* 0x000000ff0800720c */ /* 0x000fe20003f05300 */ /*0660*/ DFMA R16, R4, R6, R16 ; /* 0x000000060410722b */ /* 0x00ee4e0000000010 */ /*0670*/ STG.E.64 [R2.64], R16 ; /* 0x0000001002007986 */ /* 0x0023ea000c101b06 */ /*0680*/ @P0 BRA 0x580 ; /* 0xfffffef000000947 */ /* 0x000fea000383ffff */ /*0690*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*06a0*/ BRA 0x6a0; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*06b0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*06c0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*06d0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*06e0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*06f0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0700*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0710*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0720*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0730*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0740*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0750*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0760*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0770*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ ..........
.text .amdgcn_target "amdgcn-amd-amdhsa--gfx1100" .protected _Z11getLowerAAtPKdPdmm .globl _Z11getLowerAAtPKdPdmm .p2align 8 .type _Z11getLowerAAtPKdPdmm,@function _Z11getLowerAAtPKdPdmm: s_clause 0x1 s_load_b32 s2, s[0:1], 0x2c s_load_b64 s[4:5], s[0:1], 0x10 s_waitcnt lgkmcnt(0) s_and_b32 s2, s2, 0xffff s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1) v_mad_u64_u32 v[2:3], null, s15, s2, v[0:1] v_mov_b32_e32 v3, 0 s_mov_b32 s15, 0 v_cmp_lt_u64_e64 s2, s[14:15], s[4:5] s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_cmp_gt_u64_e32 vcc_lo, s[4:5], v[2:3] s_and_b32 s2, s2, vcc_lo s_delay_alu instid0(SALU_CYCLE_1) s_and_saveexec_b32 s3, s2 s_cbranch_execz .LBB0_4 s_clause 0x1 s_load_b64 s[6:7], s[0:1], 0x8 s_load_b64 s[2:3], s[0:1], 0x18 s_mul_i32 s5, s14, s5 s_mul_hi_u32 s8, s14, s4 s_mul_i32 s4, s14, s4 s_add_i32 s5, s8, s5 v_lshlrev_b64 v[0:1], 3, v[2:3] s_lshl_b64 s[4:5], s[4:5], 3 v_mov_b32_e32 v3, 0 s_delay_alu instid0(VALU_DEP_1) v_mov_b32_e32 v4, v3 s_waitcnt lgkmcnt(0) s_add_u32 s4, s6, s4 s_addc_u32 s5, s7, s5 v_add_co_u32 v0, vcc_lo, s4, v0 v_add_co_ci_u32_e32 v1, vcc_lo, s5, v1, vcc_lo s_cmp_eq_u64 s[2:3], 0 global_store_b64 v[0:1], v[3:4], off s_cbranch_scc1 .LBB0_4 global_load_b64 v[3:4], v[0:1], off v_mad_u64_u32 v[5:6], null, v2, s2, 0 s_load_b64 s[0:1], s[0:1], 0x0 s_mul_i32 s4, s14, s3 s_mul_hi_u32 s5, s14, s2 s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1) s_add_i32 s5, s5, s4 s_mul_i32 s4, s14, s2 v_mad_u64_u32 v[7:8], null, v2, s3, v[6:7] s_lshl_b64 s[4:5], s[4:5], 3 v_mov_b32_e32 v2, 0 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1) v_mov_b32_e32 v6, v7 v_lshlrev_b64 v[5:6], 3, v[5:6] s_waitcnt lgkmcnt(0) s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2) v_add_co_u32 v5, vcc_lo, s0, v5 v_add_co_ci_u32_e32 v6, vcc_lo, s1, v6, vcc_lo s_add_u32 s0, s0, s4 s_addc_u32 s1, s1, s5 .p2align 6 .LBB0_3: global_load_b64 v[7:8], v2, s[0:1] global_load_b64 v[9:10], v[5:6], off v_add_co_u32 v5, vcc_lo, v5, 8 s_add_u32 s2, s2, -1 v_add_co_ci_u32_e32 v6, vcc_lo, 0, v6, vcc_lo s_addc_u32 s3, s3, -1 s_add_u32 s0, s0, 8 s_addc_u32 s1, s1, 0 s_cmp_lg_u64 s[2:3], 0 s_waitcnt vmcnt(0) v_fma_f64 v[3:4], v[7:8], v[9:10], v[3:4] global_store_b64 v[0:1], v[3:4], off s_cbranch_scc1 .LBB0_3 .LBB0_4: s_nop 0 s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z11getLowerAAtPKdPdmm .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 0 .amdhsa_next_free_vgpr 11 .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 _Z11getLowerAAtPKdPdmm, .Lfunc_end0-_Z11getLowerAAtPKdPdmm .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: 8 .value_kind: by_value - .offset: 24 .size: 8 .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: _Z11getLowerAAtPKdPdmm .private_segment_fixed_size: 0 .sgpr_count: 18 .sgpr_spill_count: 0 .symbol: _Z11getLowerAAtPKdPdmm.kd .uniform_work_group_size: 1 .uses_dynamic_stack: false .vgpr_count: 11 .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_0018be0c_00000000-6_getLowerAAt.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 _Z36__device_stub__Z11getLowerAAtPKdPdmmPKdPdmm .type _Z36__device_stub__Z11getLowerAAtPKdPdmmPKdPdmm, @function _Z36__device_stub__Z11getLowerAAtPKdPdmmPKdPdmm: .LFB2051: .cfi_startproc endbr64 subq $152, %rsp .cfi_def_cfa_offset 160 movq %rdi, 24(%rsp) movq %rsi, 16(%rsp) movq %rdx, 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 16(%rsp), %rax movq %rax, 104(%rsp) leaq 8(%rsp), %rax movq %rax, 112(%rsp) movq %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 _Z11getLowerAAtPKdPdmm(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 160 jmp .L3 .L8: call __stack_chk_fail@PLT .cfi_endproc .LFE2051: .size _Z36__device_stub__Z11getLowerAAtPKdPdmmPKdPdmm, .-_Z36__device_stub__Z11getLowerAAtPKdPdmmPKdPdmm .globl _Z11getLowerAAtPKdPdmm .type _Z11getLowerAAtPKdPdmm, @function _Z11getLowerAAtPKdPdmm: .LFB2052: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z36__device_stub__Z11getLowerAAtPKdPdmmPKdPdmm addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2052: .size _Z11getLowerAAtPKdPdmm, .-_Z11getLowerAAtPKdPdmm .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "_Z11getLowerAAtPKdPdmm" .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 _Z11getLowerAAtPKdPdmm(%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 "getLowerAAt.hip" .globl _Z26__device_stub__getLowerAAtPKdPdmm # -- Begin function _Z26__device_stub__getLowerAAtPKdPdmm .p2align 4, 0x90 .type _Z26__device_stub__getLowerAAtPKdPdmm,@function _Z26__device_stub__getLowerAAtPKdPdmm: # @_Z26__device_stub__getLowerAAtPKdPdmm .cfi_startproc # %bb.0: subq $120, %rsp .cfi_def_cfa_offset 128 movq %rdi, 72(%rsp) movq %rsi, 64(%rsp) movq %rdx, 56(%rsp) movq %rcx, 48(%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 48(%rsp), %rax movq %rax, 104(%rsp) 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 80(%rsp), %r9 movl $_Z11getLowerAAtPKdPdmm, %edi pushq (%rsp) .cfi_adjust_cfa_offset 8 pushq 16(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $136, %rsp .cfi_adjust_cfa_offset -136 retq .Lfunc_end0: .size _Z26__device_stub__getLowerAAtPKdPdmm, .Lfunc_end0-_Z26__device_stub__getLowerAAtPKdPdmm .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 $_Z11getLowerAAtPKdPdmm, %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 _Z11getLowerAAtPKdPdmm,@object # @_Z11getLowerAAtPKdPdmm .section .rodata,"a",@progbits .globl _Z11getLowerAAtPKdPdmm .p2align 3, 0x0 _Z11getLowerAAtPKdPdmm: .quad _Z26__device_stub__getLowerAAtPKdPdmm .size _Z11getLowerAAtPKdPdmm, 8 .type .L__unnamed_1,@object # @0 .section .rodata.str1.1,"aMS",@progbits,1 .L__unnamed_1: .asciz "_Z11getLowerAAtPKdPdmm" .size .L__unnamed_1, 23 .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 _Z26__device_stub__getLowerAAtPKdPdmm .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z11getLowerAAtPKdPdmm .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 dynamicReverse(int *d, int n) { extern __shared__ int s[]; int t = threadIdx.x; int tr = n - t - 1; s[t] = d[t]; __syncthreads(); d[t] = s[tr]; }
code for sm_80 Function : _Z14dynamicReversePii .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 R7, SR_TID.X ; /* 0x0000000000077919 */ /* 0x000e220000002100 */ /*0020*/ HFMA2.MMA R2, -RZ, RZ, 0, 2.384185791015625e-07 ; /* 0x00000004ff027435 */ /* 0x000fe200000001ff */ /*0030*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */ /* 0x000fd20000000a00 */ /*0040*/ IMAD.WIDE R2, R7, R2, c[0x0][0x160] ; /* 0x0000580007027625 */ /* 0x001fca00078e0202 */ /*0050*/ LDG.E R4, [R2.64] ; /* 0x0000000402047981 */ /* 0x000ea2000c1e1900 */ /*0060*/ LOP3.LUT R0, RZ, R7, RZ, 0x33, !PT ; /* 0x00000007ff007212 */ /* 0x000fc800078e33ff */ /*0070*/ IADD3 R0, R0, c[0x0][0x168], RZ ; /* 0x00005a0000007a10 */ /* 0x000fe20007ffe0ff */ /*0080*/ STS [R7.X4], R4 ; /* 0x0000000407007388 */ /* 0x004fe80000004800 */ /*0090*/ BAR.SYNC.DEFER_BLOCKING 0x0 ; /* 0x0000000000007b1d */ /* 0x000fec0000010000 */ /*00a0*/ LDS R5, [R0.X4] ; /* 0x0000000000057984 */ /* 0x000e280000004800 */ /*00b0*/ STG.E [R2.64], R5 ; /* 0x0000000502007986 */ /* 0x001fe2000c101904 */ /*00c0*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*00d0*/ BRA 0xd0; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*00e0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*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 "includes.h" __global__ void dynamicReverse(int *d, int n) { extern __shared__ int s[]; int t = threadIdx.x; int tr = n - t - 1; s[t] = d[t]; __syncthreads(); d[t] = s[tr]; }
.file "tmpxft_00095197_00000000-6_dynamicReverse.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 _Z35__device_stub__Z14dynamicReversePiiPii .type _Z35__device_stub__Z14dynamicReversePiiPii, @function _Z35__device_stub__Z14dynamicReversePiiPii: .LFB2051: .cfi_startproc endbr64 subq $120, %rsp .cfi_def_cfa_offset 128 movq %rdi, 8(%rsp) movl %esi, 4(%rsp) movq %fs:40, %rax movq %rax, 104(%rsp) xorl %eax, %eax leaq 8(%rsp), %rax movq %rax, 80(%rsp) leaq 4(%rsp), %rax movq %rax, 88(%rsp) movl $1, 32(%rsp) movl $1, 36(%rsp) movl $1, 40(%rsp) movl $1, 44(%rsp) movl $1, 48(%rsp) movl $1, 52(%rsp) leaq 24(%rsp), %rcx leaq 16(%rsp), %rdx leaq 44(%rsp), %rsi leaq 32(%rsp), %rdi call __cudaPopCallConfiguration@PLT testl %eax, %eax je .L7 .L3: movq 104(%rsp), %rax subq %fs:40, %rax jne .L8 addq $120, %rsp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L7: .cfi_restore_state pushq 24(%rsp) .cfi_def_cfa_offset 136 pushq 24(%rsp) .cfi_def_cfa_offset 144 leaq 96(%rsp), %r9 movq 60(%rsp), %rcx movl 68(%rsp), %r8d movq 48(%rsp), %rsi movl 56(%rsp), %edx leaq _Z14dynamicReversePii(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 128 jmp .L3 .L8: call __stack_chk_fail@PLT .cfi_endproc .LFE2051: .size _Z35__device_stub__Z14dynamicReversePiiPii, .-_Z35__device_stub__Z14dynamicReversePiiPii .globl _Z14dynamicReversePii .type _Z14dynamicReversePii, @function _Z14dynamicReversePii: .LFB2052: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z35__device_stub__Z14dynamicReversePiiPii addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2052: .size _Z14dynamicReversePii, .-_Z14dynamicReversePii .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "_Z14dynamicReversePii" .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 _Z14dynamicReversePii(%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 dynamicReverse(int *d, int n) { extern __shared__ int s[]; int t = threadIdx.x; int tr = n - t - 1; s[t] = d[t]; __syncthreads(); d[t] = s[tr]; }
#include <hip/hip_runtime.h> #include "includes.h" __global__ void dynamicReverse(int *d, int n) { extern __shared__ int s[]; int t = threadIdx.x; int tr = n - t - 1; s[t] = d[t]; __syncthreads(); d[t] = s[tr]; }
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 dynamicReverse(int *d, int n) { extern __shared__ int s[]; int t = threadIdx.x; int tr = n - t - 1; s[t] = d[t]; __syncthreads(); d[t] = s[tr]; }
.text .amdgcn_target "amdgcn-amd-amdhsa--gfx1100" .protected _Z14dynamicReversePii .globl _Z14dynamicReversePii .p2align 8 .type _Z14dynamicReversePii,@function _Z14dynamicReversePii: s_load_b64 s[2:3], s[0:1], 0x0 v_lshlrev_b32_e32 v1, 2, v0 s_load_b32 s0, s[0:1], 0x8 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1) v_add_nc_u32_e32 v3, 0, v1 s_waitcnt lgkmcnt(0) global_load_b32 v2, v1, s[2:3] v_xad_u32 v0, v0, -1, s0 v_lshl_add_u32 v0, v0, 2, 0 s_waitcnt vmcnt(0) ds_store_b32 v3, v2 s_waitcnt lgkmcnt(0) s_barrier buffer_gl0_inv ds_load_b32 v0, v0 s_waitcnt lgkmcnt(0) global_store_b32 v1, v0, s[2:3] s_nop 0 s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z14dynamicReversePii .amdhsa_group_segment_fixed_size 0 .amdhsa_private_segment_fixed_size 0 .amdhsa_kernarg_size 12 .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 4 .amdhsa_reserve_vcc 0 .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 _Z14dynamicReversePii, .Lfunc_end0-_Z14dynamicReversePii .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 .group_segment_fixed_size: 0 .kernarg_segment_align: 8 .kernarg_segment_size: 12 .language: OpenCL C .language_version: - 2 - 0 .max_flat_workgroup_size: 1024 .name: _Z14dynamicReversePii .private_segment_fixed_size: 0 .sgpr_count: 4 .sgpr_spill_count: 0 .symbol: _Z14dynamicReversePii.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 dynamicReverse(int *d, int n) { extern __shared__ int s[]; int t = threadIdx.x; int tr = n - t - 1; s[t] = d[t]; __syncthreads(); d[t] = s[tr]; }
.text .file "dynamicReverse.hip" .globl _Z29__device_stub__dynamicReversePii # -- Begin function _Z29__device_stub__dynamicReversePii .p2align 4, 0x90 .type _Z29__device_stub__dynamicReversePii,@function _Z29__device_stub__dynamicReversePii: # @_Z29__device_stub__dynamicReversePii .cfi_startproc # %bb.0: subq $88, %rsp .cfi_def_cfa_offset 96 movq %rdi, 56(%rsp) movl %esi, 4(%rsp) leaq 56(%rsp), %rax movq %rax, 64(%rsp) leaq 4(%rsp), %rax movq %rax, 72(%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 64(%rsp), %r9 movl $_Z14dynamicReversePii, %edi pushq 8(%rsp) .cfi_adjust_cfa_offset 8 pushq 24(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $104, %rsp .cfi_adjust_cfa_offset -104 retq .Lfunc_end0: .size _Z29__device_stub__dynamicReversePii, .Lfunc_end0-_Z29__device_stub__dynamicReversePii .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 $_Z14dynamicReversePii, %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 _Z14dynamicReversePii,@object # @_Z14dynamicReversePii .section .rodata,"a",@progbits .globl _Z14dynamicReversePii .p2align 3, 0x0 _Z14dynamicReversePii: .quad _Z29__device_stub__dynamicReversePii .size _Z14dynamicReversePii, 8 .type .L__unnamed_1,@object # @0 .section .rodata.str1.1,"aMS",@progbits,1 .L__unnamed_1: .asciz "_Z14dynamicReversePii" .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 _Z29__device_stub__dynamicReversePii .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z14dynamicReversePii .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 : _Z14dynamicReversePii .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 R7, SR_TID.X ; /* 0x0000000000077919 */ /* 0x000e220000002100 */ /*0020*/ HFMA2.MMA R2, -RZ, RZ, 0, 2.384185791015625e-07 ; /* 0x00000004ff027435 */ /* 0x000fe200000001ff */ /*0030*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */ /* 0x000fd20000000a00 */ /*0040*/ IMAD.WIDE R2, R7, R2, c[0x0][0x160] ; /* 0x0000580007027625 */ /* 0x001fca00078e0202 */ /*0050*/ LDG.E R4, [R2.64] ; /* 0x0000000402047981 */ /* 0x000ea2000c1e1900 */ /*0060*/ LOP3.LUT R0, RZ, R7, RZ, 0x33, !PT ; /* 0x00000007ff007212 */ /* 0x000fc800078e33ff */ /*0070*/ IADD3 R0, R0, c[0x0][0x168], RZ ; /* 0x00005a0000007a10 */ /* 0x000fe20007ffe0ff */ /*0080*/ STS [R7.X4], R4 ; /* 0x0000000407007388 */ /* 0x004fe80000004800 */ /*0090*/ BAR.SYNC.DEFER_BLOCKING 0x0 ; /* 0x0000000000007b1d */ /* 0x000fec0000010000 */ /*00a0*/ LDS R5, [R0.X4] ; /* 0x0000000000057984 */ /* 0x000e280000004800 */ /*00b0*/ STG.E [R2.64], R5 ; /* 0x0000000502007986 */ /* 0x001fe2000c101904 */ /*00c0*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*00d0*/ BRA 0xd0; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*00e0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*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 _Z14dynamicReversePii .globl _Z14dynamicReversePii .p2align 8 .type _Z14dynamicReversePii,@function _Z14dynamicReversePii: s_load_b64 s[2:3], s[0:1], 0x0 v_lshlrev_b32_e32 v1, 2, v0 s_load_b32 s0, s[0:1], 0x8 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1) v_add_nc_u32_e32 v3, 0, v1 s_waitcnt lgkmcnt(0) global_load_b32 v2, v1, s[2:3] v_xad_u32 v0, v0, -1, s0 v_lshl_add_u32 v0, v0, 2, 0 s_waitcnt vmcnt(0) ds_store_b32 v3, v2 s_waitcnt lgkmcnt(0) s_barrier buffer_gl0_inv ds_load_b32 v0, v0 s_waitcnt lgkmcnt(0) global_store_b32 v1, v0, s[2:3] s_nop 0 s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z14dynamicReversePii .amdhsa_group_segment_fixed_size 0 .amdhsa_private_segment_fixed_size 0 .amdhsa_kernarg_size 12 .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 4 .amdhsa_reserve_vcc 0 .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 _Z14dynamicReversePii, .Lfunc_end0-_Z14dynamicReversePii .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 .group_segment_fixed_size: 0 .kernarg_segment_align: 8 .kernarg_segment_size: 12 .language: OpenCL C .language_version: - 2 - 0 .max_flat_workgroup_size: 1024 .name: _Z14dynamicReversePii .private_segment_fixed_size: 0 .sgpr_count: 4 .sgpr_spill_count: 0 .symbol: _Z14dynamicReversePii.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_00095197_00000000-6_dynamicReverse.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 _Z35__device_stub__Z14dynamicReversePiiPii .type _Z35__device_stub__Z14dynamicReversePiiPii, @function _Z35__device_stub__Z14dynamicReversePiiPii: .LFB2051: .cfi_startproc endbr64 subq $120, %rsp .cfi_def_cfa_offset 128 movq %rdi, 8(%rsp) movl %esi, 4(%rsp) movq %fs:40, %rax movq %rax, 104(%rsp) xorl %eax, %eax leaq 8(%rsp), %rax movq %rax, 80(%rsp) leaq 4(%rsp), %rax movq %rax, 88(%rsp) movl $1, 32(%rsp) movl $1, 36(%rsp) movl $1, 40(%rsp) movl $1, 44(%rsp) movl $1, 48(%rsp) movl $1, 52(%rsp) leaq 24(%rsp), %rcx leaq 16(%rsp), %rdx leaq 44(%rsp), %rsi leaq 32(%rsp), %rdi call __cudaPopCallConfiguration@PLT testl %eax, %eax je .L7 .L3: movq 104(%rsp), %rax subq %fs:40, %rax jne .L8 addq $120, %rsp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L7: .cfi_restore_state pushq 24(%rsp) .cfi_def_cfa_offset 136 pushq 24(%rsp) .cfi_def_cfa_offset 144 leaq 96(%rsp), %r9 movq 60(%rsp), %rcx movl 68(%rsp), %r8d movq 48(%rsp), %rsi movl 56(%rsp), %edx leaq _Z14dynamicReversePii(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 128 jmp .L3 .L8: call __stack_chk_fail@PLT .cfi_endproc .LFE2051: .size _Z35__device_stub__Z14dynamicReversePiiPii, .-_Z35__device_stub__Z14dynamicReversePiiPii .globl _Z14dynamicReversePii .type _Z14dynamicReversePii, @function _Z14dynamicReversePii: .LFB2052: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z35__device_stub__Z14dynamicReversePiiPii addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2052: .size _Z14dynamicReversePii, .-_Z14dynamicReversePii .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "_Z14dynamicReversePii" .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 _Z14dynamicReversePii(%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 "dynamicReverse.hip" .globl _Z29__device_stub__dynamicReversePii # -- Begin function _Z29__device_stub__dynamicReversePii .p2align 4, 0x90 .type _Z29__device_stub__dynamicReversePii,@function _Z29__device_stub__dynamicReversePii: # @_Z29__device_stub__dynamicReversePii .cfi_startproc # %bb.0: subq $88, %rsp .cfi_def_cfa_offset 96 movq %rdi, 56(%rsp) movl %esi, 4(%rsp) leaq 56(%rsp), %rax movq %rax, 64(%rsp) leaq 4(%rsp), %rax movq %rax, 72(%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 64(%rsp), %r9 movl $_Z14dynamicReversePii, %edi pushq 8(%rsp) .cfi_adjust_cfa_offset 8 pushq 24(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $104, %rsp .cfi_adjust_cfa_offset -104 retq .Lfunc_end0: .size _Z29__device_stub__dynamicReversePii, .Lfunc_end0-_Z29__device_stub__dynamicReversePii .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 $_Z14dynamicReversePii, %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 _Z14dynamicReversePii,@object # @_Z14dynamicReversePii .section .rodata,"a",@progbits .globl _Z14dynamicReversePii .p2align 3, 0x0 _Z14dynamicReversePii: .quad _Z29__device_stub__dynamicReversePii .size _Z14dynamicReversePii, 8 .type .L__unnamed_1,@object # @0 .section .rodata.str1.1,"aMS",@progbits,1 .L__unnamed_1: .asciz "_Z14dynamicReversePii" .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 _Z29__device_stub__dynamicReversePii .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z14dynamicReversePii .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<cuda.h> // Device code __global__ void VecAdd(float* A, float* B, float* C, int N){ int i = blockDim.x * blockIdx.x + threadIdx.x; if(i < N){ C[i] = A[i] + B[i]; } } // Host code int main(){ int N = 10; size_t size = N*sizeof(float); // Allocate memory for the host // float* h_A = (float*)malloc(size); // float* h_B = (float*)malloc(size); // float* h_C = (float*)malloc(size); // Another way of writing - Pinned memory float *h_A, *h_B, *h_C; cudaMallocHost(&h_A, size); cudaMallocHost(&h_B, size); cudaMallocHost(&h_C, size); // Initialize the input vectors for(auto i = 0; i < N; i++){ h_A[i] = i; h_B[i] = 2*i; h_C[i] = 0; } // Allocate memory for the device float* d_A; cudaMalloc(&d_A, size); float* d_B; cudaMalloc(&d_B, size); float* d_C; cudaMalloc(&d_C, size); // Copy contents of host to device cudaMemcpy(d_A, h_A, size, cudaMemcpyHostToDevice); cudaMemcpy(d_B, h_B, size, cudaMemcpyHostToDevice); cudaMemcpy(d_C, h_C, size, cudaMemcpyHostToDevice); // Invoke the kernel to do the computation int threadsPerBlock = 256; int blocksPerGrid = (N + threadsPerBlock -1)/threadsPerBlock; VecAdd<<<blocksPerGrid, threadsPerBlock>>>(d_A, d_B, d_C, N); // Copy results from device to host cudaMemcpy(h_C, d_C, size, cudaMemcpyDeviceToHost); // Free the memory cudaFree(d_A); cudaFree(d_B); cudaFree(d_C); // Print values for(auto i = 0; i < N; i++){ std::cout << h_C[i] << std::endl; } // Free Pinned memory cudaFree(h_A); cudaFree(h_B); cudaFree(h_C); return 0; }
code for sm_80 Function : _Z6VecAddPfS_S_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 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.GE.AND P0, PT, R6, c[0x0][0x178], PT ; /* 0x00005e0006007a0c */ /* 0x000fda0003f06270 */ /*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 */ /* 0x000fc800078e0207 */ /*00d0*/ FADD R9, R4, R3 ; /* 0x0000000304097221 */ /* 0x004fca0000000000 */ /*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 */ ..........
You are a helpful coding assistant specialized in converting CUDA source code to CUDA host assembly.
#include<iostream> #include<cuda.h> // Device code __global__ void VecAdd(float* A, float* B, float* C, int N){ int i = blockDim.x * blockIdx.x + threadIdx.x; if(i < N){ C[i] = A[i] + B[i]; } } // Host code int main(){ int N = 10; size_t size = N*sizeof(float); // Allocate memory for the host // float* h_A = (float*)malloc(size); // float* h_B = (float*)malloc(size); // float* h_C = (float*)malloc(size); // Another way of writing - Pinned memory float *h_A, *h_B, *h_C; cudaMallocHost(&h_A, size); cudaMallocHost(&h_B, size); cudaMallocHost(&h_C, size); // Initialize the input vectors for(auto i = 0; i < N; i++){ h_A[i] = i; h_B[i] = 2*i; h_C[i] = 0; } // Allocate memory for the device float* d_A; cudaMalloc(&d_A, size); float* d_B; cudaMalloc(&d_B, size); float* d_C; cudaMalloc(&d_C, size); // Copy contents of host to device cudaMemcpy(d_A, h_A, size, cudaMemcpyHostToDevice); cudaMemcpy(d_B, h_B, size, cudaMemcpyHostToDevice); cudaMemcpy(d_C, h_C, size, cudaMemcpyHostToDevice); // Invoke the kernel to do the computation int threadsPerBlock = 256; int blocksPerGrid = (N + threadsPerBlock -1)/threadsPerBlock; VecAdd<<<blocksPerGrid, threadsPerBlock>>>(d_A, d_B, d_C, N); // Copy results from device to host cudaMemcpy(h_C, d_C, size, cudaMemcpyDeviceToHost); // Free the memory cudaFree(d_A); cudaFree(d_B); cudaFree(d_C); // Print values for(auto i = 0; i < N; i++){ std::cout << h_C[i] << std::endl; } // Free Pinned memory cudaFree(h_A); cudaFree(h_B); cudaFree(h_C); return 0; }
.file "tmpxft_000e94cd_00000000-6_vecadd.cudafe1.cpp" .text #APP .globl _ZSt21ios_base_library_initv #NO_APP .type _ZL26__cudaUnregisterBinaryUtilv, @function _ZL26__cudaUnregisterBinaryUtilv: .LFB3672: .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 .LFE3672: .size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv .globl _Z30__device_stub__Z6VecAddPfS_S_iPfS_S_i .type _Z30__device_stub__Z6VecAddPfS_S_iPfS_S_i, @function _Z30__device_stub__Z6VecAddPfS_S_iPfS_S_i: .LFB3694: .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) 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) 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 _Z6VecAddPfS_S_i(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 160 jmp .L3 .L8: call __stack_chk_fail@PLT .cfi_endproc .LFE3694: .size _Z30__device_stub__Z6VecAddPfS_S_iPfS_S_i, .-_Z30__device_stub__Z6VecAddPfS_S_iPfS_S_i .globl _Z6VecAddPfS_S_i .type _Z6VecAddPfS_S_i, @function _Z6VecAddPfS_S_i: .LFB3695: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z30__device_stub__Z6VecAddPfS_S_iPfS_S_i addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE3695: .size _Z6VecAddPfS_S_i, .-_Z6VecAddPfS_S_i .globl main .type main, @function main: .LFB3669: .cfi_startproc endbr64 pushq %r13 .cfi_def_cfa_offset 16 .cfi_offset 13, -16 pushq %r12 .cfi_def_cfa_offset 24 .cfi_offset 12, -24 pushq %rbp .cfi_def_cfa_offset 32 .cfi_offset 6, -32 pushq %rbx .cfi_def_cfa_offset 40 .cfi_offset 3, -40 subq $88, %rsp .cfi_def_cfa_offset 128 movq %fs:40, %rax movq %rax, 72(%rsp) xorl %eax, %eax movq %rsp, %rdi movl $0, %edx movl $40, %esi call cudaHostAlloc@PLT leaq 8(%rsp), %rdi movl $0, %edx movl $40, %esi call cudaHostAlloc@PLT leaq 16(%rsp), %rdi movl $0, %edx movl $40, %esi call cudaHostAlloc@PLT movl $0, %eax .L12: pxor %xmm0, %xmm0 cvtsi2ssl %eax, %xmm0 movq (%rsp), %rdx movss %xmm0, (%rdx,%rax,4) leal (%rax,%rax), %edx pxor %xmm0, %xmm0 cvtsi2ssl %edx, %xmm0 movq 8(%rsp), %rdx movss %xmm0, (%rdx,%rax,4) movq 16(%rsp), %rdx movl $0x00000000, (%rdx,%rax,4) addq $1, %rax cmpq $10, %rax jne .L12 leaq 24(%rsp), %rdi movl $40, %esi call cudaMalloc@PLT leaq 32(%rsp), %rdi movl $40, %esi call cudaMalloc@PLT leaq 40(%rsp), %rdi movl $40, %esi call cudaMalloc@PLT movl $1, %ecx movl $40, %edx movq (%rsp), %rsi movq 24(%rsp), %rdi call cudaMemcpy@PLT movl $1, %ecx movl $40, %edx movq 8(%rsp), %rsi movq 32(%rsp), %rdi call cudaMemcpy@PLT movl $1, %ecx movl $40, %edx movq 16(%rsp), %rsi movq 40(%rsp), %rdi call cudaMemcpy@PLT movl $256, 60(%rsp) movl $1, 64(%rsp) movl $1, 68(%rsp) movl $1, 48(%rsp) movl $1, 52(%rsp) movl $1, 56(%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 .L23 .L13: movl $2, %ecx movl $40, %edx movq 40(%rsp), %rsi movq 16(%rsp), %rdi call cudaMemcpy@PLT movq 24(%rsp), %rdi call cudaFree@PLT movq 32(%rsp), %rdi call cudaFree@PLT movq 40(%rsp), %rdi call cudaFree@PLT movl $0, %ebp leaq _ZSt4cout(%rip), %r12 jmp .L18 .L23: movl $10, %ecx movq 40(%rsp), %rdx movq 32(%rsp), %rsi movq 24(%rsp), %rdi call _Z30__device_stub__Z6VecAddPfS_S_iPfS_S_i jmp .L13 .L26: movq 72(%rsp), %rax subq %fs:40, %rax jne .L24 call _ZSt16__throw_bad_castv@PLT .L24: call __stack_chk_fail@PLT .L16: movq %r13, %rdi call _ZNKSt5ctypeIcE13_M_widen_initEv@PLT movq 0(%r13), %rax movl $10, %esi movq %r13, %rdi call *48(%rax) movl %eax, %esi .L17: movsbl %sil, %esi movq %rbx, %rdi call _ZNSo3putEc@PLT movq %rax, %rdi call _ZNSo5flushEv@PLT addq $4, %rbp cmpq $40, %rbp je .L25 .L18: movq 16(%rsp), %rax pxor %xmm0, %xmm0 cvtss2sd (%rax,%rbp), %xmm0 movq %r12, %rdi call _ZNSo9_M_insertIdEERSoT_@PLT movq %rax, %rbx movq (%rax), %rax movq -24(%rax), %rax movq 240(%rbx,%rax), %r13 testq %r13, %r13 je .L26 cmpb $0, 56(%r13) je .L16 movzbl 67(%r13), %esi jmp .L17 .L25: movq (%rsp), %rdi call cudaFree@PLT movq 8(%rsp), %rdi call cudaFree@PLT movq 16(%rsp), %rdi call cudaFree@PLT movq 72(%rsp), %rax subq %fs:40, %rax jne .L27 movl $0, %eax addq $88, %rsp .cfi_remember_state .cfi_def_cfa_offset 40 popq %rbx .cfi_def_cfa_offset 32 popq %rbp .cfi_def_cfa_offset 24 popq %r12 .cfi_def_cfa_offset 16 popq %r13 .cfi_def_cfa_offset 8 ret .L27: .cfi_restore_state call __stack_chk_fail@PLT .cfi_endproc .LFE3669: .size main, .-main .section .rodata.str1.1,"aMS",@progbits,1 .LC1: .string "_Z6VecAddPfS_S_i" .text .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB3697: .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 _Z6VecAddPfS_S_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 .LFE3697: .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<iostream> #include<cuda.h> // Device code __global__ void VecAdd(float* A, float* B, float* C, int N){ int i = blockDim.x * blockIdx.x + threadIdx.x; if(i < N){ C[i] = A[i] + B[i]; } } // Host code int main(){ int N = 10; size_t size = N*sizeof(float); // Allocate memory for the host // float* h_A = (float*)malloc(size); // float* h_B = (float*)malloc(size); // float* h_C = (float*)malloc(size); // Another way of writing - Pinned memory float *h_A, *h_B, *h_C; cudaMallocHost(&h_A, size); cudaMallocHost(&h_B, size); cudaMallocHost(&h_C, size); // Initialize the input vectors for(auto i = 0; i < N; i++){ h_A[i] = i; h_B[i] = 2*i; h_C[i] = 0; } // Allocate memory for the device float* d_A; cudaMalloc(&d_A, size); float* d_B; cudaMalloc(&d_B, size); float* d_C; cudaMalloc(&d_C, size); // Copy contents of host to device cudaMemcpy(d_A, h_A, size, cudaMemcpyHostToDevice); cudaMemcpy(d_B, h_B, size, cudaMemcpyHostToDevice); cudaMemcpy(d_C, h_C, size, cudaMemcpyHostToDevice); // Invoke the kernel to do the computation int threadsPerBlock = 256; int blocksPerGrid = (N + threadsPerBlock -1)/threadsPerBlock; VecAdd<<<blocksPerGrid, threadsPerBlock>>>(d_A, d_B, d_C, N); // Copy results from device to host cudaMemcpy(h_C, d_C, size, cudaMemcpyDeviceToHost); // Free the memory cudaFree(d_A); cudaFree(d_B); cudaFree(d_C); // Print values for(auto i = 0; i < N; i++){ std::cout << h_C[i] << std::endl; } // Free Pinned memory cudaFree(h_A); cudaFree(h_B); cudaFree(h_C); return 0; }
#include<iostream> #include<hip/hip_runtime.h> // Device code __global__ void VecAdd(float* A, float* B, float* C, int N){ int i = blockDim.x * blockIdx.x + threadIdx.x; if(i < N){ C[i] = A[i] + B[i]; } } // Host code int main(){ int N = 10; size_t size = N*sizeof(float); // Allocate memory for the host // float* h_A = (float*)malloc(size); // float* h_B = (float*)malloc(size); // float* h_C = (float*)malloc(size); // Another way of writing - Pinned memory float *h_A, *h_B, *h_C; hipHostMalloc(&h_A, size, hipHostMallocDefault); hipHostMalloc(&h_B, size, hipHostMallocDefault); hipHostMalloc(&h_C, size, hipHostMallocDefault); // Initialize the input vectors for(auto i = 0; i < N; i++){ h_A[i] = i; h_B[i] = 2*i; h_C[i] = 0; } // Allocate memory for the device float* d_A; hipMalloc(&d_A, size); float* d_B; hipMalloc(&d_B, size); float* d_C; hipMalloc(&d_C, size); // Copy contents of host to device hipMemcpy(d_A, h_A, size, hipMemcpyHostToDevice); hipMemcpy(d_B, h_B, size, hipMemcpyHostToDevice); hipMemcpy(d_C, h_C, size, hipMemcpyHostToDevice); // Invoke the kernel to do the computation int threadsPerBlock = 256; int blocksPerGrid = (N + threadsPerBlock -1)/threadsPerBlock; VecAdd<<<blocksPerGrid, threadsPerBlock>>>(d_A, d_B, d_C, N); // Copy results from device to host hipMemcpy(h_C, d_C, size, hipMemcpyDeviceToHost); // Free the memory hipFree(d_A); hipFree(d_B); hipFree(d_C); // Print values for(auto i = 0; i < N; i++){ std::cout << h_C[i] << std::endl; } // Free Pinned memory hipFree(h_A); hipFree(h_B); hipFree(h_C); return 0; }
You are a helpful coding assistant specialized in converting HIP source code to AMD device assembly.
#include<iostream> #include<hip/hip_runtime.h> // Device code __global__ void VecAdd(float* A, float* B, float* C, int N){ int i = blockDim.x * blockIdx.x + threadIdx.x; if(i < N){ C[i] = A[i] + B[i]; } } // Host code int main(){ int N = 10; size_t size = N*sizeof(float); // Allocate memory for the host // float* h_A = (float*)malloc(size); // float* h_B = (float*)malloc(size); // float* h_C = (float*)malloc(size); // Another way of writing - Pinned memory float *h_A, *h_B, *h_C; hipHostMalloc(&h_A, size, hipHostMallocDefault); hipHostMalloc(&h_B, size, hipHostMallocDefault); hipHostMalloc(&h_C, size, hipHostMallocDefault); // Initialize the input vectors for(auto i = 0; i < N; i++){ h_A[i] = i; h_B[i] = 2*i; h_C[i] = 0; } // Allocate memory for the device float* d_A; hipMalloc(&d_A, size); float* d_B; hipMalloc(&d_B, size); float* d_C; hipMalloc(&d_C, size); // Copy contents of host to device hipMemcpy(d_A, h_A, size, hipMemcpyHostToDevice); hipMemcpy(d_B, h_B, size, hipMemcpyHostToDevice); hipMemcpy(d_C, h_C, size, hipMemcpyHostToDevice); // Invoke the kernel to do the computation int threadsPerBlock = 256; int blocksPerGrid = (N + threadsPerBlock -1)/threadsPerBlock; VecAdd<<<blocksPerGrid, threadsPerBlock>>>(d_A, d_B, d_C, N); // Copy results from device to host hipMemcpy(h_C, d_C, size, hipMemcpyDeviceToHost); // Free the memory hipFree(d_A); hipFree(d_B); hipFree(d_C); // Print values for(auto i = 0; i < N; i++){ std::cout << h_C[i] << std::endl; } // Free Pinned memory hipFree(h_A); hipFree(h_B); hipFree(h_C); return 0; }
.text .amdgcn_target "amdgcn-amd-amdhsa--gfx1100" .protected _Z6VecAddPfS_S_i .globl _Z6VecAddPfS_S_i .p2align 8 .type _Z6VecAddPfS_S_i,@function _Z6VecAddPfS_S_i: s_clause 0x1 s_load_b32 s2, s[0:1], 0x2c s_load_b32 s3, s[0:1], 0x18 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[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_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 _Z6VecAddPfS_S_i .amdhsa_group_segment_fixed_size 0 .amdhsa_private_segment_fixed_size 0 .amdhsa_kernarg_size 288 .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 _Z6VecAddPfS_S_i, .Lfunc_end0-_Z6VecAddPfS_S_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 - .address_space: global .offset: 16 .size: 8 .value_kind: global_buffer - .offset: 24 .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: _Z6VecAddPfS_S_i .private_segment_fixed_size: 0 .sgpr_count: 18 .sgpr_spill_count: 0 .symbol: _Z6VecAddPfS_S_i.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<iostream> #include<hip/hip_runtime.h> // Device code __global__ void VecAdd(float* A, float* B, float* C, int N){ int i = blockDim.x * blockIdx.x + threadIdx.x; if(i < N){ C[i] = A[i] + B[i]; } } // Host code int main(){ int N = 10; size_t size = N*sizeof(float); // Allocate memory for the host // float* h_A = (float*)malloc(size); // float* h_B = (float*)malloc(size); // float* h_C = (float*)malloc(size); // Another way of writing - Pinned memory float *h_A, *h_B, *h_C; hipHostMalloc(&h_A, size, hipHostMallocDefault); hipHostMalloc(&h_B, size, hipHostMallocDefault); hipHostMalloc(&h_C, size, hipHostMallocDefault); // Initialize the input vectors for(auto i = 0; i < N; i++){ h_A[i] = i; h_B[i] = 2*i; h_C[i] = 0; } // Allocate memory for the device float* d_A; hipMalloc(&d_A, size); float* d_B; hipMalloc(&d_B, size); float* d_C; hipMalloc(&d_C, size); // Copy contents of host to device hipMemcpy(d_A, h_A, size, hipMemcpyHostToDevice); hipMemcpy(d_B, h_B, size, hipMemcpyHostToDevice); hipMemcpy(d_C, h_C, size, hipMemcpyHostToDevice); // Invoke the kernel to do the computation int threadsPerBlock = 256; int blocksPerGrid = (N + threadsPerBlock -1)/threadsPerBlock; VecAdd<<<blocksPerGrid, threadsPerBlock>>>(d_A, d_B, d_C, N); // Copy results from device to host hipMemcpy(h_C, d_C, size, hipMemcpyDeviceToHost); // Free the memory hipFree(d_A); hipFree(d_B); hipFree(d_C); // Print values for(auto i = 0; i < N; i++){ std::cout << h_C[i] << std::endl; } // Free Pinned memory hipFree(h_A); hipFree(h_B); hipFree(h_C); return 0; }
.text .file "vecadd.hip" # Start of file scope inline assembly .globl _ZSt21ios_base_library_initv # End of file scope inline assembly .globl _Z21__device_stub__VecAddPfS_S_i # -- Begin function _Z21__device_stub__VecAddPfS_S_i .p2align 4, 0x90 .type _Z21__device_stub__VecAddPfS_S_i,@function _Z21__device_stub__VecAddPfS_S_i: # @_Z21__device_stub__VecAddPfS_S_i .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) 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) 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 $_Z6VecAddPfS_S_i, %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 _Z21__device_stub__VecAddPfS_S_i, .Lfunc_end0-_Z21__device_stub__VecAddPfS_S_i .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 $160, %rsp .cfi_def_cfa_offset 192 .cfi_offset %rbx, -32 .cfi_offset %r14, -24 .cfi_offset %r15, -16 leaq 40(%rsp), %rdi xorl %ebx, %ebx movl $40, %esi xorl %edx, %edx callq hipHostMalloc leaq 32(%rsp), %rdi movl $40, %esi xorl %edx, %edx callq hipHostMalloc movq %rsp, %rdi movl $40, %esi xorl %edx, %edx callq hipHostMalloc movq 40(%rsp), %rax movq 32(%rsp), %rcx movq (%rsp), %rdx xorl %esi, %esi .p2align 4, 0x90 .LBB1_1: # =>This Inner Loop Header: Depth=1 xorps %xmm0, %xmm0 cvtsi2ss %esi, %xmm0 movss %xmm0, (%rax,%rsi,4) xorps %xmm0, %xmm0 cvtsi2ss %ebx, %xmm0 movss %xmm0, (%rcx,%rsi,4) movl $0, (%rdx,%rsi,4) incq %rsi addl $2, %ebx cmpq $10, %rsi jne .LBB1_1 # %bb.2: leaq 24(%rsp), %rdi movl $40, %esi callq hipMalloc leaq 16(%rsp), %rdi movl $40, %esi callq hipMalloc leaq 8(%rsp), %rdi movl $40, %esi callq hipMalloc movq 24(%rsp), %rdi movq 40(%rsp), %rsi movl $40, %edx movl $1, %ecx callq hipMemcpy movq 16(%rsp), %rdi movq 32(%rsp), %rsi movl $40, %edx movl $1, %ecx callq hipMemcpy movq 8(%rsp), %rdi movq (%rsp), %rsi movl $40, %edx movl $1, %ecx callq hipMemcpy movabsq $4294967297, %rdi # imm = 0x100000001 leaq 255(%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 24(%rsp), %rax movq 16(%rsp), %rcx movq 8(%rsp), %rdx movq %rax, 120(%rsp) movq %rcx, 112(%rsp) movq %rdx, 104(%rsp) movl $10, 52(%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 52(%rsp), %rax movq %rax, 152(%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 $_Z6VecAddPfS_S_i, %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_4: movq (%rsp), %rdi movq 8(%rsp), %rsi movl $40, %edx movl $2, %ecx callq hipMemcpy movq 24(%rsp), %rdi callq hipFree movq 16(%rsp), %rdi callq hipFree movq 8(%rsp), %rdi callq hipFree xorl %r14d, %r14d jmp .LBB1_5 .p2align 4, 0x90 .LBB1_8: # in Loop: Header=BB1_5 Depth=1 movq %rbx, %rdi movq %rax, %r15 callq _ZNKSt5ctypeIcE13_M_widen_initEv movq (%rbx), %rax movq %rbx, %rdi movl $10, %esi callq *48(%rax) movl %eax, %ecx movq %r15, %rax .LBB1_9: # %_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_.exit # in Loop: Header=BB1_5 Depth=1 movsbl %cl, %esi movq %rax, %rdi callq _ZNSo3putEc movq %rax, %rdi callq _ZNSo5flushEv incq %r14 cmpq $10, %r14 je .LBB1_10 .LBB1_5: # =>This Inner Loop Header: Depth=1 movq (%rsp), %rax movss (%rax,%r14,4), %xmm0 # xmm0 = mem[0],zero,zero,zero cvtss2sd %xmm0, %xmm0 movl $_ZSt4cout, %edi callq _ZNSo9_M_insertIdEERSoT_ movq (%rax), %rcx movq -24(%rcx), %rcx movq 240(%rax,%rcx), %rbx testq %rbx, %rbx je .LBB1_11 # %bb.6: # %_ZSt13__check_facetISt5ctypeIcEERKT_PS3_.exit.i.i # in Loop: Header=BB1_5 Depth=1 cmpb $0, 56(%rbx) je .LBB1_8 # %bb.7: # in Loop: Header=BB1_5 Depth=1 movzbl 67(%rbx), %ecx jmp .LBB1_9 .LBB1_10: movq 40(%rsp), %rdi callq hipFree movq 32(%rsp), %rdi callq hipFree movq (%rsp), %rdi callq hipFree xorl %eax, %eax addq $160, %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_11: .cfi_def_cfa_offset 192 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 $_Z6VecAddPfS_S_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_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 _Z6VecAddPfS_S_i,@object # @_Z6VecAddPfS_S_i .section .rodata,"a",@progbits .globl _Z6VecAddPfS_S_i .p2align 3, 0x0 _Z6VecAddPfS_S_i: .quad _Z21__device_stub__VecAddPfS_S_i .size _Z6VecAddPfS_S_i, 8 .type .L__unnamed_1,@object # @0 .section .rodata.str1.1,"aMS",@progbits,1 .L__unnamed_1: .asciz "_Z6VecAddPfS_S_i" .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 _Z21__device_stub__VecAddPfS_S_i .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z6VecAddPfS_S_i .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 : _Z6VecAddPfS_S_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 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.GE.AND P0, PT, R6, c[0x0][0x178], PT ; /* 0x00005e0006007a0c */ /* 0x000fda0003f06270 */ /*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 */ /* 0x000fc800078e0207 */ /*00d0*/ FADD R9, R4, R3 ; /* 0x0000000304097221 */ /* 0x004fca0000000000 */ /*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 _Z6VecAddPfS_S_i .globl _Z6VecAddPfS_S_i .p2align 8 .type _Z6VecAddPfS_S_i,@function _Z6VecAddPfS_S_i: s_clause 0x1 s_load_b32 s2, s[0:1], 0x2c s_load_b32 s3, s[0:1], 0x18 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[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_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 _Z6VecAddPfS_S_i .amdhsa_group_segment_fixed_size 0 .amdhsa_private_segment_fixed_size 0 .amdhsa_kernarg_size 288 .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 _Z6VecAddPfS_S_i, .Lfunc_end0-_Z6VecAddPfS_S_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 - .address_space: global .offset: 16 .size: 8 .value_kind: global_buffer - .offset: 24 .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: _Z6VecAddPfS_S_i .private_segment_fixed_size: 0 .sgpr_count: 18 .sgpr_spill_count: 0 .symbol: _Z6VecAddPfS_S_i.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_000e94cd_00000000-6_vecadd.cudafe1.cpp" .text #APP .globl _ZSt21ios_base_library_initv #NO_APP .type _ZL26__cudaUnregisterBinaryUtilv, @function _ZL26__cudaUnregisterBinaryUtilv: .LFB3672: .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 .LFE3672: .size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv .globl _Z30__device_stub__Z6VecAddPfS_S_iPfS_S_i .type _Z30__device_stub__Z6VecAddPfS_S_iPfS_S_i, @function _Z30__device_stub__Z6VecAddPfS_S_iPfS_S_i: .LFB3694: .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) 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) 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 _Z6VecAddPfS_S_i(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 160 jmp .L3 .L8: call __stack_chk_fail@PLT .cfi_endproc .LFE3694: .size _Z30__device_stub__Z6VecAddPfS_S_iPfS_S_i, .-_Z30__device_stub__Z6VecAddPfS_S_iPfS_S_i .globl _Z6VecAddPfS_S_i .type _Z6VecAddPfS_S_i, @function _Z6VecAddPfS_S_i: .LFB3695: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z30__device_stub__Z6VecAddPfS_S_iPfS_S_i addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE3695: .size _Z6VecAddPfS_S_i, .-_Z6VecAddPfS_S_i .globl main .type main, @function main: .LFB3669: .cfi_startproc endbr64 pushq %r13 .cfi_def_cfa_offset 16 .cfi_offset 13, -16 pushq %r12 .cfi_def_cfa_offset 24 .cfi_offset 12, -24 pushq %rbp .cfi_def_cfa_offset 32 .cfi_offset 6, -32 pushq %rbx .cfi_def_cfa_offset 40 .cfi_offset 3, -40 subq $88, %rsp .cfi_def_cfa_offset 128 movq %fs:40, %rax movq %rax, 72(%rsp) xorl %eax, %eax movq %rsp, %rdi movl $0, %edx movl $40, %esi call cudaHostAlloc@PLT leaq 8(%rsp), %rdi movl $0, %edx movl $40, %esi call cudaHostAlloc@PLT leaq 16(%rsp), %rdi movl $0, %edx movl $40, %esi call cudaHostAlloc@PLT movl $0, %eax .L12: pxor %xmm0, %xmm0 cvtsi2ssl %eax, %xmm0 movq (%rsp), %rdx movss %xmm0, (%rdx,%rax,4) leal (%rax,%rax), %edx pxor %xmm0, %xmm0 cvtsi2ssl %edx, %xmm0 movq 8(%rsp), %rdx movss %xmm0, (%rdx,%rax,4) movq 16(%rsp), %rdx movl $0x00000000, (%rdx,%rax,4) addq $1, %rax cmpq $10, %rax jne .L12 leaq 24(%rsp), %rdi movl $40, %esi call cudaMalloc@PLT leaq 32(%rsp), %rdi movl $40, %esi call cudaMalloc@PLT leaq 40(%rsp), %rdi movl $40, %esi call cudaMalloc@PLT movl $1, %ecx movl $40, %edx movq (%rsp), %rsi movq 24(%rsp), %rdi call cudaMemcpy@PLT movl $1, %ecx movl $40, %edx movq 8(%rsp), %rsi movq 32(%rsp), %rdi call cudaMemcpy@PLT movl $1, %ecx movl $40, %edx movq 16(%rsp), %rsi movq 40(%rsp), %rdi call cudaMemcpy@PLT movl $256, 60(%rsp) movl $1, 64(%rsp) movl $1, 68(%rsp) movl $1, 48(%rsp) movl $1, 52(%rsp) movl $1, 56(%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 .L23 .L13: movl $2, %ecx movl $40, %edx movq 40(%rsp), %rsi movq 16(%rsp), %rdi call cudaMemcpy@PLT movq 24(%rsp), %rdi call cudaFree@PLT movq 32(%rsp), %rdi call cudaFree@PLT movq 40(%rsp), %rdi call cudaFree@PLT movl $0, %ebp leaq _ZSt4cout(%rip), %r12 jmp .L18 .L23: movl $10, %ecx movq 40(%rsp), %rdx movq 32(%rsp), %rsi movq 24(%rsp), %rdi call _Z30__device_stub__Z6VecAddPfS_S_iPfS_S_i jmp .L13 .L26: movq 72(%rsp), %rax subq %fs:40, %rax jne .L24 call _ZSt16__throw_bad_castv@PLT .L24: call __stack_chk_fail@PLT .L16: movq %r13, %rdi call _ZNKSt5ctypeIcE13_M_widen_initEv@PLT movq 0(%r13), %rax movl $10, %esi movq %r13, %rdi call *48(%rax) movl %eax, %esi .L17: movsbl %sil, %esi movq %rbx, %rdi call _ZNSo3putEc@PLT movq %rax, %rdi call _ZNSo5flushEv@PLT addq $4, %rbp cmpq $40, %rbp je .L25 .L18: movq 16(%rsp), %rax pxor %xmm0, %xmm0 cvtss2sd (%rax,%rbp), %xmm0 movq %r12, %rdi call _ZNSo9_M_insertIdEERSoT_@PLT movq %rax, %rbx movq (%rax), %rax movq -24(%rax), %rax movq 240(%rbx,%rax), %r13 testq %r13, %r13 je .L26 cmpb $0, 56(%r13) je .L16 movzbl 67(%r13), %esi jmp .L17 .L25: movq (%rsp), %rdi call cudaFree@PLT movq 8(%rsp), %rdi call cudaFree@PLT movq 16(%rsp), %rdi call cudaFree@PLT movq 72(%rsp), %rax subq %fs:40, %rax jne .L27 movl $0, %eax addq $88, %rsp .cfi_remember_state .cfi_def_cfa_offset 40 popq %rbx .cfi_def_cfa_offset 32 popq %rbp .cfi_def_cfa_offset 24 popq %r12 .cfi_def_cfa_offset 16 popq %r13 .cfi_def_cfa_offset 8 ret .L27: .cfi_restore_state call __stack_chk_fail@PLT .cfi_endproc .LFE3669: .size main, .-main .section .rodata.str1.1,"aMS",@progbits,1 .LC1: .string "_Z6VecAddPfS_S_i" .text .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB3697: .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 _Z6VecAddPfS_S_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 .LFE3697: .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 "vecadd.hip" # Start of file scope inline assembly .globl _ZSt21ios_base_library_initv # End of file scope inline assembly .globl _Z21__device_stub__VecAddPfS_S_i # -- Begin function _Z21__device_stub__VecAddPfS_S_i .p2align 4, 0x90 .type _Z21__device_stub__VecAddPfS_S_i,@function _Z21__device_stub__VecAddPfS_S_i: # @_Z21__device_stub__VecAddPfS_S_i .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) 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) 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 $_Z6VecAddPfS_S_i, %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 _Z21__device_stub__VecAddPfS_S_i, .Lfunc_end0-_Z21__device_stub__VecAddPfS_S_i .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 $160, %rsp .cfi_def_cfa_offset 192 .cfi_offset %rbx, -32 .cfi_offset %r14, -24 .cfi_offset %r15, -16 leaq 40(%rsp), %rdi xorl %ebx, %ebx movl $40, %esi xorl %edx, %edx callq hipHostMalloc leaq 32(%rsp), %rdi movl $40, %esi xorl %edx, %edx callq hipHostMalloc movq %rsp, %rdi movl $40, %esi xorl %edx, %edx callq hipHostMalloc movq 40(%rsp), %rax movq 32(%rsp), %rcx movq (%rsp), %rdx xorl %esi, %esi .p2align 4, 0x90 .LBB1_1: # =>This Inner Loop Header: Depth=1 xorps %xmm0, %xmm0 cvtsi2ss %esi, %xmm0 movss %xmm0, (%rax,%rsi,4) xorps %xmm0, %xmm0 cvtsi2ss %ebx, %xmm0 movss %xmm0, (%rcx,%rsi,4) movl $0, (%rdx,%rsi,4) incq %rsi addl $2, %ebx cmpq $10, %rsi jne .LBB1_1 # %bb.2: leaq 24(%rsp), %rdi movl $40, %esi callq hipMalloc leaq 16(%rsp), %rdi movl $40, %esi callq hipMalloc leaq 8(%rsp), %rdi movl $40, %esi callq hipMalloc movq 24(%rsp), %rdi movq 40(%rsp), %rsi movl $40, %edx movl $1, %ecx callq hipMemcpy movq 16(%rsp), %rdi movq 32(%rsp), %rsi movl $40, %edx movl $1, %ecx callq hipMemcpy movq 8(%rsp), %rdi movq (%rsp), %rsi movl $40, %edx movl $1, %ecx callq hipMemcpy movabsq $4294967297, %rdi # imm = 0x100000001 leaq 255(%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 24(%rsp), %rax movq 16(%rsp), %rcx movq 8(%rsp), %rdx movq %rax, 120(%rsp) movq %rcx, 112(%rsp) movq %rdx, 104(%rsp) movl $10, 52(%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 52(%rsp), %rax movq %rax, 152(%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 $_Z6VecAddPfS_S_i, %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_4: movq (%rsp), %rdi movq 8(%rsp), %rsi movl $40, %edx movl $2, %ecx callq hipMemcpy movq 24(%rsp), %rdi callq hipFree movq 16(%rsp), %rdi callq hipFree movq 8(%rsp), %rdi callq hipFree xorl %r14d, %r14d jmp .LBB1_5 .p2align 4, 0x90 .LBB1_8: # in Loop: Header=BB1_5 Depth=1 movq %rbx, %rdi movq %rax, %r15 callq _ZNKSt5ctypeIcE13_M_widen_initEv movq (%rbx), %rax movq %rbx, %rdi movl $10, %esi callq *48(%rax) movl %eax, %ecx movq %r15, %rax .LBB1_9: # %_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_.exit # in Loop: Header=BB1_5 Depth=1 movsbl %cl, %esi movq %rax, %rdi callq _ZNSo3putEc movq %rax, %rdi callq _ZNSo5flushEv incq %r14 cmpq $10, %r14 je .LBB1_10 .LBB1_5: # =>This Inner Loop Header: Depth=1 movq (%rsp), %rax movss (%rax,%r14,4), %xmm0 # xmm0 = mem[0],zero,zero,zero cvtss2sd %xmm0, %xmm0 movl $_ZSt4cout, %edi callq _ZNSo9_M_insertIdEERSoT_ movq (%rax), %rcx movq -24(%rcx), %rcx movq 240(%rax,%rcx), %rbx testq %rbx, %rbx je .LBB1_11 # %bb.6: # %_ZSt13__check_facetISt5ctypeIcEERKT_PS3_.exit.i.i # in Loop: Header=BB1_5 Depth=1 cmpb $0, 56(%rbx) je .LBB1_8 # %bb.7: # in Loop: Header=BB1_5 Depth=1 movzbl 67(%rbx), %ecx jmp .LBB1_9 .LBB1_10: movq 40(%rsp), %rdi callq hipFree movq 32(%rsp), %rdi callq hipFree movq (%rsp), %rdi callq hipFree xorl %eax, %eax addq $160, %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_11: .cfi_def_cfa_offset 192 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 $_Z6VecAddPfS_S_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_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 _Z6VecAddPfS_S_i,@object # @_Z6VecAddPfS_S_i .section .rodata,"a",@progbits .globl _Z6VecAddPfS_S_i .p2align 3, 0x0 _Z6VecAddPfS_S_i: .quad _Z21__device_stub__VecAddPfS_S_i .size _Z6VecAddPfS_S_i, 8 .type .L__unnamed_1,@object # @0 .section .rodata.str1.1,"aMS",@progbits,1 .L__unnamed_1: .asciz "_Z6VecAddPfS_S_i" .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 _Z21__device_stub__VecAddPfS_S_i .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z6VecAddPfS_S_i .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 "includes.h" // Include files // Parameters #define N_ATOMS 343 #define MASS_ATOM 1.0f #define time_step 0.01f #define L 10.5f #define T 0.728f #define NUM_STEPS 10000 const int BLOCK_SIZE = 1024; //const int L = ; const int scheme = 1; // 0 for explicit, 1 for implicit /*************************************************************************************************************/ /************* INITIALIZATION CODE **********/ /*************************************************************************************************************/ __global__ void newForceReduction(float *input, float *output, int startunit, int len) { unsigned int tx = threadIdx.x; unsigned int start = blockIdx.x *N_ATOMS; __shared__ float partSum[BLOCK_SIZE]; // if (tx == 0) printf("Length of the shared memory array - %i \n", N_ATOMS); //Loading input floats to shared memory //Take care of the boundary conditions if (tx < N_ATOMS) { partSum[tx] = input[start + tx]; } else{ partSum[tx] = 0.0f; } __syncthreads(); //Reduction Kernel for each dimension if (tx < 512){ partSum[tx] += partSum[tx + 512]; } __syncthreads(); if (tx < 256){ partSum[tx] += partSum[tx + 256]; } __syncthreads(); if (tx < 128){ partSum[tx] += partSum[tx + 128]; } __syncthreads(); if (tx < 64){ partSum[tx] += partSum[tx + 64]; } __syncthreads(); if (tx < 32){ partSum[tx] += partSum[tx + 32]; partSum[tx] += partSum[tx + 16]; partSum[tx] += partSum[tx + 8]; partSum[tx] += partSum[tx + 4]; partSum[tx] += partSum[tx + 2]; partSum[tx] += partSum[tx + 1]; } if (tx == 0){ output[blockIdx.x] = -partSum[0]; } }
code for sm_80 Function : _Z17newForceReductionPfS_ii .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_TID.X ; /* 0x0000000000007919 */ /* 0x000e220000002100 */ /*0020*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */ /* 0x000fe20000000a00 */ /*0030*/ BSSY B0, 0xf0 ; /* 0x000000b000007945 */ /* 0x000fe20003800000 */ /*0040*/ ISETP.GE.U32.AND P0, PT, R0.reuse, 0x157, PT ; /* 0x000001570000780c */ /* 0x041fe40003f06070 */ /*0050*/ ISETP.GT.U32.AND P1, PT, R0, 0x1ff, PT ; /* 0x000001ff0000780c */ /* 0x000fd60003f24070 */ /*0060*/ @P0 STS [R0.X4], RZ ; /* 0x000000ff00000388 */ /* 0x0001e20000004800 */ /*0070*/ @P0 BRA 0xe0 ; /* 0x0000006000000947 */ /* 0x000fea0003800000 */ /*0080*/ S2R R3, SR_CTAID.X ; /* 0x0000000000037919 */ /* 0x000e620000002500 */ /*0090*/ HFMA2.MMA R5, -RZ, RZ, 0, 2.384185791015625e-07 ; /* 0x00000004ff057435 */ /* 0x000fe200000001ff */ /*00a0*/ IMAD R2, R3, 0x157, R0 ; /* 0x0000015703027824 */ /* 0x002fd200078e0200 */ /*00b0*/ IMAD.WIDE.U32 R2, R2, R5, c[0x0][0x160] ; /* 0x0000580002027625 */ /* 0x000fcc00078e0005 */ /*00c0*/ LDG.E R3, [R2.64] ; /* 0x0000000402037981 */ /* 0x000ea8000c1e1900 */ /*00d0*/ STS [R0.X4], R3 ; /* 0x0000000300007388 */ /* 0x0043e40000004800 */ /*00e0*/ BSYNC B0 ; /* 0x0000000000007941 */ /* 0x000fea0003800000 */ /*00f0*/ BAR.SYNC.DEFER_BLOCKING 0x0 ; /* 0x0000000000007b1d */ /* 0x000fe20000010000 */ /*0100*/ ISETP.GT.U32.AND P0, PT, R0.reuse, 0xff, PT ; /* 0x000000ff0000780c */ /* 0x040fe40003f04070 */ /*0110*/ ISETP.NE.AND P2, PT, R0, RZ, PT ; /* 0x000000ff0000720c */ /* 0x000fc60003f45270 */ /*0120*/ BSSY B0, 0x3a0 ; /* 0x0000027000007945 */ /* 0x000fe20003800000 */ /*0130*/ @!P1 LDS R2, [R0.X4] ; /* 0x0000000000029984 */ /* 0x000fe80000004800 */ /*0140*/ @!P1 LDS R3, [R0.X4+0x800] ; /* 0x0008000000039984 */ /* 0x002e640000004800 */ /*0150*/ @!P1 FADD R3, R2, R3 ; /* 0x0000000302039221 */ /* 0x002fca0000000000 */ /*0160*/ @!P1 STS [R0.X4], R3 ; /* 0x0000000300009388 */ /* 0x000fe80000004800 */ /*0170*/ BAR.SYNC.DEFER_BLOCKING 0x0 ; /* 0x0000000000007b1d */ /* 0x000fe20000010000 */ /*0180*/ ISETP.GT.U32.AND P1, PT, R0, 0x7f, PT ; /* 0x0000007f0000780c */ /* 0x000fca0003f24070 */ /*0190*/ @!P0 LDS R2, [R0.X4] ; /* 0x0000000000028984 */ /* 0x000fe80000004800 */ /*01a0*/ @!P0 LDS R5, [R0.X4+0x400] ; /* 0x0004000000058984 */ /* 0x000e640000004800 */ /*01b0*/ @!P0 FADD R5, R2, R5 ; /* 0x0000000502058221 */ /* 0x002fca0000000000 */ /*01c0*/ @!P0 STS [R0.X4], R5 ; /* 0x0000000500008388 */ /* 0x000fe80000004800 */ /*01d0*/ BAR.SYNC.DEFER_BLOCKING 0x0 ; /* 0x0000000000007b1d */ /* 0x000fe20000010000 */ /*01e0*/ ISETP.GT.U32.AND P0, PT, R0, 0x3f, PT ; /* 0x0000003f0000780c */ /* 0x000fca0003f04070 */ /*01f0*/ @!P1 LDS R2, [R0.X4] ; /* 0x0000000000029984 */ /* 0x000fe80000004800 */ /*0200*/ @!P1 LDS R7, [R0.X4+0x200] ; /* 0x0002000000079984 */ /* 0x000e640000004800 */ /*0210*/ @!P1 FADD R7, R2, R7 ; /* 0x0000000702079221 */ /* 0x002fca0000000000 */ /*0220*/ @!P1 STS [R0.X4], R7 ; /* 0x0000000700009388 */ /* 0x000fe80000004800 */ /*0230*/ BAR.SYNC.DEFER_BLOCKING 0x0 ; /* 0x0000000000007b1d */ /* 0x000fe20000010000 */ /*0240*/ ISETP.GT.U32.AND P1, PT, R0, 0x1f, PT ; /* 0x0000001f0000780c */ /* 0x000fca0003f24070 */ /*0250*/ @!P0 LDS R2, [R0.X4] ; /* 0x0000000000028984 */ /* 0x000fe80000004800 */ /*0260*/ @!P0 LDS R3, [R0.X4+0x100] ; /* 0x0001000000038984 */ /* 0x000e640000004800 */ /*0270*/ @!P0 FADD R3, R2, R3 ; /* 0x0000000302038221 */ /* 0x002fca0000000000 */ /*0280*/ @!P0 STS [R0.X4], R3 ; /* 0x0000000300008388 */ /* 0x0003e80000004800 */ /*0290*/ BAR.SYNC.DEFER_BLOCKING 0x0 ; /* 0x0000000000007b1d */ /* 0x000fec0000010000 */ /*02a0*/ @P1 BRA 0x390 ; /* 0x000000e000001947 */ /* 0x000fea0003800000 */ /*02b0*/ LDS R2, [R0.X4] ; /* 0x0000000000027984 */ /* 0x002fe80000004800 */ /*02c0*/ LDS R3, [R0.X4+0x80] ; /* 0x0000800000037984 */ /* 0x000e680000004800 */ /*02d0*/ LDS R5, [R0.X4+0x40] ; /* 0x0000400000057984 */ /* 0x000ea80000004800 */ /*02e0*/ LDS R7, [R0.X4+0x20] ; /* 0x0000200000077984 */ /* 0x000ee80000004800 */ /*02f0*/ LDS R9, [R0.X4+0x10] ; /* 0x0000100000097984 */ /* 0x000f280000004800 */ /*0300*/ LDS R11, [R0.X4+0x8] ; /* 0x00000800000b7984 */ /* 0x000f680000004800 */ /*0310*/ LDS R13, [R0.X4+0x4] ; /* 0x00000400000d7984 */ /* 0x000e220000004800 */ /*0320*/ FADD R2, R2, R3 ; /* 0x0000000302027221 */ /* 0x002fc80000000000 */ /*0330*/ FADD R2, R2, R5 ; /* 0x0000000502027221 */ /* 0x004fc80000000000 */ /*0340*/ FADD R2, R2, R7 ; /* 0x0000000702027221 */ /* 0x008fc80000000000 */ /*0350*/ FADD R2, R2, R9 ; /* 0x0000000902027221 */ /* 0x010fc80000000000 */ /*0360*/ FADD R2, R2, R11 ; /* 0x0000000b02027221 */ /* 0x020fc80000000000 */ /*0370*/ FADD R13, R2, R13 ; /* 0x0000000d020d7221 */ /* 0x001fca0000000000 */ /*0380*/ STS [R0.X4], R13 ; /* 0x0000000d00007388 */ /* 0x0001e40000004800 */ /*0390*/ BSYNC B0 ; /* 0x0000000000007941 */ /* 0x002fea0003800000 */ /*03a0*/ @P2 EXIT ; /* 0x000000000000294d */ /* 0x000fea0003800000 */ /*03b0*/ LDS R0, [RZ] ; /* 0x00000000ff007984 */ /* 0x001e220000000800 */ /*03c0*/ MOV R3, 0x4 ; /* 0x0000000400037802 */ /* 0x000fc60000000f00 */ /*03d0*/ S2R R2, SR_CTAID.X ; /* 0x0000000000027919 */ /* 0x000e640000002500 */ /*03e0*/ IMAD.WIDE.U32 R2, R2, R3, c[0x0][0x168] ; /* 0x00005a0002027625 */ /* 0x002fc800078e0003 */ /*03f0*/ FADD R5, -R0, -RZ ; /* 0x800000ff00057221 */ /* 0x001fca0000000100 */ /*0400*/ STG.E [R2.64], R5 ; /* 0x0000000502007986 */ /* 0x000fe2000c101904 */ /*0410*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*0420*/ BRA 0x420; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*0430*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0440*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0450*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*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 "includes.h" // Include files // Parameters #define N_ATOMS 343 #define MASS_ATOM 1.0f #define time_step 0.01f #define L 10.5f #define T 0.728f #define NUM_STEPS 10000 const int BLOCK_SIZE = 1024; //const int L = ; const int scheme = 1; // 0 for explicit, 1 for implicit /*************************************************************************************************************/ /************* INITIALIZATION CODE **********/ /*************************************************************************************************************/ __global__ void newForceReduction(float *input, float *output, int startunit, int len) { unsigned int tx = threadIdx.x; unsigned int start = blockIdx.x *N_ATOMS; __shared__ float partSum[BLOCK_SIZE]; // if (tx == 0) printf("Length of the shared memory array - %i \n", N_ATOMS); //Loading input floats to shared memory //Take care of the boundary conditions if (tx < N_ATOMS) { partSum[tx] = input[start + tx]; } else{ partSum[tx] = 0.0f; } __syncthreads(); //Reduction Kernel for each dimension if (tx < 512){ partSum[tx] += partSum[tx + 512]; } __syncthreads(); if (tx < 256){ partSum[tx] += partSum[tx + 256]; } __syncthreads(); if (tx < 128){ partSum[tx] += partSum[tx + 128]; } __syncthreads(); if (tx < 64){ partSum[tx] += partSum[tx + 64]; } __syncthreads(); if (tx < 32){ partSum[tx] += partSum[tx + 32]; partSum[tx] += partSum[tx + 16]; partSum[tx] += partSum[tx + 8]; partSum[tx] += partSum[tx + 4]; partSum[tx] += partSum[tx + 2]; partSum[tx] += partSum[tx + 1]; } if (tx == 0){ output[blockIdx.x] = -partSum[0]; } }
.file "tmpxft_0011ca8a_00000000-6_newForceReduction.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 _Z41__device_stub__Z17newForceReductionPfS_iiPfS_ii .type _Z41__device_stub__Z17newForceReductionPfS_iiPfS_ii, @function _Z41__device_stub__Z17newForceReductionPfS_iiPfS_ii: .LFB2051: .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 _Z17newForceReductionPfS_ii(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 160 jmp .L3 .L8: call __stack_chk_fail@PLT .cfi_endproc .LFE2051: .size _Z41__device_stub__Z17newForceReductionPfS_iiPfS_ii, .-_Z41__device_stub__Z17newForceReductionPfS_iiPfS_ii .globl _Z17newForceReductionPfS_ii .type _Z17newForceReductionPfS_ii, @function _Z17newForceReductionPfS_ii: .LFB2052: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z41__device_stub__Z17newForceReductionPfS_iiPfS_ii addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2052: .size _Z17newForceReductionPfS_ii, .-_Z17newForceReductionPfS_ii .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "_Z17newForceReductionPfS_ii" .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 _Z17newForceReductionPfS_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 .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" // Include files // Parameters #define N_ATOMS 343 #define MASS_ATOM 1.0f #define time_step 0.01f #define L 10.5f #define T 0.728f #define NUM_STEPS 10000 const int BLOCK_SIZE = 1024; //const int L = ; const int scheme = 1; // 0 for explicit, 1 for implicit /*************************************************************************************************************/ /************* INITIALIZATION CODE **********/ /*************************************************************************************************************/ __global__ void newForceReduction(float *input, float *output, int startunit, int len) { unsigned int tx = threadIdx.x; unsigned int start = blockIdx.x *N_ATOMS; __shared__ float partSum[BLOCK_SIZE]; // if (tx == 0) printf("Length of the shared memory array - %i \n", N_ATOMS); //Loading input floats to shared memory //Take care of the boundary conditions if (tx < N_ATOMS) { partSum[tx] = input[start + tx]; } else{ partSum[tx] = 0.0f; } __syncthreads(); //Reduction Kernel for each dimension if (tx < 512){ partSum[tx] += partSum[tx + 512]; } __syncthreads(); if (tx < 256){ partSum[tx] += partSum[tx + 256]; } __syncthreads(); if (tx < 128){ partSum[tx] += partSum[tx + 128]; } __syncthreads(); if (tx < 64){ partSum[tx] += partSum[tx + 64]; } __syncthreads(); if (tx < 32){ partSum[tx] += partSum[tx + 32]; partSum[tx] += partSum[tx + 16]; partSum[tx] += partSum[tx + 8]; partSum[tx] += partSum[tx + 4]; partSum[tx] += partSum[tx + 2]; partSum[tx] += partSum[tx + 1]; } if (tx == 0){ output[blockIdx.x] = -partSum[0]; } }
#include <hip/hip_runtime.h> #include "includes.h" // Include files // Parameters #define N_ATOMS 343 #define MASS_ATOM 1.0f #define time_step 0.01f #define L 10.5f #define T 0.728f #define NUM_STEPS 10000 const int BLOCK_SIZE = 1024; //const int L = ; const int scheme = 1; // 0 for explicit, 1 for implicit /*************************************************************************************************************/ /************* INITIALIZATION CODE **********/ /*************************************************************************************************************/ __global__ void newForceReduction(float *input, float *output, int startunit, int len) { unsigned int tx = threadIdx.x; unsigned int start = blockIdx.x *N_ATOMS; __shared__ float partSum[BLOCK_SIZE]; // if (tx == 0) printf("Length of the shared memory array - %i \n", N_ATOMS); //Loading input floats to shared memory //Take care of the boundary conditions if (tx < N_ATOMS) { partSum[tx] = input[start + tx]; } else{ partSum[tx] = 0.0f; } __syncthreads(); //Reduction Kernel for each dimension if (tx < 512){ partSum[tx] += partSum[tx + 512]; } __syncthreads(); if (tx < 256){ partSum[tx] += partSum[tx + 256]; } __syncthreads(); if (tx < 128){ partSum[tx] += partSum[tx + 128]; } __syncthreads(); if (tx < 64){ partSum[tx] += partSum[tx + 64]; } __syncthreads(); if (tx < 32){ partSum[tx] += partSum[tx + 32]; partSum[tx] += partSum[tx + 16]; partSum[tx] += partSum[tx + 8]; partSum[tx] += partSum[tx + 4]; partSum[tx] += partSum[tx + 2]; partSum[tx] += partSum[tx + 1]; } if (tx == 0){ output[blockIdx.x] = -partSum[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" // Include files // Parameters #define N_ATOMS 343 #define MASS_ATOM 1.0f #define time_step 0.01f #define L 10.5f #define T 0.728f #define NUM_STEPS 10000 const int BLOCK_SIZE = 1024; //const int L = ; const int scheme = 1; // 0 for explicit, 1 for implicit /*************************************************************************************************************/ /************* INITIALIZATION CODE **********/ /*************************************************************************************************************/ __global__ void newForceReduction(float *input, float *output, int startunit, int len) { unsigned int tx = threadIdx.x; unsigned int start = blockIdx.x *N_ATOMS; __shared__ float partSum[BLOCK_SIZE]; // if (tx == 0) printf("Length of the shared memory array - %i \n", N_ATOMS); //Loading input floats to shared memory //Take care of the boundary conditions if (tx < N_ATOMS) { partSum[tx] = input[start + tx]; } else{ partSum[tx] = 0.0f; } __syncthreads(); //Reduction Kernel for each dimension if (tx < 512){ partSum[tx] += partSum[tx + 512]; } __syncthreads(); if (tx < 256){ partSum[tx] += partSum[tx + 256]; } __syncthreads(); if (tx < 128){ partSum[tx] += partSum[tx + 128]; } __syncthreads(); if (tx < 64){ partSum[tx] += partSum[tx + 64]; } __syncthreads(); if (tx < 32){ partSum[tx] += partSum[tx + 32]; partSum[tx] += partSum[tx + 16]; partSum[tx] += partSum[tx + 8]; partSum[tx] += partSum[tx + 4]; partSum[tx] += partSum[tx + 2]; partSum[tx] += partSum[tx + 1]; } if (tx == 0){ output[blockIdx.x] = -partSum[0]; } }
.text .amdgcn_target "amdgcn-amd-amdhsa--gfx1100" .protected _Z17newForceReductionPfS_ii .globl _Z17newForceReductionPfS_ii .p2align 8 .type _Z17newForceReductionPfS_ii,@function _Z17newForceReductionPfS_ii: v_mov_b32_e32 v2, 0 s_mov_b32 s2, s15 s_mov_b32 s3, exec_lo v_cmpx_gt_u32_e32 0x157, v0 s_cbranch_execz .LBB0_2 s_load_b64 s[4:5], s[0:1], 0x0 v_mad_u64_u32 v[1:2], null, s2, 0x157, v[0:1] v_mov_b32_e32 v2, 0 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_lshlrev_b64 v[1:2], 2, v[1:2] s_waitcnt lgkmcnt(0) v_add_co_u32 v1, vcc_lo, s4, v1 s_delay_alu instid0(VALU_DEP_2) v_add_co_ci_u32_e32 v2, vcc_lo, s5, v2, vcc_lo global_load_b32 v2, v[1:2], off .LBB0_2: s_or_b32 exec_lo, exec_lo, s3 v_lshlrev_b32_e32 v1, 2, v0 s_mov_b32 s3, exec_lo s_waitcnt vmcnt(0) ds_store_b32 v1, v2 s_waitcnt lgkmcnt(0) s_barrier buffer_gl0_inv v_cmpx_gt_u32_e32 0x200, v0 s_cbranch_execz .LBB0_4 ds_load_2addr_stride64_b32 v[2:3], v1 offset1:8 s_waitcnt lgkmcnt(0) v_add_f32_e32 v2, v3, v2 ds_store_b32 v1, v2 .LBB0_4: s_or_b32 exec_lo, exec_lo, s3 s_delay_alu instid0(SALU_CYCLE_1) s_mov_b32 s3, exec_lo s_waitcnt lgkmcnt(0) s_barrier buffer_gl0_inv v_cmpx_gt_u32_e32 0x100, v0 s_cbranch_execz .LBB0_6 v_lshlrev_b32_e32 v3, 2, v0 ds_load_2addr_stride64_b32 v[1:2], v3 offset1:4 s_waitcnt lgkmcnt(0) v_add_f32_e32 v1, v2, v1 ds_store_b32 v3, v1 .LBB0_6: s_or_b32 exec_lo, exec_lo, s3 s_delay_alu instid0(SALU_CYCLE_1) s_mov_b32 s3, exec_lo s_waitcnt lgkmcnt(0) s_barrier buffer_gl0_inv v_cmpx_gt_u32_e32 0x80, v0 s_cbranch_execz .LBB0_8 v_lshlrev_b32_e32 v3, 2, v0 ds_load_2addr_stride64_b32 v[1:2], v3 offset1:2 s_waitcnt lgkmcnt(0) v_add_f32_e32 v1, v2, v1 ds_store_b32 v3, v1 .LBB0_8: s_or_b32 exec_lo, exec_lo, s3 s_delay_alu instid0(SALU_CYCLE_1) s_mov_b32 s3, exec_lo s_waitcnt lgkmcnt(0) s_barrier buffer_gl0_inv v_cmpx_gt_u32_e32 64, v0 s_cbranch_execz .LBB0_10 v_lshlrev_b32_e32 v3, 2, v0 ds_load_2addr_stride64_b32 v[1:2], v3 offset1:1 s_waitcnt lgkmcnt(0) v_add_f32_e32 v1, v2, v1 ds_store_b32 v3, v1 .LBB0_10: s_or_b32 exec_lo, exec_lo, s3 s_delay_alu instid0(SALU_CYCLE_1) s_mov_b32 s3, exec_lo s_waitcnt lgkmcnt(0) s_barrier buffer_gl0_inv v_cmpx_gt_u32_e32 32, v0 s_cbranch_execz .LBB0_12 v_lshlrev_b32_e32 v7, 2, v0 ds_load_b32 v8, v7 offset:128 ds_load_2addr_b32 v[1:2], v7 offset1:1 ds_load_2addr_b32 v[3:4], v7 offset0:8 offset1:16 ds_load_2addr_b32 v[5:6], v7 offset0:2 offset1:4 s_waitcnt lgkmcnt(2) v_add_f32_e32 v1, v8, v1 s_waitcnt lgkmcnt(1) s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_add_f32_e32 v1, v1, v4 v_add_f32_e32 v1, v1, v3 s_waitcnt lgkmcnt(0) s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_add_f32_e32 v1, v1, v6 v_add_f32_e32 v1, v1, v5 s_delay_alu instid0(VALU_DEP_1) v_add_f32_e32 v1, v1, v2 ds_store_b32 v7, v1 .LBB0_12: s_or_b32 exec_lo, exec_lo, s3 s_mov_b32 s3, 0 s_mov_b32 s4, exec_lo v_cmpx_eq_u32_e32 0, v0 s_cbranch_execz .LBB0_14 v_mov_b32_e32 v0, 0 s_load_b64 s[0:1], s[0:1], 0x8 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 v_xor_b32_e32 v1, 0x80000000, v1 global_store_b32 v0, v1, s[0:1] .LBB0_14: s_nop 0 s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z17newForceReductionPfS_ii .amdhsa_group_segment_fixed_size 4096 .amdhsa_private_segment_fixed_size 0 .amdhsa_kernarg_size 24 .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 9 .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 _Z17newForceReductionPfS_ii, .Lfunc_end0-_Z17newForceReductionPfS_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 .group_segment_fixed_size: 4096 .kernarg_segment_align: 8 .kernarg_segment_size: 24 .language: OpenCL C .language_version: - 2 - 0 .max_flat_workgroup_size: 1024 .name: _Z17newForceReductionPfS_ii .private_segment_fixed_size: 0 .sgpr_count: 18 .sgpr_spill_count: 0 .symbol: _Z17newForceReductionPfS_ii.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.
#include <hip/hip_runtime.h> #include "includes.h" // Include files // Parameters #define N_ATOMS 343 #define MASS_ATOM 1.0f #define time_step 0.01f #define L 10.5f #define T 0.728f #define NUM_STEPS 10000 const int BLOCK_SIZE = 1024; //const int L = ; const int scheme = 1; // 0 for explicit, 1 for implicit /*************************************************************************************************************/ /************* INITIALIZATION CODE **********/ /*************************************************************************************************************/ __global__ void newForceReduction(float *input, float *output, int startunit, int len) { unsigned int tx = threadIdx.x; unsigned int start = blockIdx.x *N_ATOMS; __shared__ float partSum[BLOCK_SIZE]; // if (tx == 0) printf("Length of the shared memory array - %i \n", N_ATOMS); //Loading input floats to shared memory //Take care of the boundary conditions if (tx < N_ATOMS) { partSum[tx] = input[start + tx]; } else{ partSum[tx] = 0.0f; } __syncthreads(); //Reduction Kernel for each dimension if (tx < 512){ partSum[tx] += partSum[tx + 512]; } __syncthreads(); if (tx < 256){ partSum[tx] += partSum[tx + 256]; } __syncthreads(); if (tx < 128){ partSum[tx] += partSum[tx + 128]; } __syncthreads(); if (tx < 64){ partSum[tx] += partSum[tx + 64]; } __syncthreads(); if (tx < 32){ partSum[tx] += partSum[tx + 32]; partSum[tx] += partSum[tx + 16]; partSum[tx] += partSum[tx + 8]; partSum[tx] += partSum[tx + 4]; partSum[tx] += partSum[tx + 2]; partSum[tx] += partSum[tx + 1]; } if (tx == 0){ output[blockIdx.x] = -partSum[0]; } }
.text .file "newForceReduction.hip" .globl _Z32__device_stub__newForceReductionPfS_ii # -- Begin function _Z32__device_stub__newForceReductionPfS_ii .p2align 4, 0x90 .type _Z32__device_stub__newForceReductionPfS_ii,@function _Z32__device_stub__newForceReductionPfS_ii: # @_Z32__device_stub__newForceReductionPfS_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 $_Z17newForceReductionPfS_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 _Z32__device_stub__newForceReductionPfS_ii, .Lfunc_end0-_Z32__device_stub__newForceReductionPfS_ii .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 $_Z17newForceReductionPfS_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_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 _Z17newForceReductionPfS_ii,@object # @_Z17newForceReductionPfS_ii .section .rodata,"a",@progbits .globl _Z17newForceReductionPfS_ii .p2align 3, 0x0 _Z17newForceReductionPfS_ii: .quad _Z32__device_stub__newForceReductionPfS_ii .size _Z17newForceReductionPfS_ii, 8 .type .L__unnamed_1,@object # @0 .section .rodata.str1.1,"aMS",@progbits,1 .L__unnamed_1: .asciz "_Z17newForceReductionPfS_ii" .size .L__unnamed_1, 28 .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__newForceReductionPfS_ii .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z17newForceReductionPfS_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 : _Z17newForceReductionPfS_ii .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_TID.X ; /* 0x0000000000007919 */ /* 0x000e220000002100 */ /*0020*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */ /* 0x000fe20000000a00 */ /*0030*/ BSSY B0, 0xf0 ; /* 0x000000b000007945 */ /* 0x000fe20003800000 */ /*0040*/ ISETP.GE.U32.AND P0, PT, R0.reuse, 0x157, PT ; /* 0x000001570000780c */ /* 0x041fe40003f06070 */ /*0050*/ ISETP.GT.U32.AND P1, PT, R0, 0x1ff, PT ; /* 0x000001ff0000780c */ /* 0x000fd60003f24070 */ /*0060*/ @P0 STS [R0.X4], RZ ; /* 0x000000ff00000388 */ /* 0x0001e20000004800 */ /*0070*/ @P0 BRA 0xe0 ; /* 0x0000006000000947 */ /* 0x000fea0003800000 */ /*0080*/ S2R R3, SR_CTAID.X ; /* 0x0000000000037919 */ /* 0x000e620000002500 */ /*0090*/ HFMA2.MMA R5, -RZ, RZ, 0, 2.384185791015625e-07 ; /* 0x00000004ff057435 */ /* 0x000fe200000001ff */ /*00a0*/ IMAD R2, R3, 0x157, R0 ; /* 0x0000015703027824 */ /* 0x002fd200078e0200 */ /*00b0*/ IMAD.WIDE.U32 R2, R2, R5, c[0x0][0x160] ; /* 0x0000580002027625 */ /* 0x000fcc00078e0005 */ /*00c0*/ LDG.E R3, [R2.64] ; /* 0x0000000402037981 */ /* 0x000ea8000c1e1900 */ /*00d0*/ STS [R0.X4], R3 ; /* 0x0000000300007388 */ /* 0x0043e40000004800 */ /*00e0*/ BSYNC B0 ; /* 0x0000000000007941 */ /* 0x000fea0003800000 */ /*00f0*/ BAR.SYNC.DEFER_BLOCKING 0x0 ; /* 0x0000000000007b1d */ /* 0x000fe20000010000 */ /*0100*/ ISETP.GT.U32.AND P0, PT, R0.reuse, 0xff, PT ; /* 0x000000ff0000780c */ /* 0x040fe40003f04070 */ /*0110*/ ISETP.NE.AND P2, PT, R0, RZ, PT ; /* 0x000000ff0000720c */ /* 0x000fc60003f45270 */ /*0120*/ BSSY B0, 0x3a0 ; /* 0x0000027000007945 */ /* 0x000fe20003800000 */ /*0130*/ @!P1 LDS R2, [R0.X4] ; /* 0x0000000000029984 */ /* 0x000fe80000004800 */ /*0140*/ @!P1 LDS R3, [R0.X4+0x800] ; /* 0x0008000000039984 */ /* 0x002e640000004800 */ /*0150*/ @!P1 FADD R3, R2, R3 ; /* 0x0000000302039221 */ /* 0x002fca0000000000 */ /*0160*/ @!P1 STS [R0.X4], R3 ; /* 0x0000000300009388 */ /* 0x000fe80000004800 */ /*0170*/ BAR.SYNC.DEFER_BLOCKING 0x0 ; /* 0x0000000000007b1d */ /* 0x000fe20000010000 */ /*0180*/ ISETP.GT.U32.AND P1, PT, R0, 0x7f, PT ; /* 0x0000007f0000780c */ /* 0x000fca0003f24070 */ /*0190*/ @!P0 LDS R2, [R0.X4] ; /* 0x0000000000028984 */ /* 0x000fe80000004800 */ /*01a0*/ @!P0 LDS R5, [R0.X4+0x400] ; /* 0x0004000000058984 */ /* 0x000e640000004800 */ /*01b0*/ @!P0 FADD R5, R2, R5 ; /* 0x0000000502058221 */ /* 0x002fca0000000000 */ /*01c0*/ @!P0 STS [R0.X4], R5 ; /* 0x0000000500008388 */ /* 0x000fe80000004800 */ /*01d0*/ BAR.SYNC.DEFER_BLOCKING 0x0 ; /* 0x0000000000007b1d */ /* 0x000fe20000010000 */ /*01e0*/ ISETP.GT.U32.AND P0, PT, R0, 0x3f, PT ; /* 0x0000003f0000780c */ /* 0x000fca0003f04070 */ /*01f0*/ @!P1 LDS R2, [R0.X4] ; /* 0x0000000000029984 */ /* 0x000fe80000004800 */ /*0200*/ @!P1 LDS R7, [R0.X4+0x200] ; /* 0x0002000000079984 */ /* 0x000e640000004800 */ /*0210*/ @!P1 FADD R7, R2, R7 ; /* 0x0000000702079221 */ /* 0x002fca0000000000 */ /*0220*/ @!P1 STS [R0.X4], R7 ; /* 0x0000000700009388 */ /* 0x000fe80000004800 */ /*0230*/ BAR.SYNC.DEFER_BLOCKING 0x0 ; /* 0x0000000000007b1d */ /* 0x000fe20000010000 */ /*0240*/ ISETP.GT.U32.AND P1, PT, R0, 0x1f, PT ; /* 0x0000001f0000780c */ /* 0x000fca0003f24070 */ /*0250*/ @!P0 LDS R2, [R0.X4] ; /* 0x0000000000028984 */ /* 0x000fe80000004800 */ /*0260*/ @!P0 LDS R3, [R0.X4+0x100] ; /* 0x0001000000038984 */ /* 0x000e640000004800 */ /*0270*/ @!P0 FADD R3, R2, R3 ; /* 0x0000000302038221 */ /* 0x002fca0000000000 */ /*0280*/ @!P0 STS [R0.X4], R3 ; /* 0x0000000300008388 */ /* 0x0003e80000004800 */ /*0290*/ BAR.SYNC.DEFER_BLOCKING 0x0 ; /* 0x0000000000007b1d */ /* 0x000fec0000010000 */ /*02a0*/ @P1 BRA 0x390 ; /* 0x000000e000001947 */ /* 0x000fea0003800000 */ /*02b0*/ LDS R2, [R0.X4] ; /* 0x0000000000027984 */ /* 0x002fe80000004800 */ /*02c0*/ LDS R3, [R0.X4+0x80] ; /* 0x0000800000037984 */ /* 0x000e680000004800 */ /*02d0*/ LDS R5, [R0.X4+0x40] ; /* 0x0000400000057984 */ /* 0x000ea80000004800 */ /*02e0*/ LDS R7, [R0.X4+0x20] ; /* 0x0000200000077984 */ /* 0x000ee80000004800 */ /*02f0*/ LDS R9, [R0.X4+0x10] ; /* 0x0000100000097984 */ /* 0x000f280000004800 */ /*0300*/ LDS R11, [R0.X4+0x8] ; /* 0x00000800000b7984 */ /* 0x000f680000004800 */ /*0310*/ LDS R13, [R0.X4+0x4] ; /* 0x00000400000d7984 */ /* 0x000e220000004800 */ /*0320*/ FADD R2, R2, R3 ; /* 0x0000000302027221 */ /* 0x002fc80000000000 */ /*0330*/ FADD R2, R2, R5 ; /* 0x0000000502027221 */ /* 0x004fc80000000000 */ /*0340*/ FADD R2, R2, R7 ; /* 0x0000000702027221 */ /* 0x008fc80000000000 */ /*0350*/ FADD R2, R2, R9 ; /* 0x0000000902027221 */ /* 0x010fc80000000000 */ /*0360*/ FADD R2, R2, R11 ; /* 0x0000000b02027221 */ /* 0x020fc80000000000 */ /*0370*/ FADD R13, R2, R13 ; /* 0x0000000d020d7221 */ /* 0x001fca0000000000 */ /*0380*/ STS [R0.X4], R13 ; /* 0x0000000d00007388 */ /* 0x0001e40000004800 */ /*0390*/ BSYNC B0 ; /* 0x0000000000007941 */ /* 0x002fea0003800000 */ /*03a0*/ @P2 EXIT ; /* 0x000000000000294d */ /* 0x000fea0003800000 */ /*03b0*/ LDS R0, [RZ] ; /* 0x00000000ff007984 */ /* 0x001e220000000800 */ /*03c0*/ MOV R3, 0x4 ; /* 0x0000000400037802 */ /* 0x000fc60000000f00 */ /*03d0*/ S2R R2, SR_CTAID.X ; /* 0x0000000000027919 */ /* 0x000e640000002500 */ /*03e0*/ IMAD.WIDE.U32 R2, R2, R3, c[0x0][0x168] ; /* 0x00005a0002027625 */ /* 0x002fc800078e0003 */ /*03f0*/ FADD R5, -R0, -RZ ; /* 0x800000ff00057221 */ /* 0x001fca0000000100 */ /*0400*/ STG.E [R2.64], R5 ; /* 0x0000000502007986 */ /* 0x000fe2000c101904 */ /*0410*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*0420*/ BRA 0x420; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*0430*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0440*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0450*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*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 _Z17newForceReductionPfS_ii .globl _Z17newForceReductionPfS_ii .p2align 8 .type _Z17newForceReductionPfS_ii,@function _Z17newForceReductionPfS_ii: v_mov_b32_e32 v2, 0 s_mov_b32 s2, s15 s_mov_b32 s3, exec_lo v_cmpx_gt_u32_e32 0x157, v0 s_cbranch_execz .LBB0_2 s_load_b64 s[4:5], s[0:1], 0x0 v_mad_u64_u32 v[1:2], null, s2, 0x157, v[0:1] v_mov_b32_e32 v2, 0 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_lshlrev_b64 v[1:2], 2, v[1:2] s_waitcnt lgkmcnt(0) v_add_co_u32 v1, vcc_lo, s4, v1 s_delay_alu instid0(VALU_DEP_2) v_add_co_ci_u32_e32 v2, vcc_lo, s5, v2, vcc_lo global_load_b32 v2, v[1:2], off .LBB0_2: s_or_b32 exec_lo, exec_lo, s3 v_lshlrev_b32_e32 v1, 2, v0 s_mov_b32 s3, exec_lo s_waitcnt vmcnt(0) ds_store_b32 v1, v2 s_waitcnt lgkmcnt(0) s_barrier buffer_gl0_inv v_cmpx_gt_u32_e32 0x200, v0 s_cbranch_execz .LBB0_4 ds_load_2addr_stride64_b32 v[2:3], v1 offset1:8 s_waitcnt lgkmcnt(0) v_add_f32_e32 v2, v3, v2 ds_store_b32 v1, v2 .LBB0_4: s_or_b32 exec_lo, exec_lo, s3 s_delay_alu instid0(SALU_CYCLE_1) s_mov_b32 s3, exec_lo s_waitcnt lgkmcnt(0) s_barrier buffer_gl0_inv v_cmpx_gt_u32_e32 0x100, v0 s_cbranch_execz .LBB0_6 v_lshlrev_b32_e32 v3, 2, v0 ds_load_2addr_stride64_b32 v[1:2], v3 offset1:4 s_waitcnt lgkmcnt(0) v_add_f32_e32 v1, v2, v1 ds_store_b32 v3, v1 .LBB0_6: s_or_b32 exec_lo, exec_lo, s3 s_delay_alu instid0(SALU_CYCLE_1) s_mov_b32 s3, exec_lo s_waitcnt lgkmcnt(0) s_barrier buffer_gl0_inv v_cmpx_gt_u32_e32 0x80, v0 s_cbranch_execz .LBB0_8 v_lshlrev_b32_e32 v3, 2, v0 ds_load_2addr_stride64_b32 v[1:2], v3 offset1:2 s_waitcnt lgkmcnt(0) v_add_f32_e32 v1, v2, v1 ds_store_b32 v3, v1 .LBB0_8: s_or_b32 exec_lo, exec_lo, s3 s_delay_alu instid0(SALU_CYCLE_1) s_mov_b32 s3, exec_lo s_waitcnt lgkmcnt(0) s_barrier buffer_gl0_inv v_cmpx_gt_u32_e32 64, v0 s_cbranch_execz .LBB0_10 v_lshlrev_b32_e32 v3, 2, v0 ds_load_2addr_stride64_b32 v[1:2], v3 offset1:1 s_waitcnt lgkmcnt(0) v_add_f32_e32 v1, v2, v1 ds_store_b32 v3, v1 .LBB0_10: s_or_b32 exec_lo, exec_lo, s3 s_delay_alu instid0(SALU_CYCLE_1) s_mov_b32 s3, exec_lo s_waitcnt lgkmcnt(0) s_barrier buffer_gl0_inv v_cmpx_gt_u32_e32 32, v0 s_cbranch_execz .LBB0_12 v_lshlrev_b32_e32 v7, 2, v0 ds_load_b32 v8, v7 offset:128 ds_load_2addr_b32 v[1:2], v7 offset1:1 ds_load_2addr_b32 v[3:4], v7 offset0:8 offset1:16 ds_load_2addr_b32 v[5:6], v7 offset0:2 offset1:4 s_waitcnt lgkmcnt(2) v_add_f32_e32 v1, v8, v1 s_waitcnt lgkmcnt(1) s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_add_f32_e32 v1, v1, v4 v_add_f32_e32 v1, v1, v3 s_waitcnt lgkmcnt(0) s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_add_f32_e32 v1, v1, v6 v_add_f32_e32 v1, v1, v5 s_delay_alu instid0(VALU_DEP_1) v_add_f32_e32 v1, v1, v2 ds_store_b32 v7, v1 .LBB0_12: s_or_b32 exec_lo, exec_lo, s3 s_mov_b32 s3, 0 s_mov_b32 s4, exec_lo v_cmpx_eq_u32_e32 0, v0 s_cbranch_execz .LBB0_14 v_mov_b32_e32 v0, 0 s_load_b64 s[0:1], s[0:1], 0x8 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 v_xor_b32_e32 v1, 0x80000000, v1 global_store_b32 v0, v1, s[0:1] .LBB0_14: s_nop 0 s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z17newForceReductionPfS_ii .amdhsa_group_segment_fixed_size 4096 .amdhsa_private_segment_fixed_size 0 .amdhsa_kernarg_size 24 .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 9 .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 _Z17newForceReductionPfS_ii, .Lfunc_end0-_Z17newForceReductionPfS_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 .group_segment_fixed_size: 4096 .kernarg_segment_align: 8 .kernarg_segment_size: 24 .language: OpenCL C .language_version: - 2 - 0 .max_flat_workgroup_size: 1024 .name: _Z17newForceReductionPfS_ii .private_segment_fixed_size: 0 .sgpr_count: 18 .sgpr_spill_count: 0 .symbol: _Z17newForceReductionPfS_ii.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_0011ca8a_00000000-6_newForceReduction.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 _Z41__device_stub__Z17newForceReductionPfS_iiPfS_ii .type _Z41__device_stub__Z17newForceReductionPfS_iiPfS_ii, @function _Z41__device_stub__Z17newForceReductionPfS_iiPfS_ii: .LFB2051: .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 _Z17newForceReductionPfS_ii(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 160 jmp .L3 .L8: call __stack_chk_fail@PLT .cfi_endproc .LFE2051: .size _Z41__device_stub__Z17newForceReductionPfS_iiPfS_ii, .-_Z41__device_stub__Z17newForceReductionPfS_iiPfS_ii .globl _Z17newForceReductionPfS_ii .type _Z17newForceReductionPfS_ii, @function _Z17newForceReductionPfS_ii: .LFB2052: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z41__device_stub__Z17newForceReductionPfS_iiPfS_ii addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2052: .size _Z17newForceReductionPfS_ii, .-_Z17newForceReductionPfS_ii .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "_Z17newForceReductionPfS_ii" .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 _Z17newForceReductionPfS_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 .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 "newForceReduction.hip" .globl _Z32__device_stub__newForceReductionPfS_ii # -- Begin function _Z32__device_stub__newForceReductionPfS_ii .p2align 4, 0x90 .type _Z32__device_stub__newForceReductionPfS_ii,@function _Z32__device_stub__newForceReductionPfS_ii: # @_Z32__device_stub__newForceReductionPfS_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 $_Z17newForceReductionPfS_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 _Z32__device_stub__newForceReductionPfS_ii, .Lfunc_end0-_Z32__device_stub__newForceReductionPfS_ii .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 $_Z17newForceReductionPfS_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_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 _Z17newForceReductionPfS_ii,@object # @_Z17newForceReductionPfS_ii .section .rodata,"a",@progbits .globl _Z17newForceReductionPfS_ii .p2align 3, 0x0 _Z17newForceReductionPfS_ii: .quad _Z32__device_stub__newForceReductionPfS_ii .size _Z17newForceReductionPfS_ii, 8 .type .L__unnamed_1,@object # @0 .section .rodata.str1.1,"aMS",@progbits,1 .L__unnamed_1: .asciz "_Z17newForceReductionPfS_ii" .size .L__unnamed_1, 28 .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__newForceReductionPfS_ii .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z17newForceReductionPfS_ii .addrsig_sym __hip_fatbin .addrsig_sym __hip_fatbin_wrapper .addrsig_sym __hip_cuid_