From 6456cd652aa1872b0467926d3e17f46dbc17a329 Mon Sep 17 00:00:00 2001 From: Clemens Lutz Date: Wed, 6 Oct 2021 20:15:42 +0200 Subject: [PATCH] Add NVIDIA Tools Extension wrapper The [NVTX library](https://docs.nvidia.com/cuda/profiler-users-guide/index.html#nvtx) integrates the program under test with tools such as NVVP and nvprof. NVTX is packaged together with the standard CUDA libraries. Thus, this commit adds a bindgen wrapper for the NVTX library as `nvtx-sys`. --- Cargo.toml | 1 + bindgen.sh | 16 + nvtx-sys/Cargo.toml | 20 + nvtx-sys/bindgen.sh | 16 + nvtx-sys/build.rs | 18 + nvtx-sys/src/lib.rs | 18 + nvtx-sys/src/nv_tools_ext.rs | 728 +++++++++++++++++++++++++++++++++++ 7 files changed, 817 insertions(+) create mode 100755 bindgen.sh create mode 100644 nvtx-sys/Cargo.toml create mode 100755 nvtx-sys/bindgen.sh create mode 100644 nvtx-sys/build.rs create mode 100644 nvtx-sys/src/lib.rs create mode 100644 nvtx-sys/src/nv_tools_ext.rs diff --git a/Cargo.toml b/Cargo.toml index 964716d..4d848bf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,4 +4,5 @@ members = [ "cuda-config", "cuda-driver-sys", "cuda-runtime-sys", + "nvtx-sys", ] diff --git a/bindgen.sh b/bindgen.sh new file mode 100755 index 0000000..b0c60a8 --- /dev/null +++ b/bindgen.sh @@ -0,0 +1,16 @@ +#!/bin/bash +set -exu + +bindgen \ + --whitelist-type="^nvtx.*" \ + --whitelist-var="^nvtx.*" \ + --whitelist-function="^nvtx.*" \ + --default-enum-style=rust \ + --no-doc-comments \ + --with-derive-default \ + --with-derive-eq \ + --with-derive-hash \ + --with-derive-ord \ + --size_t-is-usize \ + "$CUDA_PATH/include/nvToolsExt.h" \ + > src/nv_tools_ext.rs diff --git a/nvtx-sys/Cargo.toml b/nvtx-sys/Cargo.toml new file mode 100644 index 0000000..d99afa9 --- /dev/null +++ b/nvtx-sys/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "nvtx-sys" +version = "0.3.0-alpha.0" +authors = ["Toshiki Teramura ", "Clemens Lutz "] +edition = "2018" + +build = "build.rs" +links = "nvToolsExt" + +description = "Rust binding to NVIDIA Tools Extension Library" +documentation = "https://docs.rs/nvtx-sys/" +repository = "https://github.com/rust-cuda/cuda-sys" +keywords = ["GPGPU", "CUDA", "ffi"] +license = "MIT/Apache-2.0" +readme = "../README.md" +categories = [] + +[build-dependencies.cuda-config] +path = "../cuda-config" +version = "0.1.0" diff --git a/nvtx-sys/bindgen.sh b/nvtx-sys/bindgen.sh new file mode 100755 index 0000000..b0c60a8 --- /dev/null +++ b/nvtx-sys/bindgen.sh @@ -0,0 +1,16 @@ +#!/bin/bash +set -exu + +bindgen \ + --whitelist-type="^nvtx.*" \ + --whitelist-var="^nvtx.*" \ + --whitelist-function="^nvtx.*" \ + --default-enum-style=rust \ + --no-doc-comments \ + --with-derive-default \ + --with-derive-eq \ + --with-derive-hash \ + --with-derive-ord \ + --size_t-is-usize \ + "$CUDA_PATH/include/nvToolsExt.h" \ + > src/nv_tools_ext.rs diff --git a/nvtx-sys/build.rs b/nvtx-sys/build.rs new file mode 100644 index 0000000..63ac67b --- /dev/null +++ b/nvtx-sys/build.rs @@ -0,0 +1,18 @@ +use cuda_config::*; + +fn main() { + if cfg!(target_os = "windows") { + println!( + "cargo:rustc-link-search=native={}", + find_cuda_windows().display() + ); + } else { + for path in find_cuda() { + println!("cargo:rustc-link-search=native={}", path.display()); + } + }; + + println!("cargo:rustc-link-lib=dylib=nvToolsExt"); + println!("cargo:rerun-if-changed=build.rs"); + println!("cargo:rerun-if-env-changed=CUDA_LIBRARY_PATH"); +} diff --git a/nvtx-sys/src/lib.rs b/nvtx-sys/src/lib.rs new file mode 100644 index 0000000..38d8cdb --- /dev/null +++ b/nvtx-sys/src/lib.rs @@ -0,0 +1,18 @@ +#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow(deref_nullptr)] // https://github.com/rust-lang/rust-bindgen/issues/1651 +include!("nv_tools_ext.rs"); + +#[cfg(test)] +mod tests { + use super::*; + use std::ffi::CStr; + + // not a test for cublas initialization, but a test for linking cublasCreate_v2 + #[test] + fn link_test() { + unsafe { + let name = CStr::from_bytes_with_nul_unchecked(b"my mark\0"); + nvtxMarkA(name.as_ptr()); + } + } +} diff --git a/nvtx-sys/src/nv_tools_ext.rs b/nvtx-sys/src/nv_tools_ext.rs new file mode 100644 index 0000000..24cbfb1 --- /dev/null +++ b/nvtx-sys/src/nv_tools_ext.rs @@ -0,0 +1,728 @@ +/* automatically generated by rust-bindgen 0.59.1 */ + +pub type __uint16_t = ::std::os::raw::c_ushort; +pub type __int32_t = ::std::os::raw::c_int; +pub type __uint32_t = ::std::os::raw::c_uint; +pub type __int64_t = ::std::os::raw::c_long; +pub type __uint64_t = ::std::os::raw::c_ulong; +pub type wchar_t = ::std::os::raw::c_int; +pub type nvtxRangeId_t = u64; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct nvtxStringHandle { + _unused: [u8; 0], +} +pub type nvtxStringHandle_t = *mut nvtxStringHandle; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct nvtxDomainHandle { + _unused: [u8; 0], +} +pub type nvtxDomainHandle_t = *mut nvtxDomainHandle; +#[repr(u32)] +#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +pub enum nvtxColorType_t { + NVTX_COLOR_UNKNOWN = 0, + NVTX_COLOR_ARGB = 1, +} +#[repr(u32)] +#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +pub enum nvtxMessageType_t { + NVTX_MESSAGE_UNKNOWN = 0, + NVTX_MESSAGE_TYPE_ASCII = 1, + NVTX_MESSAGE_TYPE_UNICODE = 2, + NVTX_MESSAGE_TYPE_REGISTERED = 3, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union nvtxMessageValue_t { + pub ascii: *const ::std::os::raw::c_char, + pub unicode: *const wchar_t, + pub registered: nvtxStringHandle_t, +} +#[test] +fn bindgen_test_layout_nvtxMessageValue_t() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(nvtxMessageValue_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(nvtxMessageValue_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ascii as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(nvtxMessageValue_t), + "::", + stringify!(ascii) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).unicode as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(nvtxMessageValue_t), + "::", + stringify!(unicode) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).registered as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(nvtxMessageValue_t), + "::", + stringify!(registered) + ) + ); +} +impl Default for nvtxMessageValue_t { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +#[repr(u32)] +#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +pub enum nvtxInitializationMode_t { + NVTX_INITIALIZATION_MODE_UNKNOWN = 0, + NVTX_INITIALIZATION_MODE_CALLBACK_V1 = 1, + NVTX_INITIALIZATION_MODE_CALLBACK_V2 = 2, + NVTX_INITIALIZATION_MODE_SIZE = 3, +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +pub struct nvtxInitializationAttributes_v2 { + pub version: u16, + pub size: u16, + pub mode: u32, + pub fnptr: ::std::option::Option, +} +#[test] +fn bindgen_test_layout_nvtxInitializationAttributes_v2() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(nvtxInitializationAttributes_v2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(nvtxInitializationAttributes_v2)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).version as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(nvtxInitializationAttributes_v2), + "::", + stringify!(version) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).size as *const _ as usize + }, + 2usize, + concat!( + "Offset of field: ", + stringify!(nvtxInitializationAttributes_v2), + "::", + stringify!(size) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).mode as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(nvtxInitializationAttributes_v2), + "::", + stringify!(mode) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).fnptr as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(nvtxInitializationAttributes_v2), + "::", + stringify!(fnptr) + ) + ); +} +pub type nvtxInitializationAttributes_t = nvtxInitializationAttributes_v2; +extern "C" { + pub fn nvtxInitialize( + initAttrib: *const nvtxInitializationAttributes_t, + ) -> ::std::os::raw::c_int; +} +#[repr(u32)] +#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +pub enum nvtxPayloadType_t { + NVTX_PAYLOAD_UNKNOWN = 0, + NVTX_PAYLOAD_TYPE_UNSIGNED_INT64 = 1, + NVTX_PAYLOAD_TYPE_INT64 = 2, + NVTX_PAYLOAD_TYPE_DOUBLE = 3, + NVTX_PAYLOAD_TYPE_UNSIGNED_INT32 = 4, + NVTX_PAYLOAD_TYPE_INT32 = 5, + NVTX_PAYLOAD_TYPE_FLOAT = 6, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct nvtxEventAttributes_v2 { + pub version: u16, + pub size: u16, + pub category: u32, + pub colorType: i32, + pub color: u32, + pub payloadType: i32, + pub reserved0: i32, + pub payload: nvtxEventAttributes_v2_payload_t, + pub messageType: i32, + pub message: nvtxMessageValue_t, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union nvtxEventAttributes_v2_payload_t { + pub ullValue: u64, + pub llValue: i64, + pub dValue: f64, + pub uiValue: u32, + pub iValue: i32, + pub fValue: f32, +} +#[test] +fn bindgen_test_layout_nvtxEventAttributes_v2_payload_t() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(nvtxEventAttributes_v2_payload_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(nvtxEventAttributes_v2_payload_t) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ullValue as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(nvtxEventAttributes_v2_payload_t), + "::", + stringify!(ullValue) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).llValue as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(nvtxEventAttributes_v2_payload_t), + "::", + stringify!(llValue) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dValue as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(nvtxEventAttributes_v2_payload_t), + "::", + stringify!(dValue) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).uiValue as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(nvtxEventAttributes_v2_payload_t), + "::", + stringify!(uiValue) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).iValue as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(nvtxEventAttributes_v2_payload_t), + "::", + stringify!(iValue) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).fValue as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(nvtxEventAttributes_v2_payload_t), + "::", + stringify!(fValue) + ) + ); +} +impl Default for nvtxEventAttributes_v2_payload_t { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +#[test] +fn bindgen_test_layout_nvtxEventAttributes_v2() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(nvtxEventAttributes_v2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(nvtxEventAttributes_v2)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).version as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(nvtxEventAttributes_v2), + "::", + stringify!(version) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).size as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(nvtxEventAttributes_v2), + "::", + stringify!(size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).category as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(nvtxEventAttributes_v2), + "::", + stringify!(category) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).colorType as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(nvtxEventAttributes_v2), + "::", + stringify!(colorType) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).color as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(nvtxEventAttributes_v2), + "::", + stringify!(color) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).payloadType as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(nvtxEventAttributes_v2), + "::", + stringify!(payloadType) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).reserved0 as *const _ as usize + }, + 20usize, + concat!( + "Offset of field: ", + stringify!(nvtxEventAttributes_v2), + "::", + stringify!(reserved0) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).payload as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(nvtxEventAttributes_v2), + "::", + stringify!(payload) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).messageType as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(nvtxEventAttributes_v2), + "::", + stringify!(messageType) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).message as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(nvtxEventAttributes_v2), + "::", + stringify!(message) + ) + ); +} +impl Default for nvtxEventAttributes_v2 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type nvtxEventAttributes_t = nvtxEventAttributes_v2; +extern "C" { + pub fn nvtxDomainMarkEx(domain: nvtxDomainHandle_t, eventAttrib: *const nvtxEventAttributes_t); +} +extern "C" { + pub fn nvtxMarkEx(eventAttrib: *const nvtxEventAttributes_t); +} +extern "C" { + pub fn nvtxMarkA(message: *const ::std::os::raw::c_char); +} +extern "C" { + pub fn nvtxMarkW(message: *const wchar_t); +} +extern "C" { + pub fn nvtxDomainRangeStartEx( + domain: nvtxDomainHandle_t, + eventAttrib: *const nvtxEventAttributes_t, + ) -> nvtxRangeId_t; +} +extern "C" { + pub fn nvtxRangeStartEx(eventAttrib: *const nvtxEventAttributes_t) -> nvtxRangeId_t; +} +extern "C" { + pub fn nvtxRangeStartA(message: *const ::std::os::raw::c_char) -> nvtxRangeId_t; +} +extern "C" { + pub fn nvtxRangeStartW(message: *const wchar_t) -> nvtxRangeId_t; +} +extern "C" { + pub fn nvtxDomainRangeEnd(domain: nvtxDomainHandle_t, id: nvtxRangeId_t); +} +extern "C" { + pub fn nvtxRangeEnd(id: nvtxRangeId_t); +} +extern "C" { + pub fn nvtxDomainRangePushEx( + domain: nvtxDomainHandle_t, + eventAttrib: *const nvtxEventAttributes_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn nvtxRangePushEx(eventAttrib: *const nvtxEventAttributes_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn nvtxRangePushA(message: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn nvtxRangePushW(message: *const wchar_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn nvtxDomainRangePop(domain: nvtxDomainHandle_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn nvtxRangePop() -> ::std::os::raw::c_int; +} +#[repr(u32)] +#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +pub enum nvtxResourceGenericType_t { + NVTX_RESOURCE_TYPE_UNKNOWN = 0, + NVTX_RESOURCE_TYPE_GENERIC_POINTER = 65537, + NVTX_RESOURCE_TYPE_GENERIC_HANDLE = 65538, + NVTX_RESOURCE_TYPE_GENERIC_THREAD_NATIVE = 65539, + NVTX_RESOURCE_TYPE_GENERIC_THREAD_POSIX = 65540, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct nvtxResourceAttributes_v0 { + pub version: u16, + pub size: u16, + pub identifierType: i32, + pub identifier: nvtxResourceAttributes_v0_identifier_t, + pub messageType: i32, + pub message: nvtxMessageValue_t, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union nvtxResourceAttributes_v0_identifier_t { + pub pValue: *const ::std::os::raw::c_void, + pub ullValue: u64, +} +#[test] +fn bindgen_test_layout_nvtxResourceAttributes_v0_identifier_t() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!( + "Size of: ", + stringify!(nvtxResourceAttributes_v0_identifier_t) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(nvtxResourceAttributes_v0_identifier_t) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pValue as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(nvtxResourceAttributes_v0_identifier_t), + "::", + stringify!(pValue) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ullValue as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(nvtxResourceAttributes_v0_identifier_t), + "::", + stringify!(ullValue) + ) + ); +} +impl Default for nvtxResourceAttributes_v0_identifier_t { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +#[test] +fn bindgen_test_layout_nvtxResourceAttributes_v0() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(nvtxResourceAttributes_v0)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(nvtxResourceAttributes_v0)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).version as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(nvtxResourceAttributes_v0), + "::", + stringify!(version) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).size as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(nvtxResourceAttributes_v0), + "::", + stringify!(size) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).identifierType as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(nvtxResourceAttributes_v0), + "::", + stringify!(identifierType) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).identifier as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(nvtxResourceAttributes_v0), + "::", + stringify!(identifier) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).messageType as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(nvtxResourceAttributes_v0), + "::", + stringify!(messageType) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).message as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(nvtxResourceAttributes_v0), + "::", + stringify!(message) + ) + ); +} +impl Default for nvtxResourceAttributes_v0 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type nvtxResourceAttributes_t = nvtxResourceAttributes_v0; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct nvtxResourceHandle { + _unused: [u8; 0], +} +pub type nvtxResourceHandle_t = *mut nvtxResourceHandle; +extern "C" { + pub fn nvtxDomainResourceCreate( + domain: nvtxDomainHandle_t, + attribs: *mut nvtxResourceAttributes_t, + ) -> nvtxResourceHandle_t; +} +extern "C" { + pub fn nvtxDomainResourceDestroy(resource: nvtxResourceHandle_t); +} +extern "C" { + pub fn nvtxDomainNameCategoryA( + domain: nvtxDomainHandle_t, + category: u32, + name: *const ::std::os::raw::c_char, + ); +} +extern "C" { + pub fn nvtxDomainNameCategoryW(domain: nvtxDomainHandle_t, category: u32, name: *const wchar_t); +} +extern "C" { + pub fn nvtxNameCategoryA(category: u32, name: *const ::std::os::raw::c_char); +} +extern "C" { + pub fn nvtxNameCategoryW(category: u32, name: *const wchar_t); +} +extern "C" { + pub fn nvtxNameOsThreadA(threadId: u32, name: *const ::std::os::raw::c_char); +} +extern "C" { + pub fn nvtxNameOsThreadW(threadId: u32, name: *const wchar_t); +} +extern "C" { + pub fn nvtxDomainRegisterStringA( + domain: nvtxDomainHandle_t, + string: *const ::std::os::raw::c_char, + ) -> nvtxStringHandle_t; +} +extern "C" { + pub fn nvtxDomainRegisterStringW( + domain: nvtxDomainHandle_t, + string: *const wchar_t, + ) -> nvtxStringHandle_t; +} +extern "C" { + pub fn nvtxDomainCreateA(name: *const ::std::os::raw::c_char) -> nvtxDomainHandle_t; +} +extern "C" { + pub fn nvtxDomainCreateW(name: *const wchar_t) -> nvtxDomainHandle_t; +} +extern "C" { + pub fn nvtxDomainDestroy(domain: nvtxDomainHandle_t); +}