system
stringclasses
7 values
input
stringlengths
10
94.5k
output
stringlengths
14
55.5k
You are a helpful coding assistant specialized in converting CUDA source code to HIP/AMD source code.
#include "includes.h" __global__ void lifter(float* cepstrum, int nCoefs, int nhalf) { int i = threadIdx.x + blockDim.x*blockIdx.x; int k = i + nCoefs; if (k < nhalf+2-nCoefs) { cepstrum[k] = 0.0; // kill all the cepstrum coefficients above nCoefs } }
#include <hip/hip_runtime.h> #include "includes.h" __global__ void lifter(float* cepstrum, int nCoefs, int nhalf) { int i = threadIdx.x + blockDim.x*blockIdx.x; int k = i + nCoefs; if (k < nhalf+2-nCoefs) { cepstrum[k] = 0.0; // kill all the cepstrum coefficients above nCoefs } }
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 lifter(float* cepstrum, int nCoefs, int nhalf) { int i = threadIdx.x + blockDim.x*blockIdx.x; int k = i + nCoefs; if (k < nhalf+2-nCoefs) { cepstrum[k] = 0.0; // kill all the cepstrum coefficients above nCoefs } }
.text .amdgcn_target "amdgcn-amd-amdhsa--gfx1100" .protected _Z6lifterPfii .globl _Z6lifterPfii .p2align 8 .type _Z6lifterPfii,@function _Z6lifterPfii: s_clause 0x1 s_load_b32 s4, s[0:1], 0x1c s_load_b64 s[2:3], s[0:1], 0x8 s_waitcnt lgkmcnt(0) s_and_b32 s4, s4, 0xffff s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1) s_mul_i32 s15, s15, s4 v_add3_u32 v0, s15, s2, v0 s_sub_i32 s2, s3, s2 s_delay_alu instid0(SALU_CYCLE_1) s_add_i32 s2, s2, 2 s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1) v_cmp_gt_i32_e32 vcc_lo, s2, v0 s_and_saveexec_b32 s2, vcc_lo s_cbranch_execz .LBB0_2 s_load_b64 s[0:1], s[0:1], 0x0 v_ashrrev_i32_e32 v1, 31, v0 v_mov_b32_e32 v2, 0 s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_lshlrev_b64 v[0:1], 2, v[0:1] s_waitcnt lgkmcnt(0) v_add_co_u32 v0, vcc_lo, s0, v0 s_delay_alu instid0(VALU_DEP_2) v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo global_store_b32 v[0:1], v2, off .LBB0_2: s_nop 0 s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z6lifterPfii .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 3 .amdhsa_next_free_sgpr 16 .amdhsa_float_round_mode_32 0 .amdhsa_float_round_mode_16_64 0 .amdhsa_float_denorm_mode_32 3 .amdhsa_float_denorm_mode_16_64 3 .amdhsa_dx10_clamp 1 .amdhsa_ieee_mode 1 .amdhsa_fp16_overflow 0 .amdhsa_workgroup_processor_mode 1 .amdhsa_memory_ordered 1 .amdhsa_forward_progress 0 .amdhsa_shared_vgpr_count 0 .amdhsa_exception_fp_ieee_invalid_op 0 .amdhsa_exception_fp_denorm_src 0 .amdhsa_exception_fp_ieee_div_zero 0 .amdhsa_exception_fp_ieee_overflow 0 .amdhsa_exception_fp_ieee_underflow 0 .amdhsa_exception_fp_ieee_inexact 0 .amdhsa_exception_int_div_zero 0 .end_amdhsa_kernel .text .Lfunc_end0: .size _Z6lifterPfii, .Lfunc_end0-_Z6lifterPfii .section .AMDGPU.csdata,"",@progbits .text .p2alignl 7, 3214868480 .fill 96, 4, 3214868480 .type __hip_cuid_,@object .section .bss,"aw",@nobits .globl __hip_cuid_ __hip_cuid_: .byte 0 .size __hip_cuid_, 1 .ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)" .section ".note.GNU-stack","",@progbits .addrsig .addrsig_sym __hip_cuid_ .amdgpu_metadata --- amdhsa.kernels: - .args: - .address_space: global .offset: 0 .size: 8 .value_kind: global_buffer - .offset: 8 .size: 4 .value_kind: by_value - .offset: 12 .size: 4 .value_kind: by_value - .offset: 16 .size: 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: _Z6lifterPfii .private_segment_fixed_size: 0 .sgpr_count: 18 .sgpr_spill_count: 0 .symbol: _Z6lifterPfii.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> #include "includes.h" __global__ void lifter(float* cepstrum, int nCoefs, int nhalf) { int i = threadIdx.x + blockDim.x*blockIdx.x; int k = i + nCoefs; if (k < nhalf+2-nCoefs) { cepstrum[k] = 0.0; // kill all the cepstrum coefficients above nCoefs } }
.text .file "lifter.hip" .globl _Z21__device_stub__lifterPfii # -- Begin function _Z21__device_stub__lifterPfii .p2align 4, 0x90 .type _Z21__device_stub__lifterPfii,@function _Z21__device_stub__lifterPfii: # @_Z21__device_stub__lifterPfii .cfi_startproc # %bb.0: subq $88, %rsp .cfi_def_cfa_offset 96 movq %rdi, 56(%rsp) movl %esi, 4(%rsp) movl %edx, (%rsp) leaq 56(%rsp), %rax movq %rax, 64(%rsp) leaq 4(%rsp), %rax movq %rax, 72(%rsp) movq %rsp, %rax movq %rax, 80(%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 $_Z6lifterPfii, %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 _Z21__device_stub__lifterPfii, .Lfunc_end0-_Z21__device_stub__lifterPfii .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 $_Z6lifterPfii, %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 _Z6lifterPfii,@object # @_Z6lifterPfii .section .rodata,"a",@progbits .globl _Z6lifterPfii .p2align 3, 0x0 _Z6lifterPfii: .quad _Z21__device_stub__lifterPfii .size _Z6lifterPfii, 8 .type .L__unnamed_1,@object # @0 .section .rodata.str1.1,"aMS",@progbits,1 .L__unnamed_1: .asciz "_Z6lifterPfii" .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 .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__lifterPfii .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z6lifterPfii .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 : _Z6lifterPfii .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][0x168] ; /* 0x00005a0000047ab9 */ /* 0x000fe40000000a00 */ /*0030*/ UIADD3 UR4, -UR4, 0x2, UR5 ; /* 0x0000000204047890 */ /* 0x000fe2000fffe105 */ /*0040*/ S2R R3, SR_CTAID.X ; /* 0x0000000000037919 */ /* 0x000e240000002500 */ /*0050*/ IMAD R0, R3, c[0x0][0x0], R0 ; /* 0x0000000003007a24 */ /* 0x001fca00078e0200 */ /*0060*/ IADD3 R0, R0, c[0x0][0x168], RZ ; /* 0x00005a0000007a10 */ /* 0x000fc80007ffe0ff */ /*0070*/ ISETP.GE.AND P0, PT, R0, UR4, PT ; /* 0x0000000400007c0c */ /* 0x000fda000bf06270 */ /*0080*/ @P0 EXIT ; /* 0x000000000000094d */ /* 0x000fea0003800000 */ /*0090*/ HFMA2.MMA R3, -RZ, RZ, 0, 2.384185791015625e-07 ; /* 0x00000004ff037435 */ /* 0x000fe200000001ff */ /*00a0*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */ /* 0x000fd20000000a00 */ /*00b0*/ IMAD.WIDE R2, R0, R3, c[0x0][0x160] ; /* 0x0000580000027625 */ /* 0x000fca00078e0203 */ /*00c0*/ STG.E [R2.64], RZ ; /* 0x000000ff02007986 */ /* 0x000fe2000c101904 */ /*00d0*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*00e0*/ BRA 0xe0; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*00f0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0100*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0110*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0120*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0130*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0140*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0150*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0160*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0170*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ ..........
.text .amdgcn_target "amdgcn-amd-amdhsa--gfx1100" .protected _Z6lifterPfii .globl _Z6lifterPfii .p2align 8 .type _Z6lifterPfii,@function _Z6lifterPfii: s_clause 0x1 s_load_b32 s4, s[0:1], 0x1c s_load_b64 s[2:3], s[0:1], 0x8 s_waitcnt lgkmcnt(0) s_and_b32 s4, s4, 0xffff s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1) s_mul_i32 s15, s15, s4 v_add3_u32 v0, s15, s2, v0 s_sub_i32 s2, s3, s2 s_delay_alu instid0(SALU_CYCLE_1) s_add_i32 s2, s2, 2 s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1) v_cmp_gt_i32_e32 vcc_lo, s2, v0 s_and_saveexec_b32 s2, vcc_lo s_cbranch_execz .LBB0_2 s_load_b64 s[0:1], s[0:1], 0x0 v_ashrrev_i32_e32 v1, 31, v0 v_mov_b32_e32 v2, 0 s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_lshlrev_b64 v[0:1], 2, v[0:1] s_waitcnt lgkmcnt(0) v_add_co_u32 v0, vcc_lo, s0, v0 s_delay_alu instid0(VALU_DEP_2) v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo global_store_b32 v[0:1], v2, off .LBB0_2: s_nop 0 s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z6lifterPfii .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 3 .amdhsa_next_free_sgpr 16 .amdhsa_float_round_mode_32 0 .amdhsa_float_round_mode_16_64 0 .amdhsa_float_denorm_mode_32 3 .amdhsa_float_denorm_mode_16_64 3 .amdhsa_dx10_clamp 1 .amdhsa_ieee_mode 1 .amdhsa_fp16_overflow 0 .amdhsa_workgroup_processor_mode 1 .amdhsa_memory_ordered 1 .amdhsa_forward_progress 0 .amdhsa_shared_vgpr_count 0 .amdhsa_exception_fp_ieee_invalid_op 0 .amdhsa_exception_fp_denorm_src 0 .amdhsa_exception_fp_ieee_div_zero 0 .amdhsa_exception_fp_ieee_overflow 0 .amdhsa_exception_fp_ieee_underflow 0 .amdhsa_exception_fp_ieee_inexact 0 .amdhsa_exception_int_div_zero 0 .end_amdhsa_kernel .text .Lfunc_end0: .size _Z6lifterPfii, .Lfunc_end0-_Z6lifterPfii .section .AMDGPU.csdata,"",@progbits .text .p2alignl 7, 3214868480 .fill 96, 4, 3214868480 .type __hip_cuid_,@object .section .bss,"aw",@nobits .globl __hip_cuid_ __hip_cuid_: .byte 0 .size __hip_cuid_, 1 .ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)" .section ".note.GNU-stack","",@progbits .addrsig .addrsig_sym __hip_cuid_ .amdgpu_metadata --- amdhsa.kernels: - .args: - .address_space: global .offset: 0 .size: 8 .value_kind: global_buffer - .offset: 8 .size: 4 .value_kind: by_value - .offset: 12 .size: 4 .value_kind: by_value - .offset: 16 .size: 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: _Z6lifterPfii .private_segment_fixed_size: 0 .sgpr_count: 18 .sgpr_spill_count: 0 .symbol: _Z6lifterPfii.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_00136fe7_00000000-6_lifter.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 _Z27__device_stub__Z6lifterPfiiPfii .type _Z27__device_stub__Z6lifterPfiiPfii, @function _Z27__device_stub__Z6lifterPfiiPfii: .LFB2051: .cfi_startproc endbr64 subq $120, %rsp .cfi_def_cfa_offset 128 movq %rdi, 8(%rsp) movl %esi, 4(%rsp) movl %edx, (%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) movq %rsp, %rax movq %rax, 96(%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 _Z6lifterPfii(%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 _Z27__device_stub__Z6lifterPfiiPfii, .-_Z27__device_stub__Z6lifterPfiiPfii .globl _Z6lifterPfii .type _Z6lifterPfii, @function _Z6lifterPfii: .LFB2052: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z27__device_stub__Z6lifterPfiiPfii addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2052: .size _Z6lifterPfii, .-_Z6lifterPfii .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "_Z6lifterPfii" .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 _Z6lifterPfii(%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 "lifter.hip" .globl _Z21__device_stub__lifterPfii # -- Begin function _Z21__device_stub__lifterPfii .p2align 4, 0x90 .type _Z21__device_stub__lifterPfii,@function _Z21__device_stub__lifterPfii: # @_Z21__device_stub__lifterPfii .cfi_startproc # %bb.0: subq $88, %rsp .cfi_def_cfa_offset 96 movq %rdi, 56(%rsp) movl %esi, 4(%rsp) movl %edx, (%rsp) leaq 56(%rsp), %rax movq %rax, 64(%rsp) leaq 4(%rsp), %rax movq %rax, 72(%rsp) movq %rsp, %rax movq %rax, 80(%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 $_Z6lifterPfii, %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 _Z21__device_stub__lifterPfii, .Lfunc_end0-_Z21__device_stub__lifterPfii .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 $_Z6lifterPfii, %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 _Z6lifterPfii,@object # @_Z6lifterPfii .section .rodata,"a",@progbits .globl _Z6lifterPfii .p2align 3, 0x0 _Z6lifterPfii: .quad _Z21__device_stub__lifterPfii .size _Z6lifterPfii, 8 .type .L__unnamed_1,@object # @0 .section .rodata.str1.1,"aMS",@progbits,1 .L__unnamed_1: .asciz "_Z6lifterPfii" .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 .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__lifterPfii .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z6lifterPfii .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 <chrono> #include <iostream> #include <cuda.h> using namespace std; void gen_matrix(int *matrix, int rows, int cols) { for (int i = 0; i < rows * cols; ++i) { matrix[i] = rand() % 10; } } void print_matrix(double *matrix, int rows, int cols) { for (int i = 0; i < rows * cols; ++i) { cout << matrix[i] << " "; if ((i + 1) % cols == 0) { cout << endl; } } } #define BLOCK_SIZE 16 #define FILTER_SIZE 3 #define IDX(row, col, len) ((row)*(len)+(col)) __global__ void laplap(double *from, double *to, double *filter, double divisor, int X, int Y) { int row = blockIdx.y * blockDim.y + threadIdx.y; int col = blockIdx.x * blockDim.x + threadIdx.x; double sum = 0; if (col > 0 && row > 0 && col < X - 1 && row < Y - 1) { for (int i = -1; i < 2; ++i) { for (int j = -1; j < 2; ++j) { // assume that middle element in filter equals to 0 sum += from[(row + i) * X + (col + j)] * filter[(i + 1) * FILTER_SIZE + j + 1]; } } to[row * X + col] = sum / divisor; } } int main(int argc, char* argv[]) { int X = 128, Y = 128; double *from = new double[X * Y]; for (int i = 0; i != X; ++i) { for (int j = 0; j != Y; ++j) { from[i * Y + j] = 0; } } for (int i = 0; i != X; ++i) { from[i * Y] = 1; } double *to = new double[X * Y]; // 0 1 0 // 1 0 1 // 0 1 0 double *filter = new double[FILTER_SIZE * FILTER_SIZE]; for (int i = 0; i != FILTER_SIZE * FILTER_SIZE; ++i) { if (i % 2) { filter[i] = 1; } else { filter[i] = 0; } } print_matrix(filter, FILTER_SIZE, FILTER_SIZE); double *new_from, *new_to, *new_filter; cudaMalloc((void**) &new_from, sizeof(double) * X * Y); cudaMalloc((void**) &new_to, sizeof(double) * X * Y); cudaMalloc((void**) &new_filter, sizeof(double) * FILTER_SIZE * FILTER_SIZE); // copy matrix A and B from host to device memory cudaMemcpy(new_from, from, sizeof(double) * X * Y, cudaMemcpyHostToDevice); cudaMemcpy(new_filter, filter, sizeof(double) * FILTER_SIZE * FILTER_SIZE, cudaMemcpyHostToDevice); dim3 grid((X + BLOCK_SIZE - 1) / BLOCK_SIZE, (Y + BLOCK_SIZE - 1) / BLOCK_SIZE); dim3 block(BLOCK_SIZE, BLOCK_SIZE); int MAX_ITER = 8000; for (int it = 0; it != MAX_ITER; ++it) { laplap<<<grid, block>>>(new_from, new_to, new_filter, 4, X, Y); laplap<<<grid, block>>>(new_to, new_from, new_filter, 4, X, Y); } cudaMemcpy(to, new_from, sizeof(double) * X * Y, cudaMemcpyDeviceToHost); cudaThreadSynchronize(); FILE *f_name; f_name = fopen("res.txt", "w"); for (int i = 0; i < X; ++i) { for (int j = 0; j < Y; ++j) { fprintf(f_name, "%f\t", to[i * X + j]); } fprintf(f_name, "\n"); } cudaFree(new_from); cudaFree(new_to); cudaFree(new_filter); delete from; delete to; delete filter; }
code for sm_80 Function : _Z6laplapPdS_S_dii .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 R19, SR_CTAID.Y ; /* 0x0000000000137919 */ /* 0x000e220000002600 */ /*0020*/ UMOV UR5, 0x1 ; /* 0x0000000100057882 */ /* 0x000fe40000000000 */ /*0030*/ ULDC.64 UR6, c[0x0][0x180] ; /* 0x0000600000067ab9 */ /* 0x000fe20000000a00 */ /*0040*/ S2R R0, SR_TID.Y ; /* 0x0000000000007919 */ /* 0x000e220000002200 */ /*0050*/ UIADD3 UR4, -UR5, UR6, URZ ; /* 0x0000000605047290 */ /* 0x000fe4000fffe13f */ /*0060*/ UIADD3 UR5, -UR5, UR7, URZ ; /* 0x0000000705057290 */ /* 0x000fe2000fffe13f */ /*0070*/ S2R R2, SR_CTAID.X ; /* 0x0000000000027919 */ /* 0x000e680000002500 */ /*0080*/ S2R R3, SR_TID.X ; /* 0x0000000000037919 */ /* 0x000e620000002100 */ /*0090*/ IMAD R19, R19, c[0x0][0x4], R0 ; /* 0x0000010013137a24 */ /* 0x001fca00078e0200 */ /*00a0*/ ISETP.GE.AND P0, PT, R19, 0x1, PT ; /* 0x000000011300780c */ /* 0x000fe20003f06270 */ /*00b0*/ IMAD R0, R2, c[0x0][0x0], R3 ; /* 0x0000000002007a24 */ /* 0x002fca00078e0203 */ /*00c0*/ ISETP.LT.OR P0, PT, R0, 0x1, !P0 ; /* 0x000000010000780c */ /* 0x000fc80004701670 */ /*00d0*/ ISETP.GE.OR P0, PT, R0, UR4, P0 ; /* 0x0000000400007c0c */ /* 0x000fc80008706670 */ /*00e0*/ ISETP.GE.OR P0, PT, R19, UR5, P0 ; /* 0x0000000513007c0c */ /* 0x000fda0008706670 */ /*00f0*/ @P0 EXIT ; /* 0x000000000000094d */ /* 0x000fea0003800000 */ /*0100*/ IADD3 R3, R19, -0x1, RZ ; /* 0xffffffff13037810 */ /* 0x000fe20007ffe0ff */ /*0110*/ IMAD.MOV.U32 R27, RZ, RZ, 0x8 ; /* 0x00000008ff1b7424 */ /* 0x000fe200078e00ff */ /*0120*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */ /* 0x000fe20000000a00 */ /*0130*/ IMAD.MOV.U32 R2, RZ, RZ, c[0x0][0x170] ; /* 0x00005c00ff027624 */ /* 0x000fe400078e00ff */ /*0140*/ IMAD R10, R3, c[0x0][0x180], R0 ; /* 0x00006000030a7a24 */ /* 0x000fe400078e0200 */ /*0150*/ IMAD.MOV.U32 R3, RZ, RZ, c[0x0][0x174] ; /* 0x00005d00ff037624 */ /* 0x000fe400078e00ff */ /*0160*/ IMAD.WIDE R16, R10, R27, c[0x0][0x160] ; /* 0x000058000a107625 */ /* 0x000fc600078e021b */ /*0170*/ LDG.E.64 R8, [R2.64] ; /* 0x0000000402087981 */ /* 0x000ea8000c1e1b00 */ /*0180*/ LDG.E.64 R12, [R16.64+-0x8] ; /* 0xfffff804100c7981 */ /* 0x000ea8000c1e1b00 */ /*0190*/ LDG.E.64 R24, [R2.64+0x8] ; /* 0x0000080402187981 */ /* 0x000ee8000c1e1b00 */ /*01a0*/ LDG.E.64 R14, [R16.64] ; /* 0x00000004100e7981 */ /* 0x000ee2000c1e1b00 */ /*01b0*/ IMAD.WIDE R28, R27, c[0x0][0x180], R16 ; /* 0x000060001b1c7a25 */ /* 0x000fc600078e0210 */ /*01c0*/ LDG.E.64 R20, [R2.64+0x10] ; /* 0x0000100402147981 */ /* 0x000f28000c1e1b00 */ /*01d0*/ LDG.E.64 R22, [R16.64+0x8] ; /* 0x0000080410167981 */ /* 0x000128000c1e1b00 */ /*01e0*/ LDG.E.64 R6, [R2.64+0x18] ; /* 0x0000180402067981 */ /* 0x000f68000c1e1b00 */ /*01f0*/ LDG.E.64 R4, [R28.64+-0x8] ; /* 0xfffff8041c047981 */ /* 0x000f62000c1e1b00 */ /*0200*/ DFMA R8, R8, R12, RZ ; /* 0x0000000c0808722b */ /* 0x0042c400000000ff */ /*0210*/ IADD3 R12, R10, -0x1, RZ ; /* 0xffffffff0a0c7810 */ /* 0x002fe40007ffe0ff */ /*0220*/ LDG.E.64 R10, [R28.64] ; /* 0x000000041c0a7981 */ /* 0x0002a4000c1e1b00 */ /*0230*/ DFMA R24, R24, R14, R8 ; /* 0x0000000e1818722b */ /* 0x0087080000000008 */ /*0240*/ LDG.E.64 R8, [R2.64+0x20] ; /* 0x0000200402087981 */ /* 0x008ea2000c1e1b00 */ /*0250*/ IMAD.WIDE R16, R12, R27, c[0x0][0x160] ; /* 0x000058000c107625 */ /* 0x001fc600078e021b */ /*0260*/ LDG.E.64 R12, [R28.64+0x8] ; /* 0x000008041c0c7981 */ /* 0x0002e8000c1e1b00 */ /*0270*/ LDG.E.64 R14, [R2.64+0x28] ; /* 0x00002804020e7981 */ /* 0x000ee2000c1e1b00 */ /*0280*/ IMAD.WIDE R16, R27.reuse, c[0x0][0x180], R16 ; /* 0x000060001b107a25 */ /* 0x040fe200078e0210 */ /*0290*/ DFMA R24, R20, R22, R24 ; /* 0x000000161418722b */ /* 0x0101640000000018 */ /*02a0*/ LDG.E.64 R20, [R2.64+0x30] ; /* 0x0000300402147981 */ /* 0x001f26000c1e1b00 */ /*02b0*/ IMAD.WIDE R16, R27, c[0x0][0x180], R16 ; /* 0x000060001b107a25 */ /* 0x000fe200078e0210 */ /*02c0*/ DFMA R24, R6, R4, R24 ; /* 0x000000040618722b */ /* 0x0200a20000000018 */ /*02d0*/ LDG.E.64 R26, [R2.64+0x40] ; /* 0x00004004021a7981 */ /* 0x000f68000c1e1b00 */ /*02e0*/ LDG.E.64 R22, [R16.64] ; /* 0x0000000410167981 */ /* 0x000328000c1e1b00 */ /*02f0*/ LDG.E.64 R4, [R2.64+0x38] ; /* 0x0000380402047981 */ /* 0x001f68000c1e1b00 */ /*0300*/ LDG.E.64 R6, [R16.64+0x8] ; /* 0x0000080410067981 */ /* 0x000368000c1e1b00 */ /*0310*/ LDG.E.64 R16, [R16.64+0x10] ; /* 0x0000100410107981 */ /* 0x002f62000c1e1b00 */ /*0320*/ MUFU.RCP64H R29, c[0x0][0x17c] ; /* 0x00005f00001d7b08 */ /* 0x000e220000001800 */ /*0330*/ IMAD.MOV.U32 R28, RZ, RZ, 0x1 ; /* 0x00000001ff1c7424 */ /* 0x000fe200078e00ff */ /*0340*/ BSSY B0, 0x4c0 ; /* 0x0000017000007945 */ /* 0x000fe20003800000 */ /*0350*/ IMAD R0, R19, c[0x0][0x180], R0 ; /* 0x0000600013007a24 */ /* 0x000fe200078e0200 */ /*0360*/ DFMA R10, R8, R10, R24 ; /* 0x0000000a080a722b */ /* 0x0042c40000000018 */ /*0370*/ IMAD.MOV.U32 R8, RZ, RZ, c[0x0][0x178] ; /* 0x00005e00ff087624 */ /* 0x002fe400078e00ff */ /*0380*/ IMAD.MOV.U32 R9, RZ, RZ, c[0x0][0x17c] ; /* 0x00005f00ff097624 */ /* 0x000fe400078e00ff */ /*0390*/ DFMA R10, R14, R12, R10 ; /* 0x0000000c0e0a722b */ /* 0x008fc8000000000a */ /*03a0*/ DFMA R12, R28, -R8, 1 ; /* 0x3ff000001c0c742b */ /* 0x001e0c0000000808 */ /*03b0*/ DFMA R12, R12, R12, R12 ; /* 0x0000000c0c0c722b */ /* 0x001e08000000000c */ /*03c0*/ DFMA R10, R20, R22, R10 ; /* 0x00000016140a722b */ /* 0x010f48000000000a */ /*03d0*/ DFMA R12, R28, R12, R28 ; /* 0x0000000c1c0c722b */ /* 0x001e08000000001c */ /*03e0*/ DFMA R4, R4, R6, R10 ; /* 0x000000060404722b */ /* 0x020e48000000000a */ /*03f0*/ DFMA R8, R12, -R8, 1 ; /* 0x3ff000000c08742b */ /* 0x001e080000000808 */ /*0400*/ DFMA R16, R26, R16, R4 ; /* 0x000000101a10722b */ /* 0x002fc80000000004 */ /*0410*/ DFMA R8, R12, R8, R12 ; /* 0x000000080c08722b */ /* 0x001e0c000000000c */ /*0420*/ DMUL R2, R16, R8 ; /* 0x0000000810027228 */ /* 0x001e0c0000000000 */ /*0430*/ DFMA R4, R2, -c[0x0][0x178], R16 ; /* 0x80005e0002047a2b */ /* 0x001e0c0000000010 */ /*0440*/ DFMA R2, R8, R4, R2 ; /* 0x000000040802722b */ /* 0x001e220000000002 */ /*0450*/ FSETP.GEU.AND P1, PT, |R17|, 6.5827683646048100446e-37, PT ; /* 0x036000001100780b */ /* 0x000fd20003f2e200 */ /*0460*/ FFMA R4, RZ, c[0x0][0x17c], R3 ; /* 0x00005f00ff047a23 */ /* 0x001fca0000000003 */ /*0470*/ FSETP.GT.AND P0, PT, |R4|, 1.469367938527859385e-39, PT ; /* 0x001000000400780b */ /* 0x000fda0003f04200 */ /*0480*/ @P0 BRA P1, 0x4b0 ; /* 0x0000002000000947 */ /* 0x000fea0000800000 */ /*0490*/ MOV R8, 0x4b0 ; /* 0x000004b000087802 */ /* 0x000fe40000000f00 */ /*04a0*/ CALL.REL.NOINC 0x500 ; /* 0x0000005000007944 */ /* 0x000fea0003c00000 */ /*04b0*/ BSYNC B0 ; /* 0x0000000000007941 */ /* 0x000fea0003800000 */ /*04c0*/ IMAD.MOV.U32 R5, RZ, RZ, 0x8 ; /* 0x00000008ff057424 */ /* 0x000fc800078e00ff */ /*04d0*/ IMAD.WIDE R4, R0, R5, c[0x0][0x168] ; /* 0x00005a0000047625 */ /* 0x000fca00078e0205 */ /*04e0*/ STG.E.64 [R4.64], R2 ; /* 0x0000000204007986 */ /* 0x000fe2000c101b04 */ /*04f0*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*0500*/ IMAD.MOV.U32 R9, RZ, RZ, c[0x0][0x17c] ; /* 0x00005f00ff097624 */ /* 0x000fe200078e00ff */ /*0510*/ BSSY B1, 0xad0 ; /* 0x000005b000017945 */ /* 0x000fe20003800000 */ /*0520*/ IMAD.MOV.U32 R5, RZ, RZ, R17 ; /* 0x000000ffff057224 */ /* 0x000fe400078e0011 */ /*0530*/ IMAD.MOV.U32 R13, RZ, RZ, 0x1ca00000 ; /* 0x1ca00000ff0d7424 */ /* 0x000fe200078e00ff */ /*0540*/ FSETP.GEU.AND P0, PT, |R9|.reuse, 1.469367938527859385e-39, PT ; /* 0x001000000900780b */ /* 0x040fe20003f0e200 */ /*0550*/ IMAD.MOV.U32 R14, RZ, RZ, 0x1 ; /* 0x00000001ff0e7424 */ /* 0x000fe200078e00ff */ /*0560*/ LOP3.LUT R6, R9, 0x800fffff, RZ, 0xc0, !PT ; /* 0x800fffff09067812 */ /* 0x000fe200078ec0ff */ /*0570*/ IMAD.MOV.U32 R4, RZ, RZ, R16 ; /* 0x000000ffff047224 */ /* 0x000fe200078e0010 */ /*0580*/ FSETP.GEU.AND P2, PT, |R5|, 1.469367938527859385e-39, PT ; /* 0x001000000500780b */ /* 0x000fc40003f4e200 */ /*0590*/ LOP3.LUT R7, R6, 0x3ff00000, RZ, 0xfc, !PT ; /* 0x3ff0000006077812 */ /* 0x000fe200078efcff */ /*05a0*/ IMAD.MOV.U32 R6, RZ, RZ, c[0x0][0x178] ; /* 0x00005e00ff067624 */ /* 0x000fe200078e00ff */ /*05b0*/ LOP3.LUT R10, R9, 0x7ff00000, RZ, 0xc0, !PT ; /* 0x7ff00000090a7812 */ /* 0x000fe400078ec0ff */ /*05c0*/ LOP3.LUT R11, R5, 0x7ff00000, RZ, 0xc0, !PT ; /* 0x7ff00000050b7812 */ /* 0x000fe400078ec0ff */ /*05d0*/ MOV R21, R10.reuse ; /* 0x0000000a00157202 */ /* 0x080fe20000000f00 */ /*05e0*/ @!P0 IMAD.MOV.U32 R2, RZ, RZ, c[0x0][0x178] ; /* 0x00005e00ff028624 */ /* 0x000fe200078e00ff */ /*05f0*/ ISETP.GE.U32.AND P1, PT, R11, R10, PT ; /* 0x0000000a0b00720c */ /* 0x000fe20003f26070 */ /*0600*/ @!P0 IMAD.MOV.U32 R3, RZ, RZ, c[0x0][0x17c] ; /* 0x00005f00ff038624 */ /* 0x000fe400078e00ff */ /*0610*/ IMAD.MOV.U32 R12, RZ, RZ, R11 ; /* 0x000000ffff0c7224 */ /* 0x000fe200078e000b */ /*0620*/ SEL R13, R13, 0x63400000, !P1 ; /* 0x634000000d0d7807 */ /* 0x000fc60004800000 */ /*0630*/ @!P0 DMUL R6, R2, 8.98846567431157953865e+307 ; /* 0x7fe0000002068828 */ /* 0x000e220000000000 */ /*0640*/ @!P2 LOP3.LUT R16, R13, 0x80000000, R5, 0xf8, !PT ; /* 0x800000000d10a812 */ /* 0x000fc800078ef805 */ /*0650*/ @!P2 LOP3.LUT R17, R16, 0x100000, RZ, 0xfc, !PT ; /* 0x001000001011a812 */ /* 0x000fe200078efcff */ /*0660*/ MUFU.RCP64H R15, R7 ; /* 0x00000007000f7308 */ /* 0x001e220000001800 */ /*0670*/ @!P2 IMAD.MOV.U32 R16, RZ, RZ, RZ ; /* 0x000000ffff10a224 */ /* 0x000fc600078e00ff */ /*0680*/ @!P0 LOP3.LUT R21, R7, 0x7ff00000, RZ, 0xc0, !PT ; /* 0x7ff0000007158812 */ /* 0x000fc800078ec0ff */ /*0690*/ IADD3 R20, R21, -0x1, RZ ; /* 0xffffffff15147810 */ /* 0x000fe20007ffe0ff */ /*06a0*/ DFMA R2, R14, -R6, 1 ; /* 0x3ff000000e02742b */ /* 0x001e0c0000000806 */ /*06b0*/ DFMA R18, R2, R2, R2 ; /* 0x000000020212722b */ /* 0x0010640000000002 */ /*06c0*/ LOP3.LUT R3, R13, 0x800fffff, R5, 0xf8, !PT ; /* 0x800fffff0d037812 */ /* 0x001fe200078ef805 */ /*06d0*/ IMAD.MOV.U32 R2, RZ, RZ, R4 ; /* 0x000000ffff027224 */ /* 0x000fc600078e0004 */ /*06e0*/ DFMA R14, R14, R18, R14 ; /* 0x000000120e0e722b */ /* 0x002e08000000000e */ /*06f0*/ @!P2 DFMA R2, R2, 2, -R16 ; /* 0x400000000202a82b */ /* 0x000e480000000810 */ /*0700*/ DFMA R16, R14, -R6, 1 ; /* 0x3ff000000e10742b */ /* 0x001e0c0000000806 */ /*0710*/ @!P2 LOP3.LUT R12, R3, 0x7ff00000, RZ, 0xc0, !PT ; /* 0x7ff00000030ca812 */ /* 0x002fe200078ec0ff */ /*0720*/ DFMA R14, R14, R16, R14 ; /* 0x000000100e0e722b */ /* 0x001e06000000000e */ /*0730*/ IADD3 R18, R12, -0x1, RZ ; /* 0xffffffff0c127810 */ /* 0x000fc60007ffe0ff */ /*0740*/ DMUL R16, R14, R2 ; /* 0x000000020e107228 */ /* 0x001e220000000000 */ /*0750*/ ISETP.GT.U32.AND P0, PT, R18, 0x7feffffe, PT ; /* 0x7feffffe1200780c */ /* 0x000fc80003f04070 */ /*0760*/ ISETP.GT.U32.OR P0, PT, R20, 0x7feffffe, P0 ; /* 0x7feffffe1400780c */ /* 0x000fe20000704470 */ /*0770*/ DFMA R18, R16, -R6, R2 ; /* 0x800000061012722b */ /* 0x001e0c0000000002 */ /*0780*/ DFMA R14, R14, R18, R16 ; /* 0x000000120e0e722b */ /* 0x00104c0000000010 */ /*0790*/ @P0 BRA 0x940 ; /* 0x000001a000000947 */ /* 0x000fea0003800000 */ /*07a0*/ IMAD.IADD R10, R11, 0x1, -R10 ; /* 0x000000010b0a7824 */ /* 0x003fe400078e0a0a */ /*07b0*/ IMAD.MOV.U32 R4, RZ, RZ, RZ ; /* 0x000000ffff047224 */ /* 0x000fc600078e00ff */ /*07c0*/ IMNMX R10, R10, -0x46a00000, !PT ; /* 0xb96000000a0a7817 */ /* 0x000fc80007800200 */ /*07d0*/ IMNMX R10, R10, 0x46a00000, PT ; /* 0x46a000000a0a7817 */ /* 0x000fca0003800200 */ /*07e0*/ IMAD.IADD R13, R10, 0x1, -R13 ; /* 0x000000010a0d7824 */ /* 0x000fca00078e0a0d */ /*07f0*/ IADD3 R5, R13, 0x7fe00000, RZ ; /* 0x7fe000000d057810 */ /* 0x000fcc0007ffe0ff */ /*0800*/ DMUL R10, R14, R4 ; /* 0x000000040e0a7228 */ /* 0x000e140000000000 */ /*0810*/ FSETP.GTU.AND P0, PT, |R11|, 1.469367938527859385e-39, PT ; /* 0x001000000b00780b */ /* 0x001fda0003f0c200 */ /*0820*/ @P0 BRA 0xac0 ; /* 0x0000029000000947 */ /* 0x000fea0003800000 */ /*0830*/ DFMA R2, R14, -R6, R2 ; /* 0x800000060e02722b */ /* 0x000e220000000002 */ /*0840*/ IMAD.MOV.U32 R4, RZ, RZ, RZ ; /* 0x000000ffff047224 */ /* 0x000fd200078e00ff */ /*0850*/ FSETP.NEU.AND P0, PT, R3.reuse, RZ, PT ; /* 0x000000ff0300720b */ /* 0x041fe40003f0d000 */ /*0860*/ LOP3.LUT R2, R3, c[0x0][0x17c], RZ, 0x3c, !PT ; /* 0x00005f0003027a12 */ /* 0x000fc800078e3cff */ /*0870*/ LOP3.LUT R7, R2, 0x80000000, RZ, 0xc0, !PT ; /* 0x8000000002077812 */ /* 0x000fc800078ec0ff */ /*0880*/ LOP3.LUT R5, R7, R5, RZ, 0xfc, !PT ; /* 0x0000000507057212 */ /* 0x000fc600078efcff */ /*0890*/ @!P0 BRA 0xac0 ; /* 0x0000022000008947 */ /* 0x000fea0003800000 */ /*08a0*/ IMAD.MOV R3, RZ, RZ, -R13 ; /* 0x000000ffff037224 */ /* 0x000fe200078e0a0d */ /*08b0*/ DMUL.RP R4, R14, R4 ; /* 0x000000040e047228 */ /* 0x000e220000008000 */ /*08c0*/ IMAD.MOV.U32 R2, RZ, RZ, RZ ; /* 0x000000ffff027224 */ /* 0x000fe200078e00ff */ /*08d0*/ IADD3 R13, -R13, -0x43300000, RZ ; /* 0xbcd000000d0d7810 */ /* 0x000fca0007ffe1ff */ /*08e0*/ DFMA R2, R10, -R2, R14 ; /* 0x800000020a02722b */ /* 0x000e46000000000e */ /*08f0*/ LOP3.LUT R7, R5, R7, RZ, 0x3c, !PT ; /* 0x0000000705077212 */ /* 0x001fce00078e3cff */ /*0900*/ FSETP.NEU.AND P0, PT, |R3|, R13, PT ; /* 0x0000000d0300720b */ /* 0x002fc80003f0d200 */ /*0910*/ FSEL R10, R4, R10, !P0 ; /* 0x0000000a040a7208 */ /* 0x000fe40004000000 */ /*0920*/ FSEL R11, R7, R11, !P0 ; /* 0x0000000b070b7208 */ /* 0x000fe20004000000 */ /*0930*/ BRA 0xac0 ; /* 0x0000018000007947 */ /* 0x000fea0003800000 */ /*0940*/ DSETP.NAN.AND P0, PT, R4, R4, PT ; /* 0x000000040400722a */ /* 0x003e1c0003f08000 */ /*0950*/ @P0 BRA 0xaa0 ; /* 0x0000014000000947 */ /* 0x001fea0003800000 */ /*0960*/ IMAD.MOV.U32 R2, RZ, RZ, c[0x0][0x178] ; /* 0x00005e00ff027624 */ /* 0x000fe400078e00ff */ /*0970*/ IMAD.MOV.U32 R3, RZ, RZ, c[0x0][0x17c] ; /* 0x00005f00ff037624 */ /* 0x000fcc00078e00ff */ /*0980*/ DSETP.NAN.AND P0, PT, R2, c[0x0][0x178], PT ; /* 0x00005e000200762a */ /* 0x000e1c0003f08000 */ /*0990*/ @P0 BRA 0xa70 ; /* 0x000000d000000947 */ /* 0x001fea0003800000 */ /*09a0*/ ISETP.NE.AND P0, PT, R12, R21, PT ; /* 0x000000150c00720c */ /* 0x000fe20003f05270 */ /*09b0*/ IMAD.MOV.U32 R10, RZ, RZ, 0x0 ; /* 0x00000000ff0a7424 */ /* 0x000fe200078e00ff */ /*09c0*/ MOV R11, 0xfff80000 ; /* 0xfff80000000b7802 */ /* 0x000fd60000000f00 */ /*09d0*/ @!P0 BRA 0xac0 ; /* 0x000000e000008947 */ /* 0x000fea0003800000 */ /*09e0*/ ISETP.NE.AND P0, PT, R12, 0x7ff00000, PT ; /* 0x7ff000000c00780c */ /* 0x000fe40003f05270 */ /*09f0*/ LOP3.LUT R4, R5, c[0x0][0x17c], RZ, 0x3c, !PT ; /* 0x00005f0005047a12 */ /* 0x000fe400078e3cff */ /*0a00*/ ISETP.EQ.OR P0, PT, R21, RZ, !P0 ; /* 0x000000ff1500720c */ /* 0x000fe40004702670 */ /*0a10*/ LOP3.LUT R11, R4, 0x80000000, RZ, 0xc0, !PT ; /* 0x80000000040b7812 */ /* 0x000fd600078ec0ff */ /*0a20*/ @P0 LOP3.LUT R2, R11, 0x7ff00000, RZ, 0xfc, !PT ; /* 0x7ff000000b020812 */ /* 0x000fe200078efcff */ /*0a30*/ @!P0 IMAD.MOV.U32 R10, RZ, RZ, RZ ; /* 0x000000ffff0a8224 */ /* 0x000fe400078e00ff */ /*0a40*/ @P0 IMAD.MOV.U32 R10, RZ, RZ, RZ ; /* 0x000000ffff0a0224 */ /* 0x000fe400078e00ff */ /*0a50*/ @P0 IMAD.MOV.U32 R11, RZ, RZ, R2 ; /* 0x000000ffff0b0224 */ /* 0x000fe200078e0002 */ /*0a60*/ BRA 0xac0 ; /* 0x0000005000007947 */ /* 0x000fea0003800000 */ /*0a70*/ LOP3.LUT R11, R9, 0x80000, RZ, 0xfc, !PT ; /* 0x00080000090b7812 */ /* 0x000fe200078efcff */ /*0a80*/ IMAD.MOV.U32 R10, RZ, RZ, c[0x0][0x178] ; /* 0x00005e00ff0a7624 */ /* 0x000fe200078e00ff */ /*0a90*/ BRA 0xac0 ; /* 0x0000002000007947 */ /* 0x000fea0003800000 */ /*0aa0*/ LOP3.LUT R11, R5, 0x80000, RZ, 0xfc, !PT ; /* 0x00080000050b7812 */ /* 0x000fe200078efcff */ /*0ab0*/ IMAD.MOV.U32 R10, RZ, RZ, R4 ; /* 0x000000ffff0a7224 */ /* 0x000fe400078e0004 */ /*0ac0*/ BSYNC B1 ; /* 0x0000000000017941 */ /* 0x000fea0003800000 */ /*0ad0*/ IMAD.MOV.U32 R9, RZ, RZ, 0x0 ; /* 0x00000000ff097424 */ /* 0x000fe400078e00ff */ /*0ae0*/ IMAD.MOV.U32 R2, RZ, RZ, R10 ; /* 0x000000ffff027224 */ /* 0x000fc400078e000a */ /*0af0*/ IMAD.MOV.U32 R3, RZ, RZ, R11 ; /* 0x000000ffff037224 */ /* 0x000fe200078e000b */ /*0b00*/ RET.REL.NODEC R8 0x0 ; /* 0xfffff4f008007950 */ /* 0x000fec0003c3ffff */ /*0b10*/ BRA 0xb10; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*0b20*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0b30*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0b40*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0b50*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0b60*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0b70*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0b80*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0b90*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0ba0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0bb0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0bc0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0bd0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0be0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0bf0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ ..........
You are a helpful coding assistant specialized in converting CUDA source code to CUDA host assembly.
#include <chrono> #include <iostream> #include <cuda.h> using namespace std; void gen_matrix(int *matrix, int rows, int cols) { for (int i = 0; i < rows * cols; ++i) { matrix[i] = rand() % 10; } } void print_matrix(double *matrix, int rows, int cols) { for (int i = 0; i < rows * cols; ++i) { cout << matrix[i] << " "; if ((i + 1) % cols == 0) { cout << endl; } } } #define BLOCK_SIZE 16 #define FILTER_SIZE 3 #define IDX(row, col, len) ((row)*(len)+(col)) __global__ void laplap(double *from, double *to, double *filter, double divisor, int X, int Y) { int row = blockIdx.y * blockDim.y + threadIdx.y; int col = blockIdx.x * blockDim.x + threadIdx.x; double sum = 0; if (col > 0 && row > 0 && col < X - 1 && row < Y - 1) { for (int i = -1; i < 2; ++i) { for (int j = -1; j < 2; ++j) { // assume that middle element in filter equals to 0 sum += from[(row + i) * X + (col + j)] * filter[(i + 1) * FILTER_SIZE + j + 1]; } } to[row * X + col] = sum / divisor; } } int main(int argc, char* argv[]) { int X = 128, Y = 128; double *from = new double[X * Y]; for (int i = 0; i != X; ++i) { for (int j = 0; j != Y; ++j) { from[i * Y + j] = 0; } } for (int i = 0; i != X; ++i) { from[i * Y] = 1; } double *to = new double[X * Y]; // 0 1 0 // 1 0 1 // 0 1 0 double *filter = new double[FILTER_SIZE * FILTER_SIZE]; for (int i = 0; i != FILTER_SIZE * FILTER_SIZE; ++i) { if (i % 2) { filter[i] = 1; } else { filter[i] = 0; } } print_matrix(filter, FILTER_SIZE, FILTER_SIZE); double *new_from, *new_to, *new_filter; cudaMalloc((void**) &new_from, sizeof(double) * X * Y); cudaMalloc((void**) &new_to, sizeof(double) * X * Y); cudaMalloc((void**) &new_filter, sizeof(double) * FILTER_SIZE * FILTER_SIZE); // copy matrix A and B from host to device memory cudaMemcpy(new_from, from, sizeof(double) * X * Y, cudaMemcpyHostToDevice); cudaMemcpy(new_filter, filter, sizeof(double) * FILTER_SIZE * FILTER_SIZE, cudaMemcpyHostToDevice); dim3 grid((X + BLOCK_SIZE - 1) / BLOCK_SIZE, (Y + BLOCK_SIZE - 1) / BLOCK_SIZE); dim3 block(BLOCK_SIZE, BLOCK_SIZE); int MAX_ITER = 8000; for (int it = 0; it != MAX_ITER; ++it) { laplap<<<grid, block>>>(new_from, new_to, new_filter, 4, X, Y); laplap<<<grid, block>>>(new_to, new_from, new_filter, 4, X, Y); } cudaMemcpy(to, new_from, sizeof(double) * X * Y, cudaMemcpyDeviceToHost); cudaThreadSynchronize(); FILE *f_name; f_name = fopen("res.txt", "w"); for (int i = 0; i < X; ++i) { for (int j = 0; j < Y; ++j) { fprintf(f_name, "%f\t", to[i * X + j]); } fprintf(f_name, "\n"); } cudaFree(new_from); cudaFree(new_to); cudaFree(new_filter); delete from; delete to; delete filter; }
.file "tmpxft_0010c643_00000000-6_laplas.cudafe1.cpp" .text #APP .globl _ZSt21ios_base_library_initv #NO_APP .type _ZL26__cudaUnregisterBinaryUtilv, @function _ZL26__cudaUnregisterBinaryUtilv: .LFB3773: .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 .LFE3773: .size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv .globl _Z10gen_matrixPiii .type _Z10gen_matrixPiii, @function _Z10gen_matrixPiii: .LFB3768: .cfi_startproc endbr64 imull %edx, %esi testl %esi, %esi jle .L8 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 pushq %rbx .cfi_def_cfa_offset 24 .cfi_offset 3, -24 subq $8, %rsp .cfi_def_cfa_offset 32 movq %rdi, %rbx movslq %esi, %rsi leaq (%rdi,%rsi,4), %rbp .L5: call rand@PLT movslq %eax, %rdx imulq $1717986919, %rdx, %rdx sarq $34, %rdx movl %eax, %ecx sarl $31, %ecx subl %ecx, %edx leal (%rdx,%rdx,4), %edx addl %edx, %edx subl %edx, %eax movl %eax, (%rbx) addq $4, %rbx cmpq %rbp, %rbx jne .L5 addq $8, %rsp .cfi_def_cfa_offset 24 popq %rbx .cfi_def_cfa_offset 16 popq %rbp .cfi_def_cfa_offset 8 ret .L8: .cfi_restore 3 .cfi_restore 6 ret .cfi_endproc .LFE3768: .size _Z10gen_matrixPiii, .-_Z10gen_matrixPiii .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string " " .text .globl _Z12print_matrixPdii .type _Z12print_matrixPdii, @function _Z12print_matrixPdii: .LFB3769: .cfi_startproc endbr64 imull %edx, %esi testl %esi, %esi jle .L20 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 $8, %rsp .cfi_def_cfa_offset 64 movq %rdi, %r15 movl %edx, %ebp movslq %esi, %r13 movl $1, %ebx leaq _ZSt4cout(%rip), %r12 jmp .L17 .L24: call _ZSt16__throw_bad_castv@PLT .L15: movq %r14, %rdi call _ZNKSt5ctypeIcE13_M_widen_initEv@PLT movq (%r14), %rax movl $10, %esi movq %r14, %rdi call *48(%rax) movl %eax, %esi .L16: movsbl %sil, %esi movq %r12, %rdi call _ZNSo3putEc@PLT movq %rax, %rdi call _ZNSo5flushEv@PLT .L13: leaq 1(%rbx), %rax cmpq %r13, %rbx je .L23 movq %rax, %rbx .L17: movsd -8(%r15,%rbx,8), %xmm0 movq %r12, %rdi call _ZNSo9_M_insertIdEERSoT_@PLT movq %rax, %rdi movl $1, %edx leaq .LC0(%rip), %rsi call _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT movl %ebx, %eax cltd idivl %ebp testl %edx, %edx jne .L13 movq (%r12), %rax movq -24(%rax), %rax movq 240(%r12,%rax), %r14 testq %r14, %r14 je .L24 cmpb $0, 56(%r14) je .L15 movzbl 67(%r14), %esi jmp .L16 .L23: addq $8, %rsp .cfi_def_cfa_offset 56 popq %rbx .cfi_def_cfa_offset 48 popq %rbp .cfi_def_cfa_offset 40 popq %r12 .cfi_def_cfa_offset 32 popq %r13 .cfi_def_cfa_offset 24 popq %r14 .cfi_def_cfa_offset 16 popq %r15 .cfi_def_cfa_offset 8 ret .L20: .cfi_restore 3 .cfi_restore 6 .cfi_restore 12 .cfi_restore 13 .cfi_restore 14 .cfi_restore 15 ret .cfi_endproc .LFE3769: .size _Z12print_matrixPdii, .-_Z12print_matrixPdii .globl _Z32__device_stub__Z6laplapPdS_S_diiPdS_S_dii .type _Z32__device_stub__Z6laplapPdS_S_diiPdS_S_dii, @function _Z32__device_stub__Z6laplapPdS_S_diiPdS_S_dii: .LFB3795: .cfi_startproc endbr64 subq $184, %rsp .cfi_def_cfa_offset 192 movq %rdi, 40(%rsp) movq %rsi, 32(%rsp) movq %rdx, 24(%rsp) movsd %xmm0, 16(%rsp) movl %ecx, 12(%rsp) movl %r8d, 8(%rsp) movq %fs:40, %rax movq %rax, 168(%rsp) xorl %eax, %eax leaq 40(%rsp), %rax movq %rax, 112(%rsp) leaq 32(%rsp), %rax movq %rax, 120(%rsp) leaq 24(%rsp), %rax movq %rax, 128(%rsp) leaq 16(%rsp), %rax movq %rax, 136(%rsp) leaq 12(%rsp), %rax movq %rax, 144(%rsp) leaq 8(%rsp), %rax movq %rax, 152(%rsp) movl $1, 64(%rsp) movl $1, 68(%rsp) movl $1, 72(%rsp) movl $1, 76(%rsp) movl $1, 80(%rsp) movl $1, 84(%rsp) leaq 56(%rsp), %rcx leaq 48(%rsp), %rdx leaq 76(%rsp), %rsi leaq 64(%rsp), %rdi call __cudaPopCallConfiguration@PLT testl %eax, %eax je .L29 .L25: movq 168(%rsp), %rax subq %fs:40, %rax jne .L30 addq $184, %rsp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L29: .cfi_restore_state pushq 56(%rsp) .cfi_def_cfa_offset 200 pushq 56(%rsp) .cfi_def_cfa_offset 208 leaq 128(%rsp), %r9 movq 92(%rsp), %rcx movl 100(%rsp), %r8d movq 80(%rsp), %rsi movl 88(%rsp), %edx leaq _Z6laplapPdS_S_dii(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 192 jmp .L25 .L30: call __stack_chk_fail@PLT .cfi_endproc .LFE3795: .size _Z32__device_stub__Z6laplapPdS_S_diiPdS_S_dii, .-_Z32__device_stub__Z6laplapPdS_S_diiPdS_S_dii .globl _Z6laplapPdS_S_dii .type _Z6laplapPdS_S_dii, @function _Z6laplapPdS_S_dii: .LFB3796: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z32__device_stub__Z6laplapPdS_S_diiPdS_S_dii addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE3796: .size _Z6laplapPdS_S_dii, .-_Z6laplapPdS_S_dii .section .rodata.str1.1 .LC4: .string "w" .LC5: .string "res.txt" .LC6: .string "%f\t" .LC7: .string "\n" .text .globl main .type main, @function main: .LFB3770: .cfi_startproc endbr64 pushq %r15 .cfi_def_cfa_offset 16 .cfi_offset 15, -16 pushq %r14 .cfi_def_cfa_offset 24 .cfi_offset 14, -24 pushq %r13 .cfi_def_cfa_offset 32 .cfi_offset 13, -32 pushq %r12 .cfi_def_cfa_offset 40 .cfi_offset 12, -40 pushq %rbp .cfi_def_cfa_offset 48 .cfi_offset 6, -48 pushq %rbx .cfi_def_cfa_offset 56 .cfi_offset 3, -56 subq $104, %rsp .cfi_def_cfa_offset 160 movq %fs:40, %rax movq %rax, 88(%rsp) xorl %eax, %eax movl $131072, %edi call _Znam@PLT movq %rax, 8(%rsp) movq %rax, %rcx leaq 1024(%rax), %rdx leaq 132096(%rax), %rsi .L34: leaq -1024(%rdx), %rax .L35: movq $0x000000000, (%rax) addq $8, %rax cmpq %rdx, %rax jne .L35 addq $1024, %rdx cmpq %rsi, %rdx jne .L34 movq 8(%rsp), %rax addq $131072, %rax movsd .LC1(%rip), %xmm0 .L37: movsd %xmm0, (%rcx) addq $1024, %rcx cmpq %rax, %rcx jne .L37 movl $131072, %edi call _Znam@PLT movq %rax, 24(%rsp) movl $72, %edi call _Znam@PLT movq %rax, 16(%rsp) movl $0, %eax pxor %xmm1, %xmm1 jmp .L39 .L38: movq 16(%rsp), %rcx movsd %xmm0, (%rcx,%rax,8) addq $1, %rax cmpq $9, %rax je .L54 .L39: movapd %xmm1, %xmm0 testb $1, %al je .L38 movsd .LC1(%rip), %xmm0 jmp .L38 .L54: movl $3, %edx movl $3, %esi movq %rcx, %rbx movq %rcx, %rdi call _Z12print_matrixPdii leaq 40(%rsp), %rdi movl $131072, %esi call cudaMalloc@PLT leaq 48(%rsp), %rdi movl $131072, %esi call cudaMalloc@PLT leaq 56(%rsp), %rdi movl $72, %esi call cudaMalloc@PLT movl $1, %ecx movl $131072, %edx movq 8(%rsp), %rsi movq 40(%rsp), %rdi call cudaMemcpy@PLT movl $1, %ecx movl $72, %edx movq %rbx, %rsi movq 56(%rsp), %rdi call cudaMemcpy@PLT movl $8, 64(%rsp) movl $8, 68(%rsp) movl $1, 72(%rsp) movl $16, 76(%rsp) movl $16, 80(%rsp) movl $1, 84(%rsp) movl $8000, %ebx jmp .L42 .L56: movl $128, %r8d movl $128, %ecx movsd .LC3(%rip), %xmm0 movq 56(%rsp), %rdx movq 48(%rsp), %rsi movq 40(%rsp), %rdi call _Z32__device_stub__Z6laplapPdS_S_diiPdS_S_dii jmp .L40 .L41: subl $1, %ebx je .L55 .L42: movl 84(%rsp), %ecx movl $0, %r9d movl $0, %r8d movq 76(%rsp), %rdx movq 64(%rsp), %rdi movl 72(%rsp), %esi call __cudaPushCallConfiguration@PLT testl %eax, %eax je .L56 .L40: movl 84(%rsp), %ecx movl $0, %r9d movl $0, %r8d movq 76(%rsp), %rdx movq 64(%rsp), %rdi movl 72(%rsp), %esi call __cudaPushCallConfiguration@PLT testl %eax, %eax jne .L41 movl $128, %r8d movl $128, %ecx movsd .LC3(%rip), %xmm0 movq 56(%rsp), %rdx movq 40(%rsp), %rsi movq 48(%rsp), %rdi call _Z32__device_stub__Z6laplapPdS_S_diiPdS_S_dii jmp .L41 .L55: movl $2, %ecx movl $131072, %edx movq 40(%rsp), %rsi movq 24(%rsp), %rbx movq %rbx, %rdi call cudaMemcpy@PLT call cudaThreadSynchronize@PLT leaq .LC4(%rip), %rsi leaq .LC5(%rip), %rdi call fopen@PLT movq %rax, %r12 leaq 1024(%rbx), %rbp leaq 132096(%rbx), %r15 leaq .LC6(%rip), %r13 leaq .LC7(%rip), %r14 .L43: leaq -1024(%rbp), %rbx .L44: movsd (%rbx), %xmm0 movq %r13, %rdx movl $2, %esi movq %r12, %rdi movl $1, %eax call __fprintf_chk@PLT addq $8, %rbx cmpq %rbp, %rbx jne .L44 movq %r14, %rdx movl $2, %esi movq %r12, %rdi movl $0, %eax call __fprintf_chk@PLT addq $1024, %rbp cmpq %r15, %rbp jne .L43 movq 40(%rsp), %rdi call cudaFree@PLT movq 48(%rsp), %rdi call cudaFree@PLT movq 56(%rsp), %rdi call cudaFree@PLT movl $8, %esi movq 8(%rsp), %rdi call _ZdlPvm@PLT movl $8, %esi movq 24(%rsp), %rdi call _ZdlPvm@PLT movl $8, %esi movq 16(%rsp), %rdi call _ZdlPvm@PLT movq 88(%rsp), %rax subq %fs:40, %rax jne .L57 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 .L57: .cfi_restore_state call __stack_chk_fail@PLT .cfi_endproc .LFE3770: .size main, .-main .section .rodata.str1.1 .LC8: .string "_Z6laplapPdS_S_dii" .text .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB3798: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 leaq _ZL15__fatDeviceText(%rip), %rdi call __cudaRegisterFatBinary@PLT movq %rax, %rdi movq %rax, _ZL20__cudaFatCubinHandle(%rip) pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 pushq $0 .cfi_def_cfa_offset 40 pushq $0 .cfi_def_cfa_offset 48 movl $0, %r9d movl $-1, %r8d leaq .LC8(%rip), %rdx movq %rdx, %rcx leaq _Z6laplapPdS_S_dii(%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 .LFE3798: .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 .LC1: .long 0 .long 1072693248 .align 8 .LC3: .long 0 .long 1074790400 .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 <chrono> #include <iostream> #include <cuda.h> using namespace std; void gen_matrix(int *matrix, int rows, int cols) { for (int i = 0; i < rows * cols; ++i) { matrix[i] = rand() % 10; } } void print_matrix(double *matrix, int rows, int cols) { for (int i = 0; i < rows * cols; ++i) { cout << matrix[i] << " "; if ((i + 1) % cols == 0) { cout << endl; } } } #define BLOCK_SIZE 16 #define FILTER_SIZE 3 #define IDX(row, col, len) ((row)*(len)+(col)) __global__ void laplap(double *from, double *to, double *filter, double divisor, int X, int Y) { int row = blockIdx.y * blockDim.y + threadIdx.y; int col = blockIdx.x * blockDim.x + threadIdx.x; double sum = 0; if (col > 0 && row > 0 && col < X - 1 && row < Y - 1) { for (int i = -1; i < 2; ++i) { for (int j = -1; j < 2; ++j) { // assume that middle element in filter equals to 0 sum += from[(row + i) * X + (col + j)] * filter[(i + 1) * FILTER_SIZE + j + 1]; } } to[row * X + col] = sum / divisor; } } int main(int argc, char* argv[]) { int X = 128, Y = 128; double *from = new double[X * Y]; for (int i = 0; i != X; ++i) { for (int j = 0; j != Y; ++j) { from[i * Y + j] = 0; } } for (int i = 0; i != X; ++i) { from[i * Y] = 1; } double *to = new double[X * Y]; // 0 1 0 // 1 0 1 // 0 1 0 double *filter = new double[FILTER_SIZE * FILTER_SIZE]; for (int i = 0; i != FILTER_SIZE * FILTER_SIZE; ++i) { if (i % 2) { filter[i] = 1; } else { filter[i] = 0; } } print_matrix(filter, FILTER_SIZE, FILTER_SIZE); double *new_from, *new_to, *new_filter; cudaMalloc((void**) &new_from, sizeof(double) * X * Y); cudaMalloc((void**) &new_to, sizeof(double) * X * Y); cudaMalloc((void**) &new_filter, sizeof(double) * FILTER_SIZE * FILTER_SIZE); // copy matrix A and B from host to device memory cudaMemcpy(new_from, from, sizeof(double) * X * Y, cudaMemcpyHostToDevice); cudaMemcpy(new_filter, filter, sizeof(double) * FILTER_SIZE * FILTER_SIZE, cudaMemcpyHostToDevice); dim3 grid((X + BLOCK_SIZE - 1) / BLOCK_SIZE, (Y + BLOCK_SIZE - 1) / BLOCK_SIZE); dim3 block(BLOCK_SIZE, BLOCK_SIZE); int MAX_ITER = 8000; for (int it = 0; it != MAX_ITER; ++it) { laplap<<<grid, block>>>(new_from, new_to, new_filter, 4, X, Y); laplap<<<grid, block>>>(new_to, new_from, new_filter, 4, X, Y); } cudaMemcpy(to, new_from, sizeof(double) * X * Y, cudaMemcpyDeviceToHost); cudaThreadSynchronize(); FILE *f_name; f_name = fopen("res.txt", "w"); for (int i = 0; i < X; ++i) { for (int j = 0; j < Y; ++j) { fprintf(f_name, "%f\t", to[i * X + j]); } fprintf(f_name, "\n"); } cudaFree(new_from); cudaFree(new_to); cudaFree(new_filter); delete from; delete to; delete filter; }
#include <chrono> #include <iostream> #include <hip/hip_runtime.h> using namespace std; void gen_matrix(int *matrix, int rows, int cols) { for (int i = 0; i < rows * cols; ++i) { matrix[i] = rand() % 10; } } void print_matrix(double *matrix, int rows, int cols) { for (int i = 0; i < rows * cols; ++i) { cout << matrix[i] << " "; if ((i + 1) % cols == 0) { cout << endl; } } } #define BLOCK_SIZE 16 #define FILTER_SIZE 3 #define IDX(row, col, len) ((row)*(len)+(col)) __global__ void laplap(double *from, double *to, double *filter, double divisor, int X, int Y) { int row = blockIdx.y * blockDim.y + threadIdx.y; int col = blockIdx.x * blockDim.x + threadIdx.x; double sum = 0; if (col > 0 && row > 0 && col < X - 1 && row < Y - 1) { for (int i = -1; i < 2; ++i) { for (int j = -1; j < 2; ++j) { // assume that middle element in filter equals to 0 sum += from[(row + i) * X + (col + j)] * filter[(i + 1) * FILTER_SIZE + j + 1]; } } to[row * X + col] = sum / divisor; } } int main(int argc, char* argv[]) { int X = 128, Y = 128; double *from = new double[X * Y]; for (int i = 0; i != X; ++i) { for (int j = 0; j != Y; ++j) { from[i * Y + j] = 0; } } for (int i = 0; i != X; ++i) { from[i * Y] = 1; } double *to = new double[X * Y]; // 0 1 0 // 1 0 1 // 0 1 0 double *filter = new double[FILTER_SIZE * FILTER_SIZE]; for (int i = 0; i != FILTER_SIZE * FILTER_SIZE; ++i) { if (i % 2) { filter[i] = 1; } else { filter[i] = 0; } } print_matrix(filter, FILTER_SIZE, FILTER_SIZE); double *new_from, *new_to, *new_filter; hipMalloc((void**) &new_from, sizeof(double) * X * Y); hipMalloc((void**) &new_to, sizeof(double) * X * Y); hipMalloc((void**) &new_filter, sizeof(double) * FILTER_SIZE * FILTER_SIZE); // copy matrix A and B from host to device memory hipMemcpy(new_from, from, sizeof(double) * X * Y, hipMemcpyHostToDevice); hipMemcpy(new_filter, filter, sizeof(double) * FILTER_SIZE * FILTER_SIZE, hipMemcpyHostToDevice); dim3 grid((X + BLOCK_SIZE - 1) / BLOCK_SIZE, (Y + BLOCK_SIZE - 1) / BLOCK_SIZE); dim3 block(BLOCK_SIZE, BLOCK_SIZE); int MAX_ITER = 8000; for (int it = 0; it != MAX_ITER; ++it) { laplap<<<grid, block>>>(new_from, new_to, new_filter, 4, X, Y); laplap<<<grid, block>>>(new_to, new_from, new_filter, 4, X, Y); } hipMemcpy(to, new_from, sizeof(double) * X * Y, hipMemcpyDeviceToHost); hipDeviceSynchronize(); FILE *f_name; f_name = fopen("res.txt", "w"); for (int i = 0; i < X; ++i) { for (int j = 0; j < Y; ++j) { fprintf(f_name, "%f\t", to[i * X + j]); } fprintf(f_name, "\n"); } hipFree(new_from); hipFree(new_to); hipFree(new_filter); delete from; delete to; delete filter; }
You are a helpful coding assistant specialized in converting HIP source code to AMD device assembly.
#include <chrono> #include <iostream> #include <hip/hip_runtime.h> using namespace std; void gen_matrix(int *matrix, int rows, int cols) { for (int i = 0; i < rows * cols; ++i) { matrix[i] = rand() % 10; } } void print_matrix(double *matrix, int rows, int cols) { for (int i = 0; i < rows * cols; ++i) { cout << matrix[i] << " "; if ((i + 1) % cols == 0) { cout << endl; } } } #define BLOCK_SIZE 16 #define FILTER_SIZE 3 #define IDX(row, col, len) ((row)*(len)+(col)) __global__ void laplap(double *from, double *to, double *filter, double divisor, int X, int Y) { int row = blockIdx.y * blockDim.y + threadIdx.y; int col = blockIdx.x * blockDim.x + threadIdx.x; double sum = 0; if (col > 0 && row > 0 && col < X - 1 && row < Y - 1) { for (int i = -1; i < 2; ++i) { for (int j = -1; j < 2; ++j) { // assume that middle element in filter equals to 0 sum += from[(row + i) * X + (col + j)] * filter[(i + 1) * FILTER_SIZE + j + 1]; } } to[row * X + col] = sum / divisor; } } int main(int argc, char* argv[]) { int X = 128, Y = 128; double *from = new double[X * Y]; for (int i = 0; i != X; ++i) { for (int j = 0; j != Y; ++j) { from[i * Y + j] = 0; } } for (int i = 0; i != X; ++i) { from[i * Y] = 1; } double *to = new double[X * Y]; // 0 1 0 // 1 0 1 // 0 1 0 double *filter = new double[FILTER_SIZE * FILTER_SIZE]; for (int i = 0; i != FILTER_SIZE * FILTER_SIZE; ++i) { if (i % 2) { filter[i] = 1; } else { filter[i] = 0; } } print_matrix(filter, FILTER_SIZE, FILTER_SIZE); double *new_from, *new_to, *new_filter; hipMalloc((void**) &new_from, sizeof(double) * X * Y); hipMalloc((void**) &new_to, sizeof(double) * X * Y); hipMalloc((void**) &new_filter, sizeof(double) * FILTER_SIZE * FILTER_SIZE); // copy matrix A and B from host to device memory hipMemcpy(new_from, from, sizeof(double) * X * Y, hipMemcpyHostToDevice); hipMemcpy(new_filter, filter, sizeof(double) * FILTER_SIZE * FILTER_SIZE, hipMemcpyHostToDevice); dim3 grid((X + BLOCK_SIZE - 1) / BLOCK_SIZE, (Y + BLOCK_SIZE - 1) / BLOCK_SIZE); dim3 block(BLOCK_SIZE, BLOCK_SIZE); int MAX_ITER = 8000; for (int it = 0; it != MAX_ITER; ++it) { laplap<<<grid, block>>>(new_from, new_to, new_filter, 4, X, Y); laplap<<<grid, block>>>(new_to, new_from, new_filter, 4, X, Y); } hipMemcpy(to, new_from, sizeof(double) * X * Y, hipMemcpyDeviceToHost); hipDeviceSynchronize(); FILE *f_name; f_name = fopen("res.txt", "w"); for (int i = 0; i < X; ++i) { for (int j = 0; j < Y; ++j) { fprintf(f_name, "%f\t", to[i * X + j]); } fprintf(f_name, "\n"); } hipFree(new_from); hipFree(new_to); hipFree(new_filter); delete from; delete to; delete filter; }
.text .amdgcn_target "amdgcn-amd-amdhsa--gfx1100" .protected _Z6laplapPdS_S_dii .globl _Z6laplapPdS_S_dii .p2align 8 .type _Z6laplapPdS_S_dii,@function _Z6laplapPdS_S_dii: s_clause 0x1 s_load_b32 s2, s[0:1], 0x34 s_load_b64 s[4:5], s[0:1], 0x20 v_bfe_u32 v2, v0, 10, 10 v_and_b32_e32 v1, 0x3ff, v0 s_waitcnt lgkmcnt(0) s_lshr_b32 s3, s2, 16 s_and_b32 s2, s2, 0xffff s_mul_i32 s15, s15, s3 s_mul_i32 s14, s14, s2 v_add_nc_u32_e32 v3, s15, v2 v_add_nc_u32_e32 v0, s14, v1 s_add_i32 s2, s4, -1 s_add_i32 s3, s5, -1 s_mov_b32 s5, -1 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3) v_min_i32_e32 v4, v3, v0 v_cmp_gt_i32_e32 vcc_lo, s2, v0 v_cmp_gt_i32_e64 s2, s3, v3 v_cmp_lt_i32_e64 s3, 0, v4 s_delay_alu instid0(VALU_DEP_2) s_and_b32 s2, vcc_lo, s2 s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1) s_and_b32 s2, s2, s3 s_delay_alu instid0(SALU_CYCLE_1) s_and_saveexec_b32 s3, s2 s_cbranch_execz .LBB0_6 s_clause 0x1 s_load_b64 s[2:3], s[0:1], 0x0 s_load_b64 s[6:7], s[0:1], 0x10 v_add3_u32 v2, v2, s15, -1 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3) v_mad_u64_u32 v[4:5], null, s4, v2, v[1:2] v_mov_b32_e32 v1, 0 v_mov_b32_e32 v2, 0 v_add3_u32 v4, v4, s14, -1 .p2align 6 .LBB0_2: s_mov_b32 s10, 0 s_waitcnt lgkmcnt(0) s_mov_b64 s[8:9], s[6:7] .p2align 6 .LBB0_3: s_delay_alu instid0(VALU_DEP_1) v_add_nc_u32_e32 v5, s10, v4 s_load_b64 s[12:13], s[8:9], 0x0 s_add_i32 s10, s10, 1 s_add_u32 s8, s8, 8 s_addc_u32 s9, s9, 0 v_ashrrev_i32_e32 v6, 31, v5 s_cmp_eq_u32 s10, 3 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_lshlrev_b64 v[5:6], 3, v[5:6] v_add_co_u32 v5, vcc_lo, s2, v5 s_delay_alu instid0(VALU_DEP_2) v_add_co_ci_u32_e32 v6, vcc_lo, s3, v6, vcc_lo global_load_b64 v[5:6], v[5:6], off s_waitcnt vmcnt(0) lgkmcnt(0) v_fma_f64 v[1:2], v[5:6], s[12:13], v[1:2] s_cbranch_scc0 .LBB0_3 s_add_i32 s5, s5, 1 v_add_nc_u32_e32 v4, s4, v4 s_add_u32 s6, s6, 24 s_addc_u32 s7, s7, 0 s_cmp_eq_u32 s5, 2 s_cbranch_scc0 .LBB0_2 s_clause 0x1 s_load_b64 s[2:3], s[0:1], 0x18 s_load_b64 s[0:1], s[0:1], 0x8 s_waitcnt lgkmcnt(0) s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1) v_div_scale_f64 v[4:5], null, s[2:3], s[2:3], v[1:2] 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[1:2], s[2:3], v[1:2] 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(NEXT) | instid1(VALU_DEP_1) v_div_fixup_f64 v[1:2], v[4:5], s[2:3], v[1:2] v_mad_u64_u32 v[4:5], null, v3, s4, v[0:1] s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_ashrrev_i32_e32 v5, 31, v4 v_lshlrev_b64 v[3:4], 3, v[4:5] s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2) v_add_co_u32 v3, vcc_lo, s0, v3 v_add_co_ci_u32_e32 v4, vcc_lo, s1, v4, vcc_lo global_store_b64 v[3:4], v[1:2], off .LBB0_6: s_nop 0 s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z6laplapPdS_S_dii .amdhsa_group_segment_fixed_size 0 .amdhsa_private_segment_fixed_size 0 .amdhsa_kernarg_size 296 .amdhsa_user_sgpr_count 14 .amdhsa_user_sgpr_dispatch_ptr 0 .amdhsa_user_sgpr_queue_ptr 0 .amdhsa_user_sgpr_kernarg_segment_ptr 1 .amdhsa_user_sgpr_dispatch_id 0 .amdhsa_user_sgpr_private_segment_size 0 .amdhsa_wavefront_size32 1 .amdhsa_uses_dynamic_stack 0 .amdhsa_enable_private_segment 0 .amdhsa_system_sgpr_workgroup_id_x 1 .amdhsa_system_sgpr_workgroup_id_y 1 .amdhsa_system_sgpr_workgroup_id_z 0 .amdhsa_system_sgpr_workgroup_info 0 .amdhsa_system_vgpr_workitem_id 1 .amdhsa_next_free_vgpr 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 _Z6laplapPdS_S_dii, .Lfunc_end0-_Z6laplapPdS_S_dii .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 - .offset: 32 .size: 4 .value_kind: by_value - .offset: 36 .size: 4 .value_kind: by_value - .offset: 40 .size: 4 .value_kind: hidden_block_count_x - .offset: 44 .size: 4 .value_kind: hidden_block_count_y - .offset: 48 .size: 4 .value_kind: hidden_block_count_z - .offset: 52 .size: 2 .value_kind: hidden_group_size_x - .offset: 54 .size: 2 .value_kind: hidden_group_size_y - .offset: 56 .size: 2 .value_kind: hidden_group_size_z - .offset: 58 .size: 2 .value_kind: hidden_remainder_x - .offset: 60 .size: 2 .value_kind: hidden_remainder_y - .offset: 62 .size: 2 .value_kind: hidden_remainder_z - .offset: 80 .size: 8 .value_kind: hidden_global_offset_x - .offset: 88 .size: 8 .value_kind: hidden_global_offset_y - .offset: 96 .size: 8 .value_kind: hidden_global_offset_z - .offset: 104 .size: 2 .value_kind: hidden_grid_dims .group_segment_fixed_size: 0 .kernarg_segment_align: 8 .kernarg_segment_size: 296 .language: OpenCL C .language_version: - 2 - 0 .max_flat_workgroup_size: 1024 .name: _Z6laplapPdS_S_dii .private_segment_fixed_size: 0 .sgpr_count: 18 .sgpr_spill_count: 0 .symbol: _Z6laplapPdS_S_dii.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 <chrono> #include <iostream> #include <hip/hip_runtime.h> using namespace std; void gen_matrix(int *matrix, int rows, int cols) { for (int i = 0; i < rows * cols; ++i) { matrix[i] = rand() % 10; } } void print_matrix(double *matrix, int rows, int cols) { for (int i = 0; i < rows * cols; ++i) { cout << matrix[i] << " "; if ((i + 1) % cols == 0) { cout << endl; } } } #define BLOCK_SIZE 16 #define FILTER_SIZE 3 #define IDX(row, col, len) ((row)*(len)+(col)) __global__ void laplap(double *from, double *to, double *filter, double divisor, int X, int Y) { int row = blockIdx.y * blockDim.y + threadIdx.y; int col = blockIdx.x * blockDim.x + threadIdx.x; double sum = 0; if (col > 0 && row > 0 && col < X - 1 && row < Y - 1) { for (int i = -1; i < 2; ++i) { for (int j = -1; j < 2; ++j) { // assume that middle element in filter equals to 0 sum += from[(row + i) * X + (col + j)] * filter[(i + 1) * FILTER_SIZE + j + 1]; } } to[row * X + col] = sum / divisor; } } int main(int argc, char* argv[]) { int X = 128, Y = 128; double *from = new double[X * Y]; for (int i = 0; i != X; ++i) { for (int j = 0; j != Y; ++j) { from[i * Y + j] = 0; } } for (int i = 0; i != X; ++i) { from[i * Y] = 1; } double *to = new double[X * Y]; // 0 1 0 // 1 0 1 // 0 1 0 double *filter = new double[FILTER_SIZE * FILTER_SIZE]; for (int i = 0; i != FILTER_SIZE * FILTER_SIZE; ++i) { if (i % 2) { filter[i] = 1; } else { filter[i] = 0; } } print_matrix(filter, FILTER_SIZE, FILTER_SIZE); double *new_from, *new_to, *new_filter; hipMalloc((void**) &new_from, sizeof(double) * X * Y); hipMalloc((void**) &new_to, sizeof(double) * X * Y); hipMalloc((void**) &new_filter, sizeof(double) * FILTER_SIZE * FILTER_SIZE); // copy matrix A and B from host to device memory hipMemcpy(new_from, from, sizeof(double) * X * Y, hipMemcpyHostToDevice); hipMemcpy(new_filter, filter, sizeof(double) * FILTER_SIZE * FILTER_SIZE, hipMemcpyHostToDevice); dim3 grid((X + BLOCK_SIZE - 1) / BLOCK_SIZE, (Y + BLOCK_SIZE - 1) / BLOCK_SIZE); dim3 block(BLOCK_SIZE, BLOCK_SIZE); int MAX_ITER = 8000; for (int it = 0; it != MAX_ITER; ++it) { laplap<<<grid, block>>>(new_from, new_to, new_filter, 4, X, Y); laplap<<<grid, block>>>(new_to, new_from, new_filter, 4, X, Y); } hipMemcpy(to, new_from, sizeof(double) * X * Y, hipMemcpyDeviceToHost); hipDeviceSynchronize(); FILE *f_name; f_name = fopen("res.txt", "w"); for (int i = 0; i < X; ++i) { for (int j = 0; j < Y; ++j) { fprintf(f_name, "%f\t", to[i * X + j]); } fprintf(f_name, "\n"); } hipFree(new_from); hipFree(new_to); hipFree(new_filter); delete from; delete to; delete filter; }
.text .file "laplas.hip" # Start of file scope inline assembly .globl _ZSt21ios_base_library_initv # End of file scope inline assembly .globl _Z10gen_matrixPiii # -- Begin function _Z10gen_matrixPiii .p2align 4, 0x90 .type _Z10gen_matrixPiii,@function _Z10gen_matrixPiii: # @_Z10gen_matrixPiii .cfi_startproc # %bb.0: imull %edx, %esi testl %esi, %esi jle .LBB0_4 # %bb.1: # %.lr.ph.preheader pushq %r15 .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 %r15, -16 movq %rdi, %rbx movl %esi, %r14d xorl %r15d, %r15d .p2align 4, 0x90 .LBB0_2: # %.lr.ph # =>This Inner Loop Header: Depth=1 callq rand cltq imulq $1717986919, %rax, %rcx # imm = 0x66666667 movq %rcx, %rdx shrq $63, %rdx sarq $34, %rcx addl %edx, %ecx addl %ecx, %ecx leal (%rcx,%rcx,4), %ecx subl %ecx, %eax movl %eax, (%rbx,%r15,4) incq %r15 cmpq %r15, %r14 jne .LBB0_2 # %bb.3: popq %rbx .cfi_def_cfa_offset 24 popq %r14 .cfi_def_cfa_offset 16 popq %r15 .cfi_def_cfa_offset 8 .cfi_restore %rbx .cfi_restore %r14 .cfi_restore %r15 .LBB0_4: # %._crit_edge retq .Lfunc_end0: .size _Z10gen_matrixPiii, .Lfunc_end0-_Z10gen_matrixPiii .cfi_endproc # -- End function .globl _Z12print_matrixPdii # -- Begin function _Z12print_matrixPdii .p2align 4, 0x90 .type _Z12print_matrixPdii,@function _Z12print_matrixPdii: # @_Z12print_matrixPdii .cfi_startproc # %bb.0: pushq %r15 .cfi_def_cfa_offset 16 pushq %r14 .cfi_def_cfa_offset 24 pushq %r13 .cfi_def_cfa_offset 32 pushq %r12 .cfi_def_cfa_offset 40 pushq %rbx .cfi_def_cfa_offset 48 .cfi_offset %rbx, -48 .cfi_offset %r12, -40 .cfi_offset %r13, -32 .cfi_offset %r14, -24 .cfi_offset %r15, -16 imull %edx, %esi testl %esi, %esi jle .LBB1_9 # %bb.1: # %.lr.ph.preheader movl %edx, %ebx movq %rdi, %r14 movl %esi, %r13d xorl %r15d, %r15d jmp .LBB1_2 .LBB1_6: # in Loop: Header=BB1_2 Depth=1 movq %r12, %rdi callq _ZNKSt5ctypeIcE13_M_widen_initEv movq (%r12), %rax movq %r12, %rdi movl $10, %esi callq *48(%rax) .LBB1_7: # %_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_.exit # in Loop: Header=BB1_2 Depth=1 movsbl %al, %esi movl $_ZSt4cout, %edi callq _ZNSo3putEc movq %rax, %rdi callq _ZNSo5flushEv .LBB1_8: # in Loop: Header=BB1_2 Depth=1 cmpq %r15, %r13 je .LBB1_9 .LBB1_2: # %.lr.ph # =>This Inner Loop Header: Depth=1 movsd (%r14,%r15,8), %xmm0 # xmm0 = mem[0],zero movl $_ZSt4cout, %edi callq _ZNSo9_M_insertIdEERSoT_ movl $.L.str, %esi movl $1, %edx movq %rax, %rdi callq _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l incq %r15 movl %r15d, %eax cltd idivl %ebx testl %edx, %edx jne .LBB1_8 # %bb.3: # in Loop: Header=BB1_2 Depth=1 movq _ZSt4cout(%rip), %rax movq -24(%rax), %rax movq _ZSt4cout+240(%rax), %r12 testq %r12, %r12 je .LBB1_10 # %bb.4: # %_ZSt13__check_facetISt5ctypeIcEERKT_PS3_.exit.i.i # in Loop: Header=BB1_2 Depth=1 cmpb $0, 56(%r12) je .LBB1_6 # %bb.5: # in Loop: Header=BB1_2 Depth=1 movzbl 67(%r12), %eax jmp .LBB1_7 .LBB1_9: # %._crit_edge popq %rbx .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 retq .LBB1_10: .cfi_def_cfa_offset 48 callq _ZSt16__throw_bad_castv .Lfunc_end1: .size _Z12print_matrixPdii, .Lfunc_end1-_Z12print_matrixPdii .cfi_endproc # -- End function .globl _Z21__device_stub__laplapPdS_S_dii # -- Begin function _Z21__device_stub__laplapPdS_S_dii .p2align 4, 0x90 .type _Z21__device_stub__laplapPdS_S_dii,@function _Z21__device_stub__laplapPdS_S_dii: # @_Z21__device_stub__laplapPdS_S_dii .cfi_startproc # %bb.0: subq $152, %rsp .cfi_def_cfa_offset 160 movq %rdi, 88(%rsp) movq %rsi, 80(%rsp) movq %rdx, 72(%rsp) movsd %xmm0, 64(%rsp) movl %ecx, 12(%rsp) movl %r8d, 8(%rsp) leaq 88(%rsp), %rax movq %rax, 96(%rsp) leaq 80(%rsp), %rax movq %rax, 104(%rsp) leaq 72(%rsp), %rax movq %rax, 112(%rsp) leaq 64(%rsp), %rax movq %rax, 120(%rsp) leaq 12(%rsp), %rax movq %rax, 128(%rsp) leaq 8(%rsp), %rax movq %rax, 136(%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 96(%rsp), %r9 movl $_Z6laplapPdS_S_dii, %edi pushq 16(%rsp) .cfi_adjust_cfa_offset 8 pushq 32(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $168, %rsp .cfi_adjust_cfa_offset -168 retq .Lfunc_end2: .size _Z21__device_stub__laplapPdS_S_dii, .Lfunc_end2-_Z21__device_stub__laplapPdS_S_dii .cfi_endproc # -- End function .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 # -- Begin function main .LCPI3_0: .quad 0x3ff0000000000000 # double 1 .text .globl main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: # %.preheader102.preheader pushq %rbp .cfi_def_cfa_offset 16 pushq %r15 .cfi_def_cfa_offset 24 pushq %r14 .cfi_def_cfa_offset 32 pushq %r13 .cfi_def_cfa_offset 40 pushq %r12 .cfi_def_cfa_offset 48 pushq %rbx .cfi_def_cfa_offset 56 subq $184, %rsp .cfi_def_cfa_offset 240 .cfi_offset %rbx, -56 .cfi_offset %r12, -48 .cfi_offset %r13, -40 .cfi_offset %r14, -32 .cfi_offset %r15, -24 .cfi_offset %rbp, -16 movl $131072, %edi # imm = 0x20000 callq _Znam movq %rax, %rbx xorl %r14d, %r14d movl $131072, %edx # imm = 0x20000 movq %rax, %rdi xorl %esi, %esi callq memset@PLT movabsq $4607182418800017408, %rax # imm = 0x3FF0000000000000 .p2align 4, 0x90 .LBB3_1: # %.preheader102 # =>This Inner Loop Header: Depth=1 movq %rax, (%rbx,%r14) addq $1024, %r14 # imm = 0x400 cmpq $131072, %r14 # imm = 0x20000 jne .LBB3_1 # %bb.2: movl $131072, %edi # imm = 0x20000 callq _Znam movq %rax, 120(%rsp) # 8-byte Spill movl $72, %edi callq _Znam movq %rax, %r15 xorl %eax, %eax movsd .LCPI3_0(%rip), %xmm0 # xmm0 = mem[0],zero jmp .LBB3_3 .p2align 4, 0x90 .LBB3_5: # in Loop: Header=BB3_3 Depth=1 movsd %xmm1, (%r15,%rax,8) incq %rax cmpq $9, %rax je .LBB3_6 .LBB3_3: # =>This Inner Loop Header: Depth=1 xorps %xmm1, %xmm1 testb $1, %al je .LBB3_5 # %bb.4: # in Loop: Header=BB3_3 Depth=1 movaps %xmm0, %xmm1 jmp .LBB3_5 .LBB3_6: movabsq $68719476752, %r12 # imm = 0x1000000010 movabsq $34359738376, %r13 # imm = 0x800000008 movq %r15, %rdi movl $3, %esi movl $3, %edx callq _Z12print_matrixPdii leaq 16(%rsp), %rdi movl $131072, %esi # imm = 0x20000 callq hipMalloc leaq 32(%rsp), %rdi movl $131072, %esi # imm = 0x20000 callq hipMalloc leaq 24(%rsp), %rdi movl $72, %esi callq hipMalloc movq 16(%rsp), %rdi movl $131072, %edx # imm = 0x20000 movq %rbx, %rsi movl $1, %ecx callq hipMemcpy movq 24(%rsp), %rdi movl $72, %edx movq %r15, %rsi movl $1, %ecx callq hipMemcpy movl $8000, %r14d # imm = 0x1F40 leaq 128(%rsp), %rbp jmp .LBB3_7 .p2align 4, 0x90 .LBB3_11: # in Loop: Header=BB3_7 Depth=1 decl %r14d je .LBB3_12 .LBB3_7: # =>This Inner Loop Header: Depth=1 movq %r13, %rdi movl $1, %esi movq %r12, %rdx movl $1, %ecx xorl %r8d, %r8d xorl %r9d, %r9d callq __hipPushCallConfiguration testl %eax, %eax jne .LBB3_9 # %bb.8: # in Loop: Header=BB3_7 Depth=1 movq 16(%rsp), %rax movq 32(%rsp), %rcx movq 24(%rsp), %rdx movq %rax, 112(%rsp) movq %rcx, 104(%rsp) movq %rdx, 96(%rsp) movabsq $4616189618054758400, %rax # imm = 0x4010000000000000 movq %rax, 88(%rsp) movl $128, 12(%rsp) movl $128, 8(%rsp) leaq 112(%rsp), %rax movq %rax, 128(%rsp) leaq 104(%rsp), %rax movq %rax, 136(%rsp) leaq 96(%rsp), %rax movq %rax, 144(%rsp) leaq 88(%rsp), %rax movq %rax, 152(%rsp) leaq 12(%rsp), %rax movq %rax, 160(%rsp) leaq 8(%rsp), %rax movq %rax, 168(%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 movl $_Z6laplapPdS_S_dii, %edi movq %rbp, %r9 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 .LBB3_9: # in Loop: Header=BB3_7 Depth=1 movq %r13, %rdi movl $1, %esi movq %r12, %rdx movl $1, %ecx xorl %r8d, %r8d xorl %r9d, %r9d callq __hipPushCallConfiguration testl %eax, %eax jne .LBB3_11 # %bb.10: # in Loop: Header=BB3_7 Depth=1 movq 32(%rsp), %rax movq 16(%rsp), %rcx movq 24(%rsp), %rdx movq %rax, 112(%rsp) movq %rcx, 104(%rsp) movq %rdx, 96(%rsp) movabsq $4616189618054758400, %rax # imm = 0x4010000000000000 movq %rax, 88(%rsp) movl $128, 12(%rsp) movl $128, 8(%rsp) leaq 112(%rsp), %rax movq %rax, 128(%rsp) leaq 104(%rsp), %rax movq %rax, 136(%rsp) leaq 96(%rsp), %rax movq %rax, 144(%rsp) leaq 88(%rsp), %rax movq %rax, 152(%rsp) leaq 12(%rsp), %rax movq %rax, 160(%rsp) leaq 8(%rsp), %rax movq %rax, 168(%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 movl $_Z6laplapPdS_S_dii, %edi movq %rbp, %r9 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 jmp .LBB3_11 .LBB3_12: movq 16(%rsp), %rsi movl $131072, %edx # imm = 0x20000 movq 120(%rsp), %r13 # 8-byte Reload movq %r13, %rdi movl $2, %ecx callq hipMemcpy callq hipDeviceSynchronize movl $.L.str.1, %edi movl $.L.str.2, %esi callq fopen movq %rax, %r14 xorl %r12d, %r12d .p2align 4, 0x90 .LBB3_13: # %.preheader # =>This Loop Header: Depth=1 # Child Loop BB3_14 Depth 2 xorl %ebp, %ebp .p2align 4, 0x90 .LBB3_14: # Parent Loop BB3_13 Depth=1 # => This Inner Loop Header: Depth=2 movsd (%r13,%rbp,8), %xmm0 # xmm0 = mem[0],zero movl $.L.str.3, %esi movq %r14, %rdi movb $1, %al callq fprintf incq %rbp cmpq $128, %rbp jne .LBB3_14 # %bb.15: # in Loop: Header=BB3_13 Depth=1 movl $10, %edi movq %r14, %rsi callq fputc@PLT incq %r12 addq $1024, %r13 # imm = 0x400 cmpq $128, %r12 jne .LBB3_13 # %bb.16: movq 16(%rsp), %rdi callq hipFree movq 32(%rsp), %rdi callq hipFree movq 24(%rsp), %rdi callq hipFree movq %rbx, %rdi callq _ZdlPv movq 120(%rsp), %rdi # 8-byte Reload callq _ZdlPv movq %r15, %rdi callq _ZdlPv xorl %eax, %eax addq $184, %rsp .cfi_def_cfa_offset 56 popq %rbx .cfi_def_cfa_offset 48 popq %r12 .cfi_def_cfa_offset 40 popq %r13 .cfi_def_cfa_offset 32 popq %r14 .cfi_def_cfa_offset 24 popq %r15 .cfi_def_cfa_offset 16 popq %rbp .cfi_def_cfa_offset 8 retq .Lfunc_end3: .size main, .Lfunc_end3-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 .LBB4_2 # %bb.1: movl $__hip_fatbin_wrapper, %edi callq __hipRegisterFatBinary movq %rax, __hip_gpubin_handle(%rip) .LBB4_2: movq __hip_gpubin_handle(%rip), %rdi xorps %xmm0, %xmm0 movups %xmm0, 16(%rsp) movups %xmm0, (%rsp) movl $_Z6laplapPdS_S_dii, %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_end4: .size __hip_module_ctor, .Lfunc_end4-__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 .LBB5_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 .LBB5_2: retq .Lfunc_end5: .size __hip_module_dtor, .Lfunc_end5-__hip_module_dtor .cfi_endproc # -- End function .type .L.str,@object # @.str .section .rodata.str1.1,"aMS",@progbits,1 .L.str: .asciz " " .size .L.str, 2 .type _Z6laplapPdS_S_dii,@object # @_Z6laplapPdS_S_dii .section .rodata,"a",@progbits .globl _Z6laplapPdS_S_dii .p2align 3, 0x0 _Z6laplapPdS_S_dii: .quad _Z21__device_stub__laplapPdS_S_dii .size _Z6laplapPdS_S_dii, 8 .type .L.str.1,@object # @.str.1 .section .rodata.str1.1,"aMS",@progbits,1 .L.str.1: .asciz "res.txt" .size .L.str.1, 8 .type .L.str.2,@object # @.str.2 .L.str.2: .asciz "w" .size .L.str.2, 2 .type .L.str.3,@object # @.str.3 .L.str.3: .asciz "%f\t" .size .L.str.3, 4 .type .L__unnamed_1,@object # @0 .L__unnamed_1: .asciz "_Z6laplapPdS_S_dii" .size .L__unnamed_1, 19 .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__laplapPdS_S_dii .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _ZSt4cout .addrsig_sym _Z6laplapPdS_S_dii .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 : _Z6laplapPdS_S_dii .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 R19, SR_CTAID.Y ; /* 0x0000000000137919 */ /* 0x000e220000002600 */ /*0020*/ UMOV UR5, 0x1 ; /* 0x0000000100057882 */ /* 0x000fe40000000000 */ /*0030*/ ULDC.64 UR6, c[0x0][0x180] ; /* 0x0000600000067ab9 */ /* 0x000fe20000000a00 */ /*0040*/ S2R R0, SR_TID.Y ; /* 0x0000000000007919 */ /* 0x000e220000002200 */ /*0050*/ UIADD3 UR4, -UR5, UR6, URZ ; /* 0x0000000605047290 */ /* 0x000fe4000fffe13f */ /*0060*/ UIADD3 UR5, -UR5, UR7, URZ ; /* 0x0000000705057290 */ /* 0x000fe2000fffe13f */ /*0070*/ S2R R2, SR_CTAID.X ; /* 0x0000000000027919 */ /* 0x000e680000002500 */ /*0080*/ S2R R3, SR_TID.X ; /* 0x0000000000037919 */ /* 0x000e620000002100 */ /*0090*/ IMAD R19, R19, c[0x0][0x4], R0 ; /* 0x0000010013137a24 */ /* 0x001fca00078e0200 */ /*00a0*/ ISETP.GE.AND P0, PT, R19, 0x1, PT ; /* 0x000000011300780c */ /* 0x000fe20003f06270 */ /*00b0*/ IMAD R0, R2, c[0x0][0x0], R3 ; /* 0x0000000002007a24 */ /* 0x002fca00078e0203 */ /*00c0*/ ISETP.LT.OR P0, PT, R0, 0x1, !P0 ; /* 0x000000010000780c */ /* 0x000fc80004701670 */ /*00d0*/ ISETP.GE.OR P0, PT, R0, UR4, P0 ; /* 0x0000000400007c0c */ /* 0x000fc80008706670 */ /*00e0*/ ISETP.GE.OR P0, PT, R19, UR5, P0 ; /* 0x0000000513007c0c */ /* 0x000fda0008706670 */ /*00f0*/ @P0 EXIT ; /* 0x000000000000094d */ /* 0x000fea0003800000 */ /*0100*/ IADD3 R3, R19, -0x1, RZ ; /* 0xffffffff13037810 */ /* 0x000fe20007ffe0ff */ /*0110*/ IMAD.MOV.U32 R27, RZ, RZ, 0x8 ; /* 0x00000008ff1b7424 */ /* 0x000fe200078e00ff */ /*0120*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */ /* 0x000fe20000000a00 */ /*0130*/ IMAD.MOV.U32 R2, RZ, RZ, c[0x0][0x170] ; /* 0x00005c00ff027624 */ /* 0x000fe400078e00ff */ /*0140*/ IMAD R10, R3, c[0x0][0x180], R0 ; /* 0x00006000030a7a24 */ /* 0x000fe400078e0200 */ /*0150*/ IMAD.MOV.U32 R3, RZ, RZ, c[0x0][0x174] ; /* 0x00005d00ff037624 */ /* 0x000fe400078e00ff */ /*0160*/ IMAD.WIDE R16, R10, R27, c[0x0][0x160] ; /* 0x000058000a107625 */ /* 0x000fc600078e021b */ /*0170*/ LDG.E.64 R8, [R2.64] ; /* 0x0000000402087981 */ /* 0x000ea8000c1e1b00 */ /*0180*/ LDG.E.64 R12, [R16.64+-0x8] ; /* 0xfffff804100c7981 */ /* 0x000ea8000c1e1b00 */ /*0190*/ LDG.E.64 R24, [R2.64+0x8] ; /* 0x0000080402187981 */ /* 0x000ee8000c1e1b00 */ /*01a0*/ LDG.E.64 R14, [R16.64] ; /* 0x00000004100e7981 */ /* 0x000ee2000c1e1b00 */ /*01b0*/ IMAD.WIDE R28, R27, c[0x0][0x180], R16 ; /* 0x000060001b1c7a25 */ /* 0x000fc600078e0210 */ /*01c0*/ LDG.E.64 R20, [R2.64+0x10] ; /* 0x0000100402147981 */ /* 0x000f28000c1e1b00 */ /*01d0*/ LDG.E.64 R22, [R16.64+0x8] ; /* 0x0000080410167981 */ /* 0x000128000c1e1b00 */ /*01e0*/ LDG.E.64 R6, [R2.64+0x18] ; /* 0x0000180402067981 */ /* 0x000f68000c1e1b00 */ /*01f0*/ LDG.E.64 R4, [R28.64+-0x8] ; /* 0xfffff8041c047981 */ /* 0x000f62000c1e1b00 */ /*0200*/ DFMA R8, R8, R12, RZ ; /* 0x0000000c0808722b */ /* 0x0042c400000000ff */ /*0210*/ IADD3 R12, R10, -0x1, RZ ; /* 0xffffffff0a0c7810 */ /* 0x002fe40007ffe0ff */ /*0220*/ LDG.E.64 R10, [R28.64] ; /* 0x000000041c0a7981 */ /* 0x0002a4000c1e1b00 */ /*0230*/ DFMA R24, R24, R14, R8 ; /* 0x0000000e1818722b */ /* 0x0087080000000008 */ /*0240*/ LDG.E.64 R8, [R2.64+0x20] ; /* 0x0000200402087981 */ /* 0x008ea2000c1e1b00 */ /*0250*/ IMAD.WIDE R16, R12, R27, c[0x0][0x160] ; /* 0x000058000c107625 */ /* 0x001fc600078e021b */ /*0260*/ LDG.E.64 R12, [R28.64+0x8] ; /* 0x000008041c0c7981 */ /* 0x0002e8000c1e1b00 */ /*0270*/ LDG.E.64 R14, [R2.64+0x28] ; /* 0x00002804020e7981 */ /* 0x000ee2000c1e1b00 */ /*0280*/ IMAD.WIDE R16, R27.reuse, c[0x0][0x180], R16 ; /* 0x000060001b107a25 */ /* 0x040fe200078e0210 */ /*0290*/ DFMA R24, R20, R22, R24 ; /* 0x000000161418722b */ /* 0x0101640000000018 */ /*02a0*/ LDG.E.64 R20, [R2.64+0x30] ; /* 0x0000300402147981 */ /* 0x001f26000c1e1b00 */ /*02b0*/ IMAD.WIDE R16, R27, c[0x0][0x180], R16 ; /* 0x000060001b107a25 */ /* 0x000fe200078e0210 */ /*02c0*/ DFMA R24, R6, R4, R24 ; /* 0x000000040618722b */ /* 0x0200a20000000018 */ /*02d0*/ LDG.E.64 R26, [R2.64+0x40] ; /* 0x00004004021a7981 */ /* 0x000f68000c1e1b00 */ /*02e0*/ LDG.E.64 R22, [R16.64] ; /* 0x0000000410167981 */ /* 0x000328000c1e1b00 */ /*02f0*/ LDG.E.64 R4, [R2.64+0x38] ; /* 0x0000380402047981 */ /* 0x001f68000c1e1b00 */ /*0300*/ LDG.E.64 R6, [R16.64+0x8] ; /* 0x0000080410067981 */ /* 0x000368000c1e1b00 */ /*0310*/ LDG.E.64 R16, [R16.64+0x10] ; /* 0x0000100410107981 */ /* 0x002f62000c1e1b00 */ /*0320*/ MUFU.RCP64H R29, c[0x0][0x17c] ; /* 0x00005f00001d7b08 */ /* 0x000e220000001800 */ /*0330*/ IMAD.MOV.U32 R28, RZ, RZ, 0x1 ; /* 0x00000001ff1c7424 */ /* 0x000fe200078e00ff */ /*0340*/ BSSY B0, 0x4c0 ; /* 0x0000017000007945 */ /* 0x000fe20003800000 */ /*0350*/ IMAD R0, R19, c[0x0][0x180], R0 ; /* 0x0000600013007a24 */ /* 0x000fe200078e0200 */ /*0360*/ DFMA R10, R8, R10, R24 ; /* 0x0000000a080a722b */ /* 0x0042c40000000018 */ /*0370*/ IMAD.MOV.U32 R8, RZ, RZ, c[0x0][0x178] ; /* 0x00005e00ff087624 */ /* 0x002fe400078e00ff */ /*0380*/ IMAD.MOV.U32 R9, RZ, RZ, c[0x0][0x17c] ; /* 0x00005f00ff097624 */ /* 0x000fe400078e00ff */ /*0390*/ DFMA R10, R14, R12, R10 ; /* 0x0000000c0e0a722b */ /* 0x008fc8000000000a */ /*03a0*/ DFMA R12, R28, -R8, 1 ; /* 0x3ff000001c0c742b */ /* 0x001e0c0000000808 */ /*03b0*/ DFMA R12, R12, R12, R12 ; /* 0x0000000c0c0c722b */ /* 0x001e08000000000c */ /*03c0*/ DFMA R10, R20, R22, R10 ; /* 0x00000016140a722b */ /* 0x010f48000000000a */ /*03d0*/ DFMA R12, R28, R12, R28 ; /* 0x0000000c1c0c722b */ /* 0x001e08000000001c */ /*03e0*/ DFMA R4, R4, R6, R10 ; /* 0x000000060404722b */ /* 0x020e48000000000a */ /*03f0*/ DFMA R8, R12, -R8, 1 ; /* 0x3ff000000c08742b */ /* 0x001e080000000808 */ /*0400*/ DFMA R16, R26, R16, R4 ; /* 0x000000101a10722b */ /* 0x002fc80000000004 */ /*0410*/ DFMA R8, R12, R8, R12 ; /* 0x000000080c08722b */ /* 0x001e0c000000000c */ /*0420*/ DMUL R2, R16, R8 ; /* 0x0000000810027228 */ /* 0x001e0c0000000000 */ /*0430*/ DFMA R4, R2, -c[0x0][0x178], R16 ; /* 0x80005e0002047a2b */ /* 0x001e0c0000000010 */ /*0440*/ DFMA R2, R8, R4, R2 ; /* 0x000000040802722b */ /* 0x001e220000000002 */ /*0450*/ FSETP.GEU.AND P1, PT, |R17|, 6.5827683646048100446e-37, PT ; /* 0x036000001100780b */ /* 0x000fd20003f2e200 */ /*0460*/ FFMA R4, RZ, c[0x0][0x17c], R3 ; /* 0x00005f00ff047a23 */ /* 0x001fca0000000003 */ /*0470*/ FSETP.GT.AND P0, PT, |R4|, 1.469367938527859385e-39, PT ; /* 0x001000000400780b */ /* 0x000fda0003f04200 */ /*0480*/ @P0 BRA P1, 0x4b0 ; /* 0x0000002000000947 */ /* 0x000fea0000800000 */ /*0490*/ MOV R8, 0x4b0 ; /* 0x000004b000087802 */ /* 0x000fe40000000f00 */ /*04a0*/ CALL.REL.NOINC 0x500 ; /* 0x0000005000007944 */ /* 0x000fea0003c00000 */ /*04b0*/ BSYNC B0 ; /* 0x0000000000007941 */ /* 0x000fea0003800000 */ /*04c0*/ IMAD.MOV.U32 R5, RZ, RZ, 0x8 ; /* 0x00000008ff057424 */ /* 0x000fc800078e00ff */ /*04d0*/ IMAD.WIDE R4, R0, R5, c[0x0][0x168] ; /* 0x00005a0000047625 */ /* 0x000fca00078e0205 */ /*04e0*/ STG.E.64 [R4.64], R2 ; /* 0x0000000204007986 */ /* 0x000fe2000c101b04 */ /*04f0*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*0500*/ IMAD.MOV.U32 R9, RZ, RZ, c[0x0][0x17c] ; /* 0x00005f00ff097624 */ /* 0x000fe200078e00ff */ /*0510*/ BSSY B1, 0xad0 ; /* 0x000005b000017945 */ /* 0x000fe20003800000 */ /*0520*/ IMAD.MOV.U32 R5, RZ, RZ, R17 ; /* 0x000000ffff057224 */ /* 0x000fe400078e0011 */ /*0530*/ IMAD.MOV.U32 R13, RZ, RZ, 0x1ca00000 ; /* 0x1ca00000ff0d7424 */ /* 0x000fe200078e00ff */ /*0540*/ FSETP.GEU.AND P0, PT, |R9|.reuse, 1.469367938527859385e-39, PT ; /* 0x001000000900780b */ /* 0x040fe20003f0e200 */ /*0550*/ IMAD.MOV.U32 R14, RZ, RZ, 0x1 ; /* 0x00000001ff0e7424 */ /* 0x000fe200078e00ff */ /*0560*/ LOP3.LUT R6, R9, 0x800fffff, RZ, 0xc0, !PT ; /* 0x800fffff09067812 */ /* 0x000fe200078ec0ff */ /*0570*/ IMAD.MOV.U32 R4, RZ, RZ, R16 ; /* 0x000000ffff047224 */ /* 0x000fe200078e0010 */ /*0580*/ FSETP.GEU.AND P2, PT, |R5|, 1.469367938527859385e-39, PT ; /* 0x001000000500780b */ /* 0x000fc40003f4e200 */ /*0590*/ LOP3.LUT R7, R6, 0x3ff00000, RZ, 0xfc, !PT ; /* 0x3ff0000006077812 */ /* 0x000fe200078efcff */ /*05a0*/ IMAD.MOV.U32 R6, RZ, RZ, c[0x0][0x178] ; /* 0x00005e00ff067624 */ /* 0x000fe200078e00ff */ /*05b0*/ LOP3.LUT R10, R9, 0x7ff00000, RZ, 0xc0, !PT ; /* 0x7ff00000090a7812 */ /* 0x000fe400078ec0ff */ /*05c0*/ LOP3.LUT R11, R5, 0x7ff00000, RZ, 0xc0, !PT ; /* 0x7ff00000050b7812 */ /* 0x000fe400078ec0ff */ /*05d0*/ MOV R21, R10.reuse ; /* 0x0000000a00157202 */ /* 0x080fe20000000f00 */ /*05e0*/ @!P0 IMAD.MOV.U32 R2, RZ, RZ, c[0x0][0x178] ; /* 0x00005e00ff028624 */ /* 0x000fe200078e00ff */ /*05f0*/ ISETP.GE.U32.AND P1, PT, R11, R10, PT ; /* 0x0000000a0b00720c */ /* 0x000fe20003f26070 */ /*0600*/ @!P0 IMAD.MOV.U32 R3, RZ, RZ, c[0x0][0x17c] ; /* 0x00005f00ff038624 */ /* 0x000fe400078e00ff */ /*0610*/ IMAD.MOV.U32 R12, RZ, RZ, R11 ; /* 0x000000ffff0c7224 */ /* 0x000fe200078e000b */ /*0620*/ SEL R13, R13, 0x63400000, !P1 ; /* 0x634000000d0d7807 */ /* 0x000fc60004800000 */ /*0630*/ @!P0 DMUL R6, R2, 8.98846567431157953865e+307 ; /* 0x7fe0000002068828 */ /* 0x000e220000000000 */ /*0640*/ @!P2 LOP3.LUT R16, R13, 0x80000000, R5, 0xf8, !PT ; /* 0x800000000d10a812 */ /* 0x000fc800078ef805 */ /*0650*/ @!P2 LOP3.LUT R17, R16, 0x100000, RZ, 0xfc, !PT ; /* 0x001000001011a812 */ /* 0x000fe200078efcff */ /*0660*/ MUFU.RCP64H R15, R7 ; /* 0x00000007000f7308 */ /* 0x001e220000001800 */ /*0670*/ @!P2 IMAD.MOV.U32 R16, RZ, RZ, RZ ; /* 0x000000ffff10a224 */ /* 0x000fc600078e00ff */ /*0680*/ @!P0 LOP3.LUT R21, R7, 0x7ff00000, RZ, 0xc0, !PT ; /* 0x7ff0000007158812 */ /* 0x000fc800078ec0ff */ /*0690*/ IADD3 R20, R21, -0x1, RZ ; /* 0xffffffff15147810 */ /* 0x000fe20007ffe0ff */ /*06a0*/ DFMA R2, R14, -R6, 1 ; /* 0x3ff000000e02742b */ /* 0x001e0c0000000806 */ /*06b0*/ DFMA R18, R2, R2, R2 ; /* 0x000000020212722b */ /* 0x0010640000000002 */ /*06c0*/ LOP3.LUT R3, R13, 0x800fffff, R5, 0xf8, !PT ; /* 0x800fffff0d037812 */ /* 0x001fe200078ef805 */ /*06d0*/ IMAD.MOV.U32 R2, RZ, RZ, R4 ; /* 0x000000ffff027224 */ /* 0x000fc600078e0004 */ /*06e0*/ DFMA R14, R14, R18, R14 ; /* 0x000000120e0e722b */ /* 0x002e08000000000e */ /*06f0*/ @!P2 DFMA R2, R2, 2, -R16 ; /* 0x400000000202a82b */ /* 0x000e480000000810 */ /*0700*/ DFMA R16, R14, -R6, 1 ; /* 0x3ff000000e10742b */ /* 0x001e0c0000000806 */ /*0710*/ @!P2 LOP3.LUT R12, R3, 0x7ff00000, RZ, 0xc0, !PT ; /* 0x7ff00000030ca812 */ /* 0x002fe200078ec0ff */ /*0720*/ DFMA R14, R14, R16, R14 ; /* 0x000000100e0e722b */ /* 0x001e06000000000e */ /*0730*/ IADD3 R18, R12, -0x1, RZ ; /* 0xffffffff0c127810 */ /* 0x000fc60007ffe0ff */ /*0740*/ DMUL R16, R14, R2 ; /* 0x000000020e107228 */ /* 0x001e220000000000 */ /*0750*/ ISETP.GT.U32.AND P0, PT, R18, 0x7feffffe, PT ; /* 0x7feffffe1200780c */ /* 0x000fc80003f04070 */ /*0760*/ ISETP.GT.U32.OR P0, PT, R20, 0x7feffffe, P0 ; /* 0x7feffffe1400780c */ /* 0x000fe20000704470 */ /*0770*/ DFMA R18, R16, -R6, R2 ; /* 0x800000061012722b */ /* 0x001e0c0000000002 */ /*0780*/ DFMA R14, R14, R18, R16 ; /* 0x000000120e0e722b */ /* 0x00104c0000000010 */ /*0790*/ @P0 BRA 0x940 ; /* 0x000001a000000947 */ /* 0x000fea0003800000 */ /*07a0*/ IMAD.IADD R10, R11, 0x1, -R10 ; /* 0x000000010b0a7824 */ /* 0x003fe400078e0a0a */ /*07b0*/ IMAD.MOV.U32 R4, RZ, RZ, RZ ; /* 0x000000ffff047224 */ /* 0x000fc600078e00ff */ /*07c0*/ IMNMX R10, R10, -0x46a00000, !PT ; /* 0xb96000000a0a7817 */ /* 0x000fc80007800200 */ /*07d0*/ IMNMX R10, R10, 0x46a00000, PT ; /* 0x46a000000a0a7817 */ /* 0x000fca0003800200 */ /*07e0*/ IMAD.IADD R13, R10, 0x1, -R13 ; /* 0x000000010a0d7824 */ /* 0x000fca00078e0a0d */ /*07f0*/ IADD3 R5, R13, 0x7fe00000, RZ ; /* 0x7fe000000d057810 */ /* 0x000fcc0007ffe0ff */ /*0800*/ DMUL R10, R14, R4 ; /* 0x000000040e0a7228 */ /* 0x000e140000000000 */ /*0810*/ FSETP.GTU.AND P0, PT, |R11|, 1.469367938527859385e-39, PT ; /* 0x001000000b00780b */ /* 0x001fda0003f0c200 */ /*0820*/ @P0 BRA 0xac0 ; /* 0x0000029000000947 */ /* 0x000fea0003800000 */ /*0830*/ DFMA R2, R14, -R6, R2 ; /* 0x800000060e02722b */ /* 0x000e220000000002 */ /*0840*/ IMAD.MOV.U32 R4, RZ, RZ, RZ ; /* 0x000000ffff047224 */ /* 0x000fd200078e00ff */ /*0850*/ FSETP.NEU.AND P0, PT, R3.reuse, RZ, PT ; /* 0x000000ff0300720b */ /* 0x041fe40003f0d000 */ /*0860*/ LOP3.LUT R2, R3, c[0x0][0x17c], RZ, 0x3c, !PT ; /* 0x00005f0003027a12 */ /* 0x000fc800078e3cff */ /*0870*/ LOP3.LUT R7, R2, 0x80000000, RZ, 0xc0, !PT ; /* 0x8000000002077812 */ /* 0x000fc800078ec0ff */ /*0880*/ LOP3.LUT R5, R7, R5, RZ, 0xfc, !PT ; /* 0x0000000507057212 */ /* 0x000fc600078efcff */ /*0890*/ @!P0 BRA 0xac0 ; /* 0x0000022000008947 */ /* 0x000fea0003800000 */ /*08a0*/ IMAD.MOV R3, RZ, RZ, -R13 ; /* 0x000000ffff037224 */ /* 0x000fe200078e0a0d */ /*08b0*/ DMUL.RP R4, R14, R4 ; /* 0x000000040e047228 */ /* 0x000e220000008000 */ /*08c0*/ IMAD.MOV.U32 R2, RZ, RZ, RZ ; /* 0x000000ffff027224 */ /* 0x000fe200078e00ff */ /*08d0*/ IADD3 R13, -R13, -0x43300000, RZ ; /* 0xbcd000000d0d7810 */ /* 0x000fca0007ffe1ff */ /*08e0*/ DFMA R2, R10, -R2, R14 ; /* 0x800000020a02722b */ /* 0x000e46000000000e */ /*08f0*/ LOP3.LUT R7, R5, R7, RZ, 0x3c, !PT ; /* 0x0000000705077212 */ /* 0x001fce00078e3cff */ /*0900*/ FSETP.NEU.AND P0, PT, |R3|, R13, PT ; /* 0x0000000d0300720b */ /* 0x002fc80003f0d200 */ /*0910*/ FSEL R10, R4, R10, !P0 ; /* 0x0000000a040a7208 */ /* 0x000fe40004000000 */ /*0920*/ FSEL R11, R7, R11, !P0 ; /* 0x0000000b070b7208 */ /* 0x000fe20004000000 */ /*0930*/ BRA 0xac0 ; /* 0x0000018000007947 */ /* 0x000fea0003800000 */ /*0940*/ DSETP.NAN.AND P0, PT, R4, R4, PT ; /* 0x000000040400722a */ /* 0x003e1c0003f08000 */ /*0950*/ @P0 BRA 0xaa0 ; /* 0x0000014000000947 */ /* 0x001fea0003800000 */ /*0960*/ IMAD.MOV.U32 R2, RZ, RZ, c[0x0][0x178] ; /* 0x00005e00ff027624 */ /* 0x000fe400078e00ff */ /*0970*/ IMAD.MOV.U32 R3, RZ, RZ, c[0x0][0x17c] ; /* 0x00005f00ff037624 */ /* 0x000fcc00078e00ff */ /*0980*/ DSETP.NAN.AND P0, PT, R2, c[0x0][0x178], PT ; /* 0x00005e000200762a */ /* 0x000e1c0003f08000 */ /*0990*/ @P0 BRA 0xa70 ; /* 0x000000d000000947 */ /* 0x001fea0003800000 */ /*09a0*/ ISETP.NE.AND P0, PT, R12, R21, PT ; /* 0x000000150c00720c */ /* 0x000fe20003f05270 */ /*09b0*/ IMAD.MOV.U32 R10, RZ, RZ, 0x0 ; /* 0x00000000ff0a7424 */ /* 0x000fe200078e00ff */ /*09c0*/ MOV R11, 0xfff80000 ; /* 0xfff80000000b7802 */ /* 0x000fd60000000f00 */ /*09d0*/ @!P0 BRA 0xac0 ; /* 0x000000e000008947 */ /* 0x000fea0003800000 */ /*09e0*/ ISETP.NE.AND P0, PT, R12, 0x7ff00000, PT ; /* 0x7ff000000c00780c */ /* 0x000fe40003f05270 */ /*09f0*/ LOP3.LUT R4, R5, c[0x0][0x17c], RZ, 0x3c, !PT ; /* 0x00005f0005047a12 */ /* 0x000fe400078e3cff */ /*0a00*/ ISETP.EQ.OR P0, PT, R21, RZ, !P0 ; /* 0x000000ff1500720c */ /* 0x000fe40004702670 */ /*0a10*/ LOP3.LUT R11, R4, 0x80000000, RZ, 0xc0, !PT ; /* 0x80000000040b7812 */ /* 0x000fd600078ec0ff */ /*0a20*/ @P0 LOP3.LUT R2, R11, 0x7ff00000, RZ, 0xfc, !PT ; /* 0x7ff000000b020812 */ /* 0x000fe200078efcff */ /*0a30*/ @!P0 IMAD.MOV.U32 R10, RZ, RZ, RZ ; /* 0x000000ffff0a8224 */ /* 0x000fe400078e00ff */ /*0a40*/ @P0 IMAD.MOV.U32 R10, RZ, RZ, RZ ; /* 0x000000ffff0a0224 */ /* 0x000fe400078e00ff */ /*0a50*/ @P0 IMAD.MOV.U32 R11, RZ, RZ, R2 ; /* 0x000000ffff0b0224 */ /* 0x000fe200078e0002 */ /*0a60*/ BRA 0xac0 ; /* 0x0000005000007947 */ /* 0x000fea0003800000 */ /*0a70*/ LOP3.LUT R11, R9, 0x80000, RZ, 0xfc, !PT ; /* 0x00080000090b7812 */ /* 0x000fe200078efcff */ /*0a80*/ IMAD.MOV.U32 R10, RZ, RZ, c[0x0][0x178] ; /* 0x00005e00ff0a7624 */ /* 0x000fe200078e00ff */ /*0a90*/ BRA 0xac0 ; /* 0x0000002000007947 */ /* 0x000fea0003800000 */ /*0aa0*/ LOP3.LUT R11, R5, 0x80000, RZ, 0xfc, !PT ; /* 0x00080000050b7812 */ /* 0x000fe200078efcff */ /*0ab0*/ IMAD.MOV.U32 R10, RZ, RZ, R4 ; /* 0x000000ffff0a7224 */ /* 0x000fe400078e0004 */ /*0ac0*/ BSYNC B1 ; /* 0x0000000000017941 */ /* 0x000fea0003800000 */ /*0ad0*/ IMAD.MOV.U32 R9, RZ, RZ, 0x0 ; /* 0x00000000ff097424 */ /* 0x000fe400078e00ff */ /*0ae0*/ IMAD.MOV.U32 R2, RZ, RZ, R10 ; /* 0x000000ffff027224 */ /* 0x000fc400078e000a */ /*0af0*/ IMAD.MOV.U32 R3, RZ, RZ, R11 ; /* 0x000000ffff037224 */ /* 0x000fe200078e000b */ /*0b00*/ RET.REL.NODEC R8 0x0 ; /* 0xfffff4f008007950 */ /* 0x000fec0003c3ffff */ /*0b10*/ BRA 0xb10; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*0b20*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0b30*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0b40*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0b50*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0b60*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0b70*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0b80*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0b90*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0ba0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0bb0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0bc0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0bd0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0be0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0bf0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ ..........
.text .amdgcn_target "amdgcn-amd-amdhsa--gfx1100" .protected _Z6laplapPdS_S_dii .globl _Z6laplapPdS_S_dii .p2align 8 .type _Z6laplapPdS_S_dii,@function _Z6laplapPdS_S_dii: s_clause 0x1 s_load_b32 s2, s[0:1], 0x34 s_load_b64 s[4:5], s[0:1], 0x20 v_bfe_u32 v2, v0, 10, 10 v_and_b32_e32 v1, 0x3ff, v0 s_waitcnt lgkmcnt(0) s_lshr_b32 s3, s2, 16 s_and_b32 s2, s2, 0xffff s_mul_i32 s15, s15, s3 s_mul_i32 s14, s14, s2 v_add_nc_u32_e32 v3, s15, v2 v_add_nc_u32_e32 v0, s14, v1 s_add_i32 s2, s4, -1 s_add_i32 s3, s5, -1 s_mov_b32 s5, -1 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3) v_min_i32_e32 v4, v3, v0 v_cmp_gt_i32_e32 vcc_lo, s2, v0 v_cmp_gt_i32_e64 s2, s3, v3 v_cmp_lt_i32_e64 s3, 0, v4 s_delay_alu instid0(VALU_DEP_2) s_and_b32 s2, vcc_lo, s2 s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1) s_and_b32 s2, s2, s3 s_delay_alu instid0(SALU_CYCLE_1) s_and_saveexec_b32 s3, s2 s_cbranch_execz .LBB0_6 s_clause 0x1 s_load_b64 s[2:3], s[0:1], 0x0 s_load_b64 s[6:7], s[0:1], 0x10 v_add3_u32 v2, v2, s15, -1 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3) v_mad_u64_u32 v[4:5], null, s4, v2, v[1:2] v_mov_b32_e32 v1, 0 v_mov_b32_e32 v2, 0 v_add3_u32 v4, v4, s14, -1 .p2align 6 .LBB0_2: s_mov_b32 s10, 0 s_waitcnt lgkmcnt(0) s_mov_b64 s[8:9], s[6:7] .p2align 6 .LBB0_3: s_delay_alu instid0(VALU_DEP_1) v_add_nc_u32_e32 v5, s10, v4 s_load_b64 s[12:13], s[8:9], 0x0 s_add_i32 s10, s10, 1 s_add_u32 s8, s8, 8 s_addc_u32 s9, s9, 0 v_ashrrev_i32_e32 v6, 31, v5 s_cmp_eq_u32 s10, 3 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_lshlrev_b64 v[5:6], 3, v[5:6] v_add_co_u32 v5, vcc_lo, s2, v5 s_delay_alu instid0(VALU_DEP_2) v_add_co_ci_u32_e32 v6, vcc_lo, s3, v6, vcc_lo global_load_b64 v[5:6], v[5:6], off s_waitcnt vmcnt(0) lgkmcnt(0) v_fma_f64 v[1:2], v[5:6], s[12:13], v[1:2] s_cbranch_scc0 .LBB0_3 s_add_i32 s5, s5, 1 v_add_nc_u32_e32 v4, s4, v4 s_add_u32 s6, s6, 24 s_addc_u32 s7, s7, 0 s_cmp_eq_u32 s5, 2 s_cbranch_scc0 .LBB0_2 s_clause 0x1 s_load_b64 s[2:3], s[0:1], 0x18 s_load_b64 s[0:1], s[0:1], 0x8 s_waitcnt lgkmcnt(0) s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1) v_div_scale_f64 v[4:5], null, s[2:3], s[2:3], v[1:2] 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[1:2], s[2:3], v[1:2] 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(NEXT) | instid1(VALU_DEP_1) v_div_fixup_f64 v[1:2], v[4:5], s[2:3], v[1:2] v_mad_u64_u32 v[4:5], null, v3, s4, v[0:1] s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_ashrrev_i32_e32 v5, 31, v4 v_lshlrev_b64 v[3:4], 3, v[4:5] s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2) v_add_co_u32 v3, vcc_lo, s0, v3 v_add_co_ci_u32_e32 v4, vcc_lo, s1, v4, vcc_lo global_store_b64 v[3:4], v[1:2], off .LBB0_6: s_nop 0 s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z6laplapPdS_S_dii .amdhsa_group_segment_fixed_size 0 .amdhsa_private_segment_fixed_size 0 .amdhsa_kernarg_size 296 .amdhsa_user_sgpr_count 14 .amdhsa_user_sgpr_dispatch_ptr 0 .amdhsa_user_sgpr_queue_ptr 0 .amdhsa_user_sgpr_kernarg_segment_ptr 1 .amdhsa_user_sgpr_dispatch_id 0 .amdhsa_user_sgpr_private_segment_size 0 .amdhsa_wavefront_size32 1 .amdhsa_uses_dynamic_stack 0 .amdhsa_enable_private_segment 0 .amdhsa_system_sgpr_workgroup_id_x 1 .amdhsa_system_sgpr_workgroup_id_y 1 .amdhsa_system_sgpr_workgroup_id_z 0 .amdhsa_system_sgpr_workgroup_info 0 .amdhsa_system_vgpr_workitem_id 1 .amdhsa_next_free_vgpr 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 _Z6laplapPdS_S_dii, .Lfunc_end0-_Z6laplapPdS_S_dii .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 - .offset: 32 .size: 4 .value_kind: by_value - .offset: 36 .size: 4 .value_kind: by_value - .offset: 40 .size: 4 .value_kind: hidden_block_count_x - .offset: 44 .size: 4 .value_kind: hidden_block_count_y - .offset: 48 .size: 4 .value_kind: hidden_block_count_z - .offset: 52 .size: 2 .value_kind: hidden_group_size_x - .offset: 54 .size: 2 .value_kind: hidden_group_size_y - .offset: 56 .size: 2 .value_kind: hidden_group_size_z - .offset: 58 .size: 2 .value_kind: hidden_remainder_x - .offset: 60 .size: 2 .value_kind: hidden_remainder_y - .offset: 62 .size: 2 .value_kind: hidden_remainder_z - .offset: 80 .size: 8 .value_kind: hidden_global_offset_x - .offset: 88 .size: 8 .value_kind: hidden_global_offset_y - .offset: 96 .size: 8 .value_kind: hidden_global_offset_z - .offset: 104 .size: 2 .value_kind: hidden_grid_dims .group_segment_fixed_size: 0 .kernarg_segment_align: 8 .kernarg_segment_size: 296 .language: OpenCL C .language_version: - 2 - 0 .max_flat_workgroup_size: 1024 .name: _Z6laplapPdS_S_dii .private_segment_fixed_size: 0 .sgpr_count: 18 .sgpr_spill_count: 0 .symbol: _Z6laplapPdS_S_dii.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 from CUDA host assembly to AMD host assembly.
.file "tmpxft_0010c643_00000000-6_laplas.cudafe1.cpp" .text #APP .globl _ZSt21ios_base_library_initv #NO_APP .type _ZL26__cudaUnregisterBinaryUtilv, @function _ZL26__cudaUnregisterBinaryUtilv: .LFB3773: .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 .LFE3773: .size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv .globl _Z10gen_matrixPiii .type _Z10gen_matrixPiii, @function _Z10gen_matrixPiii: .LFB3768: .cfi_startproc endbr64 imull %edx, %esi testl %esi, %esi jle .L8 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 pushq %rbx .cfi_def_cfa_offset 24 .cfi_offset 3, -24 subq $8, %rsp .cfi_def_cfa_offset 32 movq %rdi, %rbx movslq %esi, %rsi leaq (%rdi,%rsi,4), %rbp .L5: call rand@PLT movslq %eax, %rdx imulq $1717986919, %rdx, %rdx sarq $34, %rdx movl %eax, %ecx sarl $31, %ecx subl %ecx, %edx leal (%rdx,%rdx,4), %edx addl %edx, %edx subl %edx, %eax movl %eax, (%rbx) addq $4, %rbx cmpq %rbp, %rbx jne .L5 addq $8, %rsp .cfi_def_cfa_offset 24 popq %rbx .cfi_def_cfa_offset 16 popq %rbp .cfi_def_cfa_offset 8 ret .L8: .cfi_restore 3 .cfi_restore 6 ret .cfi_endproc .LFE3768: .size _Z10gen_matrixPiii, .-_Z10gen_matrixPiii .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string " " .text .globl _Z12print_matrixPdii .type _Z12print_matrixPdii, @function _Z12print_matrixPdii: .LFB3769: .cfi_startproc endbr64 imull %edx, %esi testl %esi, %esi jle .L20 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 $8, %rsp .cfi_def_cfa_offset 64 movq %rdi, %r15 movl %edx, %ebp movslq %esi, %r13 movl $1, %ebx leaq _ZSt4cout(%rip), %r12 jmp .L17 .L24: call _ZSt16__throw_bad_castv@PLT .L15: movq %r14, %rdi call _ZNKSt5ctypeIcE13_M_widen_initEv@PLT movq (%r14), %rax movl $10, %esi movq %r14, %rdi call *48(%rax) movl %eax, %esi .L16: movsbl %sil, %esi movq %r12, %rdi call _ZNSo3putEc@PLT movq %rax, %rdi call _ZNSo5flushEv@PLT .L13: leaq 1(%rbx), %rax cmpq %r13, %rbx je .L23 movq %rax, %rbx .L17: movsd -8(%r15,%rbx,8), %xmm0 movq %r12, %rdi call _ZNSo9_M_insertIdEERSoT_@PLT movq %rax, %rdi movl $1, %edx leaq .LC0(%rip), %rsi call _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT movl %ebx, %eax cltd idivl %ebp testl %edx, %edx jne .L13 movq (%r12), %rax movq -24(%rax), %rax movq 240(%r12,%rax), %r14 testq %r14, %r14 je .L24 cmpb $0, 56(%r14) je .L15 movzbl 67(%r14), %esi jmp .L16 .L23: addq $8, %rsp .cfi_def_cfa_offset 56 popq %rbx .cfi_def_cfa_offset 48 popq %rbp .cfi_def_cfa_offset 40 popq %r12 .cfi_def_cfa_offset 32 popq %r13 .cfi_def_cfa_offset 24 popq %r14 .cfi_def_cfa_offset 16 popq %r15 .cfi_def_cfa_offset 8 ret .L20: .cfi_restore 3 .cfi_restore 6 .cfi_restore 12 .cfi_restore 13 .cfi_restore 14 .cfi_restore 15 ret .cfi_endproc .LFE3769: .size _Z12print_matrixPdii, .-_Z12print_matrixPdii .globl _Z32__device_stub__Z6laplapPdS_S_diiPdS_S_dii .type _Z32__device_stub__Z6laplapPdS_S_diiPdS_S_dii, @function _Z32__device_stub__Z6laplapPdS_S_diiPdS_S_dii: .LFB3795: .cfi_startproc endbr64 subq $184, %rsp .cfi_def_cfa_offset 192 movq %rdi, 40(%rsp) movq %rsi, 32(%rsp) movq %rdx, 24(%rsp) movsd %xmm0, 16(%rsp) movl %ecx, 12(%rsp) movl %r8d, 8(%rsp) movq %fs:40, %rax movq %rax, 168(%rsp) xorl %eax, %eax leaq 40(%rsp), %rax movq %rax, 112(%rsp) leaq 32(%rsp), %rax movq %rax, 120(%rsp) leaq 24(%rsp), %rax movq %rax, 128(%rsp) leaq 16(%rsp), %rax movq %rax, 136(%rsp) leaq 12(%rsp), %rax movq %rax, 144(%rsp) leaq 8(%rsp), %rax movq %rax, 152(%rsp) movl $1, 64(%rsp) movl $1, 68(%rsp) movl $1, 72(%rsp) movl $1, 76(%rsp) movl $1, 80(%rsp) movl $1, 84(%rsp) leaq 56(%rsp), %rcx leaq 48(%rsp), %rdx leaq 76(%rsp), %rsi leaq 64(%rsp), %rdi call __cudaPopCallConfiguration@PLT testl %eax, %eax je .L29 .L25: movq 168(%rsp), %rax subq %fs:40, %rax jne .L30 addq $184, %rsp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L29: .cfi_restore_state pushq 56(%rsp) .cfi_def_cfa_offset 200 pushq 56(%rsp) .cfi_def_cfa_offset 208 leaq 128(%rsp), %r9 movq 92(%rsp), %rcx movl 100(%rsp), %r8d movq 80(%rsp), %rsi movl 88(%rsp), %edx leaq _Z6laplapPdS_S_dii(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 192 jmp .L25 .L30: call __stack_chk_fail@PLT .cfi_endproc .LFE3795: .size _Z32__device_stub__Z6laplapPdS_S_diiPdS_S_dii, .-_Z32__device_stub__Z6laplapPdS_S_diiPdS_S_dii .globl _Z6laplapPdS_S_dii .type _Z6laplapPdS_S_dii, @function _Z6laplapPdS_S_dii: .LFB3796: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z32__device_stub__Z6laplapPdS_S_diiPdS_S_dii addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE3796: .size _Z6laplapPdS_S_dii, .-_Z6laplapPdS_S_dii .section .rodata.str1.1 .LC4: .string "w" .LC5: .string "res.txt" .LC6: .string "%f\t" .LC7: .string "\n" .text .globl main .type main, @function main: .LFB3770: .cfi_startproc endbr64 pushq %r15 .cfi_def_cfa_offset 16 .cfi_offset 15, -16 pushq %r14 .cfi_def_cfa_offset 24 .cfi_offset 14, -24 pushq %r13 .cfi_def_cfa_offset 32 .cfi_offset 13, -32 pushq %r12 .cfi_def_cfa_offset 40 .cfi_offset 12, -40 pushq %rbp .cfi_def_cfa_offset 48 .cfi_offset 6, -48 pushq %rbx .cfi_def_cfa_offset 56 .cfi_offset 3, -56 subq $104, %rsp .cfi_def_cfa_offset 160 movq %fs:40, %rax movq %rax, 88(%rsp) xorl %eax, %eax movl $131072, %edi call _Znam@PLT movq %rax, 8(%rsp) movq %rax, %rcx leaq 1024(%rax), %rdx leaq 132096(%rax), %rsi .L34: leaq -1024(%rdx), %rax .L35: movq $0x000000000, (%rax) addq $8, %rax cmpq %rdx, %rax jne .L35 addq $1024, %rdx cmpq %rsi, %rdx jne .L34 movq 8(%rsp), %rax addq $131072, %rax movsd .LC1(%rip), %xmm0 .L37: movsd %xmm0, (%rcx) addq $1024, %rcx cmpq %rax, %rcx jne .L37 movl $131072, %edi call _Znam@PLT movq %rax, 24(%rsp) movl $72, %edi call _Znam@PLT movq %rax, 16(%rsp) movl $0, %eax pxor %xmm1, %xmm1 jmp .L39 .L38: movq 16(%rsp), %rcx movsd %xmm0, (%rcx,%rax,8) addq $1, %rax cmpq $9, %rax je .L54 .L39: movapd %xmm1, %xmm0 testb $1, %al je .L38 movsd .LC1(%rip), %xmm0 jmp .L38 .L54: movl $3, %edx movl $3, %esi movq %rcx, %rbx movq %rcx, %rdi call _Z12print_matrixPdii leaq 40(%rsp), %rdi movl $131072, %esi call cudaMalloc@PLT leaq 48(%rsp), %rdi movl $131072, %esi call cudaMalloc@PLT leaq 56(%rsp), %rdi movl $72, %esi call cudaMalloc@PLT movl $1, %ecx movl $131072, %edx movq 8(%rsp), %rsi movq 40(%rsp), %rdi call cudaMemcpy@PLT movl $1, %ecx movl $72, %edx movq %rbx, %rsi movq 56(%rsp), %rdi call cudaMemcpy@PLT movl $8, 64(%rsp) movl $8, 68(%rsp) movl $1, 72(%rsp) movl $16, 76(%rsp) movl $16, 80(%rsp) movl $1, 84(%rsp) movl $8000, %ebx jmp .L42 .L56: movl $128, %r8d movl $128, %ecx movsd .LC3(%rip), %xmm0 movq 56(%rsp), %rdx movq 48(%rsp), %rsi movq 40(%rsp), %rdi call _Z32__device_stub__Z6laplapPdS_S_diiPdS_S_dii jmp .L40 .L41: subl $1, %ebx je .L55 .L42: movl 84(%rsp), %ecx movl $0, %r9d movl $0, %r8d movq 76(%rsp), %rdx movq 64(%rsp), %rdi movl 72(%rsp), %esi call __cudaPushCallConfiguration@PLT testl %eax, %eax je .L56 .L40: movl 84(%rsp), %ecx movl $0, %r9d movl $0, %r8d movq 76(%rsp), %rdx movq 64(%rsp), %rdi movl 72(%rsp), %esi call __cudaPushCallConfiguration@PLT testl %eax, %eax jne .L41 movl $128, %r8d movl $128, %ecx movsd .LC3(%rip), %xmm0 movq 56(%rsp), %rdx movq 40(%rsp), %rsi movq 48(%rsp), %rdi call _Z32__device_stub__Z6laplapPdS_S_diiPdS_S_dii jmp .L41 .L55: movl $2, %ecx movl $131072, %edx movq 40(%rsp), %rsi movq 24(%rsp), %rbx movq %rbx, %rdi call cudaMemcpy@PLT call cudaThreadSynchronize@PLT leaq .LC4(%rip), %rsi leaq .LC5(%rip), %rdi call fopen@PLT movq %rax, %r12 leaq 1024(%rbx), %rbp leaq 132096(%rbx), %r15 leaq .LC6(%rip), %r13 leaq .LC7(%rip), %r14 .L43: leaq -1024(%rbp), %rbx .L44: movsd (%rbx), %xmm0 movq %r13, %rdx movl $2, %esi movq %r12, %rdi movl $1, %eax call __fprintf_chk@PLT addq $8, %rbx cmpq %rbp, %rbx jne .L44 movq %r14, %rdx movl $2, %esi movq %r12, %rdi movl $0, %eax call __fprintf_chk@PLT addq $1024, %rbp cmpq %r15, %rbp jne .L43 movq 40(%rsp), %rdi call cudaFree@PLT movq 48(%rsp), %rdi call cudaFree@PLT movq 56(%rsp), %rdi call cudaFree@PLT movl $8, %esi movq 8(%rsp), %rdi call _ZdlPvm@PLT movl $8, %esi movq 24(%rsp), %rdi call _ZdlPvm@PLT movl $8, %esi movq 16(%rsp), %rdi call _ZdlPvm@PLT movq 88(%rsp), %rax subq %fs:40, %rax jne .L57 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 .L57: .cfi_restore_state call __stack_chk_fail@PLT .cfi_endproc .LFE3770: .size main, .-main .section .rodata.str1.1 .LC8: .string "_Z6laplapPdS_S_dii" .text .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB3798: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 leaq _ZL15__fatDeviceText(%rip), %rdi call __cudaRegisterFatBinary@PLT movq %rax, %rdi movq %rax, _ZL20__cudaFatCubinHandle(%rip) pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 pushq $0 .cfi_def_cfa_offset 40 pushq $0 .cfi_def_cfa_offset 48 movl $0, %r9d movl $-1, %r8d leaq .LC8(%rip), %rdx movq %rdx, %rcx leaq _Z6laplapPdS_S_dii(%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 .LFE3798: .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 .LC1: .long 0 .long 1072693248 .align 8 .LC3: .long 0 .long 1074790400 .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 "laplas.hip" # Start of file scope inline assembly .globl _ZSt21ios_base_library_initv # End of file scope inline assembly .globl _Z10gen_matrixPiii # -- Begin function _Z10gen_matrixPiii .p2align 4, 0x90 .type _Z10gen_matrixPiii,@function _Z10gen_matrixPiii: # @_Z10gen_matrixPiii .cfi_startproc # %bb.0: imull %edx, %esi testl %esi, %esi jle .LBB0_4 # %bb.1: # %.lr.ph.preheader pushq %r15 .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 %r15, -16 movq %rdi, %rbx movl %esi, %r14d xorl %r15d, %r15d .p2align 4, 0x90 .LBB0_2: # %.lr.ph # =>This Inner Loop Header: Depth=1 callq rand cltq imulq $1717986919, %rax, %rcx # imm = 0x66666667 movq %rcx, %rdx shrq $63, %rdx sarq $34, %rcx addl %edx, %ecx addl %ecx, %ecx leal (%rcx,%rcx,4), %ecx subl %ecx, %eax movl %eax, (%rbx,%r15,4) incq %r15 cmpq %r15, %r14 jne .LBB0_2 # %bb.3: popq %rbx .cfi_def_cfa_offset 24 popq %r14 .cfi_def_cfa_offset 16 popq %r15 .cfi_def_cfa_offset 8 .cfi_restore %rbx .cfi_restore %r14 .cfi_restore %r15 .LBB0_4: # %._crit_edge retq .Lfunc_end0: .size _Z10gen_matrixPiii, .Lfunc_end0-_Z10gen_matrixPiii .cfi_endproc # -- End function .globl _Z12print_matrixPdii # -- Begin function _Z12print_matrixPdii .p2align 4, 0x90 .type _Z12print_matrixPdii,@function _Z12print_matrixPdii: # @_Z12print_matrixPdii .cfi_startproc # %bb.0: pushq %r15 .cfi_def_cfa_offset 16 pushq %r14 .cfi_def_cfa_offset 24 pushq %r13 .cfi_def_cfa_offset 32 pushq %r12 .cfi_def_cfa_offset 40 pushq %rbx .cfi_def_cfa_offset 48 .cfi_offset %rbx, -48 .cfi_offset %r12, -40 .cfi_offset %r13, -32 .cfi_offset %r14, -24 .cfi_offset %r15, -16 imull %edx, %esi testl %esi, %esi jle .LBB1_9 # %bb.1: # %.lr.ph.preheader movl %edx, %ebx movq %rdi, %r14 movl %esi, %r13d xorl %r15d, %r15d jmp .LBB1_2 .LBB1_6: # in Loop: Header=BB1_2 Depth=1 movq %r12, %rdi callq _ZNKSt5ctypeIcE13_M_widen_initEv movq (%r12), %rax movq %r12, %rdi movl $10, %esi callq *48(%rax) .LBB1_7: # %_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_.exit # in Loop: Header=BB1_2 Depth=1 movsbl %al, %esi movl $_ZSt4cout, %edi callq _ZNSo3putEc movq %rax, %rdi callq _ZNSo5flushEv .LBB1_8: # in Loop: Header=BB1_2 Depth=1 cmpq %r15, %r13 je .LBB1_9 .LBB1_2: # %.lr.ph # =>This Inner Loop Header: Depth=1 movsd (%r14,%r15,8), %xmm0 # xmm0 = mem[0],zero movl $_ZSt4cout, %edi callq _ZNSo9_M_insertIdEERSoT_ movl $.L.str, %esi movl $1, %edx movq %rax, %rdi callq _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l incq %r15 movl %r15d, %eax cltd idivl %ebx testl %edx, %edx jne .LBB1_8 # %bb.3: # in Loop: Header=BB1_2 Depth=1 movq _ZSt4cout(%rip), %rax movq -24(%rax), %rax movq _ZSt4cout+240(%rax), %r12 testq %r12, %r12 je .LBB1_10 # %bb.4: # %_ZSt13__check_facetISt5ctypeIcEERKT_PS3_.exit.i.i # in Loop: Header=BB1_2 Depth=1 cmpb $0, 56(%r12) je .LBB1_6 # %bb.5: # in Loop: Header=BB1_2 Depth=1 movzbl 67(%r12), %eax jmp .LBB1_7 .LBB1_9: # %._crit_edge popq %rbx .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 retq .LBB1_10: .cfi_def_cfa_offset 48 callq _ZSt16__throw_bad_castv .Lfunc_end1: .size _Z12print_matrixPdii, .Lfunc_end1-_Z12print_matrixPdii .cfi_endproc # -- End function .globl _Z21__device_stub__laplapPdS_S_dii # -- Begin function _Z21__device_stub__laplapPdS_S_dii .p2align 4, 0x90 .type _Z21__device_stub__laplapPdS_S_dii,@function _Z21__device_stub__laplapPdS_S_dii: # @_Z21__device_stub__laplapPdS_S_dii .cfi_startproc # %bb.0: subq $152, %rsp .cfi_def_cfa_offset 160 movq %rdi, 88(%rsp) movq %rsi, 80(%rsp) movq %rdx, 72(%rsp) movsd %xmm0, 64(%rsp) movl %ecx, 12(%rsp) movl %r8d, 8(%rsp) leaq 88(%rsp), %rax movq %rax, 96(%rsp) leaq 80(%rsp), %rax movq %rax, 104(%rsp) leaq 72(%rsp), %rax movq %rax, 112(%rsp) leaq 64(%rsp), %rax movq %rax, 120(%rsp) leaq 12(%rsp), %rax movq %rax, 128(%rsp) leaq 8(%rsp), %rax movq %rax, 136(%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 96(%rsp), %r9 movl $_Z6laplapPdS_S_dii, %edi pushq 16(%rsp) .cfi_adjust_cfa_offset 8 pushq 32(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $168, %rsp .cfi_adjust_cfa_offset -168 retq .Lfunc_end2: .size _Z21__device_stub__laplapPdS_S_dii, .Lfunc_end2-_Z21__device_stub__laplapPdS_S_dii .cfi_endproc # -- End function .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 # -- Begin function main .LCPI3_0: .quad 0x3ff0000000000000 # double 1 .text .globl main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: # %.preheader102.preheader pushq %rbp .cfi_def_cfa_offset 16 pushq %r15 .cfi_def_cfa_offset 24 pushq %r14 .cfi_def_cfa_offset 32 pushq %r13 .cfi_def_cfa_offset 40 pushq %r12 .cfi_def_cfa_offset 48 pushq %rbx .cfi_def_cfa_offset 56 subq $184, %rsp .cfi_def_cfa_offset 240 .cfi_offset %rbx, -56 .cfi_offset %r12, -48 .cfi_offset %r13, -40 .cfi_offset %r14, -32 .cfi_offset %r15, -24 .cfi_offset %rbp, -16 movl $131072, %edi # imm = 0x20000 callq _Znam movq %rax, %rbx xorl %r14d, %r14d movl $131072, %edx # imm = 0x20000 movq %rax, %rdi xorl %esi, %esi callq memset@PLT movabsq $4607182418800017408, %rax # imm = 0x3FF0000000000000 .p2align 4, 0x90 .LBB3_1: # %.preheader102 # =>This Inner Loop Header: Depth=1 movq %rax, (%rbx,%r14) addq $1024, %r14 # imm = 0x400 cmpq $131072, %r14 # imm = 0x20000 jne .LBB3_1 # %bb.2: movl $131072, %edi # imm = 0x20000 callq _Znam movq %rax, 120(%rsp) # 8-byte Spill movl $72, %edi callq _Znam movq %rax, %r15 xorl %eax, %eax movsd .LCPI3_0(%rip), %xmm0 # xmm0 = mem[0],zero jmp .LBB3_3 .p2align 4, 0x90 .LBB3_5: # in Loop: Header=BB3_3 Depth=1 movsd %xmm1, (%r15,%rax,8) incq %rax cmpq $9, %rax je .LBB3_6 .LBB3_3: # =>This Inner Loop Header: Depth=1 xorps %xmm1, %xmm1 testb $1, %al je .LBB3_5 # %bb.4: # in Loop: Header=BB3_3 Depth=1 movaps %xmm0, %xmm1 jmp .LBB3_5 .LBB3_6: movabsq $68719476752, %r12 # imm = 0x1000000010 movabsq $34359738376, %r13 # imm = 0x800000008 movq %r15, %rdi movl $3, %esi movl $3, %edx callq _Z12print_matrixPdii leaq 16(%rsp), %rdi movl $131072, %esi # imm = 0x20000 callq hipMalloc leaq 32(%rsp), %rdi movl $131072, %esi # imm = 0x20000 callq hipMalloc leaq 24(%rsp), %rdi movl $72, %esi callq hipMalloc movq 16(%rsp), %rdi movl $131072, %edx # imm = 0x20000 movq %rbx, %rsi movl $1, %ecx callq hipMemcpy movq 24(%rsp), %rdi movl $72, %edx movq %r15, %rsi movl $1, %ecx callq hipMemcpy movl $8000, %r14d # imm = 0x1F40 leaq 128(%rsp), %rbp jmp .LBB3_7 .p2align 4, 0x90 .LBB3_11: # in Loop: Header=BB3_7 Depth=1 decl %r14d je .LBB3_12 .LBB3_7: # =>This Inner Loop Header: Depth=1 movq %r13, %rdi movl $1, %esi movq %r12, %rdx movl $1, %ecx xorl %r8d, %r8d xorl %r9d, %r9d callq __hipPushCallConfiguration testl %eax, %eax jne .LBB3_9 # %bb.8: # in Loop: Header=BB3_7 Depth=1 movq 16(%rsp), %rax movq 32(%rsp), %rcx movq 24(%rsp), %rdx movq %rax, 112(%rsp) movq %rcx, 104(%rsp) movq %rdx, 96(%rsp) movabsq $4616189618054758400, %rax # imm = 0x4010000000000000 movq %rax, 88(%rsp) movl $128, 12(%rsp) movl $128, 8(%rsp) leaq 112(%rsp), %rax movq %rax, 128(%rsp) leaq 104(%rsp), %rax movq %rax, 136(%rsp) leaq 96(%rsp), %rax movq %rax, 144(%rsp) leaq 88(%rsp), %rax movq %rax, 152(%rsp) leaq 12(%rsp), %rax movq %rax, 160(%rsp) leaq 8(%rsp), %rax movq %rax, 168(%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 movl $_Z6laplapPdS_S_dii, %edi movq %rbp, %r9 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 .LBB3_9: # in Loop: Header=BB3_7 Depth=1 movq %r13, %rdi movl $1, %esi movq %r12, %rdx movl $1, %ecx xorl %r8d, %r8d xorl %r9d, %r9d callq __hipPushCallConfiguration testl %eax, %eax jne .LBB3_11 # %bb.10: # in Loop: Header=BB3_7 Depth=1 movq 32(%rsp), %rax movq 16(%rsp), %rcx movq 24(%rsp), %rdx movq %rax, 112(%rsp) movq %rcx, 104(%rsp) movq %rdx, 96(%rsp) movabsq $4616189618054758400, %rax # imm = 0x4010000000000000 movq %rax, 88(%rsp) movl $128, 12(%rsp) movl $128, 8(%rsp) leaq 112(%rsp), %rax movq %rax, 128(%rsp) leaq 104(%rsp), %rax movq %rax, 136(%rsp) leaq 96(%rsp), %rax movq %rax, 144(%rsp) leaq 88(%rsp), %rax movq %rax, 152(%rsp) leaq 12(%rsp), %rax movq %rax, 160(%rsp) leaq 8(%rsp), %rax movq %rax, 168(%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 movl $_Z6laplapPdS_S_dii, %edi movq %rbp, %r9 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 jmp .LBB3_11 .LBB3_12: movq 16(%rsp), %rsi movl $131072, %edx # imm = 0x20000 movq 120(%rsp), %r13 # 8-byte Reload movq %r13, %rdi movl $2, %ecx callq hipMemcpy callq hipDeviceSynchronize movl $.L.str.1, %edi movl $.L.str.2, %esi callq fopen movq %rax, %r14 xorl %r12d, %r12d .p2align 4, 0x90 .LBB3_13: # %.preheader # =>This Loop Header: Depth=1 # Child Loop BB3_14 Depth 2 xorl %ebp, %ebp .p2align 4, 0x90 .LBB3_14: # Parent Loop BB3_13 Depth=1 # => This Inner Loop Header: Depth=2 movsd (%r13,%rbp,8), %xmm0 # xmm0 = mem[0],zero movl $.L.str.3, %esi movq %r14, %rdi movb $1, %al callq fprintf incq %rbp cmpq $128, %rbp jne .LBB3_14 # %bb.15: # in Loop: Header=BB3_13 Depth=1 movl $10, %edi movq %r14, %rsi callq fputc@PLT incq %r12 addq $1024, %r13 # imm = 0x400 cmpq $128, %r12 jne .LBB3_13 # %bb.16: movq 16(%rsp), %rdi callq hipFree movq 32(%rsp), %rdi callq hipFree movq 24(%rsp), %rdi callq hipFree movq %rbx, %rdi callq _ZdlPv movq 120(%rsp), %rdi # 8-byte Reload callq _ZdlPv movq %r15, %rdi callq _ZdlPv xorl %eax, %eax addq $184, %rsp .cfi_def_cfa_offset 56 popq %rbx .cfi_def_cfa_offset 48 popq %r12 .cfi_def_cfa_offset 40 popq %r13 .cfi_def_cfa_offset 32 popq %r14 .cfi_def_cfa_offset 24 popq %r15 .cfi_def_cfa_offset 16 popq %rbp .cfi_def_cfa_offset 8 retq .Lfunc_end3: .size main, .Lfunc_end3-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 .LBB4_2 # %bb.1: movl $__hip_fatbin_wrapper, %edi callq __hipRegisterFatBinary movq %rax, __hip_gpubin_handle(%rip) .LBB4_2: movq __hip_gpubin_handle(%rip), %rdi xorps %xmm0, %xmm0 movups %xmm0, 16(%rsp) movups %xmm0, (%rsp) movl $_Z6laplapPdS_S_dii, %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_end4: .size __hip_module_ctor, .Lfunc_end4-__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 .LBB5_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 .LBB5_2: retq .Lfunc_end5: .size __hip_module_dtor, .Lfunc_end5-__hip_module_dtor .cfi_endproc # -- End function .type .L.str,@object # @.str .section .rodata.str1.1,"aMS",@progbits,1 .L.str: .asciz " " .size .L.str, 2 .type _Z6laplapPdS_S_dii,@object # @_Z6laplapPdS_S_dii .section .rodata,"a",@progbits .globl _Z6laplapPdS_S_dii .p2align 3, 0x0 _Z6laplapPdS_S_dii: .quad _Z21__device_stub__laplapPdS_S_dii .size _Z6laplapPdS_S_dii, 8 .type .L.str.1,@object # @.str.1 .section .rodata.str1.1,"aMS",@progbits,1 .L.str.1: .asciz "res.txt" .size .L.str.1, 8 .type .L.str.2,@object # @.str.2 .L.str.2: .asciz "w" .size .L.str.2, 2 .type .L.str.3,@object # @.str.3 .L.str.3: .asciz "%f\t" .size .L.str.3, 4 .type .L__unnamed_1,@object # @0 .L__unnamed_1: .asciz "_Z6laplapPdS_S_dii" .size .L__unnamed_1, 19 .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__laplapPdS_S_dii .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _ZSt4cout .addrsig_sym _Z6laplapPdS_S_dii .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 <math.h> #include <stdio.h> #include <stdlib.h> void print_instructions() { printf( "usage: ./mandelbrot_cuda c_x_min c_x_max c_y_min c_y_max image_size x_grid_dimension y_grid_dimension\n"); printf("examples with image_size = 4096, x_grid_dimension = 64 and y_grid_dimension = 64:\n"); printf( " Full Picture: ./mandelbrot_cuda -2.5 1.5 -2.0 2.0 4096 64 64\n"); printf( " Seahorse Valley: ./mandelbrot_cuda -0.8 -0.7 0.05 0.15 " "4096 64 64\n"); printf( " Elephant Valley: ./mandelbrot_cuda 0.175 0.375 -0.1 0.1 " "4096 64 64\n"); printf( " Triple Spiral Valley: ./mandelbrot_cuda -0.188 -0.012 0.554 0.754 " "4096 64 64\n"); exit(0); }; void write_to_file(unsigned char *image_buffer, int i_x_max, int i_y_max, int image_buffer_size) { FILE *file; const char *filename = "output.ppm"; const char *comment = "# "; int max_color_component_value = 255; file = fopen(filename, "wb"); fprintf(file, "P6\n %s\n %d\n %d\n %d\n", comment, i_x_max, i_y_max, max_color_component_value); for (int i = 0; i < image_buffer_size; i++) { unsigned char buffer[3] = {image_buffer[i], image_buffer[i + image_buffer_size], image_buffer[i + (image_buffer_size * 2)]}; fwrite(buffer, 1, 3, file); }; fclose(file); }; __global__ void compute_mandelbrot(unsigned char *d_image_buffer, int gradient_size, int iteration_max, double c_x_min, double c_x_max, double c_y_min, double c_y_max, int image_buffer_size, int i_x_max, int i_y_max, double pixel_width, double pixel_height) { double z_x; double z_y; double z_x_squared; double z_y_squared; double escape_radius_squared = 4; int iteration; int i_x; int i_y; double c_x; double c_y; int colors[17][3] = { {66, 30, 15}, {25, 7, 26}, {9, 1, 47}, {4, 4, 73}, {0, 7, 100}, {12, 44, 138}, {24, 82, 177}, {57, 125, 209}, {134, 181, 229}, {211, 236, 248}, {241, 233, 191}, {248, 201, 95}, {255, 170, 0}, {204, 128, 0}, {153, 87, 0}, {106, 52, 3}, {16, 16, 16}, }; int index = blockIdx.x * blockDim.x + threadIdx.x; int stride = blockDim.x * gridDim.x; for (i_y = index; i_y < i_y_max; i_y += stride) { c_y = c_y_min + i_y * pixel_height; if (fabs(c_y) < pixel_height / 2) { c_y = 0.0; }; for (i_x = 0; i_x < i_x_max; i_x++) { c_x = c_x_min + i_x * pixel_width; z_x = 0.0; z_y = 0.0; z_x_squared = 0.0; z_y_squared = 0.0; for (iteration = 0; iteration < iteration_max && ((z_x_squared + z_y_squared) < escape_radius_squared); iteration++) { z_y = 2 * z_x * z_y + c_y; z_x = z_x_squared - z_y_squared + c_x; z_x_squared = z_x * z_x; z_y_squared = z_y * z_y; }; if (iteration == iteration_max) { d_image_buffer[(i_y_max * i_y) + i_x] = colors[16][0]; d_image_buffer[(i_y_max * i_y) + i_x + image_buffer_size] = colors[16][1]; d_image_buffer[(i_y_max * i_y) + i_x + (2 * image_buffer_size)] = colors[16][2]; } else { int color = iteration % 16; d_image_buffer[(i_y_max * i_y) + i_x] = colors[color][0]; d_image_buffer[(i_y_max * i_y) + i_x + image_buffer_size] = colors[color][1]; d_image_buffer[(i_y_max * i_y) + i_x + (2 * image_buffer_size)] = colors[color][2]; }; }; }; }; int main(int argc, char *argv[]) { if (argc < 8) { print_instructions(); return 0; } double c_x_min; double c_x_max; double c_y_min; double c_y_max; int image_size; int x_grid_dimension; int y_grid_dimension; unsigned char *image_buffer; unsigned char *d_image_buffer; int gradient_size = 16; int iteration_max = 200; sscanf(argv[1], "%lf", &c_x_min); sscanf(argv[2], "%lf", &c_x_max); sscanf(argv[3], "%lf", &c_y_min); sscanf(argv[4], "%lf", &c_y_max); sscanf(argv[5], "%d", &image_size); sscanf(argv[6], "%d", &x_grid_dimension); sscanf(argv[7], "%d", &y_grid_dimension); int i_x_max = image_size; int i_y_max = image_size; int image_buffer_size = image_size * image_size; double pixel_width = (c_x_max - c_x_min) / i_x_max; double pixel_height = (c_y_max - c_y_min) / i_y_max; int rgb_size = 3; image_buffer = (unsigned char *)malloc(sizeof(unsigned char) * image_buffer_size * rgb_size); cudaMalloc(&d_image_buffer, sizeof(unsigned char) * image_buffer_size * rgb_size); int blockSize = 256; dim3 gridSize = dim3(x_grid_dimension, y_grid_dimension); compute_mandelbrot<<<gridSize, blockSize>>>(d_image_buffer, gradient_size, iteration_max, c_x_min, c_x_max, c_y_min, c_y_max, image_buffer_size, i_x_max, i_y_max, pixel_width, pixel_height); cudaDeviceSynchronize(); cudaMemcpy(image_buffer, d_image_buffer, sizeof(unsigned char) * image_buffer_size * rgb_size, cudaMemcpyDeviceToHost); // write_to_file(image_buffer, i_x_max, i_y_max, image_buffer_size); return 0; };
.file "tmpxft_00181870_00000000-6_mandelbrot_cuda.cudafe1.cpp" .text #APP #NO_APP .type _ZL26__cudaUnregisterBinaryUtilv, @function _ZL26__cudaUnregisterBinaryUtilv: .LFB2062: .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 .LFE2062: .size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv .section .rodata.str1.8,"aMS",@progbits,1 .align 8 .LC0: .string "usage: ./mandelbrot_cuda c_x_min c_x_max c_y_min c_y_max image_size x_grid_dimension y_grid_dimension\n" .align 8 .LC1: .string "examples with image_size = 4096, x_grid_dimension = 64 and y_grid_dimension = 64:\n" .align 8 .LC2: .string " Full Picture: ./mandelbrot_cuda -2.5 1.5 -2.0 2.0 4096 64 64\n" .align 8 .LC3: .string " Seahorse Valley: ./mandelbrot_cuda -0.8 -0.7 0.05 0.15 4096 64 64\n" .align 8 .LC4: .string " Elephant Valley: ./mandelbrot_cuda 0.175 0.375 -0.1 0.1 4096 64 64\n" .align 8 .LC5: .string " Triple Spiral Valley: ./mandelbrot_cuda -0.188 -0.012 0.554 0.754 4096 64 64\n" .text .globl _Z18print_instructionsv .type _Z18print_instructionsv, @function _Z18print_instructionsv: .LFB2057: .cfi_startproc endbr64 pushq %rax .cfi_def_cfa_offset 16 popq %rax .cfi_def_cfa_offset 8 subq $8, %rsp .cfi_def_cfa_offset 16 leaq .LC0(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT leaq .LC1(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT leaq .LC3(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT leaq .LC4(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT leaq .LC5(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $0, %edi call exit@PLT .cfi_endproc .LFE2057: .size _Z18print_instructionsv, .-_Z18print_instructionsv .section .rodata.str1.1,"aMS",@progbits,1 .LC6: .string "wb" .LC7: .string "output.ppm" .LC8: .string "# " .LC9: .string "P6\n %s\n %d\n %d\n %d\n" .text .globl _Z13write_to_filePhiii .type _Z13write_to_filePhiii, @function _Z13write_to_filePhiii: .LFB2058: .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 $16, %rsp .cfi_def_cfa_offset 64 movq %rdi, %r12 movl %esi, %ebx movl %edx, %r14d movl %ecx, %ebp movq %fs:40, %rax movq %rax, 8(%rsp) xorl %eax, %eax leaq .LC6(%rip), %rsi leaq .LC7(%rip), %rdi call fopen@PLT movq %rax, %r13 subq $8, %rsp .cfi_def_cfa_offset 72 pushq $255 .cfi_def_cfa_offset 80 movl %r14d, %r9d movl %ebx, %r8d leaq .LC8(%rip), %rcx leaq .LC9(%rip), %rdx movl $2, %esi movq %rax, %rdi movl $0, %eax call __fprintf_chk@PLT addq $16, %rsp .cfi_def_cfa_offset 64 testl %ebp, %ebp jle .L6 movq %r12, %rbx movslq %ebp, %rbp addq %rbp, %r12 leaq 5(%rsp), %r14 .L7: movzbl (%rbx), %eax movb %al, 5(%rsp) movzbl (%rbx,%rbp), %eax movb %al, 6(%rsp) movzbl (%rbx,%rbp,2), %eax movb %al, 7(%rsp) movq %r13, %rcx movl $3, %edx movl $1, %esi movq %r14, %rdi call fwrite@PLT addq $1, %rbx cmpq %r12, %rbx jne .L7 .L6: movq %r13, %rdi call fclose@PLT movq 8(%rsp), %rax subq %fs:40, %rax jne .L11 addq $16, %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 .L11: .cfi_restore_state call __stack_chk_fail@PLT .cfi_endproc .LFE2058: .size _Z13write_to_filePhiii, .-_Z13write_to_filePhiii .globl _Z49__device_stub__Z18compute_mandelbrotPhiiddddiiiddPhiiddddiiidd .type _Z49__device_stub__Z18compute_mandelbrotPhiiddddiiiddPhiiddddiiidd, @function _Z49__device_stub__Z18compute_mandelbrotPhiiddddiiiddPhiiddddiiidd: .LFB2084: .cfi_startproc endbr64 subq $264, %rsp .cfi_def_cfa_offset 272 movq %rdi, 72(%rsp) movl %esi, 68(%rsp) movl %edx, 64(%rsp) movsd %xmm0, 56(%rsp) movsd %xmm1, 48(%rsp) movsd %xmm2, 40(%rsp) movsd %xmm3, 32(%rsp) movl %ecx, 28(%rsp) movl %r8d, 24(%rsp) movl %r9d, 20(%rsp) movsd %xmm4, 8(%rsp) movsd %xmm5, (%rsp) movq %fs:40, %rax movq %rax, 248(%rsp) xorl %eax, %eax leaq 72(%rsp), %rax movq %rax, 144(%rsp) leaq 68(%rsp), %rax movq %rax, 152(%rsp) leaq 64(%rsp), %rax movq %rax, 160(%rsp) leaq 56(%rsp), %rax movq %rax, 168(%rsp) leaq 48(%rsp), %rax movq %rax, 176(%rsp) leaq 40(%rsp), %rax movq %rax, 184(%rsp) leaq 32(%rsp), %rax movq %rax, 192(%rsp) leaq 28(%rsp), %rax movq %rax, 200(%rsp) leaq 24(%rsp), %rax movq %rax, 208(%rsp) leaq 20(%rsp), %rax movq %rax, 216(%rsp) leaq 8(%rsp), %rax movq %rax, 224(%rsp) movq %rsp, %rax movq %rax, 232(%rsp) movl $1, 96(%rsp) movl $1, 100(%rsp) movl $1, 104(%rsp) movl $1, 108(%rsp) movl $1, 112(%rsp) movl $1, 116(%rsp) leaq 88(%rsp), %rcx leaq 80(%rsp), %rdx leaq 108(%rsp), %rsi leaq 96(%rsp), %rdi call __cudaPopCallConfiguration@PLT testl %eax, %eax je .L16 .L12: movq 248(%rsp), %rax subq %fs:40, %rax jne .L17 addq $264, %rsp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L16: .cfi_restore_state pushq 88(%rsp) .cfi_def_cfa_offset 280 pushq 88(%rsp) .cfi_def_cfa_offset 288 leaq 160(%rsp), %r9 movq 124(%rsp), %rcx movl 132(%rsp), %r8d movq 112(%rsp), %rsi movl 120(%rsp), %edx leaq _Z18compute_mandelbrotPhiiddddiiidd(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 272 jmp .L12 .L17: call __stack_chk_fail@PLT .cfi_endproc .LFE2084: .size _Z49__device_stub__Z18compute_mandelbrotPhiiddddiiiddPhiiddddiiidd, .-_Z49__device_stub__Z18compute_mandelbrotPhiiddddiiiddPhiiddddiiidd .globl _Z18compute_mandelbrotPhiiddddiiidd .type _Z18compute_mandelbrotPhiiddddiiidd, @function _Z18compute_mandelbrotPhiiddddiiidd: .LFB2085: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z49__device_stub__Z18compute_mandelbrotPhiiddddiiiddPhiiddddiiidd addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2085: .size _Z18compute_mandelbrotPhiiddddiiidd, .-_Z18compute_mandelbrotPhiiddddiiidd .section .rodata.str1.1 .LC10: .string "%lf" .LC11: .string "%d" .text .globl main .type main, @function main: .LFB2059: .cfi_startproc endbr64 pushq %r15 .cfi_def_cfa_offset 16 .cfi_offset 15, -16 pushq %r14 .cfi_def_cfa_offset 24 .cfi_offset 14, -24 pushq %r13 .cfi_def_cfa_offset 32 .cfi_offset 13, -32 pushq %r12 .cfi_def_cfa_offset 40 .cfi_offset 12, -40 pushq %rbp .cfi_def_cfa_offset 48 .cfi_offset 6, -48 pushq %rbx .cfi_def_cfa_offset 56 .cfi_offset 3, -56 subq $120, %rsp .cfi_def_cfa_offset 176 movq %fs:40, %rax movq %rax, 104(%rsp) xorl %eax, %eax cmpl $7, %edi jle .L26 movq %rsi, %rbx leaq 40(%rsp), %rdx movq 8(%rsi), %rdi leaq .LC10(%rip), %rbp movq %rbp, %rsi movl $0, %eax call __isoc23_sscanf@PLT leaq 48(%rsp), %rdx movq 16(%rbx), %rdi movq %rbp, %rsi movl $0, %eax call __isoc23_sscanf@PLT leaq 56(%rsp), %rdx movq 24(%rbx), %rdi movq %rbp, %rsi movl $0, %eax call __isoc23_sscanf@PLT leaq 64(%rsp), %rdx movq 32(%rbx), %rdi movq %rbp, %rsi movl $0, %eax call __isoc23_sscanf@PLT leaq 28(%rsp), %rdx movq 40(%rbx), %rdi leaq .LC11(%rip), %rbp movq %rbp, %rsi movl $0, %eax call __isoc23_sscanf@PLT leaq 32(%rsp), %rdx movq 48(%rbx), %rdi movq %rbp, %rsi movl $0, %eax call __isoc23_sscanf@PLT leaq 36(%rsp), %rdx movq 56(%rbx), %rdi movq %rbp, %rsi movl $0, %eax call __isoc23_sscanf@PLT movl 28(%rsp), %r12d movl %r12d, %r13d imull %r12d, %r13d movq 48(%rsp), %r14 movsd 40(%rsp), %xmm6 movsd %xmm6, (%rsp) movq 64(%rsp), %r15 movsd 56(%rsp), %xmm7 movsd %xmm7, 8(%rsp) movslq %r13d, %rax leaq (%rax,%rax,2), %rbp movq %rbp, %rdi call malloc@PLT movq %rax, %rbx leaq 72(%rsp), %rdi movq %rbp, %rsi call cudaMalloc@PLT movl 32(%rsp), %eax movl %eax, 80(%rsp) movl 36(%rsp), %eax movl %eax, 84(%rsp) movl $256, 92(%rsp) movl $1, 96(%rsp) movl $0, %r9d movl $0, %r8d movq 92(%rsp), %rdx movl $1, %ecx movq 80(%rsp), %rdi movl $1, %esi call __cudaPushCallConfiguration@PLT testl %eax, %eax je .L27 .L23: call cudaDeviceSynchronize@PLT movl $2, %ecx movq %rbp, %rdx movq 72(%rsp), %rsi movq %rbx, %rdi call cudaMemcpy@PLT movq 104(%rsp), %rax subq %fs:40, %rax jne .L28 movl $0, %eax addq $120, %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 .L26: .cfi_restore_state movq 104(%rsp), %rax subq %fs:40, %rax jne .L29 call _Z18print_instructionsv .L29: call __stack_chk_fail@PLT .L27: pxor %xmm0, %xmm0 cvtsi2sdl %r12d, %xmm0 movq %r15, %xmm5 subsd 8(%rsp), %xmm5 movq %r14, %xmm4 subsd (%rsp), %xmm4 divsd %xmm0, %xmm5 divsd %xmm0, %xmm4 movl %r12d, %r9d movl %r12d, %r8d movl %r13d, %ecx movsd 64(%rsp), %xmm3 movsd 56(%rsp), %xmm2 movsd 48(%rsp), %xmm1 movsd 40(%rsp), %xmm0 movl $200, %edx movl $16, %esi movq 72(%rsp), %rdi call _Z49__device_stub__Z18compute_mandelbrotPhiiddddiiiddPhiiddddiiidd jmp .L23 .L28: call __stack_chk_fail@PLT .cfi_endproc .LFE2059: .size main, .-main .section .rodata.str1.8 .align 8 .LC12: .string "_Z18compute_mandelbrotPhiiddddiiidd" .text .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB2087: .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 .LC12(%rip), %rdx movq %rdx, %rcx leaq _Z18compute_mandelbrotPhiiddddiiidd(%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 .LFE2087: .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 <math.h> #include <stdio.h> #include <stdlib.h> void print_instructions() { printf( "usage: ./mandelbrot_cuda c_x_min c_x_max c_y_min c_y_max image_size x_grid_dimension y_grid_dimension\n"); printf("examples with image_size = 4096, x_grid_dimension = 64 and y_grid_dimension = 64:\n"); printf( " Full Picture: ./mandelbrot_cuda -2.5 1.5 -2.0 2.0 4096 64 64\n"); printf( " Seahorse Valley: ./mandelbrot_cuda -0.8 -0.7 0.05 0.15 " "4096 64 64\n"); printf( " Elephant Valley: ./mandelbrot_cuda 0.175 0.375 -0.1 0.1 " "4096 64 64\n"); printf( " Triple Spiral Valley: ./mandelbrot_cuda -0.188 -0.012 0.554 0.754 " "4096 64 64\n"); exit(0); }; void write_to_file(unsigned char *image_buffer, int i_x_max, int i_y_max, int image_buffer_size) { FILE *file; const char *filename = "output.ppm"; const char *comment = "# "; int max_color_component_value = 255; file = fopen(filename, "wb"); fprintf(file, "P6\n %s\n %d\n %d\n %d\n", comment, i_x_max, i_y_max, max_color_component_value); for (int i = 0; i < image_buffer_size; i++) { unsigned char buffer[3] = {image_buffer[i], image_buffer[i + image_buffer_size], image_buffer[i + (image_buffer_size * 2)]}; fwrite(buffer, 1, 3, file); }; fclose(file); }; __global__ void compute_mandelbrot(unsigned char *d_image_buffer, int gradient_size, int iteration_max, double c_x_min, double c_x_max, double c_y_min, double c_y_max, int image_buffer_size, int i_x_max, int i_y_max, double pixel_width, double pixel_height) { double z_x; double z_y; double z_x_squared; double z_y_squared; double escape_radius_squared = 4; int iteration; int i_x; int i_y; double c_x; double c_y; int colors[17][3] = { {66, 30, 15}, {25, 7, 26}, {9, 1, 47}, {4, 4, 73}, {0, 7, 100}, {12, 44, 138}, {24, 82, 177}, {57, 125, 209}, {134, 181, 229}, {211, 236, 248}, {241, 233, 191}, {248, 201, 95}, {255, 170, 0}, {204, 128, 0}, {153, 87, 0}, {106, 52, 3}, {16, 16, 16}, }; int index = blockIdx.x * blockDim.x + threadIdx.x; int stride = blockDim.x * gridDim.x; for (i_y = index; i_y < i_y_max; i_y += stride) { c_y = c_y_min + i_y * pixel_height; if (fabs(c_y) < pixel_height / 2) { c_y = 0.0; }; for (i_x = 0; i_x < i_x_max; i_x++) { c_x = c_x_min + i_x * pixel_width; z_x = 0.0; z_y = 0.0; z_x_squared = 0.0; z_y_squared = 0.0; for (iteration = 0; iteration < iteration_max && ((z_x_squared + z_y_squared) < escape_radius_squared); iteration++) { z_y = 2 * z_x * z_y + c_y; z_x = z_x_squared - z_y_squared + c_x; z_x_squared = z_x * z_x; z_y_squared = z_y * z_y; }; if (iteration == iteration_max) { d_image_buffer[(i_y_max * i_y) + i_x] = colors[16][0]; d_image_buffer[(i_y_max * i_y) + i_x + image_buffer_size] = colors[16][1]; d_image_buffer[(i_y_max * i_y) + i_x + (2 * image_buffer_size)] = colors[16][2]; } else { int color = iteration % 16; d_image_buffer[(i_y_max * i_y) + i_x] = colors[color][0]; d_image_buffer[(i_y_max * i_y) + i_x + image_buffer_size] = colors[color][1]; d_image_buffer[(i_y_max * i_y) + i_x + (2 * image_buffer_size)] = colors[color][2]; }; }; }; }; int main(int argc, char *argv[]) { if (argc < 8) { print_instructions(); return 0; } double c_x_min; double c_x_max; double c_y_min; double c_y_max; int image_size; int x_grid_dimension; int y_grid_dimension; unsigned char *image_buffer; unsigned char *d_image_buffer; int gradient_size = 16; int iteration_max = 200; sscanf(argv[1], "%lf", &c_x_min); sscanf(argv[2], "%lf", &c_x_max); sscanf(argv[3], "%lf", &c_y_min); sscanf(argv[4], "%lf", &c_y_max); sscanf(argv[5], "%d", &image_size); sscanf(argv[6], "%d", &x_grid_dimension); sscanf(argv[7], "%d", &y_grid_dimension); int i_x_max = image_size; int i_y_max = image_size; int image_buffer_size = image_size * image_size; double pixel_width = (c_x_max - c_x_min) / i_x_max; double pixel_height = (c_y_max - c_y_min) / i_y_max; int rgb_size = 3; image_buffer = (unsigned char *)malloc(sizeof(unsigned char) * image_buffer_size * rgb_size); cudaMalloc(&d_image_buffer, sizeof(unsigned char) * image_buffer_size * rgb_size); int blockSize = 256; dim3 gridSize = dim3(x_grid_dimension, y_grid_dimension); compute_mandelbrot<<<gridSize, blockSize>>>(d_image_buffer, gradient_size, iteration_max, c_x_min, c_x_max, c_y_min, c_y_max, image_buffer_size, i_x_max, i_y_max, pixel_width, pixel_height); cudaDeviceSynchronize(); cudaMemcpy(image_buffer, d_image_buffer, sizeof(unsigned char) * image_buffer_size * rgb_size, cudaMemcpyDeviceToHost); // write_to_file(image_buffer, i_x_max, i_y_max, image_buffer_size); return 0; };
#include <hip/hip_runtime.h> #include <math.h> #include <stdio.h> #include <stdlib.h> void print_instructions() { printf( "usage: ./mandelbrot_cuda c_x_min c_x_max c_y_min c_y_max image_size x_grid_dimension y_grid_dimension\n"); printf("examples with image_size = 4096, x_grid_dimension = 64 and y_grid_dimension = 64:\n"); printf( " Full Picture: ./mandelbrot_cuda -2.5 1.5 -2.0 2.0 4096 64 64\n"); printf( " Seahorse Valley: ./mandelbrot_cuda -0.8 -0.7 0.05 0.15 " "4096 64 64\n"); printf( " Elephant Valley: ./mandelbrot_cuda 0.175 0.375 -0.1 0.1 " "4096 64 64\n"); printf( " Triple Spiral Valley: ./mandelbrot_cuda -0.188 -0.012 0.554 0.754 " "4096 64 64\n"); exit(0); }; void write_to_file(unsigned char *image_buffer, int i_x_max, int i_y_max, int image_buffer_size) { FILE *file; const char *filename = "output.ppm"; const char *comment = "# "; int max_color_component_value = 255; file = fopen(filename, "wb"); fprintf(file, "P6\n %s\n %d\n %d\n %d\n", comment, i_x_max, i_y_max, max_color_component_value); for (int i = 0; i < image_buffer_size; i++) { unsigned char buffer[3] = {image_buffer[i], image_buffer[i + image_buffer_size], image_buffer[i + (image_buffer_size * 2)]}; fwrite(buffer, 1, 3, file); }; fclose(file); }; __global__ void compute_mandelbrot(unsigned char *d_image_buffer, int gradient_size, int iteration_max, double c_x_min, double c_x_max, double c_y_min, double c_y_max, int image_buffer_size, int i_x_max, int i_y_max, double pixel_width, double pixel_height) { double z_x; double z_y; double z_x_squared; double z_y_squared; double escape_radius_squared = 4; int iteration; int i_x; int i_y; double c_x; double c_y; int colors[17][3] = { {66, 30, 15}, {25, 7, 26}, {9, 1, 47}, {4, 4, 73}, {0, 7, 100}, {12, 44, 138}, {24, 82, 177}, {57, 125, 209}, {134, 181, 229}, {211, 236, 248}, {241, 233, 191}, {248, 201, 95}, {255, 170, 0}, {204, 128, 0}, {153, 87, 0}, {106, 52, 3}, {16, 16, 16}, }; int index = blockIdx.x * blockDim.x + threadIdx.x; int stride = blockDim.x * gridDim.x; for (i_y = index; i_y < i_y_max; i_y += stride) { c_y = c_y_min + i_y * pixel_height; if (fabs(c_y) < pixel_height / 2) { c_y = 0.0; }; for (i_x = 0; i_x < i_x_max; i_x++) { c_x = c_x_min + i_x * pixel_width; z_x = 0.0; z_y = 0.0; z_x_squared = 0.0; z_y_squared = 0.0; for (iteration = 0; iteration < iteration_max && ((z_x_squared + z_y_squared) < escape_radius_squared); iteration++) { z_y = 2 * z_x * z_y + c_y; z_x = z_x_squared - z_y_squared + c_x; z_x_squared = z_x * z_x; z_y_squared = z_y * z_y; }; if (iteration == iteration_max) { d_image_buffer[(i_y_max * i_y) + i_x] = colors[16][0]; d_image_buffer[(i_y_max * i_y) + i_x + image_buffer_size] = colors[16][1]; d_image_buffer[(i_y_max * i_y) + i_x + (2 * image_buffer_size)] = colors[16][2]; } else { int color = iteration % 16; d_image_buffer[(i_y_max * i_y) + i_x] = colors[color][0]; d_image_buffer[(i_y_max * i_y) + i_x + image_buffer_size] = colors[color][1]; d_image_buffer[(i_y_max * i_y) + i_x + (2 * image_buffer_size)] = colors[color][2]; }; }; }; }; int main(int argc, char *argv[]) { if (argc < 8) { print_instructions(); return 0; } double c_x_min; double c_x_max; double c_y_min; double c_y_max; int image_size; int x_grid_dimension; int y_grid_dimension; unsigned char *image_buffer; unsigned char *d_image_buffer; int gradient_size = 16; int iteration_max = 200; sscanf(argv[1], "%lf", &c_x_min); sscanf(argv[2], "%lf", &c_x_max); sscanf(argv[3], "%lf", &c_y_min); sscanf(argv[4], "%lf", &c_y_max); sscanf(argv[5], "%d", &image_size); sscanf(argv[6], "%d", &x_grid_dimension); sscanf(argv[7], "%d", &y_grid_dimension); int i_x_max = image_size; int i_y_max = image_size; int image_buffer_size = image_size * image_size; double pixel_width = (c_x_max - c_x_min) / i_x_max; double pixel_height = (c_y_max - c_y_min) / i_y_max; int rgb_size = 3; image_buffer = (unsigned char *)malloc(sizeof(unsigned char) * image_buffer_size * rgb_size); hipMalloc(&d_image_buffer, sizeof(unsigned char) * image_buffer_size * rgb_size); int blockSize = 256; dim3 gridSize = dim3(x_grid_dimension, y_grid_dimension); compute_mandelbrot<<<gridSize, blockSize>>>(d_image_buffer, gradient_size, iteration_max, c_x_min, c_x_max, c_y_min, c_y_max, image_buffer_size, i_x_max, i_y_max, pixel_width, pixel_height); hipDeviceSynchronize(); hipMemcpy(image_buffer, d_image_buffer, sizeof(unsigned char) * image_buffer_size * rgb_size, hipMemcpyDeviceToHost); // write_to_file(image_buffer, i_x_max, i_y_max, image_buffer_size); return 0; };
You are a helpful coding assistant specialized in converting HIP source code to AMD device assembly.
#include <hip/hip_runtime.h> #include <math.h> #include <stdio.h> #include <stdlib.h> void print_instructions() { printf( "usage: ./mandelbrot_cuda c_x_min c_x_max c_y_min c_y_max image_size x_grid_dimension y_grid_dimension\n"); printf("examples with image_size = 4096, x_grid_dimension = 64 and y_grid_dimension = 64:\n"); printf( " Full Picture: ./mandelbrot_cuda -2.5 1.5 -2.0 2.0 4096 64 64\n"); printf( " Seahorse Valley: ./mandelbrot_cuda -0.8 -0.7 0.05 0.15 " "4096 64 64\n"); printf( " Elephant Valley: ./mandelbrot_cuda 0.175 0.375 -0.1 0.1 " "4096 64 64\n"); printf( " Triple Spiral Valley: ./mandelbrot_cuda -0.188 -0.012 0.554 0.754 " "4096 64 64\n"); exit(0); }; void write_to_file(unsigned char *image_buffer, int i_x_max, int i_y_max, int image_buffer_size) { FILE *file; const char *filename = "output.ppm"; const char *comment = "# "; int max_color_component_value = 255; file = fopen(filename, "wb"); fprintf(file, "P6\n %s\n %d\n %d\n %d\n", comment, i_x_max, i_y_max, max_color_component_value); for (int i = 0; i < image_buffer_size; i++) { unsigned char buffer[3] = {image_buffer[i], image_buffer[i + image_buffer_size], image_buffer[i + (image_buffer_size * 2)]}; fwrite(buffer, 1, 3, file); }; fclose(file); }; __global__ void compute_mandelbrot(unsigned char *d_image_buffer, int gradient_size, int iteration_max, double c_x_min, double c_x_max, double c_y_min, double c_y_max, int image_buffer_size, int i_x_max, int i_y_max, double pixel_width, double pixel_height) { double z_x; double z_y; double z_x_squared; double z_y_squared; double escape_radius_squared = 4; int iteration; int i_x; int i_y; double c_x; double c_y; int colors[17][3] = { {66, 30, 15}, {25, 7, 26}, {9, 1, 47}, {4, 4, 73}, {0, 7, 100}, {12, 44, 138}, {24, 82, 177}, {57, 125, 209}, {134, 181, 229}, {211, 236, 248}, {241, 233, 191}, {248, 201, 95}, {255, 170, 0}, {204, 128, 0}, {153, 87, 0}, {106, 52, 3}, {16, 16, 16}, }; int index = blockIdx.x * blockDim.x + threadIdx.x; int stride = blockDim.x * gridDim.x; for (i_y = index; i_y < i_y_max; i_y += stride) { c_y = c_y_min + i_y * pixel_height; if (fabs(c_y) < pixel_height / 2) { c_y = 0.0; }; for (i_x = 0; i_x < i_x_max; i_x++) { c_x = c_x_min + i_x * pixel_width; z_x = 0.0; z_y = 0.0; z_x_squared = 0.0; z_y_squared = 0.0; for (iteration = 0; iteration < iteration_max && ((z_x_squared + z_y_squared) < escape_radius_squared); iteration++) { z_y = 2 * z_x * z_y + c_y; z_x = z_x_squared - z_y_squared + c_x; z_x_squared = z_x * z_x; z_y_squared = z_y * z_y; }; if (iteration == iteration_max) { d_image_buffer[(i_y_max * i_y) + i_x] = colors[16][0]; d_image_buffer[(i_y_max * i_y) + i_x + image_buffer_size] = colors[16][1]; d_image_buffer[(i_y_max * i_y) + i_x + (2 * image_buffer_size)] = colors[16][2]; } else { int color = iteration % 16; d_image_buffer[(i_y_max * i_y) + i_x] = colors[color][0]; d_image_buffer[(i_y_max * i_y) + i_x + image_buffer_size] = colors[color][1]; d_image_buffer[(i_y_max * i_y) + i_x + (2 * image_buffer_size)] = colors[color][2]; }; }; }; }; int main(int argc, char *argv[]) { if (argc < 8) { print_instructions(); return 0; } double c_x_min; double c_x_max; double c_y_min; double c_y_max; int image_size; int x_grid_dimension; int y_grid_dimension; unsigned char *image_buffer; unsigned char *d_image_buffer; int gradient_size = 16; int iteration_max = 200; sscanf(argv[1], "%lf", &c_x_min); sscanf(argv[2], "%lf", &c_x_max); sscanf(argv[3], "%lf", &c_y_min); sscanf(argv[4], "%lf", &c_y_max); sscanf(argv[5], "%d", &image_size); sscanf(argv[6], "%d", &x_grid_dimension); sscanf(argv[7], "%d", &y_grid_dimension); int i_x_max = image_size; int i_y_max = image_size; int image_buffer_size = image_size * image_size; double pixel_width = (c_x_max - c_x_min) / i_x_max; double pixel_height = (c_y_max - c_y_min) / i_y_max; int rgb_size = 3; image_buffer = (unsigned char *)malloc(sizeof(unsigned char) * image_buffer_size * rgb_size); hipMalloc(&d_image_buffer, sizeof(unsigned char) * image_buffer_size * rgb_size); int blockSize = 256; dim3 gridSize = dim3(x_grid_dimension, y_grid_dimension); compute_mandelbrot<<<gridSize, blockSize>>>(d_image_buffer, gradient_size, iteration_max, c_x_min, c_x_max, c_y_min, c_y_max, image_buffer_size, i_x_max, i_y_max, pixel_width, pixel_height); hipDeviceSynchronize(); hipMemcpy(image_buffer, d_image_buffer, sizeof(unsigned char) * image_buffer_size * rgb_size, hipMemcpyDeviceToHost); // write_to_file(image_buffer, i_x_max, i_y_max, image_buffer_size); return 0; };
.text .amdgcn_target "amdgcn-amd-amdhsa--gfx1100" .protected _Z18compute_mandelbrotPhiiddddiiidd .globl _Z18compute_mandelbrotPhiiddddiiidd .p2align 8 .type _Z18compute_mandelbrotPhiiddddiiidd,@function _Z18compute_mandelbrotPhiiddddiiidd: s_clause 0x1 s_load_b32 s2, s[0:1], 0x5c s_load_b32 s12, s[0:1], 0x38 s_add_u32 s8, s0, 0x50 s_addc_u32 s9, s1, 0 s_waitcnt lgkmcnt(0) s_and_b32 s16, s2, 0xffff s_mov_b32 s2, exec_lo v_mad_u64_u32 v[1:2], null, s15, s16, v[0:1] s_delay_alu instid0(VALU_DEP_1) v_cmpx_gt_i32_e64 s12, v1 s_cbranch_execz .LBB0_15 s_clause 0x2 s_load_b128 s[4:7], s[0:1], 0x40 s_load_b64 s[2:3], s[0:1], 0x30 s_load_b32 s13, s[0:1], 0xc s_load_b32 s17, s[8:9], 0x0 s_clause 0x2 s_load_b64 s[8:9], s[0:1], 0x0 s_load_b64 s[10:11], s[0:1], 0x10 s_load_b64 s[0:1], s[0:1], 0x20 s_waitcnt lgkmcnt(0) s_cmp_gt_i32 s3, 0 s_cselect_b32 s14, -1, 0 s_cmp_gt_i32 s13, 0 v_mul_f64 v[2:3], s[6:7], 0.5 s_cselect_b32 s15, -1, 0 s_mul_i32 s16, s17, s16 s_mov_b32 s17, 0 s_lshl_b32 s18, s2, 1 s_branch .LBB0_3 .LBB0_2: v_add_nc_u32_e32 v1, s16, v1 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1) v_cmp_le_i32_e32 vcc_lo, s12, v1 s_or_b32 s17, vcc_lo, s17 s_and_not1_b32 exec_lo, exec_lo, s17 s_cbranch_execz .LBB0_15 .LBB0_3: s_and_not1_b32 vcc_lo, exec_lo, s14 s_cbranch_vccnz .LBB0_2 v_cvt_f64_i32_e32 v[4:5], v1 v_mul_lo_u32 v0, v1, s12 s_mov_b32 s19, 0 v_mov_b32_e32 v6, 0 s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1) v_fma_f64 v[4:5], v[4:5], s[6:7], s[0:1] v_cmp_nlt_f64_e64 vcc_lo, |v[4:5]|, v[2:3] v_dual_mov_b32 v7, 0 :: v_dual_cndmask_b32 v4, 0, v4 v_cndmask_b32_e32 v5, 0, v5, vcc_lo s_branch .LBB0_6 .LBB0_5: s_or_b32 exec_lo, exec_lo, s20 v_add_f64 v[6:7], v[6:7], 1.0 v_ashrrev_i32_e32 v10, 31, v9 v_add_co_u32 v9, vcc_lo, s8, v9 s_add_i32 s19, s19, 1 s_delay_alu instid0(VALU_DEP_2) v_add_co_ci_u32_e32 v10, vcc_lo, s9, v10, vcc_lo s_cmp_lg_u32 s19, s3 s_waitcnt vmcnt(0) global_store_b8 v[9:10], v8, off s_cbranch_scc0 .LBB0_2 .LBB0_6: s_and_not1_b32 vcc_lo, exec_lo, s15 s_cbranch_vccnz .LBB0_10 v_fma_f64 v[8:9], v[6:7], s[4:5], s[10:11] v_mov_b32_e32 v10, 0 v_mov_b32_e32 v11, 0 s_mov_b32 s20, 0 s_mov_b32 s21, 0 s_delay_alu instid0(VALU_DEP_1) v_dual_mov_b32 v13, v11 :: v_dual_mov_b32 v12, v10 v_dual_mov_b32 v15, v11 :: v_dual_mov_b32 v14, v10 v_dual_mov_b32 v17, v11 :: v_dual_mov_b32 v16, v10 .p2align 6 .LBB0_8: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1) v_add_f64 v[14:15], v[14:15], -v[16:17] v_add_f64 v[16:17], v[10:11], v[10:11] s_add_i32 s21, s21, 1 s_cmp_ge_i32 s21, s13 v_mov_b32_e32 v18, s21 s_cselect_b32 s22, -1, 0 s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3) v_add_f64 v[10:11], v[8:9], v[14:15] v_fma_f64 v[12:13], v[12:13], v[16:17], v[4:5] s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1) v_mul_f64 v[14:15], v[10:11], v[10:11] v_fma_f64 v[16:17], v[12:13], v[12:13], v[14:15] s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1) v_cmp_ngt_f64_e32 vcc_lo, 4.0, v[16:17] v_mul_f64 v[16:17], v[12:13], v[12:13] s_or_b32 s22, s22, vcc_lo s_and_b32 s22, exec_lo, s22 s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1) s_or_b32 s20, s22, s20 s_and_not1_b32 exec_lo, exec_lo, s20 s_cbranch_execnz .LBB0_8 s_or_b32 exec_lo, exec_lo, s20 s_branch .LBB0_11 .LBB0_10: v_mov_b32_e32 v18, 0 .LBB0_11: s_mov_b32 s20, exec_lo s_delay_alu instid0(VALU_DEP_1) v_cmpx_ne_u32_e64 s13, v18 s_xor_b32 s20, exec_lo, s20 s_cbranch_execz .LBB0_13 v_and_b32_e32 v12, 15, v18 s_getpc_b64 s[22:23] s_add_u32 s22, s22, __const._Z18compute_mandelbrotPhiiddddiiidd.colors@rel32@lo+4 s_addc_u32 s23, s23, __const._Z18compute_mandelbrotPhiiddddiiidd.colors@rel32@hi+12 v_add_nc_u32_e32 v14, s19, v0 v_mad_u64_u32 v[8:9], null, v12, 12, s[22:23] s_delay_alu instid0(VALU_DEP_2) v_ashrrev_i32_e32 v11, 31, v14 s_getpc_b64 s[22:23] s_add_u32 s22, s22, __const._Z18compute_mandelbrotPhiiddddiiidd.colors@rel32@lo+8 s_addc_u32 s23, s23, __const._Z18compute_mandelbrotPhiiddddiiidd.colors@rel32@hi+16 v_add_co_u32 v10, vcc_lo, s8, v14 v_add_co_ci_u32_e32 v11, vcc_lo, s9, v11, vcc_lo global_load_b32 v13, v[8:9], off v_mad_u64_u32 v[8:9], null, v12, 12, s[22:23] s_getpc_b64 s[22:23] s_add_u32 s22, s22, __const._Z18compute_mandelbrotPhiiddddiiidd.colors@rel32@lo+12 s_addc_u32 s23, s23, __const._Z18compute_mandelbrotPhiiddddiiidd.colors@rel32@hi+20 s_waitcnt vmcnt(0) global_store_b8 v[10:11], v13, off global_load_b32 v13, v[8:9], off v_add_nc_u32_e32 v10, s2, v14 v_mad_u64_u32 v[8:9], null, v12, 12, s[22:23] s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2) v_ashrrev_i32_e32 v11, 31, v10 v_add_co_u32 v10, vcc_lo, s8, v10 v_add_co_ci_u32_e32 v11, vcc_lo, s9, v11, vcc_lo s_waitcnt vmcnt(0) global_store_b8 v[10:11], v13, off global_load_b32 v8, v[8:9], off v_add_nc_u32_e32 v9, s18, v14 .LBB0_13: s_and_not1_saveexec_b32 s20, s20 s_cbranch_execz .LBB0_5 v_add_nc_u32_e32 v9, s19, v0 s_waitcnt vmcnt(0) s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2) v_ashrrev_i32_e32 v8, 31, v9 v_add_co_u32 v10, vcc_lo, s8, v9 v_add_co_ci_u32_e32 v11, vcc_lo, s9, v8, vcc_lo v_mov_b32_e32 v8, 16 v_add_nc_u32_e32 v12, s2, v9 v_add_nc_u32_e32 v9, s18, v9 s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2) v_ashrrev_i32_e32 v13, 31, v12 v_add_co_u32 v12, vcc_lo, s8, v12 v_add_co_ci_u32_e32 v13, vcc_lo, s9, v13, vcc_lo s_clause 0x1 global_store_b8 v[10:11], v8, off global_store_b8 v[12:13], v8, off s_branch .LBB0_5 .LBB0_15: s_nop 0 s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z18compute_mandelbrotPhiiddddiiidd .amdhsa_group_segment_fixed_size 0 .amdhsa_private_segment_fixed_size 0 .amdhsa_kernarg_size 336 .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 19 .amdhsa_next_free_sgpr 24 .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 _Z18compute_mandelbrotPhiiddddiiidd, .Lfunc_end0-_Z18compute_mandelbrotPhiiddddiiidd .section .AMDGPU.csdata,"",@progbits .text .p2alignl 7, 3214868480 .fill 96, 4, 3214868480 .type __const._Z18compute_mandelbrotPhiiddddiiidd.colors,@object .section .rodata,"a",@progbits .p2align 4, 0x0 __const._Z18compute_mandelbrotPhiiddddiiidd.colors: .long 66 .long 30 .long 15 .long 25 .long 7 .long 26 .long 9 .long 1 .long 47 .long 4 .long 4 .long 73 .long 0 .long 7 .long 100 .long 12 .long 44 .long 138 .long 24 .long 82 .long 177 .long 57 .long 125 .long 209 .long 134 .long 181 .long 229 .long 211 .long 236 .long 248 .long 241 .long 233 .long 191 .long 248 .long 201 .long 95 .long 255 .long 170 .long 0 .long 204 .long 128 .long 0 .long 153 .long 87 .long 0 .long 106 .long 52 .long 3 .long 16 .long 16 .long 16 .size __const._Z18compute_mandelbrotPhiiddddiiidd.colors, 204 .type __hip_cuid_,@object .section .bss,"aw",@nobits .globl __hip_cuid_ __hip_cuid_: .byte 0 .size __hip_cuid_, 1 .ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)" .section ".note.GNU-stack","",@progbits .addrsig .addrsig_sym __hip_cuid_ .amdgpu_metadata --- amdhsa.kernels: - .args: - .address_space: global .offset: 0 .size: 8 .value_kind: global_buffer - .offset: 8 .size: 4 .value_kind: by_value - .offset: 12 .size: 4 .value_kind: by_value - .offset: 16 .size: 8 .value_kind: by_value - .offset: 24 .size: 8 .value_kind: by_value - .offset: 32 .size: 8 .value_kind: by_value - .offset: 40 .size: 8 .value_kind: by_value - .offset: 48 .size: 4 .value_kind: by_value - .offset: 52 .size: 4 .value_kind: by_value - .offset: 56 .size: 4 .value_kind: by_value - .offset: 64 .size: 8 .value_kind: by_value - .offset: 72 .size: 8 .value_kind: by_value - .offset: 80 .size: 4 .value_kind: hidden_block_count_x - .offset: 84 .size: 4 .value_kind: hidden_block_count_y - .offset: 88 .size: 4 .value_kind: hidden_block_count_z - .offset: 92 .size: 2 .value_kind: hidden_group_size_x - .offset: 94 .size: 2 .value_kind: hidden_group_size_y - .offset: 96 .size: 2 .value_kind: hidden_group_size_z - .offset: 98 .size: 2 .value_kind: hidden_remainder_x - .offset: 100 .size: 2 .value_kind: hidden_remainder_y - .offset: 102 .size: 2 .value_kind: hidden_remainder_z - .offset: 120 .size: 8 .value_kind: hidden_global_offset_x - .offset: 128 .size: 8 .value_kind: hidden_global_offset_y - .offset: 136 .size: 8 .value_kind: hidden_global_offset_z - .offset: 144 .size: 2 .value_kind: hidden_grid_dims .group_segment_fixed_size: 0 .kernarg_segment_align: 8 .kernarg_segment_size: 336 .language: OpenCL C .language_version: - 2 - 0 .max_flat_workgroup_size: 1024 .name: _Z18compute_mandelbrotPhiiddddiiidd .private_segment_fixed_size: 0 .sgpr_count: 26 .sgpr_spill_count: 0 .symbol: _Z18compute_mandelbrotPhiiddddiiidd.kd .uniform_work_group_size: 1 .uses_dynamic_stack: false .vgpr_count: 19 .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 <math.h> #include <stdio.h> #include <stdlib.h> void print_instructions() { printf( "usage: ./mandelbrot_cuda c_x_min c_x_max c_y_min c_y_max image_size x_grid_dimension y_grid_dimension\n"); printf("examples with image_size = 4096, x_grid_dimension = 64 and y_grid_dimension = 64:\n"); printf( " Full Picture: ./mandelbrot_cuda -2.5 1.5 -2.0 2.0 4096 64 64\n"); printf( " Seahorse Valley: ./mandelbrot_cuda -0.8 -0.7 0.05 0.15 " "4096 64 64\n"); printf( " Elephant Valley: ./mandelbrot_cuda 0.175 0.375 -0.1 0.1 " "4096 64 64\n"); printf( " Triple Spiral Valley: ./mandelbrot_cuda -0.188 -0.012 0.554 0.754 " "4096 64 64\n"); exit(0); }; void write_to_file(unsigned char *image_buffer, int i_x_max, int i_y_max, int image_buffer_size) { FILE *file; const char *filename = "output.ppm"; const char *comment = "# "; int max_color_component_value = 255; file = fopen(filename, "wb"); fprintf(file, "P6\n %s\n %d\n %d\n %d\n", comment, i_x_max, i_y_max, max_color_component_value); for (int i = 0; i < image_buffer_size; i++) { unsigned char buffer[3] = {image_buffer[i], image_buffer[i + image_buffer_size], image_buffer[i + (image_buffer_size * 2)]}; fwrite(buffer, 1, 3, file); }; fclose(file); }; __global__ void compute_mandelbrot(unsigned char *d_image_buffer, int gradient_size, int iteration_max, double c_x_min, double c_x_max, double c_y_min, double c_y_max, int image_buffer_size, int i_x_max, int i_y_max, double pixel_width, double pixel_height) { double z_x; double z_y; double z_x_squared; double z_y_squared; double escape_radius_squared = 4; int iteration; int i_x; int i_y; double c_x; double c_y; int colors[17][3] = { {66, 30, 15}, {25, 7, 26}, {9, 1, 47}, {4, 4, 73}, {0, 7, 100}, {12, 44, 138}, {24, 82, 177}, {57, 125, 209}, {134, 181, 229}, {211, 236, 248}, {241, 233, 191}, {248, 201, 95}, {255, 170, 0}, {204, 128, 0}, {153, 87, 0}, {106, 52, 3}, {16, 16, 16}, }; int index = blockIdx.x * blockDim.x + threadIdx.x; int stride = blockDim.x * gridDim.x; for (i_y = index; i_y < i_y_max; i_y += stride) { c_y = c_y_min + i_y * pixel_height; if (fabs(c_y) < pixel_height / 2) { c_y = 0.0; }; for (i_x = 0; i_x < i_x_max; i_x++) { c_x = c_x_min + i_x * pixel_width; z_x = 0.0; z_y = 0.0; z_x_squared = 0.0; z_y_squared = 0.0; for (iteration = 0; iteration < iteration_max && ((z_x_squared + z_y_squared) < escape_radius_squared); iteration++) { z_y = 2 * z_x * z_y + c_y; z_x = z_x_squared - z_y_squared + c_x; z_x_squared = z_x * z_x; z_y_squared = z_y * z_y; }; if (iteration == iteration_max) { d_image_buffer[(i_y_max * i_y) + i_x] = colors[16][0]; d_image_buffer[(i_y_max * i_y) + i_x + image_buffer_size] = colors[16][1]; d_image_buffer[(i_y_max * i_y) + i_x + (2 * image_buffer_size)] = colors[16][2]; } else { int color = iteration % 16; d_image_buffer[(i_y_max * i_y) + i_x] = colors[color][0]; d_image_buffer[(i_y_max * i_y) + i_x + image_buffer_size] = colors[color][1]; d_image_buffer[(i_y_max * i_y) + i_x + (2 * image_buffer_size)] = colors[color][2]; }; }; }; }; int main(int argc, char *argv[]) { if (argc < 8) { print_instructions(); return 0; } double c_x_min; double c_x_max; double c_y_min; double c_y_max; int image_size; int x_grid_dimension; int y_grid_dimension; unsigned char *image_buffer; unsigned char *d_image_buffer; int gradient_size = 16; int iteration_max = 200; sscanf(argv[1], "%lf", &c_x_min); sscanf(argv[2], "%lf", &c_x_max); sscanf(argv[3], "%lf", &c_y_min); sscanf(argv[4], "%lf", &c_y_max); sscanf(argv[5], "%d", &image_size); sscanf(argv[6], "%d", &x_grid_dimension); sscanf(argv[7], "%d", &y_grid_dimension); int i_x_max = image_size; int i_y_max = image_size; int image_buffer_size = image_size * image_size; double pixel_width = (c_x_max - c_x_min) / i_x_max; double pixel_height = (c_y_max - c_y_min) / i_y_max; int rgb_size = 3; image_buffer = (unsigned char *)malloc(sizeof(unsigned char) * image_buffer_size * rgb_size); hipMalloc(&d_image_buffer, sizeof(unsigned char) * image_buffer_size * rgb_size); int blockSize = 256; dim3 gridSize = dim3(x_grid_dimension, y_grid_dimension); compute_mandelbrot<<<gridSize, blockSize>>>(d_image_buffer, gradient_size, iteration_max, c_x_min, c_x_max, c_y_min, c_y_max, image_buffer_size, i_x_max, i_y_max, pixel_width, pixel_height); hipDeviceSynchronize(); hipMemcpy(image_buffer, d_image_buffer, sizeof(unsigned char) * image_buffer_size * rgb_size, hipMemcpyDeviceToHost); // write_to_file(image_buffer, i_x_max, i_y_max, image_buffer_size); return 0; };
.text .file "mandelbrot_cuda.hip" .globl _Z18print_instructionsv # -- Begin function _Z18print_instructionsv .p2align 4, 0x90 .type _Z18print_instructionsv,@function _Z18print_instructionsv: # @_Z18print_instructionsv .cfi_startproc # %bb.0: pushq %rax .cfi_def_cfa_offset 16 movl $.Lstr, %edi callq puts@PLT movl $.Lstr.1, %edi callq puts@PLT movl $.Lstr.2, %edi callq puts@PLT movl $.Lstr.3, %edi callq puts@PLT movl $.Lstr.4, %edi callq puts@PLT movl $.Lstr.5, %edi callq puts@PLT xorl %edi, %edi callq exit .Lfunc_end0: .size _Z18print_instructionsv, .Lfunc_end0-_Z18print_instructionsv .cfi_endproc # -- End function .globl _Z13write_to_filePhiii # -- Begin function _Z13write_to_filePhiii .p2align 4, 0x90 .type _Z13write_to_filePhiii,@function _Z13write_to_filePhiii: # @_Z13write_to_filePhiii .cfi_startproc # %bb.0: pushq %rbp .cfi_def_cfa_offset 16 pushq %r15 .cfi_def_cfa_offset 24 pushq %r14 .cfi_def_cfa_offset 32 pushq %r13 .cfi_def_cfa_offset 40 pushq %r12 .cfi_def_cfa_offset 48 pushq %rbx .cfi_def_cfa_offset 56 pushq %rax .cfi_def_cfa_offset 64 .cfi_offset %rbx, -56 .cfi_offset %r12, -48 .cfi_offset %r13, -40 .cfi_offset %r14, -32 .cfi_offset %r15, -24 .cfi_offset %rbp, -16 movl %ecx, %ebp movl %edx, %r15d movl %esi, %r12d movq %rdi, %rbx movl $.L.str.6, %edi movl $.L.str.8, %esi callq fopen movq %rax, %r14 movl $.L.str.9, %esi movl $.L.str.7, %edx movq %rax, %rdi movl %r12d, %ecx movl %r15d, %r8d movl $255, %r9d xorl %eax, %eax callq fprintf testl %ebp, %ebp jle .LBB1_3 # %bb.1: # %.lr.ph movl %ebp, %r12d leaq (%rbx,%r12), %r13 leaq (%rbx,%r12,2), %rbp xorl %r15d, %r15d .p2align 4, 0x90 .LBB1_2: # =>This Inner Loop Header: Depth=1 movzbl (%rbx,%r15), %eax movb %al, 5(%rsp) movzbl (%r13,%r15), %eax movb %al, 6(%rsp) movzbl (%rbp,%r15), %eax movb %al, 7(%rsp) movl $1, %esi movl $3, %edx leaq 5(%rsp), %rdi movq %r14, %rcx callq fwrite incq %r15 cmpq %r15, %r12 jne .LBB1_2 .LBB1_3: # %._crit_edge movq %r14, %rdi addq $8, %rsp .cfi_def_cfa_offset 56 popq %rbx .cfi_def_cfa_offset 48 popq %r12 .cfi_def_cfa_offset 40 popq %r13 .cfi_def_cfa_offset 32 popq %r14 .cfi_def_cfa_offset 24 popq %r15 .cfi_def_cfa_offset 16 popq %rbp .cfi_def_cfa_offset 8 jmp fclose # TAILCALL .Lfunc_end1: .size _Z13write_to_filePhiii, .Lfunc_end1-_Z13write_to_filePhiii .cfi_endproc # -- End function .globl _Z33__device_stub__compute_mandelbrotPhiiddddiiidd # -- Begin function _Z33__device_stub__compute_mandelbrotPhiiddddiiidd .p2align 4, 0x90 .type _Z33__device_stub__compute_mandelbrotPhiiddddiiidd,@function _Z33__device_stub__compute_mandelbrotPhiiddddiiidd: # @_Z33__device_stub__compute_mandelbrotPhiiddddiiidd .cfi_startproc # %bb.0: subq $232, %rsp .cfi_def_cfa_offset 240 movq %rdi, 120(%rsp) movl %esi, 20(%rsp) movl %edx, 16(%rsp) movsd %xmm0, 112(%rsp) movsd %xmm1, 104(%rsp) movsd %xmm2, 96(%rsp) movsd %xmm3, 88(%rsp) movl %ecx, 12(%rsp) movl %r8d, 8(%rsp) movl %r9d, 4(%rsp) movsd %xmm4, 80(%rsp) movsd %xmm5, 72(%rsp) leaq 120(%rsp), %rax movq %rax, 128(%rsp) leaq 20(%rsp), %rax movq %rax, 136(%rsp) leaq 16(%rsp), %rax movq %rax, 144(%rsp) leaq 112(%rsp), %rax movq %rax, 152(%rsp) leaq 104(%rsp), %rax movq %rax, 160(%rsp) leaq 96(%rsp), %rax movq %rax, 168(%rsp) leaq 88(%rsp), %rax movq %rax, 176(%rsp) leaq 12(%rsp), %rax movq %rax, 184(%rsp) leaq 8(%rsp), %rax movq %rax, 192(%rsp) leaq 4(%rsp), %rax movq %rax, 200(%rsp) leaq 80(%rsp), %rax movq %rax, 208(%rsp) leaq 72(%rsp), %rax movq %rax, 216(%rsp) leaq 56(%rsp), %rdi leaq 40(%rsp), %rsi leaq 32(%rsp), %rdx leaq 24(%rsp), %rcx callq __hipPopCallConfiguration movq 56(%rsp), %rsi movl 64(%rsp), %edx movq 40(%rsp), %rcx movl 48(%rsp), %r8d leaq 128(%rsp), %r9 movl $_Z18compute_mandelbrotPhiiddddiiidd, %edi pushq 24(%rsp) .cfi_adjust_cfa_offset 8 pushq 40(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $248, %rsp .cfi_adjust_cfa_offset -248 retq .Lfunc_end2: .size _Z33__device_stub__compute_mandelbrotPhiiddddiiidd, .Lfunc_end2-_Z33__device_stub__compute_mandelbrotPhiiddddiiidd .cfi_endproc # -- End function .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: pushq %rbp .cfi_def_cfa_offset 16 pushq %r15 .cfi_def_cfa_offset 24 pushq %r14 .cfi_def_cfa_offset 32 pushq %rbx .cfi_def_cfa_offset 40 subq $312, %rsp # imm = 0x138 .cfi_def_cfa_offset 352 .cfi_offset %rbx, -40 .cfi_offset %r14, -32 .cfi_offset %r15, -24 .cfi_offset %rbp, -16 cmpl $7, %edi jle .LBB3_4 # %bb.1: movq %rsi, %rbx movq 8(%rsi), %rdi leaq 64(%rsp), %rdx movl $.L.str.10, %esi xorl %eax, %eax callq __isoc23_sscanf movq 16(%rbx), %rdi leaq 56(%rsp), %rdx movl $.L.str.10, %esi xorl %eax, %eax callq __isoc23_sscanf movq 24(%rbx), %rdi leaq 48(%rsp), %rdx movl $.L.str.10, %esi xorl %eax, %eax callq __isoc23_sscanf movq 32(%rbx), %rdi leaq 40(%rsp), %rdx movl $.L.str.10, %esi xorl %eax, %eax callq __isoc23_sscanf movq 40(%rbx), %rdi leaq 8(%rsp), %rdx movl $.L.str.11, %esi xorl %eax, %eax callq __isoc23_sscanf movq 48(%rbx), %rdi leaq 4(%rsp), %rdx movl $.L.str.11, %esi xorl %eax, %eax callq __isoc23_sscanf movq 56(%rbx), %rdi movq %rsp, %rdx movl $.L.str.11, %esi xorl %eax, %eax callq __isoc23_sscanf movl 8(%rsp), %ebp movl %ebp, %r15d imull %r15d, %r15d movsd 56(%rsp), %xmm0 # xmm0 = mem[0],zero movsd %xmm0, 96(%rsp) # 8-byte Spill movsd 64(%rsp), %xmm0 # xmm0 = mem[0],zero movsd %xmm0, 80(%rsp) # 8-byte Spill movsd 40(%rsp), %xmm0 # xmm0 = mem[0],zero movsd %xmm0, 88(%rsp) # 8-byte Spill movsd 48(%rsp), %xmm0 # xmm0 = mem[0],zero movsd %xmm0, 72(%rsp) # 8-byte Spill leaq (%r15,%r15,2), %rbx movq %rbx, %rdi callq malloc movq %rax, %r14 leaq 32(%rsp), %rdi movq %rbx, %rsi callq hipMalloc movl 4(%rsp), %eax movl (%rsp), %edi shlq $32, %rdi orq %rax, %rdi movabsq $4294967552, %rdx # imm = 0x100000100 movl $1, %esi movl $1, %ecx xorl %r8d, %r8d xorl %r9d, %r9d callq __hipPushCallConfiguration testl %eax, %eax jne .LBB3_3 # %bb.2: movsd 88(%rsp), %xmm5 # 8-byte Reload # xmm5 = mem[0],zero subsd 72(%rsp), %xmm5 # 8-byte Folded Reload xorps %xmm0, %xmm0 cvtsi2sd %ebp, %xmm0 divsd %xmm0, %xmm5 movsd 96(%rsp), %xmm4 # 8-byte Reload # xmm4 = mem[0],zero subsd 80(%rsp), %xmm4 # 8-byte Folded Reload divsd %xmm0, %xmm4 movq 32(%rsp), %rax movsd 64(%rsp), %xmm0 # xmm0 = mem[0],zero movsd 56(%rsp), %xmm1 # xmm1 = mem[0],zero movsd 48(%rsp), %xmm2 # xmm2 = mem[0],zero movsd 40(%rsp), %xmm3 # xmm3 = mem[0],zero movq %rax, 200(%rsp) movl $16, 28(%rsp) movl $200, 24(%rsp) movsd %xmm0, 192(%rsp) movsd %xmm1, 184(%rsp) movsd %xmm2, 176(%rsp) movsd %xmm3, 168(%rsp) movl %r15d, 20(%rsp) movl %ebp, 16(%rsp) movl %ebp, 12(%rsp) movsd %xmm4, 160(%rsp) movsd %xmm5, 152(%rsp) leaq 200(%rsp), %rax movq %rax, 208(%rsp) leaq 28(%rsp), %rax movq %rax, 216(%rsp) leaq 24(%rsp), %rax movq %rax, 224(%rsp) leaq 192(%rsp), %rax movq %rax, 232(%rsp) leaq 184(%rsp), %rax movq %rax, 240(%rsp) leaq 176(%rsp), %rax movq %rax, 248(%rsp) leaq 168(%rsp), %rax movq %rax, 256(%rsp) leaq 20(%rsp), %rax movq %rax, 264(%rsp) leaq 16(%rsp), %rax movq %rax, 272(%rsp) leaq 12(%rsp), %rax movq %rax, 280(%rsp) leaq 160(%rsp), %rax movq %rax, 288(%rsp) leaq 152(%rsp), %rax movq %rax, 296(%rsp) leaq 136(%rsp), %rdi leaq 120(%rsp), %rsi leaq 112(%rsp), %rdx leaq 104(%rsp), %rcx callq __hipPopCallConfiguration movq 136(%rsp), %rsi movl 144(%rsp), %edx movq 120(%rsp), %rcx movl 128(%rsp), %r8d leaq 208(%rsp), %r9 movl $_Z18compute_mandelbrotPhiiddddiiidd, %edi pushq 104(%rsp) .cfi_adjust_cfa_offset 8 pushq 120(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $16, %rsp .cfi_adjust_cfa_offset -16 .LBB3_3: callq hipDeviceSynchronize movq 32(%rsp), %rsi movq %r14, %rdi movq %rbx, %rdx movl $2, %ecx callq hipMemcpy xorl %eax, %eax addq $312, %rsp # imm = 0x138 .cfi_def_cfa_offset 40 popq %rbx .cfi_def_cfa_offset 32 popq %r14 .cfi_def_cfa_offset 24 popq %r15 .cfi_def_cfa_offset 16 popq %rbp .cfi_def_cfa_offset 8 retq .LBB3_4: .cfi_def_cfa_offset 352 movl $.Lstr, %edi callq puts@PLT movl $.Lstr.1, %edi callq puts@PLT movl $.Lstr.2, %edi callq puts@PLT movl $.Lstr.3, %edi callq puts@PLT movl $.Lstr.4, %edi callq puts@PLT movl $.Lstr.5, %edi callq puts@PLT xorl %edi, %edi callq exit .Lfunc_end3: .size main, .Lfunc_end3-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 .LBB4_2 # %bb.1: movl $__hip_fatbin_wrapper, %edi callq __hipRegisterFatBinary movq %rax, __hip_gpubin_handle(%rip) .LBB4_2: movq __hip_gpubin_handle(%rip), %rdi xorps %xmm0, %xmm0 movups %xmm0, 16(%rsp) movups %xmm0, (%rsp) movl $_Z18compute_mandelbrotPhiiddddiiidd, %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_end4: .size __hip_module_ctor, .Lfunc_end4-__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 .LBB5_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 .LBB5_2: retq .Lfunc_end5: .size __hip_module_dtor, .Lfunc_end5-__hip_module_dtor .cfi_endproc # -- End function .type .L.str.6,@object # @.str.6 .section .rodata.str1.1,"aMS",@progbits,1 .L.str.6: .asciz "output.ppm" .size .L.str.6, 11 .type .L.str.7,@object # @.str.7 .L.str.7: .asciz "# " .size .L.str.7, 3 .type .L.str.8,@object # @.str.8 .L.str.8: .asciz "wb" .size .L.str.8, 3 .type .L.str.9,@object # @.str.9 .L.str.9: .asciz "P6\n %s\n %d\n %d\n %d\n" .size .L.str.9, 20 .type _Z18compute_mandelbrotPhiiddddiiidd,@object # @_Z18compute_mandelbrotPhiiddddiiidd .section .rodata,"a",@progbits .globl _Z18compute_mandelbrotPhiiddddiiidd .p2align 3, 0x0 _Z18compute_mandelbrotPhiiddddiiidd: .quad _Z33__device_stub__compute_mandelbrotPhiiddddiiidd .size _Z18compute_mandelbrotPhiiddddiiidd, 8 .type .L.str.10,@object # @.str.10 .section .rodata.str1.1,"aMS",@progbits,1 .L.str.10: .asciz "%lf" .size .L.str.10, 4 .type .L.str.11,@object # @.str.11 .L.str.11: .asciz "%d" .size .L.str.11, 3 .type .L__unnamed_1,@object # @0 .L__unnamed_1: .asciz "_Z18compute_mandelbrotPhiiddddiiidd" .size .L__unnamed_1, 36 .type __hip_fatbin_wrapper,@object # @__hip_fatbin_wrapper .section .hipFatBinSegment,"a",@progbits .p2align 3, 0x0 __hip_fatbin_wrapper: .long 1212764230 # 0x48495046 .long 1 # 0x1 .quad __hip_fatbin .quad 0 .size __hip_fatbin_wrapper, 24 .type __hip_gpubin_handle,@object # @__hip_gpubin_handle .local __hip_gpubin_handle .comm __hip_gpubin_handle,8,8 .section .init_array,"aw",@init_array .p2align 3, 0x0 .quad __hip_module_ctor .type __hip_cuid_,@object # @__hip_cuid_ .bss .globl __hip_cuid_ __hip_cuid_: .byte 0 # 0x0 .size __hip_cuid_, 1 .type .Lstr,@object # @str .section .rodata.str1.1,"aMS",@progbits,1 .Lstr: .asciz "usage: ./mandelbrot_cuda c_x_min c_x_max c_y_min c_y_max image_size x_grid_dimension y_grid_dimension" .size .Lstr, 102 .type .Lstr.1,@object # @str.1 .Lstr.1: .asciz "examples with image_size = 4096, x_grid_dimension = 64 and y_grid_dimension = 64:" .size .Lstr.1, 82 .type .Lstr.2,@object # @str.2 .Lstr.2: .asciz " Full Picture: ./mandelbrot_cuda -2.5 1.5 -2.0 2.0 4096 64 64" .size .Lstr.2, 73 .type .Lstr.3,@object # @str.3 .Lstr.3: .asciz " Seahorse Valley: ./mandelbrot_cuda -0.8 -0.7 0.05 0.15 4096 64 64" .size .Lstr.3, 75 .type .Lstr.4,@object # @str.4 .Lstr.4: .asciz " Elephant Valley: ./mandelbrot_cuda 0.175 0.375 -0.1 0.1 4096 64 64" .size .Lstr.4, 76 .type .Lstr.5,@object # @str.5 .Lstr.5: .asciz " Triple Spiral Valley: ./mandelbrot_cuda -0.188 -0.012 0.554 0.754 4096 64 64" .size .Lstr.5, 81 .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 _Z33__device_stub__compute_mandelbrotPhiiddddiiidd .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z18compute_mandelbrotPhiiddddiiidd .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_00181870_00000000-6_mandelbrot_cuda.cudafe1.cpp" .text #APP #NO_APP .type _ZL26__cudaUnregisterBinaryUtilv, @function _ZL26__cudaUnregisterBinaryUtilv: .LFB2062: .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 .LFE2062: .size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv .section .rodata.str1.8,"aMS",@progbits,1 .align 8 .LC0: .string "usage: ./mandelbrot_cuda c_x_min c_x_max c_y_min c_y_max image_size x_grid_dimension y_grid_dimension\n" .align 8 .LC1: .string "examples with image_size = 4096, x_grid_dimension = 64 and y_grid_dimension = 64:\n" .align 8 .LC2: .string " Full Picture: ./mandelbrot_cuda -2.5 1.5 -2.0 2.0 4096 64 64\n" .align 8 .LC3: .string " Seahorse Valley: ./mandelbrot_cuda -0.8 -0.7 0.05 0.15 4096 64 64\n" .align 8 .LC4: .string " Elephant Valley: ./mandelbrot_cuda 0.175 0.375 -0.1 0.1 4096 64 64\n" .align 8 .LC5: .string " Triple Spiral Valley: ./mandelbrot_cuda -0.188 -0.012 0.554 0.754 4096 64 64\n" .text .globl _Z18print_instructionsv .type _Z18print_instructionsv, @function _Z18print_instructionsv: .LFB2057: .cfi_startproc endbr64 pushq %rax .cfi_def_cfa_offset 16 popq %rax .cfi_def_cfa_offset 8 subq $8, %rsp .cfi_def_cfa_offset 16 leaq .LC0(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT leaq .LC1(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT leaq .LC3(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT leaq .LC4(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT leaq .LC5(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $0, %edi call exit@PLT .cfi_endproc .LFE2057: .size _Z18print_instructionsv, .-_Z18print_instructionsv .section .rodata.str1.1,"aMS",@progbits,1 .LC6: .string "wb" .LC7: .string "output.ppm" .LC8: .string "# " .LC9: .string "P6\n %s\n %d\n %d\n %d\n" .text .globl _Z13write_to_filePhiii .type _Z13write_to_filePhiii, @function _Z13write_to_filePhiii: .LFB2058: .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 $16, %rsp .cfi_def_cfa_offset 64 movq %rdi, %r12 movl %esi, %ebx movl %edx, %r14d movl %ecx, %ebp movq %fs:40, %rax movq %rax, 8(%rsp) xorl %eax, %eax leaq .LC6(%rip), %rsi leaq .LC7(%rip), %rdi call fopen@PLT movq %rax, %r13 subq $8, %rsp .cfi_def_cfa_offset 72 pushq $255 .cfi_def_cfa_offset 80 movl %r14d, %r9d movl %ebx, %r8d leaq .LC8(%rip), %rcx leaq .LC9(%rip), %rdx movl $2, %esi movq %rax, %rdi movl $0, %eax call __fprintf_chk@PLT addq $16, %rsp .cfi_def_cfa_offset 64 testl %ebp, %ebp jle .L6 movq %r12, %rbx movslq %ebp, %rbp addq %rbp, %r12 leaq 5(%rsp), %r14 .L7: movzbl (%rbx), %eax movb %al, 5(%rsp) movzbl (%rbx,%rbp), %eax movb %al, 6(%rsp) movzbl (%rbx,%rbp,2), %eax movb %al, 7(%rsp) movq %r13, %rcx movl $3, %edx movl $1, %esi movq %r14, %rdi call fwrite@PLT addq $1, %rbx cmpq %r12, %rbx jne .L7 .L6: movq %r13, %rdi call fclose@PLT movq 8(%rsp), %rax subq %fs:40, %rax jne .L11 addq $16, %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 .L11: .cfi_restore_state call __stack_chk_fail@PLT .cfi_endproc .LFE2058: .size _Z13write_to_filePhiii, .-_Z13write_to_filePhiii .globl _Z49__device_stub__Z18compute_mandelbrotPhiiddddiiiddPhiiddddiiidd .type _Z49__device_stub__Z18compute_mandelbrotPhiiddddiiiddPhiiddddiiidd, @function _Z49__device_stub__Z18compute_mandelbrotPhiiddddiiiddPhiiddddiiidd: .LFB2084: .cfi_startproc endbr64 subq $264, %rsp .cfi_def_cfa_offset 272 movq %rdi, 72(%rsp) movl %esi, 68(%rsp) movl %edx, 64(%rsp) movsd %xmm0, 56(%rsp) movsd %xmm1, 48(%rsp) movsd %xmm2, 40(%rsp) movsd %xmm3, 32(%rsp) movl %ecx, 28(%rsp) movl %r8d, 24(%rsp) movl %r9d, 20(%rsp) movsd %xmm4, 8(%rsp) movsd %xmm5, (%rsp) movq %fs:40, %rax movq %rax, 248(%rsp) xorl %eax, %eax leaq 72(%rsp), %rax movq %rax, 144(%rsp) leaq 68(%rsp), %rax movq %rax, 152(%rsp) leaq 64(%rsp), %rax movq %rax, 160(%rsp) leaq 56(%rsp), %rax movq %rax, 168(%rsp) leaq 48(%rsp), %rax movq %rax, 176(%rsp) leaq 40(%rsp), %rax movq %rax, 184(%rsp) leaq 32(%rsp), %rax movq %rax, 192(%rsp) leaq 28(%rsp), %rax movq %rax, 200(%rsp) leaq 24(%rsp), %rax movq %rax, 208(%rsp) leaq 20(%rsp), %rax movq %rax, 216(%rsp) leaq 8(%rsp), %rax movq %rax, 224(%rsp) movq %rsp, %rax movq %rax, 232(%rsp) movl $1, 96(%rsp) movl $1, 100(%rsp) movl $1, 104(%rsp) movl $1, 108(%rsp) movl $1, 112(%rsp) movl $1, 116(%rsp) leaq 88(%rsp), %rcx leaq 80(%rsp), %rdx leaq 108(%rsp), %rsi leaq 96(%rsp), %rdi call __cudaPopCallConfiguration@PLT testl %eax, %eax je .L16 .L12: movq 248(%rsp), %rax subq %fs:40, %rax jne .L17 addq $264, %rsp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L16: .cfi_restore_state pushq 88(%rsp) .cfi_def_cfa_offset 280 pushq 88(%rsp) .cfi_def_cfa_offset 288 leaq 160(%rsp), %r9 movq 124(%rsp), %rcx movl 132(%rsp), %r8d movq 112(%rsp), %rsi movl 120(%rsp), %edx leaq _Z18compute_mandelbrotPhiiddddiiidd(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 272 jmp .L12 .L17: call __stack_chk_fail@PLT .cfi_endproc .LFE2084: .size _Z49__device_stub__Z18compute_mandelbrotPhiiddddiiiddPhiiddddiiidd, .-_Z49__device_stub__Z18compute_mandelbrotPhiiddddiiiddPhiiddddiiidd .globl _Z18compute_mandelbrotPhiiddddiiidd .type _Z18compute_mandelbrotPhiiddddiiidd, @function _Z18compute_mandelbrotPhiiddddiiidd: .LFB2085: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z49__device_stub__Z18compute_mandelbrotPhiiddddiiiddPhiiddddiiidd addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2085: .size _Z18compute_mandelbrotPhiiddddiiidd, .-_Z18compute_mandelbrotPhiiddddiiidd .section .rodata.str1.1 .LC10: .string "%lf" .LC11: .string "%d" .text .globl main .type main, @function main: .LFB2059: .cfi_startproc endbr64 pushq %r15 .cfi_def_cfa_offset 16 .cfi_offset 15, -16 pushq %r14 .cfi_def_cfa_offset 24 .cfi_offset 14, -24 pushq %r13 .cfi_def_cfa_offset 32 .cfi_offset 13, -32 pushq %r12 .cfi_def_cfa_offset 40 .cfi_offset 12, -40 pushq %rbp .cfi_def_cfa_offset 48 .cfi_offset 6, -48 pushq %rbx .cfi_def_cfa_offset 56 .cfi_offset 3, -56 subq $120, %rsp .cfi_def_cfa_offset 176 movq %fs:40, %rax movq %rax, 104(%rsp) xorl %eax, %eax cmpl $7, %edi jle .L26 movq %rsi, %rbx leaq 40(%rsp), %rdx movq 8(%rsi), %rdi leaq .LC10(%rip), %rbp movq %rbp, %rsi movl $0, %eax call __isoc23_sscanf@PLT leaq 48(%rsp), %rdx movq 16(%rbx), %rdi movq %rbp, %rsi movl $0, %eax call __isoc23_sscanf@PLT leaq 56(%rsp), %rdx movq 24(%rbx), %rdi movq %rbp, %rsi movl $0, %eax call __isoc23_sscanf@PLT leaq 64(%rsp), %rdx movq 32(%rbx), %rdi movq %rbp, %rsi movl $0, %eax call __isoc23_sscanf@PLT leaq 28(%rsp), %rdx movq 40(%rbx), %rdi leaq .LC11(%rip), %rbp movq %rbp, %rsi movl $0, %eax call __isoc23_sscanf@PLT leaq 32(%rsp), %rdx movq 48(%rbx), %rdi movq %rbp, %rsi movl $0, %eax call __isoc23_sscanf@PLT leaq 36(%rsp), %rdx movq 56(%rbx), %rdi movq %rbp, %rsi movl $0, %eax call __isoc23_sscanf@PLT movl 28(%rsp), %r12d movl %r12d, %r13d imull %r12d, %r13d movq 48(%rsp), %r14 movsd 40(%rsp), %xmm6 movsd %xmm6, (%rsp) movq 64(%rsp), %r15 movsd 56(%rsp), %xmm7 movsd %xmm7, 8(%rsp) movslq %r13d, %rax leaq (%rax,%rax,2), %rbp movq %rbp, %rdi call malloc@PLT movq %rax, %rbx leaq 72(%rsp), %rdi movq %rbp, %rsi call cudaMalloc@PLT movl 32(%rsp), %eax movl %eax, 80(%rsp) movl 36(%rsp), %eax movl %eax, 84(%rsp) movl $256, 92(%rsp) movl $1, 96(%rsp) movl $0, %r9d movl $0, %r8d movq 92(%rsp), %rdx movl $1, %ecx movq 80(%rsp), %rdi movl $1, %esi call __cudaPushCallConfiguration@PLT testl %eax, %eax je .L27 .L23: call cudaDeviceSynchronize@PLT movl $2, %ecx movq %rbp, %rdx movq 72(%rsp), %rsi movq %rbx, %rdi call cudaMemcpy@PLT movq 104(%rsp), %rax subq %fs:40, %rax jne .L28 movl $0, %eax addq $120, %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 .L26: .cfi_restore_state movq 104(%rsp), %rax subq %fs:40, %rax jne .L29 call _Z18print_instructionsv .L29: call __stack_chk_fail@PLT .L27: pxor %xmm0, %xmm0 cvtsi2sdl %r12d, %xmm0 movq %r15, %xmm5 subsd 8(%rsp), %xmm5 movq %r14, %xmm4 subsd (%rsp), %xmm4 divsd %xmm0, %xmm5 divsd %xmm0, %xmm4 movl %r12d, %r9d movl %r12d, %r8d movl %r13d, %ecx movsd 64(%rsp), %xmm3 movsd 56(%rsp), %xmm2 movsd 48(%rsp), %xmm1 movsd 40(%rsp), %xmm0 movl $200, %edx movl $16, %esi movq 72(%rsp), %rdi call _Z49__device_stub__Z18compute_mandelbrotPhiiddddiiiddPhiiddddiiidd jmp .L23 .L28: call __stack_chk_fail@PLT .cfi_endproc .LFE2059: .size main, .-main .section .rodata.str1.8 .align 8 .LC12: .string "_Z18compute_mandelbrotPhiiddddiiidd" .text .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB2087: .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 .LC12(%rip), %rdx movq %rdx, %rcx leaq _Z18compute_mandelbrotPhiiddddiiidd(%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 .LFE2087: .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 "mandelbrot_cuda.hip" .globl _Z18print_instructionsv # -- Begin function _Z18print_instructionsv .p2align 4, 0x90 .type _Z18print_instructionsv,@function _Z18print_instructionsv: # @_Z18print_instructionsv .cfi_startproc # %bb.0: pushq %rax .cfi_def_cfa_offset 16 movl $.Lstr, %edi callq puts@PLT movl $.Lstr.1, %edi callq puts@PLT movl $.Lstr.2, %edi callq puts@PLT movl $.Lstr.3, %edi callq puts@PLT movl $.Lstr.4, %edi callq puts@PLT movl $.Lstr.5, %edi callq puts@PLT xorl %edi, %edi callq exit .Lfunc_end0: .size _Z18print_instructionsv, .Lfunc_end0-_Z18print_instructionsv .cfi_endproc # -- End function .globl _Z13write_to_filePhiii # -- Begin function _Z13write_to_filePhiii .p2align 4, 0x90 .type _Z13write_to_filePhiii,@function _Z13write_to_filePhiii: # @_Z13write_to_filePhiii .cfi_startproc # %bb.0: pushq %rbp .cfi_def_cfa_offset 16 pushq %r15 .cfi_def_cfa_offset 24 pushq %r14 .cfi_def_cfa_offset 32 pushq %r13 .cfi_def_cfa_offset 40 pushq %r12 .cfi_def_cfa_offset 48 pushq %rbx .cfi_def_cfa_offset 56 pushq %rax .cfi_def_cfa_offset 64 .cfi_offset %rbx, -56 .cfi_offset %r12, -48 .cfi_offset %r13, -40 .cfi_offset %r14, -32 .cfi_offset %r15, -24 .cfi_offset %rbp, -16 movl %ecx, %ebp movl %edx, %r15d movl %esi, %r12d movq %rdi, %rbx movl $.L.str.6, %edi movl $.L.str.8, %esi callq fopen movq %rax, %r14 movl $.L.str.9, %esi movl $.L.str.7, %edx movq %rax, %rdi movl %r12d, %ecx movl %r15d, %r8d movl $255, %r9d xorl %eax, %eax callq fprintf testl %ebp, %ebp jle .LBB1_3 # %bb.1: # %.lr.ph movl %ebp, %r12d leaq (%rbx,%r12), %r13 leaq (%rbx,%r12,2), %rbp xorl %r15d, %r15d .p2align 4, 0x90 .LBB1_2: # =>This Inner Loop Header: Depth=1 movzbl (%rbx,%r15), %eax movb %al, 5(%rsp) movzbl (%r13,%r15), %eax movb %al, 6(%rsp) movzbl (%rbp,%r15), %eax movb %al, 7(%rsp) movl $1, %esi movl $3, %edx leaq 5(%rsp), %rdi movq %r14, %rcx callq fwrite incq %r15 cmpq %r15, %r12 jne .LBB1_2 .LBB1_3: # %._crit_edge movq %r14, %rdi addq $8, %rsp .cfi_def_cfa_offset 56 popq %rbx .cfi_def_cfa_offset 48 popq %r12 .cfi_def_cfa_offset 40 popq %r13 .cfi_def_cfa_offset 32 popq %r14 .cfi_def_cfa_offset 24 popq %r15 .cfi_def_cfa_offset 16 popq %rbp .cfi_def_cfa_offset 8 jmp fclose # TAILCALL .Lfunc_end1: .size _Z13write_to_filePhiii, .Lfunc_end1-_Z13write_to_filePhiii .cfi_endproc # -- End function .globl _Z33__device_stub__compute_mandelbrotPhiiddddiiidd # -- Begin function _Z33__device_stub__compute_mandelbrotPhiiddddiiidd .p2align 4, 0x90 .type _Z33__device_stub__compute_mandelbrotPhiiddddiiidd,@function _Z33__device_stub__compute_mandelbrotPhiiddddiiidd: # @_Z33__device_stub__compute_mandelbrotPhiiddddiiidd .cfi_startproc # %bb.0: subq $232, %rsp .cfi_def_cfa_offset 240 movq %rdi, 120(%rsp) movl %esi, 20(%rsp) movl %edx, 16(%rsp) movsd %xmm0, 112(%rsp) movsd %xmm1, 104(%rsp) movsd %xmm2, 96(%rsp) movsd %xmm3, 88(%rsp) movl %ecx, 12(%rsp) movl %r8d, 8(%rsp) movl %r9d, 4(%rsp) movsd %xmm4, 80(%rsp) movsd %xmm5, 72(%rsp) leaq 120(%rsp), %rax movq %rax, 128(%rsp) leaq 20(%rsp), %rax movq %rax, 136(%rsp) leaq 16(%rsp), %rax movq %rax, 144(%rsp) leaq 112(%rsp), %rax movq %rax, 152(%rsp) leaq 104(%rsp), %rax movq %rax, 160(%rsp) leaq 96(%rsp), %rax movq %rax, 168(%rsp) leaq 88(%rsp), %rax movq %rax, 176(%rsp) leaq 12(%rsp), %rax movq %rax, 184(%rsp) leaq 8(%rsp), %rax movq %rax, 192(%rsp) leaq 4(%rsp), %rax movq %rax, 200(%rsp) leaq 80(%rsp), %rax movq %rax, 208(%rsp) leaq 72(%rsp), %rax movq %rax, 216(%rsp) leaq 56(%rsp), %rdi leaq 40(%rsp), %rsi leaq 32(%rsp), %rdx leaq 24(%rsp), %rcx callq __hipPopCallConfiguration movq 56(%rsp), %rsi movl 64(%rsp), %edx movq 40(%rsp), %rcx movl 48(%rsp), %r8d leaq 128(%rsp), %r9 movl $_Z18compute_mandelbrotPhiiddddiiidd, %edi pushq 24(%rsp) .cfi_adjust_cfa_offset 8 pushq 40(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $248, %rsp .cfi_adjust_cfa_offset -248 retq .Lfunc_end2: .size _Z33__device_stub__compute_mandelbrotPhiiddddiiidd, .Lfunc_end2-_Z33__device_stub__compute_mandelbrotPhiiddddiiidd .cfi_endproc # -- End function .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: pushq %rbp .cfi_def_cfa_offset 16 pushq %r15 .cfi_def_cfa_offset 24 pushq %r14 .cfi_def_cfa_offset 32 pushq %rbx .cfi_def_cfa_offset 40 subq $312, %rsp # imm = 0x138 .cfi_def_cfa_offset 352 .cfi_offset %rbx, -40 .cfi_offset %r14, -32 .cfi_offset %r15, -24 .cfi_offset %rbp, -16 cmpl $7, %edi jle .LBB3_4 # %bb.1: movq %rsi, %rbx movq 8(%rsi), %rdi leaq 64(%rsp), %rdx movl $.L.str.10, %esi xorl %eax, %eax callq __isoc23_sscanf movq 16(%rbx), %rdi leaq 56(%rsp), %rdx movl $.L.str.10, %esi xorl %eax, %eax callq __isoc23_sscanf movq 24(%rbx), %rdi leaq 48(%rsp), %rdx movl $.L.str.10, %esi xorl %eax, %eax callq __isoc23_sscanf movq 32(%rbx), %rdi leaq 40(%rsp), %rdx movl $.L.str.10, %esi xorl %eax, %eax callq __isoc23_sscanf movq 40(%rbx), %rdi leaq 8(%rsp), %rdx movl $.L.str.11, %esi xorl %eax, %eax callq __isoc23_sscanf movq 48(%rbx), %rdi leaq 4(%rsp), %rdx movl $.L.str.11, %esi xorl %eax, %eax callq __isoc23_sscanf movq 56(%rbx), %rdi movq %rsp, %rdx movl $.L.str.11, %esi xorl %eax, %eax callq __isoc23_sscanf movl 8(%rsp), %ebp movl %ebp, %r15d imull %r15d, %r15d movsd 56(%rsp), %xmm0 # xmm0 = mem[0],zero movsd %xmm0, 96(%rsp) # 8-byte Spill movsd 64(%rsp), %xmm0 # xmm0 = mem[0],zero movsd %xmm0, 80(%rsp) # 8-byte Spill movsd 40(%rsp), %xmm0 # xmm0 = mem[0],zero movsd %xmm0, 88(%rsp) # 8-byte Spill movsd 48(%rsp), %xmm0 # xmm0 = mem[0],zero movsd %xmm0, 72(%rsp) # 8-byte Spill leaq (%r15,%r15,2), %rbx movq %rbx, %rdi callq malloc movq %rax, %r14 leaq 32(%rsp), %rdi movq %rbx, %rsi callq hipMalloc movl 4(%rsp), %eax movl (%rsp), %edi shlq $32, %rdi orq %rax, %rdi movabsq $4294967552, %rdx # imm = 0x100000100 movl $1, %esi movl $1, %ecx xorl %r8d, %r8d xorl %r9d, %r9d callq __hipPushCallConfiguration testl %eax, %eax jne .LBB3_3 # %bb.2: movsd 88(%rsp), %xmm5 # 8-byte Reload # xmm5 = mem[0],zero subsd 72(%rsp), %xmm5 # 8-byte Folded Reload xorps %xmm0, %xmm0 cvtsi2sd %ebp, %xmm0 divsd %xmm0, %xmm5 movsd 96(%rsp), %xmm4 # 8-byte Reload # xmm4 = mem[0],zero subsd 80(%rsp), %xmm4 # 8-byte Folded Reload divsd %xmm0, %xmm4 movq 32(%rsp), %rax movsd 64(%rsp), %xmm0 # xmm0 = mem[0],zero movsd 56(%rsp), %xmm1 # xmm1 = mem[0],zero movsd 48(%rsp), %xmm2 # xmm2 = mem[0],zero movsd 40(%rsp), %xmm3 # xmm3 = mem[0],zero movq %rax, 200(%rsp) movl $16, 28(%rsp) movl $200, 24(%rsp) movsd %xmm0, 192(%rsp) movsd %xmm1, 184(%rsp) movsd %xmm2, 176(%rsp) movsd %xmm3, 168(%rsp) movl %r15d, 20(%rsp) movl %ebp, 16(%rsp) movl %ebp, 12(%rsp) movsd %xmm4, 160(%rsp) movsd %xmm5, 152(%rsp) leaq 200(%rsp), %rax movq %rax, 208(%rsp) leaq 28(%rsp), %rax movq %rax, 216(%rsp) leaq 24(%rsp), %rax movq %rax, 224(%rsp) leaq 192(%rsp), %rax movq %rax, 232(%rsp) leaq 184(%rsp), %rax movq %rax, 240(%rsp) leaq 176(%rsp), %rax movq %rax, 248(%rsp) leaq 168(%rsp), %rax movq %rax, 256(%rsp) leaq 20(%rsp), %rax movq %rax, 264(%rsp) leaq 16(%rsp), %rax movq %rax, 272(%rsp) leaq 12(%rsp), %rax movq %rax, 280(%rsp) leaq 160(%rsp), %rax movq %rax, 288(%rsp) leaq 152(%rsp), %rax movq %rax, 296(%rsp) leaq 136(%rsp), %rdi leaq 120(%rsp), %rsi leaq 112(%rsp), %rdx leaq 104(%rsp), %rcx callq __hipPopCallConfiguration movq 136(%rsp), %rsi movl 144(%rsp), %edx movq 120(%rsp), %rcx movl 128(%rsp), %r8d leaq 208(%rsp), %r9 movl $_Z18compute_mandelbrotPhiiddddiiidd, %edi pushq 104(%rsp) .cfi_adjust_cfa_offset 8 pushq 120(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $16, %rsp .cfi_adjust_cfa_offset -16 .LBB3_3: callq hipDeviceSynchronize movq 32(%rsp), %rsi movq %r14, %rdi movq %rbx, %rdx movl $2, %ecx callq hipMemcpy xorl %eax, %eax addq $312, %rsp # imm = 0x138 .cfi_def_cfa_offset 40 popq %rbx .cfi_def_cfa_offset 32 popq %r14 .cfi_def_cfa_offset 24 popq %r15 .cfi_def_cfa_offset 16 popq %rbp .cfi_def_cfa_offset 8 retq .LBB3_4: .cfi_def_cfa_offset 352 movl $.Lstr, %edi callq puts@PLT movl $.Lstr.1, %edi callq puts@PLT movl $.Lstr.2, %edi callq puts@PLT movl $.Lstr.3, %edi callq puts@PLT movl $.Lstr.4, %edi callq puts@PLT movl $.Lstr.5, %edi callq puts@PLT xorl %edi, %edi callq exit .Lfunc_end3: .size main, .Lfunc_end3-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 .LBB4_2 # %bb.1: movl $__hip_fatbin_wrapper, %edi callq __hipRegisterFatBinary movq %rax, __hip_gpubin_handle(%rip) .LBB4_2: movq __hip_gpubin_handle(%rip), %rdi xorps %xmm0, %xmm0 movups %xmm0, 16(%rsp) movups %xmm0, (%rsp) movl $_Z18compute_mandelbrotPhiiddddiiidd, %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_end4: .size __hip_module_ctor, .Lfunc_end4-__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 .LBB5_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 .LBB5_2: retq .Lfunc_end5: .size __hip_module_dtor, .Lfunc_end5-__hip_module_dtor .cfi_endproc # -- End function .type .L.str.6,@object # @.str.6 .section .rodata.str1.1,"aMS",@progbits,1 .L.str.6: .asciz "output.ppm" .size .L.str.6, 11 .type .L.str.7,@object # @.str.7 .L.str.7: .asciz "# " .size .L.str.7, 3 .type .L.str.8,@object # @.str.8 .L.str.8: .asciz "wb" .size .L.str.8, 3 .type .L.str.9,@object # @.str.9 .L.str.9: .asciz "P6\n %s\n %d\n %d\n %d\n" .size .L.str.9, 20 .type _Z18compute_mandelbrotPhiiddddiiidd,@object # @_Z18compute_mandelbrotPhiiddddiiidd .section .rodata,"a",@progbits .globl _Z18compute_mandelbrotPhiiddddiiidd .p2align 3, 0x0 _Z18compute_mandelbrotPhiiddddiiidd: .quad _Z33__device_stub__compute_mandelbrotPhiiddddiiidd .size _Z18compute_mandelbrotPhiiddddiiidd, 8 .type .L.str.10,@object # @.str.10 .section .rodata.str1.1,"aMS",@progbits,1 .L.str.10: .asciz "%lf" .size .L.str.10, 4 .type .L.str.11,@object # @.str.11 .L.str.11: .asciz "%d" .size .L.str.11, 3 .type .L__unnamed_1,@object # @0 .L__unnamed_1: .asciz "_Z18compute_mandelbrotPhiiddddiiidd" .size .L__unnamed_1, 36 .type __hip_fatbin_wrapper,@object # @__hip_fatbin_wrapper .section .hipFatBinSegment,"a",@progbits .p2align 3, 0x0 __hip_fatbin_wrapper: .long 1212764230 # 0x48495046 .long 1 # 0x1 .quad __hip_fatbin .quad 0 .size __hip_fatbin_wrapper, 24 .type __hip_gpubin_handle,@object # @__hip_gpubin_handle .local __hip_gpubin_handle .comm __hip_gpubin_handle,8,8 .section .init_array,"aw",@init_array .p2align 3, 0x0 .quad __hip_module_ctor .type __hip_cuid_,@object # @__hip_cuid_ .bss .globl __hip_cuid_ __hip_cuid_: .byte 0 # 0x0 .size __hip_cuid_, 1 .type .Lstr,@object # @str .section .rodata.str1.1,"aMS",@progbits,1 .Lstr: .asciz "usage: ./mandelbrot_cuda c_x_min c_x_max c_y_min c_y_max image_size x_grid_dimension y_grid_dimension" .size .Lstr, 102 .type .Lstr.1,@object # @str.1 .Lstr.1: .asciz "examples with image_size = 4096, x_grid_dimension = 64 and y_grid_dimension = 64:" .size .Lstr.1, 82 .type .Lstr.2,@object # @str.2 .Lstr.2: .asciz " Full Picture: ./mandelbrot_cuda -2.5 1.5 -2.0 2.0 4096 64 64" .size .Lstr.2, 73 .type .Lstr.3,@object # @str.3 .Lstr.3: .asciz " Seahorse Valley: ./mandelbrot_cuda -0.8 -0.7 0.05 0.15 4096 64 64" .size .Lstr.3, 75 .type .Lstr.4,@object # @str.4 .Lstr.4: .asciz " Elephant Valley: ./mandelbrot_cuda 0.175 0.375 -0.1 0.1 4096 64 64" .size .Lstr.4, 76 .type .Lstr.5,@object # @str.5 .Lstr.5: .asciz " Triple Spiral Valley: ./mandelbrot_cuda -0.188 -0.012 0.554 0.754 4096 64 64" .size .Lstr.5, 81 .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 _Z33__device_stub__compute_mandelbrotPhiiddddiiidd .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z18compute_mandelbrotPhiiddddiiidd .addrsig_sym __hip_fatbin .addrsig_sym __hip_fatbin_wrapper .addrsig_sym __hip_cuid_
You are a helpful coding assistant specialized in converting CUDA source code to CUDA device assembly.
#include <iostream> using namespace std; class Polygon { public: int width, height; public: void set_values(int a, int b) { width = a; height = b; } virtual int area() { return 0; } }; class Rectangle: public Polygon { public: int area () { return width * height; } }; class Triangle: public Polygon { public: int area () { return (width * height / 2); } }; int get_area(Polygon& poly) { printf("t: %s\n", typeid(poly).name()); printf("w: %d\n", poly.width); return poly.area(); } int main () { Polygon* rect = new Rectangle(); Polygon* trgl = new Triangle(); Polygon* poly = new Polygon(); rect->set_values(4, 5); trgl->set_values(5, 5); poly->set_values(6, 5); printf("size for rect: %d\n", get_area(*rect)); printf("size for trgl: %d\n", get_area(*trgl)); printf("size for poly: %d\n", get_area(*poly)); return 0; }
code for sm_80
You are a helpful coding assistant specialized in converting CUDA source code to CUDA host assembly.
#include <iostream> using namespace std; class Polygon { public: int width, height; public: void set_values(int a, int b) { width = a; height = b; } virtual int area() { return 0; } }; class Rectangle: public Polygon { public: int area () { return width * height; } }; class Triangle: public Polygon { public: int area () { return (width * height / 2); } }; int get_area(Polygon& poly) { printf("t: %s\n", typeid(poly).name()); printf("w: %d\n", poly.width); return poly.area(); } int main () { Polygon* rect = new Rectangle(); Polygon* trgl = new Triangle(); Polygon* poly = new Polygon(); rect->set_values(4, 5); trgl->set_values(5, 5); poly->set_values(6, 5); printf("size for rect: %d\n", get_area(*rect)); printf("size for trgl: %d\n", get_area(*trgl)); printf("size for poly: %d\n", get_area(*poly)); return 0; }
.file "tmpxft_001aaf43_00000000-6_test-ext.cudafe1.cpp" .text #APP .globl _ZSt21ios_base_library_initv #NO_APP .section .text._ZN7Polygon4areaEv,"axG",@progbits,_ZN7Polygon4areaEv,comdat .align 2 .weak _ZN7Polygon4areaEv .type _ZN7Polygon4areaEv, @function _ZN7Polygon4areaEv: .LFB3670: .cfi_startproc endbr64 movl $0, %eax ret .cfi_endproc .LFE3670: .size _ZN7Polygon4areaEv, .-_ZN7Polygon4areaEv .section .text._ZN9Rectangle4areaEv,"axG",@progbits,_ZN9Rectangle4areaEv,comdat .align 2 .weak _ZN9Rectangle4areaEv .type _ZN9Rectangle4areaEv, @function _ZN9Rectangle4areaEv: .LFB3671: .cfi_startproc endbr64 movl 8(%rdi), %eax imull 12(%rdi), %eax ret .cfi_endproc .LFE3671: .size _ZN9Rectangle4areaEv, .-_ZN9Rectangle4areaEv .section .text._ZN8Triangle4areaEv,"axG",@progbits,_ZN8Triangle4areaEv,comdat .align 2 .weak _ZN8Triangle4areaEv .type _ZN8Triangle4areaEv, @function _ZN8Triangle4areaEv: .LFB3672: .cfi_startproc endbr64 movl 8(%rdi), %edx imull 12(%rdi), %edx movl %edx, %eax shrl $31, %eax addl %edx, %eax sarl %eax ret .cfi_endproc .LFE3672: .size _ZN8Triangle4areaEv, .-_ZN8Triangle4areaEv .text .type _ZL26__cudaUnregisterBinaryUtilv, @function _ZL26__cudaUnregisterBinaryUtilv: .LFB3686: .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 .LFE3686: .size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "t: %s\n" .LC1: .string "w: %d\n" .text .globl _Z8get_areaR7Polygon .type _Z8get_areaR7Polygon, @function _Z8get_areaR7Polygon: .LFB3673: .cfi_startproc endbr64 pushq %rbx .cfi_def_cfa_offset 16 .cfi_offset 3, -16 movq %rdi, %rbx movq (%rdi), %rax movq -8(%rax), %rax movq 8(%rax), %rdx cmpb $42, (%rdx) sete %al movzbl %al, %eax addq %rax, %rdx leaq .LC0(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl 8(%rbx), %edx leaq .LC1(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movq (%rbx), %rax movq %rbx, %rdi call *(%rax) popq %rbx .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE3673: .size _Z8get_areaR7Polygon, .-_Z8get_areaR7Polygon .section .rodata.str1.1 .LC2: .string "size for rect: %d\n" .LC3: .string "size for trgl: %d\n" .LC4: .string "size for poly: %d\n" .text .globl main .type main, @function main: .LFB3674: .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 movl $16, %edi call _Znwm@PLT movq %rax, %rbp movl $0, 8(%rax) movl $0, 12(%rax) leaq 16+_ZTV9Rectangle(%rip), %rax movq %rax, 0(%rbp) movl $16, %edi call _Znwm@PLT movq %rax, %rbx movl $0, 8(%rax) movl $0, 12(%rax) leaq 16+_ZTV8Triangle(%rip), %rax movq %rax, (%rbx) movl $16, %edi call _Znwm@PLT movq %rax, %r12 leaq 16+_ZTV7Polygon(%rip), %rax movq %rax, (%r12) movl $4, 8(%rbp) movl $5, 12(%rbp) movl $5, 8(%rbx) movl $5, 12(%rbx) movl $6, 8(%r12) movl $5, 12(%r12) movq %rbp, %rdi call _Z8get_areaR7Polygon movl %eax, %edx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movq %rbx, %rdi call _Z8get_areaR7Polygon movl %eax, %edx leaq .LC3(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movq %r12, %rdi call _Z8get_areaR7Polygon movl %eax, %edx leaq .LC4(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $0, %eax popq %rbx .cfi_def_cfa_offset 24 popq %rbp .cfi_def_cfa_offset 16 popq %r12 .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE3674: .size main, .-main .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB3709: .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 .LFE3709: .size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv .section .init_array,"aw" .align 8 .quad _ZL24__sti____cudaRegisterAllv .weak _ZTS7Polygon .section .rodata._ZTS7Polygon,"aG",@progbits,_ZTS7Polygon,comdat .align 8 .type _ZTS7Polygon, @object .size _ZTS7Polygon, 9 _ZTS7Polygon: .string "7Polygon" .weak _ZTI7Polygon .section .data.rel.ro._ZTI7Polygon,"awG",@progbits,_ZTI7Polygon,comdat .align 8 .type _ZTI7Polygon, @object .size _ZTI7Polygon, 16 _ZTI7Polygon: .quad _ZTVN10__cxxabiv117__class_type_infoE+16 .quad _ZTS7Polygon .weak _ZTS9Rectangle .section .rodata._ZTS9Rectangle,"aG",@progbits,_ZTS9Rectangle,comdat .align 8 .type _ZTS9Rectangle, @object .size _ZTS9Rectangle, 11 _ZTS9Rectangle: .string "9Rectangle" .weak _ZTI9Rectangle .section .data.rel.ro._ZTI9Rectangle,"awG",@progbits,_ZTI9Rectangle,comdat .align 8 .type _ZTI9Rectangle, @object .size _ZTI9Rectangle, 24 _ZTI9Rectangle: .quad _ZTVN10__cxxabiv120__si_class_type_infoE+16 .quad _ZTS9Rectangle .quad _ZTI7Polygon .weak _ZTS8Triangle .section .rodata._ZTS8Triangle,"aG",@progbits,_ZTS8Triangle,comdat .align 8 .type _ZTS8Triangle, @object .size _ZTS8Triangle, 10 _ZTS8Triangle: .string "8Triangle" .weak _ZTI8Triangle .section .data.rel.ro._ZTI8Triangle,"awG",@progbits,_ZTI8Triangle,comdat .align 8 .type _ZTI8Triangle, @object .size _ZTI8Triangle, 24 _ZTI8Triangle: .quad _ZTVN10__cxxabiv120__si_class_type_infoE+16 .quad _ZTS8Triangle .quad _ZTI7Polygon .weak _ZTV7Polygon .section .data.rel.ro.local._ZTV7Polygon,"awG",@progbits,_ZTV7Polygon,comdat .align 8 .type _ZTV7Polygon, @object .size _ZTV7Polygon, 24 _ZTV7Polygon: .quad 0 .quad _ZTI7Polygon .quad _ZN7Polygon4areaEv .weak _ZTV9Rectangle .section .data.rel.ro.local._ZTV9Rectangle,"awG",@progbits,_ZTV9Rectangle,comdat .align 8 .type _ZTV9Rectangle, @object .size _ZTV9Rectangle, 24 _ZTV9Rectangle: .quad 0 .quad _ZTI9Rectangle .quad _ZN9Rectangle4areaEv .weak _ZTV8Triangle .section .data.rel.ro.local._ZTV8Triangle,"awG",@progbits,_ZTV8Triangle,comdat .align 8 .type _ZTV8Triangle, @object .size _ZTV8Triangle, 24 _ZTV8Triangle: .quad 0 .quad _ZTI8Triangle .quad _ZN8Triangle4areaEv .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> using namespace std; class Polygon { public: int width, height; public: void set_values(int a, int b) { width = a; height = b; } virtual int area() { return 0; } }; class Rectangle: public Polygon { public: int area () { return width * height; } }; class Triangle: public Polygon { public: int area () { return (width * height / 2); } }; int get_area(Polygon& poly) { printf("t: %s\n", typeid(poly).name()); printf("w: %d\n", poly.width); return poly.area(); } int main () { Polygon* rect = new Rectangle(); Polygon* trgl = new Triangle(); Polygon* poly = new Polygon(); rect->set_values(4, 5); trgl->set_values(5, 5); poly->set_values(6, 5); printf("size for rect: %d\n", get_area(*rect)); printf("size for trgl: %d\n", get_area(*trgl)); printf("size for poly: %d\n", get_area(*poly)); return 0; }
#include <hip/hip_runtime.h> #include <iostream> using namespace std; class Polygon { public: int width, height; public: void set_values(int a, int b) { width = a; height = b; } virtual int area() { return 0; } }; class Rectangle: public Polygon { public: int area () { return width * height; } }; class Triangle: public Polygon { public: int area () { return (width * height / 2); } }; int get_area(Polygon& poly) { printf("t: %s\n", typeid(poly).name()); printf("w: %d\n", poly.width); return poly.area(); } int main () { Polygon* rect = new Rectangle(); Polygon* trgl = new Triangle(); Polygon* poly = new Polygon(); rect->set_values(4, 5); trgl->set_values(5, 5); poly->set_values(6, 5); printf("size for rect: %d\n", get_area(*rect)); printf("size for trgl: %d\n", get_area(*trgl)); printf("size for poly: %d\n", get_area(*poly)); return 0; }
You are a helpful coding assistant specialized in converting HIP source code to AMD device assembly.
#include <hip/hip_runtime.h> #include <iostream> using namespace std; class Polygon { public: int width, height; public: void set_values(int a, int b) { width = a; height = b; } virtual int area() { return 0; } }; class Rectangle: public Polygon { public: int area () { return width * height; } }; class Triangle: public Polygon { public: int area () { return (width * height / 2); } }; int get_area(Polygon& poly) { printf("t: %s\n", typeid(poly).name()); printf("w: %d\n", poly.width); return poly.area(); } int main () { Polygon* rect = new Rectangle(); Polygon* trgl = new Triangle(); Polygon* poly = new Polygon(); rect->set_values(4, 5); trgl->set_values(5, 5); poly->set_values(6, 5); printf("size for rect: %d\n", get_area(*rect)); printf("size for trgl: %d\n", get_area(*trgl)); printf("size for poly: %d\n", get_area(*poly)); return 0; }
.text .p2alignl 7, 3214868480 .fill 96, 4, 3214868480 .type __hip_cuid_,@object .section .bss,"aw",@nobits .globl __hip_cuid_ __hip_cuid_: .byte 0 .size __hip_cuid_, 1 .ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)" .section ".note.GNU-stack","",@progbits .addrsig .addrsig_sym __hip_cuid_ .amdgcn_target "amdgcn-amd-amdhsa--gfx1100" .amdgpu_metadata --- amdhsa.kernels: [] amdhsa.target: amdgcn-amd-amdhsa--gfx1100 amdhsa.version: - 1 - 2 ... .end_amdgpu_metadata
You are a helpful coding assistant specialized in converting HIP source code to AMD host assembly.
#include <hip/hip_runtime.h> #include <iostream> using namespace std; class Polygon { public: int width, height; public: void set_values(int a, int b) { width = a; height = b; } virtual int area() { return 0; } }; class Rectangle: public Polygon { public: int area () { return width * height; } }; class Triangle: public Polygon { public: int area () { return (width * height / 2); } }; int get_area(Polygon& poly) { printf("t: %s\n", typeid(poly).name()); printf("w: %d\n", poly.width); return poly.area(); } int main () { Polygon* rect = new Rectangle(); Polygon* trgl = new Triangle(); Polygon* poly = new Polygon(); rect->set_values(4, 5); trgl->set_values(5, 5); poly->set_values(6, 5); printf("size for rect: %d\n", get_area(*rect)); printf("size for trgl: %d\n", get_area(*trgl)); printf("size for poly: %d\n", get_area(*poly)); return 0; }
.text .file "test-ext.hip" # Start of file scope inline assembly .globl _ZSt21ios_base_library_initv # End of file scope inline assembly .globl _Z8get_areaR7Polygon # -- Begin function _Z8get_areaR7Polygon .p2align 4, 0x90 .type _Z8get_areaR7Polygon,@function _Z8get_areaR7Polygon: # @_Z8get_areaR7Polygon .cfi_startproc # %bb.0: pushq %rbx .cfi_def_cfa_offset 16 .cfi_offset %rbx, -16 movq %rdi, %rbx movq (%rdi), %rax movq -8(%rax), %rax movq 8(%rax), %rax xorl %esi, %esi cmpb $42, (%rax) sete %sil addq %rax, %rsi movl $.L.str, %edi xorl %eax, %eax callq printf movl 8(%rbx), %esi movl $.L.str.1, %edi xorl %eax, %eax callq printf movq (%rbx), %rax movq %rbx, %rdi popq %rbx .cfi_def_cfa_offset 8 jmpq *(%rax) # TAILCALL .Lfunc_end0: .size _Z8get_areaR7Polygon, .Lfunc_end0-_Z8get_areaR7Polygon .cfi_endproc # -- End function .section .rodata.cst16,"aM",@progbits,16 .p2align 4, 0x0 # -- Begin function main .LCPI1_0: .zero 16 .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 .cfi_offset %rbx, -32 .cfi_offset %r14, -24 .cfi_offset %r15, -16 movl $16, %edi callq _Znwm movq %rax, %r15 xorps %xmm0, %xmm0 movaps %xmm0, (%rax) movq $_ZTV9Rectangle+16, (%rax) movl $16, %edi callq _Znwm movq %rax, %r14 xorps %xmm0, %xmm0 movaps %xmm0, (%rax) movq $_ZTV8Triangle+16, (%rax) movl $16, %edi callq _Znwm movq %rax, %rbx xorps %xmm0, %xmm0 movaps %xmm0, (%rax) movq $_ZTV7Polygon+16, (%rax) movabsq $21474836484, %rax # imm = 0x500000004 movq %rax, 8(%r15) movabsq $21474836485, %rax # imm = 0x500000005 movq %rax, 8(%r14) movabsq $21474836486, %rax # imm = 0x500000006 movq %rax, 8(%rbx) movl $.L.str, %edi movl $_ZTS9Rectangle, %esi xorl %eax, %eax callq printf movl 8(%r15), %esi movl $.L.str.1, %edi xorl %eax, %eax callq printf movq (%r15), %rax movq %r15, %rdi callq *(%rax) movl $.L.str.2, %edi movl %eax, %esi xorl %eax, %eax callq printf movq (%r14), %rax movq -8(%rax), %rax movq 8(%rax), %rax xorl %esi, %esi cmpb $42, (%rax) sete %sil addq %rax, %rsi movl $.L.str, %edi xorl %eax, %eax callq printf movl 8(%r14), %esi movl $.L.str.1, %edi xorl %eax, %eax callq printf movq (%r14), %rax movq %r14, %rdi callq *(%rax) movl $.L.str.3, %edi movl %eax, %esi xorl %eax, %eax callq printf movq (%rbx), %rax movq -8(%rax), %rax movq 8(%rax), %rax xorl %esi, %esi cmpb $42, (%rax) sete %sil addq %rax, %rsi movl $.L.str, %edi xorl %eax, %eax callq printf movl 8(%rbx), %esi movl $.L.str.1, %edi xorl %eax, %eax callq printf movq (%rbx), %rax movq %rbx, %rdi callq *(%rax) movl $.L.str.4, %edi movl %eax, %esi xorl %eax, %eax callq printf xorl %eax, %eax 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 .section .text._ZN9Rectangle4areaEv,"axG",@progbits,_ZN9Rectangle4areaEv,comdat .weak _ZN9Rectangle4areaEv # -- Begin function _ZN9Rectangle4areaEv .p2align 4, 0x90 .type _ZN9Rectangle4areaEv,@function _ZN9Rectangle4areaEv: # @_ZN9Rectangle4areaEv .cfi_startproc # %bb.0: movl 12(%rdi), %eax imull 8(%rdi), %eax retq .Lfunc_end2: .size _ZN9Rectangle4areaEv, .Lfunc_end2-_ZN9Rectangle4areaEv .cfi_endproc # -- End function .section .text._ZN7Polygon4areaEv,"axG",@progbits,_ZN7Polygon4areaEv,comdat .weak _ZN7Polygon4areaEv # -- Begin function _ZN7Polygon4areaEv .p2align 4, 0x90 .type _ZN7Polygon4areaEv,@function _ZN7Polygon4areaEv: # @_ZN7Polygon4areaEv .cfi_startproc # %bb.0: xorl %eax, %eax retq .Lfunc_end3: .size _ZN7Polygon4areaEv, .Lfunc_end3-_ZN7Polygon4areaEv .cfi_endproc # -- End function .section .text._ZN8Triangle4areaEv,"axG",@progbits,_ZN8Triangle4areaEv,comdat .weak _ZN8Triangle4areaEv # -- Begin function _ZN8Triangle4areaEv .p2align 4, 0x90 .type _ZN8Triangle4areaEv,@function _ZN8Triangle4areaEv: # @_ZN8Triangle4areaEv .cfi_startproc # %bb.0: movl 12(%rdi), %ecx imull 8(%rdi), %ecx movl %ecx, %eax shrl $31, %eax addl %ecx, %eax sarl %eax retq .Lfunc_end4: .size _ZN8Triangle4areaEv, .Lfunc_end4-_ZN8Triangle4areaEv .cfi_endproc # -- End function .type .L.str,@object # @.str .section .rodata.str1.1,"aMS",@progbits,1 .L.str: .asciz "t: %s\n" .size .L.str, 7 .type .L.str.1,@object # @.str.1 .L.str.1: .asciz "w: %d\n" .size .L.str.1, 7 .type .L.str.2,@object # @.str.2 .L.str.2: .asciz "size for rect: %d\n" .size .L.str.2, 19 .type .L.str.3,@object # @.str.3 .L.str.3: .asciz "size for trgl: %d\n" .size .L.str.3, 19 .type .L.str.4,@object # @.str.4 .L.str.4: .asciz "size for poly: %d\n" .size .L.str.4, 19 .type _ZTV9Rectangle,@object # @_ZTV9Rectangle .section .rodata._ZTV9Rectangle,"aG",@progbits,_ZTV9Rectangle,comdat .weak _ZTV9Rectangle .p2align 3, 0x0 _ZTV9Rectangle: .quad 0 .quad _ZTI9Rectangle .quad _ZN9Rectangle4areaEv .size _ZTV9Rectangle, 24 .type _ZTS9Rectangle,@object # @_ZTS9Rectangle .section .rodata._ZTS9Rectangle,"aG",@progbits,_ZTS9Rectangle,comdat .weak _ZTS9Rectangle _ZTS9Rectangle: .asciz "9Rectangle" .size _ZTS9Rectangle, 11 .type _ZTS7Polygon,@object # @_ZTS7Polygon .section .rodata._ZTS7Polygon,"aG",@progbits,_ZTS7Polygon,comdat .weak _ZTS7Polygon _ZTS7Polygon: .asciz "7Polygon" .size _ZTS7Polygon, 9 .type _ZTI7Polygon,@object # @_ZTI7Polygon .section .rodata._ZTI7Polygon,"aG",@progbits,_ZTI7Polygon,comdat .weak _ZTI7Polygon .p2align 3, 0x0 _ZTI7Polygon: .quad _ZTVN10__cxxabiv117__class_type_infoE+16 .quad _ZTS7Polygon .size _ZTI7Polygon, 16 .type _ZTI9Rectangle,@object # @_ZTI9Rectangle .section .rodata._ZTI9Rectangle,"aG",@progbits,_ZTI9Rectangle,comdat .weak _ZTI9Rectangle .p2align 3, 0x0 _ZTI9Rectangle: .quad _ZTVN10__cxxabiv120__si_class_type_infoE+16 .quad _ZTS9Rectangle .quad _ZTI7Polygon .size _ZTI9Rectangle, 24 .type _ZTV7Polygon,@object # @_ZTV7Polygon .section .rodata._ZTV7Polygon,"aG",@progbits,_ZTV7Polygon,comdat .weak _ZTV7Polygon .p2align 3, 0x0 _ZTV7Polygon: .quad 0 .quad _ZTI7Polygon .quad _ZN7Polygon4areaEv .size _ZTV7Polygon, 24 .type _ZTV8Triangle,@object # @_ZTV8Triangle .section .rodata._ZTV8Triangle,"aG",@progbits,_ZTV8Triangle,comdat .weak _ZTV8Triangle .p2align 3, 0x0 _ZTV8Triangle: .quad 0 .quad _ZTI8Triangle .quad _ZN8Triangle4areaEv .size _ZTV8Triangle, 24 .type _ZTS8Triangle,@object # @_ZTS8Triangle .section .rodata._ZTS8Triangle,"aG",@progbits,_ZTS8Triangle,comdat .weak _ZTS8Triangle _ZTS8Triangle: .asciz "8Triangle" .size _ZTS8Triangle, 10 .type _ZTI8Triangle,@object # @_ZTI8Triangle .section .rodata._ZTI8Triangle,"aG",@progbits,_ZTI8Triangle,comdat .weak _ZTI8Triangle .p2align 3, 0x0 _ZTI8Triangle: .quad _ZTVN10__cxxabiv120__si_class_type_infoE+16 .quad _ZTS8Triangle .quad _ZTI7Polygon .size _ZTI8Triangle, 24 .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 _ZTVN10__cxxabiv120__si_class_type_infoE .addrsig_sym _ZTS9Rectangle .addrsig_sym _ZTVN10__cxxabiv117__class_type_infoE .addrsig_sym _ZTS7Polygon .addrsig_sym _ZTI7Polygon .addrsig_sym _ZTI9Rectangle .addrsig_sym _ZTS8Triangle .addrsig_sym _ZTI8Triangle .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_001aaf43_00000000-6_test-ext.cudafe1.cpp" .text #APP .globl _ZSt21ios_base_library_initv #NO_APP .section .text._ZN7Polygon4areaEv,"axG",@progbits,_ZN7Polygon4areaEv,comdat .align 2 .weak _ZN7Polygon4areaEv .type _ZN7Polygon4areaEv, @function _ZN7Polygon4areaEv: .LFB3670: .cfi_startproc endbr64 movl $0, %eax ret .cfi_endproc .LFE3670: .size _ZN7Polygon4areaEv, .-_ZN7Polygon4areaEv .section .text._ZN9Rectangle4areaEv,"axG",@progbits,_ZN9Rectangle4areaEv,comdat .align 2 .weak _ZN9Rectangle4areaEv .type _ZN9Rectangle4areaEv, @function _ZN9Rectangle4areaEv: .LFB3671: .cfi_startproc endbr64 movl 8(%rdi), %eax imull 12(%rdi), %eax ret .cfi_endproc .LFE3671: .size _ZN9Rectangle4areaEv, .-_ZN9Rectangle4areaEv .section .text._ZN8Triangle4areaEv,"axG",@progbits,_ZN8Triangle4areaEv,comdat .align 2 .weak _ZN8Triangle4areaEv .type _ZN8Triangle4areaEv, @function _ZN8Triangle4areaEv: .LFB3672: .cfi_startproc endbr64 movl 8(%rdi), %edx imull 12(%rdi), %edx movl %edx, %eax shrl $31, %eax addl %edx, %eax sarl %eax ret .cfi_endproc .LFE3672: .size _ZN8Triangle4areaEv, .-_ZN8Triangle4areaEv .text .type _ZL26__cudaUnregisterBinaryUtilv, @function _ZL26__cudaUnregisterBinaryUtilv: .LFB3686: .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 .LFE3686: .size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "t: %s\n" .LC1: .string "w: %d\n" .text .globl _Z8get_areaR7Polygon .type _Z8get_areaR7Polygon, @function _Z8get_areaR7Polygon: .LFB3673: .cfi_startproc endbr64 pushq %rbx .cfi_def_cfa_offset 16 .cfi_offset 3, -16 movq %rdi, %rbx movq (%rdi), %rax movq -8(%rax), %rax movq 8(%rax), %rdx cmpb $42, (%rdx) sete %al movzbl %al, %eax addq %rax, %rdx leaq .LC0(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl 8(%rbx), %edx leaq .LC1(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movq (%rbx), %rax movq %rbx, %rdi call *(%rax) popq %rbx .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE3673: .size _Z8get_areaR7Polygon, .-_Z8get_areaR7Polygon .section .rodata.str1.1 .LC2: .string "size for rect: %d\n" .LC3: .string "size for trgl: %d\n" .LC4: .string "size for poly: %d\n" .text .globl main .type main, @function main: .LFB3674: .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 movl $16, %edi call _Znwm@PLT movq %rax, %rbp movl $0, 8(%rax) movl $0, 12(%rax) leaq 16+_ZTV9Rectangle(%rip), %rax movq %rax, 0(%rbp) movl $16, %edi call _Znwm@PLT movq %rax, %rbx movl $0, 8(%rax) movl $0, 12(%rax) leaq 16+_ZTV8Triangle(%rip), %rax movq %rax, (%rbx) movl $16, %edi call _Znwm@PLT movq %rax, %r12 leaq 16+_ZTV7Polygon(%rip), %rax movq %rax, (%r12) movl $4, 8(%rbp) movl $5, 12(%rbp) movl $5, 8(%rbx) movl $5, 12(%rbx) movl $6, 8(%r12) movl $5, 12(%r12) movq %rbp, %rdi call _Z8get_areaR7Polygon movl %eax, %edx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movq %rbx, %rdi call _Z8get_areaR7Polygon movl %eax, %edx leaq .LC3(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movq %r12, %rdi call _Z8get_areaR7Polygon movl %eax, %edx leaq .LC4(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $0, %eax popq %rbx .cfi_def_cfa_offset 24 popq %rbp .cfi_def_cfa_offset 16 popq %r12 .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE3674: .size main, .-main .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB3709: .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 .LFE3709: .size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv .section .init_array,"aw" .align 8 .quad _ZL24__sti____cudaRegisterAllv .weak _ZTS7Polygon .section .rodata._ZTS7Polygon,"aG",@progbits,_ZTS7Polygon,comdat .align 8 .type _ZTS7Polygon, @object .size _ZTS7Polygon, 9 _ZTS7Polygon: .string "7Polygon" .weak _ZTI7Polygon .section .data.rel.ro._ZTI7Polygon,"awG",@progbits,_ZTI7Polygon,comdat .align 8 .type _ZTI7Polygon, @object .size _ZTI7Polygon, 16 _ZTI7Polygon: .quad _ZTVN10__cxxabiv117__class_type_infoE+16 .quad _ZTS7Polygon .weak _ZTS9Rectangle .section .rodata._ZTS9Rectangle,"aG",@progbits,_ZTS9Rectangle,comdat .align 8 .type _ZTS9Rectangle, @object .size _ZTS9Rectangle, 11 _ZTS9Rectangle: .string "9Rectangle" .weak _ZTI9Rectangle .section .data.rel.ro._ZTI9Rectangle,"awG",@progbits,_ZTI9Rectangle,comdat .align 8 .type _ZTI9Rectangle, @object .size _ZTI9Rectangle, 24 _ZTI9Rectangle: .quad _ZTVN10__cxxabiv120__si_class_type_infoE+16 .quad _ZTS9Rectangle .quad _ZTI7Polygon .weak _ZTS8Triangle .section .rodata._ZTS8Triangle,"aG",@progbits,_ZTS8Triangle,comdat .align 8 .type _ZTS8Triangle, @object .size _ZTS8Triangle, 10 _ZTS8Triangle: .string "8Triangle" .weak _ZTI8Triangle .section .data.rel.ro._ZTI8Triangle,"awG",@progbits,_ZTI8Triangle,comdat .align 8 .type _ZTI8Triangle, @object .size _ZTI8Triangle, 24 _ZTI8Triangle: .quad _ZTVN10__cxxabiv120__si_class_type_infoE+16 .quad _ZTS8Triangle .quad _ZTI7Polygon .weak _ZTV7Polygon .section .data.rel.ro.local._ZTV7Polygon,"awG",@progbits,_ZTV7Polygon,comdat .align 8 .type _ZTV7Polygon, @object .size _ZTV7Polygon, 24 _ZTV7Polygon: .quad 0 .quad _ZTI7Polygon .quad _ZN7Polygon4areaEv .weak _ZTV9Rectangle .section .data.rel.ro.local._ZTV9Rectangle,"awG",@progbits,_ZTV9Rectangle,comdat .align 8 .type _ZTV9Rectangle, @object .size _ZTV9Rectangle, 24 _ZTV9Rectangle: .quad 0 .quad _ZTI9Rectangle .quad _ZN9Rectangle4areaEv .weak _ZTV8Triangle .section .data.rel.ro.local._ZTV8Triangle,"awG",@progbits,_ZTV8Triangle,comdat .align 8 .type _ZTV8Triangle, @object .size _ZTV8Triangle, 24 _ZTV8Triangle: .quad 0 .quad _ZTI8Triangle .quad _ZN8Triangle4areaEv .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 "test-ext.hip" # Start of file scope inline assembly .globl _ZSt21ios_base_library_initv # End of file scope inline assembly .globl _Z8get_areaR7Polygon # -- Begin function _Z8get_areaR7Polygon .p2align 4, 0x90 .type _Z8get_areaR7Polygon,@function _Z8get_areaR7Polygon: # @_Z8get_areaR7Polygon .cfi_startproc # %bb.0: pushq %rbx .cfi_def_cfa_offset 16 .cfi_offset %rbx, -16 movq %rdi, %rbx movq (%rdi), %rax movq -8(%rax), %rax movq 8(%rax), %rax xorl %esi, %esi cmpb $42, (%rax) sete %sil addq %rax, %rsi movl $.L.str, %edi xorl %eax, %eax callq printf movl 8(%rbx), %esi movl $.L.str.1, %edi xorl %eax, %eax callq printf movq (%rbx), %rax movq %rbx, %rdi popq %rbx .cfi_def_cfa_offset 8 jmpq *(%rax) # TAILCALL .Lfunc_end0: .size _Z8get_areaR7Polygon, .Lfunc_end0-_Z8get_areaR7Polygon .cfi_endproc # -- End function .section .rodata.cst16,"aM",@progbits,16 .p2align 4, 0x0 # -- Begin function main .LCPI1_0: .zero 16 .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 .cfi_offset %rbx, -32 .cfi_offset %r14, -24 .cfi_offset %r15, -16 movl $16, %edi callq _Znwm movq %rax, %r15 xorps %xmm0, %xmm0 movaps %xmm0, (%rax) movq $_ZTV9Rectangle+16, (%rax) movl $16, %edi callq _Znwm movq %rax, %r14 xorps %xmm0, %xmm0 movaps %xmm0, (%rax) movq $_ZTV8Triangle+16, (%rax) movl $16, %edi callq _Znwm movq %rax, %rbx xorps %xmm0, %xmm0 movaps %xmm0, (%rax) movq $_ZTV7Polygon+16, (%rax) movabsq $21474836484, %rax # imm = 0x500000004 movq %rax, 8(%r15) movabsq $21474836485, %rax # imm = 0x500000005 movq %rax, 8(%r14) movabsq $21474836486, %rax # imm = 0x500000006 movq %rax, 8(%rbx) movl $.L.str, %edi movl $_ZTS9Rectangle, %esi xorl %eax, %eax callq printf movl 8(%r15), %esi movl $.L.str.1, %edi xorl %eax, %eax callq printf movq (%r15), %rax movq %r15, %rdi callq *(%rax) movl $.L.str.2, %edi movl %eax, %esi xorl %eax, %eax callq printf movq (%r14), %rax movq -8(%rax), %rax movq 8(%rax), %rax xorl %esi, %esi cmpb $42, (%rax) sete %sil addq %rax, %rsi movl $.L.str, %edi xorl %eax, %eax callq printf movl 8(%r14), %esi movl $.L.str.1, %edi xorl %eax, %eax callq printf movq (%r14), %rax movq %r14, %rdi callq *(%rax) movl $.L.str.3, %edi movl %eax, %esi xorl %eax, %eax callq printf movq (%rbx), %rax movq -8(%rax), %rax movq 8(%rax), %rax xorl %esi, %esi cmpb $42, (%rax) sete %sil addq %rax, %rsi movl $.L.str, %edi xorl %eax, %eax callq printf movl 8(%rbx), %esi movl $.L.str.1, %edi xorl %eax, %eax callq printf movq (%rbx), %rax movq %rbx, %rdi callq *(%rax) movl $.L.str.4, %edi movl %eax, %esi xorl %eax, %eax callq printf xorl %eax, %eax 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 .section .text._ZN9Rectangle4areaEv,"axG",@progbits,_ZN9Rectangle4areaEv,comdat .weak _ZN9Rectangle4areaEv # -- Begin function _ZN9Rectangle4areaEv .p2align 4, 0x90 .type _ZN9Rectangle4areaEv,@function _ZN9Rectangle4areaEv: # @_ZN9Rectangle4areaEv .cfi_startproc # %bb.0: movl 12(%rdi), %eax imull 8(%rdi), %eax retq .Lfunc_end2: .size _ZN9Rectangle4areaEv, .Lfunc_end2-_ZN9Rectangle4areaEv .cfi_endproc # -- End function .section .text._ZN7Polygon4areaEv,"axG",@progbits,_ZN7Polygon4areaEv,comdat .weak _ZN7Polygon4areaEv # -- Begin function _ZN7Polygon4areaEv .p2align 4, 0x90 .type _ZN7Polygon4areaEv,@function _ZN7Polygon4areaEv: # @_ZN7Polygon4areaEv .cfi_startproc # %bb.0: xorl %eax, %eax retq .Lfunc_end3: .size _ZN7Polygon4areaEv, .Lfunc_end3-_ZN7Polygon4areaEv .cfi_endproc # -- End function .section .text._ZN8Triangle4areaEv,"axG",@progbits,_ZN8Triangle4areaEv,comdat .weak _ZN8Triangle4areaEv # -- Begin function _ZN8Triangle4areaEv .p2align 4, 0x90 .type _ZN8Triangle4areaEv,@function _ZN8Triangle4areaEv: # @_ZN8Triangle4areaEv .cfi_startproc # %bb.0: movl 12(%rdi), %ecx imull 8(%rdi), %ecx movl %ecx, %eax shrl $31, %eax addl %ecx, %eax sarl %eax retq .Lfunc_end4: .size _ZN8Triangle4areaEv, .Lfunc_end4-_ZN8Triangle4areaEv .cfi_endproc # -- End function .type .L.str,@object # @.str .section .rodata.str1.1,"aMS",@progbits,1 .L.str: .asciz "t: %s\n" .size .L.str, 7 .type .L.str.1,@object # @.str.1 .L.str.1: .asciz "w: %d\n" .size .L.str.1, 7 .type .L.str.2,@object # @.str.2 .L.str.2: .asciz "size for rect: %d\n" .size .L.str.2, 19 .type .L.str.3,@object # @.str.3 .L.str.3: .asciz "size for trgl: %d\n" .size .L.str.3, 19 .type .L.str.4,@object # @.str.4 .L.str.4: .asciz "size for poly: %d\n" .size .L.str.4, 19 .type _ZTV9Rectangle,@object # @_ZTV9Rectangle .section .rodata._ZTV9Rectangle,"aG",@progbits,_ZTV9Rectangle,comdat .weak _ZTV9Rectangle .p2align 3, 0x0 _ZTV9Rectangle: .quad 0 .quad _ZTI9Rectangle .quad _ZN9Rectangle4areaEv .size _ZTV9Rectangle, 24 .type _ZTS9Rectangle,@object # @_ZTS9Rectangle .section .rodata._ZTS9Rectangle,"aG",@progbits,_ZTS9Rectangle,comdat .weak _ZTS9Rectangle _ZTS9Rectangle: .asciz "9Rectangle" .size _ZTS9Rectangle, 11 .type _ZTS7Polygon,@object # @_ZTS7Polygon .section .rodata._ZTS7Polygon,"aG",@progbits,_ZTS7Polygon,comdat .weak _ZTS7Polygon _ZTS7Polygon: .asciz "7Polygon" .size _ZTS7Polygon, 9 .type _ZTI7Polygon,@object # @_ZTI7Polygon .section .rodata._ZTI7Polygon,"aG",@progbits,_ZTI7Polygon,comdat .weak _ZTI7Polygon .p2align 3, 0x0 _ZTI7Polygon: .quad _ZTVN10__cxxabiv117__class_type_infoE+16 .quad _ZTS7Polygon .size _ZTI7Polygon, 16 .type _ZTI9Rectangle,@object # @_ZTI9Rectangle .section .rodata._ZTI9Rectangle,"aG",@progbits,_ZTI9Rectangle,comdat .weak _ZTI9Rectangle .p2align 3, 0x0 _ZTI9Rectangle: .quad _ZTVN10__cxxabiv120__si_class_type_infoE+16 .quad _ZTS9Rectangle .quad _ZTI7Polygon .size _ZTI9Rectangle, 24 .type _ZTV7Polygon,@object # @_ZTV7Polygon .section .rodata._ZTV7Polygon,"aG",@progbits,_ZTV7Polygon,comdat .weak _ZTV7Polygon .p2align 3, 0x0 _ZTV7Polygon: .quad 0 .quad _ZTI7Polygon .quad _ZN7Polygon4areaEv .size _ZTV7Polygon, 24 .type _ZTV8Triangle,@object # @_ZTV8Triangle .section .rodata._ZTV8Triangle,"aG",@progbits,_ZTV8Triangle,comdat .weak _ZTV8Triangle .p2align 3, 0x0 _ZTV8Triangle: .quad 0 .quad _ZTI8Triangle .quad _ZN8Triangle4areaEv .size _ZTV8Triangle, 24 .type _ZTS8Triangle,@object # @_ZTS8Triangle .section .rodata._ZTS8Triangle,"aG",@progbits,_ZTS8Triangle,comdat .weak _ZTS8Triangle _ZTS8Triangle: .asciz "8Triangle" .size _ZTS8Triangle, 10 .type _ZTI8Triangle,@object # @_ZTI8Triangle .section .rodata._ZTI8Triangle,"aG",@progbits,_ZTI8Triangle,comdat .weak _ZTI8Triangle .p2align 3, 0x0 _ZTI8Triangle: .quad _ZTVN10__cxxabiv120__si_class_type_infoE+16 .quad _ZTS8Triangle .quad _ZTI7Polygon .size _ZTI8Triangle, 24 .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 _ZTVN10__cxxabiv120__si_class_type_infoE .addrsig_sym _ZTS9Rectangle .addrsig_sym _ZTVN10__cxxabiv117__class_type_infoE .addrsig_sym _ZTS7Polygon .addrsig_sym _ZTI7Polygon .addrsig_sym _ZTI9Rectangle .addrsig_sym _ZTS8Triangle .addrsig_sym _ZTI8Triangle .addrsig_sym __hip_cuid_
You are a helpful coding assistant specialized in converting CUDA source code to CUDA device assembly.
#include <stdio.h> /* * Initialize array values on the host. */ void init(int *a, int N) { int i; for (i = 0; i < N; ++i) { a[i] = i; } } /* * Double elements in parallel on the GPU. */ __global__ void doubleElements(int *a, int N) { int i; i = blockIdx.x * blockDim.x + threadIdx.x; if (i < N) { a[i] *= 2; } } /* * Check all elements have been doubled on the host. */ bool checkElementsAreDoubled(int *a, int N) { int i; for (i = 0; i < N; ++i) { if (a[i] != i*2) return false; } return true; } int main() { int N = 100; int *a; size_t size = N * sizeof(int); /* * Refactor this memory allocation to provide a pointer * `a` that can be used on both the host and the device. */ cudaMallocManaged(&a, size); init(a, N); size_t threads_per_block = 10; size_t number_of_blocks = 10; /* * This launch will not work until the pointer `a` is also * available to the device. */ doubleElements<<<number_of_blocks, threads_per_block>>>(a, N); cudaDeviceSynchronize(); bool areDoubled = checkElementsAreDoubled(a, N); printf("All elements were doubled? %s\n", areDoubled ? "TRUE" : "FALSE"); /* * Refactor to free memory that has been allocated to be * accessed by both the host and the device. */ cudaFree(a); }
code for sm_80 Function : _Z14doubleElementsPii .headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)" /*0000*/ MOV R1, c[0x0][0x28] ; /* 0x00000a0000017a02 */ /* 0x000fe40000000f00 */ /*0010*/ S2R R2, SR_CTAID.X ; /* 0x0000000000027919 */ /* 0x000e280000002500 */ /*0020*/ S2R R3, SR_TID.X ; /* 0x0000000000037919 */ /* 0x000e240000002100 */ /*0030*/ IMAD R2, R2, c[0x0][0x0], R3 ; /* 0x0000000002027a24 */ /* 0x001fca00078e0203 */ /*0040*/ ISETP.GE.AND P0, PT, R2, c[0x0][0x168], PT ; /* 0x00005a0002007a0c */ /* 0x000fda0003f06270 */ /*0050*/ @P0 EXIT ; /* 0x000000000000094d */ /* 0x000fea0003800000 */ /*0060*/ HFMA2.MMA R3, -RZ, RZ, 0, 2.384185791015625e-07 ; /* 0x00000004ff037435 */ /* 0x000fe200000001ff */ /*0070*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */ /* 0x000fd20000000a00 */ /*0080*/ IMAD.WIDE R2, R2, R3, c[0x0][0x160] ; /* 0x0000580002027625 */ /* 0x000fca00078e0203 */ /*0090*/ LDG.E R0, [R2.64] ; /* 0x0000000402007981 */ /* 0x000ea4000c1e1900 */ /*00a0*/ SHF.L.U32 R5, R0, 0x1, RZ ; /* 0x0000000100057819 */ /* 0x004fca00000006ff */ /*00b0*/ STG.E [R2.64], R5 ; /* 0x0000000502007986 */ /* 0x000fe2000c101904 */ /*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 <stdio.h> /* * Initialize array values on the host. */ void init(int *a, int N) { int i; for (i = 0; i < N; ++i) { a[i] = i; } } /* * Double elements in parallel on the GPU. */ __global__ void doubleElements(int *a, int N) { int i; i = blockIdx.x * blockDim.x + threadIdx.x; if (i < N) { a[i] *= 2; } } /* * Check all elements have been doubled on the host. */ bool checkElementsAreDoubled(int *a, int N) { int i; for (i = 0; i < N; ++i) { if (a[i] != i*2) return false; } return true; } int main() { int N = 100; int *a; size_t size = N * sizeof(int); /* * Refactor this memory allocation to provide a pointer * `a` that can be used on both the host and the device. */ cudaMallocManaged(&a, size); init(a, N); size_t threads_per_block = 10; size_t number_of_blocks = 10; /* * This launch will not work until the pointer `a` is also * available to the device. */ doubleElements<<<number_of_blocks, threads_per_block>>>(a, N); cudaDeviceSynchronize(); bool areDoubled = checkElementsAreDoubled(a, N); printf("All elements were doubled? %s\n", areDoubled ? "TRUE" : "FALSE"); /* * Refactor to free memory that has been allocated to be * accessed by both the host and the device. */ cudaFree(a); }
.file "tmpxft_0002d425_00000000-6_01-double-elements.cudafe1.cpp" .text #APP #NO_APP .type _ZL26__cudaUnregisterBinaryUtilv, @function _ZL26__cudaUnregisterBinaryUtilv: .LFB2062: .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 .LFE2062: .size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv .globl _Z4initPii .type _Z4initPii, @function _Z4initPii: .LFB2057: .cfi_startproc endbr64 testl %esi, %esi jle .L3 movslq %esi, %rsi movl $0, %eax .L5: movl %eax, (%rdi,%rax,4) addq $1, %rax cmpq %rsi, %rax jne .L5 .L3: ret .cfi_endproc .LFE2057: .size _Z4initPii, .-_Z4initPii .globl _Z23checkElementsAreDoubledPii .type _Z23checkElementsAreDoubledPii, @function _Z23checkElementsAreDoubledPii: .LFB2058: .cfi_startproc endbr64 testl %esi, %esi jle .L10 movslq %esi, %rsi movl $0, %eax .L9: leal (%rax,%rax), %edx cmpl %edx, (%rdi,%rax,4) jne .L11 addq $1, %rax cmpq %rsi, %rax jne .L9 movl $1, %eax ret .L10: movl $1, %eax ret .L11: movl $0, %eax ret .cfi_endproc .LFE2058: .size _Z23checkElementsAreDoubledPii, .-_Z23checkElementsAreDoubledPii .globl _Z35__device_stub__Z14doubleElementsPiiPii .type _Z35__device_stub__Z14doubleElementsPiiPii, @function _Z35__device_stub__Z14doubleElementsPiiPii: .LFB2084: .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 .L17 .L13: movq 104(%rsp), %rax subq %fs:40, %rax jne .L18 addq $120, %rsp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L17: .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 _Z14doubleElementsPii(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 128 jmp .L13 .L18: call __stack_chk_fail@PLT .cfi_endproc .LFE2084: .size _Z35__device_stub__Z14doubleElementsPiiPii, .-_Z35__device_stub__Z14doubleElementsPiiPii .globl _Z14doubleElementsPii .type _Z14doubleElementsPii, @function _Z14doubleElementsPii: .LFB2085: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z35__device_stub__Z14doubleElementsPiiPii addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2085: .size _Z14doubleElementsPii, .-_Z14doubleElementsPii .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "TRUE" .LC1: .string "FALSE" .section .rodata.str1.8,"aMS",@progbits,1 .align 8 .LC2: .string "All elements were doubled? %s\n" .text .globl main .type main, @function main: .LFB2059: .cfi_startproc endbr64 subq $56, %rsp .cfi_def_cfa_offset 64 movq %fs:40, %rax movq %rax, 40(%rsp) xorl %eax, %eax leaq 8(%rsp), %rdi movl $1, %edx movl $400, %esi call cudaMallocManaged@PLT movl $100, %esi movq 8(%rsp), %rdi call _Z4initPii movl $10, 28(%rsp) movl $1, 32(%rsp) movl $10, 16(%rsp) movl $1, 20(%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 .L27 .L22: call cudaDeviceSynchronize@PLT movl $100, %esi movq 8(%rsp), %rdi call _Z23checkElementsAreDoubledPii testb %al, %al leaq .LC1(%rip), %rdx leaq .LC0(%rip), %rax cmovne %rax, %rdx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movq 8(%rsp), %rdi call cudaFree@PLT movq 40(%rsp), %rax subq %fs:40, %rax jne .L28 movl $0, %eax addq $56, %rsp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L27: .cfi_restore_state movl $100, %esi movq 8(%rsp), %rdi call _Z35__device_stub__Z14doubleElementsPiiPii jmp .L22 .L28: call __stack_chk_fail@PLT .cfi_endproc .LFE2059: .size main, .-main .section .rodata.str1.1 .LC3: .string "_Z14doubleElementsPii" .text .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB2087: .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 .LC3(%rip), %rdx movq %rdx, %rcx leaq _Z14doubleElementsPii(%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 .LFE2087: .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> /* * Initialize array values on the host. */ void init(int *a, int N) { int i; for (i = 0; i < N; ++i) { a[i] = i; } } /* * Double elements in parallel on the GPU. */ __global__ void doubleElements(int *a, int N) { int i; i = blockIdx.x * blockDim.x + threadIdx.x; if (i < N) { a[i] *= 2; } } /* * Check all elements have been doubled on the host. */ bool checkElementsAreDoubled(int *a, int N) { int i; for (i = 0; i < N; ++i) { if (a[i] != i*2) return false; } return true; } int main() { int N = 100; int *a; size_t size = N * sizeof(int); /* * Refactor this memory allocation to provide a pointer * `a` that can be used on both the host and the device. */ cudaMallocManaged(&a, size); init(a, N); size_t threads_per_block = 10; size_t number_of_blocks = 10; /* * This launch will not work until the pointer `a` is also * available to the device. */ doubleElements<<<number_of_blocks, threads_per_block>>>(a, N); cudaDeviceSynchronize(); bool areDoubled = checkElementsAreDoubled(a, N); printf("All elements were doubled? %s\n", areDoubled ? "TRUE" : "FALSE"); /* * Refactor to free memory that has been allocated to be * accessed by both the host and the device. */ cudaFree(a); }
#include <hip/hip_runtime.h> #include <stdio.h> /* * Initialize array values on the host. */ void init(int *a, int N) { int i; for (i = 0; i < N; ++i) { a[i] = i; } } /* * Double elements in parallel on the GPU. */ __global__ void doubleElements(int *a, int N) { int i; i = blockIdx.x * blockDim.x + threadIdx.x; if (i < N) { a[i] *= 2; } } /* * Check all elements have been doubled on the host. */ bool checkElementsAreDoubled(int *a, int N) { int i; for (i = 0; i < N; ++i) { if (a[i] != i*2) return false; } return true; } int main() { int N = 100; int *a; size_t size = N * sizeof(int); /* * Refactor this memory allocation to provide a pointer * `a` that can be used on both the host and the device. */ hipMallocManaged(&a, size); init(a, N); size_t threads_per_block = 10; size_t number_of_blocks = 10; /* * This launch will not work until the pointer `a` is also * available to the device. */ doubleElements<<<number_of_blocks, threads_per_block>>>(a, N); hipDeviceSynchronize(); bool areDoubled = checkElementsAreDoubled(a, N); printf("All elements were doubled? %s\n", areDoubled ? "TRUE" : "FALSE"); /* * Refactor to free memory that has been allocated to be * accessed by both the host and the device. */ hipFree(a); }
You are a helpful coding assistant specialized in converting HIP source code to AMD device assembly.
#include <hip/hip_runtime.h> #include <stdio.h> /* * Initialize array values on the host. */ void init(int *a, int N) { int i; for (i = 0; i < N; ++i) { a[i] = i; } } /* * Double elements in parallel on the GPU. */ __global__ void doubleElements(int *a, int N) { int i; i = blockIdx.x * blockDim.x + threadIdx.x; if (i < N) { a[i] *= 2; } } /* * Check all elements have been doubled on the host. */ bool checkElementsAreDoubled(int *a, int N) { int i; for (i = 0; i < N; ++i) { if (a[i] != i*2) return false; } return true; } int main() { int N = 100; int *a; size_t size = N * sizeof(int); /* * Refactor this memory allocation to provide a pointer * `a` that can be used on both the host and the device. */ hipMallocManaged(&a, size); init(a, N); size_t threads_per_block = 10; size_t number_of_blocks = 10; /* * This launch will not work until the pointer `a` is also * available to the device. */ doubleElements<<<number_of_blocks, threads_per_block>>>(a, N); hipDeviceSynchronize(); bool areDoubled = checkElementsAreDoubled(a, N); printf("All elements were doubled? %s\n", areDoubled ? "TRUE" : "FALSE"); /* * Refactor to free memory that has been allocated to be * accessed by both the host and the device. */ hipFree(a); }
.text .amdgcn_target "amdgcn-amd-amdhsa--gfx1100" .protected _Z14doubleElementsPii .globl _Z14doubleElementsPii .p2align 8 .type _Z14doubleElementsPii,@function _Z14doubleElementsPii: s_clause 0x1 s_load_b32 s2, s[0:1], 0x1c s_load_b32 s3, s[0:1], 0x8 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_b64 s[0:1], s[0:1], 0x0 v_ashrrev_i32_e32 v2, 31, v1 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_lshlrev_b64 v[0:1], 2, v[1:2] s_waitcnt lgkmcnt(0) v_add_co_u32 v0, vcc_lo, s0, v0 s_delay_alu instid0(VALU_DEP_2) v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo global_load_b32 v2, v[0:1], off s_waitcnt vmcnt(0) v_lshlrev_b32_e32 v2, 1, v2 global_store_b32 v[0:1], v2, off .LBB0_2: s_nop 0 s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z14doubleElementsPii .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 3 .amdhsa_next_free_sgpr 16 .amdhsa_float_round_mode_32 0 .amdhsa_float_round_mode_16_64 0 .amdhsa_float_denorm_mode_32 3 .amdhsa_float_denorm_mode_16_64 3 .amdhsa_dx10_clamp 1 .amdhsa_ieee_mode 1 .amdhsa_fp16_overflow 0 .amdhsa_workgroup_processor_mode 1 .amdhsa_memory_ordered 1 .amdhsa_forward_progress 0 .amdhsa_shared_vgpr_count 0 .amdhsa_exception_fp_ieee_invalid_op 0 .amdhsa_exception_fp_denorm_src 0 .amdhsa_exception_fp_ieee_div_zero 0 .amdhsa_exception_fp_ieee_overflow 0 .amdhsa_exception_fp_ieee_underflow 0 .amdhsa_exception_fp_ieee_inexact 0 .amdhsa_exception_int_div_zero 0 .end_amdhsa_kernel .text .Lfunc_end0: .size _Z14doubleElementsPii, .Lfunc_end0-_Z14doubleElementsPii .section .AMDGPU.csdata,"",@progbits .text .p2alignl 7, 3214868480 .fill 96, 4, 3214868480 .type __hip_cuid_,@object .section .bss,"aw",@nobits .globl __hip_cuid_ __hip_cuid_: .byte 0 .size __hip_cuid_, 1 .ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)" .section ".note.GNU-stack","",@progbits .addrsig .addrsig_sym __hip_cuid_ .amdgpu_metadata --- amdhsa.kernels: - .args: - .address_space: global .offset: 0 .size: 8 .value_kind: global_buffer - .offset: 8 .size: 4 .value_kind: by_value - .offset: 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: _Z14doubleElementsPii .private_segment_fixed_size: 0 .sgpr_count: 18 .sgpr_spill_count: 0 .symbol: _Z14doubleElementsPii.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> #include <stdio.h> /* * Initialize array values on the host. */ void init(int *a, int N) { int i; for (i = 0; i < N; ++i) { a[i] = i; } } /* * Double elements in parallel on the GPU. */ __global__ void doubleElements(int *a, int N) { int i; i = blockIdx.x * blockDim.x + threadIdx.x; if (i < N) { a[i] *= 2; } } /* * Check all elements have been doubled on the host. */ bool checkElementsAreDoubled(int *a, int N) { int i; for (i = 0; i < N; ++i) { if (a[i] != i*2) return false; } return true; } int main() { int N = 100; int *a; size_t size = N * sizeof(int); /* * Refactor this memory allocation to provide a pointer * `a` that can be used on both the host and the device. */ hipMallocManaged(&a, size); init(a, N); size_t threads_per_block = 10; size_t number_of_blocks = 10; /* * This launch will not work until the pointer `a` is also * available to the device. */ doubleElements<<<number_of_blocks, threads_per_block>>>(a, N); hipDeviceSynchronize(); bool areDoubled = checkElementsAreDoubled(a, N); printf("All elements were doubled? %s\n", areDoubled ? "TRUE" : "FALSE"); /* * Refactor to free memory that has been allocated to be * accessed by both the host and the device. */ hipFree(a); }
.text .file "01-double-elements.hip" .globl _Z4initPii # -- Begin function _Z4initPii .p2align 4, 0x90 .type _Z4initPii,@function _Z4initPii: # @_Z4initPii .cfi_startproc # %bb.0: testl %esi, %esi jle .LBB0_3 # %bb.1: # %.lr.ph.preheader movl %esi, %eax xorl %ecx, %ecx .p2align 4, 0x90 .LBB0_2: # %.lr.ph # =>This Inner Loop Header: Depth=1 movl %ecx, (%rdi,%rcx,4) incq %rcx cmpq %rcx, %rax jne .LBB0_2 .LBB0_3: # %._crit_edge retq .Lfunc_end0: .size _Z4initPii, .Lfunc_end0-_Z4initPii .cfi_endproc # -- End function .globl _Z29__device_stub__doubleElementsPii # -- Begin function _Z29__device_stub__doubleElementsPii .p2align 4, 0x90 .type _Z29__device_stub__doubleElementsPii,@function _Z29__device_stub__doubleElementsPii: # @_Z29__device_stub__doubleElementsPii .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 $_Z14doubleElementsPii, %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 _Z29__device_stub__doubleElementsPii, .Lfunc_end1-_Z29__device_stub__doubleElementsPii .cfi_endproc # -- End function .globl _Z23checkElementsAreDoubledPii # -- Begin function _Z23checkElementsAreDoubledPii .p2align 4, 0x90 .type _Z23checkElementsAreDoubledPii,@function _Z23checkElementsAreDoubledPii: # @_Z23checkElementsAreDoubledPii .cfi_startproc # %bb.0: testl %esi, %esi setle %al jle .LBB2_6 # %bb.1: # %.lr.ph.preheader cmpl $0, (%rdi) je .LBB2_2 .LBB2_6: # %._crit_edge retq .LBB2_2: # %.lr.ph12.preheader movl %esi, %eax xorl %ecx, %ecx .p2align 4, 0x90 .LBB2_3: # %.lr.ph12 # =>This Inner Loop Header: Depth=1 incq %rcx cmpq %rax, %rcx je .LBB2_5 # %bb.4: # %.lr.ph # in Loop: Header=BB2_3 Depth=1 movl (%rdi,%rcx,4), %edx leaq (%rcx,%rcx), %rsi cmpq %rdx, %rsi je .LBB2_3 .LBB2_5: # %._crit_edge.loopexit cmpq %rax, %rcx setae %al retq .Lfunc_end2: .size _Z23checkElementsAreDoubledPii, .Lfunc_end2-_Z23checkElementsAreDoubledPii .cfi_endproc # -- End function .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: subq $104, %rsp .cfi_def_cfa_offset 112 leaq 8(%rsp), %rdi movl $400, %esi # imm = 0x190 movl $1, %edx callq hipMallocManaged xorl %eax, %eax movq 8(%rsp), %rcx .p2align 4, 0x90 .LBB3_1: # %.lr.ph.i # =>This Inner Loop Header: Depth=1 movl %eax, (%rcx,%rax,4) incq %rax cmpq $100, %rax jne .LBB3_1 # %bb.2: # %_Z4initPii.exit movabsq $4294967306, %rdi # imm = 0x10000000A movl $1, %esi movq %rdi, %rdx movl $1, %ecx xorl %r8d, %r8d xorl %r9d, %r9d callq __hipPushCallConfiguration testl %eax, %eax jne .LBB3_4 # %bb.3: movq 8(%rsp), %rax movq %rax, 72(%rsp) movl $100, 20(%rsp) leaq 72(%rsp), %rax movq %rax, 80(%rsp) leaq 20(%rsp), %rax movq %rax, 88(%rsp) leaq 56(%rsp), %rdi leaq 40(%rsp), %rsi leaq 32(%rsp), %rdx leaq 24(%rsp), %rcx callq __hipPopCallConfiguration movq 56(%rsp), %rsi movl 64(%rsp), %edx movq 40(%rsp), %rcx movl 48(%rsp), %r8d leaq 80(%rsp), %r9 movl $_Z14doubleElementsPii, %edi pushq 24(%rsp) .cfi_adjust_cfa_offset 8 pushq 40(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $16, %rsp .cfi_adjust_cfa_offset -16 .LBB3_4: callq hipDeviceSynchronize movq 8(%rsp), %rax movl $.L.str.2, %esi cmpl $0, (%rax) jne .LBB3_9 # %bb.5: # %.lr.ph.preheader xorl %ecx, %ecx xorl %esi, %esi .p2align 4, 0x90 .LBB3_6: # %.lr.ph # =>This Inner Loop Header: Depth=1 movq %rsi, %rdx cmpq $99, %rsi je .LBB3_8 # %bb.7: # %.lr.ph.i11 # in Loop: Header=BB3_6 Depth=1 movl 4(%rax,%rdx,4), %edi addq $2, %rcx leaq 1(%rdx), %rsi cmpq %rdi, %rcx je .LBB3_6 .LBB3_8: # %_Z23checkElementsAreDoubledPii.exit.loopexit cmpq $99, %rdx movl $.L.str.1, %eax movl $.L.str.2, %esi cmovaeq %rax, %rsi .LBB3_9: # %_Z23checkElementsAreDoubledPii.exit movl $.L.str, %edi xorl %eax, %eax callq printf movq 8(%rsp), %rdi callq hipFree xorl %eax, %eax addq $104, %rsp .cfi_def_cfa_offset 8 retq .Lfunc_end3: .size main, .Lfunc_end3-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 .LBB4_2 # %bb.1: movl $__hip_fatbin_wrapper, %edi callq __hipRegisterFatBinary movq %rax, __hip_gpubin_handle(%rip) .LBB4_2: movq __hip_gpubin_handle(%rip), %rdi xorps %xmm0, %xmm0 movups %xmm0, 16(%rsp) movups %xmm0, (%rsp) movl $_Z14doubleElementsPii, %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_end4: .size __hip_module_ctor, .Lfunc_end4-__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 .LBB5_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 .LBB5_2: retq .Lfunc_end5: .size __hip_module_dtor, .Lfunc_end5-__hip_module_dtor .cfi_endproc # -- End function .type _Z14doubleElementsPii,@object # @_Z14doubleElementsPii .section .rodata,"a",@progbits .globl _Z14doubleElementsPii .p2align 3, 0x0 _Z14doubleElementsPii: .quad _Z29__device_stub__doubleElementsPii .size _Z14doubleElementsPii, 8 .type .L.str,@object # @.str .section .rodata.str1.1,"aMS",@progbits,1 .L.str: .asciz "All elements were doubled? %s\n" .size .L.str, 31 .type .L.str.1,@object # @.str.1 .L.str.1: .asciz "TRUE" .size .L.str.1, 5 .type .L.str.2,@object # @.str.2 .L.str.2: .asciz "FALSE" .size .L.str.2, 6 .type .L__unnamed_1,@object # @0 .L__unnamed_1: .asciz "_Z14doubleElementsPii" .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__doubleElementsPii .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z14doubleElementsPii .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 : _Z14doubleElementsPii .headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)" /*0000*/ MOV R1, c[0x0][0x28] ; /* 0x00000a0000017a02 */ /* 0x000fe40000000f00 */ /*0010*/ S2R R2, SR_CTAID.X ; /* 0x0000000000027919 */ /* 0x000e280000002500 */ /*0020*/ S2R R3, SR_TID.X ; /* 0x0000000000037919 */ /* 0x000e240000002100 */ /*0030*/ IMAD R2, R2, c[0x0][0x0], R3 ; /* 0x0000000002027a24 */ /* 0x001fca00078e0203 */ /*0040*/ ISETP.GE.AND P0, PT, R2, c[0x0][0x168], PT ; /* 0x00005a0002007a0c */ /* 0x000fda0003f06270 */ /*0050*/ @P0 EXIT ; /* 0x000000000000094d */ /* 0x000fea0003800000 */ /*0060*/ HFMA2.MMA R3, -RZ, RZ, 0, 2.384185791015625e-07 ; /* 0x00000004ff037435 */ /* 0x000fe200000001ff */ /*0070*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */ /* 0x000fd20000000a00 */ /*0080*/ IMAD.WIDE R2, R2, R3, c[0x0][0x160] ; /* 0x0000580002027625 */ /* 0x000fca00078e0203 */ /*0090*/ LDG.E R0, [R2.64] ; /* 0x0000000402007981 */ /* 0x000ea4000c1e1900 */ /*00a0*/ SHF.L.U32 R5, R0, 0x1, RZ ; /* 0x0000000100057819 */ /* 0x004fca00000006ff */ /*00b0*/ STG.E [R2.64], R5 ; /* 0x0000000502007986 */ /* 0x000fe2000c101904 */ /*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 _Z14doubleElementsPii .globl _Z14doubleElementsPii .p2align 8 .type _Z14doubleElementsPii,@function _Z14doubleElementsPii: s_clause 0x1 s_load_b32 s2, s[0:1], 0x1c s_load_b32 s3, s[0:1], 0x8 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_b64 s[0:1], s[0:1], 0x0 v_ashrrev_i32_e32 v2, 31, v1 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_lshlrev_b64 v[0:1], 2, v[1:2] s_waitcnt lgkmcnt(0) v_add_co_u32 v0, vcc_lo, s0, v0 s_delay_alu instid0(VALU_DEP_2) v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo global_load_b32 v2, v[0:1], off s_waitcnt vmcnt(0) v_lshlrev_b32_e32 v2, 1, v2 global_store_b32 v[0:1], v2, off .LBB0_2: s_nop 0 s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z14doubleElementsPii .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 3 .amdhsa_next_free_sgpr 16 .amdhsa_float_round_mode_32 0 .amdhsa_float_round_mode_16_64 0 .amdhsa_float_denorm_mode_32 3 .amdhsa_float_denorm_mode_16_64 3 .amdhsa_dx10_clamp 1 .amdhsa_ieee_mode 1 .amdhsa_fp16_overflow 0 .amdhsa_workgroup_processor_mode 1 .amdhsa_memory_ordered 1 .amdhsa_forward_progress 0 .amdhsa_shared_vgpr_count 0 .amdhsa_exception_fp_ieee_invalid_op 0 .amdhsa_exception_fp_denorm_src 0 .amdhsa_exception_fp_ieee_div_zero 0 .amdhsa_exception_fp_ieee_overflow 0 .amdhsa_exception_fp_ieee_underflow 0 .amdhsa_exception_fp_ieee_inexact 0 .amdhsa_exception_int_div_zero 0 .end_amdhsa_kernel .text .Lfunc_end0: .size _Z14doubleElementsPii, .Lfunc_end0-_Z14doubleElementsPii .section .AMDGPU.csdata,"",@progbits .text .p2alignl 7, 3214868480 .fill 96, 4, 3214868480 .type __hip_cuid_,@object .section .bss,"aw",@nobits .globl __hip_cuid_ __hip_cuid_: .byte 0 .size __hip_cuid_, 1 .ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)" .section ".note.GNU-stack","",@progbits .addrsig .addrsig_sym __hip_cuid_ .amdgpu_metadata --- amdhsa.kernels: - .args: - .address_space: global .offset: 0 .size: 8 .value_kind: global_buffer - .offset: 8 .size: 4 .value_kind: by_value - .offset: 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: _Z14doubleElementsPii .private_segment_fixed_size: 0 .sgpr_count: 18 .sgpr_spill_count: 0 .symbol: _Z14doubleElementsPii.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_0002d425_00000000-6_01-double-elements.cudafe1.cpp" .text #APP #NO_APP .type _ZL26__cudaUnregisterBinaryUtilv, @function _ZL26__cudaUnregisterBinaryUtilv: .LFB2062: .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 .LFE2062: .size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv .globl _Z4initPii .type _Z4initPii, @function _Z4initPii: .LFB2057: .cfi_startproc endbr64 testl %esi, %esi jle .L3 movslq %esi, %rsi movl $0, %eax .L5: movl %eax, (%rdi,%rax,4) addq $1, %rax cmpq %rsi, %rax jne .L5 .L3: ret .cfi_endproc .LFE2057: .size _Z4initPii, .-_Z4initPii .globl _Z23checkElementsAreDoubledPii .type _Z23checkElementsAreDoubledPii, @function _Z23checkElementsAreDoubledPii: .LFB2058: .cfi_startproc endbr64 testl %esi, %esi jle .L10 movslq %esi, %rsi movl $0, %eax .L9: leal (%rax,%rax), %edx cmpl %edx, (%rdi,%rax,4) jne .L11 addq $1, %rax cmpq %rsi, %rax jne .L9 movl $1, %eax ret .L10: movl $1, %eax ret .L11: movl $0, %eax ret .cfi_endproc .LFE2058: .size _Z23checkElementsAreDoubledPii, .-_Z23checkElementsAreDoubledPii .globl _Z35__device_stub__Z14doubleElementsPiiPii .type _Z35__device_stub__Z14doubleElementsPiiPii, @function _Z35__device_stub__Z14doubleElementsPiiPii: .LFB2084: .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 .L17 .L13: movq 104(%rsp), %rax subq %fs:40, %rax jne .L18 addq $120, %rsp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L17: .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 _Z14doubleElementsPii(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 128 jmp .L13 .L18: call __stack_chk_fail@PLT .cfi_endproc .LFE2084: .size _Z35__device_stub__Z14doubleElementsPiiPii, .-_Z35__device_stub__Z14doubleElementsPiiPii .globl _Z14doubleElementsPii .type _Z14doubleElementsPii, @function _Z14doubleElementsPii: .LFB2085: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z35__device_stub__Z14doubleElementsPiiPii addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2085: .size _Z14doubleElementsPii, .-_Z14doubleElementsPii .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "TRUE" .LC1: .string "FALSE" .section .rodata.str1.8,"aMS",@progbits,1 .align 8 .LC2: .string "All elements were doubled? %s\n" .text .globl main .type main, @function main: .LFB2059: .cfi_startproc endbr64 subq $56, %rsp .cfi_def_cfa_offset 64 movq %fs:40, %rax movq %rax, 40(%rsp) xorl %eax, %eax leaq 8(%rsp), %rdi movl $1, %edx movl $400, %esi call cudaMallocManaged@PLT movl $100, %esi movq 8(%rsp), %rdi call _Z4initPii movl $10, 28(%rsp) movl $1, 32(%rsp) movl $10, 16(%rsp) movl $1, 20(%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 .L27 .L22: call cudaDeviceSynchronize@PLT movl $100, %esi movq 8(%rsp), %rdi call _Z23checkElementsAreDoubledPii testb %al, %al leaq .LC1(%rip), %rdx leaq .LC0(%rip), %rax cmovne %rax, %rdx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movq 8(%rsp), %rdi call cudaFree@PLT movq 40(%rsp), %rax subq %fs:40, %rax jne .L28 movl $0, %eax addq $56, %rsp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L27: .cfi_restore_state movl $100, %esi movq 8(%rsp), %rdi call _Z35__device_stub__Z14doubleElementsPiiPii jmp .L22 .L28: call __stack_chk_fail@PLT .cfi_endproc .LFE2059: .size main, .-main .section .rodata.str1.1 .LC3: .string "_Z14doubleElementsPii" .text .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB2087: .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 .LC3(%rip), %rdx movq %rdx, %rcx leaq _Z14doubleElementsPii(%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 .LFE2087: .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 "01-double-elements.hip" .globl _Z4initPii # -- Begin function _Z4initPii .p2align 4, 0x90 .type _Z4initPii,@function _Z4initPii: # @_Z4initPii .cfi_startproc # %bb.0: testl %esi, %esi jle .LBB0_3 # %bb.1: # %.lr.ph.preheader movl %esi, %eax xorl %ecx, %ecx .p2align 4, 0x90 .LBB0_2: # %.lr.ph # =>This Inner Loop Header: Depth=1 movl %ecx, (%rdi,%rcx,4) incq %rcx cmpq %rcx, %rax jne .LBB0_2 .LBB0_3: # %._crit_edge retq .Lfunc_end0: .size _Z4initPii, .Lfunc_end0-_Z4initPii .cfi_endproc # -- End function .globl _Z29__device_stub__doubleElementsPii # -- Begin function _Z29__device_stub__doubleElementsPii .p2align 4, 0x90 .type _Z29__device_stub__doubleElementsPii,@function _Z29__device_stub__doubleElementsPii: # @_Z29__device_stub__doubleElementsPii .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 $_Z14doubleElementsPii, %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 _Z29__device_stub__doubleElementsPii, .Lfunc_end1-_Z29__device_stub__doubleElementsPii .cfi_endproc # -- End function .globl _Z23checkElementsAreDoubledPii # -- Begin function _Z23checkElementsAreDoubledPii .p2align 4, 0x90 .type _Z23checkElementsAreDoubledPii,@function _Z23checkElementsAreDoubledPii: # @_Z23checkElementsAreDoubledPii .cfi_startproc # %bb.0: testl %esi, %esi setle %al jle .LBB2_6 # %bb.1: # %.lr.ph.preheader cmpl $0, (%rdi) je .LBB2_2 .LBB2_6: # %._crit_edge retq .LBB2_2: # %.lr.ph12.preheader movl %esi, %eax xorl %ecx, %ecx .p2align 4, 0x90 .LBB2_3: # %.lr.ph12 # =>This Inner Loop Header: Depth=1 incq %rcx cmpq %rax, %rcx je .LBB2_5 # %bb.4: # %.lr.ph # in Loop: Header=BB2_3 Depth=1 movl (%rdi,%rcx,4), %edx leaq (%rcx,%rcx), %rsi cmpq %rdx, %rsi je .LBB2_3 .LBB2_5: # %._crit_edge.loopexit cmpq %rax, %rcx setae %al retq .Lfunc_end2: .size _Z23checkElementsAreDoubledPii, .Lfunc_end2-_Z23checkElementsAreDoubledPii .cfi_endproc # -- End function .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: subq $104, %rsp .cfi_def_cfa_offset 112 leaq 8(%rsp), %rdi movl $400, %esi # imm = 0x190 movl $1, %edx callq hipMallocManaged xorl %eax, %eax movq 8(%rsp), %rcx .p2align 4, 0x90 .LBB3_1: # %.lr.ph.i # =>This Inner Loop Header: Depth=1 movl %eax, (%rcx,%rax,4) incq %rax cmpq $100, %rax jne .LBB3_1 # %bb.2: # %_Z4initPii.exit movabsq $4294967306, %rdi # imm = 0x10000000A movl $1, %esi movq %rdi, %rdx movl $1, %ecx xorl %r8d, %r8d xorl %r9d, %r9d callq __hipPushCallConfiguration testl %eax, %eax jne .LBB3_4 # %bb.3: movq 8(%rsp), %rax movq %rax, 72(%rsp) movl $100, 20(%rsp) leaq 72(%rsp), %rax movq %rax, 80(%rsp) leaq 20(%rsp), %rax movq %rax, 88(%rsp) leaq 56(%rsp), %rdi leaq 40(%rsp), %rsi leaq 32(%rsp), %rdx leaq 24(%rsp), %rcx callq __hipPopCallConfiguration movq 56(%rsp), %rsi movl 64(%rsp), %edx movq 40(%rsp), %rcx movl 48(%rsp), %r8d leaq 80(%rsp), %r9 movl $_Z14doubleElementsPii, %edi pushq 24(%rsp) .cfi_adjust_cfa_offset 8 pushq 40(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $16, %rsp .cfi_adjust_cfa_offset -16 .LBB3_4: callq hipDeviceSynchronize movq 8(%rsp), %rax movl $.L.str.2, %esi cmpl $0, (%rax) jne .LBB3_9 # %bb.5: # %.lr.ph.preheader xorl %ecx, %ecx xorl %esi, %esi .p2align 4, 0x90 .LBB3_6: # %.lr.ph # =>This Inner Loop Header: Depth=1 movq %rsi, %rdx cmpq $99, %rsi je .LBB3_8 # %bb.7: # %.lr.ph.i11 # in Loop: Header=BB3_6 Depth=1 movl 4(%rax,%rdx,4), %edi addq $2, %rcx leaq 1(%rdx), %rsi cmpq %rdi, %rcx je .LBB3_6 .LBB3_8: # %_Z23checkElementsAreDoubledPii.exit.loopexit cmpq $99, %rdx movl $.L.str.1, %eax movl $.L.str.2, %esi cmovaeq %rax, %rsi .LBB3_9: # %_Z23checkElementsAreDoubledPii.exit movl $.L.str, %edi xorl %eax, %eax callq printf movq 8(%rsp), %rdi callq hipFree xorl %eax, %eax addq $104, %rsp .cfi_def_cfa_offset 8 retq .Lfunc_end3: .size main, .Lfunc_end3-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 .LBB4_2 # %bb.1: movl $__hip_fatbin_wrapper, %edi callq __hipRegisterFatBinary movq %rax, __hip_gpubin_handle(%rip) .LBB4_2: movq __hip_gpubin_handle(%rip), %rdi xorps %xmm0, %xmm0 movups %xmm0, 16(%rsp) movups %xmm0, (%rsp) movl $_Z14doubleElementsPii, %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_end4: .size __hip_module_ctor, .Lfunc_end4-__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 .LBB5_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 .LBB5_2: retq .Lfunc_end5: .size __hip_module_dtor, .Lfunc_end5-__hip_module_dtor .cfi_endproc # -- End function .type _Z14doubleElementsPii,@object # @_Z14doubleElementsPii .section .rodata,"a",@progbits .globl _Z14doubleElementsPii .p2align 3, 0x0 _Z14doubleElementsPii: .quad _Z29__device_stub__doubleElementsPii .size _Z14doubleElementsPii, 8 .type .L.str,@object # @.str .section .rodata.str1.1,"aMS",@progbits,1 .L.str: .asciz "All elements were doubled? %s\n" .size .L.str, 31 .type .L.str.1,@object # @.str.1 .L.str.1: .asciz "TRUE" .size .L.str.1, 5 .type .L.str.2,@object # @.str.2 .L.str.2: .asciz "FALSE" .size .L.str.2, 6 .type .L__unnamed_1,@object # @0 .L__unnamed_1: .asciz "_Z14doubleElementsPii" .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__doubleElementsPii .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z14doubleElementsPii .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 poli_warp(float* poli, const int N) { int idx = blockIdx.x * blockDim.x + threadIdx.x; float x; if (idx < N) { x = poli[idx]; poli[idx] = 5 + x * ( 7 - x * (9 + x * (5 + x * (5 + x))))- 1.0f/x + 3.0f/(x*x) + x/5.0f; } poli[idx] = x; }
code for sm_80 Function : _Z9poli_warpPfi .headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)" /*0000*/ IMAD.MOV.U32 R1, RZ, RZ, c[0x0][0x28] ; /* 0x00000a00ff017624 */ /* 0x000fe400078e00ff */ /*0010*/ S2R R2, SR_CTAID.X ; /* 0x0000000000027919 */ /* 0x000e220000002500 */ /*0020*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */ /* 0x000fe20000000a00 */ /*0030*/ BSSY B0, 0x470 ; /* 0x0000043000007945 */ /* 0x000fe40003800000 */ /*0040*/ S2R R3, SR_TID.X ; /* 0x0000000000037919 */ /* 0x000e240000002100 */ /*0050*/ IMAD R2, R2, c[0x0][0x0], R3 ; /* 0x0000000002027a24 */ /* 0x001fe400078e0203 */ /*0060*/ IMAD.MOV.U32 R3, RZ, RZ, 0x4 ; /* 0x00000004ff037424 */ /* 0x000fc600078e00ff */ /*0070*/ ISETP.GE.AND P0, PT, R2.reuse, c[0x0][0x168], PT ; /* 0x00005a0002007a0c */ /* 0x040fe20003f06270 */ /*0080*/ IMAD.WIDE R2, R2, R3, c[0x0][0x160] ; /* 0x0000580002027625 */ /* 0x000fd800078e0203 */ /*0090*/ @P0 BRA 0x460 ; /* 0x000003c000000947 */ /* 0x000fea0003800000 */ /*00a0*/ LDG.E R5, [R2.64] ; /* 0x0000000402057981 */ /* 0x000ea2000c1e1900 */ /*00b0*/ UMOV UR6, 0x3f800000 ; /* 0x3f80000000067882 */ /* 0x000fe20000000000 */ /*00c0*/ BSSY B1, 0x210 ; /* 0x0000014000017945 */ /* 0x000fe20003800000 */ /*00d0*/ IMAD.U32 R8, RZ, RZ, UR6 ; /* 0x00000006ff087e24 */ /* 0x000fe2000f8e00ff */ /*00e0*/ MUFU.RCP R4, R5 ; /* 0x0000000500047308 */ /* 0x004e220000001000 */ /*00f0*/ FADD R0, R5, 5 ; /* 0x40a0000005007421 */ /* 0x000fc80000000000 */ /*0100*/ FFMA R0, R5, R0, 5 ; /* 0x40a0000005007423 */ /* 0x000fc60000000000 */ /*0110*/ FCHK P0, -R8, R5 ; /* 0x0000000508007302 */ /* 0x000e620000000100 */ /*0120*/ FFMA R0, R5, R0, 9 ; /* 0x4110000005007423 */ /* 0x000fc80000000000 */ /*0130*/ FFMA R0, -R5.reuse, R0, 7 ; /* 0x40e0000005007423 */ /* 0x040fe40000000100 */ /*0140*/ FFMA R7, -R5.reuse, R4, 1 ; /* 0x3f80000005077423 */ /* 0x041fe40000000104 */ /*0150*/ FFMA R0, R5, R0, 5 ; /* 0x40a0000005007423 */ /* 0x000fe40000000000 */ /*0160*/ FFMA R7, R4, R7, R4 ; /* 0x0000000704077223 */ /* 0x000fc80000000004 */ /*0170*/ FFMA R4, R7, -1, RZ ; /* 0xbf80000007047823 */ /* 0x000fc800000000ff */ /*0180*/ FFMA R6, -R5, R4, -1 ; /* 0xbf80000005067423 */ /* 0x000fc80000000104 */ /*0190*/ FFMA R7, R7, R6, R4 ; /* 0x0000000607077223 */ /* 0x000fe20000000004 */ /*01a0*/ @!P0 BRA 0x200 ; /* 0x0000005000008947 */ /* 0x002fea0003800000 */ /*01b0*/ IMAD.MOV.U32 R10, RZ, RZ, -0x40800000 ; /* 0xbf800000ff0a7424 */ /* 0x000fe200078e00ff */ /*01c0*/ MOV R9, R5 ; /* 0x0000000500097202 */ /* 0x000fe40000000f00 */ /*01d0*/ MOV R4, 0x1f0 ; /* 0x000001f000047802 */ /* 0x000fe40000000f00 */ /*01e0*/ CALL.REL.NOINC 0x490 ; /* 0x000002a000007944 */ /* 0x000fea0003c00000 */ /*01f0*/ IMAD.MOV.U32 R7, RZ, RZ, R9 ; /* 0x000000ffff077224 */ /* 0x000fe400078e0009 */ /*0200*/ BSYNC B1 ; /* 0x0000000000017941 */ /* 0x000fea0003800000 */ /*0210*/ FMUL R4, R5, R5 ; /* 0x0000000505047220 */ /* 0x000fe20000400000 */ /*0220*/ UMOV UR6, 0x40400000 ; /* 0x4040000000067882 */ /* 0x000fe20000000000 */ /*0230*/ BSSY B1, 0x330 ; /* 0x000000f000017945 */ /* 0x000fe20003800000 */ /*0240*/ IMAD.U32 R11, RZ, RZ, UR6 ; /* 0x00000006ff0b7e24 */ /* 0x000fe2000f8e00ff */ /*0250*/ MUFU.RCP R9, R4 ; /* 0x0000000400097308 */ /* 0x000e220000001000 */ /*0260*/ FADD R0, R0, R7 ; /* 0x0000000700007221 */ /* 0x000fce0000000000 */ /*0270*/ FCHK P0, R11, R4 ; /* 0x000000040b007302 */ /* 0x000e620000000000 */ /*0280*/ FFMA R6, -R4, R9, 1 ; /* 0x3f80000004067423 */ /* 0x001fc80000000109 */ /*0290*/ FFMA R6, R9, R6, R9 ; /* 0x0000000609067223 */ /* 0x000fc80000000009 */ /*02a0*/ FFMA R9, R6, 3, RZ ; /* 0x4040000006097823 */ /* 0x000fc800000000ff */ /*02b0*/ FFMA R8, -R4, R9, 3 ; /* 0x4040000004087423 */ /* 0x000fc80000000109 */ /*02c0*/ FFMA R9, R6, R8, R9 ; /* 0x0000000806097223 */ /* 0x000fe20000000009 */ /*02d0*/ @!P0 BRA 0x320 ; /* 0x0000004000008947 */ /* 0x002fea0003800000 */ /*02e0*/ HFMA2.MMA R10, -RZ, RZ, 2.125, 0 ; /* 0x40400000ff0a7435 */ /* 0x000fe200000001ff */ /*02f0*/ IMAD.MOV.U32 R9, RZ, RZ, R4 ; /* 0x000000ffff097224 */ /* 0x000fe200078e0004 */ /*0300*/ MOV R4, 0x320 ; /* 0x0000032000047802 */ /* 0x000fc80000000f00 */ /*0310*/ CALL.REL.NOINC 0x490 ; /* 0x0000017000007944 */ /* 0x000fea0003c00000 */ /*0320*/ BSYNC B1 ; /* 0x0000000000017941 */ /* 0x000fea0003800000 */ /*0330*/ IMAD.MOV.U32 R7, RZ, RZ, 0x3e4ccccd ; /* 0x3e4ccccdff077424 */ /* 0x000fe200078e00ff */ /*0340*/ FCHK P0, R5, 5 ; /* 0x40a0000005007902 */ /* 0x000e220000000000 */ /*0350*/ IMAD.MOV.U32 R4, RZ, RZ, 0x3f800000 ; /* 0x3f800000ff047424 */ /* 0x000fe200078e00ff */ /*0360*/ BSSY B1, 0x440 ; /* 0x000000d000017945 */ /* 0x000fe20003800000 */ /*0370*/ FADD R0, R0, R9 ; /* 0x0000000900007221 */ /* 0x000fe40000000000 */ /*0380*/ FFMA R4, R7, -5, R4 ; /* 0xc0a0000007047823 */ /* 0x000fc80000000004 */ /*0390*/ FFMA R4, R4, R7, 0.20000000298023223877 ; /* 0x3e4ccccd04047423 */ /* 0x000fc80000000007 */ /*03a0*/ FFMA R6, R5, R4, RZ ; /* 0x0000000405067223 */ /* 0x000fc800000000ff */ /*03b0*/ FFMA R7, R6, -5, R5 ; /* 0xc0a0000006077823 */ /* 0x000fc80000000005 */ /*03c0*/ FFMA R7, R4, R7, R6 ; /* 0x0000000704077223 */ /* 0x000fe20000000006 */ /*03d0*/ @!P0 BRA 0x430 ; /* 0x0000005000008947 */ /* 0x001fea0003800000 */ /*03e0*/ IMAD.MOV.U32 R10, RZ, RZ, R5 ; /* 0x000000ffff0a7224 */ /* 0x000fe200078e0005 */ /*03f0*/ MOV R9, 0x40a00000 ; /* 0x40a0000000097802 */ /* 0x000fe40000000f00 */ /*0400*/ MOV R4, 0x420 ; /* 0x0000042000047802 */ /* 0x000fe40000000f00 */ /*0410*/ CALL.REL.NOINC 0x490 ; /* 0x0000007000007944 */ /* 0x000fea0003c00000 */ /*0420*/ IMAD.MOV.U32 R7, RZ, RZ, R9 ; /* 0x000000ffff077224 */ /* 0x000fe400078e0009 */ /*0430*/ BSYNC B1 ; /* 0x0000000000017941 */ /* 0x000fea0003800000 */ /*0440*/ FADD R7, R0, R7 ; /* 0x0000000700077221 */ /* 0x000fca0000000000 */ /*0450*/ STG.E [R2.64], R7 ; /* 0x0000000702007986 */ /* 0x0001e4000c101904 */ /*0460*/ BSYNC B0 ; /* 0x0000000000007941 */ /* 0x000fea0003800000 */ /*0470*/ STG.E [R2.64], R5 ; /* 0x0000000502007986 */ /* 0x000fe2000c101904 */ /*0480*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*0490*/ SHF.R.U32.HI R8, RZ, 0x17, R9 ; /* 0x00000017ff087819 */ /* 0x000fe20000011609 */ /*04a0*/ BSSY B2, 0xae0 ; /* 0x0000063000027945 */ /* 0x000fe20003800000 */ /*04b0*/ SHF.R.U32.HI R6, RZ, 0x17, R10.reuse ; /* 0x00000017ff067819 */ /* 0x100fe4000001160a */ /*04c0*/ LOP3.LUT R8, R8, 0xff, RZ, 0xc0, !PT ; /* 0x000000ff08087812 */ /* 0x000fe400078ec0ff */ /*04d0*/ LOP3.LUT R12, R6, 0xff, RZ, 0xc0, !PT ; /* 0x000000ff060c7812 */ /* 0x000fe200078ec0ff */ /*04e0*/ IMAD.MOV.U32 R6, RZ, RZ, R10 ; /* 0x000000ffff067224 */ /* 0x000fe200078e000a */ /*04f0*/ IADD3 R13, R8, -0x1, RZ ; /* 0xffffffff080d7810 */ /* 0x000fe40007ffe0ff */ /*0500*/ IADD3 R11, R12, -0x1, RZ ; /* 0xffffffff0c0b7810 */ /* 0x000fc40007ffe0ff */ /*0510*/ ISETP.GT.U32.AND P0, PT, R13, 0xfd, PT ; /* 0x000000fd0d00780c */ /* 0x000fc80003f04070 */ /*0520*/ ISETP.GT.U32.OR P0, PT, R11, 0xfd, P0 ; /* 0x000000fd0b00780c */ /* 0x000fda0000704470 */ /*0530*/ @!P0 IMAD.MOV.U32 R7, RZ, RZ, RZ ; /* 0x000000ffff078224 */ /* 0x000fe200078e00ff */ /*0540*/ @!P0 BRA 0x6c0 ; /* 0x0000017000008947 */ /* 0x000fea0003800000 */ /*0550*/ FSETP.GTU.FTZ.AND P0, PT, |R10|, +INF , PT ; /* 0x7f8000000a00780b */ /* 0x000fe40003f1c200 */ /*0560*/ FSETP.GTU.FTZ.AND P1, PT, |R9|, +INF , PT ; /* 0x7f8000000900780b */ /* 0x000fc80003f3c200 */ /*0570*/ PLOP3.LUT P0, PT, P0, P1, PT, 0xa8, 0x0 ; /* 0x000000000000781c */ /* 0x000fda0000703570 */ /*0580*/ @P0 BRA 0xac0 ; /* 0x0000053000000947 */ /* 0x000fea0003800000 */ /*0590*/ LOP3.LUT P0, RZ, R9, 0x7fffffff, R6, 0xc8, !PT ; /* 0x7fffffff09ff7812 */ /* 0x000fda000780c806 */ /*05a0*/ @!P0 BRA 0xaa0 ; /* 0x000004f000008947 */ /* 0x000fea0003800000 */ /*05b0*/ FSETP.NEU.FTZ.AND P2, PT, |R10|.reuse, +INF , PT ; /* 0x7f8000000a00780b */ /* 0x040fe40003f5d200 */ /*05c0*/ FSETP.NEU.FTZ.AND P1, PT, |R9|, +INF , PT ; /* 0x7f8000000900780b */ /* 0x000fe40003f3d200 */ /*05d0*/ FSETP.NEU.FTZ.AND P0, PT, |R10|, +INF , PT ; /* 0x7f8000000a00780b */ /* 0x000fd60003f1d200 */ /*05e0*/ @!P1 BRA !P2, 0xaa0 ; /* 0x000004b000009947 */ /* 0x000fea0005000000 */ /*05f0*/ LOP3.LUT P2, RZ, R6, 0x7fffffff, RZ, 0xc0, !PT ; /* 0x7fffffff06ff7812 */ /* 0x000fc8000784c0ff */ /*0600*/ PLOP3.LUT P1, PT, P1, P2, PT, 0x2a, 0x0 ; /* 0x000000000000781c */ /* 0x000fda0000f24572 */ /*0610*/ @P1 BRA 0xa80 ; /* 0x0000046000001947 */ /* 0x000fea0003800000 */ /*0620*/ LOP3.LUT P1, RZ, R9, 0x7fffffff, RZ, 0xc0, !PT ; /* 0x7fffffff09ff7812 */ /* 0x000fc8000782c0ff */ /*0630*/ PLOP3.LUT P0, PT, P0, P1, PT, 0x2a, 0x0 ; /* 0x000000000000781c */ /* 0x000fda0000702572 */ /*0640*/ @P0 BRA 0xa50 ; /* 0x0000040000000947 */ /* 0x000fea0003800000 */ /*0650*/ ISETP.GE.AND P0, PT, R11, RZ, PT ; /* 0x000000ff0b00720c */ /* 0x000fe40003f06270 */ /*0660*/ ISETP.GE.AND P1, PT, R13, RZ, PT ; /* 0x000000ff0d00720c */ /* 0x000fd60003f26270 */ /*0670*/ @P0 MOV R7, RZ ; /* 0x000000ff00070202 */ /* 0x000fe20000000f00 */ /*0680*/ @!P0 IMAD.MOV.U32 R7, RZ, RZ, -0x40 ; /* 0xffffffc0ff078424 */ /* 0x000fe400078e00ff */ /*0690*/ @!P0 FFMA R6, R10, 1.84467440737095516160e+19, RZ ; /* 0x5f8000000a068823 */ /* 0x000fe400000000ff */ /*06a0*/ @!P1 FFMA R9, R9, 1.84467440737095516160e+19, RZ ; /* 0x5f80000009099823 */ /* 0x000fe200000000ff */ /*06b0*/ @!P1 IADD3 R7, R7, 0x40, RZ ; /* 0x0000004007079810 */ /* 0x000fe40007ffe0ff */ /*06c0*/ LEA R10, R8, 0xc0800000, 0x17 ; /* 0xc0800000080a7811 */ /* 0x000fe200078eb8ff */ /*06d0*/ BSSY B3, 0xa40 ; /* 0x0000036000037945 */ /* 0x000fe80003800000 */ /*06e0*/ IMAD.IADD R10, R9, 0x1, -R10 ; /* 0x00000001090a7824 */ /* 0x000fe200078e0a0a */ /*06f0*/ IADD3 R9, R12, -0x7f, RZ ; /* 0xffffff810c097810 */ /* 0x000fc60007ffe0ff */ /*0700*/ MUFU.RCP R11, R10 ; /* 0x0000000a000b7308 */ /* 0x0000620000001000 */ /*0710*/ FADD.FTZ R13, -R10, -RZ ; /* 0x800000ff0a0d7221 */ /* 0x000fe40000010100 */ /*0720*/ IMAD R6, R9.reuse, -0x800000, R6 ; /* 0xff80000009067824 */ /* 0x040fe200078e0206 */ /*0730*/ IADD3 R10, R9, 0x7f, -R8 ; /* 0x0000007f090a7810 */ /* 0x001fca0007ffe808 */ /*0740*/ IMAD.IADD R7, R10, 0x1, R7 ; /* 0x000000010a077824 */ /* 0x000fe400078e0207 */ /*0750*/ FFMA R12, R11, R13, 1 ; /* 0x3f8000000b0c7423 */ /* 0x002fc8000000000d */ /*0760*/ FFMA R15, R11, R12, R11 ; /* 0x0000000c0b0f7223 */ /* 0x000fc8000000000b */ /*0770*/ FFMA R11, R6, R15, RZ ; /* 0x0000000f060b7223 */ /* 0x000fc800000000ff */ /*0780*/ FFMA R12, R13, R11, R6 ; /* 0x0000000b0d0c7223 */ /* 0x000fc80000000006 */ /*0790*/ FFMA R12, R15, R12, R11 ; /* 0x0000000c0f0c7223 */ /* 0x000fc8000000000b */ /*07a0*/ FFMA R13, R13, R12, R6 ; /* 0x0000000c0d0d7223 */ /* 0x000fc80000000006 */ /*07b0*/ FFMA R6, R15, R13, R12 ; /* 0x0000000d0f067223 */ /* 0x000fca000000000c */ /*07c0*/ SHF.R.U32.HI R8, RZ, 0x17, R6 ; /* 0x00000017ff087819 */ /* 0x000fc80000011606 */ /*07d0*/ LOP3.LUT R8, R8, 0xff, RZ, 0xc0, !PT ; /* 0x000000ff08087812 */ /* 0x000fc800078ec0ff */ /*07e0*/ IADD3 R11, R8, R7, RZ ; /* 0x00000007080b7210 */ /* 0x000fc80007ffe0ff */ /*07f0*/ IADD3 R8, R11, -0x1, RZ ; /* 0xffffffff0b087810 */ /* 0x000fc80007ffe0ff */ /*0800*/ ISETP.GE.U32.AND P0, PT, R8, 0xfe, PT ; /* 0x000000fe0800780c */ /* 0x000fda0003f06070 */ /*0810*/ @!P0 BRA 0xa20 ; /* 0x0000020000008947 */ /* 0x000fea0003800000 */ /*0820*/ ISETP.GT.AND P0, PT, R11, 0xfe, PT ; /* 0x000000fe0b00780c */ /* 0x000fda0003f04270 */ /*0830*/ @P0 BRA 0x9f0 ; /* 0x000001b000000947 */ /* 0x000fea0003800000 */ /*0840*/ ISETP.GE.AND P0, PT, R11, 0x1, PT ; /* 0x000000010b00780c */ /* 0x000fda0003f06270 */ /*0850*/ @P0 BRA 0xa30 ; /* 0x000001d000000947 */ /* 0x000fea0003800000 */ /*0860*/ ISETP.GE.AND P0, PT, R11, -0x18, PT ; /* 0xffffffe80b00780c */ /* 0x000fe40003f06270 */ /*0870*/ LOP3.LUT R6, R6, 0x80000000, RZ, 0xc0, !PT ; /* 0x8000000006067812 */ /* 0x000fd600078ec0ff */ /*0880*/ @!P0 BRA 0xa30 ; /* 0x000001a000008947 */ /* 0x000fea0003800000 */ /*0890*/ FFMA.RZ R7, R15, R13.reuse, R12.reuse ; /* 0x0000000d0f077223 */ /* 0x180fe2000000c00c */ /*08a0*/ IADD3 R10, R11, 0x20, RZ ; /* 0x000000200b0a7810 */ /* 0x000fe20007ffe0ff */ /*08b0*/ FFMA.RM R8, R15, R13.reuse, R12.reuse ; /* 0x0000000d0f087223 */ /* 0x180fe2000000400c */ /*08c0*/ ISETP.NE.AND P2, PT, R11, RZ, PT ; /* 0x000000ff0b00720c */ /* 0x000fe40003f45270 */ /*08d0*/ LOP3.LUT R9, R7, 0x7fffff, RZ, 0xc0, !PT ; /* 0x007fffff07097812 */ /* 0x000fe200078ec0ff */ /*08e0*/ FFMA.RP R7, R15, R13, R12 ; /* 0x0000000d0f077223 */ /* 0x000fe2000000800c */ /*08f0*/ ISETP.NE.AND P1, PT, R11, RZ, PT ; /* 0x000000ff0b00720c */ /* 0x000fe20003f25270 */ /*0900*/ IMAD.MOV R11, RZ, RZ, -R11 ; /* 0x000000ffff0b7224 */ /* 0x000fe200078e0a0b */ /*0910*/ LOP3.LUT R9, R9, 0x800000, RZ, 0xfc, !PT ; /* 0x0080000009097812 */ /* 0x000fe400078efcff */ /*0920*/ FSETP.NEU.FTZ.AND P0, PT, R7, R8, PT ; /* 0x000000080700720b */ /* 0x000fc40003f1d000 */ /*0930*/ SHF.L.U32 R10, R9, R10, RZ ; /* 0x0000000a090a7219 */ /* 0x000fe400000006ff */ /*0940*/ SEL R8, R11, RZ, P2 ; /* 0x000000ff0b087207 */ /* 0x000fe40001000000 */ /*0950*/ ISETP.NE.AND P1, PT, R10, RZ, P1 ; /* 0x000000ff0a00720c */ /* 0x000fe40000f25270 */ /*0960*/ SHF.R.U32.HI R8, RZ, R8, R9 ; /* 0x00000008ff087219 */ /* 0x000fe40000011609 */ /*0970*/ PLOP3.LUT P0, PT, P0, P1, PT, 0xa8, 0x0 ; /* 0x000000000000781c */ /* 0x000fe40000703570 */ /*0980*/ SHF.R.U32.HI R10, RZ, 0x1, R8 ; /* 0x00000001ff0a7819 */ /* 0x000fc40000011608 */ /*0990*/ SEL R7, RZ, 0x1, !P0 ; /* 0x00000001ff077807 */ /* 0x000fc80004000000 */ /*09a0*/ LOP3.LUT R7, R7, 0x1, R10, 0xf8, !PT ; /* 0x0000000107077812 */ /* 0x000fc800078ef80a */ /*09b0*/ LOP3.LUT R7, R7, R8, RZ, 0xc0, !PT ; /* 0x0000000807077212 */ /* 0x000fca00078ec0ff */ /*09c0*/ IMAD.IADD R7, R10, 0x1, R7 ; /* 0x000000010a077824 */ /* 0x000fca00078e0207 */ /*09d0*/ LOP3.LUT R6, R7, R6, RZ, 0xfc, !PT ; /* 0x0000000607067212 */ /* 0x000fe200078efcff */ /*09e0*/ BRA 0xa30 ; /* 0x0000004000007947 */ /* 0x000fea0003800000 */ /*09f0*/ LOP3.LUT R6, R6, 0x80000000, RZ, 0xc0, !PT ; /* 0x8000000006067812 */ /* 0x000fc800078ec0ff */ /*0a00*/ LOP3.LUT R6, R6, 0x7f800000, RZ, 0xfc, !PT ; /* 0x7f80000006067812 */ /* 0x000fe200078efcff */ /*0a10*/ BRA 0xa30 ; /* 0x0000001000007947 */ /* 0x000fea0003800000 */ /*0a20*/ IMAD R6, R7, 0x800000, R6 ; /* 0x0080000007067824 */ /* 0x000fe400078e0206 */ /*0a30*/ BSYNC B3 ; /* 0x0000000000037941 */ /* 0x000fea0003800000 */ /*0a40*/ BRA 0xad0 ; /* 0x0000008000007947 */ /* 0x000fea0003800000 */ /*0a50*/ LOP3.LUT R6, R9, 0x80000000, R6, 0x48, !PT ; /* 0x8000000009067812 */ /* 0x000fc800078e4806 */ /*0a60*/ LOP3.LUT R6, R6, 0x7f800000, RZ, 0xfc, !PT ; /* 0x7f80000006067812 */ /* 0x000fe200078efcff */ /*0a70*/ BRA 0xad0 ; /* 0x0000005000007947 */ /* 0x000fea0003800000 */ /*0a80*/ LOP3.LUT R6, R9, 0x80000000, R6, 0x48, !PT ; /* 0x8000000009067812 */ /* 0x000fe200078e4806 */ /*0a90*/ BRA 0xad0 ; /* 0x0000003000007947 */ /* 0x000fea0003800000 */ /*0aa0*/ MUFU.RSQ R6, -QNAN ; /* 0xffc0000000067908 */ /* 0x000e220000001400 */ /*0ab0*/ BRA 0xad0 ; /* 0x0000001000007947 */ /* 0x000fea0003800000 */ /*0ac0*/ FADD.FTZ R6, R10, R9 ; /* 0x000000090a067221 */ /* 0x000fe40000010000 */ /*0ad0*/ BSYNC B2 ; /* 0x0000000000027941 */ /* 0x000fea0003800000 */ /*0ae0*/ MOV R9, R6 ; /* 0x0000000600097202 */ /* 0x001fe20000000f00 */ /*0af0*/ IMAD.MOV.U32 R6, RZ, RZ, R4 ; /* 0x000000ffff067224 */ /* 0x000fe400078e0004 */ /*0b00*/ IMAD.MOV.U32 R7, RZ, RZ, 0x0 ; /* 0x00000000ff077424 */ /* 0x000fc800078e00ff */ /*0b10*/ RET.REL.NODEC R6 0x0 ; /* 0xfffff4e006007950 */ /* 0x000fea0003c3ffff */ /*0b20*/ BRA 0xb20; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*0b30*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0b40*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0b50*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0b60*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0b70*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0b80*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0b90*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0ba0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0bb0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0bc0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0bd0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0be0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0bf0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ ..........
You are a helpful coding assistant specialized in converting CUDA source code to CUDA host assembly.
#include "includes.h" __global__ void poli_warp(float* poli, const int N) { int idx = blockIdx.x * blockDim.x + threadIdx.x; float x; if (idx < N) { x = poli[idx]; poli[idx] = 5 + x * ( 7 - x * (9 + x * (5 + x * (5 + x))))- 1.0f/x + 3.0f/(x*x) + x/5.0f; } poli[idx] = x; }
.file "tmpxft_00169747_00000000-6_poli_warp.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__Z9poli_warpPfiPfi .type _Z29__device_stub__Z9poli_warpPfiPfi, @function _Z29__device_stub__Z9poli_warpPfiPfi: .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 _Z9poli_warpPfi(%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__Z9poli_warpPfiPfi, .-_Z29__device_stub__Z9poli_warpPfiPfi .globl _Z9poli_warpPfi .type _Z9poli_warpPfi, @function _Z9poli_warpPfi: .LFB2052: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z29__device_stub__Z9poli_warpPfiPfi addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2052: .size _Z9poli_warpPfi, .-_Z9poli_warpPfi .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "_Z9poli_warpPfi" .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 _Z9poli_warpPfi(%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 poli_warp(float* poli, const int N) { int idx = blockIdx.x * blockDim.x + threadIdx.x; float x; if (idx < N) { x = poli[idx]; poli[idx] = 5 + x * ( 7 - x * (9 + x * (5 + x * (5 + x))))- 1.0f/x + 3.0f/(x*x) + x/5.0f; } poli[idx] = x; }
#include <hip/hip_runtime.h> #include "includes.h" __global__ void poli_warp(float* poli, const int N) { int idx = blockIdx.x * blockDim.x + threadIdx.x; float x; if (idx < N) { x = poli[idx]; poli[idx] = 5 + x * ( 7 - x * (9 + x * (5 + x * (5 + x))))- 1.0f/x + 3.0f/(x*x) + x/5.0f; } poli[idx] = x; }
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 poli_warp(float* poli, const int N) { int idx = blockIdx.x * blockDim.x + threadIdx.x; float x; if (idx < N) { x = poli[idx]; poli[idx] = 5 + x * ( 7 - x * (9 + x * (5 + x * (5 + x))))- 1.0f/x + 3.0f/(x*x) + x/5.0f; } poli[idx] = x; }
.text .amdgcn_target "amdgcn-amd-amdhsa--gfx1100" .protected _Z9poli_warpPfi .globl _Z9poli_warpPfi .p2align 8 .type _Z9poli_warpPfi,@function _Z9poli_warpPfi: s_clause 0x2 s_load_b32 s4, s[0:1], 0x1c s_load_b32 s5, s[0:1], 0x8 s_load_b64 s[2:3], s[0:1], 0x0 s_waitcnt lgkmcnt(0) s_and_b32 s0, s4, 0xffff s_mov_b32 s4, exec_lo v_mad_u64_u32 v[1:2], null, s15, s0, v[0:1] s_delay_alu instid0(VALU_DEP_1) v_ashrrev_i32_e32 v2, 31, v1 v_cmpx_gt_i32_e64 s5, v1 s_cbranch_execz .LBB0_2 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1) v_lshlrev_b64 v[3:4], 2, v[1:2] v_add_co_u32 v3, vcc_lo, s2, v3 s_delay_alu instid0(VALU_DEP_2) v_add_co_ci_u32_e32 v4, vcc_lo, s3, v4, vcc_lo global_load_b32 v0, v[3:4], off s_waitcnt vmcnt(0) v_div_scale_f32 v5, null, v0, v0, -1.0 v_div_scale_f32 v14, vcc_lo, -1.0, v0, -1.0 v_div_scale_f32 v9, null, 0x40a00000, 0x40a00000, v0 s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1) v_rcp_f32_e32 v7, v5 v_rcp_f32_e32 v11, v9 s_waitcnt_depctr 0xfff v_fma_f32 v12, -v5, v7, 1.0 v_fma_f32 v16, -v9, v11, 1.0 s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3) v_fmac_f32_e32 v7, v12, v7 v_mul_f32_e32 v6, v0, v0 v_fmac_f32_e32 v11, v16, v11 s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3) v_mul_f32_e32 v17, v14, v7 v_div_scale_f32 v8, null, v6, v6, 0x40400000 v_div_scale_f32 v15, s0, 0x40400000, v6, 0x40400000 s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3) v_fma_f32 v18, -v5, v17, v14 v_rcp_f32_e32 v10, v8 s_waitcnt_depctr 0xfff v_fma_f32 v12, -v8, v10, 1.0 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2) v_dual_add_f32 v13, 0x40a00000, v0 :: v_dual_fmac_f32 v10, v12, v10 v_div_scale_f32 v12, s1, v0, 0x40a00000, v0 v_dual_mul_f32 v16, v15, v10 :: v_dual_fmac_f32 v17, v18, v7 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2) v_fma_f32 v19, -v8, v16, v15 v_fma_f32 v5, -v5, v17, v14 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_dual_fmaak_f32 v13, v0, v13, 0x40a00000 :: v_dual_fmac_f32 v16, v19, v10 v_div_fmas_f32 v5, v5, v7, v17 s_mov_b32 vcc_lo, s0 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_fma_f32 v8, -v8, v16, v15 v_div_fixup_f32 v5, v5, v0, -1.0 v_mul_f32_e32 v18, v12, v11 s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_2) v_div_fmas_f32 v8, v8, v10, v16 s_mov_b32 vcc_lo, s1 v_fma_f32 v14, -v9, v18, v12 v_fmaak_f32 v13, v0, v13, 0x41100000 s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3) v_div_fixup_f32 v6, v8, v6, 0x40400000 v_fmac_f32_e32 v18, v14, v11 s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2) v_fma_f32 v13, -v0, v13, 0x40e00000 v_fma_f32 v9, -v9, v18, v12 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1) v_fmaak_f32 v7, v0, v13, 0x40a00000 v_add_f32_e32 v5, v7, v5 s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2) v_div_fmas_f32 v7, v9, v11, v18 v_add_f32_e32 v5, v6, v5 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1) v_div_fixup_f32 v6, v7, 0x40a00000, v0 v_add_f32_e32 v5, v6, v5 global_store_b32 v[3:4], v5, off .LBB0_2: s_or_b32 exec_lo, exec_lo, s4 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1) v_lshlrev_b64 v[1:2], 2, v[1:2] v_add_co_u32 v1, vcc_lo, s2, v1 s_delay_alu instid0(VALU_DEP_2) v_add_co_ci_u32_e32 v2, vcc_lo, s3, v2, vcc_lo global_store_b32 v[1:2], v0, off s_nop 0 s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z9poli_warpPfi .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 20 .amdhsa_next_free_sgpr 16 .amdhsa_float_round_mode_32 0 .amdhsa_float_round_mode_16_64 0 .amdhsa_float_denorm_mode_32 3 .amdhsa_float_denorm_mode_16_64 3 .amdhsa_dx10_clamp 1 .amdhsa_ieee_mode 1 .amdhsa_fp16_overflow 0 .amdhsa_workgroup_processor_mode 1 .amdhsa_memory_ordered 1 .amdhsa_forward_progress 0 .amdhsa_shared_vgpr_count 0 .amdhsa_exception_fp_ieee_invalid_op 0 .amdhsa_exception_fp_denorm_src 0 .amdhsa_exception_fp_ieee_div_zero 0 .amdhsa_exception_fp_ieee_overflow 0 .amdhsa_exception_fp_ieee_underflow 0 .amdhsa_exception_fp_ieee_inexact 0 .amdhsa_exception_int_div_zero 0 .end_amdhsa_kernel .text .Lfunc_end0: .size _Z9poli_warpPfi, .Lfunc_end0-_Z9poli_warpPfi .section .AMDGPU.csdata,"",@progbits .text .p2alignl 7, 3214868480 .fill 96, 4, 3214868480 .type __hip_cuid_,@object .section .bss,"aw",@nobits .globl __hip_cuid_ __hip_cuid_: .byte 0 .size __hip_cuid_, 1 .ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)" .section ".note.GNU-stack","",@progbits .addrsig .addrsig_sym __hip_cuid_ .amdgpu_metadata --- amdhsa.kernels: - .args: - .address_space: global .offset: 0 .size: 8 .value_kind: global_buffer - .offset: 8 .size: 4 .value_kind: by_value - .offset: 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: _Z9poli_warpPfi .private_segment_fixed_size: 0 .sgpr_count: 18 .sgpr_spill_count: 0 .symbol: _Z9poli_warpPfi.kd .uniform_work_group_size: 1 .uses_dynamic_stack: false .vgpr_count: 20 .vgpr_spill_count: 0 .wavefront_size: 32 .workgroup_processor_mode: 1 amdhsa.target: amdgcn-amd-amdhsa--gfx1100 amdhsa.version: - 1 - 2 ... .end_amdgpu_metadata
You are a helpful coding assistant specialized in converting HIP source code to AMD host assembly.
#include <hip/hip_runtime.h> #include "includes.h" __global__ void poli_warp(float* poli, const int N) { int idx = blockIdx.x * blockDim.x + threadIdx.x; float x; if (idx < N) { x = poli[idx]; poli[idx] = 5 + x * ( 7 - x * (9 + x * (5 + x * (5 + x))))- 1.0f/x + 3.0f/(x*x) + x/5.0f; } poli[idx] = x; }
.text .file "poli_warp.hip" .globl _Z24__device_stub__poli_warpPfi # -- Begin function _Z24__device_stub__poli_warpPfi .p2align 4, 0x90 .type _Z24__device_stub__poli_warpPfi,@function _Z24__device_stub__poli_warpPfi: # @_Z24__device_stub__poli_warpPfi .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 $_Z9poli_warpPfi, %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 _Z24__device_stub__poli_warpPfi, .Lfunc_end0-_Z24__device_stub__poli_warpPfi .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 $_Z9poli_warpPfi, %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 _Z9poli_warpPfi,@object # @_Z9poli_warpPfi .section .rodata,"a",@progbits .globl _Z9poli_warpPfi .p2align 3, 0x0 _Z9poli_warpPfi: .quad _Z24__device_stub__poli_warpPfi .size _Z9poli_warpPfi, 8 .type .L__unnamed_1,@object # @0 .section .rodata.str1.1,"aMS",@progbits,1 .L__unnamed_1: .asciz "_Z9poli_warpPfi" .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 _Z24__device_stub__poli_warpPfi .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z9poli_warpPfi .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 : _Z9poli_warpPfi .headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)" /*0000*/ IMAD.MOV.U32 R1, RZ, RZ, c[0x0][0x28] ; /* 0x00000a00ff017624 */ /* 0x000fe400078e00ff */ /*0010*/ S2R R2, SR_CTAID.X ; /* 0x0000000000027919 */ /* 0x000e220000002500 */ /*0020*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */ /* 0x000fe20000000a00 */ /*0030*/ BSSY B0, 0x470 ; /* 0x0000043000007945 */ /* 0x000fe40003800000 */ /*0040*/ S2R R3, SR_TID.X ; /* 0x0000000000037919 */ /* 0x000e240000002100 */ /*0050*/ IMAD R2, R2, c[0x0][0x0], R3 ; /* 0x0000000002027a24 */ /* 0x001fe400078e0203 */ /*0060*/ IMAD.MOV.U32 R3, RZ, RZ, 0x4 ; /* 0x00000004ff037424 */ /* 0x000fc600078e00ff */ /*0070*/ ISETP.GE.AND P0, PT, R2.reuse, c[0x0][0x168], PT ; /* 0x00005a0002007a0c */ /* 0x040fe20003f06270 */ /*0080*/ IMAD.WIDE R2, R2, R3, c[0x0][0x160] ; /* 0x0000580002027625 */ /* 0x000fd800078e0203 */ /*0090*/ @P0 BRA 0x460 ; /* 0x000003c000000947 */ /* 0x000fea0003800000 */ /*00a0*/ LDG.E R5, [R2.64] ; /* 0x0000000402057981 */ /* 0x000ea2000c1e1900 */ /*00b0*/ UMOV UR6, 0x3f800000 ; /* 0x3f80000000067882 */ /* 0x000fe20000000000 */ /*00c0*/ BSSY B1, 0x210 ; /* 0x0000014000017945 */ /* 0x000fe20003800000 */ /*00d0*/ IMAD.U32 R8, RZ, RZ, UR6 ; /* 0x00000006ff087e24 */ /* 0x000fe2000f8e00ff */ /*00e0*/ MUFU.RCP R4, R5 ; /* 0x0000000500047308 */ /* 0x004e220000001000 */ /*00f0*/ FADD R0, R5, 5 ; /* 0x40a0000005007421 */ /* 0x000fc80000000000 */ /*0100*/ FFMA R0, R5, R0, 5 ; /* 0x40a0000005007423 */ /* 0x000fc60000000000 */ /*0110*/ FCHK P0, -R8, R5 ; /* 0x0000000508007302 */ /* 0x000e620000000100 */ /*0120*/ FFMA R0, R5, R0, 9 ; /* 0x4110000005007423 */ /* 0x000fc80000000000 */ /*0130*/ FFMA R0, -R5.reuse, R0, 7 ; /* 0x40e0000005007423 */ /* 0x040fe40000000100 */ /*0140*/ FFMA R7, -R5.reuse, R4, 1 ; /* 0x3f80000005077423 */ /* 0x041fe40000000104 */ /*0150*/ FFMA R0, R5, R0, 5 ; /* 0x40a0000005007423 */ /* 0x000fe40000000000 */ /*0160*/ FFMA R7, R4, R7, R4 ; /* 0x0000000704077223 */ /* 0x000fc80000000004 */ /*0170*/ FFMA R4, R7, -1, RZ ; /* 0xbf80000007047823 */ /* 0x000fc800000000ff */ /*0180*/ FFMA R6, -R5, R4, -1 ; /* 0xbf80000005067423 */ /* 0x000fc80000000104 */ /*0190*/ FFMA R7, R7, R6, R4 ; /* 0x0000000607077223 */ /* 0x000fe20000000004 */ /*01a0*/ @!P0 BRA 0x200 ; /* 0x0000005000008947 */ /* 0x002fea0003800000 */ /*01b0*/ IMAD.MOV.U32 R10, RZ, RZ, -0x40800000 ; /* 0xbf800000ff0a7424 */ /* 0x000fe200078e00ff */ /*01c0*/ MOV R9, R5 ; /* 0x0000000500097202 */ /* 0x000fe40000000f00 */ /*01d0*/ MOV R4, 0x1f0 ; /* 0x000001f000047802 */ /* 0x000fe40000000f00 */ /*01e0*/ CALL.REL.NOINC 0x490 ; /* 0x000002a000007944 */ /* 0x000fea0003c00000 */ /*01f0*/ IMAD.MOV.U32 R7, RZ, RZ, R9 ; /* 0x000000ffff077224 */ /* 0x000fe400078e0009 */ /*0200*/ BSYNC B1 ; /* 0x0000000000017941 */ /* 0x000fea0003800000 */ /*0210*/ FMUL R4, R5, R5 ; /* 0x0000000505047220 */ /* 0x000fe20000400000 */ /*0220*/ UMOV UR6, 0x40400000 ; /* 0x4040000000067882 */ /* 0x000fe20000000000 */ /*0230*/ BSSY B1, 0x330 ; /* 0x000000f000017945 */ /* 0x000fe20003800000 */ /*0240*/ IMAD.U32 R11, RZ, RZ, UR6 ; /* 0x00000006ff0b7e24 */ /* 0x000fe2000f8e00ff */ /*0250*/ MUFU.RCP R9, R4 ; /* 0x0000000400097308 */ /* 0x000e220000001000 */ /*0260*/ FADD R0, R0, R7 ; /* 0x0000000700007221 */ /* 0x000fce0000000000 */ /*0270*/ FCHK P0, R11, R4 ; /* 0x000000040b007302 */ /* 0x000e620000000000 */ /*0280*/ FFMA R6, -R4, R9, 1 ; /* 0x3f80000004067423 */ /* 0x001fc80000000109 */ /*0290*/ FFMA R6, R9, R6, R9 ; /* 0x0000000609067223 */ /* 0x000fc80000000009 */ /*02a0*/ FFMA R9, R6, 3, RZ ; /* 0x4040000006097823 */ /* 0x000fc800000000ff */ /*02b0*/ FFMA R8, -R4, R9, 3 ; /* 0x4040000004087423 */ /* 0x000fc80000000109 */ /*02c0*/ FFMA R9, R6, R8, R9 ; /* 0x0000000806097223 */ /* 0x000fe20000000009 */ /*02d0*/ @!P0 BRA 0x320 ; /* 0x0000004000008947 */ /* 0x002fea0003800000 */ /*02e0*/ HFMA2.MMA R10, -RZ, RZ, 2.125, 0 ; /* 0x40400000ff0a7435 */ /* 0x000fe200000001ff */ /*02f0*/ IMAD.MOV.U32 R9, RZ, RZ, R4 ; /* 0x000000ffff097224 */ /* 0x000fe200078e0004 */ /*0300*/ MOV R4, 0x320 ; /* 0x0000032000047802 */ /* 0x000fc80000000f00 */ /*0310*/ CALL.REL.NOINC 0x490 ; /* 0x0000017000007944 */ /* 0x000fea0003c00000 */ /*0320*/ BSYNC B1 ; /* 0x0000000000017941 */ /* 0x000fea0003800000 */ /*0330*/ IMAD.MOV.U32 R7, RZ, RZ, 0x3e4ccccd ; /* 0x3e4ccccdff077424 */ /* 0x000fe200078e00ff */ /*0340*/ FCHK P0, R5, 5 ; /* 0x40a0000005007902 */ /* 0x000e220000000000 */ /*0350*/ IMAD.MOV.U32 R4, RZ, RZ, 0x3f800000 ; /* 0x3f800000ff047424 */ /* 0x000fe200078e00ff */ /*0360*/ BSSY B1, 0x440 ; /* 0x000000d000017945 */ /* 0x000fe20003800000 */ /*0370*/ FADD R0, R0, R9 ; /* 0x0000000900007221 */ /* 0x000fe40000000000 */ /*0380*/ FFMA R4, R7, -5, R4 ; /* 0xc0a0000007047823 */ /* 0x000fc80000000004 */ /*0390*/ FFMA R4, R4, R7, 0.20000000298023223877 ; /* 0x3e4ccccd04047423 */ /* 0x000fc80000000007 */ /*03a0*/ FFMA R6, R5, R4, RZ ; /* 0x0000000405067223 */ /* 0x000fc800000000ff */ /*03b0*/ FFMA R7, R6, -5, R5 ; /* 0xc0a0000006077823 */ /* 0x000fc80000000005 */ /*03c0*/ FFMA R7, R4, R7, R6 ; /* 0x0000000704077223 */ /* 0x000fe20000000006 */ /*03d0*/ @!P0 BRA 0x430 ; /* 0x0000005000008947 */ /* 0x001fea0003800000 */ /*03e0*/ IMAD.MOV.U32 R10, RZ, RZ, R5 ; /* 0x000000ffff0a7224 */ /* 0x000fe200078e0005 */ /*03f0*/ MOV R9, 0x40a00000 ; /* 0x40a0000000097802 */ /* 0x000fe40000000f00 */ /*0400*/ MOV R4, 0x420 ; /* 0x0000042000047802 */ /* 0x000fe40000000f00 */ /*0410*/ CALL.REL.NOINC 0x490 ; /* 0x0000007000007944 */ /* 0x000fea0003c00000 */ /*0420*/ IMAD.MOV.U32 R7, RZ, RZ, R9 ; /* 0x000000ffff077224 */ /* 0x000fe400078e0009 */ /*0430*/ BSYNC B1 ; /* 0x0000000000017941 */ /* 0x000fea0003800000 */ /*0440*/ FADD R7, R0, R7 ; /* 0x0000000700077221 */ /* 0x000fca0000000000 */ /*0450*/ STG.E [R2.64], R7 ; /* 0x0000000702007986 */ /* 0x0001e4000c101904 */ /*0460*/ BSYNC B0 ; /* 0x0000000000007941 */ /* 0x000fea0003800000 */ /*0470*/ STG.E [R2.64], R5 ; /* 0x0000000502007986 */ /* 0x000fe2000c101904 */ /*0480*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*0490*/ SHF.R.U32.HI R8, RZ, 0x17, R9 ; /* 0x00000017ff087819 */ /* 0x000fe20000011609 */ /*04a0*/ BSSY B2, 0xae0 ; /* 0x0000063000027945 */ /* 0x000fe20003800000 */ /*04b0*/ SHF.R.U32.HI R6, RZ, 0x17, R10.reuse ; /* 0x00000017ff067819 */ /* 0x100fe4000001160a */ /*04c0*/ LOP3.LUT R8, R8, 0xff, RZ, 0xc0, !PT ; /* 0x000000ff08087812 */ /* 0x000fe400078ec0ff */ /*04d0*/ LOP3.LUT R12, R6, 0xff, RZ, 0xc0, !PT ; /* 0x000000ff060c7812 */ /* 0x000fe200078ec0ff */ /*04e0*/ IMAD.MOV.U32 R6, RZ, RZ, R10 ; /* 0x000000ffff067224 */ /* 0x000fe200078e000a */ /*04f0*/ IADD3 R13, R8, -0x1, RZ ; /* 0xffffffff080d7810 */ /* 0x000fe40007ffe0ff */ /*0500*/ IADD3 R11, R12, -0x1, RZ ; /* 0xffffffff0c0b7810 */ /* 0x000fc40007ffe0ff */ /*0510*/ ISETP.GT.U32.AND P0, PT, R13, 0xfd, PT ; /* 0x000000fd0d00780c */ /* 0x000fc80003f04070 */ /*0520*/ ISETP.GT.U32.OR P0, PT, R11, 0xfd, P0 ; /* 0x000000fd0b00780c */ /* 0x000fda0000704470 */ /*0530*/ @!P0 IMAD.MOV.U32 R7, RZ, RZ, RZ ; /* 0x000000ffff078224 */ /* 0x000fe200078e00ff */ /*0540*/ @!P0 BRA 0x6c0 ; /* 0x0000017000008947 */ /* 0x000fea0003800000 */ /*0550*/ FSETP.GTU.FTZ.AND P0, PT, |R10|, +INF , PT ; /* 0x7f8000000a00780b */ /* 0x000fe40003f1c200 */ /*0560*/ FSETP.GTU.FTZ.AND P1, PT, |R9|, +INF , PT ; /* 0x7f8000000900780b */ /* 0x000fc80003f3c200 */ /*0570*/ PLOP3.LUT P0, PT, P0, P1, PT, 0xa8, 0x0 ; /* 0x000000000000781c */ /* 0x000fda0000703570 */ /*0580*/ @P0 BRA 0xac0 ; /* 0x0000053000000947 */ /* 0x000fea0003800000 */ /*0590*/ LOP3.LUT P0, RZ, R9, 0x7fffffff, R6, 0xc8, !PT ; /* 0x7fffffff09ff7812 */ /* 0x000fda000780c806 */ /*05a0*/ @!P0 BRA 0xaa0 ; /* 0x000004f000008947 */ /* 0x000fea0003800000 */ /*05b0*/ FSETP.NEU.FTZ.AND P2, PT, |R10|.reuse, +INF , PT ; /* 0x7f8000000a00780b */ /* 0x040fe40003f5d200 */ /*05c0*/ FSETP.NEU.FTZ.AND P1, PT, |R9|, +INF , PT ; /* 0x7f8000000900780b */ /* 0x000fe40003f3d200 */ /*05d0*/ FSETP.NEU.FTZ.AND P0, PT, |R10|, +INF , PT ; /* 0x7f8000000a00780b */ /* 0x000fd60003f1d200 */ /*05e0*/ @!P1 BRA !P2, 0xaa0 ; /* 0x000004b000009947 */ /* 0x000fea0005000000 */ /*05f0*/ LOP3.LUT P2, RZ, R6, 0x7fffffff, RZ, 0xc0, !PT ; /* 0x7fffffff06ff7812 */ /* 0x000fc8000784c0ff */ /*0600*/ PLOP3.LUT P1, PT, P1, P2, PT, 0x2a, 0x0 ; /* 0x000000000000781c */ /* 0x000fda0000f24572 */ /*0610*/ @P1 BRA 0xa80 ; /* 0x0000046000001947 */ /* 0x000fea0003800000 */ /*0620*/ LOP3.LUT P1, RZ, R9, 0x7fffffff, RZ, 0xc0, !PT ; /* 0x7fffffff09ff7812 */ /* 0x000fc8000782c0ff */ /*0630*/ PLOP3.LUT P0, PT, P0, P1, PT, 0x2a, 0x0 ; /* 0x000000000000781c */ /* 0x000fda0000702572 */ /*0640*/ @P0 BRA 0xa50 ; /* 0x0000040000000947 */ /* 0x000fea0003800000 */ /*0650*/ ISETP.GE.AND P0, PT, R11, RZ, PT ; /* 0x000000ff0b00720c */ /* 0x000fe40003f06270 */ /*0660*/ ISETP.GE.AND P1, PT, R13, RZ, PT ; /* 0x000000ff0d00720c */ /* 0x000fd60003f26270 */ /*0670*/ @P0 MOV R7, RZ ; /* 0x000000ff00070202 */ /* 0x000fe20000000f00 */ /*0680*/ @!P0 IMAD.MOV.U32 R7, RZ, RZ, -0x40 ; /* 0xffffffc0ff078424 */ /* 0x000fe400078e00ff */ /*0690*/ @!P0 FFMA R6, R10, 1.84467440737095516160e+19, RZ ; /* 0x5f8000000a068823 */ /* 0x000fe400000000ff */ /*06a0*/ @!P1 FFMA R9, R9, 1.84467440737095516160e+19, RZ ; /* 0x5f80000009099823 */ /* 0x000fe200000000ff */ /*06b0*/ @!P1 IADD3 R7, R7, 0x40, RZ ; /* 0x0000004007079810 */ /* 0x000fe40007ffe0ff */ /*06c0*/ LEA R10, R8, 0xc0800000, 0x17 ; /* 0xc0800000080a7811 */ /* 0x000fe200078eb8ff */ /*06d0*/ BSSY B3, 0xa40 ; /* 0x0000036000037945 */ /* 0x000fe80003800000 */ /*06e0*/ IMAD.IADD R10, R9, 0x1, -R10 ; /* 0x00000001090a7824 */ /* 0x000fe200078e0a0a */ /*06f0*/ IADD3 R9, R12, -0x7f, RZ ; /* 0xffffff810c097810 */ /* 0x000fc60007ffe0ff */ /*0700*/ MUFU.RCP R11, R10 ; /* 0x0000000a000b7308 */ /* 0x0000620000001000 */ /*0710*/ FADD.FTZ R13, -R10, -RZ ; /* 0x800000ff0a0d7221 */ /* 0x000fe40000010100 */ /*0720*/ IMAD R6, R9.reuse, -0x800000, R6 ; /* 0xff80000009067824 */ /* 0x040fe200078e0206 */ /*0730*/ IADD3 R10, R9, 0x7f, -R8 ; /* 0x0000007f090a7810 */ /* 0x001fca0007ffe808 */ /*0740*/ IMAD.IADD R7, R10, 0x1, R7 ; /* 0x000000010a077824 */ /* 0x000fe400078e0207 */ /*0750*/ FFMA R12, R11, R13, 1 ; /* 0x3f8000000b0c7423 */ /* 0x002fc8000000000d */ /*0760*/ FFMA R15, R11, R12, R11 ; /* 0x0000000c0b0f7223 */ /* 0x000fc8000000000b */ /*0770*/ FFMA R11, R6, R15, RZ ; /* 0x0000000f060b7223 */ /* 0x000fc800000000ff */ /*0780*/ FFMA R12, R13, R11, R6 ; /* 0x0000000b0d0c7223 */ /* 0x000fc80000000006 */ /*0790*/ FFMA R12, R15, R12, R11 ; /* 0x0000000c0f0c7223 */ /* 0x000fc8000000000b */ /*07a0*/ FFMA R13, R13, R12, R6 ; /* 0x0000000c0d0d7223 */ /* 0x000fc80000000006 */ /*07b0*/ FFMA R6, R15, R13, R12 ; /* 0x0000000d0f067223 */ /* 0x000fca000000000c */ /*07c0*/ SHF.R.U32.HI R8, RZ, 0x17, R6 ; /* 0x00000017ff087819 */ /* 0x000fc80000011606 */ /*07d0*/ LOP3.LUT R8, R8, 0xff, RZ, 0xc0, !PT ; /* 0x000000ff08087812 */ /* 0x000fc800078ec0ff */ /*07e0*/ IADD3 R11, R8, R7, RZ ; /* 0x00000007080b7210 */ /* 0x000fc80007ffe0ff */ /*07f0*/ IADD3 R8, R11, -0x1, RZ ; /* 0xffffffff0b087810 */ /* 0x000fc80007ffe0ff */ /*0800*/ ISETP.GE.U32.AND P0, PT, R8, 0xfe, PT ; /* 0x000000fe0800780c */ /* 0x000fda0003f06070 */ /*0810*/ @!P0 BRA 0xa20 ; /* 0x0000020000008947 */ /* 0x000fea0003800000 */ /*0820*/ ISETP.GT.AND P0, PT, R11, 0xfe, PT ; /* 0x000000fe0b00780c */ /* 0x000fda0003f04270 */ /*0830*/ @P0 BRA 0x9f0 ; /* 0x000001b000000947 */ /* 0x000fea0003800000 */ /*0840*/ ISETP.GE.AND P0, PT, R11, 0x1, PT ; /* 0x000000010b00780c */ /* 0x000fda0003f06270 */ /*0850*/ @P0 BRA 0xa30 ; /* 0x000001d000000947 */ /* 0x000fea0003800000 */ /*0860*/ ISETP.GE.AND P0, PT, R11, -0x18, PT ; /* 0xffffffe80b00780c */ /* 0x000fe40003f06270 */ /*0870*/ LOP3.LUT R6, R6, 0x80000000, RZ, 0xc0, !PT ; /* 0x8000000006067812 */ /* 0x000fd600078ec0ff */ /*0880*/ @!P0 BRA 0xa30 ; /* 0x000001a000008947 */ /* 0x000fea0003800000 */ /*0890*/ FFMA.RZ R7, R15, R13.reuse, R12.reuse ; /* 0x0000000d0f077223 */ /* 0x180fe2000000c00c */ /*08a0*/ IADD3 R10, R11, 0x20, RZ ; /* 0x000000200b0a7810 */ /* 0x000fe20007ffe0ff */ /*08b0*/ FFMA.RM R8, R15, R13.reuse, R12.reuse ; /* 0x0000000d0f087223 */ /* 0x180fe2000000400c */ /*08c0*/ ISETP.NE.AND P2, PT, R11, RZ, PT ; /* 0x000000ff0b00720c */ /* 0x000fe40003f45270 */ /*08d0*/ LOP3.LUT R9, R7, 0x7fffff, RZ, 0xc0, !PT ; /* 0x007fffff07097812 */ /* 0x000fe200078ec0ff */ /*08e0*/ FFMA.RP R7, R15, R13, R12 ; /* 0x0000000d0f077223 */ /* 0x000fe2000000800c */ /*08f0*/ ISETP.NE.AND P1, PT, R11, RZ, PT ; /* 0x000000ff0b00720c */ /* 0x000fe20003f25270 */ /*0900*/ IMAD.MOV R11, RZ, RZ, -R11 ; /* 0x000000ffff0b7224 */ /* 0x000fe200078e0a0b */ /*0910*/ LOP3.LUT R9, R9, 0x800000, RZ, 0xfc, !PT ; /* 0x0080000009097812 */ /* 0x000fe400078efcff */ /*0920*/ FSETP.NEU.FTZ.AND P0, PT, R7, R8, PT ; /* 0x000000080700720b */ /* 0x000fc40003f1d000 */ /*0930*/ SHF.L.U32 R10, R9, R10, RZ ; /* 0x0000000a090a7219 */ /* 0x000fe400000006ff */ /*0940*/ SEL R8, R11, RZ, P2 ; /* 0x000000ff0b087207 */ /* 0x000fe40001000000 */ /*0950*/ ISETP.NE.AND P1, PT, R10, RZ, P1 ; /* 0x000000ff0a00720c */ /* 0x000fe40000f25270 */ /*0960*/ SHF.R.U32.HI R8, RZ, R8, R9 ; /* 0x00000008ff087219 */ /* 0x000fe40000011609 */ /*0970*/ PLOP3.LUT P0, PT, P0, P1, PT, 0xa8, 0x0 ; /* 0x000000000000781c */ /* 0x000fe40000703570 */ /*0980*/ SHF.R.U32.HI R10, RZ, 0x1, R8 ; /* 0x00000001ff0a7819 */ /* 0x000fc40000011608 */ /*0990*/ SEL R7, RZ, 0x1, !P0 ; /* 0x00000001ff077807 */ /* 0x000fc80004000000 */ /*09a0*/ LOP3.LUT R7, R7, 0x1, R10, 0xf8, !PT ; /* 0x0000000107077812 */ /* 0x000fc800078ef80a */ /*09b0*/ LOP3.LUT R7, R7, R8, RZ, 0xc0, !PT ; /* 0x0000000807077212 */ /* 0x000fca00078ec0ff */ /*09c0*/ IMAD.IADD R7, R10, 0x1, R7 ; /* 0x000000010a077824 */ /* 0x000fca00078e0207 */ /*09d0*/ LOP3.LUT R6, R7, R6, RZ, 0xfc, !PT ; /* 0x0000000607067212 */ /* 0x000fe200078efcff */ /*09e0*/ BRA 0xa30 ; /* 0x0000004000007947 */ /* 0x000fea0003800000 */ /*09f0*/ LOP3.LUT R6, R6, 0x80000000, RZ, 0xc0, !PT ; /* 0x8000000006067812 */ /* 0x000fc800078ec0ff */ /*0a00*/ LOP3.LUT R6, R6, 0x7f800000, RZ, 0xfc, !PT ; /* 0x7f80000006067812 */ /* 0x000fe200078efcff */ /*0a10*/ BRA 0xa30 ; /* 0x0000001000007947 */ /* 0x000fea0003800000 */ /*0a20*/ IMAD R6, R7, 0x800000, R6 ; /* 0x0080000007067824 */ /* 0x000fe400078e0206 */ /*0a30*/ BSYNC B3 ; /* 0x0000000000037941 */ /* 0x000fea0003800000 */ /*0a40*/ BRA 0xad0 ; /* 0x0000008000007947 */ /* 0x000fea0003800000 */ /*0a50*/ LOP3.LUT R6, R9, 0x80000000, R6, 0x48, !PT ; /* 0x8000000009067812 */ /* 0x000fc800078e4806 */ /*0a60*/ LOP3.LUT R6, R6, 0x7f800000, RZ, 0xfc, !PT ; /* 0x7f80000006067812 */ /* 0x000fe200078efcff */ /*0a70*/ BRA 0xad0 ; /* 0x0000005000007947 */ /* 0x000fea0003800000 */ /*0a80*/ LOP3.LUT R6, R9, 0x80000000, R6, 0x48, !PT ; /* 0x8000000009067812 */ /* 0x000fe200078e4806 */ /*0a90*/ BRA 0xad0 ; /* 0x0000003000007947 */ /* 0x000fea0003800000 */ /*0aa0*/ MUFU.RSQ R6, -QNAN ; /* 0xffc0000000067908 */ /* 0x000e220000001400 */ /*0ab0*/ BRA 0xad0 ; /* 0x0000001000007947 */ /* 0x000fea0003800000 */ /*0ac0*/ FADD.FTZ R6, R10, R9 ; /* 0x000000090a067221 */ /* 0x000fe40000010000 */ /*0ad0*/ BSYNC B2 ; /* 0x0000000000027941 */ /* 0x000fea0003800000 */ /*0ae0*/ MOV R9, R6 ; /* 0x0000000600097202 */ /* 0x001fe20000000f00 */ /*0af0*/ IMAD.MOV.U32 R6, RZ, RZ, R4 ; /* 0x000000ffff067224 */ /* 0x000fe400078e0004 */ /*0b00*/ IMAD.MOV.U32 R7, RZ, RZ, 0x0 ; /* 0x00000000ff077424 */ /* 0x000fc800078e00ff */ /*0b10*/ RET.REL.NODEC R6 0x0 ; /* 0xfffff4e006007950 */ /* 0x000fea0003c3ffff */ /*0b20*/ BRA 0xb20; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*0b30*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0b40*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0b50*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0b60*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0b70*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0b80*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0b90*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0ba0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0bb0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0bc0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0bd0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0be0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0bf0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ ..........
.text .amdgcn_target "amdgcn-amd-amdhsa--gfx1100" .protected _Z9poli_warpPfi .globl _Z9poli_warpPfi .p2align 8 .type _Z9poli_warpPfi,@function _Z9poli_warpPfi: s_clause 0x2 s_load_b32 s4, s[0:1], 0x1c s_load_b32 s5, s[0:1], 0x8 s_load_b64 s[2:3], s[0:1], 0x0 s_waitcnt lgkmcnt(0) s_and_b32 s0, s4, 0xffff s_mov_b32 s4, exec_lo v_mad_u64_u32 v[1:2], null, s15, s0, v[0:1] s_delay_alu instid0(VALU_DEP_1) v_ashrrev_i32_e32 v2, 31, v1 v_cmpx_gt_i32_e64 s5, v1 s_cbranch_execz .LBB0_2 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1) v_lshlrev_b64 v[3:4], 2, v[1:2] v_add_co_u32 v3, vcc_lo, s2, v3 s_delay_alu instid0(VALU_DEP_2) v_add_co_ci_u32_e32 v4, vcc_lo, s3, v4, vcc_lo global_load_b32 v0, v[3:4], off s_waitcnt vmcnt(0) v_div_scale_f32 v5, null, v0, v0, -1.0 v_div_scale_f32 v14, vcc_lo, -1.0, v0, -1.0 v_div_scale_f32 v9, null, 0x40a00000, 0x40a00000, v0 s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1) v_rcp_f32_e32 v7, v5 v_rcp_f32_e32 v11, v9 s_waitcnt_depctr 0xfff v_fma_f32 v12, -v5, v7, 1.0 v_fma_f32 v16, -v9, v11, 1.0 s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3) v_fmac_f32_e32 v7, v12, v7 v_mul_f32_e32 v6, v0, v0 v_fmac_f32_e32 v11, v16, v11 s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3) v_mul_f32_e32 v17, v14, v7 v_div_scale_f32 v8, null, v6, v6, 0x40400000 v_div_scale_f32 v15, s0, 0x40400000, v6, 0x40400000 s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3) v_fma_f32 v18, -v5, v17, v14 v_rcp_f32_e32 v10, v8 s_waitcnt_depctr 0xfff v_fma_f32 v12, -v8, v10, 1.0 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2) v_dual_add_f32 v13, 0x40a00000, v0 :: v_dual_fmac_f32 v10, v12, v10 v_div_scale_f32 v12, s1, v0, 0x40a00000, v0 v_dual_mul_f32 v16, v15, v10 :: v_dual_fmac_f32 v17, v18, v7 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2) v_fma_f32 v19, -v8, v16, v15 v_fma_f32 v5, -v5, v17, v14 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_dual_fmaak_f32 v13, v0, v13, 0x40a00000 :: v_dual_fmac_f32 v16, v19, v10 v_div_fmas_f32 v5, v5, v7, v17 s_mov_b32 vcc_lo, s0 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_fma_f32 v8, -v8, v16, v15 v_div_fixup_f32 v5, v5, v0, -1.0 v_mul_f32_e32 v18, v12, v11 s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_2) v_div_fmas_f32 v8, v8, v10, v16 s_mov_b32 vcc_lo, s1 v_fma_f32 v14, -v9, v18, v12 v_fmaak_f32 v13, v0, v13, 0x41100000 s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3) v_div_fixup_f32 v6, v8, v6, 0x40400000 v_fmac_f32_e32 v18, v14, v11 s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2) v_fma_f32 v13, -v0, v13, 0x40e00000 v_fma_f32 v9, -v9, v18, v12 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1) v_fmaak_f32 v7, v0, v13, 0x40a00000 v_add_f32_e32 v5, v7, v5 s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2) v_div_fmas_f32 v7, v9, v11, v18 v_add_f32_e32 v5, v6, v5 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1) v_div_fixup_f32 v6, v7, 0x40a00000, v0 v_add_f32_e32 v5, v6, v5 global_store_b32 v[3:4], v5, off .LBB0_2: s_or_b32 exec_lo, exec_lo, s4 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1) v_lshlrev_b64 v[1:2], 2, v[1:2] v_add_co_u32 v1, vcc_lo, s2, v1 s_delay_alu instid0(VALU_DEP_2) v_add_co_ci_u32_e32 v2, vcc_lo, s3, v2, vcc_lo global_store_b32 v[1:2], v0, off s_nop 0 s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z9poli_warpPfi .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 20 .amdhsa_next_free_sgpr 16 .amdhsa_float_round_mode_32 0 .amdhsa_float_round_mode_16_64 0 .amdhsa_float_denorm_mode_32 3 .amdhsa_float_denorm_mode_16_64 3 .amdhsa_dx10_clamp 1 .amdhsa_ieee_mode 1 .amdhsa_fp16_overflow 0 .amdhsa_workgroup_processor_mode 1 .amdhsa_memory_ordered 1 .amdhsa_forward_progress 0 .amdhsa_shared_vgpr_count 0 .amdhsa_exception_fp_ieee_invalid_op 0 .amdhsa_exception_fp_denorm_src 0 .amdhsa_exception_fp_ieee_div_zero 0 .amdhsa_exception_fp_ieee_overflow 0 .amdhsa_exception_fp_ieee_underflow 0 .amdhsa_exception_fp_ieee_inexact 0 .amdhsa_exception_int_div_zero 0 .end_amdhsa_kernel .text .Lfunc_end0: .size _Z9poli_warpPfi, .Lfunc_end0-_Z9poli_warpPfi .section .AMDGPU.csdata,"",@progbits .text .p2alignl 7, 3214868480 .fill 96, 4, 3214868480 .type __hip_cuid_,@object .section .bss,"aw",@nobits .globl __hip_cuid_ __hip_cuid_: .byte 0 .size __hip_cuid_, 1 .ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)" .section ".note.GNU-stack","",@progbits .addrsig .addrsig_sym __hip_cuid_ .amdgpu_metadata --- amdhsa.kernels: - .args: - .address_space: global .offset: 0 .size: 8 .value_kind: global_buffer - .offset: 8 .size: 4 .value_kind: by_value - .offset: 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: _Z9poli_warpPfi .private_segment_fixed_size: 0 .sgpr_count: 18 .sgpr_spill_count: 0 .symbol: _Z9poli_warpPfi.kd .uniform_work_group_size: 1 .uses_dynamic_stack: false .vgpr_count: 20 .vgpr_spill_count: 0 .wavefront_size: 32 .workgroup_processor_mode: 1 amdhsa.target: amdgcn-amd-amdhsa--gfx1100 amdhsa.version: - 1 - 2 ... .end_amdgpu_metadata
You are a helpful coding assistant specialized in converting from CUDA host assembly to AMD host assembly.
.file "tmpxft_00169747_00000000-6_poli_warp.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__Z9poli_warpPfiPfi .type _Z29__device_stub__Z9poli_warpPfiPfi, @function _Z29__device_stub__Z9poli_warpPfiPfi: .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 _Z9poli_warpPfi(%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__Z9poli_warpPfiPfi, .-_Z29__device_stub__Z9poli_warpPfiPfi .globl _Z9poli_warpPfi .type _Z9poli_warpPfi, @function _Z9poli_warpPfi: .LFB2052: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z29__device_stub__Z9poli_warpPfiPfi addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2052: .size _Z9poli_warpPfi, .-_Z9poli_warpPfi .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "_Z9poli_warpPfi" .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 _Z9poli_warpPfi(%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 "poli_warp.hip" .globl _Z24__device_stub__poli_warpPfi # -- Begin function _Z24__device_stub__poli_warpPfi .p2align 4, 0x90 .type _Z24__device_stub__poli_warpPfi,@function _Z24__device_stub__poli_warpPfi: # @_Z24__device_stub__poli_warpPfi .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 $_Z9poli_warpPfi, %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 _Z24__device_stub__poli_warpPfi, .Lfunc_end0-_Z24__device_stub__poli_warpPfi .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 $_Z9poli_warpPfi, %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 _Z9poli_warpPfi,@object # @_Z9poli_warpPfi .section .rodata,"a",@progbits .globl _Z9poli_warpPfi .p2align 3, 0x0 _Z9poli_warpPfi: .quad _Z24__device_stub__poli_warpPfi .size _Z9poli_warpPfi, 8 .type .L__unnamed_1,@object # @0 .section .rodata.str1.1,"aMS",@progbits,1 .L__unnamed_1: .asciz "_Z9poli_warpPfi" .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 _Z24__device_stub__poli_warpPfi .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z9poli_warpPfi .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> #include<stdlib.h> #define N 1024 //N*N行列 __global__ void matrix_transpose(int *g_A, int *g_B) { int gx = blockIdx.x*32 + threadIdx.x; int gy = blockIdx.y*32 + threadIdx.y; g_B[gx * N + gy] = g_A[gy * N + gx]; } int main() { int *h_A, *h_B, *d_A, *d_B; h_A = (int*)malloc(N*N*sizeof(int)); h_B = (int*)malloc(N*N*sizeof(int)); cudaMalloc(&d_A, N*N*sizeof(int)); cudaMalloc(&d_B, N*N*sizeof(int)); for(int i=0; i<N*N; i++) h_A[i] = i; cudaMemcpy(d_A, h_A, N*N*sizeof(int), cudaMemcpyHostToDevice); dim3 grid(32, 32); dim3 block(32, 32); matrix_transpose<<< grid, block >>>(d_A, d_B); cudaMemcpy(h_B, d_B, N*N*sizeof(int), cudaMemcpyDeviceToHost); int flag = 0; for(int y=0;y<N;y++) for(int x=0;x<N;x++) if(h_A[y*N+x]!=h_B[x*N+y]){ flag = 1; break; } if(flag==0) printf("OK\n"); else printf("NG\n"); free(h_A); free(h_B); cudaFree(d_A); cudaFree(d_B); }
code for sm_80 Function : _Z16matrix_transposePiS_ .headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)" /*0000*/ MOV R1, c[0x0][0x28] ; /* 0x00000a0000017a02 */ /* 0x000fe40000000f00 */ /*0010*/ S2R R0, SR_CTAID.X ; /* 0x0000000000007919 */ /* 0x000e220000002500 */ /*0020*/ IMAD.MOV.U32 R4, RZ, RZ, 0x4 ; /* 0x00000004ff047424 */ /* 0x000fe200078e00ff */ /*0030*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */ /* 0x000fe40000000a00 */ /*0040*/ S2R R3, SR_TID.X ; /* 0x0000000000037919 */ /* 0x000e280000002100 */ /*0050*/ S2R R5, SR_CTAID.Y ; /* 0x0000000000057919 */ /* 0x000e680000002600 */ /*0060*/ S2R R2, SR_TID.Y ; /* 0x0000000000027919 */ /* 0x000e620000002200 */ /*0070*/ LEA R0, R0, R3, 0x5 ; /* 0x0000000300007211 */ /* 0x001fc400078e28ff */ /*0080*/ LEA R5, R5, R2, 0x5 ; /* 0x0000000205057211 */ /* 0x002fc800078e28ff */ /*0090*/ LEA R2, R5, R0, 0xa ; /* 0x0000000005027211 */ /* 0x000fca00078e50ff */ /*00a0*/ IMAD.WIDE R2, R2, R4, c[0x0][0x160] ; /* 0x0000580002027625 */ /* 0x000fcc00078e0204 */ /*00b0*/ LDG.E R3, [R2.64] ; /* 0x0000000402037981 */ /* 0x000ea2000c1e1900 */ /*00c0*/ IMAD R5, R0, 0x400, R5 ; /* 0x0000040000057824 */ /* 0x000fc800078e0205 */ /*00d0*/ IMAD.WIDE R4, R5, R4, c[0x0][0x168] ; /* 0x00005a0005047625 */ /* 0x000fca00078e0204 */ /*00e0*/ STG.E [R4.64], R3 ; /* 0x0000000304007986 */ /* 0x004fe2000c101904 */ /*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<stdio.h> #include<stdlib.h> #define N 1024 //N*N行列 __global__ void matrix_transpose(int *g_A, int *g_B) { int gx = blockIdx.x*32 + threadIdx.x; int gy = blockIdx.y*32 + threadIdx.y; g_B[gx * N + gy] = g_A[gy * N + gx]; } int main() { int *h_A, *h_B, *d_A, *d_B; h_A = (int*)malloc(N*N*sizeof(int)); h_B = (int*)malloc(N*N*sizeof(int)); cudaMalloc(&d_A, N*N*sizeof(int)); cudaMalloc(&d_B, N*N*sizeof(int)); for(int i=0; i<N*N; i++) h_A[i] = i; cudaMemcpy(d_A, h_A, N*N*sizeof(int), cudaMemcpyHostToDevice); dim3 grid(32, 32); dim3 block(32, 32); matrix_transpose<<< grid, block >>>(d_A, d_B); cudaMemcpy(h_B, d_B, N*N*sizeof(int), cudaMemcpyDeviceToHost); int flag = 0; for(int y=0;y<N;y++) for(int x=0;x<N;x++) if(h_A[y*N+x]!=h_B[x*N+y]){ flag = 1; break; } if(flag==0) printf("OK\n"); else printf("NG\n"); free(h_A); free(h_B); cudaFree(d_A); cudaFree(d_B); }
.file "tmpxft_00174ee4_00000000-6_matrix_transpose.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 _Z38__device_stub__Z16matrix_transposePiS_PiS_ .type _Z38__device_stub__Z16matrix_transposePiS_PiS_, @function _Z38__device_stub__Z16matrix_transposePiS_PiS_: .LFB2082: .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 _Z16matrix_transposePiS_(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 128 jmp .L3 .L8: call __stack_chk_fail@PLT .cfi_endproc .LFE2082: .size _Z38__device_stub__Z16matrix_transposePiS_PiS_, .-_Z38__device_stub__Z16matrix_transposePiS_PiS_ .globl _Z16matrix_transposePiS_ .type _Z16matrix_transposePiS_, @function _Z16matrix_transposePiS_: .LFB2083: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z38__device_stub__Z16matrix_transposePiS_PiS_ addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2083: .size _Z16matrix_transposePiS_, .-_Z16matrix_transposePiS_ .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "OK\n" .LC1: .string "NG\n" .text .globl main .type main, @function main: .LFB2057: .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 $56, %rsp .cfi_def_cfa_offset 80 movq %fs:40, %rax movq %rax, 40(%rsp) xorl %eax, %eax movl $4194304, %edi call malloc@PLT movq %rax, %rbx movl $4194304, %edi call malloc@PLT movq %rax, %rbp movq %rsp, %rdi movl $4194304, %esi call cudaMalloc@PLT leaq 8(%rsp), %rdi movl $4194304, %esi call cudaMalloc@PLT movl $0, %eax .L12: movl %eax, (%rbx,%rax,4) addq $1, %rax cmpq $1048576, %rax jne .L12 movl $1, %ecx movl $4194304, %edx movq %rbx, %rsi movq (%rsp), %rdi call cudaMemcpy@PLT movl $32, 16(%rsp) movl $32, 20(%rsp) movl $32, 28(%rsp) movl $32, 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 .L25 .L13: movl $2, %ecx movl $4194304, %edx movq 8(%rsp), %rsi movq %rbp, %rdi call cudaMemcpy@PLT leaq 4194304(%rbp), %rcx movq %rbx, %rdi movl $0, %esi movl $0, %r8d movl $1, %r9d jmp .L14 .L25: movq 8(%rsp), %rsi movq (%rsp), %rdi call _Z38__device_stub__Z16matrix_transposePiS_PiS_ jmp .L13 .L21: movl %r9d, %r8d .L15: addl $1, %esi addq $4, %rcx addq $4096, %rdi cmpl $1024, %esi je .L17 .L14: leaq -4194304(%rcx), %rax movq %rdi, %rdx .L16: movl (%rax), %r10d cmpl %r10d, (%rdx) jne .L21 addq $4, %rdx addq $4096, %rax cmpq %rcx, %rax jne .L16 jmp .L15 .L17: testl %r8d, %r8d jne .L18 leaq .LC0(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT .L19: movq %rbx, %rdi call free@PLT movq %rbp, %rdi call free@PLT movq (%rsp), %rdi call cudaFree@PLT movq 8(%rsp), %rdi call cudaFree@PLT movq 40(%rsp), %rax subq %fs:40, %rax jne .L26 movl $0, %eax addq $56, %rsp .cfi_remember_state .cfi_def_cfa_offset 24 popq %rbx .cfi_def_cfa_offset 16 popq %rbp .cfi_def_cfa_offset 8 ret .L18: .cfi_restore_state leaq .LC1(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT jmp .L19 .L26: call __stack_chk_fail@PLT .cfi_endproc .LFE2057: .size main, .-main .section .rodata.str1.1 .LC2: .string "_Z16matrix_transposePiS_" .text .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB2085: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 leaq _ZL15__fatDeviceText(%rip), %rdi call __cudaRegisterFatBinary@PLT movq %rax, %rdi movq %rax, _ZL20__cudaFatCubinHandle(%rip) pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 pushq $0 .cfi_def_cfa_offset 40 pushq $0 .cfi_def_cfa_offset 48 movl $0, %r9d movl $-1, %r8d leaq .LC2(%rip), %rdx movq %rdx, %rcx leaq _Z16matrix_transposePiS_(%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> #define N 1024 //N*N行列 __global__ void matrix_transpose(int *g_A, int *g_B) { int gx = blockIdx.x*32 + threadIdx.x; int gy = blockIdx.y*32 + threadIdx.y; g_B[gx * N + gy] = g_A[gy * N + gx]; } int main() { int *h_A, *h_B, *d_A, *d_B; h_A = (int*)malloc(N*N*sizeof(int)); h_B = (int*)malloc(N*N*sizeof(int)); cudaMalloc(&d_A, N*N*sizeof(int)); cudaMalloc(&d_B, N*N*sizeof(int)); for(int i=0; i<N*N; i++) h_A[i] = i; cudaMemcpy(d_A, h_A, N*N*sizeof(int), cudaMemcpyHostToDevice); dim3 grid(32, 32); dim3 block(32, 32); matrix_transpose<<< grid, block >>>(d_A, d_B); cudaMemcpy(h_B, d_B, N*N*sizeof(int), cudaMemcpyDeviceToHost); int flag = 0; for(int y=0;y<N;y++) for(int x=0;x<N;x++) if(h_A[y*N+x]!=h_B[x*N+y]){ flag = 1; break; } if(flag==0) printf("OK\n"); else printf("NG\n"); free(h_A); free(h_B); cudaFree(d_A); cudaFree(d_B); }
#include <hip/hip_runtime.h> #include<stdio.h> #include<stdlib.h> #define N 1024 //N*N行列 __global__ void matrix_transpose(int *g_A, int *g_B) { int gx = blockIdx.x*32 + threadIdx.x; int gy = blockIdx.y*32 + threadIdx.y; g_B[gx * N + gy] = g_A[gy * N + gx]; } int main() { int *h_A, *h_B, *d_A, *d_B; h_A = (int*)malloc(N*N*sizeof(int)); h_B = (int*)malloc(N*N*sizeof(int)); hipMalloc(&d_A, N*N*sizeof(int)); hipMalloc(&d_B, N*N*sizeof(int)); for(int i=0; i<N*N; i++) h_A[i] = i; hipMemcpy(d_A, h_A, N*N*sizeof(int), hipMemcpyHostToDevice); dim3 grid(32, 32); dim3 block(32, 32); matrix_transpose<<< grid, block >>>(d_A, d_B); hipMemcpy(h_B, d_B, N*N*sizeof(int), hipMemcpyDeviceToHost); int flag = 0; for(int y=0;y<N;y++) for(int x=0;x<N;x++) if(h_A[y*N+x]!=h_B[x*N+y]){ flag = 1; break; } if(flag==0) printf("OK\n"); else printf("NG\n"); free(h_A); free(h_B); hipFree(d_A); hipFree(d_B); }
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> #define N 1024 //N*N行列 __global__ void matrix_transpose(int *g_A, int *g_B) { int gx = blockIdx.x*32 + threadIdx.x; int gy = blockIdx.y*32 + threadIdx.y; g_B[gx * N + gy] = g_A[gy * N + gx]; } int main() { int *h_A, *h_B, *d_A, *d_B; h_A = (int*)malloc(N*N*sizeof(int)); h_B = (int*)malloc(N*N*sizeof(int)); hipMalloc(&d_A, N*N*sizeof(int)); hipMalloc(&d_B, N*N*sizeof(int)); for(int i=0; i<N*N; i++) h_A[i] = i; hipMemcpy(d_A, h_A, N*N*sizeof(int), hipMemcpyHostToDevice); dim3 grid(32, 32); dim3 block(32, 32); matrix_transpose<<< grid, block >>>(d_A, d_B); hipMemcpy(h_B, d_B, N*N*sizeof(int), hipMemcpyDeviceToHost); int flag = 0; for(int y=0;y<N;y++) for(int x=0;x<N;x++) if(h_A[y*N+x]!=h_B[x*N+y]){ flag = 1; break; } if(flag==0) printf("OK\n"); else printf("NG\n"); free(h_A); free(h_B); hipFree(d_A); hipFree(d_B); }
.text .amdgcn_target "amdgcn-amd-amdhsa--gfx1100" .protected _Z16matrix_transposePiS_ .globl _Z16matrix_transposePiS_ .p2align 8 .type _Z16matrix_transposePiS_,@function _Z16matrix_transposePiS_: v_and_b32_e32 v1, 0x3ff, v0 v_bfe_u32 v0, v0, 10, 10 s_load_b128 s[0:3], s[0:1], 0x0 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_lshl_add_u32 v2, s14, 5, v1 v_lshl_add_u32 v3, s15, 5, v0 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_lshl_add_u32 v0, v3, 10, v2 v_ashrrev_i32_e32 v1, 31, v0 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_lshlrev_b64 v[0:1], 2, v[0:1] s_waitcnt lgkmcnt(0) v_add_co_u32 v0, vcc_lo, s0, v0 s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_1) v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo global_load_b32 v4, v[0:1], off v_lshl_add_u32 v0, v2, 10, v3 v_ashrrev_i32_e32 v1, 31, v0 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_lshlrev_b64 v[0:1], 2, v[0:1] v_add_co_u32 v0, vcc_lo, s2, v0 s_delay_alu instid0(VALU_DEP_2) v_add_co_ci_u32_e32 v1, vcc_lo, s3, v1, vcc_lo s_waitcnt vmcnt(0) global_store_b32 v[0:1], v4, off s_nop 0 s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z16matrix_transposePiS_ .amdhsa_group_segment_fixed_size 0 .amdhsa_private_segment_fixed_size 0 .amdhsa_kernarg_size 16 .amdhsa_user_sgpr_count 14 .amdhsa_user_sgpr_dispatch_ptr 0 .amdhsa_user_sgpr_queue_ptr 0 .amdhsa_user_sgpr_kernarg_segment_ptr 1 .amdhsa_user_sgpr_dispatch_id 0 .amdhsa_user_sgpr_private_segment_size 0 .amdhsa_wavefront_size32 1 .amdhsa_uses_dynamic_stack 0 .amdhsa_enable_private_segment 0 .amdhsa_system_sgpr_workgroup_id_x 1 .amdhsa_system_sgpr_workgroup_id_y 1 .amdhsa_system_sgpr_workgroup_id_z 0 .amdhsa_system_sgpr_workgroup_info 0 .amdhsa_system_vgpr_workitem_id 1 .amdhsa_next_free_vgpr 5 .amdhsa_next_free_sgpr 16 .amdhsa_float_round_mode_32 0 .amdhsa_float_round_mode_16_64 0 .amdhsa_float_denorm_mode_32 3 .amdhsa_float_denorm_mode_16_64 3 .amdhsa_dx10_clamp 1 .amdhsa_ieee_mode 1 .amdhsa_fp16_overflow 0 .amdhsa_workgroup_processor_mode 1 .amdhsa_memory_ordered 1 .amdhsa_forward_progress 0 .amdhsa_shared_vgpr_count 0 .amdhsa_exception_fp_ieee_invalid_op 0 .amdhsa_exception_fp_denorm_src 0 .amdhsa_exception_fp_ieee_div_zero 0 .amdhsa_exception_fp_ieee_overflow 0 .amdhsa_exception_fp_ieee_underflow 0 .amdhsa_exception_fp_ieee_inexact 0 .amdhsa_exception_int_div_zero 0 .end_amdhsa_kernel .text .Lfunc_end0: .size _Z16matrix_transposePiS_, .Lfunc_end0-_Z16matrix_transposePiS_ .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 .group_segment_fixed_size: 0 .kernarg_segment_align: 8 .kernarg_segment_size: 16 .language: OpenCL C .language_version: - 2 - 0 .max_flat_workgroup_size: 1024 .name: _Z16matrix_transposePiS_ .private_segment_fixed_size: 0 .sgpr_count: 18 .sgpr_spill_count: 0 .symbol: _Z16matrix_transposePiS_.kd .uniform_work_group_size: 1 .uses_dynamic_stack: false .vgpr_count: 5 .vgpr_spill_count: 0 .wavefront_size: 32 .workgroup_processor_mode: 1 amdhsa.target: amdgcn-amd-amdhsa--gfx1100 amdhsa.version: - 1 - 2 ... .end_amdgpu_metadata
You are a helpful coding assistant specialized in converting HIP source code to AMD host assembly.
#include <hip/hip_runtime.h> #include<stdio.h> #include<stdlib.h> #define N 1024 //N*N行列 __global__ void matrix_transpose(int *g_A, int *g_B) { int gx = blockIdx.x*32 + threadIdx.x; int gy = blockIdx.y*32 + threadIdx.y; g_B[gx * N + gy] = g_A[gy * N + gx]; } int main() { int *h_A, *h_B, *d_A, *d_B; h_A = (int*)malloc(N*N*sizeof(int)); h_B = (int*)malloc(N*N*sizeof(int)); hipMalloc(&d_A, N*N*sizeof(int)); hipMalloc(&d_B, N*N*sizeof(int)); for(int i=0; i<N*N; i++) h_A[i] = i; hipMemcpy(d_A, h_A, N*N*sizeof(int), hipMemcpyHostToDevice); dim3 grid(32, 32); dim3 block(32, 32); matrix_transpose<<< grid, block >>>(d_A, d_B); hipMemcpy(h_B, d_B, N*N*sizeof(int), hipMemcpyDeviceToHost); int flag = 0; for(int y=0;y<N;y++) for(int x=0;x<N;x++) if(h_A[y*N+x]!=h_B[x*N+y]){ flag = 1; break; } if(flag==0) printf("OK\n"); else printf("NG\n"); free(h_A); free(h_B); hipFree(d_A); hipFree(d_B); }
.text .file "matrix_transpose.hip" .globl _Z31__device_stub__matrix_transposePiS_ # -- Begin function _Z31__device_stub__matrix_transposePiS_ .p2align 4, 0x90 .type _Z31__device_stub__matrix_transposePiS_,@function _Z31__device_stub__matrix_transposePiS_: # @_Z31__device_stub__matrix_transposePiS_ .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 $_Z16matrix_transposePiS_, %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 _Z31__device_stub__matrix_transposePiS_, .Lfunc_end0-_Z31__device_stub__matrix_transposePiS_ .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 $96, %rsp .cfi_def_cfa_offset 128 .cfi_offset %rbx, -32 .cfi_offset %r14, -24 .cfi_offset %r15, -16 movl $4194304, %edi # imm = 0x400000 callq malloc movq %rax, %rbx movl $4194304, %edi # imm = 0x400000 callq malloc movq %rax, %r14 leaq 8(%rsp), %rdi movl $4194304, %esi # imm = 0x400000 callq hipMalloc movq %rsp, %rdi movl $4194304, %esi # imm = 0x400000 callq hipMalloc xorl %eax, %eax .p2align 4, 0x90 .LBB1_1: # =>This Inner Loop Header: Depth=1 movl %eax, (%rbx,%rax,4) incq %rax cmpq $1048576, %rax # imm = 0x100000 jne .LBB1_1 # %bb.2: movq 8(%rsp), %rdi movl $4194304, %edx # imm = 0x400000 movq %rbx, %rsi movl $1, %ecx callq hipMemcpy xorl %r15d, %r15d movabsq $137438953504, %rdi # imm = 0x2000000020 movl $1, %esi movq %rdi, %rdx movl $1, %ecx xorl %r8d, %r8d xorl %r9d, %r9d callq __hipPushCallConfiguration testl %eax, %eax jne .LBB1_4 # %bb.3: movq 8(%rsp), %rax movq (%rsp), %rcx movq %rax, 72(%rsp) movq %rcx, 64(%rsp) leaq 72(%rsp), %rax movq %rax, 80(%rsp) leaq 64(%rsp), %rax movq %rax, 88(%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 $_Z16matrix_transposePiS_, %edi pushq 16(%rsp) .cfi_adjust_cfa_offset 8 pushq 32(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $16, %rsp .cfi_adjust_cfa_offset -16 .LBB1_4: movq (%rsp), %rsi movl $4194304, %edx # imm = 0x400000 movq %r14, %rdi movl $2, %ecx callq hipMemcpy movq %r14, %rax movq %rbx, %rcx xorl %edx, %edx jmp .LBB1_5 .p2align 4, 0x90 .LBB1_8: # in Loop: Header=BB1_5 Depth=1 movl $1, %r15d .LBB1_9: # in Loop: Header=BB1_5 Depth=1 incq %rdx addq $4096, %rcx # imm = 0x1000 addq $4, %rax cmpq $1024, %rdx # imm = 0x400 je .LBB1_10 .LBB1_5: # %.preheader # =>This Loop Header: Depth=1 # Child Loop BB1_7 Depth 2 movq %rax, %rsi xorl %edi, %edi .p2align 4, 0x90 .LBB1_7: # Parent Loop BB1_5 Depth=1 # => This Inner Loop Header: Depth=2 movl (%rcx,%rdi,4), %r8d cmpl (%rsi), %r8d jne .LBB1_8 # %bb.6: # in Loop: Header=BB1_7 Depth=2 incq %rdi addq $4096, %rsi # imm = 0x1000 cmpq $1024, %rdi # imm = 0x400 jne .LBB1_7 jmp .LBB1_9 .LBB1_10: testl %r15d, %r15d movl $.Lstr.1, %eax movl $.Lstr, %edi cmoveq %rax, %rdi callq puts@PLT movq %rbx, %rdi callq free movq %r14, %rdi callq free movq 8(%rsp), %rdi callq hipFree movq (%rsp), %rdi callq hipFree xorl %eax, %eax addq $96, %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 $_Z16matrix_transposePiS_, %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 _Z16matrix_transposePiS_,@object # @_Z16matrix_transposePiS_ .section .rodata,"a",@progbits .globl _Z16matrix_transposePiS_ .p2align 3, 0x0 _Z16matrix_transposePiS_: .quad _Z31__device_stub__matrix_transposePiS_ .size _Z16matrix_transposePiS_, 8 .type .L__unnamed_1,@object # @0 .section .rodata.str1.1,"aMS",@progbits,1 .L__unnamed_1: .asciz "_Z16matrix_transposePiS_" .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 "NG" .size .Lstr, 3 .type .Lstr.1,@object # @str.1 .Lstr.1: .asciz "OK" .size .Lstr.1, 3 .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 _Z31__device_stub__matrix_transposePiS_ .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z16matrix_transposePiS_ .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 : _Z16matrix_transposePiS_ .headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)" /*0000*/ MOV R1, c[0x0][0x28] ; /* 0x00000a0000017a02 */ /* 0x000fe40000000f00 */ /*0010*/ S2R R0, SR_CTAID.X ; /* 0x0000000000007919 */ /* 0x000e220000002500 */ /*0020*/ IMAD.MOV.U32 R4, RZ, RZ, 0x4 ; /* 0x00000004ff047424 */ /* 0x000fe200078e00ff */ /*0030*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */ /* 0x000fe40000000a00 */ /*0040*/ S2R R3, SR_TID.X ; /* 0x0000000000037919 */ /* 0x000e280000002100 */ /*0050*/ S2R R5, SR_CTAID.Y ; /* 0x0000000000057919 */ /* 0x000e680000002600 */ /*0060*/ S2R R2, SR_TID.Y ; /* 0x0000000000027919 */ /* 0x000e620000002200 */ /*0070*/ LEA R0, R0, R3, 0x5 ; /* 0x0000000300007211 */ /* 0x001fc400078e28ff */ /*0080*/ LEA R5, R5, R2, 0x5 ; /* 0x0000000205057211 */ /* 0x002fc800078e28ff */ /*0090*/ LEA R2, R5, R0, 0xa ; /* 0x0000000005027211 */ /* 0x000fca00078e50ff */ /*00a0*/ IMAD.WIDE R2, R2, R4, c[0x0][0x160] ; /* 0x0000580002027625 */ /* 0x000fcc00078e0204 */ /*00b0*/ LDG.E R3, [R2.64] ; /* 0x0000000402037981 */ /* 0x000ea2000c1e1900 */ /*00c0*/ IMAD R5, R0, 0x400, R5 ; /* 0x0000040000057824 */ /* 0x000fc800078e0205 */ /*00d0*/ IMAD.WIDE R4, R5, R4, c[0x0][0x168] ; /* 0x00005a0005047625 */ /* 0x000fca00078e0204 */ /*00e0*/ STG.E [R4.64], R3 ; /* 0x0000000304007986 */ /* 0x004fe2000c101904 */ /*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 _Z16matrix_transposePiS_ .globl _Z16matrix_transposePiS_ .p2align 8 .type _Z16matrix_transposePiS_,@function _Z16matrix_transposePiS_: v_and_b32_e32 v1, 0x3ff, v0 v_bfe_u32 v0, v0, 10, 10 s_load_b128 s[0:3], s[0:1], 0x0 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_lshl_add_u32 v2, s14, 5, v1 v_lshl_add_u32 v3, s15, 5, v0 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_lshl_add_u32 v0, v3, 10, v2 v_ashrrev_i32_e32 v1, 31, v0 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_lshlrev_b64 v[0:1], 2, v[0:1] s_waitcnt lgkmcnt(0) v_add_co_u32 v0, vcc_lo, s0, v0 s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_1) v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo global_load_b32 v4, v[0:1], off v_lshl_add_u32 v0, v2, 10, v3 v_ashrrev_i32_e32 v1, 31, v0 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_lshlrev_b64 v[0:1], 2, v[0:1] v_add_co_u32 v0, vcc_lo, s2, v0 s_delay_alu instid0(VALU_DEP_2) v_add_co_ci_u32_e32 v1, vcc_lo, s3, v1, vcc_lo s_waitcnt vmcnt(0) global_store_b32 v[0:1], v4, off s_nop 0 s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z16matrix_transposePiS_ .amdhsa_group_segment_fixed_size 0 .amdhsa_private_segment_fixed_size 0 .amdhsa_kernarg_size 16 .amdhsa_user_sgpr_count 14 .amdhsa_user_sgpr_dispatch_ptr 0 .amdhsa_user_sgpr_queue_ptr 0 .amdhsa_user_sgpr_kernarg_segment_ptr 1 .amdhsa_user_sgpr_dispatch_id 0 .amdhsa_user_sgpr_private_segment_size 0 .amdhsa_wavefront_size32 1 .amdhsa_uses_dynamic_stack 0 .amdhsa_enable_private_segment 0 .amdhsa_system_sgpr_workgroup_id_x 1 .amdhsa_system_sgpr_workgroup_id_y 1 .amdhsa_system_sgpr_workgroup_id_z 0 .amdhsa_system_sgpr_workgroup_info 0 .amdhsa_system_vgpr_workitem_id 1 .amdhsa_next_free_vgpr 5 .amdhsa_next_free_sgpr 16 .amdhsa_float_round_mode_32 0 .amdhsa_float_round_mode_16_64 0 .amdhsa_float_denorm_mode_32 3 .amdhsa_float_denorm_mode_16_64 3 .amdhsa_dx10_clamp 1 .amdhsa_ieee_mode 1 .amdhsa_fp16_overflow 0 .amdhsa_workgroup_processor_mode 1 .amdhsa_memory_ordered 1 .amdhsa_forward_progress 0 .amdhsa_shared_vgpr_count 0 .amdhsa_exception_fp_ieee_invalid_op 0 .amdhsa_exception_fp_denorm_src 0 .amdhsa_exception_fp_ieee_div_zero 0 .amdhsa_exception_fp_ieee_overflow 0 .amdhsa_exception_fp_ieee_underflow 0 .amdhsa_exception_fp_ieee_inexact 0 .amdhsa_exception_int_div_zero 0 .end_amdhsa_kernel .text .Lfunc_end0: .size _Z16matrix_transposePiS_, .Lfunc_end0-_Z16matrix_transposePiS_ .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 .group_segment_fixed_size: 0 .kernarg_segment_align: 8 .kernarg_segment_size: 16 .language: OpenCL C .language_version: - 2 - 0 .max_flat_workgroup_size: 1024 .name: _Z16matrix_transposePiS_ .private_segment_fixed_size: 0 .sgpr_count: 18 .sgpr_spill_count: 0 .symbol: _Z16matrix_transposePiS_.kd .uniform_work_group_size: 1 .uses_dynamic_stack: false .vgpr_count: 5 .vgpr_spill_count: 0 .wavefront_size: 32 .workgroup_processor_mode: 1 amdhsa.target: amdgcn-amd-amdhsa--gfx1100 amdhsa.version: - 1 - 2 ... .end_amdgpu_metadata
You are a helpful coding assistant specialized in converting from CUDA host assembly to AMD host assembly.
.file "tmpxft_00174ee4_00000000-6_matrix_transpose.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 _Z38__device_stub__Z16matrix_transposePiS_PiS_ .type _Z38__device_stub__Z16matrix_transposePiS_PiS_, @function _Z38__device_stub__Z16matrix_transposePiS_PiS_: .LFB2082: .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 _Z16matrix_transposePiS_(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 128 jmp .L3 .L8: call __stack_chk_fail@PLT .cfi_endproc .LFE2082: .size _Z38__device_stub__Z16matrix_transposePiS_PiS_, .-_Z38__device_stub__Z16matrix_transposePiS_PiS_ .globl _Z16matrix_transposePiS_ .type _Z16matrix_transposePiS_, @function _Z16matrix_transposePiS_: .LFB2083: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z38__device_stub__Z16matrix_transposePiS_PiS_ addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2083: .size _Z16matrix_transposePiS_, .-_Z16matrix_transposePiS_ .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "OK\n" .LC1: .string "NG\n" .text .globl main .type main, @function main: .LFB2057: .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 $56, %rsp .cfi_def_cfa_offset 80 movq %fs:40, %rax movq %rax, 40(%rsp) xorl %eax, %eax movl $4194304, %edi call malloc@PLT movq %rax, %rbx movl $4194304, %edi call malloc@PLT movq %rax, %rbp movq %rsp, %rdi movl $4194304, %esi call cudaMalloc@PLT leaq 8(%rsp), %rdi movl $4194304, %esi call cudaMalloc@PLT movl $0, %eax .L12: movl %eax, (%rbx,%rax,4) addq $1, %rax cmpq $1048576, %rax jne .L12 movl $1, %ecx movl $4194304, %edx movq %rbx, %rsi movq (%rsp), %rdi call cudaMemcpy@PLT movl $32, 16(%rsp) movl $32, 20(%rsp) movl $32, 28(%rsp) movl $32, 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 .L25 .L13: movl $2, %ecx movl $4194304, %edx movq 8(%rsp), %rsi movq %rbp, %rdi call cudaMemcpy@PLT leaq 4194304(%rbp), %rcx movq %rbx, %rdi movl $0, %esi movl $0, %r8d movl $1, %r9d jmp .L14 .L25: movq 8(%rsp), %rsi movq (%rsp), %rdi call _Z38__device_stub__Z16matrix_transposePiS_PiS_ jmp .L13 .L21: movl %r9d, %r8d .L15: addl $1, %esi addq $4, %rcx addq $4096, %rdi cmpl $1024, %esi je .L17 .L14: leaq -4194304(%rcx), %rax movq %rdi, %rdx .L16: movl (%rax), %r10d cmpl %r10d, (%rdx) jne .L21 addq $4, %rdx addq $4096, %rax cmpq %rcx, %rax jne .L16 jmp .L15 .L17: testl %r8d, %r8d jne .L18 leaq .LC0(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT .L19: movq %rbx, %rdi call free@PLT movq %rbp, %rdi call free@PLT movq (%rsp), %rdi call cudaFree@PLT movq 8(%rsp), %rdi call cudaFree@PLT movq 40(%rsp), %rax subq %fs:40, %rax jne .L26 movl $0, %eax addq $56, %rsp .cfi_remember_state .cfi_def_cfa_offset 24 popq %rbx .cfi_def_cfa_offset 16 popq %rbp .cfi_def_cfa_offset 8 ret .L18: .cfi_restore_state leaq .LC1(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT jmp .L19 .L26: call __stack_chk_fail@PLT .cfi_endproc .LFE2057: .size main, .-main .section .rodata.str1.1 .LC2: .string "_Z16matrix_transposePiS_" .text .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB2085: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 leaq _ZL15__fatDeviceText(%rip), %rdi call __cudaRegisterFatBinary@PLT movq %rax, %rdi movq %rax, _ZL20__cudaFatCubinHandle(%rip) pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 pushq $0 .cfi_def_cfa_offset 40 pushq $0 .cfi_def_cfa_offset 48 movl $0, %r9d movl $-1, %r8d leaq .LC2(%rip), %rdx movq %rdx, %rcx leaq _Z16matrix_transposePiS_(%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 "matrix_transpose.hip" .globl _Z31__device_stub__matrix_transposePiS_ # -- Begin function _Z31__device_stub__matrix_transposePiS_ .p2align 4, 0x90 .type _Z31__device_stub__matrix_transposePiS_,@function _Z31__device_stub__matrix_transposePiS_: # @_Z31__device_stub__matrix_transposePiS_ .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 $_Z16matrix_transposePiS_, %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 _Z31__device_stub__matrix_transposePiS_, .Lfunc_end0-_Z31__device_stub__matrix_transposePiS_ .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 $96, %rsp .cfi_def_cfa_offset 128 .cfi_offset %rbx, -32 .cfi_offset %r14, -24 .cfi_offset %r15, -16 movl $4194304, %edi # imm = 0x400000 callq malloc movq %rax, %rbx movl $4194304, %edi # imm = 0x400000 callq malloc movq %rax, %r14 leaq 8(%rsp), %rdi movl $4194304, %esi # imm = 0x400000 callq hipMalloc movq %rsp, %rdi movl $4194304, %esi # imm = 0x400000 callq hipMalloc xorl %eax, %eax .p2align 4, 0x90 .LBB1_1: # =>This Inner Loop Header: Depth=1 movl %eax, (%rbx,%rax,4) incq %rax cmpq $1048576, %rax # imm = 0x100000 jne .LBB1_1 # %bb.2: movq 8(%rsp), %rdi movl $4194304, %edx # imm = 0x400000 movq %rbx, %rsi movl $1, %ecx callq hipMemcpy xorl %r15d, %r15d movabsq $137438953504, %rdi # imm = 0x2000000020 movl $1, %esi movq %rdi, %rdx movl $1, %ecx xorl %r8d, %r8d xorl %r9d, %r9d callq __hipPushCallConfiguration testl %eax, %eax jne .LBB1_4 # %bb.3: movq 8(%rsp), %rax movq (%rsp), %rcx movq %rax, 72(%rsp) movq %rcx, 64(%rsp) leaq 72(%rsp), %rax movq %rax, 80(%rsp) leaq 64(%rsp), %rax movq %rax, 88(%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 $_Z16matrix_transposePiS_, %edi pushq 16(%rsp) .cfi_adjust_cfa_offset 8 pushq 32(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $16, %rsp .cfi_adjust_cfa_offset -16 .LBB1_4: movq (%rsp), %rsi movl $4194304, %edx # imm = 0x400000 movq %r14, %rdi movl $2, %ecx callq hipMemcpy movq %r14, %rax movq %rbx, %rcx xorl %edx, %edx jmp .LBB1_5 .p2align 4, 0x90 .LBB1_8: # in Loop: Header=BB1_5 Depth=1 movl $1, %r15d .LBB1_9: # in Loop: Header=BB1_5 Depth=1 incq %rdx addq $4096, %rcx # imm = 0x1000 addq $4, %rax cmpq $1024, %rdx # imm = 0x400 je .LBB1_10 .LBB1_5: # %.preheader # =>This Loop Header: Depth=1 # Child Loop BB1_7 Depth 2 movq %rax, %rsi xorl %edi, %edi .p2align 4, 0x90 .LBB1_7: # Parent Loop BB1_5 Depth=1 # => This Inner Loop Header: Depth=2 movl (%rcx,%rdi,4), %r8d cmpl (%rsi), %r8d jne .LBB1_8 # %bb.6: # in Loop: Header=BB1_7 Depth=2 incq %rdi addq $4096, %rsi # imm = 0x1000 cmpq $1024, %rdi # imm = 0x400 jne .LBB1_7 jmp .LBB1_9 .LBB1_10: testl %r15d, %r15d movl $.Lstr.1, %eax movl $.Lstr, %edi cmoveq %rax, %rdi callq puts@PLT movq %rbx, %rdi callq free movq %r14, %rdi callq free movq 8(%rsp), %rdi callq hipFree movq (%rsp), %rdi callq hipFree xorl %eax, %eax addq $96, %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 $_Z16matrix_transposePiS_, %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 _Z16matrix_transposePiS_,@object # @_Z16matrix_transposePiS_ .section .rodata,"a",@progbits .globl _Z16matrix_transposePiS_ .p2align 3, 0x0 _Z16matrix_transposePiS_: .quad _Z31__device_stub__matrix_transposePiS_ .size _Z16matrix_transposePiS_, 8 .type .L__unnamed_1,@object # @0 .section .rodata.str1.1,"aMS",@progbits,1 .L__unnamed_1: .asciz "_Z16matrix_transposePiS_" .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 "NG" .size .Lstr, 3 .type .Lstr.1,@object # @str.1 .Lstr.1: .asciz "OK" .size .Lstr.1, 3 .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 _Z31__device_stub__matrix_transposePiS_ .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z16matrix_transposePiS_ .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> #include <cuda.h> __global__ void dkernel(unsigned *vector, unsigned vectorsize) { unsigned id = blockIdx.x * blockDim.x + threadIdx.x; vector[id] = id; __syncthreads(); if (id < vectorsize - 1 && vector[id + 1] != id + 1) printf("syncthreads does not work.\n"); } #define BLOCKSIZE 1000 #define N BLOCKSIZE int main(int nn, char *str[]) { unsigned *vector, *hvector; cudaMalloc(&vector, N * sizeof(unsigned)); hvector = (unsigned *)malloc(N * sizeof(unsigned)); dkernel<<<100, BLOCKSIZE>>>(vector, N); cudaMemcpy(hvector, vector, N * sizeof(unsigned), cudaMemcpyDeviceToHost); for (unsigned ii = 0; ii < N; ++ii) { printf("%4d ", hvector[ii]); } printf("\n"); return 0; }
code for sm_80 Function : _Z7dkernelPjj .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 R5, SR_CTAID.X ; /* 0x0000000000057919 */ /* 0x000e220000002500 */ /*0020*/ ULDC UR4, c[0x0][0x168] ; /* 0x00005a0000047ab9 */ /* 0x000fe40000000800 */ /*0030*/ UIADD3 UR4, UR4, -0x1, URZ ; /* 0xffffffff04047890 */ /* 0x000fe2000fffe03f */ /*0040*/ S2R R0, SR_TID.X ; /* 0x0000000000007919 */ /* 0x000e240000002100 */ /*0050*/ IMAD R5, R5, c[0x0][0x0], R0 ; /* 0x0000000005057a24 */ /* 0x001fe400078e0200 */ /*0060*/ IMAD.MOV.U32 R0, RZ, RZ, 0x4 ; /* 0x00000004ff007424 */ /* 0x000fc600078e00ff */ /*0070*/ ISETP.GE.U32.AND P0, PT, R5.reuse, UR4, PT ; /* 0x0000000405007c0c */ /* 0x040fe2000bf06070 */ /*0080*/ IMAD.WIDE.U32 R2, R5, R0, c[0x0][0x160] ; /* 0x0000580005027625 */ /* 0x000fe200078e0000 */ /*0090*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */ /* 0x000fc80000000a00 */ /*00a0*/ STG.E [R2.64], R5 ; /* 0x0000000502007986 */ /* 0x0001e8000c101904 */ /*00b0*/ BAR.SYNC.DEFER_BLOCKING 0x0 ; /* 0x0000000000007b1d */ /* 0x000fec0000010000 */ /*00c0*/ @P0 EXIT ; /* 0x000000000000094d */ /* 0x000fea0003800000 */ /*00d0*/ IADD3 R5, R5, 0x1, RZ ; /* 0x0000000105057810 */ /* 0x001fca0007ffe0ff */ /*00e0*/ IMAD.WIDE.U32 R2, R5, R0, c[0x0][0x160] ; /* 0x0000580005027625 */ /* 0x000fcc00078e0000 */ /*00f0*/ LDG.E R2, [R2.64] ; /* 0x0000000402027981 */ /* 0x000ea4000c1e1900 */ /*0100*/ ISETP.NE.AND P0, PT, R2, R5, PT ; /* 0x000000050200720c */ /* 0x004fda0003f05270 */ /*0110*/ @!P0 EXIT ; /* 0x000000000000894d */ /* 0x000fea0003800000 */ /*0120*/ MOV R0, 0x0 ; /* 0x0000000000007802 */ /* 0x000fe20000000f00 */ /*0130*/ IMAD.MOV.U32 R4, RZ, RZ, c[0x4][0x8] ; /* 0x01000200ff047624 */ /* 0x000fe200078e00ff */ /*0140*/ CS2R R6, SRZ ; /* 0x0000000000067805 */ /* 0x000fe2000001ff00 */ /*0150*/ IMAD.MOV.U32 R5, RZ, RZ, c[0x4][0xc] ; /* 0x01000300ff057624 */ /* 0x000fe200078e00ff */ /*0160*/ LDC.64 R2, c[0x4][R0] ; /* 0x0100000000027b82 */ /* 0x00006c0000000a00 */ /*0170*/ LEPC R8 ; /* 0x000000000008734e */ /* 0x000fe40000000000 */ /*0180*/ MOV R11, 0x1f0 ; /* 0x000001f0000b7802 */ /* 0x000fe40000000f00 */ /*0190*/ MOV R20, 0x170 ; /* 0x0000017000147802 */ /* 0x000fe40000000f00 */ /*01a0*/ MOV R21, 0x0 ; /* 0x0000000000157802 */ /* 0x000fe40000000f00 */ /*01b0*/ MOV R0, 0x0 ; /* 0x0000000000007802 */ /* 0x001fc40000000f00 */ /*01c0*/ IADD3 R20, P0, P1, -R20, R11, R8 ; /* 0x0000000b14147210 */ /* 0x000fc8000791e108 */ /*01d0*/ IADD3.X R21, ~R0, R21, R9, P0, P1 ; /* 0x0000001500157210 */ /* 0x000fc800007e2509 */ /*01e0*/ CALL.ABS.NOINC R2 ; /* 0x0000000002007343 */ /* 0x002fea0003c00000 */ /*01f0*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*0200*/ BRA 0x200; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*0210*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0220*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0230*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0240*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0250*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0260*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0270*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0280*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*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 */ ..........
You are a helpful coding assistant specialized in converting CUDA source code to CUDA host assembly.
#include <stdio.h> #include <cuda.h> __global__ void dkernel(unsigned *vector, unsigned vectorsize) { unsigned id = blockIdx.x * blockDim.x + threadIdx.x; vector[id] = id; __syncthreads(); if (id < vectorsize - 1 && vector[id + 1] != id + 1) printf("syncthreads does not work.\n"); } #define BLOCKSIZE 1000 #define N BLOCKSIZE int main(int nn, char *str[]) { unsigned *vector, *hvector; cudaMalloc(&vector, N * sizeof(unsigned)); hvector = (unsigned *)malloc(N * sizeof(unsigned)); dkernel<<<100, BLOCKSIZE>>>(vector, N); cudaMemcpy(hvector, vector, N * sizeof(unsigned), cudaMemcpyDeviceToHost); for (unsigned ii = 0; ii < N; ++ii) { printf("%4d ", hvector[ii]); } printf("\n"); return 0; }
.file "tmpxft_000f39a2_00000000-6_syncthreads.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__Z7dkernelPjjPjj .type _Z27__device_stub__Z7dkernelPjjPjj, @function _Z27__device_stub__Z7dkernelPjjPjj: .LFB2082: .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 _Z7dkernelPjj(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 128 jmp .L3 .L8: call __stack_chk_fail@PLT .cfi_endproc .LFE2082: .size _Z27__device_stub__Z7dkernelPjjPjj, .-_Z27__device_stub__Z7dkernelPjjPjj .globl _Z7dkernelPjj .type _Z7dkernelPjj, @function _Z7dkernelPjj: .LFB2083: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z27__device_stub__Z7dkernelPjjPjj addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2083: .size _Z7dkernelPjj, .-_Z7dkernelPjj .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "%4d " .LC1: .string "\n" .text .globl main .type main, @function main: .LFB2057: .cfi_startproc endbr64 pushq %r12 .cfi_def_cfa_offset 16 .cfi_offset 12, -16 pushq %rbp .cfi_def_cfa_offset 24 .cfi_offset 6, -24 pushq %rbx .cfi_def_cfa_offset 32 .cfi_offset 3, -32 subq $48, %rsp .cfi_def_cfa_offset 80 movq %fs:40, %rax movq %rax, 40(%rsp) xorl %eax, %eax leaq 8(%rsp), %rdi movl $4000, %esi call cudaMalloc@PLT movl $4000, %edi call malloc@PLT movq %rax, %rbp movl $1000, 28(%rsp) movl $1, 32(%rsp) movl $100, 16(%rsp) movl $1, 20(%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 .L12: movl $2, %ecx movl $4000, %edx movq 8(%rsp), %rsi movq %rbp, %rdi call cudaMemcpy@PLT movq %rbp, %rbx addq $4000, %rbp leaq .LC0(%rip), %r12 .L13: movl (%rbx), %edx movq %r12, %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT addq $4, %rbx cmpq %rbp, %rbx jne .L13 leaq .LC1(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT 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 movl $1000, %esi movq 8(%rsp), %rdi call _Z27__device_stub__Z7dkernelPjjPjj jmp .L12 .L18: call __stack_chk_fail@PLT .cfi_endproc .LFE2057: .size main, .-main .section .rodata.str1.1 .LC2: .string "_Z7dkernelPjj" .text .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB2085: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 leaq _ZL15__fatDeviceText(%rip), %rdi call __cudaRegisterFatBinary@PLT movq %rax, %rdi movq %rax, _ZL20__cudaFatCubinHandle(%rip) pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 pushq $0 .cfi_def_cfa_offset 40 pushq $0 .cfi_def_cfa_offset 48 movl $0, %r9d movl $-1, %r8d leaq .LC2(%rip), %rdx movq %rdx, %rcx leaq _Z7dkernelPjj(%rip), %rsi call __cudaRegisterFunction@PLT addq $32, %rsp .cfi_def_cfa_offset 16 movq _ZL20__cudaFatCubinHandle(%rip), %rdi call __cudaRegisterFatBinaryEnd@PLT leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi call atexit@PLT addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2085: .size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv .section .init_array,"aw" .align 8 .quad _ZL24__sti____cudaRegisterAllv .section .nvFatBinSegment,"aw" .align 8 .type _ZL15__fatDeviceText, @object .size _ZL15__fatDeviceText, 24 _ZL15__fatDeviceText: .long 1180844977 .long 1 .quad fatbinData .quad 0 .local _ZL20__cudaFatCubinHandle .comm _ZL20__cudaFatCubinHandle,8,8 .ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4:
You are a helpful coding assistant specialized in converting CUDA source code to HIP/AMD source code.
#include <stdio.h> #include <cuda.h> __global__ void dkernel(unsigned *vector, unsigned vectorsize) { unsigned id = blockIdx.x * blockDim.x + threadIdx.x; vector[id] = id; __syncthreads(); if (id < vectorsize - 1 && vector[id + 1] != id + 1) printf("syncthreads does not work.\n"); } #define BLOCKSIZE 1000 #define N BLOCKSIZE int main(int nn, char *str[]) { unsigned *vector, *hvector; cudaMalloc(&vector, N * sizeof(unsigned)); hvector = (unsigned *)malloc(N * sizeof(unsigned)); dkernel<<<100, BLOCKSIZE>>>(vector, N); cudaMemcpy(hvector, vector, N * sizeof(unsigned), cudaMemcpyDeviceToHost); for (unsigned ii = 0; ii < N; ++ii) { printf("%4d ", hvector[ii]); } printf("\n"); return 0; }
#include <stdio.h> #include <hip/hip_runtime.h> __global__ void dkernel(unsigned *vector, unsigned vectorsize) { unsigned id = blockIdx.x * blockDim.x + threadIdx.x; vector[id] = id; __syncthreads(); if (id < vectorsize - 1 && vector[id + 1] != id + 1) printf("syncthreads does not work.\n"); } #define BLOCKSIZE 1000 #define N BLOCKSIZE int main(int nn, char *str[]) { unsigned *vector, *hvector; hipMalloc(&vector, N * sizeof(unsigned)); hvector = (unsigned *)malloc(N * sizeof(unsigned)); dkernel<<<100, BLOCKSIZE>>>(vector, N); hipMemcpy(hvector, vector, N * sizeof(unsigned), hipMemcpyDeviceToHost); for (unsigned ii = 0; ii < N; ++ii) { printf("%4d ", hvector[ii]); } printf("\n"); return 0; }
You are a helpful coding assistant specialized in converting HIP source code to AMD device assembly.
#include <stdio.h> #include <hip/hip_runtime.h> __global__ void dkernel(unsigned *vector, unsigned vectorsize) { unsigned id = blockIdx.x * blockDim.x + threadIdx.x; vector[id] = id; __syncthreads(); if (id < vectorsize - 1 && vector[id + 1] != id + 1) printf("syncthreads does not work.\n"); } #define BLOCKSIZE 1000 #define N BLOCKSIZE int main(int nn, char *str[]) { unsigned *vector, *hvector; hipMalloc(&vector, N * sizeof(unsigned)); hvector = (unsigned *)malloc(N * sizeof(unsigned)); dkernel<<<100, BLOCKSIZE>>>(vector, N); hipMemcpy(hvector, vector, N * sizeof(unsigned), hipMemcpyDeviceToHost); for (unsigned ii = 0; ii < N; ++ii) { printf("%4d ", hvector[ii]); } printf("\n"); return 0; }
.text .amdgcn_target "amdgcn-amd-amdhsa--gfx1100" .protected _Z7dkernelPjj .globl _Z7dkernelPjj .p2align 8 .type _Z7dkernelPjj,@function _Z7dkernelPjj: s_clause 0x2 s_load_b32 s4, s[0:1], 0x1c s_load_b64 s[2:3], s[0:1], 0x0 s_load_b32 s5, s[0:1], 0x8 s_add_u32 s0, s0, 16 s_addc_u32 s1, s1, 0 s_waitcnt lgkmcnt(0) s_and_b32 s4, s4, 0xffff s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_3) | instid1(VALU_DEP_1) v_mad_u64_u32 v[1:2], null, s15, s4, v[0:1] v_mov_b32_e32 v2, 0 s_add_i32 s5, s5, -1 s_mov_b32 s4, exec_lo v_lshlrev_b64 v[3:4], 2, v[1:2] s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2) v_add_co_u32 v3, vcc_lo, s2, v3 v_add_co_ci_u32_e32 v4, vcc_lo, s3, v4, vcc_lo global_store_b32 v[3:4], v1, off s_waitcnt_vscnt null, 0x0 s_barrier buffer_gl0_inv v_cmpx_gt_u32_e64 s5, v1 s_cbranch_execz .LBB0_134 v_add_nc_u32_e32 v1, 1, v1 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_lshlrev_b64 v[2:3], 2, v[1:2] v_add_co_u32 v2, vcc_lo, s2, v2 s_delay_alu instid0(VALU_DEP_2) v_add_co_ci_u32_e32 v3, vcc_lo, s3, v3, vcc_lo global_load_b32 v0, v[2:3], off s_waitcnt vmcnt(0) v_cmp_ne_u32_e32 vcc_lo, v0, v1 s_and_b32 exec_lo, exec_lo, vcc_lo s_cbranch_execz .LBB0_134 s_load_b64 s[2:3], s[0:1], 0x50 v_mbcnt_lo_u32_b32 v20, -1, 0 v_mov_b32_e32 v6, 0 s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_dual_mov_b32 v7, 0 :: v_dual_mov_b32 v4, v20 v_readfirstlane_b32 s0, v4 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_cmp_eq_u32_e64 s0, s0, v4 s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_8 v_mov_b32_e32 v0, 0 s_mov_b32 s4, exec_lo s_waitcnt lgkmcnt(0) global_load_b64 v[8:9], v0, s[2:3] offset:24 glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv s_clause 0x1 global_load_b64 v[1:2], v0, s[2:3] offset:40 global_load_b64 v[5:6], v0, s[2:3] s_waitcnt vmcnt(1) v_and_b32_e32 v1, v1, v8 v_and_b32_e32 v2, v2, v9 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_mul_hi_u32 v3, v1, 24 v_mul_lo_u32 v2, v2, 24 v_mul_lo_u32 v1, v1, 24 s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2) v_add_nc_u32_e32 v2, v3, v2 s_waitcnt vmcnt(0) v_add_co_u32 v1, vcc_lo, v5, v1 s_delay_alu instid0(VALU_DEP_2) v_add_co_ci_u32_e32 v2, vcc_lo, v6, v2, vcc_lo global_load_b64 v[6:7], v[1:2], off glc s_waitcnt vmcnt(0) global_atomic_cmpswap_b64 v[6:7], v0, v[6:9], s[2:3] offset:24 glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv v_cmpx_ne_u64_e64 v[6:7], v[8:9] s_cbranch_execz .LBB0_7 s_mov_b32 s5, 0 .p2align 6 .LBB0_5: s_sleep 1 s_clause 0x1 global_load_b64 v[1:2], v0, s[2:3] offset:40 global_load_b64 v[10:11], v0, s[2:3] v_dual_mov_b32 v9, v7 :: v_dual_mov_b32 v8, v6 s_waitcnt vmcnt(1) s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2) v_and_b32_e32 v1, v1, v8 v_and_b32_e32 v7, v2, v9 s_waitcnt vmcnt(0) s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1) v_mad_u64_u32 v[5:6], null, v1, 24, v[10:11] v_mov_b32_e32 v1, v6 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_mad_u64_u32 v[2:3], null, v7, 24, v[1:2] v_mov_b32_e32 v6, v2 global_load_b64 v[6:7], v[5:6], off glc s_waitcnt vmcnt(0) global_atomic_cmpswap_b64 v[6:7], v0, v[6:9], s[2:3] offset:24 glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv v_cmp_eq_u64_e32 vcc_lo, v[6:7], v[8:9] s_or_b32 s5, vcc_lo, s5 s_delay_alu instid0(SALU_CYCLE_1) s_and_not1_b32 exec_lo, exec_lo, s5 s_cbranch_execnz .LBB0_5 s_or_b32 exec_lo, exec_lo, s5 .LBB0_7: s_delay_alu instid0(SALU_CYCLE_1) s_or_b32 exec_lo, exec_lo, s4 .LBB0_8: s_delay_alu instid0(SALU_CYCLE_1) s_or_b32 exec_lo, exec_lo, s1 v_mov_b32_e32 v5, 0 v_readfirstlane_b32 s4, v6 v_readfirstlane_b32 s5, v7 s_mov_b32 s8, exec_lo s_waitcnt lgkmcnt(0) s_clause 0x1 global_load_b64 v[8:9], v5, s[2:3] offset:40 global_load_b128 v[0:3], v5, s[2:3] s_waitcnt vmcnt(1) v_readfirstlane_b32 s6, v8 v_readfirstlane_b32 s7, v9 s_delay_alu instid0(VALU_DEP_1) s_and_b64 s[6:7], s[4:5], s[6:7] s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_10 v_dual_mov_b32 v6, s8 :: v_dual_mov_b32 v7, 0 s_mul_i32 s8, s7, 24 s_mul_hi_u32 s9, s6, 24 v_dual_mov_b32 v8, 2 :: v_dual_mov_b32 v9, 1 s_add_i32 s9, s9, s8 s_mul_i32 s8, s6, 24 s_waitcnt vmcnt(0) v_add_co_u32 v10, vcc_lo, v0, s8 v_add_co_ci_u32_e32 v11, vcc_lo, s9, v1, vcc_lo global_store_b128 v[10:11], v[6:9], off offset:8 .LBB0_10: s_or_b32 exec_lo, exec_lo, s1 s_lshl_b64 s[8:9], s[6:7], 12 v_lshlrev_b64 v[4:5], 6, v[4:5] s_waitcnt vmcnt(0) v_add_co_u32 v2, vcc_lo, v2, s8 v_add_co_ci_u32_e32 v7, vcc_lo, s9, v3, vcc_lo v_mov_b32_e32 v3, 0 s_mov_b32 s8, 0 s_delay_alu instid0(VALU_DEP_3) v_add_co_u32 v6, vcc_lo, v2, v4 v_mov_b32_e32 v2, 33 s_mov_b32 s9, s8 s_mov_b32 s10, s8 s_mov_b32 s11, s8 v_add_co_ci_u32_e32 v7, vcc_lo, v7, v5, vcc_lo v_mov_b32_e32 v4, v3 v_dual_mov_b32 v5, v3 :: v_dual_mov_b32 v8, s8 v_dual_mov_b32 v9, s9 :: v_dual_mov_b32 v10, s10 v_mov_b32_e32 v11, s11 s_clause 0x3 global_store_b128 v[6:7], v[2:5], off global_store_b128 v[6:7], v[8:11], off offset:16 global_store_b128 v[6:7], v[8:11], off offset:32 global_store_b128 v[6:7], v[8:11], off offset:48 s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_18 v_dual_mov_b32 v10, 0 :: v_dual_mov_b32 v11, s4 v_mov_b32_e32 v12, s5 s_clause 0x1 global_load_b64 v[13:14], v10, s[2:3] offset:32 glc global_load_b64 v[2:3], v10, s[2:3] offset:40 s_waitcnt vmcnt(0) v_readfirstlane_b32 s8, v2 v_readfirstlane_b32 s9, v3 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1) s_and_b64 s[8:9], s[8:9], s[4:5] s_mul_i32 s9, s9, 24 s_mul_hi_u32 s10, s8, 24 s_mul_i32 s8, s8, 24 s_add_i32 s10, s10, s9 v_add_co_u32 v8, vcc_lo, v0, s8 v_add_co_ci_u32_e32 v9, vcc_lo, s10, v1, vcc_lo s_mov_b32 s8, exec_lo global_store_b64 v[8:9], v[13:14], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[4:5], v10, v[11:14], s[2:3] offset:32 glc s_waitcnt vmcnt(0) v_cmpx_ne_u64_e64 v[4:5], v[13:14] s_cbranch_execz .LBB0_14 s_mov_b32 s9, 0 .LBB0_13: v_dual_mov_b32 v2, s4 :: v_dual_mov_b32 v3, s5 s_sleep 1 global_store_b64 v[8:9], v[4:5], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[2:3], v10, v[2:5], s[2:3] offset:32 glc s_waitcnt vmcnt(0) v_cmp_eq_u64_e32 vcc_lo, v[2:3], v[4:5] v_dual_mov_b32 v5, v3 :: v_dual_mov_b32 v4, v2 s_or_b32 s9, vcc_lo, s9 s_delay_alu instid0(SALU_CYCLE_1) s_and_not1_b32 exec_lo, exec_lo, s9 s_cbranch_execnz .LBB0_13 .LBB0_14: s_or_b32 exec_lo, exec_lo, s8 v_mov_b32_e32 v2, 0 s_mov_b32 s9, exec_lo s_mov_b32 s8, exec_lo v_mbcnt_lo_u32_b32 v4, s9, 0 global_load_b64 v[2:3], v2, s[2:3] offset:16 v_cmpx_eq_u32_e32 0, v4 s_cbranch_execz .LBB0_16 s_bcnt1_i32_b32 s9, s9 s_delay_alu instid0(SALU_CYCLE_1) v_dual_mov_b32 v5, 0 :: v_dual_mov_b32 v4, s9 s_waitcnt vmcnt(0) global_atomic_add_u64 v[2:3], v[4:5], off offset:8 .LBB0_16: s_or_b32 exec_lo, exec_lo, s8 s_waitcnt vmcnt(0) global_load_b64 v[4:5], v[2:3], off offset:16 s_waitcnt vmcnt(0) v_cmp_eq_u64_e32 vcc_lo, 0, v[4:5] s_cbranch_vccnz .LBB0_18 global_load_b32 v2, v[2:3], off offset:24 v_mov_b32_e32 v3, 0 s_waitcnt vmcnt(0) v_readfirstlane_b32 s8, v2 s_waitcnt_vscnt null, 0x0 global_store_b64 v[4:5], v[2:3], off s_and_b32 m0, s8, 0xff s_sendmsg sendmsg(MSG_INTERRUPT) .LBB0_18: s_or_b32 exec_lo, exec_lo, s1 s_mul_i32 s1, s7, 24 s_mul_hi_u32 s7, s6, 24 s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1) s_add_i32 s7, s7, s1 s_mul_i32 s1, s6, 24 v_add_co_u32 v0, vcc_lo, v0, s1 v_add_co_ci_u32_e32 v1, vcc_lo, s7, v1, vcc_lo s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_add_co_u32 v0, vcc_lo, v0, 20 v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo s_branch .LBB0_22 .p2align 6 .LBB0_19: s_or_b32 exec_lo, exec_lo, s1 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_readfirstlane_b32 s1, v2 s_cmp_eq_u32 s1, 0 s_cbranch_scc1 .LBB0_21 s_sleep 1 s_cbranch_execnz .LBB0_22 s_branch .LBB0_24 .p2align 6 .LBB0_21: s_branch .LBB0_24 .LBB0_22: v_mov_b32_e32 v2, 1 s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_19 global_load_b32 v2, v[0:1], off glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv v_and_b32_e32 v2, 1, v2 s_branch .LBB0_19 .LBB0_24: global_load_b64 v[22:23], v[6:7], off s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_28 v_mov_b32_e32 v6, 0 s_clause 0x2 global_load_b64 v[2:3], v6, s[2:3] offset:40 global_load_b64 v[7:8], v6, s[2:3] offset:24 glc global_load_b64 v[4:5], v6, s[2:3] s_waitcnt vmcnt(2) v_add_co_u32 v9, vcc_lo, v2, 1 v_add_co_ci_u32_e32 v10, vcc_lo, 0, v3, vcc_lo s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_add_co_u32 v0, vcc_lo, v9, s4 v_add_co_ci_u32_e32 v1, vcc_lo, s5, v10, vcc_lo s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_cmp_eq_u64_e32 vcc_lo, 0, v[0:1] v_dual_cndmask_b32 v1, v1, v10 :: v_dual_cndmask_b32 v0, v0, v9 v_and_b32_e32 v3, v1, v3 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_and_b32_e32 v2, v0, v2 v_mul_lo_u32 v3, v3, 24 s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2) v_mul_hi_u32 v9, v2, 24 v_mul_lo_u32 v2, v2, 24 v_add_nc_u32_e32 v3, v9, v3 s_waitcnt vmcnt(0) s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3) v_add_co_u32 v4, vcc_lo, v4, v2 v_mov_b32_e32 v2, v7 v_add_co_ci_u32_e32 v5, vcc_lo, v5, v3, vcc_lo v_mov_b32_e32 v3, v8 global_store_b64 v[4:5], v[7:8], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[2:3], v6, v[0:3], s[2:3] offset:24 glc s_waitcnt vmcnt(0) v_cmp_ne_u64_e32 vcc_lo, v[2:3], v[7:8] s_and_b32 exec_lo, exec_lo, vcc_lo s_cbranch_execz .LBB0_28 s_mov_b32 s0, 0 .LBB0_27: s_sleep 1 global_store_b64 v[4:5], v[2:3], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[7:8], v6, v[0:3], s[2:3] offset:24 glc s_waitcnt vmcnt(0) v_cmp_eq_u64_e32 vcc_lo, v[7:8], v[2:3] v_dual_mov_b32 v2, v7 :: v_dual_mov_b32 v3, v8 s_or_b32 s0, vcc_lo, s0 s_delay_alu instid0(SALU_CYCLE_1) s_and_not1_b32 exec_lo, exec_lo, s0 s_cbranch_execnz .LBB0_27 .LBB0_28: s_or_b32 exec_lo, exec_lo, s1 s_getpc_b64 s[4:5] s_add_u32 s4, s4, .str@rel32@lo+4 s_addc_u32 s5, s5, .str@rel32@hi+12 s_mov_b32 s0, -1 s_cmp_lg_u64 s[4:5], 0 s_cbranch_scc0 .LBB0_107 s_waitcnt vmcnt(0) v_dual_mov_b32 v1, v23 :: v_dual_and_b32 v0, -3, v22 v_mov_b32_e32 v25, 0 s_mov_b64 s[6:7], 28 s_branch .LBB0_31 .LBB0_30: s_or_b32 exec_lo, exec_lo, s1 s_sub_u32 s6, s6, s8 s_subb_u32 s7, s7, s9 s_add_u32 s4, s4, s8 s_addc_u32 s5, s5, s9 s_cmp_lg_u64 s[6:7], 0 s_cbranch_scc0 .LBB0_106 .LBB0_31: v_cmp_lt_u64_e64 s0, s[6:7], 56 s_delay_alu instid0(VALU_DEP_1) s_and_b32 s0, s0, exec_lo s_cselect_b32 s8, s6, 56 s_cselect_b32 s9, s7, 0 s_cmp_gt_u32 s8, 7 s_mov_b32 s0, -1 s_cbranch_scc1 .LBB0_36 v_mov_b32_e32 v2, 0 v_mov_b32_e32 v3, 0 s_cmp_eq_u32 s8, 0 s_cbranch_scc1 .LBB0_35 s_lshl_b64 s[0:1], s[8:9], 3 s_mov_b64 s[10:11], 0 s_mov_b64 s[12:13], s[4:5] .LBB0_34: global_load_u8 v4, v25, s[12:13] s_waitcnt vmcnt(0) v_and_b32_e32 v24, 0xffff, v4 s_delay_alu instid0(VALU_DEP_1) v_lshlrev_b64 v[4:5], s10, v[24:25] s_add_u32 s10, s10, 8 s_addc_u32 s11, s11, 0 s_add_u32 s12, s12, 1 s_addc_u32 s13, s13, 0 s_cmp_lg_u32 s0, s10 v_or_b32_e32 v2, v4, v2 v_or_b32_e32 v3, v5, v3 s_cbranch_scc1 .LBB0_34 .LBB0_35: s_mov_b32 s0, 0 s_mov_b32 s15, 0 .LBB0_36: s_and_not1_b32 vcc_lo, exec_lo, s0 s_mov_b64 s[0:1], s[4:5] s_cbranch_vccnz .LBB0_38 global_load_b64 v[2:3], v25, s[4:5] s_add_i32 s15, s8, -8 s_add_u32 s0, s4, 8 s_addc_u32 s1, s5, 0 .LBB0_38: s_cmp_gt_u32 s15, 7 s_cbranch_scc1 .LBB0_43 v_mov_b32_e32 v4, 0 v_mov_b32_e32 v5, 0 s_cmp_eq_u32 s15, 0 s_cbranch_scc1 .LBB0_42 s_mov_b64 s[10:11], 0 s_mov_b64 s[12:13], 0 .LBB0_41: s_delay_alu instid0(SALU_CYCLE_1) s_add_u32 s16, s0, s12 s_addc_u32 s17, s1, s13 s_add_u32 s12, s12, 1 global_load_u8 v6, v25, s[16:17] s_addc_u32 s13, s13, 0 s_waitcnt vmcnt(0) v_and_b32_e32 v24, 0xffff, v6 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1) v_lshlrev_b64 v[6:7], s10, v[24:25] s_add_u32 s10, s10, 8 s_addc_u32 s11, s11, 0 s_cmp_lg_u32 s15, s12 v_or_b32_e32 v4, v6, v4 s_delay_alu instid0(VALU_DEP_2) v_or_b32_e32 v5, v7, v5 s_cbranch_scc1 .LBB0_41 .LBB0_42: s_mov_b32 s14, 0 s_cbranch_execz .LBB0_44 s_branch .LBB0_45 .LBB0_43: .LBB0_44: global_load_b64 v[4:5], v25, s[0:1] s_add_i32 s14, s15, -8 s_add_u32 s0, s0, 8 s_addc_u32 s1, s1, 0 .LBB0_45: s_cmp_gt_u32 s14, 7 s_cbranch_scc1 .LBB0_50 v_mov_b32_e32 v6, 0 v_mov_b32_e32 v7, 0 s_cmp_eq_u32 s14, 0 s_cbranch_scc1 .LBB0_49 s_mov_b64 s[10:11], 0 s_mov_b64 s[12:13], 0 .LBB0_48: s_delay_alu instid0(SALU_CYCLE_1) s_add_u32 s16, s0, s12 s_addc_u32 s17, s1, s13 s_add_u32 s12, s12, 1 global_load_u8 v8, v25, s[16:17] s_addc_u32 s13, s13, 0 s_waitcnt vmcnt(0) v_and_b32_e32 v24, 0xffff, v8 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1) v_lshlrev_b64 v[8:9], s10, v[24:25] s_add_u32 s10, s10, 8 s_addc_u32 s11, s11, 0 s_cmp_lg_u32 s14, s12 v_or_b32_e32 v6, v8, v6 s_delay_alu instid0(VALU_DEP_2) v_or_b32_e32 v7, v9, v7 s_cbranch_scc1 .LBB0_48 .LBB0_49: s_mov_b32 s15, 0 s_cbranch_execz .LBB0_51 s_branch .LBB0_52 .LBB0_50: .LBB0_51: global_load_b64 v[6:7], v25, s[0:1] s_add_i32 s15, s14, -8 s_add_u32 s0, s0, 8 s_addc_u32 s1, s1, 0 .LBB0_52: s_cmp_gt_u32 s15, 7 s_cbranch_scc1 .LBB0_57 v_mov_b32_e32 v8, 0 v_mov_b32_e32 v9, 0 s_cmp_eq_u32 s15, 0 s_cbranch_scc1 .LBB0_56 s_mov_b64 s[10:11], 0 s_mov_b64 s[12:13], 0 .LBB0_55: s_delay_alu instid0(SALU_CYCLE_1) s_add_u32 s16, s0, s12 s_addc_u32 s17, s1, s13 s_add_u32 s12, s12, 1 global_load_u8 v10, v25, s[16:17] s_addc_u32 s13, s13, 0 s_waitcnt vmcnt(0) v_and_b32_e32 v24, 0xffff, v10 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1) v_lshlrev_b64 v[10:11], s10, v[24:25] s_add_u32 s10, s10, 8 s_addc_u32 s11, s11, 0 s_cmp_lg_u32 s15, s12 v_or_b32_e32 v8, v10, v8 s_delay_alu instid0(VALU_DEP_2) v_or_b32_e32 v9, v11, v9 s_cbranch_scc1 .LBB0_55 .LBB0_56: s_mov_b32 s14, 0 s_cbranch_execz .LBB0_58 s_branch .LBB0_59 .LBB0_57: .LBB0_58: global_load_b64 v[8:9], v25, s[0:1] s_add_i32 s14, s15, -8 s_add_u32 s0, s0, 8 s_addc_u32 s1, s1, 0 .LBB0_59: s_cmp_gt_u32 s14, 7 s_cbranch_scc1 .LBB0_64 v_mov_b32_e32 v10, 0 v_mov_b32_e32 v11, 0 s_cmp_eq_u32 s14, 0 s_cbranch_scc1 .LBB0_63 s_mov_b64 s[10:11], 0 s_mov_b64 s[12:13], 0 .LBB0_62: s_delay_alu instid0(SALU_CYCLE_1) s_add_u32 s16, s0, s12 s_addc_u32 s17, s1, s13 s_add_u32 s12, s12, 1 global_load_u8 v12, v25, s[16:17] s_addc_u32 s13, s13, 0 s_waitcnt vmcnt(0) v_and_b32_e32 v24, 0xffff, v12 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1) v_lshlrev_b64 v[12:13], s10, v[24:25] s_add_u32 s10, s10, 8 s_addc_u32 s11, s11, 0 s_cmp_lg_u32 s14, s12 v_or_b32_e32 v10, v12, v10 s_delay_alu instid0(VALU_DEP_2) v_or_b32_e32 v11, v13, v11 s_cbranch_scc1 .LBB0_62 .LBB0_63: s_mov_b32 s15, 0 s_cbranch_execz .LBB0_65 s_branch .LBB0_66 .LBB0_64: .LBB0_65: global_load_b64 v[10:11], v25, s[0:1] s_add_i32 s15, s14, -8 s_add_u32 s0, s0, 8 s_addc_u32 s1, s1, 0 .LBB0_66: s_cmp_gt_u32 s15, 7 s_cbranch_scc1 .LBB0_71 v_mov_b32_e32 v12, 0 v_mov_b32_e32 v13, 0 s_cmp_eq_u32 s15, 0 s_cbranch_scc1 .LBB0_70 s_mov_b64 s[10:11], 0 s_mov_b64 s[12:13], 0 .LBB0_69: s_delay_alu instid0(SALU_CYCLE_1) s_add_u32 s16, s0, s12 s_addc_u32 s17, s1, s13 s_add_u32 s12, s12, 1 global_load_u8 v14, v25, s[16:17] s_addc_u32 s13, s13, 0 s_waitcnt vmcnt(0) v_and_b32_e32 v24, 0xffff, v14 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1) v_lshlrev_b64 v[14:15], s10, v[24:25] s_add_u32 s10, s10, 8 s_addc_u32 s11, s11, 0 s_cmp_lg_u32 s15, s12 v_or_b32_e32 v12, v14, v12 s_delay_alu instid0(VALU_DEP_2) v_or_b32_e32 v13, v15, v13 s_cbranch_scc1 .LBB0_69 .LBB0_70: s_mov_b32 s14, 0 s_cbranch_execz .LBB0_72 s_branch .LBB0_73 .LBB0_71: .LBB0_72: global_load_b64 v[12:13], v25, s[0:1] s_add_i32 s14, s15, -8 s_add_u32 s0, s0, 8 s_addc_u32 s1, s1, 0 .LBB0_73: s_cmp_gt_u32 s14, 7 s_cbranch_scc1 .LBB0_78 v_mov_b32_e32 v14, 0 v_mov_b32_e32 v15, 0 s_cmp_eq_u32 s14, 0 s_cbranch_scc1 .LBB0_77 s_mov_b64 s[10:11], 0 s_mov_b64 s[12:13], s[0:1] .LBB0_76: global_load_u8 v16, v25, s[12:13] s_add_i32 s14, s14, -1 s_waitcnt vmcnt(0) v_and_b32_e32 v24, 0xffff, v16 s_delay_alu instid0(VALU_DEP_1) v_lshlrev_b64 v[16:17], s10, v[24:25] s_add_u32 s10, s10, 8 s_addc_u32 s11, s11, 0 s_add_u32 s12, s12, 1 s_addc_u32 s13, s13, 0 s_cmp_lg_u32 s14, 0 v_or_b32_e32 v14, v16, v14 v_or_b32_e32 v15, v17, v15 s_cbranch_scc1 .LBB0_76 .LBB0_77: s_cbranch_execz .LBB0_79 s_branch .LBB0_80 .LBB0_78: .LBB0_79: global_load_b64 v[14:15], v25, s[0:1] .LBB0_80: v_mov_b32_e32 v24, v20 v_mov_b32_e32 v26, 0 v_mov_b32_e32 v27, 0 s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1) v_readfirstlane_b32 s0, v24 v_cmp_eq_u32_e64 s0, s0, v24 s_delay_alu instid0(VALU_DEP_1) s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_86 global_load_b64 v[18:19], v25, s[2:3] offset:24 glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv s_clause 0x1 global_load_b64 v[16:17], v25, s[2:3] offset:40 global_load_b64 v[26:27], v25, s[2:3] s_mov_b32 s10, exec_lo s_waitcnt vmcnt(1) v_and_b32_e32 v17, v17, v19 v_and_b32_e32 v16, v16, v18 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_mul_lo_u32 v17, v17, 24 v_mul_hi_u32 v21, v16, 24 v_mul_lo_u32 v16, v16, 24 s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2) v_add_nc_u32_e32 v17, v21, v17 s_waitcnt vmcnt(0) v_add_co_u32 v16, vcc_lo, v26, v16 s_delay_alu instid0(VALU_DEP_2) v_add_co_ci_u32_e32 v17, vcc_lo, v27, v17, vcc_lo global_load_b64 v[16:17], v[16:17], off glc s_waitcnt vmcnt(0) global_atomic_cmpswap_b64 v[26:27], v25, v[16:19], s[2:3] offset:24 glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv v_cmpx_ne_u64_e64 v[26:27], v[18:19] s_cbranch_execz .LBB0_85 s_mov_b32 s11, 0 .p2align 6 .LBB0_83: s_sleep 1 s_clause 0x1 global_load_b64 v[16:17], v25, s[2:3] offset:40 global_load_b64 v[28:29], v25, s[2:3] v_dual_mov_b32 v18, v26 :: v_dual_mov_b32 v19, v27 s_waitcnt vmcnt(1) s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_and_b32_e32 v16, v16, v18 s_waitcnt vmcnt(0) v_mad_u64_u32 v[26:27], null, v16, 24, v[28:29] s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_dual_mov_b32 v16, v27 :: v_dual_and_b32 v17, v17, v19 v_mad_u64_u32 v[27:28], null, v17, 24, v[16:17] global_load_b64 v[16:17], v[26:27], off glc s_waitcnt vmcnt(0) global_atomic_cmpswap_b64 v[26:27], v25, v[16:19], s[2:3] offset:24 glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv v_cmp_eq_u64_e32 vcc_lo, v[26:27], v[18:19] s_or_b32 s11, vcc_lo, s11 s_delay_alu instid0(SALU_CYCLE_1) s_and_not1_b32 exec_lo, exec_lo, s11 s_cbranch_execnz .LBB0_83 s_or_b32 exec_lo, exec_lo, s11 .LBB0_85: s_delay_alu instid0(SALU_CYCLE_1) s_or_b32 exec_lo, exec_lo, s10 .LBB0_86: s_delay_alu instid0(SALU_CYCLE_1) s_or_b32 exec_lo, exec_lo, s1 s_clause 0x1 global_load_b64 v[28:29], v25, s[2:3] offset:40 global_load_b128 v[16:19], v25, s[2:3] v_readfirstlane_b32 s10, v26 v_readfirstlane_b32 s11, v27 s_mov_b32 s14, exec_lo s_waitcnt vmcnt(1) v_readfirstlane_b32 s12, v28 v_readfirstlane_b32 s13, v29 s_delay_alu instid0(VALU_DEP_1) s_and_b64 s[12:13], s[10:11], s[12:13] s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_88 v_dual_mov_b32 v26, s14 :: v_dual_mov_b32 v27, 0 s_mul_i32 s14, s13, 24 s_mul_hi_u32 s15, s12, 24 v_dual_mov_b32 v28, 2 :: v_dual_mov_b32 v29, 1 s_add_i32 s15, s15, s14 s_mul_i32 s14, s12, 24 s_waitcnt vmcnt(0) v_add_co_u32 v30, vcc_lo, v16, s14 v_add_co_ci_u32_e32 v31, vcc_lo, s15, v17, vcc_lo global_store_b128 v[30:31], v[26:29], off offset:8 .LBB0_88: s_or_b32 exec_lo, exec_lo, s1 v_cmp_gt_u64_e64 vcc_lo, s[6:7], 56 v_or_b32_e32 v21, 2, v0 s_lshl_b64 s[14:15], s[12:13], 12 v_lshlrev_b64 v[26:27], 6, v[24:25] s_lshl_b32 s1, s8, 2 s_delay_alu instid0(SALU_CYCLE_1) s_add_i32 s1, s1, 28 v_cndmask_b32_e32 v0, v21, v0, vcc_lo s_waitcnt vmcnt(0) v_add_co_u32 v18, vcc_lo, v18, s14 v_add_co_ci_u32_e32 v19, vcc_lo, s15, v19, vcc_lo s_and_b32 s1, s1, 0x1e0 s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3) v_add_co_u32 v18, vcc_lo, v18, v26 v_and_or_b32 v0, v0, 0xffffff1f, s1 v_add_co_ci_u32_e32 v19, vcc_lo, v19, v27, vcc_lo s_clause 0x3 global_store_b128 v[18:19], v[0:3], off global_store_b128 v[18:19], v[4:7], off offset:16 global_store_b128 v[18:19], v[8:11], off offset:32 global_store_b128 v[18:19], v[12:15], off offset:48 s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_96 s_clause 0x1 global_load_b64 v[8:9], v25, s[2:3] offset:32 glc global_load_b64 v[0:1], v25, s[2:3] offset:40 v_dual_mov_b32 v6, s10 :: v_dual_mov_b32 v7, s11 s_waitcnt vmcnt(0) v_readfirstlane_b32 s14, v0 v_readfirstlane_b32 s15, v1 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1) s_and_b64 s[14:15], s[14:15], s[10:11] s_mul_i32 s15, s15, 24 s_mul_hi_u32 s16, s14, 24 s_mul_i32 s14, s14, 24 s_add_i32 s16, s16, s15 v_add_co_u32 v4, vcc_lo, v16, s14 v_add_co_ci_u32_e32 v5, vcc_lo, s16, v17, vcc_lo s_mov_b32 s14, exec_lo global_store_b64 v[4:5], v[8:9], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[2:3], v25, v[6:9], s[2:3] offset:32 glc s_waitcnt vmcnt(0) v_cmpx_ne_u64_e64 v[2:3], v[8:9] s_cbranch_execz .LBB0_92 s_mov_b32 s15, 0 .LBB0_91: v_dual_mov_b32 v0, s10 :: v_dual_mov_b32 v1, s11 s_sleep 1 global_store_b64 v[4:5], v[2:3], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[0:1], v25, v[0:3], s[2:3] offset:32 glc s_waitcnt vmcnt(0) v_cmp_eq_u64_e32 vcc_lo, v[0:1], v[2:3] v_dual_mov_b32 v3, v1 :: v_dual_mov_b32 v2, v0 s_or_b32 s15, vcc_lo, s15 s_delay_alu instid0(SALU_CYCLE_1) s_and_not1_b32 exec_lo, exec_lo, s15 s_cbranch_execnz .LBB0_91 .LBB0_92: s_or_b32 exec_lo, exec_lo, s14 global_load_b64 v[0:1], v25, s[2:3] offset:16 s_mov_b32 s15, exec_lo s_mov_b32 s14, exec_lo v_mbcnt_lo_u32_b32 v2, s15, 0 s_delay_alu instid0(VALU_DEP_1) v_cmpx_eq_u32_e32 0, v2 s_cbranch_execz .LBB0_94 s_bcnt1_i32_b32 s15, s15 s_delay_alu instid0(SALU_CYCLE_1) v_dual_mov_b32 v3, 0 :: v_dual_mov_b32 v2, s15 s_waitcnt vmcnt(0) global_atomic_add_u64 v[0:1], v[2:3], off offset:8 .LBB0_94: s_or_b32 exec_lo, exec_lo, s14 s_waitcnt vmcnt(0) global_load_b64 v[2:3], v[0:1], off offset:16 s_waitcnt vmcnt(0) v_cmp_eq_u64_e32 vcc_lo, 0, v[2:3] s_cbranch_vccnz .LBB0_96 global_load_b32 v24, v[0:1], off offset:24 s_waitcnt vmcnt(0) v_readfirstlane_b32 s14, v24 s_waitcnt_vscnt null, 0x0 global_store_b64 v[2:3], v[24:25], off s_and_b32 m0, s14, 0xff s_sendmsg sendmsg(MSG_INTERRUPT) .LBB0_96: s_or_b32 exec_lo, exec_lo, s1 s_mul_i32 s1, s13, 24 s_mul_hi_u32 s13, s12, 24 s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1) s_add_i32 s13, s13, s1 s_mul_i32 s1, s12, 24 v_add_co_u32 v0, vcc_lo, v16, s1 v_add_co_ci_u32_e32 v1, vcc_lo, s13, v17, vcc_lo s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_add_co_u32 v0, vcc_lo, v0, 20 v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo s_branch .LBB0_100 .p2align 6 .LBB0_97: s_or_b32 exec_lo, exec_lo, s1 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_readfirstlane_b32 s1, v2 s_cmp_eq_u32 s1, 0 s_cbranch_scc1 .LBB0_99 s_sleep 1 s_cbranch_execnz .LBB0_100 s_branch .LBB0_102 .p2align 6 .LBB0_99: s_branch .LBB0_102 .LBB0_100: v_mov_b32_e32 v2, 1 s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_97 global_load_b32 v2, v[0:1], off glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv v_and_b32_e32 v2, 1, v2 s_branch .LBB0_97 .LBB0_102: global_load_b64 v[0:1], v[18:19], off s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_30 s_clause 0x2 global_load_b64 v[4:5], v25, s[2:3] offset:40 global_load_b64 v[8:9], v25, s[2:3] offset:24 glc global_load_b64 v[6:7], v25, s[2:3] s_waitcnt vmcnt(2) v_add_co_u32 v10, vcc_lo, v4, 1 v_add_co_ci_u32_e32 v11, vcc_lo, 0, v5, vcc_lo s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_add_co_u32 v2, vcc_lo, v10, s10 v_add_co_ci_u32_e32 v3, vcc_lo, s11, v11, vcc_lo s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_cmp_eq_u64_e32 vcc_lo, 0, v[2:3] v_dual_cndmask_b32 v3, v3, v11 :: v_dual_cndmask_b32 v2, v2, v10 v_and_b32_e32 v5, v3, v5 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1) v_and_b32_e32 v4, v2, v4 v_mul_hi_u32 v10, v4, 24 v_mul_lo_u32 v4, v4, 24 s_waitcnt vmcnt(0) s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1) v_add_co_u32 v6, vcc_lo, v6, v4 v_mov_b32_e32 v4, v8 v_mul_lo_u32 v5, v5, 24 v_add_nc_u32_e32 v5, v10, v5 s_delay_alu instid0(VALU_DEP_1) v_add_co_ci_u32_e32 v7, vcc_lo, v7, v5, vcc_lo v_mov_b32_e32 v5, v9 global_store_b64 v[6:7], v[8:9], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[4:5], v25, v[2:5], s[2:3] offset:24 glc s_waitcnt vmcnt(0) v_cmp_ne_u64_e32 vcc_lo, v[4:5], v[8:9] s_and_b32 exec_lo, exec_lo, vcc_lo s_cbranch_execz .LBB0_30 s_mov_b32 s0, 0 .LBB0_105: s_sleep 1 global_store_b64 v[6:7], v[4:5], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[8:9], v25, v[2:5], s[2:3] offset:24 glc s_waitcnt vmcnt(0) v_cmp_eq_u64_e32 vcc_lo, v[8:9], v[4:5] v_dual_mov_b32 v4, v8 :: v_dual_mov_b32 v5, v9 s_or_b32 s0, vcc_lo, s0 s_delay_alu instid0(SALU_CYCLE_1) s_and_not1_b32 exec_lo, exec_lo, s0 s_cbranch_execnz .LBB0_105 s_branch .LBB0_30 .LBB0_106: s_mov_b32 s0, 0 .LBB0_107: s_delay_alu instid0(SALU_CYCLE_1) s_and_b32 vcc_lo, exec_lo, s0 s_cbranch_vccz .LBB0_134 v_readfirstlane_b32 s0, v20 v_mov_b32_e32 v4, 0 v_mov_b32_e32 v5, 0 s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1) v_cmp_eq_u32_e64 s0, s0, v20 s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_114 s_waitcnt vmcnt(0) v_mov_b32_e32 v0, 0 s_mov_b32 s4, exec_lo global_load_b64 v[6:7], v0, s[2:3] offset:24 glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv s_clause 0x1 global_load_b64 v[1:2], v0, s[2:3] offset:40 global_load_b64 v[3:4], v0, s[2:3] s_waitcnt vmcnt(1) v_and_b32_e32 v1, v1, v6 v_and_b32_e32 v2, v2, v7 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_mul_hi_u32 v5, v1, 24 v_mul_lo_u32 v2, v2, 24 v_mul_lo_u32 v1, v1, 24 s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2) v_add_nc_u32_e32 v2, v5, v2 s_waitcnt vmcnt(0) v_add_co_u32 v1, vcc_lo, v3, v1 s_delay_alu instid0(VALU_DEP_2) v_add_co_ci_u32_e32 v2, vcc_lo, v4, v2, vcc_lo global_load_b64 v[4:5], v[1:2], off glc s_waitcnt vmcnt(0) global_atomic_cmpswap_b64 v[4:5], v0, v[4:7], s[2:3] offset:24 glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv v_cmpx_ne_u64_e64 v[4:5], v[6:7] s_cbranch_execz .LBB0_113 s_mov_b32 s5, 0 .p2align 6 .LBB0_111: s_sleep 1 s_clause 0x1 global_load_b64 v[1:2], v0, s[2:3] offset:40 global_load_b64 v[8:9], v0, s[2:3] v_dual_mov_b32 v7, v5 :: v_dual_mov_b32 v6, v4 s_waitcnt vmcnt(1) s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_and_b32_e32 v1, v1, v6 s_waitcnt vmcnt(0) v_mad_u64_u32 v[3:4], null, v1, 24, v[8:9] s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_dual_mov_b32 v1, v4 :: v_dual_and_b32 v2, v2, v7 v_mad_u64_u32 v[4:5], null, v2, 24, v[1:2] global_load_b64 v[4:5], v[3:4], off glc s_waitcnt vmcnt(0) global_atomic_cmpswap_b64 v[4:5], v0, v[4:7], s[2:3] offset:24 glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv v_cmp_eq_u64_e32 vcc_lo, v[4:5], v[6:7] s_or_b32 s5, vcc_lo, s5 s_delay_alu instid0(SALU_CYCLE_1) s_and_not1_b32 exec_lo, exec_lo, s5 s_cbranch_execnz .LBB0_111 s_or_b32 exec_lo, exec_lo, s5 .LBB0_113: s_delay_alu instid0(SALU_CYCLE_1) s_or_b32 exec_lo, exec_lo, s4 .LBB0_114: s_delay_alu instid0(SALU_CYCLE_1) s_or_b32 exec_lo, exec_lo, s1 v_mov_b32_e32 v21, 0 v_readfirstlane_b32 s4, v4 v_readfirstlane_b32 s5, v5 s_mov_b32 s8, exec_lo s_clause 0x1 global_load_b64 v[6:7], v21, s[2:3] offset:40 global_load_b128 v[0:3], v21, s[2:3] s_waitcnt vmcnt(1) v_readfirstlane_b32 s6, v6 v_readfirstlane_b32 s7, v7 s_delay_alu instid0(VALU_DEP_1) s_and_b64 s[6:7], s[4:5], s[6:7] s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_116 v_dual_mov_b32 v4, s8 :: v_dual_mov_b32 v5, 0 s_mul_i32 s8, s7, 24 s_mul_hi_u32 s9, s6, 24 v_dual_mov_b32 v6, 2 :: v_dual_mov_b32 v7, 1 s_add_i32 s9, s9, s8 s_mul_i32 s8, s6, 24 s_waitcnt vmcnt(0) v_add_co_u32 v8, vcc_lo, v0, s8 v_add_co_ci_u32_e32 v9, vcc_lo, s9, v1, vcc_lo global_store_b128 v[8:9], v[4:7], off offset:8 .LBB0_116: s_or_b32 exec_lo, exec_lo, s1 s_lshl_b64 s[8:9], s[6:7], 12 v_and_or_b32 v22, v22, 0xffffff1d, 34 s_waitcnt vmcnt(0) v_add_co_u32 v4, vcc_lo, v2, s8 v_add_co_ci_u32_e32 v5, vcc_lo, s9, v3, vcc_lo v_lshlrev_b64 v[2:3], 6, v[20:21] s_mov_b32 s8, 0 s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(VALU_DEP_1) s_mov_b32 s9, s8 s_mov_b32 s10, s8 s_mov_b32 s11, s8 v_add_co_u32 v8, vcc_lo, v4, v2 v_mov_b32_e32 v6, 0 v_add_co_ci_u32_e32 v9, vcc_lo, v5, v3, vcc_lo v_dual_mov_b32 v2, s8 :: v_dual_mov_b32 v5, s11 v_dual_mov_b32 v3, s9 :: v_dual_mov_b32 v4, s10 s_delay_alu instid0(VALU_DEP_4) v_mov_b32_e32 v7, v6 s_clause 0x4 global_store_b64 v[8:9], v[22:23], off global_store_b128 v[8:9], v[2:5], off offset:8 global_store_b128 v[8:9], v[2:5], off offset:24 global_store_b128 v[8:9], v[2:5], off offset:40 global_store_b64 v[8:9], v[6:7], off offset:56 s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_124 v_dual_mov_b32 v8, 0 :: v_dual_mov_b32 v9, s4 v_mov_b32_e32 v10, s5 s_clause 0x1 global_load_b64 v[11:12], v8, s[2:3] offset:32 glc global_load_b64 v[2:3], v8, s[2:3] offset:40 s_waitcnt vmcnt(0) v_readfirstlane_b32 s8, v2 v_readfirstlane_b32 s9, v3 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1) s_and_b64 s[8:9], s[8:9], s[4:5] s_mul_i32 s9, s9, 24 s_mul_hi_u32 s10, s8, 24 s_mul_i32 s8, s8, 24 s_add_i32 s10, s10, s9 v_add_co_u32 v6, vcc_lo, v0, s8 v_add_co_ci_u32_e32 v7, vcc_lo, s10, v1, vcc_lo s_mov_b32 s8, exec_lo global_store_b64 v[6:7], v[11:12], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[4:5], v8, v[9:12], s[2:3] offset:32 glc s_waitcnt vmcnt(0) v_cmpx_ne_u64_e64 v[4:5], v[11:12] s_cbranch_execz .LBB0_120 s_mov_b32 s9, 0 .LBB0_119: v_dual_mov_b32 v2, s4 :: v_dual_mov_b32 v3, s5 s_sleep 1 global_store_b64 v[6:7], v[4:5], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[2:3], v8, v[2:5], s[2:3] offset:32 glc s_waitcnt vmcnt(0) v_cmp_eq_u64_e32 vcc_lo, v[2:3], v[4:5] v_dual_mov_b32 v5, v3 :: v_dual_mov_b32 v4, v2 s_or_b32 s9, vcc_lo, s9 s_delay_alu instid0(SALU_CYCLE_1) s_and_not1_b32 exec_lo, exec_lo, s9 s_cbranch_execnz .LBB0_119 .LBB0_120: s_or_b32 exec_lo, exec_lo, s8 v_mov_b32_e32 v2, 0 s_mov_b32 s9, exec_lo s_mov_b32 s8, exec_lo v_mbcnt_lo_u32_b32 v4, s9, 0 global_load_b64 v[2:3], v2, s[2:3] offset:16 v_cmpx_eq_u32_e32 0, v4 s_cbranch_execz .LBB0_122 s_bcnt1_i32_b32 s9, s9 s_delay_alu instid0(SALU_CYCLE_1) v_dual_mov_b32 v5, 0 :: v_dual_mov_b32 v4, s9 s_waitcnt vmcnt(0) global_atomic_add_u64 v[2:3], v[4:5], off offset:8 .LBB0_122: s_or_b32 exec_lo, exec_lo, s8 s_waitcnt vmcnt(0) global_load_b64 v[4:5], v[2:3], off offset:16 s_waitcnt vmcnt(0) v_cmp_eq_u64_e32 vcc_lo, 0, v[4:5] s_cbranch_vccnz .LBB0_124 global_load_b32 v2, v[2:3], off offset:24 v_mov_b32_e32 v3, 0 s_waitcnt vmcnt(0) v_readfirstlane_b32 s8, v2 s_waitcnt_vscnt null, 0x0 global_store_b64 v[4:5], v[2:3], off s_and_b32 m0, s8, 0xff s_sendmsg sendmsg(MSG_INTERRUPT) .LBB0_124: s_or_b32 exec_lo, exec_lo, s1 s_mul_i32 s1, s7, 24 s_mul_hi_u32 s7, s6, 24 s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1) s_add_i32 s7, s7, s1 s_mul_i32 s1, s6, 24 v_add_co_u32 v0, vcc_lo, v0, s1 v_add_co_ci_u32_e32 v1, vcc_lo, s7, v1, vcc_lo s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_add_co_u32 v0, vcc_lo, v0, 20 v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo s_branch .LBB0_128 .p2align 6 .LBB0_125: s_or_b32 exec_lo, exec_lo, s1 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_readfirstlane_b32 s1, v2 s_cmp_eq_u32 s1, 0 s_cbranch_scc1 .LBB0_127 s_sleep 1 s_cbranch_execnz .LBB0_128 s_branch .LBB0_130 .p2align 6 .LBB0_127: s_branch .LBB0_130 .LBB0_128: v_mov_b32_e32 v2, 1 s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_125 global_load_b32 v2, v[0:1], off glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv v_and_b32_e32 v2, 1, v2 s_branch .LBB0_125 .LBB0_130: s_and_b32 exec_lo, exec_lo, s0 s_cbranch_execz .LBB0_134 v_mov_b32_e32 v6, 0 s_clause 0x2 global_load_b64 v[2:3], v6, s[2:3] offset:40 global_load_b64 v[7:8], v6, s[2:3] offset:24 glc global_load_b64 v[4:5], v6, s[2:3] s_waitcnt vmcnt(2) v_add_co_u32 v9, vcc_lo, v2, 1 v_add_co_ci_u32_e32 v10, vcc_lo, 0, v3, vcc_lo s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_add_co_u32 v0, vcc_lo, v9, s4 v_add_co_ci_u32_e32 v1, vcc_lo, s5, v10, vcc_lo s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_cmp_eq_u64_e32 vcc_lo, 0, v[0:1] v_dual_cndmask_b32 v1, v1, v10 :: v_dual_cndmask_b32 v0, v0, v9 v_and_b32_e32 v3, v1, v3 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_and_b32_e32 v2, v0, v2 v_mul_lo_u32 v3, v3, 24 s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2) v_mul_hi_u32 v9, v2, 24 v_mul_lo_u32 v2, v2, 24 v_add_nc_u32_e32 v3, v9, v3 s_waitcnt vmcnt(0) s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3) v_add_co_u32 v4, vcc_lo, v4, v2 v_mov_b32_e32 v2, v7 v_add_co_ci_u32_e32 v5, vcc_lo, v5, v3, vcc_lo v_mov_b32_e32 v3, v8 global_store_b64 v[4:5], v[7:8], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[2:3], v6, v[0:3], s[2:3] offset:24 glc s_waitcnt vmcnt(0) v_cmp_ne_u64_e32 vcc_lo, v[2:3], v[7:8] s_and_b32 exec_lo, exec_lo, vcc_lo s_cbranch_execz .LBB0_134 s_mov_b32 s0, 0 .LBB0_133: s_sleep 1 global_store_b64 v[4:5], v[2:3], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[7:8], v6, v[0:3], s[2:3] offset:24 glc s_waitcnt vmcnt(0) v_cmp_eq_u64_e32 vcc_lo, v[7:8], v[2:3] v_dual_mov_b32 v2, v7 :: v_dual_mov_b32 v3, v8 s_or_b32 s0, vcc_lo, s0 s_delay_alu instid0(SALU_CYCLE_1) s_and_not1_b32 exec_lo, exec_lo, s0 s_cbranch_execnz .LBB0_133 .LBB0_134: s_nop 0 s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z7dkernelPjj .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 32 .amdhsa_next_free_sgpr 18 .amdhsa_float_round_mode_32 0 .amdhsa_float_round_mode_16_64 0 .amdhsa_float_denorm_mode_32 3 .amdhsa_float_denorm_mode_16_64 3 .amdhsa_dx10_clamp 1 .amdhsa_ieee_mode 1 .amdhsa_fp16_overflow 0 .amdhsa_workgroup_processor_mode 1 .amdhsa_memory_ordered 1 .amdhsa_forward_progress 0 .amdhsa_shared_vgpr_count 0 .amdhsa_exception_fp_ieee_invalid_op 0 .amdhsa_exception_fp_denorm_src 0 .amdhsa_exception_fp_ieee_div_zero 0 .amdhsa_exception_fp_ieee_overflow 0 .amdhsa_exception_fp_ieee_underflow 0 .amdhsa_exception_fp_ieee_inexact 0 .amdhsa_exception_int_div_zero 0 .end_amdhsa_kernel .text .Lfunc_end0: .size _Z7dkernelPjj, .Lfunc_end0-_Z7dkernelPjj .section .AMDGPU.csdata,"",@progbits .text .p2alignl 7, 3214868480 .fill 96, 4, 3214868480 .type .str,@object .section .rodata.str1.1,"aMS",@progbits,1 .str: .asciz "syncthreads does not work.\n" .size .str, 28 .type __hip_cuid_,@object .section .bss,"aw",@nobits .globl __hip_cuid_ __hip_cuid_: .byte 0 .size __hip_cuid_, 1 .ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)" .section ".note.GNU-stack","",@progbits .addrsig .addrsig_sym __hip_cuid_ .amdgpu_metadata --- amdhsa.kernels: - .args: - .address_space: global .offset: 0 .size: 8 .value_kind: global_buffer - .offset: 8 .size: 4 .value_kind: by_value - .offset: 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 - .offset: 96 .size: 8 .value_kind: hidden_hostcall_buffer .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: _Z7dkernelPjj .private_segment_fixed_size: 0 .sgpr_count: 20 .sgpr_spill_count: 0 .symbol: _Z7dkernelPjj.kd .uniform_work_group_size: 1 .uses_dynamic_stack: false .vgpr_count: 32 .vgpr_spill_count: 0 .wavefront_size: 32 .workgroup_processor_mode: 1 amdhsa.target: amdgcn-amd-amdhsa--gfx1100 amdhsa.version: - 1 - 2 ... .end_amdgpu_metadata
You are a helpful coding assistant specialized in converting HIP source code to AMD host assembly.
#include <stdio.h> #include <hip/hip_runtime.h> __global__ void dkernel(unsigned *vector, unsigned vectorsize) { unsigned id = blockIdx.x * blockDim.x + threadIdx.x; vector[id] = id; __syncthreads(); if (id < vectorsize - 1 && vector[id + 1] != id + 1) printf("syncthreads does not work.\n"); } #define BLOCKSIZE 1000 #define N BLOCKSIZE int main(int nn, char *str[]) { unsigned *vector, *hvector; hipMalloc(&vector, N * sizeof(unsigned)); hvector = (unsigned *)malloc(N * sizeof(unsigned)); dkernel<<<100, BLOCKSIZE>>>(vector, N); hipMemcpy(hvector, vector, N * sizeof(unsigned), hipMemcpyDeviceToHost); for (unsigned ii = 0; ii < N; ++ii) { printf("%4d ", hvector[ii]); } printf("\n"); return 0; }
.text .file "syncthreads.hip" .globl _Z22__device_stub__dkernelPjj # -- Begin function _Z22__device_stub__dkernelPjj .p2align 4, 0x90 .type _Z22__device_stub__dkernelPjj,@function _Z22__device_stub__dkernelPjj: # @_Z22__device_stub__dkernelPjj .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 $_Z7dkernelPjj, %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 _Z22__device_stub__dkernelPjj, .Lfunc_end0-_Z22__device_stub__dkernelPjj .cfi_endproc # -- End function .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 $104, %rsp .cfi_def_cfa_offset 128 .cfi_offset %rbx, -24 .cfi_offset %r14, -16 leaq 16(%rsp), %rdi movl $4000, %esi # imm = 0xFA0 callq hipMalloc movl $4000, %edi # imm = 0xFA0 callq malloc movq %rax, %rbx movabsq $4294967396, %rdi # imm = 0x100000064 leaq 900(%rdi), %rdx movl $1, %esi movl $1, %ecx xorl %r8d, %r8d xorl %r9d, %r9d callq __hipPushCallConfiguration testl %eax, %eax jne .LBB1_2 # %bb.1: movq 16(%rsp), %rax movq %rax, 72(%rsp) movl $1000, 12(%rsp) # imm = 0x3E8 leaq 72(%rsp), %rax movq %rax, 80(%rsp) leaq 12(%rsp), %rax movq %rax, 88(%rsp) leaq 56(%rsp), %rdi leaq 40(%rsp), %rsi leaq 32(%rsp), %rdx leaq 24(%rsp), %rcx callq __hipPopCallConfiguration movq 56(%rsp), %rsi movl 64(%rsp), %edx movq 40(%rsp), %rcx movl 48(%rsp), %r8d leaq 80(%rsp), %r9 movl $_Z7dkernelPjj, %edi pushq 24(%rsp) .cfi_adjust_cfa_offset 8 pushq 40(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $16, %rsp .cfi_adjust_cfa_offset -16 .LBB1_2: movq 16(%rsp), %rsi movl $4000, %edx # imm = 0xFA0 movq %rbx, %rdi movl $2, %ecx callq hipMemcpy xorl %r14d, %r14d .p2align 4, 0x90 .LBB1_3: # =>This Inner Loop Header: Depth=1 movl (%rbx,%r14,4), %esi movl $.L.str, %edi xorl %eax, %eax callq printf incq %r14 cmpq $1000, %r14 # imm = 0x3E8 jne .LBB1_3 # %bb.4: movl $10, %edi callq putchar@PLT xorl %eax, %eax addq $104, %rsp .cfi_def_cfa_offset 24 popq %rbx .cfi_def_cfa_offset 16 popq %r14 .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 $_Z7dkernelPjj, %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 _Z7dkernelPjj,@object # @_Z7dkernelPjj .section .rodata,"a",@progbits .globl _Z7dkernelPjj .p2align 3, 0x0 _Z7dkernelPjj: .quad _Z22__device_stub__dkernelPjj .size _Z7dkernelPjj, 8 .type .L.str,@object # @.str .section .rodata.str1.1,"aMS",@progbits,1 .L.str: .asciz "%4d " .size .L.str, 5 .type .L__unnamed_1,@object # @0 .L__unnamed_1: .asciz "_Z7dkernelPjj" .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 .section ".linker-options","e",@llvm_linker_options .ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)" .section ".note.GNU-stack","",@progbits .addrsig .addrsig_sym _Z22__device_stub__dkernelPjj .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z7dkernelPjj .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_000f39a2_00000000-6_syncthreads.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__Z7dkernelPjjPjj .type _Z27__device_stub__Z7dkernelPjjPjj, @function _Z27__device_stub__Z7dkernelPjjPjj: .LFB2082: .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 _Z7dkernelPjj(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 128 jmp .L3 .L8: call __stack_chk_fail@PLT .cfi_endproc .LFE2082: .size _Z27__device_stub__Z7dkernelPjjPjj, .-_Z27__device_stub__Z7dkernelPjjPjj .globl _Z7dkernelPjj .type _Z7dkernelPjj, @function _Z7dkernelPjj: .LFB2083: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z27__device_stub__Z7dkernelPjjPjj addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2083: .size _Z7dkernelPjj, .-_Z7dkernelPjj .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "%4d " .LC1: .string "\n" .text .globl main .type main, @function main: .LFB2057: .cfi_startproc endbr64 pushq %r12 .cfi_def_cfa_offset 16 .cfi_offset 12, -16 pushq %rbp .cfi_def_cfa_offset 24 .cfi_offset 6, -24 pushq %rbx .cfi_def_cfa_offset 32 .cfi_offset 3, -32 subq $48, %rsp .cfi_def_cfa_offset 80 movq %fs:40, %rax movq %rax, 40(%rsp) xorl %eax, %eax leaq 8(%rsp), %rdi movl $4000, %esi call cudaMalloc@PLT movl $4000, %edi call malloc@PLT movq %rax, %rbp movl $1000, 28(%rsp) movl $1, 32(%rsp) movl $100, 16(%rsp) movl $1, 20(%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 .L12: movl $2, %ecx movl $4000, %edx movq 8(%rsp), %rsi movq %rbp, %rdi call cudaMemcpy@PLT movq %rbp, %rbx addq $4000, %rbp leaq .LC0(%rip), %r12 .L13: movl (%rbx), %edx movq %r12, %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT addq $4, %rbx cmpq %rbp, %rbx jne .L13 leaq .LC1(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT 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 movl $1000, %esi movq 8(%rsp), %rdi call _Z27__device_stub__Z7dkernelPjjPjj jmp .L12 .L18: call __stack_chk_fail@PLT .cfi_endproc .LFE2057: .size main, .-main .section .rodata.str1.1 .LC2: .string "_Z7dkernelPjj" .text .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB2085: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 leaq _ZL15__fatDeviceText(%rip), %rdi call __cudaRegisterFatBinary@PLT movq %rax, %rdi movq %rax, _ZL20__cudaFatCubinHandle(%rip) pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 pushq $0 .cfi_def_cfa_offset 40 pushq $0 .cfi_def_cfa_offset 48 movl $0, %r9d movl $-1, %r8d leaq .LC2(%rip), %rdx movq %rdx, %rcx leaq _Z7dkernelPjj(%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 "syncthreads.hip" .globl _Z22__device_stub__dkernelPjj # -- Begin function _Z22__device_stub__dkernelPjj .p2align 4, 0x90 .type _Z22__device_stub__dkernelPjj,@function _Z22__device_stub__dkernelPjj: # @_Z22__device_stub__dkernelPjj .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 $_Z7dkernelPjj, %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 _Z22__device_stub__dkernelPjj, .Lfunc_end0-_Z22__device_stub__dkernelPjj .cfi_endproc # -- End function .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 $104, %rsp .cfi_def_cfa_offset 128 .cfi_offset %rbx, -24 .cfi_offset %r14, -16 leaq 16(%rsp), %rdi movl $4000, %esi # imm = 0xFA0 callq hipMalloc movl $4000, %edi # imm = 0xFA0 callq malloc movq %rax, %rbx movabsq $4294967396, %rdi # imm = 0x100000064 leaq 900(%rdi), %rdx movl $1, %esi movl $1, %ecx xorl %r8d, %r8d xorl %r9d, %r9d callq __hipPushCallConfiguration testl %eax, %eax jne .LBB1_2 # %bb.1: movq 16(%rsp), %rax movq %rax, 72(%rsp) movl $1000, 12(%rsp) # imm = 0x3E8 leaq 72(%rsp), %rax movq %rax, 80(%rsp) leaq 12(%rsp), %rax movq %rax, 88(%rsp) leaq 56(%rsp), %rdi leaq 40(%rsp), %rsi leaq 32(%rsp), %rdx leaq 24(%rsp), %rcx callq __hipPopCallConfiguration movq 56(%rsp), %rsi movl 64(%rsp), %edx movq 40(%rsp), %rcx movl 48(%rsp), %r8d leaq 80(%rsp), %r9 movl $_Z7dkernelPjj, %edi pushq 24(%rsp) .cfi_adjust_cfa_offset 8 pushq 40(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $16, %rsp .cfi_adjust_cfa_offset -16 .LBB1_2: movq 16(%rsp), %rsi movl $4000, %edx # imm = 0xFA0 movq %rbx, %rdi movl $2, %ecx callq hipMemcpy xorl %r14d, %r14d .p2align 4, 0x90 .LBB1_3: # =>This Inner Loop Header: Depth=1 movl (%rbx,%r14,4), %esi movl $.L.str, %edi xorl %eax, %eax callq printf incq %r14 cmpq $1000, %r14 # imm = 0x3E8 jne .LBB1_3 # %bb.4: movl $10, %edi callq putchar@PLT xorl %eax, %eax addq $104, %rsp .cfi_def_cfa_offset 24 popq %rbx .cfi_def_cfa_offset 16 popq %r14 .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 $_Z7dkernelPjj, %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 _Z7dkernelPjj,@object # @_Z7dkernelPjj .section .rodata,"a",@progbits .globl _Z7dkernelPjj .p2align 3, 0x0 _Z7dkernelPjj: .quad _Z22__device_stub__dkernelPjj .size _Z7dkernelPjj, 8 .type .L.str,@object # @.str .section .rodata.str1.1,"aMS",@progbits,1 .L.str: .asciz "%4d " .size .L.str, 5 .type .L__unnamed_1,@object # @0 .L__unnamed_1: .asciz "_Z7dkernelPjj" .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 .section ".linker-options","e",@llvm_linker_options .ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)" .section ".note.GNU-stack","",@progbits .addrsig .addrsig_sym _Z22__device_stub__dkernelPjj .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z7dkernelPjj .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 convertDepthImageToMeter_kernel(float *d_depth_image_meter, const unsigned int *d_depth_image_millimeter, int n_rows, int n_cols) { const int x = blockIdx.x * blockDim.x + threadIdx.x; const int y = blockIdx.y * blockDim.y + threadIdx.y; if (x < n_cols && y < n_rows) { int ind = y * n_cols + x; unsigned int depth = d_depth_image_millimeter[ind]; d_depth_image_meter[ind] = (depth == 4294967295) ? nanf("") : (float)depth / 1000.0f; } }
code for sm_80 Function : _Z31convertDepthImageToMeter_kernelPfPKjii .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 */ /* 0x000e280000002100 */ /*0030*/ S2R R2, SR_CTAID.Y ; /* 0x0000000000027919 */ /* 0x000e680000002600 */ /*0040*/ S2R R5, SR_TID.Y ; /* 0x0000000000057919 */ /* 0x000e620000002200 */ /*0050*/ IMAD R0, R0, c[0x0][0x0], R3 ; /* 0x0000000000007a24 */ /* 0x001fca00078e0203 */ /*0060*/ ISETP.GE.AND P0, PT, R0, c[0x0][0x174], PT ; /* 0x00005d0000007a0c */ /* 0x000fe20003f06270 */ /*0070*/ IMAD R3, R2, c[0x0][0x4], R5 ; /* 0x0000010002037a24 */ /* 0x002fca00078e0205 */ /*0080*/ ISETP.GE.OR P0, PT, R3, c[0x0][0x170], P0 ; /* 0x00005c0003007a0c */ /* 0x000fda0000706670 */ /*0090*/ @P0 EXIT ; /* 0x000000000000094d */ /* 0x000fea0003800000 */ /*00a0*/ IMAD.MOV.U32 R5, RZ, RZ, 0x4 ; /* 0x00000004ff057424 */ /* 0x000fe200078e00ff */ /*00b0*/ ULDC.64 UR6, c[0x0][0x118] ; /* 0x0000460000067ab9 */ /* 0x000fe20000000a00 */ /*00c0*/ IMAD R0, R3, c[0x0][0x174], R0 ; /* 0x00005d0003007a24 */ /* 0x000fc800078e0200 */ /*00d0*/ IMAD.WIDE R4, R0, R5, c[0x0][0x168] ; /* 0x00005a0000047625 */ /* 0x000fcc00078e0205 */ /*00e0*/ LDG.E R4, [R4.64] ; /* 0x0000000604047981 */ /* 0x000ea2000c1e1900 */ /*00f0*/ BSSY B2, 0x240 ; /* 0x0000014000027945 */ /* 0x000fe20003800000 */ /*0100*/ IMAD.MOV.U32 R7, RZ, RZ, 0x7fc00000 ; /* 0x7fc00000ff077424 */ /* 0x000fe200078e00ff */ /*0110*/ SHF.R.S32.HI R3, RZ, 0x1f, R0 ; /* 0x0000001fff037819 */ /* 0x000fe40000011400 */ /*0120*/ ISETP.NE.AND P0, PT, R4, -0x1, PT ; /* 0xffffffff0400780c */ /* 0x004fda0003f05270 */ /*0130*/ @!P0 BRA 0x230 ; /* 0x000000f000008947 */ /* 0x000fea0003800000 */ /*0140*/ I2F.U32 R4, R4 ; /* 0x0000000400047306 */ /* 0x000e220000201000 */ /*0150*/ IMAD.MOV.U32 R5, RZ, RZ, 0x3a83126f ; /* 0x3a83126fff057424 */ /* 0x000fe200078e00ff */ /*0160*/ BSSY B1, 0x230 ; /* 0x000000c000017945 */ /* 0x000fe20003800000 */ /*0170*/ IMAD.MOV.U32 R2, RZ, RZ, 0x447a0000 ; /* 0x447a0000ff027424 */ /* 0x000fc800078e00ff */ /*0180*/ FFMA R2, R5, -R2, 1 ; /* 0x3f80000005027423 */ /* 0x000fc80000000802 */ /*0190*/ FFMA R5, R2, R5, 0.0010000000474974513054 ; /* 0x3a83126f02057423 */ /* 0x000fe20000000005 */ /*01a0*/ FCHK P0, R4, 1000 ; /* 0x447a000004007902 */ /* 0x001e260000000000 */ /*01b0*/ FFMA R2, R4, R5, RZ ; /* 0x0000000504027223 */ /* 0x000fc800000000ff */ /*01c0*/ FFMA R6, R2, -1000, R4 ; /* 0xc47a000002067823 */ /* 0x000fc80000000004 */ /*01d0*/ FFMA R7, R5, R6, R2 ; /* 0x0000000605077223 */ /* 0x000fe20000000002 */ /*01e0*/ @!P0 BRA 0x220 ; /* 0x0000003000008947 */ /* 0x001fea0003800000 */ /*01f0*/ MOV R2, 0x210 ; /* 0x0000021000027802 */ /* 0x000fe40000000f00 */ /*0200*/ CALL.REL.NOINC 0x280 ; /* 0x0000007000007944 */ /* 0x000fea0003c00000 */ /*0210*/ IMAD.MOV.U32 R7, RZ, RZ, R6 ; /* 0x000000ffff077224 */ /* 0x001fe400078e0006 */ /*0220*/ BSYNC B1 ; /* 0x0000000000017941 */ /* 0x000fea0003800000 */ /*0230*/ BSYNC B2 ; /* 0x0000000000027941 */ /* 0x000fea0003800000 */ /*0240*/ LEA R2, P0, R0, c[0x0][0x160], 0x2 ; /* 0x0000580000027a11 */ /* 0x000fc800078010ff */ /*0250*/ LEA.HI.X R3, R0, c[0x0][0x164], R3, 0x2, P0 ; /* 0x0000590000037a11 */ /* 0x000fca00000f1403 */ /*0260*/ STG.E [R2.64], R7 ; /* 0x0000000702007986 */ /* 0x000fe2000c101906 */ /*0270*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*0280*/ SHF.R.U32.HI R5, RZ, 0x17, R4.reuse ; /* 0x00000017ff057819 */ /* 0x100fe20000011604 */ /*0290*/ BSSY B0, 0x860 ; /* 0x000005c000007945 */ /* 0x000fe20003800000 */ /*02a0*/ BSSY B3, 0x450 ; /* 0x000001a000037945 */ /* 0x000fe20003800000 */ /*02b0*/ IMAD.MOV.U32 R6, RZ, RZ, R4 ; /* 0x000000ffff067224 */ /* 0x000fe200078e0004 */ /*02c0*/ LOP3.LUT R5, R5, 0xff, RZ, 0xc0, !PT ; /* 0x000000ff05057812 */ /* 0x000fc800078ec0ff */ /*02d0*/ IADD3 R8, R5, -0x1, RZ ; /* 0xffffffff05087810 */ /* 0x000fc80007ffe0ff */ /*02e0*/ ISETP.GT.U32.OR P0, PT, R8, 0xfd, !PT ; /* 0x000000fd0800780c */ /* 0x000fda0007f04470 */ /*02f0*/ @!P0 IMAD.MOV.U32 R7, RZ, RZ, RZ ; /* 0x000000ffff078224 */ /* 0x000fe200078e00ff */ /*0300*/ @!P0 BRA 0x440 ; /* 0x0000013000008947 */ /* 0x000fea0003800000 */ /*0310*/ FSETP.GTU.FTZ.AND P0, PT, |R4|, +INF , PT ; /* 0x7f8000000400780b */ /* 0x000fda0003f1c200 */ /*0320*/ @P0 BREAK B3 ; /* 0x0000000000030942 */ /* 0x000fe20003800000 */ /*0330*/ @P0 BRA 0x840 ; /* 0x0000050000000947 */ /* 0x000fea0003800000 */ /*0340*/ IMAD.MOV.U32 R7, RZ, RZ, 0x447a0000 ; /* 0x447a0000ff077424 */ /* 0x000fca00078e00ff */ /*0350*/ LOP3.LUT P0, RZ, R7, 0x7fffffff, R6, 0xc8, !PT ; /* 0x7fffffff07ff7812 */ /* 0x000fda000780c806 */ /*0360*/ @!P0 BREAK B3 ; /* 0x0000000000038942 */ /* 0x000fe20003800000 */ /*0370*/ @!P0 BRA 0x820 ; /* 0x000004a000008947 */ /* 0x000fea0003800000 */ /*0380*/ LOP3.LUT P0, RZ, R6, 0x7fffffff, RZ, 0xc0, !PT ; /* 0x7fffffff06ff7812 */ /* 0x000fda000780c0ff */ /*0390*/ @!P0 BREAK B3 ; /* 0x0000000000038942 */ /* 0x000fe20003800000 */ /*03a0*/ @!P0 BRA 0x800 ; /* 0x0000045000008947 */ /* 0x000fea0003800000 */ /*03b0*/ FSETP.NEU.FTZ.AND P0, PT, |R4|, +INF , PT ; /* 0x7f8000000400780b */ /* 0x000fe40003f1d200 */ /*03c0*/ LOP3.LUT P1, RZ, R7, 0x7fffffff, RZ, 0xc0, !PT ; /* 0x7fffffff07ff7812 */ /* 0x000fc8000782c0ff */ /*03d0*/ PLOP3.LUT P0, PT, P0, P1, PT, 0x2a, 0x0 ; /* 0x000000000000781c */ /* 0x000fda0000702572 */ /*03e0*/ @P0 BREAK B3 ; /* 0x0000000000030942 */ /* 0x000fe20003800000 */ /*03f0*/ @P0 BRA 0x7d0 ; /* 0x000003d000000947 */ /* 0x000fea0003800000 */ /*0400*/ ISETP.GE.AND P0, PT, R8, RZ, PT ; /* 0x000000ff0800720c */ /* 0x000fda0003f06270 */ /*0410*/ @P0 IMAD.MOV.U32 R7, RZ, RZ, RZ ; /* 0x000000ffff070224 */ /* 0x000fe400078e00ff */ /*0420*/ @!P0 FFMA R6, R4, 1.84467440737095516160e+19, RZ ; /* 0x5f80000004068823 */ /* 0x000fe400000000ff */ /*0430*/ @!P0 IMAD.MOV.U32 R7, RZ, RZ, -0x40 ; /* 0xffffffc0ff078424 */ /* 0x000fe400078e00ff */ /*0440*/ BSYNC B3 ; /* 0x0000000000037941 */ /* 0x000fea0003800000 */ /*0450*/ UMOV UR4, 0x447a0000 ; /* 0x447a000000047882 */ /* 0x000fe20000000000 */ /*0460*/ IADD3 R5, R5, -0x7f, RZ ; /* 0xffffff8105057810 */ /* 0x000fe20007ffe0ff */ /*0470*/ UIADD3 UR4, UR4, -0x4800000, URZ ; /* 0xfb80000004047890 */ /* 0x000fe2000fffe03f */ /*0480*/ BSSY B3, 0x7c0 ; /* 0x0000033000037945 */ /* 0x000fe40003800000 */ /*0490*/ IADD3 R7, R7, -0x9, R5 ; /* 0xfffffff707077810 */ /* 0x000fe20007ffe005 */ /*04a0*/ IMAD R6, R5, -0x800000, R6 ; /* 0xff80000005067824 */ /* 0x000fc400078e0206 */ /*04b0*/ FADD.FTZ R9, -RZ, -UR4 ; /* 0x80000004ff097e21 */ /* 0x000fc60008010100 */ /*04c0*/ MUFU.RCP R4, UR4 ; /* 0x0000000400047d08 */ /* 0x000e240008001000 */ /*04d0*/ FFMA R11, R4, R9, 1 ; /* 0x3f800000040b7423 */ /* 0x001fc80000000009 */ /*04e0*/ FFMA R11, R4, R11, R4 ; /* 0x0000000b040b7223 */ /* 0x000fc80000000004 */ /*04f0*/ FFMA R4, R6, R11, RZ ; /* 0x0000000b06047223 */ /* 0x000fc800000000ff */ /*0500*/ FFMA R8, R9, R4, R6 ; /* 0x0000000409087223 */ /* 0x000fc80000000006 */ /*0510*/ FFMA R8, R11, R8, R4 ; /* 0x000000080b087223 */ /* 0x000fc80000000004 */ /*0520*/ FFMA R9, R9, R8, R6 ; /* 0x0000000809097223 */ /* 0x000fc80000000006 */ /*0530*/ FFMA R6, R11, R9, R8 ; /* 0x000000090b067223 */ /* 0x000fca0000000008 */ /*0540*/ SHF.R.U32.HI R4, RZ, 0x17, R6 ; /* 0x00000017ff047819 */ /* 0x000fc80000011606 */ /*0550*/ LOP3.LUT R4, R4, 0xff, RZ, 0xc0, !PT ; /* 0x000000ff04047812 */ /* 0x000fca00078ec0ff */ /*0560*/ IMAD.IADD R10, R4, 0x1, R7 ; /* 0x00000001040a7824 */ /* 0x000fca00078e0207 */ /*0570*/ IADD3 R4, R10, -0x1, RZ ; /* 0xffffffff0a047810 */ /* 0x000fc80007ffe0ff */ /*0580*/ ISETP.GE.U32.AND P0, PT, R4, 0xfe, PT ; /* 0x000000fe0400780c */ /* 0x000fda0003f06070 */ /*0590*/ @!P0 BRA 0x7a0 ; /* 0x0000020000008947 */ /* 0x000fea0003800000 */ /*05a0*/ ISETP.GT.AND P0, PT, R10, 0xfe, PT ; /* 0x000000fe0a00780c */ /* 0x000fda0003f04270 */ /*05b0*/ @P0 BRA 0x770 ; /* 0x000001b000000947 */ /* 0x000fea0003800000 */ /*05c0*/ ISETP.GE.AND P0, PT, R10, 0x1, PT ; /* 0x000000010a00780c */ /* 0x000fda0003f06270 */ /*05d0*/ @P0 BRA 0x7b0 ; /* 0x000001d000000947 */ /* 0x000fea0003800000 */ /*05e0*/ ISETP.GE.AND P0, PT, R10, -0x18, PT ; /* 0xffffffe80a00780c */ /* 0x000fe40003f06270 */ /*05f0*/ LOP3.LUT R6, R6, 0x80000000, RZ, 0xc0, !PT ; /* 0x8000000006067812 */ /* 0x000fd600078ec0ff */ /*0600*/ @!P0 BRA 0x7b0 ; /* 0x000001a000008947 */ /* 0x000fea0003800000 */ /*0610*/ FFMA.RZ R4, R11.reuse, R9.reuse, R8 ; /* 0x000000090b047223 */ /* 0x0c0fe2000000c008 */ /*0620*/ ISETP.NE.AND P2, PT, R10.reuse, RZ, PT ; /* 0x000000ff0a00720c */ /* 0x040fe20003f45270 */ /*0630*/ IMAD.MOV R7, RZ, RZ, -R10 ; /* 0x000000ffff077224 */ /* 0x000fe200078e0a0a */ /*0640*/ ISETP.NE.AND P1, PT, R10, RZ, PT ; /* 0x000000ff0a00720c */ /* 0x000fe40003f25270 */ /*0650*/ LOP3.LUT R5, R4, 0x7fffff, RZ, 0xc0, !PT ; /* 0x007fffff04057812 */ /* 0x000fe200078ec0ff */ /*0660*/ FFMA.RP R4, R11.reuse, R9.reuse, R8.reuse ; /* 0x000000090b047223 */ /* 0x1c0fe40000008008 */ /*0670*/ FFMA.RM R11, R11, R9, R8 ; /* 0x000000090b0b7223 */ /* 0x000fe20000004008 */ /*0680*/ IADD3 R8, R10, 0x20, RZ ; /* 0x000000200a087810 */ /* 0x000fe40007ffe0ff */ /*0690*/ LOP3.LUT R5, R5, 0x800000, RZ, 0xfc, !PT ; /* 0x0080000005057812 */ /* 0x000fc400078efcff */ /*06a0*/ FSETP.NEU.FTZ.AND P0, PT, R4, R11, PT ; /* 0x0000000b0400720b */ /* 0x000fe40003f1d000 */ /*06b0*/ SHF.L.U32 R8, R5, R8, RZ ; /* 0x0000000805087219 */ /* 0x000fe400000006ff */ /*06c0*/ SEL R4, R7, RZ, P2 ; /* 0x000000ff07047207 */ /* 0x000fe40001000000 */ /*06d0*/ ISETP.NE.AND P1, PT, R8, RZ, P1 ; /* 0x000000ff0800720c */ /* 0x000fe40000f25270 */ /*06e0*/ SHF.R.U32.HI R4, RZ, R4, R5 ; /* 0x00000004ff047219 */ /* 0x000fe40000011605 */ /*06f0*/ PLOP3.LUT P0, PT, P0, P1, PT, 0xa8, 0x0 ; /* 0x000000000000781c */ /* 0x000fc40000703570 */ /*0700*/ SHF.R.U32.HI R8, RZ, 0x1, R4 ; /* 0x00000001ff087819 */ /* 0x000fe40000011604 */ /*0710*/ SEL R5, RZ, 0x1, !P0 ; /* 0x00000001ff057807 */ /* 0x000fc80004000000 */ /*0720*/ LOP3.LUT R5, R5, 0x1, R8, 0xf8, !PT ; /* 0x0000000105057812 */ /* 0x000fc800078ef808 */ /*0730*/ LOP3.LUT R5, R5, R4, RZ, 0xc0, !PT ; /* 0x0000000405057212 */ /* 0x000fca00078ec0ff */ /*0740*/ IMAD.IADD R5, R8, 0x1, R5 ; /* 0x0000000108057824 */ /* 0x000fca00078e0205 */ /*0750*/ LOP3.LUT R6, R5, R6, RZ, 0xfc, !PT ; /* 0x0000000605067212 */ /* 0x000fe200078efcff */ /*0760*/ BRA 0x7b0 ; /* 0x0000004000007947 */ /* 0x000fea0003800000 */ /*0770*/ LOP3.LUT R6, R6, 0x80000000, RZ, 0xc0, !PT ; /* 0x8000000006067812 */ /* 0x000fc800078ec0ff */ /*0780*/ LOP3.LUT R6, R6, 0x7f800000, RZ, 0xfc, !PT ; /* 0x7f80000006067812 */ /* 0x000fe200078efcff */ /*0790*/ BRA 0x7b0 ; /* 0x0000001000007947 */ /* 0x000fea0003800000 */ /*07a0*/ IMAD R6, R7, 0x800000, R6 ; /* 0x0080000007067824 */ /* 0x000fe400078e0206 */ /*07b0*/ BSYNC B3 ; /* 0x0000000000037941 */ /* 0x000fea0003800000 */ /*07c0*/ BRA 0x850 ; /* 0x0000008000007947 */ /* 0x000fea0003800000 */ /*07d0*/ LOP3.LUT R6, R7, 0x80000000, R6, 0x48, !PT ; /* 0x8000000007067812 */ /* 0x000fc800078e4806 */ /*07e0*/ LOP3.LUT R6, R6, 0x7f800000, RZ, 0xfc, !PT ; /* 0x7f80000006067812 */ /* 0x000fe200078efcff */ /*07f0*/ BRA 0x850 ; /* 0x0000005000007947 */ /* 0x000fea0003800000 */ /*0800*/ LOP3.LUT R6, R7, 0x80000000, R6, 0x48, !PT ; /* 0x8000000007067812 */ /* 0x000fe200078e4806 */ /*0810*/ BRA 0x850 ; /* 0x0000003000007947 */ /* 0x000fea0003800000 */ /*0820*/ MUFU.RSQ R6, -QNAN ; /* 0xffc0000000067908 */ /* 0x000e220000001400 */ /*0830*/ BRA 0x850 ; /* 0x0000001000007947 */ /* 0x000fea0003800000 */ /*0840*/ FADD.FTZ R6, R4, 1000 ; /* 0x447a000004067421 */ /* 0x000fe40000010000 */ /*0850*/ BSYNC B0 ; /* 0x0000000000007941 */ /* 0x000fea0003800000 */ /*0860*/ IMAD.MOV.U32 R4, RZ, RZ, R2 ; /* 0x000000ffff047224 */ /* 0x000fe400078e0002 */ /*0870*/ IMAD.MOV.U32 R5, RZ, RZ, 0x0 ; /* 0x00000000ff057424 */ /* 0x000fc800078e00ff */ /*0880*/ RET.REL.NODEC R4 0x0 ; /* 0xfffff77004007950 */ /* 0x000fea0003c3ffff */ /*0890*/ BRA 0x890; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*08a0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*08b0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*08c0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*08d0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*08e0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*08f0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0900*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0910*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0920*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0930*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0940*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0950*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0960*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0970*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ ..........
You are a helpful coding assistant specialized in converting CUDA source code to CUDA host assembly.
#include "includes.h" __global__ void convertDepthImageToMeter_kernel(float *d_depth_image_meter, const unsigned int *d_depth_image_millimeter, int n_rows, int n_cols) { const int x = blockIdx.x * blockDim.x + threadIdx.x; const int y = blockIdx.y * blockDim.y + threadIdx.y; if (x < n_cols && y < n_rows) { int ind = y * n_cols + x; unsigned int depth = d_depth_image_millimeter[ind]; d_depth_image_meter[ind] = (depth == 4294967295) ? nanf("") : (float)depth / 1000.0f; } }
.file "tmpxft_000b7417_00000000-6_convertDepthImageToMeter_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 .globl _Z56__device_stub__Z31convertDepthImageToMeter_kernelPfPKjiiPfPKjii .type _Z56__device_stub__Z31convertDepthImageToMeter_kernelPfPKjiiPfPKjii, @function _Z56__device_stub__Z31convertDepthImageToMeter_kernelPfPKjiiPfPKjii: .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 _Z31convertDepthImageToMeter_kernelPfPKjii(%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 _Z56__device_stub__Z31convertDepthImageToMeter_kernelPfPKjiiPfPKjii, .-_Z56__device_stub__Z31convertDepthImageToMeter_kernelPfPKjiiPfPKjii .globl _Z31convertDepthImageToMeter_kernelPfPKjii .type _Z31convertDepthImageToMeter_kernelPfPKjii, @function _Z31convertDepthImageToMeter_kernelPfPKjii: .LFB2052: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z56__device_stub__Z31convertDepthImageToMeter_kernelPfPKjiiPfPKjii addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2052: .size _Z31convertDepthImageToMeter_kernelPfPKjii, .-_Z31convertDepthImageToMeter_kernelPfPKjii .section .rodata.str1.8,"aMS",@progbits,1 .align 8 .LC0: .string "_Z31convertDepthImageToMeter_kernelPfPKjii" .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 _Z31convertDepthImageToMeter_kernelPfPKjii(%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 convertDepthImageToMeter_kernel(float *d_depth_image_meter, const unsigned int *d_depth_image_millimeter, int n_rows, int n_cols) { const int x = blockIdx.x * blockDim.x + threadIdx.x; const int y = blockIdx.y * blockDim.y + threadIdx.y; if (x < n_cols && y < n_rows) { int ind = y * n_cols + x; unsigned int depth = d_depth_image_millimeter[ind]; d_depth_image_meter[ind] = (depth == 4294967295) ? nanf("") : (float)depth / 1000.0f; } }
#include <hip/hip_runtime.h> #include "includes.h" __global__ void convertDepthImageToMeter_kernel(float *d_depth_image_meter, const unsigned int *d_depth_image_millimeter, int n_rows, int n_cols) { const int x = blockIdx.x * blockDim.x + threadIdx.x; const int y = blockIdx.y * blockDim.y + threadIdx.y; if (x < n_cols && y < n_rows) { int ind = y * n_cols + x; unsigned int depth = d_depth_image_millimeter[ind]; d_depth_image_meter[ind] = (depth == 4294967295) ? nanf("") : (float)depth / 1000.0f; } }
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 convertDepthImageToMeter_kernel(float *d_depth_image_meter, const unsigned int *d_depth_image_millimeter, int n_rows, int n_cols) { const int x = blockIdx.x * blockDim.x + threadIdx.x; const int y = blockIdx.y * blockDim.y + threadIdx.y; if (x < n_cols && y < n_rows) { int ind = y * n_cols + x; unsigned int depth = d_depth_image_millimeter[ind]; d_depth_image_meter[ind] = (depth == 4294967295) ? nanf("") : (float)depth / 1000.0f; } }
.text .amdgcn_target "amdgcn-amd-amdhsa--gfx1100" .protected _Z31convertDepthImageToMeter_kernelPfPKjii .globl _Z31convertDepthImageToMeter_kernelPfPKjii .p2align 8 .type _Z31convertDepthImageToMeter_kernelPfPKjii,@function _Z31convertDepthImageToMeter_kernelPfPKjii: s_clause 0x1 s_load_b32 s4, s[0:1], 0x24 s_load_b64 s[2:3], s[0:1], 0x10 v_and_b32_e32 v2, 0x3ff, v0 v_bfe_u32 v3, v0, 10, 10 s_waitcnt lgkmcnt(0) s_and_b32 s5, s4, 0xffff s_lshr_b32 s4, s4, 16 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2) v_mad_u64_u32 v[0:1], null, s14, s5, v[2:3] v_mad_u64_u32 v[1:2], null, s15, s4, v[3:4] v_cmp_gt_i32_e32 vcc_lo, s3, v0 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1) v_cmp_gt_i32_e64 s2, s2, v1 s_and_b32 s2, vcc_lo, s2 s_delay_alu instid0(SALU_CYCLE_1) s_and_saveexec_b32 s4, s2 s_cbranch_execz .LBB0_4 s_load_b64 s[4:5], s[0:1], 0x8 v_mad_u64_u32 v[2:3], null, v1, s3, v[0:1] s_mov_b32 s2, exec_lo s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_ashrrev_i32_e32 v3, 31, v2 v_lshlrev_b64 v[0:1], 2, v[2:3] s_waitcnt lgkmcnt(0) s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2) v_add_co_u32 v2, vcc_lo, s4, v0 v_add_co_ci_u32_e32 v3, vcc_lo, s5, v1, vcc_lo global_load_b32 v3, v[2:3], off v_mov_b32_e32 v2, 0x7fc00000 s_waitcnt vmcnt(0) v_cmpx_ne_u32_e32 -1, v3 s_cbranch_execz .LBB0_3 v_cvt_f32_u32_e32 v2, v3 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_div_scale_f32 v3, null, 0x447a0000, 0x447a0000, v2 v_rcp_f32_e32 v4, v3 s_waitcnt_depctr 0xfff v_fma_f32 v5, -v3, v4, 1.0 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_fmac_f32_e32 v4, v5, v4 v_div_scale_f32 v5, vcc_lo, v2, 0x447a0000, v2 v_mul_f32_e32 v6, v5, v4 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_fma_f32 v7, -v3, v6, v5 v_fmac_f32_e32 v6, v7, v4 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_fma_f32 v3, -v3, v6, v5 v_div_fmas_f32 v3, v3, v4, v6 s_delay_alu instid0(VALU_DEP_1) v_div_fixup_f32 v2, v3, 0x447a0000, v2 .LBB0_3: s_or_b32 exec_lo, exec_lo, s2 s_load_b64 s[0:1], s[0:1], 0x0 s_waitcnt lgkmcnt(0) v_add_co_u32 v0, vcc_lo, s0, v0 v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo global_store_b32 v[0:1], v2, off .LBB0_4: s_nop 0 s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z31convertDepthImageToMeter_kernelPfPKjii .amdhsa_group_segment_fixed_size 0 .amdhsa_private_segment_fixed_size 0 .amdhsa_kernarg_size 280 .amdhsa_user_sgpr_count 14 .amdhsa_user_sgpr_dispatch_ptr 0 .amdhsa_user_sgpr_queue_ptr 0 .amdhsa_user_sgpr_kernarg_segment_ptr 1 .amdhsa_user_sgpr_dispatch_id 0 .amdhsa_user_sgpr_private_segment_size 0 .amdhsa_wavefront_size32 1 .amdhsa_uses_dynamic_stack 0 .amdhsa_enable_private_segment 0 .amdhsa_system_sgpr_workgroup_id_x 1 .amdhsa_system_sgpr_workgroup_id_y 1 .amdhsa_system_sgpr_workgroup_id_z 0 .amdhsa_system_sgpr_workgroup_info 0 .amdhsa_system_vgpr_workitem_id 1 .amdhsa_next_free_vgpr 8 .amdhsa_next_free_sgpr 16 .amdhsa_float_round_mode_32 0 .amdhsa_float_round_mode_16_64 0 .amdhsa_float_denorm_mode_32 3 .amdhsa_float_denorm_mode_16_64 3 .amdhsa_dx10_clamp 1 .amdhsa_ieee_mode 1 .amdhsa_fp16_overflow 0 .amdhsa_workgroup_processor_mode 1 .amdhsa_memory_ordered 1 .amdhsa_forward_progress 0 .amdhsa_shared_vgpr_count 0 .amdhsa_exception_fp_ieee_invalid_op 0 .amdhsa_exception_fp_denorm_src 0 .amdhsa_exception_fp_ieee_div_zero 0 .amdhsa_exception_fp_ieee_overflow 0 .amdhsa_exception_fp_ieee_underflow 0 .amdhsa_exception_fp_ieee_inexact 0 .amdhsa_exception_int_div_zero 0 .end_amdhsa_kernel .text .Lfunc_end0: .size _Z31convertDepthImageToMeter_kernelPfPKjii, .Lfunc_end0-_Z31convertDepthImageToMeter_kernelPfPKjii .section .AMDGPU.csdata,"",@progbits .text .p2alignl 7, 3214868480 .fill 96, 4, 3214868480 .type __hip_cuid_,@object .section .bss,"aw",@nobits .globl __hip_cuid_ __hip_cuid_: .byte 0 .size __hip_cuid_, 1 .ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)" .section ".note.GNU-stack","",@progbits .addrsig .addrsig_sym __hip_cuid_ .amdgpu_metadata --- amdhsa.kernels: - .args: - .address_space: global .offset: 0 .size: 8 .value_kind: global_buffer - .address_space: global .offset: 8 .size: 8 .value_kind: global_buffer - .offset: 16 .size: 4 .value_kind: by_value - .offset: 20 .size: 4 .value_kind: by_value - .offset: 24 .size: 4 .value_kind: hidden_block_count_x - .offset: 28 .size: 4 .value_kind: hidden_block_count_y - .offset: 32 .size: 4 .value_kind: hidden_block_count_z - .offset: 36 .size: 2 .value_kind: hidden_group_size_x - .offset: 38 .size: 2 .value_kind: hidden_group_size_y - .offset: 40 .size: 2 .value_kind: hidden_group_size_z - .offset: 42 .size: 2 .value_kind: hidden_remainder_x - .offset: 44 .size: 2 .value_kind: hidden_remainder_y - .offset: 46 .size: 2 .value_kind: hidden_remainder_z - .offset: 64 .size: 8 .value_kind: hidden_global_offset_x - .offset: 72 .size: 8 .value_kind: hidden_global_offset_y - .offset: 80 .size: 8 .value_kind: hidden_global_offset_z - .offset: 88 .size: 2 .value_kind: hidden_grid_dims .group_segment_fixed_size: 0 .kernarg_segment_align: 8 .kernarg_segment_size: 280 .language: OpenCL C .language_version: - 2 - 0 .max_flat_workgroup_size: 1024 .name: _Z31convertDepthImageToMeter_kernelPfPKjii .private_segment_fixed_size: 0 .sgpr_count: 18 .sgpr_spill_count: 0 .symbol: _Z31convertDepthImageToMeter_kernelPfPKjii.kd .uniform_work_group_size: 1 .uses_dynamic_stack: false .vgpr_count: 8 .vgpr_spill_count: 0 .wavefront_size: 32 .workgroup_processor_mode: 1 amdhsa.target: amdgcn-amd-amdhsa--gfx1100 amdhsa.version: - 1 - 2 ... .end_amdgpu_metadata
You are a helpful coding assistant specialized in converting HIP source code to AMD host assembly.
#include <hip/hip_runtime.h> #include "includes.h" __global__ void convertDepthImageToMeter_kernel(float *d_depth_image_meter, const unsigned int *d_depth_image_millimeter, int n_rows, int n_cols) { const int x = blockIdx.x * blockDim.x + threadIdx.x; const int y = blockIdx.y * blockDim.y + threadIdx.y; if (x < n_cols && y < n_rows) { int ind = y * n_cols + x; unsigned int depth = d_depth_image_millimeter[ind]; d_depth_image_meter[ind] = (depth == 4294967295) ? nanf("") : (float)depth / 1000.0f; } }
.text .file "convertDepthImageToMeter_kernel.hip" .globl _Z46__device_stub__convertDepthImageToMeter_kernelPfPKjii # -- Begin function _Z46__device_stub__convertDepthImageToMeter_kernelPfPKjii .p2align 4, 0x90 .type _Z46__device_stub__convertDepthImageToMeter_kernelPfPKjii,@function _Z46__device_stub__convertDepthImageToMeter_kernelPfPKjii: # @_Z46__device_stub__convertDepthImageToMeter_kernelPfPKjii .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 $_Z31convertDepthImageToMeter_kernelPfPKjii, %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 _Z46__device_stub__convertDepthImageToMeter_kernelPfPKjii, .Lfunc_end0-_Z46__device_stub__convertDepthImageToMeter_kernelPfPKjii .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 $_Z31convertDepthImageToMeter_kernelPfPKjii, %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 _Z31convertDepthImageToMeter_kernelPfPKjii,@object # @_Z31convertDepthImageToMeter_kernelPfPKjii .section .rodata,"a",@progbits .globl _Z31convertDepthImageToMeter_kernelPfPKjii .p2align 3, 0x0 _Z31convertDepthImageToMeter_kernelPfPKjii: .quad _Z46__device_stub__convertDepthImageToMeter_kernelPfPKjii .size _Z31convertDepthImageToMeter_kernelPfPKjii, 8 .type .L__unnamed_1,@object # @0 .section .rodata.str1.1,"aMS",@progbits,1 .L__unnamed_1: .asciz "_Z31convertDepthImageToMeter_kernelPfPKjii" .size .L__unnamed_1, 43 .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 _Z46__device_stub__convertDepthImageToMeter_kernelPfPKjii .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z31convertDepthImageToMeter_kernelPfPKjii .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 : _Z31convertDepthImageToMeter_kernelPfPKjii .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 */ /* 0x000e280000002100 */ /*0030*/ S2R R2, SR_CTAID.Y ; /* 0x0000000000027919 */ /* 0x000e680000002600 */ /*0040*/ S2R R5, SR_TID.Y ; /* 0x0000000000057919 */ /* 0x000e620000002200 */ /*0050*/ IMAD R0, R0, c[0x0][0x0], R3 ; /* 0x0000000000007a24 */ /* 0x001fca00078e0203 */ /*0060*/ ISETP.GE.AND P0, PT, R0, c[0x0][0x174], PT ; /* 0x00005d0000007a0c */ /* 0x000fe20003f06270 */ /*0070*/ IMAD R3, R2, c[0x0][0x4], R5 ; /* 0x0000010002037a24 */ /* 0x002fca00078e0205 */ /*0080*/ ISETP.GE.OR P0, PT, R3, c[0x0][0x170], P0 ; /* 0x00005c0003007a0c */ /* 0x000fda0000706670 */ /*0090*/ @P0 EXIT ; /* 0x000000000000094d */ /* 0x000fea0003800000 */ /*00a0*/ IMAD.MOV.U32 R5, RZ, RZ, 0x4 ; /* 0x00000004ff057424 */ /* 0x000fe200078e00ff */ /*00b0*/ ULDC.64 UR6, c[0x0][0x118] ; /* 0x0000460000067ab9 */ /* 0x000fe20000000a00 */ /*00c0*/ IMAD R0, R3, c[0x0][0x174], R0 ; /* 0x00005d0003007a24 */ /* 0x000fc800078e0200 */ /*00d0*/ IMAD.WIDE R4, R0, R5, c[0x0][0x168] ; /* 0x00005a0000047625 */ /* 0x000fcc00078e0205 */ /*00e0*/ LDG.E R4, [R4.64] ; /* 0x0000000604047981 */ /* 0x000ea2000c1e1900 */ /*00f0*/ BSSY B2, 0x240 ; /* 0x0000014000027945 */ /* 0x000fe20003800000 */ /*0100*/ IMAD.MOV.U32 R7, RZ, RZ, 0x7fc00000 ; /* 0x7fc00000ff077424 */ /* 0x000fe200078e00ff */ /*0110*/ SHF.R.S32.HI R3, RZ, 0x1f, R0 ; /* 0x0000001fff037819 */ /* 0x000fe40000011400 */ /*0120*/ ISETP.NE.AND P0, PT, R4, -0x1, PT ; /* 0xffffffff0400780c */ /* 0x004fda0003f05270 */ /*0130*/ @!P0 BRA 0x230 ; /* 0x000000f000008947 */ /* 0x000fea0003800000 */ /*0140*/ I2F.U32 R4, R4 ; /* 0x0000000400047306 */ /* 0x000e220000201000 */ /*0150*/ IMAD.MOV.U32 R5, RZ, RZ, 0x3a83126f ; /* 0x3a83126fff057424 */ /* 0x000fe200078e00ff */ /*0160*/ BSSY B1, 0x230 ; /* 0x000000c000017945 */ /* 0x000fe20003800000 */ /*0170*/ IMAD.MOV.U32 R2, RZ, RZ, 0x447a0000 ; /* 0x447a0000ff027424 */ /* 0x000fc800078e00ff */ /*0180*/ FFMA R2, R5, -R2, 1 ; /* 0x3f80000005027423 */ /* 0x000fc80000000802 */ /*0190*/ FFMA R5, R2, R5, 0.0010000000474974513054 ; /* 0x3a83126f02057423 */ /* 0x000fe20000000005 */ /*01a0*/ FCHK P0, R4, 1000 ; /* 0x447a000004007902 */ /* 0x001e260000000000 */ /*01b0*/ FFMA R2, R4, R5, RZ ; /* 0x0000000504027223 */ /* 0x000fc800000000ff */ /*01c0*/ FFMA R6, R2, -1000, R4 ; /* 0xc47a000002067823 */ /* 0x000fc80000000004 */ /*01d0*/ FFMA R7, R5, R6, R2 ; /* 0x0000000605077223 */ /* 0x000fe20000000002 */ /*01e0*/ @!P0 BRA 0x220 ; /* 0x0000003000008947 */ /* 0x001fea0003800000 */ /*01f0*/ MOV R2, 0x210 ; /* 0x0000021000027802 */ /* 0x000fe40000000f00 */ /*0200*/ CALL.REL.NOINC 0x280 ; /* 0x0000007000007944 */ /* 0x000fea0003c00000 */ /*0210*/ IMAD.MOV.U32 R7, RZ, RZ, R6 ; /* 0x000000ffff077224 */ /* 0x001fe400078e0006 */ /*0220*/ BSYNC B1 ; /* 0x0000000000017941 */ /* 0x000fea0003800000 */ /*0230*/ BSYNC B2 ; /* 0x0000000000027941 */ /* 0x000fea0003800000 */ /*0240*/ LEA R2, P0, R0, c[0x0][0x160], 0x2 ; /* 0x0000580000027a11 */ /* 0x000fc800078010ff */ /*0250*/ LEA.HI.X R3, R0, c[0x0][0x164], R3, 0x2, P0 ; /* 0x0000590000037a11 */ /* 0x000fca00000f1403 */ /*0260*/ STG.E [R2.64], R7 ; /* 0x0000000702007986 */ /* 0x000fe2000c101906 */ /*0270*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*0280*/ SHF.R.U32.HI R5, RZ, 0x17, R4.reuse ; /* 0x00000017ff057819 */ /* 0x100fe20000011604 */ /*0290*/ BSSY B0, 0x860 ; /* 0x000005c000007945 */ /* 0x000fe20003800000 */ /*02a0*/ BSSY B3, 0x450 ; /* 0x000001a000037945 */ /* 0x000fe20003800000 */ /*02b0*/ IMAD.MOV.U32 R6, RZ, RZ, R4 ; /* 0x000000ffff067224 */ /* 0x000fe200078e0004 */ /*02c0*/ LOP3.LUT R5, R5, 0xff, RZ, 0xc0, !PT ; /* 0x000000ff05057812 */ /* 0x000fc800078ec0ff */ /*02d0*/ IADD3 R8, R5, -0x1, RZ ; /* 0xffffffff05087810 */ /* 0x000fc80007ffe0ff */ /*02e0*/ ISETP.GT.U32.OR P0, PT, R8, 0xfd, !PT ; /* 0x000000fd0800780c */ /* 0x000fda0007f04470 */ /*02f0*/ @!P0 IMAD.MOV.U32 R7, RZ, RZ, RZ ; /* 0x000000ffff078224 */ /* 0x000fe200078e00ff */ /*0300*/ @!P0 BRA 0x440 ; /* 0x0000013000008947 */ /* 0x000fea0003800000 */ /*0310*/ FSETP.GTU.FTZ.AND P0, PT, |R4|, +INF , PT ; /* 0x7f8000000400780b */ /* 0x000fda0003f1c200 */ /*0320*/ @P0 BREAK B3 ; /* 0x0000000000030942 */ /* 0x000fe20003800000 */ /*0330*/ @P0 BRA 0x840 ; /* 0x0000050000000947 */ /* 0x000fea0003800000 */ /*0340*/ IMAD.MOV.U32 R7, RZ, RZ, 0x447a0000 ; /* 0x447a0000ff077424 */ /* 0x000fca00078e00ff */ /*0350*/ LOP3.LUT P0, RZ, R7, 0x7fffffff, R6, 0xc8, !PT ; /* 0x7fffffff07ff7812 */ /* 0x000fda000780c806 */ /*0360*/ @!P0 BREAK B3 ; /* 0x0000000000038942 */ /* 0x000fe20003800000 */ /*0370*/ @!P0 BRA 0x820 ; /* 0x000004a000008947 */ /* 0x000fea0003800000 */ /*0380*/ LOP3.LUT P0, RZ, R6, 0x7fffffff, RZ, 0xc0, !PT ; /* 0x7fffffff06ff7812 */ /* 0x000fda000780c0ff */ /*0390*/ @!P0 BREAK B3 ; /* 0x0000000000038942 */ /* 0x000fe20003800000 */ /*03a0*/ @!P0 BRA 0x800 ; /* 0x0000045000008947 */ /* 0x000fea0003800000 */ /*03b0*/ FSETP.NEU.FTZ.AND P0, PT, |R4|, +INF , PT ; /* 0x7f8000000400780b */ /* 0x000fe40003f1d200 */ /*03c0*/ LOP3.LUT P1, RZ, R7, 0x7fffffff, RZ, 0xc0, !PT ; /* 0x7fffffff07ff7812 */ /* 0x000fc8000782c0ff */ /*03d0*/ PLOP3.LUT P0, PT, P0, P1, PT, 0x2a, 0x0 ; /* 0x000000000000781c */ /* 0x000fda0000702572 */ /*03e0*/ @P0 BREAK B3 ; /* 0x0000000000030942 */ /* 0x000fe20003800000 */ /*03f0*/ @P0 BRA 0x7d0 ; /* 0x000003d000000947 */ /* 0x000fea0003800000 */ /*0400*/ ISETP.GE.AND P0, PT, R8, RZ, PT ; /* 0x000000ff0800720c */ /* 0x000fda0003f06270 */ /*0410*/ @P0 IMAD.MOV.U32 R7, RZ, RZ, RZ ; /* 0x000000ffff070224 */ /* 0x000fe400078e00ff */ /*0420*/ @!P0 FFMA R6, R4, 1.84467440737095516160e+19, RZ ; /* 0x5f80000004068823 */ /* 0x000fe400000000ff */ /*0430*/ @!P0 IMAD.MOV.U32 R7, RZ, RZ, -0x40 ; /* 0xffffffc0ff078424 */ /* 0x000fe400078e00ff */ /*0440*/ BSYNC B3 ; /* 0x0000000000037941 */ /* 0x000fea0003800000 */ /*0450*/ UMOV UR4, 0x447a0000 ; /* 0x447a000000047882 */ /* 0x000fe20000000000 */ /*0460*/ IADD3 R5, R5, -0x7f, RZ ; /* 0xffffff8105057810 */ /* 0x000fe20007ffe0ff */ /*0470*/ UIADD3 UR4, UR4, -0x4800000, URZ ; /* 0xfb80000004047890 */ /* 0x000fe2000fffe03f */ /*0480*/ BSSY B3, 0x7c0 ; /* 0x0000033000037945 */ /* 0x000fe40003800000 */ /*0490*/ IADD3 R7, R7, -0x9, R5 ; /* 0xfffffff707077810 */ /* 0x000fe20007ffe005 */ /*04a0*/ IMAD R6, R5, -0x800000, R6 ; /* 0xff80000005067824 */ /* 0x000fc400078e0206 */ /*04b0*/ FADD.FTZ R9, -RZ, -UR4 ; /* 0x80000004ff097e21 */ /* 0x000fc60008010100 */ /*04c0*/ MUFU.RCP R4, UR4 ; /* 0x0000000400047d08 */ /* 0x000e240008001000 */ /*04d0*/ FFMA R11, R4, R9, 1 ; /* 0x3f800000040b7423 */ /* 0x001fc80000000009 */ /*04e0*/ FFMA R11, R4, R11, R4 ; /* 0x0000000b040b7223 */ /* 0x000fc80000000004 */ /*04f0*/ FFMA R4, R6, R11, RZ ; /* 0x0000000b06047223 */ /* 0x000fc800000000ff */ /*0500*/ FFMA R8, R9, R4, R6 ; /* 0x0000000409087223 */ /* 0x000fc80000000006 */ /*0510*/ FFMA R8, R11, R8, R4 ; /* 0x000000080b087223 */ /* 0x000fc80000000004 */ /*0520*/ FFMA R9, R9, R8, R6 ; /* 0x0000000809097223 */ /* 0x000fc80000000006 */ /*0530*/ FFMA R6, R11, R9, R8 ; /* 0x000000090b067223 */ /* 0x000fca0000000008 */ /*0540*/ SHF.R.U32.HI R4, RZ, 0x17, R6 ; /* 0x00000017ff047819 */ /* 0x000fc80000011606 */ /*0550*/ LOP3.LUT R4, R4, 0xff, RZ, 0xc0, !PT ; /* 0x000000ff04047812 */ /* 0x000fca00078ec0ff */ /*0560*/ IMAD.IADD R10, R4, 0x1, R7 ; /* 0x00000001040a7824 */ /* 0x000fca00078e0207 */ /*0570*/ IADD3 R4, R10, -0x1, RZ ; /* 0xffffffff0a047810 */ /* 0x000fc80007ffe0ff */ /*0580*/ ISETP.GE.U32.AND P0, PT, R4, 0xfe, PT ; /* 0x000000fe0400780c */ /* 0x000fda0003f06070 */ /*0590*/ @!P0 BRA 0x7a0 ; /* 0x0000020000008947 */ /* 0x000fea0003800000 */ /*05a0*/ ISETP.GT.AND P0, PT, R10, 0xfe, PT ; /* 0x000000fe0a00780c */ /* 0x000fda0003f04270 */ /*05b0*/ @P0 BRA 0x770 ; /* 0x000001b000000947 */ /* 0x000fea0003800000 */ /*05c0*/ ISETP.GE.AND P0, PT, R10, 0x1, PT ; /* 0x000000010a00780c */ /* 0x000fda0003f06270 */ /*05d0*/ @P0 BRA 0x7b0 ; /* 0x000001d000000947 */ /* 0x000fea0003800000 */ /*05e0*/ ISETP.GE.AND P0, PT, R10, -0x18, PT ; /* 0xffffffe80a00780c */ /* 0x000fe40003f06270 */ /*05f0*/ LOP3.LUT R6, R6, 0x80000000, RZ, 0xc0, !PT ; /* 0x8000000006067812 */ /* 0x000fd600078ec0ff */ /*0600*/ @!P0 BRA 0x7b0 ; /* 0x000001a000008947 */ /* 0x000fea0003800000 */ /*0610*/ FFMA.RZ R4, R11.reuse, R9.reuse, R8 ; /* 0x000000090b047223 */ /* 0x0c0fe2000000c008 */ /*0620*/ ISETP.NE.AND P2, PT, R10.reuse, RZ, PT ; /* 0x000000ff0a00720c */ /* 0x040fe20003f45270 */ /*0630*/ IMAD.MOV R7, RZ, RZ, -R10 ; /* 0x000000ffff077224 */ /* 0x000fe200078e0a0a */ /*0640*/ ISETP.NE.AND P1, PT, R10, RZ, PT ; /* 0x000000ff0a00720c */ /* 0x000fe40003f25270 */ /*0650*/ LOP3.LUT R5, R4, 0x7fffff, RZ, 0xc0, !PT ; /* 0x007fffff04057812 */ /* 0x000fe200078ec0ff */ /*0660*/ FFMA.RP R4, R11.reuse, R9.reuse, R8.reuse ; /* 0x000000090b047223 */ /* 0x1c0fe40000008008 */ /*0670*/ FFMA.RM R11, R11, R9, R8 ; /* 0x000000090b0b7223 */ /* 0x000fe20000004008 */ /*0680*/ IADD3 R8, R10, 0x20, RZ ; /* 0x000000200a087810 */ /* 0x000fe40007ffe0ff */ /*0690*/ LOP3.LUT R5, R5, 0x800000, RZ, 0xfc, !PT ; /* 0x0080000005057812 */ /* 0x000fc400078efcff */ /*06a0*/ FSETP.NEU.FTZ.AND P0, PT, R4, R11, PT ; /* 0x0000000b0400720b */ /* 0x000fe40003f1d000 */ /*06b0*/ SHF.L.U32 R8, R5, R8, RZ ; /* 0x0000000805087219 */ /* 0x000fe400000006ff */ /*06c0*/ SEL R4, R7, RZ, P2 ; /* 0x000000ff07047207 */ /* 0x000fe40001000000 */ /*06d0*/ ISETP.NE.AND P1, PT, R8, RZ, P1 ; /* 0x000000ff0800720c */ /* 0x000fe40000f25270 */ /*06e0*/ SHF.R.U32.HI R4, RZ, R4, R5 ; /* 0x00000004ff047219 */ /* 0x000fe40000011605 */ /*06f0*/ PLOP3.LUT P0, PT, P0, P1, PT, 0xa8, 0x0 ; /* 0x000000000000781c */ /* 0x000fc40000703570 */ /*0700*/ SHF.R.U32.HI R8, RZ, 0x1, R4 ; /* 0x00000001ff087819 */ /* 0x000fe40000011604 */ /*0710*/ SEL R5, RZ, 0x1, !P0 ; /* 0x00000001ff057807 */ /* 0x000fc80004000000 */ /*0720*/ LOP3.LUT R5, R5, 0x1, R8, 0xf8, !PT ; /* 0x0000000105057812 */ /* 0x000fc800078ef808 */ /*0730*/ LOP3.LUT R5, R5, R4, RZ, 0xc0, !PT ; /* 0x0000000405057212 */ /* 0x000fca00078ec0ff */ /*0740*/ IMAD.IADD R5, R8, 0x1, R5 ; /* 0x0000000108057824 */ /* 0x000fca00078e0205 */ /*0750*/ LOP3.LUT R6, R5, R6, RZ, 0xfc, !PT ; /* 0x0000000605067212 */ /* 0x000fe200078efcff */ /*0760*/ BRA 0x7b0 ; /* 0x0000004000007947 */ /* 0x000fea0003800000 */ /*0770*/ LOP3.LUT R6, R6, 0x80000000, RZ, 0xc0, !PT ; /* 0x8000000006067812 */ /* 0x000fc800078ec0ff */ /*0780*/ LOP3.LUT R6, R6, 0x7f800000, RZ, 0xfc, !PT ; /* 0x7f80000006067812 */ /* 0x000fe200078efcff */ /*0790*/ BRA 0x7b0 ; /* 0x0000001000007947 */ /* 0x000fea0003800000 */ /*07a0*/ IMAD R6, R7, 0x800000, R6 ; /* 0x0080000007067824 */ /* 0x000fe400078e0206 */ /*07b0*/ BSYNC B3 ; /* 0x0000000000037941 */ /* 0x000fea0003800000 */ /*07c0*/ BRA 0x850 ; /* 0x0000008000007947 */ /* 0x000fea0003800000 */ /*07d0*/ LOP3.LUT R6, R7, 0x80000000, R6, 0x48, !PT ; /* 0x8000000007067812 */ /* 0x000fc800078e4806 */ /*07e0*/ LOP3.LUT R6, R6, 0x7f800000, RZ, 0xfc, !PT ; /* 0x7f80000006067812 */ /* 0x000fe200078efcff */ /*07f0*/ BRA 0x850 ; /* 0x0000005000007947 */ /* 0x000fea0003800000 */ /*0800*/ LOP3.LUT R6, R7, 0x80000000, R6, 0x48, !PT ; /* 0x8000000007067812 */ /* 0x000fe200078e4806 */ /*0810*/ BRA 0x850 ; /* 0x0000003000007947 */ /* 0x000fea0003800000 */ /*0820*/ MUFU.RSQ R6, -QNAN ; /* 0xffc0000000067908 */ /* 0x000e220000001400 */ /*0830*/ BRA 0x850 ; /* 0x0000001000007947 */ /* 0x000fea0003800000 */ /*0840*/ FADD.FTZ R6, R4, 1000 ; /* 0x447a000004067421 */ /* 0x000fe40000010000 */ /*0850*/ BSYNC B0 ; /* 0x0000000000007941 */ /* 0x000fea0003800000 */ /*0860*/ IMAD.MOV.U32 R4, RZ, RZ, R2 ; /* 0x000000ffff047224 */ /* 0x000fe400078e0002 */ /*0870*/ IMAD.MOV.U32 R5, RZ, RZ, 0x0 ; /* 0x00000000ff057424 */ /* 0x000fc800078e00ff */ /*0880*/ RET.REL.NODEC R4 0x0 ; /* 0xfffff77004007950 */ /* 0x000fea0003c3ffff */ /*0890*/ BRA 0x890; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*08a0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*08b0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*08c0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*08d0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*08e0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*08f0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0900*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0910*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0920*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0930*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0940*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0950*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0960*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0970*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ ..........
.text .amdgcn_target "amdgcn-amd-amdhsa--gfx1100" .protected _Z31convertDepthImageToMeter_kernelPfPKjii .globl _Z31convertDepthImageToMeter_kernelPfPKjii .p2align 8 .type _Z31convertDepthImageToMeter_kernelPfPKjii,@function _Z31convertDepthImageToMeter_kernelPfPKjii: s_clause 0x1 s_load_b32 s4, s[0:1], 0x24 s_load_b64 s[2:3], s[0:1], 0x10 v_and_b32_e32 v2, 0x3ff, v0 v_bfe_u32 v3, v0, 10, 10 s_waitcnt lgkmcnt(0) s_and_b32 s5, s4, 0xffff s_lshr_b32 s4, s4, 16 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2) v_mad_u64_u32 v[0:1], null, s14, s5, v[2:3] v_mad_u64_u32 v[1:2], null, s15, s4, v[3:4] v_cmp_gt_i32_e32 vcc_lo, s3, v0 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1) v_cmp_gt_i32_e64 s2, s2, v1 s_and_b32 s2, vcc_lo, s2 s_delay_alu instid0(SALU_CYCLE_1) s_and_saveexec_b32 s4, s2 s_cbranch_execz .LBB0_4 s_load_b64 s[4:5], s[0:1], 0x8 v_mad_u64_u32 v[2:3], null, v1, s3, v[0:1] s_mov_b32 s2, exec_lo s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_ashrrev_i32_e32 v3, 31, v2 v_lshlrev_b64 v[0:1], 2, v[2:3] s_waitcnt lgkmcnt(0) s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2) v_add_co_u32 v2, vcc_lo, s4, v0 v_add_co_ci_u32_e32 v3, vcc_lo, s5, v1, vcc_lo global_load_b32 v3, v[2:3], off v_mov_b32_e32 v2, 0x7fc00000 s_waitcnt vmcnt(0) v_cmpx_ne_u32_e32 -1, v3 s_cbranch_execz .LBB0_3 v_cvt_f32_u32_e32 v2, v3 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_div_scale_f32 v3, null, 0x447a0000, 0x447a0000, v2 v_rcp_f32_e32 v4, v3 s_waitcnt_depctr 0xfff v_fma_f32 v5, -v3, v4, 1.0 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_fmac_f32_e32 v4, v5, v4 v_div_scale_f32 v5, vcc_lo, v2, 0x447a0000, v2 v_mul_f32_e32 v6, v5, v4 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_fma_f32 v7, -v3, v6, v5 v_fmac_f32_e32 v6, v7, v4 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_fma_f32 v3, -v3, v6, v5 v_div_fmas_f32 v3, v3, v4, v6 s_delay_alu instid0(VALU_DEP_1) v_div_fixup_f32 v2, v3, 0x447a0000, v2 .LBB0_3: s_or_b32 exec_lo, exec_lo, s2 s_load_b64 s[0:1], s[0:1], 0x0 s_waitcnt lgkmcnt(0) v_add_co_u32 v0, vcc_lo, s0, v0 v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo global_store_b32 v[0:1], v2, off .LBB0_4: s_nop 0 s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z31convertDepthImageToMeter_kernelPfPKjii .amdhsa_group_segment_fixed_size 0 .amdhsa_private_segment_fixed_size 0 .amdhsa_kernarg_size 280 .amdhsa_user_sgpr_count 14 .amdhsa_user_sgpr_dispatch_ptr 0 .amdhsa_user_sgpr_queue_ptr 0 .amdhsa_user_sgpr_kernarg_segment_ptr 1 .amdhsa_user_sgpr_dispatch_id 0 .amdhsa_user_sgpr_private_segment_size 0 .amdhsa_wavefront_size32 1 .amdhsa_uses_dynamic_stack 0 .amdhsa_enable_private_segment 0 .amdhsa_system_sgpr_workgroup_id_x 1 .amdhsa_system_sgpr_workgroup_id_y 1 .amdhsa_system_sgpr_workgroup_id_z 0 .amdhsa_system_sgpr_workgroup_info 0 .amdhsa_system_vgpr_workitem_id 1 .amdhsa_next_free_vgpr 8 .amdhsa_next_free_sgpr 16 .amdhsa_float_round_mode_32 0 .amdhsa_float_round_mode_16_64 0 .amdhsa_float_denorm_mode_32 3 .amdhsa_float_denorm_mode_16_64 3 .amdhsa_dx10_clamp 1 .amdhsa_ieee_mode 1 .amdhsa_fp16_overflow 0 .amdhsa_workgroup_processor_mode 1 .amdhsa_memory_ordered 1 .amdhsa_forward_progress 0 .amdhsa_shared_vgpr_count 0 .amdhsa_exception_fp_ieee_invalid_op 0 .amdhsa_exception_fp_denorm_src 0 .amdhsa_exception_fp_ieee_div_zero 0 .amdhsa_exception_fp_ieee_overflow 0 .amdhsa_exception_fp_ieee_underflow 0 .amdhsa_exception_fp_ieee_inexact 0 .amdhsa_exception_int_div_zero 0 .end_amdhsa_kernel .text .Lfunc_end0: .size _Z31convertDepthImageToMeter_kernelPfPKjii, .Lfunc_end0-_Z31convertDepthImageToMeter_kernelPfPKjii .section .AMDGPU.csdata,"",@progbits .text .p2alignl 7, 3214868480 .fill 96, 4, 3214868480 .type __hip_cuid_,@object .section .bss,"aw",@nobits .globl __hip_cuid_ __hip_cuid_: .byte 0 .size __hip_cuid_, 1 .ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)" .section ".note.GNU-stack","",@progbits .addrsig .addrsig_sym __hip_cuid_ .amdgpu_metadata --- amdhsa.kernels: - .args: - .address_space: global .offset: 0 .size: 8 .value_kind: global_buffer - .address_space: global .offset: 8 .size: 8 .value_kind: global_buffer - .offset: 16 .size: 4 .value_kind: by_value - .offset: 20 .size: 4 .value_kind: by_value - .offset: 24 .size: 4 .value_kind: hidden_block_count_x - .offset: 28 .size: 4 .value_kind: hidden_block_count_y - .offset: 32 .size: 4 .value_kind: hidden_block_count_z - .offset: 36 .size: 2 .value_kind: hidden_group_size_x - .offset: 38 .size: 2 .value_kind: hidden_group_size_y - .offset: 40 .size: 2 .value_kind: hidden_group_size_z - .offset: 42 .size: 2 .value_kind: hidden_remainder_x - .offset: 44 .size: 2 .value_kind: hidden_remainder_y - .offset: 46 .size: 2 .value_kind: hidden_remainder_z - .offset: 64 .size: 8 .value_kind: hidden_global_offset_x - .offset: 72 .size: 8 .value_kind: hidden_global_offset_y - .offset: 80 .size: 8 .value_kind: hidden_global_offset_z - .offset: 88 .size: 2 .value_kind: hidden_grid_dims .group_segment_fixed_size: 0 .kernarg_segment_align: 8 .kernarg_segment_size: 280 .language: OpenCL C .language_version: - 2 - 0 .max_flat_workgroup_size: 1024 .name: _Z31convertDepthImageToMeter_kernelPfPKjii .private_segment_fixed_size: 0 .sgpr_count: 18 .sgpr_spill_count: 0 .symbol: _Z31convertDepthImageToMeter_kernelPfPKjii.kd .uniform_work_group_size: 1 .uses_dynamic_stack: false .vgpr_count: 8 .vgpr_spill_count: 0 .wavefront_size: 32 .workgroup_processor_mode: 1 amdhsa.target: amdgcn-amd-amdhsa--gfx1100 amdhsa.version: - 1 - 2 ... .end_amdgpu_metadata
You are a helpful coding assistant specialized in converting from CUDA host assembly to AMD host assembly.
.file "tmpxft_000b7417_00000000-6_convertDepthImageToMeter_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 .globl _Z56__device_stub__Z31convertDepthImageToMeter_kernelPfPKjiiPfPKjii .type _Z56__device_stub__Z31convertDepthImageToMeter_kernelPfPKjiiPfPKjii, @function _Z56__device_stub__Z31convertDepthImageToMeter_kernelPfPKjiiPfPKjii: .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 _Z31convertDepthImageToMeter_kernelPfPKjii(%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 _Z56__device_stub__Z31convertDepthImageToMeter_kernelPfPKjiiPfPKjii, .-_Z56__device_stub__Z31convertDepthImageToMeter_kernelPfPKjiiPfPKjii .globl _Z31convertDepthImageToMeter_kernelPfPKjii .type _Z31convertDepthImageToMeter_kernelPfPKjii, @function _Z31convertDepthImageToMeter_kernelPfPKjii: .LFB2052: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z56__device_stub__Z31convertDepthImageToMeter_kernelPfPKjiiPfPKjii addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2052: .size _Z31convertDepthImageToMeter_kernelPfPKjii, .-_Z31convertDepthImageToMeter_kernelPfPKjii .section .rodata.str1.8,"aMS",@progbits,1 .align 8 .LC0: .string "_Z31convertDepthImageToMeter_kernelPfPKjii" .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 _Z31convertDepthImageToMeter_kernelPfPKjii(%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 "convertDepthImageToMeter_kernel.hip" .globl _Z46__device_stub__convertDepthImageToMeter_kernelPfPKjii # -- Begin function _Z46__device_stub__convertDepthImageToMeter_kernelPfPKjii .p2align 4, 0x90 .type _Z46__device_stub__convertDepthImageToMeter_kernelPfPKjii,@function _Z46__device_stub__convertDepthImageToMeter_kernelPfPKjii: # @_Z46__device_stub__convertDepthImageToMeter_kernelPfPKjii .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 $_Z31convertDepthImageToMeter_kernelPfPKjii, %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 _Z46__device_stub__convertDepthImageToMeter_kernelPfPKjii, .Lfunc_end0-_Z46__device_stub__convertDepthImageToMeter_kernelPfPKjii .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 $_Z31convertDepthImageToMeter_kernelPfPKjii, %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 _Z31convertDepthImageToMeter_kernelPfPKjii,@object # @_Z31convertDepthImageToMeter_kernelPfPKjii .section .rodata,"a",@progbits .globl _Z31convertDepthImageToMeter_kernelPfPKjii .p2align 3, 0x0 _Z31convertDepthImageToMeter_kernelPfPKjii: .quad _Z46__device_stub__convertDepthImageToMeter_kernelPfPKjii .size _Z31convertDepthImageToMeter_kernelPfPKjii, 8 .type .L__unnamed_1,@object # @0 .section .rodata.str1.1,"aMS",@progbits,1 .L__unnamed_1: .asciz "_Z31convertDepthImageToMeter_kernelPfPKjii" .size .L__unnamed_1, 43 .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 _Z46__device_stub__convertDepthImageToMeter_kernelPfPKjii .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z31convertDepthImageToMeter_kernelPfPKjii .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 addVectors( int size, float *d_a, float *d_b, float *d_c) { int tid = threadIdx.x + blockIdx.x * blockDim.x; if (tid < size) { d_c[tid] = d_a[tid] + d_b[tid]; } }
code for sm_80 Function : _Z10addVectorsiPfS_S_ .headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)" /*0000*/ MOV R1, c[0x0][0x28] ; /* 0x00000a0000017a02 */ /* 0x000fe40000000f00 */ /*0010*/ S2R R6, SR_TID.X ; /* 0x0000000000067919 */ /* 0x000e280000002100 */ /*0020*/ S2R R3, SR_CTAID.X ; /* 0x0000000000037919 */ /* 0x000e240000002500 */ /*0030*/ IMAD R6, R3, c[0x0][0x0], R6 ; /* 0x0000000003067a24 */ /* 0x001fca00078e0206 */ /*0040*/ ISETP.GE.AND P0, PT, R6, c[0x0][0x160], PT ; /* 0x0000580006007a0c */ /* 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][0x170] ; /* 0x00005c0006047625 */ /* 0x000fc800078e0207 */ /*0090*/ IMAD.WIDE R2, R6.reuse, R7.reuse, c[0x0][0x168] ; /* 0x00005a0006027625 */ /* 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][0x178] ; /* 0x00005e0006067625 */ /* 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 "includes.h" __global__ void addVectors( int size, float *d_a, float *d_b, float *d_c) { int tid = threadIdx.x + blockIdx.x * blockDim.x; if (tid < size) { d_c[tid] = d_a[tid] + d_b[tid]; } }
.file "tmpxft_000917aa_00000000-6_addVectors.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__Z10addVectorsiPfS_S_iPfS_S_ .type _Z35__device_stub__Z10addVectorsiPfS_S_iPfS_S_, @function _Z35__device_stub__Z10addVectorsiPfS_S_iPfS_S_: .LFB2051: .cfi_startproc endbr64 subq $152, %rsp .cfi_def_cfa_offset 160 movl %edi, 28(%rsp) movq %rsi, 16(%rsp) movq %rdx, 8(%rsp) movq %rcx, (%rsp) movq %fs:40, %rax movq %rax, 136(%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) 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 _Z10addVectorsiPfS_S_(%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 _Z35__device_stub__Z10addVectorsiPfS_S_iPfS_S_, .-_Z35__device_stub__Z10addVectorsiPfS_S_iPfS_S_ .globl _Z10addVectorsiPfS_S_ .type _Z10addVectorsiPfS_S_, @function _Z10addVectorsiPfS_S_: .LFB2052: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z35__device_stub__Z10addVectorsiPfS_S_iPfS_S_ addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2052: .size _Z10addVectorsiPfS_S_, .-_Z10addVectorsiPfS_S_ .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "_Z10addVectorsiPfS_S_" .text .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB2054: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 leaq _ZL15__fatDeviceText(%rip), %rdi call __cudaRegisterFatBinary@PLT movq %rax, %rdi movq %rax, _ZL20__cudaFatCubinHandle(%rip) pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 pushq $0 .cfi_def_cfa_offset 40 pushq $0 .cfi_def_cfa_offset 48 movl $0, %r9d movl $-1, %r8d leaq .LC0(%rip), %rdx movq %rdx, %rcx leaq _Z10addVectorsiPfS_S_(%rip), %rsi call __cudaRegisterFunction@PLT addq $32, %rsp .cfi_def_cfa_offset 16 movq _ZL20__cudaFatCubinHandle(%rip), %rdi call __cudaRegisterFatBinaryEnd@PLT leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi call atexit@PLT addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2054: .size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv .section .init_array,"aw" .align 8 .quad _ZL24__sti____cudaRegisterAllv .section .nvFatBinSegment,"aw" .align 8 .type _ZL15__fatDeviceText, @object .size _ZL15__fatDeviceText, 24 _ZL15__fatDeviceText: .long 1180844977 .long 1 .quad fatbinData .quad 0 .local _ZL20__cudaFatCubinHandle .comm _ZL20__cudaFatCubinHandle,8,8 .ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4:
You are a helpful coding assistant specialized in converting CUDA source code to HIP/AMD source code.
#include "includes.h" __global__ void addVectors( int size, float *d_a, float *d_b, float *d_c) { int tid = threadIdx.x + blockIdx.x * blockDim.x; if (tid < size) { d_c[tid] = d_a[tid] + d_b[tid]; } }
#include <hip/hip_runtime.h> #include "includes.h" __global__ void addVectors( int size, float *d_a, float *d_b, float *d_c) { int tid = threadIdx.x + blockIdx.x * blockDim.x; if (tid < size) { d_c[tid] = d_a[tid] + d_b[tid]; } }
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 addVectors( int size, float *d_a, float *d_b, float *d_c) { int tid = threadIdx.x + blockIdx.x * blockDim.x; if (tid < size) { d_c[tid] = d_a[tid] + d_b[tid]; } }
.text .amdgcn_target "amdgcn-amd-amdhsa--gfx1100" .protected _Z10addVectorsiPfS_S_ .globl _Z10addVectorsiPfS_S_ .p2align 8 .type _Z10addVectorsiPfS_S_,@function _Z10addVectorsiPfS_S_: s_clause 0x1 s_load_b32 s2, s[0:1], 0x2c s_load_b32 s3, s[0:1], 0x0 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], 0x8 v_ashrrev_i32_e32 v2, 31, v1 s_load_b64 s[0:1], s[0:1], 0x18 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 _Z10addVectorsiPfS_S_ .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 _Z10addVectorsiPfS_S_, .Lfunc_end0-_Z10addVectorsiPfS_S_ .section .AMDGPU.csdata,"",@progbits .text .p2alignl 7, 3214868480 .fill 96, 4, 3214868480 .type __hip_cuid_,@object .section .bss,"aw",@nobits .globl __hip_cuid_ __hip_cuid_: .byte 0 .size __hip_cuid_, 1 .ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)" .section ".note.GNU-stack","",@progbits .addrsig .addrsig_sym __hip_cuid_ .amdgpu_metadata --- amdhsa.kernels: - .args: - .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 - .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: _Z10addVectorsiPfS_S_ .private_segment_fixed_size: 0 .sgpr_count: 18 .sgpr_spill_count: 0 .symbol: _Z10addVectorsiPfS_S_.kd .uniform_work_group_size: 1 .uses_dynamic_stack: false .vgpr_count: 6 .vgpr_spill_count: 0 .wavefront_size: 32 .workgroup_processor_mode: 1 amdhsa.target: amdgcn-amd-amdhsa--gfx1100 amdhsa.version: - 1 - 2 ... .end_amdgpu_metadata
You are a helpful coding assistant specialized in converting HIP source code to AMD host assembly.
#include <hip/hip_runtime.h> #include "includes.h" __global__ void addVectors( int size, float *d_a, float *d_b, float *d_c) { int tid = threadIdx.x + blockIdx.x * blockDim.x; if (tid < size) { d_c[tid] = d_a[tid] + d_b[tid]; } }
.text .file "addVectors.hip" .globl _Z25__device_stub__addVectorsiPfS_S_ # -- Begin function _Z25__device_stub__addVectorsiPfS_S_ .p2align 4, 0x90 .type _Z25__device_stub__addVectorsiPfS_S_,@function _Z25__device_stub__addVectorsiPfS_S_: # @_Z25__device_stub__addVectorsiPfS_S_ .cfi_startproc # %bb.0: subq $120, %rsp .cfi_def_cfa_offset 128 movl %edi, 4(%rsp) movq %rsi, 72(%rsp) movq %rdx, 64(%rsp) movq %rcx, 56(%rsp) leaq 4(%rsp), %rax movq %rax, 80(%rsp) leaq 72(%rsp), %rax movq %rax, 88(%rsp) leaq 64(%rsp), %rax movq %rax, 96(%rsp) leaq 56(%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 $_Z10addVectorsiPfS_S_, %edi pushq 8(%rsp) .cfi_adjust_cfa_offset 8 pushq 24(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $136, %rsp .cfi_adjust_cfa_offset -136 retq .Lfunc_end0: .size _Z25__device_stub__addVectorsiPfS_S_, .Lfunc_end0-_Z25__device_stub__addVectorsiPfS_S_ .cfi_endproc # -- End function .p2align 4, 0x90 # -- Begin function __hip_module_ctor .type __hip_module_ctor,@function __hip_module_ctor: # @__hip_module_ctor .cfi_startproc # %bb.0: subq $40, %rsp .cfi_def_cfa_offset 48 cmpq $0, __hip_gpubin_handle(%rip) jne .LBB1_2 # %bb.1: movl $__hip_fatbin_wrapper, %edi callq __hipRegisterFatBinary movq %rax, __hip_gpubin_handle(%rip) .LBB1_2: movq __hip_gpubin_handle(%rip), %rdi xorps %xmm0, %xmm0 movups %xmm0, 16(%rsp) movups %xmm0, (%rsp) movl $_Z10addVectorsiPfS_S_, %esi movl $.L__unnamed_1, %edx movl $.L__unnamed_1, %ecx movl $-1, %r8d xorl %r9d, %r9d callq __hipRegisterFunction movl $__hip_module_dtor, %edi addq $40, %rsp .cfi_def_cfa_offset 8 jmp atexit # TAILCALL .Lfunc_end1: .size __hip_module_ctor, .Lfunc_end1-__hip_module_ctor .cfi_endproc # -- End function .p2align 4, 0x90 # -- Begin function __hip_module_dtor .type __hip_module_dtor,@function __hip_module_dtor: # @__hip_module_dtor .cfi_startproc # %bb.0: movq __hip_gpubin_handle(%rip), %rdi testq %rdi, %rdi je .LBB2_2 # %bb.1: pushq %rax .cfi_def_cfa_offset 16 callq __hipUnregisterFatBinary movq $0, __hip_gpubin_handle(%rip) addq $8, %rsp .cfi_def_cfa_offset 8 .LBB2_2: retq .Lfunc_end2: .size __hip_module_dtor, .Lfunc_end2-__hip_module_dtor .cfi_endproc # -- End function .type _Z10addVectorsiPfS_S_,@object # @_Z10addVectorsiPfS_S_ .section .rodata,"a",@progbits .globl _Z10addVectorsiPfS_S_ .p2align 3, 0x0 _Z10addVectorsiPfS_S_: .quad _Z25__device_stub__addVectorsiPfS_S_ .size _Z10addVectorsiPfS_S_, 8 .type .L__unnamed_1,@object # @0 .section .rodata.str1.1,"aMS",@progbits,1 .L__unnamed_1: .asciz "_Z10addVectorsiPfS_S_" .size .L__unnamed_1, 22 .type __hip_fatbin_wrapper,@object # @__hip_fatbin_wrapper .section .hipFatBinSegment,"a",@progbits .p2align 3, 0x0 __hip_fatbin_wrapper: .long 1212764230 # 0x48495046 .long 1 # 0x1 .quad __hip_fatbin .quad 0 .size __hip_fatbin_wrapper, 24 .type __hip_gpubin_handle,@object # @__hip_gpubin_handle .local __hip_gpubin_handle .comm __hip_gpubin_handle,8,8 .section .init_array,"aw",@init_array .p2align 3, 0x0 .quad __hip_module_ctor .type __hip_cuid_,@object # @__hip_cuid_ .bss .globl __hip_cuid_ __hip_cuid_: .byte 0 # 0x0 .size __hip_cuid_, 1 .section ".linker-options","e",@llvm_linker_options .ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)" .section ".note.GNU-stack","",@progbits .addrsig .addrsig_sym _Z25__device_stub__addVectorsiPfS_S_ .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z10addVectorsiPfS_S_ .addrsig_sym __hip_fatbin .addrsig_sym __hip_fatbin_wrapper .addrsig_sym __hip_cuid_
You are a helpful coding assistant specialized in converting from CUDA device assembly to AMD device assembly.
code for sm_80 Function : _Z10addVectorsiPfS_S_ .headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)" /*0000*/ MOV R1, c[0x0][0x28] ; /* 0x00000a0000017a02 */ /* 0x000fe40000000f00 */ /*0010*/ S2R R6, SR_TID.X ; /* 0x0000000000067919 */ /* 0x000e280000002100 */ /*0020*/ S2R R3, SR_CTAID.X ; /* 0x0000000000037919 */ /* 0x000e240000002500 */ /*0030*/ IMAD R6, R3, c[0x0][0x0], R6 ; /* 0x0000000003067a24 */ /* 0x001fca00078e0206 */ /*0040*/ ISETP.GE.AND P0, PT, R6, c[0x0][0x160], PT ; /* 0x0000580006007a0c */ /* 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][0x170] ; /* 0x00005c0006047625 */ /* 0x000fc800078e0207 */ /*0090*/ IMAD.WIDE R2, R6.reuse, R7.reuse, c[0x0][0x168] ; /* 0x00005a0006027625 */ /* 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][0x178] ; /* 0x00005e0006067625 */ /* 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 _Z10addVectorsiPfS_S_ .globl _Z10addVectorsiPfS_S_ .p2align 8 .type _Z10addVectorsiPfS_S_,@function _Z10addVectorsiPfS_S_: s_clause 0x1 s_load_b32 s2, s[0:1], 0x2c s_load_b32 s3, s[0:1], 0x0 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], 0x8 v_ashrrev_i32_e32 v2, 31, v1 s_load_b64 s[0:1], s[0:1], 0x18 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 _Z10addVectorsiPfS_S_ .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 _Z10addVectorsiPfS_S_, .Lfunc_end0-_Z10addVectorsiPfS_S_ .section .AMDGPU.csdata,"",@progbits .text .p2alignl 7, 3214868480 .fill 96, 4, 3214868480 .type __hip_cuid_,@object .section .bss,"aw",@nobits .globl __hip_cuid_ __hip_cuid_: .byte 0 .size __hip_cuid_, 1 .ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)" .section ".note.GNU-stack","",@progbits .addrsig .addrsig_sym __hip_cuid_ .amdgpu_metadata --- amdhsa.kernels: - .args: - .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 - .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: _Z10addVectorsiPfS_S_ .private_segment_fixed_size: 0 .sgpr_count: 18 .sgpr_spill_count: 0 .symbol: _Z10addVectorsiPfS_S_.kd .uniform_work_group_size: 1 .uses_dynamic_stack: false .vgpr_count: 6 .vgpr_spill_count: 0 .wavefront_size: 32 .workgroup_processor_mode: 1 amdhsa.target: amdgcn-amd-amdhsa--gfx1100 amdhsa.version: - 1 - 2 ... .end_amdgpu_metadata
You are a helpful coding assistant specialized in converting from CUDA host assembly to AMD host assembly.
.file "tmpxft_000917aa_00000000-6_addVectors.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__Z10addVectorsiPfS_S_iPfS_S_ .type _Z35__device_stub__Z10addVectorsiPfS_S_iPfS_S_, @function _Z35__device_stub__Z10addVectorsiPfS_S_iPfS_S_: .LFB2051: .cfi_startproc endbr64 subq $152, %rsp .cfi_def_cfa_offset 160 movl %edi, 28(%rsp) movq %rsi, 16(%rsp) movq %rdx, 8(%rsp) movq %rcx, (%rsp) movq %fs:40, %rax movq %rax, 136(%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) 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 _Z10addVectorsiPfS_S_(%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 _Z35__device_stub__Z10addVectorsiPfS_S_iPfS_S_, .-_Z35__device_stub__Z10addVectorsiPfS_S_iPfS_S_ .globl _Z10addVectorsiPfS_S_ .type _Z10addVectorsiPfS_S_, @function _Z10addVectorsiPfS_S_: .LFB2052: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z35__device_stub__Z10addVectorsiPfS_S_iPfS_S_ addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2052: .size _Z10addVectorsiPfS_S_, .-_Z10addVectorsiPfS_S_ .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "_Z10addVectorsiPfS_S_" .text .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB2054: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 leaq _ZL15__fatDeviceText(%rip), %rdi call __cudaRegisterFatBinary@PLT movq %rax, %rdi movq %rax, _ZL20__cudaFatCubinHandle(%rip) pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 pushq $0 .cfi_def_cfa_offset 40 pushq $0 .cfi_def_cfa_offset 48 movl $0, %r9d movl $-1, %r8d leaq .LC0(%rip), %rdx movq %rdx, %rcx leaq _Z10addVectorsiPfS_S_(%rip), %rsi call __cudaRegisterFunction@PLT addq $32, %rsp .cfi_def_cfa_offset 16 movq _ZL20__cudaFatCubinHandle(%rip), %rdi call __cudaRegisterFatBinaryEnd@PLT leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi call atexit@PLT addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2054: .size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv .section .init_array,"aw" .align 8 .quad _ZL24__sti____cudaRegisterAllv .section .nvFatBinSegment,"aw" .align 8 .type _ZL15__fatDeviceText, @object .size _ZL15__fatDeviceText, 24 _ZL15__fatDeviceText: .long 1180844977 .long 1 .quad fatbinData .quad 0 .local _ZL20__cudaFatCubinHandle .comm _ZL20__cudaFatCubinHandle,8,8 .ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4:
.text .file "addVectors.hip" .globl _Z25__device_stub__addVectorsiPfS_S_ # -- Begin function _Z25__device_stub__addVectorsiPfS_S_ .p2align 4, 0x90 .type _Z25__device_stub__addVectorsiPfS_S_,@function _Z25__device_stub__addVectorsiPfS_S_: # @_Z25__device_stub__addVectorsiPfS_S_ .cfi_startproc # %bb.0: subq $120, %rsp .cfi_def_cfa_offset 128 movl %edi, 4(%rsp) movq %rsi, 72(%rsp) movq %rdx, 64(%rsp) movq %rcx, 56(%rsp) leaq 4(%rsp), %rax movq %rax, 80(%rsp) leaq 72(%rsp), %rax movq %rax, 88(%rsp) leaq 64(%rsp), %rax movq %rax, 96(%rsp) leaq 56(%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 $_Z10addVectorsiPfS_S_, %edi pushq 8(%rsp) .cfi_adjust_cfa_offset 8 pushq 24(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $136, %rsp .cfi_adjust_cfa_offset -136 retq .Lfunc_end0: .size _Z25__device_stub__addVectorsiPfS_S_, .Lfunc_end0-_Z25__device_stub__addVectorsiPfS_S_ .cfi_endproc # -- End function .p2align 4, 0x90 # -- Begin function __hip_module_ctor .type __hip_module_ctor,@function __hip_module_ctor: # @__hip_module_ctor .cfi_startproc # %bb.0: subq $40, %rsp .cfi_def_cfa_offset 48 cmpq $0, __hip_gpubin_handle(%rip) jne .LBB1_2 # %bb.1: movl $__hip_fatbin_wrapper, %edi callq __hipRegisterFatBinary movq %rax, __hip_gpubin_handle(%rip) .LBB1_2: movq __hip_gpubin_handle(%rip), %rdi xorps %xmm0, %xmm0 movups %xmm0, 16(%rsp) movups %xmm0, (%rsp) movl $_Z10addVectorsiPfS_S_, %esi movl $.L__unnamed_1, %edx movl $.L__unnamed_1, %ecx movl $-1, %r8d xorl %r9d, %r9d callq __hipRegisterFunction movl $__hip_module_dtor, %edi addq $40, %rsp .cfi_def_cfa_offset 8 jmp atexit # TAILCALL .Lfunc_end1: .size __hip_module_ctor, .Lfunc_end1-__hip_module_ctor .cfi_endproc # -- End function .p2align 4, 0x90 # -- Begin function __hip_module_dtor .type __hip_module_dtor,@function __hip_module_dtor: # @__hip_module_dtor .cfi_startproc # %bb.0: movq __hip_gpubin_handle(%rip), %rdi testq %rdi, %rdi je .LBB2_2 # %bb.1: pushq %rax .cfi_def_cfa_offset 16 callq __hipUnregisterFatBinary movq $0, __hip_gpubin_handle(%rip) addq $8, %rsp .cfi_def_cfa_offset 8 .LBB2_2: retq .Lfunc_end2: .size __hip_module_dtor, .Lfunc_end2-__hip_module_dtor .cfi_endproc # -- End function .type _Z10addVectorsiPfS_S_,@object # @_Z10addVectorsiPfS_S_ .section .rodata,"a",@progbits .globl _Z10addVectorsiPfS_S_ .p2align 3, 0x0 _Z10addVectorsiPfS_S_: .quad _Z25__device_stub__addVectorsiPfS_S_ .size _Z10addVectorsiPfS_S_, 8 .type .L__unnamed_1,@object # @0 .section .rodata.str1.1,"aMS",@progbits,1 .L__unnamed_1: .asciz "_Z10addVectorsiPfS_S_" .size .L__unnamed_1, 22 .type __hip_fatbin_wrapper,@object # @__hip_fatbin_wrapper .section .hipFatBinSegment,"a",@progbits .p2align 3, 0x0 __hip_fatbin_wrapper: .long 1212764230 # 0x48495046 .long 1 # 0x1 .quad __hip_fatbin .quad 0 .size __hip_fatbin_wrapper, 24 .type __hip_gpubin_handle,@object # @__hip_gpubin_handle .local __hip_gpubin_handle .comm __hip_gpubin_handle,8,8 .section .init_array,"aw",@init_array .p2align 3, 0x0 .quad __hip_module_ctor .type __hip_cuid_,@object # @__hip_cuid_ .bss .globl __hip_cuid_ __hip_cuid_: .byte 0 # 0x0 .size __hip_cuid_, 1 .section ".linker-options","e",@llvm_linker_options .ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)" .section ".note.GNU-stack","",@progbits .addrsig .addrsig_sym _Z25__device_stub__addVectorsiPfS_S_ .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z10addVectorsiPfS_S_ .addrsig_sym __hip_fatbin .addrsig_sym __hip_fatbin_wrapper .addrsig_sym __hip_cuid_
You are a helpful coding assistant specialized in converting CUDA source code to CUDA device assembly.
extern "C" __global__ void saxpy(float* S, float A, float* X, float* Y) { int i = blockIdx.x * blockDim.x + threadIdx.x; S[i] = A * X[i] + Y[i]; }
code for sm_80 Function : saxpy .headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)" /*0000*/ MOV R1, c[0x0][0x28] ; /* 0x00000a0000017a02 */ /* 0x000fe40000000f00 */ /*0010*/ S2R R6, SR_CTAID.X ; /* 0x0000000000067919 */ /* 0x000e220000002500 */ /*0020*/ HFMA2.MMA R7, -RZ, RZ, 0, 2.384185791015625e-07 ; /* 0x00000004ff077435 */ /* 0x000fe200000001ff */ /*0030*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */ /* 0x000fe40000000a00 */ /*0040*/ S2R R3, SR_TID.X ; /* 0x0000000000037919 */ /* 0x000e240000002100 */ /*0050*/ IMAD R6, R6, c[0x0][0x0], R3 ; /* 0x0000000006067a24 */ /* 0x001fca00078e0203 */ /*0060*/ IMAD.WIDE R2, R6, R7, c[0x0][0x170] ; /* 0x00005c0006027625 */ /* 0x000fc800078e0207 */ /*0070*/ IMAD.WIDE R4, R6.reuse, R7.reuse, c[0x0][0x178] ; /* 0x00005e0006047625 */ /* 0x0c0fe400078e0207 */ /*0080*/ LDG.E R2, [R2.64] ; /* 0x0000000402027981 */ /* 0x000ea8000c1e1900 */ /*0090*/ LDG.E R5, [R4.64] ; /* 0x0000000404057981 */ /* 0x000ea2000c1e1900 */ /*00a0*/ IMAD.WIDE R6, R6, R7, c[0x0][0x160] ; /* 0x0000580006067625 */ /* 0x000fc800078e0207 */ /*00b0*/ FFMA R9, R2, c[0x0][0x168], R5 ; /* 0x00005a0002097a23 */ /* 0x004fca0000000005 */ /*00c0*/ STG.E [R6.64], R9 ; /* 0x0000000906007986 */ /* 0x000fe2000c101904 */ /*00d0*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*00e0*/ BRA 0xe0; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*00f0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0100*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0110*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0120*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0130*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0140*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0150*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0160*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0170*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ ..........
You are a helpful coding assistant specialized in converting CUDA source code to CUDA host assembly.
extern "C" __global__ void saxpy(float* S, float A, float* X, float* Y) { int i = blockIdx.x * blockDim.x + threadIdx.x; S[i] = A * X[i] + Y[i]; }
.file "tmpxft_0000200a_00000000-6_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 .globl _Z29__device_stub__Z5saxpyPffS_S_PffS_S_ .type _Z29__device_stub__Z5saxpyPffS_S_PffS_S_, @function _Z29__device_stub__Z5saxpyPffS_S_PffS_S_: .LFB2051: .cfi_startproc endbr64 subq $152, %rsp .cfi_def_cfa_offset 160 movq %rdi, 24(%rsp) movss %xmm0, 20(%rsp) movq %rsi, 8(%rsp) movq %rdx, (%rsp) movq %fs:40, %rax movq %rax, 136(%rsp) xorl %eax, %eax leaq 24(%rsp), %rax movq %rax, 96(%rsp) leaq 20(%rsp), %rax movq %rax, 104(%rsp) leaq 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 saxpy(%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 _Z29__device_stub__Z5saxpyPffS_S_PffS_S_, .-_Z29__device_stub__Z5saxpyPffS_S_PffS_S_ .globl saxpy .type saxpy, @function saxpy: .LFB2052: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z29__device_stub__Z5saxpyPffS_S_PffS_S_ addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2052: .size saxpy, .-saxpy .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "saxpy" .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 saxpy(%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.
extern "C" __global__ void saxpy(float* S, float A, float* X, float* Y) { int i = blockIdx.x * blockDim.x + threadIdx.x; S[i] = A * X[i] + Y[i]; }
#include <hip/hip_runtime.h> extern "C" __global__ void saxpy(float* S, float A, float* X, float* Y) { int i = blockIdx.x * blockDim.x + threadIdx.x; S[i] = A * X[i] + Y[i]; }
You are a helpful coding assistant specialized in converting HIP source code to AMD device assembly.
#include <hip/hip_runtime.h> extern "C" __global__ void saxpy(float* S, float A, float* X, float* Y) { int i = blockIdx.x * blockDim.x + threadIdx.x; S[i] = A * X[i] + Y[i]; }
.text .amdgcn_target "amdgcn-amd-amdhsa--gfx1100" .protected saxpy .globl saxpy .p2align 8 .type saxpy,@function saxpy: s_clause 0x1 s_load_b32 s2, s[0:1], 0x2c s_load_b128 s[4:7], s[0:1], 0x10 s_waitcnt lgkmcnt(0) s_and_b32 s2, s2, 0xffff s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1] v_ashrrev_i32_e32 v2, 31, v1 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_lshlrev_b64 v[0:1], 2, v[1:2] v_add_co_u32 v2, vcc_lo, s4, v0 s_delay_alu instid0(VALU_DEP_2) v_add_co_ci_u32_e32 v3, vcc_lo, s5, v1, vcc_lo v_add_co_u32 v4, vcc_lo, s6, v0 v_add_co_ci_u32_e32 v5, vcc_lo, s7, v1, vcc_lo global_load_b32 v2, v[2:3], off global_load_b32 v3, v[4:5], off s_clause 0x1 s_load_b32 s2, s[0:1], 0x8 s_load_b64 s[0:1], s[0:1], 0x0 s_waitcnt lgkmcnt(0) v_add_co_u32 v0, vcc_lo, s0, v0 v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo s_waitcnt vmcnt(0) v_fmac_f32_e32 v3, s2, v2 global_store_b32 v[0:1], v3, off s_nop 0 s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel saxpy .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 saxpy, .Lfunc_end0-saxpy .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 - .address_space: global .offset: 16 .size: 8 .value_kind: global_buffer - .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: saxpy .private_segment_fixed_size: 0 .sgpr_count: 18 .sgpr_spill_count: 0 .symbol: saxpy.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> extern "C" __global__ void saxpy(float* S, float A, float* X, float* Y) { int i = blockIdx.x * blockDim.x + threadIdx.x; S[i] = A * X[i] + Y[i]; }
.text .file "kernel.hip" .globl __device_stub__saxpy # -- Begin function __device_stub__saxpy .p2align 4, 0x90 .type __device_stub__saxpy,@function __device_stub__saxpy: # @__device_stub__saxpy .cfi_startproc # %bb.0: subq $120, %rsp .cfi_def_cfa_offset 128 movq %rdi, 72(%rsp) movss %xmm0, 4(%rsp) movq %rsi, 64(%rsp) movq %rdx, 56(%rsp) leaq 72(%rsp), %rax movq %rax, 80(%rsp) leaq 4(%rsp), %rax movq %rax, 88(%rsp) leaq 64(%rsp), %rax movq %rax, 96(%rsp) leaq 56(%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 $saxpy, %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 __device_stub__saxpy, .Lfunc_end0-__device_stub__saxpy .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 $saxpy, %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 saxpy,@object # @saxpy .section .rodata,"a",@progbits .globl saxpy .p2align 3, 0x0 saxpy: .quad __device_stub__saxpy .size saxpy, 8 .type .L__unnamed_1,@object # @0 .section .rodata.str1.1,"aMS",@progbits,1 .L__unnamed_1: .asciz "saxpy" .size .L__unnamed_1, 6 .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 __device_stub__saxpy .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym saxpy .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 : saxpy .headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)" /*0000*/ MOV R1, c[0x0][0x28] ; /* 0x00000a0000017a02 */ /* 0x000fe40000000f00 */ /*0010*/ S2R R6, SR_CTAID.X ; /* 0x0000000000067919 */ /* 0x000e220000002500 */ /*0020*/ HFMA2.MMA R7, -RZ, RZ, 0, 2.384185791015625e-07 ; /* 0x00000004ff077435 */ /* 0x000fe200000001ff */ /*0030*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */ /* 0x000fe40000000a00 */ /*0040*/ S2R R3, SR_TID.X ; /* 0x0000000000037919 */ /* 0x000e240000002100 */ /*0050*/ IMAD R6, R6, c[0x0][0x0], R3 ; /* 0x0000000006067a24 */ /* 0x001fca00078e0203 */ /*0060*/ IMAD.WIDE R2, R6, R7, c[0x0][0x170] ; /* 0x00005c0006027625 */ /* 0x000fc800078e0207 */ /*0070*/ IMAD.WIDE R4, R6.reuse, R7.reuse, c[0x0][0x178] ; /* 0x00005e0006047625 */ /* 0x0c0fe400078e0207 */ /*0080*/ LDG.E R2, [R2.64] ; /* 0x0000000402027981 */ /* 0x000ea8000c1e1900 */ /*0090*/ LDG.E R5, [R4.64] ; /* 0x0000000404057981 */ /* 0x000ea2000c1e1900 */ /*00a0*/ IMAD.WIDE R6, R6, R7, c[0x0][0x160] ; /* 0x0000580006067625 */ /* 0x000fc800078e0207 */ /*00b0*/ FFMA R9, R2, c[0x0][0x168], R5 ; /* 0x00005a0002097a23 */ /* 0x004fca0000000005 */ /*00c0*/ STG.E [R6.64], R9 ; /* 0x0000000906007986 */ /* 0x000fe2000c101904 */ /*00d0*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*00e0*/ BRA 0xe0; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*00f0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0100*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0110*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0120*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0130*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0140*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0150*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0160*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0170*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ ..........
.text .amdgcn_target "amdgcn-amd-amdhsa--gfx1100" .protected saxpy .globl saxpy .p2align 8 .type saxpy,@function saxpy: s_clause 0x1 s_load_b32 s2, s[0:1], 0x2c s_load_b128 s[4:7], s[0:1], 0x10 s_waitcnt lgkmcnt(0) s_and_b32 s2, s2, 0xffff s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1] v_ashrrev_i32_e32 v2, 31, v1 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_lshlrev_b64 v[0:1], 2, v[1:2] v_add_co_u32 v2, vcc_lo, s4, v0 s_delay_alu instid0(VALU_DEP_2) v_add_co_ci_u32_e32 v3, vcc_lo, s5, v1, vcc_lo v_add_co_u32 v4, vcc_lo, s6, v0 v_add_co_ci_u32_e32 v5, vcc_lo, s7, v1, vcc_lo global_load_b32 v2, v[2:3], off global_load_b32 v3, v[4:5], off s_clause 0x1 s_load_b32 s2, s[0:1], 0x8 s_load_b64 s[0:1], s[0:1], 0x0 s_waitcnt lgkmcnt(0) v_add_co_u32 v0, vcc_lo, s0, v0 v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo s_waitcnt vmcnt(0) v_fmac_f32_e32 v3, s2, v2 global_store_b32 v[0:1], v3, off s_nop 0 s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel saxpy .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 saxpy, .Lfunc_end0-saxpy .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 - .address_space: global .offset: 16 .size: 8 .value_kind: global_buffer - .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: saxpy .private_segment_fixed_size: 0 .sgpr_count: 18 .sgpr_spill_count: 0 .symbol: saxpy.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_0000200a_00000000-6_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 .globl _Z29__device_stub__Z5saxpyPffS_S_PffS_S_ .type _Z29__device_stub__Z5saxpyPffS_S_PffS_S_, @function _Z29__device_stub__Z5saxpyPffS_S_PffS_S_: .LFB2051: .cfi_startproc endbr64 subq $152, %rsp .cfi_def_cfa_offset 160 movq %rdi, 24(%rsp) movss %xmm0, 20(%rsp) movq %rsi, 8(%rsp) movq %rdx, (%rsp) movq %fs:40, %rax movq %rax, 136(%rsp) xorl %eax, %eax leaq 24(%rsp), %rax movq %rax, 96(%rsp) leaq 20(%rsp), %rax movq %rax, 104(%rsp) leaq 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 saxpy(%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 _Z29__device_stub__Z5saxpyPffS_S_PffS_S_, .-_Z29__device_stub__Z5saxpyPffS_S_PffS_S_ .globl saxpy .type saxpy, @function saxpy: .LFB2052: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z29__device_stub__Z5saxpyPffS_S_PffS_S_ addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2052: .size saxpy, .-saxpy .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "saxpy" .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 saxpy(%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 "kernel.hip" .globl __device_stub__saxpy # -- Begin function __device_stub__saxpy .p2align 4, 0x90 .type __device_stub__saxpy,@function __device_stub__saxpy: # @__device_stub__saxpy .cfi_startproc # %bb.0: subq $120, %rsp .cfi_def_cfa_offset 128 movq %rdi, 72(%rsp) movss %xmm0, 4(%rsp) movq %rsi, 64(%rsp) movq %rdx, 56(%rsp) leaq 72(%rsp), %rax movq %rax, 80(%rsp) leaq 4(%rsp), %rax movq %rax, 88(%rsp) leaq 64(%rsp), %rax movq %rax, 96(%rsp) leaq 56(%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 $saxpy, %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 __device_stub__saxpy, .Lfunc_end0-__device_stub__saxpy .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 $saxpy, %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 saxpy,@object # @saxpy .section .rodata,"a",@progbits .globl saxpy .p2align 3, 0x0 saxpy: .quad __device_stub__saxpy .size saxpy, 8 .type .L__unnamed_1,@object # @0 .section .rodata.str1.1,"aMS",@progbits,1 .L__unnamed_1: .asciz "saxpy" .size .L__unnamed_1, 6 .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 __device_stub__saxpy .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym saxpy .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> __global__ void hellokernel() { printf("Hello World!\n"); } int main(void) { int num_threads = 10; int num_blocks = 10; hellokernel<<<num_blocks,num_threads>>>(); cudaDeviceSynchronize(); return 0; }
code for sm_80 Function : _Z11hellokernelv .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*/ MOV R0, 0x0 ; /* 0x0000000000007802 */ /* 0x000fe20000000f00 */ /*0020*/ IMAD.MOV.U32 R4, RZ, RZ, c[0x4][0x8] ; /* 0x01000200ff047624 */ /* 0x000fe200078e00ff */ /*0030*/ CS2R R6, SRZ ; /* 0x0000000000067805 */ /* 0x000fe2000001ff00 */ /*0040*/ IMAD.MOV.U32 R5, RZ, RZ, c[0x4][0xc] ; /* 0x01000300ff057624 */ /* 0x000fe200078e00ff */ /*0050*/ LDC.64 R2, c[0x4][R0] ; /* 0x0100000000027b82 */ /* 0x00006c0000000a00 */ /*0060*/ LEPC R8 ; /* 0x000000000008734e */ /* 0x000fe40000000000 */ /*0070*/ MOV R11, 0xe0 ; /* 0x000000e0000b7802 */ /* 0x000fe40000000f00 */ /*0080*/ MOV R20, 0x60 ; /* 0x0000006000147802 */ /* 0x000fe40000000f00 */ /*0090*/ MOV R21, 0x0 ; /* 0x0000000000157802 */ /* 0x000fe40000000f00 */ /*00a0*/ MOV R0, 0x0 ; /* 0x0000000000007802 */ /* 0x001fc40000000f00 */ /*00b0*/ IADD3 R20, P0, P1, -R20, R11, R8 ; /* 0x0000000b14147210 */ /* 0x000fc8000791e108 */ /*00c0*/ IADD3.X R21, ~R0, R21, R9, P0, P1 ; /* 0x0000001500157210 */ /* 0x000fc800007e2509 */ /*00d0*/ CALL.ABS.NOINC R2 ; /* 0x0000000002007343 */ /* 0x002fea0003c00000 */ /*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 <stdio.h> __global__ void hellokernel() { printf("Hello World!\n"); } int main(void) { int num_threads = 10; int num_blocks = 10; hellokernel<<<num_blocks,num_threads>>>(); cudaDeviceSynchronize(); return 0; }
.file "tmpxft_0002be5c_00000000-6_hello-1.cudafe1.cpp" .text #APP #NO_APP .type _ZL26__cudaUnregisterBinaryUtilv, @function _ZL26__cudaUnregisterBinaryUtilv: .LFB2060: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 movq _ZL20__cudaFatCubinHandle(%rip), %rdi call __cudaUnregisterFatBinary@PLT addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2060: .size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv .globl _Z30__device_stub__Z11hellokernelvv .type _Z30__device_stub__Z11hellokernelvv, @function _Z30__device_stub__Z11hellokernelvv: .LFB2082: .cfi_startproc endbr64 subq $88, %rsp .cfi_def_cfa_offset 96 movq %fs:40, %rax movq %rax, 72(%rsp) xorl %eax, %eax movl $1, 16(%rsp) movl $1, 20(%rsp) movl $1, 24(%rsp) movl $1, 28(%rsp) movl $1, 32(%rsp) movl $1, 36(%rsp) leaq 8(%rsp), %rcx movq %rsp, %rdx leaq 28(%rsp), %rsi leaq 16(%rsp), %rdi call __cudaPopCallConfiguration@PLT testl %eax, %eax je .L7 .L3: movq 72(%rsp), %rax subq %fs:40, %rax jne .L8 addq $88, %rsp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L7: .cfi_restore_state pushq 8(%rsp) .cfi_def_cfa_offset 104 pushq 8(%rsp) .cfi_def_cfa_offset 112 leaq 80(%rsp), %r9 movq 44(%rsp), %rcx movl 52(%rsp), %r8d movq 32(%rsp), %rsi movl 40(%rsp), %edx leaq _Z11hellokernelv(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 96 jmp .L3 .L8: call __stack_chk_fail@PLT .cfi_endproc .LFE2082: .size _Z30__device_stub__Z11hellokernelvv, .-_Z30__device_stub__Z11hellokernelvv .globl _Z11hellokernelv .type _Z11hellokernelv, @function _Z11hellokernelv: .LFB2083: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z30__device_stub__Z11hellokernelvv addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2083: .size _Z11hellokernelv, .-_Z11hellokernelv .globl main .type main, @function main: .LFB2057: .cfi_startproc endbr64 subq $40, %rsp .cfi_def_cfa_offset 48 movl $10, 20(%rsp) movl $1, 24(%rsp) movl $10, 8(%rsp) movl $1, 12(%rsp) movl $0, %r9d movl $0, %r8d movq 20(%rsp), %rdx movl $1, %ecx movq 8(%rsp), %rdi movl $1, %esi call __cudaPushCallConfiguration@PLT testl %eax, %eax je .L14 .L12: call cudaDeviceSynchronize@PLT movl $0, %eax addq $40, %rsp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L14: .cfi_restore_state call _Z30__device_stub__Z11hellokernelvv jmp .L12 .cfi_endproc .LFE2057: .size main, .-main .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "_Z11hellokernelv" .text .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB2085: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 leaq _ZL15__fatDeviceText(%rip), %rdi call __cudaRegisterFatBinary@PLT movq %rax, %rdi movq %rax, _ZL20__cudaFatCubinHandle(%rip) pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 pushq $0 .cfi_def_cfa_offset 40 pushq $0 .cfi_def_cfa_offset 48 movl $0, %r9d movl $-1, %r8d leaq .LC0(%rip), %rdx movq %rdx, %rcx leaq _Z11hellokernelv(%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> __global__ void hellokernel() { printf("Hello World!\n"); } int main(void) { int num_threads = 10; int num_blocks = 10; hellokernel<<<num_blocks,num_threads>>>(); cudaDeviceSynchronize(); return 0; }
#include <hip/hip_runtime.h> #include <stdio.h> __global__ void hellokernel() { printf("Hello World!\n"); } int main(void) { int num_threads = 10; int num_blocks = 10; hellokernel<<<num_blocks,num_threads>>>(); hipDeviceSynchronize(); 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> __global__ void hellokernel() { printf("Hello World!\n"); } int main(void) { int num_threads = 10; int num_blocks = 10; hellokernel<<<num_blocks,num_threads>>>(); hipDeviceSynchronize(); return 0; }
.text .amdgcn_target "amdgcn-amd-amdhsa--gfx1100" .protected _Z11hellokernelv .globl _Z11hellokernelv .p2align 8 .type _Z11hellokernelv,@function _Z11hellokernelv: s_load_b64 s[2:3], s[0:1], 0x50 v_mbcnt_lo_u32_b32 v20, -1, 0 v_mov_b32_e32 v6, 0 s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_dual_mov_b32 v7, 0 :: v_dual_mov_b32 v4, v20 v_readfirstlane_b32 s0, v4 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_cmp_eq_u32_e64 s0, s0, v4 s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_6 v_mov_b32_e32 v0, 0 s_mov_b32 s4, exec_lo s_waitcnt lgkmcnt(0) global_load_b64 v[8:9], v0, s[2:3] offset:24 glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv s_clause 0x1 global_load_b64 v[1:2], v0, s[2:3] offset:40 global_load_b64 v[5:6], v0, s[2:3] s_waitcnt vmcnt(1) v_and_b32_e32 v1, v1, v8 v_and_b32_e32 v2, v2, v9 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_mul_hi_u32 v3, v1, 24 v_mul_lo_u32 v2, v2, 24 v_mul_lo_u32 v1, v1, 24 s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2) v_add_nc_u32_e32 v2, v3, v2 s_waitcnt vmcnt(0) v_add_co_u32 v1, vcc_lo, v5, v1 s_delay_alu instid0(VALU_DEP_2) v_add_co_ci_u32_e32 v2, vcc_lo, v6, v2, vcc_lo global_load_b64 v[6:7], v[1:2], off glc s_waitcnt vmcnt(0) global_atomic_cmpswap_b64 v[6:7], v0, v[6:9], s[2:3] offset:24 glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv v_cmpx_ne_u64_e64 v[6:7], v[8:9] s_cbranch_execz .LBB0_5 s_mov_b32 s5, 0 .p2align 6 .LBB0_3: s_sleep 1 s_clause 0x1 global_load_b64 v[1:2], v0, s[2:3] offset:40 global_load_b64 v[10:11], v0, s[2:3] v_dual_mov_b32 v9, v7 :: v_dual_mov_b32 v8, v6 s_waitcnt vmcnt(1) s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2) v_and_b32_e32 v1, v1, v8 v_and_b32_e32 v7, v2, v9 s_waitcnt vmcnt(0) s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1) v_mad_u64_u32 v[5:6], null, v1, 24, v[10:11] v_mov_b32_e32 v1, v6 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_mad_u64_u32 v[2:3], null, v7, 24, v[1:2] v_mov_b32_e32 v6, v2 global_load_b64 v[6:7], v[5:6], off glc s_waitcnt vmcnt(0) global_atomic_cmpswap_b64 v[6:7], v0, v[6:9], s[2:3] offset:24 glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv v_cmp_eq_u64_e32 vcc_lo, v[6:7], v[8:9] s_or_b32 s5, vcc_lo, s5 s_delay_alu instid0(SALU_CYCLE_1) s_and_not1_b32 exec_lo, exec_lo, s5 s_cbranch_execnz .LBB0_3 s_or_b32 exec_lo, exec_lo, s5 .LBB0_5: s_delay_alu instid0(SALU_CYCLE_1) s_or_b32 exec_lo, exec_lo, s4 .LBB0_6: s_delay_alu instid0(SALU_CYCLE_1) s_or_b32 exec_lo, exec_lo, s1 v_mov_b32_e32 v5, 0 v_readfirstlane_b32 s4, v6 v_readfirstlane_b32 s5, v7 s_mov_b32 s8, exec_lo s_waitcnt lgkmcnt(0) s_clause 0x1 global_load_b64 v[8:9], v5, s[2:3] offset:40 global_load_b128 v[0:3], v5, s[2:3] s_waitcnt vmcnt(1) v_readfirstlane_b32 s6, v8 v_readfirstlane_b32 s7, v9 s_delay_alu instid0(VALU_DEP_1) s_and_b64 s[6:7], s[4:5], s[6:7] s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_8 v_dual_mov_b32 v6, s8 :: v_dual_mov_b32 v7, 0 s_mul_i32 s8, s7, 24 s_mul_hi_u32 s9, s6, 24 v_dual_mov_b32 v8, 2 :: v_dual_mov_b32 v9, 1 s_add_i32 s9, s9, s8 s_mul_i32 s8, s6, 24 s_waitcnt vmcnt(0) v_add_co_u32 v10, vcc_lo, v0, s8 v_add_co_ci_u32_e32 v11, vcc_lo, s9, v1, vcc_lo global_store_b128 v[10:11], v[6:9], off offset:8 .LBB0_8: s_or_b32 exec_lo, exec_lo, s1 s_lshl_b64 s[8:9], s[6:7], 12 v_lshlrev_b64 v[4:5], 6, v[4:5] s_waitcnt vmcnt(0) v_add_co_u32 v2, vcc_lo, v2, s8 v_add_co_ci_u32_e32 v7, vcc_lo, s9, v3, vcc_lo v_mov_b32_e32 v3, 0 s_mov_b32 s8, 0 s_delay_alu instid0(VALU_DEP_3) v_add_co_u32 v6, vcc_lo, v2, v4 v_mov_b32_e32 v2, 33 s_mov_b32 s9, s8 s_mov_b32 s10, s8 s_mov_b32 s11, s8 v_add_co_ci_u32_e32 v7, vcc_lo, v7, v5, vcc_lo v_mov_b32_e32 v4, v3 v_dual_mov_b32 v5, v3 :: v_dual_mov_b32 v8, s8 v_dual_mov_b32 v9, s9 :: v_dual_mov_b32 v10, s10 v_mov_b32_e32 v11, s11 s_clause 0x3 global_store_b128 v[6:7], v[2:5], off global_store_b128 v[6:7], v[8:11], off offset:16 global_store_b128 v[6:7], v[8:11], off offset:32 global_store_b128 v[6:7], v[8:11], off offset:48 s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_16 v_dual_mov_b32 v10, 0 :: v_dual_mov_b32 v11, s4 v_mov_b32_e32 v12, s5 s_clause 0x1 global_load_b64 v[13:14], v10, s[2:3] offset:32 glc global_load_b64 v[2:3], v10, s[2:3] offset:40 s_waitcnt vmcnt(0) v_readfirstlane_b32 s8, v2 v_readfirstlane_b32 s9, v3 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1) s_and_b64 s[8:9], s[8:9], s[4:5] s_mul_i32 s9, s9, 24 s_mul_hi_u32 s10, s8, 24 s_mul_i32 s8, s8, 24 s_add_i32 s10, s10, s9 v_add_co_u32 v8, vcc_lo, v0, s8 v_add_co_ci_u32_e32 v9, vcc_lo, s10, v1, vcc_lo s_mov_b32 s8, exec_lo global_store_b64 v[8:9], v[13:14], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[4:5], v10, v[11:14], s[2:3] offset:32 glc s_waitcnt vmcnt(0) v_cmpx_ne_u64_e64 v[4:5], v[13:14] s_cbranch_execz .LBB0_12 s_mov_b32 s9, 0 .LBB0_11: v_dual_mov_b32 v2, s4 :: v_dual_mov_b32 v3, s5 s_sleep 1 global_store_b64 v[8:9], v[4:5], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[2:3], v10, v[2:5], s[2:3] offset:32 glc s_waitcnt vmcnt(0) v_cmp_eq_u64_e32 vcc_lo, v[2:3], v[4:5] v_dual_mov_b32 v5, v3 :: v_dual_mov_b32 v4, v2 s_or_b32 s9, vcc_lo, s9 s_delay_alu instid0(SALU_CYCLE_1) s_and_not1_b32 exec_lo, exec_lo, s9 s_cbranch_execnz .LBB0_11 .LBB0_12: s_or_b32 exec_lo, exec_lo, s8 v_mov_b32_e32 v2, 0 s_mov_b32 s9, exec_lo s_mov_b32 s8, exec_lo v_mbcnt_lo_u32_b32 v4, s9, 0 global_load_b64 v[2:3], v2, s[2:3] offset:16 v_cmpx_eq_u32_e32 0, v4 s_cbranch_execz .LBB0_14 s_bcnt1_i32_b32 s9, s9 s_delay_alu instid0(SALU_CYCLE_1) v_dual_mov_b32 v5, 0 :: v_dual_mov_b32 v4, s9 s_waitcnt vmcnt(0) global_atomic_add_u64 v[2:3], v[4:5], off offset:8 .LBB0_14: s_or_b32 exec_lo, exec_lo, s8 s_waitcnt vmcnt(0) global_load_b64 v[4:5], v[2:3], off offset:16 s_waitcnt vmcnt(0) v_cmp_eq_u64_e32 vcc_lo, 0, v[4:5] s_cbranch_vccnz .LBB0_16 global_load_b32 v2, v[2:3], off offset:24 v_mov_b32_e32 v3, 0 s_waitcnt vmcnt(0) v_readfirstlane_b32 s8, v2 s_waitcnt_vscnt null, 0x0 global_store_b64 v[4:5], v[2:3], off s_and_b32 m0, s8, 0xff s_sendmsg sendmsg(MSG_INTERRUPT) .LBB0_16: s_or_b32 exec_lo, exec_lo, s1 s_mul_i32 s1, s7, 24 s_mul_hi_u32 s7, s6, 24 s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1) s_add_i32 s7, s7, s1 s_mul_i32 s1, s6, 24 v_add_co_u32 v0, vcc_lo, v0, s1 v_add_co_ci_u32_e32 v1, vcc_lo, s7, v1, vcc_lo s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_add_co_u32 v0, vcc_lo, v0, 20 v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo s_branch .LBB0_20 .p2align 6 .LBB0_17: s_or_b32 exec_lo, exec_lo, s1 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_readfirstlane_b32 s1, v2 s_cmp_eq_u32 s1, 0 s_cbranch_scc1 .LBB0_19 s_sleep 1 s_cbranch_execnz .LBB0_20 s_branch .LBB0_22 .p2align 6 .LBB0_19: s_branch .LBB0_22 .LBB0_20: v_mov_b32_e32 v2, 1 s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_17 global_load_b32 v2, v[0:1], off glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv v_and_b32_e32 v2, 1, v2 s_branch .LBB0_17 .LBB0_22: global_load_b64 v[22:23], v[6:7], off s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_26 v_mov_b32_e32 v6, 0 s_clause 0x2 global_load_b64 v[2:3], v6, s[2:3] offset:40 global_load_b64 v[7:8], v6, s[2:3] offset:24 glc global_load_b64 v[4:5], v6, s[2:3] s_waitcnt vmcnt(2) v_add_co_u32 v9, vcc_lo, v2, 1 v_add_co_ci_u32_e32 v10, vcc_lo, 0, v3, vcc_lo s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_add_co_u32 v0, vcc_lo, v9, s4 v_add_co_ci_u32_e32 v1, vcc_lo, s5, v10, vcc_lo s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_cmp_eq_u64_e32 vcc_lo, 0, v[0:1] v_dual_cndmask_b32 v1, v1, v10 :: v_dual_cndmask_b32 v0, v0, v9 v_and_b32_e32 v3, v1, v3 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_and_b32_e32 v2, v0, v2 v_mul_lo_u32 v3, v3, 24 s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2) v_mul_hi_u32 v9, v2, 24 v_mul_lo_u32 v2, v2, 24 v_add_nc_u32_e32 v3, v9, v3 s_waitcnt vmcnt(0) s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3) v_add_co_u32 v4, vcc_lo, v4, v2 v_mov_b32_e32 v2, v7 v_add_co_ci_u32_e32 v5, vcc_lo, v5, v3, vcc_lo v_mov_b32_e32 v3, v8 global_store_b64 v[4:5], v[7:8], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[2:3], v6, v[0:3], s[2:3] offset:24 glc s_waitcnt vmcnt(0) v_cmp_ne_u64_e32 vcc_lo, v[2:3], v[7:8] s_and_b32 exec_lo, exec_lo, vcc_lo s_cbranch_execz .LBB0_26 s_mov_b32 s0, 0 .LBB0_25: s_sleep 1 global_store_b64 v[4:5], v[2:3], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[7:8], v6, v[0:3], s[2:3] offset:24 glc s_waitcnt vmcnt(0) v_cmp_eq_u64_e32 vcc_lo, v[7:8], v[2:3] v_dual_mov_b32 v2, v7 :: v_dual_mov_b32 v3, v8 s_or_b32 s0, vcc_lo, s0 s_delay_alu instid0(SALU_CYCLE_1) s_and_not1_b32 exec_lo, exec_lo, s0 s_cbranch_execnz .LBB0_25 .LBB0_26: s_or_b32 exec_lo, exec_lo, s1 s_getpc_b64 s[4:5] s_add_u32 s4, s4, .str@rel32@lo+4 s_addc_u32 s5, s5, .str@rel32@hi+12 s_mov_b32 s0, -1 s_cmp_lg_u64 s[4:5], 0 s_cbranch_scc0 .LBB0_105 s_waitcnt vmcnt(0) v_dual_mov_b32 v1, v23 :: v_dual_and_b32 v0, -3, v22 v_mov_b32_e32 v25, 0 s_mov_b64 s[6:7], 14 s_branch .LBB0_29 .LBB0_28: s_or_b32 exec_lo, exec_lo, s1 s_sub_u32 s6, s6, s8 s_subb_u32 s7, s7, s9 s_add_u32 s4, s4, s8 s_addc_u32 s5, s5, s9 s_cmp_lg_u64 s[6:7], 0 s_cbranch_scc0 .LBB0_104 .LBB0_29: v_cmp_lt_u64_e64 s0, s[6:7], 56 s_delay_alu instid0(VALU_DEP_1) s_and_b32 s0, s0, exec_lo s_cselect_b32 s8, s6, 56 s_cselect_b32 s9, s7, 0 s_cmp_gt_u32 s8, 7 s_mov_b32 s0, -1 s_cbranch_scc1 .LBB0_34 v_mov_b32_e32 v2, 0 v_mov_b32_e32 v3, 0 s_cmp_eq_u32 s8, 0 s_cbranch_scc1 .LBB0_33 s_lshl_b64 s[0:1], s[8:9], 3 s_mov_b64 s[10:11], 0 s_mov_b64 s[12:13], s[4:5] .LBB0_32: global_load_u8 v4, v25, s[12:13] s_waitcnt vmcnt(0) v_and_b32_e32 v24, 0xffff, v4 s_delay_alu instid0(VALU_DEP_1) v_lshlrev_b64 v[4:5], s10, v[24:25] s_add_u32 s10, s10, 8 s_addc_u32 s11, s11, 0 s_add_u32 s12, s12, 1 s_addc_u32 s13, s13, 0 s_cmp_lg_u32 s0, s10 v_or_b32_e32 v2, v4, v2 v_or_b32_e32 v3, v5, v3 s_cbranch_scc1 .LBB0_32 .LBB0_33: s_mov_b32 s0, 0 s_mov_b32 s15, 0 .LBB0_34: s_and_not1_b32 vcc_lo, exec_lo, s0 s_mov_b64 s[0:1], s[4:5] s_cbranch_vccnz .LBB0_36 global_load_b64 v[2:3], v25, s[4:5] s_add_i32 s15, s8, -8 s_add_u32 s0, s4, 8 s_addc_u32 s1, s5, 0 .LBB0_36: s_cmp_gt_u32 s15, 7 s_cbranch_scc1 .LBB0_41 v_mov_b32_e32 v4, 0 v_mov_b32_e32 v5, 0 s_cmp_eq_u32 s15, 0 s_cbranch_scc1 .LBB0_40 s_mov_b64 s[10:11], 0 s_mov_b64 s[12:13], 0 .LBB0_39: s_delay_alu instid0(SALU_CYCLE_1) s_add_u32 s16, s0, s12 s_addc_u32 s17, s1, s13 s_add_u32 s12, s12, 1 global_load_u8 v6, v25, s[16:17] s_addc_u32 s13, s13, 0 s_waitcnt vmcnt(0) v_and_b32_e32 v24, 0xffff, v6 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1) v_lshlrev_b64 v[6:7], s10, v[24:25] s_add_u32 s10, s10, 8 s_addc_u32 s11, s11, 0 s_cmp_lg_u32 s15, s12 v_or_b32_e32 v4, v6, v4 s_delay_alu instid0(VALU_DEP_2) v_or_b32_e32 v5, v7, v5 s_cbranch_scc1 .LBB0_39 .LBB0_40: s_mov_b32 s14, 0 s_cbranch_execz .LBB0_42 s_branch .LBB0_43 .LBB0_41: .LBB0_42: global_load_b64 v[4:5], v25, s[0:1] s_add_i32 s14, s15, -8 s_add_u32 s0, s0, 8 s_addc_u32 s1, s1, 0 .LBB0_43: s_cmp_gt_u32 s14, 7 s_cbranch_scc1 .LBB0_48 v_mov_b32_e32 v6, 0 v_mov_b32_e32 v7, 0 s_cmp_eq_u32 s14, 0 s_cbranch_scc1 .LBB0_47 s_mov_b64 s[10:11], 0 s_mov_b64 s[12:13], 0 .LBB0_46: s_delay_alu instid0(SALU_CYCLE_1) s_add_u32 s16, s0, s12 s_addc_u32 s17, s1, s13 s_add_u32 s12, s12, 1 global_load_u8 v8, v25, s[16:17] s_addc_u32 s13, s13, 0 s_waitcnt vmcnt(0) v_and_b32_e32 v24, 0xffff, v8 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1) v_lshlrev_b64 v[8:9], s10, v[24:25] s_add_u32 s10, s10, 8 s_addc_u32 s11, s11, 0 s_cmp_lg_u32 s14, s12 v_or_b32_e32 v6, v8, v6 s_delay_alu instid0(VALU_DEP_2) v_or_b32_e32 v7, v9, v7 s_cbranch_scc1 .LBB0_46 .LBB0_47: s_mov_b32 s15, 0 s_cbranch_execz .LBB0_49 s_branch .LBB0_50 .LBB0_48: .LBB0_49: global_load_b64 v[6:7], v25, s[0:1] s_add_i32 s15, s14, -8 s_add_u32 s0, s0, 8 s_addc_u32 s1, s1, 0 .LBB0_50: s_cmp_gt_u32 s15, 7 s_cbranch_scc1 .LBB0_55 v_mov_b32_e32 v8, 0 v_mov_b32_e32 v9, 0 s_cmp_eq_u32 s15, 0 s_cbranch_scc1 .LBB0_54 s_mov_b64 s[10:11], 0 s_mov_b64 s[12:13], 0 .LBB0_53: s_delay_alu instid0(SALU_CYCLE_1) s_add_u32 s16, s0, s12 s_addc_u32 s17, s1, s13 s_add_u32 s12, s12, 1 global_load_u8 v10, v25, s[16:17] s_addc_u32 s13, s13, 0 s_waitcnt vmcnt(0) v_and_b32_e32 v24, 0xffff, v10 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1) v_lshlrev_b64 v[10:11], s10, v[24:25] s_add_u32 s10, s10, 8 s_addc_u32 s11, s11, 0 s_cmp_lg_u32 s15, s12 v_or_b32_e32 v8, v10, v8 s_delay_alu instid0(VALU_DEP_2) v_or_b32_e32 v9, v11, v9 s_cbranch_scc1 .LBB0_53 .LBB0_54: s_mov_b32 s14, 0 s_cbranch_execz .LBB0_56 s_branch .LBB0_57 .LBB0_55: .LBB0_56: global_load_b64 v[8:9], v25, s[0:1] s_add_i32 s14, s15, -8 s_add_u32 s0, s0, 8 s_addc_u32 s1, s1, 0 .LBB0_57: s_cmp_gt_u32 s14, 7 s_cbranch_scc1 .LBB0_62 v_mov_b32_e32 v10, 0 v_mov_b32_e32 v11, 0 s_cmp_eq_u32 s14, 0 s_cbranch_scc1 .LBB0_61 s_mov_b64 s[10:11], 0 s_mov_b64 s[12:13], 0 .LBB0_60: s_delay_alu instid0(SALU_CYCLE_1) s_add_u32 s16, s0, s12 s_addc_u32 s17, s1, s13 s_add_u32 s12, s12, 1 global_load_u8 v12, v25, s[16:17] s_addc_u32 s13, s13, 0 s_waitcnt vmcnt(0) v_and_b32_e32 v24, 0xffff, v12 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1) v_lshlrev_b64 v[12:13], s10, v[24:25] s_add_u32 s10, s10, 8 s_addc_u32 s11, s11, 0 s_cmp_lg_u32 s14, s12 v_or_b32_e32 v10, v12, v10 s_delay_alu instid0(VALU_DEP_2) v_or_b32_e32 v11, v13, v11 s_cbranch_scc1 .LBB0_60 .LBB0_61: s_mov_b32 s15, 0 s_cbranch_execz .LBB0_63 s_branch .LBB0_64 .LBB0_62: .LBB0_63: global_load_b64 v[10:11], v25, s[0:1] s_add_i32 s15, s14, -8 s_add_u32 s0, s0, 8 s_addc_u32 s1, s1, 0 .LBB0_64: s_cmp_gt_u32 s15, 7 s_cbranch_scc1 .LBB0_69 v_mov_b32_e32 v12, 0 v_mov_b32_e32 v13, 0 s_cmp_eq_u32 s15, 0 s_cbranch_scc1 .LBB0_68 s_mov_b64 s[10:11], 0 s_mov_b64 s[12:13], 0 .LBB0_67: s_delay_alu instid0(SALU_CYCLE_1) s_add_u32 s16, s0, s12 s_addc_u32 s17, s1, s13 s_add_u32 s12, s12, 1 global_load_u8 v14, v25, s[16:17] s_addc_u32 s13, s13, 0 s_waitcnt vmcnt(0) v_and_b32_e32 v24, 0xffff, v14 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1) v_lshlrev_b64 v[14:15], s10, v[24:25] s_add_u32 s10, s10, 8 s_addc_u32 s11, s11, 0 s_cmp_lg_u32 s15, s12 v_or_b32_e32 v12, v14, v12 s_delay_alu instid0(VALU_DEP_2) v_or_b32_e32 v13, v15, v13 s_cbranch_scc1 .LBB0_67 .LBB0_68: s_mov_b32 s14, 0 s_cbranch_execz .LBB0_70 s_branch .LBB0_71 .LBB0_69: .LBB0_70: global_load_b64 v[12:13], v25, s[0:1] s_add_i32 s14, s15, -8 s_add_u32 s0, s0, 8 s_addc_u32 s1, s1, 0 .LBB0_71: s_cmp_gt_u32 s14, 7 s_cbranch_scc1 .LBB0_76 v_mov_b32_e32 v14, 0 v_mov_b32_e32 v15, 0 s_cmp_eq_u32 s14, 0 s_cbranch_scc1 .LBB0_75 s_mov_b64 s[10:11], 0 s_mov_b64 s[12:13], s[0:1] .LBB0_74: global_load_u8 v16, v25, s[12:13] s_add_i32 s14, s14, -1 s_waitcnt vmcnt(0) v_and_b32_e32 v24, 0xffff, v16 s_delay_alu instid0(VALU_DEP_1) v_lshlrev_b64 v[16:17], s10, v[24:25] s_add_u32 s10, s10, 8 s_addc_u32 s11, s11, 0 s_add_u32 s12, s12, 1 s_addc_u32 s13, s13, 0 s_cmp_lg_u32 s14, 0 v_or_b32_e32 v14, v16, v14 v_or_b32_e32 v15, v17, v15 s_cbranch_scc1 .LBB0_74 .LBB0_75: s_cbranch_execz .LBB0_77 s_branch .LBB0_78 .LBB0_76: .LBB0_77: global_load_b64 v[14:15], v25, s[0:1] .LBB0_78: v_mov_b32_e32 v24, v20 v_mov_b32_e32 v26, 0 v_mov_b32_e32 v27, 0 s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1) v_readfirstlane_b32 s0, v24 v_cmp_eq_u32_e64 s0, s0, v24 s_delay_alu instid0(VALU_DEP_1) s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_84 global_load_b64 v[18:19], v25, s[2:3] offset:24 glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv s_clause 0x1 global_load_b64 v[16:17], v25, s[2:3] offset:40 global_load_b64 v[26:27], v25, s[2:3] s_mov_b32 s10, exec_lo s_waitcnt vmcnt(1) v_and_b32_e32 v17, v17, v19 v_and_b32_e32 v16, v16, v18 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_mul_lo_u32 v17, v17, 24 v_mul_hi_u32 v21, v16, 24 v_mul_lo_u32 v16, v16, 24 s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2) v_add_nc_u32_e32 v17, v21, v17 s_waitcnt vmcnt(0) v_add_co_u32 v16, vcc_lo, v26, v16 s_delay_alu instid0(VALU_DEP_2) v_add_co_ci_u32_e32 v17, vcc_lo, v27, v17, vcc_lo global_load_b64 v[16:17], v[16:17], off glc s_waitcnt vmcnt(0) global_atomic_cmpswap_b64 v[26:27], v25, v[16:19], s[2:3] offset:24 glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv v_cmpx_ne_u64_e64 v[26:27], v[18:19] s_cbranch_execz .LBB0_83 s_mov_b32 s11, 0 .p2align 6 .LBB0_81: s_sleep 1 s_clause 0x1 global_load_b64 v[16:17], v25, s[2:3] offset:40 global_load_b64 v[28:29], v25, s[2:3] v_dual_mov_b32 v18, v26 :: v_dual_mov_b32 v19, v27 s_waitcnt vmcnt(1) s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_and_b32_e32 v16, v16, v18 s_waitcnt vmcnt(0) v_mad_u64_u32 v[26:27], null, v16, 24, v[28:29] s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_dual_mov_b32 v16, v27 :: v_dual_and_b32 v17, v17, v19 v_mad_u64_u32 v[27:28], null, v17, 24, v[16:17] global_load_b64 v[16:17], v[26:27], off glc s_waitcnt vmcnt(0) global_atomic_cmpswap_b64 v[26:27], v25, v[16:19], s[2:3] offset:24 glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv v_cmp_eq_u64_e32 vcc_lo, v[26:27], v[18:19] s_or_b32 s11, vcc_lo, s11 s_delay_alu instid0(SALU_CYCLE_1) s_and_not1_b32 exec_lo, exec_lo, s11 s_cbranch_execnz .LBB0_81 s_or_b32 exec_lo, exec_lo, s11 .LBB0_83: s_delay_alu instid0(SALU_CYCLE_1) s_or_b32 exec_lo, exec_lo, s10 .LBB0_84: s_delay_alu instid0(SALU_CYCLE_1) s_or_b32 exec_lo, exec_lo, s1 s_clause 0x1 global_load_b64 v[28:29], v25, s[2:3] offset:40 global_load_b128 v[16:19], v25, s[2:3] v_readfirstlane_b32 s10, v26 v_readfirstlane_b32 s11, v27 s_mov_b32 s14, exec_lo s_waitcnt vmcnt(1) v_readfirstlane_b32 s12, v28 v_readfirstlane_b32 s13, v29 s_delay_alu instid0(VALU_DEP_1) s_and_b64 s[12:13], s[10:11], s[12:13] s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_86 v_dual_mov_b32 v26, s14 :: v_dual_mov_b32 v27, 0 s_mul_i32 s14, s13, 24 s_mul_hi_u32 s15, s12, 24 v_dual_mov_b32 v28, 2 :: v_dual_mov_b32 v29, 1 s_add_i32 s15, s15, s14 s_mul_i32 s14, s12, 24 s_waitcnt vmcnt(0) v_add_co_u32 v30, vcc_lo, v16, s14 v_add_co_ci_u32_e32 v31, vcc_lo, s15, v17, vcc_lo global_store_b128 v[30:31], v[26:29], off offset:8 .LBB0_86: s_or_b32 exec_lo, exec_lo, s1 v_cmp_gt_u64_e64 vcc_lo, s[6:7], 56 v_or_b32_e32 v21, 2, v0 s_lshl_b64 s[14:15], s[12:13], 12 v_lshlrev_b64 v[26:27], 6, v[24:25] s_lshl_b32 s1, s8, 2 s_delay_alu instid0(SALU_CYCLE_1) s_add_i32 s1, s1, 28 v_cndmask_b32_e32 v0, v21, v0, vcc_lo s_waitcnt vmcnt(0) v_add_co_u32 v18, vcc_lo, v18, s14 v_add_co_ci_u32_e32 v19, vcc_lo, s15, v19, vcc_lo s_and_b32 s1, s1, 0x1e0 s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3) v_add_co_u32 v18, vcc_lo, v18, v26 v_and_or_b32 v0, v0, 0xffffff1f, s1 v_add_co_ci_u32_e32 v19, vcc_lo, v19, v27, vcc_lo s_clause 0x3 global_store_b128 v[18:19], v[0:3], off global_store_b128 v[18:19], v[4:7], off offset:16 global_store_b128 v[18:19], v[8:11], off offset:32 global_store_b128 v[18:19], v[12:15], off offset:48 s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_94 s_clause 0x1 global_load_b64 v[8:9], v25, s[2:3] offset:32 glc global_load_b64 v[0:1], v25, s[2:3] offset:40 v_dual_mov_b32 v6, s10 :: v_dual_mov_b32 v7, s11 s_waitcnt vmcnt(0) v_readfirstlane_b32 s14, v0 v_readfirstlane_b32 s15, v1 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1) s_and_b64 s[14:15], s[14:15], s[10:11] s_mul_i32 s15, s15, 24 s_mul_hi_u32 s16, s14, 24 s_mul_i32 s14, s14, 24 s_add_i32 s16, s16, s15 v_add_co_u32 v4, vcc_lo, v16, s14 v_add_co_ci_u32_e32 v5, vcc_lo, s16, v17, vcc_lo s_mov_b32 s14, exec_lo global_store_b64 v[4:5], v[8:9], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[2:3], v25, v[6:9], s[2:3] offset:32 glc s_waitcnt vmcnt(0) v_cmpx_ne_u64_e64 v[2:3], v[8:9] s_cbranch_execz .LBB0_90 s_mov_b32 s15, 0 .LBB0_89: v_dual_mov_b32 v0, s10 :: v_dual_mov_b32 v1, s11 s_sleep 1 global_store_b64 v[4:5], v[2:3], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[0:1], v25, v[0:3], s[2:3] offset:32 glc s_waitcnt vmcnt(0) v_cmp_eq_u64_e32 vcc_lo, v[0:1], v[2:3] v_dual_mov_b32 v3, v1 :: v_dual_mov_b32 v2, v0 s_or_b32 s15, vcc_lo, s15 s_delay_alu instid0(SALU_CYCLE_1) s_and_not1_b32 exec_lo, exec_lo, s15 s_cbranch_execnz .LBB0_89 .LBB0_90: s_or_b32 exec_lo, exec_lo, s14 global_load_b64 v[0:1], v25, s[2:3] offset:16 s_mov_b32 s15, exec_lo s_mov_b32 s14, exec_lo v_mbcnt_lo_u32_b32 v2, s15, 0 s_delay_alu instid0(VALU_DEP_1) v_cmpx_eq_u32_e32 0, v2 s_cbranch_execz .LBB0_92 s_bcnt1_i32_b32 s15, s15 s_delay_alu instid0(SALU_CYCLE_1) v_dual_mov_b32 v3, 0 :: v_dual_mov_b32 v2, s15 s_waitcnt vmcnt(0) global_atomic_add_u64 v[0:1], v[2:3], off offset:8 .LBB0_92: s_or_b32 exec_lo, exec_lo, s14 s_waitcnt vmcnt(0) global_load_b64 v[2:3], v[0:1], off offset:16 s_waitcnt vmcnt(0) v_cmp_eq_u64_e32 vcc_lo, 0, v[2:3] s_cbranch_vccnz .LBB0_94 global_load_b32 v24, v[0:1], off offset:24 s_waitcnt vmcnt(0) v_readfirstlane_b32 s14, v24 s_waitcnt_vscnt null, 0x0 global_store_b64 v[2:3], v[24:25], off s_and_b32 m0, s14, 0xff s_sendmsg sendmsg(MSG_INTERRUPT) .LBB0_94: s_or_b32 exec_lo, exec_lo, s1 s_mul_i32 s1, s13, 24 s_mul_hi_u32 s13, s12, 24 s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1) s_add_i32 s13, s13, s1 s_mul_i32 s1, s12, 24 v_add_co_u32 v0, vcc_lo, v16, s1 v_add_co_ci_u32_e32 v1, vcc_lo, s13, v17, vcc_lo s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_add_co_u32 v0, vcc_lo, v0, 20 v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo s_branch .LBB0_98 .p2align 6 .LBB0_95: s_or_b32 exec_lo, exec_lo, s1 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_readfirstlane_b32 s1, v2 s_cmp_eq_u32 s1, 0 s_cbranch_scc1 .LBB0_97 s_sleep 1 s_cbranch_execnz .LBB0_98 s_branch .LBB0_100 .p2align 6 .LBB0_97: s_branch .LBB0_100 .LBB0_98: v_mov_b32_e32 v2, 1 s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_95 global_load_b32 v2, v[0:1], off glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv v_and_b32_e32 v2, 1, v2 s_branch .LBB0_95 .LBB0_100: global_load_b64 v[0:1], v[18:19], off s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_28 s_clause 0x2 global_load_b64 v[4:5], v25, s[2:3] offset:40 global_load_b64 v[8:9], v25, s[2:3] offset:24 glc global_load_b64 v[6:7], v25, s[2:3] s_waitcnt vmcnt(2) v_add_co_u32 v10, vcc_lo, v4, 1 v_add_co_ci_u32_e32 v11, vcc_lo, 0, v5, vcc_lo s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_add_co_u32 v2, vcc_lo, v10, s10 v_add_co_ci_u32_e32 v3, vcc_lo, s11, v11, vcc_lo s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_cmp_eq_u64_e32 vcc_lo, 0, v[2:3] v_dual_cndmask_b32 v3, v3, v11 :: v_dual_cndmask_b32 v2, v2, v10 v_and_b32_e32 v5, v3, v5 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1) v_and_b32_e32 v4, v2, v4 v_mul_hi_u32 v10, v4, 24 v_mul_lo_u32 v4, v4, 24 s_waitcnt vmcnt(0) s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1) v_add_co_u32 v6, vcc_lo, v6, v4 v_mov_b32_e32 v4, v8 v_mul_lo_u32 v5, v5, 24 v_add_nc_u32_e32 v5, v10, v5 s_delay_alu instid0(VALU_DEP_1) v_add_co_ci_u32_e32 v7, vcc_lo, v7, v5, vcc_lo v_mov_b32_e32 v5, v9 global_store_b64 v[6:7], v[8:9], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[4:5], v25, v[2:5], s[2:3] offset:24 glc s_waitcnt vmcnt(0) v_cmp_ne_u64_e32 vcc_lo, v[4:5], v[8:9] s_and_b32 exec_lo, exec_lo, vcc_lo s_cbranch_execz .LBB0_28 s_mov_b32 s0, 0 .LBB0_103: s_sleep 1 global_store_b64 v[6:7], v[4:5], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[8:9], v25, v[2:5], s[2:3] offset:24 glc s_waitcnt vmcnt(0) v_cmp_eq_u64_e32 vcc_lo, v[8:9], v[4:5] v_dual_mov_b32 v4, v8 :: v_dual_mov_b32 v5, v9 s_or_b32 s0, vcc_lo, s0 s_delay_alu instid0(SALU_CYCLE_1) s_and_not1_b32 exec_lo, exec_lo, s0 s_cbranch_execnz .LBB0_103 s_branch .LBB0_28 .LBB0_104: s_mov_b32 s0, 0 .LBB0_105: s_delay_alu instid0(SALU_CYCLE_1) s_and_b32 vcc_lo, exec_lo, s0 s_cbranch_vccz .LBB0_132 v_readfirstlane_b32 s0, v20 v_mov_b32_e32 v4, 0 v_mov_b32_e32 v5, 0 s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1) v_cmp_eq_u32_e64 s0, s0, v20 s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_112 s_waitcnt vmcnt(0) v_mov_b32_e32 v0, 0 s_mov_b32 s4, exec_lo global_load_b64 v[6:7], v0, s[2:3] offset:24 glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv s_clause 0x1 global_load_b64 v[1:2], v0, s[2:3] offset:40 global_load_b64 v[3:4], v0, s[2:3] s_waitcnt vmcnt(1) v_and_b32_e32 v1, v1, v6 v_and_b32_e32 v2, v2, v7 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_mul_hi_u32 v5, v1, 24 v_mul_lo_u32 v2, v2, 24 v_mul_lo_u32 v1, v1, 24 s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2) v_add_nc_u32_e32 v2, v5, v2 s_waitcnt vmcnt(0) v_add_co_u32 v1, vcc_lo, v3, v1 s_delay_alu instid0(VALU_DEP_2) v_add_co_ci_u32_e32 v2, vcc_lo, v4, v2, vcc_lo global_load_b64 v[4:5], v[1:2], off glc s_waitcnt vmcnt(0) global_atomic_cmpswap_b64 v[4:5], v0, v[4:7], s[2:3] offset:24 glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv v_cmpx_ne_u64_e64 v[4:5], v[6:7] s_cbranch_execz .LBB0_111 s_mov_b32 s5, 0 .p2align 6 .LBB0_109: s_sleep 1 s_clause 0x1 global_load_b64 v[1:2], v0, s[2:3] offset:40 global_load_b64 v[8:9], v0, s[2:3] v_dual_mov_b32 v7, v5 :: v_dual_mov_b32 v6, v4 s_waitcnt vmcnt(1) s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_and_b32_e32 v1, v1, v6 s_waitcnt vmcnt(0) v_mad_u64_u32 v[3:4], null, v1, 24, v[8:9] s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_dual_mov_b32 v1, v4 :: v_dual_and_b32 v2, v2, v7 v_mad_u64_u32 v[4:5], null, v2, 24, v[1:2] global_load_b64 v[4:5], v[3:4], off glc s_waitcnt vmcnt(0) global_atomic_cmpswap_b64 v[4:5], v0, v[4:7], s[2:3] offset:24 glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv v_cmp_eq_u64_e32 vcc_lo, v[4:5], v[6:7] s_or_b32 s5, vcc_lo, s5 s_delay_alu instid0(SALU_CYCLE_1) s_and_not1_b32 exec_lo, exec_lo, s5 s_cbranch_execnz .LBB0_109 s_or_b32 exec_lo, exec_lo, s5 .LBB0_111: s_delay_alu instid0(SALU_CYCLE_1) s_or_b32 exec_lo, exec_lo, s4 .LBB0_112: s_delay_alu instid0(SALU_CYCLE_1) s_or_b32 exec_lo, exec_lo, s1 v_mov_b32_e32 v21, 0 v_readfirstlane_b32 s4, v4 v_readfirstlane_b32 s5, v5 s_mov_b32 s8, exec_lo s_clause 0x1 global_load_b64 v[6:7], v21, s[2:3] offset:40 global_load_b128 v[0:3], v21, s[2:3] s_waitcnt vmcnt(1) v_readfirstlane_b32 s6, v6 v_readfirstlane_b32 s7, v7 s_delay_alu instid0(VALU_DEP_1) s_and_b64 s[6:7], s[4:5], s[6:7] s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_114 v_dual_mov_b32 v4, s8 :: v_dual_mov_b32 v5, 0 s_mul_i32 s8, s7, 24 s_mul_hi_u32 s9, s6, 24 v_dual_mov_b32 v6, 2 :: v_dual_mov_b32 v7, 1 s_add_i32 s9, s9, s8 s_mul_i32 s8, s6, 24 s_waitcnt vmcnt(0) v_add_co_u32 v8, vcc_lo, v0, s8 v_add_co_ci_u32_e32 v9, vcc_lo, s9, v1, vcc_lo global_store_b128 v[8:9], v[4:7], off offset:8 .LBB0_114: s_or_b32 exec_lo, exec_lo, s1 s_lshl_b64 s[8:9], s[6:7], 12 v_and_or_b32 v22, v22, 0xffffff1d, 34 s_waitcnt vmcnt(0) v_add_co_u32 v4, vcc_lo, v2, s8 v_add_co_ci_u32_e32 v5, vcc_lo, s9, v3, vcc_lo v_lshlrev_b64 v[2:3], 6, v[20:21] s_mov_b32 s8, 0 s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(VALU_DEP_1) s_mov_b32 s9, s8 s_mov_b32 s10, s8 s_mov_b32 s11, s8 v_add_co_u32 v8, vcc_lo, v4, v2 v_mov_b32_e32 v6, 0 v_add_co_ci_u32_e32 v9, vcc_lo, v5, v3, vcc_lo v_dual_mov_b32 v2, s8 :: v_dual_mov_b32 v5, s11 v_dual_mov_b32 v3, s9 :: v_dual_mov_b32 v4, s10 s_delay_alu instid0(VALU_DEP_4) v_mov_b32_e32 v7, v6 s_clause 0x4 global_store_b64 v[8:9], v[22:23], off global_store_b128 v[8:9], v[2:5], off offset:8 global_store_b128 v[8:9], v[2:5], off offset:24 global_store_b128 v[8:9], v[2:5], off offset:40 global_store_b64 v[8:9], v[6:7], off offset:56 s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_122 v_dual_mov_b32 v8, 0 :: v_dual_mov_b32 v9, s4 v_mov_b32_e32 v10, s5 s_clause 0x1 global_load_b64 v[11:12], v8, s[2:3] offset:32 glc global_load_b64 v[2:3], v8, s[2:3] offset:40 s_waitcnt vmcnt(0) v_readfirstlane_b32 s8, v2 v_readfirstlane_b32 s9, v3 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1) s_and_b64 s[8:9], s[8:9], s[4:5] s_mul_i32 s9, s9, 24 s_mul_hi_u32 s10, s8, 24 s_mul_i32 s8, s8, 24 s_add_i32 s10, s10, s9 v_add_co_u32 v6, vcc_lo, v0, s8 v_add_co_ci_u32_e32 v7, vcc_lo, s10, v1, vcc_lo s_mov_b32 s8, exec_lo global_store_b64 v[6:7], v[11:12], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[4:5], v8, v[9:12], s[2:3] offset:32 glc s_waitcnt vmcnt(0) v_cmpx_ne_u64_e64 v[4:5], v[11:12] s_cbranch_execz .LBB0_118 s_mov_b32 s9, 0 .LBB0_117: v_dual_mov_b32 v2, s4 :: v_dual_mov_b32 v3, s5 s_sleep 1 global_store_b64 v[6:7], v[4:5], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[2:3], v8, v[2:5], s[2:3] offset:32 glc s_waitcnt vmcnt(0) v_cmp_eq_u64_e32 vcc_lo, v[2:3], v[4:5] v_dual_mov_b32 v5, v3 :: v_dual_mov_b32 v4, v2 s_or_b32 s9, vcc_lo, s9 s_delay_alu instid0(SALU_CYCLE_1) s_and_not1_b32 exec_lo, exec_lo, s9 s_cbranch_execnz .LBB0_117 .LBB0_118: s_or_b32 exec_lo, exec_lo, s8 v_mov_b32_e32 v2, 0 s_mov_b32 s9, exec_lo s_mov_b32 s8, exec_lo v_mbcnt_lo_u32_b32 v4, s9, 0 global_load_b64 v[2:3], v2, s[2:3] offset:16 v_cmpx_eq_u32_e32 0, v4 s_cbranch_execz .LBB0_120 s_bcnt1_i32_b32 s9, s9 s_delay_alu instid0(SALU_CYCLE_1) v_dual_mov_b32 v5, 0 :: v_dual_mov_b32 v4, s9 s_waitcnt vmcnt(0) global_atomic_add_u64 v[2:3], v[4:5], off offset:8 .LBB0_120: s_or_b32 exec_lo, exec_lo, s8 s_waitcnt vmcnt(0) global_load_b64 v[4:5], v[2:3], off offset:16 s_waitcnt vmcnt(0) v_cmp_eq_u64_e32 vcc_lo, 0, v[4:5] s_cbranch_vccnz .LBB0_122 global_load_b32 v2, v[2:3], off offset:24 v_mov_b32_e32 v3, 0 s_waitcnt vmcnt(0) v_readfirstlane_b32 s8, v2 s_waitcnt_vscnt null, 0x0 global_store_b64 v[4:5], v[2:3], off s_and_b32 m0, s8, 0xff s_sendmsg sendmsg(MSG_INTERRUPT) .LBB0_122: s_or_b32 exec_lo, exec_lo, s1 s_mul_i32 s1, s7, 24 s_mul_hi_u32 s7, s6, 24 s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1) s_add_i32 s7, s7, s1 s_mul_i32 s1, s6, 24 v_add_co_u32 v0, vcc_lo, v0, s1 v_add_co_ci_u32_e32 v1, vcc_lo, s7, v1, vcc_lo s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_add_co_u32 v0, vcc_lo, v0, 20 v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo s_branch .LBB0_126 .p2align 6 .LBB0_123: s_or_b32 exec_lo, exec_lo, s1 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_readfirstlane_b32 s1, v2 s_cmp_eq_u32 s1, 0 s_cbranch_scc1 .LBB0_125 s_sleep 1 s_cbranch_execnz .LBB0_126 s_branch .LBB0_128 .p2align 6 .LBB0_125: s_branch .LBB0_128 .LBB0_126: v_mov_b32_e32 v2, 1 s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_123 global_load_b32 v2, v[0:1], off glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv v_and_b32_e32 v2, 1, v2 s_branch .LBB0_123 .LBB0_128: s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_132 v_mov_b32_e32 v6, 0 s_clause 0x2 global_load_b64 v[2:3], v6, s[2:3] offset:40 global_load_b64 v[7:8], v6, s[2:3] offset:24 glc global_load_b64 v[4:5], v6, s[2:3] s_waitcnt vmcnt(2) v_add_co_u32 v9, vcc_lo, v2, 1 v_add_co_ci_u32_e32 v10, vcc_lo, 0, v3, vcc_lo s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_add_co_u32 v0, vcc_lo, v9, s4 v_add_co_ci_u32_e32 v1, vcc_lo, s5, v10, vcc_lo s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_cmp_eq_u64_e32 vcc_lo, 0, v[0:1] v_dual_cndmask_b32 v1, v1, v10 :: v_dual_cndmask_b32 v0, v0, v9 v_and_b32_e32 v3, v1, v3 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_and_b32_e32 v2, v0, v2 v_mul_lo_u32 v3, v3, 24 s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2) v_mul_hi_u32 v9, v2, 24 v_mul_lo_u32 v2, v2, 24 v_add_nc_u32_e32 v3, v9, v3 s_waitcnt vmcnt(0) s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3) v_add_co_u32 v4, vcc_lo, v4, v2 v_mov_b32_e32 v2, v7 v_add_co_ci_u32_e32 v5, vcc_lo, v5, v3, vcc_lo v_mov_b32_e32 v3, v8 global_store_b64 v[4:5], v[7:8], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[2:3], v6, v[0:3], s[2:3] offset:24 glc s_waitcnt vmcnt(0) v_cmp_ne_u64_e32 vcc_lo, v[2:3], v[7:8] s_and_b32 exec_lo, exec_lo, vcc_lo s_cbranch_execz .LBB0_132 s_mov_b32 s0, 0 .LBB0_131: s_sleep 1 global_store_b64 v[4:5], v[2:3], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[7:8], v6, v[0:3], s[2:3] offset:24 glc s_waitcnt vmcnt(0) v_cmp_eq_u64_e32 vcc_lo, v[7:8], v[2:3] v_dual_mov_b32 v2, v7 :: v_dual_mov_b32 v3, v8 s_or_b32 s0, vcc_lo, s0 s_delay_alu instid0(SALU_CYCLE_1) s_and_not1_b32 exec_lo, exec_lo, s0 s_cbranch_execnz .LBB0_131 .LBB0_132: s_nop 0 s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z11hellokernelv .amdhsa_group_segment_fixed_size 0 .amdhsa_private_segment_fixed_size 0 .amdhsa_kernarg_size 256 .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 32 .amdhsa_next_free_sgpr 18 .amdhsa_float_round_mode_32 0 .amdhsa_float_round_mode_16_64 0 .amdhsa_float_denorm_mode_32 3 .amdhsa_float_denorm_mode_16_64 3 .amdhsa_dx10_clamp 1 .amdhsa_ieee_mode 1 .amdhsa_fp16_overflow 0 .amdhsa_workgroup_processor_mode 1 .amdhsa_memory_ordered 1 .amdhsa_forward_progress 0 .amdhsa_shared_vgpr_count 0 .amdhsa_exception_fp_ieee_invalid_op 0 .amdhsa_exception_fp_denorm_src 0 .amdhsa_exception_fp_ieee_div_zero 0 .amdhsa_exception_fp_ieee_overflow 0 .amdhsa_exception_fp_ieee_underflow 0 .amdhsa_exception_fp_ieee_inexact 0 .amdhsa_exception_int_div_zero 0 .end_amdhsa_kernel .text .Lfunc_end0: .size _Z11hellokernelv, .Lfunc_end0-_Z11hellokernelv .section .AMDGPU.csdata,"",@progbits .text .p2alignl 7, 3214868480 .fill 96, 4, 3214868480 .type .str,@object .section .rodata.str1.1,"aMS",@progbits,1 .str: .asciz "Hello World!\n" .size .str, 14 .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: hidden_block_count_x - .offset: 4 .size: 4 .value_kind: hidden_block_count_y - .offset: 8 .size: 4 .value_kind: hidden_block_count_z - .offset: 12 .size: 2 .value_kind: hidden_group_size_x - .offset: 14 .size: 2 .value_kind: hidden_group_size_y - .offset: 16 .size: 2 .value_kind: hidden_group_size_z - .offset: 18 .size: 2 .value_kind: hidden_remainder_x - .offset: 20 .size: 2 .value_kind: hidden_remainder_y - .offset: 22 .size: 2 .value_kind: hidden_remainder_z - .offset: 40 .size: 8 .value_kind: hidden_global_offset_x - .offset: 48 .size: 8 .value_kind: hidden_global_offset_y - .offset: 56 .size: 8 .value_kind: hidden_global_offset_z - .offset: 64 .size: 2 .value_kind: hidden_grid_dims - .offset: 80 .size: 8 .value_kind: hidden_hostcall_buffer .group_segment_fixed_size: 0 .kernarg_segment_align: 8 .kernarg_segment_size: 256 .language: OpenCL C .language_version: - 2 - 0 .max_flat_workgroup_size: 1024 .name: _Z11hellokernelv .private_segment_fixed_size: 0 .sgpr_count: 20 .sgpr_spill_count: 0 .symbol: _Z11hellokernelv.kd .uniform_work_group_size: 1 .uses_dynamic_stack: false .vgpr_count: 32 .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> __global__ void hellokernel() { printf("Hello World!\n"); } int main(void) { int num_threads = 10; int num_blocks = 10; hellokernel<<<num_blocks,num_threads>>>(); hipDeviceSynchronize(); return 0; }
.text .file "hello-1.hip" .globl _Z26__device_stub__hellokernelv # -- Begin function _Z26__device_stub__hellokernelv .p2align 4, 0x90 .type _Z26__device_stub__hellokernelv,@function _Z26__device_stub__hellokernelv: # @_Z26__device_stub__hellokernelv .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 $_Z11hellokernelv, %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 _Z26__device_stub__hellokernelv, .Lfunc_end0-_Z26__device_stub__hellokernelv .cfi_endproc # -- End function .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: subq $56, %rsp .cfi_def_cfa_offset 64 movabsq $4294967306, %rdi # imm = 0x10000000A movl $1, %esi movq %rdi, %rdx movl $1, %ecx xorl %r8d, %r8d xorl %r9d, %r9d callq __hipPushCallConfiguration testl %eax, %eax jne .LBB1_2 # %bb.1: leaq 32(%rsp), %rdi leaq 16(%rsp), %rsi leaq 8(%rsp), %rdx movq %rsp, %rcx callq __hipPopCallConfiguration movq 32(%rsp), %rsi movl 40(%rsp), %edx movq 16(%rsp), %rcx movl 24(%rsp), %r8d leaq 48(%rsp), %r9 movl $_Z11hellokernelv, %edi pushq (%rsp) .cfi_adjust_cfa_offset 8 pushq 16(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $16, %rsp .cfi_adjust_cfa_offset -16 .LBB1_2: callq hipDeviceSynchronize xorl %eax, %eax addq $56, %rsp .cfi_def_cfa_offset 8 retq .Lfunc_end1: .size main, .Lfunc_end1-main .cfi_endproc # -- End function .p2align 4, 0x90 # -- Begin function __hip_module_ctor .type __hip_module_ctor,@function __hip_module_ctor: # @__hip_module_ctor .cfi_startproc # %bb.0: subq $40, %rsp .cfi_def_cfa_offset 48 cmpq $0, __hip_gpubin_handle(%rip) jne .LBB2_2 # %bb.1: movl $__hip_fatbin_wrapper, %edi callq __hipRegisterFatBinary movq %rax, __hip_gpubin_handle(%rip) .LBB2_2: movq __hip_gpubin_handle(%rip), %rdi xorps %xmm0, %xmm0 movups %xmm0, 16(%rsp) movups %xmm0, (%rsp) movl $_Z11hellokernelv, %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 _Z11hellokernelv,@object # @_Z11hellokernelv .section .rodata,"a",@progbits .globl _Z11hellokernelv .p2align 3, 0x0 _Z11hellokernelv: .quad _Z26__device_stub__hellokernelv .size _Z11hellokernelv, 8 .type .L__unnamed_1,@object # @0 .section .rodata.str1.1,"aMS",@progbits,1 .L__unnamed_1: .asciz "_Z11hellokernelv" .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 _Z26__device_stub__hellokernelv .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z11hellokernelv .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 : _Z11hellokernelv .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*/ MOV R0, 0x0 ; /* 0x0000000000007802 */ /* 0x000fe20000000f00 */ /*0020*/ IMAD.MOV.U32 R4, RZ, RZ, c[0x4][0x8] ; /* 0x01000200ff047624 */ /* 0x000fe200078e00ff */ /*0030*/ CS2R R6, SRZ ; /* 0x0000000000067805 */ /* 0x000fe2000001ff00 */ /*0040*/ IMAD.MOV.U32 R5, RZ, RZ, c[0x4][0xc] ; /* 0x01000300ff057624 */ /* 0x000fe200078e00ff */ /*0050*/ LDC.64 R2, c[0x4][R0] ; /* 0x0100000000027b82 */ /* 0x00006c0000000a00 */ /*0060*/ LEPC R8 ; /* 0x000000000008734e */ /* 0x000fe40000000000 */ /*0070*/ MOV R11, 0xe0 ; /* 0x000000e0000b7802 */ /* 0x000fe40000000f00 */ /*0080*/ MOV R20, 0x60 ; /* 0x0000006000147802 */ /* 0x000fe40000000f00 */ /*0090*/ MOV R21, 0x0 ; /* 0x0000000000157802 */ /* 0x000fe40000000f00 */ /*00a0*/ MOV R0, 0x0 ; /* 0x0000000000007802 */ /* 0x001fc40000000f00 */ /*00b0*/ IADD3 R20, P0, P1, -R20, R11, R8 ; /* 0x0000000b14147210 */ /* 0x000fc8000791e108 */ /*00c0*/ IADD3.X R21, ~R0, R21, R9, P0, P1 ; /* 0x0000001500157210 */ /* 0x000fc800007e2509 */ /*00d0*/ CALL.ABS.NOINC R2 ; /* 0x0000000002007343 */ /* 0x002fea0003c00000 */ /*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 _Z11hellokernelv .globl _Z11hellokernelv .p2align 8 .type _Z11hellokernelv,@function _Z11hellokernelv: s_load_b64 s[2:3], s[0:1], 0x50 v_mbcnt_lo_u32_b32 v20, -1, 0 v_mov_b32_e32 v6, 0 s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_dual_mov_b32 v7, 0 :: v_dual_mov_b32 v4, v20 v_readfirstlane_b32 s0, v4 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_cmp_eq_u32_e64 s0, s0, v4 s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_6 v_mov_b32_e32 v0, 0 s_mov_b32 s4, exec_lo s_waitcnt lgkmcnt(0) global_load_b64 v[8:9], v0, s[2:3] offset:24 glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv s_clause 0x1 global_load_b64 v[1:2], v0, s[2:3] offset:40 global_load_b64 v[5:6], v0, s[2:3] s_waitcnt vmcnt(1) v_and_b32_e32 v1, v1, v8 v_and_b32_e32 v2, v2, v9 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_mul_hi_u32 v3, v1, 24 v_mul_lo_u32 v2, v2, 24 v_mul_lo_u32 v1, v1, 24 s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2) v_add_nc_u32_e32 v2, v3, v2 s_waitcnt vmcnt(0) v_add_co_u32 v1, vcc_lo, v5, v1 s_delay_alu instid0(VALU_DEP_2) v_add_co_ci_u32_e32 v2, vcc_lo, v6, v2, vcc_lo global_load_b64 v[6:7], v[1:2], off glc s_waitcnt vmcnt(0) global_atomic_cmpswap_b64 v[6:7], v0, v[6:9], s[2:3] offset:24 glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv v_cmpx_ne_u64_e64 v[6:7], v[8:9] s_cbranch_execz .LBB0_5 s_mov_b32 s5, 0 .p2align 6 .LBB0_3: s_sleep 1 s_clause 0x1 global_load_b64 v[1:2], v0, s[2:3] offset:40 global_load_b64 v[10:11], v0, s[2:3] v_dual_mov_b32 v9, v7 :: v_dual_mov_b32 v8, v6 s_waitcnt vmcnt(1) s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2) v_and_b32_e32 v1, v1, v8 v_and_b32_e32 v7, v2, v9 s_waitcnt vmcnt(0) s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1) v_mad_u64_u32 v[5:6], null, v1, 24, v[10:11] v_mov_b32_e32 v1, v6 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_mad_u64_u32 v[2:3], null, v7, 24, v[1:2] v_mov_b32_e32 v6, v2 global_load_b64 v[6:7], v[5:6], off glc s_waitcnt vmcnt(0) global_atomic_cmpswap_b64 v[6:7], v0, v[6:9], s[2:3] offset:24 glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv v_cmp_eq_u64_e32 vcc_lo, v[6:7], v[8:9] s_or_b32 s5, vcc_lo, s5 s_delay_alu instid0(SALU_CYCLE_1) s_and_not1_b32 exec_lo, exec_lo, s5 s_cbranch_execnz .LBB0_3 s_or_b32 exec_lo, exec_lo, s5 .LBB0_5: s_delay_alu instid0(SALU_CYCLE_1) s_or_b32 exec_lo, exec_lo, s4 .LBB0_6: s_delay_alu instid0(SALU_CYCLE_1) s_or_b32 exec_lo, exec_lo, s1 v_mov_b32_e32 v5, 0 v_readfirstlane_b32 s4, v6 v_readfirstlane_b32 s5, v7 s_mov_b32 s8, exec_lo s_waitcnt lgkmcnt(0) s_clause 0x1 global_load_b64 v[8:9], v5, s[2:3] offset:40 global_load_b128 v[0:3], v5, s[2:3] s_waitcnt vmcnt(1) v_readfirstlane_b32 s6, v8 v_readfirstlane_b32 s7, v9 s_delay_alu instid0(VALU_DEP_1) s_and_b64 s[6:7], s[4:5], s[6:7] s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_8 v_dual_mov_b32 v6, s8 :: v_dual_mov_b32 v7, 0 s_mul_i32 s8, s7, 24 s_mul_hi_u32 s9, s6, 24 v_dual_mov_b32 v8, 2 :: v_dual_mov_b32 v9, 1 s_add_i32 s9, s9, s8 s_mul_i32 s8, s6, 24 s_waitcnt vmcnt(0) v_add_co_u32 v10, vcc_lo, v0, s8 v_add_co_ci_u32_e32 v11, vcc_lo, s9, v1, vcc_lo global_store_b128 v[10:11], v[6:9], off offset:8 .LBB0_8: s_or_b32 exec_lo, exec_lo, s1 s_lshl_b64 s[8:9], s[6:7], 12 v_lshlrev_b64 v[4:5], 6, v[4:5] s_waitcnt vmcnt(0) v_add_co_u32 v2, vcc_lo, v2, s8 v_add_co_ci_u32_e32 v7, vcc_lo, s9, v3, vcc_lo v_mov_b32_e32 v3, 0 s_mov_b32 s8, 0 s_delay_alu instid0(VALU_DEP_3) v_add_co_u32 v6, vcc_lo, v2, v4 v_mov_b32_e32 v2, 33 s_mov_b32 s9, s8 s_mov_b32 s10, s8 s_mov_b32 s11, s8 v_add_co_ci_u32_e32 v7, vcc_lo, v7, v5, vcc_lo v_mov_b32_e32 v4, v3 v_dual_mov_b32 v5, v3 :: v_dual_mov_b32 v8, s8 v_dual_mov_b32 v9, s9 :: v_dual_mov_b32 v10, s10 v_mov_b32_e32 v11, s11 s_clause 0x3 global_store_b128 v[6:7], v[2:5], off global_store_b128 v[6:7], v[8:11], off offset:16 global_store_b128 v[6:7], v[8:11], off offset:32 global_store_b128 v[6:7], v[8:11], off offset:48 s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_16 v_dual_mov_b32 v10, 0 :: v_dual_mov_b32 v11, s4 v_mov_b32_e32 v12, s5 s_clause 0x1 global_load_b64 v[13:14], v10, s[2:3] offset:32 glc global_load_b64 v[2:3], v10, s[2:3] offset:40 s_waitcnt vmcnt(0) v_readfirstlane_b32 s8, v2 v_readfirstlane_b32 s9, v3 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1) s_and_b64 s[8:9], s[8:9], s[4:5] s_mul_i32 s9, s9, 24 s_mul_hi_u32 s10, s8, 24 s_mul_i32 s8, s8, 24 s_add_i32 s10, s10, s9 v_add_co_u32 v8, vcc_lo, v0, s8 v_add_co_ci_u32_e32 v9, vcc_lo, s10, v1, vcc_lo s_mov_b32 s8, exec_lo global_store_b64 v[8:9], v[13:14], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[4:5], v10, v[11:14], s[2:3] offset:32 glc s_waitcnt vmcnt(0) v_cmpx_ne_u64_e64 v[4:5], v[13:14] s_cbranch_execz .LBB0_12 s_mov_b32 s9, 0 .LBB0_11: v_dual_mov_b32 v2, s4 :: v_dual_mov_b32 v3, s5 s_sleep 1 global_store_b64 v[8:9], v[4:5], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[2:3], v10, v[2:5], s[2:3] offset:32 glc s_waitcnt vmcnt(0) v_cmp_eq_u64_e32 vcc_lo, v[2:3], v[4:5] v_dual_mov_b32 v5, v3 :: v_dual_mov_b32 v4, v2 s_or_b32 s9, vcc_lo, s9 s_delay_alu instid0(SALU_CYCLE_1) s_and_not1_b32 exec_lo, exec_lo, s9 s_cbranch_execnz .LBB0_11 .LBB0_12: s_or_b32 exec_lo, exec_lo, s8 v_mov_b32_e32 v2, 0 s_mov_b32 s9, exec_lo s_mov_b32 s8, exec_lo v_mbcnt_lo_u32_b32 v4, s9, 0 global_load_b64 v[2:3], v2, s[2:3] offset:16 v_cmpx_eq_u32_e32 0, v4 s_cbranch_execz .LBB0_14 s_bcnt1_i32_b32 s9, s9 s_delay_alu instid0(SALU_CYCLE_1) v_dual_mov_b32 v5, 0 :: v_dual_mov_b32 v4, s9 s_waitcnt vmcnt(0) global_atomic_add_u64 v[2:3], v[4:5], off offset:8 .LBB0_14: s_or_b32 exec_lo, exec_lo, s8 s_waitcnt vmcnt(0) global_load_b64 v[4:5], v[2:3], off offset:16 s_waitcnt vmcnt(0) v_cmp_eq_u64_e32 vcc_lo, 0, v[4:5] s_cbranch_vccnz .LBB0_16 global_load_b32 v2, v[2:3], off offset:24 v_mov_b32_e32 v3, 0 s_waitcnt vmcnt(0) v_readfirstlane_b32 s8, v2 s_waitcnt_vscnt null, 0x0 global_store_b64 v[4:5], v[2:3], off s_and_b32 m0, s8, 0xff s_sendmsg sendmsg(MSG_INTERRUPT) .LBB0_16: s_or_b32 exec_lo, exec_lo, s1 s_mul_i32 s1, s7, 24 s_mul_hi_u32 s7, s6, 24 s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1) s_add_i32 s7, s7, s1 s_mul_i32 s1, s6, 24 v_add_co_u32 v0, vcc_lo, v0, s1 v_add_co_ci_u32_e32 v1, vcc_lo, s7, v1, vcc_lo s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_add_co_u32 v0, vcc_lo, v0, 20 v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo s_branch .LBB0_20 .p2align 6 .LBB0_17: s_or_b32 exec_lo, exec_lo, s1 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_readfirstlane_b32 s1, v2 s_cmp_eq_u32 s1, 0 s_cbranch_scc1 .LBB0_19 s_sleep 1 s_cbranch_execnz .LBB0_20 s_branch .LBB0_22 .p2align 6 .LBB0_19: s_branch .LBB0_22 .LBB0_20: v_mov_b32_e32 v2, 1 s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_17 global_load_b32 v2, v[0:1], off glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv v_and_b32_e32 v2, 1, v2 s_branch .LBB0_17 .LBB0_22: global_load_b64 v[22:23], v[6:7], off s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_26 v_mov_b32_e32 v6, 0 s_clause 0x2 global_load_b64 v[2:3], v6, s[2:3] offset:40 global_load_b64 v[7:8], v6, s[2:3] offset:24 glc global_load_b64 v[4:5], v6, s[2:3] s_waitcnt vmcnt(2) v_add_co_u32 v9, vcc_lo, v2, 1 v_add_co_ci_u32_e32 v10, vcc_lo, 0, v3, vcc_lo s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_add_co_u32 v0, vcc_lo, v9, s4 v_add_co_ci_u32_e32 v1, vcc_lo, s5, v10, vcc_lo s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_cmp_eq_u64_e32 vcc_lo, 0, v[0:1] v_dual_cndmask_b32 v1, v1, v10 :: v_dual_cndmask_b32 v0, v0, v9 v_and_b32_e32 v3, v1, v3 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_and_b32_e32 v2, v0, v2 v_mul_lo_u32 v3, v3, 24 s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2) v_mul_hi_u32 v9, v2, 24 v_mul_lo_u32 v2, v2, 24 v_add_nc_u32_e32 v3, v9, v3 s_waitcnt vmcnt(0) s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3) v_add_co_u32 v4, vcc_lo, v4, v2 v_mov_b32_e32 v2, v7 v_add_co_ci_u32_e32 v5, vcc_lo, v5, v3, vcc_lo v_mov_b32_e32 v3, v8 global_store_b64 v[4:5], v[7:8], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[2:3], v6, v[0:3], s[2:3] offset:24 glc s_waitcnt vmcnt(0) v_cmp_ne_u64_e32 vcc_lo, v[2:3], v[7:8] s_and_b32 exec_lo, exec_lo, vcc_lo s_cbranch_execz .LBB0_26 s_mov_b32 s0, 0 .LBB0_25: s_sleep 1 global_store_b64 v[4:5], v[2:3], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[7:8], v6, v[0:3], s[2:3] offset:24 glc s_waitcnt vmcnt(0) v_cmp_eq_u64_e32 vcc_lo, v[7:8], v[2:3] v_dual_mov_b32 v2, v7 :: v_dual_mov_b32 v3, v8 s_or_b32 s0, vcc_lo, s0 s_delay_alu instid0(SALU_CYCLE_1) s_and_not1_b32 exec_lo, exec_lo, s0 s_cbranch_execnz .LBB0_25 .LBB0_26: s_or_b32 exec_lo, exec_lo, s1 s_getpc_b64 s[4:5] s_add_u32 s4, s4, .str@rel32@lo+4 s_addc_u32 s5, s5, .str@rel32@hi+12 s_mov_b32 s0, -1 s_cmp_lg_u64 s[4:5], 0 s_cbranch_scc0 .LBB0_105 s_waitcnt vmcnt(0) v_dual_mov_b32 v1, v23 :: v_dual_and_b32 v0, -3, v22 v_mov_b32_e32 v25, 0 s_mov_b64 s[6:7], 14 s_branch .LBB0_29 .LBB0_28: s_or_b32 exec_lo, exec_lo, s1 s_sub_u32 s6, s6, s8 s_subb_u32 s7, s7, s9 s_add_u32 s4, s4, s8 s_addc_u32 s5, s5, s9 s_cmp_lg_u64 s[6:7], 0 s_cbranch_scc0 .LBB0_104 .LBB0_29: v_cmp_lt_u64_e64 s0, s[6:7], 56 s_delay_alu instid0(VALU_DEP_1) s_and_b32 s0, s0, exec_lo s_cselect_b32 s8, s6, 56 s_cselect_b32 s9, s7, 0 s_cmp_gt_u32 s8, 7 s_mov_b32 s0, -1 s_cbranch_scc1 .LBB0_34 v_mov_b32_e32 v2, 0 v_mov_b32_e32 v3, 0 s_cmp_eq_u32 s8, 0 s_cbranch_scc1 .LBB0_33 s_lshl_b64 s[0:1], s[8:9], 3 s_mov_b64 s[10:11], 0 s_mov_b64 s[12:13], s[4:5] .LBB0_32: global_load_u8 v4, v25, s[12:13] s_waitcnt vmcnt(0) v_and_b32_e32 v24, 0xffff, v4 s_delay_alu instid0(VALU_DEP_1) v_lshlrev_b64 v[4:5], s10, v[24:25] s_add_u32 s10, s10, 8 s_addc_u32 s11, s11, 0 s_add_u32 s12, s12, 1 s_addc_u32 s13, s13, 0 s_cmp_lg_u32 s0, s10 v_or_b32_e32 v2, v4, v2 v_or_b32_e32 v3, v5, v3 s_cbranch_scc1 .LBB0_32 .LBB0_33: s_mov_b32 s0, 0 s_mov_b32 s15, 0 .LBB0_34: s_and_not1_b32 vcc_lo, exec_lo, s0 s_mov_b64 s[0:1], s[4:5] s_cbranch_vccnz .LBB0_36 global_load_b64 v[2:3], v25, s[4:5] s_add_i32 s15, s8, -8 s_add_u32 s0, s4, 8 s_addc_u32 s1, s5, 0 .LBB0_36: s_cmp_gt_u32 s15, 7 s_cbranch_scc1 .LBB0_41 v_mov_b32_e32 v4, 0 v_mov_b32_e32 v5, 0 s_cmp_eq_u32 s15, 0 s_cbranch_scc1 .LBB0_40 s_mov_b64 s[10:11], 0 s_mov_b64 s[12:13], 0 .LBB0_39: s_delay_alu instid0(SALU_CYCLE_1) s_add_u32 s16, s0, s12 s_addc_u32 s17, s1, s13 s_add_u32 s12, s12, 1 global_load_u8 v6, v25, s[16:17] s_addc_u32 s13, s13, 0 s_waitcnt vmcnt(0) v_and_b32_e32 v24, 0xffff, v6 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1) v_lshlrev_b64 v[6:7], s10, v[24:25] s_add_u32 s10, s10, 8 s_addc_u32 s11, s11, 0 s_cmp_lg_u32 s15, s12 v_or_b32_e32 v4, v6, v4 s_delay_alu instid0(VALU_DEP_2) v_or_b32_e32 v5, v7, v5 s_cbranch_scc1 .LBB0_39 .LBB0_40: s_mov_b32 s14, 0 s_cbranch_execz .LBB0_42 s_branch .LBB0_43 .LBB0_41: .LBB0_42: global_load_b64 v[4:5], v25, s[0:1] s_add_i32 s14, s15, -8 s_add_u32 s0, s0, 8 s_addc_u32 s1, s1, 0 .LBB0_43: s_cmp_gt_u32 s14, 7 s_cbranch_scc1 .LBB0_48 v_mov_b32_e32 v6, 0 v_mov_b32_e32 v7, 0 s_cmp_eq_u32 s14, 0 s_cbranch_scc1 .LBB0_47 s_mov_b64 s[10:11], 0 s_mov_b64 s[12:13], 0 .LBB0_46: s_delay_alu instid0(SALU_CYCLE_1) s_add_u32 s16, s0, s12 s_addc_u32 s17, s1, s13 s_add_u32 s12, s12, 1 global_load_u8 v8, v25, s[16:17] s_addc_u32 s13, s13, 0 s_waitcnt vmcnt(0) v_and_b32_e32 v24, 0xffff, v8 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1) v_lshlrev_b64 v[8:9], s10, v[24:25] s_add_u32 s10, s10, 8 s_addc_u32 s11, s11, 0 s_cmp_lg_u32 s14, s12 v_or_b32_e32 v6, v8, v6 s_delay_alu instid0(VALU_DEP_2) v_or_b32_e32 v7, v9, v7 s_cbranch_scc1 .LBB0_46 .LBB0_47: s_mov_b32 s15, 0 s_cbranch_execz .LBB0_49 s_branch .LBB0_50 .LBB0_48: .LBB0_49: global_load_b64 v[6:7], v25, s[0:1] s_add_i32 s15, s14, -8 s_add_u32 s0, s0, 8 s_addc_u32 s1, s1, 0 .LBB0_50: s_cmp_gt_u32 s15, 7 s_cbranch_scc1 .LBB0_55 v_mov_b32_e32 v8, 0 v_mov_b32_e32 v9, 0 s_cmp_eq_u32 s15, 0 s_cbranch_scc1 .LBB0_54 s_mov_b64 s[10:11], 0 s_mov_b64 s[12:13], 0 .LBB0_53: s_delay_alu instid0(SALU_CYCLE_1) s_add_u32 s16, s0, s12 s_addc_u32 s17, s1, s13 s_add_u32 s12, s12, 1 global_load_u8 v10, v25, s[16:17] s_addc_u32 s13, s13, 0 s_waitcnt vmcnt(0) v_and_b32_e32 v24, 0xffff, v10 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1) v_lshlrev_b64 v[10:11], s10, v[24:25] s_add_u32 s10, s10, 8 s_addc_u32 s11, s11, 0 s_cmp_lg_u32 s15, s12 v_or_b32_e32 v8, v10, v8 s_delay_alu instid0(VALU_DEP_2) v_or_b32_e32 v9, v11, v9 s_cbranch_scc1 .LBB0_53 .LBB0_54: s_mov_b32 s14, 0 s_cbranch_execz .LBB0_56 s_branch .LBB0_57 .LBB0_55: .LBB0_56: global_load_b64 v[8:9], v25, s[0:1] s_add_i32 s14, s15, -8 s_add_u32 s0, s0, 8 s_addc_u32 s1, s1, 0 .LBB0_57: s_cmp_gt_u32 s14, 7 s_cbranch_scc1 .LBB0_62 v_mov_b32_e32 v10, 0 v_mov_b32_e32 v11, 0 s_cmp_eq_u32 s14, 0 s_cbranch_scc1 .LBB0_61 s_mov_b64 s[10:11], 0 s_mov_b64 s[12:13], 0 .LBB0_60: s_delay_alu instid0(SALU_CYCLE_1) s_add_u32 s16, s0, s12 s_addc_u32 s17, s1, s13 s_add_u32 s12, s12, 1 global_load_u8 v12, v25, s[16:17] s_addc_u32 s13, s13, 0 s_waitcnt vmcnt(0) v_and_b32_e32 v24, 0xffff, v12 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1) v_lshlrev_b64 v[12:13], s10, v[24:25] s_add_u32 s10, s10, 8 s_addc_u32 s11, s11, 0 s_cmp_lg_u32 s14, s12 v_or_b32_e32 v10, v12, v10 s_delay_alu instid0(VALU_DEP_2) v_or_b32_e32 v11, v13, v11 s_cbranch_scc1 .LBB0_60 .LBB0_61: s_mov_b32 s15, 0 s_cbranch_execz .LBB0_63 s_branch .LBB0_64 .LBB0_62: .LBB0_63: global_load_b64 v[10:11], v25, s[0:1] s_add_i32 s15, s14, -8 s_add_u32 s0, s0, 8 s_addc_u32 s1, s1, 0 .LBB0_64: s_cmp_gt_u32 s15, 7 s_cbranch_scc1 .LBB0_69 v_mov_b32_e32 v12, 0 v_mov_b32_e32 v13, 0 s_cmp_eq_u32 s15, 0 s_cbranch_scc1 .LBB0_68 s_mov_b64 s[10:11], 0 s_mov_b64 s[12:13], 0 .LBB0_67: s_delay_alu instid0(SALU_CYCLE_1) s_add_u32 s16, s0, s12 s_addc_u32 s17, s1, s13 s_add_u32 s12, s12, 1 global_load_u8 v14, v25, s[16:17] s_addc_u32 s13, s13, 0 s_waitcnt vmcnt(0) v_and_b32_e32 v24, 0xffff, v14 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1) v_lshlrev_b64 v[14:15], s10, v[24:25] s_add_u32 s10, s10, 8 s_addc_u32 s11, s11, 0 s_cmp_lg_u32 s15, s12 v_or_b32_e32 v12, v14, v12 s_delay_alu instid0(VALU_DEP_2) v_or_b32_e32 v13, v15, v13 s_cbranch_scc1 .LBB0_67 .LBB0_68: s_mov_b32 s14, 0 s_cbranch_execz .LBB0_70 s_branch .LBB0_71 .LBB0_69: .LBB0_70: global_load_b64 v[12:13], v25, s[0:1] s_add_i32 s14, s15, -8 s_add_u32 s0, s0, 8 s_addc_u32 s1, s1, 0 .LBB0_71: s_cmp_gt_u32 s14, 7 s_cbranch_scc1 .LBB0_76 v_mov_b32_e32 v14, 0 v_mov_b32_e32 v15, 0 s_cmp_eq_u32 s14, 0 s_cbranch_scc1 .LBB0_75 s_mov_b64 s[10:11], 0 s_mov_b64 s[12:13], s[0:1] .LBB0_74: global_load_u8 v16, v25, s[12:13] s_add_i32 s14, s14, -1 s_waitcnt vmcnt(0) v_and_b32_e32 v24, 0xffff, v16 s_delay_alu instid0(VALU_DEP_1) v_lshlrev_b64 v[16:17], s10, v[24:25] s_add_u32 s10, s10, 8 s_addc_u32 s11, s11, 0 s_add_u32 s12, s12, 1 s_addc_u32 s13, s13, 0 s_cmp_lg_u32 s14, 0 v_or_b32_e32 v14, v16, v14 v_or_b32_e32 v15, v17, v15 s_cbranch_scc1 .LBB0_74 .LBB0_75: s_cbranch_execz .LBB0_77 s_branch .LBB0_78 .LBB0_76: .LBB0_77: global_load_b64 v[14:15], v25, s[0:1] .LBB0_78: v_mov_b32_e32 v24, v20 v_mov_b32_e32 v26, 0 v_mov_b32_e32 v27, 0 s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1) v_readfirstlane_b32 s0, v24 v_cmp_eq_u32_e64 s0, s0, v24 s_delay_alu instid0(VALU_DEP_1) s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_84 global_load_b64 v[18:19], v25, s[2:3] offset:24 glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv s_clause 0x1 global_load_b64 v[16:17], v25, s[2:3] offset:40 global_load_b64 v[26:27], v25, s[2:3] s_mov_b32 s10, exec_lo s_waitcnt vmcnt(1) v_and_b32_e32 v17, v17, v19 v_and_b32_e32 v16, v16, v18 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_mul_lo_u32 v17, v17, 24 v_mul_hi_u32 v21, v16, 24 v_mul_lo_u32 v16, v16, 24 s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2) v_add_nc_u32_e32 v17, v21, v17 s_waitcnt vmcnt(0) v_add_co_u32 v16, vcc_lo, v26, v16 s_delay_alu instid0(VALU_DEP_2) v_add_co_ci_u32_e32 v17, vcc_lo, v27, v17, vcc_lo global_load_b64 v[16:17], v[16:17], off glc s_waitcnt vmcnt(0) global_atomic_cmpswap_b64 v[26:27], v25, v[16:19], s[2:3] offset:24 glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv v_cmpx_ne_u64_e64 v[26:27], v[18:19] s_cbranch_execz .LBB0_83 s_mov_b32 s11, 0 .p2align 6 .LBB0_81: s_sleep 1 s_clause 0x1 global_load_b64 v[16:17], v25, s[2:3] offset:40 global_load_b64 v[28:29], v25, s[2:3] v_dual_mov_b32 v18, v26 :: v_dual_mov_b32 v19, v27 s_waitcnt vmcnt(1) s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_and_b32_e32 v16, v16, v18 s_waitcnt vmcnt(0) v_mad_u64_u32 v[26:27], null, v16, 24, v[28:29] s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_dual_mov_b32 v16, v27 :: v_dual_and_b32 v17, v17, v19 v_mad_u64_u32 v[27:28], null, v17, 24, v[16:17] global_load_b64 v[16:17], v[26:27], off glc s_waitcnt vmcnt(0) global_atomic_cmpswap_b64 v[26:27], v25, v[16:19], s[2:3] offset:24 glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv v_cmp_eq_u64_e32 vcc_lo, v[26:27], v[18:19] s_or_b32 s11, vcc_lo, s11 s_delay_alu instid0(SALU_CYCLE_1) s_and_not1_b32 exec_lo, exec_lo, s11 s_cbranch_execnz .LBB0_81 s_or_b32 exec_lo, exec_lo, s11 .LBB0_83: s_delay_alu instid0(SALU_CYCLE_1) s_or_b32 exec_lo, exec_lo, s10 .LBB0_84: s_delay_alu instid0(SALU_CYCLE_1) s_or_b32 exec_lo, exec_lo, s1 s_clause 0x1 global_load_b64 v[28:29], v25, s[2:3] offset:40 global_load_b128 v[16:19], v25, s[2:3] v_readfirstlane_b32 s10, v26 v_readfirstlane_b32 s11, v27 s_mov_b32 s14, exec_lo s_waitcnt vmcnt(1) v_readfirstlane_b32 s12, v28 v_readfirstlane_b32 s13, v29 s_delay_alu instid0(VALU_DEP_1) s_and_b64 s[12:13], s[10:11], s[12:13] s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_86 v_dual_mov_b32 v26, s14 :: v_dual_mov_b32 v27, 0 s_mul_i32 s14, s13, 24 s_mul_hi_u32 s15, s12, 24 v_dual_mov_b32 v28, 2 :: v_dual_mov_b32 v29, 1 s_add_i32 s15, s15, s14 s_mul_i32 s14, s12, 24 s_waitcnt vmcnt(0) v_add_co_u32 v30, vcc_lo, v16, s14 v_add_co_ci_u32_e32 v31, vcc_lo, s15, v17, vcc_lo global_store_b128 v[30:31], v[26:29], off offset:8 .LBB0_86: s_or_b32 exec_lo, exec_lo, s1 v_cmp_gt_u64_e64 vcc_lo, s[6:7], 56 v_or_b32_e32 v21, 2, v0 s_lshl_b64 s[14:15], s[12:13], 12 v_lshlrev_b64 v[26:27], 6, v[24:25] s_lshl_b32 s1, s8, 2 s_delay_alu instid0(SALU_CYCLE_1) s_add_i32 s1, s1, 28 v_cndmask_b32_e32 v0, v21, v0, vcc_lo s_waitcnt vmcnt(0) v_add_co_u32 v18, vcc_lo, v18, s14 v_add_co_ci_u32_e32 v19, vcc_lo, s15, v19, vcc_lo s_and_b32 s1, s1, 0x1e0 s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3) v_add_co_u32 v18, vcc_lo, v18, v26 v_and_or_b32 v0, v0, 0xffffff1f, s1 v_add_co_ci_u32_e32 v19, vcc_lo, v19, v27, vcc_lo s_clause 0x3 global_store_b128 v[18:19], v[0:3], off global_store_b128 v[18:19], v[4:7], off offset:16 global_store_b128 v[18:19], v[8:11], off offset:32 global_store_b128 v[18:19], v[12:15], off offset:48 s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_94 s_clause 0x1 global_load_b64 v[8:9], v25, s[2:3] offset:32 glc global_load_b64 v[0:1], v25, s[2:3] offset:40 v_dual_mov_b32 v6, s10 :: v_dual_mov_b32 v7, s11 s_waitcnt vmcnt(0) v_readfirstlane_b32 s14, v0 v_readfirstlane_b32 s15, v1 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1) s_and_b64 s[14:15], s[14:15], s[10:11] s_mul_i32 s15, s15, 24 s_mul_hi_u32 s16, s14, 24 s_mul_i32 s14, s14, 24 s_add_i32 s16, s16, s15 v_add_co_u32 v4, vcc_lo, v16, s14 v_add_co_ci_u32_e32 v5, vcc_lo, s16, v17, vcc_lo s_mov_b32 s14, exec_lo global_store_b64 v[4:5], v[8:9], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[2:3], v25, v[6:9], s[2:3] offset:32 glc s_waitcnt vmcnt(0) v_cmpx_ne_u64_e64 v[2:3], v[8:9] s_cbranch_execz .LBB0_90 s_mov_b32 s15, 0 .LBB0_89: v_dual_mov_b32 v0, s10 :: v_dual_mov_b32 v1, s11 s_sleep 1 global_store_b64 v[4:5], v[2:3], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[0:1], v25, v[0:3], s[2:3] offset:32 glc s_waitcnt vmcnt(0) v_cmp_eq_u64_e32 vcc_lo, v[0:1], v[2:3] v_dual_mov_b32 v3, v1 :: v_dual_mov_b32 v2, v0 s_or_b32 s15, vcc_lo, s15 s_delay_alu instid0(SALU_CYCLE_1) s_and_not1_b32 exec_lo, exec_lo, s15 s_cbranch_execnz .LBB0_89 .LBB0_90: s_or_b32 exec_lo, exec_lo, s14 global_load_b64 v[0:1], v25, s[2:3] offset:16 s_mov_b32 s15, exec_lo s_mov_b32 s14, exec_lo v_mbcnt_lo_u32_b32 v2, s15, 0 s_delay_alu instid0(VALU_DEP_1) v_cmpx_eq_u32_e32 0, v2 s_cbranch_execz .LBB0_92 s_bcnt1_i32_b32 s15, s15 s_delay_alu instid0(SALU_CYCLE_1) v_dual_mov_b32 v3, 0 :: v_dual_mov_b32 v2, s15 s_waitcnt vmcnt(0) global_atomic_add_u64 v[0:1], v[2:3], off offset:8 .LBB0_92: s_or_b32 exec_lo, exec_lo, s14 s_waitcnt vmcnt(0) global_load_b64 v[2:3], v[0:1], off offset:16 s_waitcnt vmcnt(0) v_cmp_eq_u64_e32 vcc_lo, 0, v[2:3] s_cbranch_vccnz .LBB0_94 global_load_b32 v24, v[0:1], off offset:24 s_waitcnt vmcnt(0) v_readfirstlane_b32 s14, v24 s_waitcnt_vscnt null, 0x0 global_store_b64 v[2:3], v[24:25], off s_and_b32 m0, s14, 0xff s_sendmsg sendmsg(MSG_INTERRUPT) .LBB0_94: s_or_b32 exec_lo, exec_lo, s1 s_mul_i32 s1, s13, 24 s_mul_hi_u32 s13, s12, 24 s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1) s_add_i32 s13, s13, s1 s_mul_i32 s1, s12, 24 v_add_co_u32 v0, vcc_lo, v16, s1 v_add_co_ci_u32_e32 v1, vcc_lo, s13, v17, vcc_lo s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_add_co_u32 v0, vcc_lo, v0, 20 v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo s_branch .LBB0_98 .p2align 6 .LBB0_95: s_or_b32 exec_lo, exec_lo, s1 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_readfirstlane_b32 s1, v2 s_cmp_eq_u32 s1, 0 s_cbranch_scc1 .LBB0_97 s_sleep 1 s_cbranch_execnz .LBB0_98 s_branch .LBB0_100 .p2align 6 .LBB0_97: s_branch .LBB0_100 .LBB0_98: v_mov_b32_e32 v2, 1 s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_95 global_load_b32 v2, v[0:1], off glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv v_and_b32_e32 v2, 1, v2 s_branch .LBB0_95 .LBB0_100: global_load_b64 v[0:1], v[18:19], off s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_28 s_clause 0x2 global_load_b64 v[4:5], v25, s[2:3] offset:40 global_load_b64 v[8:9], v25, s[2:3] offset:24 glc global_load_b64 v[6:7], v25, s[2:3] s_waitcnt vmcnt(2) v_add_co_u32 v10, vcc_lo, v4, 1 v_add_co_ci_u32_e32 v11, vcc_lo, 0, v5, vcc_lo s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_add_co_u32 v2, vcc_lo, v10, s10 v_add_co_ci_u32_e32 v3, vcc_lo, s11, v11, vcc_lo s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_cmp_eq_u64_e32 vcc_lo, 0, v[2:3] v_dual_cndmask_b32 v3, v3, v11 :: v_dual_cndmask_b32 v2, v2, v10 v_and_b32_e32 v5, v3, v5 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1) v_and_b32_e32 v4, v2, v4 v_mul_hi_u32 v10, v4, 24 v_mul_lo_u32 v4, v4, 24 s_waitcnt vmcnt(0) s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1) v_add_co_u32 v6, vcc_lo, v6, v4 v_mov_b32_e32 v4, v8 v_mul_lo_u32 v5, v5, 24 v_add_nc_u32_e32 v5, v10, v5 s_delay_alu instid0(VALU_DEP_1) v_add_co_ci_u32_e32 v7, vcc_lo, v7, v5, vcc_lo v_mov_b32_e32 v5, v9 global_store_b64 v[6:7], v[8:9], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[4:5], v25, v[2:5], s[2:3] offset:24 glc s_waitcnt vmcnt(0) v_cmp_ne_u64_e32 vcc_lo, v[4:5], v[8:9] s_and_b32 exec_lo, exec_lo, vcc_lo s_cbranch_execz .LBB0_28 s_mov_b32 s0, 0 .LBB0_103: s_sleep 1 global_store_b64 v[6:7], v[4:5], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[8:9], v25, v[2:5], s[2:3] offset:24 glc s_waitcnt vmcnt(0) v_cmp_eq_u64_e32 vcc_lo, v[8:9], v[4:5] v_dual_mov_b32 v4, v8 :: v_dual_mov_b32 v5, v9 s_or_b32 s0, vcc_lo, s0 s_delay_alu instid0(SALU_CYCLE_1) s_and_not1_b32 exec_lo, exec_lo, s0 s_cbranch_execnz .LBB0_103 s_branch .LBB0_28 .LBB0_104: s_mov_b32 s0, 0 .LBB0_105: s_delay_alu instid0(SALU_CYCLE_1) s_and_b32 vcc_lo, exec_lo, s0 s_cbranch_vccz .LBB0_132 v_readfirstlane_b32 s0, v20 v_mov_b32_e32 v4, 0 v_mov_b32_e32 v5, 0 s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1) v_cmp_eq_u32_e64 s0, s0, v20 s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_112 s_waitcnt vmcnt(0) v_mov_b32_e32 v0, 0 s_mov_b32 s4, exec_lo global_load_b64 v[6:7], v0, s[2:3] offset:24 glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv s_clause 0x1 global_load_b64 v[1:2], v0, s[2:3] offset:40 global_load_b64 v[3:4], v0, s[2:3] s_waitcnt vmcnt(1) v_and_b32_e32 v1, v1, v6 v_and_b32_e32 v2, v2, v7 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_mul_hi_u32 v5, v1, 24 v_mul_lo_u32 v2, v2, 24 v_mul_lo_u32 v1, v1, 24 s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2) v_add_nc_u32_e32 v2, v5, v2 s_waitcnt vmcnt(0) v_add_co_u32 v1, vcc_lo, v3, v1 s_delay_alu instid0(VALU_DEP_2) v_add_co_ci_u32_e32 v2, vcc_lo, v4, v2, vcc_lo global_load_b64 v[4:5], v[1:2], off glc s_waitcnt vmcnt(0) global_atomic_cmpswap_b64 v[4:5], v0, v[4:7], s[2:3] offset:24 glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv v_cmpx_ne_u64_e64 v[4:5], v[6:7] s_cbranch_execz .LBB0_111 s_mov_b32 s5, 0 .p2align 6 .LBB0_109: s_sleep 1 s_clause 0x1 global_load_b64 v[1:2], v0, s[2:3] offset:40 global_load_b64 v[8:9], v0, s[2:3] v_dual_mov_b32 v7, v5 :: v_dual_mov_b32 v6, v4 s_waitcnt vmcnt(1) s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_and_b32_e32 v1, v1, v6 s_waitcnt vmcnt(0) v_mad_u64_u32 v[3:4], null, v1, 24, v[8:9] s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_dual_mov_b32 v1, v4 :: v_dual_and_b32 v2, v2, v7 v_mad_u64_u32 v[4:5], null, v2, 24, v[1:2] global_load_b64 v[4:5], v[3:4], off glc s_waitcnt vmcnt(0) global_atomic_cmpswap_b64 v[4:5], v0, v[4:7], s[2:3] offset:24 glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv v_cmp_eq_u64_e32 vcc_lo, v[4:5], v[6:7] s_or_b32 s5, vcc_lo, s5 s_delay_alu instid0(SALU_CYCLE_1) s_and_not1_b32 exec_lo, exec_lo, s5 s_cbranch_execnz .LBB0_109 s_or_b32 exec_lo, exec_lo, s5 .LBB0_111: s_delay_alu instid0(SALU_CYCLE_1) s_or_b32 exec_lo, exec_lo, s4 .LBB0_112: s_delay_alu instid0(SALU_CYCLE_1) s_or_b32 exec_lo, exec_lo, s1 v_mov_b32_e32 v21, 0 v_readfirstlane_b32 s4, v4 v_readfirstlane_b32 s5, v5 s_mov_b32 s8, exec_lo s_clause 0x1 global_load_b64 v[6:7], v21, s[2:3] offset:40 global_load_b128 v[0:3], v21, s[2:3] s_waitcnt vmcnt(1) v_readfirstlane_b32 s6, v6 v_readfirstlane_b32 s7, v7 s_delay_alu instid0(VALU_DEP_1) s_and_b64 s[6:7], s[4:5], s[6:7] s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_114 v_dual_mov_b32 v4, s8 :: v_dual_mov_b32 v5, 0 s_mul_i32 s8, s7, 24 s_mul_hi_u32 s9, s6, 24 v_dual_mov_b32 v6, 2 :: v_dual_mov_b32 v7, 1 s_add_i32 s9, s9, s8 s_mul_i32 s8, s6, 24 s_waitcnt vmcnt(0) v_add_co_u32 v8, vcc_lo, v0, s8 v_add_co_ci_u32_e32 v9, vcc_lo, s9, v1, vcc_lo global_store_b128 v[8:9], v[4:7], off offset:8 .LBB0_114: s_or_b32 exec_lo, exec_lo, s1 s_lshl_b64 s[8:9], s[6:7], 12 v_and_or_b32 v22, v22, 0xffffff1d, 34 s_waitcnt vmcnt(0) v_add_co_u32 v4, vcc_lo, v2, s8 v_add_co_ci_u32_e32 v5, vcc_lo, s9, v3, vcc_lo v_lshlrev_b64 v[2:3], 6, v[20:21] s_mov_b32 s8, 0 s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(VALU_DEP_1) s_mov_b32 s9, s8 s_mov_b32 s10, s8 s_mov_b32 s11, s8 v_add_co_u32 v8, vcc_lo, v4, v2 v_mov_b32_e32 v6, 0 v_add_co_ci_u32_e32 v9, vcc_lo, v5, v3, vcc_lo v_dual_mov_b32 v2, s8 :: v_dual_mov_b32 v5, s11 v_dual_mov_b32 v3, s9 :: v_dual_mov_b32 v4, s10 s_delay_alu instid0(VALU_DEP_4) v_mov_b32_e32 v7, v6 s_clause 0x4 global_store_b64 v[8:9], v[22:23], off global_store_b128 v[8:9], v[2:5], off offset:8 global_store_b128 v[8:9], v[2:5], off offset:24 global_store_b128 v[8:9], v[2:5], off offset:40 global_store_b64 v[8:9], v[6:7], off offset:56 s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_122 v_dual_mov_b32 v8, 0 :: v_dual_mov_b32 v9, s4 v_mov_b32_e32 v10, s5 s_clause 0x1 global_load_b64 v[11:12], v8, s[2:3] offset:32 glc global_load_b64 v[2:3], v8, s[2:3] offset:40 s_waitcnt vmcnt(0) v_readfirstlane_b32 s8, v2 v_readfirstlane_b32 s9, v3 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1) s_and_b64 s[8:9], s[8:9], s[4:5] s_mul_i32 s9, s9, 24 s_mul_hi_u32 s10, s8, 24 s_mul_i32 s8, s8, 24 s_add_i32 s10, s10, s9 v_add_co_u32 v6, vcc_lo, v0, s8 v_add_co_ci_u32_e32 v7, vcc_lo, s10, v1, vcc_lo s_mov_b32 s8, exec_lo global_store_b64 v[6:7], v[11:12], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[4:5], v8, v[9:12], s[2:3] offset:32 glc s_waitcnt vmcnt(0) v_cmpx_ne_u64_e64 v[4:5], v[11:12] s_cbranch_execz .LBB0_118 s_mov_b32 s9, 0 .LBB0_117: v_dual_mov_b32 v2, s4 :: v_dual_mov_b32 v3, s5 s_sleep 1 global_store_b64 v[6:7], v[4:5], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[2:3], v8, v[2:5], s[2:3] offset:32 glc s_waitcnt vmcnt(0) v_cmp_eq_u64_e32 vcc_lo, v[2:3], v[4:5] v_dual_mov_b32 v5, v3 :: v_dual_mov_b32 v4, v2 s_or_b32 s9, vcc_lo, s9 s_delay_alu instid0(SALU_CYCLE_1) s_and_not1_b32 exec_lo, exec_lo, s9 s_cbranch_execnz .LBB0_117 .LBB0_118: s_or_b32 exec_lo, exec_lo, s8 v_mov_b32_e32 v2, 0 s_mov_b32 s9, exec_lo s_mov_b32 s8, exec_lo v_mbcnt_lo_u32_b32 v4, s9, 0 global_load_b64 v[2:3], v2, s[2:3] offset:16 v_cmpx_eq_u32_e32 0, v4 s_cbranch_execz .LBB0_120 s_bcnt1_i32_b32 s9, s9 s_delay_alu instid0(SALU_CYCLE_1) v_dual_mov_b32 v5, 0 :: v_dual_mov_b32 v4, s9 s_waitcnt vmcnt(0) global_atomic_add_u64 v[2:3], v[4:5], off offset:8 .LBB0_120: s_or_b32 exec_lo, exec_lo, s8 s_waitcnt vmcnt(0) global_load_b64 v[4:5], v[2:3], off offset:16 s_waitcnt vmcnt(0) v_cmp_eq_u64_e32 vcc_lo, 0, v[4:5] s_cbranch_vccnz .LBB0_122 global_load_b32 v2, v[2:3], off offset:24 v_mov_b32_e32 v3, 0 s_waitcnt vmcnt(0) v_readfirstlane_b32 s8, v2 s_waitcnt_vscnt null, 0x0 global_store_b64 v[4:5], v[2:3], off s_and_b32 m0, s8, 0xff s_sendmsg sendmsg(MSG_INTERRUPT) .LBB0_122: s_or_b32 exec_lo, exec_lo, s1 s_mul_i32 s1, s7, 24 s_mul_hi_u32 s7, s6, 24 s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1) s_add_i32 s7, s7, s1 s_mul_i32 s1, s6, 24 v_add_co_u32 v0, vcc_lo, v0, s1 v_add_co_ci_u32_e32 v1, vcc_lo, s7, v1, vcc_lo s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_add_co_u32 v0, vcc_lo, v0, 20 v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo s_branch .LBB0_126 .p2align 6 .LBB0_123: s_or_b32 exec_lo, exec_lo, s1 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_readfirstlane_b32 s1, v2 s_cmp_eq_u32 s1, 0 s_cbranch_scc1 .LBB0_125 s_sleep 1 s_cbranch_execnz .LBB0_126 s_branch .LBB0_128 .p2align 6 .LBB0_125: s_branch .LBB0_128 .LBB0_126: v_mov_b32_e32 v2, 1 s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_123 global_load_b32 v2, v[0:1], off glc s_waitcnt vmcnt(0) buffer_gl1_inv buffer_gl0_inv v_and_b32_e32 v2, 1, v2 s_branch .LBB0_123 .LBB0_128: s_and_saveexec_b32 s1, s0 s_cbranch_execz .LBB0_132 v_mov_b32_e32 v6, 0 s_clause 0x2 global_load_b64 v[2:3], v6, s[2:3] offset:40 global_load_b64 v[7:8], v6, s[2:3] offset:24 glc global_load_b64 v[4:5], v6, s[2:3] s_waitcnt vmcnt(2) v_add_co_u32 v9, vcc_lo, v2, 1 v_add_co_ci_u32_e32 v10, vcc_lo, 0, v3, vcc_lo s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_add_co_u32 v0, vcc_lo, v9, s4 v_add_co_ci_u32_e32 v1, vcc_lo, s5, v10, vcc_lo s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_cmp_eq_u64_e32 vcc_lo, 0, v[0:1] v_dual_cndmask_b32 v1, v1, v10 :: v_dual_cndmask_b32 v0, v0, v9 v_and_b32_e32 v3, v1, v3 s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2) v_and_b32_e32 v2, v0, v2 v_mul_lo_u32 v3, v3, 24 s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2) v_mul_hi_u32 v9, v2, 24 v_mul_lo_u32 v2, v2, 24 v_add_nc_u32_e32 v3, v9, v3 s_waitcnt vmcnt(0) s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3) v_add_co_u32 v4, vcc_lo, v4, v2 v_mov_b32_e32 v2, v7 v_add_co_ci_u32_e32 v5, vcc_lo, v5, v3, vcc_lo v_mov_b32_e32 v3, v8 global_store_b64 v[4:5], v[7:8], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[2:3], v6, v[0:3], s[2:3] offset:24 glc s_waitcnt vmcnt(0) v_cmp_ne_u64_e32 vcc_lo, v[2:3], v[7:8] s_and_b32 exec_lo, exec_lo, vcc_lo s_cbranch_execz .LBB0_132 s_mov_b32 s0, 0 .LBB0_131: s_sleep 1 global_store_b64 v[4:5], v[2:3], off s_waitcnt_vscnt null, 0x0 global_atomic_cmpswap_b64 v[7:8], v6, v[0:3], s[2:3] offset:24 glc s_waitcnt vmcnt(0) v_cmp_eq_u64_e32 vcc_lo, v[7:8], v[2:3] v_dual_mov_b32 v2, v7 :: v_dual_mov_b32 v3, v8 s_or_b32 s0, vcc_lo, s0 s_delay_alu instid0(SALU_CYCLE_1) s_and_not1_b32 exec_lo, exec_lo, s0 s_cbranch_execnz .LBB0_131 .LBB0_132: s_nop 0 s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z11hellokernelv .amdhsa_group_segment_fixed_size 0 .amdhsa_private_segment_fixed_size 0 .amdhsa_kernarg_size 256 .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 32 .amdhsa_next_free_sgpr 18 .amdhsa_float_round_mode_32 0 .amdhsa_float_round_mode_16_64 0 .amdhsa_float_denorm_mode_32 3 .amdhsa_float_denorm_mode_16_64 3 .amdhsa_dx10_clamp 1 .amdhsa_ieee_mode 1 .amdhsa_fp16_overflow 0 .amdhsa_workgroup_processor_mode 1 .amdhsa_memory_ordered 1 .amdhsa_forward_progress 0 .amdhsa_shared_vgpr_count 0 .amdhsa_exception_fp_ieee_invalid_op 0 .amdhsa_exception_fp_denorm_src 0 .amdhsa_exception_fp_ieee_div_zero 0 .amdhsa_exception_fp_ieee_overflow 0 .amdhsa_exception_fp_ieee_underflow 0 .amdhsa_exception_fp_ieee_inexact 0 .amdhsa_exception_int_div_zero 0 .end_amdhsa_kernel .text .Lfunc_end0: .size _Z11hellokernelv, .Lfunc_end0-_Z11hellokernelv .section .AMDGPU.csdata,"",@progbits .text .p2alignl 7, 3214868480 .fill 96, 4, 3214868480 .type .str,@object .section .rodata.str1.1,"aMS",@progbits,1 .str: .asciz "Hello World!\n" .size .str, 14 .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: hidden_block_count_x - .offset: 4 .size: 4 .value_kind: hidden_block_count_y - .offset: 8 .size: 4 .value_kind: hidden_block_count_z - .offset: 12 .size: 2 .value_kind: hidden_group_size_x - .offset: 14 .size: 2 .value_kind: hidden_group_size_y - .offset: 16 .size: 2 .value_kind: hidden_group_size_z - .offset: 18 .size: 2 .value_kind: hidden_remainder_x - .offset: 20 .size: 2 .value_kind: hidden_remainder_y - .offset: 22 .size: 2 .value_kind: hidden_remainder_z - .offset: 40 .size: 8 .value_kind: hidden_global_offset_x - .offset: 48 .size: 8 .value_kind: hidden_global_offset_y - .offset: 56 .size: 8 .value_kind: hidden_global_offset_z - .offset: 64 .size: 2 .value_kind: hidden_grid_dims - .offset: 80 .size: 8 .value_kind: hidden_hostcall_buffer .group_segment_fixed_size: 0 .kernarg_segment_align: 8 .kernarg_segment_size: 256 .language: OpenCL C .language_version: - 2 - 0 .max_flat_workgroup_size: 1024 .name: _Z11hellokernelv .private_segment_fixed_size: 0 .sgpr_count: 20 .sgpr_spill_count: 0 .symbol: _Z11hellokernelv.kd .uniform_work_group_size: 1 .uses_dynamic_stack: false .vgpr_count: 32 .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_0002be5c_00000000-6_hello-1.cudafe1.cpp" .text #APP #NO_APP .type _ZL26__cudaUnregisterBinaryUtilv, @function _ZL26__cudaUnregisterBinaryUtilv: .LFB2060: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 movq _ZL20__cudaFatCubinHandle(%rip), %rdi call __cudaUnregisterFatBinary@PLT addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2060: .size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv .globl _Z30__device_stub__Z11hellokernelvv .type _Z30__device_stub__Z11hellokernelvv, @function _Z30__device_stub__Z11hellokernelvv: .LFB2082: .cfi_startproc endbr64 subq $88, %rsp .cfi_def_cfa_offset 96 movq %fs:40, %rax movq %rax, 72(%rsp) xorl %eax, %eax movl $1, 16(%rsp) movl $1, 20(%rsp) movl $1, 24(%rsp) movl $1, 28(%rsp) movl $1, 32(%rsp) movl $1, 36(%rsp) leaq 8(%rsp), %rcx movq %rsp, %rdx leaq 28(%rsp), %rsi leaq 16(%rsp), %rdi call __cudaPopCallConfiguration@PLT testl %eax, %eax je .L7 .L3: movq 72(%rsp), %rax subq %fs:40, %rax jne .L8 addq $88, %rsp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L7: .cfi_restore_state pushq 8(%rsp) .cfi_def_cfa_offset 104 pushq 8(%rsp) .cfi_def_cfa_offset 112 leaq 80(%rsp), %r9 movq 44(%rsp), %rcx movl 52(%rsp), %r8d movq 32(%rsp), %rsi movl 40(%rsp), %edx leaq _Z11hellokernelv(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 96 jmp .L3 .L8: call __stack_chk_fail@PLT .cfi_endproc .LFE2082: .size _Z30__device_stub__Z11hellokernelvv, .-_Z30__device_stub__Z11hellokernelvv .globl _Z11hellokernelv .type _Z11hellokernelv, @function _Z11hellokernelv: .LFB2083: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z30__device_stub__Z11hellokernelvv addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2083: .size _Z11hellokernelv, .-_Z11hellokernelv .globl main .type main, @function main: .LFB2057: .cfi_startproc endbr64 subq $40, %rsp .cfi_def_cfa_offset 48 movl $10, 20(%rsp) movl $1, 24(%rsp) movl $10, 8(%rsp) movl $1, 12(%rsp) movl $0, %r9d movl $0, %r8d movq 20(%rsp), %rdx movl $1, %ecx movq 8(%rsp), %rdi movl $1, %esi call __cudaPushCallConfiguration@PLT testl %eax, %eax je .L14 .L12: call cudaDeviceSynchronize@PLT movl $0, %eax addq $40, %rsp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L14: .cfi_restore_state call _Z30__device_stub__Z11hellokernelvv jmp .L12 .cfi_endproc .LFE2057: .size main, .-main .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "_Z11hellokernelv" .text .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB2085: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 leaq _ZL15__fatDeviceText(%rip), %rdi call __cudaRegisterFatBinary@PLT movq %rax, %rdi movq %rax, _ZL20__cudaFatCubinHandle(%rip) pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 pushq $0 .cfi_def_cfa_offset 40 pushq $0 .cfi_def_cfa_offset 48 movl $0, %r9d movl $-1, %r8d leaq .LC0(%rip), %rdx movq %rdx, %rcx leaq _Z11hellokernelv(%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 "hello-1.hip" .globl _Z26__device_stub__hellokernelv # -- Begin function _Z26__device_stub__hellokernelv .p2align 4, 0x90 .type _Z26__device_stub__hellokernelv,@function _Z26__device_stub__hellokernelv: # @_Z26__device_stub__hellokernelv .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 $_Z11hellokernelv, %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 _Z26__device_stub__hellokernelv, .Lfunc_end0-_Z26__device_stub__hellokernelv .cfi_endproc # -- End function .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: subq $56, %rsp .cfi_def_cfa_offset 64 movabsq $4294967306, %rdi # imm = 0x10000000A movl $1, %esi movq %rdi, %rdx movl $1, %ecx xorl %r8d, %r8d xorl %r9d, %r9d callq __hipPushCallConfiguration testl %eax, %eax jne .LBB1_2 # %bb.1: leaq 32(%rsp), %rdi leaq 16(%rsp), %rsi leaq 8(%rsp), %rdx movq %rsp, %rcx callq __hipPopCallConfiguration movq 32(%rsp), %rsi movl 40(%rsp), %edx movq 16(%rsp), %rcx movl 24(%rsp), %r8d leaq 48(%rsp), %r9 movl $_Z11hellokernelv, %edi pushq (%rsp) .cfi_adjust_cfa_offset 8 pushq 16(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $16, %rsp .cfi_adjust_cfa_offset -16 .LBB1_2: callq hipDeviceSynchronize xorl %eax, %eax addq $56, %rsp .cfi_def_cfa_offset 8 retq .Lfunc_end1: .size main, .Lfunc_end1-main .cfi_endproc # -- End function .p2align 4, 0x90 # -- Begin function __hip_module_ctor .type __hip_module_ctor,@function __hip_module_ctor: # @__hip_module_ctor .cfi_startproc # %bb.0: subq $40, %rsp .cfi_def_cfa_offset 48 cmpq $0, __hip_gpubin_handle(%rip) jne .LBB2_2 # %bb.1: movl $__hip_fatbin_wrapper, %edi callq __hipRegisterFatBinary movq %rax, __hip_gpubin_handle(%rip) .LBB2_2: movq __hip_gpubin_handle(%rip), %rdi xorps %xmm0, %xmm0 movups %xmm0, 16(%rsp) movups %xmm0, (%rsp) movl $_Z11hellokernelv, %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 _Z11hellokernelv,@object # @_Z11hellokernelv .section .rodata,"a",@progbits .globl _Z11hellokernelv .p2align 3, 0x0 _Z11hellokernelv: .quad _Z26__device_stub__hellokernelv .size _Z11hellokernelv, 8 .type .L__unnamed_1,@object # @0 .section .rodata.str1.1,"aMS",@progbits,1 .L__unnamed_1: .asciz "_Z11hellokernelv" .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 _Z26__device_stub__hellokernelv .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z11hellokernelv .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> #include <math.h> #define N (2048*2048) #define THREAD_PER_BLOCK 512 __global__ void tra( int *a, int *b) { int i = blockIdx.x/4; int j = (blockIdx.x%4) * blockDim.x + threadIdx.x; b[i*2048+j] = a[j*2048+i]; } void random_ints(int *p, int n) { int i; for(i=0; i<n; i++) { p[i]=rand(); } } int main( void ) { int *a, *b, *c; // host copies of a, b, c int *dev_a, *dev_b; // device copies of a, b, c int size = N * sizeof( int ); // we need space for N // integers int i, j; // allocate device copies of a, b cudaMalloc( (void**)&dev_a, size ); cudaMalloc( (void**)&dev_b, size ); a = (int*)malloc( size ); b = (int*)malloc( size ); c = (int*)malloc( size ); random_ints( a, N ); random_ints( b, N ); // copy inputs to device cudaMemcpy( dev_a, a, size, cudaMemcpyHostToDevice ); cudaMemcpy( dev_b, b, size, cudaMemcpyHostToDevice ); // launch an rev() kernel with N threads tra<<< N/THREAD_PER_BLOCK, THREAD_PER_BLOCK >>>( dev_a, dev_b); // copy device result back to host copy of c cudaMemcpy( b, dev_b, size, cudaMemcpyDeviceToHost ); for(i=0; i<2048; i++) { for(j=0; j<2048; j++) { c[i*2048+j] = a[j*2048+i]; if(b[i*2048+j]!=c[i*2048+j]) { printf("error: expected %d, got %d!\n",c[i*2048+j], b[i*2048+j]); break; } } } if(i==N) {printf("correct!\n");} free( a ); free( b ); free( c ); cudaFree( dev_a ); cudaFree( dev_b ); return 0; }
code for sm_80 Function : _Z3traPiS_ .headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)" /*0000*/ MOV R1, c[0x0][0x28] ; /* 0x00000a0000017a02 */ /* 0x000fe40000000f00 */ /*0010*/ S2R R2, SR_CTAID.X ; /* 0x0000000000027919 */ /* 0x000e220000002500 */ /*0020*/ HFMA2.MMA R4, -RZ, RZ, 0, 2.384185791015625e-07 ; /* 0x00000004ff047435 */ /* 0x000fe200000001ff */ /*0030*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */ /* 0x000fe40000000a00 */ /*0040*/ S2R R5, SR_TID.X ; /* 0x0000000000057919 */ /* 0x000e620000002100 */ /*0050*/ LOP3.LUT R0, R2, 0x3, RZ, 0xc0, !PT ; /* 0x0000000302007812 */ /* 0x001fca00078ec0ff */ /*0060*/ IMAD R5, R0, c[0x0][0x0], R5 ; /* 0x0000000000057a24 */ /* 0x002fe200078e0205 */ /*0070*/ SHF.R.U32.HI R0, RZ, 0x2, R2 ; /* 0x00000002ff007819 */ /* 0x000fc80000011602 */ /*0080*/ LEA R2, R5, R0, 0xb ; /* 0x0000000005027211 */ /* 0x000fca00078e58ff */ /*0090*/ IMAD.WIDE R2, R2, R4, c[0x0][0x160] ; /* 0x0000580002027625 */ /* 0x000fcc00078e0204 */ /*00a0*/ LDG.E R3, [R2.64] ; /* 0x0000000402037981 */ /* 0x000ea2000c1e1900 */ /*00b0*/ LEA R5, R0, R5, 0xb ; /* 0x0000000500057211 */ /* 0x000fca00078e58ff */ /*00c0*/ IMAD.WIDE R4, R5, R4, c[0x0][0x168] ; /* 0x00005a0005047625 */ /* 0x000fca00078e0204 */ /*00d0*/ STG.E [R4.64], R3 ; /* 0x0000000304007986 */ /* 0x004fe2000c101904 */ /*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 <stdio.h> #include <math.h> #define N (2048*2048) #define THREAD_PER_BLOCK 512 __global__ void tra( int *a, int *b) { int i = blockIdx.x/4; int j = (blockIdx.x%4) * blockDim.x + threadIdx.x; b[i*2048+j] = a[j*2048+i]; } void random_ints(int *p, int n) { int i; for(i=0; i<n; i++) { p[i]=rand(); } } int main( void ) { int *a, *b, *c; // host copies of a, b, c int *dev_a, *dev_b; // device copies of a, b, c int size = N * sizeof( int ); // we need space for N // integers int i, j; // allocate device copies of a, b cudaMalloc( (void**)&dev_a, size ); cudaMalloc( (void**)&dev_b, size ); a = (int*)malloc( size ); b = (int*)malloc( size ); c = (int*)malloc( size ); random_ints( a, N ); random_ints( b, N ); // copy inputs to device cudaMemcpy( dev_a, a, size, cudaMemcpyHostToDevice ); cudaMemcpy( dev_b, b, size, cudaMemcpyHostToDevice ); // launch an rev() kernel with N threads tra<<< N/THREAD_PER_BLOCK, THREAD_PER_BLOCK >>>( dev_a, dev_b); // copy device result back to host copy of c cudaMemcpy( b, dev_b, size, cudaMemcpyDeviceToHost ); for(i=0; i<2048; i++) { for(j=0; j<2048; j++) { c[i*2048+j] = a[j*2048+i]; if(b[i*2048+j]!=c[i*2048+j]) { printf("error: expected %d, got %d!\n",c[i*2048+j], b[i*2048+j]); break; } } } if(i==N) {printf("correct!\n");} free( a ); free( b ); free( c ); cudaFree( dev_a ); cudaFree( dev_b ); return 0; }
.file "tmpxft_0006545f_00000000-6_matrix_transp.cudafe1.cpp" .text #APP #NO_APP .type _ZL26__cudaUnregisterBinaryUtilv, @function _ZL26__cudaUnregisterBinaryUtilv: .LFB2061: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 movq _ZL20__cudaFatCubinHandle(%rip), %rdi call __cudaUnregisterFatBinary@PLT addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2061: .size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv .globl _Z11random_intsPii .type _Z11random_intsPii, @function _Z11random_intsPii: .LFB2057: .cfi_startproc endbr64 testl %esi, %esi jle .L8 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 pushq %rbx .cfi_def_cfa_offset 24 .cfi_offset 3, -24 subq $8, %rsp .cfi_def_cfa_offset 32 movq %rdi, %rbx movslq %esi, %rsi leaq (%rdi,%rsi,4), %rbp .L5: call rand@PLT movl %eax, (%rbx) addq $4, %rbx cmpq %rbp, %rbx jne .L5 addq $8, %rsp .cfi_def_cfa_offset 24 popq %rbx .cfi_def_cfa_offset 16 popq %rbp .cfi_def_cfa_offset 8 ret .L8: .cfi_restore 3 .cfi_restore 6 ret .cfi_endproc .LFE2057: .size _Z11random_intsPii, .-_Z11random_intsPii .globl _Z24__device_stub__Z3traPiS_PiS_ .type _Z24__device_stub__Z3traPiS_PiS_, @function _Z24__device_stub__Z3traPiS_PiS_: .LFB2083: .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 .L15 .L11: movq 104(%rsp), %rax subq %fs:40, %rax jne .L16 addq $120, %rsp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L15: .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 _Z3traPiS_(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 128 jmp .L11 .L16: call __stack_chk_fail@PLT .cfi_endproc .LFE2083: .size _Z24__device_stub__Z3traPiS_PiS_, .-_Z24__device_stub__Z3traPiS_PiS_ .globl _Z3traPiS_ .type _Z3traPiS_, @function _Z3traPiS_: .LFB2084: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z24__device_stub__Z3traPiS_PiS_ addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2084: .size _Z3traPiS_, .-_Z3traPiS_ .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "error: expected %d, got %d!\n" .text .globl main .type main, @function main: .LFB2058: .cfi_startproc endbr64 pushq %r15 .cfi_def_cfa_offset 16 .cfi_offset 15, -16 pushq %r14 .cfi_def_cfa_offset 24 .cfi_offset 14, -24 pushq %r13 .cfi_def_cfa_offset 32 .cfi_offset 13, -32 pushq %r12 .cfi_def_cfa_offset 40 .cfi_offset 12, -40 pushq %rbp .cfi_def_cfa_offset 48 .cfi_offset 6, -48 pushq %rbx .cfi_def_cfa_offset 56 .cfi_offset 3, -56 subq $56, %rsp .cfi_def_cfa_offset 112 movq %fs:40, %rax movq %rax, 40(%rsp) xorl %eax, %eax movq %rsp, %rdi movl $16777216, %esi call cudaMalloc@PLT leaq 8(%rsp), %rdi movl $16777216, %esi call cudaMalloc@PLT movl $16777216, %edi call malloc@PLT movq %rax, %r14 movl $16777216, %edi call malloc@PLT movq %rax, %rbp movl $16777216, %edi call malloc@PLT movq %rax, %r12 movl $4194304, %esi movq %r14, %rdi call _Z11random_intsPii movl $4194304, %esi movq %rbp, %rdi call _Z11random_intsPii movl $1, %ecx movl $16777216, %edx movq %r14, %rsi movq (%rsp), %rdi call cudaMemcpy@PLT movl $1, %ecx movl $16777216, %edx movq %rbp, %rsi movq 8(%rsp), %rdi call cudaMemcpy@PLT movl $512, 28(%rsp) movl $1, 32(%rsp) movl $8192, 16(%rsp) movl $1, 20(%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 .L29 .L20: movl $2, %ecx movl $16777216, %edx movq 8(%rsp), %rsi movq %rbp, %rdi call cudaMemcpy@PLT movl $8192, %ebx movl $0, %r13d leaq .LC0(%rip), %r15 jmp .L21 .L29: movq 8(%rsp), %rsi movq (%rsp), %rdi call _Z24__device_stub__Z3traPiS_PiS_ jmp .L20 .L30: movl %esi, %ecx movq %r15, %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT .L23: addq $1, %r13 addq $8192, %rbx cmpq $2048, %r13 je .L25 .L21: leaq (%r14,%r13,4), %rcx movq %r13, %rax salq $13, %rax .L24: movl (%rcx), %edx movl %edx, (%r12,%rax) movl 0(%rbp,%rax), %esi cmpl %esi, %edx jne .L30 addq $8192, %rcx addq $4, %rax cmpq %rbx, %rax jne .L24 jmp .L23 .L25: movq %r14, %rdi call free@PLT movq %rbp, %rdi call free@PLT movq %r12, %rdi call free@PLT movq (%rsp), %rdi call cudaFree@PLT movq 8(%rsp), %rdi call cudaFree@PLT movq 40(%rsp), %rax subq %fs:40, %rax jne .L31 movl $0, %eax addq $56, %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 .L31: .cfi_restore_state call __stack_chk_fail@PLT .cfi_endproc .LFE2058: .size main, .-main .section .rodata.str1.1 .LC1: .string "_Z3traPiS_" .text .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB2086: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 leaq _ZL15__fatDeviceText(%rip), %rdi call __cudaRegisterFatBinary@PLT movq %rax, %rdi movq %rax, _ZL20__cudaFatCubinHandle(%rip) pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 pushq $0 .cfi_def_cfa_offset 40 pushq $0 .cfi_def_cfa_offset 48 movl $0, %r9d movl $-1, %r8d leaq .LC1(%rip), %rdx movq %rdx, %rcx leaq _Z3traPiS_(%rip), %rsi call __cudaRegisterFunction@PLT addq $32, %rsp .cfi_def_cfa_offset 16 movq _ZL20__cudaFatCubinHandle(%rip), %rdi call __cudaRegisterFatBinaryEnd@PLT leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi call atexit@PLT addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2086: .size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv .section .init_array,"aw" .align 8 .quad _ZL24__sti____cudaRegisterAllv .section .nvFatBinSegment,"aw" .align 8 .type _ZL15__fatDeviceText, @object .size _ZL15__fatDeviceText, 24 _ZL15__fatDeviceText: .long 1180844977 .long 1 .quad fatbinData .quad 0 .local _ZL20__cudaFatCubinHandle .comm _ZL20__cudaFatCubinHandle,8,8 .ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4:
You are a helpful coding assistant specialized in converting CUDA source code to HIP/AMD source code.
#include <stdio.h> #include <math.h> #define N (2048*2048) #define THREAD_PER_BLOCK 512 __global__ void tra( int *a, int *b) { int i = blockIdx.x/4; int j = (blockIdx.x%4) * blockDim.x + threadIdx.x; b[i*2048+j] = a[j*2048+i]; } void random_ints(int *p, int n) { int i; for(i=0; i<n; i++) { p[i]=rand(); } } int main( void ) { int *a, *b, *c; // host copies of a, b, c int *dev_a, *dev_b; // device copies of a, b, c int size = N * sizeof( int ); // we need space for N // integers int i, j; // allocate device copies of a, b cudaMalloc( (void**)&dev_a, size ); cudaMalloc( (void**)&dev_b, size ); a = (int*)malloc( size ); b = (int*)malloc( size ); c = (int*)malloc( size ); random_ints( a, N ); random_ints( b, N ); // copy inputs to device cudaMemcpy( dev_a, a, size, cudaMemcpyHostToDevice ); cudaMemcpy( dev_b, b, size, cudaMemcpyHostToDevice ); // launch an rev() kernel with N threads tra<<< N/THREAD_PER_BLOCK, THREAD_PER_BLOCK >>>( dev_a, dev_b); // copy device result back to host copy of c cudaMemcpy( b, dev_b, size, cudaMemcpyDeviceToHost ); for(i=0; i<2048; i++) { for(j=0; j<2048; j++) { c[i*2048+j] = a[j*2048+i]; if(b[i*2048+j]!=c[i*2048+j]) { printf("error: expected %d, got %d!\n",c[i*2048+j], b[i*2048+j]); break; } } } if(i==N) {printf("correct!\n");} free( a ); free( b ); free( c ); cudaFree( dev_a ); cudaFree( dev_b ); return 0; }
#include <hip/hip_runtime.h> #include <stdio.h> #include <math.h> #define N (2048*2048) #define THREAD_PER_BLOCK 512 __global__ void tra( int *a, int *b) { int i = blockIdx.x/4; int j = (blockIdx.x%4) * blockDim.x + threadIdx.x; b[i*2048+j] = a[j*2048+i]; } void random_ints(int *p, int n) { int i; for(i=0; i<n; i++) { p[i]=rand(); } } int main( void ) { int *a, *b, *c; // host copies of a, b, c int *dev_a, *dev_b; // device copies of a, b, c int size = N * sizeof( int ); // we need space for N // integers int i, j; // allocate device copies of a, b hipMalloc( (void**)&dev_a, size ); hipMalloc( (void**)&dev_b, size ); a = (int*)malloc( size ); b = (int*)malloc( size ); c = (int*)malloc( size ); random_ints( a, N ); random_ints( b, N ); // copy inputs to device hipMemcpy( dev_a, a, size, hipMemcpyHostToDevice ); hipMemcpy( dev_b, b, size, hipMemcpyHostToDevice ); // launch an rev() kernel with N threads tra<<< N/THREAD_PER_BLOCK, THREAD_PER_BLOCK >>>( dev_a, dev_b); // copy device result back to host copy of c hipMemcpy( b, dev_b, size, hipMemcpyDeviceToHost ); for(i=0; i<2048; i++) { for(j=0; j<2048; j++) { c[i*2048+j] = a[j*2048+i]; if(b[i*2048+j]!=c[i*2048+j]) { printf("error: expected %d, got %d!\n",c[i*2048+j], b[i*2048+j]); break; } } } if(i==N) {printf("correct!\n");} free( a ); free( b ); free( c ); hipFree( dev_a ); hipFree( dev_b ); 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 <math.h> #define N (2048*2048) #define THREAD_PER_BLOCK 512 __global__ void tra( int *a, int *b) { int i = blockIdx.x/4; int j = (blockIdx.x%4) * blockDim.x + threadIdx.x; b[i*2048+j] = a[j*2048+i]; } void random_ints(int *p, int n) { int i; for(i=0; i<n; i++) { p[i]=rand(); } } int main( void ) { int *a, *b, *c; // host copies of a, b, c int *dev_a, *dev_b; // device copies of a, b, c int size = N * sizeof( int ); // we need space for N // integers int i, j; // allocate device copies of a, b hipMalloc( (void**)&dev_a, size ); hipMalloc( (void**)&dev_b, size ); a = (int*)malloc( size ); b = (int*)malloc( size ); c = (int*)malloc( size ); random_ints( a, N ); random_ints( b, N ); // copy inputs to device hipMemcpy( dev_a, a, size, hipMemcpyHostToDevice ); hipMemcpy( dev_b, b, size, hipMemcpyHostToDevice ); // launch an rev() kernel with N threads tra<<< N/THREAD_PER_BLOCK, THREAD_PER_BLOCK >>>( dev_a, dev_b); // copy device result back to host copy of c hipMemcpy( b, dev_b, size, hipMemcpyDeviceToHost ); for(i=0; i<2048; i++) { for(j=0; j<2048; j++) { c[i*2048+j] = a[j*2048+i]; if(b[i*2048+j]!=c[i*2048+j]) { printf("error: expected %d, got %d!\n",c[i*2048+j], b[i*2048+j]); break; } } } if(i==N) {printf("correct!\n");} free( a ); free( b ); free( c ); hipFree( dev_a ); hipFree( dev_b ); return 0; }
.text .amdgcn_target "amdgcn-amd-amdhsa--gfx1100" .protected _Z3traPiS_ .globl _Z3traPiS_ .p2align 8 .type _Z3traPiS_,@function _Z3traPiS_: s_clause 0x1 s_load_b32 s4, s[0:1], 0x1c s_load_b128 s[0:3], s[0:1], 0x0 s_and_b32 s5, s15, 3 v_mov_b32_e32 v3, 0 s_waitcnt lgkmcnt(0) s_and_b32 s4, s4, 0xffff s_delay_alu instid0(SALU_CYCLE_1) v_mad_u64_u32 v[1:2], null, s5, s4, v[0:1] s_lshr_b32 s4, s15, 2 s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1) v_lshl_add_u32 v2, v1, 11, s4 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_lshlrev_b64 v[4:5], 2, v[2:3] v_lshl_add_u32 v2, s4, 11, v1 v_lshlrev_b64 v[0:1], 2, v[2:3] s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_4) v_add_co_u32 v4, vcc_lo, s0, v4 v_add_co_ci_u32_e32 v5, vcc_lo, s1, v5, vcc_lo s_delay_alu instid0(VALU_DEP_3) v_add_co_u32 v0, vcc_lo, s2, v0 global_load_b32 v4, v[4:5], off v_add_co_ci_u32_e32 v1, vcc_lo, s3, v1, vcc_lo s_waitcnt vmcnt(0) global_store_b32 v[0:1], v4, off s_nop 0 s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z3traPiS_ .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 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 _Z3traPiS_, .Lfunc_end0-_Z3traPiS_ .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: _Z3traPiS_ .private_segment_fixed_size: 0 .sgpr_count: 18 .sgpr_spill_count: 0 .symbol: _Z3traPiS_.kd .uniform_work_group_size: 1 .uses_dynamic_stack: false .vgpr_count: 6 .vgpr_spill_count: 0 .wavefront_size: 32 .workgroup_processor_mode: 1 amdhsa.target: amdgcn-amd-amdhsa--gfx1100 amdhsa.version: - 1 - 2 ... .end_amdgpu_metadata
You are a helpful coding assistant specialized in converting HIP source code to AMD host assembly.
#include <hip/hip_runtime.h> #include <stdio.h> #include <math.h> #define N (2048*2048) #define THREAD_PER_BLOCK 512 __global__ void tra( int *a, int *b) { int i = blockIdx.x/4; int j = (blockIdx.x%4) * blockDim.x + threadIdx.x; b[i*2048+j] = a[j*2048+i]; } void random_ints(int *p, int n) { int i; for(i=0; i<n; i++) { p[i]=rand(); } } int main( void ) { int *a, *b, *c; // host copies of a, b, c int *dev_a, *dev_b; // device copies of a, b, c int size = N * sizeof( int ); // we need space for N // integers int i, j; // allocate device copies of a, b hipMalloc( (void**)&dev_a, size ); hipMalloc( (void**)&dev_b, size ); a = (int*)malloc( size ); b = (int*)malloc( size ); c = (int*)malloc( size ); random_ints( a, N ); random_ints( b, N ); // copy inputs to device hipMemcpy( dev_a, a, size, hipMemcpyHostToDevice ); hipMemcpy( dev_b, b, size, hipMemcpyHostToDevice ); // launch an rev() kernel with N threads tra<<< N/THREAD_PER_BLOCK, THREAD_PER_BLOCK >>>( dev_a, dev_b); // copy device result back to host copy of c hipMemcpy( b, dev_b, size, hipMemcpyDeviceToHost ); for(i=0; i<2048; i++) { for(j=0; j<2048; j++) { c[i*2048+j] = a[j*2048+i]; if(b[i*2048+j]!=c[i*2048+j]) { printf("error: expected %d, got %d!\n",c[i*2048+j], b[i*2048+j]); break; } } } if(i==N) {printf("correct!\n");} free( a ); free( b ); free( c ); hipFree( dev_a ); hipFree( dev_b ); return 0; }
.text .file "matrix_transp.hip" .globl _Z18__device_stub__traPiS_ # -- Begin function _Z18__device_stub__traPiS_ .p2align 4, 0x90 .type _Z18__device_stub__traPiS_,@function _Z18__device_stub__traPiS_: # @_Z18__device_stub__traPiS_ .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 $_Z3traPiS_, %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 _Z18__device_stub__traPiS_, .Lfunc_end0-_Z18__device_stub__traPiS_ .cfi_endproc # -- End function .globl _Z11random_intsPii # -- Begin function _Z11random_intsPii .p2align 4, 0x90 .type _Z11random_intsPii,@function _Z11random_intsPii: # @_Z11random_intsPii .cfi_startproc # %bb.0: testl %esi, %esi jle .LBB1_4 # %bb.1: # %.lr.ph.preheader pushq %r15 .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 %r15, -16 movq %rdi, %rbx movl %esi, %r14d xorl %r15d, %r15d .p2align 4, 0x90 .LBB1_2: # %.lr.ph # =>This Inner Loop Header: Depth=1 callq rand movl %eax, (%rbx,%r15,4) incq %r15 cmpq %r15, %r14 jne .LBB1_2 # %bb.3: popq %rbx .cfi_def_cfa_offset 24 popq %r14 .cfi_def_cfa_offset 16 popq %r15 .cfi_def_cfa_offset 8 .cfi_restore %rbx .cfi_restore %r14 .cfi_restore %r15 .LBB1_4: # %._crit_edge retq .Lfunc_end1: .size _Z11random_intsPii, .Lfunc_end1-_Z11random_intsPii .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 %r13 .cfi_def_cfa_offset 32 pushq %r12 .cfi_def_cfa_offset 40 pushq %rbx .cfi_def_cfa_offset 48 subq $96, %rsp .cfi_def_cfa_offset 144 .cfi_offset %rbx, -48 .cfi_offset %r12, -40 .cfi_offset %r13, -32 .cfi_offset %r14, -24 .cfi_offset %r15, -16 leaq 8(%rsp), %rdi movl $16777216, %esi # imm = 0x1000000 callq hipMalloc movq %rsp, %rdi movl $16777216, %esi # imm = 0x1000000 callq hipMalloc movl $16777216, %edi # imm = 0x1000000 callq malloc movq %rax, %rbx movl $16777216, %edi # imm = 0x1000000 callq malloc movq %rax, %r14 xorl %r15d, %r15d .p2align 4, 0x90 .LBB2_1: # %.lr.ph.i # =>This Inner Loop Header: Depth=1 callq rand movl %eax, (%rbx,%r15,4) incq %r15 cmpq $4194304, %r15 # imm = 0x400000 jne .LBB2_1 # %bb.2: # %.lr.ph.i44.preheader xorl %r15d, %r15d .p2align 4, 0x90 .LBB2_3: # %.lr.ph.i44 # =>This Inner Loop Header: Depth=1 callq rand movl %eax, (%r14,%r15,4) incq %r15 cmpq $4194304, %r15 # imm = 0x400000 jne .LBB2_3 # %bb.4: # %_Z11random_intsPii.exit48 movq 8(%rsp), %rdi movl $16777216, %edx # imm = 0x1000000 movq %rbx, %rsi movl $1, %ecx callq hipMemcpy movq (%rsp), %rdi movl $16777216, %edx # imm = 0x1000000 movq %r14, %rsi movl $1, %ecx callq hipMemcpy movabsq $4294967808, %rdx # imm = 0x100000200 leaq 7680(%rdx), %rdi movl $1, %esi movl $1, %ecx xorl %r8d, %r8d xorl %r9d, %r9d callq __hipPushCallConfiguration testl %eax, %eax jne .LBB2_6 # %bb.5: movq 8(%rsp), %rax movq (%rsp), %rcx movq %rax, 72(%rsp) movq %rcx, 64(%rsp) leaq 72(%rsp), %rax movq %rax, 80(%rsp) leaq 64(%rsp), %rax movq %rax, 88(%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 $_Z3traPiS_, %edi pushq 16(%rsp) .cfi_adjust_cfa_offset 8 pushq 32(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $16, %rsp .cfi_adjust_cfa_offset -16 .LBB2_6: movq (%rsp), %rsi movl $16777216, %edx # imm = 0x1000000 movq %r14, %rdi movl $2, %ecx callq hipMemcpy movq %rbx, %r15 movq %r14, %r12 xorl %r13d, %r13d jmp .LBB2_7 .p2align 4, 0x90 .LBB2_10: # in Loop: Header=BB2_7 Depth=1 movl $.L.str, %edi xorl %eax, %eax callq printf .LBB2_11: # %.loopexit # in Loop: Header=BB2_7 Depth=1 incq %r13 addq $8192, %r12 # imm = 0x2000 addq $4, %r15 cmpq $2048, %r13 # imm = 0x800 je .LBB2_12 .LBB2_7: # %.preheader # =>This Loop Header: Depth=1 # Child Loop BB2_9 Depth 2 movq %r15, %rax xorl %ecx, %ecx .p2align 4, 0x90 .LBB2_9: # Parent Loop BB2_7 Depth=1 # => This Inner Loop Header: Depth=2 movl (%rax), %esi movl (%r12,%rcx,4), %edx cmpl %esi, %edx jne .LBB2_10 # %bb.8: # in Loop: Header=BB2_9 Depth=2 incq %rcx addq $8192, %rax # imm = 0x2000 cmpq $2048, %rcx # imm = 0x800 jne .LBB2_9 jmp .LBB2_11 .LBB2_12: movq %rbx, %rdi callq free movq %r14, %rdi callq free movq 8(%rsp), %rdi callq hipFree movq (%rsp), %rdi callq hipFree xorl %eax, %eax addq $96, %rsp .cfi_def_cfa_offset 48 popq %rbx .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 retq .Lfunc_end2: .size main, .Lfunc_end2-main .cfi_endproc # -- End function .p2align 4, 0x90 # -- Begin function __hip_module_ctor .type __hip_module_ctor,@function __hip_module_ctor: # @__hip_module_ctor .cfi_startproc # %bb.0: subq $40, %rsp .cfi_def_cfa_offset 48 cmpq $0, __hip_gpubin_handle(%rip) jne .LBB3_2 # %bb.1: movl $__hip_fatbin_wrapper, %edi callq __hipRegisterFatBinary movq %rax, __hip_gpubin_handle(%rip) .LBB3_2: movq __hip_gpubin_handle(%rip), %rdi xorps %xmm0, %xmm0 movups %xmm0, 16(%rsp) movups %xmm0, (%rsp) movl $_Z3traPiS_, %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 _Z3traPiS_,@object # @_Z3traPiS_ .section .rodata,"a",@progbits .globl _Z3traPiS_ .p2align 3, 0x0 _Z3traPiS_: .quad _Z18__device_stub__traPiS_ .size _Z3traPiS_, 8 .type .L.str,@object # @.str .section .rodata.str1.1,"aMS",@progbits,1 .L.str: .asciz "error: expected %d, got %d!\n" .size .L.str, 29 .type .L__unnamed_1,@object # @0 .L__unnamed_1: .asciz "_Z3traPiS_" .size .L__unnamed_1, 11 .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__traPiS_ .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z3traPiS_ .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 : _Z3traPiS_ .headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)" /*0000*/ MOV R1, c[0x0][0x28] ; /* 0x00000a0000017a02 */ /* 0x000fe40000000f00 */ /*0010*/ S2R R2, SR_CTAID.X ; /* 0x0000000000027919 */ /* 0x000e220000002500 */ /*0020*/ HFMA2.MMA R4, -RZ, RZ, 0, 2.384185791015625e-07 ; /* 0x00000004ff047435 */ /* 0x000fe200000001ff */ /*0030*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */ /* 0x000fe40000000a00 */ /*0040*/ S2R R5, SR_TID.X ; /* 0x0000000000057919 */ /* 0x000e620000002100 */ /*0050*/ LOP3.LUT R0, R2, 0x3, RZ, 0xc0, !PT ; /* 0x0000000302007812 */ /* 0x001fca00078ec0ff */ /*0060*/ IMAD R5, R0, c[0x0][0x0], R5 ; /* 0x0000000000057a24 */ /* 0x002fe200078e0205 */ /*0070*/ SHF.R.U32.HI R0, RZ, 0x2, R2 ; /* 0x00000002ff007819 */ /* 0x000fc80000011602 */ /*0080*/ LEA R2, R5, R0, 0xb ; /* 0x0000000005027211 */ /* 0x000fca00078e58ff */ /*0090*/ IMAD.WIDE R2, R2, R4, c[0x0][0x160] ; /* 0x0000580002027625 */ /* 0x000fcc00078e0204 */ /*00a0*/ LDG.E R3, [R2.64] ; /* 0x0000000402037981 */ /* 0x000ea2000c1e1900 */ /*00b0*/ LEA R5, R0, R5, 0xb ; /* 0x0000000500057211 */ /* 0x000fca00078e58ff */ /*00c0*/ IMAD.WIDE R4, R5, R4, c[0x0][0x168] ; /* 0x00005a0005047625 */ /* 0x000fca00078e0204 */ /*00d0*/ STG.E [R4.64], R3 ; /* 0x0000000304007986 */ /* 0x004fe2000c101904 */ /*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 _Z3traPiS_ .globl _Z3traPiS_ .p2align 8 .type _Z3traPiS_,@function _Z3traPiS_: s_clause 0x1 s_load_b32 s4, s[0:1], 0x1c s_load_b128 s[0:3], s[0:1], 0x0 s_and_b32 s5, s15, 3 v_mov_b32_e32 v3, 0 s_waitcnt lgkmcnt(0) s_and_b32 s4, s4, 0xffff s_delay_alu instid0(SALU_CYCLE_1) v_mad_u64_u32 v[1:2], null, s5, s4, v[0:1] s_lshr_b32 s4, s15, 2 s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1) v_lshl_add_u32 v2, v1, 11, s4 s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1) v_lshlrev_b64 v[4:5], 2, v[2:3] v_lshl_add_u32 v2, s4, 11, v1 v_lshlrev_b64 v[0:1], 2, v[2:3] s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_4) v_add_co_u32 v4, vcc_lo, s0, v4 v_add_co_ci_u32_e32 v5, vcc_lo, s1, v5, vcc_lo s_delay_alu instid0(VALU_DEP_3) v_add_co_u32 v0, vcc_lo, s2, v0 global_load_b32 v4, v[4:5], off v_add_co_ci_u32_e32 v1, vcc_lo, s3, v1, vcc_lo s_waitcnt vmcnt(0) global_store_b32 v[0:1], v4, off s_nop 0 s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z3traPiS_ .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 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 _Z3traPiS_, .Lfunc_end0-_Z3traPiS_ .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: _Z3traPiS_ .private_segment_fixed_size: 0 .sgpr_count: 18 .sgpr_spill_count: 0 .symbol: _Z3traPiS_.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_0006545f_00000000-6_matrix_transp.cudafe1.cpp" .text #APP #NO_APP .type _ZL26__cudaUnregisterBinaryUtilv, @function _ZL26__cudaUnregisterBinaryUtilv: .LFB2061: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 movq _ZL20__cudaFatCubinHandle(%rip), %rdi call __cudaUnregisterFatBinary@PLT addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2061: .size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv .globl _Z11random_intsPii .type _Z11random_intsPii, @function _Z11random_intsPii: .LFB2057: .cfi_startproc endbr64 testl %esi, %esi jle .L8 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 pushq %rbx .cfi_def_cfa_offset 24 .cfi_offset 3, -24 subq $8, %rsp .cfi_def_cfa_offset 32 movq %rdi, %rbx movslq %esi, %rsi leaq (%rdi,%rsi,4), %rbp .L5: call rand@PLT movl %eax, (%rbx) addq $4, %rbx cmpq %rbp, %rbx jne .L5 addq $8, %rsp .cfi_def_cfa_offset 24 popq %rbx .cfi_def_cfa_offset 16 popq %rbp .cfi_def_cfa_offset 8 ret .L8: .cfi_restore 3 .cfi_restore 6 ret .cfi_endproc .LFE2057: .size _Z11random_intsPii, .-_Z11random_intsPii .globl _Z24__device_stub__Z3traPiS_PiS_ .type _Z24__device_stub__Z3traPiS_PiS_, @function _Z24__device_stub__Z3traPiS_PiS_: .LFB2083: .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 .L15 .L11: movq 104(%rsp), %rax subq %fs:40, %rax jne .L16 addq $120, %rsp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L15: .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 _Z3traPiS_(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 128 jmp .L11 .L16: call __stack_chk_fail@PLT .cfi_endproc .LFE2083: .size _Z24__device_stub__Z3traPiS_PiS_, .-_Z24__device_stub__Z3traPiS_PiS_ .globl _Z3traPiS_ .type _Z3traPiS_, @function _Z3traPiS_: .LFB2084: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z24__device_stub__Z3traPiS_PiS_ addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2084: .size _Z3traPiS_, .-_Z3traPiS_ .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "error: expected %d, got %d!\n" .text .globl main .type main, @function main: .LFB2058: .cfi_startproc endbr64 pushq %r15 .cfi_def_cfa_offset 16 .cfi_offset 15, -16 pushq %r14 .cfi_def_cfa_offset 24 .cfi_offset 14, -24 pushq %r13 .cfi_def_cfa_offset 32 .cfi_offset 13, -32 pushq %r12 .cfi_def_cfa_offset 40 .cfi_offset 12, -40 pushq %rbp .cfi_def_cfa_offset 48 .cfi_offset 6, -48 pushq %rbx .cfi_def_cfa_offset 56 .cfi_offset 3, -56 subq $56, %rsp .cfi_def_cfa_offset 112 movq %fs:40, %rax movq %rax, 40(%rsp) xorl %eax, %eax movq %rsp, %rdi movl $16777216, %esi call cudaMalloc@PLT leaq 8(%rsp), %rdi movl $16777216, %esi call cudaMalloc@PLT movl $16777216, %edi call malloc@PLT movq %rax, %r14 movl $16777216, %edi call malloc@PLT movq %rax, %rbp movl $16777216, %edi call malloc@PLT movq %rax, %r12 movl $4194304, %esi movq %r14, %rdi call _Z11random_intsPii movl $4194304, %esi movq %rbp, %rdi call _Z11random_intsPii movl $1, %ecx movl $16777216, %edx movq %r14, %rsi movq (%rsp), %rdi call cudaMemcpy@PLT movl $1, %ecx movl $16777216, %edx movq %rbp, %rsi movq 8(%rsp), %rdi call cudaMemcpy@PLT movl $512, 28(%rsp) movl $1, 32(%rsp) movl $8192, 16(%rsp) movl $1, 20(%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 .L29 .L20: movl $2, %ecx movl $16777216, %edx movq 8(%rsp), %rsi movq %rbp, %rdi call cudaMemcpy@PLT movl $8192, %ebx movl $0, %r13d leaq .LC0(%rip), %r15 jmp .L21 .L29: movq 8(%rsp), %rsi movq (%rsp), %rdi call _Z24__device_stub__Z3traPiS_PiS_ jmp .L20 .L30: movl %esi, %ecx movq %r15, %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT .L23: addq $1, %r13 addq $8192, %rbx cmpq $2048, %r13 je .L25 .L21: leaq (%r14,%r13,4), %rcx movq %r13, %rax salq $13, %rax .L24: movl (%rcx), %edx movl %edx, (%r12,%rax) movl 0(%rbp,%rax), %esi cmpl %esi, %edx jne .L30 addq $8192, %rcx addq $4, %rax cmpq %rbx, %rax jne .L24 jmp .L23 .L25: movq %r14, %rdi call free@PLT movq %rbp, %rdi call free@PLT movq %r12, %rdi call free@PLT movq (%rsp), %rdi call cudaFree@PLT movq 8(%rsp), %rdi call cudaFree@PLT movq 40(%rsp), %rax subq %fs:40, %rax jne .L31 movl $0, %eax addq $56, %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 .L31: .cfi_restore_state call __stack_chk_fail@PLT .cfi_endproc .LFE2058: .size main, .-main .section .rodata.str1.1 .LC1: .string "_Z3traPiS_" .text .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB2086: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 leaq _ZL15__fatDeviceText(%rip), %rdi call __cudaRegisterFatBinary@PLT movq %rax, %rdi movq %rax, _ZL20__cudaFatCubinHandle(%rip) pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 pushq $0 .cfi_def_cfa_offset 40 pushq $0 .cfi_def_cfa_offset 48 movl $0, %r9d movl $-1, %r8d leaq .LC1(%rip), %rdx movq %rdx, %rcx leaq _Z3traPiS_(%rip), %rsi call __cudaRegisterFunction@PLT addq $32, %rsp .cfi_def_cfa_offset 16 movq _ZL20__cudaFatCubinHandle(%rip), %rdi call __cudaRegisterFatBinaryEnd@PLT leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi call atexit@PLT addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2086: .size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv .section .init_array,"aw" .align 8 .quad _ZL24__sti____cudaRegisterAllv .section .nvFatBinSegment,"aw" .align 8 .type _ZL15__fatDeviceText, @object .size _ZL15__fatDeviceText, 24 _ZL15__fatDeviceText: .long 1180844977 .long 1 .quad fatbinData .quad 0 .local _ZL20__cudaFatCubinHandle .comm _ZL20__cudaFatCubinHandle,8,8 .ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4:
.text .file "matrix_transp.hip" .globl _Z18__device_stub__traPiS_ # -- Begin function _Z18__device_stub__traPiS_ .p2align 4, 0x90 .type _Z18__device_stub__traPiS_,@function _Z18__device_stub__traPiS_: # @_Z18__device_stub__traPiS_ .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 $_Z3traPiS_, %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 _Z18__device_stub__traPiS_, .Lfunc_end0-_Z18__device_stub__traPiS_ .cfi_endproc # -- End function .globl _Z11random_intsPii # -- Begin function _Z11random_intsPii .p2align 4, 0x90 .type _Z11random_intsPii,@function _Z11random_intsPii: # @_Z11random_intsPii .cfi_startproc # %bb.0: testl %esi, %esi jle .LBB1_4 # %bb.1: # %.lr.ph.preheader pushq %r15 .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 %r15, -16 movq %rdi, %rbx movl %esi, %r14d xorl %r15d, %r15d .p2align 4, 0x90 .LBB1_2: # %.lr.ph # =>This Inner Loop Header: Depth=1 callq rand movl %eax, (%rbx,%r15,4) incq %r15 cmpq %r15, %r14 jne .LBB1_2 # %bb.3: popq %rbx .cfi_def_cfa_offset 24 popq %r14 .cfi_def_cfa_offset 16 popq %r15 .cfi_def_cfa_offset 8 .cfi_restore %rbx .cfi_restore %r14 .cfi_restore %r15 .LBB1_4: # %._crit_edge retq .Lfunc_end1: .size _Z11random_intsPii, .Lfunc_end1-_Z11random_intsPii .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 %r13 .cfi_def_cfa_offset 32 pushq %r12 .cfi_def_cfa_offset 40 pushq %rbx .cfi_def_cfa_offset 48 subq $96, %rsp .cfi_def_cfa_offset 144 .cfi_offset %rbx, -48 .cfi_offset %r12, -40 .cfi_offset %r13, -32 .cfi_offset %r14, -24 .cfi_offset %r15, -16 leaq 8(%rsp), %rdi movl $16777216, %esi # imm = 0x1000000 callq hipMalloc movq %rsp, %rdi movl $16777216, %esi # imm = 0x1000000 callq hipMalloc movl $16777216, %edi # imm = 0x1000000 callq malloc movq %rax, %rbx movl $16777216, %edi # imm = 0x1000000 callq malloc movq %rax, %r14 xorl %r15d, %r15d .p2align 4, 0x90 .LBB2_1: # %.lr.ph.i # =>This Inner Loop Header: Depth=1 callq rand movl %eax, (%rbx,%r15,4) incq %r15 cmpq $4194304, %r15 # imm = 0x400000 jne .LBB2_1 # %bb.2: # %.lr.ph.i44.preheader xorl %r15d, %r15d .p2align 4, 0x90 .LBB2_3: # %.lr.ph.i44 # =>This Inner Loop Header: Depth=1 callq rand movl %eax, (%r14,%r15,4) incq %r15 cmpq $4194304, %r15 # imm = 0x400000 jne .LBB2_3 # %bb.4: # %_Z11random_intsPii.exit48 movq 8(%rsp), %rdi movl $16777216, %edx # imm = 0x1000000 movq %rbx, %rsi movl $1, %ecx callq hipMemcpy movq (%rsp), %rdi movl $16777216, %edx # imm = 0x1000000 movq %r14, %rsi movl $1, %ecx callq hipMemcpy movabsq $4294967808, %rdx # imm = 0x100000200 leaq 7680(%rdx), %rdi movl $1, %esi movl $1, %ecx xorl %r8d, %r8d xorl %r9d, %r9d callq __hipPushCallConfiguration testl %eax, %eax jne .LBB2_6 # %bb.5: movq 8(%rsp), %rax movq (%rsp), %rcx movq %rax, 72(%rsp) movq %rcx, 64(%rsp) leaq 72(%rsp), %rax movq %rax, 80(%rsp) leaq 64(%rsp), %rax movq %rax, 88(%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 $_Z3traPiS_, %edi pushq 16(%rsp) .cfi_adjust_cfa_offset 8 pushq 32(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $16, %rsp .cfi_adjust_cfa_offset -16 .LBB2_6: movq (%rsp), %rsi movl $16777216, %edx # imm = 0x1000000 movq %r14, %rdi movl $2, %ecx callq hipMemcpy movq %rbx, %r15 movq %r14, %r12 xorl %r13d, %r13d jmp .LBB2_7 .p2align 4, 0x90 .LBB2_10: # in Loop: Header=BB2_7 Depth=1 movl $.L.str, %edi xorl %eax, %eax callq printf .LBB2_11: # %.loopexit # in Loop: Header=BB2_7 Depth=1 incq %r13 addq $8192, %r12 # imm = 0x2000 addq $4, %r15 cmpq $2048, %r13 # imm = 0x800 je .LBB2_12 .LBB2_7: # %.preheader # =>This Loop Header: Depth=1 # Child Loop BB2_9 Depth 2 movq %r15, %rax xorl %ecx, %ecx .p2align 4, 0x90 .LBB2_9: # Parent Loop BB2_7 Depth=1 # => This Inner Loop Header: Depth=2 movl (%rax), %esi movl (%r12,%rcx,4), %edx cmpl %esi, %edx jne .LBB2_10 # %bb.8: # in Loop: Header=BB2_9 Depth=2 incq %rcx addq $8192, %rax # imm = 0x2000 cmpq $2048, %rcx # imm = 0x800 jne .LBB2_9 jmp .LBB2_11 .LBB2_12: movq %rbx, %rdi callq free movq %r14, %rdi callq free movq 8(%rsp), %rdi callq hipFree movq (%rsp), %rdi callq hipFree xorl %eax, %eax addq $96, %rsp .cfi_def_cfa_offset 48 popq %rbx .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 retq .Lfunc_end2: .size main, .Lfunc_end2-main .cfi_endproc # -- End function .p2align 4, 0x90 # -- Begin function __hip_module_ctor .type __hip_module_ctor,@function __hip_module_ctor: # @__hip_module_ctor .cfi_startproc # %bb.0: subq $40, %rsp .cfi_def_cfa_offset 48 cmpq $0, __hip_gpubin_handle(%rip) jne .LBB3_2 # %bb.1: movl $__hip_fatbin_wrapper, %edi callq __hipRegisterFatBinary movq %rax, __hip_gpubin_handle(%rip) .LBB3_2: movq __hip_gpubin_handle(%rip), %rdi xorps %xmm0, %xmm0 movups %xmm0, 16(%rsp) movups %xmm0, (%rsp) movl $_Z3traPiS_, %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 _Z3traPiS_,@object # @_Z3traPiS_ .section .rodata,"a",@progbits .globl _Z3traPiS_ .p2align 3, 0x0 _Z3traPiS_: .quad _Z18__device_stub__traPiS_ .size _Z3traPiS_, 8 .type .L.str,@object # @.str .section .rodata.str1.1,"aMS",@progbits,1 .L.str: .asciz "error: expected %d, got %d!\n" .size .L.str, 29 .type .L__unnamed_1,@object # @0 .L__unnamed_1: .asciz "_Z3traPiS_" .size .L__unnamed_1, 11 .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__traPiS_ .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z3traPiS_ .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 <curand.h> #include <curand_kernel.h> #include <device_launch_parameters.h> #include <device_functions.h> #include <time.h> #include "curisk.cuh" __global__ void generate_vector_sample_kernel(); __global__ void setup_gamma_generator(long seed); __device__ __forceinline__ float generate_gamma_1_1(curandState *state); #define CUDA_CALL(x) do { if((x)!=cudaSuccess) { \ printf("\nError \"%s\" at %s:%d\n", cudaGetErrorString(x), __FILE__, __LINE__);\ exit(EXIT_FAILURE);}} while(0) #define check_error() do { if(cudaGetLastError()!=cudaSuccess) { \ printf("\nError \"%s\" at %s:%d\n", cudaGetErrorString(cudaGetLastError()), __FILE__, __LINE__);\ exit(EXIT_FAILURE);}} while(0) #define ESTIMATED_MAX_DIMENSION 32 __constant__ int c_dimension; __constant__ int c_vector_scheme[ESTIMATED_MAX_DIMENSION]; __constant__ bound_t c_vector_bounds[ESTIMATED_MAX_DIMENSION]; __constant__ ordinal_t c_vector_ordinal[ESTIMATED_MAX_DIMENSION]; __constant__ int c_sample_size; __device__ float *d_vector_sample; __device__ int d_round_sample_size; __device__ float *d_round_vector_sample; __device__ curandState *d_curand_states; __device__ int d_vectors_ready; void generate_vector_sample(sampling_cofiguration_t& conf, sampling_result_t& result, int timeout_rounds) { int start_time_point = clock(); /* Скопируем некоторые поля из conf в константную память. */ conf.log() << "Preparing constant variables." << std::endl; cudaMemcpyToSymbol(c_dimension, &conf.dimension, sizeof(int)); check_error(); cudaMemcpyToSymbol(c_sample_size, &conf.sample_size, sizeof(int)); check_error(); cudaMemcpyToSymbol(c_vector_scheme, conf.vector_scheme, conf.dimension*sizeof(int)); check_error(); cudaMemcpyToSymbol(c_vector_bounds, conf.vector_bounds, conf.dimension*sizeof(bound_t)); check_error(); cudaMemcpyToSymbol(c_vector_ordinal, conf.vector_ordinal, conf.dimension*sizeof(ordinal_t)); check_error(); /* Выделим память для выборки. */ conf.log() << "Allocate memory for vector sample." << std::endl; float *dh_vector_sample; cudaMalloc(&dh_vector_sample, conf.sample_size*conf.dimension*sizeof(float)); check_error(); cudaMemcpyToSymbol(d_vector_sample, &dh_vector_sample, sizeof(dh_vector_sample)); check_error(); /* Выделим память для выборки раунда. */ conf.log() << "Allocate memory for round vector sample." << std::endl; int blocks_per_round = conf.grid_dimension.x; int vectors_per_block = conf.block_dimension.x; int round_sample_size = blocks_per_round*vectors_per_block; cudaMemcpyToSymbol(d_round_sample_size, &round_sample_size, sizeof(int)); check_error(); float *dh_round_vector_sample; cudaMalloc(&dh_round_vector_sample, round_sample_size*conf.dimension*sizeof(float)); check_error(); cudaMemcpyToSymbol(d_round_vector_sample, &dh_round_vector_sample, sizeof(dh_round_vector_sample)); check_error(); /* Настроим генератор случайных чисел. */ conf.log() << "Setup CUDA random numbers generator." << std::endl; curandState *dh_curand_states; cudaMalloc(&dh_curand_states, round_sample_size*sizeof(curandState)); check_error(); cudaMemcpyToSymbol(d_curand_states, &dh_curand_states, sizeof(dh_curand_states)); check_error(); setup_gamma_generator<<<blocks_per_round, vectors_per_block>>>(clock()); check_error(); cudaDeviceSynchronize(); check_error(); /* Число готовых элементов выборки. */ int vectors_ready = 0; cudaMemcpyToSymbol(d_vectors_ready, &vectors_ready, sizeof(vectors_ready)); check_error(); conf.log() << "Start round cycle." << std::endl; int rounds = 0; while (vectors_ready < conf.sample_size) { generate_vector_sample_kernel<<<blocks_per_round, vectors_per_block>>>(); CUDA_CALL(cudaDeviceSynchronize()); cudaMemcpyFromSymbol(&vectors_ready, d_vectors_ready, sizeof(vectors_ready)); check_error(); rounds++; if (rounds > timeout_rounds) { conf.log() << "Round cycle is terminated (timeout)." << std::endl; result.generated_vectors_number = vectors_ready; result.error = SAMPLING_TIMEOUT; break; } } conf.log() << "Stop round cycle." << std::endl; conf.log() << "Vectors generated: " << vectors_ready << "/" << conf.sample_size << "." << std::endl; if (vectors_ready < conf.sample_size) { cudaMemcpy(result.vector_sample, dh_vector_sample, vectors_ready*conf.dimension*sizeof(float), cudaMemcpyDeviceToHost); check_error(); } else { cudaMemcpy(result.vector_sample, dh_vector_sample, conf.sample_size*conf.dimension*sizeof(float), cudaMemcpyDeviceToHost); check_error(); } cudaFree(dh_vector_sample); cudaFree(dh_round_vector_sample); cudaFree(dh_curand_states); int end_time_point = clock(); float elapsed_time = ((float) (end_time_point - start_time_point))/CLOCKS_PER_SEC; conf.log() << "Elapsed time: " << elapsed_time << " s." << std::endl; result.elapsed_time = elapsed_time; } __global__ void generate_vector_sample_kernel() { int idx = blockIdx.x*blockDim.x + threadIdx.x; int dimension = c_dimension; int i; float value; float than_value; float sum = 0; int last_vectors_ready; ordinal_t ordinal; bound_t bound; bool eliminate = false; for (i = 0; i < dimension; i++) { if (c_vector_scheme[i] == 0) value = 0; else value = generate_gamma_1_1(d_curand_states + idx); sum += value; d_round_vector_sample[dimension*idx + i] = value; } if (sum != 0) { for (i = 0; i < dimension; i++) { value = d_round_vector_sample[dimension*idx + i]; value /= sum; d_round_vector_sample[dimension*idx + i] = value; bound = c_vector_bounds[i]; eliminate = eliminate || value < bound.left || value > bound.right; } for (i = 0; i < dimension; i++) { value = d_round_vector_sample[dimension*idx + i]; ordinal = c_vector_ordinal[i]; than_value = d_round_vector_sample[dimension*idx + ordinal.than_index]; eliminate = eliminate || (ordinal.ordinal == ORDINAL_LESS && value >= than_value) || (ordinal.ordinal == ORDINAL_MORE && value <= than_value); } } if (!eliminate) { last_vectors_ready = atomicAdd(&d_vectors_ready, 1); if (last_vectors_ready < c_sample_size) { for (i = 0; i < dimension; i++) d_vector_sample[dimension*last_vectors_ready + i] = d_round_vector_sample[dimension*idx + i]; } } } __global__ void setup_gamma_generator(long seed) { int tid = threadIdx.x + blockIdx.x*blockDim.x; if (tid < d_round_sample_size) curand_init(seed, tid, 0, &d_curand_states[tid]); } /* * Функция генерирует случайную величину с распределением Gamma(1,1). */ __device__ __forceinline__ float generate_gamma_1_1(curandState *state) { curandState localState = *state; float c, z, u, v, result; c = 1/sqrtf(9*2/3.); do { z = curand_normal(&localState); u = curand_uniform(&localState); v = powf(1 + c*z, 3); } while (z <= (-1/c) || logf(u) >= (0.5*z*z + 2/3. - (2/3.)*v + (2/3.)*logf(v))); result = (2/3.)*v; *state = localState; return result; }
.file "tmpxft_000e0a29_00000000-6_curisk.cudafe1.cpp" .text #APP .globl _ZSt21ios_base_library_initv #NO_APP .type _ZL26__cudaUnregisterBinaryUtilv, @function _ZL26__cudaUnregisterBinaryUtilv: .LFB3900: .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 .LFE3900: .size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv .globl _Z48__device_stub__Z29generate_vector_sample_kernelvv .type _Z48__device_stub__Z29generate_vector_sample_kernelvv, @function _Z48__device_stub__Z29generate_vector_sample_kernelvv: .LFB3922: .cfi_startproc endbr64 subq $88, %rsp .cfi_def_cfa_offset 96 movq %fs:40, %rax movq %rax, 72(%rsp) xorl %eax, %eax movl $1, 16(%rsp) movl $1, 20(%rsp) movl $1, 24(%rsp) movl $1, 28(%rsp) movl $1, 32(%rsp) movl $1, 36(%rsp) leaq 8(%rsp), %rcx movq %rsp, %rdx leaq 28(%rsp), %rsi leaq 16(%rsp), %rdi call __cudaPopCallConfiguration@PLT testl %eax, %eax je .L7 .L3: movq 72(%rsp), %rax subq %fs:40, %rax jne .L8 addq $88, %rsp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L7: .cfi_restore_state pushq 8(%rsp) .cfi_def_cfa_offset 104 pushq 8(%rsp) .cfi_def_cfa_offset 112 leaq 80(%rsp), %r9 movq 44(%rsp), %rcx movl 52(%rsp), %r8d movq 32(%rsp), %rsi movl 40(%rsp), %edx leaq _Z29generate_vector_sample_kernelv(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 96 jmp .L3 .L8: call __stack_chk_fail@PLT .cfi_endproc .LFE3922: .size _Z48__device_stub__Z29generate_vector_sample_kernelvv, .-_Z48__device_stub__Z29generate_vector_sample_kernelvv .globl _Z29generate_vector_sample_kernelv .type _Z29generate_vector_sample_kernelv, @function _Z29generate_vector_sample_kernelv: .LFB3923: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z48__device_stub__Z29generate_vector_sample_kernelvv addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE3923: .size _Z29generate_vector_sample_kernelv, .-_Z29generate_vector_sample_kernelv .globl _Z40__device_stub__Z21setup_gamma_generatorll .type _Z40__device_stub__Z21setup_gamma_generatorll, @function _Z40__device_stub__Z21setup_gamma_generatorll: .LFB3924: .cfi_startproc endbr64 subq $104, %rsp .cfi_def_cfa_offset 112 movq %rdi, 8(%rsp) movq %fs:40, %rax movq %rax, 88(%rsp) xorl %eax, %eax leaq 8(%rsp), %rax movq %rax, 80(%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 .L15 .L11: movq 88(%rsp), %rax subq %fs:40, %rax jne .L16 addq $104, %rsp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L15: .cfi_restore_state pushq 24(%rsp) .cfi_def_cfa_offset 120 pushq 24(%rsp) .cfi_def_cfa_offset 128 leaq 96(%rsp), %r9 movq 60(%rsp), %rcx movl 68(%rsp), %r8d movq 48(%rsp), %rsi movl 56(%rsp), %edx leaq _Z21setup_gamma_generatorl(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 112 jmp .L11 .L16: call __stack_chk_fail@PLT .cfi_endproc .LFE3924: .size _Z40__device_stub__Z21setup_gamma_generatorll, .-_Z40__device_stub__Z21setup_gamma_generatorll .globl _Z21setup_gamma_generatorl .type _Z21setup_gamma_generatorl, @function _Z21setup_gamma_generatorl: .LFB3925: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z40__device_stub__Z21setup_gamma_generatorll addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE3925: .size _Z21setup_gamma_generatorl, .-_Z21setup_gamma_generatorl .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "Preparing constant variables." .section .rodata.str1.8,"aMS",@progbits,1 .align 8 .LC1: .string "/home/ubuntu/Datasets/stackv2/train-structured/zikovam/curisk-c/master/curisk.cu" .section .rodata.str1.1 .LC2: .string "\nError \"%s\" at %s:%d\n" .section .rodata.str1.8 .align 8 .LC3: .string "Allocate memory for vector sample." .align 8 .LC4: .string "Allocate memory for round vector sample." .align 8 .LC5: .string "Setup CUDA random numbers generator." .section .rodata.str1.1 .LC6: .string "Start round cycle." .section .rodata.str1.8 .align 8 .LC7: .string "Round cycle is terminated (timeout)." .section .rodata.str1.1 .LC8: .string "Stop round cycle." .LC9: .string "Vectors generated: " .LC10: .string "/" .LC11: .string "." .LC13: .string "Elapsed time: " .LC14: .string " s." .text .globl _Z22generate_vector_sampleR23sampling_cofiguration_tR17sampling_result_ti .type _Z22generate_vector_sampleR23sampling_cofiguration_tR17sampling_result_ti, @function _Z22generate_vector_sampleR23sampling_cofiguration_tR17sampling_result_ti: .LFB3896: .cfi_startproc endbr64 pushq %r15 .cfi_def_cfa_offset 16 .cfi_offset 15, -16 pushq %r14 .cfi_def_cfa_offset 24 .cfi_offset 14, -24 pushq %r13 .cfi_def_cfa_offset 32 .cfi_offset 13, -32 pushq %r12 .cfi_def_cfa_offset 40 .cfi_offset 12, -40 pushq %rbp .cfi_def_cfa_offset 48 .cfi_offset 6, -48 pushq %rbx .cfi_def_cfa_offset 56 .cfi_offset 3, -56 subq $88, %rsp .cfi_def_cfa_offset 144 movq %rdi, %rbp movq %rsi, (%rsp) movl %edx, %r14d movq %fs:40, %rax movq %rax, 72(%rsp) xorl %eax, %eax call clock@PLT movq %rax, 8(%rsp) movq 64(%rbp), %rbx movl $29, %edx leaq .LC0(%rip), %rsi movq %rbx, %rdi call _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT movq (%rbx), %rax movq -24(%rax), %rax movq 240(%rbx,%rax), %r12 testq %r12, %r12 je .L83 cmpb $0, 56(%r12) je .L22 movzbl 67(%r12), %esi .L23: movsbl %sil, %esi movq %rbx, %rdi call _ZNSo3putEc@PLT movq %rax, %rdi call _ZNSo5flushEv@PLT movl $1, %r8d movl $0, %ecx movl $4, %edx movq %rbp, %rsi leaq _ZL11c_dimension(%rip), %rdi call cudaMemcpyToSymbol@PLT call cudaGetLastError@PLT testl %eax, %eax jne .L84 leaq 32(%rbp), %rsi movl $1, %r8d movl $0, %ecx movl $4, %edx leaq _ZL13c_sample_size(%rip), %rdi call cudaMemcpyToSymbol@PLT call cudaGetLastError@PLT testl %eax, %eax jne .L85 movslq 0(%rbp), %rdx salq $2, %rdx movq 8(%rbp), %rsi movl $1, %r8d movl $0, %ecx leaq _ZL15c_vector_scheme(%rip), %rdi call cudaMemcpyToSymbol@PLT call cudaGetLastError@PLT testl %eax, %eax jne .L86 movslq 0(%rbp), %rdx salq $3, %rdx movq 16(%rbp), %rsi movl $1, %r8d movl $0, %ecx leaq _ZL15c_vector_bounds(%rip), %rdi call cudaMemcpyToSymbol@PLT call cudaGetLastError@PLT testl %eax, %eax jne .L87 movslq 0(%rbp), %rdx salq $3, %rdx movq 24(%rbp), %rsi movl $1, %r8d movl $0, %ecx leaq _ZL16c_vector_ordinal(%rip), %rdi call cudaMemcpyToSymbol@PLT call cudaGetLastError@PLT testl %eax, %eax jne .L88 movq 64(%rbp), %rbx movl $34, %edx leaq .LC3(%rip), %rsi movq %rbx, %rdi call _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT movq (%rbx), %rax movq -24(%rax), %rax movq 240(%rbx,%rax), %r12 testq %r12, %r12 je .L89 cmpb $0, 56(%r12) je .L31 movzbl 67(%r12), %esi .L32: movsbl %sil, %esi movq %rbx, %rdi call _ZNSo3putEc@PLT movq %rax, %rdi call _ZNSo5flushEv@PLT movl 32(%rbp), %esi imull 0(%rbp), %esi movslq %esi, %rsi salq $2, %rsi leaq 24(%rsp), %rdi call cudaMalloc@PLT call cudaGetLastError@PLT testl %eax, %eax jne .L90 leaq 24(%rsp), %rsi movl $1, %r8d movl $0, %ecx movl $8, %edx leaq _ZL15d_vector_sample(%rip), %rdi call cudaMemcpyToSymbol@PLT call cudaGetLastError@PLT testl %eax, %eax jne .L91 movq 64(%rbp), %rbx movl $40, %edx leaq .LC4(%rip), %rsi movq %rbx, %rdi call _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT movq (%rbx), %rax movq -24(%rax), %rax movq 240(%rbx,%rax), %r12 testq %r12, %r12 je .L92 cmpb $0, 56(%r12) je .L37 movzbl 67(%r12), %esi .L38: movsbl %sil, %esi movq %rbx, %rdi call _ZNSo3putEc@PLT movq %rax, %rdi call _ZNSo5flushEv@PLT movl 36(%rbp), %r12d movl 48(%rbp), %r13d movl %r12d, %eax imull %r13d, %eax movl %eax, 16(%rsp) leaq 16(%rsp), %rsi movl $1, %r8d movl $0, %ecx movl $4, %edx leaq _ZL19d_round_sample_size(%rip), %rdi call cudaMemcpyToSymbol@PLT call cudaGetLastError@PLT testl %eax, %eax jne .L93 movl 0(%rbp), %esi imull 16(%rsp), %esi movslq %esi, %rsi salq $2, %rsi leaq 32(%rsp), %rdi call cudaMalloc@PLT call cudaGetLastError@PLT testl %eax, %eax jne .L94 leaq 32(%rsp), %rsi movl $1, %r8d movl $0, %ecx movl $8, %edx leaq _ZL21d_round_vector_sample(%rip), %rdi call cudaMemcpyToSymbol@PLT call cudaGetLastError@PLT testl %eax, %eax jne .L95 movq 64(%rbp), %rbx movl $36, %edx leaq .LC5(%rip), %rsi movq %rbx, %rdi call _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT movq (%rbx), %rax movq -24(%rax), %rax movq 240(%rbx,%rax), %r15 testq %r15, %r15 je .L96 cmpb $0, 56(%r15) je .L44 movzbl 67(%r15), %esi .L45: movsbl %sil, %esi movq %rbx, %rdi call _ZNSo3putEc@PLT movq %rax, %rdi call _ZNSo5flushEv@PLT movslq 16(%rsp), %rax leaq (%rax,%rax,2), %rsi salq $4, %rsi leaq 40(%rsp), %rdi call cudaMalloc@PLT call cudaGetLastError@PLT testl %eax, %eax jne .L97 leaq 40(%rsp), %rsi movl $1, %r8d movl $0, %ecx movl $8, %edx leaq _ZL15d_curand_states(%rip), %rdi call cudaMemcpyToSymbol@PLT call cudaGetLastError@PLT testl %eax, %eax jne .L98 movl %r13d, 60(%rsp) movl $1, 64(%rsp) movl $1, 68(%rsp) movl %r12d, 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 .L99 .L48: call cudaGetLastError@PLT testl %eax, %eax jne .L100 call cudaDeviceSynchronize@PLT call cudaGetLastError@PLT testl %eax, %eax jne .L101 movl $0, 20(%rsp) leaq 20(%rsp), %rsi movl $1, %r8d movl $0, %ecx movl $4, %edx leaq _ZL15d_vectors_ready(%rip), %rdi call cudaMemcpyToSymbol@PLT call cudaGetLastError@PLT testl %eax, %eax jne .L102 movq 64(%rbp), %rbx movl $18, %edx leaq .LC6(%rip), %rsi movq %rbx, %rdi call _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT movq (%rbx), %rax movq -24(%rax), %rax movq 240(%rbx,%rax), %r15 testq %r15, %r15 je .L103 cmpb $0, 56(%r15) je .L54 movzbl 67(%r15), %esi .L55: movsbl %sil, %esi movq %rbx, %rdi call _ZNSo3putEc@PLT movq %rax, %rdi call _ZNSo5flushEv@PLT movl $0, %ebx leaq _ZL15d_vectors_ready(%rip), %r15 jmp .L56 .L83: movq 72(%rsp), %rax subq %fs:40, %rax jne .L104 call _ZSt16__throw_bad_castv@PLT .L104: call __stack_chk_fail@PLT .L22: movq %r12, %rdi call _ZNKSt5ctypeIcE13_M_widen_initEv@PLT movq (%r12), %rax movl $10, %esi movq %r12, %rdi call *48(%rax) movl %eax, %esi jmp .L23 .L84: call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $42, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L85: call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $43, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L86: call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $44, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L87: call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $45, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L88: call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $46, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L89: movq 72(%rsp), %rax subq %fs:40, %rax jne .L105 call _ZSt16__throw_bad_castv@PLT .L105: call __stack_chk_fail@PLT .L31: movq %r12, %rdi call _ZNKSt5ctypeIcE13_M_widen_initEv@PLT movq (%r12), %rax movl $10, %esi movq %r12, %rdi call *48(%rax) movl %eax, %esi jmp .L32 .L90: call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $51, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L91: call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $52, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L92: movq 72(%rsp), %rax subq %fs:40, %rax jne .L106 call _ZSt16__throw_bad_castv@PLT .L106: call __stack_chk_fail@PLT .L37: movq %r12, %rdi call _ZNKSt5ctypeIcE13_M_widen_initEv@PLT movq (%r12), %rax movl $10, %esi movq %r12, %rdi call *48(%rax) movl %eax, %esi jmp .L38 .L93: call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $59, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L94: call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $62, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L95: call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $63, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L96: movq 72(%rsp), %rax subq %fs:40, %rax jne .L107 call _ZSt16__throw_bad_castv@PLT .L107: 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 jmp .L45 .L97: call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $68, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L98: call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $69, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L99: call clock@PLT movq %rax, %rdi call _Z40__device_stub__Z21setup_gamma_generatorll jmp .L48 .L100: call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $71, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L101: call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $72, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L102: call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $76, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L103: movq 72(%rsp), %rax subq %fs:40, %rax jne .L108 call _ZSt16__throw_bad_castv@PLT .L108: call __stack_chk_fail@PLT .L54: movq %r15, %rdi call _ZNKSt5ctypeIcE13_M_widen_initEv@PLT movq (%r15), %rax movl $10, %esi movq %r15, %rdi call *48(%rax) movl %eax, %esi jmp .L55 .L57: call cudaDeviceSynchronize@PLT testl %eax, %eax jne .L109 leaq 20(%rsp), %rdi movl $2, %r8d movl $0, %ecx movl $4, %edx movq %r15, %rsi call cudaMemcpyFromSymbol@PLT call cudaGetLastError@PLT testl %eax, %eax jne .L110 addl $1, %ebx cmpl %r14d, %ebx jg .L111 .L56: movl 20(%rsp), %eax cmpl %eax, 32(%rbp) jle .L64 movl %r13d, 60(%rsp) movl $1, 64(%rsp) movl $1, 68(%rsp) movl %r12d, 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 jne .L57 call _Z48__device_stub__Z29generate_vector_sample_kernelvv jmp .L57 .L109: call cudaDeviceSynchronize@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $83, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L110: call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $84, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L111: movq 64(%rbp), %rbx movl $36, %edx leaq .LC7(%rip), %rsi movq %rbx, %rdi call _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT movq (%rbx), %rax movq -24(%rax), %rax movq 240(%rbx,%rax), %r12 testq %r12, %r12 je .L112 cmpb $0, 56(%r12) je .L62 movzbl 67(%r12), %esi .L63: movsbl %sil, %esi movq %rbx, %rdi call _ZNSo3putEc@PLT movq %rax, %rdi call _ZNSo5flushEv@PLT movl 20(%rsp), %eax movq (%rsp), %rcx movl %eax, 12(%rcx) movl $1, 4(%rcx) .L64: movq 64(%rbp), %rbx movl $17, %edx leaq .LC8(%rip), %rsi movq %rbx, %rdi call _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT movq (%rbx), %rax movq -24(%rax), %rax movq 240(%rbx,%rax), %r12 testq %r12, %r12 je .L113 cmpb $0, 56(%r12) je .L68 movzbl 67(%r12), %esi .L69: movsbl %sil, %esi movq %rbx, %rdi call _ZNSo3putEc@PLT movq %rax, %rdi call _ZNSo5flushEv@PLT movq 64(%rbp), %rbx movl $19, %edx leaq .LC9(%rip), %rsi movq %rbx, %rdi call _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT movl 20(%rsp), %esi movq %rbx, %rdi call _ZNSolsEi@PLT movq %rax, %rbx movl $1, %edx leaq .LC10(%rip), %rsi movq %rax, %rdi call _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT movl 32(%rbp), %esi movq %rbx, %rdi call _ZNSolsEi@PLT movq %rax, %rbx movl $1, %edx leaq .LC11(%rip), %rsi movq %rax, %rdi call _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT movq (%rbx), %rax movq -24(%rax), %rax movq 240(%rbx,%rax), %r12 testq %r12, %r12 je .L114 cmpb $0, 56(%r12) je .L72 movzbl 67(%r12), %esi .L73: movsbl %sil, %esi movq %rbx, %rdi call _ZNSo3putEc@PLT movq %rax, %rdi call _ZNSo5flushEv@PLT movl 32(%rbp), %eax movl 20(%rsp), %edx cmpl %edx, %eax jle .L74 imull 0(%rbp), %edx movslq %edx, %rdx salq $2, %rdx movq (%rsp), %rax movq 16(%rax), %rdi movl $2, %ecx movq 24(%rsp), %rsi call cudaMemcpy@PLT call cudaGetLastError@PLT testl %eax, %eax jne .L115 .L75: movq 24(%rsp), %rdi call cudaFree@PLT movq 32(%rsp), %rdi call cudaFree@PLT movq 40(%rsp), %rdi call cudaFree@PLT call clock@PLT movl 8(%rsp), %ecx subl %ecx, %eax pxor %xmm0, %xmm0 cvtsi2ssl %eax, %xmm0 divss .LC12(%rip), %xmm0 movss %xmm0, 8(%rsp) movq 64(%rbp), %rbx movl $14, %edx leaq .LC13(%rip), %rsi movq %rbx, %rdi call _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT pxor %xmm0, %xmm0 cvtss2sd 8(%rsp), %xmm0 movq %rbx, %rdi call _ZNSo9_M_insertIdEERSoT_@PLT movq %rax, %rbx movl $3, %edx leaq .LC14(%rip), %rsi movq %rax, %rdi call _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT movq (%rbx), %rax movq -24(%rax), %rax movq 240(%rbx,%rax), %rbp testq %rbp, %rbp je .L116 cmpb $0, 56(%rbp) je .L78 movzbl 67(%rbp), %esi .L79: movsbl %sil, %esi movq %rbx, %rdi call _ZNSo3putEc@PLT movq %rax, %rdi call _ZNSo5flushEv@PLT movq (%rsp), %rax movss 8(%rsp), %xmm1 movss %xmm1, (%rax) movq 72(%rsp), %rax subq %fs:40, %rax jne .L117 addq $88, %rsp .cfi_remember_state .cfi_def_cfa_offset 56 popq %rbx .cfi_def_cfa_offset 48 popq %rbp .cfi_def_cfa_offset 40 popq %r12 .cfi_def_cfa_offset 32 popq %r13 .cfi_def_cfa_offset 24 popq %r14 .cfi_def_cfa_offset 16 popq %r15 .cfi_def_cfa_offset 8 ret .L112: .cfi_restore_state movq 72(%rsp), %rax subq %fs:40, %rax jne .L118 call _ZSt16__throw_bad_castv@PLT .L118: call __stack_chk_fail@PLT .L62: movq %r12, %rdi call _ZNKSt5ctypeIcE13_M_widen_initEv@PLT movq (%r12), %rax movl $10, %esi movq %r12, %rdi call *48(%rax) movl %eax, %esi jmp .L63 .L113: movq 72(%rsp), %rax subq %fs:40, %rax jne .L119 call _ZSt16__throw_bad_castv@PLT .L119: call __stack_chk_fail@PLT .L68: movq %r12, %rdi call _ZNKSt5ctypeIcE13_M_widen_initEv@PLT movq (%r12), %rax movl $10, %esi movq %r12, %rdi call *48(%rax) movl %eax, %esi jmp .L69 .L114: movq 72(%rsp), %rax subq %fs:40, %rax jne .L120 call _ZSt16__throw_bad_castv@PLT .L120: call __stack_chk_fail@PLT .L72: movq %r12, %rdi call _ZNKSt5ctypeIcE13_M_widen_initEv@PLT movq (%r12), %rax movl $10, %esi movq %r12, %rdi call *48(%rax) movl %eax, %esi jmp .L73 .L115: call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $100, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L74: imull 0(%rbp), %eax movslq %eax, %rdx salq $2, %rdx movq (%rsp), %rax movq 16(%rax), %rdi movl $2, %ecx movq 24(%rsp), %rsi call cudaMemcpy@PLT call cudaGetLastError@PLT testl %eax, %eax je .L75 call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $104, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L116: movq 72(%rsp), %rax subq %fs:40, %rax jne .L121 call _ZSt16__throw_bad_castv@PLT .L121: call __stack_chk_fail@PLT .L78: movq %rbp, %rdi call _ZNKSt5ctypeIcE13_M_widen_initEv@PLT movq 0(%rbp), %rax movl $10, %esi movq %rbp, %rdi call *48(%rax) movl %eax, %esi jmp .L79 .L117: call __stack_chk_fail@PLT .cfi_endproc .LFE3896: .size _Z22generate_vector_sampleR23sampling_cofiguration_tR17sampling_result_ti, .-_Z22generate_vector_sampleR23sampling_cofiguration_tR17sampling_result_ti .section .rodata.str1.1 .LC15: .string "_Z21setup_gamma_generatorl" .section .rodata.str1.8 .align 8 .LC16: .string "_Z29generate_vector_sample_kernelv" .section .rodata.str1.1 .LC17: .string "precalc_xorwow_matrix" .LC18: .string "precalc_xorwow_offset_matrix" .LC19: .string "mrg32k3aM1" .LC20: .string "mrg32k3aM2" .LC21: .string "mrg32k3aM1SubSeq" .LC22: .string "mrg32k3aM2SubSeq" .LC23: .string "mrg32k3aM1Seq" .LC24: .string "mrg32k3aM2Seq" .LC25: .string "__cr_lgamma_table" .LC26: .string "c_dimension" .LC27: .string "c_vector_scheme" .LC28: .string "c_vector_bounds" .LC29: .string "c_vector_ordinal" .LC30: .string "c_sample_size" .LC31: .string "d_vector_sample" .LC32: .string "d_round_sample_size" .LC33: .string "d_round_vector_sample" .LC34: .string "d_curand_states" .LC35: .string "d_vectors_ready" .text .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB3927: .cfi_startproc endbr64 pushq %rbx .cfi_def_cfa_offset 16 .cfi_offset 3, -16 leaq _ZL15__fatDeviceText(%rip), %rdi call __cudaRegisterFatBinary@PLT movq %rax, %rbx 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 .LC15(%rip), %rdx movq %rdx, %rcx leaq _Z21setup_gamma_generatorl(%rip), %rsi movq %rax, %rdi call __cudaRegisterFunction@PLT addq $32, %rsp .cfi_def_cfa_offset 16 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 .LC16(%rip), %rdx movq %rdx, %rcx leaq _Z29generate_vector_sample_kernelv(%rip), %rsi movq %rbx, %rdi call __cudaRegisterFunction@PLT addq $32, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 movl $102400, %r9d movl $0, %r8d leaq .LC17(%rip), %rdx movq %rdx, %rcx leaq _ZL21precalc_xorwow_matrix(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 movl $102400, %r9d movl $0, %r8d leaq .LC18(%rip), %rdx movq %rdx, %rcx leaq _ZL28precalc_xorwow_offset_matrix(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 movl $2304, %r9d movl $0, %r8d leaq .LC19(%rip), %rdx movq %rdx, %rcx leaq _ZL10mrg32k3aM1(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 movl $2304, %r9d movl $0, %r8d leaq .LC20(%rip), %rdx movq %rdx, %rcx leaq _ZL10mrg32k3aM2(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 movl $2016, %r9d movl $0, %r8d leaq .LC21(%rip), %rdx movq %rdx, %rcx leaq _ZL16mrg32k3aM1SubSeq(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 movl $2016, %r9d movl $0, %r8d leaq .LC22(%rip), %rdx movq %rdx, %rcx leaq _ZL16mrg32k3aM2SubSeq(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 movl $2304, %r9d movl $0, %r8d leaq .LC23(%rip), %rdx movq %rdx, %rcx leaq _ZL13mrg32k3aM1Seq(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 movl $2304, %r9d movl $0, %r8d leaq .LC24(%rip), %rdx movq %rdx, %rcx leaq _ZL13mrg32k3aM2Seq(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $1 .cfi_def_cfa_offset 32 movl $72, %r9d movl $0, %r8d leaq .LC25(%rip), %rdx movq %rdx, %rcx leaq _ZL17__cr_lgamma_table(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $1 .cfi_def_cfa_offset 32 movl $4, %r9d movl $0, %r8d leaq .LC26(%rip), %rdx movq %rdx, %rcx leaq _ZL11c_dimension(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $1 .cfi_def_cfa_offset 32 movl $128, %r9d movl $0, %r8d leaq .LC27(%rip), %rdx movq %rdx, %rcx leaq _ZL15c_vector_scheme(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $1 .cfi_def_cfa_offset 32 movl $256, %r9d movl $0, %r8d leaq .LC28(%rip), %rdx movq %rdx, %rcx leaq _ZL15c_vector_bounds(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $1 .cfi_def_cfa_offset 32 movl $256, %r9d movl $0, %r8d leaq .LC29(%rip), %rdx movq %rdx, %rcx leaq _ZL16c_vector_ordinal(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $1 .cfi_def_cfa_offset 32 movl $4, %r9d movl $0, %r8d leaq .LC30(%rip), %rdx movq %rdx, %rcx leaq _ZL13c_sample_size(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 movl $8, %r9d movl $0, %r8d leaq .LC31(%rip), %rdx movq %rdx, %rcx leaq _ZL15d_vector_sample(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 movl $4, %r9d movl $0, %r8d leaq .LC32(%rip), %rdx movq %rdx, %rcx leaq _ZL19d_round_sample_size(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 movl $8, %r9d movl $0, %r8d leaq .LC33(%rip), %rdx movq %rdx, %rcx leaq _ZL21d_round_vector_sample(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 movl $8, %r9d movl $0, %r8d leaq .LC34(%rip), %rdx movq %rdx, %rcx leaq _ZL15d_curand_states(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 movl $4, %r9d movl $0, %r8d leaq .LC35(%rip), %rdx movq %rdx, %rcx leaq _ZL15d_vectors_ready(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 movq _ZL20__cudaFatCubinHandle(%rip), %rdi call __cudaRegisterFatBinaryEnd@PLT leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi call atexit@PLT popq %rbx .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE3927: .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 .local _ZL15d_vectors_ready .comm _ZL15d_vectors_ready,4,4 .local _ZL15d_curand_states .comm _ZL15d_curand_states,8,8 .local _ZL21d_round_vector_sample .comm _ZL21d_round_vector_sample,8,8 .local _ZL19d_round_sample_size .comm _ZL19d_round_sample_size,4,4 .local _ZL15d_vector_sample .comm _ZL15d_vector_sample,8,8 .local _ZL13c_sample_size .comm _ZL13c_sample_size,4,4 .local _ZL16c_vector_ordinal .comm _ZL16c_vector_ordinal,256,32 .local _ZL15c_vector_bounds .comm _ZL15c_vector_bounds,256,32 .local _ZL15c_vector_scheme .comm _ZL15c_vector_scheme,128,32 .local _ZL11c_dimension .comm _ZL11c_dimension,4,4 .local _ZL17__cr_lgamma_table .comm _ZL17__cr_lgamma_table,72,32 .local _ZL13mrg32k3aM2Seq .comm _ZL13mrg32k3aM2Seq,2304,32 .local _ZL13mrg32k3aM1Seq .comm _ZL13mrg32k3aM1Seq,2304,32 .local _ZL16mrg32k3aM2SubSeq .comm _ZL16mrg32k3aM2SubSeq,2016,32 .local _ZL16mrg32k3aM1SubSeq .comm _ZL16mrg32k3aM1SubSeq,2016,32 .local _ZL10mrg32k3aM2 .comm _ZL10mrg32k3aM2,2304,32 .local _ZL10mrg32k3aM1 .comm _ZL10mrg32k3aM1,2304,32 .local _ZL28precalc_xorwow_offset_matrix .comm _ZL28precalc_xorwow_offset_matrix,102400,32 .local _ZL21precalc_xorwow_matrix .comm _ZL21precalc_xorwow_matrix,102400,32 .section .rodata.cst4,"aM",@progbits,4 .align 4 .LC12: .long 1232348160 .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 <curand.h> #include <curand_kernel.h> #include <device_launch_parameters.h> #include <device_functions.h> #include <time.h> #include "curisk.cuh" __global__ void generate_vector_sample_kernel(); __global__ void setup_gamma_generator(long seed); __device__ __forceinline__ float generate_gamma_1_1(curandState *state); #define CUDA_CALL(x) do { if((x)!=cudaSuccess) { \ printf("\nError \"%s\" at %s:%d\n", cudaGetErrorString(x), __FILE__, __LINE__);\ exit(EXIT_FAILURE);}} while(0) #define check_error() do { if(cudaGetLastError()!=cudaSuccess) { \ printf("\nError \"%s\" at %s:%d\n", cudaGetErrorString(cudaGetLastError()), __FILE__, __LINE__);\ exit(EXIT_FAILURE);}} while(0) #define ESTIMATED_MAX_DIMENSION 32 __constant__ int c_dimension; __constant__ int c_vector_scheme[ESTIMATED_MAX_DIMENSION]; __constant__ bound_t c_vector_bounds[ESTIMATED_MAX_DIMENSION]; __constant__ ordinal_t c_vector_ordinal[ESTIMATED_MAX_DIMENSION]; __constant__ int c_sample_size; __device__ float *d_vector_sample; __device__ int d_round_sample_size; __device__ float *d_round_vector_sample; __device__ curandState *d_curand_states; __device__ int d_vectors_ready; void generate_vector_sample(sampling_cofiguration_t& conf, sampling_result_t& result, int timeout_rounds) { int start_time_point = clock(); /* Скопируем некоторые поля из conf в константную память. */ conf.log() << "Preparing constant variables." << std::endl; cudaMemcpyToSymbol(c_dimension, &conf.dimension, sizeof(int)); check_error(); cudaMemcpyToSymbol(c_sample_size, &conf.sample_size, sizeof(int)); check_error(); cudaMemcpyToSymbol(c_vector_scheme, conf.vector_scheme, conf.dimension*sizeof(int)); check_error(); cudaMemcpyToSymbol(c_vector_bounds, conf.vector_bounds, conf.dimension*sizeof(bound_t)); check_error(); cudaMemcpyToSymbol(c_vector_ordinal, conf.vector_ordinal, conf.dimension*sizeof(ordinal_t)); check_error(); /* Выделим память для выборки. */ conf.log() << "Allocate memory for vector sample." << std::endl; float *dh_vector_sample; cudaMalloc(&dh_vector_sample, conf.sample_size*conf.dimension*sizeof(float)); check_error(); cudaMemcpyToSymbol(d_vector_sample, &dh_vector_sample, sizeof(dh_vector_sample)); check_error(); /* Выделим память для выборки раунда. */ conf.log() << "Allocate memory for round vector sample." << std::endl; int blocks_per_round = conf.grid_dimension.x; int vectors_per_block = conf.block_dimension.x; int round_sample_size = blocks_per_round*vectors_per_block; cudaMemcpyToSymbol(d_round_sample_size, &round_sample_size, sizeof(int)); check_error(); float *dh_round_vector_sample; cudaMalloc(&dh_round_vector_sample, round_sample_size*conf.dimension*sizeof(float)); check_error(); cudaMemcpyToSymbol(d_round_vector_sample, &dh_round_vector_sample, sizeof(dh_round_vector_sample)); check_error(); /* Настроим генератор случайных чисел. */ conf.log() << "Setup CUDA random numbers generator." << std::endl; curandState *dh_curand_states; cudaMalloc(&dh_curand_states, round_sample_size*sizeof(curandState)); check_error(); cudaMemcpyToSymbol(d_curand_states, &dh_curand_states, sizeof(dh_curand_states)); check_error(); setup_gamma_generator<<<blocks_per_round, vectors_per_block>>>(clock()); check_error(); cudaDeviceSynchronize(); check_error(); /* Число готовых элементов выборки. */ int vectors_ready = 0; cudaMemcpyToSymbol(d_vectors_ready, &vectors_ready, sizeof(vectors_ready)); check_error(); conf.log() << "Start round cycle." << std::endl; int rounds = 0; while (vectors_ready < conf.sample_size) { generate_vector_sample_kernel<<<blocks_per_round, vectors_per_block>>>(); CUDA_CALL(cudaDeviceSynchronize()); cudaMemcpyFromSymbol(&vectors_ready, d_vectors_ready, sizeof(vectors_ready)); check_error(); rounds++; if (rounds > timeout_rounds) { conf.log() << "Round cycle is terminated (timeout)." << std::endl; result.generated_vectors_number = vectors_ready; result.error = SAMPLING_TIMEOUT; break; } } conf.log() << "Stop round cycle." << std::endl; conf.log() << "Vectors generated: " << vectors_ready << "/" << conf.sample_size << "." << std::endl; if (vectors_ready < conf.sample_size) { cudaMemcpy(result.vector_sample, dh_vector_sample, vectors_ready*conf.dimension*sizeof(float), cudaMemcpyDeviceToHost); check_error(); } else { cudaMemcpy(result.vector_sample, dh_vector_sample, conf.sample_size*conf.dimension*sizeof(float), cudaMemcpyDeviceToHost); check_error(); } cudaFree(dh_vector_sample); cudaFree(dh_round_vector_sample); cudaFree(dh_curand_states); int end_time_point = clock(); float elapsed_time = ((float) (end_time_point - start_time_point))/CLOCKS_PER_SEC; conf.log() << "Elapsed time: " << elapsed_time << " s." << std::endl; result.elapsed_time = elapsed_time; } __global__ void generate_vector_sample_kernel() { int idx = blockIdx.x*blockDim.x + threadIdx.x; int dimension = c_dimension; int i; float value; float than_value; float sum = 0; int last_vectors_ready; ordinal_t ordinal; bound_t bound; bool eliminate = false; for (i = 0; i < dimension; i++) { if (c_vector_scheme[i] == 0) value = 0; else value = generate_gamma_1_1(d_curand_states + idx); sum += value; d_round_vector_sample[dimension*idx + i] = value; } if (sum != 0) { for (i = 0; i < dimension; i++) { value = d_round_vector_sample[dimension*idx + i]; value /= sum; d_round_vector_sample[dimension*idx + i] = value; bound = c_vector_bounds[i]; eliminate = eliminate || value < bound.left || value > bound.right; } for (i = 0; i < dimension; i++) { value = d_round_vector_sample[dimension*idx + i]; ordinal = c_vector_ordinal[i]; than_value = d_round_vector_sample[dimension*idx + ordinal.than_index]; eliminate = eliminate || (ordinal.ordinal == ORDINAL_LESS && value >= than_value) || (ordinal.ordinal == ORDINAL_MORE && value <= than_value); } } if (!eliminate) { last_vectors_ready = atomicAdd(&d_vectors_ready, 1); if (last_vectors_ready < c_sample_size) { for (i = 0; i < dimension; i++) d_vector_sample[dimension*last_vectors_ready + i] = d_round_vector_sample[dimension*idx + i]; } } } __global__ void setup_gamma_generator(long seed) { int tid = threadIdx.x + blockIdx.x*blockDim.x; if (tid < d_round_sample_size) curand_init(seed, tid, 0, &d_curand_states[tid]); } /* * Функция генерирует случайную величину с распределением Gamma(1,1). */ __device__ __forceinline__ float generate_gamma_1_1(curandState *state) { curandState localState = *state; float c, z, u, v, result; c = 1/sqrtf(9*2/3.); do { z = curand_normal(&localState); u = curand_uniform(&localState); v = powf(1 + c*z, 3); } while (z <= (-1/c) || logf(u) >= (0.5*z*z + 2/3. - (2/3.)*v + (2/3.)*logf(v))); result = (2/3.)*v; *state = localState; return result; }
#ifndef CURISK_H #define CURISK_H #include <hip/hip_runtime.h> #include <hiprand/hiprand_kernel.h> #include <iostream> /* * Структура определяет границы элемента случайного вектора. */ struct bound_t { float left; float right; }; #define BOUND_INIT {0, 1} enum ordinal_e { ORDINAL_LESS, ORDINAL_MORE, ORDINAL_NEVER_MIND }; /* * Ординальное ограничение вектора. В поле than_index указывается индекс элемента, * относительного которого данный элемент (к которому относится структура) больше или * меньше. * * Если на элемент не накладываются ординальные ограничения, то than_index == 0 и * ordinal == ORDINAL_NEVER_MIND. */ struct ordinal_t { int than_index; ordinal_e ordinal; }; #define ORDINAL_INIT {0, ORDINAL_NEVER_MIND} /* * Конфигурация генератора выборки, которая передается ему до его запуска. В ней * содержатся параметры отбора и конфигурация ядра CUDA (размерность сетки и блока). */ struct sampling_cofiguration_t { sampling_cofiguration_t(int dimension, int sample_size, dim3 grid_dimension, dim3 block_dimension, std::ostream& log = std::cout) { this->dimension = dimension; this->sample_size = sample_size; this->grid_dimension = grid_dimension; this->block_dimension = block_dimension; this->_log = &log; vector_scheme = new int[dimension]; vector_bounds = new bound_t[dimension]; vector_ordinal = new ordinal_t[dimension]; } ~sampling_cofiguration_t() { delete [] vector_scheme; delete [] vector_bounds; delete [] vector_ordinal; } int dimension; // Размер веткора W. int *vector_scheme; // Схема вектора W вида (0, 1, 1, 0 ...). bound_t *vector_bounds; ordinal_t *vector_ordinal; int sample_size; // Количество векторов в желаемой выборке векторов. dim3 grid_dimension; dim3 block_dimension; std::ostream& log() { return *_log; } private: std::ostream *_log; }; /* * Тип ошибки, возвращаемый функцией генерации векторов * в структуре sampling_result_t. */ enum sampling_error_code_e { SAMPLING_SUCCESS, SAMPLING_TIMEOUT, SAMPLING_CUDA_ERROR, SAMPLING_UNKNOWN_ERROR }; /* * Структура результата генерации векторов. Заполняется функцией * генерации векторов. * * В поле generated_vectors_number хранится число сгенерированных векторов * выборки. Даже при неудачной генерации, оно может быть отлично от * нуля, поэтому неплохо бы знать об этом. */ struct sampling_result_t { sampling_result_t(sampling_cofiguration_t *conf) { size_t size = conf->dimension*conf->sample_size; vector_sample = new float[size]; memset(vector_sample, 0, size*sizeof(float)); error = SAMPLING_SUCCESS; cuda_error = hipSuccess; generated_vectors_number = 0; } ~sampling_result_t() { delete [] vector_sample; } float elapsed_time; sampling_error_code_e error; hipError_t cuda_error; int generated_vectors_number; float *vector_sample; }; /* * Функция генерации векторов. Значение timeout_rounds указывает порогове число раундов (число * запусков ядра CUDA), после которого генерация завершается с ошибкой. Ошибка фиксируется в * структуре result как SAMPLING_TIMEOUT. */ void generate_vector_sample(sampling_cofiguration_t& conf, sampling_result_t& result, int timeout_rounds); #endif
You are a helpful coding assistant specialized in converting HIP source code to AMD device assembly.
#ifndef CURISK_H #define CURISK_H #include <hip/hip_runtime.h> #include <hiprand/hiprand_kernel.h> #include <iostream> /* * Структура определяет границы элемента случайного вектора. */ struct bound_t { float left; float right; }; #define BOUND_INIT {0, 1} enum ordinal_e { ORDINAL_LESS, ORDINAL_MORE, ORDINAL_NEVER_MIND }; /* * Ординальное ограничение вектора. В поле than_index указывается индекс элемента, * относительного которого данный элемент (к которому относится структура) больше или * меньше. * * Если на элемент не накладываются ординальные ограничения, то than_index == 0 и * ordinal == ORDINAL_NEVER_MIND. */ struct ordinal_t { int than_index; ordinal_e ordinal; }; #define ORDINAL_INIT {0, ORDINAL_NEVER_MIND} /* * Конфигурация генератора выборки, которая передается ему до его запуска. В ней * содержатся параметры отбора и конфигурация ядра CUDA (размерность сетки и блока). */ struct sampling_cofiguration_t { sampling_cofiguration_t(int dimension, int sample_size, dim3 grid_dimension, dim3 block_dimension, std::ostream& log = std::cout) { this->dimension = dimension; this->sample_size = sample_size; this->grid_dimension = grid_dimension; this->block_dimension = block_dimension; this->_log = &log; vector_scheme = new int[dimension]; vector_bounds = new bound_t[dimension]; vector_ordinal = new ordinal_t[dimension]; } ~sampling_cofiguration_t() { delete [] vector_scheme; delete [] vector_bounds; delete [] vector_ordinal; } int dimension; // Размер веткора W. int *vector_scheme; // Схема вектора W вида (0, 1, 1, 0 ...). bound_t *vector_bounds; ordinal_t *vector_ordinal; int sample_size; // Количество векторов в желаемой выборке векторов. dim3 grid_dimension; dim3 block_dimension; std::ostream& log() { return *_log; } private: std::ostream *_log; }; /* * Тип ошибки, возвращаемый функцией генерации векторов * в структуре sampling_result_t. */ enum sampling_error_code_e { SAMPLING_SUCCESS, SAMPLING_TIMEOUT, SAMPLING_CUDA_ERROR, SAMPLING_UNKNOWN_ERROR }; /* * Структура результата генерации векторов. Заполняется функцией * генерации векторов. * * В поле generated_vectors_number хранится число сгенерированных векторов * выборки. Даже при неудачной генерации, оно может быть отлично от * нуля, поэтому неплохо бы знать об этом. */ struct sampling_result_t { sampling_result_t(sampling_cofiguration_t *conf) { size_t size = conf->dimension*conf->sample_size; vector_sample = new float[size]; memset(vector_sample, 0, size*sizeof(float)); error = SAMPLING_SUCCESS; cuda_error = hipSuccess; generated_vectors_number = 0; } ~sampling_result_t() { delete [] vector_sample; } float elapsed_time; sampling_error_code_e error; hipError_t cuda_error; int generated_vectors_number; float *vector_sample; }; /* * Функция генерации векторов. Значение timeout_rounds указывает порогове число раундов (число * запусков ядра CUDA), после которого генерация завершается с ошибкой. Ошибка фиксируется в * структуре result как SAMPLING_TIMEOUT. */ void generate_vector_sample(sampling_cofiguration_t& conf, sampling_result_t& result, int timeout_rounds); #endif
.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.
#ifndef CURISK_H #define CURISK_H #include <hip/hip_runtime.h> #include <hiprand/hiprand_kernel.h> #include <iostream> /* * Структура определяет границы элемента случайного вектора. */ struct bound_t { float left; float right; }; #define BOUND_INIT {0, 1} enum ordinal_e { ORDINAL_LESS, ORDINAL_MORE, ORDINAL_NEVER_MIND }; /* * Ординальное ограничение вектора. В поле than_index указывается индекс элемента, * относительного которого данный элемент (к которому относится структура) больше или * меньше. * * Если на элемент не накладываются ординальные ограничения, то than_index == 0 и * ordinal == ORDINAL_NEVER_MIND. */ struct ordinal_t { int than_index; ordinal_e ordinal; }; #define ORDINAL_INIT {0, ORDINAL_NEVER_MIND} /* * Конфигурация генератора выборки, которая передается ему до его запуска. В ней * содержатся параметры отбора и конфигурация ядра CUDA (размерность сетки и блока). */ struct sampling_cofiguration_t { sampling_cofiguration_t(int dimension, int sample_size, dim3 grid_dimension, dim3 block_dimension, std::ostream& log = std::cout) { this->dimension = dimension; this->sample_size = sample_size; this->grid_dimension = grid_dimension; this->block_dimension = block_dimension; this->_log = &log; vector_scheme = new int[dimension]; vector_bounds = new bound_t[dimension]; vector_ordinal = new ordinal_t[dimension]; } ~sampling_cofiguration_t() { delete [] vector_scheme; delete [] vector_bounds; delete [] vector_ordinal; } int dimension; // Размер веткора W. int *vector_scheme; // Схема вектора W вида (0, 1, 1, 0 ...). bound_t *vector_bounds; ordinal_t *vector_ordinal; int sample_size; // Количество векторов в желаемой выборке векторов. dim3 grid_dimension; dim3 block_dimension; std::ostream& log() { return *_log; } private: std::ostream *_log; }; /* * Тип ошибки, возвращаемый функцией генерации векторов * в структуре sampling_result_t. */ enum sampling_error_code_e { SAMPLING_SUCCESS, SAMPLING_TIMEOUT, SAMPLING_CUDA_ERROR, SAMPLING_UNKNOWN_ERROR }; /* * Структура результата генерации векторов. Заполняется функцией * генерации векторов. * * В поле generated_vectors_number хранится число сгенерированных векторов * выборки. Даже при неудачной генерации, оно может быть отлично от * нуля, поэтому неплохо бы знать об этом. */ struct sampling_result_t { sampling_result_t(sampling_cofiguration_t *conf) { size_t size = conf->dimension*conf->sample_size; vector_sample = new float[size]; memset(vector_sample, 0, size*sizeof(float)); error = SAMPLING_SUCCESS; cuda_error = hipSuccess; generated_vectors_number = 0; } ~sampling_result_t() { delete [] vector_sample; } float elapsed_time; sampling_error_code_e error; hipError_t cuda_error; int generated_vectors_number; float *vector_sample; }; /* * Функция генерации векторов. Значение timeout_rounds указывает порогове число раундов (число * запусков ядра CUDA), после которого генерация завершается с ошибкой. Ошибка фиксируется в * структуре result как SAMPLING_TIMEOUT. */ void generate_vector_sample(sampling_cofiguration_t& conf, sampling_result_t& result, int timeout_rounds); #endif
.text .file "curisk.hip" # Start of file scope inline assembly .globl _ZSt21ios_base_library_initv # End of file scope inline assembly .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 host assembly to AMD host assembly.
.file "tmpxft_000e0a29_00000000-6_curisk.cudafe1.cpp" .text #APP .globl _ZSt21ios_base_library_initv #NO_APP .type _ZL26__cudaUnregisterBinaryUtilv, @function _ZL26__cudaUnregisterBinaryUtilv: .LFB3900: .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 .LFE3900: .size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv .globl _Z48__device_stub__Z29generate_vector_sample_kernelvv .type _Z48__device_stub__Z29generate_vector_sample_kernelvv, @function _Z48__device_stub__Z29generate_vector_sample_kernelvv: .LFB3922: .cfi_startproc endbr64 subq $88, %rsp .cfi_def_cfa_offset 96 movq %fs:40, %rax movq %rax, 72(%rsp) xorl %eax, %eax movl $1, 16(%rsp) movl $1, 20(%rsp) movl $1, 24(%rsp) movl $1, 28(%rsp) movl $1, 32(%rsp) movl $1, 36(%rsp) leaq 8(%rsp), %rcx movq %rsp, %rdx leaq 28(%rsp), %rsi leaq 16(%rsp), %rdi call __cudaPopCallConfiguration@PLT testl %eax, %eax je .L7 .L3: movq 72(%rsp), %rax subq %fs:40, %rax jne .L8 addq $88, %rsp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L7: .cfi_restore_state pushq 8(%rsp) .cfi_def_cfa_offset 104 pushq 8(%rsp) .cfi_def_cfa_offset 112 leaq 80(%rsp), %r9 movq 44(%rsp), %rcx movl 52(%rsp), %r8d movq 32(%rsp), %rsi movl 40(%rsp), %edx leaq _Z29generate_vector_sample_kernelv(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 96 jmp .L3 .L8: call __stack_chk_fail@PLT .cfi_endproc .LFE3922: .size _Z48__device_stub__Z29generate_vector_sample_kernelvv, .-_Z48__device_stub__Z29generate_vector_sample_kernelvv .globl _Z29generate_vector_sample_kernelv .type _Z29generate_vector_sample_kernelv, @function _Z29generate_vector_sample_kernelv: .LFB3923: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z48__device_stub__Z29generate_vector_sample_kernelvv addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE3923: .size _Z29generate_vector_sample_kernelv, .-_Z29generate_vector_sample_kernelv .globl _Z40__device_stub__Z21setup_gamma_generatorll .type _Z40__device_stub__Z21setup_gamma_generatorll, @function _Z40__device_stub__Z21setup_gamma_generatorll: .LFB3924: .cfi_startproc endbr64 subq $104, %rsp .cfi_def_cfa_offset 112 movq %rdi, 8(%rsp) movq %fs:40, %rax movq %rax, 88(%rsp) xorl %eax, %eax leaq 8(%rsp), %rax movq %rax, 80(%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 .L15 .L11: movq 88(%rsp), %rax subq %fs:40, %rax jne .L16 addq $104, %rsp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L15: .cfi_restore_state pushq 24(%rsp) .cfi_def_cfa_offset 120 pushq 24(%rsp) .cfi_def_cfa_offset 128 leaq 96(%rsp), %r9 movq 60(%rsp), %rcx movl 68(%rsp), %r8d movq 48(%rsp), %rsi movl 56(%rsp), %edx leaq _Z21setup_gamma_generatorl(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 112 jmp .L11 .L16: call __stack_chk_fail@PLT .cfi_endproc .LFE3924: .size _Z40__device_stub__Z21setup_gamma_generatorll, .-_Z40__device_stub__Z21setup_gamma_generatorll .globl _Z21setup_gamma_generatorl .type _Z21setup_gamma_generatorl, @function _Z21setup_gamma_generatorl: .LFB3925: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z40__device_stub__Z21setup_gamma_generatorll addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE3925: .size _Z21setup_gamma_generatorl, .-_Z21setup_gamma_generatorl .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "Preparing constant variables." .section .rodata.str1.8,"aMS",@progbits,1 .align 8 .LC1: .string "/home/ubuntu/Datasets/stackv2/train-structured/zikovam/curisk-c/master/curisk.cu" .section .rodata.str1.1 .LC2: .string "\nError \"%s\" at %s:%d\n" .section .rodata.str1.8 .align 8 .LC3: .string "Allocate memory for vector sample." .align 8 .LC4: .string "Allocate memory for round vector sample." .align 8 .LC5: .string "Setup CUDA random numbers generator." .section .rodata.str1.1 .LC6: .string "Start round cycle." .section .rodata.str1.8 .align 8 .LC7: .string "Round cycle is terminated (timeout)." .section .rodata.str1.1 .LC8: .string "Stop round cycle." .LC9: .string "Vectors generated: " .LC10: .string "/" .LC11: .string "." .LC13: .string "Elapsed time: " .LC14: .string " s." .text .globl _Z22generate_vector_sampleR23sampling_cofiguration_tR17sampling_result_ti .type _Z22generate_vector_sampleR23sampling_cofiguration_tR17sampling_result_ti, @function _Z22generate_vector_sampleR23sampling_cofiguration_tR17sampling_result_ti: .LFB3896: .cfi_startproc endbr64 pushq %r15 .cfi_def_cfa_offset 16 .cfi_offset 15, -16 pushq %r14 .cfi_def_cfa_offset 24 .cfi_offset 14, -24 pushq %r13 .cfi_def_cfa_offset 32 .cfi_offset 13, -32 pushq %r12 .cfi_def_cfa_offset 40 .cfi_offset 12, -40 pushq %rbp .cfi_def_cfa_offset 48 .cfi_offset 6, -48 pushq %rbx .cfi_def_cfa_offset 56 .cfi_offset 3, -56 subq $88, %rsp .cfi_def_cfa_offset 144 movq %rdi, %rbp movq %rsi, (%rsp) movl %edx, %r14d movq %fs:40, %rax movq %rax, 72(%rsp) xorl %eax, %eax call clock@PLT movq %rax, 8(%rsp) movq 64(%rbp), %rbx movl $29, %edx leaq .LC0(%rip), %rsi movq %rbx, %rdi call _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT movq (%rbx), %rax movq -24(%rax), %rax movq 240(%rbx,%rax), %r12 testq %r12, %r12 je .L83 cmpb $0, 56(%r12) je .L22 movzbl 67(%r12), %esi .L23: movsbl %sil, %esi movq %rbx, %rdi call _ZNSo3putEc@PLT movq %rax, %rdi call _ZNSo5flushEv@PLT movl $1, %r8d movl $0, %ecx movl $4, %edx movq %rbp, %rsi leaq _ZL11c_dimension(%rip), %rdi call cudaMemcpyToSymbol@PLT call cudaGetLastError@PLT testl %eax, %eax jne .L84 leaq 32(%rbp), %rsi movl $1, %r8d movl $0, %ecx movl $4, %edx leaq _ZL13c_sample_size(%rip), %rdi call cudaMemcpyToSymbol@PLT call cudaGetLastError@PLT testl %eax, %eax jne .L85 movslq 0(%rbp), %rdx salq $2, %rdx movq 8(%rbp), %rsi movl $1, %r8d movl $0, %ecx leaq _ZL15c_vector_scheme(%rip), %rdi call cudaMemcpyToSymbol@PLT call cudaGetLastError@PLT testl %eax, %eax jne .L86 movslq 0(%rbp), %rdx salq $3, %rdx movq 16(%rbp), %rsi movl $1, %r8d movl $0, %ecx leaq _ZL15c_vector_bounds(%rip), %rdi call cudaMemcpyToSymbol@PLT call cudaGetLastError@PLT testl %eax, %eax jne .L87 movslq 0(%rbp), %rdx salq $3, %rdx movq 24(%rbp), %rsi movl $1, %r8d movl $0, %ecx leaq _ZL16c_vector_ordinal(%rip), %rdi call cudaMemcpyToSymbol@PLT call cudaGetLastError@PLT testl %eax, %eax jne .L88 movq 64(%rbp), %rbx movl $34, %edx leaq .LC3(%rip), %rsi movq %rbx, %rdi call _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT movq (%rbx), %rax movq -24(%rax), %rax movq 240(%rbx,%rax), %r12 testq %r12, %r12 je .L89 cmpb $0, 56(%r12) je .L31 movzbl 67(%r12), %esi .L32: movsbl %sil, %esi movq %rbx, %rdi call _ZNSo3putEc@PLT movq %rax, %rdi call _ZNSo5flushEv@PLT movl 32(%rbp), %esi imull 0(%rbp), %esi movslq %esi, %rsi salq $2, %rsi leaq 24(%rsp), %rdi call cudaMalloc@PLT call cudaGetLastError@PLT testl %eax, %eax jne .L90 leaq 24(%rsp), %rsi movl $1, %r8d movl $0, %ecx movl $8, %edx leaq _ZL15d_vector_sample(%rip), %rdi call cudaMemcpyToSymbol@PLT call cudaGetLastError@PLT testl %eax, %eax jne .L91 movq 64(%rbp), %rbx movl $40, %edx leaq .LC4(%rip), %rsi movq %rbx, %rdi call _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT movq (%rbx), %rax movq -24(%rax), %rax movq 240(%rbx,%rax), %r12 testq %r12, %r12 je .L92 cmpb $0, 56(%r12) je .L37 movzbl 67(%r12), %esi .L38: movsbl %sil, %esi movq %rbx, %rdi call _ZNSo3putEc@PLT movq %rax, %rdi call _ZNSo5flushEv@PLT movl 36(%rbp), %r12d movl 48(%rbp), %r13d movl %r12d, %eax imull %r13d, %eax movl %eax, 16(%rsp) leaq 16(%rsp), %rsi movl $1, %r8d movl $0, %ecx movl $4, %edx leaq _ZL19d_round_sample_size(%rip), %rdi call cudaMemcpyToSymbol@PLT call cudaGetLastError@PLT testl %eax, %eax jne .L93 movl 0(%rbp), %esi imull 16(%rsp), %esi movslq %esi, %rsi salq $2, %rsi leaq 32(%rsp), %rdi call cudaMalloc@PLT call cudaGetLastError@PLT testl %eax, %eax jne .L94 leaq 32(%rsp), %rsi movl $1, %r8d movl $0, %ecx movl $8, %edx leaq _ZL21d_round_vector_sample(%rip), %rdi call cudaMemcpyToSymbol@PLT call cudaGetLastError@PLT testl %eax, %eax jne .L95 movq 64(%rbp), %rbx movl $36, %edx leaq .LC5(%rip), %rsi movq %rbx, %rdi call _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT movq (%rbx), %rax movq -24(%rax), %rax movq 240(%rbx,%rax), %r15 testq %r15, %r15 je .L96 cmpb $0, 56(%r15) je .L44 movzbl 67(%r15), %esi .L45: movsbl %sil, %esi movq %rbx, %rdi call _ZNSo3putEc@PLT movq %rax, %rdi call _ZNSo5flushEv@PLT movslq 16(%rsp), %rax leaq (%rax,%rax,2), %rsi salq $4, %rsi leaq 40(%rsp), %rdi call cudaMalloc@PLT call cudaGetLastError@PLT testl %eax, %eax jne .L97 leaq 40(%rsp), %rsi movl $1, %r8d movl $0, %ecx movl $8, %edx leaq _ZL15d_curand_states(%rip), %rdi call cudaMemcpyToSymbol@PLT call cudaGetLastError@PLT testl %eax, %eax jne .L98 movl %r13d, 60(%rsp) movl $1, 64(%rsp) movl $1, 68(%rsp) movl %r12d, 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 .L99 .L48: call cudaGetLastError@PLT testl %eax, %eax jne .L100 call cudaDeviceSynchronize@PLT call cudaGetLastError@PLT testl %eax, %eax jne .L101 movl $0, 20(%rsp) leaq 20(%rsp), %rsi movl $1, %r8d movl $0, %ecx movl $4, %edx leaq _ZL15d_vectors_ready(%rip), %rdi call cudaMemcpyToSymbol@PLT call cudaGetLastError@PLT testl %eax, %eax jne .L102 movq 64(%rbp), %rbx movl $18, %edx leaq .LC6(%rip), %rsi movq %rbx, %rdi call _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT movq (%rbx), %rax movq -24(%rax), %rax movq 240(%rbx,%rax), %r15 testq %r15, %r15 je .L103 cmpb $0, 56(%r15) je .L54 movzbl 67(%r15), %esi .L55: movsbl %sil, %esi movq %rbx, %rdi call _ZNSo3putEc@PLT movq %rax, %rdi call _ZNSo5flushEv@PLT movl $0, %ebx leaq _ZL15d_vectors_ready(%rip), %r15 jmp .L56 .L83: movq 72(%rsp), %rax subq %fs:40, %rax jne .L104 call _ZSt16__throw_bad_castv@PLT .L104: call __stack_chk_fail@PLT .L22: movq %r12, %rdi call _ZNKSt5ctypeIcE13_M_widen_initEv@PLT movq (%r12), %rax movl $10, %esi movq %r12, %rdi call *48(%rax) movl %eax, %esi jmp .L23 .L84: call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $42, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L85: call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $43, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L86: call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $44, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L87: call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $45, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L88: call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $46, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L89: movq 72(%rsp), %rax subq %fs:40, %rax jne .L105 call _ZSt16__throw_bad_castv@PLT .L105: call __stack_chk_fail@PLT .L31: movq %r12, %rdi call _ZNKSt5ctypeIcE13_M_widen_initEv@PLT movq (%r12), %rax movl $10, %esi movq %r12, %rdi call *48(%rax) movl %eax, %esi jmp .L32 .L90: call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $51, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L91: call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $52, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L92: movq 72(%rsp), %rax subq %fs:40, %rax jne .L106 call _ZSt16__throw_bad_castv@PLT .L106: call __stack_chk_fail@PLT .L37: movq %r12, %rdi call _ZNKSt5ctypeIcE13_M_widen_initEv@PLT movq (%r12), %rax movl $10, %esi movq %r12, %rdi call *48(%rax) movl %eax, %esi jmp .L38 .L93: call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $59, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L94: call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $62, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L95: call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $63, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L96: movq 72(%rsp), %rax subq %fs:40, %rax jne .L107 call _ZSt16__throw_bad_castv@PLT .L107: 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 jmp .L45 .L97: call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $68, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L98: call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $69, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L99: call clock@PLT movq %rax, %rdi call _Z40__device_stub__Z21setup_gamma_generatorll jmp .L48 .L100: call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $71, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L101: call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $72, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L102: call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $76, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L103: movq 72(%rsp), %rax subq %fs:40, %rax jne .L108 call _ZSt16__throw_bad_castv@PLT .L108: call __stack_chk_fail@PLT .L54: movq %r15, %rdi call _ZNKSt5ctypeIcE13_M_widen_initEv@PLT movq (%r15), %rax movl $10, %esi movq %r15, %rdi call *48(%rax) movl %eax, %esi jmp .L55 .L57: call cudaDeviceSynchronize@PLT testl %eax, %eax jne .L109 leaq 20(%rsp), %rdi movl $2, %r8d movl $0, %ecx movl $4, %edx movq %r15, %rsi call cudaMemcpyFromSymbol@PLT call cudaGetLastError@PLT testl %eax, %eax jne .L110 addl $1, %ebx cmpl %r14d, %ebx jg .L111 .L56: movl 20(%rsp), %eax cmpl %eax, 32(%rbp) jle .L64 movl %r13d, 60(%rsp) movl $1, 64(%rsp) movl $1, 68(%rsp) movl %r12d, 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 jne .L57 call _Z48__device_stub__Z29generate_vector_sample_kernelvv jmp .L57 .L109: call cudaDeviceSynchronize@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $83, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L110: call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $84, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L111: movq 64(%rbp), %rbx movl $36, %edx leaq .LC7(%rip), %rsi movq %rbx, %rdi call _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT movq (%rbx), %rax movq -24(%rax), %rax movq 240(%rbx,%rax), %r12 testq %r12, %r12 je .L112 cmpb $0, 56(%r12) je .L62 movzbl 67(%r12), %esi .L63: movsbl %sil, %esi movq %rbx, %rdi call _ZNSo3putEc@PLT movq %rax, %rdi call _ZNSo5flushEv@PLT movl 20(%rsp), %eax movq (%rsp), %rcx movl %eax, 12(%rcx) movl $1, 4(%rcx) .L64: movq 64(%rbp), %rbx movl $17, %edx leaq .LC8(%rip), %rsi movq %rbx, %rdi call _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT movq (%rbx), %rax movq -24(%rax), %rax movq 240(%rbx,%rax), %r12 testq %r12, %r12 je .L113 cmpb $0, 56(%r12) je .L68 movzbl 67(%r12), %esi .L69: movsbl %sil, %esi movq %rbx, %rdi call _ZNSo3putEc@PLT movq %rax, %rdi call _ZNSo5flushEv@PLT movq 64(%rbp), %rbx movl $19, %edx leaq .LC9(%rip), %rsi movq %rbx, %rdi call _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT movl 20(%rsp), %esi movq %rbx, %rdi call _ZNSolsEi@PLT movq %rax, %rbx movl $1, %edx leaq .LC10(%rip), %rsi movq %rax, %rdi call _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT movl 32(%rbp), %esi movq %rbx, %rdi call _ZNSolsEi@PLT movq %rax, %rbx movl $1, %edx leaq .LC11(%rip), %rsi movq %rax, %rdi call _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT movq (%rbx), %rax movq -24(%rax), %rax movq 240(%rbx,%rax), %r12 testq %r12, %r12 je .L114 cmpb $0, 56(%r12) je .L72 movzbl 67(%r12), %esi .L73: movsbl %sil, %esi movq %rbx, %rdi call _ZNSo3putEc@PLT movq %rax, %rdi call _ZNSo5flushEv@PLT movl 32(%rbp), %eax movl 20(%rsp), %edx cmpl %edx, %eax jle .L74 imull 0(%rbp), %edx movslq %edx, %rdx salq $2, %rdx movq (%rsp), %rax movq 16(%rax), %rdi movl $2, %ecx movq 24(%rsp), %rsi call cudaMemcpy@PLT call cudaGetLastError@PLT testl %eax, %eax jne .L115 .L75: movq 24(%rsp), %rdi call cudaFree@PLT movq 32(%rsp), %rdi call cudaFree@PLT movq 40(%rsp), %rdi call cudaFree@PLT call clock@PLT movl 8(%rsp), %ecx subl %ecx, %eax pxor %xmm0, %xmm0 cvtsi2ssl %eax, %xmm0 divss .LC12(%rip), %xmm0 movss %xmm0, 8(%rsp) movq 64(%rbp), %rbx movl $14, %edx leaq .LC13(%rip), %rsi movq %rbx, %rdi call _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT pxor %xmm0, %xmm0 cvtss2sd 8(%rsp), %xmm0 movq %rbx, %rdi call _ZNSo9_M_insertIdEERSoT_@PLT movq %rax, %rbx movl $3, %edx leaq .LC14(%rip), %rsi movq %rax, %rdi call _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT movq (%rbx), %rax movq -24(%rax), %rax movq 240(%rbx,%rax), %rbp testq %rbp, %rbp je .L116 cmpb $0, 56(%rbp) je .L78 movzbl 67(%rbp), %esi .L79: movsbl %sil, %esi movq %rbx, %rdi call _ZNSo3putEc@PLT movq %rax, %rdi call _ZNSo5flushEv@PLT movq (%rsp), %rax movss 8(%rsp), %xmm1 movss %xmm1, (%rax) movq 72(%rsp), %rax subq %fs:40, %rax jne .L117 addq $88, %rsp .cfi_remember_state .cfi_def_cfa_offset 56 popq %rbx .cfi_def_cfa_offset 48 popq %rbp .cfi_def_cfa_offset 40 popq %r12 .cfi_def_cfa_offset 32 popq %r13 .cfi_def_cfa_offset 24 popq %r14 .cfi_def_cfa_offset 16 popq %r15 .cfi_def_cfa_offset 8 ret .L112: .cfi_restore_state movq 72(%rsp), %rax subq %fs:40, %rax jne .L118 call _ZSt16__throw_bad_castv@PLT .L118: call __stack_chk_fail@PLT .L62: movq %r12, %rdi call _ZNKSt5ctypeIcE13_M_widen_initEv@PLT movq (%r12), %rax movl $10, %esi movq %r12, %rdi call *48(%rax) movl %eax, %esi jmp .L63 .L113: movq 72(%rsp), %rax subq %fs:40, %rax jne .L119 call _ZSt16__throw_bad_castv@PLT .L119: call __stack_chk_fail@PLT .L68: movq %r12, %rdi call _ZNKSt5ctypeIcE13_M_widen_initEv@PLT movq (%r12), %rax movl $10, %esi movq %r12, %rdi call *48(%rax) movl %eax, %esi jmp .L69 .L114: movq 72(%rsp), %rax subq %fs:40, %rax jne .L120 call _ZSt16__throw_bad_castv@PLT .L120: call __stack_chk_fail@PLT .L72: movq %r12, %rdi call _ZNKSt5ctypeIcE13_M_widen_initEv@PLT movq (%r12), %rax movl $10, %esi movq %r12, %rdi call *48(%rax) movl %eax, %esi jmp .L73 .L115: call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $100, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L74: imull 0(%rbp), %eax movslq %eax, %rdx salq $2, %rdx movq (%rsp), %rax movq 16(%rax), %rdi movl $2, %ecx movq 24(%rsp), %rsi call cudaMemcpy@PLT call cudaGetLastError@PLT testl %eax, %eax je .L75 call cudaGetLastError@PLT movl %eax, %edi call cudaGetErrorString@PLT movq %rax, %rdx movl $104, %r8d leaq .LC1(%rip), %rcx leaq .LC2(%rip), %rsi movl $2, %edi movl $0, %eax call __printf_chk@PLT movl $1, %edi call exit@PLT .L116: movq 72(%rsp), %rax subq %fs:40, %rax jne .L121 call _ZSt16__throw_bad_castv@PLT .L121: call __stack_chk_fail@PLT .L78: movq %rbp, %rdi call _ZNKSt5ctypeIcE13_M_widen_initEv@PLT movq 0(%rbp), %rax movl $10, %esi movq %rbp, %rdi call *48(%rax) movl %eax, %esi jmp .L79 .L117: call __stack_chk_fail@PLT .cfi_endproc .LFE3896: .size _Z22generate_vector_sampleR23sampling_cofiguration_tR17sampling_result_ti, .-_Z22generate_vector_sampleR23sampling_cofiguration_tR17sampling_result_ti .section .rodata.str1.1 .LC15: .string "_Z21setup_gamma_generatorl" .section .rodata.str1.8 .align 8 .LC16: .string "_Z29generate_vector_sample_kernelv" .section .rodata.str1.1 .LC17: .string "precalc_xorwow_matrix" .LC18: .string "precalc_xorwow_offset_matrix" .LC19: .string "mrg32k3aM1" .LC20: .string "mrg32k3aM2" .LC21: .string "mrg32k3aM1SubSeq" .LC22: .string "mrg32k3aM2SubSeq" .LC23: .string "mrg32k3aM1Seq" .LC24: .string "mrg32k3aM2Seq" .LC25: .string "__cr_lgamma_table" .LC26: .string "c_dimension" .LC27: .string "c_vector_scheme" .LC28: .string "c_vector_bounds" .LC29: .string "c_vector_ordinal" .LC30: .string "c_sample_size" .LC31: .string "d_vector_sample" .LC32: .string "d_round_sample_size" .LC33: .string "d_round_vector_sample" .LC34: .string "d_curand_states" .LC35: .string "d_vectors_ready" .text .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB3927: .cfi_startproc endbr64 pushq %rbx .cfi_def_cfa_offset 16 .cfi_offset 3, -16 leaq _ZL15__fatDeviceText(%rip), %rdi call __cudaRegisterFatBinary@PLT movq %rax, %rbx 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 .LC15(%rip), %rdx movq %rdx, %rcx leaq _Z21setup_gamma_generatorl(%rip), %rsi movq %rax, %rdi call __cudaRegisterFunction@PLT addq $32, %rsp .cfi_def_cfa_offset 16 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 .LC16(%rip), %rdx movq %rdx, %rcx leaq _Z29generate_vector_sample_kernelv(%rip), %rsi movq %rbx, %rdi call __cudaRegisterFunction@PLT addq $32, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 movl $102400, %r9d movl $0, %r8d leaq .LC17(%rip), %rdx movq %rdx, %rcx leaq _ZL21precalc_xorwow_matrix(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 movl $102400, %r9d movl $0, %r8d leaq .LC18(%rip), %rdx movq %rdx, %rcx leaq _ZL28precalc_xorwow_offset_matrix(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 movl $2304, %r9d movl $0, %r8d leaq .LC19(%rip), %rdx movq %rdx, %rcx leaq _ZL10mrg32k3aM1(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 movl $2304, %r9d movl $0, %r8d leaq .LC20(%rip), %rdx movq %rdx, %rcx leaq _ZL10mrg32k3aM2(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 movl $2016, %r9d movl $0, %r8d leaq .LC21(%rip), %rdx movq %rdx, %rcx leaq _ZL16mrg32k3aM1SubSeq(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 movl $2016, %r9d movl $0, %r8d leaq .LC22(%rip), %rdx movq %rdx, %rcx leaq _ZL16mrg32k3aM2SubSeq(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 movl $2304, %r9d movl $0, %r8d leaq .LC23(%rip), %rdx movq %rdx, %rcx leaq _ZL13mrg32k3aM1Seq(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 movl $2304, %r9d movl $0, %r8d leaq .LC24(%rip), %rdx movq %rdx, %rcx leaq _ZL13mrg32k3aM2Seq(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $1 .cfi_def_cfa_offset 32 movl $72, %r9d movl $0, %r8d leaq .LC25(%rip), %rdx movq %rdx, %rcx leaq _ZL17__cr_lgamma_table(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $1 .cfi_def_cfa_offset 32 movl $4, %r9d movl $0, %r8d leaq .LC26(%rip), %rdx movq %rdx, %rcx leaq _ZL11c_dimension(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $1 .cfi_def_cfa_offset 32 movl $128, %r9d movl $0, %r8d leaq .LC27(%rip), %rdx movq %rdx, %rcx leaq _ZL15c_vector_scheme(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $1 .cfi_def_cfa_offset 32 movl $256, %r9d movl $0, %r8d leaq .LC28(%rip), %rdx movq %rdx, %rcx leaq _ZL15c_vector_bounds(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $1 .cfi_def_cfa_offset 32 movl $256, %r9d movl $0, %r8d leaq .LC29(%rip), %rdx movq %rdx, %rcx leaq _ZL16c_vector_ordinal(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $1 .cfi_def_cfa_offset 32 movl $4, %r9d movl $0, %r8d leaq .LC30(%rip), %rdx movq %rdx, %rcx leaq _ZL13c_sample_size(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 movl $8, %r9d movl $0, %r8d leaq .LC31(%rip), %rdx movq %rdx, %rcx leaq _ZL15d_vector_sample(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 movl $4, %r9d movl $0, %r8d leaq .LC32(%rip), %rdx movq %rdx, %rcx leaq _ZL19d_round_sample_size(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 movl $8, %r9d movl $0, %r8d leaq .LC33(%rip), %rdx movq %rdx, %rcx leaq _ZL21d_round_vector_sample(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 movl $8, %r9d movl $0, %r8d leaq .LC34(%rip), %rdx movq %rdx, %rcx leaq _ZL15d_curand_states(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 movl $4, %r9d movl $0, %r8d leaq .LC35(%rip), %rdx movq %rdx, %rcx leaq _ZL15d_vectors_ready(%rip), %rsi movq %rbx, %rdi call __cudaRegisterVar@PLT addq $16, %rsp .cfi_def_cfa_offset 16 movq _ZL20__cudaFatCubinHandle(%rip), %rdi call __cudaRegisterFatBinaryEnd@PLT leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi call atexit@PLT popq %rbx .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE3927: .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 .local _ZL15d_vectors_ready .comm _ZL15d_vectors_ready,4,4 .local _ZL15d_curand_states .comm _ZL15d_curand_states,8,8 .local _ZL21d_round_vector_sample .comm _ZL21d_round_vector_sample,8,8 .local _ZL19d_round_sample_size .comm _ZL19d_round_sample_size,4,4 .local _ZL15d_vector_sample .comm _ZL15d_vector_sample,8,8 .local _ZL13c_sample_size .comm _ZL13c_sample_size,4,4 .local _ZL16c_vector_ordinal .comm _ZL16c_vector_ordinal,256,32 .local _ZL15c_vector_bounds .comm _ZL15c_vector_bounds,256,32 .local _ZL15c_vector_scheme .comm _ZL15c_vector_scheme,128,32 .local _ZL11c_dimension .comm _ZL11c_dimension,4,4 .local _ZL17__cr_lgamma_table .comm _ZL17__cr_lgamma_table,72,32 .local _ZL13mrg32k3aM2Seq .comm _ZL13mrg32k3aM2Seq,2304,32 .local _ZL13mrg32k3aM1Seq .comm _ZL13mrg32k3aM1Seq,2304,32 .local _ZL16mrg32k3aM2SubSeq .comm _ZL16mrg32k3aM2SubSeq,2016,32 .local _ZL16mrg32k3aM1SubSeq .comm _ZL16mrg32k3aM1SubSeq,2016,32 .local _ZL10mrg32k3aM2 .comm _ZL10mrg32k3aM2,2304,32 .local _ZL10mrg32k3aM1 .comm _ZL10mrg32k3aM1,2304,32 .local _ZL28precalc_xorwow_offset_matrix .comm _ZL28precalc_xorwow_offset_matrix,102400,32 .local _ZL21precalc_xorwow_matrix .comm _ZL21precalc_xorwow_matrix,102400,32 .section .rodata.cst4,"aM",@progbits,4 .align 4 .LC12: .long 1232348160 .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 "curisk.hip" # Start of file scope inline assembly .globl _ZSt21ios_base_library_initv # End of file scope inline assembly .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 <thrust/device_vector.h> #include <iostream> __global__ void kernel(float* A, int N, float* res) { extern __shared__ float shm[]; int idx = blockIdx.x * blockDim.x + threadIdx.x; int tid = threadIdx.x; shm[tid] = A[idx]; __syncthreads(); for (int i = 1; i < blockDim.x; i *= 2) { int index = 2 * i * tid; if (index < blockDim.x) shm[index] += shm[index + i]; __syncthreads(); } if (tid == 0) atomicAdd(res, shm[0]); } int main() { thrust::device_vector<float> d_vec(128, 1.f); float* raw_ptr = thrust::raw_pointer_cast(d_vec.data()); float* d_res; float res = 0.f; cudaMalloc(&d_res, sizeof(float)); cudaMemset((void*)d_res, 0, sizeof(float)); kernel<<<1, 128, 128 * sizeof(float)>>>(raw_ptr, d_vec.size(), d_res); cudaMemcpy(&res, d_res, sizeof(float), cudaMemcpyDeviceToHost); std::cout << res << "\n"; return 0; }
code for sm_80 Function : _ZN3cub17CUB_200700_800_NS6detail8for_each13static_kernelINS2_12policy_hub_t12policy_350_tEmN6thrust20THRUST_200700_800_NS8cuda_cub20__uninitialized_fill7functorINS7_10device_ptrIfEEfEEEEvT0_T1_ .headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)" /*0000*/ IMAD.MOV.U32 R1, RZ, RZ, c[0x0][0x28] ; /* 0x00000a00ff017624 */ /* 0x000fe400078e00ff */ /*0010*/ S2R R2, SR_CTAID.X ; /* 0x0000000000027919 */ /* 0x000e220000002500 */ /*0020*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */ /* 0x000fc60000000a00 */ /*0030*/ S2R R5, SR_TID.X ; /* 0x0000000000057919 */ /* 0x000e620000002100 */ /*0040*/ IMAD.WIDE.U32 R2, R2, 0x200, RZ ; /* 0x0000020002027825 */ /* 0x001fca00078e00ff */ /*0050*/ IADD3 R4, P1, -R2.reuse, c[0x0][0x160], RZ ; /* 0x0000580002047a10 */ /* 0x040fe40007f3e1ff */ /*0060*/ IADD3 R0, P2, R2, R5, RZ ; /* 0x0000000502007210 */ /* 0x002fe40007f5e0ff */ /*0070*/ ISETP.GT.U32.AND P0, PT, R4, 0x1ff, PT ; /* 0x000001ff0400780c */ /* 0x000fe40003f04070 */ /*0080*/ IADD3.X R6, ~R3, c[0x0][0x164], RZ, P1, !PT ; /* 0x0000590003067a10 */ /* 0x000fe20000ffe5ff */ /*0090*/ IMAD.X R3, RZ, RZ, R3, P2 ; /* 0x000000ffff037224 */ /* 0x000fe200010e0603 */ /*00a0*/ LEA R2, P1, R0, c[0x0][0x168], 0x2 ; /* 0x00005a0000027a11 */ /* 0x000fe400078210ff */ /*00b0*/ ISETP.GT.U32.AND.EX P0, PT, R6, RZ, PT, P0 ; /* 0x000000ff0600720c */ /* 0x000fc40003f04100 */ /*00c0*/ LEA.HI.X R3, R0, c[0x0][0x16c], R3, 0x2, P1 ; /* 0x00005b0000037a11 */ /* 0x000fd600008f1403 */ /*00d0*/ @P0 BRA 0x1a0 ; /* 0x000000c000000947 */ /* 0x000fea0003800000 */ /*00e0*/ ISETP.GT.U32.AND P0, PT, R4, R5, PT ; /* 0x000000050400720c */ /* 0x000fe40003f04070 */ /*00f0*/ SHF.R.S32.HI R6, RZ, 0x1f, R4 ; /* 0x0000001fff067819 */ /* 0x000fe40000011404 */ /*0100*/ IADD3 R0, R5, 0x100, RZ ; /* 0x0000010005007810 */ /* 0x000fe40007ffe0ff */ /*0110*/ ISETP.GT.U32.AND.EX P0, PT, R6, RZ, PT, P0 ; /* 0x000000ff0600720c */ /* 0x000fda0003f04100 */ /*0120*/ @P0 IMAD.MOV.U32 R7, RZ, RZ, c[0x0][0x170] ; /* 0x00005c00ff070624 */ /* 0x000fca00078e00ff */ /*0130*/ @P0 STG.E [R2.64], R7 ; /* 0x0000000702000986 */ /* 0x0001e2000c101904 */ /*0140*/ ISETP.GT.U32.AND P0, PT, R4, R0, PT ; /* 0x000000000400720c */ /* 0x000fc80003f04070 */ /*0150*/ ISETP.GT.U32.AND.EX P0, PT, R6, RZ, PT, P0 ; /* 0x000000ff0600720c */ /* 0x000fda0003f04100 */ /*0160*/ @!P0 EXIT ; /* 0x000000000000894d */ /* 0x000fea0003800000 */ /*0170*/ IMAD.MOV.U32 R5, RZ, RZ, c[0x0][0x170] ; /* 0x00005c00ff057624 */ /* 0x001fca00078e00ff */ /*0180*/ STG.E [R2.64+0x400], R5 ; /* 0x0004000502007986 */ /* 0x000fe2000c101904 */ /*0190*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*01a0*/ IMAD.MOV.U32 R5, RZ, RZ, c[0x0][0x170] ; /* 0x00005c00ff057624 */ /* 0x000fca00078e00ff */ /*01b0*/ STG.E [R2.64], R5 ; /* 0x0000000502007986 */ /* 0x000fe8000c101904 */ /*01c0*/ STG.E [R2.64+0x400], R5 ; /* 0x0004000502007986 */ /* 0x000fe2000c101904 */ /*01d0*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*01e0*/ BRA 0x1e0; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*01f0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0200*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0210*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0220*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0230*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0240*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0250*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0260*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0270*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ .......... Function : _ZN3cub17CUB_200700_800_NS11EmptyKernelIvEEvv .headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)" /*0000*/ MOV R1, c[0x0][0x28] ; /* 0x00000a0000017a02 */ /* 0x000fe40000000f00 */ /*0010*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*0020*/ BRA 0x20; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*0030*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0040*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0050*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0060*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0070*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0080*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0090*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*00a0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*00b0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*00c0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*00d0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*00e0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*00f0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ .......... Function : _Z6kernelPfiS_ .headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)" /*0000*/ MOV R1, c[0x0][0x28] ; /* 0x00000a0000017a02 */ /* 0x000fe40000000f00 */ /*0010*/ S2R R2, SR_CTAID.X ; /* 0x0000000000027919 */ /* 0x000e220000002500 */ /*0020*/ HFMA2.MMA R3, -RZ, RZ, 0, 2.384185791015625e-07 ; /* 0x00000004ff037435 */ /* 0x000fe200000001ff */ /*0030*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */ /* 0x000fe40000000a00 */ /*0040*/ S2R R5, SR_TID.X ; /* 0x0000000000057919 */ /* 0x000e240000002100 */ /*0050*/ IMAD R2, R2, c[0x0][0x0], R5 ; /* 0x0000000002027a24 */ /* 0x001fca00078e0205 */ /*0060*/ IMAD.WIDE R2, R2, R3, c[0x0][0x160] ; /* 0x0000580002027625 */ /* 0x000fcc00078e0203 */ /*0070*/ LDG.E R2, [R2.64] ; /* 0x0000000402027981 */ /* 0x000ea2000c1e1900 */ /*0080*/ IMAD.MOV.U32 R0, RZ, RZ, c[0x0][0x0] ; /* 0x00000000ff007624 */ /* 0x000fe200078e00ff */ /*0090*/ ISETP.NE.AND P0, PT, R5, RZ, PT ; /* 0x000000ff0500720c */ /* 0x000fc80003f05270 */ /*00a0*/ ISETP.GE.U32.AND P1, PT, R0, 0x2, PT ; /* 0x000000020000780c */ /* 0x000fe20003f26070 */ /*00b0*/ STS [R5.X4], R2 ; /* 0x0000000205007388 */ /* 0x0041e80000004800 */ /*00c0*/ BAR.SYNC.DEFER_BLOCKING 0x0 ; /* 0x0000000000007b1d */ /* 0x000ff00000010000 */ /*00d0*/ @!P1 BRA 0x1b0 ; /* 0x000000d000009947 */ /* 0x000fea0003800000 */ /*00e0*/ MOV R0, 0x1 ; /* 0x0000000100007802 */ /* 0x001fca0000000f00 */ /*00f0*/ IMAD.SHL.U32 R4, R0, 0x2, RZ ; /* 0x0000000200047824 */ /* 0x000fc800078e00ff */ /*0100*/ IMAD R6, R4, R5, RZ ; /* 0x0000000504067224 */ /* 0x000fca00078e02ff */ /*0110*/ ISETP.GE.U32.AND P1, PT, R6, c[0x0][0x0], PT ; /* 0x0000000006007a0c */ /* 0x000fda0003f26070 */ /*0120*/ @!P1 IADD3 R2, R6, R0, RZ ; /* 0x0000000006029210 */ /* 0x000fe40007ffe0ff */ /*0130*/ @!P1 LDS R0, [R6.X4] ; /* 0x0000000006009984 */ /* 0x000fe80000004800 */ /*0140*/ @!P1 LDS R3, [R2.X4] ; /* 0x0000000002039984 */ /* 0x000e240000004800 */ /*0150*/ @!P1 FADD R3, R0, R3 ; /* 0x0000000300039221 */ /* 0x001fe40000000000 */ /*0160*/ IMAD.MOV.U32 R0, RZ, RZ, R4 ; /* 0x000000ffff007224 */ /* 0x000fc600078e0004 */ /*0170*/ @!P1 STS [R6.X4], R3 ; /* 0x0000000306009388 */ /* 0x0001e80000004800 */ /*0180*/ BAR.SYNC.DEFER_BLOCKING 0x0 ; /* 0x0000000000007b1d */ /* 0x000fe20000010000 */ /*0190*/ ISETP.GE.U32.AND P1, PT, R4, c[0x0][0x0], PT ; /* 0x0000000004007a0c */ /* 0x000fda0003f26070 */ /*01a0*/ @!P1 BRA 0xf0 ; /* 0xffffff4000009947 */ /* 0x001fea000383ffff */ /*01b0*/ @P0 EXIT ; /* 0x000000000000094d */ /* 0x001fea0003800000 */ /*01c0*/ LDS R5, [RZ] ; /* 0x00000000ff057984 */ /* 0x000e220000000800 */ /*01d0*/ MOV R2, c[0x0][0x170] ; /* 0x00005c0000027a02 */ /* 0x000fe20000000f00 */ /*01e0*/ IMAD.MOV.U32 R3, RZ, RZ, c[0x0][0x174] ; /* 0x00005d00ff037624 */ /* 0x000fca00078e00ff */ /*01f0*/ RED.E.ADD.F32.FTZ.RN.STRONG.GPU [R2.64], R5 ; /* 0x000000050200798e */ /* 0x001fe2000c10e784 */ /*0200*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*0210*/ BRA 0x210; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*0220*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0230*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0240*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0250*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0260*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0270*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0280*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*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 */ ..........
You are a helpful coding assistant specialized in converting CUDA source code to HIP/AMD source code.
#include <thrust/device_vector.h> #include <iostream> __global__ void kernel(float* A, int N, float* res) { extern __shared__ float shm[]; int idx = blockIdx.x * blockDim.x + threadIdx.x; int tid = threadIdx.x; shm[tid] = A[idx]; __syncthreads(); for (int i = 1; i < blockDim.x; i *= 2) { int index = 2 * i * tid; if (index < blockDim.x) shm[index] += shm[index + i]; __syncthreads(); } if (tid == 0) atomicAdd(res, shm[0]); } int main() { thrust::device_vector<float> d_vec(128, 1.f); float* raw_ptr = thrust::raw_pointer_cast(d_vec.data()); float* d_res; float res = 0.f; cudaMalloc(&d_res, sizeof(float)); cudaMemset((void*)d_res, 0, sizeof(float)); kernel<<<1, 128, 128 * sizeof(float)>>>(raw_ptr, d_vec.size(), d_res); cudaMemcpy(&res, d_res, sizeof(float), cudaMemcpyDeviceToHost); std::cout << res << "\n"; return 0; }
#include <hip/hip_runtime.h> #include <thrust/device_vector.h> #include <iostream> __global__ void kernel(float* A, int N, float* res) { extern __shared__ float shm[]; int idx = blockIdx.x * blockDim.x + threadIdx.x; int tid = threadIdx.x; shm[tid] = A[idx]; __syncthreads(); for (int i = 1; i < blockDim.x; i *= 2) { int index = 2 * i * tid; if (index < blockDim.x) shm[index] += shm[index + i]; __syncthreads(); } if (tid == 0) atomicAdd(res, shm[0]); } int main() { thrust::device_vector<float> d_vec(128, 1.f); float* raw_ptr = thrust::raw_pointer_cast(d_vec.data()); float* d_res; float res = 0.f; hipMalloc(&d_res, sizeof(float)); hipMemset((void*)d_res, 0, sizeof(float)); kernel<<<1, 128, 128 * sizeof(float)>>>(raw_ptr, d_vec.size(), d_res); hipMemcpy(&res, d_res, sizeof(float), hipMemcpyDeviceToHost); std::cout << res << "\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 <thrust/device_vector.h> #include <iostream> __global__ void kernel(float* A, int N, float* res) { extern __shared__ float shm[]; int idx = blockIdx.x * blockDim.x + threadIdx.x; int tid = threadIdx.x; shm[tid] = A[idx]; __syncthreads(); for (int i = 1; i < blockDim.x; i *= 2) { int index = 2 * i * tid; if (index < blockDim.x) shm[index] += shm[index + i]; __syncthreads(); } if (tid == 0) atomicAdd(res, shm[0]); } int main() { thrust::device_vector<float> d_vec(128, 1.f); float* raw_ptr = thrust::raw_pointer_cast(d_vec.data()); float* d_res; float res = 0.f; hipMalloc(&d_res, sizeof(float)); hipMemset((void*)d_res, 0, sizeof(float)); kernel<<<1, 128, 128 * sizeof(float)>>>(raw_ptr, d_vec.size(), d_res); hipMemcpy(&res, d_res, sizeof(float), hipMemcpyDeviceToHost); std::cout << res << "\n"; return 0; }
.text .amdgcn_target "amdgcn-amd-amdhsa--gfx1100" .protected _Z6kernelPfiS_ .globl _Z6kernelPfiS_ .p2align 8 .type _Z6kernelPfiS_,@function _Z6kernelPfiS_: s_clause 0x1 s_load_b32 s2, s[0:1], 0x24 s_load_b64 s[4:5], s[0:1], 0x0 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_cmp_lt_u32 s2, 2 v_ashrrev_i32_e32 v2, 31, v1 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_lshlrev_b64 v[1:2], 2, v[1:2] v_add_co_u32 v1, vcc_lo, 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 v1, v[1:2], off v_lshl_add_u32 v2, v0, 2, 0 s_waitcnt vmcnt(0) ds_store_b32 v2, v1 s_waitcnt lgkmcnt(0) s_barrier buffer_gl0_inv s_cbranch_scc1 .LBB0_5 s_mov_b32 s4, 1 s_set_inst_prefetch_distance 0x1 s_branch .LBB0_3 .p2align 6 .LBB0_2: s_or_b32 exec_lo, exec_lo, s5 s_cmp_ge_u32 s3, s2 s_mov_b32 s4, s3 s_waitcnt lgkmcnt(0) s_barrier buffer_gl0_inv s_cbranch_scc1 .LBB0_5 .LBB0_3: s_lshl_b32 s3, s4, 1 s_mov_b32 s5, exec_lo v_mul_lo_u32 v1, s3, v0 s_delay_alu instid0(VALU_DEP_1) v_cmpx_gt_u32_e64 s2, v1 s_cbranch_execz .LBB0_2 v_add_nc_u32_e32 v2, s4, v1 v_lshl_add_u32 v1, v1, 2, 0 s_delay_alu instid0(VALU_DEP_2) v_lshl_add_u32 v2, v2, 2, 0 ds_load_b32 v2, v2 ds_load_b32 v3, v1 s_waitcnt lgkmcnt(0) v_add_f32_e32 v2, v2, v3 ds_store_b32 v1, v2 s_branch .LBB0_2 .LBB0_5: s_set_inst_prefetch_distance 0x2 s_mov_b32 s2, exec_lo v_cmpx_eq_u32_e32 0, v0 s_cbranch_execz .LBB0_9 s_mov_b32 s2, exec_lo s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_mbcnt_lo_u32_b32 v0, s2, 0 v_cmp_eq_u32_e32 vcc_lo, 0, v0 s_and_b32 s3, exec_lo, vcc_lo s_delay_alu instid0(SALU_CYCLE_1) s_mov_b32 exec_lo, s3 s_cbranch_execz .LBB0_9 s_load_b64 s[0:1], s[0:1], 0x10 s_bcnt1_i32_b32 s2, s2 v_mov_b32_e32 v3, 0 v_cvt_f32_ubyte0_e32 v1, s2 s_mov_b32 s2, 0 s_waitcnt lgkmcnt(0) s_load_b32 s3, s[0:1], 0x0 v_mov_b32_e32 v0, 0 ds_load_b32 v0, v0 s_waitcnt lgkmcnt(0) v_dual_mul_f32 v2, v0, v1 :: v_dual_mov_b32 v1, s3 .LBB0_8: s_delay_alu instid0(VALU_DEP_1) v_add_f32_e32 v0, v1, v2 global_atomic_cmpswap_b32 v0, v3, v[0:1], s[0:1] glc s_waitcnt vmcnt(0) v_cmp_eq_u32_e32 vcc_lo, v0, v1 v_mov_b32_e32 v1, v0 s_or_b32 s2, vcc_lo, s2 s_delay_alu instid0(SALU_CYCLE_1) s_and_not1_b32 exec_lo, exec_lo, s2 s_cbranch_execnz .LBB0_8 .LBB0_9: s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z6kernelPfiS_ .amdhsa_group_segment_fixed_size 0 .amdhsa_private_segment_fixed_size 0 .amdhsa_kernarg_size 280 .amdhsa_user_sgpr_count 15 .amdhsa_user_sgpr_dispatch_ptr 0 .amdhsa_user_sgpr_queue_ptr 0 .amdhsa_user_sgpr_kernarg_segment_ptr 1 .amdhsa_user_sgpr_dispatch_id 0 .amdhsa_user_sgpr_private_segment_size 0 .amdhsa_wavefront_size32 1 .amdhsa_uses_dynamic_stack 0 .amdhsa_enable_private_segment 0 .amdhsa_system_sgpr_workgroup_id_x 1 .amdhsa_system_sgpr_workgroup_id_y 0 .amdhsa_system_sgpr_workgroup_id_z 0 .amdhsa_system_sgpr_workgroup_info 0 .amdhsa_system_vgpr_workitem_id 0 .amdhsa_next_free_vgpr 4 .amdhsa_next_free_sgpr 16 .amdhsa_float_round_mode_32 0 .amdhsa_float_round_mode_16_64 0 .amdhsa_float_denorm_mode_32 3 .amdhsa_float_denorm_mode_16_64 3 .amdhsa_dx10_clamp 1 .amdhsa_ieee_mode 1 .amdhsa_fp16_overflow 0 .amdhsa_workgroup_processor_mode 1 .amdhsa_memory_ordered 1 .amdhsa_forward_progress 0 .amdhsa_shared_vgpr_count 0 .amdhsa_exception_fp_ieee_invalid_op 0 .amdhsa_exception_fp_denorm_src 0 .amdhsa_exception_fp_ieee_div_zero 0 .amdhsa_exception_fp_ieee_overflow 0 .amdhsa_exception_fp_ieee_underflow 0 .amdhsa_exception_fp_ieee_inexact 0 .amdhsa_exception_int_div_zero 0 .end_amdhsa_kernel .text .Lfunc_end0: .size _Z6kernelPfiS_, .Lfunc_end0-_Z6kernelPfiS_ .section .AMDGPU.csdata,"",@progbits .section .text._ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_,"axG",@progbits,_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_,comdat .protected _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_ .globl _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_ .p2align 8 .type _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_,@function _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_: s_load_b128 s[4:7], s[0:1], 0x10 s_lshl_b32 s2, s15, 8 s_waitcnt lgkmcnt(0) s_add_u32 s2, s2, s6 s_addc_u32 s3, 0, s7 s_sub_u32 s4, s4, s2 s_subb_u32 s5, s5, s3 s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_cmp_gt_u64_e64 s5, 0x100, s[4:5] s_and_b32 s5, s5, exec_lo s_cselect_b32 s4, s4, 0x100 s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1) v_cmp_gt_u32_e32 vcc_lo, s4, v0 s_cmpk_eq_i32 s4, 0x100 s_cselect_b32 s4, -1, 0 s_or_b32 s4, s4, vcc_lo s_delay_alu instid0(SALU_CYCLE_1) s_and_saveexec_b32 s5, s4 s_cbranch_execz .LBB1_2 s_clause 0x1 s_load_b64 s[4:5], s[0:1], 0x0 s_load_b32 s6, s[0:1], 0x8 v_lshlrev_b32_e32 v0, 2, v0 s_lshl_b64 s[0:1], s[2:3], 2 s_waitcnt lgkmcnt(0) s_add_u32 s0, s4, s0 s_addc_u32 s1, s5, s1 v_add_co_u32 v0, s0, s0, v0 s_delay_alu instid0(VALU_DEP_1) v_add_co_ci_u32_e64 v1, null, s1, 0, s0 v_mov_b32_e32 v2, s6 flat_store_b32 v[0:1], v2 .LBB1_2: s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_ .amdhsa_group_segment_fixed_size 0 .amdhsa_private_segment_fixed_size 0 .amdhsa_kernarg_size 32 .amdhsa_user_sgpr_count 15 .amdhsa_user_sgpr_dispatch_ptr 0 .amdhsa_user_sgpr_queue_ptr 0 .amdhsa_user_sgpr_kernarg_segment_ptr 1 .amdhsa_user_sgpr_dispatch_id 0 .amdhsa_user_sgpr_private_segment_size 0 .amdhsa_wavefront_size32 1 .amdhsa_uses_dynamic_stack 0 .amdhsa_enable_private_segment 0 .amdhsa_system_sgpr_workgroup_id_x 1 .amdhsa_system_sgpr_workgroup_id_y 0 .amdhsa_system_sgpr_workgroup_id_z 0 .amdhsa_system_sgpr_workgroup_info 0 .amdhsa_system_vgpr_workitem_id 0 .amdhsa_next_free_vgpr 3 .amdhsa_next_free_sgpr 16 .amdhsa_float_round_mode_32 0 .amdhsa_float_round_mode_16_64 0 .amdhsa_float_denorm_mode_32 3 .amdhsa_float_denorm_mode_16_64 3 .amdhsa_dx10_clamp 1 .amdhsa_ieee_mode 1 .amdhsa_fp16_overflow 0 .amdhsa_workgroup_processor_mode 1 .amdhsa_memory_ordered 1 .amdhsa_forward_progress 0 .amdhsa_shared_vgpr_count 0 .amdhsa_exception_fp_ieee_invalid_op 0 .amdhsa_exception_fp_denorm_src 0 .amdhsa_exception_fp_ieee_div_zero 0 .amdhsa_exception_fp_ieee_overflow 0 .amdhsa_exception_fp_ieee_underflow 0 .amdhsa_exception_fp_ieee_inexact 0 .amdhsa_exception_int_div_zero 0 .end_amdhsa_kernel .section .text._ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_,"axG",@progbits,_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_,comdat .Lfunc_end1: .size _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_, .Lfunc_end1-_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_ .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 - .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 - .offset: 144 .size: 4 .value_kind: hidden_dynamic_lds_size .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: _Z6kernelPfiS_ .private_segment_fixed_size: 0 .sgpr_count: 18 .sgpr_spill_count: 0 .symbol: _Z6kernelPfiS_.kd .uniform_work_group_size: 1 .uses_dynamic_stack: false .vgpr_count: 4 .vgpr_spill_count: 0 .wavefront_size: 32 .workgroup_processor_mode: 1 - .args: - .offset: 0 .size: 16 .value_kind: by_value - .offset: 16 .size: 8 .value_kind: by_value - .offset: 24 .size: 8 .value_kind: by_value .group_segment_fixed_size: 0 .kernarg_segment_align: 8 .kernarg_segment_size: 32 .language: OpenCL C .language_version: - 2 - 0 .max_flat_workgroup_size: 256 .name: _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_ .private_segment_fixed_size: 0 .sgpr_count: 18 .sgpr_spill_count: 0 .symbol: _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_.kd .uniform_work_group_size: 1 .uses_dynamic_stack: false .vgpr_count: 3 .vgpr_spill_count: 0 .wavefront_size: 32 .workgroup_processor_mode: 1 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_tEmN6thrust20THRUST_200700_800_NS8cuda_cub20__uninitialized_fill7functorINS7_10device_ptrIfEEfEEEEvT0_T1_ .headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)" /*0000*/ IMAD.MOV.U32 R1, RZ, RZ, c[0x0][0x28] ; /* 0x00000a00ff017624 */ /* 0x000fe400078e00ff */ /*0010*/ S2R R2, SR_CTAID.X ; /* 0x0000000000027919 */ /* 0x000e220000002500 */ /*0020*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */ /* 0x000fc60000000a00 */ /*0030*/ S2R R5, SR_TID.X ; /* 0x0000000000057919 */ /* 0x000e620000002100 */ /*0040*/ IMAD.WIDE.U32 R2, R2, 0x200, RZ ; /* 0x0000020002027825 */ /* 0x001fca00078e00ff */ /*0050*/ IADD3 R4, P1, -R2.reuse, c[0x0][0x160], RZ ; /* 0x0000580002047a10 */ /* 0x040fe40007f3e1ff */ /*0060*/ IADD3 R0, P2, R2, R5, RZ ; /* 0x0000000502007210 */ /* 0x002fe40007f5e0ff */ /*0070*/ ISETP.GT.U32.AND P0, PT, R4, 0x1ff, PT ; /* 0x000001ff0400780c */ /* 0x000fe40003f04070 */ /*0080*/ IADD3.X R6, ~R3, c[0x0][0x164], RZ, P1, !PT ; /* 0x0000590003067a10 */ /* 0x000fe20000ffe5ff */ /*0090*/ IMAD.X R3, RZ, RZ, R3, P2 ; /* 0x000000ffff037224 */ /* 0x000fe200010e0603 */ /*00a0*/ LEA R2, P1, R0, c[0x0][0x168], 0x2 ; /* 0x00005a0000027a11 */ /* 0x000fe400078210ff */ /*00b0*/ ISETP.GT.U32.AND.EX P0, PT, R6, RZ, PT, P0 ; /* 0x000000ff0600720c */ /* 0x000fc40003f04100 */ /*00c0*/ LEA.HI.X R3, R0, c[0x0][0x16c], R3, 0x2, P1 ; /* 0x00005b0000037a11 */ /* 0x000fd600008f1403 */ /*00d0*/ @P0 BRA 0x1a0 ; /* 0x000000c000000947 */ /* 0x000fea0003800000 */ /*00e0*/ ISETP.GT.U32.AND P0, PT, R4, R5, PT ; /* 0x000000050400720c */ /* 0x000fe40003f04070 */ /*00f0*/ SHF.R.S32.HI R6, RZ, 0x1f, R4 ; /* 0x0000001fff067819 */ /* 0x000fe40000011404 */ /*0100*/ IADD3 R0, R5, 0x100, RZ ; /* 0x0000010005007810 */ /* 0x000fe40007ffe0ff */ /*0110*/ ISETP.GT.U32.AND.EX P0, PT, R6, RZ, PT, P0 ; /* 0x000000ff0600720c */ /* 0x000fda0003f04100 */ /*0120*/ @P0 IMAD.MOV.U32 R7, RZ, RZ, c[0x0][0x170] ; /* 0x00005c00ff070624 */ /* 0x000fca00078e00ff */ /*0130*/ @P0 STG.E [R2.64], R7 ; /* 0x0000000702000986 */ /* 0x0001e2000c101904 */ /*0140*/ ISETP.GT.U32.AND P0, PT, R4, R0, PT ; /* 0x000000000400720c */ /* 0x000fc80003f04070 */ /*0150*/ ISETP.GT.U32.AND.EX P0, PT, R6, RZ, PT, P0 ; /* 0x000000ff0600720c */ /* 0x000fda0003f04100 */ /*0160*/ @!P0 EXIT ; /* 0x000000000000894d */ /* 0x000fea0003800000 */ /*0170*/ IMAD.MOV.U32 R5, RZ, RZ, c[0x0][0x170] ; /* 0x00005c00ff057624 */ /* 0x001fca00078e00ff */ /*0180*/ STG.E [R2.64+0x400], R5 ; /* 0x0004000502007986 */ /* 0x000fe2000c101904 */ /*0190*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*01a0*/ IMAD.MOV.U32 R5, RZ, RZ, c[0x0][0x170] ; /* 0x00005c00ff057624 */ /* 0x000fca00078e00ff */ /*01b0*/ STG.E [R2.64], R5 ; /* 0x0000000502007986 */ /* 0x000fe8000c101904 */ /*01c0*/ STG.E [R2.64+0x400], R5 ; /* 0x0004000502007986 */ /* 0x000fe2000c101904 */ /*01d0*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*01e0*/ BRA 0x1e0; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*01f0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0200*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0210*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0220*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0230*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0240*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0250*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0260*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0270*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ .......... Function : _ZN3cub17CUB_200700_800_NS11EmptyKernelIvEEvv .headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)" /*0000*/ MOV R1, c[0x0][0x28] ; /* 0x00000a0000017a02 */ /* 0x000fe40000000f00 */ /*0010*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*0020*/ BRA 0x20; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*0030*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0040*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0050*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0060*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0070*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0080*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0090*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*00a0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*00b0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*00c0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*00d0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*00e0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*00f0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ .......... Function : _Z6kernelPfiS_ .headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)" /*0000*/ MOV R1, c[0x0][0x28] ; /* 0x00000a0000017a02 */ /* 0x000fe40000000f00 */ /*0010*/ S2R R2, SR_CTAID.X ; /* 0x0000000000027919 */ /* 0x000e220000002500 */ /*0020*/ HFMA2.MMA R3, -RZ, RZ, 0, 2.384185791015625e-07 ; /* 0x00000004ff037435 */ /* 0x000fe200000001ff */ /*0030*/ ULDC.64 UR4, c[0x0][0x118] ; /* 0x0000460000047ab9 */ /* 0x000fe40000000a00 */ /*0040*/ S2R R5, SR_TID.X ; /* 0x0000000000057919 */ /* 0x000e240000002100 */ /*0050*/ IMAD R2, R2, c[0x0][0x0], R5 ; /* 0x0000000002027a24 */ /* 0x001fca00078e0205 */ /*0060*/ IMAD.WIDE R2, R2, R3, c[0x0][0x160] ; /* 0x0000580002027625 */ /* 0x000fcc00078e0203 */ /*0070*/ LDG.E R2, [R2.64] ; /* 0x0000000402027981 */ /* 0x000ea2000c1e1900 */ /*0080*/ IMAD.MOV.U32 R0, RZ, RZ, c[0x0][0x0] ; /* 0x00000000ff007624 */ /* 0x000fe200078e00ff */ /*0090*/ ISETP.NE.AND P0, PT, R5, RZ, PT ; /* 0x000000ff0500720c */ /* 0x000fc80003f05270 */ /*00a0*/ ISETP.GE.U32.AND P1, PT, R0, 0x2, PT ; /* 0x000000020000780c */ /* 0x000fe20003f26070 */ /*00b0*/ STS [R5.X4], R2 ; /* 0x0000000205007388 */ /* 0x0041e80000004800 */ /*00c0*/ BAR.SYNC.DEFER_BLOCKING 0x0 ; /* 0x0000000000007b1d */ /* 0x000ff00000010000 */ /*00d0*/ @!P1 BRA 0x1b0 ; /* 0x000000d000009947 */ /* 0x000fea0003800000 */ /*00e0*/ MOV R0, 0x1 ; /* 0x0000000100007802 */ /* 0x001fca0000000f00 */ /*00f0*/ IMAD.SHL.U32 R4, R0, 0x2, RZ ; /* 0x0000000200047824 */ /* 0x000fc800078e00ff */ /*0100*/ IMAD R6, R4, R5, RZ ; /* 0x0000000504067224 */ /* 0x000fca00078e02ff */ /*0110*/ ISETP.GE.U32.AND P1, PT, R6, c[0x0][0x0], PT ; /* 0x0000000006007a0c */ /* 0x000fda0003f26070 */ /*0120*/ @!P1 IADD3 R2, R6, R0, RZ ; /* 0x0000000006029210 */ /* 0x000fe40007ffe0ff */ /*0130*/ @!P1 LDS R0, [R6.X4] ; /* 0x0000000006009984 */ /* 0x000fe80000004800 */ /*0140*/ @!P1 LDS R3, [R2.X4] ; /* 0x0000000002039984 */ /* 0x000e240000004800 */ /*0150*/ @!P1 FADD R3, R0, R3 ; /* 0x0000000300039221 */ /* 0x001fe40000000000 */ /*0160*/ IMAD.MOV.U32 R0, RZ, RZ, R4 ; /* 0x000000ffff007224 */ /* 0x000fc600078e0004 */ /*0170*/ @!P1 STS [R6.X4], R3 ; /* 0x0000000306009388 */ /* 0x0001e80000004800 */ /*0180*/ BAR.SYNC.DEFER_BLOCKING 0x0 ; /* 0x0000000000007b1d */ /* 0x000fe20000010000 */ /*0190*/ ISETP.GE.U32.AND P1, PT, R4, c[0x0][0x0], PT ; /* 0x0000000004007a0c */ /* 0x000fda0003f26070 */ /*01a0*/ @!P1 BRA 0xf0 ; /* 0xffffff4000009947 */ /* 0x001fea000383ffff */ /*01b0*/ @P0 EXIT ; /* 0x000000000000094d */ /* 0x001fea0003800000 */ /*01c0*/ LDS R5, [RZ] ; /* 0x00000000ff057984 */ /* 0x000e220000000800 */ /*01d0*/ MOV R2, c[0x0][0x170] ; /* 0x00005c0000027a02 */ /* 0x000fe20000000f00 */ /*01e0*/ IMAD.MOV.U32 R3, RZ, RZ, c[0x0][0x174] ; /* 0x00005d00ff037624 */ /* 0x000fca00078e00ff */ /*01f0*/ RED.E.ADD.F32.FTZ.RN.STRONG.GPU [R2.64], R5 ; /* 0x000000050200798e */ /* 0x001fe2000c10e784 */ /*0200*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*0210*/ BRA 0x210; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*0220*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0230*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0240*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0250*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0260*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0270*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0280*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*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 */ ..........
.text .amdgcn_target "amdgcn-amd-amdhsa--gfx1100" .protected _Z6kernelPfiS_ .globl _Z6kernelPfiS_ .p2align 8 .type _Z6kernelPfiS_,@function _Z6kernelPfiS_: s_clause 0x1 s_load_b32 s2, s[0:1], 0x24 s_load_b64 s[4:5], s[0:1], 0x0 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_cmp_lt_u32 s2, 2 v_ashrrev_i32_e32 v2, 31, v1 s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_lshlrev_b64 v[1:2], 2, v[1:2] v_add_co_u32 v1, vcc_lo, 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 v1, v[1:2], off v_lshl_add_u32 v2, v0, 2, 0 s_waitcnt vmcnt(0) ds_store_b32 v2, v1 s_waitcnt lgkmcnt(0) s_barrier buffer_gl0_inv s_cbranch_scc1 .LBB0_5 s_mov_b32 s4, 1 s_set_inst_prefetch_distance 0x1 s_branch .LBB0_3 .p2align 6 .LBB0_2: s_or_b32 exec_lo, exec_lo, s5 s_cmp_ge_u32 s3, s2 s_mov_b32 s4, s3 s_waitcnt lgkmcnt(0) s_barrier buffer_gl0_inv s_cbranch_scc1 .LBB0_5 .LBB0_3: s_lshl_b32 s3, s4, 1 s_mov_b32 s5, exec_lo v_mul_lo_u32 v1, s3, v0 s_delay_alu instid0(VALU_DEP_1) v_cmpx_gt_u32_e64 s2, v1 s_cbranch_execz .LBB0_2 v_add_nc_u32_e32 v2, s4, v1 v_lshl_add_u32 v1, v1, 2, 0 s_delay_alu instid0(VALU_DEP_2) v_lshl_add_u32 v2, v2, 2, 0 ds_load_b32 v2, v2 ds_load_b32 v3, v1 s_waitcnt lgkmcnt(0) v_add_f32_e32 v2, v2, v3 ds_store_b32 v1, v2 s_branch .LBB0_2 .LBB0_5: s_set_inst_prefetch_distance 0x2 s_mov_b32 s2, exec_lo v_cmpx_eq_u32_e32 0, v0 s_cbranch_execz .LBB0_9 s_mov_b32 s2, exec_lo s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_mbcnt_lo_u32_b32 v0, s2, 0 v_cmp_eq_u32_e32 vcc_lo, 0, v0 s_and_b32 s3, exec_lo, vcc_lo s_delay_alu instid0(SALU_CYCLE_1) s_mov_b32 exec_lo, s3 s_cbranch_execz .LBB0_9 s_load_b64 s[0:1], s[0:1], 0x10 s_bcnt1_i32_b32 s2, s2 v_mov_b32_e32 v3, 0 v_cvt_f32_ubyte0_e32 v1, s2 s_mov_b32 s2, 0 s_waitcnt lgkmcnt(0) s_load_b32 s3, s[0:1], 0x0 v_mov_b32_e32 v0, 0 ds_load_b32 v0, v0 s_waitcnt lgkmcnt(0) v_dual_mul_f32 v2, v0, v1 :: v_dual_mov_b32 v1, s3 .LBB0_8: s_delay_alu instid0(VALU_DEP_1) v_add_f32_e32 v0, v1, v2 global_atomic_cmpswap_b32 v0, v3, v[0:1], s[0:1] glc s_waitcnt vmcnt(0) v_cmp_eq_u32_e32 vcc_lo, v0, v1 v_mov_b32_e32 v1, v0 s_or_b32 s2, vcc_lo, s2 s_delay_alu instid0(SALU_CYCLE_1) s_and_not1_b32 exec_lo, exec_lo, s2 s_cbranch_execnz .LBB0_8 .LBB0_9: s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _Z6kernelPfiS_ .amdhsa_group_segment_fixed_size 0 .amdhsa_private_segment_fixed_size 0 .amdhsa_kernarg_size 280 .amdhsa_user_sgpr_count 15 .amdhsa_user_sgpr_dispatch_ptr 0 .amdhsa_user_sgpr_queue_ptr 0 .amdhsa_user_sgpr_kernarg_segment_ptr 1 .amdhsa_user_sgpr_dispatch_id 0 .amdhsa_user_sgpr_private_segment_size 0 .amdhsa_wavefront_size32 1 .amdhsa_uses_dynamic_stack 0 .amdhsa_enable_private_segment 0 .amdhsa_system_sgpr_workgroup_id_x 1 .amdhsa_system_sgpr_workgroup_id_y 0 .amdhsa_system_sgpr_workgroup_id_z 0 .amdhsa_system_sgpr_workgroup_info 0 .amdhsa_system_vgpr_workitem_id 0 .amdhsa_next_free_vgpr 4 .amdhsa_next_free_sgpr 16 .amdhsa_float_round_mode_32 0 .amdhsa_float_round_mode_16_64 0 .amdhsa_float_denorm_mode_32 3 .amdhsa_float_denorm_mode_16_64 3 .amdhsa_dx10_clamp 1 .amdhsa_ieee_mode 1 .amdhsa_fp16_overflow 0 .amdhsa_workgroup_processor_mode 1 .amdhsa_memory_ordered 1 .amdhsa_forward_progress 0 .amdhsa_shared_vgpr_count 0 .amdhsa_exception_fp_ieee_invalid_op 0 .amdhsa_exception_fp_denorm_src 0 .amdhsa_exception_fp_ieee_div_zero 0 .amdhsa_exception_fp_ieee_overflow 0 .amdhsa_exception_fp_ieee_underflow 0 .amdhsa_exception_fp_ieee_inexact 0 .amdhsa_exception_int_div_zero 0 .end_amdhsa_kernel .text .Lfunc_end0: .size _Z6kernelPfiS_, .Lfunc_end0-_Z6kernelPfiS_ .section .AMDGPU.csdata,"",@progbits .section .text._ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_,"axG",@progbits,_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_,comdat .protected _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_ .globl _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_ .p2align 8 .type _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_,@function _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_: s_load_b128 s[4:7], s[0:1], 0x10 s_lshl_b32 s2, s15, 8 s_waitcnt lgkmcnt(0) s_add_u32 s2, s2, s6 s_addc_u32 s3, 0, s7 s_sub_u32 s4, s4, s2 s_subb_u32 s5, s5, s3 s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1) v_cmp_gt_u64_e64 s5, 0x100, s[4:5] s_and_b32 s5, s5, exec_lo s_cselect_b32 s4, s4, 0x100 s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1) v_cmp_gt_u32_e32 vcc_lo, s4, v0 s_cmpk_eq_i32 s4, 0x100 s_cselect_b32 s4, -1, 0 s_or_b32 s4, s4, vcc_lo s_delay_alu instid0(SALU_CYCLE_1) s_and_saveexec_b32 s5, s4 s_cbranch_execz .LBB1_2 s_clause 0x1 s_load_b64 s[4:5], s[0:1], 0x0 s_load_b32 s6, s[0:1], 0x8 v_lshlrev_b32_e32 v0, 2, v0 s_lshl_b64 s[0:1], s[2:3], 2 s_waitcnt lgkmcnt(0) s_add_u32 s0, s4, s0 s_addc_u32 s1, s5, s1 v_add_co_u32 v0, s0, s0, v0 s_delay_alu instid0(VALU_DEP_1) v_add_co_ci_u32_e64 v1, null, s1, 0, s0 v_mov_b32_e32 v2, s6 flat_store_b32 v[0:1], v2 .LBB1_2: s_endpgm .section .rodata,"a",@progbits .p2align 6, 0x0 .amdhsa_kernel _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_ .amdhsa_group_segment_fixed_size 0 .amdhsa_private_segment_fixed_size 0 .amdhsa_kernarg_size 32 .amdhsa_user_sgpr_count 15 .amdhsa_user_sgpr_dispatch_ptr 0 .amdhsa_user_sgpr_queue_ptr 0 .amdhsa_user_sgpr_kernarg_segment_ptr 1 .amdhsa_user_sgpr_dispatch_id 0 .amdhsa_user_sgpr_private_segment_size 0 .amdhsa_wavefront_size32 1 .amdhsa_uses_dynamic_stack 0 .amdhsa_enable_private_segment 0 .amdhsa_system_sgpr_workgroup_id_x 1 .amdhsa_system_sgpr_workgroup_id_y 0 .amdhsa_system_sgpr_workgroup_id_z 0 .amdhsa_system_sgpr_workgroup_info 0 .amdhsa_system_vgpr_workitem_id 0 .amdhsa_next_free_vgpr 3 .amdhsa_next_free_sgpr 16 .amdhsa_float_round_mode_32 0 .amdhsa_float_round_mode_16_64 0 .amdhsa_float_denorm_mode_32 3 .amdhsa_float_denorm_mode_16_64 3 .amdhsa_dx10_clamp 1 .amdhsa_ieee_mode 1 .amdhsa_fp16_overflow 0 .amdhsa_workgroup_processor_mode 1 .amdhsa_memory_ordered 1 .amdhsa_forward_progress 0 .amdhsa_shared_vgpr_count 0 .amdhsa_exception_fp_ieee_invalid_op 0 .amdhsa_exception_fp_denorm_src 0 .amdhsa_exception_fp_ieee_div_zero 0 .amdhsa_exception_fp_ieee_overflow 0 .amdhsa_exception_fp_ieee_underflow 0 .amdhsa_exception_fp_ieee_inexact 0 .amdhsa_exception_int_div_zero 0 .end_amdhsa_kernel .section .text._ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_,"axG",@progbits,_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_,comdat .Lfunc_end1: .size _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_, .Lfunc_end1-_ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_ .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 - .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 - .offset: 144 .size: 4 .value_kind: hidden_dynamic_lds_size .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: _Z6kernelPfiS_ .private_segment_fixed_size: 0 .sgpr_count: 18 .sgpr_spill_count: 0 .symbol: _Z6kernelPfiS_.kd .uniform_work_group_size: 1 .uses_dynamic_stack: false .vgpr_count: 4 .vgpr_spill_count: 0 .wavefront_size: 32 .workgroup_processor_mode: 1 - .args: - .offset: 0 .size: 16 .value_kind: by_value - .offset: 16 .size: 8 .value_kind: by_value - .offset: 24 .size: 8 .value_kind: by_value .group_segment_fixed_size: 0 .kernarg_segment_align: 8 .kernarg_segment_size: 32 .language: OpenCL C .language_version: - 2 - 0 .max_flat_workgroup_size: 256 .name: _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_ .private_segment_fixed_size: 0 .sgpr_count: 18 .sgpr_spill_count: 0 .symbol: _ZN6thrust11hip_rocprim14__parallel_for6kernelILj256ENS0_20__uninitialized_fill7functorINS_10device_ptrIfEEfEEmLj1EEEvT0_T1_S9_.kd .uniform_work_group_size: 1 .uses_dynamic_stack: false .vgpr_count: 3 .vgpr_spill_count: 0 .wavefront_size: 32 .workgroup_processor_mode: 1 amdhsa.target: amdgcn-amd-amdhsa--gfx1100 amdhsa.version: - 1 - 2 ... .end_amdgpu_metadata
You are a helpful coding assistant specialized in converting CUDA source code to CUDA device assembly.
#include <stdio.h> #include <stdint.h> static __device__ __inline__ uint32_t __mysmid(){ uint32_t smid; asm volatile("mov.u32 %0, %%smid;" : "=r"(smid)); return smid; } static __device__ __inline__ uint32_t __mywarpid(){ uint32_t warpid; asm volatile("mov.u32 %0, %%warpid;" : "=r"(warpid)); return warpid; } static __device__ __inline__ uint32_t __mylaneid(){ uint32_t laneid; asm volatile("mov.u32 %0, %%laneid;" : "=r"(laneid)); return laneid; } __global__ void mykernel(){ int idx = threadIdx.x + blockDim.x*blockIdx.x; printf("I am thread %d, my SM ID is %d, my warp ID is %d, and my warp lane is %d\n", idx, __mysmid(), __mywarpid(), __mylaneid()); } int main() { mykernel<<<4,4>>>(); cudaDeviceSynchronize(); return 0; }
code for sm_80 Function : _Z8mykernelv .headerflags @"EF_CUDA_TEXMODE_UNIFIED EF_CUDA_64BIT_ADDRESS EF_CUDA_SM80 EF_CUDA_VIRTUAL_SM(EF_CUDA_SM80)" /*0000*/ IMAD.MOV.U32 R1, RZ, RZ, c[0x0][0x28] ; /* 0x00000a00ff017624 */ /* 0x000fc800078e00ff */ /*0010*/ S2R R9, SR_VIRTUALSMID ; /* 0x0000000000097919 */ /* 0x000e220000004300 */ /*0020*/ IADD3 R1, R1, -0x10, RZ ; /* 0xfffffff001017810 */ /* 0x000fe20007ffe0ff */ /*0030*/ IMAD.MOV.U32 R4, RZ, RZ, c[0x4][0x8] ; /* 0x01000200ff047624 */ /* 0x000fe400078e00ff */ /*0040*/ S2R R0, SR_VIRTID ; /* 0x0000000000007919 */ /* 0x000e620000000300 */ /*0050*/ IADD3 R6, P0, R1, c[0x0][0x20], RZ ; /* 0x0000080001067a10 */ /* 0x000fe20007f1e0ff */ /*0060*/ IMAD.MOV.U32 R5, RZ, RZ, c[0x4][0xc] ; /* 0x01000300ff057624 */ /* 0x000fe400078e00ff */ /*0070*/ S2R R8, SR_TID.X ; /* 0x0000000000087919 */ /* 0x000ea40000002100 */ /*0080*/ IMAD.X R7, RZ, RZ, c[0x0][0x24], P0 ; /* 0x00000900ff077624 */ /* 0x000fc400000e06ff */ /*0090*/ S2R R3, SR_CTAID.X ; /* 0x0000000000037919 */ /* 0x000ea80000002500 */ /*00a0*/ S2R R11, SR_LANEID ; /* 0x00000000000b7919 */ /* 0x000e220000000000 */ /*00b0*/ SHF.R.U32.HI R10, RZ, 0x8, R0 ; /* 0x00000008ff0a7819 */ /* 0x002fe40000011600 */ /*00c0*/ MOV R0, 0x0 ; /* 0x0000000000007802 */ /* 0x000fe40000000f00 */ /*00d0*/ SGXT.U32 R10, R10, 0x7 ; /* 0x000000070a0a781a */ /* 0x000fe20000000000 */ /*00e0*/ IMAD R8, R3, c[0x0][0x0], R8 ; /* 0x0000000003087a24 */ /* 0x004fc400078e0208 */ /*00f0*/ LDC.64 R2, c[0x4][R0] ; /* 0x0100000000027b82 */ /* 0x0002a60000000a00 */ /*0100*/ STL.128 [R1], R8 ; /* 0x0000000801007387 */ /* 0x0013e40000100c00 */ /*0110*/ LEPC R8 ; /* 0x000000000008734e */ /* 0x002fe40000000000 */ /*0120*/ MOV R11, 0x190 ; /* 0x00000190000b7802 */ /* 0x000fe40000000f00 */ /*0130*/ MOV R20, 0x110 ; /* 0x0000011000147802 */ /* 0x000fe40000000f00 */ /*0140*/ MOV R21, 0x0 ; /* 0x0000000000157802 */ /* 0x000fe40000000f00 */ /*0150*/ MOV R0, 0x0 ; /* 0x0000000000007802 */ /* 0x000fe40000000f00 */ /*0160*/ IADD3 R20, P0, P1, -R20, R11, R8 ; /* 0x0000000b14147210 */ /* 0x000fc8000791e108 */ /*0170*/ IADD3.X R21, ~R0, R21, R9, P0, P1 ; /* 0x0000001500157210 */ /* 0x000fc800007e2509 */ /*0180*/ CALL.ABS.NOINC R2 ; /* 0x0000000002007343 */ /* 0x004fea0003c00000 */ /*0190*/ EXIT ; /* 0x000000000000794d */ /* 0x000fea0003800000 */ /*01a0*/ BRA 0x1a0; /* 0xfffffff000007947 */ /* 0x000fc0000383ffff */ /*01b0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*01c0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*01d0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*01e0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*01f0*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0200*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0210*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0220*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0230*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0240*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0250*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0260*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ /*0270*/ NOP; /* 0x0000000000007918 */ /* 0x000fc00000000000 */ ..........
You are a helpful coding assistant specialized in converting CUDA source code to CUDA host assembly.
#include <stdio.h> #include <stdint.h> static __device__ __inline__ uint32_t __mysmid(){ uint32_t smid; asm volatile("mov.u32 %0, %%smid;" : "=r"(smid)); return smid; } static __device__ __inline__ uint32_t __mywarpid(){ uint32_t warpid; asm volatile("mov.u32 %0, %%warpid;" : "=r"(warpid)); return warpid; } static __device__ __inline__ uint32_t __mylaneid(){ uint32_t laneid; asm volatile("mov.u32 %0, %%laneid;" : "=r"(laneid)); return laneid; } __global__ void mykernel(){ int idx = threadIdx.x + blockDim.x*blockIdx.x; printf("I am thread %d, my SM ID is %d, my warp ID is %d, and my warp lane is %d\n", idx, __mysmid(), __mywarpid(), __mylaneid()); } int main() { mykernel<<<4,4>>>(); cudaDeviceSynchronize(); return 0; }
.file "tmpxft_0019877a_00000000-6_smid_assembly.cudafe1.cpp" .text #APP #NO_APP .type _ZL26__cudaUnregisterBinaryUtilv, @function _ZL26__cudaUnregisterBinaryUtilv: .LFB2063: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 movq _ZL20__cudaFatCubinHandle(%rip), %rdi call __cudaUnregisterFatBinary@PLT addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2063: .size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv .globl _Z26__device_stub__Z8mykernelvv .type _Z26__device_stub__Z8mykernelvv, @function _Z26__device_stub__Z8mykernelvv: .LFB2085: .cfi_startproc endbr64 subq $88, %rsp .cfi_def_cfa_offset 96 movq %fs:40, %rax movq %rax, 72(%rsp) xorl %eax, %eax movl $1, 16(%rsp) movl $1, 20(%rsp) movl $1, 24(%rsp) movl $1, 28(%rsp) movl $1, 32(%rsp) movl $1, 36(%rsp) leaq 8(%rsp), %rcx movq %rsp, %rdx leaq 28(%rsp), %rsi leaq 16(%rsp), %rdi call __cudaPopCallConfiguration@PLT testl %eax, %eax je .L7 .L3: movq 72(%rsp), %rax subq %fs:40, %rax jne .L8 addq $88, %rsp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L7: .cfi_restore_state pushq 8(%rsp) .cfi_def_cfa_offset 104 pushq 8(%rsp) .cfi_def_cfa_offset 112 leaq 80(%rsp), %r9 movq 44(%rsp), %rcx movl 52(%rsp), %r8d movq 32(%rsp), %rsi movl 40(%rsp), %edx leaq _Z8mykernelv(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 96 jmp .L3 .L8: call __stack_chk_fail@PLT .cfi_endproc .LFE2085: .size _Z26__device_stub__Z8mykernelvv, .-_Z26__device_stub__Z8mykernelvv .globl _Z8mykernelv .type _Z8mykernelv, @function _Z8mykernelv: .LFB2086: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z26__device_stub__Z8mykernelvv addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2086: .size _Z8mykernelv, .-_Z8mykernelv .globl main .type main, @function main: .LFB2060: .cfi_startproc endbr64 subq $40, %rsp .cfi_def_cfa_offset 48 movl $4, 20(%rsp) movl $1, 24(%rsp) movl $4, 8(%rsp) movl $1, 12(%rsp) movl $0, %r9d movl $0, %r8d movq 20(%rsp), %rdx movl $1, %ecx movq 8(%rsp), %rdi movl $1, %esi call __cudaPushCallConfiguration@PLT testl %eax, %eax je .L14 .L12: call cudaDeviceSynchronize@PLT movl $0, %eax addq $40, %rsp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L14: .cfi_restore_state call _Z26__device_stub__Z8mykernelvv jmp .L12 .cfi_endproc .LFE2060: .size main, .-main .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "_Z8mykernelv" .text .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB2088: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 leaq _ZL15__fatDeviceText(%rip), %rdi call __cudaRegisterFatBinary@PLT movq %rax, %rdi movq %rax, _ZL20__cudaFatCubinHandle(%rip) pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 pushq $0 .cfi_def_cfa_offset 40 pushq $0 .cfi_def_cfa_offset 48 movl $0, %r9d movl $-1, %r8d leaq .LC0(%rip), %rdx movq %rdx, %rcx leaq _Z8mykernelv(%rip), %rsi call __cudaRegisterFunction@PLT addq $32, %rsp .cfi_def_cfa_offset 16 movq _ZL20__cudaFatCubinHandle(%rip), %rdi call __cudaRegisterFatBinaryEnd@PLT leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi call atexit@PLT addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2088: .size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv .section .init_array,"aw" .align 8 .quad _ZL24__sti____cudaRegisterAllv .section .nvFatBinSegment,"aw" .align 8 .type _ZL15__fatDeviceText, @object .size _ZL15__fatDeviceText, 24 _ZL15__fatDeviceText: .long 1180844977 .long 1 .quad fatbinData .quad 0 .local _ZL20__cudaFatCubinHandle .comm _ZL20__cudaFatCubinHandle,8,8 .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 <stdint.h> static __device__ __inline__ uint32_t __mysmid(){ uint32_t smid; asm volatile("mov.u32 %0, %%smid;" : "=r"(smid)); return smid; } static __device__ __inline__ uint32_t __mywarpid(){ uint32_t warpid; asm volatile("mov.u32 %0, %%warpid;" : "=r"(warpid)); return warpid; } static __device__ __inline__ uint32_t __mylaneid(){ uint32_t laneid; asm volatile("mov.u32 %0, %%laneid;" : "=r"(laneid)); return laneid; } __global__ void mykernel(){ int idx = threadIdx.x + blockDim.x*blockIdx.x; printf("I am thread %d, my SM ID is %d, my warp ID is %d, and my warp lane is %d\n", idx, __mysmid(), __mywarpid(), __mylaneid()); } int main() { mykernel<<<4,4>>>(); cudaDeviceSynchronize(); return 0; }
#include <hip/hip_runtime.h> #include <stdio.h> #include <stdint.h> static __device__ __inline__ uint32_t __mysmid(){ uint32_t smid; asm volatile("mov.u32 %0, %%smid;" : "=r"(smid)); return smid; } static __device__ __inline__ uint32_t __mywarpid(){ uint32_t warpid; asm volatile("mov.u32 %0, %%warpid;" : "=r"(warpid)); return warpid; } static __device__ __inline__ uint32_t __mylaneid(){ uint32_t laneid; asm volatile("mov.u32 %0, %%laneid;" : "=r"(laneid)); return laneid; } __global__ void mykernel(){ int idx = threadIdx.x + blockDim.x*blockIdx.x; printf("I am thread %d, my SM ID is %d, my warp ID is %d, and my warp lane is %d\n", idx, __mysmid(), __mywarpid(), __mylaneid()); } int main() { mykernel<<<4,4>>>(); hipDeviceSynchronize(); 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> #include <stdint.h> static __device__ __inline__ uint32_t __mysmid(){ uint32_t smid; asm volatile("mov.u32 %0, %%smid;" : "=r"(smid)); return smid; } static __device__ __inline__ uint32_t __mywarpid(){ uint32_t warpid; asm volatile("mov.u32 %0, %%warpid;" : "=r"(warpid)); return warpid; } static __device__ __inline__ uint32_t __mylaneid(){ uint32_t laneid; asm volatile("mov.u32 %0, %%laneid;" : "=r"(laneid)); return laneid; } __global__ void mykernel(){ int idx = threadIdx.x + blockDim.x*blockIdx.x; printf("I am thread %d, my SM ID is %d, my warp ID is %d, and my warp lane is %d\n", idx, __mysmid(), __mywarpid(), __mylaneid()); } int main() { mykernel<<<4,4>>>(); hipDeviceSynchronize(); return 0; }
.text .file "smid_assembly.hip" .globl _Z23__device_stub__mykernelv # -- Begin function _Z23__device_stub__mykernelv .p2align 4, 0x90 .type _Z23__device_stub__mykernelv,@function _Z23__device_stub__mykernelv: # @_Z23__device_stub__mykernelv .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 $_Z8mykernelv, %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 _Z23__device_stub__mykernelv, .Lfunc_end0-_Z23__device_stub__mykernelv .cfi_endproc # -- End function .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: subq $56, %rsp .cfi_def_cfa_offset 64 movabsq $4294967300, %rdi # imm = 0x100000004 movl $1, %esi movq %rdi, %rdx movl $1, %ecx xorl %r8d, %r8d xorl %r9d, %r9d callq __hipPushCallConfiguration testl %eax, %eax jne .LBB1_2 # %bb.1: leaq 32(%rsp), %rdi leaq 16(%rsp), %rsi leaq 8(%rsp), %rdx movq %rsp, %rcx callq __hipPopCallConfiguration movq 32(%rsp), %rsi movl 40(%rsp), %edx movq 16(%rsp), %rcx movl 24(%rsp), %r8d leaq 48(%rsp), %r9 movl $_Z8mykernelv, %edi pushq (%rsp) .cfi_adjust_cfa_offset 8 pushq 16(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $16, %rsp .cfi_adjust_cfa_offset -16 .LBB1_2: callq hipDeviceSynchronize xorl %eax, %eax addq $56, %rsp .cfi_def_cfa_offset 8 retq .Lfunc_end1: .size main, .Lfunc_end1-main .cfi_endproc # -- End function .p2align 4, 0x90 # -- Begin function __hip_module_ctor .type __hip_module_ctor,@function __hip_module_ctor: # @__hip_module_ctor .cfi_startproc # %bb.0: subq $40, %rsp .cfi_def_cfa_offset 48 cmpq $0, __hip_gpubin_handle(%rip) jne .LBB2_2 # %bb.1: movl $__hip_fatbin_wrapper, %edi callq __hipRegisterFatBinary movq %rax, __hip_gpubin_handle(%rip) .LBB2_2: movq __hip_gpubin_handle(%rip), %rdi xorps %xmm0, %xmm0 movups %xmm0, 16(%rsp) movups %xmm0, (%rsp) movl $_Z8mykernelv, %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 _Z8mykernelv,@object # @_Z8mykernelv .section .rodata,"a",@progbits .globl _Z8mykernelv .p2align 3, 0x0 _Z8mykernelv: .quad _Z23__device_stub__mykernelv .size _Z8mykernelv, 8 .type .L__unnamed_1,@object # @0 .section .rodata.str1.1,"aMS",@progbits,1 .L__unnamed_1: .asciz "_Z8mykernelv" .size .L__unnamed_1, 13 .type __hip_fatbin_wrapper,@object # @__hip_fatbin_wrapper .section .hipFatBinSegment,"a",@progbits .p2align 3, 0x0 __hip_fatbin_wrapper: .long 1212764230 # 0x48495046 .long 1 # 0x1 .quad __hip_fatbin .quad 0 .size __hip_fatbin_wrapper, 24 .type __hip_gpubin_handle,@object # @__hip_gpubin_handle .local __hip_gpubin_handle .comm __hip_gpubin_handle,8,8 .section .init_array,"aw",@init_array .p2align 3, 0x0 .quad __hip_module_ctor .type __hip_cuid_,@object # @__hip_cuid_ .bss .globl __hip_cuid_ __hip_cuid_: .byte 0 # 0x0 .size __hip_cuid_, 1 .section ".linker-options","e",@llvm_linker_options .ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)" .section ".note.GNU-stack","",@progbits .addrsig .addrsig_sym _Z23__device_stub__mykernelv .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z8mykernelv .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_0019877a_00000000-6_smid_assembly.cudafe1.cpp" .text #APP #NO_APP .type _ZL26__cudaUnregisterBinaryUtilv, @function _ZL26__cudaUnregisterBinaryUtilv: .LFB2063: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 movq _ZL20__cudaFatCubinHandle(%rip), %rdi call __cudaUnregisterFatBinary@PLT addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2063: .size _ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv .globl _Z26__device_stub__Z8mykernelvv .type _Z26__device_stub__Z8mykernelvv, @function _Z26__device_stub__Z8mykernelvv: .LFB2085: .cfi_startproc endbr64 subq $88, %rsp .cfi_def_cfa_offset 96 movq %fs:40, %rax movq %rax, 72(%rsp) xorl %eax, %eax movl $1, 16(%rsp) movl $1, 20(%rsp) movl $1, 24(%rsp) movl $1, 28(%rsp) movl $1, 32(%rsp) movl $1, 36(%rsp) leaq 8(%rsp), %rcx movq %rsp, %rdx leaq 28(%rsp), %rsi leaq 16(%rsp), %rdi call __cudaPopCallConfiguration@PLT testl %eax, %eax je .L7 .L3: movq 72(%rsp), %rax subq %fs:40, %rax jne .L8 addq $88, %rsp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L7: .cfi_restore_state pushq 8(%rsp) .cfi_def_cfa_offset 104 pushq 8(%rsp) .cfi_def_cfa_offset 112 leaq 80(%rsp), %r9 movq 44(%rsp), %rcx movl 52(%rsp), %r8d movq 32(%rsp), %rsi movl 40(%rsp), %edx leaq _Z8mykernelv(%rip), %rdi call cudaLaunchKernel@PLT addq $16, %rsp .cfi_def_cfa_offset 96 jmp .L3 .L8: call __stack_chk_fail@PLT .cfi_endproc .LFE2085: .size _Z26__device_stub__Z8mykernelvv, .-_Z26__device_stub__Z8mykernelvv .globl _Z8mykernelv .type _Z8mykernelv, @function _Z8mykernelv: .LFB2086: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call _Z26__device_stub__Z8mykernelvv addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2086: .size _Z8mykernelv, .-_Z8mykernelv .globl main .type main, @function main: .LFB2060: .cfi_startproc endbr64 subq $40, %rsp .cfi_def_cfa_offset 48 movl $4, 20(%rsp) movl $1, 24(%rsp) movl $4, 8(%rsp) movl $1, 12(%rsp) movl $0, %r9d movl $0, %r8d movq 20(%rsp), %rdx movl $1, %ecx movq 8(%rsp), %rdi movl $1, %esi call __cudaPushCallConfiguration@PLT testl %eax, %eax je .L14 .L12: call cudaDeviceSynchronize@PLT movl $0, %eax addq $40, %rsp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L14: .cfi_restore_state call _Z26__device_stub__Z8mykernelvv jmp .L12 .cfi_endproc .LFE2060: .size main, .-main .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "_Z8mykernelv" .text .type _ZL24__sti____cudaRegisterAllv, @function _ZL24__sti____cudaRegisterAllv: .LFB2088: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 leaq _ZL15__fatDeviceText(%rip), %rdi call __cudaRegisterFatBinary@PLT movq %rax, %rdi movq %rax, _ZL20__cudaFatCubinHandle(%rip) pushq $0 .cfi_def_cfa_offset 24 pushq $0 .cfi_def_cfa_offset 32 pushq $0 .cfi_def_cfa_offset 40 pushq $0 .cfi_def_cfa_offset 48 movl $0, %r9d movl $-1, %r8d leaq .LC0(%rip), %rdx movq %rdx, %rcx leaq _Z8mykernelv(%rip), %rsi call __cudaRegisterFunction@PLT addq $32, %rsp .cfi_def_cfa_offset 16 movq _ZL20__cudaFatCubinHandle(%rip), %rdi call __cudaRegisterFatBinaryEnd@PLT leaq _ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi call atexit@PLT addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE2088: .size _ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv .section .init_array,"aw" .align 8 .quad _ZL24__sti____cudaRegisterAllv .section .nvFatBinSegment,"aw" .align 8 .type _ZL15__fatDeviceText, @object .size _ZL15__fatDeviceText, 24 _ZL15__fatDeviceText: .long 1180844977 .long 1 .quad fatbinData .quad 0 .local _ZL20__cudaFatCubinHandle .comm _ZL20__cudaFatCubinHandle,8,8 .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 "smid_assembly.hip" .globl _Z23__device_stub__mykernelv # -- Begin function _Z23__device_stub__mykernelv .p2align 4, 0x90 .type _Z23__device_stub__mykernelv,@function _Z23__device_stub__mykernelv: # @_Z23__device_stub__mykernelv .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 $_Z8mykernelv, %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 _Z23__device_stub__mykernelv, .Lfunc_end0-_Z23__device_stub__mykernelv .cfi_endproc # -- End function .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: subq $56, %rsp .cfi_def_cfa_offset 64 movabsq $4294967300, %rdi # imm = 0x100000004 movl $1, %esi movq %rdi, %rdx movl $1, %ecx xorl %r8d, %r8d xorl %r9d, %r9d callq __hipPushCallConfiguration testl %eax, %eax jne .LBB1_2 # %bb.1: leaq 32(%rsp), %rdi leaq 16(%rsp), %rsi leaq 8(%rsp), %rdx movq %rsp, %rcx callq __hipPopCallConfiguration movq 32(%rsp), %rsi movl 40(%rsp), %edx movq 16(%rsp), %rcx movl 24(%rsp), %r8d leaq 48(%rsp), %r9 movl $_Z8mykernelv, %edi pushq (%rsp) .cfi_adjust_cfa_offset 8 pushq 16(%rsp) .cfi_adjust_cfa_offset 8 callq hipLaunchKernel addq $16, %rsp .cfi_adjust_cfa_offset -16 .LBB1_2: callq hipDeviceSynchronize xorl %eax, %eax addq $56, %rsp .cfi_def_cfa_offset 8 retq .Lfunc_end1: .size main, .Lfunc_end1-main .cfi_endproc # -- End function .p2align 4, 0x90 # -- Begin function __hip_module_ctor .type __hip_module_ctor,@function __hip_module_ctor: # @__hip_module_ctor .cfi_startproc # %bb.0: subq $40, %rsp .cfi_def_cfa_offset 48 cmpq $0, __hip_gpubin_handle(%rip) jne .LBB2_2 # %bb.1: movl $__hip_fatbin_wrapper, %edi callq __hipRegisterFatBinary movq %rax, __hip_gpubin_handle(%rip) .LBB2_2: movq __hip_gpubin_handle(%rip), %rdi xorps %xmm0, %xmm0 movups %xmm0, 16(%rsp) movups %xmm0, (%rsp) movl $_Z8mykernelv, %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 _Z8mykernelv,@object # @_Z8mykernelv .section .rodata,"a",@progbits .globl _Z8mykernelv .p2align 3, 0x0 _Z8mykernelv: .quad _Z23__device_stub__mykernelv .size _Z8mykernelv, 8 .type .L__unnamed_1,@object # @0 .section .rodata.str1.1,"aMS",@progbits,1 .L__unnamed_1: .asciz "_Z8mykernelv" .size .L__unnamed_1, 13 .type __hip_fatbin_wrapper,@object # @__hip_fatbin_wrapper .section .hipFatBinSegment,"a",@progbits .p2align 3, 0x0 __hip_fatbin_wrapper: .long 1212764230 # 0x48495046 .long 1 # 0x1 .quad __hip_fatbin .quad 0 .size __hip_fatbin_wrapper, 24 .type __hip_gpubin_handle,@object # @__hip_gpubin_handle .local __hip_gpubin_handle .comm __hip_gpubin_handle,8,8 .section .init_array,"aw",@init_array .p2align 3, 0x0 .quad __hip_module_ctor .type __hip_cuid_,@object # @__hip_cuid_ .bss .globl __hip_cuid_ __hip_cuid_: .byte 0 # 0x0 .size __hip_cuid_, 1 .section ".linker-options","e",@llvm_linker_options .ident "AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)" .section ".note.GNU-stack","",@progbits .addrsig .addrsig_sym _Z23__device_stub__mykernelv .addrsig_sym __hip_module_ctor .addrsig_sym __hip_module_dtor .addrsig_sym _Z8mykernelv .addrsig_sym __hip_fatbin .addrsig_sym __hip_fatbin_wrapper .addrsig_sym __hip_cuid_