aboutsummaryrefslogtreecommitdiffhomepage
path: root/ptx
diff options
context:
space:
mode:
authorAndrzej Janik <[email protected]>2021-06-11 12:36:23 +0200
committerAndrzej Janik <[email protected]>2021-06-11 12:36:23 +0200
commit2198862e76d070abaf013f1a52d8a2a03649434b (patch)
tree9c6c7cc6e6ad5f3273b64be94cb4a02a950fd9c8 /ptx
parentf0771e1fb6bb95e3f22b8bfa3a9efd3bfe88c946 (diff)
downloadZLUDA-2198862e76d070abaf013f1a52d8a2a03649434b.tar.gz
ZLUDA-2198862e76d070abaf013f1a52d8a2a03649434b.zip
Fix handling of kernel args in stateful conversion
Diffstat (limited to 'ptx')
-rw-r--r--ptx/src/translate.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/ptx/src/translate.rs b/ptx/src/translate.rs
index 511d763..dc8cc5a 100644
--- a/ptx/src/translate.rs
+++ b/ptx/src/translate.rs
@@ -4136,10 +4136,13 @@ fn emit_implicit_conversion(
let dst_type = map.get_or_add(builder, SpirvType::new(cv.to_type.clone()));
builder.convert_ptr_to_u(dst_type, Some(cv.dst), cv.src)?;
}
- (TypeKind::Pointer, TypeKind::Scalar, &ConversionKind::Default)
- | (TypeKind::Scalar, TypeKind::Pointer, &ConversionKind::Default) => {
- let dst_type = map.get_or_add(builder, SpirvType::new(cv.to_type.clone()));
- builder.bitcast(dst_type, Some(cv.dst), cv.src)?;
+ (TypeKind::Pointer, TypeKind::Scalar, &ConversionKind::Default) => {
+ let result_type = map.get_or_add(builder, SpirvType::new(cv.to_type.clone()));
+ builder.convert_ptr_to_u(result_type, Some(cv.dst), cv.src)?;
+ }
+ (TypeKind::Scalar, TypeKind::Pointer, &ConversionKind::Default) => {
+ let result_type = map.get_or_add(builder, SpirvType::new(cv.to_type.clone()));
+ builder.convert_u_to_ptr(result_type, Some(cv.dst), cv.src)?;
}
_ => unreachable!(),
}
@@ -4478,7 +4481,7 @@ fn convert_to_stateful_memory_access<'a, 'input>(
for arg in (*method_decl).input_arguments.iter_mut() {
let new_id = id_defs.register_variable(
ast::Type::Pointer(ast::ScalarType::U8, ast::StateSpace::Global),
- ast::StateSpace::Reg,
+ ast::StateSpace::Param,
);
let old_name = arg.name;
if func_args_ptr.contains(&arg.name) {