/** File:    svmPredict.cu
 * Purpose:  Parallel Programming 2017 Final Project: Training Support Vector Machine on multiprocessors and GPUs
 *           use to get accuracy of training result on GPU
 *
 * Compile:  nvcc -o svmPredict svmPredict.cu
 * Run:      ./svmPredict ./data/test-mnist ./data/train-mnist.model 1500 784
 *           ./data/test-mnist: input test data set
 *           ./data/train-mnist.model: input model data
 *           1500       : number of training data 
 *           784        : dimension of feature space
 *
 * Notes:
 *    1.  Need modified_SMO executable to train first in order to get model file. 
 *    2.  The test file shouldn't be the same with the training data.
 *
 * Output: percentage of prediction accuracy of input data
 *
 * Author: Wei-Hsiang Teng
 * History: 2017/6/9       created
 *          2017/6/13      change datatype from float to double
 *	        
 */  

#include <string.h> /* for memset */
#include <stdlib.h>
#include <stdio.h>
#include <sys/time.h> // for estimate elapsed time
#include <math.h>
#define STR_SIZE 8192

#define CHECK(call)                                                            \
{                                                                              \
    const cudaError_t error = call;                                            \
    if (error != cudaSuccess)                                                  \
    {                                                                          \
        fprintf(stderr, "Error: %s:%d, ", __FILE__, __LINE__);                 \
        fprintf(stderr, "code: %d, reason: %s\n", error,                       \
                cudaGetErrorString(error));                                    \
        exit(-1);                                                               \
    }                                                                          \
}

#define GET_TIME(now) { \
   struct timeval t; \
   gettimeofday(&t, NULL); \
   now = t.tv_sec + t.tv_usec/1000000.0; \
}
/**
* name:        rbf_kernel
*
* description: kernel generates kernel function K(X_i, X_j) of X which is gaussian.
* input:       x1[]: coordinates of testing data set
*              x2[]: coordinates of support vectors
*              dim: number of dimension of coordinates
*              i, j: index of kernel function K(X_i, X_j)
*              gamma: parameter for guassian kernel: exp(-gamma*|X_i - X_j|^2) 
*
* output:      K(X_i, X_j)      
* 
*/
__device__ double rbf_kernel(double x1[], double x2[], int i, int j, int dim, double gamma)
{
	double ker = 0.0;
	int m;

	for (m = 0; m < dim; m++)
	{
		ker += (x1[i * dim + m] - x2[j * dim + m]) * (x1[i * dim + m] - x2[j * dim + m]);
	}
	ker = exp(-1 * gamma * ker);
	
	return ker;
}

__global__ void svmPredict(double* devX1, double* devX2, int* devY, double* devAlphas, int size, int total_sv, int dim, double gamma, double b, int* num)
{
	int i = blockIdx.x * blockDim.x + threadIdx.x;
	int j, result;
	double dual = 0;
	if (i < size) 
	{
		for (j = 0; j < total_sv; j++) {
			dual +=  devAlphas[j] * rbf_kernel(devX1, devX2, i, j, dim, gamma);
		} 
		dual += b;
		result = 1;
		if (dual < 0)
			result = -1;
		if (result == devY[i])
			atomicAdd(num, 1);
	}
}

void read_data(char* file, double x[], int y[], int size, int dim)
{
	int i;
	char s[STR_SIZE];
	const char* delim = ":";
    char *token;
	int index = 0, pre_index = 0;
	FILE *pFile;
	
	pFile = fopen(file, "r"); 
	if (pFile == NULL) {
		printf("can't open %s\n", file);
		exit(-1);
	}
	
	for (i = 0; i < size; i++)
	{
		int cnt = 0;
		fgets(s, sizeof(s), pFile);
	    /* get the first token */
	    token = strtok(s, delim);
	    sscanf(token, "%d %d", &y[i], &index);
	    /* walk through other tokens */
	    while( token != NULL ) 
	    {
			if (cnt == 0) {
				token = strtok(NULL, delim);
			}
			if (index > 0)
				sscanf(token, "%lf %d", &x[i * dim + index - 1], &pre_index);
			index = pre_index;
		    token = strtok(NULL, delim);			
			cnt++;
	    }
	}
	fclose(pFile);
}

void read_model(char* file, double x[], double alphas[], int dim, int total_sv)
{
	FILE *pFile;
	int i;
	char s[STR_SIZE];
	const char* delim = ":";
        char *token;
	int index = 0, pre_index = 0;
	
	pFile = fopen(file, "r"); 
	if (pFile == NULL) {
		printf("can't open %s\n", file);
		exit(-1);
	}
	fgets(s, sizeof(s), pFile);
	for (i = 0; i < total_sv; i++)
	{
		int cnt = 0;
		fgets(s, sizeof(s), pFile);
	        /* get the first token */
	        token = strtok(s, delim);
	        sscanf(token, "%lf %d", &alphas[i], &index);
	        /* walk through other tokens */
	        while( token != NULL ) 
	        {
			if (cnt == 0) {
				token = strtok(NULL, delim);
			}
			if (index > 0)
				sscanf(token, "%lf %d", &x[i * dim + index - 1], &pre_index);
			index = pre_index;
		        token = strtok(NULL, delim);			
			cnt++;
	        }
	}
	fclose(pFile);
}

int main(int argc, char* argv[])
{
	int size, dim, total_sv, correct_num;
	double* x1, *x2;
	double gamma, b;
	int *y1;
	double* alphas;
	double start, end;
	
	/* device variables */
	double* devX1;
	double* devX2;
	int* devY;
	double* devAlphas;
	int* devNum;
	
	if (argc < 5) {
		printf("%s data_file model_file data_size data_dim\n", argv[0]);
		exit(-1);
	}
	
	size = atoi(argv[3]);
	dim = atoi(argv[4]);
	
	GET_TIME(start);
	x1 = (double *)malloc(size*dim*sizeof(double));
	memset(x1, 0, sizeof(double)*size*dim);
	y1 = (int *)malloc(size*sizeof(double));
	
	/* read files */
	read_data(argv[1], x1, y1, size, dim);
	/* read model */
	FILE *fp;
	fp = fopen(argv[2], "r");
	if (fp == NULL)
	{
		printf("can't open file %s\n", argv[2]);
		exit(-1);
	}
	fscanf(fp, "%d %lf %lf", &total_sv, &gamma, &b);
	fclose(fp);
	x2 = (double *)malloc(total_sv*dim*sizeof(double));
	memset(x2, 0, sizeof(double)*total_sv*dim);
	alphas = (double *)malloc(total_sv*sizeof(double));
	read_model(argv[2], x2, alphas, dim, total_sv);
	
	/* allocate device memory */
	CHECK(cudaMalloc((void**)&devX1, size * dim * sizeof(double)));
	CHECK(cudaMalloc((void**)&devY, size * sizeof(int)));
	CHECK(cudaMalloc((void**)&devNum, sizeof(int)));
	CHECK(cudaMemcpy(devX1, x1, size * dim * sizeof(double), cudaMemcpyHostToDevice));
	CHECK(cudaMemcpy(devY, y1, size * sizeof(int), cudaMemcpyHostToDevice));
	CHECK(cudaMalloc((void**)&devX2, total_sv * dim * sizeof(double)));
	CHECK(cudaMalloc((void**)&devAlphas, total_sv * sizeof(double)));
	CHECK(cudaMemcpy(devX2, x2, total_sv * dim * sizeof(double), cudaMemcpyHostToDevice));
	CHECK(cudaMemcpy(devAlphas, alphas, total_sv * sizeof(double), cudaMemcpyHostToDevice));
	
	dim3 block(32);
	dim3 grid((size + block.x - 1)/block.x);
	
	svmPredict<<<grid, block>>>(devX1, devX2, devY, devAlphas, size, total_sv, dim, gamma, b, devNum);
	CHECK(cudaMemcpy(&correct_num, devNum, sizeof(int), cudaMemcpyDeviceToHost));
	GET_TIME(end);
	printf("accuracy (%d/%d): %1.5f\n", correct_num, size, (double)correct_num/size);
	printf("elapsed time is %lf seconds\n", end - start);
	
	free(y1);
    free(x2);
	free(alphas);
	cudaFree(devX1);
	cudaFree(devX2);
	cudaFree(devY);
	cudaFree(devAlphas);
	cudaFree(devNum);
	return 0;
}

	.file	"tmpxft_002f6109_00000000-6_svmPredict.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2033:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2033:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z10rbf_kernelPdS_iiid
	.type	_Z10rbf_kernelPdS_iiid, @function
_Z10rbf_kernelPdS_iiid:
.LFB2027:
	.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
.LFE2027:
	.size	_Z10rbf_kernelPdS_iiid, .-_Z10rbf_kernelPdS_iiid
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"r"
.LC1:
	.string	"can't open %s\n"
.LC2:
	.string	":"
.LC3:
	.string	"%d %d"
.LC4:
	.string	"%lf %d"
	.text
	.globl	_Z9read_dataPcPdPiii
	.type	_Z9read_dataPcPdPiii, @function
