aboutsummaryrefslogtreecommitdiffhomepage
path: root/zluda/src/impl/context.rs
blob: fffceb82c3af0f281123f7057c48b44905e39247 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use std::ptr;

use crate::cuda::CUlimit;
use crate::cuda::CUresult;

pub(crate) unsafe fn get_limit(pvalue: *mut usize, limit: CUlimit) -> CUresult {
    if pvalue == ptr::null_mut() {
        return CUresult::CUDA_ERROR_INVALID_VALUE;
    }
    if limit == CUlimit::CU_LIMIT_STACK_SIZE {
        *pvalue = 512; // GTX 1060 reports 1024
        CUresult::CUDA_SUCCESS
    } else {
        CUresult::CUDA_ERROR_NOT_SUPPORTED
    }
}

pub(crate) fn set_limit(limit: CUlimit, value: usize) -> CUresult {
    if limit == CUlimit::CU_LIMIT_STACK_SIZE {
        CUresult::CUDA_SUCCESS
    } else {
        CUresult::CUDA_ERROR_NOT_SUPPORTED
    }
}