singe-cuda 0.1.0-alpha.6

Safe Rust wrappers for CUDA driver, runtime, NVRTC, NVVM, NVTX, memory, streams, modules, and graphs.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
use std::{
    ffi::{CStr, CString},
    fmt::{self, Display, Formatter},
    marker::PhantomData,
};

use num_enum::{IntoPrimitive, TryFromPrimitive};
use singe_core::impl_enum_conversion;
use singe_cuda_sys::nvtx as sys;

use crate::error::{Error, Result};

// TODO: move to a core version type
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Version {
    pub major: u32,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Color(u32);

impl Color {
    pub const fn argb(value: u32) -> Self {
        Self(value)
    }

    pub const fn rgba(red: u8, green: u8, blue: u8, alpha: u8) -> Self {
        Self(((alpha as u32) << 24) | ((red as u32) << 16) | ((green as u32) << 8) | blue as u32)
    }

    pub const fn as_raw(self) -> u32 {
        self.0
    }
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Category(u32);

impl Category {
    pub const fn from_raw(value: u32) -> Self {
        Self(value)
    }

    pub const fn as_raw(self) -> u32 {
        self.0
    }
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
#[repr(u32)]
pub enum ColorType {
    Unknown = sys::nvtxColorType_t::NVTX_COLOR_UNKNOWN as _,
    Argb = sys::nvtxColorType_t::NVTX_COLOR_ARGB as _,
}

impl_enum_conversion!(sys::nvtxColorType_t, ColorType);

impl Display for ColorType {
    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
        match self {
            Self::Unknown => write!(f, "NVTX_COLOR_UNKNOWN"),
            Self::Argb => write!(f, "NVTX_COLOR_ARGB"),
        }
    }
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
#[repr(u32)]
pub enum MessageType {
    Unknown = sys::nvtxMessageType_t::NVTX_MESSAGE_UNKNOWN as _,
    Ascii = sys::nvtxMessageType_t::NVTX_MESSAGE_TYPE_ASCII as _,
    Unicode = sys::nvtxMessageType_t::NVTX_MESSAGE_TYPE_UNICODE as _,
    Registered = sys::nvtxMessageType_t::NVTX_MESSAGE_TYPE_REGISTERED as _,
}

impl_enum_conversion!(sys::nvtxMessageType_t, MessageType);

impl Display for MessageType {
    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
        match self {
            Self::Unknown => write!(f, "NVTX_MESSAGE_UNKNOWN"),
            Self::Ascii => write!(f, "NVTX_MESSAGE_TYPE_ASCII"),
            Self::Unicode => write!(f, "NVTX_MESSAGE_TYPE_UNICODE"),
            Self::Registered => write!(f, "NVTX_MESSAGE_TYPE_REGISTERED"),
        }
    }
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
#[repr(u32)]
pub enum PayloadType {
    Unknown = sys::nvtxPayloadType_t::NVTX_PAYLOAD_UNKNOWN as _,
    UnsignedInt64 = sys::nvtxPayloadType_t::NVTX_PAYLOAD_TYPE_UNSIGNED_INT64 as _,
    Int64 = sys::nvtxPayloadType_t::NVTX_PAYLOAD_TYPE_INT64 as _,
    Double = sys::nvtxPayloadType_t::NVTX_PAYLOAD_TYPE_DOUBLE as _,
    UnsignedInt32 = sys::nvtxPayloadType_t::NVTX_PAYLOAD_TYPE_UNSIGNED_INT32 as _,
    Int32 = sys::nvtxPayloadType_t::NVTX_PAYLOAD_TYPE_INT32 as _,
    Float = sys::nvtxPayloadType_t::NVTX_PAYLOAD_TYPE_FLOAT as _,
}

impl_enum_conversion!(sys::nvtxPayloadType_t, PayloadType);

impl Display for PayloadType {
    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
        match self {
            Self::Unknown => write!(f, "NVTX_PAYLOAD_UNKNOWN"),
            Self::UnsignedInt64 => write!(f, "NVTX_PAYLOAD_TYPE_UNSIGNED_INT64"),
            Self::Int64 => write!(f, "NVTX_PAYLOAD_TYPE_INT64"),
            Self::Double => write!(f, "NVTX_PAYLOAD_TYPE_DOUBLE"),
            Self::UnsignedInt32 => write!(f, "NVTX_PAYLOAD_TYPE_UNSIGNED_INT32"),
            Self::Int32 => write!(f, "NVTX_PAYLOAD_TYPE_INT32"),
            Self::Float => write!(f, "NVTX_PAYLOAD_TYPE_FLOAT"),
        }
    }
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
#[repr(u32)]
pub enum ResourceGenericType {
    Unknown = sys::nvtxResourceGenericType_t::NVTX_RESOURCE_TYPE_UNKNOWN as _,
    GenericPointer = sys::nvtxResourceGenericType_t::NVTX_RESOURCE_TYPE_GENERIC_POINTER as _,
    GenericHandle = sys::nvtxResourceGenericType_t::NVTX_RESOURCE_TYPE_GENERIC_HANDLE as _,
    GenericThreadNative =
        sys::nvtxResourceGenericType_t::NVTX_RESOURCE_TYPE_GENERIC_THREAD_NATIVE as _,
    GenericThreadPosix =
        sys::nvtxResourceGenericType_t::NVTX_RESOURCE_TYPE_GENERIC_THREAD_POSIX as _,
}

impl_enum_conversion!(sys::nvtxResourceGenericType_t, ResourceGenericType);

impl Display for ResourceGenericType {
    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
        match self {
            Self::Unknown => write!(f, "NVTX_RESOURCE_TYPE_UNKNOWN"),
            Self::GenericPointer => write!(f, "NVTX_RESOURCE_TYPE_GENERIC_POINTER"),
            Self::GenericHandle => write!(f, "NVTX_RESOURCE_TYPE_GENERIC_HANDLE"),
            Self::GenericThreadNative => write!(f, "NVTX_RESOURCE_TYPE_GENERIC_THREAD_NATIVE"),
            Self::GenericThreadPosix => write!(f, "NVTX_RESOURCE_TYPE_GENERIC_THREAD_POSIX"),
        }
    }
}

#[derive(Debug, Clone, Copy, PartialEq)]
pub enum Payload {
    I32(i32),
    I64(i64),
    U32(u32),
    U64(u64),
    F32(f32),
    F64(f64),
}

impl Payload {
    fn encode_type(self) -> sys::nvtxPayloadType_t {
        match self {
            Self::I32(_) => PayloadType::Int32.into(),
            Self::I64(_) => PayloadType::Int64.into(),
            Self::U32(_) => PayloadType::UnsignedInt32.into(),
            Self::U64(_) => PayloadType::UnsignedInt64.into(),
            Self::F32(_) => PayloadType::Float.into(),
            Self::F64(_) => PayloadType::Double.into(),
        }
    }

    fn encode_value(self) -> sys::nvtxEventAttributes_v2_payload_t {
        match self {
            Self::I32(value) => sys::nvtxEventAttributes_v2_payload_t { iValue: value },
            Self::I64(value) => sys::nvtxEventAttributes_v2_payload_t { llValue: value },
            Self::U32(value) => sys::nvtxEventAttributes_v2_payload_t { uiValue: value },
            Self::U64(value) => sys::nvtxEventAttributes_v2_payload_t { ullValue: value },
            Self::F32(value) => sys::nvtxEventAttributes_v2_payload_t { fValue: value },
            Self::F64(value) => sys::nvtxEventAttributes_v2_payload_t { dValue: value },
        }
    }
}

#[derive(Debug, Clone, Copy)]
pub struct EventAttributes<'a> {
    message: Option<&'a CStr>,
    category: Option<Category>,
    color: Option<Color>,
    payload: Option<Payload>,
}

impl<'a> EventAttributes<'a> {
    pub const fn new() -> Self {
        Self {
            message: None,
            category: None,
            color: None,
            payload: None,
        }
    }

    pub fn with_message(mut self, message: &'a CStr) -> Self {
        self.message = Some(message);
        self
    }

    pub fn with_category(mut self, category: Category) -> Self {
        self.category = Some(category);
        self
    }

    pub fn with_color(mut self, color: Color) -> Self {
        self.color = Some(color);
        self
    }

    pub fn with_payload(mut self, payload: Payload) -> Self {
        self.payload = Some(payload);
        self
    }

    pub const fn message(&self) -> Option<&'a CStr> {
        self.message
    }

    pub const fn category(&self) -> Option<Category> {
        self.category
    }

    pub const fn color(&self) -> Option<Color> {
        self.color
    }

    pub const fn payload(&self) -> Option<Payload> {
        self.payload
    }

    fn encode(self) -> sys::nvtxEventAttributes_t {
        let mut raw = sys::nvtxEventAttributes_t {
            version: sys::NVTX_VERSION as u16,
            size: size_of::<sys::nvtxEventAttributes_t>() as u16,
            ..Default::default()
        };

        if let Some(category) = self.category {
            raw.category = category.0;
        }

        if let Some(color) = self.color {
            raw.colorType = sys::nvtxColorType_t::from(ColorType::Argb) as i32;
            raw.color = color.0;
        }

        if let Some(payload) = self.payload {
            raw.payloadType = payload.encode_type() as i32;
            raw.payload = payload.encode_value();
        }

        if let Some(message) = self.message {
            raw.messageType = sys::nvtxMessageType_t::from(MessageType::Ascii) as i32;
            raw.message.ascii = message.as_ptr();
        }

        raw
    }
}

