#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <cuda_runtime.h>


__device__ void
vectorAdd1(int* d_A, int* d_B, int* d_C, int size, int* mapBlk, int blockDim){
	int vId = threadIdx.x + mapBlk[blockIdx.x]*blockDim;
	if(vId < size){
		d_C[vId] = d_A[vId] + d_B[vId];
	}
	for(int i =0; i<100000;i++);
}

__device__ void
vectorAdd2(int* d_A, int* d_B, int* d_C, int size, int* mapBlk, int blockDim){
	int vId = threadIdx.x + mapBlk[blockIdx.x]*blockDim;
		if(vId < size){
			d_C[vId] = d_A[vId] + d_B[vId];
		}
		for(int i =0; i<100000;i++);
}

__global__ void
scheduler(int* d_A1, int* d_B1, int* d_C1, int size1, int* d_A2, int* d_B2, int* d_C2, int size2, int* mapBlk, int* mapKernel, int gridDim_A, int blockDim_A, int gridDim_B, int blockDim_B ){

	if(mapKernel[blockIdx.x] == 0)
		vectorAdd1(d_A1, d_B1, d_C1, size1, mapBlk, blockDim_A);
	else
		vectorAdd2(d_A2, d_B2, d_C2, size2, mapBlk, blockDim_A);
}

int main(){

	const int numElements = 1000000;
	size_t size = numElements*sizeof(int);

	int blocks = 2000;
	int threads = 1000;
	int* mapKernel = new int[blocks];
	int* mapBlk = new int[blocks];

		/*Będą wykonywały się na zmianę po jednym bloku*/
		for(int blkA =0, blkB = 0, i = 0; i < blocks; i++)
		{
			mapKernel[i] = i%2;
			if(mapKernel[i] == 0)
				mapBlk[i] = blkA++;
			else
				mapBlk[i] = blkB++;

		}

	/*Alokowanie pamięci na wektory na hoście*/

	int* h_A1 = (int*)malloc(size);
	int* h_B1 = (int*)malloc(size);
	int* h_C1 = (int*)malloc(size);

	int* h_A2 = (int*)malloc(size);
	int* h_B2 = (int*)malloc(size);
	int* h_C2 = (int*)malloc(size);

	/*Wylosowanie liczb do wektorów*/
	srand( time(NULL));
	for(int i = 0; i < numElements; i++){
		h_A1[i] = (int)rand()%10000;
		h_B1[i] = (int)rand()%10000;

		h_A2[i] = (int)rand()%10000;
		h_B2[i] = (int)rand()%10000;
	}

	int* d_A1 = NULL;
	int* d_B1 = NULL;
	int* d_C1 = NULL;

	int* d_A2 = NULL;
	int* d_B2 = NULL;
	int* d_C2 = NULL;

	cudaError_t err = cudaSuccess;


	err = cudaMalloc((void**)&d_A1, size);
	if(err != cudaSuccess)
	{
		printf("Nie udalo sie zaalokowac pamieci na urzadzeniu ( kod bledu %s)!\n", cudaGetErrorString(err));
		exit(EXIT_FAILURE);

	}
	err = cudaMalloc((void**)&d_B1, size);
	if(err != cudaSuccess)
	{
		printf("Nie udalo sie zaalokowac pamieci na urzadzeniu ( kod bledu %s)!\n", cudaGetErrorString(err));
		exit(EXIT_FAILURE);

	}
	err = cudaMalloc((void**)&d_C1, size);
	if(err != cudaSuccess)
	{
		printf("Nie udalo sie zaalokowac pamieci na urzadzeniu ( kod bledu %s)!\n", cudaGetErrorString(err));
		exit(EXIT_FAILURE);

	}
	err = cudaMalloc((void**)&d_A2, size);
	if(err != cudaSuccess)
	{
		printf("Nie udalo sie zaalokowac pamieci na urzadzeniu ( kod bledu %s)!\n", cudaGetErrorString(err));
		exit(EXIT_FAILURE);

	}
	err = cudaMalloc((void**)&d_B2, size);
	if(err != cudaSuccess)
	{
		printf("Nie udalo sie zaalokowac pamieci na urzadzeniu ( kod bledu %s)!\n", cudaGetErrorString(err));
		exit(EXIT_FAILURE);

	}
	err = cudaMalloc((void**)&d_C2, size);
	if(err != cudaSuccess)
	{
		printf("Nie udalo sie zaalokowac pamieci na urzadzeniu ( kod bledu %s)!\n", cudaGetErrorString(err));
		exit(EXIT_FAILURE);

	}

	/*Memcpy host to device*/
	printf("Kopiowanie wektorów z hosta do urzadzenia...\n");

	err = cudaMemcpy(d_A1, h_A1, size, cudaMemcpyHostToDevice);
	if(err != cudaSuccess)
	{
		printf("Nie udalo sie skopiowac danych do urzadzenia( kod bledu %s)!\n", cudaGetErrorString(err));
		exit(EXIT_FAILURE);
	}
	err = cudaMemcpy(d_B1, h_B1, size, cudaMemcpyHostToDevice);
		if(err != cudaSuccess)
		{
			printf("Nie udalo sie skopiowac danych do urzadzenia( kod bledu %s)!\n", cudaGetErrorString(err));
			exit(EXIT_FAILURE);
		}
	err = cudaMemcpy(d_A2, h_A2, size, cudaMemcpyHostToDevice);
		if(err != cudaSuccess)
		{
			printf("Nie udalo sie skopiowac danych do urzadzenia( kod bledu %s)!\n", cudaGetErrorString(err));
			exit(EXIT_FAILURE);
		}
	err = cudaMemcpy(d_B2, h_B2, size, cudaMemcpyHostToDevice);
		if(err != cudaSuccess)
		{
			printf("Nie udalo sie skopiowac danych do urzadzenia( kod bledu %s)!\n", cudaGetErrorString(err));
			exit(EXIT_FAILURE);
		}


	/*Skopiowanie tablic mapujacych do urzadzenia*/
	size_t mapSize = blocks*sizeof(int);
	int* d_mapKernel = NULL;
	int* d_mapBlk = NULL;

	printf("Kopiowanie tablic mapujacych do urzadzenia...\n");
	err = cudaMalloc((void**)&d_mapKernel,mapSize);
	if(err != cudaSuccess)
		{
			printf("Nie udalo sie zaalokowac pamieci na urzadzeniu ( kod bledu %s)!\n", cudaGetErrorString(err));
			exit(EXIT_FAILURE);

		}
	err = cudaMalloc((void**)&d_mapBlk, mapSize);
	if(err != cudaSuccess)
		{
			printf("Nie udalo sie zaalokowac pamieci na urzadzeniu ( kod bledu %s)!\n", cudaGetErrorString(err));
			exit(EXIT_FAILURE);

		}

	err = cudaMemcpy(d_mapKernel, mapKernel, mapSize, cudaMemcpyHostToDevice);
	if(err != cudaSuccess)
		{
			printf("Nie udalo sie skopiowac map do urzadzenia( kod bledu %s)!\n", cudaGetErrorString(err));
			exit(EXIT_FAILURE);

		}
	err = cudaMemcpy(d_mapBlk, mapBlk, mapSize, cudaMemcpyHostToDevice);
	if(err != cudaSuccess)
		{
			printf("Nie udalo sie skopiowac map do urzadzenia ( kod bledu %s)!\n", cudaGetErrorString(err));
			exit(EXIT_FAILURE);

		}
		/*Launching kernel!!!*/
	scheduler<<<blocks,threads>>>(d_A1, d_B1, d_C1, size, d_A2, d_B2, d_C2, size, d_mapBlk, d_mapKernel, blocks, threads, blocks, threads );

	/*Memcpy device to host*/
	err = cudaMemcpy(h_C1, d_C1, size, cudaMemcpyDeviceToHost);
	if(err != cudaSuccess){

		printf("Nie udalo sie skopiowac danych z urzadzenia do hosta ( kod bledu %s)!\n", cudaGetErrorString(err));
		exit(EXIT_FAILURE);
	}
	err = cudaMemcpy(h_C2, d_C2, size, cudaMemcpyDeviceToHost);
	if(err != cudaSuccess){

		printf("Nie udalo sie skopiowac danych z urzadzenia do hosta ( kod bledu %s)!\n", cudaGetErrorString(err));
		exit(EXIT_FAILURE);
	}

	/*Checking the resultes*/
	for(int i = 0; i < numElements; i++)
	{
		int w1,w2;
		w1 = h_A1[i]+h_B1[i];
		w2 = h_A2[i]+h_B2[i];
		if( w1 != h_C1[i])
		{
			printf("nr %d Wynik 1 niepoprawny %d + %d != %d!!\n",i, h_A1[i], h_B1[i], h_C1[i] );
			return 1;
		}
		if( w2 != h_C2[i])
				{
					printf("nr %d Wynik 2 niepoprawny %d + %d != %d!!\n",i,h_A2[i], h_B2[i], h_C2[i] );
					return 1;
				}

	}

	printf("Wynik poprawny!!\n");
	return 0;
}

	.file	"tmpxft_003a2e40_00000000-6_source.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3640:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3640:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z10vectorAdd1PiS_S_iS_i
	.type	_Z10vectorAdd1PiS_S_iS_i, @function
