added support to run test via NVVM

This commit is contained in:
Evghenii
2014-01-22 10:16:37 +01:00
parent 98fc43d859
commit 6931f87fcd
6 changed files with 72 additions and 25 deletions

View File

@@ -199,7 +199,10 @@ namespace parser
if (_alignment > 0)
s << "__attribute__((aligned(" << _alignment << "))) ";
s << tokenToDataType(_dataTypeId, 0);
s << name << "[" << arrayDimensionsList[0] << "] = {0};\n\n";
if (arrayDimensionsList[0] == 0)
s << name << ";\n\n";
else
s << name << "[" << arrayDimensionsList[0] << "] = {0};\n\n";
std::cout << s.str();
arrayDimensionsList.clear();
}
@@ -225,16 +228,16 @@ namespace parser
case TOKEN_U16: assert(0); s << "u16_t "; break;
case TOKEN_S16: assert(0); s << "s16_t "; break;
case TOKEN_B32: assert(dim == 1); s << "b32_t "; break;
case TOKEN_U32: assert(dim == 1); s << "u32_t "; break;
case TOKEN_S32: assert(dim == 1); s << "s32_t "; break;
case TOKEN_B32: assert(dim <= 1); s << "b32_t "; break;
case TOKEN_U32: assert(dim <= 1); s << "u32_t "; break;
case TOKEN_S32: assert(dim <= 1); s << "s32_t "; break;
case TOKEN_B64: assert(dim == 1); s << "b64_t "; break;
case TOKEN_U64: assert(dim == 1); s << "u64_t "; break;
case TOKEN_S64: assert(dim == 1); s << "s64_t "; break;
case TOKEN_B64: assert(dim <= 1); s << "b64_t "; break;
case TOKEN_U64: assert(dim <= 1); s << "u64_t "; break;
case TOKEN_S64: assert(dim <= 1); s << "s64_t "; break;
case TOKEN_F32: assert(dim == 1); s << "f32_t "; break;
case TOKEN_F64: assert(dim == 1); s << "f64_t "; break;
case TOKEN_F32: assert(dim <= 1); s << "f32_t "; break;
case TOKEN_F64: assert(dim <= 1); s << "f64_t "; break;
default: std::cerr << "token= " << token<< std::endl; assert(0);
}

View File

@@ -48,6 +48,8 @@ TAB [\t]*
"(" { return '(';}
")" { return ')';}
"," { return ',';}
";" { return ';';}
"=" { return '=';}
[0-9]+\.[0-9]+ { yylval->fvalue = atof(yytext); return TOKEN_FLOAT; }
[0-9]+ { yylval->ivalue = atoi(yytext); return TOKEN_INT; }
[a-zA-Z0-9_]+ { strcpy(yylval->svalue, yytext); return TOKEN_STRING;}

View File

@@ -10,7 +10,7 @@ DEPTX=dePTX
NVCC=nvcc
$DEPTX < $PTXSRC > $PTXCU &&
$NVCC -arch=sm_35 -dc $NVCCPARM -dryrun $PTXCU 2>&1 | \
$NVCC -arch=sm_35 -G -dc $NVCCPARM -dryrun $PTXCU 2>&1 | \
sed 's/\#\$//g'| \
awk '{ if ($1 == "LIBRARIES=") print $1$2; else if ($1 == "cicc") print "cp '$PTXSRC'", $NF; else print $0 }' > $PTXSH &&
sh $PTXSH

View File

@@ -105,7 +105,10 @@ anytoken:
| ']'
| '('
| ')'
| ',';
| ','
| ';'
| '='
;
ptxbody:
ptxbody visibleFunctionDeclaration | visibleFunctionDeclaration
@@ -157,9 +160,11 @@ visibleFunctionDeclaration: TOKEN_VISIBLE TOKEN_FUNC optionalReturnArgumentList
visibleInitializableDeclaration :
TOKEN_VISIBLE TOKEN_GLOBAL addressableVariablePrefix identifier arrayDimensionSet
{
state.visibleInitializableDeclaration($<svalue>4,@1);
}
{ state.visibleInitializableDeclaration($<svalue>4,@1); }
| TOKEN_VISIBLE TOKEN_GLOBAL addressableVariablePrefix identifier ';'
{state.arrayDimensions(0); state.visibleInitializableDeclaration($<svalue>4,@1); }
| TOKEN_VISIBLE TOKEN_GLOBAL addressableVariablePrefix identifier '='
{state.arrayDimensions(0); state.visibleInitializableDeclaration($<svalue>4,@1); }
%%