diff --git a/ptx/src/pass/convert_to_stateful_memory_access.rs b/ptx/src/pass/convert_to_stateful_memory_access.rs index 455a8c2e..3b8fa938 100644 --- a/ptx/src/pass/convert_to_stateful_memory_access.rs +++ b/ptx/src/pass/convert_to_stateful_memory_access.rs @@ -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 diff --git a/ptx/src/pass/emit_llvm.rs b/ptx/src/pass/emit_llvm.rs index 6df162fd..de85efcf 100644 --- a/ptx/src/pass/emit_llvm.rs +++ b/ptx/src/pass/emit_llvm.rs @@ -656,7 +656,6 @@ fn get_state_space(space: ast::StateSpace) -> Result { 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), diff --git a/ptx/src/pass/emit_spirv.rs b/ptx/src/pass/emit_spirv.rs index 5147b79f..ae4dcfea 100644 --- a/ptx/src/pass/emit_spirv.rs +++ b/ptx/src/pass/emit_spirv.rs @@ -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 diff --git a/ptx/src/pass/expand_arguments.rs b/ptx/src/pass/expand_arguments.rs index d0c7c981..e496c757 100644 --- a/ptx/src/pass/expand_arguments.rs +++ b/ptx/src/pass/expand_arguments.rs @@ -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 { diff --git a/ptx/src/pass/extract_globals.rs b/ptx/src/pass/extract_globals.rs index 680a5eee..29123666 100644 --- a/ptx/src/pass/extract_globals.rs +++ b/ptx/src/pass/extract_globals.rs @@ -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", diff --git a/ptx/src/pass/insert_implicit_conversions.rs b/ptx/src/pass/insert_implicit_conversions.rs index 25e80f05..3249b82e 100644 --- a/ptx/src/pass/insert_implicit_conversions.rs +++ b/ptx/src/pass/insert_implicit_conversions.rs @@ -128,7 +128,7 @@ pub(crate) fn default_implicit_conversion( (instruction_space, instruction_type): (ast::StateSpace, &ast::Type), ) -> Result, 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, 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, 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, TranslateError> { - if !space_is_compatible(operand_space, instruction_space) { + if operand_space != instruction_space { return Err(error_mismatched_type()); } if operand_type == instruction_type { diff --git a/ptx/src/pass/insert_mem_ssa_statements.rs b/ptx/src/pass/insert_mem_ssa_statements.rs index e314b05d..150109ba 100644 --- a/ptx/src/pass/insert_mem_ssa_statements.rs +++ b/ptx/src/pass/insert_mem_ssa_statements.rs @@ -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 { diff --git a/ptx/src/pass/mod.rs b/ptx/src/pass/mod.rs index 3aa3b0a6..3dcbf847 100644 --- a/ptx/src/pass/mod.rs +++ b/ptx/src/pass/mod.rs @@ -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, diff --git a/ptx_parser/src/lib.rs b/ptx_parser/src/lib.rs index f842ace6..fee11aa6 100644 --- a/ptx_parser/src/lib.rs +++ b/ptx_parser/src/lib.rs @@ -1499,7 +1499,6 @@ derive_parser!( pub enum StateSpace { Reg, Generic, - Sreg, } #[derive(Copy, Clone, PartialEq, Eq, Hash)]