impl Default for EventAttributes<'_> {
    fn default() -> Self {
        Self::new()
    }
}

#[derive(Debug, Clone)]
pub struct Event {
    message: CString,
    category: Option<Category>,
    color: Option<Color>,
    payload: Option<Payload>,
}

impl Event {
    pub fn create(message: &str) -> Result<Self> {
        Ok(Self {
            message: CString::new(message)?,
            category: None,
            color: None,
            payload: None,
        })
    }

    pub fn create_from_c_string(message: CString) -> Self {
        Self {
            message,
            category: None,
            color: None,
            payload: None,
        }
    }

    pub fn with_category(mut self, category: Category) -> Self {
        self.category = Some(category);
        self
    }

    pub fn with_color(mut self, color: Color) -> Self {
        self.color = Some(color);
        self
    }

    pub fn with_payload(mut self, payload: Payload) -> Self {
        self.payload = Some(payload);
        self
    }

    pub fn mark(&self) {
        mark_with_attributes(self.attributes());
    }

    pub fn local_range(&self) -> LocalRange {
        LocalRange::create_with_attributes(self.attributes())
    }

    pub fn range(&self) -> Range {
        Range::create_with_attributes(self.attributes())
    }

    pub fn domain_mark(&self, domain: &Domain) {
        domain.mark_with_attributes(self.attributes());
    }

