//
// Created by kindr on 2021/4/28.
//

#include "pinnedMemory.cuh"

#include "../../common/utils.cuh"
#include <cstdio>

bool profileCopies(float *h_a, float *h_b, float *d, unsigned int n) {
    unsigned int bytes = n * sizeof(float);
    CHECK(cudaMemcpy(d, h_a, bytes, cudaMemcpyHostToDevice));
    CHECK(cudaMemcpy(h_b, d, bytes, cudaMemcpyDeviceToHost));

    for (size_t i = 0; i < n; ++i) {
        if (h_a[i] != h_b[i]) {
            return false;
        }
    }
    return true;
}

void pinnedMemory(size_t nElements) {
    size_t bytes = nElements * sizeof(float);

    // 可分页内存
    float *h_aPageable, *h_bPageable;
    h_aPageable = (float *) malloc(bytes);
    h_bPageable = (float *) malloc(bytes);
    for (size_t i = 0; i < nElements; ++i) {
        h_aPageable[i] = static_cast<float>(i);
    }

    // 固定内存
    float *h_aPinned, *h_bPinned;
    CHECK(cudaMallocHost((void **) &h_aPinned, bytes));
    CHECK(cudaMallocHost((void **) &h_bPinned, bytes));
    memcpy(h_aPinned, h_aPageable, bytes);
    memset(h_bPageable, 0, bytes);
    memset(h_bPinned, 0, bytes);

    float *d_a;
    CHECK(cudaMalloc((void **) &d_a, bytes));

    TIME([&]() {
        bool isSame = profileCopies(h_aPageable, h_bPageable, d_a, nElements);
        printf("Pageable isSame: %s --- ", isSame ? "true" : "false");
    });

    TIME([&]() {
        bool isSame = profileCopies(h_aPinned, h_bPinned, d_a, nElements);
        printf("Pinned isSame: %s --- ", isSame ? "true" : "false");
    });

    // cleanup
    cudaFree(d_a);
    cudaFreeHost(h_aPinned);
    cudaFreeHost(h_bPinned);
    free(h_aPageable);
    free(h_bPageable);
}

	.file	"tmpxft_002018be_00000000-6_pinnedMemory.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3801:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3801:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.type	_ZNSt17_Function_handlerIFvvEZ12pinnedMemorymEUlvE0_E10_M_managerERSt9_Any_dataRKS3_St18_Manager_operation, @function
_ZNSt17_Function_handlerIFvvEZ12pinnedMemorymEUlvE0_E10_M_managerERSt9_Any_dataRKS3_St18_Manager_operation:
.LFB3943:
	.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
	movq	%rdi, %rbx
	pushq	%rcx
	.cfi_def_cfa_offset 32
	testl	%edx, %edx
	je	.L3
	cmpl	$1, %edx
	jne	.L16
	movq	(%rsi), %rax
	jmp	.L14
.L3:
	leaq	_ZTIZ12pinnedMemorymEUlvE0_(%rip), %rax
	jmp	.L14
.L16:
	cmpl	$2, %edx
	je	.L7
	cmpl	$3, %edx
	je	.L8
	jmp	.L6
.L7:
	movq	(%rsi), %rbp
	movl	$32, %edi
	call	_Znwm@PLT
	movups	0(%rbp), %xmm0
	movups	%xmm0, (%rax)
	movups	16(%rbp), %xmm1
	movups	%xmm1, 16(%rax)
.L14:
	movq	%rax, (%rbx)
	jmp	.L6
.L8:
	movq	(%rdi), %rdi
	testq	%rdi, %rdi
	je	.L6
	movl	$32, %esi
	call	_ZdlPvm@PLT
.L6:
	popq	%rdx
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3943:
	.size	_ZNSt17_Function_handlerIFvvEZ12pinnedMemorymEUlvE0_E10_M_managerERSt9_Any_dataRKS3_St18_Manager_operation, .-_ZNSt17_Function_handlerIFvvEZ12pinnedMemorymEUlvE0_E10_M_managerERSt9_Any_dataRKS3_St18_Manager_operation
	.type	_ZNSt17_Function_handlerIFvvEZ12pinnedMemorymEUlvE_E10_M_managerERSt9_Any_dataRKS3_St18_Manager_operation, @function
_ZNSt17_Function_handlerIFvvEZ12pinnedMemorymEUlvE_E10_M_managerERSt9_Any_dataRKS3_St18_Manager_operation:
.LFB3936:
	.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
	movq	%rdi, %rbx
	pushq	%rcx
	.cfi_def_cfa_offset 32
	testl	%edx, %edx
	je	.L18
	cmpl	$1, %edx
	jne	.L30
	movq	(%rsi), %rax
	jmp	.L29
