summaryrefslogtreecommitdiff
path: root/src/cuda-sim
diff options
context:
space:
mode:
authoraamir <[email protected]>2018-08-14 17:46:21 -0700
committeraamir <[email protected]>2018-08-14 17:46:21 -0700
commitcdd42ac0384cb31bcee05ac72d026f1bc8133d26 (patch)
treefd63bd4ee1998b32e9ff30098587bc46cfb0bb14 /src/cuda-sim
parent44f0114ad2c208f69c0c1baa980a5b3bda37e16b (diff)
parsing changes for timing model
Diffstat (limited to 'src/cuda-sim')
-rw-r--r--src/cuda-sim/instructions.cc13
-rw-r--r--src/cuda-sim/opcodes.h3
-rw-r--r--src/cuda-sim/ptx.l3
-rw-r--r--src/cuda-sim/ptx_ir.cc4
4 files changed, 17 insertions, 6 deletions
diff --git a/src/cuda-sim/instructions.cc b/src/cuda-sim/instructions.cc
index b26adfd..39b8ba5 100644
--- a/src/cuda-sim/instructions.cc
+++ b/src/cuda-sim/instructions.cc
@@ -130,6 +130,9 @@ unsigned thread_group_offset(int thread,unsigned wmma_type,unsigned wmma_layout
}
break;
case VP_MMA:
+ case VP_MMA4:
+ case VP_MMA8:
+ case VP_MMA16:
if(wmma_layout==ROW)
offset=load_c_float_row[thread_group]+16*in_tg_index;
else
@@ -1703,7 +1706,7 @@ void mapping(int thread,int wmma_type,int wmma_layout,int type,int index,int str
}
assg_offset=index;
}
- else if( wmma_type==VP_MMA){
+ else if(wmma_type==VP_MMA || wmma_type==VP_MMA4 || wmma_type==VP_MMA8 || wmma_type==VP_MMA16){
row=c_row_offset[thread/4]+thread%4;
col=c_col_offset[thread/4]+index;
assg_offset=index;
@@ -1761,7 +1764,7 @@ void vp_mma_impl( const ptx_instruction *pI, core_t *core, warp_inst_t inst )
switch(i) {
case 1 ://operand 1
for(k=0;k<8;k++){
- mapping(thrd,VP_MMA,a_layout,S32_TYPE,k,16,row,col,offset);
+ mapping(thrd,wmma_type,a_layout,S32_TYPE,k,16,row,col,offset);
if(g_debug_instruction)
printf("A:thread=%d,row=%d,col=%d,offset=%d\n",thrd,row,col,offset);
matrix_a[row][col]=v[offset];
@@ -1769,7 +1772,7 @@ void vp_mma_impl( const ptx_instruction *pI, core_t *core, warp_inst_t inst )
break;
case 2 ://operand 2
for(k=0;k<8;k++){
- mapping(thrd,VP_MMA,b_layout,S32_TYPE,k,16,row,col,offset);
+ mapping(thrd,wmma_type,b_layout,S32_TYPE,k,16,row,col,offset);
if(g_debug_instruction)
printf("B:thread=%d,row=%d,col=%d,offset=%d\n",thrd,row,col,offset);
if(nelem==1){
@@ -1785,7 +1788,7 @@ void vp_mma_impl( const ptx_instruction *pI, core_t *core, warp_inst_t inst )
break;
case 3 ://operand 3
for(k=0;k<8;k++){
- mapping(thrd,VP_MMA,ROW,S32_TYPE,k,16,row,col,offset);
+ mapping(thrd,wmma_type,ROW,S32_TYPE,k,16,row,col,offset);
if(g_debug_instruction)
printf("C:thread=%d,row=%d,col=%d,offset=%d\n",thrd,row,col,offset);
matrix_c[row][col]=v[offset];
@@ -1848,7 +1851,7 @@ void vp_mma_impl( const ptx_instruction *pI, core_t *core, warp_inst_t inst )
int row_t[8];
int col_t[8];
for(k=0;k<8;k++){
- mapping(thrd,VP_MMA,ROW,type,k,16,row_t[k],col_t[k],offset);
+ mapping(thrd,wmma_type,ROW,type,k,16,row_t[k],col_t[k],offset);
if(g_debug_instruction)
printf("vp_mma:row:%d,col%d\n",row_t[k],col_t[k]);
}
diff --git a/src/cuda-sim/opcodes.h b/src/cuda-sim/opcodes.h
index 31b71d0..ad8d8f1 100644
--- a/src/cuda-sim/opcodes.h
+++ b/src/cuda-sim/opcodes.h
@@ -70,6 +70,9 @@ enum wmma_type{
STORE_D,
MMA,
VP_MMA,
+ VP_MMA4,
+ VP_MMA8,
+ VP_MMA16,
ROW,
COL,
M16N16K16
diff --git a/src/cuda-sim/ptx.l b/src/cuda-sim/ptx.l
index fea2420..9c78e9f 100644
--- a/src/cuda-sim/ptx.l
+++ b/src/cuda-sim/ptx.l
@@ -165,6 +165,9 @@ breakaddr TC; ptx_lval.int_value = BREAKADDR_OP; return OPCODE;
\.c\.sync TC; ptx_lval.int_value = LOAD_C; return WMMA_DIRECTIVE;
\.d\.sync TC; ptx_lval.int_value = STORE_D; return WMMA_DIRECTIVE;
\.mma\.sync TC;ptx_lval.int_value=MMA; return WMMA_DIRECTIVE;
+\.mma4\.sync TC;ptx_lval.int_value=VP_MMA4; return WMMA_DIRECTIVE;
+\.mma8\.sync TC;ptx_lval.int_value=VP_MMA8; return WMMA_DIRECTIVE;
+\.mma16\.sync TC;ptx_lval.int_value=VP_MMA16; return WMMA_DIRECTIVE;
\.b4\.sync TC; ptx_lval.int_value=LOAD_B4; return WMMA_DIRECTIVE;
\.b8\.sync TC; ptx_lval.int_value=LOAD_B8; return WMMA_DIRECTIVE;
\.b16\.sync TC; ptx_lval.int_value=LOAD_B16; return WMMA_DIRECTIVE;
diff --git a/src/cuda-sim/ptx_ir.cc b/src/cuda-sim/ptx_ir.cc
index 55b8e11..9800e1e 100644
--- a/src/cuda-sim/ptx_ir.cc
+++ b/src/cuda-sim/ptx_ir.cc
@@ -1095,7 +1095,9 @@ ptx_instruction::ptx_instruction( int opcode,
case LOAD_C:
case STORE_D:
case MMA:
- case VP_MMA:
+ case VP_MMA4:
+ case VP_MMA8:
+ case VP_MMA16:
m_wmma_type=last_ptx_inst_option;
break;
case ROW: