From 835b78988ce1797e394cb1b169db83e7d0fc1038 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Wed, 23 May 2018 10:04:11 -0700 Subject: assertions and comments that allow the current unbind implementation to behave correctly --- src/cuda-sim/cuda-sim.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cuda-sim/cuda-sim.cc b/src/cuda-sim/cuda-sim.cc index 0e14dd0..2a197c3 100644 --- a/src/cuda-sim/cuda-sim.cc +++ b/src/cuda-sim/cuda-sim.cc @@ -154,6 +154,10 @@ unsigned int intLOGB2( unsigned int v ) { void gpgpu_t::gpgpu_ptx_sim_bindTextureToArray(const struct textureReference* texref, const struct cudaArray* array) { std::string texname = gpgpu_ptx_sim_findNamefromTexture(texref); + + std::map::const_iterator t=m_NameToCudaArray.find(texname); + //check that there's nothing there first + assert(t == m_NameToCudaArray.end()); m_NameToCudaArray[texname] = 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; @@ -199,6 +203,7 @@ void gpgpu_t::gpgpu_ptx_sim_bindTextureToArray(const struct textureReference* te void gpgpu_t::gpgpu_ptx_sim_unbindTexture(const struct textureReference* texref) { + //assumes bind-use-unbind-bind-use-unbind pattern std::string texname = gpgpu_ptx_sim_findNamefromTexture(texref); m_NameToCudaArray.erase(texname); m_NameToTexureInfo.erase(texname); -- cgit v1.3