_Z10vectorAdd1PiS_S_iS_i:
.LFB3635:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	$1, 12(%rsp)
	movl	12(%rsp), %edi
	call	exit@PLT
	.cfi_endproc
.LFE3635:
	.size	_Z10vectorAdd1PiS_S_iS_i, .-_Z10vectorAdd1PiS_S_iS_i
	.globl	_Z10vectorAdd2PiS_S_iS_i
	.type	_Z10vectorAdd2PiS_S_iS_i, @function
_Z10vectorAdd2PiS_S_iS_i:
.LFB4285:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	$1, 12(%rsp)
	movl	12(%rsp), %edi
	call	exit@PLT
	.cfi_endproc
.LFE4285:
	.size	_Z10vectorAdd2PiS_S_iS_i, .-_Z10vectorAdd2PiS_S_iS_i
	.globl	_Z48__device_stub__Z9schedulerPiS_S_iS_S_S_iS_S_iiiiPiS_S_iS_S_S_iS_S_iiii
	.type	_Z48__device_stub__Z9schedulerPiS_S_iS_S_S_iS_S_iiiiPiS_S_iS_S_S_iS_S_iiii, @function
_Z48__device_stub__Z9schedulerPiS_S_iS_S_S_iS_S_iiiiPiS_S_iS_S_S_iS_S_iiii:
.LFB3662:
	.cfi_startproc
	endbr64
	subq	$280, %rsp
	.cfi_def_cfa_offset 288
	movq	288(%rsp), %rax
	movq	%rdi, 72(%rsp)
	leaq	104(%rsp), %rdi
	movq	%rsi, 64(%rsp)
	leaq	116(%rsp), %rsi
	movq	%rax, 24(%rsp)
	movq	304(%rsp), %rax
	movq	%rdx, 56(%rsp)
	leaq	88(%rsp), %rdx
	movq	%rax, 16(%rsp)
	movq	312(%rsp), %rax
	movl	%ecx, 52(%rsp)
	leaq	96(%rsp), %rcx
	movq	%r8, 40(%rsp)
	movq	%r9, 32(%rsp)
	movq	%rax, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 264(%rsp)
	xorl	%eax, %eax
	leaq	72(%rsp), %rax
	movl	$1, 112(%rsp)
	movq	%rax, 152(%rsp)
	leaq	64(%rsp), %rax
	movq	%rax, 160(%rsp)
	leaq	56(%rsp), %rax
	movq	%rax, 168(%rsp)
	leaq	52(%rsp), %rax
	movq	%rax, 176(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 184(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 192(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 200(%rsp)
	leaq	296(%rsp), %rax
	movq	%rax, 208(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 216(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 224(%rsp)
	leaq	320(%rsp), %rax
	movq	%rax, 232(%rsp)
	leaq	328(%rsp), %rax
	movq	%rax, 240(%rsp)
	leaq	336(%rsp), %rax
	movq	%rax, 248(%rsp)
	leaq	344(%rsp), %rax
	movq	%rax, 256(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 104(%rsp)
	movq	%rax, 116(%rsp)
	movl	$1, 124(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L6
	pushq	96(%rsp)
	.cfi_def_cfa_offset 296
	leaq	_Z9schedulerPiS_S_iS_S_S_iS_S_iiii(%rip), %rdi
	pushq	96(%rsp)
	.cfi_def_cfa_offset 304
	movq	132(%rsp), %rcx
	movl	140(%rsp), %r8d
	movq	120(%rsp), %rsi
	movl	128(%rsp), %edx
	leaq	168(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 296
	popq	%rdx
	.cfi_def_cfa_offset 288
.L6:
	movq	264(%rsp), %rax
	subq	%fs:40, %rax
	je	.L8
	call	__stack_chk_fail@PLT
.L8:
	addq	$280, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3662:
	.size	_Z48__device_stub__Z9schedulerPiS_S_iS_S_S_iS_S_iiiiPiS_S_iS_S_S_iS_S_iiii, .-_Z48__device_stub__Z9schedulerPiS_S_iS_S_S_iS_S_iiiiPiS_S_iS_S_S_iS_S_iiii
	.globl	_Z9schedulerPiS_S_iS_S_S_iS_S_iiii
	.type	_Z9schedulerPiS_S_iS_S_S_iS_S_iiii, @function
_Z9schedulerPiS_S_iS_S_S_iS_S_iiii:
.LFB3663:
	.cfi_startproc
	endbr64
	jmp	_Z48__device_stub__Z9schedulerPiS_S_iS_S_S_iS_S_iiiiPiS_S_iS_S_S_iS_S_iiii
	.cfi_endproc
.LFE3663:
	.size	_Z9schedulerPiS_S_iS_S_S_iS_S_iiii, .-_Z9schedulerPiS_S_iS_S_S_iS_S_iiii
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"Nie udalo sie zaalokowac pamieci na urzadzeniu ( kod bledu %s)!\n"
.LC1:
	.string	"Kopiowanie wektor\303\263w z hosta do urzadzenia...\n"
.LC2:
	.string	"Nie udalo sie skopiowac danych do urzadzenia( kod bledu %s)!\n"
.LC3:
	.string	"Kopiowanie tablic mapujacych do urzadzenia...\n"
.LC4:
	.string	"Nie udalo sie skopiowac map do urzadzenia( kod bledu %s)!\n"
.LC5:
	.string	"Nie udalo sie skopiowac map do urzadzenia ( kod bledu %s)!\n"
.LC6:
	.string	"Nie udalo sie skopiowac danych z urzadzenia do hosta ( kod bledu %s)!\n"
.LC7:
	.string	"nr %d Wynik 1 niepoprawny %d + %d != %d!!\n"
.LC8:
	.string	"nr %d Wynik 2 niepoprawny %d + %d != %d!!\n"
.LC9:
	.string	"Wynik poprawny!!\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB3637:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$8000, %edi
	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	$136, %rsp
	.cfi_def_cfa_offset 192
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	call	_Znam@PLT
	movl	$8000, %edi
	movq	%rax, (%rsp)
	call	_Znam@PLT
	xorl	%ecx, %ecx
	xorl	%edx, %edx
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
.L15:
	movl	%eax, %edi
	andl	$1, %edi
	jne	.L13
	movl	%edx, %esi
	incl	%edx
	jmp	.L14
.L13:
	movl	%ecx, %esi
	incl	%ecx
.L14:
	movq	(%rsp), %rbx
	movl	%edi, (%rbx,%rax,4)
	movq	8(%rsp), %rbx
	movl	%esi, (%rbx,%rax,4)
	incq	%rax
	cmpq	$2000, %rax
	jne	.L15
	movl	$4000000, %edi
	xorl	%ebp, %ebp
	movl	$10000, %ebx
	call	malloc@PLT
	movl	$4000000, %edi
	movq	%rax, %r12
	call	malloc@PLT
	movl	$4000000, %edi
	movq	%rax, %r13
	call	malloc@PLT
	movl	$4000000, %edi
	movq	%rax, 16(%rsp)
	call	malloc@PLT
	movl	$4000000, %edi
	movq	%rax, %r14
	call	malloc@PLT
	movl	$4000000, %edi
	movq	%rax, %r15
	call	malloc@PLT
	xorl	%edi, %edi
	movq	%rax, 24(%rsp)
	call	time@PLT
	movl	%eax, %edi
	call	srand@PLT
.L16:
	call	rand@PLT
	cltd
	idivl	%ebx
	movl	%edx, (%r12,%rbp)
	call	rand@PLT
	cltd
	idivl	%ebx
	movl	%edx, 0(%r13,%rbp)
	call	rand@PLT
	cltd
	idivl	%ebx
	movl	%edx, (%r14,%rbp)
	call	rand@PLT
	cltd
	idivl	%ebx
	movl	%edx, (%r15,%rbp)
	addq	$4, %rbp
	cmpq	$4000000, %rbp
	jne	.L16
	xorl	%edx, %edx
	leaq	32(%rsp), %rdi
	movl	$4000000, %esi
	movq	%rdx, 32(%rsp)
	movq	%rdx, 40(%rsp)
	movq	%rdx, 48(%rsp)
	movq	%rdx, 56(%rsp)
	movq	%rdx, 64(%rsp)
	movq	%rdx, 72(%rsp)
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	jne	.L51
	leaq	40(%rsp), %rdi
	movl	$4000000, %esi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	jne	.L51
	leaq	48(%rsp), %rdi
	movl	$4000000, %esi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	jne	.L51
	leaq	56(%rsp), %rdi
	movl	$4000000, %esi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	jne	.L51
	leaq	64(%rsp), %rdi
	movl	$4000000, %esi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	jne	.L51
	leaq	72(%rsp), %rdi
	movl	$4000000, %esi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	jne	.L51
	leaq	.LC1(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	32(%rsp), %rdi
	movl	$1, %ecx
	movq	%r12, %rsi
	movl	$4000000, %edx
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	jne	.L52
	movq	40(%rsp), %rdi
	movl	$1, %ecx
	movl	$4000000, %edx
	movq	%r13, %rsi
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	jne	.L52
	movq	56(%rsp), %rdi
	movl	$1, %ecx
	movl	$4000000, %edx
	movq	%r14, %rsi
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	jne	.L52
	movq	64(%rsp), %rdi
	movl	$1, %ecx
	movl	$4000000, %edx
	movq	%r15, %rsi
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L26
.L52:
	call	cudaGetErrorString@PLT
	leaq	.LC2(%rip), %rsi
	movq	%rax, %rdx
	jmp	.L49
.L26:
	xorl	%eax, %eax
	leaq	.LC3(%rip), %rsi
	movl	$2, %edi
	movq	%rax, 80(%rsp)
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	80(%rsp), %rdi
	movl	$8000, %esi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	jne	.L51
	leaq	88(%rsp), %rdi
	movl	$8000, %esi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L28
.L51:
	call	cudaGetErrorString@PLT
	leaq	.LC0(%rip), %rsi
	movq	%rax, %rdx
	jmp	.L49
.L28:
	movq	80(%rsp), %rdi
	movq	(%rsp), %rsi
	movl	$1, %ecx
	movl	$8000, %edx
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L29
	call	cudaGetErrorString@PLT
	leaq	.LC4(%rip), %rsi
	movq	%rax, %rdx
	jmp	.L49
.L29:
	movq	88(%rsp), %rdi
	movq	8(%rsp), %rsi
	movl	$1, %ecx
	movl	$8000, %edx
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L30
	call	cudaGetErrorString@PLT
	leaq	.LC5(%rip), %rsi
	movq	%rax, %rdx
	jmp	.L49
.L30:
	movl	$536871037, %edx
	movl	$268435581, %edi
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$3, %rdx
	salq	$4, %rdi
	movl	$1, %ecx
	movl	$1, %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L31
	pushq	$1000
	.cfi_def_cfa_offset 200
	movl	$4000000, %ecx
	pushq	$2000
	.cfi_def_cfa_offset 208
	pushq	$1000
	.cfi_def_cfa_offset 216
	pushq	$2000
	.cfi_def_cfa_offset 224
	pushq	112(%rsp)
	.cfi_def_cfa_offset 232
	pushq	128(%rsp)
	.cfi_def_cfa_offset 240
	pushq	$4000000
	.cfi_def_cfa_offset 248
	pushq	128(%rsp)
	.cfi_def_cfa_offset 256
	movq	128(%rsp), %r9
	movq	120(%rsp), %r8
	movq	112(%rsp), %rdx
	movq	104(%rsp), %rsi
	movq	96(%rsp), %rdi
	call	_Z48__device_stub__Z9schedulerPiS_S_iS_S_S_iS_S_iiiiPiS_S_iS_S_S_iS_S_iiii
	addq	$64, %rsp
	.cfi_def_cfa_offset 192
.L31:
	movq	16(%rsp), %rdi
	movq	48(%rsp), %rsi
	movl	$2, %ecx
	movl	$4000000, %edx
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	jne	.L50
	movq	24(%rsp), %rdi
	movq	72(%rsp), %rsi
	movl	$4000000, %edx
	movl	$2, %ecx
	call	cudaMemcpy@PLT
	xorl	%edx, %edx
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L33
.L50:
	call	cudaGetErrorString@PLT
	leaq	.LC6(%rip), %rsi
	movq	%rax, %rdx
.L49:
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L33:
	movq	16(%rsp), %rbx
	movl	(%r12,%rdx,4), %edi
	movl	0(%r13,%rdx,4), %r8d
	movl	(%r14,%rdx,4), %ecx
	movl	(%r15,%rdx,4), %esi
	movl	(%rbx,%rdx,4), %r9d
	leal	(%rdi,%r8), %r11d
	leal	(%rcx,%rsi), %r10d
	cmpl	%r11d, %r9d
	je	.L34
	movl	%edi, %ecx
	leaq	.LC7(%rip), %rsi
	jmp	.L46
.L34:
	movq	24(%rsp), %rbx
	movl	(%rbx,%rdx,4), %r9d
	cmpl	%r10d, %r9d
	je	.L36
	movl	%esi, %r8d
	leaq	.LC8(%rip), %rsi
.L46:
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, %eax
	jmp	.L12
.L36:
	incq	%rdx
	cmpq	$1000000, %rdx
	jne	.L33
	leaq	.LC9(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	xorl	%eax, %eax
.L12:
	movq	120(%rsp), %rdx
	subq	%fs:40, %rdx
	je	.L38
	call	__stack_chk_fail@PLT
.L38:
	addq	$136, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3637:
	.size	main, .-main
	.section	.rodata.str1.1
.LC10:
	.string	"_Z9schedulerPiS_S_iS_S_S_iS_S_iiii"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3665:
	.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	.LC10(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z9schedulerPiS_S_iS_S_S_iS_S_iiii(%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
.LFE3665:
	.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:

#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <hip/hip_runtime.h>


__device__ void
vectorAdd1(int* d_A, int* d_B, int* d_C, int size, int* mapBlk, int blockDim){
	int vId = threadIdx.x + mapBlk[blockIdx.x]*blockDim;
	if(vId < size){
		d_C[vId] = d_A[vId] + d_B[vId];
	}
	for(int i =0; i<100000;i++);
}

__device__ void
vectorAdd2(int* d_A, int* d_B, int* d_C, int size, int* mapBlk, int blockDim){
	int vId = threadIdx.x + mapBlk[blockIdx.x]*blockDim;
		if(vId < size){
			d_C[vId] = d_A[vId] + d_B[vId];
		}
		for(int i =0; i<100000;i++);
}

__global__ void
scheduler(int* d_A1, int* d_B1, int* d_C1, int size1, int* d_A2, int* d_B2, int* d_C2, int size2, int* mapBlk, int* mapKernel, int gridDim_A, int blockDim_A, int gridDim_B, int blockDim_B ){

	if(mapKernel[blockIdx.x] == 0)
		vectorAdd1(d_A1, d_B1, d_C1, size1, mapBlk, blockDim_A);
	else
		vectorAdd2(d_A2, d_B2, d_C2, size2, mapBlk, blockDim_A);
}

int main(){

	const int numElements = 1000000;
	size_t size = numElements*sizeof(int);

	int blocks = 2000;
	int threads = 1000;
	int* mapKernel = new int[blocks];
	int* mapBlk = new int[blocks];

		/*Będą wykonywały się na zmianę po jednym bloku*/
		for(int blkA =0, blkB = 0, i = 0; i < blocks; i++)
		{
			mapKernel[i] = i%2;
			if(mapKernel[i] == 0)
				mapBlk[i] = blkA++;
			else
				mapBlk[i] = blkB++;

		}

	/*Alokowanie pamięci na wektory na hoście*/

	int* h_A1 = (int*)malloc(size);
	int* h_B1 = (int*)malloc(size);
	int* h_C1 = (int*)malloc(size);

	int* h_A2 = (int*)malloc(size);
	int* h_B2 = (int*)malloc(size);
	int* h_C2 = (int*)malloc(size);

	/*Wylosowanie liczb do wektorów*/
	srand( time(NULL));
	for(int i = 0; i < numElements; i++){
		h_A1[i] = (int)rand()%10000;
		h_B1[i] = (int)rand()%10000;

		h_A2[i] = (int)rand()%10000;
		h_B2[i] = (int)rand()%10000;
	}

	int* d_A1 = NULL;
	int* d_B1 = NULL;
	int* d_C1 = NULL;

	int* d_A2 = NULL;
	int* d_B2 = NULL;
	int* d_C2 = NULL;

	hipError_t err = hipSuccess;


	err = hipMalloc((void**)&d_A1, size);
	if(err != hipSuccess)
	{
		printf("Nie udalo sie zaalokowac pamieci na urzadzeniu ( kod bledu %s)!\n", hipGetErrorString(err));
		exit(EXIT_FAILURE);

	}
	err = hipMalloc((void**)&d_B1, size);
	if(err != hipSuccess)
	{
		printf("Nie udalo sie zaalokowac pamieci na urzadzeniu ( kod bledu %s)!\n", hipGetErrorString(err));
		exit(EXIT_FAILURE);

	}
	err = hipMalloc((void**)&d_C1, size);
	if(err != hipSuccess)
	{
		printf("Nie udalo sie zaalokowac pamieci na urzadzeniu ( kod bledu %s)!\n", hipGetErrorString(err));
		exit(EXIT_FAILURE);

	}
	err = hipMalloc((void**)&d_A2, size);
	if(err != hipSuccess)
	{
		printf("Nie udalo sie zaalokowac pamieci na urzadzeniu ( kod bledu %s)!\n", hipGetErrorString(err));
		exit(EXIT_FAILURE);

	}
	err = hipMalloc((void**)&d_B2, size);
	if(err != hipSuccess)
	{
		printf("Nie udalo sie zaalokowac pamieci na urzadzeniu ( kod bledu %s)!\n", hipGetErrorString(err));
		exit(EXIT_FAILURE);

	}
	err = hipMalloc((void**)&d_C2, size);
	if(err != hipSuccess)
	{
		printf("Nie udalo sie zaalokowac pamieci na urzadzeniu ( kod bledu %s)!\n", hipGetErrorString(err));
		exit(EXIT_FAILURE);

	}

	/*Memcpy host to device*/
	printf("Kopiowanie wektorów z hosta do urzadzenia...\n");

	err = hipMemcpy(d_A1, h_A1, size, hipMemcpyHostToDevice);
	if(err != hipSuccess)
	{
		printf("Nie udalo sie skopiowac danych do urzadzenia( kod bledu %s)!\n", hipGetErrorString(err));
		exit(EXIT_FAILURE);
	}
	err = hipMemcpy(d_B1, h_B1, size, hipMemcpyHostToDevice);
		if(err != hipSuccess)
		{
			printf("Nie udalo sie skopiowac danych do urzadzenia( kod bledu %s)!\n", hipGetErrorString(err));
			exit(EXIT_FAILURE);
		}
	err = hipMemcpy(d_A2, h_A2, size, hipMemcpyHostToDevice);
		if(err != hipSuccess)
		{
			printf("Nie udalo sie skopiowac danych do urzadzenia( kod bledu %s)!\n", hipGetErrorString(err));
			exit(EXIT_FAILURE);
		}
	err = hipMemcpy(d_B2, h_B2, size, hipMemcpyHostToDevice);
		if(err != hipSuccess)
		{
			printf("Nie udalo sie skopiowac danych do urzadzenia( kod bledu %s)!\n", hipGetErrorString(err));
			exit(EXIT_FAILURE);
		}


	/*Skopiowanie tablic mapujacych do urzadzenia*/
	size_t mapSize = blocks*sizeof(int);
	int* d_mapKernel = NULL;
	int* d_mapBlk = NULL;

	printf("Kopiowanie tablic mapujacych do urzadzenia...\n");
	err = hipMalloc((void**)&d_mapKernel,mapSize);
	if(err != hipSuccess)
		{
			printf("Nie udalo sie zaalokowac pamieci na urzadzeniu ( kod bledu %s)!\n", hipGetErrorString(err));
			exit(EXIT_FAILURE);

		}
	err = hipMalloc((void**)&d_mapBlk, mapSize);
	if(err != hipSuccess)
		{
			printf("Nie udalo sie zaalokowac pamieci na urzadzeniu ( kod bledu %s)!\n", hipGetErrorString(err));
			exit(EXIT_FAILURE);

		}

	err = hipMemcpy(d_mapKernel, mapKernel, mapSize, hipMemcpyHostToDevice);
	if(err != hipSuccess)
		{
			printf("Nie udalo sie skopiowac map do urzadzenia( kod bledu %s)!\n", hipGetErrorString(err));
			exit(EXIT_FAILURE);

		}
	err = hipMemcpy(d_mapBlk, mapBlk, mapSize, hipMemcpyHostToDevice);
	if(err != hipSuccess)
		{
			printf("Nie udalo sie skopiowac map do urzadzenia ( kod bledu %s)!\n", hipGetErrorString(err));
			exit(EXIT_FAILURE);

		}
		/*Launching kernel!!!*/
	scheduler<<<blocks,threads>>>(d_A1, d_B1, d_C1, size, d_A2, d_B2, d_C2, size, d_mapBlk, d_mapKernel, blocks, threads, blocks, threads );

	/*Memcpy device to host*/
	err = hipMemcpy(h_C1, d_C1, size, hipMemcpyDeviceToHost);
	if(err != hipSuccess){

		printf("Nie udalo sie skopiowac danych z urzadzenia do hosta ( kod bledu %s)!\n", hipGetErrorString(err));
		exit(EXIT_FAILURE);
	}
	err = hipMemcpy(h_C2, d_C2, size, hipMemcpyDeviceToHost);
	if(err != hipSuccess){

		printf("Nie udalo sie skopiowac danych z urzadzenia do hosta ( kod bledu %s)!\n", hipGetErrorString(err));
		exit(EXIT_FAILURE);
	}

	/*Checking the resultes*/
	for(int i = 0; i < numElements; i++)
	{
		int w1,w2;
		w1 = h_A1[i]+h_B1[i];
		w2 = h_A2[i]+h_B2[i];
		if( w1 != h_C1[i])
		{
			printf("nr %d Wynik 1 niepoprawny %d + %d != %d!!\n",i, h_A1[i], h_B1[i], h_C1[i] );
			return 1;
		}
		if( w2 != h_C2[i])
				{
					printf("nr %d Wynik 2 niepoprawny %d + %d != %d!!\n",i,h_A2[i], h_B2[i], h_C2[i] );
					return 1;
				}

	}

	printf("Wynik poprawny!!\n");
	return 0;
}

	.text
	.file	"source.hip"
                                        # Start of file scope inline assembly
	.globl	_ZSt21ios_base_library_initv

                                        # End of file scope inline assembly
	.globl	_Z24__device_stub__schedulerPiS_S_iS_S_S_iS_S_iiii # -- Begin function _Z24__device_stub__schedulerPiS_S_iS_S_S_iS_S_iiii
	.type	_Z24__device_stub__schedulerPiS_S_iS_S_S_iS_S_iiii,@function
_Z24__device_stub__schedulerPiS_S_iS_S_S_iS_S_iiii: # @_Z24__device_stub__schedulerPiS_S_iS_S_S_iS_S_iiii
	.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	$208, %rsp
	.cfi_def_cfa_offset 256
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	56(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	48(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	40(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	4(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	32(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	24(%rsp), %r8
	movq	%r9, (%r8)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r8, 40(%rbx)
	leaq	256(%rsp), %rax
	movq	%rax, 48(%rbx)
	leaq	264(%rsp), %rax
	movq	%rax, 56(%rbx)
	leaq	272(%rsp), %rax
	movq	%rax, 64(%rbx)
	leaq	280(%rsp), %rax
	movq	%rax, 72(%rbx)
	leaq	288(%rsp), %rax
	movq	%rax, 80(%rbx)
	leaq	296(%rsp), %rax
	movq	%rax, 88(%rbx)
	leaq	304(%rsp), %rax
	movq	%rax, 96(%rbx)
	leaq	312(%rsp), %rax
	movq	%rax, 104(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%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	$_Z9schedulerPiS_S_iS_S_S_iS_S_iiii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$224, %rsp
	.cfi_adjust_cfa_offset -224
	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__schedulerPiS_S_iS_S_S_iS_S_iiii, .Lfunc_end0-_Z24__device_stub__schedulerPiS_S_iS_S_S_iS_S_iiii
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	.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	$8000, %edi                     # imm = 0x1F40
	callq	_Znam
	movq	%rax, %rbp
	movl	$8000, %edi                     # imm = 0x1F40
	callq	_Znam
	xorl	%r8d, %r8d
	xorl	%ecx, %ecx
	xorl	%edx, %edx
.LBB1_1:                                # =>This Inner Loop Header: Depth=1
	movl	%r8d, %esi
	andl	$1, %esi
	movl	%esi, (%rbp,%r8,4)
	movl	%edx, %edi
	cmovel	%ecx, %edi
	addl	%esi, %edx
	xorl	$1, %esi
	addl	%esi, %ecx
	movl	%edi, (%rax,%r8,4)
	incq	%r8
	cmpq	$2000, %r8                      # imm = 0x7D0
	jne	.LBB1_1
# %bb.2:
	movq	%rax, 64(%rsp)                  # 8-byte Spill
	movl	$4000000, %edi                  # imm = 0x3D0900
	callq	malloc
	movq	%rax, %rbx
	movl	$4000000, %edi                  # imm = 0x3D0900
	callq	malloc
	movq	%rax, %r14
	movl	$4000000, %edi                  # imm = 0x3D0900
	callq	malloc
	movq	%rax, 80(%rsp)                  # 8-byte Spill
	movl	$4000000, %edi                  # imm = 0x3D0900
	callq	malloc
	movq	%rax, %r12
	movl	$4000000, %edi                  # imm = 0x3D0900
	callq	malloc
	movq	%rax, %r13
	movl	$4000000, %edi                  # imm = 0x3D0900
	callq	malloc
	movq	%rax, 72(%rsp)                  # 8-byte Spill
	xorl	%r15d, %r15d
	xorl	%edi, %edi
	callq	time
	movl	%eax, %edi
	callq	srand
.LBB1_3:                                # =>This Inner Loop Header: Depth=1
	callq	rand
	cltq
	imulq	$1759218605, %rax, %rcx         # imm = 0x68DB8BAD
	movq	%rcx, %rdx
	shrq	$63, %rdx
	sarq	$44, %rcx
	addl	%edx, %ecx
	imull	$10000, %ecx, %ecx              # imm = 0x2710
	subl	%ecx, %eax
	movl	%eax, (%rbx,%r15,4)
	callq	rand
	cltq
	imulq	$1759218605, %rax, %rcx         # imm = 0x68DB8BAD
	movq	%rcx, %rdx
	shrq	$63, %rdx
	sarq	$44, %rcx
	addl	%edx, %ecx
	imull	$10000, %ecx, %ecx              # imm = 0x2710
	subl	%ecx, %eax
	movl	%eax, (%r14,%r15,4)
	callq	rand
	cltq
	imulq	$1759218605, %rax, %rcx         # imm = 0x68DB8BAD
	movq	%rcx, %rdx
	shrq	$63, %rdx
	sarq	$44, %rcx
	addl	%edx, %ecx
	imull	$10000, %ecx, %ecx              # imm = 0x2710
	subl	%ecx, %eax
	movl	%eax, (%r12,%r15,4)
	callq	rand
	cltq
	imulq	$1759218605, %rax, %rcx         # imm = 0x68DB8BAD
	movq	%rcx, %rdx
	shrq	$63, %rdx
	sarq	$44, %rcx
	addl	%edx, %ecx
	imull	$10000, %ecx, %ecx              # imm = 0x2710
	subl	%ecx, %eax
	movl	%eax, (%r13,%r15,4)
	incq	%r15
	cmpq	$1000000, %r15                  # imm = 0xF4240
	jne	.LBB1_3
# %bb.4:
	xorl	%eax, %eax
	leaq	56(%rsp), %rdi
	movq	%rax, (%rdi)
	movq	%rax, 40(%rsp)
	movq	%rax, 32(%rsp)
	movq	%rax, 24(%rsp)
	movq	%rax, 16(%rsp)
	movq	%rax, 8(%rsp)
	movl	$4000000, %esi                  # imm = 0x3D0900
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB1_5
# %bb.7:
	leaq	40(%rsp), %rdi
	movl	$4000000, %esi                  # imm = 0x3D0900
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB1_5
# %bb.8:
	leaq	32(%rsp), %rdi
	movl	$4000000, %esi                  # imm = 0x3D0900
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB1_5
# %bb.9:
	leaq	24(%rsp), %rdi
	movl	$4000000, %esi                  # imm = 0x3D0900
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB1_5
# %bb.10:
	leaq	16(%rsp), %rdi
	movl	$4000000, %esi                  # imm = 0x3D0900
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB1_5
# %bb.11:
	leaq	8(%rsp), %rdi
	movl	$4000000, %esi                  # imm = 0x3D0900
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB1_5
# %bb.12:
	movl	$.Lstr, %edi
	callq	puts@PLT
	movq	56(%rsp), %rdi
	movl	$4000000, %edx                  # imm = 0x3D0900
	movq	%rbx, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB1_13
# %bb.14:
	movq	40(%rsp), %rdi
	movl	$4000000, %edx                  # imm = 0x3D0900
	movq	%r14, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB1_13
# %bb.15:
	movq	24(%rsp), %rdi
	movl	$4000000, %edx                  # imm = 0x3D0900
	movq	%r12, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB1_13
# %bb.16:
	movq	16(%rsp), %rdi
	movl	$4000000, %edx                  # imm = 0x3D0900
	movq	%r13, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB1_13
# %bb.17:
	xorl	%eax, %eax
	leaq	48(%rsp), %r15
	movq	%rax, (%r15)
	movq	%rax, (%rsp)
	movl	$.Lstr.1, %edi
	callq	puts@PLT
	movl	$8000, %esi                     # imm = 0x1F40
	movq	%r15, %rdi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB1_5
# %bb.18:
	movq	%rsp, %rdi
	movl	$8000, %esi                     # imm = 0x1F40
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB1_5
# %bb.19:
	movq	48(%rsp), %rdi
	movl	$8000, %edx                     # imm = 0x1F40
	movq	%rbp, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB1_20
# %bb.21:
	movq	(%rsp), %rdi
	movl	$8000, %edx                     # imm = 0x1F40
	movq	64(%rsp), %rsi                  # 8-byte Reload
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	movq	80(%rsp), %r15                  # 8-byte Reload
	movq	72(%rsp), %rbp                  # 8-byte Reload
	jne	.LBB1_22
# %bb.23:
	movabsq	$4294968296, %rdx               # imm = 0x1000003E8
	leaq	1000(%rdx), %rdi
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB1_25
# %bb.24:
	movq	56(%rsp), %rdi
	movq	40(%rsp), %rsi
	movq	32(%rsp), %rdx
	movq	24(%rsp), %r8
	movq	16(%rsp), %r9
	movl	$1000, %eax                     # imm = 0x3E8
	movl	$2000, %r10d                    # imm = 0x7D0
	movl	$4000000, %ecx                  # imm = 0x3D0900
	pushq	%rax
	.cfi_adjust_cfa_offset 8
	pushq	%r10
	.cfi_adjust_cfa_offset 8
	pushq	%rax
	.cfi_adjust_cfa_offset 8
	pushq	%r10
	.cfi_adjust_cfa_offset 8
	pushq	80(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	40(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	$4000000                        # imm = 0x3D0900
	.cfi_adjust_cfa_offset 8
	pushq	64(%rsp)
	.cfi_adjust_cfa_offset 8
	callq	_Z24__device_stub__schedulerPiS_S_iS_S_S_iS_S_iiii
	addq	$64, %rsp
	.cfi_adjust_cfa_offset -64
.LBB1_25:
	movq	32(%rsp), %rsi
	movl	$4000000, %edx                  # imm = 0x3D0900
	movq	%r15, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB1_26
# %bb.27:
	movq	8(%rsp), %rsi
	movl	$4000000, %edx                  # imm = 0x3D0900
	movq	%rbp, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB1_26
# %bb.28:                               # %.preheader.preheader
	xorl	%esi, %esi
.LBB1_29:                               # %.preheader
                                        # =>This Inner Loop Header: Depth=1
	movl	(%rbx,%rsi,4), %edx
	movl	(%r14,%rsi,4), %ecx
	leal	(%rcx,%rdx), %eax
	movl	(%r15,%rsi,4), %r8d
	cmpl	%r8d, %eax
	jne	.LBB1_30
# %bb.32:                               #   in Loop: Header=BB1_29 Depth=1
	movl	(%r13,%rsi,4), %ecx
	movl	(%r12,%rsi,4), %edx
	leal	(%rcx,%rdx), %eax
	movl	(%rbp,%rsi,4), %r8d
	cmpl	%r8d, %eax
	jne	.LBB1_33
# %bb.34:                               #   in Loop: Header=BB1_29 Depth=1
	incq	%rsi
	cmpq	$1000000, %rsi                  # imm = 0xF4240
	jne	.LBB1_29
# %bb.35:
	movl	$.Lstr.2, %edi
	callq	puts@PLT
	xorl	%eax, %eax
	jmp	.LBB1_36
.LBB1_30:
	movl	$.L.str.7, %edi
	jmp	.LBB1_31
.LBB1_33:
	movl	$.L.str.8, %edi
.LBB1_31:
                                        # kill: def $esi killed $esi killed $rsi
                                        # kill: def $edx killed $edx killed $rdx
                                        # kill: def $ecx killed $ecx killed $rcx
	xorl	%eax, %eax
	callq	printf
	movl	$1, %eax
.LBB1_36:
	addq	$88, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB1_5:
	.cfi_def_cfa_offset 144
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str, %edi
	jmp	.LBB1_6
.LBB1_13:
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.2, %edi
	jmp	.LBB1_6
.LBB1_26:
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.6, %edi
	jmp	.LBB1_6
.LBB1_20:
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.4, %edi
	jmp	.LBB1_6
.LBB1_22:
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.5, %edi
.LBB1_6:
	movq	%rax, %rsi
	xorl	%eax, %eax
	callq	printf
	movl	$1, %edi
	callq	exit
.Lfunc_end1:
	.size	main, .Lfunc_end1-main
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB2_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB2_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z9schedulerPiS_S_iS_S_S_iS_S_iiii, %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	_Z9schedulerPiS_S_iS_S_S_iS_S_iiii,@object # @_Z9schedulerPiS_S_iS_S_S_iS_S_iiii
	.section	.rodata,"a",@progbits
	.globl	_Z9schedulerPiS_S_iS_S_S_iS_S_iiii
	.p2align	3, 0x0
_Z9schedulerPiS_S_iS_S_S_iS_S_iiii:
	.quad	_Z24__device_stub__schedulerPiS_S_iS_S_S_iS_S_iiii
	.size	_Z9schedulerPiS_S_iS_S_S_iS_S_iiii, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Nie udalo sie zaalokowac pamieci na urzadzeniu ( kod bledu %s)!\n"
	.size	.L.str, 65

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"Nie udalo sie skopiowac danych do urzadzenia( kod bledu %s)!\n"
	.size	.L.str.2, 62

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"Nie udalo sie skopiowac map do urzadzenia( kod bledu %s)!\n"
	.size	.L.str.4, 59

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"Nie udalo sie skopiowac map do urzadzenia ( kod bledu %s)!\n"
	.size	.L.str.5, 60

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"Nie udalo sie skopiowac danych z urzadzenia do hosta ( kod bledu %s)!\n"
	.size	.L.str.6, 71

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"nr %d Wynik 1 niepoprawny %d + %d != %d!!\n"
	.size	.L.str.7, 43

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"nr %d Wynik 2 niepoprawny %d + %d != %d!!\n"
	.size	.L.str.8, 43

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z9schedulerPiS_S_iS_S_S_iS_S_iiii"
	.size	.L__unnamed_1, 35

	.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	"Kopiowanie wektor\303\263w z hosta do urzadzenia..."
	.size	.Lstr, 46

	.type	.Lstr.1,@object                 # @str.1
.Lstr.1:
	.asciz	"Kopiowanie tablic mapujacych do urzadzenia..."
	.size	.Lstr.1, 46

	.type	.Lstr.2,@object                 # @str.2
.Lstr.2:
	.asciz	"Wynik poprawny!!"
	.size	.Lstr.2, 17

	.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__schedulerPiS_S_iS_S_S_iS_S_iiii
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z9schedulerPiS_S_iS_S_S_iS_S_iiii
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z9schedulerPiS_S_iS_S_S_iS_S_iiii ; -- Begin function _Z9schedulerPiS_S_iS_S_S_iS_S_iiii
	.globl	_Z9schedulerPiS_S_iS_S_S_iS_S_iiii
	.p2align	8
	.type	_Z9schedulerPiS_S_iS_S_S_iS_S_iiii,@function
_Z9schedulerPiS_S_iS_S_S_iS_S_iiii:     ; @_Z9schedulerPiS_S_iS_S_S_iS_S_iiii
; %bb.0:
	s_load_b128 s[4:7], s[0:1], 0x40
	s_mov_b32 s2, s15
	s_mov_b32 s3, 0
	s_delay_alu instid0(SALU_CYCLE_1)
	s_lshl_b64 s[8:9], s[2:3], 2
	s_load_b32 s2, s[0:1], 0x54
	s_waitcnt lgkmcnt(0)
	s_add_u32 s6, s6, s8
	s_addc_u32 s7, s7, s9
	s_add_u32 s4, s4, s8
	s_addc_u32 s5, s5, s9
	s_load_b32 s4, s[4:5], 0x0
	s_load_b32 s5, s[6:7], 0x0
	s_waitcnt lgkmcnt(0)
	v_mad_u64_u32 v[4:5], null, s4, s2, v[0:1]
	s_cmp_lg_u32 s5, 0
	s_cbranch_scc0 .LBB0_4
; %bb.1:
	s_load_b32 s2, s[0:1], 0x38
                                        ; implicit-def: $vgpr5_vgpr6
                                        ; implicit-def: $vgpr2_vgpr3
                                        ; implicit-def: $vgpr0_vgpr1
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
	v_cmp_gt_i32_e32 vcc_lo, s2, v4
	s_mov_b32 s2, 0
	s_and_saveexec_b32 s4, vcc_lo
	s_xor_b32 s4, exec_lo, s4
	s_cbranch_execz .LBB0_3
; %bb.2:
	s_clause 0x1
	s_load_b128 s[8:11], s[0:1], 0x20
	s_load_b64 s[6:7], s[0:1], 0x30
	v_ashrrev_i32_e32 v5, 31, v4
	s_mov_b32 s3, exec_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[5:6], 2, v[4:5]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v0, vcc_lo, s8, v5
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v1, vcc_lo, s9, v6, vcc_lo
	v_add_co_u32 v2, vcc_lo, s10, v5
	v_add_co_ci_u32_e32 v3, vcc_lo, s11, v6, vcc_lo
	v_add_co_u32 v5, vcc_lo, s6, v5
	v_add_co_ci_u32_e32 v6, vcc_lo, s7, v6, vcc_lo
.LBB0_3:                                ; %Flow53
	s_or_b32 exec_lo, exec_lo, s4
	s_branch .LBB0_5
.LBB0_4:
	s_mov_b32 s2, -1
                                        ; implicit-def: $vgpr5_vgpr6
                                        ; implicit-def: $vgpr2_vgpr3
                                        ; implicit-def: $vgpr0_vgpr1
.LBB0_5:                                ; %Flow
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_b32 vcc_lo, exec_lo, s2
	s_cbranch_vccz .LBB0_9
; %bb.6:
	s_load_b32 s2, s[0:1], 0x18
                                        ; implicit-def: $vgpr5_vgpr6
                                        ; implicit-def: $vgpr2_vgpr3
                                        ; implicit-def: $vgpr0_vgpr1
	s_waitcnt lgkmcnt(0)
	v_cmp_gt_i32_e32 vcc_lo, s2, v4
	s_and_saveexec_b32 s2, vcc_lo
	s_cbranch_execz .LBB0_8
; %bb.7:
	s_clause 0x1
	s_load_b128 s[4:7], s[0:1], 0x0
	s_load_b64 s[0:1], s[0:1], 0x10
	v_ashrrev_i32_e32 v5, 31, v4
	s_or_b32 s3, s3, exec_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[5:6], 2, v[4:5]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v0, vcc_lo, s4, v5
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v1, vcc_lo, s5, v6, vcc_lo
	v_add_co_u32 v2, vcc_lo, s6, v5
	v_add_co_ci_u32_e32 v3, vcc_lo, s7, v6, vcc_lo
	v_add_co_u32 v5, vcc_lo, s0, v5
	v_add_co_ci_u32_e32 v6, vcc_lo, s1, v6, vcc_lo
.LBB0_8:                                ; %Flow55
	s_or_b32 exec_lo, exec_lo, s2
.LBB0_9:                                ; %Flow54
	s_and_saveexec_b32 s0, s3
	s_cbranch_execz .LBB0_11
; %bb.10:                               ; %_Z10vectorAdd1PiS_S_iS_i.exit.sink.split
	global_load_b32 v0, v[0:1], off
	global_load_b32 v1, v[2:3], off
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v0, v1, v0
	global_store_b32 v[5:6], v0, off
.LBB0_11:                               ; %_Z10vectorAdd1PiS_S_iS_i.exit
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z9schedulerPiS_S_iS_S_S_iS_S_iiii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 96
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 7
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end0:
	.size	_Z9schedulerPiS_S_iS_S_S_iS_S_iiii, .Lfunc_end0-_Z9schedulerPiS_S_iS_S_S_iS_S_iiii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 396
; NumSgprs: 18
; NumVgprs: 7
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 7
; 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
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         40
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         48
        .size:           8
        .value_kind:     global_buffer
      - .offset:         56
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         64
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         72
        .size:           8
        .value_kind:     global_buffer
      - .offset:         80
        .size:           4
        .value_kind:     by_value
      - .offset:         84
        .size:           4
        .value_kind:     by_value
      - .offset:         88
        .size:           4
        .value_kind:     by_value
      - .offset:         92
        .size:           4
        .value_kind:     by_value
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 96
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z9schedulerPiS_S_iS_S_S_iS_S_iiii
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z9schedulerPiS_S_iS_S_S_iS_S_iiii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     7
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
