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

Method atomic_store

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

Source from the content-addressed store, hash-verified

1274 }
1275
1276 fn atomic_store(
1277 &mut self,
1278 val: Self::Value,
1279 ptr: Self::Value,
1280 order: AtomicOrdering,
1281 _size: Size,
1282 ) {
1283 let ptr_elem_ty = match self.lookup_type(ptr.ty) {
1284 SpirvType::Pointer { pointee } => pointee,
1285 ty => self.fatal(&format!(
1286 "atomic_store called on variable that wasn't a pointer: {ty:?}"
1287 )),
1288 };
1289 assert_ty_eq!(self, ptr_elem_ty, val.ty);
1290 // TODO: Default to device scope
1291 let memory = self.constant_u32(self.span(), Scope::Device as u32);
1292 let semantics = self.ordering_to_semantics_def(order);
1293 self.validate_atomic(val.ty, ptr.def(self));
1294 self.emit()
1295 .atomic_store(
1296 ptr.def(self),
1297 memory.def(self),
1298 semantics.def(self),
1299 val.def(self),
1300 )
1301 .unwrap();
1302 }
1303
1304 fn gep(&mut self, ty: Self::Type, ptr: Self::Value, indices: &[Self::Value]) -> Self::Value {
1305 self.gep_help(ty, ptr, indices, false)

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected