mirror of
https://github.com/vosen/ZLUDA.git
synced 2025-04-23 18:08:57 +03:00
Handle ld.volatile/st.volatile
This commit is contained in:
@ -2729,16 +2729,19 @@ fn emit_function_body_ops<'input>(
|
|||||||
builder.branch(arg.src)?;
|
builder.branch(arg.src)?;
|
||||||
}
|
}
|
||||||
ast::Instruction::Ld(data, arg) => {
|
ast::Instruction::Ld(data, arg) => {
|
||||||
if data.qualifier != ast::LdStQualifier::Weak {
|
let mem_access = match data.qualifier {
|
||||||
todo!()
|
ast::LdStQualifier::Weak => spirv::MemoryAccess::NONE,
|
||||||
}
|
// ld.volatile does not match Volatile OpLoad nor Relaxed OpAtomicLoad
|
||||||
|
ast::LdStQualifier::Volatile => spirv::MemoryAccess::VOLATILE,
|
||||||
|
_ => return Err(TranslateError::Todo),
|
||||||
|
};
|
||||||
let result_type =
|
let result_type =
|
||||||
map.get_or_add(builder, SpirvType::new(ast::Type::from(data.typ.clone())));
|
map.get_or_add(builder, SpirvType::new(ast::Type::from(data.typ.clone())));
|
||||||
builder.load(
|
builder.load(
|
||||||
result_type,
|
result_type,
|
||||||
Some(arg.dst),
|
Some(arg.dst),
|
||||||
arg.src,
|
arg.src,
|
||||||
Some(spirv::MemoryAccess::ALIGNED),
|
Some(mem_access | spirv::MemoryAccess::ALIGNED),
|
||||||
[dr::Operand::LiteralInt32(
|
[dr::Operand::LiteralInt32(
|
||||||
ast::Type::from(data.typ.clone()).size_of() as u32,
|
ast::Type::from(data.typ.clone()).size_of() as u32,
|
||||||
)]
|
)]
|
||||||
@ -2747,13 +2750,16 @@ fn emit_function_body_ops<'input>(
|
|||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
ast::Instruction::St(data, arg) => {
|
ast::Instruction::St(data, arg) => {
|
||||||
if data.qualifier != ast::LdStQualifier::Weak {
|
let mem_access = match data.qualifier {
|
||||||
todo!()
|
ast::LdStQualifier::Weak => spirv::MemoryAccess::NONE,
|
||||||
}
|
// st.volatile does not match Volatile OpStore nor Relaxed OpAtomicStore
|
||||||
|
ast::LdStQualifier::Volatile => spirv::MemoryAccess::VOLATILE,
|
||||||
|
_ => return Err(TranslateError::Todo),
|
||||||
|
};
|
||||||
builder.store(
|
builder.store(
|
||||||
arg.src1,
|
arg.src1,
|
||||||
arg.src2,
|
arg.src2,
|
||||||
Some(spirv::MemoryAccess::ALIGNED),
|
Some(mem_access | spirv::MemoryAccess::ALIGNED),
|
||||||
[dr::Operand::LiteralInt32(
|
[dr::Operand::LiteralInt32(
|
||||||
ast::Type::from(data.typ.clone()).size_of() as u32,
|
ast::Type::from(data.typ.clone()).size_of() as u32,
|
||||||
)]
|
)]
|
||||||
|
Reference in New Issue
Block a user