@@ -422,7 +422,11 @@ impl CurrentContext {
422422 pub fn get_resource_limit ( resource : ResourceLimit ) -> CudaResult < usize > {
423423 unsafe {
424424 let mut limit: usize = 0 ;
425- cuda:: cuCtxGetLimit ( & mut limit as * mut usize , transmute ( resource) ) . to_result ( ) ?;
425+ cuda:: cuCtxGetLimit (
426+ & mut limit as * mut usize ,
427+ transmute :: < ResourceLimit , cust_raw:: CUlimit_enum > ( resource) ,
428+ )
429+ . to_result ( ) ?;
426430 Ok ( limit)
427431 }
428432 }
@@ -517,33 +521,39 @@ impl CurrentContext {
517521 /// # }
518522 /// ```
519523 pub fn set_cache_config ( cfg : CacheConfig ) -> CudaResult < ( ) > {
520- unsafe { cuda:: cuCtxSetCacheConfig ( transmute ( cfg) ) . to_result ( ) }
524+ unsafe {
525+ cuda:: cuCtxSetCacheConfig ( transmute :: < CacheConfig , cust_raw:: CUfunc_cache_enum > ( cfg) )
526+ . to_result ( )
527+ }
521528 }
522529
523530 /// Sets a requested resource limit for the current context.
524531 ///
525- /// Note that this is only a request; the driver is free to modify the requested value to meet
526- /// hardware requirements. Each limit has some specific restrictions.
527- ///
528- /// * `StackSize`: Controls the stack size in bytes for each GPU thread
529- /// * `PrintfFifoSize`: Controls the size in bytes of the FIFO used by the `printf()` device
530- /// system call. This cannot be changed after a kernel has been launched which uses the
531- /// `printf()` function.
532- /// * `MallocHeapSize`: Controls the size in bytes of the heap used by the `malloc()` and `free()`
533- /// device system calls. This cannot be changed aftr a kernel has been launched which uses the
534- /// `malloc()` and `free()` system calls.
535- /// * `DeviceRuntimeSyncDepth`: Controls the maximum nesting depth of a grid at which a thread
536- /// can safely call `cudaDeviceSynchronize()`. This cannot be changed after a kernel has been
537- /// launched which uses the device runtime. When setting this limit, keep in mind that
538- /// additional levels of sync depth require the driver to reserve large amounts of device
539- /// memory which can no longer be used for device allocations.
540- /// * `DeviceRuntimePendingLaunchCount`: Controls the maximum number of outstanding device
541- /// runtime launches that can be made from the current context. A grid is outstanding from
542- /// the point of the launch up until the grid is known to have completed. Keep in mind that
543- /// increasing this limit will require the driver to reserve larger amounts of device memory
544- /// which can no longer be used for device allocations.
545- /// * `MaxL2FetchGranularity`: Controls the L2 fetch granularity. This is purely a performance
546- /// hint and it can be ignored or clamped depending on the platform.
532+ /// Note that this is only a request; the driver is free to modify the requested
533+ /// value to meet hardware requirements. Each limit has some specific restrictions.
534+ ///
535+ /// * `StackSize`: Controls the stack size in bytes for each GPU thread
536+ /// * `PrintfFifoSize`: Controls the size in bytes of the FIFO used by the
537+ /// `printf()` device system call. This cannot be changed after a kernel has
538+ /// been launched which uses the `printf()` function.
539+ /// * `MallocHeapSize`: Controls the size in bytes of the heap used by the
540+ /// `malloc()` and `free()` device system calls. This cannot be changed aftr a
541+ /// kernel has been launched which uses the `malloc()` and `free()` system
542+ /// calls.
543+ /// * `DeviceRuntimeSyncDepth`: Controls the maximum nesting depth of a grid at
544+ /// which a thread can safely call `cudaDeviceSynchronize()`. This cannot be
545+ /// changed after a kernel has been launched which uses the device runtime. When
546+ /// setting this limit, keep in mind that additional levels of sync depth
547+ /// require the driver to reserve large amounts of device memory which can no
548+ /// longer be used for device allocations.
549+ /// * `DeviceRuntimePendingLaunchCount`: Controls the maximum number of
550+ /// outstanding device runtime launches that can be made from the current
551+ /// context. A grid is outstanding from the point of the launch up until the
552+ /// grid is known to have completed. Keep in mind that increasing this limit
553+ /// will require the driver to reserve larger amounts of device memory which can
554+ /// no longer be used for device allocations.
555+ /// * `MaxL2FetchGranularity`: Controls the L2 fetch granularity. This is purely a
556+ /// performance hint and it can be ignored or clamped depending on the platform.
547557 ///
548558 /// # Example
549559 ///
@@ -562,7 +572,11 @@ impl CurrentContext {
562572 /// ```
563573 pub fn set_resource_limit ( resource : ResourceLimit , limit : usize ) -> CudaResult < ( ) > {
564574 unsafe {
565- cuda:: cuCtxSetLimit ( transmute ( resource) , limit) . to_result ( ) ?;
575+ cuda:: cuCtxSetLimit (
576+ transmute :: < ResourceLimit , cust_raw:: CUlimit_enum > ( resource) ,
577+ limit,
578+ )
579+ . to_result ( ) ?;
566580 Ok ( ( ) )
567581 }
568582 }
@@ -588,7 +602,13 @@ impl CurrentContext {
588602 /// # }
589603 /// ```
590604 pub fn set_shared_memory_config ( cfg : SharedMemoryConfig ) -> CudaResult < ( ) > {
591- unsafe { cuda:: cuCtxSetSharedMemConfig ( transmute ( cfg) ) . to_result ( ) }
605+ unsafe {
606+ cuda:: cuCtxSetSharedMemConfig ( transmute :: <
607+ SharedMemoryConfig ,
608+ cust_raw:: CUsharedconfig_enum ,
609+ > ( cfg) )
610+ . to_result ( )
611+ }
592612 }
593613
594614 /// Set the given context as the current context for this thread.
0 commit comments