typedef void(SANITIZERAPI * Sanitizer_CallbackFunc)(void *userdata, Sanitizer_CallbackDomain domain, Sanitizer_CallbackId cbid, const void *cbdata) |
Function type for a callback. The type of the data passed to the callback in cbdata
depends on the domain. If domain
is SANITIZER_CB_DOMAIN_DRIVER_API or SANITIZER_CB_DOMAIN_RUNTIME_API the type of cbdata
will be Sanitizer_CallbackData. If domain
is SANITIZER_CB_DOMAIN_RESOURCE the type of cbdata
will be dependent on cbid. Refer to Sanitizer_ResourceContextData, Sanitizer_ResourceStreamData, Sanitizer_ResourceModuleData and Sanitizer_ResourceMemoryFlags documentations. If domain
is SANITIZER_CB_DOMAIN_SYNCHRONIZE the type of cbdata
will be Sanitizer_SynchronizeData. If domain
is SANITIZER_CB_DOMAIN_LAUNCH the type of cbdata
will be Sanitizer_LaunchData. If domain
is SANITIZER_CB_DOMAIN_MEMCPY the type of cbdata
will be Sanitizer_MemcpyData. If domain
is SANITIZER_CB_DOMAIN_MEMSET the type of cbdata
will be Sanitizer_MemsetData. If domain
is SANITIZER_CB_DOMAIN_BATCH_MEMOP the type of cbdata
will be Sanitizer_BatchMemopData.
Specifies the type of batch memory operation reported by a callback in domain SANITIZER_CB_DOMAIN_BATCH_MEMOP. This value is communicated to the callback function via Sanitizer_BatchMemopData::type.
Callback IDs for resource domain SANITIZER_CB_DOMAIN_SYNCHRONIZE. This value is communicated to the callback function via the cbid
parameter.
Callback domain. Each domain represents callback points for a group of related API functions or CUDA driver activity.
Callback IDs for resource domain SANITIZER_CB_DOMAIN_EVENTS. This value is communicated to the callback function via the cbid
parameter. Available with a driver version of 515 or newer.
Callback IDs for resource domain SANITIZER_CB_DOMAIN_EXTERNA_MEMORY. This value is communicated to the callback function via the cbid
parameter. Available with a driver version of 535 or newer.
Callback IDs for resource domain SANITIZER_CB_DOMAIN_GRAPHS. This value is communicated to the callback function via the cbid
parameter.
Callback IDs for resource domain SANITIZER_CB_DOMAIN_LAUNCH. This value is communicated to the callback function via the cbid
parameter.
Callback IDs for resource domain SANITIZER_CB_DOMAIN_RESOURCE. This value is communicated to the callback function via the cbid
parameter.
Callback IDs for resource domain SANITIZER_CB_DOMAIN_UVM. This value is communicated to the callback function via the cbid
parameter.
Indicates the direction of a memcpy, passed inside Sanitizer_Memcpydata
.
Specifies the visibility of an allocation. This is typically GLOBAL on allocations made via cudaMalloc, cudaHostAlloc and similar APIs. This can be GLOBAL or HOST for cudaMallocManaged allocations depending on the flags parameter. This can be changed after allocation time using cudaMemAttachSingle API (see SANITIZER_CBID_UVM_ATTACH_MEM for the corresponding callback).
Flags describing a memory allocation. These values are to be used in order to interpret the value of Sanitizer_ResourceMemoryData::flags
Permissions for a memory allocation. These values are to be used in order to interpret the value of Sanitizer_ResourceMemoryData::permissions
SanitizerResult SANITIZERAPI sanitizerEnableAllDomains | ( | uint32_t | enable, | |
Sanitizer_SubscriberHandle | subscriber | |||
) |
Enable or disable all callbacks in all domains.
enable | New enable state for all callbacks in all domains. Zero disables all callbacks, non-zero enables all callbacks. | |
subscriber | - Handle of the initialized subscriber |
SANITIZER_SUCCESS | on success | |
SANITIZER_ERROR_NOT_INITIALIZED | if unable to initialize the sanitizer | |
SANITIZER_ERROR_INVALID_PARAMETER | if subscriber is invalid |
SanitizerResult SANITIZERAPI sanitizerEnableCallback | ( | uint32_t | enable, | |
Sanitizer_SubscriberHandle | subscriber, | |||
Sanitizer_CallbackDomain | domain, | |||
Sanitizer_CallbackId | cbid | |||
) |
Enable or disable callbacks for a subscriber for a specific domain and callback ID.
enable | New enable state for the callback. Zero disables the callback, non-zero enables the callback | |
subscriber | - Handle of the initialized subscriber | |
domain | The domain of the callback | |
cbid | The ID of the callback |
SANITIZER_SUCCESS | on success | |
SANITIZER_ERROR_NOT_INITIALIZED | if unable to initialize the sanitizer | |
SANITIZER_ERROR_INVALID_PARAMETER | if subscriber , domain or cbid is invalid |
SanitizerResult SANITIZERAPI sanitizerEnableDomain | ( | uint32_t | enable, | |
Sanitizer_SubscriberHandle | subscriber, | |||
Sanitizer_CallbackDomain | domain | |||
) |
Enable or disable all callbacks for a specific domain.
enable | New enable state for all callbacks in the domain. Zero disables all callbacks, non-zero enables all callbacks | |
subscriber | - Handle of the initialized subscriber | |
domain | The domain of the callback |
SANITIZER_SUCCESS | on success | |
SANITIZER_ERROR_NOT_INITIALIZED | if unable to initialize the sanitizer | |
SANITIZER_ERROR_INVALID_PARAMETER | if subscriber or domain is invalid |
SanitizerResult SANITIZERAPI sanitizerGetCallbackState | ( | uint32_t * | enable, | |
Sanitizer_SubscriberHandle | subscriber, | |||
Sanitizer_CallbackDomain | domain, | |||
Sanitizer_CallbackId | cbid | |||
) |
Returns non-zero in *enable
if the callback for a domain and callback ID is enabled, and zero if not enabled.
enable | Returns non-zero if callback enabled, zero if not enabled | |
subscriber | Handle to the initialized subscriber | |
domain | The domain of the callback | |
cbid | The ID of the callback |
SANITIZER_SUCCESS | on success | |
SANITIZER_ERROR_NOT_INITIALIZED | if unable to initialize the sanitizer | |
SANITIZER_ERROR_INVALID_PARAMETER | if enabled is NULL, or if subscriber , domain or cbid is invalid. |
SanitizerResult SANITIZERAPI sanitizerSubscribe | ( | Sanitizer_SubscriberHandle * | subscriber, | |
Sanitizer_CallbackFunc | callback, | |||
void * | userdata | |||
) |
Initialize a callback subscriber with a callback function and (optionally) a pointer to user data. The returned subscriber handle can be used to enable and disable the callback for specific domains and callback IDs.
This function does not enable any callbacks.
Thread-safety: this function is thread safe.
subscriber | Returns handle to initialize subscriber | |
callback | The callback function | |
userdata | A pointer to user data. This data will be passed to the callback function via the userdata parameter |
SANITIZER_SUCCESS | on success | |
SANITIZER_ERROR_NOT_INITIALIZED | if unable to initialize the sanitizer | |
SANITIZER_ERROR_MAX_LIMIT_RACHED | if there is already a sanitizer subscriber | |
SANITIZER_ERROR_INVALID_PARAMETER | if subscriber is NULL |
SanitizerResult SANITIZERAPI sanitizerUnsubscribe | ( | Sanitizer_SubscriberHandle | subscriber | ) |
Removes a callback subscriber so that no future callback will be issued to that subscriber.
subscriber | Handle to the initialized subscriber |
SANITIZER_SUCCESS | on success | |
SANITIZER_ERROR_NOT_INITIALIZED | if unable to initialize the sanitizer | |
SANITIZER_ERROR_INVALID_PARAMETER | if subscriber is NULL or not initialized |