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

Method atomic_load

crates/rustc_codegen_spirv/src/builder/builder_methods.rs:1124–1156  ·  view source on GitHub ↗
(
        &mut self,
        ty: Self::Type,
        ptr: Self::Value,
        order: AtomicOrdering,
        _size: Size,
    )

Source from the content-addressed store, hash-verified

1122 }
1123
1124 fn atomic_load(
1125 &mut self,
1126 ty: Self::Type,
1127 ptr: Self::Value,
1128 order: AtomicOrdering,
1129 _size: Size,
1130 ) -> Self::Value {
1131 let ty = match self.lookup_type(ptr.ty) {
1132 SpirvType::Pointer { pointee } => {
1133 assert_ty_eq!(self, ty, pointee);
1134 pointee
1135 }
1136 ty => self.fatal(&format!(
1137 "atomic_load called on variable that wasn't a pointer: {ty:?}"
1138 )),
1139 };
1140 // TODO: Default to device scope
1141 let memory = self.constant_u32(self.span(), Scope::Device as u32);
1142 let semantics = self.ordering_to_semantics_def(order);
1143 let result = self
1144 .emit()
1145 .atomic_load(
1146 ty,
1147 None,
1148 ptr.def(self),
1149 memory.def(self),
1150 semantics.def(self),
1151 )
1152 .unwrap()
1153 .with_type(ty);
1154 self.validate_atomic(ty, result.def(self));
1155 result
1156 }
1157
1158 fn load_operand(
1159 &mut self,

Callers

nothing calls this directly

Calls 9

lookup_typeMethod · 0.80
fatalMethod · 0.80
constant_u32Method · 0.80
spanMethod · 0.80
with_typeMethod · 0.80
validate_atomicMethod · 0.80
emitMethod · 0.45
defMethod · 0.45

Tested by

no test coverage detected