_Z9read_dataPcPdPiii:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4152
	orq	$0, (%rsp)
	subq	$4096, %rsp
	.cfi_def_cfa_offset 8248
	orq	$0, (%rsp)
	subq	$56, %rsp
	.cfi_def_cfa_offset 8304
	movl	%ecx, 20(%rsp)
	movq	%rsi, %r13
	movq	%rdi, %rbp
	movq	%rdx, %rbx
	leaq	.LC0(%rip), %rsi
	movl	%r8d, %r14d
	movq	%fs:40, %rax
	movq	%rax, 8232(%rsp)
	xorl	%eax, %eax
	xorl	%eax, %eax
	movl	%eax, 32(%rsp)
	movl	%eax, 36(%rsp)
	call	fopen@PLT
	movq	%rax, 8(%rsp)
	testq	%rax, %rax
	je	.L5
	xorl	%r12d, %r12d
	xorl	%ebp, %ebp
	jmp	.L6
.L5:
	movl	$2, %edi
	movq	%rbp, %rdx
	leaq	.LC1(%rip), %rsi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	orl	$-1, %edi
	call	exit@PLT
.L10:
	testl	%r15d, %r15d
	jne	.L8
	xorl	%edi, %edi
	leaq	.LC2(%rip), %rsi
	call	strtok@PLT
	movq	%rax, %rdi
.L8:
	movl	32(%rsp), %eax
	testl	%eax, %eax
	jle	.L9
	addl	%r12d, %eax
	leaq	36(%rsp), %rcx
	leaq	.LC4(%rip), %rsi
	cltq
	leaq	-8(%r13,%rax,8), %rdx
	xorl	%eax, %eax
	call	__isoc23_sscanf@PLT
.L9:
	movl	36(%rsp), %eax
	xorl	%edi, %edi
	leaq	.LC2(%rip), %rsi
	incl	%r15d
	movl	%eax, 32(%rsp)
	call	strtok@PLT
	movq	%rax, %rdi
.L7:
	testq	%rdi, %rdi
	jne	.L10
	incl	%ebp
	addq	$4, %rbx
	addl	%r14d, %r12d
.L6:
	movl	20(%rsp), %eax
	cmpl	%eax, %ebp
	jge	.L15
	movq	8(%rsp), %rcx
	leaq	40(%rsp), %r15
	movl	$8192, %edx
	movl	$8192, %esi
	movq	%r15, %rdi
	call	__fgets_chk@PLT
	movq	%r15, %rdi
	leaq	.LC2(%rip), %rsi
	xorl	%r15d, %r15d
	call	strtok@PLT
	leaq	32(%rsp), %rcx
	movq	%rbx, %rdx
	leaq	.LC3(%rip), %rsi
	movq	%rax, %rdi
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	call	__isoc23_sscanf@PLT
	movq	24(%rsp), %rdi
	jmp	.L7
.L15:
	movq	8(%rsp), %rdi
	call	fclose@PLT
	movq	8232(%rsp), %rax
	subq	%fs:40, %rax
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	addq	$8248, %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
.LFE2028:
	.size	_Z9read_dataPcPdPiii, .-_Z9read_dataPcPdPiii
	.globl	_Z10read_modelPcPdS0_ii
	.type	_Z10read_modelPcPdS0_ii, @function
_Z10read_modelPcPdS0_ii:
.LFB2029:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4152
	orq	$0, (%rsp)
	subq	$4096, %rsp
	.cfi_def_cfa_offset 8248
	orq	$0, (%rsp)
	subq	$56, %rsp
	.cfi_def_cfa_offset 8304
	movl	%r8d, 20(%rsp)
	movq	%rsi, %r13
	movq	%rdi, %rbp
	movq	%rdx, %rbx
	leaq	.LC0(%rip), %rsi
	movl	%ecx, %r14d
	movq	%fs:40, %rax
	movq	%rax, 8232(%rsp)
	xorl	%eax, %eax
	xorl	%eax, %eax
	movl	%eax, 32(%rsp)
	movl	%eax, 36(%rsp)
	call	fopen@PLT
	movq	%rax, (%rsp)
	testq	%rax, %rax
	jne	.L17
	movl	$2, %edi
	movq	%rbp, %rdx
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	orl	$-1, %edi
	call	exit@PLT
.L17:
	leaq	40(%rsp), %rax
	movq	(%rsp), %rcx
	movl	$8192, %edx
	xorl	%ebp, %ebp
	movl	$8192, %esi
	movq	%rax, %rdi
	movq	%rax, 8(%rsp)
	xorl	%r12d, %r12d
	call	__fgets_chk@PLT
.L18:
	movl	20(%rsp), %eax
	cmpl	%eax, %ebp
	jge	.L26
	movq	(%rsp), %rcx
	movq	8(%rsp), %rdi
	movl	$8192, %edx
	xorl	%r15d, %r15d
	movl	$8192, %esi
	call	__fgets_chk@PLT
	movq	8(%rsp), %rdi
	leaq	.LC2(%rip), %rsi
	call	strtok@PLT
	leaq	32(%rsp), %rcx
	movq	%rbx, %rdx
	leaq	.LC4(%rip), %rsi
	movq	%rax, %rdi
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	call	__isoc23_sscanf@PLT
	movq	24(%rsp), %rdi
.L19:
	testq	%rdi, %rdi
	je	.L27
	testl	%r15d, %r15d
	jne	.L20
	xorl	%edi, %edi
	leaq	.LC2(%rip), %rsi
	call	strtok@PLT
	movq	%rax, %rdi
.L20:
	movl	32(%rsp), %eax
	testl	%eax, %eax
	jle	.L21
	addl	%r12d, %eax
	leaq	36(%rsp), %rcx
	leaq	.LC4(%rip), %rsi
	cltq
	leaq	-8(%r13,%rax,8), %rdx
	xorl	%eax, %eax
	call	__isoc23_sscanf@PLT
.L21:
	movl	36(%rsp), %eax
	xorl	%edi, %edi
	leaq	.LC2(%rip), %rsi
	incl	%r15d
	movl	%eax, 32(%rsp)
	call	strtok@PLT
	movq	%rax, %rdi
	jmp	.L19
.L27:
	incl	%ebp
	addq	$8, %rbx
	addl	%r14d, %r12d
	jmp	.L18
.L26:
	movq	(%rsp), %rdi
	call	fclose@PLT
	movq	8232(%rsp), %rax
	subq	%fs:40, %rax
	je	.L24
	call	__stack_chk_fail@PLT
.L24:
	addq	$8248, %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
.LFE2029:
	.size	_Z10read_modelPcPdS0_ii, .-_Z10read_modelPcPdS0_ii
	.globl	_Z44__device_stub__Z10svmPredictPdS_PiS_iiiddS0_PdS_PiS_iiiddS0_
	.type	_Z44__device_stub__Z10svmPredictPdS_PiS_iiiddS0_PdS_PiS_iiiddS0_, @function