.L18:
	leaq	_ZTIZ12pinnedMemorymEUlvE_(%rip), %rax
	jmp	.L29
.L30:
	cmpl	$2, %edx
	je	.L22
	cmpl	$3, %edx
	je	.L23
	jmp	.L21
.L22:
	movq	(%rsi), %rbp
	movl	$32, %edi
	call	_Znwm@PLT
	movups	0(%rbp), %xmm0
	movups	%xmm0, (%rax)
	movups	16(%rbp), %xmm1
	movups	%xmm1, 16(%rax)
.L29:
	movq	%rax, (%rbx)
	jmp	.L21
.L23:
	movq	(%rdi), %rdi
	testq	%rdi, %rdi
	je	.L21
	movl	$32, %esi
	call	_ZdlPvm@PLT
.L21:
	popq	%rdx
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3936:
	.size	_ZNSt17_Function_handlerIFvvEZ12pinnedMemorymEUlvE_E10_M_managerERSt9_Any_dataRKS3_St18_Manager_operation, .-_ZNSt17_Function_handlerIFvvEZ12pinnedMemorymEUlvE_E10_M_managerERSt9_Any_dataRKS3_St18_Manager_operation
	.section	.text._ZNSt14_Function_baseD2Ev,"axG",@progbits,_ZNSt14_Function_baseD5Ev,comdat
	.align 2
	.weak	_ZNSt14_Function_baseD2Ev
	.type	_ZNSt14_Function_baseD2Ev, @function
_ZNSt14_Function_baseD2Ev:
.LFB2386:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA2386
	endbr64
	movq	16(%rdi), %rax
	testq	%rax, %rax
	je	.L37
	movq	%rdi, %rsi
	pushq	%rdx
	.cfi_def_cfa_offset 16
	movl	$3, %edx
	call	*%rax
	popq	%rcx
	.cfi_def_cfa_offset 8
	ret
.L37:
	ret
	.cfi_endproc
.LFE2386:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table._ZNSt14_Function_baseD2Ev,"aG",@progbits,_ZNSt14_Function_baseD5Ev,comdat
.LLSDA2386:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE2386-.LLSDACSB2386
.LLSDACSB2386:
.LLSDACSE2386:
	.section	.text._ZNSt14_Function_baseD2Ev,"axG",@progbits,_ZNSt14_Function_baseD5Ev,comdat
	.size	_ZNSt14_Function_baseD2Ev, .-_ZNSt14_Function_baseD2Ev
	.weak	_ZNSt14_Function_baseD1Ev
	.set	_ZNSt14_Function_baseD1Ev,_ZNSt14_Function_baseD2Ev
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"/home/ubuntu/Datasets/stackv2/train-structured/KindRoach/LearnCuda/master/task/memory/pinnedMemory.cu"
.LC1:
	.string	"Error: %s:%d, "
.LC2:
	.string	"code: %d, reason: %s\n"
	.text
	.globl	_Z13profileCopiesPfS_S_j
	.type	_Z13profileCopiesPfS_S_j, @function
