﻿
#include "cuda_runtime.h"
#include "device_launch_parameters.h"

#include <stdio.h>
#include <stdlib.h>

__global__ void addKernel(int *c, const int *a, const int *b)
{
    int i = threadIdx.x;
    c[i] = a[i] + b[i];
}

void printDeviceNames() 
{
    int nDevices;
    cudaGetDeviceCount(&nDevices);
    for (int i = 0; i < nDevices; i++) 
    {
        cudaDeviceProp prop;
        cudaGetDeviceProperties(&prop, i);
        printf("Indeks urzadzenia: %d\n", i);
        printf("Nazwa urzadzenia: %s\n\n", prop.name);
    }
}

void printDevicePropertiesById(int id) 
{
    int nDevices, nProcs;
    cudaGetDeviceCount(&nDevices);
    if (id < nDevices) 
    {
        cudaDeviceProp prop;
        cudaGetDeviceProperties(&prop, id);
        cudaDeviceGetAttribute(&nProcs, cudaDevAttrMultiProcessorCount, id);

        printf("Nazwa urzadzenia: %s\n", prop.name);
        printf("Ilosc multiprocesorow: %d.\n", nProcs);
        printf("Kompatybilnosc obliczeniowa: %d.%d.\n\n", prop.major, prop.minor);
    }
    else 
    {
        printf("Urzadzenie o indeksie %d nie istnieje...\n", id);
    }
}

void reportGPUMemory()
{
    size_t free, total;
    int freeMem, totalMem;
    cudaMemGetInfo(&free, &total);

    freeMem = static_cast<int>(free / 1048576);
    totalMem = static_cast<int>(total / 1048576);
    printf("---------- STAN PAMIECI ----------\n");
    printf("Wolna: %d MB\nCalkowita: %d MB\nUzywana: %d MB\n\n", freeMem, totalMem, totalMem - freeMem);
}

void allocAndFreeMem()
{
    reportGPUMemory();

    printf("Alokowanie 16MB danych typu char...\n\n");
    char* charData;
    cudaMallocManaged((void**)&charData, 1 << 24);
    reportGPUMemory();

    printf("Alokowanie 128MB danych typu float...\n\n");
    float* floatData;
    cudaMallocManaged((void**)&floatData, 1 << 27);
    reportGPUMemory();

    printf("Zwolnienie pamieci danych typu char...\n");
    cudaFree(charData);
    reportGPUMemory();

    printf("Zwolnienie pamieci danych typu float...\n");
    cudaFree(floatData);
    reportGPUMemory();
}

void hostAndDeviceTransfer(float *cpuTimeGlobal, float *gpuTimeGlobal, int nElements) 
{
    cudaEvent_t startHostTransfer, stopHostTransfer;
    cudaEvent_t startDevTransfer, stopDevTransfer;

    float cpuTime = 0, gpuTime = 0;

    int *deviceArray;
    int *hostArray = (int*)malloc(nElements * sizeof(int));
    cudaMalloc((int**)&deviceArray, nElements * sizeof(int));

    cudaEventCreate(&startDevTransfer);
    cudaEventCreate(&stopDevTransfer);

    cudaEventRecord(startDevTransfer);
    cudaError_t deviceToHost = cudaMemcpy(deviceArray, hostArray, nElements * sizeof(int), cudaMemcpyHostToDevice);
    cudaEventRecord(stopDevTransfer);
    cudaEventSynchronize(stopDevTransfer);
    if (deviceToHost != cudaSuccess) {
        printf("Nie udalo sie przekopiowac danych z GPU do CPU!\n");
    }
    else {
        printf("Kopiowanie z GPU do CPU powiodlo sie!\n");
        cudaEventElapsedTime(&gpuTime, startDevTransfer, stopDevTransfer);
        printf("Czas kopiowania danych: %fs\n\n", gpuTime);
        *gpuTimeGlobal = gpuTime;
    }

    cudaEventCreate(&startHostTransfer);
    cudaEventCreate(&stopHostTransfer);

    cudaEventRecord(startHostTransfer);
    cudaError_t hostToDevice = cudaMemcpy(hostArray, deviceArray, nElements * sizeof(int), cudaMemcpyDeviceToHost);
    cudaEventRecord(stopHostTransfer);
    cudaEventSynchronize(stopHostTransfer);
    if (hostToDevice != cudaSuccess) {
        printf("Nie udalo sie przekopiowac danych z CPU do GPU!\n");
    }
    else {
        printf("Kopiowanie z CPU do GPU powiodlo sie!\n");
        cudaEventElapsedTime(&cpuTime, startHostTransfer, stopHostTransfer);
        printf("Czas kopiowania danych: %fs\n\n", cpuTime);
        *cpuTimeGlobal = cpuTime;
    }
}

float computeAverageValue(float *array)
{
    float sum = 0.0;
    for (int i = 0; i < sizeof(array); i++)
    {
        sum += array[i];
    }

    return sum / sizeof(array);
}

int main()
{
    // Zadanie 1
    printDeviceNames();

    // Zadanie 2
    int id;
    printf("Wprowadz indeks urzadzenia, aby wyswietlic jego parametry: ");
    scanf("%d", &id);
    printDevicePropertiesById(id);

    // Zadanie 3
    allocAndFreeMem();

    // Zadanie 4, 5, 6
    int nElements = 1024 * 1024;
    float cpuTime[10] = { 0.0 }, gpuTime[10] = { 0.0 };
    for (int i = 0; i < 10; i++) {
        hostAndDeviceTransfer(&cpuTime[i], &gpuTime[i], nElements);
    }

    unsigned int bytes = nElements * sizeof(int);
    float avgCpySpeedCPU = (bytes * 1e-6) / computeAverageValue(cpuTime);
    float avgCpySpeedGPU = (bytes * 1e-6) / computeAverageValue(gpuTime);

    printf("\n-----------------------------------------------\n");
    printf("Rozmiar kopiowanych danych: %d MB\n", bytes / (1024 * 1024));
    printf("Srednia predkosc kopiowania dla CPU [GB/s]: %f\n", avgCpySpeedCPU);
    printf("Srednia predkosc kopiowania dla GPU [GB/s]: %f\n", avgCpySpeedGPU);

    
    return 0;
}

	.file	"tmpxft_0023d804_00000000-6_kernel1.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2036:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2036:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"Nazwa urzadzenia: %s\n"
