MCPcopy Create free account
hub / github.com/Rust-GPU/rust-cuda / init

Function init

crates/rustc_codegen_nvvm/src/init.rs:19–36  ·  view source on GitHub ↗
(sess: &Session)

Source from the content-addressed store, hash-verified

17static INIT: Once = Once::new();
18
19pub(crate) fn init(sess: &Session) {
20 unsafe {
21 // Before we touch LLVM, make sure that multithreading is enabled.
22 INIT.call_once(|| {
23 if llvm::LLVMStartMultithreaded() != 1 {
24 // use an extra bool to make sure that all future usage of LLVM
25 // cannot proceed despite the Once not running more than once.
26 POISONED.store(true, Ordering::SeqCst);
27 }
28
29 configure_llvm(sess);
30 });
31
32 if POISONED.load(Ordering::SeqCst) {
33 bug!("couldn't enable multi-threaded LLVM");
34 }
35 }
36}
37
38unsafe fn configure_llvm(sess: &Session) {
39 // TODO(RDambrosio016): We override the meaning of llvm-args to pass our own nvvm args,

Callers 1

initMethod · 0.70

Calls 3

configure_llvmFunction · 0.85
loadMethod · 0.80
storeMethod · 0.45

Tested by

no test coverage detected