reversed to original changes. Here is the plan to use CDP and genarate only device code with host wrapper..
This commit is contained in:
@@ -860,7 +860,7 @@ DefineStdlib(SymbolTable *symbolTable, llvm::LLVMContext *ctx, llvm::Module *mod
|
||||
case Target::NVPTX64:
|
||||
{
|
||||
if (runtime32) {
|
||||
fprintf(stderr, " please add 32-bit bulitins .. \n");
|
||||
fprintf(stderr, "W're sorry, but only 64bit targets are supported at this moment .. \n");
|
||||
assert(0);
|
||||
}
|
||||
else {
|
||||
|
||||
2
ctx.cpp
2
ctx.cpp
@@ -3524,7 +3524,7 @@ FunctionEmitContext::LaunchInst(llvm::Value *callee,
|
||||
std::vector<llvm::Value *> &argVals,
|
||||
llvm::Value *launchCount[3]){
|
||||
|
||||
if (!g->target->isPTX())
|
||||
if (1) // if (!g->target->isPTX())
|
||||
{
|
||||
if (callee == NULL) {
|
||||
AssertPos(currentPos, m->errorCount > 0);
|
||||
|
||||
6
decl.cpp
6
decl.cpp
@@ -533,8 +533,8 @@ Declarator::InitFromType(const Type *baseType, DeclSpecs *ds) {
|
||||
bool isTask = ds && ((ds->typeQualifiers & TYPEQUAL_TASK) != 0);
|
||||
if (isTask && g->target->isPTX()) //getISA() == Target::NVPTX64)
|
||||
{
|
||||
ds->storageClass = SC_EXTERN_C;
|
||||
ds->typeQualifiers |= TYPEQUAL_UNMASKED;
|
||||
// ds->storageClass = SC_EXTERN_C;
|
||||
// ds->typeQualifiers |= TYPEQUAL_UNMASKED;
|
||||
}
|
||||
|
||||
bool isExternC = ds && (ds->storageClass == SC_EXTERN_C);
|
||||
@@ -546,7 +546,7 @@ Declarator::InitFromType(const Type *baseType, DeclSpecs *ds) {
|
||||
"qualifiers");
|
||||
return;
|
||||
}
|
||||
if (!g->target->isPTX())
|
||||
// if (!g->target->isPTX())
|
||||
if (isExternC && isTask) {
|
||||
Error(pos, "Function can't have both \"extern \"C\"\" and \"task\" "
|
||||
"qualifiers");
|
||||
|
||||
17
func.cpp
17
func.cpp
@@ -242,7 +242,7 @@ Function::emitCode(FunctionEmitContext *ctx, llvm::Function *function,
|
||||
// pointer to the structure that holds all of the arguments, the
|
||||
// thread index, and the thread count variables.
|
||||
|
||||
if (g->target->getISA() != Target::NVPTX64)
|
||||
if (1) //if (g->target->getISA() != Target::NVPTX64)
|
||||
{
|
||||
llvm::Function::arg_iterator argIter = function->arg_begin();
|
||||
llvm::Value *structParamPtr = argIter++;
|
||||
@@ -342,7 +342,16 @@ Function::emitCode(FunctionEmitContext *ctx, llvm::Function *function,
|
||||
ctx->SetFunctionMask(LLVMMaskAllOn);
|
||||
}
|
||||
else /* for NVPTX64 , function must be unmasked */
|
||||
assert(0);
|
||||
{
|
||||
//assert(0);
|
||||
Assert(type->isUnmasked == false);
|
||||
|
||||
// Otherwise use the mask to set the entry mask value
|
||||
argIter->setName("__mask");
|
||||
Assert(argIter->getType() == LLVMTypes::MaskType);
|
||||
ctx->SetFunctionMask(argIter);
|
||||
Assert(++argIter == function->arg_end());
|
||||
}
|
||||
|
||||
llvm::NamedMDNode* annotations =
|
||||
m->module->getOrInsertNamedMetadata("nvvm.annotations");
|
||||
@@ -524,11 +533,13 @@ Function::GenerateIR() {
|
||||
|
||||
// And we can now go ahead and emit the code
|
||||
/* export function with NVPTX64 target should be emitted host architecture */
|
||||
#if 0
|
||||
const FunctionType *func_type= CastType<FunctionType>(sym->type);
|
||||
if (g->target->getISA() == Target::NVPTX64 && func_type->isExported)
|
||||
return;
|
||||
if (g->target->getISA() != Target::NVPTX64 && g->target->isPTX() && func_type->isTask)
|
||||
return;
|
||||
#endif
|
||||
|
||||
// if (!(g->target->getISA()==Target::NVPTX64 && func_type->isExported))
|
||||
{
|
||||
@@ -549,7 +560,7 @@ Function::GenerateIR() {
|
||||
// the application can call it
|
||||
const FunctionType *type = CastType<FunctionType>(sym->type);
|
||||
Assert(type != NULL);
|
||||
if (type->isExported && g->target->getISA() != Target::NVPTX64) {
|
||||
if (type->isExported) { // && g->target->getISA() != Target::NVPTX64) {
|
||||
if (!type->isTask) {
|
||||
llvm::FunctionType *ftype = type->LLVMFunctionType(g->ctx, true);
|
||||
llvm::GlobalValue::LinkageTypes linkage = llvm::GlobalValue::ExternalLinkage;
|
||||
|
||||
@@ -733,7 +733,7 @@ Module::AddFunctionDeclaration(const std::string &name,
|
||||
if (storageClass == SC_EXTERN_C) {
|
||||
// Make sure the user hasn't supplied both an 'extern "C"' and a
|
||||
// 'task' qualifier with the function
|
||||
if (functionType->isTask && !g->target->isPTX()) { //tISA() != Target::NVPTX64) {
|
||||
if (functionType->isTask) { // && !g->target->isPTX()) { //tISA() != Target::NVPTX64) {
|
||||
Error(pos, "\"task\" qualifier is illegal with C-linkage extern "
|
||||
"function \"%s\". Ignoring this function.", name.c_str());
|
||||
return;
|
||||
@@ -795,7 +795,7 @@ Module::AddFunctionDeclaration(const std::string &name,
|
||||
#else // LLVM 3.1 and 3.3+
|
||||
function->addFnAttr(llvm::Attribute::AlwaysInline);
|
||||
#endif
|
||||
if (functionType->isTask && g->target->getISA() != Target::NVPTX64)
|
||||
if (functionType->isTask) // && g->target->getISA() != Target::NVPTX64)
|
||||
// This also applies transitively to members I think?
|
||||
#if defined(LLVM_3_1)
|
||||
function->setDoesNotAlias(1, true);
|
||||
@@ -2327,7 +2327,7 @@ Module::CompileAndOutput(const char *srcFile,
|
||||
|
||||
g->PtxString = std::string();
|
||||
|
||||
for (int itarget = 0; itarget < 2; itarget++)
|
||||
for (int itarget = 0; itarget < 1; itarget++)
|
||||
{
|
||||
fprintf(stderr, "compiling nvptx64 : target= %s\n",targets[itarget].c_str());
|
||||
g->target = new Target(arch, cpu, targets[itarget].c_str(), generatePIC, /* isPTX= */ true);
|
||||
|
||||
4
type.cpp
4
type.cpp
@@ -2925,7 +2925,7 @@ FunctionType::GetReturnTypeString() const {
|
||||
llvm::FunctionType *
|
||||
FunctionType::LLVMFunctionType(llvm::LLVMContext *ctx, bool removeMask) const {
|
||||
|
||||
if (isTask == true && !g->target->isPTX()) //getISA() != Target::NVPTX64)
|
||||
if (isTask == true) // && !g->target->isPTX()) //getISA() != Target::NVPTX64)
|
||||
Assert(removeMask == false);
|
||||
|
||||
// Get the LLVM Type *s for the function arguments
|
||||
@@ -2957,7 +2957,7 @@ FunctionType::LLVMFunctionType(llvm::LLVMContext *ctx, bool removeMask) const {
|
||||
// marshalled in a struct so that it's easy to allocate space to
|
||||
// hold them until the task actually runs.)
|
||||
// if (g->target->getISA() != Target::NVPTX64)
|
||||
if (!g->target->isPTX())
|
||||
if (1) //if (!g->target->isPTX())
|
||||
{
|
||||
llvm::Type *st = llvm::StructType::get(*ctx, llvmArgTypes);
|
||||
callTypes.push_back(llvm::PointerType::getUnqual(st));
|
||||
|
||||
Reference in New Issue
Block a user