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

Method to_concrete

crates/rustc_codegen_spirv/src/linker/specializer.rs:480–500  ·  view source on GitHub ↗

Apply `generic_args` to all the `ConcreteOrParam`s in this `Replacements` (i.e. replacing `Param(i)` with `generic_args[i]`), producing a stream of "replace the operand at `OperandLocation` with this concrete `CopyOperand`". The `concrete_instance_id` closure should look up and/or allocate an ID for a specific concrete `Instance`.

(
        &'a self,
        generic_args: &'a [CopyOperand],
        mut concrete_instance_id: impl FnMut(Instance<SmallVec<[CopyOperand; 4]>>) -> Word + 'a,
    )

Source from the content-addressed store, hash-verified

478 /// The `concrete_instance_id` closure should look up and/or allocate an ID
479 /// for a specific concrete `Instance`.
480 fn to_concrete<'a>(
481 &'a self,
482 generic_args: &'a [CopyOperand],
483 mut concrete_instance_id: impl FnMut(Instance<SmallVec<[CopyOperand; 4]>>) -> Word + 'a,
484 ) -> impl Iterator<Item = (OperandLocation, CopyOperand)> + 'a {
485 self.with_instance
486 .iter()
487 .flat_map(move |(instance, locations)| {
488 let concrete = CopyOperand::IdRef(concrete_instance_id(
489 instance
490 .as_ref()
491 .map_generic_args(|x| x.apply_generic_args(generic_args)),
492 ));
493 locations.iter().map(move |&loc| (loc, concrete))
494 })
495 .chain(
496 self.with_concrete_or_param
497 .iter()
498 .map(move |&(loc, x)| (loc, x.apply_generic_args(generic_args))),
499 )
500 }
501}
502
503/// Computed "generic" shape for a SPIR-V global/function. In the interest of efficient

Callers 3

specializeFunction · 0.80
propagate_instancesMethod · 0.80
expand_moduleMethod · 0.80

Calls 4

iterMethod · 0.80
map_generic_argsMethod · 0.80
apply_generic_argsMethod · 0.80
as_refMethod · 0.45

Tested by

no test coverage detected