Typedefs | |
typedef SanitizerPatchResult(SANITIZERAPI * | SanitizerCallbackBarrier )(void *userdata, uint64_t pc, uint32_t barIndex) |
Function type for a barrier callback. | |
typedef SanitizerPatchResult(SANITIZERAPI * | SanitizerCallbackBlockEnter )(void *userdata) |
Function type for a CUDA block enter callback. | |
typedef SanitizerPatchResult(SANITIZERAPI * | SanitizerCallbackBlockExit )(void *userdata, uint64_t pc) |
Function type for a CUDA block exit callback. | |
typedef SanitizerPatchResult(SANITIZERAPI * | SanitizerCallbackCall )(void *userdata, uint64_t pc, uint64_t targetPc) |
Function type for a function call callback. | |
typedef SanitizerPatchResult(SANITIZERAPI * | SanitizerCallbackDeviceSideFree )(void *userdata, uint64_t pc, void *ptr) |
Function type for a device-side free call. | |
typedef SanitizerPatchResult(SANITIZERAPI * | SanitizerCallbackDeviceSideMalloc )(void *userdata, uint64_t pc, void *allocatedPtr, uint64_t allocatedSize) |
Function type for a device-side malloc call. | |
typedef SanitizerPatchResult(SANITIZERAPI * | SanitizerCallbackMemoryAccess )(void *userdata, uint64_t pc, void *ptr, uint32_t accessSize, uint32_t flags) |
Function type for a memory access callback. | |
typedef SanitizerPatchResult(SANITIZERAPI * | SanitizerCallbackRet )(void *userdata, uint64_t pc) |
Function type for a function return callback. | |
typedef SanitizerPatchResult(SANITIZERAPI * | SanitizerCallbackShfl )(void *userdata, uint64_t pc) |
Function type for a shfl callback. | |
typedef SanitizerPatchResult(SANITIZERAPI * | SanitizerCallbackSyncwarp )(void *userdata, uint64_t pc, uint32_t mask) |
Function type for a syncwarp callback. | |
Enumerations | |
enum | Sanitizer_DeviceMemoryFlags { SANITIZER_MEMORY_DEVICE_FLAG_NONE = 0, SANITIZER_MEMORY_DEVICE_FLAG_READ = 0x1, SANITIZER_MEMORY_DEVICE_FLAG_WRITE = 0x2, SANITIZER_MEMORY_DEVICE_FLAG_ATOMSYS = 0x4, SANITIZER_MEMORY_DEVICE_FLAG_LOCAL = 0x8, SANITIZER_MEMORY_DEVICE_FLAG_SHARED = 0x10 } |
Flags describing a memory access. More... | |
enum | Sanitizer_InstructionId { SANITIZER_INSTRUCTION_INVALID = 0, SANITIZER_INSTRUCTION_BLOCK_ENTER = 1, SANITIZER_INSTRUCTION_BLOCK_EXIT = 2, SANITIZER_INSTRUCTION_MEMORY_ACCESS = 3, SANITIZER_INSTRUCTION_BARRIER = 4, SANITIZER_INSTRUCTION_SYNCWARP = 5, SANITIZER_INSTRUCTION_SHFL = 6, SANITIZER_INSTRUCTION_CALL = 7, SANITIZER_INSTRUCTION_RET = 8, SANITIZER_INSTRUCTION_DEVICE_SIDE_MALLOC = 9, SANITIZER_INSTRUCTION_DEVICE_SIDE_FREE = 10 } |
Instrumentation. More... | |
enum | SanitizerPatchResult { SANITIZER_PATCH_SUCCESS = 0, SANITIZER_PATCH_INVALID_MEMORY_ACCESS = 1, SANITIZER_PATCH_INVALID_SYNCHRONIZATION = 2 } |
Sanitizer patch result codes. More... | |
Functions | |
SanitizerResult SANITIZERAPI | sanitizerAddPatches (const void *image, CUcontext ctx) |
Load a module containing patches that can be used by the patching API. | |
SanitizerResult SANITIZERAPI | sanitizerAddPatchesFromFile (const char *filename, CUcontext ctx) |
Load a module containing patches that can be used by the patching API. | |
SanitizerResult SANITIZERAPI | sanitizerGetCallbackPcAndSize (CUcontext ctx, const char *deviceCallbackName, uint64_t *pc, uint64_t *size) |
Get PC and size of a device callback. | |
SanitizerResult SANITIZERAPI | sanitizerPatchInstructions (const Sanitizer_InstructionId instructionId, CUmodule module, const char *deviceCallbackName) |
Set instrumentation points and patches to be applied in a module. | |
SanitizerResult SANITIZERAPI | sanitizerPatchModule (CUmodule module) |
Perform the actual instrumentation of a module. | |
SanitizerResult SANITIZERAPI | sanitizerSetCallbackData (CUstream stream, const void *userdata) |
Specifies the user data pointer for callbacks. | |
SanitizerResult SANITIZERAPI | sanitizerSetCallbackDataEx (CUstream stream, const void *userdata, Sanitizer_MemoryData *memoryData) |
Specifies the user data pointer for callbacks. | |
SanitizerResult SANITIZERAPI | sanitizerUnpatchModule (CUmodule module) |
Remove existing instrumentation of a module. |
typedef SanitizerPatchResult(SANITIZERAPI * SanitizerCallbackBarrier)(void *userdata, uint64_t pc, uint32_t barIndex) |
userdata
is a pointer to user data. See sanitizerPatchModule pc
is the program counter of the patched instruction barIndex
is the barrier index.
typedef SanitizerPatchResult(SANITIZERAPI * SanitizerCallbackBlockEnter)(void *userdata) |
userdata
is a pointer to user data. See sanitizerPatchModule
typedef SanitizerPatchResult(SANITIZERAPI * SanitizerCallbackBlockExit)(void *userdata, uint64_t pc) |
userdata
is a pointer to user data. See sanitizerPatchModule pc
is the program counter of the patched instruction
typedef SanitizerPatchResult(SANITIZERAPI * SanitizerCallbackCall)(void *userdata, uint64_t pc, uint64_t targetPc) |
userdata
is a pointer to user data. See sanitizerPatchModule pc
is the program counter of the patched instruction targetPc
is the PC where the called function is located.
typedef SanitizerPatchResult(SANITIZERAPI * SanitizerCallbackDeviceSideFree)(void *userdata, uint64_t pc, void *ptr) |
userdata
is a pointer to user data. See sanitizerPatchModule pc
is the program counter of the patched instruction ptr
is the pointer passed to device-side free.
typedef SanitizerPatchResult(SANITIZERAPI * SanitizerCallbackDeviceSideMalloc)(void *userdata, uint64_t pc, void *allocatedPtr, uint64_t allocatedSize) |
userdata
is a pointer to user data. See sanitizerPatchModule pc
is the program counter of the patched instruction allocatedPtr
is the pointer returned by device-side malloc allocatedSize
is the size requested by the user to device-side malloc.
typedef SanitizerPatchResult(SANITIZERAPI * SanitizerCallbackMemoryAccess)(void *userdata, uint64_t pc, void *ptr, uint32_t accessSize, uint32_t flags) |
userdata
is a pointer to user data. See sanitizerPatchModule pc
is the program counter of the patched instruction ptr
is the address of the memory being accessed accessSize
is the size of the access in bytes. Valid values are 1, 2, 4, 8, and 16. flags
contains information about the type of access. See Sanitizer_DeviceMemoryFlags to interpret this value.
typedef SanitizerPatchResult(SANITIZERAPI * SanitizerCallbackRet)(void *userdata, uint64_t pc) |
userdata
is a pointer to user data. See sanitizerPatchModule pc
is the program counter of the patched instruction
typedef SanitizerPatchResult(SANITIZERAPI * SanitizerCallbackShfl)(void *userdata, uint64_t pc) |
userdata
is a pointer to user data. See sanitizerPatchModule pc
is the program counter of the patched instruction
typedef SanitizerPatchResult(SANITIZERAPI * SanitizerCallbackSyncwarp)(void *userdata, uint64_t pc, uint32_t mask) |
userdata
is a pointer to user data. See sanitizerPatchModule pc
is the program counter of the patched instruction mask
is the thread mask passed to __syncwarp().
Flags describing a memory access. These values are to be used in order to interpret the value of flags for a SanitizerCallbackMemoryAccess callback.
If neither LOCAL or SHARED flag is set, the access is made to global memory.
Instrumentation. Every entry represent an instruction type or a function call where a callback patch can be inserted.
enum SanitizerPatchResult |
Error and result codes returned by Sanitizer patches. If a patch returns with an error code different than SANITIZER_PATCH_SUCCESS, the thread will be exited.
SanitizerResult SANITIZERAPI sanitizerAddPatches | ( | const void * | image, | |
CUcontext | ctx | |||
) |
The patches loaded are only valid for the specified CUDA context.
image | Pointer to module data to load. This API supports the same module formats as the cuModuleLoadData and cuModuleLoadFatBinary functions from the CUDA driver API. | |
ctx | CUDA context in which to load the patches. If ctx is NULL, the current context will be used. |
SANITIZER_SUCCESS | on success | |
SANITIZER_ERROR_NOT_INITIALIZED | if unable to initialize the sanitizer | |
SANITIZER_ERROR_INVALID_PARAMETER | if image does not point to a valid CUDA module. |
SanitizerResult SANITIZERAPI sanitizerAddPatchesFromFile | ( | const char * | filename, | |
CUcontext | ctx | |||
) |
The patches loaded are only valid for the specified CUDA context.
filename | Path to the module file. This API supports the same module formats as the cuModuleLoad function from the CUDA driver API. | |
ctx | CUDA context in which to load the patches. If ctx is NULL, the current context will be used. |
SANITIZER_SUCCESS | on success | |
SANITIZER_ERROR_NOT_INITIALIZED | if unable to initialize the sanitizer | |
SANITIZER_ERROR_INVALID_PARAMETER | if filename is not a path to a valid CUDA module. |
SanitizerResult SANITIZERAPI sanitizerGetCallbackPcAndSize | ( | CUcontext | ctx, | |
const char * | deviceCallbackName, | |||
uint64_t * | pc, | |||
uint64_t * | size | |||
) |
[in] | ctx | CUDA context in which the patches were loaded. If ctx is NULL, the current context will be used. |
[in] | deviceCallbackName | device function callback name |
pc[out] | Callback PC returned | |
size[out] | Callback size returned |
SANITIZER_SUCCESS | on success | |
SANITIZER_ERROR_INVALID_PARAMETER | if if deviceCallbackName function cannot be located, if pc is NULL or if size is NULL. |
SanitizerResult SANITIZERAPI sanitizerPatchInstructions | ( | const Sanitizer_InstructionId | instructionId, | |
CUmodule | module, | |||
const char * | deviceCallbackName | |||
) |
Mark that all instrumentation points matching instructionId are to be patched in order to call the device function identified by deviceCallbackName. It is up to the API client to ensure that this device callback exists and match the correct callback format for this instrumentation point.
instructionId | Instrumentation point for which to insert patches | |
module | CUDA module to instrument | |
deviceCallbackName | Name of the device function callback that the inserted patch will call at the instrumented points. This function is expected to be found in code previously loaded by sanitizerAddPatchesFromFile or sanitizerAddPatches. |
SANITIZER_SUCCESS | on success | |
SANITIZER_ERROR_NOT_INITIALIZED | if unable to initialize the sanitizer | |
SANITIZER_ERROR_INVALID_PARAMETER | if module is not a CUDA module or if deviceCallbackName function cannot be located. |
SanitizerResult SANITIZERAPI sanitizerPatchModule | ( | CUmodule | module | ) |
Perform the instrumentation of a CUDA module based on previous calls to sanitizerPatchInstructions. This function also specifies the device memory buffer to be passed in as userdata to all callback functions.
module | CUDA module to instrument |
SANITIZER_SUCCESS | on success | |
SANITIZER_ERROR_INVALID_PARAMETER | if module is not a CUDA module |
SanitizerResult SANITIZERAPI sanitizerSetCallbackData | ( | CUstream | stream, | |
const void * | userdata | |||
) |
Mark all subsequent launches on stream
to use userdata
pointer as the device memory buffer to pass in to callback functions.
stream | CUDA stream to link to user data. Callbacks in subsequent launches on this stream will use userdata as callback data. Can be 0 to specify the NULL stream. | |
userdata | Device memory buffer. This data will be passed to callback functions via the userdata parameter. |
SANITIZER_SUCCESS | on success | |
SANITIZER_ERROR_INVALID_PARAMETER | if stream is not a CUDA stream |
SanitizerResult SANITIZERAPI sanitizerSetCallbackDataEx | ( | CUstream | stream, | |
const void * | userdata, | |||
Sanitizer_MemoryData * | memoryData | |||
) |
Mark all subsequent launches on stream
to use userdata
pointer as the device memory buffer to pass in to callback functions.
stream | CUDA stream to link to user data. Callbacks in subsequent launches on this stream will use userdata as callback data. Can be 0 to specify the NULL stream. | |
userdata | Device memory buffer. This data will be passed to callback functions via the userdata parameter. | |
memoryData | Extra parameters for the callback data setting |
SANITIZER_SUCCESS | on success | |
SANITIZER_ERROR_INVALID_PARAMETER | if stream is not a CUDA stream |
SanitizerResult SANITIZERAPI sanitizerUnpatchModule | ( | CUmodule | module | ) |
Remove any instrumentation of a CUDA module performed by previous calls to sanitizerPatchModule.
module | CUDA module on which to remove instrumentation |
SANITIZER_SUCCESS | on success |