You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm writing a simple program to test the functionality of NVBit.
Here is a simplified version of my code :
extern"C"__device____noinline__voidmy_function() {
// do something here
}
intmain() {
// load a cubin file which contains the function that need to be instrumented.// ...CUfunctionmyFunc;
cuModuleGetFunction(&myFunc, myModule, myFuncName);
auto instrs=nvbit_get_instrs(cuContext, func);
nvbit_insert_call(instrs[18], "my_function", IPOINT_BEFORE);
nvbit_enable_instrumented(cuContext, func, true);
// ...
}
The error is :
ASSERT FAIL: function.cpp:764:void Function::gen_new_code(std::unordered_map<std::__cxx11::basic_string<char>, Function*>&): FAIL !(instr_func_map.find(c.instr_func_name) != instr_func_map.end()) MSG: instrumentation function merged_kernel0 not found in binary!
I don't understand how nvbit_insert_call looks for the instrumentation function.
The text was updated successfully, but these errors were encountered:
Have you checked the examples like instr_count in the tools folder?
Basically, you need to write your tool, compile it as a dynamic library .so file, and run LD_PRELOAD=<tool>.so <your program> to perform the binary instrumentation.
@x-y-z Thanks for your reply.
I understand the example instr_count, but I want to use NVBit for other purposes, such as modify the SASS of a kernel.
I don't want to use it as a shared library. So my question is what kind of device function can be found by nvbit_insert_call ? Must they be loaded as a .so file?
To modify the SASS of a kernel, you can refer to mov_replace as an example.
The current implementation of NVBit only allows using it as a shared library. Device functions used in your binary could be found by NVBit.
From the error above, your instrumentation function merged_kernel0 was not found. You should put that function in inject_functs.cu and compile the file as part of NVBit tool.
I'm writing a simple program to test the functionality of NVBit.
Here is a simplified version of my code :
The error is :
I don't understand how
nvbit_insert_call
looks for the instrumentation function.The text was updated successfully, but these errors were encountered: