mirror of
https://github.com/vosen/ZLUDA.git
synced 2025-04-20 00:14:45 +00:00
Remove sreg address space
This commit is contained in:
parent
02cf83ebb9
commit
415639da72
9 changed files with 14 additions and 26 deletions
|
@ -489,7 +489,7 @@ fn convert_to_stateful_memory_access_postprocess(
|
|||
let (old_operand_type, old_operand_space, _) = id_defs.get_typed(operand)?;
|
||||
let converting_id = id_defs
|
||||
.register_intermediate(Some((old_operand_type.clone(), old_operand_space)));
|
||||
let kind = if space_is_compatible(new_operand_space, ast::StateSpace::Reg) {
|
||||
let kind = if new_operand_space == ast::StateSpace::Reg {
|
||||
ConversionKind::Default
|
||||
} else {
|
||||
ConversionKind::PtrToPtr
|
||||
|
|
|
@ -656,7 +656,6 @@ fn get_state_space(space: ast::StateSpace) -> Result<u32, TranslateError> {
|
|||
match space {
|
||||
ast::StateSpace::Reg => Ok(PRIVATE_ADDRESS_SPACE),
|
||||
ast::StateSpace::Generic => Ok(GENERIC_ADDRESS_SPACE),
|
||||
ast::StateSpace::Sreg => Ok(PRIVATE_ADDRESS_SPACE),
|
||||
ast::StateSpace::Param => Err(TranslateError::Todo),
|
||||
ast::StateSpace::ParamEntry => Err(TranslateError::Todo),
|
||||
ast::StateSpace::ParamFunc => Err(TranslateError::Todo),
|
||||
|
|
|
@ -469,7 +469,6 @@ fn space_to_spirv(this: ast::StateSpace) -> spirv::StorageClass {
|
|||
ast::StateSpace::Shared => spirv::StorageClass::Workgroup,
|
||||
ast::StateSpace::Param => spirv::StorageClass::Function,
|
||||
ast::StateSpace::Reg => spirv::StorageClass::Function,
|
||||
ast::StateSpace::Sreg => spirv::StorageClass::Input,
|
||||
ast::StateSpace::ParamEntry
|
||||
| ast::StateSpace::ParamFunc
|
||||
| ast::StateSpace::SharedCluster
|
||||
|
@ -693,7 +692,6 @@ fn emit_variable<'input>(
|
|||
ast::StateSpace::Shared => (false, spirv::StorageClass::Workgroup),
|
||||
ast::StateSpace::Const => (false, spirv::StorageClass::UniformConstant),
|
||||
ast::StateSpace::Generic => todo!(),
|
||||
ast::StateSpace::Sreg => todo!(),
|
||||
ast::StateSpace::ParamEntry
|
||||
| ast::StateSpace::ParamFunc
|
||||
| ast::StateSpace::SharedCluster
|
||||
|
|
|
@ -63,9 +63,9 @@ impl<'a, 'b> FlattenArguments<'a, 'b> {
|
|||
} else {
|
||||
return Err(TranslateError::UntypedSymbol);
|
||||
};
|
||||
if state_space == ast::StateSpace::Reg || state_space == ast::StateSpace::Sreg {
|
||||
if state_space == ast::StateSpace::Reg {
|
||||
let (reg_type, reg_space) = self.id_def.get_typed(reg)?;
|
||||
if !space_is_compatible(reg_space, ast::StateSpace::Reg) {
|
||||
if reg_space != ast::StateSpace::Reg {
|
||||
return Err(error_mismatched_type());
|
||||
}
|
||||
let reg_scalar_type = match reg_type {
|
||||
|
|
|
@ -273,7 +273,6 @@ fn space_to_ptx_name(this: ast::StateSpace) -> &'static str {
|
|||
ast::StateSpace::Const => "const",
|
||||
ast::StateSpace::Local => "local",
|
||||
ast::StateSpace::Param => "param",
|
||||
ast::StateSpace::Sreg => "sreg",
|
||||
ast::StateSpace::SharedCluster => "shared_cluster",
|
||||
ast::StateSpace::ParamEntry => "param_entry",
|
||||
ast::StateSpace::SharedCta => "shared_cta",
|
||||
|
|
|
@ -128,7 +128,7 @@ pub(crate) fn default_implicit_conversion(
|
|||
(instruction_space, instruction_type): (ast::StateSpace, &ast::Type),
|
||||
) -> Result<Option<ConversionKind>, TranslateError> {
|
||||
if instruction_space == ast::StateSpace::Reg {
|
||||
if space_is_compatible(operand_space, ast::StateSpace::Reg) {
|
||||
if operand_space == ast::StateSpace::Reg {
|
||||
if let (ast::Type::Vector(vec_len, vec_underlying_type), ast::Type::Scalar(scalar)) =
|
||||
(operand_type, instruction_type)
|
||||
{
|
||||
|
@ -142,7 +142,7 @@ pub(crate) fn default_implicit_conversion(
|
|||
return Ok(Some(ConversionKind::AddressOf));
|
||||
}
|
||||
}
|
||||
if !space_is_compatible(instruction_space, operand_space) {
|
||||
if instruction_space != operand_space {
|
||||
default_implicit_conversion_space(
|
||||
(operand_space, operand_type),
|
||||
(instruction_space, instruction_type),
|
||||
|
@ -161,7 +161,7 @@ fn is_addressable(this: ast::StateSpace) -> bool {
|
|||
| ast::StateSpace::Global
|
||||
| ast::StateSpace::Local
|
||||
| ast::StateSpace::Shared => true,
|
||||
ast::StateSpace::Param | ast::StateSpace::Reg | ast::StateSpace::Sreg => false,
|
||||
ast::StateSpace::Param | ast::StateSpace::Reg => false,
|
||||
ast::StateSpace::SharedCluster
|
||||
| ast::StateSpace::SharedCta
|
||||
| ast::StateSpace::ParamEntry
|
||||
|
@ -178,7 +178,7 @@ fn default_implicit_conversion_space(
|
|||
|| (operand_space == ast::StateSpace::Generic && coerces_to_generic(instruction_space))
|
||||
{
|
||||
Ok(Some(ConversionKind::PtrToPtr))
|
||||
} else if space_is_compatible(operand_space, ast::StateSpace::Reg) {
|
||||
} else if operand_space == ast::StateSpace::Reg {
|
||||
match operand_type {
|
||||
ast::Type::Pointer(operand_ptr_type, operand_ptr_space)
|
||||
if *operand_ptr_space == instruction_space =>
|
||||
|
@ -210,7 +210,7 @@ fn default_implicit_conversion_space(
|
|||
},
|
||||
_ => Err(error_mismatched_type()),
|
||||
}
|
||||
} else if space_is_compatible(instruction_space, ast::StateSpace::Reg) {
|
||||
} else if instruction_space == ast::StateSpace::Reg {
|
||||
match instruction_type {
|
||||
ast::Type::Pointer(instruction_ptr_type, instruction_ptr_space)
|
||||
if operand_space == *instruction_ptr_space =>
|
||||
|
@ -234,7 +234,7 @@ fn default_implicit_conversion_type(
|
|||
operand_type: &ast::Type,
|
||||
instruction_type: &ast::Type,
|
||||
) -> Result<Option<ConversionKind>, TranslateError> {
|
||||
if space_is_compatible(space, ast::StateSpace::Reg) {
|
||||
if space == ast::StateSpace::Reg {
|
||||
if should_bitcast(instruction_type, operand_type) {
|
||||
Ok(Some(ConversionKind::Default))
|
||||
} else {
|
||||
|
@ -257,8 +257,7 @@ fn coerces_to_generic(this: ast::StateSpace) -> bool {
|
|||
| ast::StateSpace::Param
|
||||
| ast::StateSpace::ParamEntry
|
||||
| ast::StateSpace::ParamFunc
|
||||
| ast::StateSpace::Generic
|
||||
| ast::StateSpace::Sreg => false,
|
||||
| ast::StateSpace::Generic => false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -294,7 +293,7 @@ pub(crate) fn should_convert_relaxed_dst_wrapper(
|
|||
(operand_space, operand_type): (ast::StateSpace, &ast::Type),
|
||||
(instruction_space, instruction_type): (ast::StateSpace, &ast::Type),
|
||||
) -> Result<Option<ConversionKind>, TranslateError> {
|
||||
if !space_is_compatible(operand_space, instruction_space) {
|
||||
if operand_space != instruction_space {
|
||||
return Err(TranslateError::MismatchedType);
|
||||
}
|
||||
if operand_type == instruction_type {
|
||||
|
@ -371,7 +370,7 @@ pub(crate) fn should_convert_relaxed_src_wrapper(
|
|||
(operand_space, operand_type): (ast::StateSpace, &ast::Type),
|
||||
(instruction_space, instruction_type): (ast::StateSpace, &ast::Type),
|
||||
) -> Result<Option<ConversionKind>, TranslateError> {
|
||||
if !space_is_compatible(operand_space, instruction_space) {
|
||||
if operand_space != instruction_space {
|
||||
return Err(error_mismatched_type());
|
||||
}
|
||||
if operand_type == instruction_type {
|
||||
|
|
|
@ -189,7 +189,7 @@ impl<'a, 'input> InsertMemSSAVisitor<'a, 'input> {
|
|||
return Ok(symbol);
|
||||
};
|
||||
let (mut var_type, var_space, is_variable) = self.id_def.get_typed(symbol)?;
|
||||
if !space_is_compatible(var_space, ast::StateSpace::Reg) || !is_variable {
|
||||
if var_space != ast::StateSpace::Reg || !is_variable {
|
||||
return Ok(symbol);
|
||||
};
|
||||
let member_index = match member_index {
|
||||
|
|
|
@ -525,7 +525,7 @@ impl<'b> NumericIdResolver<'b> {
|
|||
Some(Some(x)) => Ok(x.clone()),
|
||||
Some(None) => Err(TranslateError::UntypedSymbol),
|
||||
None => match self.special_registers.get(id) {
|
||||
Some(x) => Ok((x.get_type(), ast::StateSpace::Sreg, true)),
|
||||
Some(x) => Ok((x.get_type(), ast::StateSpace::Reg, true)),
|
||||
None => match self.global_type_check.get(&id) {
|
||||
Some(Some(result)) => Ok(result.clone()),
|
||||
Some(None) | None => Err(TranslateError::UntypedSymbol),
|
||||
|
@ -1207,12 +1207,6 @@ impl<
|
|||
}
|
||||
}
|
||||
|
||||
fn space_is_compatible(this: ast::StateSpace, other: ast::StateSpace) -> bool {
|
||||
this == other
|
||||
|| this == ast::StateSpace::Reg && other == ast::StateSpace::Sreg
|
||||
|| this == ast::StateSpace::Sreg && other == ast::StateSpace::Reg
|
||||
}
|
||||
|
||||
fn register_external_fn_call<'a>(
|
||||
id_defs: &mut NumericIdResolver,
|
||||
ptx_impl_imports: &mut HashMap<String, Directive>,
|
||||
|
|
|
@ -1499,7 +1499,6 @@ derive_parser!(
|
|||
pub enum StateSpace {
|
||||
Reg,
|
||||
Generic,
|
||||
Sreg,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
|
||||
|
|
Loading…
Add table
Reference in a new issue