    pub fn domain_local_range<'a>(&self, domain: &'a Domain) -> DomainLocalRange<'a> {
        domain.range_with_attributes(self.attributes())
    }

    pub fn domain_range<'a>(&self, domain: &'a Domain) -> DomainRange<'a> {
        domain.start_range_with_attributes(self.attributes())
    }

    pub fn attributes(&self) -> EventAttributes<'_> {
        let mut attributes = EventAttributes::new().with_message(&self.message);

        if let Some(category) = self.category {
            attributes = attributes.with_category(category);
        }

        if let Some(color) = self.color {
            attributes = attributes.with_color(color);
        }

        if let Some(payload) = self.payload {
            attributes = attributes.with_payload(payload);
        }

        attributes
    }
}

#[derive(Debug)]
pub struct Domain {
    handle: sys::nvtxDomainHandle_t,
}

// NVTX domains are process-wide annotation handles. The wrapper owns the handle
// and only passes immutable copies to NVTX entry points.
unsafe impl Send for Domain {}
unsafe impl Sync for Domain {}

impl Domain {
    pub fn create(name: &str) -> Result<Self> {
        let name = CString::new(name)?;
        Self::create_from_c_str(&name)
    }

    pub fn create_from_c_str(name: &CStr) -> Result<Self> {
        let handle = unsafe { sys::nvtxDomainCreateA(name.as_ptr()) };
        if handle.is_null() {
            return Err(Error::NullHandle);
        }
        Ok(Self { handle })
    }

    pub fn as_raw(&self) -> sys::nvtxDomainHandle_t {
        self.handle
    }

    pub fn mark(&self, message: &str) -> Result<()> {
        let message = CString::new(message)?;
        self.mark_c_str(&message);
        Ok(())
    }

    pub fn mark_c_str(&self, message: &CStr) {
        self.mark_with_attributes(EventAttributes::new().with_message(message));
    }

