summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAmruth <[email protected]>2018-04-16 15:33:19 +0000
committerTor Aamodt <[email protected]>2018-04-16 15:33:19 +0000
commit69443e6e7e4ad42d987d04e34fb8a50ae81ecf81 (patch)
treedcaabbdc35438e982bf9fe125c31216615998fd0 /src
parent37b9b2b393a13d5882ffe42afdc905e87449f9ac (diff)
parent2371b950f6d7ac99ef9841bd8e84c15b3ba437e3 (diff)
Merged in amruth_s/apr14 (pull request #4)
code working fine on all CDP benchmarks
Diffstat (limited to 'src')
-rw-r--r--src/cuda-sim/cuda-sim.cc7
-rw-r--r--src/cuda-sim/ptx.l5
-rw-r--r--src/cuda-sim/ptx_ir.h1
3 files changed, 10 insertions, 3 deletions
diff --git a/src/cuda-sim/cuda-sim.cc b/src/cuda-sim/cuda-sim.cc
index dce35ca..2c87031 100644
--- a/src/cuda-sim/cuda-sim.cc
+++ b/src/cuda-sim/cuda-sim.cc
@@ -1139,8 +1139,13 @@ void function_info::finalize( memory_space *param_mem )
}
// copy the parameter over word-by-word so that parameter that crosses a memory page can be copied over
//Jin: copy parameter using aligned rules
+ const type_info *paramtype = param->type();
+ int align_amount = paramtype->get_key().get_alignment_spec();
+ align_amount = (align_amount == -1) ? size : align_amount;
+ param_address = (param_address + align_amount - 1) / align_amount * align_amount; //aligned
+
const size_t word_size = 4;
- param_address = (param_address + size - 1) / size * size; //aligned with size
+ //param_address = (param_address + size - 1) / size * size; //aligned with size
for (size_t idx = 0; idx < size; idx += word_size) {
const char *pdata = reinterpret_cast<const char*>(param_value.pdata) + idx; // cast to char * for ptr arithmetic
param_mem->write(param_address + idx, word_size, pdata,NULL,NULL);
diff --git a/src/cuda-sim/ptx.l b/src/cuda-sim/ptx.l
index 1b5d7f6..908c5be 100644
--- a/src/cuda-sim/ptx.l
+++ b/src/cuda-sim/ptx.l
@@ -36,7 +36,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "ptx.tab.h"
#include <string.h>
-char linebuf[1024];
+#define LINEBUF_SIZE (64*1024)
+char linebuf[LINEBUF_SIZE];
unsigned col = 0;
#define TC col+=strlen(ptx_text);
#define CHECK_UNSIGNED \
@@ -384,7 +385,7 @@ breakaddr TC; ptx_lval.int_value = BREAKADDR_OP; return OPCODE;
"//"[^\n]* TC; // eat single
-\n.* col=0; strncpy(linebuf, yytext + 1, 1024); yyless( 1 );
+\n.* col=0; strncpy(linebuf, yytext + 1, LINEBUF_SIZE); yyless( 1 );
" " TC;
"\t" TC;
diff --git a/src/cuda-sim/ptx_ir.h b/src/cuda-sim/ptx_ir.h
index 85b2a3b..6731763 100644
--- a/src/cuda-sim/ptx_ir.h
+++ b/src/cuda-sim/ptx_ir.h
@@ -91,6 +91,7 @@ public:
bool is_tex() const { return m_space_spec == tex_space;}
bool is_func_addr() const { return m_is_function?true:false; }
int scalar_type() const { return m_scalar_type_spec;}
+ int get_alignment_spec() const { return m_alignment_spec;}
unsigned type_decode( size_t &size, int &t ) const;
static unsigned type_decode( int type, size_t &size, int &t );
memory_space_t get_memory_space() const { return m_space_spec; }