mirror of
https://github.com/vosen/ZLUDA.git
synced 2025-07-17 09:16:23 +03:00
Re-enable relaxed conversions
This commit is contained in:
@ -6312,13 +6312,11 @@ impl<T: ArgParamsEx> ast::Arg2Ld<T> {
|
|||||||
ArgumentDescriptor {
|
ArgumentDescriptor {
|
||||||
op: self.dst,
|
op: self.dst,
|
||||||
is_dst: true,
|
is_dst: true,
|
||||||
non_default_implicit_conversion: None,
|
non_default_implicit_conversion: Some(should_convert_relaxed_dst_wrapper),
|
||||||
},
|
},
|
||||||
&ast::Type::from(details.typ.clone()),
|
&ast::Type::from(details.typ.clone()),
|
||||||
ast::StateSpace::Reg,
|
ast::StateSpace::Reg,
|
||||||
)?;
|
)?;
|
||||||
let is_logical_ptr = details.state_space == ast::StateSpace::Param
|
|
||||||
|| details.state_space == ast::StateSpace::Local;
|
|
||||||
let src = visitor.operand(
|
let src = visitor.operand(
|
||||||
ArgumentDescriptor {
|
ArgumentDescriptor {
|
||||||
op: self.src,
|
op: self.src,
|
||||||
@ -6338,8 +6336,6 @@ impl<T: ArgParamsEx> ast::Arg2St<T> {
|
|||||||
visitor: &mut V,
|
visitor: &mut V,
|
||||||
details: &ast::StData,
|
details: &ast::StData,
|
||||||
) -> Result<ast::Arg2St<U>, TranslateError> {
|
) -> Result<ast::Arg2St<U>, TranslateError> {
|
||||||
let is_logical_ptr = details.state_space == ast::StateSpace::Param
|
|
||||||
|| details.state_space == ast::StateSpace::Local;
|
|
||||||
let src1 = visitor.operand(
|
let src1 = visitor.operand(
|
||||||
ArgumentDescriptor {
|
ArgumentDescriptor {
|
||||||
op: self.src1,
|
op: self.src1,
|
||||||
@ -6353,7 +6349,7 @@ impl<T: ArgParamsEx> ast::Arg2St<T> {
|
|||||||
ArgumentDescriptor {
|
ArgumentDescriptor {
|
||||||
op: self.src2,
|
op: self.src2,
|
||||||
is_dst: false,
|
is_dst: false,
|
||||||
non_default_implicit_conversion: None,
|
non_default_implicit_conversion: Some(should_convert_relaxed_src_wrapper),
|
||||||
},
|
},
|
||||||
&details.typ.clone().into(),
|
&details.typ.clone().into(),
|
||||||
ast::StateSpace::Reg,
|
ast::StateSpace::Reg,
|
||||||
@ -6427,7 +6423,6 @@ impl<T: ArgParamsEx> ast::Arg3<T> {
|
|||||||
ArgumentDescriptor {
|
ArgumentDescriptor {
|
||||||
op: self.src2,
|
op: self.src2,
|
||||||
is_dst: false,
|
is_dst: false,
|
||||||
|
|
||||||
non_default_implicit_conversion: None,
|
non_default_implicit_conversion: None,
|
||||||
},
|
},
|
||||||
typ,
|
typ,
|
||||||
@ -6646,7 +6641,7 @@ impl<T: ArgParamsEx> ast::Arg4<T> {
|
|||||||
non_default_implicit_conversion: None,
|
non_default_implicit_conversion: None,
|
||||||
},
|
},
|
||||||
&ast::Type::Scalar(scalar_type),
|
&ast::Type::Scalar(scalar_type),
|
||||||
ast::StateSpace::Reg,
|
state_space,
|
||||||
)?;
|
)?;
|
||||||
let src2 = visitor.operand(
|
let src2 = visitor.operand(
|
||||||
ArgumentDescriptor {
|
ArgumentDescriptor {
|
||||||
@ -7279,15 +7274,16 @@ fn should_bitcast_wrapper(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn should_convert_relaxed_src_wrapper(
|
fn should_convert_relaxed_src_wrapper(
|
||||||
src_type: &ast::Type,
|
(operand_space, operand_type): (ast::StateSpace, &ast::Type),
|
||||||
_: ast::StateSpace,
|
(instruction_space, instruction_type): (ast::StateSpace, &ast::Type),
|
||||||
instr_type: &ast::Type,
|
|
||||||
_: ast::StateSpace,
|
|
||||||
) -> Result<Option<ConversionKind>, TranslateError> {
|
) -> Result<Option<ConversionKind>, TranslateError> {
|
||||||
if src_type == instr_type {
|
if !operand_space.is_compatible(instruction_space) {
|
||||||
|
return Err(TranslateError::MismatchedType);
|
||||||
|
}
|
||||||
|
if operand_type == instruction_type {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
match should_convert_relaxed_src(src_type, instr_type) {
|
match should_convert_relaxed_src(operand_type, instruction_type) {
|
||||||
conv @ Some(_) => Ok(conv),
|
conv @ Some(_) => Ok(conv),
|
||||||
None => Err(TranslateError::MismatchedType),
|
None => Err(TranslateError::MismatchedType),
|
||||||
}
|
}
|
||||||
@ -7343,15 +7339,16 @@ fn should_convert_relaxed_src(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn should_convert_relaxed_dst_wrapper(
|
fn should_convert_relaxed_dst_wrapper(
|
||||||
dst_type: &ast::Type,
|
(operand_space, operand_type): (ast::StateSpace, &ast::Type),
|
||||||
_: ast::StateSpace,
|
(instruction_space, instruction_type): (ast::StateSpace, &ast::Type),
|
||||||
instr_type: &ast::Type,
|
|
||||||
_: ast::StateSpace,
|
|
||||||
) -> Result<Option<ConversionKind>, TranslateError> {
|
) -> Result<Option<ConversionKind>, TranslateError> {
|
||||||
if dst_type == instr_type {
|
if !operand_space.is_compatible(instruction_space) {
|
||||||
|
return Err(TranslateError::MismatchedType);
|
||||||
|
}
|
||||||
|
if operand_type == instruction_type {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
match should_convert_relaxed_dst(dst_type, instr_type) {
|
match should_convert_relaxed_dst(operand_type, instruction_type) {
|
||||||
conv @ Some(_) => Ok(conv),
|
conv @ Some(_) => Ok(conv),
|
||||||
None => Err(TranslateError::MismatchedType),
|
None => Err(TranslateError::MismatchedType),
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user