    pub fn mark_with_attributes(&self, attributes: EventAttributes<'_>) {
        let raw = attributes.encode();
        unsafe { sys::nvtxDomainMarkEx(self.handle, &raw) };
    }

    pub fn range<'a>(&'a self, message: &str) -> Result<DomainLocalRange<'a>> {
        let message = CString::new(message)?;
        Ok(self.range_c_str(&message))
    }

    pub fn range_c_str<'a>(&'a self, message: &CStr) -> DomainLocalRange<'a> {
        self.range_with_attributes(EventAttributes::new().with_message(message))
    }

    pub fn range_with_attributes<'a>(
        &'a self,
        attributes: EventAttributes<'_>,
    ) -> DomainLocalRange<'a> {
        let raw = attributes.encode();
        unsafe { sys::nvtxDomainRangePushEx(self.handle, &raw) };
        DomainLocalRange {
            domain: self,
            _not_send: PhantomData,
        }
    }

    pub fn start_range(&self, message: &str) -> Result<DomainRange<'_>> {
        let message = CString::new(message)?;
        Ok(self.start_range_c_str(&message))
    }

    pub fn start_range_c_str(&self, message: &CStr) -> DomainRange<'_> {
        self.start_range_with_attributes(EventAttributes::new().with_message(message))
    }

    pub fn start_range_with_attributes(&self, attributes: EventAttributes<'_>) -> DomainRange<'_> {
        let raw = attributes.encode();
        let id = unsafe { sys::nvtxDomainRangeStartEx(self.handle, &raw) };
        DomainRange { domain: self, id }
    }

    pub fn name_category(&self, category: Category, name: &str) -> Result<()> {
        let name = CString::new(name)?;
        unsafe { sys::nvtxDomainNameCategoryA(self.handle, category.0, name.as_ptr()) };
        Ok(())
    }
}

impl Drop for Domain {
    fn drop(&mut self) {
        unsafe { sys::nvtxDomainDestroy(self.handle) };
    }
}

#[derive(Debug)]
pub struct LocalRange {
    _not_send: PhantomData<*mut ()>,
}

impl LocalRange {
    pub fn create(message: &str) -> Result<Self> {
        let message = CString::new(message)?;
        Ok(Self::create_from_c_str(&message))
    }

    pub fn create_from_c_str(message: &CStr) -> Self {
        unsafe { sys::nvtxRangePushA(message.as_ptr()) };
        Self {
            _not_send: PhantomData,
        }
    }

    pub fn create_with_attributes(attributes: EventAttributes<'_>) -> Self {
        let raw = attributes.encode();
        unsafe { sys::nvtxRangePushEx(&raw) };
        Self {
            _not_send: PhantomData,
        }
    }
}

impl Drop for LocalRange {
    fn drop(&mut self) {
        unsafe { sys::nvtxRangePop() };
    }
}

#[derive(Debug)]
pub struct Range {
    id: sys::nvtxRangeId_t,
}

impl Range {
    pub fn create(message: &str) -> Result<Self> {
        let message = CString::new(message)?;
        Ok(Self::create_from_c_str(&message))
    }

    pub fn create_from_c_str(message: &CStr) -> Self {
        let id = unsafe { sys::nvtxRangeStartA(message.as_ptr()) };
        Self { id }
    }

    pub fn create_with_attributes(attributes: EventAttributes<'_>) -> Self {
        let raw = attributes.encode();
        let id = unsafe { sys::nvtxRangeStartEx(&raw) };
        Self { id }
    }
}

impl Drop for Range {
    fn drop(&mut self) {
        unsafe { sys::nvtxRangeEnd(self.id) };
    }
}

#[derive(Debug)]
pub struct DomainLocalRange<'a> {
    domain: &'a Domain,
    _not_send: PhantomData<*mut ()>,
}

impl Drop for DomainLocalRange<'_> {
    fn drop(&mut self) {
        unsafe { sys::nvtxDomainRangePop(self.domain.handle) };
    }
}

#[derive(Debug)]
pub struct DomainRange<'a> {
    domain: &'a Domain,
    id: sys::nvtxRangeId_t,
}

impl Drop for DomainRange<'_> {
    fn drop(&mut self) {
        unsafe { sys::nvtxDomainRangeEnd(self.domain.handle, self.id) };
    }
}

