diff options
| author | Tim Rogers <[email protected]> | 2012-06-27 14:57:05 -0800 |
|---|---|---|
| committer | Andrew Boktor <[email protected]> | 2014-08-14 13:47:33 -0700 |
| commit | 2031dd162995157c3f7830d68896b19b178b9146 (patch) | |
| tree | c19a3999057e9d775da4fe329a98c640fb84f294 /libopencl | |
| parent | 19fbc3bf016d656e7c4da5f247f87c05bbf02daf (diff) | |
Fixing a bug in the opencl prebuilt ptx flow.
If a kernel made modidifcations to the .cl code at runtime (like changed the block size or some other constants) then recompiled itself the saved_embedded_ptx
would just get overwritten. Same on using the prebuilt ptx file - I always wanted to load the same ptx file even though there should have been more than one.
[git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 13217]
Diffstat (limited to 'libopencl')
| -rw-r--r-- | libopencl/opencl_runtime_api.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libopencl/opencl_runtime_api.cc b/libopencl/opencl_runtime_api.cc index 213b4b4..0b00556 100644 --- a/libopencl/opencl_runtime_api.cc +++ b/libopencl/opencl_runtime_api.cc @@ -181,6 +181,7 @@ struct _cl_program { private: cl_context m_context; std::map<cl_uint,pgm_info> m_pgm; + static unsigned m_kernels_compiled; }; struct _cl_kernel { @@ -381,6 +382,7 @@ cl_mem _cl_context::lookup_mem( cl_mem m ) } } +unsigned _cl_program::m_kernels_compiled = 0; _cl_program::_cl_program( cl_context context, cl_uint count, const char ** strings, @@ -392,7 +394,8 @@ _cl_program::_cl_program( cl_context context, char *tmp = (char*)malloc(len+1); memcpy(tmp,strings[i],len); tmp[len] = 0; - m_pgm[i].m_source = tmp; + m_pgm[m_kernels_compiled].m_source = tmp; + ++m_kernels_compiled; free(tmp); } } |
