Conversation
| _args: &[OperandRef<'tcx, Self::Value>], | ||
| _is_cleanup: bool, | ||
| ) -> Self::Value { | ||
| bug!("LLVM intrinsic call not supported in SPIR-V backend: {instance:?}") |
There was a problem hiding this comment.
I think we want to use this rather than our own home-grown replacements, but didn't want to do it in this PR.
14cdf92 to
6434ab8
Compare
|
|
|
Tried to update with a patched Details |
|
Cool, I'll take a look. There were some changes in this area. |
There was a problem hiding this comment.
I wonder whether this is still needed? After #148789, we can simply detect Arguments::from_str if the argument is a const str.
There was a problem hiding this comment.
panic and panic_nounwind use Arguments::from_str. But panic_display / unreachable_display still go through format_args and panic_bounds_check also formats dynamic values. So I think we need both.
|
|
||
| let value = match name { | ||
| sym::likely | sym::unlikely => { | ||
| _ if name == sym::unlikely || name.as_str() == "likely" => { |
There was a problem hiding this comment.
Is there any reason for this change?
There was a problem hiding this comment.
sym::likely was removed, now checking it a different way.
2fe48e0 to
db063f6
Compare
|
@nazar-pc I think what you saw should be fixed. |
|
Yes, clippy is happy now, tests are passing too |
| let _pointee = match self.lookup_type(ty) { | ||
| SpirvType::Pointer { pointee } => pointee, | ||
| other => self.tcx.dcx().fatal(format!( | ||
| "GlobalAlloc::Memory type not implemented: {}", | ||
| other.debug(ty, self) | ||
| )), | ||
| }; |
There was a problem hiding this comment.
Seems odd to keep this if this isn't being used anymore.
| let _pointee = match self.lookup_type(ty) { | ||
| SpirvType::Pointer { pointee } => pointee, | ||
| other => self.tcx.dcx().fatal(format!( | ||
| "GlobalAlloc::VTable type not implemented: {}", | ||
| other.debug(ty, self) | ||
| )), | ||
| }; |
| let alloc_size = alloc.inner().size(); | ||
| if alloc_size.bytes() % elem_size.bytes() != 0 { | ||
| return None; | ||
| } |
There was a problem hiding this comment.
This would be an error right? Would it make sense to silently do nothing here?
| #[allow(deprecated)] | ||
| let attrs = AggregatedSpirvAttributes::parse(self, self.tcx.get_all_attrs(def_id)); |
There was a problem hiding this comment.
Maybe use get_attrs_by_path?
| @@ -86,6 +101,12 @@ pub(crate) fn provide(providers: &mut Providers) { | |||
| arg.mode = PassMode::Ignore; | |||
| } | |||
|
|
|||
| // SPIR-V backend lowers arguments by-value and cannot handle | |||
| // backend-specific indirection/casts at this layer. | |||
| if matches!(arg.mode, PassMode::Cast { .. } | PassMode::Indirect { .. }) { | |||
| arg.mode = PassMode::Direct(ArgAttributes::new()); | |||
| } | |||
There was a problem hiding this comment.
There's an make_direct_deprecated above this here. Seems to be duplication?
| // FIXME(eddyb) it should be possible to arena-allocate a | ||
| // `&str` directly, but it would require upstream changes, | ||
| // and strings are handled by string interning in `rustc`. | ||
| fn arena_alloc_slice<'tcx, T: Copy>( | ||
| dropless_arena: &'tcx DroplessArena, | ||
| xs: &[T], | ||
| ) -> &'tcx [T] { | ||
| if xs.is_empty() { | ||
| &[] | ||
| } else { | ||
| dropless_arena.alloc_slice(xs) | ||
| } | ||
| } | ||
| str::from_utf8(arena_alloc_slice(self.dropless_arena, file_name.as_bytes())) | ||
| .unwrap() |
There was a problem hiding this comment.
| #![feature(box_patterns)] | ||
| #![feature(file_buffered)] | ||
| #![feature(if_let_guard)] | ||
| #![cfg_attr(bootstrap, feature(if_let_guard))] |
There was a problem hiding this comment.
I don't think rustc_codegen_spirv ever needs cfg(bootstrap). Should just remove the features that are stabilized?
| #![feature(string_from_utf8_lossy_owned)] | ||
| #![feature(trait_alias)] | ||
| #![feature(try_blocks)] | ||
| #![cfg_attr(rustc_codegen_spirv_disable_pqp_cg_ssa, allow(unused_features))] |
There was a problem hiding this comment.
Might need some elaboration here, which are unused features if we disable pqp_cg_ssa? Would it be fine to cfg those features instead?
| fn target_machine_factory( | ||
| &self, | ||
| _sess: &Session, | ||
| _opt_level: config::OptLevel, | ||
| _target_features: &[String], | ||
| ) -> TargetMachineFactoryFn<Self> { | ||
| Arc::new(|_, _| ()) | ||
| } |
There was a problem hiding this comment.
This should be put at the bottom of the trait impl as an uninteresting method
| fs::write(out_dir.join("pqp_cg_ssa.rs"), pqp_cg_ssa_top_level)?; | ||
|
|
||
| println!("cargo::rustc-check-cfg=cfg(rustc_codegen_spirv_disable_pqp_cg_ssa)"); | ||
| println!("cargo::rustc-check-cfg=cfg(bootstrap)"); |
Requires #542