I'm trying to modify some instrumented instructions after nvbit_enable_instrumented. For example, if the replaced instruction is exit, there is no need to restore the saved context.
The implementation is a litter bit hack. I first find the trampoline code region inserted by nvbit, and then manually replace some instructions.
However, I found that if a kernel has been already executed, the instructions are cached in the instruction cache. Unless I run many other kernels to replace the cache, the modified instructions cannot be detected.
I have tried some other methods, e.g., unmap and remap the virtual address via cuMemUnmap/cuMemMap. But none of the methods worked.
Is there any elegant way to flush the instruction cache?
I'm trying to modify some instrumented instructions after
nvbit_enable_instrumented
. For example, if the replaced instruction isexit
, there is no need to restore the saved context.The implementation is a litter bit hack. I first find the trampoline code region inserted by nvbit, and then manually replace some instructions.
However, I found that if a kernel has been already executed, the instructions are cached in the instruction cache. Unless I run many other kernels to replace the cache, the modified instructions cannot be detected.
I have tried some other methods, e.g., unmap and remap the virtual address via
cuMemUnmap/cuMemMap
. But none of the methods worked.Is there any elegant way to flush the instruction cache?
Thanks.