From 7aa37b19a906d5df9e42f858c7462df23a5b7ccb Mon Sep 17 00:00:00 2001 From: Evghenii Date: Thu, 14 Nov 2013 20:04:05 +0100 Subject: [PATCH] added some more macros as quick hack... --- examples_cuda/sort/Makefile_gpu | 2 +- examples_cuda/sort/sort.ispc | 2 +- examples_cuda/sort/sort1.ispc | 1 + module.cpp | 12 ++++++++++++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/examples_cuda/sort/Makefile_gpu b/examples_cuda/sort/Makefile_gpu index af65c30f..a06eaca6 100644 --- a/examples_cuda/sort/Makefile_gpu +++ b/examples_cuda/sort/Makefile_gpu @@ -1,5 +1,5 @@ PROG=sort_cu -ISPC_SRC=sort1.ispc +ISPC_SRC=sort.ispc CXX_SRC=sort_cu.cpp sort_serial.cpp CXX=g++ diff --git a/examples_cuda/sort/sort.ispc b/examples_cuda/sort/sort.ispc index 25ea90f4..a713f1ac 100644 --- a/examples_cuda/sort/sort.ispc +++ b/examples_cuda/sort/sort.ispc @@ -188,7 +188,7 @@ static void prefix_sum (uniform int num, uniform int h[]) export void sort_ispc (uniform int n, uniform unsigned int code[], uniform int order[], uniform int ntasks) { - uniform int num = ntasks < 1 ? num_cores () : ntasks; + uniform int num = ntasks ; //< 1 ? num_cores () : ntasks; uniform int span = n / num; uniform int hsize = 256*programCount*num; uniform int * uniform hist = uniform new uniform int [hsize]; diff --git a/examples_cuda/sort/sort1.ispc b/examples_cuda/sort/sort1.ispc index 7f79703e..e7c7ff3f 100644 --- a/examples_cuda/sort/sort1.ispc +++ b/examples_cuda/sort/sort1.ispc @@ -45,6 +45,7 @@ #warning "emitting HOST code" #endif + task void histogram (uniform int span, uniform int n, uniform int64 code[], uniform int pass, uniform int hist[]) { if (taskIndex >= taskCount) return; diff --git a/module.cpp b/module.cpp index 2e9cf279..9a71442f 100644 --- a/module.cpp +++ b/module.cpp @@ -1929,6 +1929,18 @@ Module::execPreprocessor(const char *infilename, llvm::raw_string_ostream *ostre { opts.addMacroDef("__NVPTX__"); opts.addMacroDef("programIndex=laneIndex()"); + opts.addMacroDef("cif=if"); + opts.addMacroDef("cfor=for"); + opts.addMacroDef("cwhile=while"); + opts.addMacroDef("cdo=do"); + opts.addMacroDef("taskIndex=blockIndex0()"); + opts.addMacroDef("taskCount=blockCount0()"); + opts.addMacroDef("taskIndex0=blockIndex0()"); + opts.addMacroDef("taskCount0=blockCount0()"); + opts.addMacroDef("taskIndex1=blockIndex1()"); + opts.addMacroDef("taskCount1=blockCount1()"); + opts.addMacroDef("taskIndex2=blockIndex2()"); + opts.addMacroDef("taskCount2=blockCount2()"); } #if defined(LLVM_3_1)