.LC1:
	.string	"Ilosc multiprocesorow: %d.\n"
.LC2:
	.string	"Kompatybilnosc obliczeniowa: %d.%d.\n\n"
	.text
	.type	_Z25printDevicePropertiesByIdi.part.0, @function
_Z25printDevicePropertiesByIdi.part.0:
.LFB2178:
	.cfi_startproc
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	%edi, %esi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movl	%edi, %ebx
	subq	$1064, %rsp
	.cfi_def_cfa_offset 1088
	movq	%fs:40, %rax
	movq	%rax, 1048(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rbp
	movq	%rbp, %rdi
	call	cudaGetDeviceProperties_v2@PLT
	leaq	12(%rsp), %rdi
	movl	%ebx, %edx
	movl	$16, %esi
	call	cudaDeviceGetAttribute@PLT
	movq	%rbp, %rdx
	movl	$2, %edi
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rsi
	call	__printf_chk@PLT
	movl	12(%rsp), %edx
	movl	$2, %edi
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movl	380(%rsp), %ecx
	xorl	%eax, %eax
	movl	376(%rsp), %edx
	leaq	.LC2(%rip), %rsi
	movl	$2, %edi
	call	__printf_chk@PLT
	movq	1048(%rsp), %rax
	subq	%fs:40, %rax
	je	.L3
	call	__stack_chk_fail@PLT
.L3:
	addq	$1064, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2178:
	.size	_Z25printDevicePropertiesByIdi.part.0, .-_Z25printDevicePropertiesByIdi.part.0
	.section	.rodata.str1.1
.LC3:
	.string	"Indeks urzadzenia: %d\n"
.LC4:
	.string	"Nazwa urzadzenia: %s\n\n"
	.text
	.globl	_Z16printDeviceNamesv
	.type	_Z16printDeviceNamesv, @function
_Z16printDeviceNamesv:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC3(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	xorl	%ebx, %ebx
	subq	$1056, %rsp
	.cfi_def_cfa_offset 1088
	movq	%fs:40, %rax
	movq	%rax, 1048(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rdi
	call	cudaGetDeviceCount@PLT
.L7:
	cmpl	%ebx, 12(%rsp)
	jle	.L11
	leaq	16(%rsp), %rbp
	movl	%ebx, %esi
	movq	%rbp, %rdi
	call	cudaGetDeviceProperties_v2@PLT
	movl	%ebx, %edx
	movq	%r12, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	incl	%ebx
	call	__printf_chk@PLT
	movq	%rbp, %rdx
	movl	$2, %edi
	xorl	%eax, %eax
	leaq	.LC4(%rip), %rsi
	call	__printf_chk@PLT
	jmp	.L7
.L11:
	movq	1048(%rsp), %rax
	subq	%fs:40, %rax
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	addq	$1056, %rsp
	.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
	.cfi_endproc
.LFE2027:
	.size	_Z16printDeviceNamesv, .-_Z16printDeviceNamesv
	.section	.rodata.str1.1
.LC5:
	.string	"Urzadzenie o indeksie %d nie istnieje...\n"
	.text
	.globl	_Z25printDevicePropertiesByIdi
	.type	_Z25printDevicePropertiesByIdi, @function
_Z25printDevicePropertiesByIdi:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movl	%edi, %ebx
	subq	$16, %rsp
	.cfi_def_cfa_offset 32
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rdi
	call	cudaGetDeviceCount@PLT
	cmpl	%ebx, 4(%rsp)
	jle	.L13
	movl	%ebx, %edi
	call	_Z25printDevicePropertiesByIdi.part.0
	jmp	.L12
.L13:
	movl	%ebx, %edx
	leaq	.LC5(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L12:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	addq	$16, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2028:
	.size	_Z25printDevicePropertiesByIdi, .-_Z25printDevicePropertiesByIdi
	.section	.rodata.str1.1
.LC6:
	.string	"---------- STAN PAMIECI ----------\n"
.LC7:
	.string	"Wolna: %d MB\nCalkowita: %d MB\nUzywana: %d MB\n\n"
	.text
	.globl	_Z15reportGPUMemoryv
	.type	_Z15reportGPUMemoryv, @function
_Z15reportGPUMemoryv:
.LFB2029:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$40, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rsi
	leaq	8(%rsp), %rdi
	call	cudaMemGetInfo@PLT
	movq	16(%rsp), %rbp
	movq	8(%rsp), %rbx
	xorl	%eax, %eax
	leaq	.LC6(%rip), %rsi
	movl	$2, %edi
	call	__printf_chk@PLT
	shrq	$20, %rbp
	shrq	$20, %rbx
	xorl	%eax, %eax
	movl	%ebp, %r8d
	movl	%ebp, %ecx
	movl	%ebx, %edx
	movl	$2, %edi
	subl	%ebx, %r8d
	leaq	.LC7(%rip), %rsi
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	addq	$40, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2029:
	.size	_Z15reportGPUMemoryv, .-_Z15reportGPUMemoryv
	.section	.rodata.str1.1
.LC8:
	.string	"Alokowanie 16MB danych typu char...\n\n"
.LC9:
	.string	"Alokowanie 128MB danych typu float...\n\n"
.LC10:
	.string	"Zwolnienie pamieci danych typu char...\n"
.LC11:
	.string	"Zwolnienie pamieci danych typu float...\n"
	.text
	.globl	_Z15allocAndFreeMemv
	.type	_Z15allocAndFreeMemv, @function
_Z15allocAndFreeMemv:
.LFB2030:
	.cfi_startproc
	endbr64
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	call	_Z15reportGPUMemoryv
	leaq	.LC8(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, %edx
	leaq	8(%rsp), %rdi
	movl	$16777216, %esi
	call	cudaMallocManaged@PLT
	call	_Z15reportGPUMemoryv
	leaq	.LC9(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, %edx
	leaq	16(%rsp), %rdi
	movl	$134217728, %esi
	call	cudaMallocManaged@PLT
	call	_Z15reportGPUMemoryv
	leaq	.LC10(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	8(%rsp), %rdi
	call	cudaFree@PLT
	call	_Z15reportGPUMemoryv
	leaq	.LC11(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	16(%rsp), %rdi
	call	cudaFree@PLT
	call	_Z15reportGPUMemoryv
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	addq	$40, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2030:
	.size	_Z15allocAndFreeMemv, .-_Z15allocAndFreeMemv
	.section	.rodata.str1.1
.LC13:
	.string	"Nie udalo sie przekopiowac danych z GPU do CPU!\n"
.LC14:
	.string	"Kopiowanie z GPU do CPU powiodlo sie!\n"
.LC15:
	.string	"Czas kopiowania danych: %fs\n\n"
.LC16:
	.string	"Nie udalo sie przekopiowac danych z CPU do GPU!\n"
.LC17:
	.string	"Kopiowanie z CPU do GPU powiodlo sie!\n"
	.text
	.globl	_Z21hostAndDeviceTransferPfS_i
	.type	_Z21hostAndDeviceTransferPfS_i, @function
_Z21hostAndDeviceTransferPfS_i:
.LFB2031:
	.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
	movq	%rsi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movslq	%edx, %rbx
	salq	$2, %rbx
	movq	%rbx, %rdi
	subq	$64, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	movl	$0x00000000, 8(%rsp)
	movl	$0x00000000, 12(%rsp)
	call	malloc@PLT
	movq	%rbx, %rsi
	leaq	48(%rsp), %rdi
	movq	%rax, %rbp
	call	cudaMalloc@PLT
	leaq	32(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	40(%rsp), %rdi
	call	cudaEventCreate@PLT
	movq	32(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	48(%rsp), %rdi
	movq	%rbx, %rdx
	movq	%rbp, %rsi
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movq	40(%rsp), %rdi
	xorl	%esi, %esi
	movl	%eax, %r14d
	call	cudaEventRecord@PLT
	movq	40(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	testl	%r14d, %r14d
	je	.L24
	leaq	.LC13(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L25
.L24:
	leaq	.LC14(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	40(%rsp), %rdx
	movq	32(%rsp), %rsi
	leaq	12(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	leaq	.LC15(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	12(%rsp), %xmm0
	call	__printf_chk@PLT
	movss	12(%rsp), %xmm0
	movss	%xmm0, 0(%r13)
.L25:
	leaq	16(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	24(%rsp), %rdi
	call	cudaEventCreate@PLT
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	48(%rsp), %rsi
	movq	%rbx, %rdx
	movq	%rbp, %rdi
	movl	$2, %ecx
	call	cudaMemcpy@PLT
	movq	24(%rsp), %rdi
	xorl	%esi, %esi
	movl	%eax, %ebx
	call	cudaEventRecord@PLT
	movq	24(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	testl	%ebx, %ebx
	je	.L26
	leaq	.LC16(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L23
.L26:
	leaq	.LC17(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	24(%rsp), %rdx
	movq	16(%rsp), %rsi
	leaq	8(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	leaq	.LC15(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	8(%rsp), %xmm0
	call	__printf_chk@PLT
	movss	8(%rsp), %xmm0
	movss	%xmm0, (%r12)
.L23:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	je	.L28
	call	__stack_chk_fail@PLT
.L28:
	addq	$64, %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
.LFE2031:
	.size	_Z21hostAndDeviceTransferPfS_i, .-_Z21hostAndDeviceTransferPfS_i
	.globl	_Z19computeAverageValuePf
	.type	_Z19computeAverageValuePf, @function
_Z19computeAverageValuePf:
.LFB2032:
	.cfi_startproc
	endbr64
	xorl	%eax, %eax
	xorps	%xmm0, %xmm0
.L31:
	addss	(%rdi,%rax,4), %xmm0
	incq	%rax
	cmpq	$8, %rax
	jne	.L31
	mulss	.LC18(%rip), %xmm0
	ret
	.cfi_endproc
.LFE2032:
	.size	_Z19computeAverageValuePf, .-_Z19computeAverageValuePf
	.section	.rodata.str1.1
.LC19:
	.string	"Wprowadz indeks urzadzenia, aby wyswietlic jego parametry: "
.LC20:
	.string	"%d"
.LC22:
	.string	"\n-----------------------------------------------\n"
.LC23:
	.string	"Rozmiar kopiowanych danych: %d MB\n"
.LC24:
	.string	"Srednia predkosc kopiowania dla CPU [GB/s]: %f\n"
.LC25:
	.string	"Srednia predkosc kopiowania dla GPU [GB/s]: %f\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2033:
	.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
	xorl	%ebx, %ebx
	subq	$112, %rsp
	.cfi_def_cfa_offset 144
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %r12
	leaq	64(%rsp), %rbp
	call	_Z16printDeviceNamesv
	leaq	.LC19(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	20(%rsp), %rsi
	leaq	.LC20(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc23_scanf@PLT
	movl	20(%rsp), %edi
	call	_Z25printDevicePropertiesByIdi
	call	_Z15allocAndFreeMemv
	xorl	%eax, %eax
	leaq	24(%rsp), %rdi
	movl	$10, %ecx
	rep stosl
	leaq	64(%rsp), %rdi
	movl	$10, %ecx
	rep stosl
.L34:
	leaq	0(%rbp,%rbx), %rsi
	leaq	(%r12,%rbx), %rdi
	movl	$1048576, %edx
	addq	$4, %rbx
	call	_Z21hostAndDeviceTransferPfS_i
	cmpq	$40, %rbx
	jne	.L34
	movq	%r12, %rdi
	leaq	.LC22(%rip), %rsi
	call	_Z19computeAverageValuePf
	movsd	.LC21(%rip), %xmm1
	movq	%rbp, %rdi
	cvtss2sd	%xmm0, %xmm0
	movaps	%xmm1, %xmm2
	divsd	%xmm0, %xmm2
	cvtsd2ss	%xmm2, %xmm2
	movss	%xmm2, 12(%rsp)
	call	_Z19computeAverageValuePf
	movl	$2, %edi
	xorl	%eax, %eax
	cvtss2sd	%xmm0, %xmm0
	divsd	%xmm0, %xmm1
	cvtsd2ss	%xmm1, %xmm1
	movss	%xmm1, 8(%rsp)
	call	__printf_chk@PLT
	movl	$4, %edx
	leaq	.LC23(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movss	12(%rsp), %xmm2
	leaq	.LC24(%rip), %rsi
	movb	$1, %al
	movl	$2, %edi
	cvtss2sd	%xmm2, %xmm0
	call	__printf_chk@PLT
	movl	$2, %edi
	movb	$1, %al
	movss	8(%rsp), %xmm1
	leaq	.LC25(%rip), %rsi
	cvtss2sd	%xmm1, %xmm0
	call	__printf_chk@PLT
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L35
	call	__stack_chk_fail@PLT
.L35:
	addq	$112, %rsp
	.cfi_def_cfa_offset 32
	xorl	%eax, %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
.LFE2033:
	.size	main, .-main
	.text
	.globl	_Z34__device_stub__Z9addKernelPiPKiS1_PiPKiS1_
	.type	_Z34__device_stub__Z9addKernelPiPKiS1_PiPKiS1_, @function
_Z34__device_stub__Z9addKernelPiPKiS1_PiPKiS1_:
.LFB2058:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdi, 24(%rsp)
	leaq	40(%rsp), %rcx
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	32(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 112(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L38
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z9addKernelPiPKiS1_(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 160
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 152
	popq	%rdx
	.cfi_def_cfa_offset 144
.L38:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L40
	call	__stack_chk_fail@PLT
.L40:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2058:
	.size	_Z34__device_stub__Z9addKernelPiPKiS1_PiPKiS1_, .-_Z34__device_stub__Z9addKernelPiPKiS1_PiPKiS1_
	.globl	_Z9addKernelPiPKiS1_
	.type	_Z9addKernelPiPKiS1_, @function
_Z9addKernelPiPKiS1_:
.LFB2059:
	.cfi_startproc
	endbr64
	jmp	_Z34__device_stub__Z9addKernelPiPKiS1_PiPKiS1_
	.cfi_endproc
.LFE2059:
	.size	_Z9addKernelPiPKiS1_, .-_Z9addKernelPiPKiS1_
	.section	.rodata.str1.1
.LC26:
	.string	"_Z9addKernelPiPKiS1_"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2061:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC26(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z9addKernelPiPKiS1_(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2061:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC18:
	.long	1040187392
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC21:
	.long	-1598689907
	.long	1074841335
	.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:

﻿
#include "hip/hip_runtime.h"


#include <stdio.h>
#include <stdlib.h>

__global__ void addKernel(int *c, const int *a, const int *b)
{
    int i = threadIdx.x;
    c[i] = a[i] + b[i];
}

void printDeviceNames() 
{
    int nDevices;
    hipGetDeviceCount(&nDevices);
    for (int i = 0; i < nDevices; i++) 
    {
        hipDeviceProp_t prop;
        hipGetDeviceProperties(&prop, i);
        printf("Indeks urzadzenia: %d\n", i);
        printf("Nazwa urzadzenia: %s\n\n", prop.name);
    }
}

void printDevicePropertiesById(int id) 
{
    int nDevices, nProcs;
    hipGetDeviceCount(&nDevices);
    if (id < nDevices) 
    {
        hipDeviceProp_t prop;
        hipGetDeviceProperties(&prop, id);
        hipDeviceGetAttribute(&nProcs, hipDeviceAttributeMultiprocessorCount, id);

        printf("Nazwa urzadzenia: %s\n", prop.name);
        printf("Ilosc multiprocesorow: %d.\n", nProcs);
        printf("Kompatybilnosc obliczeniowa: %d.%d.\n\n", prop.major, prop.minor);
    }
    else 
    {
        printf("Urzadzenie o indeksie %d nie istnieje...\n", id);
    }
}

void reportGPUMemory()
{
    size_t free, total;
    int freeMem, totalMem;
    hipMemGetInfo(&free, &total);

    freeMem = static_cast<int>(free / 1048576);
    totalMem = static_cast<int>(total / 1048576);
    printf("---------- STAN PAMIECI ----------\n");
    printf("Wolna: %d MB\nCalkowita: %d MB\nUzywana: %d MB\n\n", freeMem, totalMem, totalMem - freeMem);
}

void allocAndFreeMem()
{
    reportGPUMemory();

    printf("Alokowanie 16MB danych typu char...\n\n");
    char* charData;
    hipMallocManaged((void**)&charData, 1 << 24);
    reportGPUMemory();

    printf("Alokowanie 128MB danych typu float...\n\n");
    float* floatData;
    hipMallocManaged((void**)&floatData, 1 << 27);
    reportGPUMemory();

    printf("Zwolnienie pamieci danych typu char...\n");
    hipFree(charData);
    reportGPUMemory();

    printf("Zwolnienie pamieci danych typu float...\n");
    hipFree(floatData);
    reportGPUMemory();
}

void hostAndDeviceTransfer(float *cpuTimeGlobal, float *gpuTimeGlobal, int nElements) 
{
    hipEvent_t startHostTransfer, stopHostTransfer;
    hipEvent_t startDevTransfer, stopDevTransfer;

    float cpuTime = 0, gpuTime = 0;

    int *deviceArray;
    int *hostArray = (int*)malloc(nElements * sizeof(int));
    hipMalloc((int**)&deviceArray, nElements * sizeof(int));

    hipEventCreate(&startDevTransfer);
    hipEventCreate(&stopDevTransfer);

    hipEventRecord(startDevTransfer);
    hipError_t deviceToHost = hipMemcpy(deviceArray, hostArray, nElements * sizeof(int), hipMemcpyHostToDevice);
    hipEventRecord(stopDevTransfer);
    hipEventSynchronize(stopDevTransfer);
    if (deviceToHost != hipSuccess) {
        printf("Nie udalo sie przekopiowac danych z GPU do CPU!\n");
    }
    else {
        printf("Kopiowanie z GPU do CPU powiodlo sie!\n");
        hipEventElapsedTime(&gpuTime, startDevTransfer, stopDevTransfer);
        printf("Czas kopiowania danych: %fs\n\n", gpuTime);
        *gpuTimeGlobal = gpuTime;
    }

    hipEventCreate(&startHostTransfer);
    hipEventCreate(&stopHostTransfer);

    hipEventRecord(startHostTransfer);
    hipError_t hostToDevice = hipMemcpy(hostArray, deviceArray, nElements * sizeof(int), hipMemcpyDeviceToHost);
    hipEventRecord(stopHostTransfer);
    hipEventSynchronize(stopHostTransfer);
    if (hostToDevice != hipSuccess) {
        printf("Nie udalo sie przekopiowac danych z CPU do GPU!\n");
    }
    else {
        printf("Kopiowanie z CPU do GPU powiodlo sie!\n");
        hipEventElapsedTime(&cpuTime, startHostTransfer, stopHostTransfer);
        printf("Czas kopiowania danych: %fs\n\n", cpuTime);
        *cpuTimeGlobal = cpuTime;
    }
}

float computeAverageValue(float *array)
{
    float sum = 0.0;
    for (int i = 0; i < sizeof(array); i++)
    {
        sum += array[i];
    }

    return sum / sizeof(array);
}

int main()
{
    // Zadanie 1
    printDeviceNames();

    // Zadanie 2
    int id;
    printf("Wprowadz indeks urzadzenia, aby wyswietlic jego parametry: ");
    scanf("%d", &id);
    printDevicePropertiesById(id);

    // Zadanie 3
    allocAndFreeMem();

    // Zadanie 4, 5, 6
    int nElements = 1024 * 1024;
    float cpuTime[10] = { 0.0 }, gpuTime[10] = { 0.0 };
    for (int i = 0; i < 10; i++) {
        hostAndDeviceTransfer(&cpuTime[i], &gpuTime[i], nElements);
    }

    unsigned int bytes = nElements * sizeof(int);
    float avgCpySpeedCPU = (bytes * 1e-6) / computeAverageValue(cpuTime);
    float avgCpySpeedGPU = (bytes * 1e-6) / computeAverageValue(gpuTime);

    printf("\n-----------------------------------------------\n");
    printf("Rozmiar kopiowanych danych: %d MB\n", bytes / (1024 * 1024));
    printf("Srednia predkosc kopiowania dla CPU [GB/s]: %f\n", avgCpySpeedCPU);
    printf("Srednia predkosc kopiowania dla GPU [GB/s]: %f\n", avgCpySpeedGPU);

    
    return 0;
}

	.text
	.file	"kernel1.hip"
	.globl	_Z24__device_stub__addKernelPiPKiS1_ # -- Begin function _Z24__device_stub__addKernelPiPKiS1_
	.type	_Z24__device_stub__addKernelPiPKiS1_,@function
_Z24__device_stub__addKernelPiPKiS1_:   # @_Z24__device_stub__addKernelPiPKiS1_
	.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	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	24(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z9addKernelPiPKiS1_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	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_end0:
	.size	_Z24__device_stub__addKernelPiPKiS1_, .Lfunc_end0-_Z24__device_stub__addKernelPiPKiS1_
	.cfi_endproc
                                        # -- End function
	.globl	_Z16printDeviceNamesv           # -- Begin function _Z16printDeviceNamesv
	.type	_Z16printDeviceNamesv,@function
_Z16printDeviceNamesv:                  # @_Z16printDeviceNamesv
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	subq	$1480, %rsp                     # imm = 0x5C8
	.cfi_def_cfa_offset 1504
	.cfi_offset %rbx, -24
	.cfi_offset %rbp, -16
	leaq	4(%rsp), %rbx
	movq	%rbx, %rdi
	callq	hipGetDeviceCount
	cmpl	$0, (%rbx)
	jle	.LBB1_3
# %bb.1:                                # %.lr.ph.preheader
	leaq	8(%rsp), %rbx
	xorl	%ebp, %ebp
.LBB1_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movq	%rbx, %rdi
	movl	%ebp, %esi
	callq	hipGetDevicePropertiesR0600
	movl	$.L.str, %edi
	movl	%ebp, %esi
	xorl	%eax, %eax
	callq	printf
	movl	$.L.str.1, %edi
	movq	%rbx, %rsi
	xorl	%eax, %eax
	callq	printf
	incl	%ebp
	cmpl	4(%rsp), %ebp
	jl	.LBB1_2
.LBB1_3:                                # %._crit_edge
	addq	$1480, %rsp                     # imm = 0x5C8
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z16printDeviceNamesv, .Lfunc_end1-_Z16printDeviceNamesv
	.cfi_endproc
                                        # -- End function
	.globl	_Z25printDevicePropertiesByIdi  # -- Begin function _Z25printDevicePropertiesByIdi
	.type	_Z25printDevicePropertiesByIdi,@function
_Z25printDevicePropertiesByIdi:         # @_Z25printDevicePropertiesByIdi
	.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	$1488, %rsp                     # imm = 0x5D0
	.cfi_def_cfa_offset 1520
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movl	%edi, %ebx
	leaq	12(%rsp), %r14
	movq	%r14, %rdi
	callq	hipGetDeviceCount
	cmpl	%ebx, (%r14)
	jle	.LBB2_2
# %bb.1:
	leaq	16(%rsp), %r14
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	hipGetDevicePropertiesR0600
	leaq	8(%rsp), %r15
	movq	%r15, %rdi
	movl	$63, %esi
	movl	%ebx, %edx
	callq	hipDeviceGetAttribute
	movl	$.L.str.2, %edi
	movq	%r14, %rsi
	xorl	%eax, %eax
	callq	printf
	movl	(%r15), %esi
	movl	$.L.str.3, %edi
	xorl	%eax, %eax
	callq	printf
	movl	360(%r14), %esi
	movl	364(%r14), %edx
	movl	$.L.str.4, %edi
	xorl	%eax, %eax
	callq	printf
	jmp	.LBB2_3
.LBB2_2:
	movl	$.L.str.5, %edi
	movl	%ebx, %esi
	xorl	%eax, %eax
	callq	printf
.LBB2_3:
	addq	$1488, %rsp                     # imm = 0x5D0
	.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_end2:
	.size	_Z25printDevicePropertiesByIdi, .Lfunc_end2-_Z25printDevicePropertiesByIdi
	.cfi_endproc
                                        # -- End function
	.globl	_Z15reportGPUMemoryv            # -- Begin function _Z15reportGPUMemoryv
	.type	_Z15reportGPUMemoryv,@function
_Z15reportGPUMemoryv:                   # @_Z15reportGPUMemoryv
	.cfi_startproc
# %bb.0:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	leaq	16(%rsp), %rbx
	leaq	8(%rsp), %r14
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	hipMemGetInfo
	movq	(%rbx), %rbx
	shrq	$20, %rbx
	movq	(%r14), %r14
	shrq	$20, %r14
	movl	$.Lstr, %edi
	callq	puts@PLT
	movl	%r14d, %ecx
	subl	%ebx, %ecx
	movl	$.L.str.7, %edi
	movl	%ebx, %esi
	movl	%r14d, %edx
	xorl	%eax, %eax
	callq	printf
	addq	$24, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	_Z15reportGPUMemoryv, .Lfunc_end3-_Z15reportGPUMemoryv
	.cfi_endproc
                                        # -- End function
	.globl	_Z15allocAndFreeMemv            # -- Begin function _Z15allocAndFreeMemv
	.type	_Z15allocAndFreeMemv,@function
_Z15allocAndFreeMemv:                   # @_Z15allocAndFreeMemv
	.cfi_startproc
# %bb.0:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	callq	_Z15reportGPUMemoryv
	movl	$.Lstr.1, %edi
	callq	puts@PLT
	leaq	16(%rsp), %rbx
	movl	$16777216, %esi                 # imm = 0x1000000
	movq	%rbx, %rdi
	movl	$1, %edx
	callq	hipMallocManaged
	callq	_Z15reportGPUMemoryv
	movl	$.Lstr.2, %edi
	callq	puts@PLT
	leaq	8(%rsp), %r14
	movl	$134217728, %esi                # imm = 0x8000000
	movq	%r14, %rdi
	movl	$1, %edx
	callq	hipMallocManaged
	callq	_Z15reportGPUMemoryv
	movl	$.Lstr.3, %edi
	callq	puts@PLT
	movq	(%rbx), %rdi
	callq	hipFree
	callq	_Z15reportGPUMemoryv
	movl	$.Lstr.4, %edi
	callq	puts@PLT
	movq	(%r14), %rdi
	callq	hipFree
	callq	_Z15reportGPUMemoryv
	addq	$24, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end4:
	.size	_Z15allocAndFreeMemv, .Lfunc_end4-_Z15allocAndFreeMemv
	.cfi_endproc
                                        # -- End function
	.globl	_Z21hostAndDeviceTransferPfS_i  # -- Begin function _Z21hostAndDeviceTransferPfS_i
	.type	_Z21hostAndDeviceTransferPfS_i,@function
_Z21hostAndDeviceTransferPfS_i:         # @_Z21hostAndDeviceTransferPfS_i
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, %r12
	movq	%rdi, 8(%rsp)                   # 8-byte Spill
	xorl	%eax, %eax
	movl	%eax, 4(%rsp)
	movl	%eax, (%rsp)
	movslq	%edx, %r14
	shlq	$2, %r14
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, %r15
	leaq	16(%rsp), %r13
	movq	%r13, %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	leaq	32(%rsp), %rbp
	movq	%rbp, %rdi
	callq	hipEventCreate
	leaq	24(%rsp), %rbx
	movq	%rbx, %rdi
	callq	hipEventCreate
	movq	(%rbp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	(%r13), %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movl	%eax, %ebp
	movq	(%rbx), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	(%rbx), %rdi
	callq	hipEventSynchronize
	testl	%ebp, %ebp
	je	.LBB5_2
# %bb.1:
	movl	$.Lstr.6, %edi
	callq	puts@PLT
	jmp	.LBB5_3
.LBB5_2:
	movl	$.Lstr.5, %edi
	callq	puts@PLT
	movq	32(%rsp), %rsi
	movq	24(%rsp), %rdx
	movq	%rsp, %rbx
	movq	%rbx, %rdi
	callq	hipEventElapsedTime
	cvtss2sd	(%rbx), %xmm0
	movl	$.L.str.14, %edi
	movb	$1, %al
	callq	printf
	movss	(%rbx), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, (%r12)
.LBB5_3:
	leaq	48(%rsp), %rbx
	movq	%rbx, %rdi
	callq	hipEventCreate
	leaq	40(%rsp), %r12
	movq	%r12, %rdi
	callq	hipEventCreate
	movq	(%rbx), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	16(%rsp), %rsi
	movq	%r15, %rdi
	movq	%r14, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movl	%eax, %ebx
	movq	(%r12), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	(%r12), %rdi
	callq	hipEventSynchronize
	testl	%ebx, %ebx
	je	.LBB5_5
# %bb.4:
	movl	$.Lstr.8, %edi
	callq	puts@PLT
	jmp	.LBB5_6
.LBB5_5:
	movl	$.Lstr.7, %edi
	callq	puts@PLT
	movq	48(%rsp), %rsi
	movq	40(%rsp), %rdx
	leaq	4(%rsp), %rbx
	movq	%rbx, %rdi
	callq	hipEventElapsedTime
	xorps	%xmm0, %xmm0
	cvtss2sd	(%rbx), %xmm0
	movl	$.L.str.14, %edi
	movb	$1, %al
	callq	printf
	movss	(%rbx), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	movq	8(%rsp), %rax                   # 8-byte Reload
	movss	%xmm0, (%rax)
.LBB5_6:
	addq	$56, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end5:
	.size	_Z21hostAndDeviceTransferPfS_i, .Lfunc_end5-_Z21hostAndDeviceTransferPfS_i
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _Z19computeAverageValuePf
.LCPI6_0:
	.long	0x3e000000                      # float 0.125
	.text
	.globl	_Z19computeAverageValuePf
	.type	_Z19computeAverageValuePf,@function
_Z19computeAverageValuePf:              # @_Z19computeAverageValuePf
	.cfi_startproc
# %bb.0:
	xorps	%xmm0, %xmm0
	xorl	%eax, %eax
.LBB6_1:                                # =>This Inner Loop Header: Depth=1
	addss	(%rdi,%rax,4), %xmm0
	incq	%rax
	cmpq	$8, %rax
	jne	.LBB6_1
# %bb.2:
	mulss	.LCPI6_0(%rip), %xmm0
	retq
.Lfunc_end6:
	.size	_Z19computeAverageValuePf, .Lfunc_end6-_Z19computeAverageValuePf
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function main
.LCPI7_0:
	.long	0x3e000000                      # float 0.125
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0
.LCPI7_1:
	.quad	0x4010c6f7a0b5ed8d              # double 4.1943039999999998
	.text
	.globl	main
	.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
	callq	_Z16printDeviceNamesv
	xorl	%r14d, %r14d
	movl	$.L.str.17, %edi
	xorl	%eax, %eax
	callq	printf
	leaq	12(%rsp), %rbx
	movl	$.L.str.18, %edi
	movq	%rbx, %rsi
	xorl	%eax, %eax
	callq	__isoc23_scanf
	movl	(%rbx), %edi
	callq	_Z25printDevicePropertiesByIdi
	callq	_Z15allocAndFreeMemv
	movq	%r14, 96(%rsp)
	xorps	%xmm0, %xmm0
	movaps	%xmm0, 80(%rsp)
	movaps	%xmm0, 64(%rsp)
	movq	%r14, 48(%rsp)
	movaps	%xmm0, 32(%rsp)
	movaps	%xmm0, 16(%rsp)
.LBB7_1:                                # =>This Inner Loop Header: Depth=1
	leaq	(%rsp,%r14), %rdi
	addq	$64, %rdi
	leaq	(%rsp,%r14), %rsi
	addq	$16, %rsi
	movl	$1048576, %edx                  # imm = 0x100000
	callq	_Z21hostAndDeviceTransferPfS_i
	addq	$4, %r14
	cmpq	$40, %r14
	jne	.LBB7_1
# %bb.2:                                # %.preheader.preheader
	xorps	%xmm0, %xmm0
	xorl	%eax, %eax
.LBB7_3:                                # %.preheader
                                        # =>This Inner Loop Header: Depth=1
	addss	64(%rsp,%rax,4), %xmm0
	incq	%rax
	cmpq	$8, %rax
	jne	.LBB7_3
# %bb.4:                                # %_Z19computeAverageValuePf.exit.preheader
	xorps	%xmm1, %xmm1
	xorl	%eax, %eax
.LBB7_5:                                # %_Z19computeAverageValuePf.exit
                                        # =>This Inner Loop Header: Depth=1
	addss	16(%rsp,%rax,4), %xmm1
	incq	%rax
	cmpq	$8, %rax
	jne	.LBB7_5
# %bb.6:                                # %_Z19computeAverageValuePf.exit14
	movss	.LCPI7_0(%rip), %xmm2           # xmm2 = mem[0],zero,zero,zero
	mulss	%xmm2, %xmm0
	cvtss2sd	%xmm0, %xmm0
	movsd	.LCPI7_1(%rip), %xmm3           # xmm3 = mem[0],zero
	movapd	%xmm3, %xmm4
	divsd	%xmm0, %xmm4
	xorps	%xmm0, %xmm0
	cvtsd2ss	%xmm4, %xmm0
	movss	%xmm0, 4(%rsp)                  # 4-byte Spill
	mulss	%xmm2, %xmm1
	xorps	%xmm0, %xmm0
	cvtss2sd	%xmm1, %xmm0
	divsd	%xmm0, %xmm3
	xorps	%xmm0, %xmm0
	cvtsd2ss	%xmm3, %xmm0
	movss	%xmm0, 8(%rsp)                  # 4-byte Spill
	movl	$.Lstr.9, %edi
	callq	puts@PLT
	movl	$.L.str.20, %edi
	movl	$4, %esi
	xorl	%eax, %eax
	callq	printf
	xorps	%xmm0, %xmm0
	cvtss2sd	4(%rsp), %xmm0                  # 4-byte Folded Reload
	movl	$.L.str.21, %edi
	movb	$1, %al
	callq	printf
	xorps	%xmm0, %xmm0
	cvtss2sd	8(%rsp), %xmm0                  # 4-byte Folded Reload
	movl	$.L.str.22, %edi
	movb	$1, %al
	callq	printf
	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_end7:
	.size	main, .Lfunc_end7-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
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB8_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB8_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z9addKernelPiPKiS1_, %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_end8:
	.size	__hip_module_ctor, .Lfunc_end8-__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	.LBB9_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
.LBB9_2:
	retq
.Lfunc_end9:
	.size	__hip_module_dtor, .Lfunc_end9-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z9addKernelPiPKiS1_,@object    # @_Z9addKernelPiPKiS1_
	.section	.rodata,"a",@progbits
	.globl	_Z9addKernelPiPKiS1_
	.p2align	3, 0x0
_Z9addKernelPiPKiS1_:
	.quad	_Z24__device_stub__addKernelPiPKiS1_
	.size	_Z9addKernelPiPKiS1_, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Indeks urzadzenia: %d\n"
	.size	.L.str, 23

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"Nazwa urzadzenia: %s\n\n"
	.size	.L.str.1, 23

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"Nazwa urzadzenia: %s\n"
	.size	.L.str.2, 22

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"Ilosc multiprocesorow: %d.\n"
	.size	.L.str.3, 28

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"Kompatybilnosc obliczeniowa: %d.%d.\n\n"
	.size	.L.str.4, 38

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"Urzadzenie o indeksie %d nie istnieje...\n"
	.size	.L.str.5, 42

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"Wolna: %d MB\nCalkowita: %d MB\nUzywana: %d MB\n\n"
	.size	.L.str.7, 47

	.type	.L.str.14,@object               # @.str.14
.L.str.14:
	.asciz	"Czas kopiowania danych: %fs\n\n"
	.size	.L.str.14, 30

	.type	.L.str.17,@object               # @.str.17
.L.str.17:
	.asciz	"Wprowadz indeks urzadzenia, aby wyswietlic jego parametry: "
	.size	.L.str.17, 60

	.type	.L.str.18,@object               # @.str.18
.L.str.18:
	.asciz	"%d"
	.size	.L.str.18, 3

	.type	.L.str.20,@object               # @.str.20
.L.str.20:
	.asciz	"Rozmiar kopiowanych danych: %d MB\n"
	.size	.L.str.20, 35

	.type	.L.str.21,@object               # @.str.21
.L.str.21:
	.asciz	"Srednia predkosc kopiowania dla CPU [GB/s]: %f\n"
	.size	.L.str.21, 48

	.type	.L.str.22,@object               # @.str.22
.L.str.22:
	.asciz	"Srednia predkosc kopiowania dla GPU [GB/s]: %f\n"
	.size	.L.str.22, 48

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z9addKernelPiPKiS1_"
	.size	.L__unnamed_1, 21

	.type	__hip_fatbin_wrapper,@object    # @__hip_fatbin_wrapper
	.section	.hipFatBinSegment,"a",@progbits
	.p2align	3, 0x0
__hip_fatbin_wrapper:
	.long	1212764230                      # 0x48495046
	.long	1                               # 0x1
	.quad	__hip_fatbin
	.quad	0
	.size	__hip_fatbin_wrapper, 24

	.type	__hip_gpubin_handle,@object     # @__hip_gpubin_handle
	.local	__hip_gpubin_handle
	.comm	__hip_gpubin_handle,8,8
	.section	.init_array,"aw",@init_array
	.p2align	3, 0x0
	.quad	__hip_module_ctor
	.type	__hip_cuid_,@object             # @__hip_cuid_
	.bss
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               # 0x0
	.size	__hip_cuid_, 1

	.type	.Lstr,@object                   # @str
	.section	.rodata.str1.1,"aMS",@progbits,1
.Lstr:
	.asciz	"---------- STAN PAMIECI ----------"
	.size	.Lstr, 35

	.type	.Lstr.1,@object                 # @str.1
.Lstr.1:
	.asciz	"Alokowanie 16MB danych typu char...\n"
	.size	.Lstr.1, 37

	.type	.Lstr.2,@object                 # @str.2
.Lstr.2:
	.asciz	"Alokowanie 128MB danych typu float...\n"
	.size	.Lstr.2, 39

	.type	.Lstr.3,@object                 # @str.3
.Lstr.3:
	.asciz	"Zwolnienie pamieci danych typu char..."
	.size	.Lstr.3, 39

	.type	.Lstr.4,@object                 # @str.4
.Lstr.4:
	.asciz	"Zwolnienie pamieci danych typu float..."
	.size	.Lstr.4, 40

	.type	.Lstr.5,@object                 # @str.5
.Lstr.5:
	.asciz	"Kopiowanie z GPU do CPU powiodlo sie!"
	.size	.Lstr.5, 38

	.type	.Lstr.6,@object                 # @str.6
.Lstr.6:
	.asciz	"Nie udalo sie przekopiowac danych z GPU do CPU!"
	.size	.Lstr.6, 48

	.type	.Lstr.7,@object                 # @str.7
.Lstr.7:
	.asciz	"Kopiowanie z CPU do GPU powiodlo sie!"
	.size	.Lstr.7, 38

	.type	.Lstr.8,@object                 # @str.8
.Lstr.8:
	.asciz	"Nie udalo sie przekopiowac danych z CPU do GPU!"
	.size	.Lstr.8, 48

	.type	.Lstr.9,@object                 # @str.9
.Lstr.9:
	.asciz	"\n-----------------------------------------------"
	.size	.Lstr.9, 49

	.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__addKernelPiPKiS1_
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z9addKernelPiPKiS1_
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z9addKernelPiPKiS1_    ; -- Begin function _Z9addKernelPiPKiS1_
	.globl	_Z9addKernelPiPKiS1_
	.p2align	8
	.type	_Z9addKernelPiPKiS1_,@function
_Z9addKernelPiPKiS1_:                   ; @_Z9addKernelPiPKiS1_
; %bb.0:
	s_clause 0x1
	s_load_b128 s[4:7], s[0:1], 0x0
	s_load_b64 s[0:1], s[0:1], 0x10
	v_lshlrev_b32_e32 v0, 2, v0
	s_waitcnt lgkmcnt(0)
	s_clause 0x1
	global_load_b32 v1, v0, s[6:7]
	global_load_b32 v2, v0, s[0:1]
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v1, v2, v1
	global_store_b32 v0, v1, s[4:5]
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z9addKernelPiPKiS1_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 24
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 3
		.amdhsa_next_free_sgpr 8
		.amdhsa_reserve_vcc 0
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end0:
	.size	_Z9addKernelPiPKiS1_, .Lfunc_end0-_Z9addKernelPiPKiS1_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 76
; NumSgprs: 8
; NumVgprs: 3
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 0
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 8
; NumVGPRsForWavesPerEU: 3
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.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_
	.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
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 24
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z9addKernelPiPKiS1_
    .private_segment_fixed_size: 0
    .sgpr_count:     8
    .sgpr_spill_count: 0
    .symbol:         _Z9addKernelPiPKiS1_.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
