aboutsummaryrefslogtreecommitdiffhomepage
path: root/zluda/src/impl/context.rs
diff options
context:
space:
mode:
Diffstat (limited to 'zluda/src/impl/context.rs')
-rw-r--r--zluda/src/impl/context.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/zluda/src/impl/context.rs b/zluda/src/impl/context.rs
index b16467a..d1b3e7b 100644
--- a/zluda/src/impl/context.rs
+++ b/zluda/src/impl/context.rs
@@ -222,6 +222,20 @@ pub(crate) fn set_limit(limit: hipLimit_t, value: usize) -> Result<(), CUresult>
Ok(())
}
+pub(crate) fn set_flags(flags: u32) -> Result<(), CUresult> {
+ with_current(|ctx| match ctx.variant {
+ ContextVariant::NonPrimary(ref context) => {
+ context
+ .flags
+ .store(flags, std::sync::atomic::Ordering::SeqCst);
+ Ok(())
+ }
+ // This looks stupid, but this is an actual CUDA behavior,
+ // see primary_context.rs test
+ ContextVariant::Primary(_) => Ok(()),
+ })?
+}
+
pub(crate) unsafe fn get_api_version(ctx: *mut Context, version: *mut u32) -> Result<(), CUresult> {
if ctx == ptr::null_mut() {
return Err(CUresult::CUDA_ERROR_INVALID_CONTEXT);