From 4e1e6545970398f5860f63168e26be18b4e53607 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Iooss?= Date: Sat, 16 Nov 2024 14:25:28 +0100 Subject: [PATCH] feat(nvtx): add nvtx wrapper, for a specific cuda version, as POC --- Cargo.toml | 1 + README.md | 4 +- build.rs | 52 + examples/nvtx-range.rs | 21 + run-bindgen.sh | 2 +- src/lib.rs | 9 +- src/nvtx/mod.rs | 8 + src/nvtx/safe.rs | 119 +++ src/nvtx/sys/bindgen.sh | 24 + src/nvtx/sys/extern.c | 42 + src/nvtx/sys/mod.rs | 59 ++ src/nvtx/sys/sys_12040.rs | 2005 +++++++++++++++++++++++++++++++++++++ src/nvtx/sys/wrapper.h | 1 + 13 files changed, 2344 insertions(+), 3 deletions(-) create mode 100644 examples/nvtx-range.rs create mode 100644 src/nvtx/mod.rs create mode 100644 src/nvtx/safe.rs create mode 100755 src/nvtx/sys/bindgen.sh create mode 100644 src/nvtx/sys/extern.c create mode 100644 src/nvtx/sys/mod.rs create mode 100644 src/nvtx/sys/sys_12040.rs create mode 100644 src/nvtx/sys/wrapper.h diff --git a/Cargo.toml b/Cargo.toml index c64b1a24..f5732c6d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,6 +49,7 @@ cublaslt = ["driver"] cudnn = ["driver"] curand = ["driver"] nccl = ["driver"] +nvtx = [] std = [] no-std = ["no-std-compat/std", "dep:spin"] diff --git a/README.md b/README.md index 76c6293b..ec1c6500 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,9 @@ Safe abstractions over: 4. [cuBLAS API](https://docs.nvidia.com/cuda/cublas/index.html) 5. [cuBLASLt API](https://docs.nvidia.com/cuda/cublas/#using-the-cublaslt-api) 6. [NCCL API](https://docs.nvidia.com/deeplearning/nccl/user-guide/docs/) - +7. [cuDNN](https://docs.nvidia.com/cudnn/index.html) +8. [nvtx](https://github.com/NVIDIA/NVTX) + **Pre-alpha state**, expect breaking changes and not all cuda functions contain a safe wrapper. **Contributions welcome for any that aren't included!** diff --git a/build.rs b/build.rs index c3451544..b5bce6b9 100644 --- a/build.rs +++ b/build.rs @@ -47,6 +47,58 @@ fn main() { #[cfg(feature = "dynamic-linking")] dynamic_linking(major, minor); + + #[cfg(feature = "nvtx")] + nvtx(); +} + +#[allow(unused)] +fn nvtx() { + let output_path = PathBuf::from(std::env::var("OUT_DIR").unwrap()); + let obj_path = output_path.join("extern.o"); + let clang_output = std::process::Command::new("clang") + .arg("-O") + .arg("-c") + .arg("-o") + .arg(&obj_path) + .arg("-I/usr/local/cuda/include") + .arg("src/nvtx/sys/extern.c") + .output() + .unwrap(); + + if !clang_output.status.success() { + panic!( + "Could not compile object file:\n{}", + String::from_utf8_lossy(&clang_output.stderr) + ); + } + + // Turn the object file into a static library + #[cfg(not(target_os = "windows"))] + let lib_output = std::process::Command::new("ar") + .arg("rcs") + .arg(output_path.join("libextern.a")) + .arg(obj_path) + .output() + .unwrap(); + #[cfg(target_os = "windows")] + let lib_output = std::process::Command::new("LIB") + .arg(obj_path) + .arg(format!("/OUT:{}", output_path.join("libextern.lib").display())) + .output() + .unwrap(); + if !lib_output.status.success() { + panic!( + "Could not emit library file:\n{}", + String::from_utf8_lossy(&lib_output.stderr) + ); + } + + // Tell cargo to statically link against the `libextern` static library. + let output_path = output_path.as_os_str().to_str().unwrap(); + println!("cargo:rustc-link-search=native={output_path}"); + println!("cargo:rustc-link-lib=static=extern"); + } #[allow(unused)] diff --git a/examples/nvtx-range.rs b/examples/nvtx-range.rs new file mode 100644 index 00000000..8c7050f4 --- /dev/null +++ b/examples/nvtx-range.rs @@ -0,0 +1,21 @@ +use cudarc::nvtx::safe::{mark, range_end, range_pop, range_push, range_start}; + + +fn main() { + range_push("Test Range"); + std::thread::sleep(std::time::Duration::from_secs(1)); + range_pop(); + + range_push("Test Range2"); + std::thread::sleep(std::time::Duration::from_secs(1)); + range_push("Test Range3"); + std::thread::sleep(std::time::Duration::from_secs(1)); + range_pop(); + range_pop(); + + let id = range_start("Test Range4"); + std::thread::sleep(std::time::Duration::from_secs(1)); + mark("Test Mark"); + std::thread::sleep(std::time::Duration::from_secs(1)); + range_end(id); +} diff --git a/run-bindgen.sh b/run-bindgen.sh index 3124d602..d2ab85f9 100644 --- a/run-bindgen.sh +++ b/run-bindgen.sh @@ -1,4 +1,4 @@ -declare -a modules=("cublas" "cublaslt" "cudnn" "curand" "driver" "nccl" "nvrtc") +declare -a modules=("cublas" "cublaslt" "cudnn" "curand" "driver" "nccl" "nvrtc" "nvtx") for path in "${modules[@]}" do cd src/${path}/sys diff --git a/src/lib.rs b/src/lib.rs index 3333bc39..d64d6a6c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,6 +3,11 @@ //! 2. [NVRTC API](https://docs.nvidia.com/cuda/nvrtc/index.html) //! 3. [cuRAND API](https://docs.nvidia.com/cuda/curand/index.html) //! 4. [cuBLAS API](https://docs.nvidia.com/cuda/cublas/index.html) +//! 5. [cuBLASLt API](https://docs.nvidia.com/cuda/cublas/#using-the-cublaslt-api) +//! 6. [NCCL API](https://docs.nvidia.com/deeplearning/nccl/user-guide/docs/) +//! 7. [cuDNN](https://docs.nvidia.com/cudnn/index.html) +//! 8. [nvtx](https://github.com/NVIDIA/NVTX) + //! //! # crate organization //! @@ -18,7 +23,7 @@ //! | cublaslt | [cublaslt::safe] | [cublaslt::result] | [cublaslt::sys] | //! | nvrtc | [nvrtc::safe] | [nvrtc::result] | [nvrtc::sys] | //! | curand | [curand::safe] | [curand::result] | [curand::sys] | -//! | cudnn | - | [cudnn::result] | [cudnn::sys] | +//! | cudnn | [cudnn::safe] | [cudnn::result] | [cudnn::sys] | //! //! # Core Concepts //! @@ -91,6 +96,8 @@ pub mod driver; pub mod nccl; #[cfg(feature = "nvrtc")] pub mod nvrtc; +#[cfg(feature = "nvtx")] +pub mod nvtx; pub mod types; diff --git a/src/nvtx/mod.rs b/src/nvtx/mod.rs new file mode 100644 index 00000000..d7676e8b --- /dev/null +++ b/src/nvtx/mod.rs @@ -0,0 +1,8 @@ +//! Wrappers around the [NVTX API](https://nvidia.github.io/NVTX/doxygen/index.html) +//! in two levels. See crate documentation for description of each. + +pub mod safe; +#[allow(warnings)] +pub mod sys; + +pub use safe::*; diff --git a/src/nvtx/safe.rs b/src/nvtx/safe.rs new file mode 100644 index 00000000..99fc6afb --- /dev/null +++ b/src/nvtx/safe.rs @@ -0,0 +1,119 @@ +use super::sys::{ + nvtxInitialize, nvtxMarkA, nvtxNameCategoryA, nvtxNameCuContextA, nvtxNameCuDeviceA, + nvtxNameCuEventA, nvtxNameCuStreamA, nvtxNameOsThreadA, nvtxRangeEnd, nvtxRangePop, + nvtxRangePushA, nvtxRangeStartA, CUcontext, CUevent, CUstream, +}; +use std::ffi::CString; + +pub fn range_push(message: &str) -> i32 { + unsafe { + let message = CString::new(message).unwrap(); + nvtxRangePushA(message.as_ptr()) + } +} + +pub fn range_pop() -> i32 { + unsafe { nvtxRangePop() } +} + +pub fn range_start(message: &str) -> u64 { + unsafe { + let message = CString::new(message).unwrap(); + nvtxRangeStartA(message.as_ptr()) + } +} + +pub fn range_end(range_id: u64) { + unsafe { + nvtxRangeEnd(range_id); + } +} + +pub fn mark(message: &str) { + unsafe { + let message = CString::new(message).unwrap(); + nvtxMarkA(message.as_ptr()); + } +} + +pub fn name_category(category: u32, name: &str) { + unsafe { + let name = CString::new(name).unwrap(); + nvtxNameCategoryA(category, name.as_ptr()); + } +} + +pub fn name_os_thread(os_thread_id: u32, name: &str) { + unsafe { + let name = CString::new(name).unwrap(); + nvtxNameOsThreadA(os_thread_id, name.as_ptr()); + } +} + +pub fn name_cu_device(cu_device: i32, name: &str) { + unsafe { + let name = CString::new(name).unwrap(); + nvtxNameCuDeviceA(cu_device, name.as_ptr()); + } +} + +pub fn name_cu_context(cu_context: CUcontext, name: &str) { + unsafe { + let name = CString::new(name).unwrap(); + nvtxNameCuContextA(cu_context, name.as_ptr()); + } +} + +pub fn name_cu_stream(cu_stream: CUstream, name: &str) { + unsafe { + let name = CString::new(name).unwrap(); + nvtxNameCuStreamA(cu_stream, name.as_ptr()); + } +} + +pub fn name_cu_event(cu_event: CUevent, name: &str) { + unsafe { + let name = CString::new(name).unwrap(); + nvtxNameCuEventA(cu_event, name.as_ptr()); + } +} + +pub fn initialize() { + unsafe { + // according to the doc, reserved "must be zero or NULL." + let reserved = std::ptr::null_mut(); + nvtxInitialize(reserved); + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_range_push() { + range_push("Test Range"); + // Add assertions here + } + + #[test] + fn test_range_pop() { + range_pop(); + // Add assertions here + } + + #[test] + fn test_name_cuda_event() { + let cuda_event: CUevent = std::ptr::null_mut(); + name_cu_event(cuda_event, "Test Event"); + // Add assertions here + } + + #[test] + fn test_initialize() { + initialize(); + // Add assertions here + } + + // Add more tests here +} diff --git a/src/nvtx/sys/bindgen.sh b/src/nvtx/sys/bindgen.sh new file mode 100755 index 00000000..8eb74f66 --- /dev/null +++ b/src/nvtx/sys/bindgen.sh @@ -0,0 +1,24 @@ +#!/bin/bash +set -exu + +# Follow https://github.com/rust-lang/rust-bindgen/discussions/2405 +bindgen \ + --allowlist-var="^CUDA_VERSION.*" \ + --allowlist-type="^nvtx.*" \ + --allowlist-function="^nvtx.*" \ + --default-enum-style=rust \ + --no-doc-comments \ + --with-derive-default \ + --with-derive-eq \ + --with-derive-hash \ + --with-derive-ord \ + --use-core \ + --wrap-static-fns \ + --experimental \ + wrapper.h -- -I/usr/local/cuda/include \ + > tmp.rs + +mv /tmp/bindgen/extern.c . + +CUDA_VERSION=$(cat tmp.rs | grep "CUDA_VERSION" | awk '{ print $6 }' | sed 's/.$//') +mv tmp.rs sys_${CUDA_VERSION}.rs diff --git a/src/nvtx/sys/extern.c b/src/nvtx/sys/extern.c new file mode 100644 index 00000000..fb246fdb --- /dev/null +++ b/src/nvtx/sys/extern.c @@ -0,0 +1,42 @@ +#include "wrapper.h" + +// Static wrappers + +void nvtxInitialize__extern(const void *reserved) { nvtxInitialize(reserved); } +void nvtxDomainMarkEx__extern(nvtxDomainHandle_t domain, const nvtxEventAttributes_t *eventAttrib) { nvtxDomainMarkEx(domain, eventAttrib); } +void nvtxMarkEx__extern(const nvtxEventAttributes_t *eventAttrib) { nvtxMarkEx(eventAttrib); } +void nvtxMarkA__extern(const char *message) { nvtxMarkA(message); } +void nvtxMarkW__extern(const wchar_t *message) { nvtxMarkW(message); } +nvtxRangeId_t nvtxDomainRangeStartEx__extern(nvtxDomainHandle_t domain, const nvtxEventAttributes_t *eventAttrib) { return nvtxDomainRangeStartEx(domain, eventAttrib); } +nvtxRangeId_t nvtxRangeStartEx__extern(const nvtxEventAttributes_t *eventAttrib) { return nvtxRangeStartEx(eventAttrib); } +nvtxRangeId_t nvtxRangeStartA__extern(const char *message) { return nvtxRangeStartA(message); } +nvtxRangeId_t nvtxRangeStartW__extern(const wchar_t *message) { return nvtxRangeStartW(message); } +void nvtxDomainRangeEnd__extern(nvtxDomainHandle_t domain, nvtxRangeId_t id) { nvtxDomainRangeEnd(domain, id); } +void nvtxRangeEnd__extern(nvtxRangeId_t id) { nvtxRangeEnd(id); } +int nvtxDomainRangePushEx__extern(nvtxDomainHandle_t domain, const nvtxEventAttributes_t *eventAttrib) { return nvtxDomainRangePushEx(domain, eventAttrib); } +int nvtxRangePushEx__extern(const nvtxEventAttributes_t *eventAttrib) { return nvtxRangePushEx(eventAttrib); } +int nvtxRangePushA__extern(const char *message) { return nvtxRangePushA(message); } +int nvtxRangePushW__extern(const wchar_t *message) { return nvtxRangePushW(message); } +int nvtxDomainRangePop__extern(nvtxDomainHandle_t domain) { return nvtxDomainRangePop(domain); } +int nvtxRangePop__extern(void) { return nvtxRangePop(); } +nvtxResourceHandle_t nvtxDomainResourceCreate__extern(nvtxDomainHandle_t domain, nvtxResourceAttributes_t *attribs) { return nvtxDomainResourceCreate(domain, attribs); } +void nvtxDomainResourceDestroy__extern(nvtxResourceHandle_t resource) { nvtxDomainResourceDestroy(resource); } +void nvtxDomainNameCategoryA__extern(nvtxDomainHandle_t domain, uint32_t category, const char *name) { nvtxDomainNameCategoryA(domain, category, name); } +void nvtxDomainNameCategoryW__extern(nvtxDomainHandle_t domain, uint32_t category, const wchar_t *name) { nvtxDomainNameCategoryW(domain, category, name); } +void nvtxNameCategoryA__extern(uint32_t category, const char *name) { nvtxNameCategoryA(category, name); } +void nvtxNameCategoryW__extern(uint32_t category, const wchar_t *name) { nvtxNameCategoryW(category, name); } +void nvtxNameOsThreadA__extern(uint32_t threadId, const char *name) { nvtxNameOsThreadA(threadId, name); } +void nvtxNameOsThreadW__extern(uint32_t threadId, const wchar_t *name) { nvtxNameOsThreadW(threadId, name); } +nvtxStringHandle_t nvtxDomainRegisterStringA__extern(nvtxDomainHandle_t domain, const char *string) { return nvtxDomainRegisterStringA(domain, string); } +nvtxStringHandle_t nvtxDomainRegisterStringW__extern(nvtxDomainHandle_t domain, const wchar_t *string) { return nvtxDomainRegisterStringW(domain, string); } +nvtxDomainHandle_t nvtxDomainCreateA__extern(const char *name) { return nvtxDomainCreateA(name); } +nvtxDomainHandle_t nvtxDomainCreateW__extern(const wchar_t *name) { return nvtxDomainCreateW(name); } +void nvtxDomainDestroy__extern(nvtxDomainHandle_t domain) { nvtxDomainDestroy(domain); } +void nvtxNameCuDeviceA__extern(CUdevice device, const char *name) { nvtxNameCuDeviceA(device, name); } +void nvtxNameCuDeviceW__extern(CUdevice device, const wchar_t *name) { nvtxNameCuDeviceW(device, name); } +void nvtxNameCuContextA__extern(CUcontext context, const char *name) { nvtxNameCuContextA(context, name); } +void nvtxNameCuContextW__extern(CUcontext context, const wchar_t *name) { nvtxNameCuContextW(context, name); } +void nvtxNameCuStreamA__extern(CUstream stream, const char *name) { nvtxNameCuStreamA(stream, name); } +void nvtxNameCuStreamW__extern(CUstream stream, const wchar_t *name) { nvtxNameCuStreamW(stream, name); } +void nvtxNameCuEventA__extern(CUevent event, const char *name) { nvtxNameCuEventA(event, name); } +void nvtxNameCuEventW__extern(CUevent event, const wchar_t *name) { nvtxNameCuEventW(event, name); } diff --git a/src/nvtx/sys/mod.rs b/src/nvtx/sys/mod.rs new file mode 100644 index 00000000..ac3bed9c --- /dev/null +++ b/src/nvtx/sys/mod.rs @@ -0,0 +1,59 @@ +#[cfg(feature = "cuda-11040")] +mod sys_11040; +#[cfg(feature = "cuda-11040")] +pub use sys_11040::*; + +#[cfg(feature = "cuda-11050")] +mod sys_11050; +#[cfg(feature = "cuda-11050")] +pub use sys_11050::*; + +#[cfg(feature = "cuda-11060")] +mod sys_11060; +#[cfg(feature = "cuda-11060")] +pub use sys_11060::*; + +#[cfg(feature = "cuda-11070")] +mod sys_11070; +#[cfg(feature = "cuda-11070")] +pub use sys_11070::*; + +#[cfg(feature = "cuda-11080")] +mod sys_11080; +#[cfg(feature = "cuda-11080")] +pub use sys_11080::*; + +#[cfg(feature = "cuda-12000")] +mod sys_12000; +#[cfg(feature = "cuda-12000")] +pub use sys_12000::*; + +#[cfg(feature = "cuda-12010")] +mod sys_12010; +#[cfg(feature = "cuda-12010")] +pub use sys_12010::*; + +#[cfg(feature = "cuda-12020")] +mod sys_12020; +#[cfg(feature = "cuda-12020")] +pub use sys_12020::*; + +#[cfg(feature = "cuda-12030")] +mod sys_12030; +#[cfg(feature = "cuda-12030")] +pub use sys_12030::*; + +#[cfg(feature = "cuda-12040")] +mod sys_12040; +#[cfg(feature = "cuda-12040")] +pub use sys_12040::*; + +#[cfg(feature = "cuda-12050")] +mod sys_12050; +#[cfg(feature = "cuda-12050")] +pub use sys_12050::*; + +#[cfg(feature = "cuda-12060")] +mod sys_12060; +#[cfg(feature = "cuda-12060")] +pub use sys_12060::*; diff --git a/src/nvtx/sys/sys_12040.rs b/src/nvtx/sys/sys_12040.rs new file mode 100644 index 00000000..eda9d5cd --- /dev/null +++ b/src/nvtx/sys/sys_12040.rs @@ -0,0 +1,2005 @@ +/* automatically generated by rust-bindgen 0.69.4 */ + +pub const CUDA_VERSION: u32 = 12040; +pub type wchar_t = ::core::ffi::c_int; +pub type nvtxRangeId_t = u64; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct nvtxDomainRegistration_st { + _unused: [u8; 0], +} +pub type nvtxDomainRegistration = nvtxDomainRegistration_st; +pub type nvtxDomainHandle_t = *mut nvtxDomainRegistration; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct nvtxStringRegistration_st { + _unused: [u8; 0], +} +pub type nvtxStringRegistration = nvtxStringRegistration_st; +pub type nvtxStringHandle_t = *mut nvtxStringRegistration; +#[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 ::core::ffi::c_char, + pub unicode: *const wchar_t, + pub registered: nvtxStringHandle_t, +} +#[test] +fn bindgen_test_layout_nvtxMessageValue_t() { + const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::core::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(nvtxMessageValue_t)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(nvtxMessageValue_t)) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).ascii) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(nvtxMessageValue_t), + "::", + stringify!(ascii) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).unicode) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(nvtxMessageValue_t), + "::", + stringify!(unicode) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).registered) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(nvtxMessageValue_t), + "::", + stringify!(registered) + ) + ); +} +impl Default for nvtxMessageValue_t { + fn default() -> Self { + let mut s = ::core::mem::MaybeUninit::::uninit(); + unsafe { + ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +extern "C" { + #[link_name = "nvtxInitialize__extern"] + pub fn nvtxInitialize(reserved: *const ::core::ffi::c_void); +} +#[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() { + const UNINIT: ::core::mem::MaybeUninit = + ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::core::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(nvtxEventAttributes_v2_payload_t)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(nvtxEventAttributes_v2_payload_t) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).ullValue) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(nvtxEventAttributes_v2_payload_t), + "::", + stringify!(ullValue) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).llValue) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(nvtxEventAttributes_v2_payload_t), + "::", + stringify!(llValue) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).dValue) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(nvtxEventAttributes_v2_payload_t), + "::", + stringify!(dValue) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).uiValue) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(nvtxEventAttributes_v2_payload_t), + "::", + stringify!(uiValue) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).iValue) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(nvtxEventAttributes_v2_payload_t), + "::", + stringify!(iValue) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).fValue) as usize - ptr 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 = ::core::mem::MaybeUninit::::uninit(); + unsafe { + ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +#[test] +fn bindgen_test_layout_nvtxEventAttributes_v2() { + const UNINIT: ::core::mem::MaybeUninit = + ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::core::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(nvtxEventAttributes_v2)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(nvtxEventAttributes_v2)) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).version) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(nvtxEventAttributes_v2), + "::", + stringify!(version) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).size) as usize - ptr as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(nvtxEventAttributes_v2), + "::", + stringify!(size) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).category) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(nvtxEventAttributes_v2), + "::", + stringify!(category) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).colorType) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(nvtxEventAttributes_v2), + "::", + stringify!(colorType) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).color) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(nvtxEventAttributes_v2), + "::", + stringify!(color) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).payloadType) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(nvtxEventAttributes_v2), + "::", + stringify!(payloadType) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).reserved0) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(nvtxEventAttributes_v2), + "::", + stringify!(reserved0) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).payload) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(nvtxEventAttributes_v2), + "::", + stringify!(payload) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).messageType) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(nvtxEventAttributes_v2), + "::", + stringify!(messageType) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).message) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(nvtxEventAttributes_v2), + "::", + stringify!(message) + ) + ); +} +impl Default for nvtxEventAttributes_v2 { + fn default() -> Self { + let mut s = ::core::mem::MaybeUninit::::uninit(); + unsafe { + ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type nvtxEventAttributes_t = nvtxEventAttributes_v2; +extern "C" { + #[link_name = "nvtxDomainMarkEx__extern"] + pub fn nvtxDomainMarkEx(domain: nvtxDomainHandle_t, eventAttrib: *const nvtxEventAttributes_t); +} +extern "C" { + #[link_name = "nvtxMarkEx__extern"] + pub fn nvtxMarkEx(eventAttrib: *const nvtxEventAttributes_t); +} +extern "C" { + #[link_name = "nvtxMarkA__extern"] + pub fn nvtxMarkA(message: *const ::core::ffi::c_char); +} +extern "C" { + #[link_name = "nvtxMarkW__extern"] + pub fn nvtxMarkW(message: *const wchar_t); +} +extern "C" { + #[link_name = "nvtxDomainRangeStartEx__extern"] + pub fn nvtxDomainRangeStartEx( + domain: nvtxDomainHandle_t, + eventAttrib: *const nvtxEventAttributes_t, + ) -> nvtxRangeId_t; +} +extern "C" { + #[link_name = "nvtxRangeStartEx__extern"] + pub fn nvtxRangeStartEx(eventAttrib: *const nvtxEventAttributes_t) -> nvtxRangeId_t; +} +extern "C" { + #[link_name = "nvtxRangeStartA__extern"] + pub fn nvtxRangeStartA(message: *const ::core::ffi::c_char) -> nvtxRangeId_t; +} +extern "C" { + #[link_name = "nvtxRangeStartW__extern"] + pub fn nvtxRangeStartW(message: *const wchar_t) -> nvtxRangeId_t; +} +extern "C" { + #[link_name = "nvtxDomainRangeEnd__extern"] + pub fn nvtxDomainRangeEnd(domain: nvtxDomainHandle_t, id: nvtxRangeId_t); +} +extern "C" { + #[link_name = "nvtxRangeEnd__extern"] + pub fn nvtxRangeEnd(id: nvtxRangeId_t); +} +extern "C" { + #[link_name = "nvtxDomainRangePushEx__extern"] + pub fn nvtxDomainRangePushEx( + domain: nvtxDomainHandle_t, + eventAttrib: *const nvtxEventAttributes_t, + ) -> ::core::ffi::c_int; +} +extern "C" { + #[link_name = "nvtxRangePushEx__extern"] + pub fn nvtxRangePushEx(eventAttrib: *const nvtxEventAttributes_t) -> ::core::ffi::c_int; +} +extern "C" { + #[link_name = "nvtxRangePushA__extern"] + pub fn nvtxRangePushA(message: *const ::core::ffi::c_char) -> ::core::ffi::c_int; +} +extern "C" { + #[link_name = "nvtxRangePushW__extern"] + pub fn nvtxRangePushW(message: *const wchar_t) -> ::core::ffi::c_int; +} +extern "C" { + #[link_name = "nvtxDomainRangePop__extern"] + pub fn nvtxDomainRangePop(domain: nvtxDomainHandle_t) -> ::core::ffi::c_int; +} +extern "C" { + #[link_name = "nvtxRangePop__extern"] + pub fn nvtxRangePop() -> ::core::ffi::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 ::core::ffi::c_void, + pub ullValue: u64, +} +#[test] +fn bindgen_test_layout_nvtxResourceAttributes_v0_identifier_t() { + const UNINIT: ::core::mem::MaybeUninit = + ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::core::mem::size_of::(), + 8usize, + concat!( + "Size of: ", + stringify!(nvtxResourceAttributes_v0_identifier_t) + ) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(nvtxResourceAttributes_v0_identifier_t) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).pValue) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(nvtxResourceAttributes_v0_identifier_t), + "::", + stringify!(pValue) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).ullValue) as usize - ptr 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 = ::core::mem::MaybeUninit::::uninit(); + unsafe { + ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +#[test] +fn bindgen_test_layout_nvtxResourceAttributes_v0() { + const UNINIT: ::core::mem::MaybeUninit = + ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::core::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(nvtxResourceAttributes_v0)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(nvtxResourceAttributes_v0)) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).version) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(nvtxResourceAttributes_v0), + "::", + stringify!(version) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).size) as usize - ptr as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(nvtxResourceAttributes_v0), + "::", + stringify!(size) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).identifierType) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(nvtxResourceAttributes_v0), + "::", + stringify!(identifierType) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).identifier) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(nvtxResourceAttributes_v0), + "::", + stringify!(identifier) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).messageType) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(nvtxResourceAttributes_v0), + "::", + stringify!(messageType) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).message) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(nvtxResourceAttributes_v0), + "::", + stringify!(message) + ) + ); +} +impl Default for nvtxResourceAttributes_v0 { + fn default() -> Self { + let mut s = ::core::mem::MaybeUninit::::uninit(); + unsafe { + ::core::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" { + #[link_name = "nvtxDomainResourceCreate__extern"] + pub fn nvtxDomainResourceCreate( + domain: nvtxDomainHandle_t, + attribs: *mut nvtxResourceAttributes_t, + ) -> nvtxResourceHandle_t; +} +extern "C" { + #[link_name = "nvtxDomainResourceDestroy__extern"] + pub fn nvtxDomainResourceDestroy(resource: nvtxResourceHandle_t); +} +extern "C" { + #[link_name = "nvtxDomainNameCategoryA__extern"] + pub fn nvtxDomainNameCategoryA( + domain: nvtxDomainHandle_t, + category: u32, + name: *const ::core::ffi::c_char, + ); +} +extern "C" { + #[link_name = "nvtxDomainNameCategoryW__extern"] + pub fn nvtxDomainNameCategoryW(domain: nvtxDomainHandle_t, category: u32, name: *const wchar_t); +} +extern "C" { + #[link_name = "nvtxNameCategoryA__extern"] + pub fn nvtxNameCategoryA(category: u32, name: *const ::core::ffi::c_char); +} +extern "C" { + #[link_name = "nvtxNameCategoryW__extern"] + pub fn nvtxNameCategoryW(category: u32, name: *const wchar_t); +} +extern "C" { + #[link_name = "nvtxNameOsThreadA__extern"] + pub fn nvtxNameOsThreadA(threadId: u32, name: *const ::core::ffi::c_char); +} +extern "C" { + #[link_name = "nvtxNameOsThreadW__extern"] + pub fn nvtxNameOsThreadW(threadId: u32, name: *const wchar_t); +} +extern "C" { + #[link_name = "nvtxDomainRegisterStringA__extern"] + pub fn nvtxDomainRegisterStringA( + domain: nvtxDomainHandle_t, + string: *const ::core::ffi::c_char, + ) -> nvtxStringHandle_t; +} +extern "C" { + #[link_name = "nvtxDomainRegisterStringW__extern"] + pub fn nvtxDomainRegisterStringW( + domain: nvtxDomainHandle_t, + string: *const wchar_t, + ) -> nvtxStringHandle_t; +} +extern "C" { + #[link_name = "nvtxDomainCreateA__extern"] + pub fn nvtxDomainCreateA(name: *const ::core::ffi::c_char) -> nvtxDomainHandle_t; +} +extern "C" { + #[link_name = "nvtxDomainCreateW__extern"] + pub fn nvtxDomainCreateW(name: *const wchar_t) -> nvtxDomainHandle_t; +} +extern "C" { + #[link_name = "nvtxDomainDestroy__extern"] + pub fn nvtxDomainDestroy(domain: nvtxDomainHandle_t); +} +pub type nvtx_CUdevice = ::core::ffi::c_int; +pub type nvtx_CUcontext = *mut ::core::ffi::c_void; +pub type nvtx_CUstream = *mut ::core::ffi::c_void; +pub type nvtx_CUevent = *mut ::core::ffi::c_void; +pub type nvtx_cudaStream_t = *mut ::core::ffi::c_void; +pub type nvtx_cudaEvent_t = *mut ::core::ffi::c_void; +pub type nvtx_cl_platform_id = *mut ::core::ffi::c_void; +pub type nvtx_cl_device_id = *mut ::core::ffi::c_void; +pub type nvtx_cl_context = *mut ::core::ffi::c_void; +pub type nvtx_cl_command_queue = *mut ::core::ffi::c_void; +pub type nvtx_cl_mem = *mut ::core::ffi::c_void; +pub type nvtx_cl_program = *mut ::core::ffi::c_void; +pub type nvtx_cl_kernel = *mut ::core::ffi::c_void; +pub type nvtx_cl_event = *mut ::core::ffi::c_void; +pub type nvtx_cl_sampler = *mut ::core::ffi::c_void; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct nvtxSyncUser { + _unused: [u8; 0], +} +pub type nvtxSyncUser_t = *mut nvtxSyncUser; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct nvtxSyncUserAttributes_v0 { + _unused: [u8; 0], +} +pub type nvtxSyncUserAttributes_t = nvtxSyncUserAttributes_v0; +pub type nvtxMarkEx_impl_fntype = + ::core::option::Option; +pub type nvtxMarkA_impl_fntype = + ::core::option::Option; +pub type nvtxMarkW_impl_fntype = + ::core::option::Option; +pub type nvtxRangeStartEx_impl_fntype = ::core::option::Option< + unsafe extern "C" fn(eventAttrib: *const nvtxEventAttributes_t) -> nvtxRangeId_t, +>; +pub type nvtxRangeStartA_impl_fntype = ::core::option::Option< + unsafe extern "C" fn(message: *const ::core::ffi::c_char) -> nvtxRangeId_t, +>; +pub type nvtxRangeStartW_impl_fntype = + ::core::option::Option nvtxRangeId_t>; +pub type nvtxRangeEnd_impl_fntype = ::core::option::Option; +pub type nvtxRangePushEx_impl_fntype = ::core::option::Option< + unsafe extern "C" fn(eventAttrib: *const nvtxEventAttributes_t) -> ::core::ffi::c_int, +>; +pub type nvtxRangePushA_impl_fntype = ::core::option::Option< + unsafe extern "C" fn(message: *const ::core::ffi::c_char) -> ::core::ffi::c_int, +>; +pub type nvtxRangePushW_impl_fntype = + ::core::option::Option ::core::ffi::c_int>; +pub type nvtxRangePop_impl_fntype = + ::core::option::Option ::core::ffi::c_int>; +pub type nvtxNameCategoryA_impl_fntype = + ::core::option::Option; +pub type nvtxNameCategoryW_impl_fntype = + ::core::option::Option; +pub type nvtxNameOsThreadA_impl_fntype = + ::core::option::Option; +pub type nvtxNameOsThreadW_impl_fntype = + ::core::option::Option; +pub type nvtxNameCuDeviceA_fakeimpl_fntype = ::core::option::Option< + unsafe extern "C" fn(device: nvtx_CUdevice, name: *const ::core::ffi::c_char), +>; +pub type nvtxNameCuDeviceW_fakeimpl_fntype = + ::core::option::Option; +pub type nvtxNameCuContextA_fakeimpl_fntype = ::core::option::Option< + unsafe extern "C" fn(context: nvtx_CUcontext, name: *const ::core::ffi::c_char), +>; +pub type nvtxNameCuContextW_fakeimpl_fntype = + ::core::option::Option; +pub type nvtxNameCuStreamA_fakeimpl_fntype = ::core::option::Option< + unsafe extern "C" fn(stream: nvtx_CUstream, name: *const ::core::ffi::c_char), +>; +pub type nvtxNameCuStreamW_fakeimpl_fntype = + ::core::option::Option; +pub type nvtxNameCuEventA_fakeimpl_fntype = ::core::option::Option< + unsafe extern "C" fn(event: nvtx_CUevent, name: *const ::core::ffi::c_char), +>; +pub type nvtxNameCuEventW_fakeimpl_fntype = + ::core::option::Option; +pub type nvtxNameClDeviceA_fakeimpl_fntype = ::core::option::Option< + unsafe extern "C" fn(device: nvtx_cl_device_id, name: *const ::core::ffi::c_char), +>; +pub type nvtxNameClDeviceW_fakeimpl_fntype = + ::core::option::Option; +pub type nvtxNameClContextA_fakeimpl_fntype = ::core::option::Option< + unsafe extern "C" fn(context: nvtx_cl_context, name: *const ::core::ffi::c_char), +>; +pub type nvtxNameClContextW_fakeimpl_fntype = + ::core::option::Option; +pub type nvtxNameClCommandQueueA_fakeimpl_fntype = ::core::option::Option< + unsafe extern "C" fn(command_queue: nvtx_cl_command_queue, name: *const ::core::ffi::c_char), +>; +pub type nvtxNameClCommandQueueW_fakeimpl_fntype = ::core::option::Option< + unsafe extern "C" fn(command_queue: nvtx_cl_command_queue, name: *const wchar_t), +>; +pub type nvtxNameClMemObjectA_fakeimpl_fntype = ::core::option::Option< + unsafe extern "C" fn(memobj: nvtx_cl_mem, name: *const ::core::ffi::c_char), +>; +pub type nvtxNameClMemObjectW_fakeimpl_fntype = + ::core::option::Option; +pub type nvtxNameClSamplerA_fakeimpl_fntype = ::core::option::Option< + unsafe extern "C" fn(sampler: nvtx_cl_sampler, name: *const ::core::ffi::c_char), +>; +pub type nvtxNameClSamplerW_fakeimpl_fntype = + ::core::option::Option; +pub type nvtxNameClProgramA_fakeimpl_fntype = ::core::option::Option< + unsafe extern "C" fn(program: nvtx_cl_program, name: *const ::core::ffi::c_char), +>; +pub type nvtxNameClProgramW_fakeimpl_fntype = + ::core::option::Option; +pub type nvtxNameClEventA_fakeimpl_fntype = ::core::option::Option< + unsafe extern "C" fn(evnt: nvtx_cl_event, name: *const ::core::ffi::c_char), +>; +pub type nvtxNameClEventW_fakeimpl_fntype = + ::core::option::Option; +pub type nvtxNameCudaDeviceA_impl_fntype = ::core::option::Option< + unsafe extern "C" fn(device: ::core::ffi::c_int, name: *const ::core::ffi::c_char), +>; +pub type nvtxNameCudaDeviceW_impl_fntype = + ::core::option::Option; +pub type nvtxNameCudaStreamA_fakeimpl_fntype = ::core::option::Option< + unsafe extern "C" fn(stream: nvtx_cudaStream_t, name: *const ::core::ffi::c_char), +>; +pub type nvtxNameCudaStreamW_fakeimpl_fntype = + ::core::option::Option; +pub type nvtxNameCudaEventA_fakeimpl_fntype = ::core::option::Option< + unsafe extern "C" fn(event: nvtx_cudaEvent_t, name: *const ::core::ffi::c_char), +>; +pub type nvtxNameCudaEventW_fakeimpl_fntype = + ::core::option::Option; +pub type nvtxDomainMarkEx_impl_fntype = ::core::option::Option< + unsafe extern "C" fn(domain: nvtxDomainHandle_t, eventAttrib: *const nvtxEventAttributes_t), +>; +pub type nvtxDomainRangeStartEx_impl_fntype = ::core::option::Option< + unsafe extern "C" fn( + domain: nvtxDomainHandle_t, + eventAttrib: *const nvtxEventAttributes_t, + ) -> nvtxRangeId_t, +>; +pub type nvtxDomainRangeEnd_impl_fntype = + ::core::option::Option; +pub type nvtxDomainRangePushEx_impl_fntype = ::core::option::Option< + unsafe extern "C" fn( + domain: nvtxDomainHandle_t, + eventAttrib: *const nvtxEventAttributes_t, + ) -> ::core::ffi::c_int, +>; +pub type nvtxDomainRangePop_impl_fntype = + ::core::option::Option ::core::ffi::c_int>; +pub type nvtxDomainResourceCreate_impl_fntype = ::core::option::Option< + unsafe extern "C" fn( + domain: nvtxDomainHandle_t, + attribs: *mut nvtxResourceAttributes_t, + ) -> nvtxResourceHandle_t, +>; +pub type nvtxDomainResourceDestroy_impl_fntype = + ::core::option::Option; +pub type nvtxDomainNameCategoryA_impl_fntype = ::core::option::Option< + unsafe extern "C" fn( + domain: nvtxDomainHandle_t, + category: u32, + name: *const ::core::ffi::c_char, + ), +>; +pub type nvtxDomainNameCategoryW_impl_fntype = ::core::option::Option< + unsafe extern "C" fn(domain: nvtxDomainHandle_t, category: u32, name: *const wchar_t), +>; +pub type nvtxDomainRegisterStringA_impl_fntype = ::core::option::Option< + unsafe extern "C" fn( + domain: nvtxDomainHandle_t, + string: *const ::core::ffi::c_char, + ) -> nvtxStringHandle_t, +>; +pub type nvtxDomainRegisterStringW_impl_fntype = ::core::option::Option< + unsafe extern "C" fn(domain: nvtxDomainHandle_t, string: *const wchar_t) -> nvtxStringHandle_t, +>; +pub type nvtxDomainCreateA_impl_fntype = ::core::option::Option< + unsafe extern "C" fn(message: *const ::core::ffi::c_char) -> nvtxDomainHandle_t, +>; +pub type nvtxDomainCreateW_impl_fntype = + ::core::option::Option nvtxDomainHandle_t>; +pub type nvtxDomainDestroy_impl_fntype = + ::core::option::Option; +pub type nvtxInitialize_impl_fntype = + ::core::option::Option; +pub type nvtxDomainSyncUserCreate_impl_fntype = ::core::option::Option< + unsafe extern "C" fn( + domain: nvtxDomainHandle_t, + attribs: *const nvtxSyncUserAttributes_t, + ) -> nvtxSyncUser_t, +>; +pub type nvtxDomainSyncUserDestroy_impl_fntype = + ::core::option::Option; +pub type nvtxDomainSyncUserAcquireStart_impl_fntype = + ::core::option::Option; +pub type nvtxDomainSyncUserAcquireFailed_impl_fntype = + ::core::option::Option; +pub type nvtxDomainSyncUserAcquireSuccess_impl_fntype = + ::core::option::Option; +pub type nvtxDomainSyncUserReleasing_impl_fntype = + ::core::option::Option; +#[repr(u32)] +#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +pub enum NvtxCallbackModule { + NVTX_CB_MODULE_INVALID = 0, + NVTX_CB_MODULE_CORE = 1, + NVTX_CB_MODULE_CUDA = 2, + NVTX_CB_MODULE_OPENCL = 3, + NVTX_CB_MODULE_CUDART = 4, + NVTX_CB_MODULE_CORE2 = 5, + NVTX_CB_MODULE_SYNC = 6, + NVTX_CB_MODULE_SIZE = 7, + NVTX_CB_MODULE_FORCE_INT = 2147483647, +} +pub type NvtxFunctionPointer = ::core::option::Option; +pub type NvtxFunctionTable = *mut *mut NvtxFunctionPointer; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +pub struct NvtxExportTableCallbacks { + pub struct_size: usize, + pub GetModuleFunctionTable: ::core::option::Option< + unsafe extern "C" fn( + module: NvtxCallbackModule, + out_table: *mut NvtxFunctionTable, + out_size: *mut ::core::ffi::c_uint, + ) -> ::core::ffi::c_int, + >, +} +#[test] +fn bindgen_test_layout_NvtxExportTableCallbacks() { + const UNINIT: ::core::mem::MaybeUninit = + ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::core::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(NvtxExportTableCallbacks)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(NvtxExportTableCallbacks)) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).struct_size) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(NvtxExportTableCallbacks), + "::", + stringify!(struct_size) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).GetModuleFunctionTable) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(NvtxExportTableCallbacks), + "::", + stringify!(GetModuleFunctionTable) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +pub struct NvtxExportTableVersionInfo { + pub struct_size: usize, + pub version: u32, + pub reserved0: u32, + pub SetInjectionNvtxVersion: ::core::option::Option, +} +#[test] +fn bindgen_test_layout_NvtxExportTableVersionInfo() { + const UNINIT: ::core::mem::MaybeUninit = + ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::core::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(NvtxExportTableVersionInfo)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(NvtxExportTableVersionInfo)) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).struct_size) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(NvtxExportTableVersionInfo), + "::", + stringify!(struct_size) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).version) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(NvtxExportTableVersionInfo), + "::", + stringify!(version) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).reserved0) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(NvtxExportTableVersionInfo), + "::", + stringify!(reserved0) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).SetInjectionNvtxVersion) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(NvtxExportTableVersionInfo), + "::", + stringify!(SetInjectionNvtxVersion) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +pub struct nvtxGlobals_t { + pub initState: ::core::ffi::c_uint, + pub etblCallbacks: NvtxExportTableCallbacks, + pub etblVersionInfo: NvtxExportTableVersionInfo, + pub nvtxMarkEx_impl_fnptr: nvtxMarkEx_impl_fntype, + pub nvtxMarkA_impl_fnptr: nvtxMarkA_impl_fntype, + pub nvtxMarkW_impl_fnptr: nvtxMarkW_impl_fntype, + pub nvtxRangeStartEx_impl_fnptr: nvtxRangeStartEx_impl_fntype, + pub nvtxRangeStartA_impl_fnptr: nvtxRangeStartA_impl_fntype, + pub nvtxRangeStartW_impl_fnptr: nvtxRangeStartW_impl_fntype, + pub nvtxRangeEnd_impl_fnptr: nvtxRangeEnd_impl_fntype, + pub nvtxRangePushEx_impl_fnptr: nvtxRangePushEx_impl_fntype, + pub nvtxRangePushA_impl_fnptr: nvtxRangePushA_impl_fntype, + pub nvtxRangePushW_impl_fnptr: nvtxRangePushW_impl_fntype, + pub nvtxRangePop_impl_fnptr: nvtxRangePop_impl_fntype, + pub nvtxNameCategoryA_impl_fnptr: nvtxNameCategoryA_impl_fntype, + pub nvtxNameCategoryW_impl_fnptr: nvtxNameCategoryW_impl_fntype, + pub nvtxNameOsThreadA_impl_fnptr: nvtxNameOsThreadA_impl_fntype, + pub nvtxNameOsThreadW_impl_fnptr: nvtxNameOsThreadW_impl_fntype, + pub nvtxNameCuDeviceA_impl_fnptr: nvtxNameCuDeviceA_fakeimpl_fntype, + pub nvtxNameCuDeviceW_impl_fnptr: nvtxNameCuDeviceW_fakeimpl_fntype, + pub nvtxNameCuContextA_impl_fnptr: nvtxNameCuContextA_fakeimpl_fntype, + pub nvtxNameCuContextW_impl_fnptr: nvtxNameCuContextW_fakeimpl_fntype, + pub nvtxNameCuStreamA_impl_fnptr: nvtxNameCuStreamA_fakeimpl_fntype, + pub nvtxNameCuStreamW_impl_fnptr: nvtxNameCuStreamW_fakeimpl_fntype, + pub nvtxNameCuEventA_impl_fnptr: nvtxNameCuEventA_fakeimpl_fntype, + pub nvtxNameCuEventW_impl_fnptr: nvtxNameCuEventW_fakeimpl_fntype, + pub nvtxNameClDeviceA_impl_fnptr: nvtxNameClDeviceA_fakeimpl_fntype, + pub nvtxNameClDeviceW_impl_fnptr: nvtxNameClDeviceW_fakeimpl_fntype, + pub nvtxNameClContextA_impl_fnptr: nvtxNameClContextA_fakeimpl_fntype, + pub nvtxNameClContextW_impl_fnptr: nvtxNameClContextW_fakeimpl_fntype, + pub nvtxNameClCommandQueueA_impl_fnptr: nvtxNameClCommandQueueA_fakeimpl_fntype, + pub nvtxNameClCommandQueueW_impl_fnptr: nvtxNameClCommandQueueW_fakeimpl_fntype, + pub nvtxNameClMemObjectA_impl_fnptr: nvtxNameClMemObjectA_fakeimpl_fntype, + pub nvtxNameClMemObjectW_impl_fnptr: nvtxNameClMemObjectW_fakeimpl_fntype, + pub nvtxNameClSamplerA_impl_fnptr: nvtxNameClSamplerA_fakeimpl_fntype, + pub nvtxNameClSamplerW_impl_fnptr: nvtxNameClSamplerW_fakeimpl_fntype, + pub nvtxNameClProgramA_impl_fnptr: nvtxNameClProgramA_fakeimpl_fntype, + pub nvtxNameClProgramW_impl_fnptr: nvtxNameClProgramW_fakeimpl_fntype, + pub nvtxNameClEventA_impl_fnptr: nvtxNameClEventA_fakeimpl_fntype, + pub nvtxNameClEventW_impl_fnptr: nvtxNameClEventW_fakeimpl_fntype, + pub nvtxNameCudaDeviceA_impl_fnptr: nvtxNameCudaDeviceA_impl_fntype, + pub nvtxNameCudaDeviceW_impl_fnptr: nvtxNameCudaDeviceW_impl_fntype, + pub nvtxNameCudaStreamA_impl_fnptr: nvtxNameCudaStreamA_fakeimpl_fntype, + pub nvtxNameCudaStreamW_impl_fnptr: nvtxNameCudaStreamW_fakeimpl_fntype, + pub nvtxNameCudaEventA_impl_fnptr: nvtxNameCudaEventA_fakeimpl_fntype, + pub nvtxNameCudaEventW_impl_fnptr: nvtxNameCudaEventW_fakeimpl_fntype, + pub nvtxDomainMarkEx_impl_fnptr: nvtxDomainMarkEx_impl_fntype, + pub nvtxDomainRangeStartEx_impl_fnptr: nvtxDomainRangeStartEx_impl_fntype, + pub nvtxDomainRangeEnd_impl_fnptr: nvtxDomainRangeEnd_impl_fntype, + pub nvtxDomainRangePushEx_impl_fnptr: nvtxDomainRangePushEx_impl_fntype, + pub nvtxDomainRangePop_impl_fnptr: nvtxDomainRangePop_impl_fntype, + pub nvtxDomainResourceCreate_impl_fnptr: nvtxDomainResourceCreate_impl_fntype, + pub nvtxDomainResourceDestroy_impl_fnptr: nvtxDomainResourceDestroy_impl_fntype, + pub nvtxDomainNameCategoryA_impl_fnptr: nvtxDomainNameCategoryA_impl_fntype, + pub nvtxDomainNameCategoryW_impl_fnptr: nvtxDomainNameCategoryW_impl_fntype, + pub nvtxDomainRegisterStringA_impl_fnptr: nvtxDomainRegisterStringA_impl_fntype, + pub nvtxDomainRegisterStringW_impl_fnptr: nvtxDomainRegisterStringW_impl_fntype, + pub nvtxDomainCreateA_impl_fnptr: nvtxDomainCreateA_impl_fntype, + pub nvtxDomainCreateW_impl_fnptr: nvtxDomainCreateW_impl_fntype, + pub nvtxDomainDestroy_impl_fnptr: nvtxDomainDestroy_impl_fntype, + pub nvtxInitialize_impl_fnptr: nvtxInitialize_impl_fntype, + pub nvtxDomainSyncUserCreate_impl_fnptr: nvtxDomainSyncUserCreate_impl_fntype, + pub nvtxDomainSyncUserDestroy_impl_fnptr: nvtxDomainSyncUserDestroy_impl_fntype, + pub nvtxDomainSyncUserAcquireStart_impl_fnptr: nvtxDomainSyncUserAcquireStart_impl_fntype, + pub nvtxDomainSyncUserAcquireFailed_impl_fnptr: nvtxDomainSyncUserAcquireFailed_impl_fntype, + pub nvtxDomainSyncUserAcquireSuccess_impl_fnptr: nvtxDomainSyncUserAcquireSuccess_impl_fntype, + pub nvtxDomainSyncUserReleasing_impl_fnptr: nvtxDomainSyncUserReleasing_impl_fntype, + pub functionTable_CORE: [*mut NvtxFunctionPointer; 17usize], + pub functionTable_CUDA: [*mut NvtxFunctionPointer; 10usize], + pub functionTable_OPENCL: [*mut NvtxFunctionPointer; 16usize], + pub functionTable_CUDART: [*mut NvtxFunctionPointer; 8usize], + pub functionTable_CORE2: [*mut NvtxFunctionPointer; 17usize], + pub functionTable_SYNC: [*mut NvtxFunctionPointer; 8usize], +} +#[test] +fn bindgen_test_layout_nvtxGlobals_t() { + const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::core::mem::size_of::(), + 1168usize, + concat!("Size of: ", stringify!(nvtxGlobals_t)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(nvtxGlobals_t)) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).initState) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(initState) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).etblCallbacks) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(etblCallbacks) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).etblVersionInfo) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(etblVersionInfo) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).nvtxMarkEx_impl_fnptr) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxMarkEx_impl_fnptr) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).nvtxMarkA_impl_fnptr) as usize - ptr as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxMarkA_impl_fnptr) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).nvtxMarkW_impl_fnptr) as usize - ptr as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxMarkW_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxRangeStartEx_impl_fnptr) as usize - ptr as usize + }, + 72usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxRangeStartEx_impl_fnptr) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).nvtxRangeStartA_impl_fnptr) as usize - ptr as usize }, + 80usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxRangeStartA_impl_fnptr) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).nvtxRangeStartW_impl_fnptr) as usize - ptr as usize }, + 88usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxRangeStartW_impl_fnptr) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).nvtxRangeEnd_impl_fnptr) as usize - ptr as usize }, + 96usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxRangeEnd_impl_fnptr) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).nvtxRangePushEx_impl_fnptr) as usize - ptr as usize }, + 104usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxRangePushEx_impl_fnptr) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).nvtxRangePushA_impl_fnptr) as usize - ptr as usize }, + 112usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxRangePushA_impl_fnptr) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).nvtxRangePushW_impl_fnptr) as usize - ptr as usize }, + 120usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxRangePushW_impl_fnptr) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).nvtxRangePop_impl_fnptr) as usize - ptr as usize }, + 128usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxRangePop_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxNameCategoryA_impl_fnptr) as usize - ptr as usize + }, + 136usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxNameCategoryA_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxNameCategoryW_impl_fnptr) as usize - ptr as usize + }, + 144usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxNameCategoryW_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxNameOsThreadA_impl_fnptr) as usize - ptr as usize + }, + 152usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxNameOsThreadA_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxNameOsThreadW_impl_fnptr) as usize - ptr as usize + }, + 160usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxNameOsThreadW_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxNameCuDeviceA_impl_fnptr) as usize - ptr as usize + }, + 168usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxNameCuDeviceA_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxNameCuDeviceW_impl_fnptr) as usize - ptr as usize + }, + 176usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxNameCuDeviceW_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxNameCuContextA_impl_fnptr) as usize - ptr as usize + }, + 184usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxNameCuContextA_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxNameCuContextW_impl_fnptr) as usize - ptr as usize + }, + 192usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxNameCuContextW_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxNameCuStreamA_impl_fnptr) as usize - ptr as usize + }, + 200usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxNameCuStreamA_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxNameCuStreamW_impl_fnptr) as usize - ptr as usize + }, + 208usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxNameCuStreamW_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxNameCuEventA_impl_fnptr) as usize - ptr as usize + }, + 216usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxNameCuEventA_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxNameCuEventW_impl_fnptr) as usize - ptr as usize + }, + 224usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxNameCuEventW_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxNameClDeviceA_impl_fnptr) as usize - ptr as usize + }, + 232usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxNameClDeviceA_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxNameClDeviceW_impl_fnptr) as usize - ptr as usize + }, + 240usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxNameClDeviceW_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxNameClContextA_impl_fnptr) as usize - ptr as usize + }, + 248usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxNameClContextA_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxNameClContextW_impl_fnptr) as usize - ptr as usize + }, + 256usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxNameClContextW_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxNameClCommandQueueA_impl_fnptr) as usize - ptr as usize + }, + 264usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxNameClCommandQueueA_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxNameClCommandQueueW_impl_fnptr) as usize - ptr as usize + }, + 272usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxNameClCommandQueueW_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxNameClMemObjectA_impl_fnptr) as usize - ptr as usize + }, + 280usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxNameClMemObjectA_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxNameClMemObjectW_impl_fnptr) as usize - ptr as usize + }, + 288usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxNameClMemObjectW_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxNameClSamplerA_impl_fnptr) as usize - ptr as usize + }, + 296usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxNameClSamplerA_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxNameClSamplerW_impl_fnptr) as usize - ptr as usize + }, + 304usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxNameClSamplerW_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxNameClProgramA_impl_fnptr) as usize - ptr as usize + }, + 312usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxNameClProgramA_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxNameClProgramW_impl_fnptr) as usize - ptr as usize + }, + 320usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxNameClProgramW_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxNameClEventA_impl_fnptr) as usize - ptr as usize + }, + 328usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxNameClEventA_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxNameClEventW_impl_fnptr) as usize - ptr as usize + }, + 336usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxNameClEventW_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxNameCudaDeviceA_impl_fnptr) as usize - ptr as usize + }, + 344usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxNameCudaDeviceA_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxNameCudaDeviceW_impl_fnptr) as usize - ptr as usize + }, + 352usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxNameCudaDeviceW_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxNameCudaStreamA_impl_fnptr) as usize - ptr as usize + }, + 360usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxNameCudaStreamA_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxNameCudaStreamW_impl_fnptr) as usize - ptr as usize + }, + 368usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxNameCudaStreamW_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxNameCudaEventA_impl_fnptr) as usize - ptr as usize + }, + 376usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxNameCudaEventA_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxNameCudaEventW_impl_fnptr) as usize - ptr as usize + }, + 384usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxNameCudaEventW_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxDomainMarkEx_impl_fnptr) as usize - ptr as usize + }, + 392usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxDomainMarkEx_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxDomainRangeStartEx_impl_fnptr) as usize - ptr as usize + }, + 400usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxDomainRangeStartEx_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxDomainRangeEnd_impl_fnptr) as usize - ptr as usize + }, + 408usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxDomainRangeEnd_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxDomainRangePushEx_impl_fnptr) as usize - ptr as usize + }, + 416usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxDomainRangePushEx_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxDomainRangePop_impl_fnptr) as usize - ptr as usize + }, + 424usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxDomainRangePop_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxDomainResourceCreate_impl_fnptr) as usize + - ptr as usize + }, + 432usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxDomainResourceCreate_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxDomainResourceDestroy_impl_fnptr) as usize + - ptr as usize + }, + 440usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxDomainResourceDestroy_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxDomainNameCategoryA_impl_fnptr) as usize - ptr as usize + }, + 448usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxDomainNameCategoryA_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxDomainNameCategoryW_impl_fnptr) as usize - ptr as usize + }, + 456usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxDomainNameCategoryW_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxDomainRegisterStringA_impl_fnptr) as usize + - ptr as usize + }, + 464usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxDomainRegisterStringA_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxDomainRegisterStringW_impl_fnptr) as usize + - ptr as usize + }, + 472usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxDomainRegisterStringW_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxDomainCreateA_impl_fnptr) as usize - ptr as usize + }, + 480usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxDomainCreateA_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxDomainCreateW_impl_fnptr) as usize - ptr as usize + }, + 488usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxDomainCreateW_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxDomainDestroy_impl_fnptr) as usize - ptr as usize + }, + 496usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxDomainDestroy_impl_fnptr) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).nvtxInitialize_impl_fnptr) as usize - ptr as usize }, + 504usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxInitialize_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxDomainSyncUserCreate_impl_fnptr) as usize + - ptr as usize + }, + 512usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxDomainSyncUserCreate_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxDomainSyncUserDestroy_impl_fnptr) as usize + - ptr as usize + }, + 520usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxDomainSyncUserDestroy_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxDomainSyncUserAcquireStart_impl_fnptr) as usize + - ptr as usize + }, + 528usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxDomainSyncUserAcquireStart_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxDomainSyncUserAcquireFailed_impl_fnptr) as usize + - ptr as usize + }, + 536usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxDomainSyncUserAcquireFailed_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxDomainSyncUserAcquireSuccess_impl_fnptr) as usize + - ptr as usize + }, + 544usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxDomainSyncUserAcquireSuccess_impl_fnptr) + ) + ); + assert_eq!( + unsafe { + ::core::ptr::addr_of!((*ptr).nvtxDomainSyncUserReleasing_impl_fnptr) as usize + - ptr as usize + }, + 552usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(nvtxDomainSyncUserReleasing_impl_fnptr) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).functionTable_CORE) as usize - ptr as usize }, + 560usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(functionTable_CORE) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).functionTable_CUDA) as usize - ptr as usize }, + 696usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(functionTable_CUDA) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).functionTable_OPENCL) as usize - ptr as usize }, + 776usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(functionTable_OPENCL) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).functionTable_CUDART) as usize - ptr as usize }, + 904usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(functionTable_CUDART) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).functionTable_CORE2) as usize - ptr as usize }, + 968usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(functionTable_CORE2) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).functionTable_SYNC) as usize - ptr as usize }, + 1104usize, + concat!( + "Offset of field: ", + stringify!(nvtxGlobals_t), + "::", + stringify!(functionTable_SYNC) + ) + ); +} +impl Default for nvtxGlobals_t { + fn default() -> Self { + let mut s = ::core::mem::MaybeUninit::::uninit(); + unsafe { + ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CUdevice_v1 = ::core::ffi::c_int; +pub type CUdevice = CUdevice_v1; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CUctx_st { + _unused: [u8; 0], +} +pub type CUcontext = *mut CUctx_st; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CUevent_st { + _unused: [u8; 0], +} +pub type CUevent = *mut CUevent_st; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CUstream_st { + _unused: [u8; 0], +} +pub type CUstream = *mut CUstream_st; +#[repr(u32)] +#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +pub enum nvtxResourceCUDAType_t { + NVTX_RESOURCE_TYPE_CUDA_DEVICE = 262145, + NVTX_RESOURCE_TYPE_CUDA_CONTEXT = 262146, + NVTX_RESOURCE_TYPE_CUDA_STREAM = 262147, + NVTX_RESOURCE_TYPE_CUDA_EVENT = 262148, +} +extern "C" { + #[link_name = "nvtxNameCuDeviceA__extern"] + pub fn nvtxNameCuDeviceA(device: CUdevice, name: *const ::core::ffi::c_char); +} +extern "C" { + #[link_name = "nvtxNameCuDeviceW__extern"] + pub fn nvtxNameCuDeviceW(device: CUdevice, name: *const wchar_t); +} +extern "C" { + #[link_name = "nvtxNameCuContextA__extern"] + pub fn nvtxNameCuContextA(context: CUcontext, name: *const ::core::ffi::c_char); +} +extern "C" { + #[link_name = "nvtxNameCuContextW__extern"] + pub fn nvtxNameCuContextW(context: CUcontext, name: *const wchar_t); +} +extern "C" { + #[link_name = "nvtxNameCuStreamA__extern"] + pub fn nvtxNameCuStreamA(stream: CUstream, name: *const ::core::ffi::c_char); +} +extern "C" { + #[link_name = "nvtxNameCuStreamW__extern"] + pub fn nvtxNameCuStreamW(stream: CUstream, name: *const wchar_t); +} +extern "C" { + #[link_name = "nvtxNameCuEventA__extern"] + pub fn nvtxNameCuEventA(event: CUevent, name: *const ::core::ffi::c_char); +} +extern "C" { + #[link_name = "nvtxNameCuEventW__extern"] + pub fn nvtxNameCuEventW(event: CUevent, name: *const wchar_t); +} +pub type nvtxNameCuDeviceA_impl_fntype = ::core::option::Option< + unsafe extern "C" fn(device: CUdevice, name: *const ::core::ffi::c_char), +>; +pub type nvtxNameCuDeviceW_impl_fntype = + ::core::option::Option; +pub type nvtxNameCuContextA_impl_fntype = ::core::option::Option< + unsafe extern "C" fn(context: CUcontext, name: *const ::core::ffi::c_char), +>; +pub type nvtxNameCuContextW_impl_fntype = + ::core::option::Option; +pub type nvtxNameCuStreamA_impl_fntype = ::core::option::Option< + unsafe extern "C" fn(stream: CUstream, name: *const ::core::ffi::c_char), +>; +pub type nvtxNameCuStreamW_impl_fntype = + ::core::option::Option; +pub type nvtxNameCuEventA_impl_fntype = + ::core::option::Option; +pub type nvtxNameCuEventW_impl_fntype = + ::core::option::Option; diff --git a/src/nvtx/sys/wrapper.h b/src/nvtx/sys/wrapper.h new file mode 100644 index 00000000..739d7262 --- /dev/null +++ b/src/nvtx/sys/wrapper.h @@ -0,0 +1 @@ +#include "nvtx3/nvToolsExtCuda.h"