_Z13profileCopiesPfS_S_j:
.LFB3788:
	.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
	movq	%rdx, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rsi, %r13
	movq	%rdi, %rsi
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rdi, %r12
	movq	%r14, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%ecx, %ebx
	movl	$1, %ecx
	pushq	%r8
	.cfi_def_cfa_offset 64
	leal	0(,%rbx,4), %r15d
	movq	%r15, %rdx
	call	cudaMemcpy@PLT
	testl	%eax, %eax
	je	.L41
	movq	stderr(%rip), %rdi
	movl	%eax, %ebp
	xorl	%eax, %eax
	movl	$12, %r8d
	leaq	.LC0(%rip), %rcx
	leaq	.LC1(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movl	%ebp, %edi
	call	cudaGetErrorString@PLT
	movq	stderr(%rip), %rdi
	movl	%ebp, %ecx
	leaq	.LC2(%rip), %rdx
	movq	%rax, %r8
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
.L41:
	movl	$2, %ecx
	movq	%r15, %rdx
	movq	%r14, %rsi
	movq	%r13, %rdi
	call	cudaMemcpy@PLT
	movl	%eax, %ebp
	testl	%eax, %eax
	je	.L42
	movq	stderr(%rip), %rdi
	movl	$13, %r8d
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rcx
	leaq	.LC1(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movl	%ebp, %edi
	call	cudaGetErrorString@PLT
	movq	stderr(%rip), %rdi
	movl	%ebp, %ecx
	leaq	.LC2(%rip), %rdx
	movq	%rax, %r8
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
.L42:
	xorl	%eax, %eax
.L43:
	cmpq	%rbx, %rax
	jnb	.L56
	movss	(%r12,%rax,4), %xmm0
	ucomiss	0(%r13,%rax,4), %xmm0
	jp	.L47
	jne	.L47
	incq	%rax
	jmp	.L43
.L56:
	movb	$1, %al
	jmp	.L40
.L47:
	xorl	%eax, %eax
.L40:
	popq	%rdx
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3788:
	.size	_Z13profileCopiesPfS_S_j, .-_Z13profileCopiesPfS_S_j
	.section	.rodata.str1.1
.LC3:
	.string	"true"
.LC4:
	.string	"false"
.LC5:
	.string	"Pageable isSame: %s --- "
	.text
	.type	_ZNSt17_Function_handlerIFvvEZ12pinnedMemorymEUlvE_E9_M_invokeERKSt9_Any_data, @function
_ZNSt17_Function_handlerIFvvEZ12pinnedMemorymEUlvE_E9_M_invokeERKSt9_Any_data:
.LFB3932:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	movq	(%rdi), %rax
	movq	24(%rax), %rcx
	movq	16(%rax), %rdx
	movq	8(%rax), %rsi
	movq	(%rax), %rax
	movl	(%rcx), %ecx
	movq	(%rdx), %rdx
	movq	(%rsi), %rsi
	movq	(%rax), %rdi
	call	_Z13profileCopiesPfS_S_j
	leaq	.LC4(%rip), %rdx
	leaq	.LC5(%rip), %rsi
	popq	%rcx
	.cfi_def_cfa_offset 8
	testb	%al, %al
	leaq	.LC3(%rip), %rax
	movl	$2, %edi
	cmovne	%rax, %rdx
	xorl	%eax, %eax
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE3932:
	.size	_ZNSt17_Function_handlerIFvvEZ12pinnedMemorymEUlvE_E9_M_invokeERKSt9_Any_data, .-_ZNSt17_Function_handlerIFvvEZ12pinnedMemorymEUlvE_E9_M_invokeERKSt9_Any_data
	.section	.rodata.str1.1
.LC6:
	.string	"Pinned isSame: %s --- "
	.text
	.type	_ZNSt17_Function_handlerIFvvEZ12pinnedMemorymEUlvE0_E9_M_invokeERKSt9_Any_data, @function
_ZNSt17_Function_handlerIFvvEZ12pinnedMemorymEUlvE0_E9_M_invokeERKSt9_Any_data:
.LFB3940:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	movq	(%rdi), %rax
	movq	24(%rax), %rcx
	movq	16(%rax), %rdx
	movq	8(%rax), %rsi
	movq	(%rax), %rax
	movl	(%rcx), %ecx
	movq	(%rdx), %rdx
	movq	(%rsi), %rsi
	movq	(%rax), %rdi
	call	_Z13profileCopiesPfS_S_j
	leaq	.LC4(%rip), %rdx
	leaq	.LC6(%rip), %rsi
	popq	%rcx
	.cfi_def_cfa_offset 8
	testb	%al, %al
	leaq	.LC3(%rip), %rax
	movl	$2, %edi
	cmovne	%rax, %rdx
	xorl	%eax, %eax
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE3940:
	.size	_ZNSt17_Function_handlerIFvvEZ12pinnedMemorymEUlvE0_E9_M_invokeERKSt9_Any_data, .-_ZNSt17_Function_handlerIFvvEZ12pinnedMemorymEUlvE0_E9_M_invokeERKSt9_Any_data
	.globl	_Z12pinnedMemorym
	.type	_Z12pinnedMemorym, @function
_Z12pinnedMemorym:
.LFB3789:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3789
	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
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	0(,%rdi,4), %rbx
	subq	$96, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdi, 8(%rsp)
	movq	%rbx, %rdi
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	call	malloc@PLT
	movq	%rbx, %rdi
	movq	%rax, 16(%rsp)
	movq	%rax, %r12
	call	malloc@PLT
	xorl	%edx, %edx
	movq	%rax, 24(%rsp)
.L66:
	cmpq	%rdx, %rbp
	je	.L101
	cvtsi2ssq	%rdx, %xmm0
	movss	%xmm0, (%r12,%rdx,4)
	incq	%rdx
	jmp	.L66
.L101:
	leaq	32(%rsp), %r13
	movq	%rbx, %rsi
	movq	%r13, %rdi
.LEHB0:
	call	cudaMallocHost@PLT
	movl	%eax, %ebp
	testl	%eax, %eax
	je	.L68
	movq	stderr(%rip), %rdi
	movl	$36, %r8d
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rcx
	leaq	.LC1(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movl	%ebp, %edi
	call	cudaGetErrorString@PLT
	movq	stderr(%rip), %rdi
	movl	%ebp, %ecx
	leaq	.LC2(%rip), %rdx
	movq	%rax, %r8
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
.L68:
	leaq	40(%rsp), %r12
	movq	%rbx, %rsi
	movq	%r12, %rdi
	call	cudaMallocHost@PLT
	movl	%eax, %ebp
	testl	%eax, %eax
	je	.L69
	movq	stderr(%rip), %rdi
	movl	$37, %r8d
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rcx
	leaq	.LC1(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movl	%ebp, %edi
	call	cudaGetErrorString@PLT
	movq	stderr(%rip), %rdi
	movl	%ebp, %ecx
	leaq	.LC2(%rip), %rdx
	movq	%rax, %r8
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
.L69:
	movq	16(%rsp), %rsi
	movq	32(%rsp), %rdi
	movq	%rbx, %rcx
	xorl	%eax, %eax
	rep movsb
	movq	%rbx, %rcx
	leaq	48(%rsp), %rbp
	movq	%rbx, %rsi
	movq	24(%rsp), %rdi
	rep stosb
	movq	%rbx, %rcx
	movq	40(%rsp), %rdi
	rep stosb
	movq	%rbp, %rdi
	call	cudaMalloc@PLT
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.L70
	movq	stderr(%rip), %rdi
	movl	$43, %r8d
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rcx
	leaq	.LC1(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movl	%ebx, %edi
	call	cudaGetErrorString@PLT
	movq	stderr(%rip), %rdi
	movl	%ebx, %ecx
	leaq	.LC2(%rip), %rdx
	movq	%rax, %r8
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
.LEHE0:
.L70:
	leaq	56(%rsp), %rdi
	movl	$6, %ecx
	xorl	%eax, %eax
	xorl	%edx, %edx
	rep stosl
	movl	$32, %edi
	movq	%rdx, 80(%rsp)
	leaq	56(%rsp), %rbx
.LEHB1:
	call	_Znwm@PLT
.LEHE1:
	leaq	16(%rsp), %rdx
	leaq	8(%rsp), %r14
	movq	%rbp, 16(%rax)
	movq	%rbx, %rdi
	movq	%rdx, (%rax)
	leaq	24(%rsp), %rdx
	movq	%rdx, 8(%rax)
	movq	%r14, 24(%rax)
	movq	%rax, 56(%rsp)
	leaq	_ZNSt17_Function_handlerIFvvEZ12pinnedMemorymEUlvE_E9_M_invokeERKSt9_Any_data(%rip), %rax
	movq	%rax, 80(%rsp)
	leaq	_ZNSt17_Function_handlerIFvvEZ12pinnedMemorymEUlvE_E10_M_managerERSt9_Any_dataRKS3_St18_Manager_operation(%rip), %rax
	movq	%rax, 72(%rsp)
.LEHB2:
	call	_Z4TIMESt8functionIFvvEE@PLT
.LEHE2:
	jmp	.L102
.L84:
	endbr64
	jmp	.L100
.L102:
	movq	%rbx, %rdi
	call	_ZNSt14_Function_baseD2Ev
	xorl	%eax, %eax
	movl	$6, %ecx
	movq	%rbx, %rdi
	rep stosl
	xorl	%eax, %eax
	movl	$32, %edi
	movq	%rax, 80(%rsp)
.LEHB3:
	call	_Znwm@PLT
.LEHE3:
	movq	%r13, (%rax)
	movq	%rbx, %rdi
	movq	%r12, 8(%rax)
	movq	%rbp, 16(%rax)
	movq	%r14, 24(%rax)
	movq	%rax, 56(%rsp)
	leaq	_ZNSt17_Function_handlerIFvvEZ12pinnedMemorymEUlvE0_E9_M_invokeERKSt9_Any_data(%rip), %rax
	movq	%rax, 80(%rsp)
	leaq	_ZNSt17_Function_handlerIFvvEZ12pinnedMemorymEUlvE0_E10_M_managerERSt9_Any_dataRKS3_St18_Manager_operation(%rip), %rax
	movq	%rax, 72(%rsp)
.LEHB4:
	call	_Z4TIMESt8functionIFvvEE@PLT
.LEHE4:
	jmp	.L103
.L85:
	endbr64
	jmp	.L100
.L103:
	movq	%rbx, %rdi
	call	_ZNSt14_Function_baseD2Ev
	movq	48(%rsp), %rdi
.LEHB5:
	call	cudaFree@PLT
	movq	32(%rsp), %rdi
	call	cudaFreeHost@PLT
	movq	40(%rsp), %rdi
	call	cudaFreeHost@PLT
	movq	16(%rsp), %rdi
	call	free@PLT
	movq	24(%rsp), %rdi
	call	free@PLT
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	je	.L81
	jmp	.L97
.L82:
	endbr64
	jmp	.L100
.L83:
	endbr64
.L100:
	movq	%rax, %rbp
.L79:
	movq	%rbx, %rdi
	call	_ZNSt14_Function_baseD2Ev
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L97
	movq	%rbp, %rdi
	call	_Unwind_Resume@PLT
.LEHE5:
.L97:
	call	__stack_chk_fail@PLT
.L81:
	addq	$96, %rsp
	.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
	.cfi_endproc
.LFE3789:
	.section	.gcc_except_table,"a",@progbits
.LLSDA3789:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3789-.LLSDACSB3789
.LLSDACSB3789:
	.uleb128 .LEHB0-.LFB3789
	.uleb128 .LEHE0-.LEHB0
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB1-.LFB3789
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L84-.LFB3789
	.uleb128 0
	.uleb128 .LEHB2-.LFB3789
	.uleb128 .LEHE2-.LEHB2
	.uleb128 .L82-.LFB3789
	.uleb128 0
	.uleb128 .LEHB3-.LFB3789
	.uleb128 .LEHE3-.LEHB3
	.uleb128 .L85-.LFB3789
	.uleb128 0
	.uleb128 .LEHB4-.LFB3789
	.uleb128 .LEHE4-.LEHB4
	.uleb128 .L83-.LFB3789
	.uleb128 0
	.uleb128 .LEHB5-.LFB3789
	.uleb128 .LEHE5-.LEHB5
	.uleb128 0
	.uleb128 0
.LLSDACSE3789:
	.text
	.size	_Z12pinnedMemorym, .-_Z12pinnedMemorym
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3824:
	.cfi_startproc
	endbr64
	pushq	%rax
	.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
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE3824:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.data.rel.ro,"aw"
	.align 8
	.type	_ZTIZ12pinnedMemorymEUlvE_, @object
	.size	_ZTIZ12pinnedMemorymEUlvE_, 16
_ZTIZ12pinnedMemorymEUlvE_:
	.quad	_ZTVN10__cxxabiv117__class_type_infoE+16
	.quad	_ZTSZ12pinnedMemorymEUlvE_
	.section	.rodata
	.align 16
	.type	_ZTSZ12pinnedMemorymEUlvE_, @object
	.size	_ZTSZ12pinnedMemorymEUlvE_, 24
_ZTSZ12pinnedMemorymEUlvE_:
	.string	"*Z12pinnedMemorymEUlvE_"
	.section	.data.rel.ro
	.align 8
	.type	_ZTIZ12pinnedMemorymEUlvE0_, @object
	.size	_ZTIZ12pinnedMemorymEUlvE0_, 16
_ZTIZ12pinnedMemorymEUlvE0_:
	.quad	_ZTVN10__cxxabiv117__class_type_infoE+16
	.quad	_ZTSZ12pinnedMemorymEUlvE0_
	.section	.rodata
	.align 16
	.type	_ZTSZ12pinnedMemorymEUlvE0_, @object
	.size	_ZTSZ12pinnedMemorymEUlvE0_, 25
_ZTSZ12pinnedMemorymEUlvE0_:
	.string	"*Z12pinnedMemorymEUlvE0_"
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.hidden	DW.ref.__gxx_personality_v0
	.weak	DW.ref.__gxx_personality_v0
	.section	.data.rel.local.DW.ref.__gxx_personality_v0,"awG",@progbits,DW.ref.__gxx_personality_v0,comdat
	.align 8
	.type	DW.ref.__gxx_personality_v0, @object
	.size	DW.ref.__gxx_personality_v0, 8
DW.ref.__gxx_personality_v0:
	.quad	__gxx_personality_v0
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

//
// Created by kindr on 2021/4/28.
//

#ifndef LEARNCUDA_PINNEDMEMORY_CUH
#define LEARNCUDA_PINNEDMEMORY_CUH

void pinnedMemory(size_t nElements);

#endif //LEARNCUDA_PINNEDMEMORY_CUH

	.text
	.file	"pinnedMemory.hip"
	.type	__hip_cuid_,@object             # @__hip_cuid_
	.bss
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               # 0x0
	.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_

	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.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
