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

Function run_thin

crates/rustc_codegen_nvvm/src/lto.rs:100–147  ·  view source on GitHub ↗

essentially does nothing for now.

(
    _cgcx: &CodegenContext<NvvmCodegenBackend>,
    modules: Vec<(String, ThinBuffer)>,
    cached_modules: Vec<(SerializedModule<ModuleBuffer>, WorkProduct)>,
)

Source from the content-addressed store, hash-verified

98
99// essentially does nothing for now.
100pub(crate) fn run_thin(
101 _cgcx: &CodegenContext<NvvmCodegenBackend>,
102 modules: Vec<(String, ThinBuffer)>,
103 cached_modules: Vec<(SerializedModule<ModuleBuffer>, WorkProduct)>,
104) -> Result<(Vec<LtoModuleCodegen<NvvmCodegenBackend>>, Vec<WorkProduct>), FatalError> {
105 debug!("Running thin LTO");
106 let mut thin_buffers = Vec::with_capacity(modules.len());
107 let mut module_names = Vec::with_capacity(modules.len() + cached_modules.len());
108 // let thin_modules = Vec::with_capacity(modules.len() + cached_modules.len());
109
110 for (name, buf) in modules {
111 let cname = CString::new(name.clone()).unwrap();
112 // thin_modules.push(
113 // llvm::ThinLTOModule {
114 // identifier: cname.as_ptr(),
115 // data: buf.data().as_ptr(),
116 // len: buf.data().len()
117 // }
118 // );
119 thin_buffers.push(buf);
120 module_names.push(cname);
121 }
122
123 let mut serialized_modules = Vec::with_capacity(cached_modules.len());
124
125 for (sm, wp) in cached_modules {
126 let _slice_u8 = sm.data();
127 serialized_modules.push(sm);
128 module_names.push(CString::new(wp.cgu_name).unwrap());
129 }
130
131 let shared = Arc::new(ThinShared {
132 data: (),
133 thin_buffers,
134 serialized_modules,
135 module_names,
136 });
137
138 let mut opt_jobs = vec![];
139 for (module_index, _) in shared.module_names.iter().enumerate() {
140 opt_jobs.push(LtoModuleCodegen::Thin(ThinModule {
141 shared: shared.clone(),
142 idx: module_index,
143 }));
144 }
145
146 Ok((opt_jobs, vec![]))
147}
148
149pub(crate) unsafe fn optimize_thin(
150 cgcx: &CodegenContext<NvvmCodegenBackend>,

Callers 1

run_thin_ltoMethod · 0.85

Calls 6

newFunction · 0.85
iterMethod · 0.80
lenMethod · 0.45
cloneMethod · 0.45
pushMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected