diff options
| author | Andrew M. B. Boktor <[email protected]> | 2012-04-18 16:33:33 -0800 |
|---|---|---|
| committer | Andrew Boktor <[email protected]> | 2014-08-14 13:19:05 -0700 |
| commit | 0cb76063ce079a0606598e145da351f134235ab5 (patch) | |
| tree | c1d2de65b2d03d4ef4257ec15037b656a03657c5 /decuda_to_ptxplus | |
| parent | 5a65fb7a5f0cb1a8d7831bae33749e8bd15a947d (diff) | |
This changelist implements the following:
1. Adds support for using cuobjdump for both ptx and ptxplus execution. This has been tested with CUDA 4.0
. Ptxplus is no longer supported through decuda/decuda_to_ptxplus
2. Adds support for converting the SASS output by cuobjdump to ptxplus. This has been tested with CUDA 4.0
. The old path that extracts ptx from cubin files is still preserved
3. Adds a bank group model. (WARNING: memory config has changed, please adapt yours). To disable the bank groups model, set nbkgrp to 1 and tCCDL and tRTPL to 0
Diff the configuration files to learn about how to use those new options.
Merging
//depot/gpgpu_sim_research/fermi-test/distribution/...
to //depot/gpgpu_sim_research/fermi/distribution/...
[git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 12023]
Diffstat (limited to 'decuda_to_ptxplus')
| -rw-r--r-- | decuda_to_ptxplus/decudaInstList.cc | 65 | ||||
| -rw-r--r-- | decuda_to_ptxplus/decudaInstList.h | 12 | ||||
| -rw-r--r-- | decuda_to_ptxplus/ptx_parser.h | 22 |
3 files changed, 87 insertions, 12 deletions
diff --git a/decuda_to_ptxplus/decudaInstList.cc b/decuda_to_ptxplus/decudaInstList.cc index 3a77de3..4035d76 100644 --- a/decuda_to_ptxplus/decudaInstList.cc +++ b/decuda_to_ptxplus/decudaInstList.cc @@ -27,7 +27,14 @@ #include "decudaInstList.h" - +#define P_DEBUG 1 +#define DPRINTF(...) \ + if(P_DEBUG) { \ + printf("(%s:%u) ", __FILE__, __LINE__); \ + printf(__VA_ARGS__); \ + printf("\n"); \ + fflush(stdout); \ + } extern void output(const char * text); //Constructor @@ -129,6 +136,13 @@ void decudaInstList::printHeaderInstList() break; } } + for ( std::list<std::string>::iterator iter = m_realTexList.begin(); + iter != m_realTexList.end(); + iter ++) { + output(".tex .u64 "); + output((*iter).c_str()); + output(";\n"); + } } void decudaInstList::printNewPtxList(decudaInstList* headerInfo) @@ -426,7 +440,7 @@ void decudaInstList::addDoublePredReg(std::string pred, std::string reg, bool lo void decudaInstList::addTex(std::string tex) { std::string origTex = tex; - + DPRINTF("decudaInstList::addTex tex=%s", tex.c_str()); // If $tex# tex from decuda, then use index to get real tex name if(tex.substr(0, 4) == "$tex") { tex = tex.substr(4, tex.size()-4); @@ -446,9 +460,9 @@ void decudaInstList::addTex(std::string tex) } // Add the tex to instruction operand list - char* texName = new char [strlen(origTex.c_str())+1]; - strcpy(texName, origTex.c_str()); - getListEnd().addOperand(texName); + //char* texName = new char [strlen(origTex.c_str())+1]; + //strcpy(texName, origTex.c_str()); + //getListEnd().addOperand(texName); } @@ -478,24 +492,34 @@ void decudaInstList::addConstMemoryValue(std::string constMemoryValue) m_constMemoryList.back().m_constMemory.push_back(constMemoryValue); } +void decudaInstList::addConstMemoryValue2(std::string constMemoryValue) +{ + m_constMemoryList2.back().m_constMemory.push_back(constMemoryValue); +} + // set type of constant memory void decudaInstList::setConstMemoryType(const char* type) { m_constMemoryList.back().type = type; } +void decudaInstList::setConstMemoryType2(const char* type) +{ + m_constMemoryList2.back().type = type; +} + // print const memory directive void decudaInstList::printMemory() { // Constant memory - std::list<constMemory>::iterator i; - for(i=m_constMemoryList.begin(); i!=m_constMemoryList.end(); ++i) { + + for(std::list<constMemory>::iterator i=m_constMemoryList.begin(); i!=m_constMemoryList.end(); ++i) { char line[40]; // Global or entry specific if(i->entryIndex == 0) - sprintf(line, ".const %s c%d[%d] = {", i->type, i->index, i->m_constMemory.size()); + sprintf(line, ".const %s constant0[%d] = {", i->type, i->m_constMemory.size()); else sprintf(line, ".const %s ce%dc%d[%d] = {", i->type, i->entryIndex, i->index, i->m_constMemory.size()); @@ -512,6 +536,26 @@ void decudaInstList::printMemory() output("\n};\n\n"); } + + for(std::list<constMemory2>::iterator i=m_constMemoryList2.begin(); i!=m_constMemoryList2.end(); ++i) { + char line[1024]; + + // Global or entry specific + sprintf(line, ".const %s constant1%s[%d] = {", i->type, i->kernel, i->m_constMemory.size()); + + output(line); + + std::list<std::string>::iterator j; + int l=0; + for(j=i->m_constMemory.begin(); j!=i->m_constMemory.end(); ++j) { + if(j!=i->m_constMemory.begin()) + output(", "); + if( (l++ % 4) == 0) output("\n "); + output(j->c_str()); + } + output("\n};\n\n"); + } + // Next, print out the local memory declaration std::list<decudaEntry>::iterator e; int eIndex=1; // entry index starts from 1 from the first blank entry is missing here (only in header entry list) @@ -565,13 +609,16 @@ void decudaInstList::addVector(char* vector, int vectorSize) { // memType: 0=constant, 1=shared, 2=global, 3=local void decudaInstList::addMemoryOperand(std::string mem, int memType) { std::string origMem = mem; + assert(0 && "This function is obsolete and shouldn't be used"); // If constant memory type, add prefix for entry specific constant memory if(memType == 0) { // Entry-specific constant memory c1 if(mem.substr(0, 3) == "c1[") { std::stringstream out; - out << "ce" << m_entryList.size() << mem; + //out << "ce" << m_entryList.size() << mem; + mem = mem.substr(2); + out << "constant1" << this->m_entryList.back().m_entryName << mem; mem = out.str(); } // Global memory c14 diff --git a/decuda_to_ptxplus/decudaInstList.h b/decuda_to_ptxplus/decudaInstList.h index da0d48a..d7387ee 100644 --- a/decuda_to_ptxplus/decudaInstList.h +++ b/decuda_to_ptxplus/decudaInstList.h @@ -34,7 +34,7 @@ #include <iostream> #include <sstream> #include <stdlib.h> -#include <regex.hpp> +#include <boost/regex.hpp> #include <map> // Used for entry specific constant memory segments (c1) @@ -46,6 +46,13 @@ struct constMemory std::list<std::string> m_constMemory; }; +struct constMemory2 +{ + const char* kernel; + const char* type; + std::list<std::string> m_constMemory; +}; + // Used for uninitialized constant memory (globally defined) struct constMemoryPtr { @@ -102,6 +109,7 @@ protected: // Const memory list std::list<constMemory> m_constMemoryList; + std::list<constMemory2> m_constMemoryList2; // Const memory pointers list std::list<constMemoryPtr> m_constMemoryPtrList; @@ -157,7 +165,9 @@ public: void addEntryConstMemory(int index); // add entry specific const memory void addConstMemory(int index); // add global const memory void setConstMemoryType(const char* type); // set type of constant memory + void setConstMemoryType2(const char* type); // set type of constant memory void addConstMemoryValue(std::string constMemoryValue); // add const memory + void addConstMemoryValue2(std::string constMemoryValue); // add const memory std::list<std::string> getRealTexList(); // get the list of real tex names void setRealTexList(std::list<std::string> realTexList); // set the list of real tex names diff --git a/decuda_to_ptxplus/ptx_parser.h b/decuda_to_ptxplus/ptx_parser.h index c429ead..bed82bb 100644 --- a/decuda_to_ptxplus/ptx_parser.h +++ b/decuda_to_ptxplus/ptx_parser.h @@ -37,6 +37,14 @@ #define NON_ARRAY_IDENTIFIER 1 #define ARRAY_IDENTIFIER_NO_DIM 2 #define ARRAY_IDENTIFIER 3 +#define P_DEBUG 1 +#define DPRINTF(...) \ + if(P_DEBUG) { \ + printf("(%s:%u) ", __FILE__, __LINE__); \ + printf(__VA_ARGS__); \ + printf("\n"); \ + fflush(stdout); \ + } enum _memory_space_t { @@ -128,21 +136,30 @@ void add_function_name( const char *headerInput ) //void add_space_spec(int headerInput) void add_space_spec( enum _memory_space_t spec, int value ) { + DPRINTF("add_space_spec: spec=%u", spec); + decudaInst *instEntry; switch(spec) { case param_space_unclassified: if(inEntryDirective && inParamDirective) { - decudaInst *instEntry = new decudaInst(); + instEntry = new decudaInst(); instEntry->setBase(".param"); g_headerList->add(instEntry); } break; case tex_space: inTexDirective = true; - decudaInst *instEntry = new decudaInst(); + instEntry = new decudaInst(); instEntry->setBase(".tex"); g_headerList->add(instEntry); break; + case const_space: + if(inEntryDirective) { + instEntry = new decudaInst(); + instEntry->setBase(".const"); + g_headerList->add(instEntry); + } + break; } } @@ -277,6 +294,7 @@ void func_header(const char* headerBase) // If start of an entry if((strcmp(headerBase, ".entry")==0)||(strcmp(headerBase, ".func")==0)) { + inEntryDirective = true; g_headerList->addEntry(""); decudaInst *instEntry = new decudaInst(); |
