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

Function run_thin

crates/rustc_codegen_spirv/src/link.rs:592–638  ·  view source on GitHub ↗

As of right now, this is essentially a no-op, just plumbing through all the files. TODO: WorkProduct impl

(
    cgcx: &CodegenContext<SpirvCodegenBackend>,
    modules: Vec<(String, SpirvThinBuffer)>,
    cached_modules: Vec<(SerializedModule<SpirvModuleBuffer>, WorkProduct)>,
)

Source from the content-addressed store, hash-verified

590/// As of right now, this is essentially a no-op, just plumbing through all the files.
591// TODO: WorkProduct impl
592pub(crate) fn run_thin(
593 cgcx: &CodegenContext<SpirvCodegenBackend>,
594 modules: Vec<(String, SpirvThinBuffer)>,
595 cached_modules: Vec<(SerializedModule<SpirvModuleBuffer>, WorkProduct)>,
596) -> Result<(Vec<LtoModuleCodegen<SpirvCodegenBackend>>, Vec<WorkProduct>), FatalError> {
597 if cgcx.opts.cg.linker_plugin_lto.enabled() {
598 unreachable!("We should never reach this case if the LTO step is deferred to the linker");
599 }
600 if cgcx.lto != Lto::ThinLocal {
601 for _ in cgcx.each_linked_rlib_for_lto.iter() {
602 bug!("TODO: Implement whatever the heck this is");
603 }
604 }
605 let mut thin_buffers = Vec::with_capacity(modules.len());
606 let mut module_names = Vec::with_capacity(modules.len() + cached_modules.len());
607
608 for (name, buffer) in modules {
609 let cname = CString::new(name.clone()).unwrap();
610 thin_buffers.push(buffer);
611 module_names.push(cname);
612 }
613
614 let mut serialized_modules = Vec::with_capacity(cached_modules.len());
615
616 for (sm, wp) in cached_modules {
617 let _slice_u8 = sm.data();
618 serialized_modules.push(sm);
619 module_names.push(CString::new(wp.cgu_name).unwrap());
620 }
621
622 let shared = Arc::new(ThinShared {
623 data: (),
624 thin_buffers,
625 serialized_modules,
626 module_names,
627 });
628
629 let mut opt_jobs = vec![];
630 for (module_index, _) in shared.module_names.iter().enumerate() {
631 opt_jobs.push(LtoModuleCodegen::Thin(ThinModule {
632 shared: shared.clone(),
633 idx: module_index,
634 }));
635 }
636
637 Ok((opt_jobs, vec![]))
638}

Callers 1

run_thin_ltoMethod · 0.85

Calls 2

iterMethod · 0.80
dataMethod · 0.80

Tested by

no test coverage detected