added support for multiple architectures. right now, support is tested only for sm_35 and sm_37

This commit is contained in:
Evghenii Gaburov
2015-02-22 12:17:37 +01:00
parent 3d086ca6b9
commit 795f592013
4 changed files with 84 additions and 25 deletions

View File

@@ -1,5 +1,5 @@
/*
Copyright (c) 2014, Evghenii Gaburov
Copyright (c) 2014-2015, Evghenii Gaburov
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -43,6 +43,8 @@ met:
#include <cstring>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include "GPUTargets.h"
#define YYERROR_VERBOSE 1
@@ -117,10 +119,12 @@ version:
TOKEN_VERSION TOKEN_FLOAT { assert($2 >= 3.0); } ;//std::cerr << "Reading PTX version " << $2 << std::endl; };
target:
TOKEN_TARGET TOKEN_STRING {
assert(
std::string($2) == std::string("sm_35")
|| std::string($2) == std::string("sm_37")
); } //std::cerr << "Target " << $2 << std::endl; };
if (std::find(GPUTargets::computeMode.begin(), GPUTargets::computeMode.end(), std::string($2)) == GPUTargets::computeMode.end())
{
fprintf(stderr, "ptxcc fatal : Found wrong Target=\"%s\" in ptx file\n", $2);
exit(-1);
}
}
address_size:
TOKEN_ADDRESS_SIZE TOKEN_INT { assert($2 == 64); } //std::cerr << "Address_Size " << $2 << std::endl; };