_Z44__device_stub__Z10svmPredictPdS_PiS_iiiddS0_PdS_PiS_iiiddS0_:
.LFB2055:
	.cfi_startproc
	endbr64
	subq	$232, %rsp
	.cfi_def_cfa_offset 240
	movq	248(%rsp), %rax
	movq	%rdi, 56(%rsp)
	leaq	88(%rsp), %rdi
	movq	%rsi, 48(%rsp)
	leaq	100(%rsp), %rsi
	movq	%rdx, 40(%rsp)
	leaq	72(%rsp), %rdx
	movq	%rcx, 32(%rsp)
	leaq	80(%rsp), %rcx
	movl	%r8d, 28(%rsp)
	movl	%r9d, 24(%rsp)
	movq	%rax, (%rsp)
	movsd	%xmm0, 16(%rsp)
	movsd	%xmm1, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 216(%rsp)
	xorl	%eax, %eax
	leaq	56(%rsp), %rax
	movl	$1, 96(%rsp)
	movq	%rax, 136(%rsp)
	leaq	48(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 160(%rsp)
	leaq	28(%rsp), %rax
	movq	%rax, 168(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 176(%rsp)
	leaq	240(%rsp), %rax
	movq	%rax, 184(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 192(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 200(%rsp)
	movq	%rsp, %rax
	movq	%rax, 208(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 88(%rsp)
	movq	%rax, 100(%rsp)
	movl	$1, 108(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L28
	pushq	80(%rsp)
	.cfi_def_cfa_offset 248
	leaq	_Z10svmPredictPdS_PiS_iiiddS0_(%rip), %rdi
	pushq	80(%rsp)
	.cfi_def_cfa_offset 256
	movq	116(%rsp), %rcx
	movl	124(%rsp), %r8d
	movq	104(%rsp), %rsi
	movl	112(%rsp), %edx
	leaq	152(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 248
	popq	%rdx
	.cfi_def_cfa_offset 240
.L28:
	movq	216(%rsp), %rax
	subq	%fs:40, %rax
	je	.L30
	call	__stack_chk_fail@PLT
.L30:
	addq	$232, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2055:
	.size	_Z44__device_stub__Z10svmPredictPdS_PiS_iiiddS0_PdS_PiS_iiiddS0_, .-_Z44__device_stub__Z10svmPredictPdS_PiS_iiiddS0_PdS_PiS_iiiddS0_
	.globl	_Z10svmPredictPdS_PiS_iiiddS0_
	.type	_Z10svmPredictPdS_PiS_iiiddS0_, @function
_Z10svmPredictPdS_PiS_iiiddS0_:
.LFB2056:
	.cfi_startproc
	endbr64
	jmp	_Z44__device_stub__Z10svmPredictPdS_PiS_iiiddS0_PdS_PiS_iiiddS0_
	.cfi_endproc
.LFE2056:
	.size	_Z10svmPredictPdS_PiS_iiiddS0_, .-_Z10svmPredictPdS_PiS_iiiddS0_
	.section	.rodata.str1.1
.LC5:
	.string	"%s data_file model_file data_size data_dim\n"
.LC7:
	.string	"can't open file %s\n"
.LC8:
	.string	"%d %lf %lf"
.LC9:
	.string	"/home/ubuntu/Datasets/stackv2/train-structured/waitmeteng/parallel_svm/master/svmPredict.cu"
.LC10:
	.string	"Error: %s:%d, "
.LC11:
	.string	"code: %d, reason: %s\n"
.LC12:
	.string	"accuracy (%d/%d): %1.5f\n"
.LC13:
	.string	"elapsed time is %lf seconds\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2030:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rsi, %r15
	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	$184, %rsp
	.cfi_def_cfa_offset 240
	movq	%fs:40, %rax
	movq	%rax, 168(%rsp)
	xorl	%eax, %eax
	cmpl	$4, %edi
	jg	.L34
	movq	(%rsi), %rdx
	movl	$2, %edi
	leaq	.LC5(%rip), %rsi
	jmp	.L49
.L34:
	movq	24(%rsi), %rdi
	call	atoi@PLT
	movq	32(%r15), %rdi
	movslq	%eax, %r13
	call	atoi@PLT
	xorl	%esi, %esi
	movq	%r13, %rbp
	movl	%eax, %ebx
	leaq	152(%rsp), %rax
	movq	%rax, %rdi
	movq	%rax, 40(%rsp)
	call	gettimeofday@PLT
	movl	%r13d, %eax
	cvtsi2sdq	152(%rsp), %xmm1
	imull	%ebx, %eax
	cvtsi2sdq	160(%rsp), %xmm0
	divsd	.LC6(%rip), %xmm0
	cltq
	addsd	%xmm1, %xmm0
	salq	$3, %rax
	movq	%rax, %rdi
	movq	%rax, 8(%rsp)
	movsd	%xmm0, 48(%rsp)
	call	malloc@PLT
	movq	8(%rsp), %rcx
	xorl	%esi, %esi
	movq	%rax, 32(%rsp)
	movslq	%ebx, %rax
	movq	32(%rsp), %rdi
	movq	%rax, %rdx
	movq	%rax, 16(%rsp)
	imulq	%r13, %rdx
	salq	$3, %rdx
	call	__memset_chk@PLT
	leaq	0(,%r13,8), %rdi
	call	malloc@PLT
	movq	8(%r15), %rdi
	movl	%ebx, %r8d
	movl	%r13d, %ecx
	movq	32(%rsp), %rsi
	movq	%rax, %rdx
	movq	%rax, 24(%rsp)
	call	_Z9read_dataPcPdPiii
	movq	16(%r15), %rdi
	leaq	.LC0(%rip), %rsi
	call	fopen@PLT
	movq	%rax, %r12
	testq	%rax, %rax
	jne	.L35
	movq	16(%r15), %rdx
	leaq	.LC7(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
.L49:
	call	__printf_chk@PLT
.L50:
	orl	$-1, %edi
	call	exit@PLT
.L35:
	leaq	80(%rsp), %r8
	leaq	64(%rsp), %rdx
	movq	%rax, %rdi
	xorl	%eax, %eax
	leaq	.LC8(%rip), %rsi
	leaq	72(%rsp), %rcx
	call	__isoc23_fscanf@PLT
	movq	%r12, %rdi
	call	fclose@PLT
	movslq	64(%rsp), %r14
	movl	%r14d, %ecx
	movq	%r14, %r12
	salq	$3, %r14
	imull	%ebx, %ecx
	movslq	%ecx, %rcx
	salq	$3, %rcx
	movq	%rcx, %rdi
	movq	%rcx, 56(%rsp)
	call	malloc@PLT
	movslq	%ebx, %rdx
	movq	56(%rsp), %rcx
	xorl	%esi, %esi
	imulq	%r14, %rdx
	movq	%rax, %rdi
	movq	%rax, 16(%rsp)
	call	__memset_chk@PLT
	movq	%r14, %rdi
	call	malloc@PLT
	movq	16(%r15), %rdi
	movq	16(%rsp), %rsi
	movl	%ebx, %ecx
	movl	%r12d, %r8d
	movq	%rax, %rdx
	movq	%rax, %r14
	call	_Z10read_modelPcPdS0_ii
	movq	8(%rsp), %rsi
	leaq	88(%rsp), %rdi
	call	cudaMalloc@PLT
	movl	$217, %r8d
	movl	%eax, %r15d
	testl	%eax, %eax
	jne	.L52
	salq	$2, %r13
	leaq	104(%rsp), %rdi
	movq	%r13, %rsi
	call	cudaMalloc@PLT
	movl	%eax, %r15d
	testl	%eax, %eax
	je	.L37
	movl	$218, %r8d
.L52:
	movq	stderr(%rip), %rdi
	leaq	.LC9(%rip), %rcx
	leaq	.LC10(%rip), %rdx
	xorl	%eax, %eax
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movl	%r15d, %edi
	call	cudaGetErrorString@PLT
	movl	%r15d, %ecx
	movq	%rax, %r8
	jmp	.L51
.L37:
	leaq	120(%rsp), %rdi
	movl	$4, %esi
	call	cudaMalloc@PLT
	movl	$219, %r8d
	movl	%eax, %r15d
	testl	%eax, %eax
	jne	.L52
	movq	8(%rsp), %rdx
	movq	32(%rsp), %rsi
	movl	$1, %ecx
	movq	88(%rsp), %rdi
	call	cudaMemcpy@PLT
	movl	$220, %r8d
	movl	%eax, %r15d
	testl	%eax, %eax
	jne	.L52
	movq	24(%rsp), %rsi
	movq	104(%rsp), %rdi
	movq	%r13, %rdx
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movl	$221, %r8d
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	.L53
	movl	64(%rsp), %esi
	leaq	96(%rsp), %rdi
	imull	%ebx, %esi
	movslq	%esi, %rsi
	salq	$3, %rsi
	call	cudaMalloc@PLT
	movl	$222, %r8d
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	.L53
	movslq	64(%rsp), %rsi
	leaq	112(%rsp), %rdi
	salq	$3, %rsi
	call	cudaMalloc@PLT
	movl	$223, %r8d
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	.L53
	movl	64(%rsp), %edx
	movq	16(%rsp), %rsi
	movl	$1, %ecx
	movq	96(%rsp), %rdi
	imull	%ebx, %edx
	movslq	%edx, %rdx
	salq	$3, %rdx
	call	cudaMemcpy@PLT
	movl	$224, %r8d
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	.L53
	movslq	64(%rsp), %rdx
	movq	112(%rsp), %rdi
	movl	$1, %ecx
	movq	%r14, %rsi
	salq	$3, %rdx
	call	cudaMemcpy@PLT
	movl	%eax, %r13d
	testl	%eax, %eax
	je	.L44
	movl	$225, %r8d
.L53:
	movq	stderr(%rip), %rdi
	leaq	.LC9(%rip), %rcx
	leaq	.LC10(%rip), %rdx
	xorl	%eax, %eax
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movl	%r13d, %edi
	call	cudaGetErrorString@PLT
	movl	%r13d, %ecx
	movq	%rax, %r8
	jmp	.L51
.L44:
	leal	31(%rbp), %eax
	movl	$134217729, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	shrl	$5, %eax
	salq	$5, %rdx
	movl	$1, %ecx
	movl	%eax, 140(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 144(%rsp)
	movq	140(%rsp), %rdi
	movl	148(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L45
	pushq	120(%rsp)
	.cfi_def_cfa_offset 248
	movl	%ebp, %r8d
	pushq	%rbx
	.cfi_def_cfa_offset 256
	movsd	96(%rsp), %xmm1
	movsd	88(%rsp), %xmm0
	movl	80(%rsp), %r9d
	movq	128(%rsp), %rcx
	movq	120(%rsp), %rdx
	movq	112(%rsp), %rsi
	movq	104(%rsp), %rdi
	call	_Z44__device_stub__Z10svmPredictPdS_PiS_iiiddS0_PdS_PiS_iiiddS0_
	popq	%rax
	.cfi_def_cfa_offset 248
	popq	%rdx
	.cfi_def_cfa_offset 240
.L45:
	movq	120(%rsp), %rsi
	leaq	68(%rsp), %rdi
	movl	$2, %ecx
	movl	$4, %edx
	call	cudaMemcpy@PLT
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.L46
	movq	stderr(%rip), %rdi
	movl	$231, %r8d
	xorl	%eax, %eax
	leaq	.LC9(%rip), %rcx
	leaq	.LC10(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movl	%ebx, %edi
	call	cudaGetErrorString@PLT
	movl	%ebx, %ecx
	movq	%rax, %r8
.L51:
	movq	stderr(%rip), %rdi
	leaq	.LC11(%rip), %rdx
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	jmp	.L50
.L46:
	movq	40(%rsp), %rdi
	xorl	%esi, %esi
	call	gettimeofday@PLT
	movl	68(%rsp), %edx
	movl	%ebp, %ecx
	movl	$2, %edi
	cvtsi2sdq	152(%rsp), %xmm1
	leaq	.LC12(%rip), %rsi
	movb	$1, %al
	cvtsi2sdq	160(%rsp), %xmm0
	divsd	.LC6(%rip), %xmm0
	addsd	%xmm1, %xmm0
	cvtsi2sdl	%ebp, %xmm1
	movq	%xmm0, %rbx
	cvtsi2sdl	%edx, %xmm0
	divsd	%xmm1, %xmm0
	call	__printf_chk@PLT
	movq	%rbx, %xmm0
	subsd	48(%rsp), %xmm0
	movb	$1, %al
	leaq	.LC13(%rip), %rsi
	movl	$2, %edi
	call	__printf_chk@PLT
	movq	24(%rsp), %rdi
	call	free@PLT
	movq	16(%rsp), %rdi
	call	free@PLT
	movq	%r14, %rdi
	call	free@PLT
	movq	88(%rsp), %rdi
	call	cudaFree@PLT
	movq	96(%rsp), %rdi
	call	cudaFree@PLT
	movq	104(%rsp), %rdi
	call	cudaFree@PLT
	movq	112(%rsp), %rdi
	call	cudaFree@PLT
	movq	120(%rsp), %rdi
	call	cudaFree@PLT
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	je	.L47
	call	__stack_chk_fail@PLT
.L47:
	addq	$184, %rsp
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	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
.LFE2030:
	.size	main, .-main
	.section	.rodata.str1.1
.LC14:
	.string	"_Z10svmPredictPdS_PiS_iiiddS0_"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2058:
	.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	.LC14(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z10svmPredictPdS_PiS_iiiddS0_(%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
.LFE2058:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC6:
	.long	0
	.long	1093567616
	.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:

/** File:    svmPredict.cu
 * Purpose:  Parallel Programming 2017 Final Project: Training Support Vector Machine on multiprocessors and GPUs
 *           use to get accuracy of training result on GPU
 *
 * Compile:  nvcc -o svmPredict svmPredict.cu
 * Run:      ./svmPredict ./data/test-mnist ./data/train-mnist.model 1500 784
 *           ./data/test-mnist: input test data set
 *           ./data/train-mnist.model: input model data
 *           1500       : number of training data 
 *           784        : dimension of feature space
 *
 * Notes:
 *    1.  Need modified_SMO executable to train first in order to get model file. 
 *    2.  The test file shouldn't be the same with the training data.
 *
 * Output: percentage of prediction accuracy of input data
 *
 * Author: Wei-Hsiang Teng
 * History: 2017/6/9       created
 *          2017/6/13      change datatype from float to double
 *	        
 */  


#include <hip/hip_runtime.h>
#include <string.h> /* for memset */
#include <stdlib.h>
#include <stdio.h>
#include <sys/time.h> // for estimate elapsed time
#include <math.h>
#define STR_SIZE 8192

#define CHECK(call)                                                            \
{                                                                              \
    const hipError_t error = call;                                            \
    if (error != hipSuccess)                                                  \
    {                                                                          \
        fprintf(stderr, "Error: %s:%d, ", __FILE__, __LINE__);                 \
        fprintf(stderr, "code: %d, reason: %s\n", error,                       \
                hipGetErrorString(error));                                    \
        exit(-1);                                                               \
    }                                                                          \
}

#define GET_TIME(now) { \
   struct timeval t; \
   gettimeofday(&t, NULL); \
   now = t.tv_sec + t.tv_usec/1000000.0; \
}
/**
* name:        rbf_kernel
*
* description: kernel generates kernel function K(X_i, X_j) of X which is gaussian.
* input:       x1[]: coordinates of testing data set
*              x2[]: coordinates of support vectors
*              dim: number of dimension of coordinates
*              i, j: index of kernel function K(X_i, X_j)
*              gamma: parameter for guassian kernel: exp(-gamma*|X_i - X_j|^2) 
*
* output:      K(X_i, X_j)      
* 
*/
__device__ double rbf_kernel(double x1[], double x2[], int i, int j, int dim, double gamma)
{
	double ker = 0.0;
	int m;

	for (m = 0; m < dim; m++)
	{
		ker += (x1[i * dim + m] - x2[j * dim + m]) * (x1[i * dim + m] - x2[j * dim + m]);
	}
	ker = exp(-1 * gamma * ker);
	
	return ker;
}

__global__ void svmPredict(double* devX1, double* devX2, int* devY, double* devAlphas, int size, int total_sv, int dim, double gamma, double b, int* num)
{
	int i = blockIdx.x * blockDim.x + threadIdx.x;
	int j, result;
	double dual = 0;
	if (i < size) 
	{
		for (j = 0; j < total_sv; j++) {
			dual +=  devAlphas[j] * rbf_kernel(devX1, devX2, i, j, dim, gamma);
		} 
		dual += b;
		result = 1;
		if (dual < 0)
			result = -1;
		if (result == devY[i])
			atomicAdd(num, 1);
	}
}

void read_data(char* file, double x[], int y[], int size, int dim)
{
	int i;
	char s[STR_SIZE];
	const char* delim = ":";
    char *token;
	int index = 0, pre_index = 0;
	FILE *pFile;
	
	pFile = fopen(file, "r"); 
	if (pFile == NULL) {
		printf("can't open %s\n", file);
		exit(-1);
	}
	
	for (i = 0; i < size; i++)
	{
		int cnt = 0;
		fgets(s, sizeof(s), pFile);
	    /* get the first token */
	    token = strtok(s, delim);
	    sscanf(token, "%d %d", &y[i], &index);
	    /* walk through other tokens */
	    while( token != NULL ) 
	    {
			if (cnt == 0) {
				token = strtok(NULL, delim);
			}
			if (index > 0)
				sscanf(token, "%lf %d", &x[i * dim + index - 1], &pre_index);
			index = pre_index;
		    token = strtok(NULL, delim);			
			cnt++;
	    }
	}
	fclose(pFile);
}

void read_model(char* file, double x[], double alphas[], int dim, int total_sv)
{
	FILE *pFile;
	int i;
	char s[STR_SIZE];
	const char* delim = ":";
        char *token;
	int index = 0, pre_index = 0;
	
	pFile = fopen(file, "r"); 
	if (pFile == NULL) {
		printf("can't open %s\n", file);
		exit(-1);
	}
	fgets(s, sizeof(s), pFile);
	for (i = 0; i < total_sv; i++)
	{
		int cnt = 0;
		fgets(s, sizeof(s), pFile);
	        /* get the first token */
	        token = strtok(s, delim);
	        sscanf(token, "%lf %d", &alphas[i], &index);
	        /* walk through other tokens */
	        while( token != NULL ) 
	        {
			if (cnt == 0) {
				token = strtok(NULL, delim);
			}
			if (index > 0)
				sscanf(token, "%lf %d", &x[i * dim + index - 1], &pre_index);
			index = pre_index;
		        token = strtok(NULL, delim);			
			cnt++;
	        }
	}
	fclose(pFile);
}

int main(int argc, char* argv[])
{
	int size, dim, total_sv, correct_num;
	double* x1, *x2;
	double gamma, b;
	int *y1;
	double* alphas;
	double start, end;
	
	/* device variables */
	double* devX1;
	double* devX2;
	int* devY;
	double* devAlphas;
	int* devNum;
	
	if (argc < 5) {
		printf("%s data_file model_file data_size data_dim\n", argv[0]);
		exit(-1);
	}
	
	size = atoi(argv[3]);
	dim = atoi(argv[4]);
	
	GET_TIME(start);
	x1 = (double *)malloc(size*dim*sizeof(double));
	memset(x1, 0, sizeof(double)*size*dim);
	y1 = (int *)malloc(size*sizeof(double));
	
	/* read files */
	read_data(argv[1], x1, y1, size, dim);
	/* read model */
	FILE *fp;
	fp = fopen(argv[2], "r");
	if (fp == NULL)
	{
		printf("can't open file %s\n", argv[2]);
		exit(-1);
	}
	fscanf(fp, "%d %lf %lf", &total_sv, &gamma, &b);
	fclose(fp);
	x2 = (double *)malloc(total_sv*dim*sizeof(double));
	memset(x2, 0, sizeof(double)*total_sv*dim);
	alphas = (double *)malloc(total_sv*sizeof(double));
	read_model(argv[2], x2, alphas, dim, total_sv);
	
	/* allocate device memory */
	CHECK(hipMalloc((void**)&devX1, size * dim * sizeof(double)));
	CHECK(hipMalloc((void**)&devY, size * sizeof(int)));
	CHECK(hipMalloc((void**)&devNum, sizeof(int)));
	CHECK(hipMemcpy(devX1, x1, size * dim * sizeof(double), hipMemcpyHostToDevice));
	CHECK(hipMemcpy(devY, y1, size * sizeof(int), hipMemcpyHostToDevice));
	CHECK(hipMalloc((void**)&devX2, total_sv * dim * sizeof(double)));
	CHECK(hipMalloc((void**)&devAlphas, total_sv * sizeof(double)));
	CHECK(hipMemcpy(devX2, x2, total_sv * dim * sizeof(double), hipMemcpyHostToDevice));
	CHECK(hipMemcpy(devAlphas, alphas, total_sv * sizeof(double), hipMemcpyHostToDevice));
	
	dim3 block(32);
	dim3 grid((size + block.x - 1)/block.x);
	
	svmPredict<<<grid, block>>>(devX1, devX2, devY, devAlphas, size, total_sv, dim, gamma, b, devNum);
	CHECK(hipMemcpy(&correct_num, devNum, sizeof(int), hipMemcpyDeviceToHost));
	GET_TIME(end);
	printf("accuracy (%d/%d): %1.5f\n", correct_num, size, (double)correct_num/size);
	printf("elapsed time is %lf seconds\n", end - start);
	
	free(y1);
    free(x2);
	free(alphas);
	hipFree(devX1);
	hipFree(devX2);
	hipFree(devY);
	hipFree(devAlphas);
	hipFree(devNum);
	return 0;
}

	.text
	.file	"svmPredict.hip"
	.globl	_Z25__device_stub__svmPredictPdS_PiS_iiiddS0_ # -- Begin function _Z25__device_stub__svmPredictPdS_PiS_iiiddS0_
	.type	_Z25__device_stub__svmPredictPdS_PiS_iiiddS0_,@function
_Z25__device_stub__svmPredictPdS_PiS_iiiddS0_: # @_Z25__device_stub__svmPredictPdS_PiS_iiiddS0_
	.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	$192, %rsp
	.cfi_def_cfa_offset 240
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	72(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	64(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	56(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	48(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	12(%rsp), %rcx
	movl	%r8d, (%rcx)
	leaq	8(%rsp), %r8
	movl	%r9d, (%r8)
	leaq	40(%rsp), %r9
	movsd	%xmm0, (%r9)
	leaq	32(%rsp), %r10
	movsd	%xmm1, (%r10)
	leaq	112(%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	240(%rsp), %rax
	movq	%rax, 48(%rbx)
	movq	%r9, 56(%rbx)
	movq	%r10, 64(%rbx)
	leaq	248(%rsp), %rax
	movq	%rax, 72(%rbx)
	leaq	96(%rsp), %r14
	leaq	80(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%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	$_Z10svmPredictPdS_PiS_iiiddS0_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$208, %rsp
	.cfi_adjust_cfa_offset -208
	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	_Z25__device_stub__svmPredictPdS_PiS_iiiddS0_, .Lfunc_end0-_Z25__device_stub__svmPredictPdS_PiS_iiiddS0_
	.cfi_endproc
                                        # -- End function
	.globl	_Z9read_dataPcPdPiii            # -- Begin function _Z9read_dataPcPdPiii
	.type	_Z9read_dataPcPdPiii,@function
_Z9read_dataPcPdPiii:                   # @_Z9read_dataPcPdPiii
	.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	$8248, %rsp                     # imm = 0x2038
	.cfi_def_cfa_offset 8304
	.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	%r8d, %r12d
	movl	%ecx, %ebp
	movq	%rdx, 40(%rsp)                  # 8-byte Spill
	movq	%rsi, 8(%rsp)                   # 8-byte Spill
	movq	%rdi, %r13
	xorl	%eax, %eax
	movl	%eax, (%rsp)
	movl	%eax, 4(%rsp)
	movl	$.L.str.1, %esi
	callq	fopen
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	testq	%rax, %rax
	je	.LBB1_12
# %bb.1:                                # %.preheader
	testl	%ebp, %ebp
	jle	.LBB1_11
# %bb.2:                                # %.lr.ph28
	addq	$-8, 8(%rsp)                    # 8-byte Folded Spill
	movslq	%r12d, %rax
	movq	%rax, 24(%rsp)                  # 8-byte Spill
	movl	%ebp, %eax
	movq	%rax, 32(%rsp)                  # 8-byte Spill
	leaq	48(%rsp), %r12
	leaq	4(%rsp), %rbp
	xorl	%ebx, %ebx
.LBB1_3:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_5 Depth 2
	movq	%r12, %rdi
	movl	$8192, %esi                     # imm = 0x2000
	movq	16(%rsp), %rdx                  # 8-byte Reload
	callq	fgets
	movl	$.L.str, %esi
	movq	%r12, %rdi
	callq	strtok
	movq	%rax, %r13
	movq	40(%rsp), %rax                  # 8-byte Reload
	leaq	(%rax,%rbx,4), %rdx
	movl	$.L.str.3, %esi
	movq	%r13, %rdi
	movq	%rsp, %rcx
	xorl	%eax, %eax
	callq	__isoc23_sscanf
	testq	%r13, %r13
	je	.LBB1_10
# %bb.4:                                # %.lr.ph
                                        #   in Loop: Header=BB1_3 Depth=1
	movq	%rbx, %rax
	imulq	24(%rsp), %rax                  # 8-byte Folded Reload
	movq	8(%rsp), %rcx                   # 8-byte Reload
	leaq	(%rcx,%rax,8), %r14
	xorl	%r15d, %r15d
.LBB1_5:                                #   Parent Loop BB1_3 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	subl	$1, %r15d
	jae	.LBB1_7
# %bb.6:                                #   in Loop: Header=BB1_5 Depth=2
	movl	$.L.str, %esi
	xorl	%edi, %edi
	callq	strtok
	movq	%rax, %r13
.LBB1_7:                                #   in Loop: Header=BB1_5 Depth=2
	movl	(%rsp), %eax
	testl	%eax, %eax
	jle	.LBB1_9
# %bb.8:                                #   in Loop: Header=BB1_5 Depth=2
	leaq	(%r14,%rax,8), %rdx
	movl	$.L.str.4, %esi
	movq	%r13, %rdi
	movq	%rbp, %rcx
	xorl	%eax, %eax
	callq	__isoc23_sscanf
.LBB1_9:                                #   in Loop: Header=BB1_5 Depth=2
	movl	4(%rsp), %eax
	movl	%eax, (%rsp)
	movl	$.L.str, %esi
	xorl	%edi, %edi
	callq	strtok
	movq	%rax, %r13
	testq	%rax, %rax
	jne	.LBB1_5
.LBB1_10:                               # %._crit_edge
                                        #   in Loop: Header=BB1_3 Depth=1
	incq	%rbx
	cmpq	32(%rsp), %rbx                  # 8-byte Folded Reload
	jne	.LBB1_3
.LBB1_11:                               # %._crit_edge29
	movq	16(%rsp), %rdi                  # 8-byte Reload
	callq	fclose
	addq	$8248, %rsp                     # imm = 0x2038
	.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_12:
	.cfi_def_cfa_offset 8304
	movl	$.L.str.2, %edi
	movq	%r13, %rsi
	xorl	%eax, %eax
	callq	printf
	movl	$-1, %edi
	callq	exit
.Lfunc_end1:
	.size	_Z9read_dataPcPdPiii, .Lfunc_end1-_Z9read_dataPcPdPiii
	.cfi_endproc
                                        # -- End function
	.globl	_Z10read_modelPcPdS0_ii         # -- Begin function _Z10read_modelPcPdS0_ii
	.type	_Z10read_modelPcPdS0_ii,@function
_Z10read_modelPcPdS0_ii:                # @_Z10read_modelPcPdS0_ii
	.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	$8248, %rsp                     # imm = 0x2038
	.cfi_def_cfa_offset 8304
	.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	%r8d, %ebp
	movl	%ecx, %r12d
	movq	%rdx, 40(%rsp)                  # 8-byte Spill
	movq	%rsi, 16(%rsp)                  # 8-byte Spill
	movq	%rdi, %r13
	xorl	%eax, %eax
	movl	%eax, 8(%rsp)
	movl	%eax, 12(%rsp)
	movl	$.L.str.1, %esi
	callq	fopen
	testq	%rax, %rax
	je	.LBB2_12
# %bb.1:
	movq	%rax, %r14
	leaq	48(%rsp), %rdi
	movl	$8192, %esi                     # imm = 0x2000
	movq	%rax, %rdx
	callq	fgets
	testl	%ebp, %ebp
	jle	.LBB2_11
# %bb.2:                                # %.lr.ph30
	addq	$-8, 16(%rsp)                   # 8-byte Folded Spill
	movslq	%r12d, %rax
	movq	%rax, 24(%rsp)                  # 8-byte Spill
	movl	%ebp, %eax
	movq	%rax, 32(%rsp)                  # 8-byte Spill
	leaq	12(%rsp), %rbp
	xorl	%ebx, %ebx
.LBB2_3:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB2_5 Depth 2
	leaq	48(%rsp), %r15
	movq	%r15, %rdi
	movl	$8192, %esi                     # imm = 0x2000
	movq	%r14, %r12
	movq	%r14, %rdx
	callq	fgets
	movl	$.L.str, %esi
	movq	%r15, %rdi
	callq	strtok
	movq	%rax, %r13
	movq	40(%rsp), %rax                  # 8-byte Reload
	leaq	(%rax,%rbx,8), %rdx
	movl	$.L.str.4, %esi
	movq	%r13, %rdi
	leaq	8(%rsp), %rcx
	xorl	%eax, %eax
	callq	__isoc23_sscanf
	testq	%r13, %r13
	je	.LBB2_10
# %bb.4:                                # %.lr.ph
                                        #   in Loop: Header=BB2_3 Depth=1
	movq	%rbx, %rax
	imulq	24(%rsp), %rax                  # 8-byte Folded Reload
	movq	16(%rsp), %rcx                  # 8-byte Reload
	leaq	(%rcx,%rax,8), %r14
	xorl	%r15d, %r15d
.LBB2_5:                                #   Parent Loop BB2_3 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	subl	$1, %r15d
	jae	.LBB2_7
# %bb.6:                                #   in Loop: Header=BB2_5 Depth=2
	movl	$.L.str, %esi
	xorl	%edi, %edi
	callq	strtok
	movq	%rax, %r13
.LBB2_7:                                #   in Loop: Header=BB2_5 Depth=2
	movl	8(%rsp), %eax
	testl	%eax, %eax
	jle	.LBB2_9
# %bb.8:                                #   in Loop: Header=BB2_5 Depth=2
	leaq	(%r14,%rax,8), %rdx
	movl	$.L.str.4, %esi
	movq	%r13, %rdi
	movq	%rbp, %rcx
	xorl	%eax, %eax
	callq	__isoc23_sscanf
.LBB2_9:                                #   in Loop: Header=BB2_5 Depth=2
	movl	12(%rsp), %eax
	movl	%eax, 8(%rsp)
	movl	$.L.str, %esi
	xorl	%edi, %edi
	callq	strtok
	movq	%rax, %r13
	testq	%rax, %rax
	jne	.LBB2_5
.LBB2_10:                               # %._crit_edge
                                        #   in Loop: Header=BB2_3 Depth=1
	incq	%rbx
	cmpq	32(%rsp), %rbx                  # 8-byte Folded Reload
	movq	%r12, %r14
	jne	.LBB2_3
.LBB2_11:                               # %._crit_edge31
	movq	%r14, %rdi
	callq	fclose
	addq	$8248, %rsp                     # imm = 0x2038
	.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
.LBB2_12:
	.cfi_def_cfa_offset 8304
	movl	$.L.str.2, %edi
	movq	%r13, %rsi
	xorl	%eax, %eax
	callq	printf
	movl	$-1, %edi
	callq	exit
.Lfunc_end2:
	.size	_Z10read_modelPcPdS0_ii, .Lfunc_end2-_Z10read_modelPcPdS0_ii
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI3_0:
	.quad	0x412e848000000000              # double 1.0E+6
	.text
	.globl	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	$168, %rsp
	.cfi_def_cfa_offset 224
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	cmpl	$4, %edi
	jle	.LBB3_15
# %bb.1:
	movq	24(%rsi), %rdi
	movq	%rsi, %rbx
	callq	atoi
	movl	%eax, %r12d
	movq	32(%rbx), %rdi
	callq	atoi
	movl	%eax, %ebp
	leaq	152(%rsp), %r14
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	movq	(%r14), %rax
	movq	%rax, 88(%rsp)                  # 8-byte Spill
	movq	8(%r14), %rax
	movq	%rax, 80(%rsp)                  # 8-byte Spill
	movl	%ebp, %eax
	imull	%r12d, %eax
	movslq	%eax, %rdi
	shlq	$3, %rdi
	movq	%rdi, 16(%rsp)                  # 8-byte Spill
	callq	malloc
	movq	%rax, %r13
	movq	%r12, 104(%rsp)                 # 8-byte Spill
	movslq	%r12d, %r14
	leaq	(,%r14,8), %r12
	movslq	%ebp, %r15
	movq	%r12, %rdx
	imulq	%r15, %rdx
	movq	%rax, %rdi
	xorl	%esi, %esi
	callq	memset@PLT
	movq	%r12, %rdi
	callq	malloc
	movq	8(%rbx), %rdi
	movq	%r13, 120(%rsp)                 # 8-byte Spill
	movq	%r13, %rsi
	movq	%rax, 112(%rsp)                 # 8-byte Spill
	movq	%rax, %rdx
	movq	%r14, 128(%rsp)                 # 8-byte Spill
	movl	%r14d, %ecx
	movl	%r15d, %r8d
	callq	_Z9read_dataPcPdPiii
	movq	%rbx, 24(%rsp)                  # 8-byte Spill
	movq	16(%rbx), %rdi
	movl	$.L.str.1, %esi
	callq	fopen
	testq	%rax, %rax
	je	.LBB3_16
# %bb.2:
	movq	%rax, %r12
	leaq	12(%rsp), %r13
	leaq	144(%rsp), %rcx
	leaq	136(%rsp), %r8
	movl	$.L.str.7, %esi
	movq	%rax, %rdi
	movq	%r13, %rdx
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	movq	%r12, %rdi
	callq	fclose
	movslq	(%r13), %r12
	movl	%r12d, %eax
	movq	%rbp, 96(%rsp)                  # 8-byte Spill
	imull	%ebp, %eax
	movslq	%eax, %rdi
	shlq	$3, %rdi
	callq	malloc
	movq	%rax, %rbp
	movq	%r12, %r13
	shlq	$3, %r13
	movq	%r13, %rdx
	imulq	%r15, %rdx
	movq	%rax, %rdi
	xorl	%esi, %esi
	callq	memset@PLT
	movq	%r13, %rdi
	callq	malloc
	movq	24(%rsp), %rcx                  # 8-byte Reload
	movq	16(%rcx), %rdi
	movq	%rbp, %rsi
	movq	%rax, 24(%rsp)                  # 8-byte Spill
	movq	%rax, %rdx
	movq	%r15, %r13
	movl	%r15d, %ecx
	movl	%r12d, %r8d
	callq	_Z10read_modelPcPdS0_ii
	leaq	64(%rsp), %rdi
	movq	16(%rsp), %r15                  # 8-byte Reload
	movq	%r15, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB3_19
# %bb.3:
	movq	128(%rsp), %r14                 # 8-byte Reload
	shlq	$2, %r14
	leaq	48(%rsp), %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB3_20
# %bb.4:
	leaq	32(%rsp), %rdi
	movl	$4, %esi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB3_21
# %bb.5:
	movq	64(%rsp), %rdi
	movq	120(%rsp), %rsi                 # 8-byte Reload
	movq	%r15, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB3_22
# %bb.6:
	movq	48(%rsp), %rdi
	movq	112(%rsp), %r15                 # 8-byte Reload
	movq	%r15, %rsi
	movq	%r14, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB3_23
# %bb.7:
	movslq	12(%rsp), %rsi
	imulq	%r13, %rsi
	shlq	$3, %rsi
	leaq	56(%rsp), %rdi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB3_24
# %bb.8:
	movslq	12(%rsp), %rsi
	shlq	$3, %rsi
	leaq	40(%rsp), %rdi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB3_25
# %bb.9:
	movq	56(%rsp), %rdi
	movslq	12(%rsp), %rdx
	imulq	%r13, %rdx
	shlq	$3, %rdx
	movq	%rbp, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB3_26
# %bb.10:
	movq	40(%rsp), %rdi
	movslq	12(%rsp), %rdx
	shlq	$3, %rdx
	movq	24(%rsp), %r13                  # 8-byte Reload
	movq	%r13, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	movq	104(%rsp), %r14                 # 8-byte Reload
	movq	96(%rsp), %r12                  # 8-byte Reload
	jne	.LBB3_27
# %bb.11:
	leal	31(%r14), %edi
	shrl	$5, %edi
	btsq	$32, %rdi
	movabsq	$4294967296, %rdx               # imm = 0x100000000
	orq	$32, %rdx
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB3_13
# %bb.12:
	movq	64(%rsp), %rdi
	movq	56(%rsp), %rsi
	movq	48(%rsp), %rdx
	movq	40(%rsp), %rcx
	movl	12(%rsp), %r9d
	movsd	144(%rsp), %xmm0                # xmm0 = mem[0],zero
	movsd	136(%rsp), %xmm1                # xmm1 = mem[0],zero
	movl	%r14d, %r8d
	pushq	32(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	%r12
	.cfi_adjust_cfa_offset 8
	callq	_Z25__device_stub__svmPredictPdS_PiS_iiiddS0_
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
.LBB3_13:
	movq	32(%rsp), %rsi
	leaq	76(%rsp), %rdi
	movl	$4, %edx
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB3_28
# %bb.14:
	xorps	%xmm0, %xmm0
	cvtsi2sdq	88(%rsp), %xmm0         # 8-byte Folded Reload
	xorps	%xmm1, %xmm1
	cvtsi2sdq	80(%rsp), %xmm1         # 8-byte Folded Reload
	divsd	.LCPI3_0(%rip), %xmm1
	addsd	%xmm0, %xmm1
	movsd	%xmm1, 16(%rsp)                 # 8-byte Spill
	leaq	152(%rsp), %rbx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	xorps	%xmm0, %xmm0
	cvtsi2sdq	(%rbx), %xmm0
	xorps	%xmm1, %xmm1
	cvtsi2sdq	8(%rbx), %xmm1
	divsd	.LCPI3_0(%rip), %xmm1
	addsd	%xmm0, %xmm1
	movl	76(%rsp), %esi
	xorps	%xmm0, %xmm0
	cvtsi2sd	%esi, %xmm0
	subsd	16(%rsp), %xmm1                 # 8-byte Folded Reload
	movsd	%xmm1, 16(%rsp)                 # 8-byte Spill
	xorps	%xmm1, %xmm1
	cvtsi2sd	%r14d, %xmm1
	divsd	%xmm1, %xmm0
	movl	$.L.str.11, %edi
	movl	%r14d, %edx
	movb	$1, %al
	callq	printf
	movl	$.L.str.12, %edi
	movsd	16(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movb	$1, %al
	callq	printf
	movq	%r15, %rdi
	callq	free
	movq	%rbp, %rdi
	callq	free
	movq	%r13, %rdi
	callq	free
	movq	64(%rsp), %rdi
	callq	hipFree
	movq	56(%rsp), %rdi
	callq	hipFree
	movq	48(%rsp), %rdi
	callq	hipFree
	movq	40(%rsp), %rdi
	callq	hipFree
	movq	32(%rsp), %rdi
	callq	hipFree
	xorl	%eax, %eax
	addq	$168, %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
.LBB3_15:
	.cfi_def_cfa_offset 224
	movq	(%rsi), %rsi
	movl	$.L.str.5, %edi
	jmp	.LBB3_17
.LBB3_16:
	movq	24(%rsp), %rax                  # 8-byte Reload
	movq	16(%rax), %rsi
	movl	$.L.str.6, %edi
.LBB3_17:
	xorl	%eax, %eax
	callq	printf
	jmp	.LBB3_18
.LBB3_19:
	movl	%eax, %r12d
	movq	stderr(%rip), %rdi
	movl	$.L.str.8, %esi
	movl	$.L.str.9, %edx
	movl	$219, %ecx
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %r14
	movl	%r12d, %edi
	callq	hipGetErrorString
	movl	$.L.str.10, %esi
	movq	%r14, %rdi
	movl	%r12d, %edx
	jmp	.LBB3_30
.LBB3_20:
	movl	%eax, %ebx
	movq	stderr(%rip), %rdi
	movl	$.L.str.8, %esi
	movl	$.L.str.9, %edx
	movl	$220, %ecx
	jmp	.LBB3_29
.LBB3_21:
	movl	%eax, %ebx
	movq	stderr(%rip), %rdi
	movl	$.L.str.8, %esi
	movl	$.L.str.9, %edx
	movl	$221, %ecx
	jmp	.LBB3_29
.LBB3_22:
	movl	%eax, %ebx
	movq	stderr(%rip), %rdi
	movl	$.L.str.8, %esi
	movl	$.L.str.9, %edx
	movl	$222, %ecx
	jmp	.LBB3_29
.LBB3_23:
	movl	%eax, %ebx
	movq	stderr(%rip), %rdi
	movl	$.L.str.8, %esi
	movl	$.L.str.9, %edx
	movl	$223, %ecx
	jmp	.LBB3_29
.LBB3_24:
	movl	%eax, %ebx
	movq	stderr(%rip), %rdi
	movl	$.L.str.8, %esi
	movl	$.L.str.9, %edx
	movl	$224, %ecx
	jmp	.LBB3_29
.LBB3_25:
	movl	%eax, %ebx
	movq	stderr(%rip), %rdi
	movl	$.L.str.8, %esi
	movl	$.L.str.9, %edx
	movl	$225, %ecx
	jmp	.LBB3_29
.LBB3_26:
	movl	%eax, %ebx
	movq	stderr(%rip), %rdi
	movl	$.L.str.8, %esi
	movl	$.L.str.9, %edx
	movl	$226, %ecx
	jmp	.LBB3_29
.LBB3_27:
	movl	%eax, %ebx
	movq	stderr(%rip), %rdi
	movl	$.L.str.8, %esi
	movl	$.L.str.9, %edx
	movl	$227, %ecx
	jmp	.LBB3_29
.LBB3_28:
	movl	%eax, %ebx
	movq	stderr(%rip), %rdi
	movl	$.L.str.8, %esi
	movl	$.L.str.9, %edx
	movl	$233, %ecx
.LBB3_29:
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %r14
	movl	%ebx, %edi
	callq	hipGetErrorString
	movl	$.L.str.10, %esi
	movq	%r14, %rdi
	movl	%ebx, %edx
.LBB3_30:
	movq	%rax, %rcx
	xorl	%eax, %eax
	callq	fprintf
.LBB3_18:
	movl	$-1, %edi
	callq	exit
.Lfunc_end3:
	.size	main, .Lfunc_end3-main
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB4_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB4_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z10svmPredictPdS_PiS_iiiddS0_, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$40, %rsp
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end4:
	.size	__hip_module_ctor, .Lfunc_end4-__hip_module_ctor
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_dtor
	.type	__hip_module_dtor,@function
__hip_module_dtor:                      # @__hip_module_dtor
	.cfi_startproc
# %bb.0:
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	je	.LBB5_2
# %bb.1:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__hipUnregisterFatBinary
	movq	$0, __hip_gpubin_handle(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
.LBB5_2:
	retq
.Lfunc_end5:
	.size	__hip_module_dtor, .Lfunc_end5-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z10svmPredictPdS_PiS_iiiddS0_,@object # @_Z10svmPredictPdS_PiS_iiiddS0_
	.section	.rodata,"a",@progbits
	.globl	_Z10svmPredictPdS_PiS_iiiddS0_
	.p2align	3, 0x0
_Z10svmPredictPdS_PiS_iiiddS0_:
	.quad	_Z25__device_stub__svmPredictPdS_PiS_iiiddS0_
	.size	_Z10svmPredictPdS_PiS_iiiddS0_, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	":"
	.size	.L.str, 2

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"r"
	.size	.L.str.1, 2

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"can't open %s\n"
	.size	.L.str.2, 15

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

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"%lf %d"
	.size	.L.str.4, 7

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"%s data_file model_file data_size data_dim\n"
	.size	.L.str.5, 44

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"can't open file %s\n"
	.size	.L.str.6, 20

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"%d %lf %lf"
	.size	.L.str.7, 11

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"Error: %s:%d, "
	.size	.L.str.8, 15

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"/home/ubuntu/Datasets/stackv2/train-structured-repos-hip-sm89/waitmeteng/parallel_svm/master/svmPredict.hip"
	.size	.L.str.9, 108

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"code: %d, reason: %s\n"
	.size	.L.str.10, 22

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"accuracy (%d/%d): %1.5f\n"
	.size	.L.str.11, 25

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"elapsed time is %lf seconds\n"
	.size	.L.str.12, 29

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z10svmPredictPdS_PiS_iiiddS0_"
	.size	.L__unnamed_1, 31

	.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

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym _Z25__device_stub__svmPredictPdS_PiS_iiiddS0_
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z10svmPredictPdS_PiS_iiiddS0_
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z10svmPredictPdS_PiS_iiiddS0_ ; -- Begin function _Z10svmPredictPdS_PiS_iiiddS0_
	.globl	_Z10svmPredictPdS_PiS_iiiddS0_
	.p2align	8
	.type	_Z10svmPredictPdS_PiS_iiiddS0_,@function
_Z10svmPredictPdS_PiS_iiiddS0_:         ; @_Z10svmPredictPdS_PiS_iiiddS0_
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x54
	s_load_b128 s[16:19], s[0:1], 0x20
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	s_mov_b32 s2, exec_lo
	v_cmpx_gt_i32_e64 s16, v1
	s_cbranch_execz .LBB0_11
; %bb.1:                                ; %.preheader
	s_clause 0x2
	s_load_b256 s[4:11], s[0:1], 0x0
	s_load_b128 s[12:15], s[0:1], 0x30
	s_load_b64 s[2:3], s[0:1], 0x40
	s_cmp_lt_i32 s17, 1
	s_cbranch_scc1 .LBB0_7
; %bb.2:                                ; %.lr.ph
	v_mul_lo_u32 v4, v1, s18
	v_mov_b32_e32 v2, 0
	v_mov_b32_e32 v3, 0
	s_mov_b32 s21, 0
	s_cmp_gt_i32 s18, 0
	s_mov_b32 s22, 0x652b82fe
	s_mov_b32 s24, 0xfefa39ef
	v_dual_mov_b32 v7, v3 :: v_dual_mov_b32 v6, v2
	v_ashrrev_i32_e32 v5, 31, v4
	s_mov_b32 s26, 0x3b39803f
	s_mov_b32 s28, 0xfca7ab0c
	s_mov_b32 s30, 0x623fde64
	s_mov_b32 s34, 0x7c89e6b0
	v_lshlrev_b64 v[4:5], 3, v[4:5]
	s_mov_b32 s36, 0x14761f6e
	s_mov_b32 s38, 0x1852b7b0
	s_mov_b32 s40, 0x11122322
	s_mov_b32 s42, 0x555502a1
	s_mov_b32 s44, 0x55555511
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v4, vcc_lo, s4, v4
	v_add_co_ci_u32_e32 v5, vcc_lo, s5, v5, vcc_lo
	s_mov_b32 s4, 0x6a5dcb37
	s_mov_b32 s46, 11
	s_mov_b32 s23, 0x3ff71547
	s_mov_b32 s25, 0xbfe62e42
	s_mov_b32 s27, 0xbc7abc9e
	s_mov_b32 s29, 0x3e928af3
	s_cselect_b32 s16, -1, 0
	s_mov_b32 s5, 0x3e5ade15
	s_mov_b32 s31, 0x3ec71dee
	s_mov_b32 s35, 0x3efa0199
	s_mov_b32 s37, 0x3f2a01a0
	s_mov_b32 s39, 0x3f56c16c
	s_mov_b32 s41, 0x3f811111
	s_mov_b32 s43, 0x3fa55555
	s_mov_b32 s45, 0x3fc55555
	s_mov_b32 s47, 0x3fe00000
	s_mov_b32 s48, s21
	s_mov_b32 s20, s21
.LBB0_3:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_5 Depth 2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_lshl_b64 s[0:1], s[20:21], 3
	v_dual_mov_b32 v9, v3 :: v_dual_mov_b32 v8, v2
	s_add_u32 s0, s10, s0
	s_addc_u32 s1, s11, s1
	s_and_not1_b32 vcc_lo, exec_lo, s16
	s_cbranch_vccnz .LBB0_6
; %bb.4:                                ; %.lr.ph.i
                                        ;   in Loop: Header=BB0_3 Depth=1
	s_mov_b32 s49, s21
	v_dual_mov_b32 v8, 0 :: v_dual_mov_b32 v11, v5
	v_dual_mov_b32 v9, 0 :: v_dual_mov_b32 v10, v4
	s_lshl_b64 s[50:51], s[48:49], 3
	s_mov_b32 s19, s18
	s_add_u32 s50, s6, s50
	s_addc_u32 s51, s7, s51
.LBB0_5:                                ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	global_load_b64 v[12:13], v[10:11], off
	s_load_b64 s[52:53], s[50:51], 0x0
	v_add_co_u32 v10, vcc_lo, v10, 8
	s_add_i32 s19, s19, -1
	v_add_co_ci_u32_e32 v11, vcc_lo, 0, v11, vcc_lo
	s_add_u32 s50, s50, 8
	s_addc_u32 s51, s51, 0
	s_cmp_lg_u32 s19, 0
	s_waitcnt vmcnt(0) lgkmcnt(0)
	v_add_f64 v[12:13], v[12:13], -s[52:53]
	s_delay_alu instid0(VALU_DEP_1)
	v_fma_f64 v[8:9], v[12:13], v[12:13], v[8:9]
	s_cbranch_scc1 .LBB0_5
.LBB0_6:                                ; %Flow74
                                        ;   in Loop: Header=BB0_3 Depth=1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_mul_f64 v[8:9], v[8:9], -s[12:13]
	s_load_b64 s[50:51], s[0:1], 0x0
	s_add_i32 s20, s20, 1
	s_add_i32 s48, s48, s18
	v_mul_f64 v[10:11], v[8:9], s[22:23]
	v_cmp_nlt_f64_e32 vcc_lo, 0x40900000, v[8:9]
	v_cmp_ngt_f64_e64 s0, 0xc090cc00, v[8:9]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_rndne_f64_e32 v[10:11], v[10:11]
	v_fma_f64 v[12:13], v[10:11], s[24:25], v[8:9]
	v_cvt_i32_f64_e32 v0, v[10:11]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[12:13], v[10:11], s[26:27], v[12:13]
	v_fma_f64 v[14:15], v[12:13], s[4:5], s[28:29]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[14:15], v[12:13], v[14:15], s[30:31]
	v_fma_f64 v[14:15], v[12:13], v[14:15], s[34:35]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[14:15], v[12:13], v[14:15], s[36:37]
	v_fma_f64 v[14:15], v[12:13], v[14:15], s[38:39]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[14:15], v[12:13], v[14:15], s[40:41]
	v_fma_f64 v[14:15], v[12:13], v[14:15], s[42:43]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[14:15], v[12:13], v[14:15], s[44:45]
	v_fma_f64 v[14:15], v[12:13], v[14:15], s[46:47]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[14:15], v[12:13], v[14:15], 1.0
	v_fma_f64 v[10:11], v[12:13], v[14:15], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ldexp_f64 v[10:11], v[10:11], v0
	v_cndmask_b32_e32 v0, 0x7ff00000, v11, vcc_lo
	s_and_b32 vcc_lo, s0, vcc_lo
	s_cmp_lg_u32 s20, s17
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cndmask_b32_e32 v8, 0, v10, vcc_lo
	v_cndmask_b32_e64 v9, 0, v0, s0
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1)
	v_fma_f64 v[6:7], s[50:51], v[8:9], v[6:7]
	s_cbranch_scc1 .LBB0_3
	s_branch .LBB0_8
.LBB0_7:
	v_mov_b32_e32 v6, 0
	v_mov_b32_e32 v7, 0
.LBB0_8:                                ; %._crit_edge
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[1:2]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v0, vcc_lo, s8, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e32 v1, vcc_lo, s9, v1, vcc_lo
	global_load_b32 v2, v[0:1], off
	v_add_f64 v[0:1], v[6:7], s[14:15]
	v_cmp_gt_f64_e32 vcc_lo, 0, v[0:1]
	v_cndmask_b32_e64 v0, 1, -1, vcc_lo
	s_waitcnt vmcnt(0)
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_eq_u32_e32 vcc_lo, v0, v2
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB0_11
; %bb.9:
	s_mov_b32 s0, exec_lo
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mbcnt_lo_u32_b32 v0, s0, 0
	v_cmp_eq_u32_e32 vcc_lo, 0, v0
	s_and_b32 s1, exec_lo, vcc_lo
	s_delay_alu instid0(SALU_CYCLE_1)
	s_mov_b32 exec_lo, s1
	s_cbranch_execz .LBB0_11
; %bb.10:
	s_bcnt1_i32_b32 s0, s0
	s_delay_alu instid0(SALU_CYCLE_1)
	v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s0
	global_atomic_add_u32 v0, v1, s[2:3]
.LBB0_11:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z10svmPredictPdS_PiS_iiiddS0_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 328
		.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 16
		.amdhsa_next_free_sgpr 54
		.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	_Z10svmPredictPdS_PiS_iiiddS0_, .Lfunc_end0-_Z10svmPredictPdS_PiS_iiiddS0_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 940
; NumSgprs: 56
; NumVgprs: 16
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 6
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 56
; NumVGPRsForWavesPerEU: 16
; 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
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .offset:         32
        .size:           4
        .value_kind:     by_value
      - .offset:         36
        .size:           4
        .value_kind:     by_value
      - .offset:         40
        .size:           4
        .value_kind:     by_value
      - .offset:         48
        .size:           8
        .value_kind:     by_value
      - .offset:         56
        .size:           8
        .value_kind:     by_value
      - .address_space:  global
        .offset:         64
        .size:           8
        .value_kind:     global_buffer
      - .offset:         72
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         76
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         80
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         84
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         86
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         88
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         90
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         92
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         94
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         112
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         120
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         128
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         136
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 328
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z10svmPredictPdS_PiS_iiiddS0_
    .private_segment_fixed_size: 0
    .sgpr_count:     56
    .sgpr_spill_count: 0
    .symbol:         _Z10svmPredictPdS_PiS_iiiddS0_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     16
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