pub fn version() -> Version {
    Version {
        major: sys::NVTX_VERSION,
    }
}

pub fn initialize() {
    unsafe { sys::nvtxInitialize(std::ptr::null()) };
}

pub fn mark(message: &str) -> Result<()> {
    Event::create(message)?.mark();
    Ok(())
}

pub fn mark_c_str(message: &CStr) {
    unsafe { sys::nvtxMarkA(message.as_ptr()) };
}

pub fn mark_with_attributes(attributes: EventAttributes<'_>) {
    let raw = attributes.encode();
    unsafe { sys::nvtxMarkEx(&raw) };
}

pub fn name_category(category: Category, name: &str) -> Result<()> {
    let name = CString::new(name)?;
    unsafe { sys::nvtxNameCategoryA(category.0, name.as_ptr()) };
    Ok(())
}

pub fn name_os_thread(thread_id: u32, name: &str) -> Result<()> {
    let name = CString::new(name)?;
    unsafe { sys::nvtxNameOsThreadA(thread_id, name.as_ptr()) };
    Ok(())
}

pub fn scoped_range(message: &str) -> Result<LocalRange> {
    LocalRange::create(message)
}

#[cfg(test)]
mod tests {
    use std::mem;

    use super::*;

    #[test]
    fn encodes_event_attributes() {
        let message = c"work";
        let raw = EventAttributes::new()
            .with_message(message)
            .with_category(Category::from_raw(7))
            .with_color(Color::rgba(1, 2, 3, 4))
            .with_payload(Payload::I64(-42))
            .encode();

        assert_eq!(raw.version, sys::NVTX_VERSION as u16);
        assert_eq!(
            raw.size,
            mem::size_of::<sys::nvtxEventAttributes_t>() as u16
        );
        assert_eq!(raw.category, 7);
        assert_eq!(raw.colorType, sys::nvtxColorType_t::NVTX_COLOR_ARGB as i32);
        assert_eq!(raw.color, 0x0401_0203);
        assert_eq!(
            raw.messageType,
            sys::nvtxMessageType_t::NVTX_MESSAGE_TYPE_ASCII as i32
        );
        assert_eq!(unsafe { raw.message.ascii }, message.as_ptr());
        assert_eq!(
            raw.payloadType,
            sys::nvtxPayloadType_t::NVTX_PAYLOAD_TYPE_INT64 as i32
        );
        assert_eq!(unsafe { raw.payload.llValue }, -42);
    }

    #[test]
    fn owned_event_builds_attributes() {
        let event = Event::create("owned")
            .unwrap()
            .with_category(Category::from_raw(3))
            .with_color(Color::argb(0xff00_00ff))
            .with_payload(Payload::U32(11));

        let attributes = event.attributes();
        let raw = attributes.encode();

        assert_eq!(attributes.message(), Some(c"owned".as_ref()));
        assert_eq!(attributes.category(), Some(Category::from_raw(3)));
        assert_eq!(attributes.color(), Some(Color::argb(0xff00_00ff)));
        assert_eq!(attributes.payload(), Some(Payload::U32(11)));
        assert_eq!(raw.category, 3);
        assert_eq!(raw.color, 0xff00_00ff);
        assert_eq!(
            raw.payloadType,
            sys::nvtxPayloadType_t::NVTX_PAYLOAD_TYPE_UNSIGNED_INT32 as i32
        );
        assert_eq!(unsafe { raw.payload.uiValue }, 11);
    }

    #[test]
    fn enum_wrappers_convert_and_display() {
        assert_eq!(
            ColorType::from(sys::nvtxColorType_t::NVTX_COLOR_ARGB),
            ColorType::Argb
        );
        assert_eq!(
            sys::nvtxMessageType_t::from(MessageType::Ascii),
            sys::nvtxMessageType_t::NVTX_MESSAGE_TYPE_ASCII
        );
        assert_eq!(
            PayloadType::UnsignedInt64.to_string(),
            "NVTX_PAYLOAD_TYPE_UNSIGNED_INT64"
        );
        assert_eq!(
            ResourceGenericType::GenericThreadPosix.to_string(),
            "NVTX_RESOURCE_TYPE_GENERIC_THREAD_POSIX"
        );
    }
}