Skip to content
Snippets Groups Projects
Commit aca66ed5 authored by Prakalp Srivastava's avatar Prakalp Srivastava
Browse files

adding changes to visc-rt as well

parent b8f409b4
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include <cstdlib> #include <cstdlib>
#include <cstdio> #include <cstdio>
#include <string> #include <string>
#include <assert.h>
#include <CL/cl.h> #include <CL/cl.h>
//#include "visc-rt.h" //#include "visc-rt.h"
...@@ -95,6 +96,8 @@ void llvm_visc_ptx_argument_scalar(void* graphID, void* input, int arg_index, si ...@@ -95,6 +96,8 @@ void llvm_visc_ptx_argument_scalar(void* graphID, void* input, int arg_index, si
extern "C" extern "C"
void* llvm_visc_ptx_argument_ptr(void* graphID, void* input, int arg_index, size_t size, bool isInput, bool isOutput) { void* llvm_visc_ptx_argument_ptr(void* graphID, void* input, int arg_index, size_t size, bool isInput, bool isOutput) {
printf("Set Pointer Input. Argument Index = %d, Ptr = %p, Size = %lu\n", arg_index, input, size); printf("Set Pointer Input. Argument Index = %d, Ptr = %p, Size = %lu\n", arg_index, input, size);
// Size should be non-zero
assert(size != 0);
printf("\tInput: %d, Output: %d\n", isInput, isOutput); printf("\tInput: %d, Output: %d\n", isInput, isOutput);
DFNodeContext_PTX* Context = (DFNodeContext_PTX*) graphID; DFNodeContext_PTX* Context = (DFNodeContext_PTX*) graphID;
cl_int errcode; cl_int errcode;
...@@ -104,10 +107,6 @@ void* llvm_visc_ptx_argument_ptr(void* graphID, void* input, int arg_index, size ...@@ -104,10 +107,6 @@ void* llvm_visc_ptx_argument_ptr(void* graphID, void* input, int arg_index, size
else if(isOutput) clFlags = CL_MEM_READ_WRITE; else if(isOutput) clFlags = CL_MEM_READ_WRITE;
else clFlags = CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR; else clFlags = CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR;
if(input == NULL) {
printf("Found NULL input value!!");
input = NULL;
}
cl_mem d_input = clCreateBuffer(Context->clGPUContext, clFlags, size, input, &errcode); cl_mem d_input = clCreateBuffer(Context->clGPUContext, clFlags, size, input, &errcode);
checkErr(errcode, CL_SUCCESS, "Failure to allocate memory on device"); checkErr(errcode, CL_SUCCESS, "Failure to allocate memory on device");
errcode |= clSetKernelArg(Context->clKernel, arg_index, sizeof(cl_mem), (void*)&d_input); errcode |= clSetKernelArg(Context->clKernel, arg_index, sizeof(cl_mem), (void*)&d_input);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment