summaryrefslogtreecommitdiff
path: root/src/cuda-sim/cuda-sim.cc
diff options
context:
space:
mode:
authorJonathan <[email protected]>2018-05-17 16:26:55 -0700
committerJonathan <[email protected]>2018-05-17 16:37:39 -0700
commit9476c4ccf17949a67a430155dfc93e66ca73d4a8 (patch)
tree0d1648596683e3ff66c9f6b01c6dbd24acccd9cd /src/cuda-sim/cuda-sim.cc
parent7546c12af13aca0fdcba6a339913120c0ffed50d (diff)
abstract_hardware_model.h:texrefAttr is different and can be searched via pointer
cuda-sim.cc: counts matches between cudaBinTextureToArray texref param (pointer) to texref pointers in m_NameToTextureRef
Diffstat (limited to 'src/cuda-sim/cuda-sim.cc')
-rw-r--r--src/cuda-sim/cuda-sim.cc47
1 files changed, 37 insertions, 10 deletions
diff --git a/src/cuda-sim/cuda-sim.cc b/src/cuda-sim/cuda-sim.cc
index 6e04ca8..39ffa63 100644
--- a/src/cuda-sim/cuda-sim.cc
+++ b/src/cuda-sim/cuda-sim.cc
@@ -26,6 +26,10 @@
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifndef VERSION_EIGHT
+#define VERSION_EIGHT
+#endif
+
#include "cuda-sim.h"
#include "instructions.h"
@@ -104,6 +108,16 @@ static address_type get_converge_point(address_type pc);
void gpgpu_t::gpgpu_ptx_sim_bindNameToTexture(const char* name, const struct textureReference* texref, int dim, int readmode, int ext)
{
+
+//#ifdef VERSION_EIGHT
+// int i;
+// printf("%s ", name);
+// printf("__cudaReserved:");
+// for (i = 0; i<15; i++){
+// printf(" %i", texref->__cudaReserved[i]);
+// }
+// printf("\n");
+//#endif
std::string texname(name);
m_NameToTextureRef[texname] = texref;
const textureReferenceAttr *texAttr = new textureReferenceAttr(texref, dim, (enum cudaTextureReadMode)readmode, ext);
@@ -140,16 +154,15 @@ unsigned int intLOGB2( unsigned int v ) {
void gpgpu_t::gpgpu_ptx_sim_bindTextureToArray(const struct textureReference* texref, const struct cudaArray* array)
{
+//#ifdef VERSION_EIGHT
+// int i;
+// printf("__cudaReserved:");
+// for (i = 0; i<15; i++){
+// printf(" %i", texref->__cudaReserved[i]);
+// }
+// printf("\n");
+//#endif
// counts number of matches
-// int normalized;
-// enum cudaTextureFilterMode filterMode;
-// enum cudaTextureAddressMode addressMode[3];
-// struct cudaChannelFormatDesc channelDesc;
-// int x;
-// int y;
-// int z;
-// int w;
-// enum cudaChannelFormatKind f;
// int trMatches = 0;
// for (auto& kv : m_NameToTextureRef){
// const struct textureReference* tr = kv.second;
@@ -170,7 +183,21 @@ void gpgpu_t::gpgpu_ptx_sim_bindTextureToArray(const struct textureReference* te
// }
// printf("GPGPU-Sim PTX: matches to texref = %d\n", trMatches);
// assert(trMatches==1);
- m_TextureRefToCudaArray[texref] = array;
+
+ //tests if texref pointer matches any pointer in m_NameToTextureRef map
+ int trMatches = 0;
+ for (auto& kv : m_NameToTextureRef){
+ const struct textureReference* tr = kv.second;
+ if (tr==texref){
+ m_TextureRefToCudaArray[tr] = array;
+ //printf("%s\n", kv.first);
+ trMatches++;
+ }
+ }
+ printf("GPGPU-Sim PTX: matches to texref = %d\n", trMatches);
+ //assert(trMatches==1);
+
+ //m_TextureRefToCudaArray[texref] = array;
unsigned int texel_size_bits = array->desc.w + array->desc.x + array->desc.y + array->desc.z;
unsigned int texel_size = texel_size_bits/8;
unsigned int Tx, Ty;